From 43a57774d9e9fb1a9fe362766334d98f80c9a906 Mon Sep 17 00:00:00 2001 From: "df@pippilotta.erinye.com" <> Date: Fri, 9 Mar 2007 10:17:21 +0100 Subject: [PATCH 01/17] BUG#25601 Missing m4 macro MYSQL_CHECK_TIME_T --- config/ac-macros/misc.m4 | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/config/ac-macros/misc.m4 b/config/ac-macros/misc.m4 index d8199f5970e..09081fb3eac 100644 --- a/config/ac-macros/misc.m4 +++ b/config/ac-macros/misc.m4 @@ -790,3 +790,27 @@ esac AC_SUBST(AR) AC_SUBST(ARFLAGS) ]) + +dnl +dnl Macro to check time_t range: according to C standard +dnl array index must be greater than 0 => if time_t is signed, +dnl the code in the macros below won't compile. +dnl + +AC_DEFUN([MYSQL_CHECK_TIME_T],[ + AC_MSG_CHECKING(if time_t is unsigned) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [[ +#include + ]], + [[ + int array[(((time_t)-1) > 0) ? 1 : -1]; + ]] ) + ], [ + AC_DEFINE([TIME_T_UNSIGNED], 1, [Define to 1 if time_t is unsigned]) + AC_MSG_RESULT(yes) + ], + [AC_MSG_RESULT(no)] + ) +]) + From 22cb4e46ded3ca0e53500ff00e6c6b5418d68cfc Mon Sep 17 00:00:00 2001 From: "df@pippilotta.erinye.com" <> Date: Mon, 2 Apr 2007 15:19:06 +0200 Subject: [PATCH 02/17] build fix for bug#27049 --- mysql-test/t/mysqlbinlog.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index 9a27c4cbdb2..ef314bced71 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -205,7 +205,7 @@ select hex(a) from t1; drop table t1; flush logs; --replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR ---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000010 +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000010 --echo End of 5.0 tests From 062ccf6905bbac5011deb617be50de4ac48c3d3e Mon Sep 17 00:00:00 2001 From: "df@pippilotta.erinye.com" <> Date: Mon, 2 Apr 2007 15:20:46 +0200 Subject: [PATCH 03/17] BUG#27489 build fix --- scripts/make_binary_distribution.sh | 43 +++++++++++++++++++---------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index eab3af29ad1..9101f7f0948 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -54,6 +54,21 @@ for arg do esac done +# Avoid too long command lines for cp (bug#27489) +MCP() { + for i + do + last=$i + done + for i + do + if test "x$i" != "x$last" + then + cp -p $i $last + fi + done +} + # Remove vendor from $system system=`echo $system | sed -e 's/[a-z]*-\(.*\)/\1/g'` @@ -253,25 +268,25 @@ copyfileto $BASE/mysql-test \ mysql-test/valgrind.supp \ netware/mysql_test_run.nlm netware/install_test_db.ncf -$CP mysql-test/lib/*.pl $BASE/mysql-test/lib -$CP mysql-test/t/*.def $BASE/mysql-test/t -$CP mysql-test/include/*.inc $BASE/mysql-test/include -$CP mysql-test/include/*.test $BASE/mysql-test/include -$CP mysql-test/t/*.def $BASE/mysql-test/t -$CP mysql-test/std_data/*.dat mysql-test/std_data/*.frm \ +MCP mysql-test/lib/*.pl $BASE/mysql-test/lib +MCP mysql-test/t/*.def $BASE/mysql-test/t +MCP mysql-test/include/*.inc $BASE/mysql-test/include +MCP mysql-test/include/*.test $BASE/mysql-test/include +MCP mysql-test/t/*.def $BASE/mysql-test/t +MCP mysql-test/std_data/*.dat mysql-test/std_data/*.frm \ mysql-test/std_data/*.MYD mysql-test/std_data/*.MYI \ mysql-test/std_data/*.pem mysql-test/std_data/Moscow_leap \ mysql-test/std_data/des_key_file mysql-test/std_data/*.*001 \ mysql-test/std_data/*.cnf mysql-test/std_data/*.MY* \ $BASE/mysql-test/std_data -$CP mysql-test/t/*.test $BASE/mysql-test/t -$CP mysql-test/t/*.imtest mysql-test/t/*.disabled $BASE/mysql-test/t -$CP mysql-test/t/*.opt mysql-test/t/*.slave-mi $BASE/mysql-test/t -$CP mysql-test/t/*.sh mysql-test/t/*.sql $BASE/mysql-test/t -$CP mysql-test/r/*.result $BASE/mysql-test/r -$CP mysql-test/r/*.require $BASE/mysql-test/r -$CP mysql-test/extra/binlog_tests/*.test $BASE/mysql-test/extra/binlog_tests -$CP mysql-test/extra/rpl_tests/*.test $BASE/mysql-test/extra/rpl_tests +MCP mysql-test/t/*.test $BASE/mysql-test/t +MCP mysql-test/t/*.imtest mysql-test/t/*.disabled $BASE/mysql-test/t +MCP mysql-test/t/*.opt mysql-test/t/*.slave-mi $BASE/mysql-test/t +MCP mysql-test/t/*.sh mysql-test/t/*.sql $BASE/mysql-test/t +MCP mysql-test/r/*.result $BASE/mysql-test/r +MCP mysql-test/r/*.require $BASE/mysql-test/r +MCP mysql-test/extra/binlog_tests/*.test $BASE/mysql-test/extra/binlog_tests +MCP mysql-test/extra/rpl_tests/*.test $BASE/mysql-test/extra/rpl_tests if [ $BASE_SYSTEM != "netware" ] ; then chmod a+x $BASE/bin/* From 48edd02fba2e431df243cd461f87f43b224ce4e4 Mon Sep 17 00:00:00 2001 From: "df@pippilotta.erinye.com" <> Date: Mon, 2 Apr 2007 15:36:59 +0200 Subject: [PATCH 04/17] BUG#25303 log_state fails --- sql/set_var.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/set_var.cc b/sql/set_var.cc index fef6fccfd06..a0869fb2984 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -875,7 +875,7 @@ SHOW_VAR init_vars[]= { #ifdef HAVE_REPLICATION {"log_slave_updates", (char*) &opt_log_slave_updates, SHOW_MY_BOOL}, #endif - {"log_slow_queries", (char*) &opt_slow_log, SHOW_BOOL}, + {"log_slow_queries", (char*) &opt_slow_log, SHOW_MY_BOOL}, {sys_log_warnings.name, (char*) &sys_log_warnings, SHOW_SYS}, {sys_long_query_time.name, (char*) &sys_long_query_time, SHOW_SYS}, {sys_low_priority_updates.name, (char*) &sys_low_priority_updates, SHOW_SYS}, From e572025bc10a332fd0498ad7fe97fe93e3c844a9 Mon Sep 17 00:00:00 2001 From: "df@pippilotta.erinye.com" <> Date: Mon, 2 Apr 2007 18:08:11 +0200 Subject: [PATCH 05/17] fix previous mysqlbinlog test case fix --- mysql-test/r/mysqlbinlog.result | 14 +++++++------- mysql-test/t/mysqlbinlog.test | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index 5a7dcca2420..57961698034 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -290,23 +290,23 @@ SET @@session.sql_mode=0/*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; create table t1 (a varchar(64) character set utf8)/*!*/; SET TIMESTAMP=1000000000/*!*/; -load data LOCAL INFILE 'MYSQL_TMP_DIR/SQL_LOAD_MB-6-0' INTO table t1/*!*/; +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-6-0' INTO table t1/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.collation_database=7/*!*/; -load data LOCAL INFILE 'MYSQL_TMP_DIR/SQL_LOAD_MB-7-0' INTO table t1/*!*/; +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-7-0' INTO table t1/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.collation_database=DEFAULT/*!*/; -load data LOCAL INFILE 'MYSQL_TMP_DIR/SQL_LOAD_MB-8-0' INTO table t1/*!*/; +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-8-0' INTO table t1/*!*/; SET TIMESTAMP=1000000000/*!*/; -load data LOCAL INFILE 'MYSQL_TMP_DIR/SQL_LOAD_MB-9-0' INTO table t1/*!*/; +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-9-0' INTO table t1/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.collation_database=7/*!*/; -load data LOCAL INFILE 'MYSQL_TMP_DIR/SQL_LOAD_MB-a-0' INTO table t1/*!*/; +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-a-0' INTO table t1/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.collation_database=DEFAULT/*!*/; -load data LOCAL INFILE 'MYSQL_TMP_DIR/SQL_LOAD_MB-b-0' INTO table t1/*!*/; +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-b-0' INTO table t1/*!*/; SET TIMESTAMP=1000000000/*!*/; -load data LOCAL INFILE 'MYSQL_TMP_DIR/SQL_LOAD_MB-c-0' INTO table t1 character set koi8r/*!*/; +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-c-0' INTO table t1 character set koi8r/*!*/; SET TIMESTAMP=1000000000/*!*/; drop table t1/*!*/; DELIMITER ; diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index ef314bced71..630e56ccfd1 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -204,7 +204,7 @@ load data infile '../std_data_ln/loaddata6.dat' into table t1 character set koi8 select hex(a) from t1; drop table t1; flush logs; ---replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000010 --echo End of 5.0 tests From 6ed21ea834e7672475e51c3b3e4f09ab84cfde6f Mon Sep 17 00:00:00 2001 From: "df@pippilotta.erinye.com" <> Date: Tue, 3 Apr 2007 18:04:24 +0200 Subject: [PATCH 06/17] no Max rpms anymore, but a debug binary --- support-files/mysql.spec.sh | 179 +++++++++++++----------------------- 1 file changed, 64 insertions(+), 115 deletions(-) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index ce1335e1bc4..61682428046 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -14,7 +14,7 @@ # Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston # MA 02110-1301 USA. -%define mysql_version @VERSION@ +%define mysql_version @VERSION@ # use "rpmbuild --with static" or "rpm --define '_with_static 1'" (for RPM 3.x) # to enable static linking (off by default) @@ -32,10 +32,10 @@ %define release 0.glibc23 %endif %define license GPL -%define mysqld_user mysql -%define mysqld_group mysql -%define server_suffix -standard -%define mysqldatadir /var/lib/mysql +%define mysqld_user mysql +%define mysqld_group mysql +%define server_suffix -community +%define mysqldatadir /var/lib/mysql # We don't package all files installed into the build root by intention - # See BUG#998 for details. @@ -99,7 +99,7 @@ Summary: MySQL: a very fast and reliable SQL database server Group: Applications/Databases Requires: coreutils grep procps /usr/sbin/useradd /usr/sbin/groupadd /sbin/chkconfig Provides: msqlormysql mysql-server mysql MySQL -Obsoletes: MySQL mysql mysql-server +Obsoletes: MySQL mysql mysql-server mysql-Max %description server The MySQL(TM) software delivers a very fast, multi-threaded, multi-user, @@ -120,7 +120,7 @@ This package includes the MySQL server binary (incl. InnoDB) as well as related utilities to run and administrate a MySQL server. If you want to access and work with the database, you have to install -package "MySQL-client" as well! +the package "MySQL-client" as well! %package client Summary: MySQL - Client @@ -141,8 +141,6 @@ Group: Applications/Databases This package contains the ndbcluster storage engine. It is necessary to have this package installed on all computers that should store ndbcluster table data. -Note that this storage engine can only be used in conjunction -with the MySQL Max server. %{see_base} @@ -211,29 +209,6 @@ Obsoletes: mysql-shared This package contains the shared libraries (*.so*) which certain languages and applications need to dynamically load and use MySQL. -%package Max -Summary: MySQL - server with extended functionality -Group: Applications/Databases -Provides: mysql-Max -Obsoletes: mysql-Max -Requires: MySQL-server >= @MYSQL_BASE_VERSION@ - -%description Max -Optional MySQL server binary that supports additional features like: - - - Berkeley DB Storage Engine - - Ndbcluster Storage Engine interface - - Archive Storage Engine - - CSV Storage Engine - - Example Storage Engine - - Federated Storage Engine - - User Defined Functions (UDFs). - -To activate this binary, just install this package in addition to -the standard MySQL package. - -Please note that this is a dynamically linked binary! - #%package embedded #Requires: %{name}-devel #Summary: MySQL - embedded library @@ -323,9 +298,6 @@ mkdir -p $RBR%{_libdir}/mysql PATH=${MYSQL_BUILD_PATH:-/bin:/usr/bin} export PATH -# Build the Max binary (includes BDB and UDFs and therefore -# cannot be linked statically against the patched glibc) - # Use gcc for C and C++ code (to avoid a dependency on libstdc++ and # including exceptions into the code if [ -z "$CXX" -a -z "$CC" ] @@ -334,81 +306,48 @@ then export CXX="gcc" fi -BuildMySQL "--enable-shared \ - --with-extra-charsets=all \ - --with-berkeley-db \ - --with-innodb \ - --with-ndbcluster \ - --with-archive-storage-engine \ - --with-csv-storage-engine \ - --with-example-storage-engine \ - --with-blackhole-storage-engine \ - --with-federated-storage-engine \ - --with-big-tables \ - --with-comment=\"MySQL Community Edition - Experimental (GPL)\" \ - --with-server-suffix='-max'" - -# We might want to save the config log file -if test -n "$MYSQL_MAXCONFLOG_DEST" -then - cp -fp config.log "$MYSQL_MAXCONFLOG_DEST" -fi - -( cd mysql-test - MTR_BUILD_THREAD=auto - export MTR_BUILD_THREAD - perl ./mysql-test-run.pl --force --report-features - perl ./mysql-test-run.pl --force --ps-protocol - true ) - -# Save mysqld-max -./libtool --mode=execute cp sql/mysqld sql/mysqld-max -./libtool --mode=execute nm --numeric-sort sql/mysqld-max > sql/mysqld-max.sym - -# Save the perror binary so it supports the NDB error codes (BUG#13740) -./libtool --mode=execute cp extra/perror extra/perror.ndb - -# Install the ndb binaries -(cd ndb; make install DESTDIR=$RBR) - -# Include libgcc.a in the devel subpackage (BUG 4921) -if expr "$CC" : ".*gcc.*" > /dev/null ; -then - libgcc=`$CC $CFLAGS --print-libgcc-file` - if [ -f $libgcc ] - then - %define have_libgcc 1 - install -m 644 $libgcc $RBR%{_libdir}/mysql/libmygcc.a - fi -fi - -# Save libraries -(cd libmysql/.libs; tar cf $RBR/shared-libs.tar *.so*) -(cd libmysql_r/.libs; tar rf $RBR/shared-libs.tar *.so*) -(cd ndb/src/.libs; tar rf $RBR/shared-libs.tar *.so*) - -# Now clean up -make clean - # # Only link statically on our i386 build host (which has a specially # patched static glibc installed) - ia64 and x86_64 run glibc-2.3 (unpatched) # so don't link statically there # -BuildMySQL "--disable-shared \ +for servertype in '--with-debug=full' ' ' +do + BuildMySQL "\ %if %{STATIC_BUILD} + --disable-shared \ --with-mysqld-ldflags='-all-static' \ --with-client-ldflags='-all-static' \ $USE_OTHER_LIBC_DIR \ %else + --enable-shared \ --with-zlib-dir=bundled \ %endif --with-extra-charsets=complex \ - --with-comment=\"MySQL Community Edition - Standard (GPL)\" \ + --with-comment=\"MySQL Community Edition (GPL)\" \ --with-server-suffix='%{server_suffix}' \ --with-archive-storage-engine \ --with-innodb \ - --with-big-tables" + --with-ndbcluster \ + --with-csv-storage-engine \ + --with-example-storage-engine \ + --with-blackhole-storage-engine \ + --with-federated-storage-engine \ + --with-big-tables $servertype" + if test "$servertype" != ' ' + then + # if this is not the regular build, we save the server binary + ./libtool --mode=execute cp sql/mysqld sql/mysqld-debug + ./libtool --mode=execute nm --numeric-sort sql/mysqld-debug > sql/mysqld-debug.sym + echo "# debug" + ( cd mysql-test + MTR_BUILD_THREAD=auto + export MTR_BUILD_THREAD + perl ./mysql-test-run.pl --force --report-features + true ) + make clean + fi +done ./libtool --mode=execute nm --numeric-sort sql/mysqld > sql/mysqld.sym @@ -418,6 +357,7 @@ then cp -fp config.log "$MYSQL_CONFLOG_DEST" fi +echo "# standard" ( cd mysql-test MTR_BUILD_THREAD=auto export MTR_BUILD_THREAD @@ -438,22 +378,33 @@ install -d $RBR%{_libdir} install -d $RBR%{_mandir} install -d $RBR%{_sbindir} - # Install all binaries stripped make install-strip DESTDIR=$RBR benchdir_root=%{_datadir} +# Install the ndb binaries +(cd ndb; make install DESTDIR=$RBR) + +# Install the saved debug server +install -s -m 755 $MBD/sql/mysqld-debug $RBR%{_sbindir}/mysqld-debug + # Install shared libraries (Disable for architectures that don't support it) -(cd $RBR%{_libdir}; tar xf $RBR/shared-libs.tar; rm -f $RBR/shared-libs.tar) +# (cd $RBR%{_libdir}; tar xf $RBR/shared-libs.tar; rm -f $RBR/shared-libs.tar) -# install saved mysqld-max -install -s -m 755 $MBD/sql/mysqld-max $RBR%{_sbindir}/mysqld-max - -# install saved perror binary with NDB support (BUG#13740) -install -s -m 755 $MBD/extra/perror.ndb $RBR%{_bindir}/perror +# Include libgcc.a in the devel subpackage (BUG 4921) +if expr "$CC" : ".*gcc.*" > /dev/null ; +then + libgcc=`$CC $CFLAGS --print-libgcc-file` + if [ -f $libgcc ] + then + %define have_libgcc 1 + install -m 644 $libgcc $RBR%{_libdir}/mysql/libmygcc.a + fi +fi # install symbol files ( for stack trace resolution) -install -m 644 $MBD/sql/mysqld-max.sym $RBR%{_libdir}/mysql/mysqld-max.sym +# install -m 644 $MBD/sql/mysqld-max.sym $RBR%{_libdir}/mysql/mysqld-max.sym install -m 644 $MBD/sql/mysqld.sym $RBR%{_libdir}/mysql/mysqld.sym +install -m 644 $MBD/sql/mysqld-debug.sym $RBR%{_libdir}/mysql/mysqld-debug.sym # Install logrotate and autostart install -m 644 $MBD/support-files/mysql-log-rotate $RBR%{_sysconfdir}/logrotate.d/mysql @@ -539,19 +490,12 @@ chmod -R og-rw $mysql_datadir/mysql # Allow safe_mysqld to start mysqld and print a message before we exit sleep 2 - %post ndb-storage mysql_clusterdir=/var/lib/mysql-cluster # Create cluster directory if needed if test ! -d $mysql_clusterdir; then mkdir -m 755 $mysql_clusterdir; fi - -%post Max -# Restart mysqld, to use the new binary. -echo "Restarting mysqld." -%{_sysconfdir}/init.d/mysql restart > /dev/null 2>&1 - %preun server if test $1 = 0 then @@ -644,6 +588,7 @@ fi %attr(755, root, root) %{_bindir}/safe_mysqld %attr(755, root, root) %{_sbindir}/mysqld +%attr(755, root, root) %{_sbindir}/mysqld-debug %attr(755, root, root) %{_sbindir}/mysqlmanager %attr(755, root, root) %{_sbindir}/rcmysql %attr(644, root, root) %{_libdir}/mysql/mysqld.sym @@ -772,11 +717,6 @@ fi %doc %attr(644, root, man) %{_mandir}/man1/mysql-stress-test.pl.1* %doc %attr(644, root, man) %{_mandir}/man1/mysql-test-run.pl.1* -%files Max -%defattr(-, root, root, 0755) -%attr(755, root, root) %{_sbindir}/mysqld-max -%attr(644, root, root) %{_libdir}/mysql/mysqld-max.sym - #%files embedded #%defattr(-, root, root, 0755) # %attr(644, root, root) %{_libdir}/mysql/libmysqld.a @@ -784,7 +724,16 @@ fi # The spec file changelog only includes changes made to the spec file # itself - note that they must be ordered by date (important when # merging BK trees) -%changelog +%changelog +* Wed Mar 21 2007 Daniel Fischer + +- Add debug server. + +* Mon Mar 19 2007 Daniel Fischer + +- Remove Max RPMs; the server RPMs contain a mysqld compiled with all + features that previously only were built into Max. + * Fri Mar 02 2007 Joerg Bruehe - Add several man pages for NDB which are now created. From 817670eeeeb4a9fdde13bd411a5d7545d3f478b1 Mon Sep 17 00:00:00 2001 From: "df@pippilotta.erinye.com" <> Date: Wed, 4 Apr 2007 14:19:47 +0200 Subject: [PATCH 07/17] build fixes for 5.1.17 --- CMakeLists.txt | 8 ++++++++ scripts/make_win_bin_dist | 28 +++++++++++++++++++++------- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index eb4d77db73f..ab7a7887c94 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,6 +114,14 @@ IF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}) + STRING(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELWITHDEBINFO + ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}) + STRING(REPLACE "/MD" "/MT" CMAKE_C_FLAGS_RELWITHDEBINFO + ${CMAKE_C_FLAGS_RELWITHDEBINFO}) + + # generate .map files + SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MAP /MAPINFO:EXPORTS") + # remove support for Exception handling STRING(REPLACE "/GX" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) diff --git a/scripts/make_win_bin_dist b/scripts/make_win_bin_dist index 146dcad95f1..9916d71e724 100755 --- a/scripts/make_win_bin_dist +++ b/scripts/make_win_bin_dist @@ -126,6 +126,15 @@ if [ -e $DESTDIR ] ; then usage fi +# ---------------------------------------------------------------------- +# Adjust target name if needed, release with debug info has another name +# ---------------------------------------------------------------------- + +if [ x"$TARGET" = x"release" -a -f "client/relwithdebinfo/mysql.exe" ] +then + TARGET="relwithdebinfo" +fi + # ---------------------------------------------------------------------- # Copy executables, and client DLL (FIXME why?) # ---------------------------------------------------------------------- @@ -134,18 +143,20 @@ trap 'echo "Clearning up and exiting..." ; rm -fr $DESTDIR; exit 1' ERR mkdir $DESTDIR mkdir $DESTDIR/bin -cp client/$TARGET/*.exe $DESTDIR/bin/ -cp extra/$TARGET/*.exe $DESTDIR/bin/ -cp storage/myisam/$TARGET/*.exe $DESTDIR/bin/ -cp server-tools/instance-manager/$TARGET/*.exe $DESTDIR/bin/ -cp tests/$TARGET/*.exe $DESTDIR/bin/ -cp libmysql/$TARGET/*.exe $DESTDIR/bin/ -cp libmysql/$TARGET/libmysql.dll $DESTDIR/bin/ +cp client/$TARGET/*.exe $DESTDIR/bin/ +cp extra/$TARGET/*.exe $DESTDIR/bin/ +cp storage/myisam/$TARGET/*.exe $DESTDIR/bin/ +cp server-tools/instance-manager/$TARGET/*.{exe,map,pdb} $DESTDIR/bin/ +cp tests/$TARGET/*.exe $DESTDIR/bin/ +cp libmysql/$TARGET/*.exe $DESTDIR/bin/ +cp libmysql/$TARGET/libmysql.dll $DESTDIR/bin/ # FIXME really needed?! mv $DESTDIR/bin/comp_err.exe $DESTDIR/bin/comp-err.exe cp sql/$TARGET/mysqld.exe $DESTDIR/bin/mysqld$EXE_SUFFIX.exe +cp sql/$TARGET/mysqld.pdb $DESTDIR/bin/mysqld$EXE_SUFFIX.pdb +cp sql/$TARGET/mysqld.map $DESTDIR/bin/mysqld$EXE_SUFFIX.map if [ x"$PACK_DEBUG" = "" -a -f "sql/debug/mysqld.exe" -o \ x"$PACK_DEBUG" = "yes" ] ; then @@ -342,6 +353,9 @@ done cp -pR sql/share $DESTDIR/ +# The SQL initiation code is really expected to be in "share" +mv $DESTDIR/scripts/*.sql $DESTDIR/share/ || true + # ---------------------------------------------------------------------- # Copy other files specified on command line DEST=SOURCE # ---------------------------------------------------------------------- From 8cc67c011e29661db8f579f1d2a649bf65605dd0 Mon Sep 17 00:00:00 2001 From: "kent@mysql.com/kent-amd64.(none)" <> Date: Thu, 5 Apr 2007 08:30:16 +0200 Subject: [PATCH 08/17] Deleted reject files accidently checked in configure.in.rej include/my_global.h.rej BUILD/SETUP.sh.rej mysys/thr_alarm.c.rej include/my_pthread.h.rej --- BUILD/SETUP.sh.rej | 19 --- configure.in.rej | 299 --------------------------------------- include/my_global.h.rej | 17 --- include/my_pthread.h.rej | 80 ----------- mysys/thr_alarm.c.rej | 220 ---------------------------- 5 files changed, 635 deletions(-) delete mode 100644 BUILD/SETUP.sh.rej delete mode 100644 configure.in.rej delete mode 100644 include/my_global.h.rej delete mode 100644 include/my_pthread.h.rej delete mode 100644 mysys/thr_alarm.c.rej diff --git a/BUILD/SETUP.sh.rej b/BUILD/SETUP.sh.rej deleted file mode 100644 index ccbcaa4404f..00000000000 --- a/BUILD/SETUP.sh.rej +++ /dev/null @@ -1,19 +0,0 @@ -*************** -*** 39,46 **** - c_warnings="$global_warnings -Wunused" - cxx_warnings="$global_warnings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor" - -! alpha_cflags="-mcpu=ev6 -Wa,-mev6" # Not used yet -! pentium_cflags="-mcpu=pentiumpro" - sparc_cflags="" - - # be as fast as we can be without losing our ability to backtrace ---- 39,46 ---- - c_warnings="$global_warnings -Wunused" - cxx_warnings="$global_warnings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor" - -! #alpha_cflags="-mcpu=ev6 -Wa,-mev6" # Not used yet -! #pentium_cflags="-mcpu=pentiumpro" - sparc_cflags="" - - # be as fast as we can be without losing our ability to backtrace diff --git a/configure.in.rej b/configure.in.rej deleted file mode 100644 index 46fbf83b198..00000000000 --- a/configure.in.rej +++ /dev/null @@ -1,299 +0,0 @@ -*************** -*** 388,402 **** - if expr "$target_os" : "[[Ll]]inux.*" > /dev/null - then - MYSQLD_DEFAULT_SWITCHES="--skip-locking" -! IS_LINUX="true" - AC_MSG_RESULT("yes"); - else - MYSQLD_DEFAULT_SWITCHES="" -! IS_LINUX="false" - AC_MSG_RESULT("no"); - fi - AC_SUBST(MYSQLD_DEFAULT_SWITCHES) -! AC_SUBST(IS_LINUX) - - dnl Find paths to some shell programs - AC_PATH_PROG(LN, ln, ln) ---- 388,403 ---- - if expr "$target_os" : "[[Ll]]inux.*" > /dev/null - then - MYSQLD_DEFAULT_SWITCHES="--skip-locking" -! TARGET_LINUX="true" - AC_MSG_RESULT("yes"); -+ AC_DEFINE([TARGET_OS_LINUX], [1], [Whether we build for Linux]) - else - MYSQLD_DEFAULT_SWITCHES="" -! TARGET_LINUX="false" - AC_MSG_RESULT("no"); - fi - AC_SUBST(MYSQLD_DEFAULT_SWITCHES) -! AC_SUBST(TARGET_LINUX) - - dnl Find paths to some shell programs - AC_PATH_PROG(LN, ln, ln) -*************** -*** 576,582 **** - # (this is true on the MySQL build machines to avoid NSS problems) - # - -! if test "$IS_LINUX" = "true" -a "$static_nss" = "" - then - tmp=`nm /usr/lib/libc.a | grep _nss_files_getaliasent_r` - if test -n "$tmp" ---- 577,583 ---- - # (this is true on the MySQL build machines to avoid NSS problems) - # - -! if test "$TARGET_LINUX" = "true" -a "$static_nss" = "" - then - tmp=`nm /usr/lib/libc.a | grep _nss_files_getaliasent_r` - if test -n "$tmp" -*************** -*** 827,833 **** - ]) - AC_SUBST(WRAPLIBS) - -! if test "$IS_LINUX" = "true"; then - AC_MSG_CHECKING([for atomic operations]) - - AC_LANG_SAVE ---- 828,834 ---- - ]) - AC_SUBST(WRAPLIBS) - -! if test "$TARGET_LINUX" = "true"; then - AC_MSG_CHECKING([for atomic operations]) - - AC_LANG_SAVE -*************** -*** 870,876 **** - [ USE_PSTACK=no ]) - pstack_libs= - pstack_dirs= -! if test "$USE_PSTACK" = yes -a "$IS_LINUX" = "true" -a "$BASE_MACHINE_TYPE" = "i386" -a "$with_mit_threads" = "no" - then - have_libiberty= have_libbfd= - my_save_LIBS="$LIBS" ---- 871,877 ---- - [ USE_PSTACK=no ]) - pstack_libs= - pstack_dirs= -! if test "$USE_PSTACK" = yes -a "$TARGET_LINUX" = "true" -a "$BASE_MACHINE_TYPE" = "i386" -a "$with_mit_threads" = "no" - then - have_libiberty= have_libbfd= - my_save_LIBS="$LIBS" -*************** -*** 1239,1301 **** - # Hack for DEC-UNIX (OSF1) - if test "$with_named_thread" = "no" -a "$with_mit_threads" = "no" - then -! # Look for LinuxThreads. -! AC_MSG_CHECKING("LinuxThreads") -! grepres=`grep Linuxthreads /usr/include/pthread.h 2>/dev/null | wc -l` -! getconfres=`which getconf >/dev/null && getconf GNU_LIBPTHREAD_VERSION | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ |grep LINUXTHREADS | wc -l || echo 0` -! if test "$grepres" -gt 0 -o "$getconfres" -gt 0 - then -! AC_MSG_RESULT("Found") -! AC_DEFINE(HAVE_LINUXTHREADS) -! # Linux 2.0 sanity check -! AC_TRY_COMPILE([#include ], [int a = sched_get_priority_min(1);], , -! AC_MSG_ERROR([Syntax error in sched.h. Change _P to __P in the /usr/include/sched.h file. See the Installation chapter in the Reference Manual])) -! # RedHat 5.0 does not work with dynamic linking of this. -static also -! # gives a speed increase in linux so it does not hurt on other systems. -! with_named_thread="-lpthread" -! else -! AC_MSG_RESULT("Not found") -! # If this is a linux machine we should barf -! AC_MSG_CHECKING("NPTL") -! if test "$IS_LINUX" = "true" -! then -! getconfres=`which getconf >/dev/null && getconf GNU_LIBPTHREAD_VERSION | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ |grep NPTL | wc -l || echo 0` -! if test "$getconfres" -gt 0 - then -! AC_DEFINE(HAVE_LINUXTHREADS) dnl All this code predates NPTL, so "have linuxthreads" is a poor name. -! with_named_thread="-lpthread" - else -! AC_MSG_ERROR([This is a Linux system and neither Linuxthreads nor NPTL were -! found. Please install Linuxthreads or a new glibc and try -! again. See the Installation chapter in the Reference Manual for -! more information.]) - fi -! else -! AC_MSG_CHECKING("DEC threads") -! if test -f /usr/shlib/libpthread.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a -! then -! with_named_thread="-lpthread -lmach -lexc" -! CFLAGS="$CFLAGS -D_REENTRANT" -! CXXFLAGS="$CXXFLAGS -D_REENTRANT" -! AC_DEFINE(HAVE_DEC_THREADS) -! AC_MSG_RESULT("yes") -! else -! AC_MSG_RESULT("no") -! AC_MSG_CHECKING("DEC 3.2 threads") -! if test -f /usr/shlib/libpthreads.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a -! then -! with_named_thread="-lpthreads -lmach -lc_r" -! AC_DEFINE(HAVE_DEC_THREADS) -! AC_DEFINE(HAVE_DEC_3_2_THREADS) -! with_osf32_threads="yes" -! MYSQLD_DEFAULT_SWITCHES="--skip-thread-priority" -! AC_MSG_RESULT("yes") -! else -! AC_MSG_RESULT("no") -! fi -! fi -! fi -! fi - fi - - ---- 1240,1337 ---- - # Hack for DEC-UNIX (OSF1) - if test "$with_named_thread" = "no" -a "$with_mit_threads" = "no" - then -! AC_MSG_CHECKING("Linux threads") -! if test "$TARGET_LINUX" = "true" - then -! AC_MSG_RESULT("starting") -! # use getconf to check glibc contents -! AC_MSG_CHECKING("getconf GNU_LIBPTHREAD_VERSION") -! case `getconf GNU_LIBPTHREAD_VERSION | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` in -! NPTL* ) -! AC_MSG_RESULT("NPTL") -! AC_DEFINE([HAVE_NPTL], [1], [NPTL threads implementation]) -! with_named_thread="-lpthread" -! ;; -! LINUXTHREADS* ) -! AC_MSG_RESULT("Linuxthreads") -! AC_DEFINE([HAVE_LINUXTHREADS], [1], -! [Whether we are using Xavier Leroy's LinuxThreads]) -! with_named_thread="-lpthread" -! ;; -! * ) -! AC_MSG_RESULT("unknown") -! ;; -! esac -! if test "$with_named_thread" = "no" - then -! # old method, check headers -! # Look for LinuxThreads. -! AC_MSG_CHECKING("LinuxThreads in header file comment") -! res=`grep Linuxthreads /usr/include/pthread.h 2>/dev/null | wc -l` -! if test "$res" -gt 0 -! then -! AC_MSG_RESULT("Found") -! AC_DEFINE([HAVE_LINUXTHREADS], [1], -! [Whether we are using Xavier Leroy's LinuxThreads]) -! # Linux 2.0 sanity check -! AC_TRY_COMPILE([#include ], [int a = sched_get_priority_min(1);], , -! AC_MSG_ERROR([Syntax error in sched.h. Change _P to __P in the /usr/include/sched.h file. See the Installation chapter in the Reference Manual])) -! # RedHat 5.0 does not work with dynamic linking of this. -static also -! # gives a speed increase in linux so it does not hurt on other systems. -! with_named_thread="-lpthread" -! else -! AC_MSG_RESULT("Not found") -! # If this is a linux machine we should barf -! AC_MSG_ERROR([This is a Linux system without a working getconf, -! and Linuxthreads was not found. Please install it (or a new glibc) and try again. -! See the Installation chapter in the Reference Manual for more information.]) -! fi - else -! AC_MSG_RESULT("no need to check headers") - fi -! AC_MSG_CHECKING("for pthread_create in -lpthread"); -! ac_save_LIBS="$LIBS" -! LIBS="$LIBS -lpthread" -! AC_TRY_LINK( [#include ], -! [ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ], -! AC_MSG_RESULT("yes"), -! [ AC_MSG_RESULT("no") -! AC_MSG_ERROR([ -! This is a Linux system claiming to support threads, either Linuxthreads or NPTL, but linking a test program failed. -! Please install one of these (or a new glibc) and try again. -! See the Installation chapter in the Reference Manual for more information.]) ] -! ) -! LIBS="$ac_save_LIBS" -! else -! AC_MSG_RESULT("no") -! fi # "$TARGET_LINUX" -! fi # "$with_named_thread" = "no" -a "$with_mit_threads" = "no" -! -! if test "$with_named_thread" = "no" -a "$with_mit_threads" = "no" -! then -! AC_MSG_CHECKING("DEC threads") -! if test -f /usr/shlib/libpthread.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a -! then -! with_named_thread="-lpthread -lmach -lexc" -! CFLAGS="$CFLAGS -D_REENTRANT" -! CXXFLAGS="$CXXFLAGS -D_REENTRANT" -! AC_DEFINE(HAVE_DEC_THREADS) -! AC_MSG_RESULT("yes") -! else -! AC_MSG_RESULT("no") -! AC_MSG_CHECKING("DEC 3.2 threads") -! if test -f /usr/shlib/libpthreads.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a -! then -! with_named_thread="-lpthreads -lmach -lc_r" -! AC_DEFINE(HAVE_DEC_THREADS) -! AC_DEFINE(HAVE_DEC_3_2_THREADS) -! with_osf32_threads="yes" -! MYSQLD_DEFAULT_SWITCHES="--skip-thread-priority" -! AC_MSG_RESULT("yes") -! else -! AC_MSG_RESULT("no") -! fi -! fi - fi - - -*************** -*** 1720,1726 **** - AC_SUBST(COMPILATION_COMMENT) - - AC_MSG_CHECKING("need of special linking flags") -! if test "$IS_LINUX" = "true" -a "$ac_cv_prog_gcc" = "yes" -a "$all_is_static" != "yes" - then - LDFLAGS="$LDFLAGS -rdynamic" - AC_MSG_RESULT("-rdynamic") ---- 1756,1762 ---- - AC_SUBST(COMPILATION_COMMENT) - - AC_MSG_CHECKING("need of special linking flags") -! if test "$TARGET_LINUX" = "true" -a "$ac_cv_prog_gcc" = "yes" -a "$all_is_static" != "yes" - then - LDFLAGS="$LDFLAGS -rdynamic" - AC_MSG_RESULT("-rdynamic") -*************** -*** 1873,1878 **** - tell atod memcpy memmove \ - setupterm strcasecmp sighold vidattr lrand48 localtime_r \ - sigset sigthreadmask pthread_sigmask pthread_setprio pthread_setprio_np \ - pthread_setschedparam pthread_attr_setprio pthread_attr_setschedparam \ - pthread_attr_create pthread_getsequence_np pthread_attr_setstacksize \ - pthread_attr_getstacksize pthread_key_delete \ ---- 1909,1915 ---- - tell atod memcpy memmove \ - setupterm strcasecmp sighold vidattr lrand48 localtime_r \ - sigset sigthreadmask pthread_sigmask pthread_setprio pthread_setprio_np \ -+ sigaction sigemptyset sigaddset \ - pthread_setschedparam pthread_attr_setprio pthread_attr_setschedparam \ - pthread_attr_create pthread_getsequence_np pthread_attr_setstacksize \ - pthread_attr_getstacksize pthread_key_delete \ -*************** -*** 1884,1890 **** - # Sanity check: We chould not have any fseeko symbol unless - # large_file_support=yes - AC_CHECK_FUNCS(fseeko, -! [if test "$large_file_support" = no -a "$IS_LINUX" = "true"; - then - AC_MSG_ERROR("Found fseeko symbol but large_file_support is not enabled!"); - fi] ---- 1921,1927 ---- - # Sanity check: We chould not have any fseeko symbol unless - # large_file_support=yes - AC_CHECK_FUNCS(fseeko, -! [if test "$large_file_support" = no -a "$TARGET_LINUX" = "true"; - then - AC_MSG_ERROR("Found fseeko symbol but large_file_support is not enabled!"); - fi] diff --git a/include/my_global.h.rej b/include/my_global.h.rej deleted file mode 100644 index f2953d169e7..00000000000 --- a/include/my_global.h.rej +++ /dev/null @@ -1,17 +0,0 @@ -*************** -*** 97,103 **** - - - /* Fix problem with S_ISLNK() on Linux */ -! #if defined(HAVE_LINUXTHREADS) - #undef _GNU_SOURCE - #define _GNU_SOURCE 1 - #endif ---- 97,103 ---- - - - /* Fix problem with S_ISLNK() on Linux */ -! #if defined(TARGET_OS_LINUX) || defined(__GLIBC__) - #undef _GNU_SOURCE - #define _GNU_SOURCE 1 - #endif diff --git a/include/my_pthread.h.rej b/include/my_pthread.h.rej deleted file mode 100644 index 1f73655b0bd..00000000000 --- a/include/my_pthread.h.rej +++ /dev/null @@ -1,80 +0,0 @@ -*************** -*** 286,293 **** - #undef HAVE_PTHREAD_RWLOCK_RDLOCK - #undef HAVE_SNPRINTF - -! #define sigset(A,B) pthread_signal((A),(void (*)(int)) (B)) -! #define signal(A,B) pthread_signal((A),(void (*)(int)) (B)) - #define my_pthread_attr_setprio(A,B) - #endif /* defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM) */ - ---- 294,301 ---- - #undef HAVE_PTHREAD_RWLOCK_RDLOCK - #undef HAVE_SNPRINTF - -! #define my_sigset(A,B) pthread_signal((A),(void (*)(int)) (B)) -! #define my_signal(A,B) pthread_signal((A),(void (*)(int)) (B)) - #define my_pthread_attr_setprio(A,B) - #endif /* defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM) */ - -*************** -*** 324,337 **** - #if !defined(HAVE_SIGWAIT) && !defined(HAVE_mit_thread) && !defined(HAVE_rts_threads) && !defined(sigwait) && !defined(alpha_linux_port) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS) && !defined(_AIX) - int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */ - #endif -! #if !defined(HAVE_SIGSET) && !defined(HAVE_mit_thread) && !defined(sigset) -! #define sigset(A,B) do { struct sigaction s; sigset_t set; \ -! sigemptyset(&set); \ -! s.sa_handler = (B); \ -! s.sa_mask = set; \ -! s.sa_flags = 0; \ -! sigaction((A), &s, (struct sigaction *) NULL); \ - } while (0) - #endif - - #ifndef my_pthread_setprio ---- 332,358 ---- - #if !defined(HAVE_SIGWAIT) && !defined(HAVE_mit_thread) && !defined(HAVE_rts_threads) && !defined(sigwait) && !defined(alpha_linux_port) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS) && !defined(_AIX) - int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */ - #endif -! -! /* -! We define my_sigset() and use that instead of the system sigset() so that -! we can favor an implementation based on sigaction(). On some systems, such -! as Mac OS X, sigset() results in flags such as SA_RESTART being set, and -! we want to make sure that no such flags are set. -! */ -! #if defined(HAVE_SIGACTION) && !defined(my_sigset) -! #define my_sigset(A,B) do { struct sigaction s; sigset_t set; int rc; \ -! DBUG_ASSERT((A) != 0); \ -! sigemptyset(&set); \ -! s.sa_handler = (B); \ -! s.sa_mask = set; \ -! s.sa_flags = 0; \ -! rc= sigaction((A), &s, (struct sigaction *) NULL); \ -! DBUG_ASSERT(rc == 0); \ - } while (0) -+ #elif defined(HAVE_SIGSET) && !defined(my_sigset) -+ #define my_sigset(A,B) sigset((A),(B)) -+ #elif !defined(my_sigset) -+ #define my_sigset(A,B) signal((A),(B)) - #endif - - #ifndef my_pthread_setprio -*************** -*** 416,422 **** - #undef pthread_detach_this_thread - #define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(tmp); } - #undef sigset -! #define sigset(A,B) pthread_signal((A),(void (*)(int)) (B)) - #endif - - #if ((defined(HAVE_PTHREAD_ATTR_CREATE) && !defined(HAVE_SIGWAIT)) || defined(HAVE_DEC_3_2_THREADS)) && !defined(HAVE_CTHREADS_WRAPPER) ---- 437,443 ---- - #undef pthread_detach_this_thread - #define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(tmp); } - #undef sigset -! #define my_sigset(A,B) pthread_signal((A),(void (*)(int)) (B)) - #endif - - #if ((defined(HAVE_PTHREAD_ATTR_CREATE) && !defined(HAVE_SIGWAIT)) || defined(HAVE_DEC_3_2_THREADS)) && !defined(HAVE_CTHREADS_WRAPPER) diff --git a/mysys/thr_alarm.c.rej b/mysys/thr_alarm.c.rej deleted file mode 100644 index c991121052e..00000000000 --- a/mysys/thr_alarm.c.rej +++ /dev/null @@ -1,220 +0,0 @@ -*************** -*** 76,96 **** - alarm_aborted=0; - init_queue(&alarm_queue,max_alarms+1,offsetof(ALARM,expire_time),0, - compare_ulong,NullS); -! sigfillset(&full_signal_set); /* Neaded to block signals */ - pthread_mutex_init(&LOCK_alarm,MY_MUTEX_INIT_FAST); - pthread_cond_init(&COND_alarm,NULL); -! #if THR_CLIENT_ALARM != SIGALRM || defined(USE_ALARM_THREAD) -! #if defined(HAVE_mit_thread) -! sigset(THR_CLIENT_ALARM,thread_alarm); /* int. thread system calls */ -! #else - { -! struct sigaction sact; -! sact.sa_flags = 0; -! sact.sa_handler = thread_alarm; -! sigaction(THR_CLIENT_ALARM, &sact, (struct sigaction*) 0); - } -- #endif -- #endif - sigemptyset(&s); - sigaddset(&s, THR_SERVER_ALARM); - alarm_thread=pthread_self(); ---- 74,89 ---- - alarm_aborted=0; - init_queue(&alarm_queue,max_alarms+1,offsetof(ALARM,expire_time),0, - compare_ulong,NullS); -! sigfillset(&full_signal_set); /* Needed to block signals */ - pthread_mutex_init(&LOCK_alarm,MY_MUTEX_INIT_FAST); - pthread_cond_init(&COND_alarm,NULL); -! #ifndef USE_ALARM_THREAD -! if (thd_lib_detected != THD_LIB_LT) -! #endif - { -! my_sigset(thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1, -! thread_alarm); - } - sigemptyset(&s); - sigaddset(&s, THR_SERVER_ALARM); - alarm_thread=pthread_self(); -*************** -*** 108,120 **** - } - #elif defined(USE_ONE_SIGNAL_HAND) - pthread_sigmask(SIG_BLOCK, &s, NULL); /* used with sigwait() */ -! #if THR_SERVER_ALARM == THR_CLIENT_ALARM -! sigset(THR_CLIENT_ALARM,process_alarm); /* Linuxthreads */ -! pthread_sigmask(SIG_UNBLOCK, &s, NULL); -! #endif - #else - pthread_sigmask(SIG_UNBLOCK, &s, NULL); -- sigset(THR_SERVER_ALARM,process_alarm); - #endif - DBUG_VOID_RETURN; - } ---- 101,115 ---- - } - #elif defined(USE_ONE_SIGNAL_HAND) - pthread_sigmask(SIG_BLOCK, &s, NULL); /* used with sigwait() */ -! if (thd_lib_detected == THD_LIB_LT) -! { -! my_sigset(thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1, -! process_alarm); /* Linuxthreads */ -! pthread_sigmask(SIG_UNBLOCK, &s, NULL); -! } - #else -+ my_sigset(THR_SERVER_ALARM, process_alarm); - pthread_sigmask(SIG_UNBLOCK, &s, NULL); - #endif - DBUG_VOID_RETURN; - } -*************** -*** 240,246 **** - if (alarm_data->malloced) - my_free((gptr) alarm_data,MYF(0)); - found++; -! #ifndef DBUG_OFF - break; - #endif - } ---- 235,241 ---- - if (alarm_data->malloced) - my_free((gptr) alarm_data,MYF(0)); - found++; -! #ifdef DBUG_OFF - break; - #endif - } -*************** -*** 249,258 **** - if (!found) - { - if (*alarmed) -! fprintf(stderr,"Warning: Didn't find alarm %lx in queue of %d alarms\n", -! (long) *alarmed, alarm_queue.elements); -! DBUG_PRINT("warning",("Didn't find alarm %lx in queue\n", -! (long) *alarmed)); - } - pthread_mutex_unlock(&LOCK_alarm); - pthread_sigmask(SIG_SETMASK,&old_mask,NULL); ---- 244,254 ---- - if (!found) - { - if (*alarmed) -! fprintf(stderr, -! "Warning: Didn't find alarm 0x%lx in queue of %d alarms\n", -! (long) *alarmed, alarm_queue.elements); -! DBUG_PRINT("warning",("Didn't find alarm 0x%lx in queue\n", -! (long) *alarmed)); - } - pthread_mutex_unlock(&LOCK_alarm); - pthread_sigmask(SIG_SETMASK,&old_mask,NULL); -*************** -*** 274,291 **** - This must be first as we can't call DBUG inside an alarm for a normal thread - */ - -! #if THR_SERVER_ALARM == THR_CLIENT_ALARM -! if (!pthread_equal(pthread_self(),alarm_thread)) - { - #if defined(MAIN) && !defined(__bsdi__) -! printf("thread_alarm\n"); fflush(stdout); - #endif - #ifdef DONT_REMEMBER_SIGNAL -! sigset(THR_CLIENT_ALARM,process_alarm); /* int. thread system calls */ - #endif - return; - } -- #endif - - /* - We have to do do the handling of the alarm in a sub function, ---- 270,287 ---- - This must be first as we can't call DBUG inside an alarm for a normal thread - */ - -! if (thd_lib_detected == THD_LIB_LT && -! !pthread_equal(pthread_self(),alarm_thread)) - { - #if defined(MAIN) && !defined(__bsdi__) -! printf("thread_alarm in process_alarm\n"); fflush(stdout); - #endif - #ifdef DONT_REMEMBER_SIGNAL -! my_sigset(thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1, -! process_alarm); /* int. thread system calls */ - #endif - return; - } - - /* - We have to do do the handling of the alarm in a sub function, -*************** -*** 301,307 **** - process_alarm_part2(sig); - #ifndef USE_ALARM_THREAD - #if defined(DONT_REMEMBER_SIGNAL) && !defined(USE_ONE_SIGNAL_HAND) -! sigset(THR_SERVER_ALARM,process_alarm); - #endif - pthread_mutex_unlock(&LOCK_alarm); - pthread_sigmask(SIG_SETMASK,&old_mask,NULL); ---- 297,303 ---- - process_alarm_part2(sig); - #ifndef USE_ALARM_THREAD - #if defined(DONT_REMEMBER_SIGNAL) && !defined(USE_ONE_SIGNAL_HAND) -! my_sigset(THR_SERVER_ALARM, process_alarm); - #endif - pthread_mutex_unlock(&LOCK_alarm); - pthread_sigmask(SIG_SETMASK,&old_mask,NULL); -*************** -*** 504,520 **** - ARGSUSED - */ - -- #if THR_CLIENT_ALARM != SIGALRM || defined(USE_ALARM_THREAD) - static sig_handler thread_alarm(int sig) - { - #ifdef MAIN - printf("thread_alarm\n"); fflush(stdout); - #endif - #ifdef DONT_REMEMBER_SIGNAL -! sigset(sig,thread_alarm); /* int. thread system calls */ - #endif - } -- #endif - - - #ifdef HAVE_TIMESPEC_TS_SEC ---- 499,513 ---- - ARGSUSED - */ - - static sig_handler thread_alarm(int sig) - { - #ifdef MAIN - printf("thread_alarm\n"); fflush(stdout); - #endif - #ifdef DONT_REMEMBER_SIGNAL -! my_sigset(sig, thread_alarm); /* int. thread system calls */ - #endif - } - - - #ifdef HAVE_TIMESPEC_TS_SEC -*************** -*** 915,921 **** - printf("Warning: Got signal %d from thread %s\n",sig,my_thread_name()); - fflush(stdout); - #ifdef DONT_REMEMBER_SIGNAL -! sigset(sig,print_signal_warning); /* int. thread system calls */ - #endif - #ifndef OS2 - if (sig == SIGALRM) ---- 908,914 ---- - printf("Warning: Got signal %d from thread %s\n",sig,my_thread_name()); - fflush(stdout); - #ifdef DONT_REMEMBER_SIGNAL -! my_sigset(sig, print_signal_warning); /* int. thread system calls */ - #endif - #ifndef OS2 - if (sig == SIGALRM) From 463b34e77b187a4d6f725076de6713b7d49a9e5e Mon Sep 17 00:00:00 2001 From: "kent@mysql.com/kent-amd64.(none)" <> Date: Thu, 5 Apr 2007 08:36:56 +0200 Subject: [PATCH 09/17] zlib.m4: Only require the more recent zlibCompileFlags() when building the server, client zlib don't need it. Makefile.am: Always build the bundled zlib static only configure.in: Look for dlopen() even if --with-mysqld-ldflags constains "-static", as this is not the same as the flag to "ld", it just informs "libtool" to link static with libraries created part of the build, even if there exists shared versions. make_binary_distribution.sh: Real "mysqlmanager" executable might be in ".libs" --- config/ac-macros/zlib.m4 | 13 +++++++++++-- configure.in | 4 ++-- scripts/make_binary_distribution.sh | 8 +++++++- zlib/Makefile.am | 3 ++- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/config/ac-macros/zlib.m4 b/config/ac-macros/zlib.m4 index a01d13937ff..74de715e424 100644 --- a/config/ac-macros/zlib.m4 +++ b/config/ac-macros/zlib.m4 @@ -10,16 +10,25 @@ AC_SUBST([zlib_dir]) mysql_cv_compress="yes" ]) -dnl Auxiliary macro to check for zlib at given path +dnl Auxiliary macro to check for zlib at given path. +dnl We are strict with the server, as "archive" engine +dnl needs zlibCompileFlags(), but for client only we +dnl are less strict, and take the zlib we find. AC_DEFUN([MYSQL_CHECK_ZLIB_DIR], [ save_CPPFLAGS="$CPPFLAGS" save_LIBS="$LIBS" CPPFLAGS="$ZLIB_INCLUDES $CPPFLAGS" LIBS="$LIBS $ZLIB_LIBS" +if test X"$with_server" = Xno +then + zlibsym=zlibVersion +else + zlibsym=zlibCompileFlags +fi AC_CACHE_VAL([mysql_cv_compress], [AC_TRY_LINK([#include ], - [return zlibCompileFlags();], + [return $zlibsym();], [mysql_cv_compress="yes" AC_MSG_RESULT([ok])], [mysql_cv_compress="no"]) diff --git a/configure.in b/configure.in index 9b0505a594f..bcf561c02ef 100644 --- a/configure.in +++ b/configure.in @@ -1601,9 +1601,9 @@ fi # dlopen, dlerror case "$with_mysqld_ldflags " in - *"-static "*) + *"-all-static "*) # No need to check for dlopen when mysqld is linked with - # -all-static or -static as it won't be able to load any functions. + # -all-static as it won't be able to load any functions. # NOTE! It would be better if it was possible to test if dlopen # can be used, but a good way to test it couldn't be found diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index 7d7918975f2..e8bf39bd016 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -115,7 +115,12 @@ if [ $BASE_SYSTEM != "netware" ] ; then chmod o-rwx $BASE/data $BASE/data/* fi -# Copy files if they exists, warn for those that don't +# Copy files if they exists, warn for those that don't. +# Note that when listing files to copy, we might list the file name +# twice, once in the directory location where it is build, and a +# second time in the ".libs" location. In the case the firs one +# is a wrapper script, the second one will overwrite it with the +# binary file. copyfileto() { destdir=$1 @@ -165,6 +170,7 @@ if [ $BASE_SYSTEM = "netware" ] ; then # For all other platforms: else BIN_FILES="$BIN_FILES \ + server-tools/instance-manager/.libs/mysqlmanager \ client/mysqltestmanagerc \ client/mysqltestmanager-pwgen tools/mysqltestmanager \ client/.libs/mysql client/.libs/mysqlshow client/.libs/mysqladmin \ diff --git a/zlib/Makefile.am b/zlib/Makefile.am index c40c922851e..f5741a782fb 100644 --- a/zlib/Makefile.am +++ b/zlib/Makefile.am @@ -21,7 +21,8 @@ LIBS= $(NON_THREADED_LIBS) pkglib_LTLIBRARIES=libz.la -libz_la_LDFLAGS= -version-info 3:3:2 +# We are never interested in a shared version +libz_la_LDFLAGS= -static noinst_HEADERS= crc32.h deflate.h inffast.h inffixed.h inflate.h \ inftrees.h trees.h zconf.h zlib.h zutil.h From d864e5e0fe16cd412785e2aab02e72f1e5eadc75 Mon Sep 17 00:00:00 2001 From: "df@pippilotta.erinye.com" <> Date: Thu, 5 Apr 2007 10:00:04 +0200 Subject: [PATCH 10/17] remove manual pages that don't exist from rpm spec file --- support-files/mysql.spec.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 0671bd8a58c..99fcfdc9b39 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -556,7 +556,6 @@ fi %doc %attr(644, root, man) %{_mandir}/man1/mysqld_multi.1* %doc %attr(644, root, man) %{_mandir}/man1/mysqld_safe.1* %doc %attr(644, root, man) %{_mandir}/man1/mysql_fix_privilege_tables.1* -%doc %attr(644, root, man) %{_mandir}/man1/mysql_install_db.1 %doc %attr(644, root, man) %{_mandir}/man1/mysql_upgrade.1* %doc %attr(644, root, man) %{_mandir}/man1/mysqlhotcopy.1* %doc %attr(644, root, man) %{_mandir}/man1/mysqlman.1* @@ -577,7 +576,6 @@ fi %attr(755, root, root) %{_bindir}/myisamlog %attr(755, root, root) %{_bindir}/myisampack %attr(755, root, root) %{_bindir}/mysql_convert_table_format -%attr(755, root, root) %{_bindir}/mysql_create_system_tables %attr(755, root, root) %{_bindir}/mysql_fix_extensions %attr(755, root, root) %{_bindir}/mysql_fix_privilege_tables %attr(755, root, root) %{_bindir}/mysql_install_db @@ -739,6 +737,10 @@ fi # itself - note that they must be ordered by date (important when # merging BK trees) %changelog +* Thu Apr 05 2007 Daniel Fischer + +- Remove several man pages that vanished after last release. + * Fri Mar 02 2007 Joerg Bruehe - Add several man pages for NDB which are now created. From df469af549b03008e3a5aad606d5838829117688 Mon Sep 17 00:00:00 2001 From: "hhunger@hh-nb.hungers" <> Date: Thu, 5 Apr 2007 16:04:31 +0200 Subject: [PATCH 11/17] test of row locking. --- .../suite/row_lock/include/row_lock.inc | 83 ++++ .../row_lock/include/row_lock_big_tab.inc | 94 +++++ .../row_lock/include/row_lock_big_tab_1.inc | 93 +++++ .../row_lock/include/row_lock_big_tab_2.inc | 93 +++++ .../suite/row_lock/include/row_lock_trig.inc | 96 +++++ .../suite/row_lock/include/row_lock_view.inc | 89 +++++ .../row_lock/include/row_lock_view_mix.inc | 92 +++++ .../include/row_lock_view_storedp.inc | 126 +++++++ .../row_lock/include/row_lock_view_trig.inc | 99 +++++ .../suite/row_lock/r/innodb_row_lock_1.result | 142 +++++++ .../suite/row_lock/r/innodb_row_lock_2.result | 32 ++ .../suite/row_lock/r/innodb_row_lock_3.result | 32 ++ .../suite/row_lock/r/innodb_row_lock_4.result | 142 +++++++ .../suite/row_lock/r/innodb_row_lock_5.result | 32 ++ .../row_lock/r/innodb_row_lock_big_tab.result | 97 +++++ .../r/innodb_row_lock_big_tab_1.result | 145 +++++++ .../r/innodb_row_lock_big_tab_2.result | 113 ++++++ .../row_lock/r/innodb_row_lock_trig_1.result | 151 ++++++++ .../row_lock/r/innodb_row_lock_trig_2.result | 37 ++ .../row_lock/r/innodb_row_lock_view_1.result | 34 ++ .../row_lock/r/innodb_row_lock_view_2.result | 40 ++ .../r/innodb_row_lock_view_mix_1.result | 48 +++ .../r/innodb_row_lock_view_mix_2.result | 40 ++ .../r/innodb_row_lock_view_storedp_1.result | 312 +++++++++++++++ .../r/innodb_row_lock_view_storedp_2.result | 47 +++ .../r/innodb_row_lock_view_trig_1.result | 183 +++++++++ .../r/innodb_row_lock_view_trig_2.result | 38 ++ .../suite/row_lock/r/ndb_row_lock_1.result | 139 +++++++ .../suite/row_lock/r/ndb_row_lock_2.result | 31 ++ .../suite/row_lock/r/ndb_row_lock_3.result | 30 ++ .../suite/row_lock/r/ndb_row_lock_4.result | 139 +++++++ .../suite/row_lock/r/ndb_row_lock_5.result | 30 ++ .../row_lock/r/ndb_row_lock_big_tab.result | 177 +++++++++ .../row_lock/r/ndb_row_lock_big_tab_1.result | 357 ++++++++++++++++++ .../row_lock/r/ndb_row_lock_big_tab_2.result | 255 +++++++++++++ .../row_lock/r/ndb_row_lock_trig_1.result | 148 ++++++++ .../row_lock/r/ndb_row_lock_trig_2.result | 35 ++ .../row_lock/r/ndb_row_lock_view_1.result | 194 ++++++++++ .../row_lock/r/ndb_row_lock_view_2.result | 200 ++++++++++ .../row_lock/r/ndb_row_lock_view_mix_1.result | 169 +++++++++ .../row_lock/r/ndb_row_lock_view_mix_2.result | 38 ++ .../r/ndb_row_lock_view_storedp_1.result | 309 +++++++++++++++ .../r/ndb_row_lock_view_storedp_2.result | 46 +++ .../r/ndb_row_lock_view_trig_1.result | 180 +++++++++ .../r/ndb_row_lock_view_trig_2.result | 36 ++ mysql-test/suite/row_lock/readme.txt | 9 + .../suite/row_lock/summary_of_sel_test.txt | 36 ++ .../suite/row_lock/t/innodb_row_lock_1.test | 9 + .../suite/row_lock/t/innodb_row_lock_2.test | 9 + .../suite/row_lock/t/innodb_row_lock_3.test | 9 + .../suite/row_lock/t/innodb_row_lock_4.test | 9 + .../suite/row_lock/t/innodb_row_lock_5.test | 9 + .../row_lock/t/innodb_row_lock_big_tab.test | 9 + .../row_lock/t/innodb_row_lock_big_tab_1.test | 10 + .../row_lock/t/innodb_row_lock_big_tab_2.test | 10 + .../row_lock/t/innodb_row_lock_trig_1.test | 9 + .../row_lock/t/innodb_row_lock_trig_2.test | 9 + .../row_lock/t/innodb_row_lock_view_1.test | 9 + .../row_lock/t/innodb_row_lock_view_2.test | 9 + .../t/innodb_row_lock_view_mix_1.test | 9 + .../t/innodb_row_lock_view_mix_2.test | 10 + .../t/innodb_row_lock_view_storedp_1.test | 9 + .../t/innodb_row_lock_view_storedp_2.test | 9 + .../t/innodb_row_lock_view_trig_1.test | 9 + .../t/innodb_row_lock_view_trig_2.test | 9 + .../suite/row_lock/t/ndb_row_lock_1.test | 6 + .../suite/row_lock/t/ndb_row_lock_2.test | 6 + .../suite/row_lock/t/ndb_row_lock_3.test | 6 + .../suite/row_lock/t/ndb_row_lock_4.test | 6 + .../suite/row_lock/t/ndb_row_lock_5.test | 6 + .../row_lock/t/ndb_row_lock_big_tab.test | 6 + .../row_lock/t/ndb_row_lock_big_tab_1.test | 7 + .../row_lock/t/ndb_row_lock_big_tab_2.test | 7 + .../suite/row_lock/t/ndb_row_lock_trig_1.test | 6 + .../suite/row_lock/t/ndb_row_lock_trig_2.test | 6 + .../suite/row_lock/t/ndb_row_lock_view_1.test | 7 + .../suite/row_lock/t/ndb_row_lock_view_2.test | 6 + .../row_lock/t/ndb_row_lock_view_mix_1.test | 6 + .../row_lock/t/ndb_row_lock_view_mix_2.test | 6 + .../t/ndb_row_lock_view_storedp_1.test | 6 + .../t/ndb_row_lock_view_storedp_2.test | 6 + .../row_lock/t/ndb_row_lock_view_trig_1.test | 6 + .../row_lock/t/ndb_row_lock_view_trig_2.test | 6 + 83 files changed, 5364 insertions(+) create mode 100644 mysql-test/suite/row_lock/include/row_lock.inc create mode 100644 mysql-test/suite/row_lock/include/row_lock_big_tab.inc create mode 100644 mysql-test/suite/row_lock/include/row_lock_big_tab_1.inc create mode 100644 mysql-test/suite/row_lock/include/row_lock_big_tab_2.inc create mode 100644 mysql-test/suite/row_lock/include/row_lock_trig.inc create mode 100644 mysql-test/suite/row_lock/include/row_lock_view.inc create mode 100644 mysql-test/suite/row_lock/include/row_lock_view_mix.inc create mode 100644 mysql-test/suite/row_lock/include/row_lock_view_storedp.inc create mode 100644 mysql-test/suite/row_lock/include/row_lock_view_trig.inc create mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_1.result create mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_2.result create mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_3.result create mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_4.result create mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_5.result create mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_big_tab.result create mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_1.result create mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_2.result create mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_trig_1.result create mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_trig_2.result create mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_view_1.result create mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_view_2.result create mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_1.result create mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_2.result create mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_1.result create mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_2.result create mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_1.result create mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_2.result create mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_1.result create mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_2.result create mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_3.result create mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_4.result create mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_5.result create mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_big_tab.result create mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_1.result create mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_2.result create mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_trig_1.result create mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_trig_2.result create mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_view_1.result create mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_view_2.result create mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_1.result create mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_2.result create mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_1.result create mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_2.result create mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_1.result create mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_2.result create mode 100644 mysql-test/suite/row_lock/readme.txt create mode 100644 mysql-test/suite/row_lock/summary_of_sel_test.txt create mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_1.test create mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_2.test create mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_3.test create mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_4.test create mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_5.test create mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_big_tab.test create mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_1.test create mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_2.test create mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_trig_1.test create mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_trig_2.test create mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_view_1.test create mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_view_2.test create mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_1.test create mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_2.test create mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_1.test create mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_2.test create mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_1.test create mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_2.test create mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_1.test create mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_2.test create mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_3.test create mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_4.test create mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_5.test create mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_big_tab.test create mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_1.test create mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_2.test create mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_trig_1.test create mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_trig_2.test create mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_view_1.test create mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_view_2.test create mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_1.test create mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_2.test create mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_1.test create mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_2.test create mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_1.test create mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_2.test diff --git a/mysql-test/suite/row_lock/include/row_lock.inc b/mysql-test/suite/row_lock/include/row_lock.inc new file mode 100644 index 00000000000..8572bc0246e --- /dev/null +++ b/mysql-test/suite/row_lock/include/row_lock.inc @@ -0,0 +1,83 @@ +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +--enable_warnings +SET autocommit=0; +# Create additional connections used through test +CONNECT (root1, localhost, root,,); +SET autocommit=0; +--echo connection default; +CONNECTION default; +eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +eval $indext1; +eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +eval $indext2; +COMMIT; +SELECT @@global.tx_isolation; + +# Both transaction are able to update the tables +eval EXPLAIN $select; +eval $select; + +--echo connection root1; +CONNECTION root1; +UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; + +--echo connection default; +CONNECTION default; +UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; + +--echo connection root1; +CONNECTION root1; +UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; + +--echo connection default; +CONNECTION default; +UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; + +--echo connection root1; +CONNECTION root1; +DELETE FROM t1 WHERE t1.i=226; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; + +--echo connection default; +CONNECTION default; +DELETE FROM t1 WHERE t1.i=224; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; +COMMIT; + +--echo connection root1; +CONNECTION root1; +ROLLBACK; + +--echo connection default; +CONNECTION default; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; + +--echo connection root1; +CONNECTION root1; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; +DISCONNECT root1; +--echo connection default; +CONNECTION default; +DROP TABLE t1, t2; + diff --git a/mysql-test/suite/row_lock/include/row_lock_big_tab.inc b/mysql-test/suite/row_lock/include/row_lock_big_tab.inc new file mode 100644 index 00000000000..f0823067eac --- /dev/null +++ b/mysql-test/suite/row_lock/include/row_lock_big_tab.inc @@ -0,0 +1,94 @@ +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +--enable_warnings +SET autocommit=0; +# Create additional connections used through test +CONNECT (root1, localhost, root,,); +SET autocommit=0; +--echo connection default; +CONNECTION default; +eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; +eval $indext1; +eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; +eval $indext2; +DELIMITER |; +CREATE PROCEDURE fill_t1 (IN upb int) +BEGIN +DECLARE cnt int DEFAULT 0; +WHILE cnt < upb DO + INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100); + SET cnt= cnt+1; +END WHILE; +END; +| +CREATE FUNCTION half_t1() RETURNS int +BEGIN + DECLARE res int DEFAULT 0; + SELECT count(*)/2 INTO res FROM t1; + RETURN res; +END; +| +CREATE PROCEDURE fill_t2 (IN upb int) +BEGIN +DECLARE cnt int DEFAULT 0; +WHILE cnt < upb DO + INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100); + SET cnt= cnt+1; +END WHILE; +END; +| +CREATE FUNCTION half_t2() RETURNS int +BEGIN + DECLARE res int DEFAULT 0; + SELECT count(*)/2 INTO res FROM t2; + RETURN res; +END; +| +DELIMITER ;| +CALL fill_t1 (10); +CALL fill_t2 (10); +COMMIT; +SELECT @@global.tx_isolation; +# With the two separate selects (without join) the differs from +# that select with join. + +# Both transaction are able to update the tables +eval EXPLAIN $select; +eval $select; + +--echo connection root1; +CONNECTION root1; +SELECT k from t1 WHERE k < half_t1(); +SELECT k from t1 WHERE k >= half_t1(); +UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k < half_t1() AND t2.i=t1.i; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; + +--echo connection default; +CONNECTION default; +UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k >= half_t1() AND t2.i=t1.i; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; +COMMIT; + +--echo connection root1; +CONNECTION root1; +ROLLBACK; + +--echo connection default; +CONNECTION default; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; + +--echo connection root1; +CONNECTION root1; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; +DISCONNECT root1; +--echo connection default; +CONNECTION default; +DROP VIEW IF EXISTS v1; +DROP TABLE t1, t2; +#DROP VIEW v1; + diff --git a/mysql-test/suite/row_lock/include/row_lock_big_tab_1.inc b/mysql-test/suite/row_lock/include/row_lock_big_tab_1.inc new file mode 100644 index 00000000000..8535c016819 --- /dev/null +++ b/mysql-test/suite/row_lock/include/row_lock_big_tab_1.inc @@ -0,0 +1,93 @@ +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +--enable_warnings +SET autocommit=0; +# Create additional connections used through test +CONNECT (root1, localhost, root,,); +SET autocommit=0; +--echo connection default; +CONNECTION default; +eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; +eval $indext1; +eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; +eval $indext2; +DELIMITER |; +CREATE PROCEDURE fill_t1 (IN upb int) +BEGIN +DECLARE cnt int DEFAULT 0; +WHILE cnt < upb DO + INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100); + SET cnt= cnt+1; +END WHILE; +END; +| +CREATE FUNCTION half_t1() RETURNS int +BEGIN + DECLARE res int DEFAULT 0; + SELECT MOD(k,2) INTO res FROM t1; + RETURN res; +END; +| +CREATE PROCEDURE fill_t2 (IN upb int) +BEGIN +DECLARE cnt int DEFAULT 0; +WHILE cnt < upb DO + INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100); + SET cnt= cnt+1; +END WHILE; +END; +| +CREATE FUNCTION half_t2() RETURNS int +BEGIN + DECLARE res int DEFAULT 0; + SELECT MOD(k,2) INTO res FROM t2; + RETURN res; +END; +| +DELIMITER ;| +eval CALL fill_t1 ($nbrows); +eval CALL fill_t2 ($nbrows); +COMMIT; +SELECT @@global.tx_isolation; +# With the two separate selects (without join) the differs from +# that select with join. + +# Both transaction are able to update the tables +eval EXPLAIN $select; +eval $select; + +--echo connection root1; +CONNECTION root1; +SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 1 AND t1.k = t2.k LOCK IN SHARE MODE; +UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k % 2 = 1 AND t1.k = t2.k; +SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k; +SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k; + +--echo connection default; +CONNECTION default; +UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k; +SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k; +SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k; + +COMMIT; + +--echo connection root1; +CONNECTION root1; +ROLLBACK; + +--echo connection default; +CONNECTION default; +SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k; +SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k; + +--echo connection root1; +CONNECTION root1; +SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k; +SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k; +DISCONNECT root1; +--echo connection default; +CONNECTION default; +DROP TABLE t1, t2; + + diff --git a/mysql-test/suite/row_lock/include/row_lock_big_tab_2.inc b/mysql-test/suite/row_lock/include/row_lock_big_tab_2.inc new file mode 100644 index 00000000000..050f2a54016 --- /dev/null +++ b/mysql-test/suite/row_lock/include/row_lock_big_tab_2.inc @@ -0,0 +1,93 @@ +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +--enable_warnings +SET autocommit=0; +# Create additional connections used through test +CONNECT (root1, localhost, root,,); +SET autocommit=0; +--echo connection default; +CONNECTION default; +eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; +eval $indext1; +eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; +eval $indext2; +DELIMITER |; +CREATE PROCEDURE fill_t1 (IN upb int) +BEGIN +DECLARE cnt int DEFAULT 0; +WHILE cnt < upb DO + INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100); + SET cnt= cnt+1; +END WHILE; +END; +| +CREATE FUNCTION half_t1() RETURNS int +BEGIN + DECLARE res int DEFAULT 0; + SELECT MOD(k,2) INTO res FROM t1; + RETURN res; +END; +| +CREATE PROCEDURE fill_t2 (IN upb int) +BEGIN +DECLARE cnt int DEFAULT 0; +WHILE cnt < upb DO + INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100); + SET cnt= cnt+1; +END WHILE; +END; +| +CREATE FUNCTION half_t2() RETURNS int +BEGIN + DECLARE res int DEFAULT 0; + SELECT MOD(k,2) INTO res FROM t2; + RETURN res; +END; +| +DELIMITER ;| +eval CALL fill_t1 ($nbrows); +eval CALL fill_t2 ($nbrows); +COMMIT; +SELECT @@global.tx_isolation; +# With the two separate selects (without join) the differs from +# that select with join. + +# Both transaction are able to update the tables +eval EXPLAIN $select; +eval $select; + +--echo connection root1; +CONNECTION root1; +#SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 1 AND t1.k = t2.k FOR UPDATE; +DELETE FROM t1 WHERE t1.k % 2 = 1; +SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k; +SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k; + +--echo connection default; +CONNECTION default; +UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k; +SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k; +SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k; + +COMMIT; + +--echo connection root1; +CONNECTION root1; +ROLLBACK; + +--echo connection default; +CONNECTION default; +SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k; +SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k; + +--echo connection root1; +CONNECTION root1; +SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k; +SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k; +DISCONNECT root1; +--echo connection default; +CONNECTION default; +DROP TABLE t1, t2; + + diff --git a/mysql-test/suite/row_lock/include/row_lock_trig.inc b/mysql-test/suite/row_lock/include/row_lock_trig.inc new file mode 100644 index 00000000000..384f00f243e --- /dev/null +++ b/mysql-test/suite/row_lock/include/row_lock_trig.inc @@ -0,0 +1,96 @@ +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +--enable_warnings +SET autocommit=0; +# Create additional connections used through test +CONNECT (root1, localhost, root,,); +SET autocommit=0; +--echo connection default; +CONNECTION default; +eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +eval $indext1; +eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +eval $indext2; +DELIMITER |; + +CREATE TRIGGER trig_t2 AFTER UPDATE ON t2 + FOR EACH ROW BEGIN + UPDATE t1 SET l = NEW.i WHERE i = OLD.i; + END; +| + +DELIMITER ;| + +COMMIT; +SELECT @@global.tx_isolation; +# With the two separate selects (without join) the differs from +# that select with join. + +# Both transaction are able to update the tables +eval EXPLAIN $select; +eval $select; +--echo connection root1; +CONNECTION root1; +UPDATE t2 SET t2.i=225 WHERE t2.i=125; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; + +--echo connection default; +CONNECTION default; +UPDATE t2 SET t2.i=223 WHERE t2.i=123; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; + +--echo connection root1; +CONNECTION root1; +UPDATE t2 SET t2.i=226 WHERE t2.i=126; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; + +--echo connection default; +CONNECTION default; +UPDATE t2 SET t2.i=224 WHERE t2.i=124; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; + +--echo connection root1; +CONNECTION root1; +DELETE FROM t1 WHERE t1.i=226; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; + +--echo connection default; +CONNECTION default; +DELETE FROM t1 WHERE t1.i=224; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; +COMMIT; + +--echo connection root1; +CONNECTION root1; +ROLLBACK; + +--echo connection default; +CONNECTION default; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; + +--echo connection root1; +CONNECTION root1; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; +DISCONNECT root1; +--echo connection default; +CONNECTION default; +DROP TABLE t1, t2; +#DROP VIEW v1; + diff --git a/mysql-test/suite/row_lock/include/row_lock_view.inc b/mysql-test/suite/row_lock/include/row_lock_view.inc new file mode 100644 index 00000000000..fbed8f64d3a --- /dev/null +++ b/mysql-test/suite/row_lock/include/row_lock_view.inc @@ -0,0 +1,89 @@ +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +--enable_warnings +SET autocommit=0; +# Create additional connections used through test +CONNECT (root1, localhost, root,,); +SET autocommit=0; +--echo connection default; +CONNECTION default; +eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +eval $indext1; +eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +eval $indext2; +CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2; +COMMIT; +SELECT @@global.tx_isolation; +# With the two separate selects (without join) the differs from +# that select with join. + +# Both transaction are able to update the tables +eval EXPLAIN $select; +eval $select; + +--echo connection root1; +CONNECTION root1; +UPDATE v1 SET i=325 where i=125; +SELECT * FROM v1 ORDER BY i,l; +SELECT * FROM t1 ORDER BY t1.k; + +--echo connection default; +CONNECTION default; +UPDATE v1 SET i=323 where i=123; +SELECT * FROM v1 ORDER BY i,l; +SELECT * FROM t1 ORDER BY t1.k; + +--echo connection root1; +CONNECTION root1; +UPDATE v1 SET i=326 where i=126; +SELECT * FROM v1 ORDER BY i,l; +SELECT * FROM t1 ORDER BY t1.k; + +--echo connection default; +CONNECTION default; +UPDATE v1 SET i=324 where i=124; +SELECT * FROM v1 ORDER BY i,l; +SELECT * FROM t1 ORDER BY t1.k; + +--echo connection root1; +CONNECTION root1; +DELETE FROM t1 WHERE t1.i=226; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; + +--echo connection default; +CONNECTION default; +DELETE FROM t1 WHERE t1.i=224; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; +COMMIT; + +--echo connection root1; +CONNECTION root1; +ROLLBACK; + +--echo connection default; +CONNECTION default; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; + +--echo connection root1; +CONNECTION root1; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; +DISCONNECT root1; +--echo connection default; +CONNECTION default; +DROP VIEW IF EXISTS v1; +DROP TABLE t1, t2; +#DROP VIEW v1; + diff --git a/mysql-test/suite/row_lock/include/row_lock_view_mix.inc b/mysql-test/suite/row_lock/include/row_lock_view_mix.inc new file mode 100644 index 00000000000..9e8cf3d34fc --- /dev/null +++ b/mysql-test/suite/row_lock/include/row_lock_view_mix.inc @@ -0,0 +1,92 @@ +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +--enable_warnings +SET autocommit=0; +# Create additional connections used through test +CONNECT (root1, localhost, root,,); +SET autocommit=0; +--echo connection default; +CONNECTION default; +eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +eval $indext1; +eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +eval $indext2; +CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2; +COMMIT; +SELECT @@global.tx_isolation; +# With the two separate selects (without join) the differs from +# that select with join. + +# Both transaction are able to update the tables +eval EXPLAIN $select; +eval $select; + +--echo connection root1; +CONNECTION root1; +UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; +#UPDATE v1 SET i=325 where i=125; +#SELECT * FROM v1 ORDER BY i,l; +#SELECT * FROM t1 ORDER BY t1.k; + +--echo connection default; +CONNECTION default; +UPDATE v1 SET i=323 where i=123; +SELECT * FROM v1 ORDER BY i,l; +SELECT * FROM t1 ORDER BY t1.k; + +--echo connection root1; +CONNECTION root1; +UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; + +--echo connection default; +CONNECTION default; +UPDATE v1 SET i=324 where i=124; +SELECT * FROM v1 ORDER BY i,l; +SELECT * FROM t1 ORDER BY t1.k; + +--echo connection root1; +CONNECTION root1; +DELETE FROM t1 WHERE t1.i=226; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; + +--echo connection default; +CONNECTION default; +DELETE FROM t1 WHERE t1.i=224; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; +COMMIT; + +--echo connection root1; +CONNECTION root1; +ROLLBACK; + +--echo connection default; +CONNECTION default; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; + +--echo connection root1; +CONNECTION root1; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; +DISCONNECT root1; +--echo connection default; +CONNECTION default; +DROP VIEW IF EXISTS v1; +DROP TABLE t1, t2; +#DROP VIEW v1; + diff --git a/mysql-test/suite/row_lock/include/row_lock_view_storedp.inc b/mysql-test/suite/row_lock/include/row_lock_view_storedp.inc new file mode 100644 index 00000000000..479392098be --- /dev/null +++ b/mysql-test/suite/row_lock/include/row_lock_view_storedp.inc @@ -0,0 +1,126 @@ +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +DROP PROCEDURE IF EXISTS stp_t; +--enable_warnings +SET autocommit=0; +# Create additional connections used through test +CONNECT (root1, localhost, root,,); +SET autocommit=0; +CONNECT (root2, localhost, root,,); +SET autocommit=0; +--echo connection default; +CONNECTION default; +eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +INSERT INTO t1 VALUES (5,127,5,127); +INSERT INTO t1 VALUES (6,128,6,128); +eval $indext1; +eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +INSERT INTO t2 VALUES (5,127,5,127); +INSERT INTO t2 VALUES (6,128,6,128); +eval $indext2; +CREATE VIEW v1 AS SELECT t1.i from t1; +DELIMITER |; + +CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA + BEGIN + UPDATE t2 SET i = p2 WHERE i = p1; + UPDATE v1 SET i = p2 WHERE i = p1; + SELECT * FROM v1 ORDER BY i; + SELECT * FROM t1 ORDER BY t1.k; + SELECT * FROM t2 ORDER BY t2.k; + END; +| + +DELIMITER ;| + +COMMIT; +SELECT @@global.tx_isolation; +eval EXPLAIN $select; +eval $select; +--echo connection root1; +CONNECTION root1; +CALL stp_t (125, 225); + +--echo connection root2; +CONNECTION root2; +CALL stp_t (127, 227); + +--echo connection default; +CONNECTION default; +CALL stp_t (123, 223); + +--echo connection root1; +CONNECTION root1; +CALL stp_t (126, 226); + +--echo connection root2; +CONNECTION root2; +CALL stp_t (128, 228); + +--echo connection default; +CONNECTION default; +CALL stp_t (124, 224); + +--echo connection root1; +CONNECTION root1; +DELETE FROM t1 WHERE t1.i=226; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; + +--echo connection root2; +CONNECTION root2; +DELETE FROM t1 WHERE t1.i=228; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; + +--echo connection default; +CONNECTION default; +DELETE FROM t1 WHERE t1.i=224; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; +COMMIT; + +--echo connection root1; +CONNECTION root1; +ROLLBACK; + +--echo connection root1; +CONNECTION root1; +COMMIT; + +--echo connection default; +CONNECTION default; +SELECT * FROM v1 ORDER BY i; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; + +--echo connection root1; +CONNECTION root1; +SELECT * FROM v1 ORDER BY i; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; +DISCONNECT root1; + +--echo connection root2; +CONNECTION root2; +SELECT * FROM v1 ORDER BY i; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; +DISCONNECT root2; + +--echo connection default; +CONNECTION default; +--disable_warnings +DROP VIEW v1; +DROP PROCEDURE stp_t; +DROP TABLE t1, t2; +--enable_warnings diff --git a/mysql-test/suite/row_lock/include/row_lock_view_trig.inc b/mysql-test/suite/row_lock/include/row_lock_view_trig.inc new file mode 100644 index 00000000000..785eb1b66a9 --- /dev/null +++ b/mysql-test/suite/row_lock/include/row_lock_view_trig.inc @@ -0,0 +1,99 @@ +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +--enable_warnings +SET autocommit=0; +# Create additional connections used through test +CONNECT (root1, localhost, root,,); +SET autocommit=0; +--echo connection default; +CONNECTION default; +eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +eval $indext1; +eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +eval $indext2; +CREATE VIEW v1 AS SELECT t1.i from t1; +DELIMITER |; + +CREATE TRIGGER trig_t2 AFTER UPDATE ON t2 + FOR EACH ROW BEGIN + UPDATE v1 SET i = NEW.i WHERE i = OLD.i; + END; +| + +DELIMITER ;| + +COMMIT; +SELECT @@global.tx_isolation; +eval EXPLAIN $select; +eval $select; +--echo connection root1; +CONNECTION root1; +UPDATE t2 SET t2.i=225 WHERE t2.i=125; +SELECT * FROM v1 ORDER BY i; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; + +--echo connection default; +CONNECTION default; +UPDATE t2 SET t2.i=223 WHERE t2.i=123; +SELECT * FROM v1 ORDER BY i; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; + +--echo connection root1; +CONNECTION root1; +UPDATE t2 SET t2.i=226 WHERE t2.i=126; +SELECT * FROM v1 ORDER BY i; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; + +--echo connection default; +CONNECTION default; +UPDATE t2 SET t2.i=224 WHERE t2.i=124; +SELECT * FROM v1 ORDER BY i; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; + +--echo connection root1; +CONNECTION root1; +DELETE FROM t1 WHERE t1.i=226; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; + +--echo connection default; +CONNECTION default; +DELETE FROM t1 WHERE t1.i=224; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; +COMMIT; + +--echo connection root1; +CONNECTION root1; +ROLLBACK; + +--echo connection default; +CONNECTION default; +SELECT * FROM v1 ORDER BY i; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; + +--echo connection root1; +CONNECTION root1; +SELECT * FROM v1 ORDER BY i; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; +DISCONNECT root1; +--echo connection default; +CONNECTION default; +DROP TABLE t1, t2; +DROP VIEW v1; + diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_1.result new file mode 100644 index 00000000000..54ed4350ba9 --- /dev/null +++ b/mysql-test/suite/row_lock/r/innodb_row_lock_1.result @@ -0,0 +1,142 @@ +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +DROP TABLE IF EXISTS t1, t2; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +CREATE INDEX ixi ON t2 (i); +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index +1 SIMPLE t2 ref ixi ixi 5 test.t1.i 2 Using where; Using index +SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; +i i +123 123 +124 124 +connection root1; +UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 126 4 126 +connection default; +UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 226 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 226 4 126 +connection default; +UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +DELETE FROM t1 WHERE t1.i=226; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 226 4 126 +connection default; +DELETE FROM t1 WHERE t1.i=224; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +COMMIT; +connection root1; +ROLLBACK; +connection default; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +connection default; +DROP TABLE t1, t2; +SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_2.result new file mode 100644 index 00000000000..56154e64489 --- /dev/null +++ b/mysql-test/suite/row_lock/r/innodb_row_lock_2.result @@ -0,0 +1,32 @@ +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +DROP TABLE IF EXISTS t1, t2; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +#CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +#CREATE INDEX ixi ON t2 (i); +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where +SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; +i i +123 123 +124 124 +connection root1; +UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_3.result b/mysql-test/suite/row_lock/r/innodb_row_lock_3.result new file mode 100644 index 00000000000..a89c55973d2 --- /dev/null +++ b/mysql-test/suite/row_lock/r/innodb_row_lock_3.result @@ -0,0 +1,32 @@ +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +DROP TABLE IF EXISTS t1, t2; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +#CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +#CREATE INDEX ixi ON t2 (i); +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where +SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; +i i +123 123 +124 124 +connection root1; +UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_4.result b/mysql-test/suite/row_lock/r/innodb_row_lock_4.result new file mode 100644 index 00000000000..310d24a456a --- /dev/null +++ b/mysql-test/suite/row_lock/r/innodb_row_lock_4.result @@ -0,0 +1,142 @@ +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +DROP TABLE IF EXISTS t1, t2; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +CREATE INDEX ixi ON t2 (i); +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index +1 SIMPLE t2 ref ixi ixi 5 test.t1.i 2 Using where; Using index +SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; +i i +123 123 +124 124 +connection root1; +UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 126 4 126 +connection default; +UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 226 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 226 4 126 +connection default; +UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +DELETE FROM t1 WHERE t1.i=226; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 226 4 126 +connection default; +DELETE FROM t1 WHERE t1.i=224; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +COMMIT; +connection root1; +ROLLBACK; +connection default; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +connection default; +DROP TABLE t1, t2; +SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_5.result b/mysql-test/suite/row_lock/r/innodb_row_lock_5.result new file mode 100644 index 00000000000..ace5fddfad5 --- /dev/null +++ b/mysql-test/suite/row_lock/r/innodb_row_lock_5.result @@ -0,0 +1,32 @@ +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +DROP TABLE IF EXISTS t1, t2; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +CREATE INDEX ixi ON t2 (i); +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where +SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; +i i +123 123 +124 124 +connection root1; +UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab.result b/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab.result new file mode 100644 index 00000000000..8f00c3a0bb7 --- /dev/null +++ b/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab.result @@ -0,0 +1,97 @@ +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +CREATE INDEX ixi ON t2 (i); +CREATE PROCEDURE fill_t1 (IN upb int) +BEGIN +DECLARE cnt int DEFAULT 0; +WHILE cnt < upb DO +INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100); +SET cnt= cnt+1; +END WHILE; +END; +| +CREATE FUNCTION half_t1() RETURNS int +BEGIN +DECLARE res int DEFAULT 0; +SELECT count(*)/2 INTO res FROM t1; +RETURN res; +END; +| +CREATE PROCEDURE fill_t2 (IN upb int) +BEGIN +DECLARE cnt int DEFAULT 0; +WHILE cnt < upb DO +INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100); +SET cnt= cnt+1; +END WHILE; +END; +| +CREATE FUNCTION half_t2() RETURNS int +BEGIN +DECLARE res int DEFAULT 0; +SELECT count(*)/2 INTO res FROM t2; +RETURN res; +END; +| +CALL fill_t1 (10); +CALL fill_t2 (10); +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ixi ixi 5 NULL 10 Using where; Using index +1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where; Using index +SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE; +i i +connection root1; +SELECT k from t1 WHERE k < half_t1(); +k +0 +1 +2 +3 +4 +SELECT k from t1 WHERE k >= half_t1(); +k +5 +6 +7 +8 +9 +UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k < half_t1() AND t2.i=t1.i; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +0 1111 0 100 +1 1111 1 101 +2 1111 2 102 +3 1111 3 103 +4 1111 4 104 +5 105 5 105 +6 106 6 106 +7 107 7 107 +8 108 8 108 +9 109 9 109 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +0 2222 0 100 +1 2222 1 101 +2 2222 2 102 +3 2222 3 103 +4 2222 4 104 +5 105 5 105 +6 106 6 106 +7 107 7 107 +8 108 8 108 +9 109 9 109 +connection default; +UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k >= half_t1() AND t2.i=t1.i; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_1.result new file mode 100644 index 00000000000..0b12f149193 --- /dev/null +++ b/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_1.result @@ -0,0 +1,145 @@ +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +CREATE INDEX ixi ON t2 (i); +CREATE PROCEDURE fill_t1 (IN upb int) +BEGIN +DECLARE cnt int DEFAULT 0; +WHILE cnt < upb DO +INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100); +SET cnt= cnt+1; +END WHILE; +END; +| +CREATE FUNCTION half_t1() RETURNS int +BEGIN +DECLARE res int DEFAULT 0; +SELECT MOD(k,2) INTO res FROM t1; +RETURN res; +END; +| +CREATE PROCEDURE fill_t2 (IN upb int) +BEGIN +DECLARE cnt int DEFAULT 0; +WHILE cnt < upb DO +INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100); +SET cnt= cnt+1; +END WHILE; +END; +| +CREATE FUNCTION half_t2() RETURNS int +BEGIN +DECLARE res int DEFAULT 0; +SELECT MOD(k,2) INTO res FROM t2; +RETURN res; +END; +| +CALL fill_t1 (40); +CALL fill_t2 (40); +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index PRIMARY ixi 5 NULL 40 Using where; Using index +1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.k 1 +SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE; +i i +100 100 +102 102 +104 104 +106 106 +108 108 +110 110 +112 112 +114 114 +116 116 +118 118 +120 120 +122 122 +124 124 +126 126 +128 128 +130 130 +132 132 +134 134 +136 136 +138 138 +connection root1; +SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 1 AND t1.k = t2.k LOCK IN SHARE MODE; +i i +101 101 +103 103 +105 105 +107 107 +109 109 +111 111 +113 113 +115 115 +117 117 +119 119 +121 121 +123 123 +125 125 +127 127 +129 129 +131 131 +133 133 +135 135 +137 137 +139 139 +UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k % 2 = 1 AND t1.k = t2.k; +SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k; +k i j l +0 100 0 100 +1 1111 1 101 +2 102 2 102 +3 1111 3 103 +4 104 4 104 +5 1111 5 105 +6 106 6 106 +7 1111 7 107 +8 108 8 108 +9 1111 9 109 +10 110 10 110 +11 1111 11 111 +12 112 12 112 +13 1111 13 113 +14 114 14 114 +15 1111 15 115 +16 116 16 116 +17 1111 17 117 +18 118 18 118 +19 1111 19 119 +SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k; +k i j l +0 100 0 100 +1 2222 1 101 +2 102 2 102 +3 2222 3 103 +4 104 4 104 +5 2222 5 105 +6 106 6 106 +7 2222 7 107 +8 108 8 108 +9 2222 9 109 +10 110 10 110 +11 2222 11 111 +12 112 12 112 +13 2222 13 113 +14 114 14 114 +15 2222 15 115 +16 116 16 116 +17 2222 17 117 +18 118 18 118 +19 2222 19 119 +connection default; +UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_2.result new file mode 100644 index 00000000000..cc9f297f9fb --- /dev/null +++ b/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_2.result @@ -0,0 +1,113 @@ +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +CREATE INDEX ixi ON t2 (i); +CREATE PROCEDURE fill_t1 (IN upb int) +BEGIN +DECLARE cnt int DEFAULT 0; +WHILE cnt < upb DO +INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100); +SET cnt= cnt+1; +END WHILE; +END; +| +CREATE FUNCTION half_t1() RETURNS int +BEGIN +DECLARE res int DEFAULT 0; +SELECT MOD(k,2) INTO res FROM t1; +RETURN res; +END; +| +CREATE PROCEDURE fill_t2 (IN upb int) +BEGIN +DECLARE cnt int DEFAULT 0; +WHILE cnt < upb DO +INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100); +SET cnt= cnt+1; +END WHILE; +END; +| +CREATE FUNCTION half_t2() RETURNS int +BEGIN +DECLARE res int DEFAULT 0; +SELECT MOD(k,2) INTO res FROM t2; +RETURN res; +END; +| +CALL fill_t1 (40); +CALL fill_t2 (40); +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index PRIMARY ixi 5 NULL 40 Using where; Using index +1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.k 1 +SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE; +i i +100 100 +102 102 +104 104 +106 106 +108 108 +110 110 +112 112 +114 114 +116 116 +118 118 +120 120 +122 122 +124 124 +126 126 +128 128 +130 130 +132 132 +134 134 +136 136 +138 138 +connection root1; +DELETE FROM t1 WHERE t1.k % 2 = 1; +SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k; +k i j l +0 100 0 100 +2 102 2 102 +4 104 4 104 +6 106 6 106 +8 108 8 108 +10 110 10 110 +12 112 12 112 +14 114 14 114 +16 116 16 116 +18 118 18 118 +SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k; +k i j l +0 100 0 100 +1 101 1 101 +2 102 2 102 +3 103 3 103 +4 104 4 104 +5 105 5 105 +6 106 6 106 +7 107 7 107 +8 108 8 108 +9 109 9 109 +10 110 10 110 +11 111 11 111 +12 112 12 112 +13 113 13 113 +14 114 14 114 +15 115 15 115 +16 116 16 116 +17 117 17 117 +18 118 18 118 +19 119 19 119 +connection default; +UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_trig_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_trig_1.result new file mode 100644 index 00000000000..dd43e5752e5 --- /dev/null +++ b/mysql-test/suite/row_lock/r/innodb_row_lock_trig_1.result @@ -0,0 +1,151 @@ +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +CREATE INDEX ixi ON t2 (i); +CREATE TRIGGER trig_t2 AFTER UPDATE ON t2 +FOR EACH ROW BEGIN +UPDATE t1 SET l = NEW.i WHERE i = OLD.i; +END; +| +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index +SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +i +123 +124 +connection root1; +UPDATE t2 SET t2.i=225 WHERE t2.i=125; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 125 3 225 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 126 4 126 +connection default; +UPDATE t2 SET t2.i=223 WHERE t2.i=123; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 223 +2 124 2 124 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +UPDATE t2 SET t2.i=226 WHERE t2.i=126; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 125 3 225 +4 126 4 226 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 226 4 126 +connection default; +UPDATE t2 SET t2.i=224 WHERE t2.i=124; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 223 +2 124 2 224 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +DELETE FROM t1 WHERE t1.i=226; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 125 3 225 +4 126 4 226 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 226 4 126 +connection default; +DELETE FROM t1 WHERE t1.i=224; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 223 +2 124 2 224 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +COMMIT; +connection root1; +ROLLBACK; +connection default; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 223 +2 124 2 224 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 223 +2 124 2 224 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +connection default; +DROP TABLE t1, t2; +SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_trig_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_trig_2.result new file mode 100644 index 00000000000..cb3a5c692e9 --- /dev/null +++ b/mysql-test/suite/row_lock/r/innodb_row_lock_trig_2.result @@ -0,0 +1,37 @@ +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +#CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +#CREATE INDEX ixi ON t2 (i); +CREATE TRIGGER trig_t2 AFTER UPDATE ON t2 +FOR EACH ROW BEGIN +UPDATE t1 SET l = NEW.i WHERE i = OLD.i; +END; +| +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +i +123 +124 +connection root1; +UPDATE t2 SET t2.i=225 WHERE t2.i=125; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_1.result new file mode 100644 index 00000000000..834cb669833 --- /dev/null +++ b/mysql-test/suite/row_lock/r/innodb_row_lock_view_1.result @@ -0,0 +1,34 @@ +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +CREATE INDEX ixi ON t2 (i); +CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2; +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index +1 SIMPLE t2 ref ixi ixi 5 test.t1.i 2 Using where; Using index +SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; +i i +123 123 +124 124 +connection root1; +UPDATE v1 SET i=325 where i=125; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_2.result new file mode 100644 index 00000000000..440138d4cd1 --- /dev/null +++ b/mysql-test/suite/row_lock/r/innodb_row_lock_view_2.result @@ -0,0 +1,40 @@ +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +CREATE INDEX ixi ON t2 (i); +CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2; +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index +1 SIMPLE t2 index NULL PRIMARY 4 NULL 4 Using index +SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE; +i +123 +124 +123 +124 +123 +124 +123 +124 +connection root1; +UPDATE v1 SET i=325 where i=125; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_1.result new file mode 100644 index 00000000000..230873b67a0 --- /dev/null +++ b/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_1.result @@ -0,0 +1,48 @@ +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +CREATE INDEX ixi ON t2 (i); +CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2; +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index +1 SIMPLE t2 ref ixi ixi 5 test.t1.i 2 Using where; Using index +SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; +i i +123 123 +124 124 +connection root1; +UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 126 4 126 +connection default; +UPDATE v1 SET i=323 where i=123; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_2.result new file mode 100644 index 00000000000..d792d573f8e --- /dev/null +++ b/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_2.result @@ -0,0 +1,40 @@ +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +CREATE INDEX ixi ON t2 (i); +CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2; +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index +1 SIMPLE t2 index NULL PRIMARY 4 NULL 4 Using index +SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE; +i +123 +124 +123 +124 +123 +124 +123 +124 +connection root1; +UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_1.result new file mode 100644 index 00000000000..77b9a4dd964 --- /dev/null +++ b/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_1.result @@ -0,0 +1,312 @@ +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +SET autocommit=0; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +INSERT INTO t1 VALUES (5,127,5,127); +INSERT INTO t1 VALUES (6,128,6,128); +CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +INSERT INTO t2 VALUES (5,127,5,127); +INSERT INTO t2 VALUES (6,128,6,128); +CREATE INDEX ixi ON t2 (i); +CREATE VIEW v1 AS SELECT t1.i from t1; +CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA +BEGIN +UPDATE t2 SET i = p2 WHERE i = p1; +UPDATE v1 SET i = p2 WHERE i = p1; +SELECT * FROM v1 ORDER BY i; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; +END; +| +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ixi ixi 5 NULL 6 Using where; Using index +SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +i +123 +124 +connection root1; +CALL stp_t (125, 225); +i +123 +124 +126 +127 +128 +225 +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 126 4 126 +5 127 5 127 +6 128 6 128 +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 126 4 126 +5 127 5 127 +6 128 6 128 +connection root2; +CALL stp_t (127, 227); +i +123 +124 +125 +126 +128 +227 +k i j l +1 123 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +5 227 5 127 +6 128 6 128 +k i j l +1 123 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +5 227 5 127 +6 128 6 128 +connection default; +CALL stp_t (123, 223); +i +124 +125 +126 +127 +128 +223 +k i j l +1 223 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +5 127 5 127 +6 128 6 128 +k i j l +1 223 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +5 127 5 127 +6 128 6 128 +connection root1; +CALL stp_t (126, 226); +i +123 +124 +127 +128 +225 +226 +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 226 4 126 +5 127 5 127 +6 128 6 128 +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 226 4 126 +5 127 5 127 +6 128 6 128 +connection root2; +CALL stp_t (128, 228); +i +123 +124 +125 +126 +227 +228 +k i j l +1 123 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +5 227 5 127 +6 228 6 128 +k i j l +1 123 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +5 227 5 127 +6 228 6 128 +connection default; +CALL stp_t (124, 224); +i +125 +126 +127 +128 +223 +224 +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +5 127 5 127 +6 128 6 128 +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +5 127 5 127 +6 128 6 128 +connection root1; +DELETE FROM t1 WHERE t1.i=226; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +5 127 5 127 +6 128 6 128 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 226 4 126 +5 127 5 127 +6 128 6 128 +connection root2; +DELETE FROM t1 WHERE t1.i=228; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +5 227 5 127 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +5 227 5 127 +6 228 6 128 +connection default; +DELETE FROM t1 WHERE t1.i=224; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +3 125 3 125 +4 126 4 126 +5 127 5 127 +6 128 6 128 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +5 127 5 127 +6 128 6 128 +COMMIT; +connection root1; +ROLLBACK; +connection root1; +COMMIT; +connection default; +SELECT * FROM v1 ORDER BY i; +i +125 +126 +127 +128 +223 +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +3 125 3 125 +4 126 4 126 +5 127 5 127 +6 128 6 128 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +5 127 5 127 +6 128 6 128 +connection root1; +SELECT * FROM v1 ORDER BY i; +i +125 +126 +127 +128 +223 +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +3 125 3 125 +4 126 4 126 +5 127 5 127 +6 128 6 128 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +5 127 5 127 +6 128 6 128 +connection root2; +SELECT * FROM v1 ORDER BY i; +i +123 +124 +125 +126 +227 +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +5 227 5 127 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +5 227 5 127 +6 228 6 128 +connection default; +DROP TABLE t1, t2; +DROP VIEW v1; +SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_2.result new file mode 100644 index 00000000000..73d8a3f4bea --- /dev/null +++ b/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_2.result @@ -0,0 +1,47 @@ +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +SET autocommit=0; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +INSERT INTO t1 VALUES (5,127,5,127); +INSERT INTO t1 VALUES (6,128,6,128); +#CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +INSERT INTO t2 VALUES (5,127,5,127); +INSERT INTO t2 VALUES (6,128,6,128); +#CREATE INDEX ixi ON t2 (i); +CREATE VIEW v1 AS SELECT t1.i from t1; +CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA +BEGIN +UPDATE t2 SET i = p2 WHERE i = p1; +UPDATE v1 SET i = p2 WHERE i = p1; +SELECT * FROM v1 ORDER BY i; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; +END; +| +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using where +SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +i +123 +124 +connection root1; +CALL stp_t (125, 225); diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_1.result new file mode 100644 index 00000000000..90383a9489f --- /dev/null +++ b/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_1.result @@ -0,0 +1,183 @@ +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +CREATE INDEX ixi ON t2 (i); +CREATE VIEW v1 AS SELECT t1.i from t1; +CREATE TRIGGER trig_t2 AFTER UPDATE ON t2 +FOR EACH ROW BEGIN +UPDATE v1 SET i = NEW.i WHERE i = OLD.i; +END; +| +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index +SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +i +123 +124 +connection root1; +UPDATE t2 SET t2.i=225 WHERE t2.i=125; +SELECT * FROM v1 ORDER BY i; +i +123 +124 +126 +225 +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 126 4 126 +connection default; +UPDATE t2 SET t2.i=223 WHERE t2.i=123; +SELECT * FROM v1 ORDER BY i; +i +124 +125 +126 +223 +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +UPDATE t2 SET t2.i=226 WHERE t2.i=126; +SELECT * FROM v1 ORDER BY i; +i +123 +124 +225 +226 +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 226 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 226 4 126 +connection default; +UPDATE t2 SET t2.i=224 WHERE t2.i=124; +SELECT * FROM v1 ORDER BY i; +i +125 +126 +223 +224 +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +DELETE FROM t1 WHERE t1.i=226; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 226 4 126 +connection default; +DELETE FROM t1 WHERE t1.i=224; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +COMMIT; +connection root1; +ROLLBACK; +connection default; +SELECT * FROM v1 ORDER BY i; +i +125 +126 +223 +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +SELECT * FROM v1 ORDER BY i; +i +125 +126 +223 +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +connection default; +DROP TABLE t1, t2; +DROP VIEW v1; +SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_2.result new file mode 100644 index 00000000000..55793558b21 --- /dev/null +++ b/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_2.result @@ -0,0 +1,38 @@ +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +#CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +#CREATE INDEX ixi ON t2 (i); +CREATE VIEW v1 AS SELECT t1.i from t1; +CREATE TRIGGER trig_t2 AFTER UPDATE ON t2 +FOR EACH ROW BEGIN +UPDATE v1 SET i = NEW.i WHERE i = OLD.i; +END; +| +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +i +123 +124 +connection root1; +UPDATE t2 SET t2.i=225 WHERE t2.i=125; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_1.result new file mode 100644 index 00000000000..248c7d5ea1f --- /dev/null +++ b/mysql-test/suite/row_lock/r/ndb_row_lock_1.result @@ -0,0 +1,139 @@ +DROP TABLE IF EXISTS t1, t2; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +CREATE INDEX ixi ON t2 (i); +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where +1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where +SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; +i i +123 123 +124 124 +connection root1; +UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 126 4 126 +connection default; +UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 226 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 226 4 126 +connection default; +UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +DELETE FROM t1 WHERE t1.i=226; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 226 4 126 +connection default; +DELETE FROM t1 WHERE t1.i=224; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +COMMIT; +connection root1; +ROLLBACK; +connection default; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +connection default; +DROP TABLE t1, t2; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_2.result new file mode 100644 index 00000000000..109d99dd036 --- /dev/null +++ b/mysql-test/suite/row_lock/r/ndb_row_lock_2.result @@ -0,0 +1,31 @@ +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +#CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +#CREATE INDEX ixi ON t2 (i); +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where +SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; +i i +123 123 +124 124 +connection root1; +UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_3.result b/mysql-test/suite/row_lock/r/ndb_row_lock_3.result new file mode 100644 index 00000000000..c936ea209ff --- /dev/null +++ b/mysql-test/suite/row_lock/r/ndb_row_lock_3.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS t1, t2; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +#CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +#CREATE INDEX ixi ON t2 (i); +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where +SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; +i i +123 123 +124 124 +connection root1; +UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_4.result b/mysql-test/suite/row_lock/r/ndb_row_lock_4.result new file mode 100644 index 00000000000..875c783bd81 --- /dev/null +++ b/mysql-test/suite/row_lock/r/ndb_row_lock_4.result @@ -0,0 +1,139 @@ +DROP TABLE IF EXISTS t1, t2; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +CREATE INDEX ixi ON t2 (i); +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where +1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where +SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; +i i +123 123 +124 124 +connection root1; +UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 126 4 126 +connection default; +UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 226 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 226 4 126 +connection default; +UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +DELETE FROM t1 WHERE t1.i=226; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 226 4 126 +connection default; +DELETE FROM t1 WHERE t1.i=224; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +COMMIT; +connection root1; +ROLLBACK; +connection default; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +connection default; +DROP TABLE t1, t2; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_5.result b/mysql-test/suite/row_lock/r/ndb_row_lock_5.result new file mode 100644 index 00000000000..0d94f8abf72 --- /dev/null +++ b/mysql-test/suite/row_lock/r/ndb_row_lock_5.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS t1, t2; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +CREATE INDEX ixi ON t2 (i); +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where +SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; +i i +123 123 +124 124 +connection root1; +UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab.result b/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab.result new file mode 100644 index 00000000000..94b67c63d94 --- /dev/null +++ b/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab.result @@ -0,0 +1,177 @@ +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +CREATE INDEX ixi ON t2 (i); +CREATE PROCEDURE fill_t1 (IN upb int) +BEGIN +DECLARE cnt int DEFAULT 0; +WHILE cnt < upb DO +INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100); +SET cnt= cnt+1; +END WHILE; +END; +| +CREATE FUNCTION half_t1() RETURNS int +BEGIN +DECLARE res int DEFAULT 0; +SELECT count(*)/2 INTO res FROM t1; +RETURN res; +END; +| +CREATE PROCEDURE fill_t2 (IN upb int) +BEGIN +DECLARE cnt int DEFAULT 0; +WHILE cnt < upb DO +INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100); +SET cnt= cnt+1; +END WHILE; +END; +| +CREATE FUNCTION half_t2() RETURNS int +BEGIN +DECLARE res int DEFAULT 0; +SELECT count(*)/2 INTO res FROM t2; +RETURN res; +END; +| +CALL fill_t1 (10); +CALL fill_t2 (10); +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where +1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where +SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE; +i i +connection root1; +SELECT k from t1 WHERE k < half_t1(); +k +0 +3 +1 +2 +4 +SELECT k from t1 WHERE k >= half_t1(); +k +6 +7 +9 +5 +8 +UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k < half_t1() AND t2.i=t1.i; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +0 1111 0 100 +1 1111 1 101 +2 1111 2 102 +3 1111 3 103 +4 1111 4 104 +5 105 5 105 +6 106 6 106 +7 107 7 107 +8 108 8 108 +9 109 9 109 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +0 2222 0 100 +1 2222 1 101 +2 2222 2 102 +3 2222 3 103 +4 2222 4 104 +5 105 5 105 +6 106 6 106 +7 107 7 107 +8 108 8 108 +9 109 9 109 +connection default; +UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k >= half_t1() AND t2.i=t1.i; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +0 100 0 100 +1 101 1 101 +2 102 2 102 +3 103 3 103 +4 104 4 104 +5 3333 5 105 +6 3333 6 106 +7 3333 7 107 +8 3333 8 108 +9 3333 9 109 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +0 100 0 100 +1 101 1 101 +2 102 2 102 +3 103 3 103 +4 104 4 104 +5 4444 5 105 +6 4444 6 106 +7 4444 7 107 +8 4444 8 108 +9 4444 9 109 +COMMIT; +connection root1; +ROLLBACK; +connection default; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +0 100 0 100 +1 101 1 101 +2 102 2 102 +3 103 3 103 +4 104 4 104 +5 3333 5 105 +6 3333 6 106 +7 3333 7 107 +8 3333 8 108 +9 3333 9 109 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +0 100 0 100 +1 101 1 101 +2 102 2 102 +3 103 3 103 +4 104 4 104 +5 4444 5 105 +6 4444 6 106 +7 4444 7 107 +8 4444 8 108 +9 4444 9 109 +connection root1; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +0 100 0 100 +1 101 1 101 +2 102 2 102 +3 103 3 103 +4 104 4 104 +5 3333 5 105 +6 3333 6 106 +7 3333 7 107 +8 3333 8 108 +9 3333 9 109 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +0 100 0 100 +1 101 1 101 +2 102 2 102 +3 103 3 103 +4 104 4 104 +5 4444 5 105 +6 4444 6 106 +7 4444 7 107 +8 4444 8 108 +9 4444 9 109 +connection default; +DROP VIEW IF EXISTS v1; +Warnings: +Note 1051 Unknown table 'test.v1' +DROP TABLE t1, t2; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_1.result new file mode 100644 index 00000000000..9803895e1a7 --- /dev/null +++ b/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_1.result @@ -0,0 +1,357 @@ +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +CREATE INDEX ixi ON t2 (i); +CREATE PROCEDURE fill_t1 (IN upb int) +BEGIN +DECLARE cnt int DEFAULT 0; +WHILE cnt < upb DO +INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100); +SET cnt= cnt+1; +END WHILE; +END; +| +CREATE FUNCTION half_t1() RETURNS int +BEGIN +DECLARE res int DEFAULT 0; +SELECT MOD(k,2) INTO res FROM t1; +RETURN res; +END; +| +CREATE PROCEDURE fill_t2 (IN upb int) +BEGIN +DECLARE cnt int DEFAULT 0; +WHILE cnt < upb DO +INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100); +SET cnt= cnt+1; +END WHILE; +END; +| +CREATE FUNCTION half_t2() RETURNS int +BEGIN +DECLARE res int DEFAULT 0; +SELECT MOD(k,2) INTO res FROM t2; +RETURN res; +END; +| +CALL fill_t1 (200); +CALL fill_t2 (200); +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 200 Using where +1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.k 1 +SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE; +i i +135 135 +119 119 +211 211 +184 184 +232 232 +105 105 +188 188 +216 216 +255 255 +154 154 +197 197 +279 279 +218 218 +127 127 +203 203 +281 281 +194 194 +161 161 +276 276 +122 122 +139 139 +183 183 +114 114 +247 247 +144 144 +148 148 +174 174 +267 267 +142 142 +168 168 +226 226 +258 258 +231 231 +146 146 +253 253 +189 189 +230 230 +290 290 +178 178 +158 158 +130 130 +214 214 +133 133 +229 229 +294 294 +295 295 +108 108 +112 112 +297 297 +151 151 +251 251 +270 270 +291 291 +159 159 +132 132 +121 121 +244 244 +272 272 +293 293 +186 186 +111 111 +166 166 +201 201 +175 175 +180 180 +209 209 +192 192 +246 246 +195 195 +107 107 +233 233 +239 239 +103 103 +109 109 +128 128 +266 266 +143 143 +160 160 +187 187 +243 243 +273 273 +259 259 +110 110 +176 176 +141 141 +170 170 +215 215 +191 191 +200 200 +271 271 +162 162 +260 260 +106 106 +150 150 +126 126 +147 147 +155 155 +193 193 +207 207 +287 287 +235 235 +252 252 +129 129 +205 205 +268 268 +278 278 +116 116 +137 137 +199 199 +217 217 +234 234 +190 190 +236 236 +257 257 +100 100 +210 210 +212 212 +264 264 +221 221 +241 241 +256 256 +262 262 +265 265 +269 269 +277 277 +173 173 +177 177 +208 208 +219 219 +285 285 +101 101 +164 164 +113 113 +125 125 +202 202 +140 140 +156 156 +282 282 +181 181 +206 206 +299 299 +102 102 +145 145 +227 227 +196 196 +138 138 +198 198 +204 204 +237 237 +171 171 +284 284 +263 263 +292 292 +104 104 +149 149 +250 250 +296 296 +228 228 +280 280 +242 242 +248 248 +185 185 +220 220 +245 245 +275 275 +118 118 +120 120 +152 152 +153 153 +157 157 +182 182 +179 179 +254 254 +288 288 +172 172 +283 283 +286 286 +115 115 +238 238 +289 289 +131 131 +223 223 +134 134 +136 136 +222 222 +225 225 +261 261 +274 274 +123 123 +163 163 +224 224 +117 117 +298 298 +169 169 +124 124 +167 167 +240 240 +249 249 +165 165 +213 213 +connection root1; +SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 1 AND t1.k = t2.k LOCK IN SHARE MODE; +i i +209 209 +195 195 +107 107 +233 233 +239 239 +103 103 +109 109 +143 143 +187 187 +243 243 +273 273 +259 259 +141 141 +215 215 +191 191 +271 271 +147 147 +155 155 +193 193 +207 207 +287 287 +235 235 +129 129 +205 205 +137 137 +199 199 +217 217 +257 257 +221 221 +241 241 +265 265 +269 269 +277 277 +173 173 +177 177 +135 135 +119 119 +211 211 +105 105 +255 255 +197 197 +279 279 +127 127 +203 203 +281 281 +161 161 +139 139 +183 183 +247 247 +267 267 +231 231 +253 253 +189 189 +133 133 +229 229 +295 295 +297 297 +151 151 +251 251 +291 291 +159 159 +121 121 +293 293 +111 111 +201 201 +175 175 +185 185 +245 245 +275 275 +153 153 +157 157 +179 179 +283 283 +115 115 +289 289 +131 131 +223 223 +225 225 +261 261 +123 123 +163 163 +117 117 +169 169 +167 167 +249 249 +165 165 +213 213 +219 219 +285 285 +101 101 +113 113 +125 125 +181 181 +299 299 +145 145 +227 227 +237 237 +171 171 +263 263 +149 149 +UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k % 2 = 1 AND t1.k = t2.k; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_2.result new file mode 100644 index 00000000000..adb89b03480 --- /dev/null +++ b/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_2.result @@ -0,0 +1,255 @@ +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +CREATE INDEX ixi ON t2 (i); +CREATE PROCEDURE fill_t1 (IN upb int) +BEGIN +DECLARE cnt int DEFAULT 0; +WHILE cnt < upb DO +INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100); +SET cnt= cnt+1; +END WHILE; +END; +| +CREATE FUNCTION half_t1() RETURNS int +BEGIN +DECLARE res int DEFAULT 0; +SELECT MOD(k,2) INTO res FROM t1; +RETURN res; +END; +| +CREATE PROCEDURE fill_t2 (IN upb int) +BEGIN +DECLARE cnt int DEFAULT 0; +WHILE cnt < upb DO +INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100); +SET cnt= cnt+1; +END WHILE; +END; +| +CREATE FUNCTION half_t2() RETURNS int +BEGIN +DECLARE res int DEFAULT 0; +SELECT MOD(k,2) INTO res FROM t2; +RETURN res; +END; +| +CALL fill_t1 (200); +CALL fill_t2 (200); +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 200 Using where +1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.k 1 +SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE; +i i +135 135 +119 119 +211 211 +184 184 +232 232 +105 105 +188 188 +216 216 +255 255 +154 154 +197 197 +279 279 +218 218 +127 127 +203 203 +281 281 +194 194 +161 161 +276 276 +122 122 +139 139 +183 183 +114 114 +247 247 +144 144 +148 148 +174 174 +267 267 +142 142 +168 168 +226 226 +258 258 +231 231 +146 146 +253 253 +189 189 +230 230 +290 290 +178 178 +158 158 +130 130 +214 214 +133 133 +229 229 +294 294 +295 295 +108 108 +112 112 +297 297 +151 151 +251 251 +270 270 +291 291 +159 159 +132 132 +121 121 +244 244 +272 272 +293 293 +186 186 +111 111 +166 166 +201 201 +175 175 +180 180 +209 209 +192 192 +246 246 +195 195 +107 107 +233 233 +239 239 +103 103 +109 109 +128 128 +266 266 +143 143 +160 160 +187 187 +243 243 +273 273 +259 259 +110 110 +176 176 +141 141 +170 170 +215 215 +191 191 +200 200 +271 271 +162 162 +260 260 +106 106 +150 150 +126 126 +147 147 +155 155 +193 193 +207 207 +287 287 +235 235 +252 252 +129 129 +205 205 +268 268 +278 278 +116 116 +137 137 +199 199 +217 217 +234 234 +190 190 +236 236 +257 257 +100 100 +210 210 +212 212 +264 264 +221 221 +241 241 +256 256 +262 262 +265 265 +269 269 +277 277 +173 173 +177 177 +208 208 +219 219 +285 285 +101 101 +164 164 +113 113 +125 125 +202 202 +140 140 +156 156 +282 282 +181 181 +206 206 +299 299 +102 102 +145 145 +227 227 +196 196 +138 138 +198 198 +204 204 +237 237 +171 171 +284 284 +263 263 +292 292 +104 104 +149 149 +250 250 +296 296 +228 228 +280 280 +242 242 +248 248 +185 185 +220 220 +245 245 +275 275 +118 118 +120 120 +152 152 +153 153 +157 157 +182 182 +179 179 +254 254 +288 288 +172 172 +283 283 +286 286 +115 115 +238 238 +289 289 +131 131 +223 223 +134 134 +136 136 +222 222 +225 225 +261 261 +274 274 +123 123 +163 163 +224 224 +117 117 +298 298 +169 169 +124 124 +167 167 +240 240 +249 249 +165 165 +213 213 +connection root1; +DELETE FROM t1 WHERE t1.k % 2 = 1; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_trig_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_trig_1.result new file mode 100644 index 00000000000..eb69fd2e306 --- /dev/null +++ b/mysql-test/suite/row_lock/r/ndb_row_lock_trig_1.result @@ -0,0 +1,148 @@ +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +CREATE INDEX ixi ON t2 (i); +CREATE TRIGGER trig_t2 AFTER UPDATE ON t2 +FOR EACH ROW BEGIN +UPDATE t1 SET l = NEW.i WHERE i = OLD.i; +END; +| +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where +SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +i +123 +124 +connection root1; +UPDATE t2 SET t2.i=225 WHERE t2.i=125; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 125 3 225 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 126 4 126 +connection default; +UPDATE t2 SET t2.i=223 WHERE t2.i=123; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 223 +2 124 2 124 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +UPDATE t2 SET t2.i=226 WHERE t2.i=126; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 125 3 225 +4 126 4 226 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 226 4 126 +connection default; +UPDATE t2 SET t2.i=224 WHERE t2.i=124; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 223 +2 124 2 224 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +DELETE FROM t1 WHERE t1.i=226; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 125 3 225 +4 126 4 226 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 226 4 126 +connection default; +DELETE FROM t1 WHERE t1.i=224; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 223 +2 124 2 224 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +COMMIT; +connection root1; +ROLLBACK; +connection default; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 223 +2 124 2 224 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 223 +2 124 2 224 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +connection default; +DROP TABLE t1, t2; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_trig_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_trig_2.result new file mode 100644 index 00000000000..bedb75da93a --- /dev/null +++ b/mysql-test/suite/row_lock/r/ndb_row_lock_trig_2.result @@ -0,0 +1,35 @@ +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +#CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +#CREATE INDEX ixi ON t2 (i); +CREATE TRIGGER trig_t2 AFTER UPDATE ON t2 +FOR EACH ROW BEGIN +UPDATE t1 SET l = NEW.i WHERE i = OLD.i; +END; +| +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +i +123 +124 +connection root1; +UPDATE t2 SET t2.i=225 WHERE t2.i=125; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_1.result new file mode 100644 index 00000000000..279f2626c73 --- /dev/null +++ b/mysql-test/suite/row_lock/r/ndb_row_lock_view_1.result @@ -0,0 +1,194 @@ +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +CREATE INDEX ixi ON t2 (i); +CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2; +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where +1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where +SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; +i i +123 123 +124 124 +connection root1; +UPDATE v1 SET i=325 where i=125; +SELECT * FROM v1 ORDER BY i,l; +i l +123 123 +123 124 +123 125 +123 126 +124 123 +124 124 +124 125 +124 126 +126 123 +126 124 +126 125 +126 126 +325 123 +325 124 +325 125 +325 126 +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 325 3 125 +4 126 4 126 +connection default; +UPDATE v1 SET i=323 where i=123; +SELECT * FROM v1 ORDER BY i,l; +i l +124 123 +124 124 +124 125 +124 126 +125 123 +125 124 +125 125 +125 126 +126 123 +126 124 +126 125 +126 126 +323 123 +323 124 +323 125 +323 126 +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 323 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +UPDATE v1 SET i=326 where i=126; +SELECT * FROM v1 ORDER BY i,l; +i l +123 123 +123 124 +123 125 +123 126 +124 123 +124 124 +124 125 +124 126 +325 123 +325 124 +325 125 +325 126 +326 123 +326 124 +326 125 +326 126 +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 325 3 125 +4 326 4 126 +connection default; +UPDATE v1 SET i=324 where i=124; +SELECT * FROM v1 ORDER BY i,l; +i l +125 123 +125 124 +125 125 +125 126 +126 123 +126 124 +126 125 +126 126 +323 123 +323 124 +323 125 +323 126 +324 123 +324 124 +324 125 +324 126 +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 323 1 123 +2 324 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +DELETE FROM t1 WHERE t1.i=226; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 325 3 125 +4 326 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +connection default; +DELETE FROM t1 WHERE t1.i=224; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 323 1 123 +2 324 2 124 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +COMMIT; +connection root1; +ROLLBACK; +connection default; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 323 1 123 +2 324 2 124 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 323 1 123 +2 324 2 124 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +connection default; +DROP VIEW IF EXISTS v1; +DROP TABLE t1, t2; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_2.result new file mode 100644 index 00000000000..9e74e93b0cc --- /dev/null +++ b/mysql-test/suite/row_lock/r/ndb_row_lock_view_2.result @@ -0,0 +1,200 @@ +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +CREATE INDEX ixi ON t2 (i); +CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2; +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where +1 SIMPLE t2 ALL NULL NULL NULL NULL 4 +SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE; +i +123 +124 +123 +124 +123 +124 +123 +124 +connection root1; +UPDATE v1 SET i=325 where i=125; +SELECT * FROM v1 ORDER BY i,l; +i l +123 123 +123 124 +123 125 +123 126 +124 123 +124 124 +124 125 +124 126 +126 123 +126 124 +126 125 +126 126 +325 123 +325 124 +325 125 +325 126 +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 325 3 125 +4 126 4 126 +connection default; +UPDATE v1 SET i=323 where i=123; +SELECT * FROM v1 ORDER BY i,l; +i l +124 123 +124 124 +124 125 +124 126 +125 123 +125 124 +125 125 +125 126 +126 123 +126 124 +126 125 +126 126 +323 123 +323 124 +323 125 +323 126 +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 323 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +UPDATE v1 SET i=326 where i=126; +SELECT * FROM v1 ORDER BY i,l; +i l +123 123 +123 124 +123 125 +123 126 +124 123 +124 124 +124 125 +124 126 +325 123 +325 124 +325 125 +325 126 +326 123 +326 124 +326 125 +326 126 +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 325 3 125 +4 326 4 126 +connection default; +UPDATE v1 SET i=324 where i=124; +SELECT * FROM v1 ORDER BY i,l; +i l +125 123 +125 124 +125 125 +125 126 +126 123 +126 124 +126 125 +126 126 +323 123 +323 124 +323 125 +323 126 +324 123 +324 124 +324 125 +324 126 +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 323 1 123 +2 324 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +DELETE FROM t1 WHERE t1.i=226; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 325 3 125 +4 326 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +connection default; +DELETE FROM t1 WHERE t1.i=224; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 323 1 123 +2 324 2 124 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +COMMIT; +connection root1; +ROLLBACK; +connection default; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 323 1 123 +2 324 2 124 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 323 1 123 +2 324 2 124 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +connection default; +DROP VIEW IF EXISTS v1; +DROP TABLE t1, t2; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_1.result new file mode 100644 index 00000000000..b5b1c519702 --- /dev/null +++ b/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_1.result @@ -0,0 +1,169 @@ +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +CREATE INDEX ixi ON t2 (i); +CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2; +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where +1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where +SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; +i i +123 123 +124 124 +connection root1; +UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 126 4 126 +connection default; +UPDATE v1 SET i=323 where i=123; +SELECT * FROM v1 ORDER BY i,l; +i l +124 123 +124 124 +124 125 +124 126 +125 123 +125 124 +125 125 +125 126 +126 123 +126 124 +126 125 +126 126 +323 123 +323 124 +323 125 +323 126 +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 323 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 226 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 226 4 126 +connection default; +UPDATE v1 SET i=324 where i=124; +SELECT * FROM v1 ORDER BY i,l; +i l +125 123 +125 124 +125 125 +125 126 +126 123 +126 124 +126 125 +126 126 +323 123 +323 124 +323 125 +323 126 +324 123 +324 124 +324 125 +324 126 +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 323 1 123 +2 324 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +DELETE FROM t1 WHERE t1.i=226; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 226 4 126 +connection default; +DELETE FROM t1 WHERE t1.i=224; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 323 1 123 +2 324 2 124 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +COMMIT; +connection root1; +ROLLBACK; +connection default; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 323 1 123 +2 324 2 124 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 323 1 123 +2 324 2 124 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +connection default; +DROP VIEW IF EXISTS v1; +DROP TABLE t1, t2; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_2.result new file mode 100644 index 00000000000..d92f9ad9664 --- /dev/null +++ b/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_2.result @@ -0,0 +1,38 @@ +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +CREATE INDEX ixi ON t2 (i); +CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2; +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where +1 SIMPLE t2 ALL NULL NULL NULL NULL 4 +SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE; +i +123 +124 +123 +124 +123 +124 +123 +124 +connection root1; +UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_1.result new file mode 100644 index 00000000000..e2a2a6e7deb --- /dev/null +++ b/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_1.result @@ -0,0 +1,309 @@ +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +DROP PROCEDURE IF EXISTS stp_t; +SET autocommit=0; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +INSERT INTO t1 VALUES (5,127,5,127); +INSERT INTO t1 VALUES (6,128,6,128); +CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +INSERT INTO t2 VALUES (5,127,5,127); +INSERT INTO t2 VALUES (6,128,6,128); +CREATE INDEX ixi ON t2 (i); +CREATE VIEW v1 AS SELECT t1.i from t1; +CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA +BEGIN +UPDATE t2 SET i = p2 WHERE i = p1; +UPDATE v1 SET i = p2 WHERE i = p1; +SELECT * FROM v1 ORDER BY i; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; +END; +| +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where +SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +i +123 +124 +connection root1; +CALL stp_t (125, 225); +i +123 +124 +126 +127 +128 +225 +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 126 4 126 +5 127 5 127 +6 128 6 128 +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 126 4 126 +5 127 5 127 +6 128 6 128 +connection root2; +CALL stp_t (127, 227); +i +123 +124 +125 +126 +128 +227 +k i j l +1 123 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +5 227 5 127 +6 128 6 128 +k i j l +1 123 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +5 227 5 127 +6 128 6 128 +connection default; +CALL stp_t (123, 223); +i +124 +125 +126 +127 +128 +223 +k i j l +1 223 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +5 127 5 127 +6 128 6 128 +k i j l +1 223 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +5 127 5 127 +6 128 6 128 +connection root1; +CALL stp_t (126, 226); +i +123 +124 +127 +128 +225 +226 +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 226 4 126 +5 127 5 127 +6 128 6 128 +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 226 4 126 +5 127 5 127 +6 128 6 128 +connection root2; +CALL stp_t (128, 228); +i +123 +124 +125 +126 +227 +228 +k i j l +1 123 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +5 227 5 127 +6 228 6 128 +k i j l +1 123 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +5 227 5 127 +6 228 6 128 +connection default; +CALL stp_t (124, 224); +i +125 +126 +127 +128 +223 +224 +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +5 127 5 127 +6 128 6 128 +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +5 127 5 127 +6 128 6 128 +connection root1; +DELETE FROM t1 WHERE t1.i=226; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +5 127 5 127 +6 128 6 128 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 226 4 126 +5 127 5 127 +6 128 6 128 +connection root2; +DELETE FROM t1 WHERE t1.i=228; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +5 227 5 127 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +5 227 5 127 +6 228 6 128 +connection default; +DELETE FROM t1 WHERE t1.i=224; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +3 125 3 125 +4 126 4 126 +5 127 5 127 +6 128 6 128 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +5 127 5 127 +6 128 6 128 +COMMIT; +connection root1; +ROLLBACK; +connection root1; +COMMIT; +connection default; +SELECT * FROM v1 ORDER BY i; +i +125 +126 +127 +128 +223 +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +3 125 3 125 +4 126 4 126 +5 127 5 127 +6 128 6 128 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +5 127 5 127 +6 128 6 128 +connection root1; +SELECT * FROM v1 ORDER BY i; +i +125 +126 +127 +128 +223 +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +3 125 3 125 +4 126 4 126 +5 127 5 127 +6 128 6 128 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +5 127 5 127 +6 128 6 128 +connection root2; +SELECT * FROM v1 ORDER BY i; +i +125 +126 +223 +227 +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +3 125 3 125 +4 126 4 126 +5 227 5 127 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +5 227 5 127 +6 228 6 128 +connection default; +DROP VIEW v1; +DROP PROCEDURE stp_t; +DROP TABLE t1, t2; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_2.result new file mode 100644 index 00000000000..6dbd5f834ed --- /dev/null +++ b/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_2.result @@ -0,0 +1,46 @@ +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +DROP PROCEDURE IF EXISTS stp_t; +SET autocommit=0; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +INSERT INTO t1 VALUES (5,127,5,127); +INSERT INTO t1 VALUES (6,128,6,128); +#CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +INSERT INTO t2 VALUES (5,127,5,127); +INSERT INTO t2 VALUES (6,128,6,128); +#CREATE INDEX ixi ON t2 (i); +CREATE VIEW v1 AS SELECT t1.i from t1; +CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA +BEGIN +UPDATE t2 SET i = p2 WHERE i = p1; +UPDATE v1 SET i = p2 WHERE i = p1; +SELECT * FROM v1 ORDER BY i; +SELECT * FROM t1 ORDER BY t1.k; +SELECT * FROM t2 ORDER BY t2.k; +END; +| +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using where +SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +i +123 +124 +connection root1; +CALL stp_t (125, 225); diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_1.result new file mode 100644 index 00000000000..f5c745ca41c --- /dev/null +++ b/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_1.result @@ -0,0 +1,180 @@ +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +CREATE INDEX ixi ON t2 (i); +CREATE VIEW v1 AS SELECT t1.i from t1; +CREATE TRIGGER trig_t2 AFTER UPDATE ON t2 +FOR EACH ROW BEGIN +UPDATE v1 SET i = NEW.i WHERE i = OLD.i; +END; +| +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where +SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +i +123 +124 +connection root1; +UPDATE t2 SET t2.i=225 WHERE t2.i=125; +SELECT * FROM v1 ORDER BY i; +i +123 +124 +126 +225 +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 126 4 126 +connection default; +UPDATE t2 SET t2.i=223 WHERE t2.i=123; +SELECT * FROM v1 ORDER BY i; +i +124 +125 +126 +223 +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 124 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +UPDATE t2 SET t2.i=226 WHERE t2.i=126; +SELECT * FROM v1 ORDER BY i; +i +123 +124 +225 +226 +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 226 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 226 4 126 +connection default; +UPDATE t2 SET t2.i=224 WHERE t2.i=124; +SELECT * FROM v1 ORDER BY i; +i +125 +126 +223 +224 +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +DELETE FROM t1 WHERE t1.i=226; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 123 1 123 +2 124 2 124 +3 225 3 125 +4 226 4 126 +connection default; +DELETE FROM t1 WHERE t1.i=224; +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +COMMIT; +connection root1; +ROLLBACK; +connection default; +SELECT * FROM v1 ORDER BY i; +i +125 +126 +223 +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +connection root1; +SELECT * FROM v1 ORDER BY i; +i +125 +126 +223 +SELECT * FROM t1 ORDER BY t1.k; +k i j l +1 223 1 123 +3 125 3 125 +4 126 4 126 +SELECT * FROM t2 ORDER BY t2.k; +k i j l +1 223 1 123 +2 224 2 124 +3 125 3 125 +4 126 4 126 +connection default; +DROP TABLE t1, t2; +DROP VIEW v1; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_2.result new file mode 100644 index 00000000000..d6a38753c1d --- /dev/null +++ b/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_2.result @@ -0,0 +1,36 @@ +DROP TABLE IF EXISTS t1, t2; +DROP VIEW IF EXISTS v1; +SET autocommit=0; +SET autocommit=0; +connection default; +CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +INSERT INTO t1 VALUES (1,123,1,123); +INSERT INTO t1 VALUES (2,124,2,124); +INSERT INTO t1 VALUES (3,125,3,125); +INSERT INTO t1 VALUES (4,126,4,126); +#CREATE INDEX ixi ON t1 (i); +CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; +INSERT INTO t2 VALUES (1,123,1,123); +INSERT INTO t2 VALUES (2,124,2,124); +INSERT INTO t2 VALUES (3,125,3,125); +INSERT INTO t2 VALUES (4,126,4,126); +#CREATE INDEX ixi ON t2 (i); +CREATE VIEW v1 AS SELECT t1.i from t1; +CREATE TRIGGER trig_t2 AFTER UPDATE ON t2 +FOR EACH ROW BEGIN +UPDATE v1 SET i = NEW.i WHERE i = OLD.i; +END; +| +COMMIT; +SELECT @@global.tx_isolation; +@@global.tx_isolation +REPEATABLE-READ +EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +i +123 +124 +connection root1; +UPDATE t2 SET t2.i=225 WHERE t2.i=125; diff --git a/mysql-test/suite/row_lock/readme.txt b/mysql-test/suite/row_lock/readme.txt new file mode 100644 index 00000000000..b43f04ecda4 --- /dev/null +++ b/mysql-test/suite/row_lock/readme.txt @@ -0,0 +1,9 @@ +All row lock test with InnoDB have to be executed with the options + +--innodb_lock_wait_timeout=1 +--innodb_locks_unsafe_for_binlog + +for example + +perl mysql-test-run.pl --mysqld=--innodb_lock_wait_timeout=2 --mysqld=--innodb_locks_unsafe_for_binlog --suite=row_lock innodb_row_lock_2 + diff --git a/mysql-test/suite/row_lock/summary_of_sel_test.txt b/mysql-test/suite/row_lock/summary_of_sel_test.txt new file mode 100644 index 00000000000..0fa332e957a --- /dev/null +++ b/mysql-test/suite/row_lock/summary_of_sel_test.txt @@ -0,0 +1,36 @@ +Test plan: +Create 2 tables with a primary key and 3 integer columns. Both get the same rows (1,123,1,123),(2,124,2,124),(3,125,3,125),(4,126,4,126). The second and third column may get an index to have cases with, without and mutilple index. Create views on the tables. Create an update trigger. Create a stored procedure updating the table. Create a stored function updating the table and deliver the key as result. + +The test isself consists of 2 sessions (transactions) running in "parallel" (same user "root") accessing and locking the same tables on basis of a row lock. Expected is that both sessions(transactions) can update the table successfully. + +First session +execute an explain to every select and one of the following selects on the first half of table t1: +- select ... where ... for update; +- select ... where ... lock in share mode; +- select ... where ... for update; +- select ... where ... lock in share mode; +- select ... ignore index ... where ... for update; +- select ... ignore index ... where ... lock in share mode; +- select ... where (select...) ... for update; +- select ... where (select...) ... lock in share mode; +- (select ... where) union (select ... where) for update; +- (select ... where) union (select ... where) lock in...; +- select ... where ... for update; +- select ... where ... lock in ...; +- select ... where ... for update; +- select ... where ... lock in ...; +Then executes +- update +- delete +- trigger accessing table t1 +- stored procedure accessing table t1 +- stored function accessing table t1 + +Second session +executes the same on the last half of table t1 + +call of mysqld with option +--innodb_locks_unsafe_for_binlog + +As the tests above work with small tables (<10 rows) there must be at least one test with a big table (>1000 rows) doing a table scan. + diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_1.test new file mode 100644 index 00000000000..e0440fe2669 --- /dev/null +++ b/mysql-test/suite/row_lock/t/innodb_row_lock_1.test @@ -0,0 +1,9 @@ +--source include/have_innodb.inc +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +let $engine= InnoDB; +let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; +let $indext1= CREATE INDEX ixi ON t1 (i); +let $indext2= CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock.inc +SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_2.test new file mode 100644 index 00000000000..5cb3ea9f2d9 --- /dev/null +++ b/mysql-test/suite/row_lock/t/innodb_row_lock_2.test @@ -0,0 +1,9 @@ +--source include/have_innodb.inc +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +let $engine= InnoDB; +let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; +let $indext1= #CREATE INDEX ixi ON t1 (i); +let $indext2= #CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock.inc +SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_3.test b/mysql-test/suite/row_lock/t/innodb_row_lock_3.test new file mode 100644 index 00000000000..11f4dc423d6 --- /dev/null +++ b/mysql-test/suite/row_lock/t/innodb_row_lock_3.test @@ -0,0 +1,9 @@ +--source include/have_innodb.inc +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +let $engine= InnoDB; +let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; +let $indext1= #CREATE INDEX ixi ON t1 (i); +let $indext2= #CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock.inc +SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_4.test b/mysql-test/suite/row_lock/t/innodb_row_lock_4.test new file mode 100644 index 00000000000..0a8ca9c13a0 --- /dev/null +++ b/mysql-test/suite/row_lock/t/innodb_row_lock_4.test @@ -0,0 +1,9 @@ +--source include/have_innodb.inc +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +let $engine= InnoDB; +let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; +let $indext1= CREATE INDEX ixi ON t1 (i); +let $indext2= CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock.inc +SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_5.test b/mysql-test/suite/row_lock/t/innodb_row_lock_5.test new file mode 100644 index 00000000000..7e411d31649 --- /dev/null +++ b/mysql-test/suite/row_lock/t/innodb_row_lock_5.test @@ -0,0 +1,9 @@ +--source include/have_innodb.inc +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +let $engine= InnoDB; +let $select= SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; +let $indext1= CREATE INDEX ixi ON t1 (i); +let $indext2= CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock.inc +SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab.test b/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab.test new file mode 100644 index 00000000000..0c5b8b41bd5 --- /dev/null +++ b/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab.test @@ -0,0 +1,9 @@ +--source include/have_innodb.inc +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +let $engine= InnoDB; +let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE; +let $indext1= CREATE INDEX ixi ON t1 (i); +let $indext2= CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock_big_tab.inc +SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_1.test new file mode 100644 index 00000000000..a12a07d82a9 --- /dev/null +++ b/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_1.test @@ -0,0 +1,10 @@ +--source include/have_innodb.inc +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +let $engine= InnoDB; +let $nbrows= 40; +let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE; +let $indext1= CREATE INDEX ixi ON t1 (i); +let $indext2= CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock_big_tab_1.inc +SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_2.test new file mode 100644 index 00000000000..49e834eb2ce --- /dev/null +++ b/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_2.test @@ -0,0 +1,10 @@ +--source include/have_innodb.inc +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +let $engine= InnoDB; +let $nbrows= 40; +let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE; +let $indext1= CREATE INDEX ixi ON t1 (i); +let $indext2= CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock_big_tab_2.inc +SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_trig_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_trig_1.test new file mode 100644 index 00000000000..225513d3f87 --- /dev/null +++ b/mysql-test/suite/row_lock/t/innodb_row_lock_trig_1.test @@ -0,0 +1,9 @@ +--source include/have_innodb.inc +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +let $engine= InnoDB; +let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +let $indext1= CREATE INDEX ixi ON t1 (i); +let $indext2= CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock_trig.inc +SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_trig_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_trig_2.test new file mode 100644 index 00000000000..88dee5f23f8 --- /dev/null +++ b/mysql-test/suite/row_lock/t/innodb_row_lock_trig_2.test @@ -0,0 +1,9 @@ +--source include/have_innodb.inc +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +let $engine= InnoDB; +let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +let $indext1= #CREATE INDEX ixi ON t1 (i); +let $indext2= #CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock_trig.inc +SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_1.test new file mode 100644 index 00000000000..d6381e1da5b --- /dev/null +++ b/mysql-test/suite/row_lock/t/innodb_row_lock_view_1.test @@ -0,0 +1,9 @@ +--source include/have_innodb.inc +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +let $engine= InnoDB; +let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; +let $indext1= CREATE INDEX ixi ON t1 (i); +let $indext2= CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock_view.inc +SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_2.test new file mode 100644 index 00000000000..ee45e683669 --- /dev/null +++ b/mysql-test/suite/row_lock/t/innodb_row_lock_view_2.test @@ -0,0 +1,9 @@ +--source include/have_innodb.inc +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +let $engine= InnoDB; +let $select= SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE; +let $indext1= CREATE INDEX ixi ON t1 (i); +let $indext2= CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock_view.inc +SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_1.test new file mode 100644 index 00000000000..49cba88dd23 --- /dev/null +++ b/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_1.test @@ -0,0 +1,9 @@ +--source include/have_innodb.inc +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +let $engine= InnoDB; +let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; +let $indext1= CREATE INDEX ixi ON t1 (i); +let $indext2= CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock_view_mix.inc +SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_2.test new file mode 100644 index 00000000000..b07f3a3378a --- /dev/null +++ b/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_2.test @@ -0,0 +1,10 @@ +--source include/have_innodb.inc +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +let $engine= InnoDB; +#let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; +let $select= SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE; +let $indext1= CREATE INDEX ixi ON t1 (i); +let $indext2= CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock_view_mix.inc +SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_1.test new file mode 100644 index 00000000000..d507ff3296f --- /dev/null +++ b/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_1.test @@ -0,0 +1,9 @@ +--source include/have_innodb.inc +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +let $engine= InnoDB; +let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +let $indext1= CREATE INDEX ixi ON t1 (i); +let $indext2= CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock_view_storedp.inc +SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_2.test new file mode 100644 index 00000000000..a1bfb16055e --- /dev/null +++ b/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_2.test @@ -0,0 +1,9 @@ +--source include/have_innodb.inc +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +let $engine= InnoDB; +let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +let $indext1= #CREATE INDEX ixi ON t1 (i); +let $indext2= #CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock_view_storedp.inc +SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_1.test new file mode 100644 index 00000000000..24c76532d17 --- /dev/null +++ b/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_1.test @@ -0,0 +1,9 @@ +--source include/have_innodb.inc +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +let $engine= InnoDB; +let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +let $indext1= CREATE INDEX ixi ON t1 (i); +let $indext2= CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock_view_trig.inc +SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_2.test new file mode 100644 index 00000000000..a8a67d77979 --- /dev/null +++ b/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_2.test @@ -0,0 +1,9 @@ +--source include/have_innodb.inc +SELECT @@global.innodb_table_locks into @table_locks; +SET @@global.innodb_table_locks= OFF; +let $engine= InnoDB; +let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +let $indext1= #CREATE INDEX ixi ON t1 (i); +let $indext2= #CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock_view_trig.inc +SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_1.test new file mode 100644 index 00000000000..6ac2e829008 --- /dev/null +++ b/mysql-test/suite/row_lock/t/ndb_row_lock_1.test @@ -0,0 +1,6 @@ +--source include/have_ndb.inc +let $engine= NDB; +let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; +let $indext1= CREATE INDEX ixi ON t1 (i); +let $indext2= CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_2.test new file mode 100644 index 00000000000..994ecba96b0 --- /dev/null +++ b/mysql-test/suite/row_lock/t/ndb_row_lock_2.test @@ -0,0 +1,6 @@ +--source include/have_ndb.inc +let $engine= NDB; +let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; +let $indext1= #CREATE INDEX ixi ON t1 (i); +let $indext2= #CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_3.test b/mysql-test/suite/row_lock/t/ndb_row_lock_3.test new file mode 100644 index 00000000000..2de43c61c2a --- /dev/null +++ b/mysql-test/suite/row_lock/t/ndb_row_lock_3.test @@ -0,0 +1,6 @@ +--source include/have_ndb.inc +let $engine= NDB; +let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; +let $indext1= #CREATE INDEX ixi ON t1 (i); +let $indext2= #CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_4.test b/mysql-test/suite/row_lock/t/ndb_row_lock_4.test new file mode 100644 index 00000000000..72b20488c74 --- /dev/null +++ b/mysql-test/suite/row_lock/t/ndb_row_lock_4.test @@ -0,0 +1,6 @@ +--source include/have_ndb.inc +let $engine= NDB; +let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; +let $indext1= CREATE INDEX ixi ON t1 (i); +let $indext2= CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_5.test b/mysql-test/suite/row_lock/t/ndb_row_lock_5.test new file mode 100644 index 00000000000..045f127a4ef --- /dev/null +++ b/mysql-test/suite/row_lock/t/ndb_row_lock_5.test @@ -0,0 +1,6 @@ +--source include/have_ndb.inc +let $engine= NDB; +let $select= SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; +let $indext1= CREATE INDEX ixi ON t1 (i); +let $indext2= CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab.test b/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab.test new file mode 100644 index 00000000000..bf2df104e03 --- /dev/null +++ b/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab.test @@ -0,0 +1,6 @@ +--source include/have_ndb.inc +let $engine= NDB; +let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE; +let $indext1= CREATE INDEX ixi ON t1 (i); +let $indext2= CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock_big_tab.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_1.test new file mode 100644 index 00000000000..4d32991d379 --- /dev/null +++ b/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_1.test @@ -0,0 +1,7 @@ +--source include/have_ndb.inc +let $engine= NDB; +let $nbrows= 200; +let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE; +let $indext1= CREATE INDEX ixi ON t1 (i); +let $indext2= CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock_big_tab_1.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_2.test new file mode 100644 index 00000000000..894a83fc1b0 --- /dev/null +++ b/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_2.test @@ -0,0 +1,7 @@ +--source include/have_ndb.inc +let $engine= NDB; +let $nbrows= 200; +let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE; +let $indext1= CREATE INDEX ixi ON t1 (i); +let $indext2= CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock_big_tab_2.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_trig_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_trig_1.test new file mode 100644 index 00000000000..a5586a6101e --- /dev/null +++ b/mysql-test/suite/row_lock/t/ndb_row_lock_trig_1.test @@ -0,0 +1,6 @@ +--source include/have_ndb.inc +let $engine= NDB; +let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +let $indext1= CREATE INDEX ixi ON t1 (i); +let $indext2= CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock_trig.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_trig_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_trig_2.test new file mode 100644 index 00000000000..7af13697ccc --- /dev/null +++ b/mysql-test/suite/row_lock/t/ndb_row_lock_trig_2.test @@ -0,0 +1,6 @@ +--source include/have_ndb.inc +let $engine= NDB; +let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +let $indext1= #CREATE INDEX ixi ON t1 (i); +let $indext2= #CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock_trig.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_1.test new file mode 100644 index 00000000000..a1aaf5ab441 --- /dev/null +++ b/mysql-test/suite/row_lock/t/ndb_row_lock_view_1.test @@ -0,0 +1,7 @@ +--source include/have_ndb.inc +let $engine= NDB; +let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; +let $indext1= CREATE INDEX ixi ON t1 (i); +let $indext2= CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock_view.inc + diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_2.test new file mode 100644 index 00000000000..b8feef693e7 --- /dev/null +++ b/mysql-test/suite/row_lock/t/ndb_row_lock_view_2.test @@ -0,0 +1,6 @@ +--source include/have_ndb.inc +let $engine= NDB; +let $select= SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE; +let $indext1= CREATE INDEX ixi ON t1 (i); +let $indext2= CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock_view.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_1.test new file mode 100644 index 00000000000..a97626048d3 --- /dev/null +++ b/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_1.test @@ -0,0 +1,6 @@ +--source include/have_ndb.inc +let $engine= NDB; +let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; +let $indext1= CREATE INDEX ixi ON t1 (i); +let $indext2= CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock_view_mix.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_2.test new file mode 100644 index 00000000000..e7a9a715785 --- /dev/null +++ b/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_2.test @@ -0,0 +1,6 @@ +--source include/have_ndb.inc +let $engine= NDB; +let $select= SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE; +let $indext1= CREATE INDEX ixi ON t1 (i); +let $indext2= CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock_view_mix.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_1.test new file mode 100644 index 00000000000..f57bcb3dd1b --- /dev/null +++ b/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_1.test @@ -0,0 +1,6 @@ +--source include/have_ndb.inc +let $engine= NDB; +let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +let $indext1= CREATE INDEX ixi ON t1 (i); +let $indext2= CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock_view_storedp.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_2.test new file mode 100644 index 00000000000..b0aaa38fb93 --- /dev/null +++ b/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_2.test @@ -0,0 +1,6 @@ +--source include/have_ndb.inc +let $engine= NDB; +let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +let $indext1= #CREATE INDEX ixi ON t1 (i); +let $indext2= #CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock_view_storedp.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_1.test new file mode 100644 index 00000000000..9c4128d78bf --- /dev/null +++ b/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_1.test @@ -0,0 +1,6 @@ +--source include/have_ndb.inc +let $engine= NDB; +let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +let $indext1= CREATE INDEX ixi ON t1 (i); +let $indext2= CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock_view_trig.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_2.test new file mode 100644 index 00000000000..38c9472fb3d --- /dev/null +++ b/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_2.test @@ -0,0 +1,6 @@ +--source include/have_ndb.inc +let $engine= NDB; +let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; +let $indext1= #CREATE INDEX ixi ON t1 (i); +let $indext2= #CREATE INDEX ixi ON t2 (i); +--source suite/row_lock/include/row_lock_view_trig.inc From e23d46e44064924d9be7bfca05c2aacd2b5e8e02 Mon Sep 17 00:00:00 2001 From: "hhunger@hh-nb.hungers" <> Date: Thu, 5 Apr 2007 17:54:37 +0200 Subject: [PATCH 12/17] changed supported sql function to inpuzt files. --- .bzrignore | 5 + .../suite/funcs_1/r/a_version_check.result | 2 +- .../include/partition_supported_sql_funcs.inc | 93 +- .../partition_supported_sql_funcs_delete.inc | 53 +- .../partition_supported_sql_funcs_int_ch1.in | 4 + .../partition_supported_sql_funcs_int_date.in | 4 + ...partition_supported_sql_funcs_int_float.in | 4 + .../partition_supported_sql_funcs_int_int.in | 45 + .../partition_supported_sql_funcs_int_time.in | 4 + .../partition_supported_sql_funcs_main.inc | 39 +- ...partition_supported_sql_func_innodb.result | 11023 +++++++++++-- ...partition_supported_sql_func_myisam.result | 11023 +++++++++++-- .../r/partition_supported_sql_func_ndb.result | 13724 ++++++++++++++++ .../suite/partitions/r/partition_t55.out | 68 + mysql-test/suite/partitions/t/disabled.def | 2 +- .../partition_supported_sql_func_innodb.test | 10 +- .../partition_supported_sql_func_myisam.test | 6 +- .../t/partition_supported_sql_func_ndb.test | 40 + 18 files changed, 34205 insertions(+), 1944 deletions(-) create mode 100644 mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in create mode 100644 mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_date.in create mode 100644 mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_float.in create mode 100644 mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_int.in create mode 100644 mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_time.in create mode 100644 mysql-test/suite/partitions/r/partition_supported_sql_func_ndb.result create mode 100644 mysql-test/suite/partitions/r/partition_t55.out create mode 100644 mysql-test/suite/partitions/t/partition_supported_sql_func_ndb.test diff --git a/.bzrignore b/.bzrignore index c04ce91b355..bb7712a277c 100644 --- a/.bzrignore +++ b/.bzrignore @@ -2956,3 +2956,8 @@ win/vs71cache.txt win/vs8cache.txt zlib/*.ds? zlib/*.vcproj +mysql-test/suite/partitions/t/partition.test +mysql-test/suite/partitions/r/dif +mysql-test/suite/partitions/r/partition.result +mysql-test/suite/partitions/r/partition_t55.out +mysql-test/suite/partitions/r/partition_t55.refout diff --git a/mysql-test/suite/funcs_1/r/a_version_check.result b/mysql-test/suite/funcs_1/r/a_version_check.result index 1569c40e4e5..da6ba0846fd 100644 --- a/mysql-test/suite/funcs_1/r/a_version_check.result +++ b/mysql-test/suite/funcs_1/r/a_version_check.result @@ -6,6 +6,6 @@ . updated with each new version --- THIS IS INTENDED! -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -funcs_1 checked with version: 5.1.16 +funcs_1 checked with version: 5.1.17 Warnings: Warning 1548 Leading spaces are removed from name ' ' diff --git a/mysql-test/suite/partitions/include/partition_supported_sql_funcs.inc b/mysql-test/suite/partitions/include/partition_supported_sql_funcs.inc index f74fce39a7d..b2e102f8e07 100644 --- a/mysql-test/suite/partitions/include/partition_supported_sql_funcs.inc +++ b/mysql-test/suite/partitions/include/partition_supported_sql_funcs.inc @@ -1,7 +1,7 @@ ################################################################################ -# t/partition_supported_sql_funcs.inc # # +# t/partition_supported_sql_funcs.inc # # # # Purpose: # -# Tests around sql functions # +# Tests frame for allowed sql functions # # # # # #------------------------------------------------------------------------------# @@ -83,24 +83,23 @@ eval insert into t3 values ($val1); eval insert into t3 values ($val2); eval insert into t3 values ($val3); -eval insert into t4 values (1,$val1); -eval insert into t4 values (2,$val2); +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +eval load data infile '$MYSQL_TEST_DIR/suite/partitions/include/$infile' into table t4; -eval insert into t5 values (1,$val1); -eval insert into t5 values (2,$val2); -eval insert into t5 values (3,$val3); +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +eval load data infile '$MYSQL_TEST_DIR/suite/partitions/include/$infile' into table t5; -eval insert into t6 values (1,$val2); -eval insert into t6 values (2,$val3); +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +eval load data infile '$MYSQL_TEST_DIR/suite/partitions/include/$infile' into table t6; -eval select $sqlfunc from t1; +eval select $sqlfunc from t1 order by col1; -select * from t1; -select * from t2; -select * from t3; -select * from t4; -select * from t5; -select * from t6; +select * from t1 order by col1; +select * from t2 order by col1; +select * from t3 order by col1; +select * from t4 order by colint; +select * from t5 order by colint; +select * from t6 order by colint; if ($do_long_tests) { @@ -111,12 +110,12 @@ if ($do_long_tests) eval update t5 set col1=$val4 where col1=$val1; eval update t6 set col1=$val4 where col1=$val1; - select * from t1; - select * from t2; - select * from t3; - select * from t4; - select * from t5; - select * from t6; + select * from t1 order by col1; + select * from t2 order by col1; + select * from t3 order by col1; + select * from t4 order by colint; + select * from t5 order by colint; + select * from t6 order by colint; } --echo ------------------------------------------------------------------------- @@ -175,46 +174,63 @@ partition by range(colint) (partition p0 values less than ($valsqlfunc), partition p1 values less than maxvalue); -select * from t11; -select * from t22; -select * from t33; -select * from t44; -select * from t55; -select * from t66; +select * from t11 order by col1; +select * from t22 order by col1; +select * from t33 order by col1; +select * from t44 order by colint; +select * from t55 order by colint; +select * from t66 order by colint; if ($do_long_tests) { + --echo --------------------------- + --echo ---- some alter table begin + --echo --------------------------- eval alter table t11 reorganize partition p0,p1 into (partition s1 values less than maxvalue); - select * from t11; + select * from t11 order by col1; eval alter table t11 reorganize partition s1 into (partition p0 values less than (15), partition p1 values less than maxvalue); - select * from t11; + select * from t11 order by col1; + +eval alter table t55 +partition by list(colint) +subpartition by hash($sqlfunc) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), + partition p1 values in (11,12,13,14,15,16,17,18,19,20), + partition p2 values in (21,22,23,24,25,26,27,28,29,30), + partition p3 values in (31,32,33,34,35,36,37,38,39,40), + partition p4 values in (41,42,43,44,45,46,47,48,49,50), + partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); + show create table t55; + select * from t55 order by colint; eval alter table t66 reorganize partition p0,p1 into (partition s1 values less than maxvalue); - select * from t66; + select * from t66 order by colint; eval alter table t66 reorganize partition s1 into (partition p0 values less than ($valsqlfunc), partition p1 values less than maxvalue); - select * from t66; + select * from t66 order by colint; eval alter table t66 reorganize partition p0,p1 into (partition s1 values less than maxvalue); - select * from t66; + select * from t66 order by colint; - eval alter table t66 - add partition s0 - (partition p0 values less than ($valsqlfunc); - select * fromt t66; + eval alter table t66 + reorganize partition s1 into + (partition p0 values less than ($valsqlfunc), + partition p1 values less than maxvalue); + select * from t66 order by colint; let $t1=t1; let $t2=t2; @@ -233,6 +249,9 @@ if ($do_long_tests) let $t6=t66; --source suite/partitions/include/partition_supported_sql_funcs_delete.inc # --source include/partition_supported_sql_funcs_delete.inc + --echo ------------------------- + --echo ---- some alter table end + --echo ------------------------- } --disable_warnings drop table if exists t1 ; diff --git a/mysql-test/suite/partitions/include/partition_supported_sql_funcs_delete.inc b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_delete.inc index c733d750fab..76e8bd6dcc6 100644 --- a/mysql-test/suite/partitions/include/partition_supported_sql_funcs_delete.inc +++ b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_delete.inc @@ -1,3 +1,16 @@ +################################################################################ +# t/partition_supported_sql_funcs_delete.inc # # # +# Purpose: # +# Delete access of the tests frame for allowed sql functions # +# # +# # +#------------------------------------------------------------------------------# +# Original Author: HH # +# Original Date: 2006-11-22 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ --echo ------------------------------------------------------------------------- --echo --- Delete rows and partitions of tables with $sqlfunc --echo ------------------------------------------------------------------------- @@ -9,25 +22,25 @@ eval delete from $t4 where col1=$val2; eval delete from $t5 where col1=$val2; eval delete from $t6 where col1=$val2; -eval select * from $t1; -eval select * from $t2; -eval select * from $t3; -eval select * from $t4; -eval select * from $t5; +eval select * from $t1 order by col1; +eval select * from $t2 order by col1; +eval select * from $t3 order by col1; +eval select * from $t4 order by colint; +eval select * from $t5 order by colint; eval insert into $t1 values ($val2); eval insert into $t2 values ($val2); eval insert into $t3 values ($val2); -eval insert into $t4 values (4,$val2); -eval insert into $t5 values (4,$val2); -eval insert into $t6 values (4,$val2); +eval insert into $t4 values (60,$val2); +eval insert into $t5 values (60,$val2); +eval insert into $t6 values (60,$val2); -eval select * from $t1; -eval select * from $t2; -eval select * from $t3; -eval select * from $t4; -eval select * from $t5; -eval select * from $t6; +eval select * from $t1 order by col1; +eval select * from $t2 order by col1; +eval select * from $t3 order by col1; +eval select * from $t4 order by colint; +eval select * from $t5 order by colint; +eval select * from $t6 order by colint; eval alter table $t1 drop partition p0; eval alter table $t2 drop partition p0; @@ -35,9 +48,9 @@ eval alter table $t4 drop partition p0; eval alter table $t5 drop partition p0; eval alter table $t6 drop partition p0; -eval select * from $t1; -eval select * from $t2; -eval select * from $t3; -eval select * from $t4; -eval select * from $t5; -eval select * from $t6; +eval select * from $t1 order by col1; +eval select * from $t2 order by col1; +eval select * from $t3 order by col1; +eval select * from $t4 order by colint; +eval select * from $t5 order by colint; +eval select * from $t6 order by colint; diff --git a/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in new file mode 100644 index 00000000000..8ae6e5fc807 --- /dev/null +++ b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in @@ -0,0 +1,4 @@ +1 1 +2 9 +3 3 +4 8 \ No newline at end of file diff --git a/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_date.in b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_date.in new file mode 100644 index 00000000000..9eb41fb007b --- /dev/null +++ b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_date.in @@ -0,0 +1,4 @@ +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 \ No newline at end of file diff --git a/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_float.in b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_float.in new file mode 100644 index 00000000000..34d8b1d1c4d --- /dev/null +++ b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_float.in @@ -0,0 +1,4 @@ +1 5.1230 +2 13.345 +3 17.987 +4 15.654 diff --git a/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_int.in b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_int.in new file mode 100644 index 00000000000..d2f5c82a241 --- /dev/null +++ b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_int.in @@ -0,0 +1,45 @@ +1 5 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 5 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 \ No newline at end of file diff --git a/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_time.in b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_time.in new file mode 100644 index 00000000000..941ba418f32 --- /dev/null +++ b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_time.in @@ -0,0 +1,4 @@ +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 diff --git a/mysql-test/suite/partitions/include/partition_supported_sql_funcs_main.inc b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_main.inc index ccfdd7a2ece..b0ec63d39a9 100644 --- a/mysql-test/suite/partitions/include/partition_supported_sql_funcs_main.inc +++ b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_main.inc @@ -2,7 +2,7 @@ # t/partition_supported_sql_funcs_main.inc # # # # Purpose: # -# Tests around sql functions # +# Tests which SQL functions are allowed in partinioning clauses. # # # # # #------------------------------------------------------------------------------# @@ -11,12 +11,28 @@ # Change Author: # # Change Date: # # Change: # +# # +# This test uses a test frame (partition_supported_sql_funcs.inc) for every # +# SQL function allowed in the partitioning parts of CREATE and ALTE TABLE. # +# The variales represent the # +# - SQL function isself with a column (sqlfunc) and a literal (valsqlsunc), # +# - the type of the column (coltype), # +# - a file with test values of the coltype (infile) and # +# - single test values (val1 to val4). # +# The test frame includes CREATE/ALTER TABLE and some access statements. # +# Column types are int, float(7,4), char(1), date and time depending on the # +# SQL function. The test frame uses the include file # +# "partition_supported_sql_funcs_delete.inc" testing the deletion of # +# partitions. # +# The CREATE and ALTER TABLE statement do not cover the complete partitions # +# functions, but will ashure that the SQL functions are basically working. # ################################################################################ let $sqlfunc = abs(col1); let $valsqlfunc = abs(15); let $coltype = int; +let $infile = partition_supported_sql_funcs_int_int.in; let $val1 = 5 ; let $val2 = 13 ; let $val3 = 17 ; @@ -27,6 +43,7 @@ let $val4 = 15 ; let $sqlfunc = ascii(col1); let $valsqlfunc = ascii('5'); let $coltype = char(1); +let $infile = partition_supported_sql_funcs_int_ch1.in; let $val1 = '1'; let $val2 = '9'; let $val3 = '3'; @@ -37,6 +54,7 @@ let $val4 = '8'; let $sqlfunc = cast(ceiling(col1) as signed integer); let $valsqlfunc = cast(ceiling(15) as signed integer); let $coltype = float(7,4); +let $infile = partition_supported_sql_funcs_int_float.in; let $val1 = 5.1230; let $val2 = 13.345; let $val3 = 17.987; @@ -47,6 +65,7 @@ let $val4 = 15.654 ; let $sqlfunc = cast(floor(col1) as signed); let $valsqlfunc = cast(floor(15.123) as signed); let $coltype = float(7,4); +let $infile = partition_supported_sql_funcs_int_float.in; let $val1 = 5.1230; let $val2 = 13.345; let $val3 = 17.987; @@ -57,6 +76,7 @@ let $val4 = 15.654 ; let $sqlfunc = cast(mod(col1,10) as signed); let $valsqlfunc = cast(mod(15,10) as signed); let $coltype = float(7,4); +let $infile = partition_supported_sql_funcs_int_float.in; let $val1 = 5.0000; let $val2 = 19; let $val3 = 17; @@ -67,6 +87,7 @@ let $val4 = 15 ; let $sqlfunc = ord(col1); let $valsqlfunc = ord('a'); let $coltype = char(3); +let $infile = partition_supported_sql_funcs_int_ch1.in; let $val1 = '1'; let $val2 = '9'; let $val3 = '3'; @@ -77,6 +98,7 @@ let $val4 = '8'; let $sqlfunc = day(col1); let $valsqlfunc = day('2006-12-21'); let $coltype = date; +let $infile = partition_supported_sql_funcs_int_date.in; let $val1 = '2006-02-03'; let $val2 = '2006-01-17'; let $val3 = '2006-01-25'; @@ -87,6 +109,7 @@ let $val4 = '2006-02-05'; let $sqlfunc = dayofmonth(col1); let $valsqlfunc = dayofmonth('2006-12-24'); let $coltype = date; +let $infile = partition_supported_sql_funcs_int_date.in; let $val1 = '2006-02-03'; let $val2 = '2006-01-17'; let $val3 = '2006-01-25'; @@ -97,6 +120,7 @@ let $val4 = '2006-02-05'; let $sqlfunc = dayofweek(col1); let $valsqlfunc = dayofweek('2006-12-24'); let $coltype = date; +let $infile = partition_supported_sql_funcs_int_date.in; let $val1 = '2006-01-03'; let $val2 = '2006-02-17'; let $val3 = '2006-01-25'; @@ -107,6 +131,7 @@ let $val4 = '2006-02-05'; let $sqlfunc = dayofyear(col1); let $valsqlfunc = dayofyear('2006-12-25'); let $coltype = date; +let $infile = partition_supported_sql_funcs_int_date.in; let $val1 = '2006-01-03'; let $val2 = '2006-01-17'; let $val3 = '2006-02-25'; @@ -120,6 +145,7 @@ let $coltype = char(30); let $sqlfunc = extract(month from col1); let $valsqlfunc = extract(year from '1998-11-23'); let $coltype = date; +let $infile = partition_supported_sql_funcs_int_date.in; let $val1 = '2006-01-03'; let $val2 = '2006-02-17'; let $val3 = '2006-01-25'; @@ -130,6 +156,7 @@ let $val4 = '2006-02-05'; let $sqlfunc = hour(col1); let $valsqlfunc = hour('18:30'); let $coltype = time; +let $infile = partition_supported_sql_funcs_int_time.in; let $val1 = '09:09'; let $val2 = '14:30'; let $val3 = '21:59'; @@ -140,6 +167,7 @@ let $val4 = '10:30'; let $sqlfunc = microsecond(col1); let $valsqlfunc = microsecond('10:30:10.000010'); let $coltype = time; +let $infile = partition_supported_sql_funcs_int_time.in; let $val1 = '09:09:15.000002'; let $val2 = '04:30:01.000018'; let $val3 = '00:59:22.000024'; @@ -160,6 +188,7 @@ let $val4 = '10:24:23'; let $sqlfunc = second(col1); let $valsqlfunc = second('18:30:14'); let $coltype = time; +let $infile = partition_supported_sql_funcs_int_time.in; let $val1 = '09:09:09'; let $val2 = '14:30:20'; let $val3 = '21:59:22'; @@ -173,6 +202,7 @@ let $coltype = char(30); let $sqlfunc = month(col1); let $valsqlfunc = month('2006-10-14'); let $coltype = date; +let $infile = partition_supported_sql_funcs_int_date.in; let $val1 = '2006-01-03'; let $val2 = '2006-12-17'; let $val3 = '2006-05-25'; @@ -183,6 +213,7 @@ let $val4 = '2006-11-06'; let $sqlfunc = quarter(col1); let $valsqlfunc = quarter('2006-10-14'); let $coltype = date; +let $infile = partition_supported_sql_funcs_int_date.in; let $val1 = '2006-01-03'; let $val2 = '2006-12-17'; let $val3 = '2006-09-25'; @@ -193,6 +224,7 @@ let $val4 = '2006-07-30'; let $sqlfunc = time_to_sec(col1)-(time_to_sec(col1)-20); let $valsqlfunc = time_to_sec('18:30:14')-(time_to_sec('17:59:59')); let $coltype = time; +let $infile = partition_supported_sql_funcs_int_time.in; let $val1 = '09:09:15'; let $val2 = '14:30:45'; let $val3 = '21:59:22'; @@ -203,6 +235,7 @@ let $val4 = '10:33:11'; let $sqlfunc = to_days(col1)-to_days('2006-01-01'); let $valsqlfunc = to_days('2006-02-02')-to_days('2006-01-01'); let $coltype = date; +let $infile = partition_supported_sql_funcs_int_date.in; let $val1 = '2006-02-03'; let $val2 = '2006-01-17'; let $val3 = '2006-01-25'; @@ -213,6 +246,7 @@ let $val4 = '2006-02-06'; let $sqlfunc = weekday(col1); let $valsqlfunc = weekday('2006-10-14'); let $coltype = date; +let $infile = partition_supported_sql_funcs_int_date.in; let $val1 = '2006-12-03'; let $val2 = '2006-11-17'; let $val3 = '2006-05-25'; @@ -223,6 +257,7 @@ let $val4 = '2006-02-06'; let $sqlfunc = weekofyear(col1); let $valsqlfunc = weekofyear('2006-02-14'); let $coltype = date; +let $infile = partition_supported_sql_funcs_int_date.in; let $val1 = '2006-01-03'; let $val2 = '2006-03-17'; let $val3 = '2006-05-25'; @@ -233,6 +268,7 @@ let $val4 = '2006-09-06'; let $sqlfunc = year(col1)-1990; let $valsqlfunc = year('2005-10-14')-1990; let $coltype = date; +let $infile = partition_supported_sql_funcs_int_date.in; let $val1 = '1996-01-03'; let $val2 = '2000-02-17'; let $val3 = '2004-05-25'; @@ -243,6 +279,7 @@ let $val4 = '2002-02-15'; let $sqlfunc = yearweek(col1)-200600; let $valsqlfunc = yearweek('2006-10-14')-200600; let $coltype = date; +let $infile = partition_supported_sql_funcs_int_date.in; let $val1 = '2006-01-03'; let $val2 = '2006-08-17'; let $val3 = '2006-03-25'; diff --git a/mysql-test/suite/partitions/r/partition_supported_sql_func_innodb.result b/mysql-test/suite/partitions/r/partition_supported_sql_func_innodb.result index bb25ac5fc73..196f7930bb0 100644 --- a/mysql-test/suite/partitions/r/partition_supported_sql_func_innodb.result +++ b/mysql-test/suite/partitions/r/partition_supported_sql_func_innodb.result @@ -55,44 +55,329 @@ insert into t2 values (17 ); insert into t3 values (5 ); insert into t3 values (13 ); insert into t3 values (17 ); -insert into t4 values (1,5 ); -insert into t4 values (2,13 ); -insert into t5 values (1,5 ); -insert into t5 values (2,13 ); -insert into t5 values (3,17 ); -insert into t6 values (1,13 ); -insert into t6 values (2,17 ); -select abs(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_int.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_int.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_int.in' into table t6; +select abs(col1) from t1 order by col1; abs(col1) 5 13 -select * from t1; +select * from t1 order by col1; col1 5 13 -select * from t2; +select * from t2 order by col1; col1 5 13 17 -select * from t3; +select * from t3 order by col1; col1 5 13 17 -select * from t4; +select * from t4 order by colint; colint col1 1 5 2 13 -select * from t5; +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 5 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +select * from t5 order by colint; colint col1 1 5 2 13 -3 17 -select * from t6; +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 5 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +select * from t6 order by colint; colint col1 -1 13 -2 17 +1 5 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 5 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +update t1 set col1=15 where col1=5 ; +update t2 set col1=15 where col1=5 ; +update t3 set col1=15 where col1=5 ; +update t4 set col1=15 where col1=5 ; +update t5 set col1=15 where col1=5 ; +update t6 set col1=15 where col1=5 ; +select * from t1 order by col1; +col1 +13 +15 +select * from t2 order by col1; +col1 +13 +15 +17 +select * from t3 order by col1; +col1 +13 +15 +17 +select * from t4 order by colint; +colint col1 +1 15 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +select * from t5 order by colint; +colint col1 +1 15 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +select * from t6 order by colint; +colint col1 +1 15 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 ------------------------------------------------------------------------- --- Alter tables with abs(col1) ------------------------------------------------------------------------- @@ -142,33 +427,1241 @@ alter table t66 partition by range(colint) (partition p0 values less than (abs(15)), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -5 13 -select * from t22; +15 +select * from t22 order by col1; col1 -5 13 +15 17 -select * from t33; +select * from t33 order by col1; col1 -5 13 +15 17 -select * from t44; +select * from t44 order by colint; colint col1 -1 5 +1 15 2 13 -select * from t55; +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +select * from t55 order by colint; colint col1 -1 5 +1 15 2 13 -3 17 -select * from t66; +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +select * from t66 order by colint; colint col1 -1 13 -2 17 +1 15 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +13 +15 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +13 +15 +alter table t55 +partition by list(colint) +subpartition by hash(abs(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (abs(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ +select * from t55 order by colint; +colint col1 +1 15 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (abs(15)), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (abs(15)), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with abs(col1) +------------------------------------------------------------------------- +delete from t1 where col1=13 ; +delete from t2 where col1=13 ; +delete from t3 where col1=13 ; +delete from t4 where col1=13 ; +delete from t5 where col1=13 ; +delete from t6 where col1=13 ; +select * from t1 order by col1; +col1 +15 +select * from t2 order by col1; +col1 +15 +17 +select * from t3 order by col1; +col1 +15 +17 +select * from t4 order by colint; +colint col1 +1 15 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +select * from t5 order by colint; +colint col1 +1 15 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +insert into t1 values (13 ); +insert into t2 values (13 ); +insert into t3 values (13 ); +insert into t4 values (60,13 ); +insert into t5 values (60,13 ); +insert into t6 values (60,13 ); +select * from t1 order by col1; +col1 +13 +15 +select * from t2 order by col1; +col1 +13 +15 +17 +select * from t3 order by col1; +col1 +13 +15 +17 +select * from t4 order by colint; +colint col1 +1 15 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +select * from t5 order by colint; +colint col1 +1 15 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +select * from t6 order by colint; +colint col1 +1 15 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +15 +select * from t2 order by col1; +col1 +13 +15 +17 +select * from t3 order by col1; +col1 +13 +15 +17 +select * from t4 order by colint; +colint col1 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +select * from t5 order by colint; +colint col1 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +select * from t6 order by colint; +colint col1 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with abs(col1) +------------------------------------------------------------------------- +delete from t11 where col1=13 ; +delete from t22 where col1=13 ; +delete from t33 where col1=13 ; +delete from t44 where col1=13 ; +delete from t55 where col1=13 ; +delete from t66 where col1=13 ; +select * from t11 order by col1; +col1 +15 +select * from t22 order by col1; +col1 +15 +17 +select * from t33 order by col1; +col1 +15 +17 +select * from t44 order by colint; +colint col1 +1 15 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +select * from t55 order by colint; +colint col1 +1 15 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +insert into t11 values (13 ); +insert into t22 values (13 ); +insert into t33 values (13 ); +insert into t44 values (60,13 ); +insert into t55 values (60,13 ); +insert into t66 values (60,13 ); +select * from t11 order by col1; +col1 +13 +15 +select * from t22 order by col1; +col1 +13 +15 +17 +select * from t33 order by col1; +col1 +13 +15 +17 +select * from t44 order by colint; +colint col1 +1 15 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +select * from t55 order by colint; +colint col1 +1 15 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +select * from t66 order by colint; +colint col1 +1 15 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +15 +select * from t22 order by col1; +col1 +13 +15 +17 +select * from t33 order by col1; +col1 +13 +15 +17 +select * from t44 order by colint; +colint col1 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +select * from t55 order by colint; +colint col1 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +select * from t66 order by colint; +colint col1 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -238,44 +1731,83 @@ insert into t2 values ('3'); insert into t3 values ('1'); insert into t3 values ('9'); insert into t3 values ('3'); -insert into t4 values (1,'1'); -insert into t4 values (2,'9'); -insert into t5 values (1,'1'); -insert into t5 values (2,'9'); -insert into t5 values (3,'3'); -insert into t6 values (1,'9'); -insert into t6 values (2,'3'); -select ascii(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t6; +select ascii(col1) from t1 order by col1; ascii(col1) 49 57 -select * from t1; +select * from t1 order by col1; col1 1 9 -select * from t2; +select * from t2 order by col1; col1 1 -9 3 -select * from t3; +9 +select * from t3 order by col1; col1 1 -9 3 -select * from t4; -colint col1 -1 1 -2 9 -select * from t5; +9 +select * from t4 order by colint; colint col1 1 1 2 9 3 3 -select * from t6; +4 8 +select * from t5 order by colint; colint col1 -1 9 -2 3 +1 1 +2 9 +3 3 +4 8 +select * from t6 order by colint; +colint col1 +1 1 +2 9 +3 3 +4 8 +update t1 set col1='8' where col1='1'; +update t2 set col1='8' where col1='1'; +update t3 set col1='8' where col1='1'; +update t4 set col1='8' where col1='1'; +update t5 set col1='8' where col1='1'; +update t6 set col1='8' where col1='1'; +select * from t1 order by col1; +col1 +8 +9 +select * from t2 order by col1; +col1 +3 +8 +9 +select * from t3 order by col1; +col1 +3 +8 +9 +select * from t4 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +select * from t5 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +select * from t6 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 ------------------------------------------------------------------------- --- Alter tables with ascii(col1) ------------------------------------------------------------------------- @@ -325,33 +1857,311 @@ alter table t66 partition by range(colint) (partition p0 values less than (ascii('5')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -1 +8 9 -select * from t22; +select * from t22 order by col1; col1 -1 -9 3 -select * from t33; -col1 -1 +8 9 +select * from t33 order by col1; +col1 3 -select * from t44; +8 +9 +select * from t44 order by colint; colint col1 -1 1 -2 9 -select * from t55; -colint col1 -1 1 +1 8 2 9 3 3 -select * from t66; +4 8 +select * from t55 order by colint; colint col1 -1 9 -2 3 +1 8 +2 9 +3 3 +4 8 +select * from t66 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +8 +9 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +8 +9 +alter table t55 +partition by list(colint) +subpartition by hash(ascii(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` char(1) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (ascii(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ +select * from t55 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (ascii('5')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (ascii('5')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with ascii(col1) +------------------------------------------------------------------------- +delete from t1 where col1='9'; +delete from t2 where col1='9'; +delete from t3 where col1='9'; +delete from t4 where col1='9'; +delete from t5 where col1='9'; +delete from t6 where col1='9'; +select * from t1 order by col1; +col1 +8 +select * from t2 order by col1; +col1 +3 +8 +select * from t3 order by col1; +col1 +3 +8 +select * from t4 order by colint; +colint col1 +1 8 +3 3 +4 8 +select * from t5 order by colint; +colint col1 +1 8 +3 3 +4 8 +insert into t1 values ('9'); +insert into t2 values ('9'); +insert into t3 values ('9'); +insert into t4 values (60,'9'); +insert into t5 values (60,'9'); +insert into t6 values (60,'9'); +select * from t1 order by col1; +col1 +8 +9 +select * from t2 order by col1; +col1 +3 +8 +9 +select * from t3 order by col1; +col1 +3 +8 +9 +select * from t4 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +select * from t5 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +select * from t6 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +8 +9 +select * from t2 order by col1; +col1 +3 +8 +9 +select * from t3 order by col1; +col1 +3 +8 +9 +select * from t4 order by colint; +colint col1 +60 9 +select * from t5 order by colint; +colint col1 +60 9 +select * from t6 order by colint; +colint col1 +60 9 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with ascii(col1) +------------------------------------------------------------------------- +delete from t11 where col1='9'; +delete from t22 where col1='9'; +delete from t33 where col1='9'; +delete from t44 where col1='9'; +delete from t55 where col1='9'; +delete from t66 where col1='9'; +select * from t11 order by col1; +col1 +8 +select * from t22 order by col1; +col1 +3 +8 +select * from t33 order by col1; +col1 +3 +8 +select * from t44 order by colint; +colint col1 +1 8 +3 3 +4 8 +select * from t55 order by colint; +colint col1 +1 8 +3 3 +4 8 +insert into t11 values ('9'); +insert into t22 values ('9'); +insert into t33 values ('9'); +insert into t44 values (60,'9'); +insert into t55 values (60,'9'); +insert into t66 values (60,'9'); +select * from t11 order by col1; +col1 +8 +9 +select * from t22 order by col1; +col1 +3 +8 +9 +select * from t33 order by col1; +col1 +3 +8 +9 +select * from t44 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +select * from t55 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +select * from t66 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +8 +9 +select * from t22 order by col1; +col1 +3 +8 +9 +select * from t33 order by col1; +col1 +3 +8 +9 +select * from t44 order by colint; +colint col1 +60 9 +select * from t55 order by colint; +colint col1 +60 9 +select * from t66 order by colint; +colint col1 +60 9 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -421,44 +2231,83 @@ insert into t2 values (17.987); insert into t3 values (5.1230); insert into t3 values (13.345); insert into t3 values (17.987); -insert into t4 values (1,5.1230); -insert into t4 values (2,13.345); -insert into t5 values (1,5.1230); -insert into t5 values (2,13.345); -insert into t5 values (3,17.987); -insert into t6 values (1,13.345); -insert into t6 values (2,17.987); -select cast(ceiling(col1) as signed integer) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t6; +select cast(ceiling(col1) as signed integer) from t1 order by col1; cast(ceiling(col1) as signed integer) 6 14 -select * from t1; +select * from t1 order by col1; col1 5.1230 13.3450 -select * from t2; +select * from t2 order by col1; col1 5.1230 13.3450 17.9870 -select * from t3; +select * from t3 order by col1; col1 5.1230 13.3450 17.9870 -select * from t4; -colint col1 -1 5.1230 -2 13.3450 -select * from t5; +select * from t4 order by colint; colint col1 1 5.1230 2 13.3450 3 17.9870 -select * from t6; +4 15.6540 +select * from t5 order by colint; colint col1 -1 13.3450 -2 17.9870 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t6 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +update t1 set col1=15.654 where col1=5.1230; +update t2 set col1=15.654 where col1=5.1230; +update t3 set col1=15.654 where col1=5.1230; +update t4 set col1=15.654 where col1=5.1230; +update t5 set col1=15.654 where col1=5.1230; +update t6 set col1=15.654 where col1=5.1230; +select * from t1 order by col1; +col1 +13.3450 +15.6540 +select * from t2 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t3 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t4 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t5 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t6 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 ------------------------------------------------------------------------- --- Alter tables with cast(ceiling(col1) as signed integer) ------------------------------------------------------------------------- @@ -508,33 +2357,309 @@ alter table t66 partition by range(colint) (partition p0 values less than (cast(ceiling(15) as signed integer)), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -5.1230 13.3450 -select * from t22; +15.6540 +select * from t22 order by col1; col1 -5.1230 13.3450 +15.6540 17.9870 -select * from t33; +select * from t33 order by col1; col1 -5.1230 13.3450 +15.6540 17.9870 -select * from t44; +select * from t44 order by colint; colint col1 -1 5.1230 -2 13.3450 -select * from t55; -colint col1 -1 5.1230 +1 15.6540 2 13.3450 3 17.9870 -select * from t66; +4 15.6540 +select * from t55 order by colint; colint col1 -1 13.3450 -2 17.9870 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t66 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +13.3450 +15.6540 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +13.3450 +15.6540 +alter table t55 +partition by list(colint) +subpartition by hash(cast(ceiling(col1) as signed integer)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` float(7,4) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (cast(ceiling(col1) as signed integer)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ +select * from t55 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (cast(ceiling(15) as signed integer)), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (cast(ceiling(15) as signed integer)), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with cast(ceiling(col1) as signed integer) +------------------------------------------------------------------------- +delete from t1 where col1=13.345; +delete from t2 where col1=13.345; +delete from t3 where col1=13.345; +delete from t4 where col1=13.345; +delete from t5 where col1=13.345; +delete from t6 where col1=13.345; +select * from t1 order by col1; +col1 +15.6540 +select * from t2 order by col1; +col1 +15.6540 +17.9870 +select * from t3 order by col1; +col1 +15.6540 +17.9870 +select * from t4 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +select * from t5 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +insert into t1 values (13.345); +insert into t2 values (13.345); +insert into t3 values (13.345); +insert into t4 values (60,13.345); +insert into t5 values (60,13.345); +insert into t6 values (60,13.345); +select * from t1 order by col1; +col1 +13.3450 +15.6540 +select * from t2 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t3 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t4 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +select * from t5 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +select * from t6 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +15.6540 +select * from t2 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t3 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t4 order by colint; +colint col1 +60 13.3450 +select * from t5 order by colint; +colint col1 +60 13.3450 +select * from t6 order by colint; +colint col1 +60 13.3450 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with cast(ceiling(col1) as signed integer) +------------------------------------------------------------------------- +delete from t11 where col1=13.345; +delete from t22 where col1=13.345; +delete from t33 where col1=13.345; +delete from t44 where col1=13.345; +delete from t55 where col1=13.345; +delete from t66 where col1=13.345; +select * from t11 order by col1; +col1 +15.6540 +select * from t22 order by col1; +col1 +15.6540 +17.9870 +select * from t33 order by col1; +col1 +15.6540 +17.9870 +select * from t44 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +select * from t55 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +insert into t11 values (13.345); +insert into t22 values (13.345); +insert into t33 values (13.345); +insert into t44 values (60,13.345); +insert into t55 values (60,13.345); +insert into t66 values (60,13.345); +select * from t11 order by col1; +col1 +13.3450 +15.6540 +select * from t22 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t33 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t44 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +select * from t55 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +select * from t66 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +15.6540 +select * from t22 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t33 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t44 order by colint; +colint col1 +60 13.3450 +select * from t55 order by colint; +colint col1 +60 13.3450 +select * from t66 order by colint; +colint col1 +60 13.3450 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -604,44 +2729,83 @@ insert into t2 values (17.987); insert into t3 values (5.1230); insert into t3 values (13.345); insert into t3 values (17.987); -insert into t4 values (1,5.1230); -insert into t4 values (2,13.345); -insert into t5 values (1,5.1230); -insert into t5 values (2,13.345); -insert into t5 values (3,17.987); -insert into t6 values (1,13.345); -insert into t6 values (2,17.987); -select cast(floor(col1) as signed) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t6; +select cast(floor(col1) as signed) from t1 order by col1; cast(floor(col1) as signed) 5 13 -select * from t1; +select * from t1 order by col1; col1 5.1230 13.3450 -select * from t2; +select * from t2 order by col1; col1 5.1230 13.3450 17.9870 -select * from t3; +select * from t3 order by col1; col1 5.1230 13.3450 17.9870 -select * from t4; -colint col1 -1 5.1230 -2 13.3450 -select * from t5; +select * from t4 order by colint; colint col1 1 5.1230 2 13.3450 3 17.9870 -select * from t6; +4 15.6540 +select * from t5 order by colint; colint col1 -1 13.3450 -2 17.9870 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t6 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +update t1 set col1=15.654 where col1=5.1230; +update t2 set col1=15.654 where col1=5.1230; +update t3 set col1=15.654 where col1=5.1230; +update t4 set col1=15.654 where col1=5.1230; +update t5 set col1=15.654 where col1=5.1230; +update t6 set col1=15.654 where col1=5.1230; +select * from t1 order by col1; +col1 +13.3450 +15.6540 +select * from t2 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t3 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t4 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t5 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t6 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 ------------------------------------------------------------------------- --- Alter tables with cast(floor(col1) as signed) ------------------------------------------------------------------------- @@ -691,33 +2855,309 @@ alter table t66 partition by range(colint) (partition p0 values less than (cast(floor(15.123) as signed)), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -5.1230 13.3450 -select * from t22; +15.6540 +select * from t22 order by col1; col1 -5.1230 13.3450 +15.6540 17.9870 -select * from t33; +select * from t33 order by col1; col1 -5.1230 13.3450 +15.6540 17.9870 -select * from t44; +select * from t44 order by colint; colint col1 -1 5.1230 -2 13.3450 -select * from t55; -colint col1 -1 5.1230 +1 15.6540 2 13.3450 3 17.9870 -select * from t66; +4 15.6540 +select * from t55 order by colint; colint col1 -1 13.3450 -2 17.9870 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t66 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +13.3450 +15.6540 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +13.3450 +15.6540 +alter table t55 +partition by list(colint) +subpartition by hash(cast(floor(col1) as signed)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` float(7,4) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (cast(floor(col1) as signed)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ +select * from t55 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (cast(floor(15.123) as signed)), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (cast(floor(15.123) as signed)), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with cast(floor(col1) as signed) +------------------------------------------------------------------------- +delete from t1 where col1=13.345; +delete from t2 where col1=13.345; +delete from t3 where col1=13.345; +delete from t4 where col1=13.345; +delete from t5 where col1=13.345; +delete from t6 where col1=13.345; +select * from t1 order by col1; +col1 +15.6540 +select * from t2 order by col1; +col1 +15.6540 +17.9870 +select * from t3 order by col1; +col1 +15.6540 +17.9870 +select * from t4 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +select * from t5 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +insert into t1 values (13.345); +insert into t2 values (13.345); +insert into t3 values (13.345); +insert into t4 values (60,13.345); +insert into t5 values (60,13.345); +insert into t6 values (60,13.345); +select * from t1 order by col1; +col1 +13.3450 +15.6540 +select * from t2 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t3 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t4 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +select * from t5 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +select * from t6 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +15.6540 +select * from t2 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t3 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t4 order by colint; +colint col1 +60 13.3450 +select * from t5 order by colint; +colint col1 +60 13.3450 +select * from t6 order by colint; +colint col1 +60 13.3450 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with cast(floor(col1) as signed) +------------------------------------------------------------------------- +delete from t11 where col1=13.345; +delete from t22 where col1=13.345; +delete from t33 where col1=13.345; +delete from t44 where col1=13.345; +delete from t55 where col1=13.345; +delete from t66 where col1=13.345; +select * from t11 order by col1; +col1 +15.6540 +select * from t22 order by col1; +col1 +15.6540 +17.9870 +select * from t33 order by col1; +col1 +15.6540 +17.9870 +select * from t44 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +select * from t55 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +insert into t11 values (13.345); +insert into t22 values (13.345); +insert into t33 values (13.345); +insert into t44 values (60,13.345); +insert into t55 values (60,13.345); +insert into t66 values (60,13.345); +select * from t11 order by col1; +col1 +13.3450 +15.6540 +select * from t22 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t33 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t44 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +select * from t55 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +select * from t66 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +15.6540 +select * from t22 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t33 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t44 order by colint; +colint col1 +60 13.3450 +select * from t55 order by colint; +colint col1 +60 13.3450 +select * from t66 order by colint; +colint col1 +60 13.3450 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -787,44 +3227,83 @@ insert into t2 values (17); insert into t3 values (5.0000); insert into t3 values (19); insert into t3 values (17); -insert into t4 values (1,5.0000); -insert into t4 values (2,19); -insert into t5 values (1,5.0000); -insert into t5 values (2,19); -insert into t5 values (3,17); -insert into t6 values (1,19); -insert into t6 values (2,17); -select cast(mod(col1,10) as signed) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t6; +select cast(mod(col1,10) as signed) from t1 order by col1; cast(mod(col1,10) as signed) 5 9 -select * from t1; +select * from t1 order by col1; col1 5.0000 19.0000 -select * from t2; +select * from t2 order by col1; col1 5.0000 -19.0000 17.0000 -select * from t3; +19.0000 +select * from t3 order by col1; col1 5.0000 -19.0000 17.0000 -select * from t4; +19.0000 +select * from t4 order by colint; colint col1 -1 5.0000 -2 19.0000 -select * from t5; +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t5 order by colint; colint col1 -1 5.0000 -2 19.0000 -3 17.0000 -select * from t6; +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t6 order by colint; colint col1 -1 19.0000 -2 17.0000 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +update t1 set col1=15 where col1=5.0000; +update t2 set col1=15 where col1=5.0000; +update t3 set col1=15 where col1=5.0000; +update t4 set col1=15 where col1=5.0000; +update t5 set col1=15 where col1=5.0000; +update t6 set col1=15 where col1=5.0000; +select * from t1 order by col1; +col1 +15.0000 +19.0000 +select * from t2 order by col1; +col1 +15.0000 +17.0000 +19.0000 +select * from t3 order by col1; +col1 +15.0000 +17.0000 +19.0000 +select * from t4 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t5 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t6 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 ------------------------------------------------------------------------- --- Alter tables with cast(mod(col1,10) as signed) ------------------------------------------------------------------------- @@ -874,33 +3353,311 @@ alter table t66 partition by range(colint) (partition p0 values less than (cast(mod(15,10) as signed)), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -5.0000 +15.0000 19.0000 -select * from t22; +select * from t22 order by col1; col1 -5.0000 -19.0000 +15.0000 17.0000 -select * from t33; -col1 -5.0000 19.0000 +select * from t33 order by col1; +col1 +15.0000 17.0000 -select * from t44; +19.0000 +select * from t44 order by colint; colint col1 -1 5.0000 -2 19.0000 -select * from t55; +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t55 order by colint; colint col1 -1 5.0000 -2 19.0000 -3 17.0000 -select * from t66; +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t66 order by colint; colint col1 -1 19.0000 -2 17.0000 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +15.0000 +19.0000 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +15.0000 +19.0000 +alter table t55 +partition by list(colint) +subpartition by hash(cast(mod(col1,10) as signed)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` float(7,4) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (cast(mod(col1,10) as signed)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ +select * from t55 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (cast(mod(15,10) as signed)), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (cast(mod(15,10) as signed)), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with cast(mod(col1,10) as signed) +------------------------------------------------------------------------- +delete from t1 where col1=19; +delete from t2 where col1=19; +delete from t3 where col1=19; +delete from t4 where col1=19; +delete from t5 where col1=19; +delete from t6 where col1=19; +select * from t1 order by col1; +col1 +15.0000 +select * from t2 order by col1; +col1 +15.0000 +17.0000 +select * from t3 order by col1; +col1 +15.0000 +17.0000 +select * from t4 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t5 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +insert into t1 values (19); +insert into t2 values (19); +insert into t3 values (19); +insert into t4 values (60,19); +insert into t5 values (60,19); +insert into t6 values (60,19); +select * from t1 order by col1; +col1 +15.0000 +19.0000 +select * from t2 order by col1; +col1 +15.0000 +17.0000 +19.0000 +select * from t3 order by col1; +col1 +15.0000 +17.0000 +19.0000 +select * from t4 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +60 19.0000 +select * from t5 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +60 19.0000 +select * from t6 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +60 19.0000 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +select * from t2 order by col1; +col1 +select * from t3 order by col1; +col1 +15.0000 +17.0000 +19.0000 +select * from t4 order by colint; +colint col1 +60 19.0000 +select * from t5 order by colint; +colint col1 +60 19.0000 +select * from t6 order by colint; +colint col1 +60 19.0000 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with cast(mod(col1,10) as signed) +------------------------------------------------------------------------- +delete from t11 where col1=19; +delete from t22 where col1=19; +delete from t33 where col1=19; +delete from t44 where col1=19; +delete from t55 where col1=19; +delete from t66 where col1=19; +select * from t11 order by col1; +col1 +15.0000 +select * from t22 order by col1; +col1 +15.0000 +17.0000 +select * from t33 order by col1; +col1 +15.0000 +17.0000 +select * from t44 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t55 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +insert into t11 values (19); +insert into t22 values (19); +insert into t33 values (19); +insert into t44 values (60,19); +insert into t55 values (60,19); +insert into t66 values (60,19); +select * from t11 order by col1; +col1 +15.0000 +19.0000 +select * from t22 order by col1; +col1 +15.0000 +17.0000 +19.0000 +select * from t33 order by col1; +col1 +15.0000 +17.0000 +19.0000 +select * from t44 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +60 19.0000 +select * from t55 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +60 19.0000 +select * from t66 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +60 19.0000 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +select * from t22 order by col1; +col1 +select * from t33 order by col1; +col1 +15.0000 +17.0000 +19.0000 +select * from t44 order by colint; +colint col1 +60 19.0000 +select * from t55 order by colint; +colint col1 +60 19.0000 +select * from t66 order by colint; +colint col1 +60 19.0000 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -970,44 +3727,83 @@ insert into t2 values ('3'); insert into t3 values ('1'); insert into t3 values ('9'); insert into t3 values ('3'); -insert into t4 values (1,'1'); -insert into t4 values (2,'9'); -insert into t5 values (1,'1'); -insert into t5 values (2,'9'); -insert into t5 values (3,'3'); -insert into t6 values (1,'9'); -insert into t6 values (2,'3'); -select ord(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t6; +select ord(col1) from t1 order by col1; ord(col1) 49 57 -select * from t1; +select * from t1 order by col1; col1 1 9 -select * from t2; +select * from t2 order by col1; col1 1 -9 3 -select * from t3; +9 +select * from t3 order by col1; col1 1 -9 3 -select * from t4; -colint col1 -1 1 -2 9 -select * from t5; +9 +select * from t4 order by colint; colint col1 1 1 2 9 3 3 -select * from t6; +4 8 +select * from t5 order by colint; colint col1 -1 9 -2 3 +1 1 +2 9 +3 3 +4 8 +select * from t6 order by colint; +colint col1 +1 1 +2 9 +3 3 +4 8 +update t1 set col1='8' where col1='1'; +update t2 set col1='8' where col1='1'; +update t3 set col1='8' where col1='1'; +update t4 set col1='8' where col1='1'; +update t5 set col1='8' where col1='1'; +update t6 set col1='8' where col1='1'; +select * from t1 order by col1; +col1 +8 +9 +select * from t2 order by col1; +col1 +3 +8 +9 +select * from t3 order by col1; +col1 +3 +8 +9 +select * from t4 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +select * from t5 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +select * from t6 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 ------------------------------------------------------------------------- --- Alter tables with ord(col1) ------------------------------------------------------------------------- @@ -1057,33 +3853,309 @@ alter table t66 partition by range(colint) (partition p0 values less than (ord('a')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -1 +8 9 -select * from t22; +select * from t22 order by col1; col1 -1 -9 3 -select * from t33; -col1 -1 +8 9 +select * from t33 order by col1; +col1 3 -select * from t44; +8 +9 +select * from t44 order by colint; colint col1 -1 1 -2 9 -select * from t55; -colint col1 -1 1 +1 8 2 9 3 3 -select * from t66; +4 8 +select * from t55 order by colint; colint col1 -1 9 -2 3 +1 8 +2 9 +3 3 +4 8 +select * from t66 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +8 +9 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +8 +9 +alter table t55 +partition by list(colint) +subpartition by hash(ord(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` char(3) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (ord(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ +select * from t55 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (ord('a')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (ord('a')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with ord(col1) +------------------------------------------------------------------------- +delete from t1 where col1='9'; +delete from t2 where col1='9'; +delete from t3 where col1='9'; +delete from t4 where col1='9'; +delete from t5 where col1='9'; +delete from t6 where col1='9'; +select * from t1 order by col1; +col1 +8 +select * from t2 order by col1; +col1 +3 +8 +select * from t3 order by col1; +col1 +3 +8 +select * from t4 order by colint; +colint col1 +1 8 +3 3 +4 8 +select * from t5 order by colint; +colint col1 +1 8 +3 3 +4 8 +insert into t1 values ('9'); +insert into t2 values ('9'); +insert into t3 values ('9'); +insert into t4 values (60,'9'); +insert into t5 values (60,'9'); +insert into t6 values (60,'9'); +select * from t1 order by col1; +col1 +8 +9 +select * from t2 order by col1; +col1 +3 +8 +9 +select * from t3 order by col1; +col1 +3 +8 +9 +select * from t4 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +select * from t5 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +select * from t6 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +8 +9 +select * from t2 order by col1; +col1 +3 +8 +9 +select * from t3 order by col1; +col1 +3 +8 +9 +select * from t4 order by colint; +colint col1 +60 9 +select * from t5 order by colint; +colint col1 +60 9 +select * from t6 order by colint; +colint col1 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with ord(col1) +------------------------------------------------------------------------- +delete from t11 where col1='9'; +delete from t22 where col1='9'; +delete from t33 where col1='9'; +delete from t44 where col1='9'; +delete from t55 where col1='9'; +delete from t66 where col1='9'; +select * from t11 order by col1; +col1 +8 +select * from t22 order by col1; +col1 +3 +8 +select * from t33 order by col1; +col1 +3 +8 +select * from t44 order by colint; +colint col1 +1 8 +3 3 +4 8 +select * from t55 order by colint; +colint col1 +1 8 +3 3 +4 8 +insert into t11 values ('9'); +insert into t22 values ('9'); +insert into t33 values ('9'); +insert into t44 values (60,'9'); +insert into t55 values (60,'9'); +insert into t66 values (60,'9'); +select * from t11 order by col1; +col1 +8 +9 +select * from t22 order by col1; +col1 +3 +8 +9 +select * from t33 order by col1; +col1 +3 +8 +9 +select * from t44 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +select * from t55 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +select * from t66 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +8 +9 +select * from t22 order by col1; +col1 +3 +8 +9 +select * from t33 order by col1; +col1 +3 +8 +9 +select * from t44 order by colint; +colint col1 +60 9 +select * from t55 order by colint; +colint col1 +60 9 +select * from t66 order by colint; +colint col1 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -1153,44 +4225,83 @@ insert into t2 values ('2006-01-25'); insert into t3 values ('2006-02-03'); insert into t3 values ('2006-01-17'); insert into t3 values ('2006-01-25'); -insert into t4 values (1,'2006-02-03'); -insert into t4 values (2,'2006-01-17'); -insert into t5 values (1,'2006-02-03'); -insert into t5 values (2,'2006-01-17'); -insert into t5 values (3,'2006-01-25'); -insert into t6 values (1,'2006-01-17'); -insert into t6 values (2,'2006-01-25'); -select day(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select day(col1) from t1 order by col1; day(col1) -3 17 -select * from t1; +3 +select * from t1 order by col1; col1 -2006-02-03 2006-01-17 -select * from t2; -col1 2006-02-03 +select * from t2 order by col1; +col1 2006-01-17 2006-01-25 -select * from t3; -col1 2006-02-03 +select * from t3 order by col1; +col1 2006-01-17 2006-01-25 -select * from t4; -colint col1 -1 2006-02-03 -2 2006-01-17 -select * from t5; +2006-02-03 +select * from t4 order by colint; colint col1 1 2006-02-03 2 2006-01-17 3 2006-01-25 -select * from t6; +4 2006-02-05 +select * from t5 order by colint; colint col1 -1 2006-01-17 -2 2006-01-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-02-05' where col1='2006-02-03'; +update t2 set col1='2006-02-05' where col1='2006-02-03'; +update t3 set col1='2006-02-05' where col1='2006-02-03'; +update t4 set col1='2006-02-05' where col1='2006-02-03'; +update t5 set col1='2006-02-05' where col1='2006-02-03'; +update t6 set col1='2006-02-05' where col1='2006-02-03'; +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t3 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t4 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 ------------------------------------------------------------------------- --- Alter tables with day(col1) ------------------------------------------------------------------------- @@ -1240,33 +4351,307 @@ alter table t66 partition by range(colint) (partition p0 values less than (day('2006-12-21')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -2006-02-03 2006-01-17 -select * from t22; +2006-02-05 +select * from t22 order by col1; col1 -2006-02-03 2006-01-17 2006-01-25 -select * from t33; +2006-02-05 +select * from t33 order by col1; col1 -2006-02-03 2006-01-17 2006-01-25 -select * from t44; +2006-02-05 +select * from t44 order by colint; colint col1 -1 2006-02-03 -2 2006-01-17 -select * from t55; -colint col1 -1 2006-02-03 +1 2006-02-05 2 2006-01-17 3 2006-01-25 -select * from t66; +4 2006-02-05 +select * from t55 order by colint; colint col1 -1 2006-01-17 -2 2006-01-25 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +alter table t55 +partition by list(colint) +subpartition by hash(day(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (day(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ +select * from t55 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (day('2006-12-21')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (day('2006-12-21')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with day(col1) +------------------------------------------------------------------------- +delete from t1 where col1='2006-01-17'; +delete from t2 where col1='2006-01-17'; +delete from t3 where col1='2006-01-17'; +delete from t4 where col1='2006-01-17'; +delete from t5 where col1='2006-01-17'; +delete from t6 where col1='2006-01-17'; +select * from t1 order by col1; +col1 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t4 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-01-17'); +insert into t2 values ('2006-01-17'); +insert into t3 values ('2006-01-17'); +insert into t4 values (60,'2006-01-17'); +insert into t5 values (60,'2006-01-17'); +insert into t6 values (60,'2006-01-17'); +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t3 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t4 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t5 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t6 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +2006-01-17 +select * from t2 order by col1; +col1 +2006-01-17 +2006-01-25 +select * from t3 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t4 order by colint; +colint col1 +60 2006-01-17 +select * from t5 order by colint; +colint col1 +60 2006-01-17 +select * from t6 order by colint; +colint col1 +60 2006-01-17 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with day(col1) +------------------------------------------------------------------------- +delete from t11 where col1='2006-01-17'; +delete from t22 where col1='2006-01-17'; +delete from t33 where col1='2006-01-17'; +delete from t44 where col1='2006-01-17'; +delete from t55 where col1='2006-01-17'; +delete from t66 where col1='2006-01-17'; +select * from t11 order by col1; +col1 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t33 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t44 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-01-17'); +insert into t22 values ('2006-01-17'); +insert into t33 values ('2006-01-17'); +insert into t44 values (60,'2006-01-17'); +insert into t55 values (60,'2006-01-17'); +insert into t66 values (60,'2006-01-17'); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t33 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t44 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t55 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t66 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +2006-01-17 +select * from t22 order by col1; +col1 +2006-01-17 +2006-01-25 +select * from t33 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t44 order by colint; +colint col1 +60 2006-01-17 +select * from t55 order by colint; +colint col1 +60 2006-01-17 +select * from t66 order by colint; +colint col1 +60 2006-01-17 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -1336,44 +4721,83 @@ insert into t2 values ('2006-01-25'); insert into t3 values ('2006-02-03'); insert into t3 values ('2006-01-17'); insert into t3 values ('2006-01-25'); -insert into t4 values (1,'2006-02-03'); -insert into t4 values (2,'2006-01-17'); -insert into t5 values (1,'2006-02-03'); -insert into t5 values (2,'2006-01-17'); -insert into t5 values (3,'2006-01-25'); -insert into t6 values (1,'2006-01-17'); -insert into t6 values (2,'2006-01-25'); -select dayofmonth(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select dayofmonth(col1) from t1 order by col1; dayofmonth(col1) -3 17 -select * from t1; +3 +select * from t1 order by col1; col1 -2006-02-03 2006-01-17 -select * from t2; -col1 2006-02-03 +select * from t2 order by col1; +col1 2006-01-17 2006-01-25 -select * from t3; -col1 2006-02-03 +select * from t3 order by col1; +col1 2006-01-17 2006-01-25 -select * from t4; -colint col1 -1 2006-02-03 -2 2006-01-17 -select * from t5; +2006-02-03 +select * from t4 order by colint; colint col1 1 2006-02-03 2 2006-01-17 3 2006-01-25 -select * from t6; +4 2006-02-05 +select * from t5 order by colint; colint col1 -1 2006-01-17 -2 2006-01-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-02-05' where col1='2006-02-03'; +update t2 set col1='2006-02-05' where col1='2006-02-03'; +update t3 set col1='2006-02-05' where col1='2006-02-03'; +update t4 set col1='2006-02-05' where col1='2006-02-03'; +update t5 set col1='2006-02-05' where col1='2006-02-03'; +update t6 set col1='2006-02-05' where col1='2006-02-03'; +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t3 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t4 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 ------------------------------------------------------------------------- --- Alter tables with dayofmonth(col1) ------------------------------------------------------------------------- @@ -1423,33 +4847,307 @@ alter table t66 partition by range(colint) (partition p0 values less than (dayofmonth('2006-12-24')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -2006-02-03 2006-01-17 -select * from t22; +2006-02-05 +select * from t22 order by col1; col1 -2006-02-03 2006-01-17 2006-01-25 -select * from t33; +2006-02-05 +select * from t33 order by col1; col1 -2006-02-03 2006-01-17 2006-01-25 -select * from t44; +2006-02-05 +select * from t44 order by colint; colint col1 -1 2006-02-03 -2 2006-01-17 -select * from t55; -colint col1 -1 2006-02-03 +1 2006-02-05 2 2006-01-17 3 2006-01-25 -select * from t66; +4 2006-02-05 +select * from t55 order by colint; colint col1 -1 2006-01-17 -2 2006-01-25 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +alter table t55 +partition by list(colint) +subpartition by hash(dayofmonth(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofmonth(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ +select * from t55 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (dayofmonth('2006-12-24')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (dayofmonth('2006-12-24')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with dayofmonth(col1) +------------------------------------------------------------------------- +delete from t1 where col1='2006-01-17'; +delete from t2 where col1='2006-01-17'; +delete from t3 where col1='2006-01-17'; +delete from t4 where col1='2006-01-17'; +delete from t5 where col1='2006-01-17'; +delete from t6 where col1='2006-01-17'; +select * from t1 order by col1; +col1 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t4 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-01-17'); +insert into t2 values ('2006-01-17'); +insert into t3 values ('2006-01-17'); +insert into t4 values (60,'2006-01-17'); +insert into t5 values (60,'2006-01-17'); +insert into t6 values (60,'2006-01-17'); +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t3 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t4 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t5 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t6 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +2006-01-17 +select * from t2 order by col1; +col1 +2006-01-17 +2006-01-25 +select * from t3 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t4 order by colint; +colint col1 +60 2006-01-17 +select * from t5 order by colint; +colint col1 +60 2006-01-17 +select * from t6 order by colint; +colint col1 +60 2006-01-17 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with dayofmonth(col1) +------------------------------------------------------------------------- +delete from t11 where col1='2006-01-17'; +delete from t22 where col1='2006-01-17'; +delete from t33 where col1='2006-01-17'; +delete from t44 where col1='2006-01-17'; +delete from t55 where col1='2006-01-17'; +delete from t66 where col1='2006-01-17'; +select * from t11 order by col1; +col1 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t33 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t44 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-01-17'); +insert into t22 values ('2006-01-17'); +insert into t33 values ('2006-01-17'); +insert into t44 values (60,'2006-01-17'); +insert into t55 values (60,'2006-01-17'); +insert into t66 values (60,'2006-01-17'); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t33 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t44 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t55 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t66 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +2006-01-17 +select * from t22 order by col1; +col1 +2006-01-17 +2006-01-25 +select * from t33 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t44 order by colint; +colint col1 +60 2006-01-17 +select * from t55 order by colint; +colint col1 +60 2006-01-17 +select * from t66 order by colint; +colint col1 +60 2006-01-17 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -1519,44 +5217,83 @@ insert into t2 values ('2006-01-25'); insert into t3 values ('2006-01-03'); insert into t3 values ('2006-02-17'); insert into t3 values ('2006-01-25'); -insert into t4 values (1,'2006-01-03'); -insert into t4 values (2,'2006-02-17'); -insert into t5 values (1,'2006-01-03'); -insert into t5 values (2,'2006-02-17'); -insert into t5 values (3,'2006-01-25'); -insert into t6 values (1,'2006-02-17'); -insert into t6 values (2,'2006-01-25'); -select dayofweek(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select dayofweek(col1) from t1 order by col1; dayofweek(col1) 3 6 -select * from t1; +select * from t1 order by col1; col1 2006-01-03 2006-02-17 -select * from t2; +select * from t2 order by col1; col1 2006-01-03 -2006-02-17 2006-01-25 -select * from t3; +2006-02-17 +select * from t3 order by col1; col1 2006-01-03 -2006-02-17 2006-01-25 -select * from t4; +2006-02-17 +select * from t4 order by colint; colint col1 -2 2006-02-17 -1 2006-01-03 -select * from t5; -colint col1 -2 2006-02-17 +1 2006-02-03 +2 2006-01-17 3 2006-01-25 -1 2006-01-03 -select * from t6; +4 2006-02-05 +select * from t5 order by colint; colint col1 -1 2006-02-17 -2 2006-01-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-02-05' where col1='2006-01-03'; +update t2 set col1='2006-02-05' where col1='2006-01-03'; +update t3 set col1='2006-02-05' where col1='2006-01-03'; +update t4 set col1='2006-02-05' where col1='2006-01-03'; +update t5 set col1='2006-02-05' where col1='2006-01-03'; +update t6 set col1='2006-02-05' where col1='2006-01-03'; +select * from t1 order by col1; +col1 +2006-02-05 +2006-02-17 +select * from t2 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 ------------------------------------------------------------------------- --- Alter tables with dayofweek(col1) ------------------------------------------------------------------------- @@ -1606,33 +5343,319 @@ alter table t66 partition by range(colint) (partition p0 values less than (dayofweek('2006-12-24')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -2006-01-03 +2006-02-05 2006-02-17 -select * from t22; +select * from t22 order by col1; col1 -2006-01-03 -2006-02-17 2006-01-25 -select * from t33; -col1 -2006-01-03 +2006-02-05 2006-02-17 +select * from t33 order by col1; +col1 2006-01-25 -select * from t44; +2006-02-05 +2006-02-17 +select * from t44 order by colint; colint col1 -2 2006-02-17 -1 2006-01-03 -select * from t55; -colint col1 -2 2006-02-17 +1 2006-02-03 +2 2006-01-17 3 2006-01-25 -1 2006-01-03 -select * from t66; +4 2006-02-05 +select * from t55 order by colint; colint col1 -1 2006-02-17 -2 2006-01-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-02-05 +2006-02-17 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-02-05 +2006-02-17 +alter table t55 +partition by list(colint) +subpartition by hash(dayofweek(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofweek(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (dayofweek('2006-12-24')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (dayofweek('2006-12-24')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with dayofweek(col1) +------------------------------------------------------------------------- +delete from t1 where col1='2006-02-17'; +delete from t2 where col1='2006-02-17'; +delete from t3 where col1='2006-02-17'; +delete from t4 where col1='2006-02-17'; +delete from t5 where col1='2006-02-17'; +delete from t6 where col1='2006-02-17'; +select * from t1 order by col1; +col1 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-02-17'); +insert into t2 values ('2006-02-17'); +insert into t3 values ('2006-02-17'); +insert into t4 values (60,'2006-02-17'); +insert into t5 values (60,'2006-02-17'); +insert into t6 values (60,'2006-02-17'); +select * from t1 order by col1; +col1 +2006-02-05 +2006-02-17 +select * from t2 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +select * from t2 order by col1; +col1 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t4 order by colint; +colint col1 +60 2006-02-17 +select * from t5 order by colint; +colint col1 +60 2006-02-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with dayofweek(col1) +------------------------------------------------------------------------- +delete from t11 where col1='2006-02-17'; +delete from t22 where col1='2006-02-17'; +delete from t33 where col1='2006-02-17'; +delete from t44 where col1='2006-02-17'; +delete from t55 where col1='2006-02-17'; +delete from t66 where col1='2006-02-17'; +select * from t11 order by col1; +col1 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t33 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-02-17'); +insert into t22 values ('2006-02-17'); +insert into t33 values ('2006-02-17'); +insert into t44 values (60,'2006-02-17'); +insert into t55 values (60,'2006-02-17'); +insert into t66 values (60,'2006-02-17'); +select * from t11 order by col1; +col1 +2006-02-05 +2006-02-17 +select * from t22 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t33 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +select * from t22 order by col1; +col1 +select * from t33 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t44 order by colint; +colint col1 +60 2006-02-17 +select * from t55 order by colint; +colint col1 +60 2006-02-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -1702,44 +5725,83 @@ insert into t2 values ('2006-02-25'); insert into t3 values ('2006-01-03'); insert into t3 values ('2006-01-17'); insert into t3 values ('2006-02-25'); -insert into t4 values (1,'2006-01-03'); -insert into t4 values (2,'2006-01-17'); -insert into t5 values (1,'2006-01-03'); -insert into t5 values (2,'2006-01-17'); -insert into t5 values (3,'2006-02-25'); -insert into t6 values (1,'2006-01-17'); -insert into t6 values (2,'2006-02-25'); -select dayofyear(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select dayofyear(col1) from t1 order by col1; dayofyear(col1) 3 17 -select * from t1; +select * from t1 order by col1; col1 2006-01-03 2006-01-17 -select * from t2; +select * from t2 order by col1; col1 2006-01-03 2006-01-17 2006-02-25 -select * from t3; +select * from t3 order by col1; col1 2006-01-03 2006-01-17 2006-02-25 -select * from t4; +select * from t4 order by colint; colint col1 -1 2006-01-03 +1 2006-02-03 2 2006-01-17 -select * from t5; +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; colint col1 -3 2006-02-25 -1 2006-01-03 +1 2006-02-03 2 2006-01-17 -select * from t6; +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; colint col1 -1 2006-01-17 -2 2006-02-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-02-05' where col1='2006-01-03'; +update t2 set col1='2006-02-05' where col1='2006-01-03'; +update t3 set col1='2006-02-05' where col1='2006-01-03'; +update t4 set col1='2006-02-05' where col1='2006-01-03'; +update t5 set col1='2006-02-05' where col1='2006-01-03'; +update t6 set col1='2006-02-05' where col1='2006-01-03'; +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t3 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 ------------------------------------------------------------------------- --- Alter tables with dayofyear(col1) ------------------------------------------------------------------------- @@ -1789,33 +5851,309 @@ alter table t66 partition by range(colint) (partition p0 values less than (dayofyear('2006-12-25')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -2006-01-03 2006-01-17 -select * from t22; +2006-02-05 +select * from t22 order by col1; col1 -2006-01-03 2006-01-17 +2006-02-05 2006-02-25 -select * from t33; +select * from t33 order by col1; col1 -2006-01-03 2006-01-17 +2006-02-05 2006-02-25 -select * from t44; +select * from t44 order by colint; colint col1 -1 2006-01-03 +1 2006-02-03 2 2006-01-17 -select * from t55; +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; colint col1 -3 2006-02-25 -1 2006-01-03 +1 2006-02-03 2 2006-01-17 -select * from t66; +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; colint col1 -1 2006-01-17 -2 2006-02-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +alter table t55 +partition by list(colint) +subpartition by hash(dayofyear(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (dayofyear('2006-12-25')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (dayofyear('2006-12-25')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with dayofyear(col1) +------------------------------------------------------------------------- +delete from t1 where col1='2006-01-17'; +delete from t2 where col1='2006-01-17'; +delete from t3 where col1='2006-01-17'; +delete from t4 where col1='2006-01-17'; +delete from t5 where col1='2006-01-17'; +delete from t6 where col1='2006-01-17'; +select * from t1 order by col1; +col1 +2006-02-05 +select * from t2 order by col1; +col1 +2006-02-05 +2006-02-25 +select * from t3 order by col1; +col1 +2006-02-05 +2006-02-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-01-17'); +insert into t2 values ('2006-01-17'); +insert into t3 values ('2006-01-17'); +insert into t4 values (60,'2006-01-17'); +insert into t5 values (60,'2006-01-17'); +insert into t6 values (60,'2006-01-17'); +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t3 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t3 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t4 order by colint; +colint col1 +60 2006-01-17 +select * from t5 order by colint; +colint col1 +60 2006-01-17 +select * from t6 order by colint; +colint col1 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with dayofyear(col1) +------------------------------------------------------------------------- +delete from t11 where col1='2006-01-17'; +delete from t22 where col1='2006-01-17'; +delete from t33 where col1='2006-01-17'; +delete from t44 where col1='2006-01-17'; +delete from t55 where col1='2006-01-17'; +delete from t66 where col1='2006-01-17'; +select * from t11 order by col1; +col1 +2006-02-05 +select * from t22 order by col1; +col1 +2006-02-05 +2006-02-25 +select * from t33 order by col1; +col1 +2006-02-05 +2006-02-25 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-01-17'); +insert into t22 values ('2006-01-17'); +insert into t33 values ('2006-01-17'); +insert into t44 values (60,'2006-01-17'); +insert into t55 values (60,'2006-01-17'); +insert into t66 values (60,'2006-01-17'); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t33 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t33 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t44 order by colint; +colint col1 +60 2006-01-17 +select * from t55 order by colint; +colint col1 +60 2006-01-17 +select * from t66 order by colint; +colint col1 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -1885,44 +6223,83 @@ insert into t2 values ('2006-02-25'); insert into t3 values ('2006-01-03'); insert into t3 values ('2006-01-17'); insert into t3 values ('2006-02-25'); -insert into t4 values (1,'2006-01-03'); -insert into t4 values (2,'2006-01-17'); -insert into t5 values (1,'2006-01-03'); -insert into t5 values (2,'2006-01-17'); -insert into t5 values (3,'2006-02-25'); -insert into t6 values (1,'2006-01-17'); -insert into t6 values (2,'2006-02-25'); -select dayofyear(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select dayofyear(col1) from t1 order by col1; dayofyear(col1) 3 17 -select * from t1; +select * from t1 order by col1; col1 2006-01-03 2006-01-17 -select * from t2; +select * from t2 order by col1; col1 2006-01-03 2006-01-17 2006-02-25 -select * from t3; +select * from t3 order by col1; col1 2006-01-03 2006-01-17 2006-02-25 -select * from t4; +select * from t4 order by colint; colint col1 -1 2006-01-03 +1 2006-02-03 2 2006-01-17 -select * from t5; +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; colint col1 -3 2006-02-25 -1 2006-01-03 +1 2006-02-03 2 2006-01-17 -select * from t6; +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; colint col1 -1 2006-01-17 -2 2006-02-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-02-05' where col1='2006-01-03'; +update t2 set col1='2006-02-05' where col1='2006-01-03'; +update t3 set col1='2006-02-05' where col1='2006-01-03'; +update t4 set col1='2006-02-05' where col1='2006-01-03'; +update t5 set col1='2006-02-05' where col1='2006-01-03'; +update t6 set col1='2006-02-05' where col1='2006-01-03'; +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t3 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 ------------------------------------------------------------------------- --- Alter tables with dayofyear(col1) ------------------------------------------------------------------------- @@ -1972,33 +6349,309 @@ alter table t66 partition by range(colint) (partition p0 values less than (dayofyear('2006-12-25')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -2006-01-03 2006-01-17 -select * from t22; +2006-02-05 +select * from t22 order by col1; col1 -2006-01-03 2006-01-17 +2006-02-05 2006-02-25 -select * from t33; +select * from t33 order by col1; col1 -2006-01-03 2006-01-17 +2006-02-05 2006-02-25 -select * from t44; +select * from t44 order by colint; colint col1 -1 2006-01-03 +1 2006-02-03 2 2006-01-17 -select * from t55; +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; colint col1 -3 2006-02-25 -1 2006-01-03 +1 2006-02-03 2 2006-01-17 -select * from t66; +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; colint col1 -1 2006-01-17 -2 2006-02-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +alter table t55 +partition by list(colint) +subpartition by hash(dayofyear(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` char(30) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (dayofyear('2006-12-25')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (dayofyear('2006-12-25')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with dayofyear(col1) +------------------------------------------------------------------------- +delete from t1 where col1='2006-01-17'; +delete from t2 where col1='2006-01-17'; +delete from t3 where col1='2006-01-17'; +delete from t4 where col1='2006-01-17'; +delete from t5 where col1='2006-01-17'; +delete from t6 where col1='2006-01-17'; +select * from t1 order by col1; +col1 +2006-02-05 +select * from t2 order by col1; +col1 +2006-02-05 +2006-02-25 +select * from t3 order by col1; +col1 +2006-02-05 +2006-02-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-01-17'); +insert into t2 values ('2006-01-17'); +insert into t3 values ('2006-01-17'); +insert into t4 values (60,'2006-01-17'); +insert into t5 values (60,'2006-01-17'); +insert into t6 values (60,'2006-01-17'); +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t3 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t3 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t4 order by colint; +colint col1 +60 2006-01-17 +select * from t5 order by colint; +colint col1 +60 2006-01-17 +select * from t6 order by colint; +colint col1 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with dayofyear(col1) +------------------------------------------------------------------------- +delete from t11 where col1='2006-01-17'; +delete from t22 where col1='2006-01-17'; +delete from t33 where col1='2006-01-17'; +delete from t44 where col1='2006-01-17'; +delete from t55 where col1='2006-01-17'; +delete from t66 where col1='2006-01-17'; +select * from t11 order by col1; +col1 +2006-02-05 +select * from t22 order by col1; +col1 +2006-02-05 +2006-02-25 +select * from t33 order by col1; +col1 +2006-02-05 +2006-02-25 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-01-17'); +insert into t22 values ('2006-01-17'); +insert into t33 values ('2006-01-17'); +insert into t44 values (60,'2006-01-17'); +insert into t55 values (60,'2006-01-17'); +insert into t66 values (60,'2006-01-17'); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t33 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t33 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t44 order by colint; +colint col1 +60 2006-01-17 +select * from t55 order by colint; +colint col1 +60 2006-01-17 +select * from t66 order by colint; +colint col1 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -2068,44 +6721,83 @@ insert into t2 values ('2006-01-25'); insert into t3 values ('2006-01-03'); insert into t3 values ('2006-02-17'); insert into t3 values ('2006-01-25'); -insert into t4 values (1,'2006-01-03'); -insert into t4 values (2,'2006-02-17'); -insert into t5 values (1,'2006-01-03'); -insert into t5 values (2,'2006-02-17'); -insert into t5 values (3,'2006-01-25'); -insert into t6 values (1,'2006-02-17'); -insert into t6 values (2,'2006-01-25'); -select extract(month from col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select extract(month from col1) from t1 order by col1; extract(month from col1) 1 2 -select * from t1; +select * from t1 order by col1; col1 2006-01-03 2006-02-17 -select * from t2; +select * from t2 order by col1; col1 2006-01-03 -2006-02-17 2006-01-25 -select * from t3; +2006-02-17 +select * from t3 order by col1; col1 2006-01-03 -2006-02-17 2006-01-25 -select * from t4; +2006-02-17 +select * from t4 order by colint; colint col1 -2 2006-02-17 -1 2006-01-03 -select * from t5; -colint col1 -2 2006-02-17 -1 2006-01-03 +1 2006-02-03 +2 2006-01-17 3 2006-01-25 -select * from t6; +4 2006-02-05 +select * from t5 order by colint; colint col1 -1 2006-02-17 -2 2006-01-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-02-05' where col1='2006-01-03'; +update t2 set col1='2006-02-05' where col1='2006-01-03'; +update t3 set col1='2006-02-05' where col1='2006-01-03'; +update t4 set col1='2006-02-05' where col1='2006-01-03'; +update t5 set col1='2006-02-05' where col1='2006-01-03'; +update t6 set col1='2006-02-05' where col1='2006-01-03'; +select * from t1 order by col1; +col1 +2006-02-05 +2006-02-17 +select * from t2 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 ------------------------------------------------------------------------- --- Alter tables with extract(month from col1) ------------------------------------------------------------------------- @@ -2155,33 +6847,309 @@ alter table t66 partition by range(colint) (partition p0 values less than (extract(year from '1998-11-23')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -2006-01-03 +2006-02-05 2006-02-17 -select * from t22; +select * from t22 order by col1; col1 -2006-01-03 -2006-02-17 2006-01-25 -select * from t33; -col1 -2006-01-03 +2006-02-05 2006-02-17 +select * from t33 order by col1; +col1 2006-01-25 -select * from t44; +2006-02-05 +2006-02-17 +select * from t44 order by colint; colint col1 -2 2006-02-17 -1 2006-01-03 -select * from t55; -colint col1 -2 2006-02-17 -1 2006-01-03 +1 2006-02-03 +2 2006-01-17 3 2006-01-25 -select * from t66; +4 2006-02-05 +select * from t55 order by colint; colint col1 -1 2006-02-17 -2 2006-01-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-02-05 +2006-02-17 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-02-05 +2006-02-17 +alter table t55 +partition by list(colint) +subpartition by hash(extract(month from col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (extract(month from col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (extract(year from '1998-11-23')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (extract(year from '1998-11-23')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with extract(month from col1) +------------------------------------------------------------------------- +delete from t1 where col1='2006-02-17'; +delete from t2 where col1='2006-02-17'; +delete from t3 where col1='2006-02-17'; +delete from t4 where col1='2006-02-17'; +delete from t5 where col1='2006-02-17'; +delete from t6 where col1='2006-02-17'; +select * from t1 order by col1; +col1 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-02-17'); +insert into t2 values ('2006-02-17'); +insert into t3 values ('2006-02-17'); +insert into t4 values (60,'2006-02-17'); +insert into t5 values (60,'2006-02-17'); +insert into t6 values (60,'2006-02-17'); +select * from t1 order by col1; +col1 +2006-02-05 +2006-02-17 +select * from t2 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +select * from t2 order by col1; +col1 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t4 order by colint; +colint col1 +60 2006-02-17 +select * from t5 order by colint; +colint col1 +60 2006-02-17 +select * from t6 order by colint; +colint col1 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with extract(month from col1) +------------------------------------------------------------------------- +delete from t11 where col1='2006-02-17'; +delete from t22 where col1='2006-02-17'; +delete from t33 where col1='2006-02-17'; +delete from t44 where col1='2006-02-17'; +delete from t55 where col1='2006-02-17'; +delete from t66 where col1='2006-02-17'; +select * from t11 order by col1; +col1 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t33 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-02-17'); +insert into t22 values ('2006-02-17'); +insert into t33 values ('2006-02-17'); +insert into t44 values (60,'2006-02-17'); +insert into t55 values (60,'2006-02-17'); +insert into t66 values (60,'2006-02-17'); +select * from t11 order by col1; +col1 +2006-02-05 +2006-02-17 +select * from t22 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t33 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +select * from t22 order by col1; +col1 +select * from t33 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t44 order by colint; +colint col1 +60 2006-02-17 +select * from t55 order by colint; +colint col1 +60 2006-02-17 +select * from t66 order by colint; +colint col1 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -2251,44 +7219,83 @@ insert into t2 values ('21:59'); insert into t3 values ('09:09'); insert into t3 values ('14:30'); insert into t3 values ('21:59'); -insert into t4 values (1,'09:09'); -insert into t4 values (2,'14:30'); -insert into t5 values (1,'09:09'); -insert into t5 values (2,'14:30'); -insert into t5 values (3,'21:59'); -insert into t6 values (1,'14:30'); -insert into t6 values (2,'21:59'); -select hour(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6; +select hour(col1) from t1 order by col1; hour(col1) 9 14 -select * from t1; +select * from t1 order by col1; col1 09:09:00 14:30:00 -select * from t2; +select * from t2 order by col1; col1 09:09:00 14:30:00 21:59:00 -select * from t3; +select * from t3 order by col1; col1 09:09:00 14:30:00 21:59:00 -select * from t4; +select * from t4 order by colint; colint col1 -2 14:30:00 -1 09:09:00 -select * from t5; +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; colint col1 -2 14:30:00 -1 09:09:00 -3 21:59:00 -select * from t6; +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t6 order by colint; colint col1 -1 14:30:00 -2 21:59:00 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +update t1 set col1='10:30' where col1='09:09'; +update t2 set col1='10:30' where col1='09:09'; +update t3 set col1='10:30' where col1='09:09'; +update t4 set col1='10:30' where col1='09:09'; +update t5 set col1='10:30' where col1='09:09'; +update t6 set col1='10:30' where col1='09:09'; +select * from t1 order by col1; +col1 +10:30:00 +14:30:00 +select * from t2 order by col1; +col1 +10:30:00 +14:30:00 +21:59:00 +select * from t3 order by col1; +col1 +10:30:00 +14:30:00 +21:59:00 +select * from t4 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t6 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 ------------------------------------------------------------------------- --- Alter tables with hour(col1) ------------------------------------------------------------------------- @@ -2338,33 +7345,315 @@ alter table t66 partition by range(colint) (partition p0 values less than (hour('18:30')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -09:09:00 +10:30:00 14:30:00 -select * from t22; +select * from t22 order by col1; col1 -09:09:00 +10:30:00 14:30:00 21:59:00 -select * from t33; +select * from t33 order by col1; col1 -09:09:00 +10:30:00 14:30:00 21:59:00 -select * from t44; +select * from t44 order by colint; colint col1 -2 14:30:00 -1 09:09:00 -select * from t55; +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t55 order by colint; colint col1 -2 14:30:00 -1 09:09:00 -3 21:59:00 -select * from t66; +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t66 order by colint; colint col1 -1 14:30:00 -2 21:59:00 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:30:00 +14:30:00 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:30:00 +14:30:00 +alter table t55 +partition by list(colint) +subpartition by hash(hour(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` time DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (hour(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ +select * from t55 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (hour('18:30')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (hour('18:30')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with hour(col1) +------------------------------------------------------------------------- +delete from t1 where col1='14:30'; +delete from t2 where col1='14:30'; +delete from t3 where col1='14:30'; +delete from t4 where col1='14:30'; +delete from t5 where col1='14:30'; +delete from t6 where col1='14:30'; +select * from t1 order by col1; +col1 +10:30:00 +select * from t2 order by col1; +col1 +10:30:00 +21:59:00 +select * from t3 order by col1; +col1 +10:30:00 +21:59:00 +select * from t4 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +insert into t1 values ('14:30'); +insert into t2 values ('14:30'); +insert into t3 values ('14:30'); +insert into t4 values (60,'14:30'); +insert into t5 values (60,'14:30'); +insert into t6 values (60,'14:30'); +select * from t1 order by col1; +col1 +10:30:00 +14:30:00 +select * from t2 order by col1; +col1 +10:30:00 +14:30:00 +21:59:00 +select * from t3 order by col1; +col1 +10:30:00 +14:30:00 +21:59:00 +select * from t4 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:00 +select * from t5 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:00 +select * from t6 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:00 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +select * from t2 order by col1; +col1 +14:30:00 +21:59:00 +select * from t3 order by col1; +col1 +10:30:00 +14:30:00 +21:59:00 +select * from t4 order by colint; +colint col1 +60 14:30:00 +select * from t5 order by colint; +colint col1 +60 14:30:00 +select * from t6 order by colint; +colint col1 +60 14:30:00 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with hour(col1) +------------------------------------------------------------------------- +delete from t11 where col1='14:30'; +delete from t22 where col1='14:30'; +delete from t33 where col1='14:30'; +delete from t44 where col1='14:30'; +delete from t55 where col1='14:30'; +delete from t66 where col1='14:30'; +select * from t11 order by col1; +col1 +10:30:00 +select * from t22 order by col1; +col1 +10:30:00 +21:59:00 +select * from t33 order by col1; +col1 +10:30:00 +21:59:00 +select * from t44 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t55 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +insert into t11 values ('14:30'); +insert into t22 values ('14:30'); +insert into t33 values ('14:30'); +insert into t44 values (60,'14:30'); +insert into t55 values (60,'14:30'); +insert into t66 values (60,'14:30'); +select * from t11 order by col1; +col1 +10:30:00 +14:30:00 +select * from t22 order by col1; +col1 +10:30:00 +14:30:00 +21:59:00 +select * from t33 order by col1; +col1 +10:30:00 +14:30:00 +21:59:00 +select * from t44 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:00 +select * from t55 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:00 +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:00 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +select * from t22 order by col1; +col1 +14:30:00 +21:59:00 +select * from t33 order by col1; +col1 +10:30:00 +14:30:00 +21:59:00 +select * from t44 order by colint; +colint col1 +60 14:30:00 +select * from t55 order by colint; +colint col1 +60 14:30:00 +select * from t66 order by colint; +colint col1 +60 14:30:00 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -2434,44 +7723,83 @@ insert into t2 values ('00:59:22.000024'); insert into t3 values ('09:09:15.000002'); insert into t3 values ('04:30:01.000018'); insert into t3 values ('00:59:22.000024'); -insert into t4 values (1,'09:09:15.000002'); -insert into t4 values (2,'04:30:01.000018'); -insert into t5 values (1,'09:09:15.000002'); -insert into t5 values (2,'04:30:01.000018'); -insert into t5 values (3,'00:59:22.000024'); -insert into t6 values (1,'04:30:01.000018'); -insert into t6 values (2,'00:59:22.000024'); -select microsecond(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6; +select microsecond(col1) from t1 order by col1; microsecond(col1) 0 0 -select * from t1; +select * from t1 order by col1; col1 -09:09:15 04:30:01 -select * from t2; +09:09:15 +select * from t2 order by col1; col1 -09:09:15 -04:30:01 00:59:22 -select * from t3; -col1 -09:09:15 04:30:01 +09:09:15 +select * from t3 order by col1; +col1 00:59:22 -select * from t4; -colint col1 -1 09:09:15 -2 04:30:01 -select * from t5; +04:30:01 +09:09:15 +select * from t4 order by colint; colint col1 1 09:09:15 2 04:30:01 3 00:59:22 -select * from t6; +4 05:30:34 +select * from t5 order by colint; colint col1 -1 04:30:01 -2 00:59:22 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t6 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +update t1 set col1='05:30:34.000037' where col1='09:09:15.000002'; +update t2 set col1='05:30:34.000037' where col1='09:09:15.000002'; +update t3 set col1='05:30:34.000037' where col1='09:09:15.000002'; +update t4 set col1='05:30:34.000037' where col1='09:09:15.000002'; +update t5 set col1='05:30:34.000037' where col1='09:09:15.000002'; +update t6 set col1='05:30:34.000037' where col1='09:09:15.000002'; +select * from t1 order by col1; +col1 +04:30:01 +05:30:34 +select * from t2 order by col1; +col1 +00:59:22 +04:30:01 +05:30:34 +select * from t3 order by col1; +col1 +00:59:22 +04:30:01 +05:30:34 +select * from t4 order by colint; +colint col1 +1 05:30:34 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 05:30:34 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t6 order by colint; +colint col1 +1 05:30:34 +2 04:30:01 +3 00:59:22 +4 05:30:34 ------------------------------------------------------------------------- --- Alter tables with microsecond(col1) ------------------------------------------------------------------------- @@ -2521,33 +7849,301 @@ alter table t66 partition by range(colint) (partition p0 values less than (microsecond('10:30:10.000010')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -09:09:15 04:30:01 -select * from t22; +05:30:34 +select * from t22 order by col1; col1 -09:09:15 -04:30:01 00:59:22 -select * from t33; -col1 -09:09:15 04:30:01 +05:30:34 +select * from t33 order by col1; +col1 00:59:22 -select * from t44; +04:30:01 +05:30:34 +select * from t44 order by colint; colint col1 -1 09:09:15 -2 04:30:01 -select * from t55; -colint col1 -1 09:09:15 +1 05:30:34 2 04:30:01 3 00:59:22 -select * from t66; +4 05:30:34 +select * from t55 order by colint; colint col1 -1 04:30:01 -2 00:59:22 +1 05:30:34 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t66 order by colint; +colint col1 +1 05:30:34 +2 04:30:01 +3 00:59:22 +4 05:30:34 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +04:30:01 +05:30:34 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +04:30:01 +05:30:34 +alter table t55 +partition by list(colint) +subpartition by hash(microsecond(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` time DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (microsecond(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ +select * from t55 order by colint; +colint col1 +1 05:30:34 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 05:30:34 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (microsecond('10:30:10.000010')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 05:30:34 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 05:30:34 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (microsecond('10:30:10.000010')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 05:30:34 +2 04:30:01 +3 00:59:22 +4 05:30:34 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with microsecond(col1) +------------------------------------------------------------------------- +delete from t1 where col1='04:30:01.000018'; +delete from t2 where col1='04:30:01.000018'; +delete from t3 where col1='04:30:01.000018'; +delete from t4 where col1='04:30:01.000018'; +delete from t5 where col1='04:30:01.000018'; +delete from t6 where col1='04:30:01.000018'; +select * from t1 order by col1; +col1 +05:30:34 +select * from t2 order by col1; +col1 +00:59:22 +05:30:34 +select * from t3 order by col1; +col1 +00:59:22 +05:30:34 +select * from t4 order by colint; +colint col1 +1 05:30:34 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 05:30:34 +3 00:59:22 +4 05:30:34 +insert into t1 values ('04:30:01.000018'); +insert into t2 values ('04:30:01.000018'); +insert into t3 values ('04:30:01.000018'); +insert into t4 values (60,'04:30:01.000018'); +insert into t5 values (60,'04:30:01.000018'); +insert into t6 values (60,'04:30:01.000018'); +select * from t1 order by col1; +col1 +04:30:01 +05:30:34 +select * from t2 order by col1; +col1 +00:59:22 +04:30:01 +05:30:34 +select * from t3 order by col1; +col1 +00:59:22 +04:30:01 +05:30:34 +select * from t4 order by colint; +colint col1 +1 05:30:34 +3 00:59:22 +4 05:30:34 +60 04:30:01 +select * from t5 order by colint; +colint col1 +1 05:30:34 +3 00:59:22 +4 05:30:34 +60 04:30:01 +select * from t6 order by colint; +colint col1 +1 05:30:34 +3 00:59:22 +4 05:30:34 +60 04:30:01 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +select * from t2 order by col1; +col1 +select * from t3 order by col1; +col1 +00:59:22 +04:30:01 +05:30:34 +select * from t4 order by colint; +colint col1 +60 04:30:01 +select * from t5 order by colint; +colint col1 +60 04:30:01 +select * from t6 order by colint; +colint col1 +60 04:30:01 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with microsecond(col1) +------------------------------------------------------------------------- +delete from t11 where col1='04:30:01.000018'; +delete from t22 where col1='04:30:01.000018'; +delete from t33 where col1='04:30:01.000018'; +delete from t44 where col1='04:30:01.000018'; +delete from t55 where col1='04:30:01.000018'; +delete from t66 where col1='04:30:01.000018'; +select * from t11 order by col1; +col1 +05:30:34 +select * from t22 order by col1; +col1 +00:59:22 +05:30:34 +select * from t33 order by col1; +col1 +00:59:22 +05:30:34 +select * from t44 order by colint; +colint col1 +1 05:30:34 +3 00:59:22 +4 05:30:34 +select * from t55 order by colint; +colint col1 +1 05:30:34 +3 00:59:22 +4 05:30:34 +insert into t11 values ('04:30:01.000018'); +insert into t22 values ('04:30:01.000018'); +insert into t33 values ('04:30:01.000018'); +insert into t44 values (60,'04:30:01.000018'); +insert into t55 values (60,'04:30:01.000018'); +insert into t66 values (60,'04:30:01.000018'); +select * from t11 order by col1; +col1 +04:30:01 +05:30:34 +select * from t22 order by col1; +col1 +00:59:22 +04:30:01 +05:30:34 +select * from t33 order by col1; +col1 +00:59:22 +04:30:01 +05:30:34 +select * from t44 order by colint; +colint col1 +1 05:30:34 +3 00:59:22 +4 05:30:34 +60 04:30:01 +select * from t55 order by colint; +colint col1 +1 05:30:34 +3 00:59:22 +4 05:30:34 +60 04:30:01 +select * from t66 order by colint; +colint col1 +1 05:30:34 +3 00:59:22 +4 05:30:34 +60 04:30:01 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +select * from t22 order by col1; +col1 +select * from t33 order by col1; +col1 +00:59:22 +04:30:01 +05:30:34 +select * from t44 order by colint; +colint col1 +60 04:30:01 +select * from t55 order by colint; +colint col1 +60 04:30:01 +select * from t66 order by colint; +colint col1 +60 04:30:01 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -2617,44 +8213,83 @@ insert into t2 values ('21:59:22'); insert into t3 values ('09:09:15'); insert into t3 values ('14:30:45'); insert into t3 values ('21:59:22'); -insert into t4 values (1,'09:09:15'); -insert into t4 values (2,'14:30:45'); -insert into t5 values (1,'09:09:15'); -insert into t5 values (2,'14:30:45'); -insert into t5 values (3,'21:59:22'); -insert into t6 values (1,'14:30:45'); -insert into t6 values (2,'21:59:22'); -select minute(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6; +select minute(col1) from t1 order by col1; minute(col1) 9 30 -select * from t1; +select * from t1 order by col1; col1 09:09:15 14:30:45 -select * from t2; +select * from t2 order by col1; col1 09:09:15 14:30:45 21:59:22 -select * from t3; +select * from t3 order by col1; col1 09:09:15 14:30:45 21:59:22 -select * from t4; +select * from t4 order by colint; colint col1 -2 14:30:45 1 09:09:15 -select * from t5; +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; colint col1 -2 14:30:45 1 09:09:15 -3 21:59:22 -select * from t6; +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t6 order by colint; colint col1 -1 14:30:45 -2 21:59:22 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +update t1 set col1='10:24:23' where col1='09:09:15'; +update t2 set col1='10:24:23' where col1='09:09:15'; +update t3 set col1='10:24:23' where col1='09:09:15'; +update t4 set col1='10:24:23' where col1='09:09:15'; +update t5 set col1='10:24:23' where col1='09:09:15'; +update t6 set col1='10:24:23' where col1='09:09:15'; +select * from t1 order by col1; +col1 +10:24:23 +14:30:45 +select * from t2 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t3 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t4 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t6 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 ------------------------------------------------------------------------- --- Alter tables with minute(col1) ------------------------------------------------------------------------- @@ -2704,33 +8339,321 @@ alter table t66 partition by range(colint) (partition p0 values less than (minute('18:30')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -09:09:15 +10:24:23 14:30:45 -select * from t22; +select * from t22 order by col1; col1 -09:09:15 +10:24:23 14:30:45 21:59:22 -select * from t33; +select * from t33 order by col1; col1 -09:09:15 +10:24:23 14:30:45 21:59:22 -select * from t44; +select * from t44 order by colint; colint col1 -2 14:30:45 -1 09:09:15 -select * from t55; +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t55 order by colint; colint col1 -2 14:30:45 -1 09:09:15 -3 21:59:22 -select * from t66; +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t66 order by colint; colint col1 -1 14:30:45 -2 21:59:22 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:24:23 +14:30:45 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:24:23 +14:30:45 +alter table t55 +partition by list(colint) +subpartition by hash(minute(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` time DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (minute(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ +select * from t55 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (minute('18:30')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (minute('18:30')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with minute(col1) +------------------------------------------------------------------------- +delete from t1 where col1='14:30:45'; +delete from t2 where col1='14:30:45'; +delete from t3 where col1='14:30:45'; +delete from t4 where col1='14:30:45'; +delete from t5 where col1='14:30:45'; +delete from t6 where col1='14:30:45'; +select * from t1 order by col1; +col1 +10:24:23 +select * from t2 order by col1; +col1 +10:24:23 +21:59:22 +select * from t3 order by col1; +col1 +10:24:23 +21:59:22 +select * from t4 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +insert into t1 values ('14:30:45'); +insert into t2 values ('14:30:45'); +insert into t3 values ('14:30:45'); +insert into t4 values (60,'14:30:45'); +insert into t5 values (60,'14:30:45'); +insert into t6 values (60,'14:30:45'); +select * from t1 order by col1; +col1 +10:24:23 +14:30:45 +select * from t2 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t3 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t4 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +select * from t5 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +select * from t6 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +10:24:23 +14:30:45 +select * from t2 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t3 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t4 order by colint; +colint col1 +60 14:30:45 +select * from t5 order by colint; +colint col1 +60 14:30:45 +select * from t6 order by colint; +colint col1 +60 14:30:45 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with minute(col1) +------------------------------------------------------------------------- +delete from t11 where col1='14:30:45'; +delete from t22 where col1='14:30:45'; +delete from t33 where col1='14:30:45'; +delete from t44 where col1='14:30:45'; +delete from t55 where col1='14:30:45'; +delete from t66 where col1='14:30:45'; +select * from t11 order by col1; +col1 +10:24:23 +select * from t22 order by col1; +col1 +10:24:23 +21:59:22 +select * from t33 order by col1; +col1 +10:24:23 +21:59:22 +select * from t44 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t55 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +insert into t11 values ('14:30:45'); +insert into t22 values ('14:30:45'); +insert into t33 values ('14:30:45'); +insert into t44 values (60,'14:30:45'); +insert into t55 values (60,'14:30:45'); +insert into t66 values (60,'14:30:45'); +select * from t11 order by col1; +col1 +10:24:23 +14:30:45 +select * from t22 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t33 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t44 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +select * from t55 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +select * from t66 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +10:24:23 +14:30:45 +select * from t22 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t33 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t44 order by colint; +colint col1 +60 14:30:45 +select * from t55 order by colint; +colint col1 +60 14:30:45 +select * from t66 order by colint; +colint col1 +60 14:30:45 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -2800,44 +8723,83 @@ insert into t2 values ('21:59:22'); insert into t3 values ('09:09:09'); insert into t3 values ('14:30:20'); insert into t3 values ('21:59:22'); -insert into t4 values (1,'09:09:09'); -insert into t4 values (2,'14:30:20'); -insert into t5 values (1,'09:09:09'); -insert into t5 values (2,'14:30:20'); -insert into t5 values (3,'21:59:22'); -insert into t6 values (1,'14:30:20'); -insert into t6 values (2,'21:59:22'); -select second(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6; +select second(col1) from t1 order by col1; second(col1) 9 20 -select * from t1; +select * from t1 order by col1; col1 09:09:09 14:30:20 -select * from t2; +select * from t2 order by col1; col1 09:09:09 14:30:20 21:59:22 -select * from t3; +select * from t3 order by col1; col1 09:09:09 14:30:20 21:59:22 -select * from t4; +select * from t4 order by colint; colint col1 -2 14:30:20 -1 09:09:09 -select * from t5; +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; colint col1 -2 14:30:20 -3 21:59:22 -1 09:09:09 -select * from t6; +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t6 order by colint; colint col1 -1 14:30:20 -2 21:59:22 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +update t1 set col1='10:22:33' where col1='09:09:09'; +update t2 set col1='10:22:33' where col1='09:09:09'; +update t3 set col1='10:22:33' where col1='09:09:09'; +update t4 set col1='10:22:33' where col1='09:09:09'; +update t5 set col1='10:22:33' where col1='09:09:09'; +update t6 set col1='10:22:33' where col1='09:09:09'; +select * from t1 order by col1; +col1 +10:22:33 +14:30:20 +select * from t2 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t3 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t4 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t6 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 ------------------------------------------------------------------------- --- Alter tables with second(col1) ------------------------------------------------------------------------- @@ -2887,33 +8849,321 @@ alter table t66 partition by range(colint) (partition p0 values less than (second('18:30:14')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -09:09:09 +10:22:33 14:30:20 -select * from t22; +select * from t22 order by col1; col1 -09:09:09 +10:22:33 14:30:20 21:59:22 -select * from t33; +select * from t33 order by col1; col1 -09:09:09 +10:22:33 14:30:20 21:59:22 -select * from t44; +select * from t44 order by colint; colint col1 -2 14:30:20 -1 09:09:09 -select * from t55; +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t55 order by colint; colint col1 -2 14:30:20 -3 21:59:22 -1 09:09:09 -select * from t66; +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t66 order by colint; colint col1 -1 14:30:20 -2 21:59:22 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:22:33 +14:30:20 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:22:33 +14:30:20 +alter table t55 +partition by list(colint) +subpartition by hash(second(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` time DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (second(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ +select * from t55 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (second('18:30:14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (second('18:30:14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with second(col1) +------------------------------------------------------------------------- +delete from t1 where col1='14:30:20'; +delete from t2 where col1='14:30:20'; +delete from t3 where col1='14:30:20'; +delete from t4 where col1='14:30:20'; +delete from t5 where col1='14:30:20'; +delete from t6 where col1='14:30:20'; +select * from t1 order by col1; +col1 +10:22:33 +select * from t2 order by col1; +col1 +10:22:33 +21:59:22 +select * from t3 order by col1; +col1 +10:22:33 +21:59:22 +select * from t4 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +insert into t1 values ('14:30:20'); +insert into t2 values ('14:30:20'); +insert into t3 values ('14:30:20'); +insert into t4 values (60,'14:30:20'); +insert into t5 values (60,'14:30:20'); +insert into t6 values (60,'14:30:20'); +select * from t1 order by col1; +col1 +10:22:33 +14:30:20 +select * from t2 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t3 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t4 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:20 +select * from t5 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:20 +select * from t6 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:20 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +10:22:33 +14:30:20 +select * from t2 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t3 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t4 order by colint; +colint col1 +60 14:30:20 +select * from t5 order by colint; +colint col1 +60 14:30:20 +select * from t6 order by colint; +colint col1 +60 14:30:20 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with second(col1) +------------------------------------------------------------------------- +delete from t11 where col1='14:30:20'; +delete from t22 where col1='14:30:20'; +delete from t33 where col1='14:30:20'; +delete from t44 where col1='14:30:20'; +delete from t55 where col1='14:30:20'; +delete from t66 where col1='14:30:20'; +select * from t11 order by col1; +col1 +10:22:33 +select * from t22 order by col1; +col1 +10:22:33 +21:59:22 +select * from t33 order by col1; +col1 +10:22:33 +21:59:22 +select * from t44 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t55 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +insert into t11 values ('14:30:20'); +insert into t22 values ('14:30:20'); +insert into t33 values ('14:30:20'); +insert into t44 values (60,'14:30:20'); +insert into t55 values (60,'14:30:20'); +insert into t66 values (60,'14:30:20'); +select * from t11 order by col1; +col1 +10:22:33 +14:30:20 +select * from t22 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t33 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t44 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:20 +select * from t55 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:20 +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:20 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +10:22:33 +14:30:20 +select * from t22 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t33 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t44 order by colint; +colint col1 +60 14:30:20 +select * from t55 order by colint; +colint col1 +60 14:30:20 +select * from t66 order by colint; +colint col1 +60 14:30:20 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -2983,44 +9233,83 @@ insert into t2 values ('21:59:22'); insert into t3 values ('09:09:09'); insert into t3 values ('14:30:20'); insert into t3 values ('21:59:22'); -insert into t4 values (1,'09:09:09'); -insert into t4 values (2,'14:30:20'); -insert into t5 values (1,'09:09:09'); -insert into t5 values (2,'14:30:20'); -insert into t5 values (3,'21:59:22'); -insert into t6 values (1,'14:30:20'); -insert into t6 values (2,'21:59:22'); -select second(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6; +select second(col1) from t1 order by col1; second(col1) 9 20 -select * from t1; +select * from t1 order by col1; col1 09:09:09 14:30:20 -select * from t2; +select * from t2 order by col1; col1 09:09:09 14:30:20 21:59:22 -select * from t3; +select * from t3 order by col1; col1 09:09:09 14:30:20 21:59:22 -select * from t4; +select * from t4 order by colint; colint col1 -2 14:30:20 -1 09:09:09 -select * from t5; +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +select * from t5 order by colint; colint col1 -2 14:30:20 -3 21:59:22 -1 09:09:09 -select * from t6; +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +select * from t6 order by colint; colint col1 -1 14:30:20 -2 21:59:22 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +update t1 set col1='10:22:33' where col1='09:09:09'; +update t2 set col1='10:22:33' where col1='09:09:09'; +update t3 set col1='10:22:33' where col1='09:09:09'; +update t4 set col1='10:22:33' where col1='09:09:09'; +update t5 set col1='10:22:33' where col1='09:09:09'; +update t6 set col1='10:22:33' where col1='09:09:09'; +select * from t1 order by col1; +col1 +10:22:33 +14:30:20 +select * from t2 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t3 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t4 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +select * from t5 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +select * from t6 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 ------------------------------------------------------------------------- --- Alter tables with second(col1) ------------------------------------------------------------------------- @@ -3070,33 +9359,321 @@ alter table t66 partition by range(colint) (partition p0 values less than (second('18:30:14')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -09:09:09 +10:22:33 14:30:20 -select * from t22; +select * from t22 order by col1; col1 -09:09:09 +10:22:33 14:30:20 21:59:22 -select * from t33; +select * from t33 order by col1; col1 -09:09:09 +10:22:33 14:30:20 21:59:22 -select * from t44; +select * from t44 order by colint; colint col1 -2 14:30:20 -1 09:09:09 -select * from t55; +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +select * from t55 order by colint; colint col1 -2 14:30:20 -3 21:59:22 -1 09:09:09 -select * from t66; +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +select * from t66 order by colint; colint col1 -1 14:30:20 -2 21:59:22 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:22:33 +14:30:20 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:22:33 +14:30:20 +alter table t55 +partition by list(colint) +subpartition by hash(second(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` char(30) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (second(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ +select * from t55 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (second('18:30:14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (second('18:30:14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with second(col1) +------------------------------------------------------------------------- +delete from t1 where col1='14:30:20'; +delete from t2 where col1='14:30:20'; +delete from t3 where col1='14:30:20'; +delete from t4 where col1='14:30:20'; +delete from t5 where col1='14:30:20'; +delete from t6 where col1='14:30:20'; +select * from t1 order by col1; +col1 +10:22:33 +select * from t2 order by col1; +col1 +10:22:33 +21:59:22 +select * from t3 order by col1; +col1 +10:22:33 +21:59:22 +select * from t4 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +select * from t5 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +insert into t1 values ('14:30:20'); +insert into t2 values ('14:30:20'); +insert into t3 values ('14:30:20'); +insert into t4 values (60,'14:30:20'); +insert into t5 values (60,'14:30:20'); +insert into t6 values (60,'14:30:20'); +select * from t1 order by col1; +col1 +10:22:33 +14:30:20 +select * from t2 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t3 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t4 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +60 14:30:20 +select * from t5 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +60 14:30:20 +select * from t6 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +60 14:30:20 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +10:22:33 +14:30:20 +select * from t2 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t3 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t4 order by colint; +colint col1 +60 14:30:20 +select * from t5 order by colint; +colint col1 +60 14:30:20 +select * from t6 order by colint; +colint col1 +60 14:30:20 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with second(col1) +------------------------------------------------------------------------- +delete from t11 where col1='14:30:20'; +delete from t22 where col1='14:30:20'; +delete from t33 where col1='14:30:20'; +delete from t44 where col1='14:30:20'; +delete from t55 where col1='14:30:20'; +delete from t66 where col1='14:30:20'; +select * from t11 order by col1; +col1 +10:22:33 +select * from t22 order by col1; +col1 +10:22:33 +21:59:22 +select * from t33 order by col1; +col1 +10:22:33 +21:59:22 +select * from t44 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +select * from t55 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +insert into t11 values ('14:30:20'); +insert into t22 values ('14:30:20'); +insert into t33 values ('14:30:20'); +insert into t44 values (60,'14:30:20'); +insert into t55 values (60,'14:30:20'); +insert into t66 values (60,'14:30:20'); +select * from t11 order by col1; +col1 +10:22:33 +14:30:20 +select * from t22 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t33 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t44 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +60 14:30:20 +select * from t55 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +60 14:30:20 +select * from t66 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +60 14:30:20 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +10:22:33 +14:30:20 +select * from t22 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t33 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t44 order by colint; +colint col1 +60 14:30:20 +select * from t55 order by colint; +colint col1 +60 14:30:20 +select * from t66 order by colint; +colint col1 +60 14:30:20 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -3166,44 +9743,83 @@ insert into t2 values ('2006-05-25'); insert into t3 values ('2006-01-03'); insert into t3 values ('2006-12-17'); insert into t3 values ('2006-05-25'); -insert into t4 values (1,'2006-01-03'); -insert into t4 values (2,'2006-12-17'); -insert into t5 values (1,'2006-01-03'); -insert into t5 values (2,'2006-12-17'); -insert into t5 values (3,'2006-05-25'); -insert into t6 values (1,'2006-12-17'); -insert into t6 values (2,'2006-05-25'); -select month(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select month(col1) from t1 order by col1; month(col1) 1 12 -select * from t1; +select * from t1 order by col1; col1 2006-01-03 2006-12-17 -select * from t2; +select * from t2 order by col1; col1 2006-01-03 2006-05-25 2006-12-17 -select * from t3; +select * from t3 order by col1; col1 2006-01-03 -2006-12-17 2006-05-25 -select * from t4; +2006-12-17 +select * from t4 order by colint; colint col1 -2 2006-12-17 -1 2006-01-03 -select * from t5; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; colint col1 -2 2006-12-17 -1 2006-01-03 -3 2006-05-25 -select * from t6; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; colint col1 -1 2006-12-17 -2 2006-05-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-11-06' where col1='2006-01-03'; +update t2 set col1='2006-11-06' where col1='2006-01-03'; +update t3 set col1='2006-11-06' where col1='2006-01-03'; +update t4 set col1='2006-11-06' where col1='2006-01-03'; +update t5 set col1='2006-11-06' where col1='2006-01-03'; +update t6 set col1='2006-11-06' where col1='2006-01-03'; +select * from t1 order by col1; +col1 +2006-11-06 +2006-12-17 +select * from t2 order by col1; +col1 +2006-05-25 +2006-11-06 +2006-12-17 +select * from t3 order by col1; +col1 +2006-05-25 +2006-11-06 +2006-12-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 ------------------------------------------------------------------------- --- Alter tables with month(col1) ------------------------------------------------------------------------- @@ -3253,33 +9869,315 @@ alter table t66 partition by range(colint) (partition p0 values less than (month('2006-10-14')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -2006-01-03 +2006-11-06 2006-12-17 -select * from t22; +select * from t22 order by col1; col1 -2006-01-03 2006-05-25 +2006-11-06 2006-12-17 -select * from t33; +select * from t33 order by col1; col1 -2006-01-03 -2006-12-17 2006-05-25 -select * from t44; +2006-11-06 +2006-12-17 +select * from t44 order by colint; colint col1 -2 2006-12-17 -1 2006-01-03 -select * from t55; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; colint col1 -2 2006-12-17 -1 2006-01-03 -3 2006-05-25 -select * from t66; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; colint col1 -1 2006-12-17 -2 2006-05-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-11-06 +2006-12-17 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-11-06 +2006-12-17 +alter table t55 +partition by list(colint) +subpartition by hash(month(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (month(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (month('2006-10-14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (month('2006-10-14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with month(col1) +------------------------------------------------------------------------- +delete from t1 where col1='2006-12-17'; +delete from t2 where col1='2006-12-17'; +delete from t3 where col1='2006-12-17'; +delete from t4 where col1='2006-12-17'; +delete from t5 where col1='2006-12-17'; +delete from t6 where col1='2006-12-17'; +select * from t1 order by col1; +col1 +2006-11-06 +select * from t2 order by col1; +col1 +2006-05-25 +2006-11-06 +select * from t3 order by col1; +col1 +2006-05-25 +2006-11-06 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-12-17'); +insert into t2 values ('2006-12-17'); +insert into t3 values ('2006-12-17'); +insert into t4 values (60,'2006-12-17'); +insert into t5 values (60,'2006-12-17'); +insert into t6 values (60,'2006-12-17'); +select * from t1 order by col1; +col1 +2006-11-06 +2006-12-17 +select * from t2 order by col1; +col1 +2006-05-25 +2006-11-06 +2006-12-17 +select * from t3 order by col1; +col1 +2006-05-25 +2006-11-06 +2006-12-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +select * from t2 order by col1; +col1 +2006-11-06 +2006-12-17 +select * from t3 order by col1; +col1 +2006-05-25 +2006-11-06 +2006-12-17 +select * from t4 order by colint; +colint col1 +60 2006-12-17 +select * from t5 order by colint; +colint col1 +60 2006-12-17 +select * from t6 order by colint; +colint col1 +60 2006-12-17 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with month(col1) +------------------------------------------------------------------------- +delete from t11 where col1='2006-12-17'; +delete from t22 where col1='2006-12-17'; +delete from t33 where col1='2006-12-17'; +delete from t44 where col1='2006-12-17'; +delete from t55 where col1='2006-12-17'; +delete from t66 where col1='2006-12-17'; +select * from t11 order by col1; +col1 +2006-11-06 +select * from t22 order by col1; +col1 +2006-05-25 +2006-11-06 +select * from t33 order by col1; +col1 +2006-05-25 +2006-11-06 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-12-17'); +insert into t22 values ('2006-12-17'); +insert into t33 values ('2006-12-17'); +insert into t44 values (60,'2006-12-17'); +insert into t55 values (60,'2006-12-17'); +insert into t66 values (60,'2006-12-17'); +select * from t11 order by col1; +col1 +2006-11-06 +2006-12-17 +select * from t22 order by col1; +col1 +2006-05-25 +2006-11-06 +2006-12-17 +select * from t33 order by col1; +col1 +2006-05-25 +2006-11-06 +2006-12-17 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +select * from t22 order by col1; +col1 +2006-11-06 +2006-12-17 +select * from t33 order by col1; +col1 +2006-05-25 +2006-11-06 +2006-12-17 +select * from t44 order by colint; +colint col1 +60 2006-12-17 +select * from t55 order by colint; +colint col1 +60 2006-12-17 +select * from t66 order by colint; +colint col1 +60 2006-12-17 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -3349,44 +10247,83 @@ insert into t2 values ('2006-09-25'); insert into t3 values ('2006-01-03'); insert into t3 values ('2006-12-17'); insert into t3 values ('2006-09-25'); -insert into t4 values (1,'2006-01-03'); -insert into t4 values (2,'2006-12-17'); -insert into t5 values (1,'2006-01-03'); -insert into t5 values (2,'2006-12-17'); -insert into t5 values (3,'2006-09-25'); -insert into t6 values (1,'2006-12-17'); -insert into t6 values (2,'2006-09-25'); -select quarter(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select quarter(col1) from t1 order by col1; quarter(col1) 1 4 -select * from t1; +select * from t1 order by col1; col1 2006-01-03 2006-12-17 -select * from t2; +select * from t2 order by col1; col1 2006-01-03 -2006-12-17 2006-09-25 -select * from t3; +2006-12-17 +select * from t3 order by col1; col1 2006-01-03 -2006-12-17 2006-09-25 -select * from t4; +2006-12-17 +select * from t4 order by colint; colint col1 -2 2006-12-17 -1 2006-01-03 -select * from t5; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; colint col1 -2 2006-12-17 -1 2006-01-03 -3 2006-09-25 -select * from t6; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; colint col1 -1 2006-12-17 -2 2006-09-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-07-30' where col1='2006-01-03'; +update t2 set col1='2006-07-30' where col1='2006-01-03'; +update t3 set col1='2006-07-30' where col1='2006-01-03'; +update t4 set col1='2006-07-30' where col1='2006-01-03'; +update t5 set col1='2006-07-30' where col1='2006-01-03'; +update t6 set col1='2006-07-30' where col1='2006-01-03'; +select * from t1 order by col1; +col1 +2006-07-30 +2006-12-17 +select * from t2 order by col1; +col1 +2006-07-30 +2006-09-25 +2006-12-17 +select * from t3 order by col1; +col1 +2006-07-30 +2006-09-25 +2006-12-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 ------------------------------------------------------------------------- --- Alter tables with quarter(col1) ------------------------------------------------------------------------- @@ -3436,33 +10373,313 @@ alter table t66 partition by range(colint) (partition p0 values less than (quarter('2006-10-14')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -2006-01-03 +2006-07-30 2006-12-17 -select * from t22; +select * from t22 order by col1; col1 -2006-01-03 -2006-12-17 +2006-07-30 2006-09-25 -select * from t33; -col1 -2006-01-03 2006-12-17 +select * from t33 order by col1; +col1 +2006-07-30 2006-09-25 -select * from t44; +2006-12-17 +select * from t44 order by colint; colint col1 -2 2006-12-17 -1 2006-01-03 -select * from t55; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; colint col1 -2 2006-12-17 -1 2006-01-03 -3 2006-09-25 -select * from t66; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; colint col1 -1 2006-12-17 -2 2006-09-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-07-30 +2006-12-17 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-07-30 +2006-12-17 +alter table t55 +partition by list(colint) +subpartition by hash(quarter(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (quarter(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (quarter('2006-10-14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (quarter('2006-10-14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with quarter(col1) +------------------------------------------------------------------------- +delete from t1 where col1='2006-12-17'; +delete from t2 where col1='2006-12-17'; +delete from t3 where col1='2006-12-17'; +delete from t4 where col1='2006-12-17'; +delete from t5 where col1='2006-12-17'; +delete from t6 where col1='2006-12-17'; +select * from t1 order by col1; +col1 +2006-07-30 +select * from t2 order by col1; +col1 +2006-07-30 +2006-09-25 +select * from t3 order by col1; +col1 +2006-07-30 +2006-09-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-12-17'); +insert into t2 values ('2006-12-17'); +insert into t3 values ('2006-12-17'); +insert into t4 values (60,'2006-12-17'); +insert into t5 values (60,'2006-12-17'); +insert into t6 values (60,'2006-12-17'); +select * from t1 order by col1; +col1 +2006-07-30 +2006-12-17 +select * from t2 order by col1; +col1 +2006-07-30 +2006-09-25 +2006-12-17 +select * from t3 order by col1; +col1 +2006-07-30 +2006-09-25 +2006-12-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +select * from t2 order by col1; +col1 +select * from t3 order by col1; +col1 +2006-07-30 +2006-09-25 +2006-12-17 +select * from t4 order by colint; +colint col1 +60 2006-12-17 +select * from t5 order by colint; +colint col1 +60 2006-12-17 +select * from t6 order by colint; +colint col1 +4 2006-02-05 +60 2006-12-17 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with quarter(col1) +------------------------------------------------------------------------- +delete from t11 where col1='2006-12-17'; +delete from t22 where col1='2006-12-17'; +delete from t33 where col1='2006-12-17'; +delete from t44 where col1='2006-12-17'; +delete from t55 where col1='2006-12-17'; +delete from t66 where col1='2006-12-17'; +select * from t11 order by col1; +col1 +2006-07-30 +select * from t22 order by col1; +col1 +2006-07-30 +2006-09-25 +select * from t33 order by col1; +col1 +2006-07-30 +2006-09-25 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-12-17'); +insert into t22 values ('2006-12-17'); +insert into t33 values ('2006-12-17'); +insert into t44 values (60,'2006-12-17'); +insert into t55 values (60,'2006-12-17'); +insert into t66 values (60,'2006-12-17'); +select * from t11 order by col1; +col1 +2006-07-30 +2006-12-17 +select * from t22 order by col1; +col1 +2006-07-30 +2006-09-25 +2006-12-17 +select * from t33 order by col1; +col1 +2006-07-30 +2006-09-25 +2006-12-17 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +select * from t22 order by col1; +col1 +select * from t33 order by col1; +col1 +2006-07-30 +2006-09-25 +2006-12-17 +select * from t44 order by colint; +colint col1 +60 2006-12-17 +select * from t55 order by colint; +colint col1 +60 2006-12-17 +select * from t66 order by colint; +colint col1 +4 2006-02-05 +60 2006-12-17 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -3532,44 +10749,83 @@ insert into t2 values ('21:59:22'); insert into t3 values ('09:09:15'); insert into t3 values ('14:30:45'); insert into t3 values ('21:59:22'); -insert into t4 values (1,'09:09:15'); -insert into t4 values (2,'14:30:45'); -insert into t5 values (1,'09:09:15'); -insert into t5 values (2,'14:30:45'); -insert into t5 values (3,'21:59:22'); -insert into t6 values (1,'14:30:45'); -insert into t6 values (2,'21:59:22'); -select time_to_sec(col1)-(time_to_sec(col1)-20) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6; +select time_to_sec(col1)-(time_to_sec(col1)-20) from t1 order by col1; time_to_sec(col1)-(time_to_sec(col1)-20) 20 20 -select * from t1; +select * from t1 order by col1; col1 09:09:15 14:30:45 -select * from t2; +select * from t2 order by col1; col1 09:09:15 14:30:45 21:59:22 -select * from t3; +select * from t3 order by col1; col1 09:09:15 14:30:45 21:59:22 -select * from t4; +select * from t4 order by colint; colint col1 1 09:09:15 -2 14:30:45 -select * from t5; +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; colint col1 1 09:09:15 -2 14:30:45 -3 21:59:22 -select * from t6; +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t6 order by colint; colint col1 -1 14:30:45 -2 21:59:22 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +update t1 set col1='10:33:11' where col1='09:09:15'; +update t2 set col1='10:33:11' where col1='09:09:15'; +update t3 set col1='10:33:11' where col1='09:09:15'; +update t4 set col1='10:33:11' where col1='09:09:15'; +update t5 set col1='10:33:11' where col1='09:09:15'; +update t6 set col1='10:33:11' where col1='09:09:15'; +select * from t1 order by col1; +col1 +10:33:11 +14:30:45 +select * from t2 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t3 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t4 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t6 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 ------------------------------------------------------------------------- --- Alter tables with time_to_sec(col1)-(time_to_sec(col1)-20) ------------------------------------------------------------------------- @@ -3619,33 +10875,319 @@ alter table t66 partition by range(colint) (partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -09:09:15 +10:33:11 14:30:45 -select * from t22; +select * from t22 order by col1; col1 -09:09:15 +10:33:11 14:30:45 21:59:22 -select * from t33; +select * from t33 order by col1; col1 -09:09:15 +10:33:11 14:30:45 21:59:22 -select * from t44; +select * from t44 order by colint; colint col1 -1 09:09:15 -2 14:30:45 -select * from t55; +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t55 order by colint; colint col1 -1 09:09:15 -2 14:30:45 -3 21:59:22 -select * from t66; +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t66 order by colint; colint col1 -1 14:30:45 -2 21:59:22 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:33:11 +14:30:45 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:33:11 +14:30:45 +alter table t55 +partition by list(colint) +subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` time DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (time_to_sec(col1)-(time_to_sec(col1)-20)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ +select * from t55 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with time_to_sec(col1)-(time_to_sec(col1)-20) +------------------------------------------------------------------------- +delete from t1 where col1='14:30:45'; +delete from t2 where col1='14:30:45'; +delete from t3 where col1='14:30:45'; +delete from t4 where col1='14:30:45'; +delete from t5 where col1='14:30:45'; +delete from t6 where col1='14:30:45'; +select * from t1 order by col1; +col1 +10:33:11 +select * from t2 order by col1; +col1 +10:33:11 +21:59:22 +select * from t3 order by col1; +col1 +10:33:11 +21:59:22 +select * from t4 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +insert into t1 values ('14:30:45'); +insert into t2 values ('14:30:45'); +insert into t3 values ('14:30:45'); +insert into t4 values (60,'14:30:45'); +insert into t5 values (60,'14:30:45'); +insert into t6 values (60,'14:30:45'); +select * from t1 order by col1; +col1 +10:33:11 +14:30:45 +select * from t2 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t3 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t4 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +select * from t5 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +select * from t6 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +10:33:11 +14:30:45 +select * from t2 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t3 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t4 order by colint; +colint col1 +60 14:30:45 +select * from t5 order by colint; +colint col1 +60 14:30:45 +select * from t6 order by colint; +colint col1 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with time_to_sec(col1)-(time_to_sec(col1)-20) +------------------------------------------------------------------------- +delete from t11 where col1='14:30:45'; +delete from t22 where col1='14:30:45'; +delete from t33 where col1='14:30:45'; +delete from t44 where col1='14:30:45'; +delete from t55 where col1='14:30:45'; +delete from t66 where col1='14:30:45'; +select * from t11 order by col1; +col1 +10:33:11 +select * from t22 order by col1; +col1 +10:33:11 +21:59:22 +select * from t33 order by col1; +col1 +10:33:11 +21:59:22 +select * from t44 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t55 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +insert into t11 values ('14:30:45'); +insert into t22 values ('14:30:45'); +insert into t33 values ('14:30:45'); +insert into t44 values (60,'14:30:45'); +insert into t55 values (60,'14:30:45'); +insert into t66 values (60,'14:30:45'); +select * from t11 order by col1; +col1 +10:33:11 +14:30:45 +select * from t22 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t33 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t44 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +select * from t55 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +select * from t66 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +10:33:11 +14:30:45 +select * from t22 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t33 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t44 order by colint; +colint col1 +60 14:30:45 +select * from t55 order by colint; +colint col1 +60 14:30:45 +select * from t66 order by colint; +colint col1 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -3715,44 +11257,83 @@ insert into t2 values ('2006-01-25'); insert into t3 values ('2006-02-03'); insert into t3 values ('2006-01-17'); insert into t3 values ('2006-01-25'); -insert into t4 values (1,'2006-02-03'); -insert into t4 values (2,'2006-01-17'); -insert into t5 values (1,'2006-02-03'); -insert into t5 values (2,'2006-01-17'); -insert into t5 values (3,'2006-01-25'); -insert into t6 values (1,'2006-01-17'); -insert into t6 values (2,'2006-01-25'); -select to_days(col1)-to_days('2006-01-01') from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select to_days(col1)-to_days('2006-01-01') from t1 order by col1; to_days(col1)-to_days('2006-01-01') -33 16 -select * from t1; +33 +select * from t1 order by col1; col1 -2006-02-03 2006-01-17 -select * from t2; +2006-02-03 +select * from t2 order by col1; col1 2006-01-17 2006-01-25 2006-02-03 -select * from t3; +select * from t3 order by col1; col1 -2006-02-03 2006-01-17 2006-01-25 -select * from t4; +2006-02-03 +select * from t4 order by colint; colint col1 -2 2006-01-17 1 2006-02-03 -select * from t5; -colint col1 2 2006-01-17 3 2006-01-25 -1 2006-02-03 -select * from t6; +4 2006-02-05 +select * from t5 order by colint; colint col1 -1 2006-01-17 -2 2006-01-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-02-06' where col1='2006-02-03'; +update t2 set col1='2006-02-06' where col1='2006-02-03'; +update t3 set col1='2006-02-06' where col1='2006-02-03'; +update t4 set col1='2006-02-06' where col1='2006-02-03'; +update t5 set col1='2006-02-06' where col1='2006-02-03'; +update t6 set col1='2006-02-06' where col1='2006-02-03'; +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-06 +select * from t2 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t3 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t4 order by colint; +colint col1 +1 2006-02-06 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-06 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-06 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 ------------------------------------------------------------------------- --- Alter tables with to_days(col1)-to_days('2006-01-01') ------------------------------------------------------------------------- @@ -3802,33 +11383,311 @@ alter table t66 partition by range(colint) (partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -2006-02-03 2006-01-17 -select * from t22; +2006-02-06 +select * from t22 order by col1; col1 2006-01-17 2006-01-25 -2006-02-03 -select * from t33; +2006-02-06 +select * from t33 order by col1; col1 -2006-02-03 2006-01-17 2006-01-25 -select * from t44; -colint col1 -2 2006-01-17 -1 2006-02-03 -select * from t55; +2006-02-06 +select * from t44 order by colint; colint col1 +1 2006-02-06 2 2006-01-17 3 2006-01-25 -1 2006-02-03 -select * from t66; +4 2006-02-05 +select * from t55 order by colint; colint col1 -1 2006-01-17 -2 2006-01-25 +1 2006-02-06 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; +colint col1 +1 2006-02-06 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-06 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-06 +alter table t55 +partition by list(colint) +subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (to_days(col1)-to_days('2006-01-01')) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ +select * from t55 order by colint; +colint col1 +1 2006-02-06 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-06 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-06 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-06 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-06 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01') +------------------------------------------------------------------------- +delete from t1 where col1='2006-01-17'; +delete from t2 where col1='2006-01-17'; +delete from t3 where col1='2006-01-17'; +delete from t4 where col1='2006-01-17'; +delete from t5 where col1='2006-01-17'; +delete from t6 where col1='2006-01-17'; +select * from t1 order by col1; +col1 +2006-02-06 +select * from t2 order by col1; +col1 +2006-01-25 +2006-02-06 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-06 +select * from t4 order by colint; +colint col1 +1 2006-02-06 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-06 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-01-17'); +insert into t2 values ('2006-01-17'); +insert into t3 values ('2006-01-17'); +insert into t4 values (60,'2006-01-17'); +insert into t5 values (60,'2006-01-17'); +insert into t6 values (60,'2006-01-17'); +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-06 +select * from t2 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t3 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t4 order by colint; +colint col1 +1 2006-02-06 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t5 order by colint; +colint col1 +1 2006-02-06 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t6 order by colint; +colint col1 +1 2006-02-06 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-06 +select * from t2 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t3 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t4 order by colint; +colint col1 +60 2006-01-17 +select * from t5 order by colint; +colint col1 +60 2006-01-17 +select * from t6 order by colint; +colint col1 +60 2006-01-17 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01') +------------------------------------------------------------------------- +delete from t11 where col1='2006-01-17'; +delete from t22 where col1='2006-01-17'; +delete from t33 where col1='2006-01-17'; +delete from t44 where col1='2006-01-17'; +delete from t55 where col1='2006-01-17'; +delete from t66 where col1='2006-01-17'; +select * from t11 order by col1; +col1 +2006-02-06 +select * from t22 order by col1; +col1 +2006-01-25 +2006-02-06 +select * from t33 order by col1; +col1 +2006-01-25 +2006-02-06 +select * from t44 order by colint; +colint col1 +1 2006-02-06 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-06 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-01-17'); +insert into t22 values ('2006-01-17'); +insert into t33 values ('2006-01-17'); +insert into t44 values (60,'2006-01-17'); +insert into t55 values (60,'2006-01-17'); +insert into t66 values (60,'2006-01-17'); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-06 +select * from t22 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t33 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t44 order by colint; +colint col1 +1 2006-02-06 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t55 order by colint; +colint col1 +1 2006-02-06 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t66 order by colint; +colint col1 +1 2006-02-06 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-06 +select * from t22 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t33 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t44 order by colint; +colint col1 +60 2006-01-17 +select * from t55 order by colint; +colint col1 +60 2006-01-17 +select * from t66 order by colint; +colint col1 +60 2006-01-17 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -3898,44 +11757,83 @@ insert into t2 values ('2006-05-25'); insert into t3 values ('2006-12-03'); insert into t3 values ('2006-11-17'); insert into t3 values ('2006-05-25'); -insert into t4 values (1,'2006-12-03'); -insert into t4 values (2,'2006-11-17'); -insert into t5 values (1,'2006-12-03'); -insert into t5 values (2,'2006-11-17'); -insert into t5 values (3,'2006-05-25'); -insert into t6 values (1,'2006-11-17'); -insert into t6 values (2,'2006-05-25'); -select weekday(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select weekday(col1) from t1 order by col1; weekday(col1) -6 4 -select * from t1; +6 +select * from t1 order by col1; col1 -2006-12-03 2006-11-17 -select * from t2; +2006-12-03 +select * from t2 order by col1; col1 -2006-12-03 -2006-11-17 2006-05-25 -select * from t3; -col1 -2006-12-03 2006-11-17 +2006-12-03 +select * from t3 order by col1; +col1 2006-05-25 -select * from t4; +2006-11-17 +2006-12-03 +select * from t4 order by colint; colint col1 -1 2006-12-03 -2 2006-11-17 -select * from t5; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; colint col1 -1 2006-12-03 -2 2006-11-17 -3 2006-05-25 -select * from t6; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; colint col1 -1 2006-11-17 -2 2006-05-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-02-06' where col1='2006-12-03'; +update t2 set col1='2006-02-06' where col1='2006-12-03'; +update t3 set col1='2006-02-06' where col1='2006-12-03'; +update t4 set col1='2006-02-06' where col1='2006-12-03'; +update t5 set col1='2006-02-06' where col1='2006-12-03'; +update t6 set col1='2006-02-06' where col1='2006-12-03'; +select * from t1 order by col1; +col1 +2006-02-06 +2006-11-17 +select * from t2 order by col1; +col1 +2006-02-06 +2006-05-25 +2006-11-17 +select * from t3 order by col1; +col1 +2006-02-06 +2006-05-25 +2006-11-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 ------------------------------------------------------------------------- --- Alter tables with weekday(col1) ------------------------------------------------------------------------- @@ -3985,33 +11883,311 @@ alter table t66 partition by range(colint) (partition p0 values less than (weekday('2006-10-14')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -2006-12-03 +2006-02-06 2006-11-17 -select * from t22; +select * from t22 order by col1; col1 -2006-12-03 -2006-11-17 +2006-02-06 2006-05-25 -select * from t33; -col1 -2006-12-03 2006-11-17 +select * from t33 order by col1; +col1 +2006-02-06 2006-05-25 -select * from t44; +2006-11-17 +select * from t44 order by colint; colint col1 -1 2006-12-03 -2 2006-11-17 -select * from t55; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; colint col1 -1 2006-12-03 -2 2006-11-17 -3 2006-05-25 -select * from t66; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; colint col1 -1 2006-11-17 -2 2006-05-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-02-06 +2006-11-17 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-02-06 +2006-11-17 +alter table t55 +partition by list(colint) +subpartition by hash(weekday(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (weekday(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (weekday('2006-10-14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (weekday('2006-10-14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with weekday(col1) +------------------------------------------------------------------------- +delete from t1 where col1='2006-11-17'; +delete from t2 where col1='2006-11-17'; +delete from t3 where col1='2006-11-17'; +delete from t4 where col1='2006-11-17'; +delete from t5 where col1='2006-11-17'; +delete from t6 where col1='2006-11-17'; +select * from t1 order by col1; +col1 +2006-02-06 +select * from t2 order by col1; +col1 +2006-02-06 +2006-05-25 +select * from t3 order by col1; +col1 +2006-02-06 +2006-05-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-11-17'); +insert into t2 values ('2006-11-17'); +insert into t3 values ('2006-11-17'); +insert into t4 values (60,'2006-11-17'); +insert into t5 values (60,'2006-11-17'); +insert into t6 values (60,'2006-11-17'); +select * from t1 order by col1; +col1 +2006-02-06 +2006-11-17 +select * from t2 order by col1; +col1 +2006-02-06 +2006-05-25 +2006-11-17 +select * from t3 order by col1; +col1 +2006-02-06 +2006-05-25 +2006-11-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-11-17 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-11-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-11-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +select * from t2 order by col1; +col1 +select * from t3 order by col1; +col1 +2006-02-06 +2006-05-25 +2006-11-17 +select * from t4 order by colint; +colint col1 +60 2006-11-17 +select * from t5 order by colint; +colint col1 +60 2006-11-17 +select * from t6 order by colint; +colint col1 +60 2006-11-17 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with weekday(col1) +------------------------------------------------------------------------- +delete from t11 where col1='2006-11-17'; +delete from t22 where col1='2006-11-17'; +delete from t33 where col1='2006-11-17'; +delete from t44 where col1='2006-11-17'; +delete from t55 where col1='2006-11-17'; +delete from t66 where col1='2006-11-17'; +select * from t11 order by col1; +col1 +2006-02-06 +select * from t22 order by col1; +col1 +2006-02-06 +2006-05-25 +select * from t33 order by col1; +col1 +2006-02-06 +2006-05-25 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-11-17'); +insert into t22 values ('2006-11-17'); +insert into t33 values ('2006-11-17'); +insert into t44 values (60,'2006-11-17'); +insert into t55 values (60,'2006-11-17'); +insert into t66 values (60,'2006-11-17'); +select * from t11 order by col1; +col1 +2006-02-06 +2006-11-17 +select * from t22 order by col1; +col1 +2006-02-06 +2006-05-25 +2006-11-17 +select * from t33 order by col1; +col1 +2006-02-06 +2006-05-25 +2006-11-17 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-11-17 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-11-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-11-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +select * from t22 order by col1; +col1 +select * from t33 order by col1; +col1 +2006-02-06 +2006-05-25 +2006-11-17 +select * from t44 order by colint; +colint col1 +60 2006-11-17 +select * from t55 order by colint; +colint col1 +60 2006-11-17 +select * from t66 order by colint; +colint col1 +60 2006-11-17 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -4081,44 +12257,83 @@ insert into t2 values ('2006-05-25'); insert into t3 values ('2006-01-03'); insert into t3 values ('2006-03-17'); insert into t3 values ('2006-05-25'); -insert into t4 values (1,'2006-01-03'); -insert into t4 values (2,'2006-03-17'); -insert into t5 values (1,'2006-01-03'); -insert into t5 values (2,'2006-03-17'); -insert into t5 values (3,'2006-05-25'); -insert into t6 values (1,'2006-03-17'); -insert into t6 values (2,'2006-05-25'); -select weekofyear(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select weekofyear(col1) from t1 order by col1; weekofyear(col1) 1 11 -select * from t1; +select * from t1 order by col1; col1 2006-01-03 2006-03-17 -select * from t2; +select * from t2 order by col1; col1 2006-01-03 2006-03-17 2006-05-25 -select * from t3; +select * from t3 order by col1; col1 2006-01-03 2006-03-17 2006-05-25 -select * from t4; +select * from t4 order by colint; colint col1 -1 2006-01-03 -2 2006-03-17 -select * from t5; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; colint col1 -1 2006-01-03 -2 2006-03-17 -3 2006-05-25 -select * from t6; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; colint col1 -1 2006-03-17 -2 2006-05-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-09-06' where col1='2006-01-03'; +update t2 set col1='2006-09-06' where col1='2006-01-03'; +update t3 set col1='2006-09-06' where col1='2006-01-03'; +update t4 set col1='2006-09-06' where col1='2006-01-03'; +update t5 set col1='2006-09-06' where col1='2006-01-03'; +update t6 set col1='2006-09-06' where col1='2006-01-03'; +select * from t1 order by col1; +col1 +2006-03-17 +2006-09-06 +select * from t2 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t3 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 ------------------------------------------------------------------------- --- Alter tables with weekofyear(col1) ------------------------------------------------------------------------- @@ -4168,33 +12383,319 @@ alter table t66 partition by range(colint) (partition p0 values less than (weekofyear('2006-02-14')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -2006-01-03 2006-03-17 -select * from t22; +2006-09-06 +select * from t22 order by col1; col1 -2006-01-03 2006-03-17 2006-05-25 -select * from t33; +2006-09-06 +select * from t33 order by col1; col1 -2006-01-03 2006-03-17 2006-05-25 -select * from t44; +2006-09-06 +select * from t44 order by colint; colint col1 -1 2006-01-03 -2 2006-03-17 -select * from t55; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; colint col1 -1 2006-01-03 -2 2006-03-17 -3 2006-05-25 -select * from t66; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; colint col1 -1 2006-03-17 -2 2006-05-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-03-17 +2006-09-06 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-03-17 +2006-09-06 +alter table t55 +partition by list(colint) +subpartition by hash(weekofyear(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (weekofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (weekofyear('2006-02-14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (weekofyear('2006-02-14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with weekofyear(col1) +------------------------------------------------------------------------- +delete from t1 where col1='2006-03-17'; +delete from t2 where col1='2006-03-17'; +delete from t3 where col1='2006-03-17'; +delete from t4 where col1='2006-03-17'; +delete from t5 where col1='2006-03-17'; +delete from t6 where col1='2006-03-17'; +select * from t1 order by col1; +col1 +2006-09-06 +select * from t2 order by col1; +col1 +2006-05-25 +2006-09-06 +select * from t3 order by col1; +col1 +2006-05-25 +2006-09-06 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-03-17'); +insert into t2 values ('2006-03-17'); +insert into t3 values ('2006-03-17'); +insert into t4 values (60,'2006-03-17'); +insert into t5 values (60,'2006-03-17'); +insert into t6 values (60,'2006-03-17'); +select * from t1 order by col1; +col1 +2006-03-17 +2006-09-06 +select * from t2 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t3 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-03-17 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-03-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-03-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +2006-09-06 +select * from t2 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t3 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t4 order by colint; +colint col1 +60 2006-03-17 +select * from t5 order by colint; +colint col1 +60 2006-03-17 +select * from t6 order by colint; +colint col1 +60 2006-03-17 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with weekofyear(col1) +------------------------------------------------------------------------- +delete from t11 where col1='2006-03-17'; +delete from t22 where col1='2006-03-17'; +delete from t33 where col1='2006-03-17'; +delete from t44 where col1='2006-03-17'; +delete from t55 where col1='2006-03-17'; +delete from t66 where col1='2006-03-17'; +select * from t11 order by col1; +col1 +2006-09-06 +select * from t22 order by col1; +col1 +2006-05-25 +2006-09-06 +select * from t33 order by col1; +col1 +2006-05-25 +2006-09-06 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-03-17'); +insert into t22 values ('2006-03-17'); +insert into t33 values ('2006-03-17'); +insert into t44 values (60,'2006-03-17'); +insert into t55 values (60,'2006-03-17'); +insert into t66 values (60,'2006-03-17'); +select * from t11 order by col1; +col1 +2006-03-17 +2006-09-06 +select * from t22 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t33 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-03-17 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-03-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-03-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +2006-09-06 +select * from t22 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t33 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t44 order by colint; +colint col1 +60 2006-03-17 +select * from t55 order by colint; +colint col1 +60 2006-03-17 +select * from t66 order by colint; +colint col1 +60 2006-03-17 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -4264,44 +12765,83 @@ insert into t2 values ('2004-05-25'); insert into t3 values ('1996-01-03'); insert into t3 values ('2000-02-17'); insert into t3 values ('2004-05-25'); -insert into t4 values (1,'1996-01-03'); -insert into t4 values (2,'2000-02-17'); -insert into t5 values (1,'1996-01-03'); -insert into t5 values (2,'2000-02-17'); -insert into t5 values (3,'2004-05-25'); -insert into t6 values (1,'2000-02-17'); -insert into t6 values (2,'2004-05-25'); -select year(col1)-1990 from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select year(col1)-1990 from t1 order by col1; year(col1)-1990 6 10 -select * from t1; +select * from t1 order by col1; col1 1996-01-03 2000-02-17 -select * from t2; +select * from t2 order by col1; col1 1996-01-03 2000-02-17 2004-05-25 -select * from t3; +select * from t3 order by col1; col1 1996-01-03 2000-02-17 2004-05-25 -select * from t4; +select * from t4 order by colint; colint col1 -1 1996-01-03 -2 2000-02-17 -select * from t5; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; colint col1 -1 1996-01-03 -2 2000-02-17 -3 2004-05-25 -select * from t6; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; colint col1 -1 2000-02-17 -2 2004-05-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2002-02-15' where col1='1996-01-03'; +update t2 set col1='2002-02-15' where col1='1996-01-03'; +update t3 set col1='2002-02-15' where col1='1996-01-03'; +update t4 set col1='2002-02-15' where col1='1996-01-03'; +update t5 set col1='2002-02-15' where col1='1996-01-03'; +update t6 set col1='2002-02-15' where col1='1996-01-03'; +select * from t1 order by col1; +col1 +2000-02-17 +2002-02-15 +select * from t2 order by col1; +col1 +2000-02-17 +2002-02-15 +2004-05-25 +select * from t3 order by col1; +col1 +2000-02-17 +2002-02-15 +2004-05-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 ------------------------------------------------------------------------- --- Alter tables with year(col1)-1990 ------------------------------------------------------------------------- @@ -4351,33 +12891,315 @@ alter table t66 partition by range(colint) (partition p0 values less than (year('2005-10-14')-1990), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -1996-01-03 2000-02-17 -select * from t22; +2002-02-15 +select * from t22 order by col1; col1 -1996-01-03 2000-02-17 +2002-02-15 2004-05-25 -select * from t33; +select * from t33 order by col1; col1 -1996-01-03 2000-02-17 +2002-02-15 2004-05-25 -select * from t44; +select * from t44 order by colint; colint col1 -1 1996-01-03 -2 2000-02-17 -select * from t55; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; colint col1 -1 1996-01-03 -2 2000-02-17 -3 2004-05-25 -select * from t66; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; colint col1 -1 2000-02-17 -2 2004-05-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2000-02-17 +2002-02-15 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2000-02-17 +2002-02-15 +alter table t55 +partition by list(colint) +subpartition by hash(year(col1)-1990) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (year(col1)-1990) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (year('2005-10-14')-1990), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (year('2005-10-14')-1990), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with year(col1)-1990 +------------------------------------------------------------------------- +delete from t1 where col1='2000-02-17'; +delete from t2 where col1='2000-02-17'; +delete from t3 where col1='2000-02-17'; +delete from t4 where col1='2000-02-17'; +delete from t5 where col1='2000-02-17'; +delete from t6 where col1='2000-02-17'; +select * from t1 order by col1; +col1 +2002-02-15 +select * from t2 order by col1; +col1 +2002-02-15 +2004-05-25 +select * from t3 order by col1; +col1 +2002-02-15 +2004-05-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2000-02-17'); +insert into t2 values ('2000-02-17'); +insert into t3 values ('2000-02-17'); +insert into t4 values (60,'2000-02-17'); +insert into t5 values (60,'2000-02-17'); +insert into t6 values (60,'2000-02-17'); +select * from t1 order by col1; +col1 +2000-02-17 +2002-02-15 +select * from t2 order by col1; +col1 +2000-02-17 +2002-02-15 +2004-05-25 +select * from t3 order by col1; +col1 +2000-02-17 +2002-02-15 +2004-05-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2000-02-17 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2000-02-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2000-02-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +select * from t2 order by col1; +col1 +2002-02-15 +2004-05-25 +select * from t3 order by col1; +col1 +2000-02-17 +2002-02-15 +2004-05-25 +select * from t4 order by colint; +colint col1 +60 2000-02-17 +select * from t5 order by colint; +colint col1 +60 2000-02-17 +select * from t6 order by colint; +colint col1 +60 2000-02-17 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with year(col1)-1990 +------------------------------------------------------------------------- +delete from t11 where col1='2000-02-17'; +delete from t22 where col1='2000-02-17'; +delete from t33 where col1='2000-02-17'; +delete from t44 where col1='2000-02-17'; +delete from t55 where col1='2000-02-17'; +delete from t66 where col1='2000-02-17'; +select * from t11 order by col1; +col1 +2002-02-15 +select * from t22 order by col1; +col1 +2002-02-15 +2004-05-25 +select * from t33 order by col1; +col1 +2002-02-15 +2004-05-25 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2000-02-17'); +insert into t22 values ('2000-02-17'); +insert into t33 values ('2000-02-17'); +insert into t44 values (60,'2000-02-17'); +insert into t55 values (60,'2000-02-17'); +insert into t66 values (60,'2000-02-17'); +select * from t11 order by col1; +col1 +2000-02-17 +2002-02-15 +select * from t22 order by col1; +col1 +2000-02-17 +2002-02-15 +2004-05-25 +select * from t33 order by col1; +col1 +2000-02-17 +2002-02-15 +2004-05-25 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2000-02-17 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2000-02-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2000-02-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +select * from t22 order by col1; +col1 +2002-02-15 +2004-05-25 +select * from t33 order by col1; +col1 +2000-02-17 +2002-02-15 +2004-05-25 +select * from t44 order by colint; +colint col1 +60 2000-02-17 +select * from t55 order by colint; +colint col1 +60 2000-02-17 +select * from t66 order by colint; +colint col1 +60 2000-02-17 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -4447,44 +13269,83 @@ insert into t2 values ('2006-03-25'); insert into t3 values ('2006-01-03'); insert into t3 values ('2006-08-17'); insert into t3 values ('2006-03-25'); -insert into t4 values (1,'2006-01-03'); -insert into t4 values (2,'2006-08-17'); -insert into t5 values (1,'2006-01-03'); -insert into t5 values (2,'2006-08-17'); -insert into t5 values (3,'2006-03-25'); -insert into t6 values (1,'2006-08-17'); -insert into t6 values (2,'2006-03-25'); -select yearweek(col1)-200600 from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select yearweek(col1)-200600 from t1 order by col1; yearweek(col1)-200600 1 33 -select * from t1; +select * from t1 order by col1; col1 2006-01-03 2006-08-17 -select * from t2; +select * from t2 order by col1; col1 2006-01-03 2006-03-25 2006-08-17 -select * from t3; +select * from t3 order by col1; col1 2006-01-03 -2006-08-17 2006-03-25 -select * from t4; +2006-08-17 +select * from t4 order by colint; colint col1 -1 2006-01-03 -2 2006-08-17 -select * from t5; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; colint col1 -3 2006-03-25 -1 2006-01-03 -2 2006-08-17 -select * from t6; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; colint col1 -1 2006-08-17 -2 2006-03-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-11-15' where col1='2006-01-03'; +update t2 set col1='2006-11-15' where col1='2006-01-03'; +update t3 set col1='2006-11-15' where col1='2006-01-03'; +update t4 set col1='2006-11-15' where col1='2006-01-03'; +update t5 set col1='2006-11-15' where col1='2006-01-03'; +update t6 set col1='2006-11-15' where col1='2006-01-03'; +select * from t1 order by col1; +col1 +2006-08-17 +2006-11-15 +select * from t2 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t3 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 ------------------------------------------------------------------------- --- Alter tables with yearweek(col1)-200600 ------------------------------------------------------------------------- @@ -4534,33 +13395,321 @@ alter table t66 partition by range(colint) (partition p0 values less than (yearweek('2006-10-14')-200600), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -2006-01-03 2006-08-17 -select * from t22; +2006-11-15 +select * from t22 order by col1; col1 -2006-01-03 2006-03-25 2006-08-17 -select * from t33; +2006-11-15 +select * from t33 order by col1; col1 -2006-01-03 -2006-08-17 2006-03-25 -select * from t44; +2006-08-17 +2006-11-15 +select * from t44 order by colint; colint col1 -1 2006-01-03 -2 2006-08-17 -select * from t55; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; colint col1 -3 2006-03-25 -1 2006-01-03 -2 2006-08-17 -select * from t66; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; colint col1 -1 2006-08-17 -2 2006-03-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-08-17 +2006-11-15 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-08-17 +2006-11-15 +alter table t55 +partition by list(colint) +subpartition by hash(yearweek(col1)-200600) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (yearweek(col1)-200600) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (yearweek('2006-10-14')-200600), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (yearweek('2006-10-14')-200600), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with yearweek(col1)-200600 +------------------------------------------------------------------------- +delete from t1 where col1='2006-08-17'; +delete from t2 where col1='2006-08-17'; +delete from t3 where col1='2006-08-17'; +delete from t4 where col1='2006-08-17'; +delete from t5 where col1='2006-08-17'; +delete from t6 where col1='2006-08-17'; +select * from t1 order by col1; +col1 +2006-11-15 +select * from t2 order by col1; +col1 +2006-03-25 +2006-11-15 +select * from t3 order by col1; +col1 +2006-03-25 +2006-11-15 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-08-17'); +insert into t2 values ('2006-08-17'); +insert into t3 values ('2006-08-17'); +insert into t4 values (60,'2006-08-17'); +insert into t5 values (60,'2006-08-17'); +insert into t6 values (60,'2006-08-17'); +select * from t1 order by col1; +col1 +2006-08-17 +2006-11-15 +select * from t2 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t3 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-08-17 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-08-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-08-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +2006-08-17 +2006-11-15 +select * from t2 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t3 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t4 order by colint; +colint col1 +60 2006-08-17 +select * from t5 order by colint; +colint col1 +60 2006-08-17 +select * from t6 order by colint; +colint col1 +60 2006-08-17 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with yearweek(col1)-200600 +------------------------------------------------------------------------- +delete from t11 where col1='2006-08-17'; +delete from t22 where col1='2006-08-17'; +delete from t33 where col1='2006-08-17'; +delete from t44 where col1='2006-08-17'; +delete from t55 where col1='2006-08-17'; +delete from t66 where col1='2006-08-17'; +select * from t11 order by col1; +col1 +2006-11-15 +select * from t22 order by col1; +col1 +2006-03-25 +2006-11-15 +select * from t33 order by col1; +col1 +2006-03-25 +2006-11-15 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-08-17'); +insert into t22 values ('2006-08-17'); +insert into t33 values ('2006-08-17'); +insert into t44 values (60,'2006-08-17'); +insert into t55 values (60,'2006-08-17'); +insert into t66 values (60,'2006-08-17'); +select * from t11 order by col1; +col1 +2006-08-17 +2006-11-15 +select * from t22 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t33 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-08-17 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-08-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-08-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +2006-08-17 +2006-11-15 +select * from t22 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t33 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t44 order by colint; +colint col1 +60 2006-08-17 +select * from t55 order by colint; +colint col1 +60 2006-08-17 +select * from t66 order by colint; +colint col1 +60 2006-08-17 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; diff --git a/mysql-test/suite/partitions/r/partition_supported_sql_func_myisam.result b/mysql-test/suite/partitions/r/partition_supported_sql_func_myisam.result index 73d69e5c90a..86742038990 100644 --- a/mysql-test/suite/partitions/r/partition_supported_sql_func_myisam.result +++ b/mysql-test/suite/partitions/r/partition_supported_sql_func_myisam.result @@ -55,44 +55,329 @@ insert into t2 values (17 ); insert into t3 values (5 ); insert into t3 values (13 ); insert into t3 values (17 ); -insert into t4 values (1,5 ); -insert into t4 values (2,13 ); -insert into t5 values (1,5 ); -insert into t5 values (2,13 ); -insert into t5 values (3,17 ); -insert into t6 values (1,13 ); -insert into t6 values (2,17 ); -select abs(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_int.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_int.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_int.in' into table t6; +select abs(col1) from t1 order by col1; abs(col1) 5 13 -select * from t1; +select * from t1 order by col1; col1 5 13 -select * from t2; +select * from t2 order by col1; col1 5 13 17 -select * from t3; +select * from t3 order by col1; col1 5 13 17 -select * from t4; +select * from t4 order by colint; colint col1 1 5 2 13 -select * from t5; +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 5 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +select * from t5 order by colint; colint col1 1 5 2 13 -3 17 -select * from t6; +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 5 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +select * from t6 order by colint; colint col1 -1 13 -2 17 +1 5 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 5 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +update t1 set col1=15 where col1=5 ; +update t2 set col1=15 where col1=5 ; +update t3 set col1=15 where col1=5 ; +update t4 set col1=15 where col1=5 ; +update t5 set col1=15 where col1=5 ; +update t6 set col1=15 where col1=5 ; +select * from t1 order by col1; +col1 +13 +15 +select * from t2 order by col1; +col1 +13 +15 +17 +select * from t3 order by col1; +col1 +13 +15 +17 +select * from t4 order by colint; +colint col1 +1 15 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +select * from t5 order by colint; +colint col1 +1 15 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +select * from t6 order by colint; +colint col1 +1 15 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 ------------------------------------------------------------------------- --- Alter tables with abs(col1) ------------------------------------------------------------------------- @@ -142,33 +427,1241 @@ alter table t66 partition by range(colint) (partition p0 values less than (abs(15)), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -5 13 -select * from t22; +15 +select * from t22 order by col1; col1 -5 13 +15 17 -select * from t33; +select * from t33 order by col1; col1 -5 13 +15 17 -select * from t44; +select * from t44 order by colint; colint col1 -1 5 +1 15 2 13 -select * from t55; +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +select * from t55 order by colint; colint col1 -1 5 +1 15 2 13 -3 17 -select * from t66; +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +select * from t66 order by colint; colint col1 -1 13 -2 17 +1 15 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +13 +15 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +13 +15 +alter table t55 +partition by list(colint) +subpartition by hash(abs(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (abs(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ +select * from t55 order by colint; +colint col1 +1 15 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (abs(15)), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (abs(15)), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with abs(col1) +------------------------------------------------------------------------- +delete from t1 where col1=13 ; +delete from t2 where col1=13 ; +delete from t3 where col1=13 ; +delete from t4 where col1=13 ; +delete from t5 where col1=13 ; +delete from t6 where col1=13 ; +select * from t1 order by col1; +col1 +15 +select * from t2 order by col1; +col1 +15 +17 +select * from t3 order by col1; +col1 +15 +17 +select * from t4 order by colint; +colint col1 +1 15 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +select * from t5 order by colint; +colint col1 +1 15 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +insert into t1 values (13 ); +insert into t2 values (13 ); +insert into t3 values (13 ); +insert into t4 values (60,13 ); +insert into t5 values (60,13 ); +insert into t6 values (60,13 ); +select * from t1 order by col1; +col1 +13 +15 +select * from t2 order by col1; +col1 +13 +15 +17 +select * from t3 order by col1; +col1 +13 +15 +17 +select * from t4 order by colint; +colint col1 +1 15 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +select * from t5 order by colint; +colint col1 +1 15 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +select * from t6 order by colint; +colint col1 +1 15 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +15 +select * from t2 order by col1; +col1 +13 +15 +17 +select * from t3 order by col1; +col1 +13 +15 +17 +select * from t4 order by colint; +colint col1 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +select * from t5 order by colint; +colint col1 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +select * from t6 order by colint; +colint col1 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with abs(col1) +------------------------------------------------------------------------- +delete from t11 where col1=13 ; +delete from t22 where col1=13 ; +delete from t33 where col1=13 ; +delete from t44 where col1=13 ; +delete from t55 where col1=13 ; +delete from t66 where col1=13 ; +select * from t11 order by col1; +col1 +15 +select * from t22 order by col1; +col1 +15 +17 +select * from t33 order by col1; +col1 +15 +17 +select * from t44 order by colint; +colint col1 +1 15 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +select * from t55 order by colint; +colint col1 +1 15 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +insert into t11 values (13 ); +insert into t22 values (13 ); +insert into t33 values (13 ); +insert into t44 values (60,13 ); +insert into t55 values (60,13 ); +insert into t66 values (60,13 ); +select * from t11 order by col1; +col1 +13 +15 +select * from t22 order by col1; +col1 +13 +15 +17 +select * from t33 order by col1; +col1 +13 +15 +17 +select * from t44 order by colint; +colint col1 +1 15 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +select * from t55 order by colint; +colint col1 +1 15 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +select * from t66 order by colint; +colint col1 +1 15 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +15 +select * from t22 order by col1; +col1 +13 +15 +17 +select * from t33 order by col1; +col1 +13 +15 +17 +select * from t44 order by colint; +colint col1 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +select * from t55 order by colint; +colint col1 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +select * from t66 order by colint; +colint col1 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -238,44 +1731,83 @@ insert into t2 values ('3'); insert into t3 values ('1'); insert into t3 values ('9'); insert into t3 values ('3'); -insert into t4 values (1,'1'); -insert into t4 values (2,'9'); -insert into t5 values (1,'1'); -insert into t5 values (2,'9'); -insert into t5 values (3,'3'); -insert into t6 values (1,'9'); -insert into t6 values (2,'3'); -select ascii(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t6; +select ascii(col1) from t1 order by col1; ascii(col1) 49 57 -select * from t1; +select * from t1 order by col1; col1 1 9 -select * from t2; +select * from t2 order by col1; col1 1 -9 3 -select * from t3; +9 +select * from t3 order by col1; col1 1 -9 3 -select * from t4; -colint col1 -1 1 -2 9 -select * from t5; +9 +select * from t4 order by colint; colint col1 1 1 2 9 3 3 -select * from t6; +4 8 +select * from t5 order by colint; colint col1 -1 9 -2 3 +1 1 +2 9 +3 3 +4 8 +select * from t6 order by colint; +colint col1 +1 1 +2 9 +3 3 +4 8 +update t1 set col1='8' where col1='1'; +update t2 set col1='8' where col1='1'; +update t3 set col1='8' where col1='1'; +update t4 set col1='8' where col1='1'; +update t5 set col1='8' where col1='1'; +update t6 set col1='8' where col1='1'; +select * from t1 order by col1; +col1 +8 +9 +select * from t2 order by col1; +col1 +3 +8 +9 +select * from t3 order by col1; +col1 +3 +8 +9 +select * from t4 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +select * from t5 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +select * from t6 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 ------------------------------------------------------------------------- --- Alter tables with ascii(col1) ------------------------------------------------------------------------- @@ -325,33 +1857,311 @@ alter table t66 partition by range(colint) (partition p0 values less than (ascii('5')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -1 +8 9 -select * from t22; +select * from t22 order by col1; col1 -1 -9 3 -select * from t33; -col1 -1 +8 9 +select * from t33 order by col1; +col1 3 -select * from t44; +8 +9 +select * from t44 order by colint; colint col1 -1 1 -2 9 -select * from t55; -colint col1 -1 1 +1 8 2 9 3 3 -select * from t66; +4 8 +select * from t55 order by colint; colint col1 -1 9 -2 3 +1 8 +2 9 +3 3 +4 8 +select * from t66 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +8 +9 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +8 +9 +alter table t55 +partition by list(colint) +subpartition by hash(ascii(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` char(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (ascii(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ +select * from t55 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (ascii('5')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (ascii('5')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with ascii(col1) +------------------------------------------------------------------------- +delete from t1 where col1='9'; +delete from t2 where col1='9'; +delete from t3 where col1='9'; +delete from t4 where col1='9'; +delete from t5 where col1='9'; +delete from t6 where col1='9'; +select * from t1 order by col1; +col1 +8 +select * from t2 order by col1; +col1 +3 +8 +select * from t3 order by col1; +col1 +3 +8 +select * from t4 order by colint; +colint col1 +1 8 +3 3 +4 8 +select * from t5 order by colint; +colint col1 +1 8 +3 3 +4 8 +insert into t1 values ('9'); +insert into t2 values ('9'); +insert into t3 values ('9'); +insert into t4 values (60,'9'); +insert into t5 values (60,'9'); +insert into t6 values (60,'9'); +select * from t1 order by col1; +col1 +8 +9 +select * from t2 order by col1; +col1 +3 +8 +9 +select * from t3 order by col1; +col1 +3 +8 +9 +select * from t4 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +select * from t5 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +select * from t6 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +8 +9 +select * from t2 order by col1; +col1 +3 +8 +9 +select * from t3 order by col1; +col1 +3 +8 +9 +select * from t4 order by colint; +colint col1 +60 9 +select * from t5 order by colint; +colint col1 +60 9 +select * from t6 order by colint; +colint col1 +60 9 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with ascii(col1) +------------------------------------------------------------------------- +delete from t11 where col1='9'; +delete from t22 where col1='9'; +delete from t33 where col1='9'; +delete from t44 where col1='9'; +delete from t55 where col1='9'; +delete from t66 where col1='9'; +select * from t11 order by col1; +col1 +8 +select * from t22 order by col1; +col1 +3 +8 +select * from t33 order by col1; +col1 +3 +8 +select * from t44 order by colint; +colint col1 +1 8 +3 3 +4 8 +select * from t55 order by colint; +colint col1 +1 8 +3 3 +4 8 +insert into t11 values ('9'); +insert into t22 values ('9'); +insert into t33 values ('9'); +insert into t44 values (60,'9'); +insert into t55 values (60,'9'); +insert into t66 values (60,'9'); +select * from t11 order by col1; +col1 +8 +9 +select * from t22 order by col1; +col1 +3 +8 +9 +select * from t33 order by col1; +col1 +3 +8 +9 +select * from t44 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +select * from t55 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +select * from t66 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +8 +9 +select * from t22 order by col1; +col1 +3 +8 +9 +select * from t33 order by col1; +col1 +3 +8 +9 +select * from t44 order by colint; +colint col1 +60 9 +select * from t55 order by colint; +colint col1 +60 9 +select * from t66 order by colint; +colint col1 +60 9 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -421,44 +2231,83 @@ insert into t2 values (17.987); insert into t3 values (5.1230); insert into t3 values (13.345); insert into t3 values (17.987); -insert into t4 values (1,5.1230); -insert into t4 values (2,13.345); -insert into t5 values (1,5.1230); -insert into t5 values (2,13.345); -insert into t5 values (3,17.987); -insert into t6 values (1,13.345); -insert into t6 values (2,17.987); -select cast(ceiling(col1) as signed integer) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t6; +select cast(ceiling(col1) as signed integer) from t1 order by col1; cast(ceiling(col1) as signed integer) 6 14 -select * from t1; +select * from t1 order by col1; col1 5.1230 13.3450 -select * from t2; +select * from t2 order by col1; col1 5.1230 13.3450 17.9870 -select * from t3; +select * from t3 order by col1; col1 5.1230 13.3450 17.9870 -select * from t4; -colint col1 -1 5.1230 -2 13.3450 -select * from t5; +select * from t4 order by colint; colint col1 1 5.1230 2 13.3450 3 17.9870 -select * from t6; +4 15.6540 +select * from t5 order by colint; colint col1 -1 13.3450 -2 17.9870 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t6 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +update t1 set col1=15.654 where col1=5.1230; +update t2 set col1=15.654 where col1=5.1230; +update t3 set col1=15.654 where col1=5.1230; +update t4 set col1=15.654 where col1=5.1230; +update t5 set col1=15.654 where col1=5.1230; +update t6 set col1=15.654 where col1=5.1230; +select * from t1 order by col1; +col1 +13.3450 +15.6540 +select * from t2 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t3 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t4 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t5 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t6 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 ------------------------------------------------------------------------- --- Alter tables with cast(ceiling(col1) as signed integer) ------------------------------------------------------------------------- @@ -508,33 +2357,309 @@ alter table t66 partition by range(colint) (partition p0 values less than (cast(ceiling(15) as signed integer)), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -5.1230 13.3450 -select * from t22; +15.6540 +select * from t22 order by col1; col1 -5.1230 13.3450 +15.6540 17.9870 -select * from t33; +select * from t33 order by col1; col1 -5.1230 13.3450 +15.6540 17.9870 -select * from t44; +select * from t44 order by colint; colint col1 -1 5.1230 -2 13.3450 -select * from t55; -colint col1 -1 5.1230 +1 15.6540 2 13.3450 3 17.9870 -select * from t66; +4 15.6540 +select * from t55 order by colint; colint col1 -1 13.3450 -2 17.9870 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t66 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +13.3450 +15.6540 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +13.3450 +15.6540 +alter table t55 +partition by list(colint) +subpartition by hash(cast(ceiling(col1) as signed integer)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` float(7,4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (cast(ceiling(col1) as signed integer)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ +select * from t55 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (cast(ceiling(15) as signed integer)), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (cast(ceiling(15) as signed integer)), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with cast(ceiling(col1) as signed integer) +------------------------------------------------------------------------- +delete from t1 where col1=13.345; +delete from t2 where col1=13.345; +delete from t3 where col1=13.345; +delete from t4 where col1=13.345; +delete from t5 where col1=13.345; +delete from t6 where col1=13.345; +select * from t1 order by col1; +col1 +15.6540 +select * from t2 order by col1; +col1 +15.6540 +17.9870 +select * from t3 order by col1; +col1 +15.6540 +17.9870 +select * from t4 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +select * from t5 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +insert into t1 values (13.345); +insert into t2 values (13.345); +insert into t3 values (13.345); +insert into t4 values (60,13.345); +insert into t5 values (60,13.345); +insert into t6 values (60,13.345); +select * from t1 order by col1; +col1 +13.3450 +15.6540 +select * from t2 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t3 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t4 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +select * from t5 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +select * from t6 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +15.6540 +select * from t2 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t3 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t4 order by colint; +colint col1 +60 13.3450 +select * from t5 order by colint; +colint col1 +60 13.3450 +select * from t6 order by colint; +colint col1 +60 13.3450 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with cast(ceiling(col1) as signed integer) +------------------------------------------------------------------------- +delete from t11 where col1=13.345; +delete from t22 where col1=13.345; +delete from t33 where col1=13.345; +delete from t44 where col1=13.345; +delete from t55 where col1=13.345; +delete from t66 where col1=13.345; +select * from t11 order by col1; +col1 +15.6540 +select * from t22 order by col1; +col1 +15.6540 +17.9870 +select * from t33 order by col1; +col1 +15.6540 +17.9870 +select * from t44 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +select * from t55 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +insert into t11 values (13.345); +insert into t22 values (13.345); +insert into t33 values (13.345); +insert into t44 values (60,13.345); +insert into t55 values (60,13.345); +insert into t66 values (60,13.345); +select * from t11 order by col1; +col1 +13.3450 +15.6540 +select * from t22 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t33 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t44 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +select * from t55 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +select * from t66 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +15.6540 +select * from t22 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t33 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t44 order by colint; +colint col1 +60 13.3450 +select * from t55 order by colint; +colint col1 +60 13.3450 +select * from t66 order by colint; +colint col1 +60 13.3450 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -604,44 +2729,83 @@ insert into t2 values (17.987); insert into t3 values (5.1230); insert into t3 values (13.345); insert into t3 values (17.987); -insert into t4 values (1,5.1230); -insert into t4 values (2,13.345); -insert into t5 values (1,5.1230); -insert into t5 values (2,13.345); -insert into t5 values (3,17.987); -insert into t6 values (1,13.345); -insert into t6 values (2,17.987); -select cast(floor(col1) as signed) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t6; +select cast(floor(col1) as signed) from t1 order by col1; cast(floor(col1) as signed) 5 13 -select * from t1; +select * from t1 order by col1; col1 5.1230 13.3450 -select * from t2; +select * from t2 order by col1; col1 5.1230 13.3450 17.9870 -select * from t3; +select * from t3 order by col1; col1 5.1230 13.3450 17.9870 -select * from t4; -colint col1 -1 5.1230 -2 13.3450 -select * from t5; +select * from t4 order by colint; colint col1 1 5.1230 2 13.3450 3 17.9870 -select * from t6; +4 15.6540 +select * from t5 order by colint; colint col1 -1 13.3450 -2 17.9870 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t6 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +update t1 set col1=15.654 where col1=5.1230; +update t2 set col1=15.654 where col1=5.1230; +update t3 set col1=15.654 where col1=5.1230; +update t4 set col1=15.654 where col1=5.1230; +update t5 set col1=15.654 where col1=5.1230; +update t6 set col1=15.654 where col1=5.1230; +select * from t1 order by col1; +col1 +13.3450 +15.6540 +select * from t2 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t3 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t4 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t5 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t6 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 ------------------------------------------------------------------------- --- Alter tables with cast(floor(col1) as signed) ------------------------------------------------------------------------- @@ -691,33 +2855,309 @@ alter table t66 partition by range(colint) (partition p0 values less than (cast(floor(15.123) as signed)), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -5.1230 13.3450 -select * from t22; +15.6540 +select * from t22 order by col1; col1 -5.1230 13.3450 +15.6540 17.9870 -select * from t33; +select * from t33 order by col1; col1 -5.1230 13.3450 +15.6540 17.9870 -select * from t44; +select * from t44 order by colint; colint col1 -1 5.1230 -2 13.3450 -select * from t55; -colint col1 -1 5.1230 +1 15.6540 2 13.3450 3 17.9870 -select * from t66; +4 15.6540 +select * from t55 order by colint; colint col1 -1 13.3450 -2 17.9870 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t66 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +13.3450 +15.6540 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +13.3450 +15.6540 +alter table t55 +partition by list(colint) +subpartition by hash(cast(floor(col1) as signed)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` float(7,4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (cast(floor(col1) as signed)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ +select * from t55 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (cast(floor(15.123) as signed)), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (cast(floor(15.123) as signed)), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with cast(floor(col1) as signed) +------------------------------------------------------------------------- +delete from t1 where col1=13.345; +delete from t2 where col1=13.345; +delete from t3 where col1=13.345; +delete from t4 where col1=13.345; +delete from t5 where col1=13.345; +delete from t6 where col1=13.345; +select * from t1 order by col1; +col1 +15.6540 +select * from t2 order by col1; +col1 +15.6540 +17.9870 +select * from t3 order by col1; +col1 +15.6540 +17.9870 +select * from t4 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +select * from t5 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +insert into t1 values (13.345); +insert into t2 values (13.345); +insert into t3 values (13.345); +insert into t4 values (60,13.345); +insert into t5 values (60,13.345); +insert into t6 values (60,13.345); +select * from t1 order by col1; +col1 +13.3450 +15.6540 +select * from t2 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t3 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t4 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +select * from t5 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +select * from t6 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +15.6540 +select * from t2 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t3 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t4 order by colint; +colint col1 +60 13.3450 +select * from t5 order by colint; +colint col1 +60 13.3450 +select * from t6 order by colint; +colint col1 +60 13.3450 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with cast(floor(col1) as signed) +------------------------------------------------------------------------- +delete from t11 where col1=13.345; +delete from t22 where col1=13.345; +delete from t33 where col1=13.345; +delete from t44 where col1=13.345; +delete from t55 where col1=13.345; +delete from t66 where col1=13.345; +select * from t11 order by col1; +col1 +15.6540 +select * from t22 order by col1; +col1 +15.6540 +17.9870 +select * from t33 order by col1; +col1 +15.6540 +17.9870 +select * from t44 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +select * from t55 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +insert into t11 values (13.345); +insert into t22 values (13.345); +insert into t33 values (13.345); +insert into t44 values (60,13.345); +insert into t55 values (60,13.345); +insert into t66 values (60,13.345); +select * from t11 order by col1; +col1 +13.3450 +15.6540 +select * from t22 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t33 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t44 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +select * from t55 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +select * from t66 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +15.6540 +select * from t22 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t33 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t44 order by colint; +colint col1 +60 13.3450 +select * from t55 order by colint; +colint col1 +60 13.3450 +select * from t66 order by colint; +colint col1 +60 13.3450 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -787,44 +3227,83 @@ insert into t2 values (17); insert into t3 values (5.0000); insert into t3 values (19); insert into t3 values (17); -insert into t4 values (1,5.0000); -insert into t4 values (2,19); -insert into t5 values (1,5.0000); -insert into t5 values (2,19); -insert into t5 values (3,17); -insert into t6 values (1,19); -insert into t6 values (2,17); -select cast(mod(col1,10) as signed) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t6; +select cast(mod(col1,10) as signed) from t1 order by col1; cast(mod(col1,10) as signed) 5 9 -select * from t1; +select * from t1 order by col1; col1 5.0000 19.0000 -select * from t2; +select * from t2 order by col1; col1 5.0000 -19.0000 17.0000 -select * from t3; +19.0000 +select * from t3 order by col1; col1 5.0000 -19.0000 17.0000 -select * from t4; +19.0000 +select * from t4 order by colint; colint col1 -1 5.0000 -2 19.0000 -select * from t5; +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t5 order by colint; colint col1 -1 5.0000 -2 19.0000 -3 17.0000 -select * from t6; +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t6 order by colint; colint col1 -1 19.0000 -2 17.0000 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +update t1 set col1=15 where col1=5.0000; +update t2 set col1=15 where col1=5.0000; +update t3 set col1=15 where col1=5.0000; +update t4 set col1=15 where col1=5.0000; +update t5 set col1=15 where col1=5.0000; +update t6 set col1=15 where col1=5.0000; +select * from t1 order by col1; +col1 +15.0000 +19.0000 +select * from t2 order by col1; +col1 +15.0000 +17.0000 +19.0000 +select * from t3 order by col1; +col1 +15.0000 +17.0000 +19.0000 +select * from t4 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t5 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t6 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 ------------------------------------------------------------------------- --- Alter tables with cast(mod(col1,10) as signed) ------------------------------------------------------------------------- @@ -874,33 +3353,311 @@ alter table t66 partition by range(colint) (partition p0 values less than (cast(mod(15,10) as signed)), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -5.0000 +15.0000 19.0000 -select * from t22; +select * from t22 order by col1; col1 -5.0000 -19.0000 +15.0000 17.0000 -select * from t33; -col1 -5.0000 19.0000 +select * from t33 order by col1; +col1 +15.0000 17.0000 -select * from t44; +19.0000 +select * from t44 order by colint; colint col1 -1 5.0000 -2 19.0000 -select * from t55; +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t55 order by colint; colint col1 -1 5.0000 -2 19.0000 -3 17.0000 -select * from t66; +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t66 order by colint; colint col1 -1 19.0000 -2 17.0000 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +15.0000 +19.0000 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +15.0000 +19.0000 +alter table t55 +partition by list(colint) +subpartition by hash(cast(mod(col1,10) as signed)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` float(7,4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (cast(mod(col1,10) as signed)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ +select * from t55 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (cast(mod(15,10) as signed)), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (cast(mod(15,10) as signed)), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with cast(mod(col1,10) as signed) +------------------------------------------------------------------------- +delete from t1 where col1=19; +delete from t2 where col1=19; +delete from t3 where col1=19; +delete from t4 where col1=19; +delete from t5 where col1=19; +delete from t6 where col1=19; +select * from t1 order by col1; +col1 +15.0000 +select * from t2 order by col1; +col1 +15.0000 +17.0000 +select * from t3 order by col1; +col1 +15.0000 +17.0000 +select * from t4 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t5 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +insert into t1 values (19); +insert into t2 values (19); +insert into t3 values (19); +insert into t4 values (60,19); +insert into t5 values (60,19); +insert into t6 values (60,19); +select * from t1 order by col1; +col1 +15.0000 +19.0000 +select * from t2 order by col1; +col1 +15.0000 +17.0000 +19.0000 +select * from t3 order by col1; +col1 +15.0000 +17.0000 +19.0000 +select * from t4 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +60 19.0000 +select * from t5 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +60 19.0000 +select * from t6 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +60 19.0000 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +select * from t2 order by col1; +col1 +select * from t3 order by col1; +col1 +15.0000 +17.0000 +19.0000 +select * from t4 order by colint; +colint col1 +60 19.0000 +select * from t5 order by colint; +colint col1 +60 19.0000 +select * from t6 order by colint; +colint col1 +60 19.0000 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with cast(mod(col1,10) as signed) +------------------------------------------------------------------------- +delete from t11 where col1=19; +delete from t22 where col1=19; +delete from t33 where col1=19; +delete from t44 where col1=19; +delete from t55 where col1=19; +delete from t66 where col1=19; +select * from t11 order by col1; +col1 +15.0000 +select * from t22 order by col1; +col1 +15.0000 +17.0000 +select * from t33 order by col1; +col1 +15.0000 +17.0000 +select * from t44 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t55 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +insert into t11 values (19); +insert into t22 values (19); +insert into t33 values (19); +insert into t44 values (60,19); +insert into t55 values (60,19); +insert into t66 values (60,19); +select * from t11 order by col1; +col1 +15.0000 +19.0000 +select * from t22 order by col1; +col1 +15.0000 +17.0000 +19.0000 +select * from t33 order by col1; +col1 +15.0000 +17.0000 +19.0000 +select * from t44 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +60 19.0000 +select * from t55 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +60 19.0000 +select * from t66 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +60 19.0000 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +select * from t22 order by col1; +col1 +select * from t33 order by col1; +col1 +15.0000 +17.0000 +19.0000 +select * from t44 order by colint; +colint col1 +60 19.0000 +select * from t55 order by colint; +colint col1 +60 19.0000 +select * from t66 order by colint; +colint col1 +60 19.0000 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -970,44 +3727,83 @@ insert into t2 values ('3'); insert into t3 values ('1'); insert into t3 values ('9'); insert into t3 values ('3'); -insert into t4 values (1,'1'); -insert into t4 values (2,'9'); -insert into t5 values (1,'1'); -insert into t5 values (2,'9'); -insert into t5 values (3,'3'); -insert into t6 values (1,'9'); -insert into t6 values (2,'3'); -select ord(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t6; +select ord(col1) from t1 order by col1; ord(col1) 49 57 -select * from t1; +select * from t1 order by col1; col1 1 9 -select * from t2; +select * from t2 order by col1; col1 1 -9 3 -select * from t3; +9 +select * from t3 order by col1; col1 1 -9 3 -select * from t4; -colint col1 -1 1 -2 9 -select * from t5; +9 +select * from t4 order by colint; colint col1 1 1 2 9 3 3 -select * from t6; +4 8 +select * from t5 order by colint; colint col1 -1 9 -2 3 +1 1 +2 9 +3 3 +4 8 +select * from t6 order by colint; +colint col1 +1 1 +2 9 +3 3 +4 8 +update t1 set col1='8' where col1='1'; +update t2 set col1='8' where col1='1'; +update t3 set col1='8' where col1='1'; +update t4 set col1='8' where col1='1'; +update t5 set col1='8' where col1='1'; +update t6 set col1='8' where col1='1'; +select * from t1 order by col1; +col1 +8 +9 +select * from t2 order by col1; +col1 +3 +8 +9 +select * from t3 order by col1; +col1 +3 +8 +9 +select * from t4 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +select * from t5 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +select * from t6 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 ------------------------------------------------------------------------- --- Alter tables with ord(col1) ------------------------------------------------------------------------- @@ -1057,33 +3853,309 @@ alter table t66 partition by range(colint) (partition p0 values less than (ord('a')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -1 +8 9 -select * from t22; +select * from t22 order by col1; col1 -1 -9 3 -select * from t33; -col1 -1 +8 9 +select * from t33 order by col1; +col1 3 -select * from t44; +8 +9 +select * from t44 order by colint; colint col1 -1 1 -2 9 -select * from t55; -colint col1 -1 1 +1 8 2 9 3 3 -select * from t66; +4 8 +select * from t55 order by colint; colint col1 -1 9 -2 3 +1 8 +2 9 +3 3 +4 8 +select * from t66 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +8 +9 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +8 +9 +alter table t55 +partition by list(colint) +subpartition by hash(ord(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` char(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (ord(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ +select * from t55 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (ord('a')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (ord('a')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with ord(col1) +------------------------------------------------------------------------- +delete from t1 where col1='9'; +delete from t2 where col1='9'; +delete from t3 where col1='9'; +delete from t4 where col1='9'; +delete from t5 where col1='9'; +delete from t6 where col1='9'; +select * from t1 order by col1; +col1 +8 +select * from t2 order by col1; +col1 +3 +8 +select * from t3 order by col1; +col1 +3 +8 +select * from t4 order by colint; +colint col1 +1 8 +3 3 +4 8 +select * from t5 order by colint; +colint col1 +1 8 +3 3 +4 8 +insert into t1 values ('9'); +insert into t2 values ('9'); +insert into t3 values ('9'); +insert into t4 values (60,'9'); +insert into t5 values (60,'9'); +insert into t6 values (60,'9'); +select * from t1 order by col1; +col1 +8 +9 +select * from t2 order by col1; +col1 +3 +8 +9 +select * from t3 order by col1; +col1 +3 +8 +9 +select * from t4 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +select * from t5 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +select * from t6 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +8 +9 +select * from t2 order by col1; +col1 +3 +8 +9 +select * from t3 order by col1; +col1 +3 +8 +9 +select * from t4 order by colint; +colint col1 +60 9 +select * from t5 order by colint; +colint col1 +60 9 +select * from t6 order by colint; +colint col1 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with ord(col1) +------------------------------------------------------------------------- +delete from t11 where col1='9'; +delete from t22 where col1='9'; +delete from t33 where col1='9'; +delete from t44 where col1='9'; +delete from t55 where col1='9'; +delete from t66 where col1='9'; +select * from t11 order by col1; +col1 +8 +select * from t22 order by col1; +col1 +3 +8 +select * from t33 order by col1; +col1 +3 +8 +select * from t44 order by colint; +colint col1 +1 8 +3 3 +4 8 +select * from t55 order by colint; +colint col1 +1 8 +3 3 +4 8 +insert into t11 values ('9'); +insert into t22 values ('9'); +insert into t33 values ('9'); +insert into t44 values (60,'9'); +insert into t55 values (60,'9'); +insert into t66 values (60,'9'); +select * from t11 order by col1; +col1 +8 +9 +select * from t22 order by col1; +col1 +3 +8 +9 +select * from t33 order by col1; +col1 +3 +8 +9 +select * from t44 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +select * from t55 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +select * from t66 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +8 +9 +select * from t22 order by col1; +col1 +3 +8 +9 +select * from t33 order by col1; +col1 +3 +8 +9 +select * from t44 order by colint; +colint col1 +60 9 +select * from t55 order by colint; +colint col1 +60 9 +select * from t66 order by colint; +colint col1 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -1153,44 +4225,83 @@ insert into t2 values ('2006-01-25'); insert into t3 values ('2006-02-03'); insert into t3 values ('2006-01-17'); insert into t3 values ('2006-01-25'); -insert into t4 values (1,'2006-02-03'); -insert into t4 values (2,'2006-01-17'); -insert into t5 values (1,'2006-02-03'); -insert into t5 values (2,'2006-01-17'); -insert into t5 values (3,'2006-01-25'); -insert into t6 values (1,'2006-01-17'); -insert into t6 values (2,'2006-01-25'); -select day(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select day(col1) from t1 order by col1; day(col1) -3 17 -select * from t1; +3 +select * from t1 order by col1; col1 -2006-02-03 2006-01-17 -select * from t2; -col1 2006-02-03 +select * from t2 order by col1; +col1 2006-01-17 2006-01-25 -select * from t3; -col1 2006-02-03 +select * from t3 order by col1; +col1 2006-01-17 2006-01-25 -select * from t4; -colint col1 -1 2006-02-03 -2 2006-01-17 -select * from t5; +2006-02-03 +select * from t4 order by colint; colint col1 1 2006-02-03 2 2006-01-17 3 2006-01-25 -select * from t6; +4 2006-02-05 +select * from t5 order by colint; colint col1 -1 2006-01-17 -2 2006-01-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-02-05' where col1='2006-02-03'; +update t2 set col1='2006-02-05' where col1='2006-02-03'; +update t3 set col1='2006-02-05' where col1='2006-02-03'; +update t4 set col1='2006-02-05' where col1='2006-02-03'; +update t5 set col1='2006-02-05' where col1='2006-02-03'; +update t6 set col1='2006-02-05' where col1='2006-02-03'; +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t3 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t4 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 ------------------------------------------------------------------------- --- Alter tables with day(col1) ------------------------------------------------------------------------- @@ -1240,33 +4351,307 @@ alter table t66 partition by range(colint) (partition p0 values less than (day('2006-12-21')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -2006-02-03 2006-01-17 -select * from t22; +2006-02-05 +select * from t22 order by col1; col1 -2006-02-03 2006-01-17 2006-01-25 -select * from t33; +2006-02-05 +select * from t33 order by col1; col1 -2006-02-03 2006-01-17 2006-01-25 -select * from t44; +2006-02-05 +select * from t44 order by colint; colint col1 -1 2006-02-03 -2 2006-01-17 -select * from t55; -colint col1 -1 2006-02-03 +1 2006-02-05 2 2006-01-17 3 2006-01-25 -select * from t66; +4 2006-02-05 +select * from t55 order by colint; colint col1 -1 2006-01-17 -2 2006-01-25 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +alter table t55 +partition by list(colint) +subpartition by hash(day(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (day(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ +select * from t55 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (day('2006-12-21')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (day('2006-12-21')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with day(col1) +------------------------------------------------------------------------- +delete from t1 where col1='2006-01-17'; +delete from t2 where col1='2006-01-17'; +delete from t3 where col1='2006-01-17'; +delete from t4 where col1='2006-01-17'; +delete from t5 where col1='2006-01-17'; +delete from t6 where col1='2006-01-17'; +select * from t1 order by col1; +col1 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t4 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-01-17'); +insert into t2 values ('2006-01-17'); +insert into t3 values ('2006-01-17'); +insert into t4 values (60,'2006-01-17'); +insert into t5 values (60,'2006-01-17'); +insert into t6 values (60,'2006-01-17'); +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t3 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t4 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t5 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t6 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +2006-01-17 +select * from t2 order by col1; +col1 +2006-01-17 +2006-01-25 +select * from t3 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t4 order by colint; +colint col1 +60 2006-01-17 +select * from t5 order by colint; +colint col1 +60 2006-01-17 +select * from t6 order by colint; +colint col1 +60 2006-01-17 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with day(col1) +------------------------------------------------------------------------- +delete from t11 where col1='2006-01-17'; +delete from t22 where col1='2006-01-17'; +delete from t33 where col1='2006-01-17'; +delete from t44 where col1='2006-01-17'; +delete from t55 where col1='2006-01-17'; +delete from t66 where col1='2006-01-17'; +select * from t11 order by col1; +col1 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t33 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t44 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-01-17'); +insert into t22 values ('2006-01-17'); +insert into t33 values ('2006-01-17'); +insert into t44 values (60,'2006-01-17'); +insert into t55 values (60,'2006-01-17'); +insert into t66 values (60,'2006-01-17'); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t33 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t44 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t55 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t66 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +2006-01-17 +select * from t22 order by col1; +col1 +2006-01-17 +2006-01-25 +select * from t33 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t44 order by colint; +colint col1 +60 2006-01-17 +select * from t55 order by colint; +colint col1 +60 2006-01-17 +select * from t66 order by colint; +colint col1 +60 2006-01-17 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -1336,44 +4721,83 @@ insert into t2 values ('2006-01-25'); insert into t3 values ('2006-02-03'); insert into t3 values ('2006-01-17'); insert into t3 values ('2006-01-25'); -insert into t4 values (1,'2006-02-03'); -insert into t4 values (2,'2006-01-17'); -insert into t5 values (1,'2006-02-03'); -insert into t5 values (2,'2006-01-17'); -insert into t5 values (3,'2006-01-25'); -insert into t6 values (1,'2006-01-17'); -insert into t6 values (2,'2006-01-25'); -select dayofmonth(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select dayofmonth(col1) from t1 order by col1; dayofmonth(col1) -3 17 -select * from t1; +3 +select * from t1 order by col1; col1 -2006-02-03 2006-01-17 -select * from t2; -col1 2006-02-03 +select * from t2 order by col1; +col1 2006-01-17 2006-01-25 -select * from t3; -col1 2006-02-03 +select * from t3 order by col1; +col1 2006-01-17 2006-01-25 -select * from t4; -colint col1 -1 2006-02-03 -2 2006-01-17 -select * from t5; +2006-02-03 +select * from t4 order by colint; colint col1 1 2006-02-03 2 2006-01-17 3 2006-01-25 -select * from t6; +4 2006-02-05 +select * from t5 order by colint; colint col1 -1 2006-01-17 -2 2006-01-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-02-05' where col1='2006-02-03'; +update t2 set col1='2006-02-05' where col1='2006-02-03'; +update t3 set col1='2006-02-05' where col1='2006-02-03'; +update t4 set col1='2006-02-05' where col1='2006-02-03'; +update t5 set col1='2006-02-05' where col1='2006-02-03'; +update t6 set col1='2006-02-05' where col1='2006-02-03'; +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t3 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t4 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 ------------------------------------------------------------------------- --- Alter tables with dayofmonth(col1) ------------------------------------------------------------------------- @@ -1423,33 +4847,307 @@ alter table t66 partition by range(colint) (partition p0 values less than (dayofmonth('2006-12-24')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -2006-02-03 2006-01-17 -select * from t22; +2006-02-05 +select * from t22 order by col1; col1 -2006-02-03 2006-01-17 2006-01-25 -select * from t33; +2006-02-05 +select * from t33 order by col1; col1 -2006-02-03 2006-01-17 2006-01-25 -select * from t44; +2006-02-05 +select * from t44 order by colint; colint col1 -1 2006-02-03 -2 2006-01-17 -select * from t55; -colint col1 -1 2006-02-03 +1 2006-02-05 2 2006-01-17 3 2006-01-25 -select * from t66; +4 2006-02-05 +select * from t55 order by colint; colint col1 -1 2006-01-17 -2 2006-01-25 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +alter table t55 +partition by list(colint) +subpartition by hash(dayofmonth(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofmonth(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ +select * from t55 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (dayofmonth('2006-12-24')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (dayofmonth('2006-12-24')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with dayofmonth(col1) +------------------------------------------------------------------------- +delete from t1 where col1='2006-01-17'; +delete from t2 where col1='2006-01-17'; +delete from t3 where col1='2006-01-17'; +delete from t4 where col1='2006-01-17'; +delete from t5 where col1='2006-01-17'; +delete from t6 where col1='2006-01-17'; +select * from t1 order by col1; +col1 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t4 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-01-17'); +insert into t2 values ('2006-01-17'); +insert into t3 values ('2006-01-17'); +insert into t4 values (60,'2006-01-17'); +insert into t5 values (60,'2006-01-17'); +insert into t6 values (60,'2006-01-17'); +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t3 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t4 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t5 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t6 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +2006-01-17 +select * from t2 order by col1; +col1 +2006-01-17 +2006-01-25 +select * from t3 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t4 order by colint; +colint col1 +60 2006-01-17 +select * from t5 order by colint; +colint col1 +60 2006-01-17 +select * from t6 order by colint; +colint col1 +60 2006-01-17 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with dayofmonth(col1) +------------------------------------------------------------------------- +delete from t11 where col1='2006-01-17'; +delete from t22 where col1='2006-01-17'; +delete from t33 where col1='2006-01-17'; +delete from t44 where col1='2006-01-17'; +delete from t55 where col1='2006-01-17'; +delete from t66 where col1='2006-01-17'; +select * from t11 order by col1; +col1 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t33 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t44 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-01-17'); +insert into t22 values ('2006-01-17'); +insert into t33 values ('2006-01-17'); +insert into t44 values (60,'2006-01-17'); +insert into t55 values (60,'2006-01-17'); +insert into t66 values (60,'2006-01-17'); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t33 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t44 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t55 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t66 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +2006-01-17 +select * from t22 order by col1; +col1 +2006-01-17 +2006-01-25 +select * from t33 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t44 order by colint; +colint col1 +60 2006-01-17 +select * from t55 order by colint; +colint col1 +60 2006-01-17 +select * from t66 order by colint; +colint col1 +60 2006-01-17 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -1519,44 +5217,83 @@ insert into t2 values ('2006-01-25'); insert into t3 values ('2006-01-03'); insert into t3 values ('2006-02-17'); insert into t3 values ('2006-01-25'); -insert into t4 values (1,'2006-01-03'); -insert into t4 values (2,'2006-02-17'); -insert into t5 values (1,'2006-01-03'); -insert into t5 values (2,'2006-02-17'); -insert into t5 values (3,'2006-01-25'); -insert into t6 values (1,'2006-02-17'); -insert into t6 values (2,'2006-01-25'); -select dayofweek(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select dayofweek(col1) from t1 order by col1; dayofweek(col1) 3 6 -select * from t1; +select * from t1 order by col1; col1 2006-01-03 2006-02-17 -select * from t2; +select * from t2 order by col1; col1 2006-01-03 -2006-02-17 2006-01-25 -select * from t3; +2006-02-17 +select * from t3 order by col1; col1 2006-01-03 -2006-02-17 2006-01-25 -select * from t4; +2006-02-17 +select * from t4 order by colint; colint col1 -2 2006-02-17 -1 2006-01-03 -select * from t5; -colint col1 -2 2006-02-17 +1 2006-02-03 +2 2006-01-17 3 2006-01-25 -1 2006-01-03 -select * from t6; +4 2006-02-05 +select * from t5 order by colint; colint col1 -1 2006-02-17 -2 2006-01-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-02-05' where col1='2006-01-03'; +update t2 set col1='2006-02-05' where col1='2006-01-03'; +update t3 set col1='2006-02-05' where col1='2006-01-03'; +update t4 set col1='2006-02-05' where col1='2006-01-03'; +update t5 set col1='2006-02-05' where col1='2006-01-03'; +update t6 set col1='2006-02-05' where col1='2006-01-03'; +select * from t1 order by col1; +col1 +2006-02-05 +2006-02-17 +select * from t2 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 ------------------------------------------------------------------------- --- Alter tables with dayofweek(col1) ------------------------------------------------------------------------- @@ -1606,33 +5343,319 @@ alter table t66 partition by range(colint) (partition p0 values less than (dayofweek('2006-12-24')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -2006-01-03 +2006-02-05 2006-02-17 -select * from t22; +select * from t22 order by col1; col1 -2006-01-03 -2006-02-17 2006-01-25 -select * from t33; -col1 -2006-01-03 +2006-02-05 2006-02-17 +select * from t33 order by col1; +col1 2006-01-25 -select * from t44; +2006-02-05 +2006-02-17 +select * from t44 order by colint; colint col1 -2 2006-02-17 -1 2006-01-03 -select * from t55; -colint col1 -2 2006-02-17 +1 2006-02-03 +2 2006-01-17 3 2006-01-25 -1 2006-01-03 -select * from t66; +4 2006-02-05 +select * from t55 order by colint; colint col1 -1 2006-02-17 -2 2006-01-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-02-05 +2006-02-17 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-02-05 +2006-02-17 +alter table t55 +partition by list(colint) +subpartition by hash(dayofweek(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofweek(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (dayofweek('2006-12-24')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (dayofweek('2006-12-24')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with dayofweek(col1) +------------------------------------------------------------------------- +delete from t1 where col1='2006-02-17'; +delete from t2 where col1='2006-02-17'; +delete from t3 where col1='2006-02-17'; +delete from t4 where col1='2006-02-17'; +delete from t5 where col1='2006-02-17'; +delete from t6 where col1='2006-02-17'; +select * from t1 order by col1; +col1 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-02-17'); +insert into t2 values ('2006-02-17'); +insert into t3 values ('2006-02-17'); +insert into t4 values (60,'2006-02-17'); +insert into t5 values (60,'2006-02-17'); +insert into t6 values (60,'2006-02-17'); +select * from t1 order by col1; +col1 +2006-02-05 +2006-02-17 +select * from t2 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +select * from t2 order by col1; +col1 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t4 order by colint; +colint col1 +60 2006-02-17 +select * from t5 order by colint; +colint col1 +60 2006-02-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with dayofweek(col1) +------------------------------------------------------------------------- +delete from t11 where col1='2006-02-17'; +delete from t22 where col1='2006-02-17'; +delete from t33 where col1='2006-02-17'; +delete from t44 where col1='2006-02-17'; +delete from t55 where col1='2006-02-17'; +delete from t66 where col1='2006-02-17'; +select * from t11 order by col1; +col1 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t33 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-02-17'); +insert into t22 values ('2006-02-17'); +insert into t33 values ('2006-02-17'); +insert into t44 values (60,'2006-02-17'); +insert into t55 values (60,'2006-02-17'); +insert into t66 values (60,'2006-02-17'); +select * from t11 order by col1; +col1 +2006-02-05 +2006-02-17 +select * from t22 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t33 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +select * from t22 order by col1; +col1 +select * from t33 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t44 order by colint; +colint col1 +60 2006-02-17 +select * from t55 order by colint; +colint col1 +60 2006-02-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -1702,44 +5725,83 @@ insert into t2 values ('2006-02-25'); insert into t3 values ('2006-01-03'); insert into t3 values ('2006-01-17'); insert into t3 values ('2006-02-25'); -insert into t4 values (1,'2006-01-03'); -insert into t4 values (2,'2006-01-17'); -insert into t5 values (1,'2006-01-03'); -insert into t5 values (2,'2006-01-17'); -insert into t5 values (3,'2006-02-25'); -insert into t6 values (1,'2006-01-17'); -insert into t6 values (2,'2006-02-25'); -select dayofyear(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select dayofyear(col1) from t1 order by col1; dayofyear(col1) 3 17 -select * from t1; +select * from t1 order by col1; col1 2006-01-03 2006-01-17 -select * from t2; +select * from t2 order by col1; col1 2006-01-03 2006-01-17 2006-02-25 -select * from t3; +select * from t3 order by col1; col1 2006-01-03 2006-01-17 2006-02-25 -select * from t4; +select * from t4 order by colint; colint col1 -1 2006-01-03 +1 2006-02-03 2 2006-01-17 -select * from t5; +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; colint col1 -3 2006-02-25 -1 2006-01-03 +1 2006-02-03 2 2006-01-17 -select * from t6; +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; colint col1 -1 2006-01-17 -2 2006-02-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-02-05' where col1='2006-01-03'; +update t2 set col1='2006-02-05' where col1='2006-01-03'; +update t3 set col1='2006-02-05' where col1='2006-01-03'; +update t4 set col1='2006-02-05' where col1='2006-01-03'; +update t5 set col1='2006-02-05' where col1='2006-01-03'; +update t6 set col1='2006-02-05' where col1='2006-01-03'; +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t3 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 ------------------------------------------------------------------------- --- Alter tables with dayofyear(col1) ------------------------------------------------------------------------- @@ -1789,33 +5851,309 @@ alter table t66 partition by range(colint) (partition p0 values less than (dayofyear('2006-12-25')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -2006-01-03 2006-01-17 -select * from t22; +2006-02-05 +select * from t22 order by col1; col1 -2006-01-03 2006-01-17 +2006-02-05 2006-02-25 -select * from t33; +select * from t33 order by col1; col1 -2006-01-03 2006-01-17 +2006-02-05 2006-02-25 -select * from t44; +select * from t44 order by colint; colint col1 -1 2006-01-03 +1 2006-02-03 2 2006-01-17 -select * from t55; +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; colint col1 -3 2006-02-25 -1 2006-01-03 +1 2006-02-03 2 2006-01-17 -select * from t66; +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; colint col1 -1 2006-01-17 -2 2006-02-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +alter table t55 +partition by list(colint) +subpartition by hash(dayofyear(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (dayofyear('2006-12-25')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (dayofyear('2006-12-25')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with dayofyear(col1) +------------------------------------------------------------------------- +delete from t1 where col1='2006-01-17'; +delete from t2 where col1='2006-01-17'; +delete from t3 where col1='2006-01-17'; +delete from t4 where col1='2006-01-17'; +delete from t5 where col1='2006-01-17'; +delete from t6 where col1='2006-01-17'; +select * from t1 order by col1; +col1 +2006-02-05 +select * from t2 order by col1; +col1 +2006-02-05 +2006-02-25 +select * from t3 order by col1; +col1 +2006-02-05 +2006-02-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-01-17'); +insert into t2 values ('2006-01-17'); +insert into t3 values ('2006-01-17'); +insert into t4 values (60,'2006-01-17'); +insert into t5 values (60,'2006-01-17'); +insert into t6 values (60,'2006-01-17'); +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t3 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t3 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t4 order by colint; +colint col1 +60 2006-01-17 +select * from t5 order by colint; +colint col1 +60 2006-01-17 +select * from t6 order by colint; +colint col1 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with dayofyear(col1) +------------------------------------------------------------------------- +delete from t11 where col1='2006-01-17'; +delete from t22 where col1='2006-01-17'; +delete from t33 where col1='2006-01-17'; +delete from t44 where col1='2006-01-17'; +delete from t55 where col1='2006-01-17'; +delete from t66 where col1='2006-01-17'; +select * from t11 order by col1; +col1 +2006-02-05 +select * from t22 order by col1; +col1 +2006-02-05 +2006-02-25 +select * from t33 order by col1; +col1 +2006-02-05 +2006-02-25 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-01-17'); +insert into t22 values ('2006-01-17'); +insert into t33 values ('2006-01-17'); +insert into t44 values (60,'2006-01-17'); +insert into t55 values (60,'2006-01-17'); +insert into t66 values (60,'2006-01-17'); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t33 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t33 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t44 order by colint; +colint col1 +60 2006-01-17 +select * from t55 order by colint; +colint col1 +60 2006-01-17 +select * from t66 order by colint; +colint col1 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -1885,44 +6223,83 @@ insert into t2 values ('2006-02-25'); insert into t3 values ('2006-01-03'); insert into t3 values ('2006-01-17'); insert into t3 values ('2006-02-25'); -insert into t4 values (1,'2006-01-03'); -insert into t4 values (2,'2006-01-17'); -insert into t5 values (1,'2006-01-03'); -insert into t5 values (2,'2006-01-17'); -insert into t5 values (3,'2006-02-25'); -insert into t6 values (1,'2006-01-17'); -insert into t6 values (2,'2006-02-25'); -select dayofyear(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select dayofyear(col1) from t1 order by col1; dayofyear(col1) 3 17 -select * from t1; +select * from t1 order by col1; col1 2006-01-03 2006-01-17 -select * from t2; +select * from t2 order by col1; col1 2006-01-03 2006-01-17 2006-02-25 -select * from t3; +select * from t3 order by col1; col1 2006-01-03 2006-01-17 2006-02-25 -select * from t4; +select * from t4 order by colint; colint col1 -1 2006-01-03 +1 2006-02-03 2 2006-01-17 -select * from t5; +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; colint col1 -3 2006-02-25 -1 2006-01-03 +1 2006-02-03 2 2006-01-17 -select * from t6; +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; colint col1 -1 2006-01-17 -2 2006-02-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-02-05' where col1='2006-01-03'; +update t2 set col1='2006-02-05' where col1='2006-01-03'; +update t3 set col1='2006-02-05' where col1='2006-01-03'; +update t4 set col1='2006-02-05' where col1='2006-01-03'; +update t5 set col1='2006-02-05' where col1='2006-01-03'; +update t6 set col1='2006-02-05' where col1='2006-01-03'; +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t3 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 ------------------------------------------------------------------------- --- Alter tables with dayofyear(col1) ------------------------------------------------------------------------- @@ -1972,33 +6349,309 @@ alter table t66 partition by range(colint) (partition p0 values less than (dayofyear('2006-12-25')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -2006-01-03 2006-01-17 -select * from t22; +2006-02-05 +select * from t22 order by col1; col1 -2006-01-03 2006-01-17 +2006-02-05 2006-02-25 -select * from t33; +select * from t33 order by col1; col1 -2006-01-03 2006-01-17 +2006-02-05 2006-02-25 -select * from t44; +select * from t44 order by colint; colint col1 -1 2006-01-03 +1 2006-02-03 2 2006-01-17 -select * from t55; +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; colint col1 -3 2006-02-25 -1 2006-01-03 +1 2006-02-03 2 2006-01-17 -select * from t66; +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; colint col1 -1 2006-01-17 -2 2006-02-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +alter table t55 +partition by list(colint) +subpartition by hash(dayofyear(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` char(30) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (dayofyear('2006-12-25')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (dayofyear('2006-12-25')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with dayofyear(col1) +------------------------------------------------------------------------- +delete from t1 where col1='2006-01-17'; +delete from t2 where col1='2006-01-17'; +delete from t3 where col1='2006-01-17'; +delete from t4 where col1='2006-01-17'; +delete from t5 where col1='2006-01-17'; +delete from t6 where col1='2006-01-17'; +select * from t1 order by col1; +col1 +2006-02-05 +select * from t2 order by col1; +col1 +2006-02-05 +2006-02-25 +select * from t3 order by col1; +col1 +2006-02-05 +2006-02-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-01-17'); +insert into t2 values ('2006-01-17'); +insert into t3 values ('2006-01-17'); +insert into t4 values (60,'2006-01-17'); +insert into t5 values (60,'2006-01-17'); +insert into t6 values (60,'2006-01-17'); +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t3 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t3 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t4 order by colint; +colint col1 +60 2006-01-17 +select * from t5 order by colint; +colint col1 +60 2006-01-17 +select * from t6 order by colint; +colint col1 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with dayofyear(col1) +------------------------------------------------------------------------- +delete from t11 where col1='2006-01-17'; +delete from t22 where col1='2006-01-17'; +delete from t33 where col1='2006-01-17'; +delete from t44 where col1='2006-01-17'; +delete from t55 where col1='2006-01-17'; +delete from t66 where col1='2006-01-17'; +select * from t11 order by col1; +col1 +2006-02-05 +select * from t22 order by col1; +col1 +2006-02-05 +2006-02-25 +select * from t33 order by col1; +col1 +2006-02-05 +2006-02-25 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-01-17'); +insert into t22 values ('2006-01-17'); +insert into t33 values ('2006-01-17'); +insert into t44 values (60,'2006-01-17'); +insert into t55 values (60,'2006-01-17'); +insert into t66 values (60,'2006-01-17'); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t33 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t33 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t44 order by colint; +colint col1 +60 2006-01-17 +select * from t55 order by colint; +colint col1 +60 2006-01-17 +select * from t66 order by colint; +colint col1 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -2068,44 +6721,83 @@ insert into t2 values ('2006-01-25'); insert into t3 values ('2006-01-03'); insert into t3 values ('2006-02-17'); insert into t3 values ('2006-01-25'); -insert into t4 values (1,'2006-01-03'); -insert into t4 values (2,'2006-02-17'); -insert into t5 values (1,'2006-01-03'); -insert into t5 values (2,'2006-02-17'); -insert into t5 values (3,'2006-01-25'); -insert into t6 values (1,'2006-02-17'); -insert into t6 values (2,'2006-01-25'); -select extract(month from col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select extract(month from col1) from t1 order by col1; extract(month from col1) 1 2 -select * from t1; +select * from t1 order by col1; col1 2006-01-03 2006-02-17 -select * from t2; +select * from t2 order by col1; col1 2006-01-03 -2006-02-17 2006-01-25 -select * from t3; +2006-02-17 +select * from t3 order by col1; col1 2006-01-03 -2006-02-17 2006-01-25 -select * from t4; +2006-02-17 +select * from t4 order by colint; colint col1 -2 2006-02-17 -1 2006-01-03 -select * from t5; -colint col1 -2 2006-02-17 -1 2006-01-03 +1 2006-02-03 +2 2006-01-17 3 2006-01-25 -select * from t6; +4 2006-02-05 +select * from t5 order by colint; colint col1 -1 2006-02-17 -2 2006-01-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-02-05' where col1='2006-01-03'; +update t2 set col1='2006-02-05' where col1='2006-01-03'; +update t3 set col1='2006-02-05' where col1='2006-01-03'; +update t4 set col1='2006-02-05' where col1='2006-01-03'; +update t5 set col1='2006-02-05' where col1='2006-01-03'; +update t6 set col1='2006-02-05' where col1='2006-01-03'; +select * from t1 order by col1; +col1 +2006-02-05 +2006-02-17 +select * from t2 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 ------------------------------------------------------------------------- --- Alter tables with extract(month from col1) ------------------------------------------------------------------------- @@ -2155,33 +6847,309 @@ alter table t66 partition by range(colint) (partition p0 values less than (extract(year from '1998-11-23')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -2006-01-03 +2006-02-05 2006-02-17 -select * from t22; +select * from t22 order by col1; col1 -2006-01-03 -2006-02-17 2006-01-25 -select * from t33; -col1 -2006-01-03 +2006-02-05 2006-02-17 +select * from t33 order by col1; +col1 2006-01-25 -select * from t44; +2006-02-05 +2006-02-17 +select * from t44 order by colint; colint col1 -2 2006-02-17 -1 2006-01-03 -select * from t55; -colint col1 -2 2006-02-17 -1 2006-01-03 +1 2006-02-03 +2 2006-01-17 3 2006-01-25 -select * from t66; +4 2006-02-05 +select * from t55 order by colint; colint col1 -1 2006-02-17 -2 2006-01-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-02-05 +2006-02-17 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-02-05 +2006-02-17 +alter table t55 +partition by list(colint) +subpartition by hash(extract(month from col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (extract(month from col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (extract(year from '1998-11-23')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (extract(year from '1998-11-23')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with extract(month from col1) +------------------------------------------------------------------------- +delete from t1 where col1='2006-02-17'; +delete from t2 where col1='2006-02-17'; +delete from t3 where col1='2006-02-17'; +delete from t4 where col1='2006-02-17'; +delete from t5 where col1='2006-02-17'; +delete from t6 where col1='2006-02-17'; +select * from t1 order by col1; +col1 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-02-17'); +insert into t2 values ('2006-02-17'); +insert into t3 values ('2006-02-17'); +insert into t4 values (60,'2006-02-17'); +insert into t5 values (60,'2006-02-17'); +insert into t6 values (60,'2006-02-17'); +select * from t1 order by col1; +col1 +2006-02-05 +2006-02-17 +select * from t2 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +select * from t2 order by col1; +col1 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t4 order by colint; +colint col1 +60 2006-02-17 +select * from t5 order by colint; +colint col1 +60 2006-02-17 +select * from t6 order by colint; +colint col1 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with extract(month from col1) +------------------------------------------------------------------------- +delete from t11 where col1='2006-02-17'; +delete from t22 where col1='2006-02-17'; +delete from t33 where col1='2006-02-17'; +delete from t44 where col1='2006-02-17'; +delete from t55 where col1='2006-02-17'; +delete from t66 where col1='2006-02-17'; +select * from t11 order by col1; +col1 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t33 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-02-17'); +insert into t22 values ('2006-02-17'); +insert into t33 values ('2006-02-17'); +insert into t44 values (60,'2006-02-17'); +insert into t55 values (60,'2006-02-17'); +insert into t66 values (60,'2006-02-17'); +select * from t11 order by col1; +col1 +2006-02-05 +2006-02-17 +select * from t22 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t33 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +select * from t22 order by col1; +col1 +select * from t33 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t44 order by colint; +colint col1 +60 2006-02-17 +select * from t55 order by colint; +colint col1 +60 2006-02-17 +select * from t66 order by colint; +colint col1 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -2251,44 +7219,83 @@ insert into t2 values ('21:59'); insert into t3 values ('09:09'); insert into t3 values ('14:30'); insert into t3 values ('21:59'); -insert into t4 values (1,'09:09'); -insert into t4 values (2,'14:30'); -insert into t5 values (1,'09:09'); -insert into t5 values (2,'14:30'); -insert into t5 values (3,'21:59'); -insert into t6 values (1,'14:30'); -insert into t6 values (2,'21:59'); -select hour(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6; +select hour(col1) from t1 order by col1; hour(col1) 9 14 -select * from t1; +select * from t1 order by col1; col1 09:09:00 14:30:00 -select * from t2; +select * from t2 order by col1; col1 09:09:00 14:30:00 21:59:00 -select * from t3; +select * from t3 order by col1; col1 09:09:00 14:30:00 21:59:00 -select * from t4; +select * from t4 order by colint; colint col1 -2 14:30:00 -1 09:09:00 -select * from t5; +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; colint col1 -2 14:30:00 -1 09:09:00 -3 21:59:00 -select * from t6; +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t6 order by colint; colint col1 -1 14:30:00 -2 21:59:00 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +update t1 set col1='10:30' where col1='09:09'; +update t2 set col1='10:30' where col1='09:09'; +update t3 set col1='10:30' where col1='09:09'; +update t4 set col1='10:30' where col1='09:09'; +update t5 set col1='10:30' where col1='09:09'; +update t6 set col1='10:30' where col1='09:09'; +select * from t1 order by col1; +col1 +10:30:00 +14:30:00 +select * from t2 order by col1; +col1 +10:30:00 +14:30:00 +21:59:00 +select * from t3 order by col1; +col1 +10:30:00 +14:30:00 +21:59:00 +select * from t4 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t6 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 ------------------------------------------------------------------------- --- Alter tables with hour(col1) ------------------------------------------------------------------------- @@ -2338,33 +7345,315 @@ alter table t66 partition by range(colint) (partition p0 values less than (hour('18:30')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -09:09:00 +10:30:00 14:30:00 -select * from t22; +select * from t22 order by col1; col1 -09:09:00 +10:30:00 14:30:00 21:59:00 -select * from t33; +select * from t33 order by col1; col1 -09:09:00 +10:30:00 14:30:00 21:59:00 -select * from t44; +select * from t44 order by colint; colint col1 -2 14:30:00 -1 09:09:00 -select * from t55; +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t55 order by colint; colint col1 -2 14:30:00 -1 09:09:00 -3 21:59:00 -select * from t66; +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t66 order by colint; colint col1 -1 14:30:00 -2 21:59:00 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:30:00 +14:30:00 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:30:00 +14:30:00 +alter table t55 +partition by list(colint) +subpartition by hash(hour(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` time DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (hour(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ +select * from t55 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (hour('18:30')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (hour('18:30')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with hour(col1) +------------------------------------------------------------------------- +delete from t1 where col1='14:30'; +delete from t2 where col1='14:30'; +delete from t3 where col1='14:30'; +delete from t4 where col1='14:30'; +delete from t5 where col1='14:30'; +delete from t6 where col1='14:30'; +select * from t1 order by col1; +col1 +10:30:00 +select * from t2 order by col1; +col1 +10:30:00 +21:59:00 +select * from t3 order by col1; +col1 +10:30:00 +21:59:00 +select * from t4 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +insert into t1 values ('14:30'); +insert into t2 values ('14:30'); +insert into t3 values ('14:30'); +insert into t4 values (60,'14:30'); +insert into t5 values (60,'14:30'); +insert into t6 values (60,'14:30'); +select * from t1 order by col1; +col1 +10:30:00 +14:30:00 +select * from t2 order by col1; +col1 +10:30:00 +14:30:00 +21:59:00 +select * from t3 order by col1; +col1 +10:30:00 +14:30:00 +21:59:00 +select * from t4 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:00 +select * from t5 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:00 +select * from t6 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:00 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +select * from t2 order by col1; +col1 +14:30:00 +21:59:00 +select * from t3 order by col1; +col1 +10:30:00 +14:30:00 +21:59:00 +select * from t4 order by colint; +colint col1 +60 14:30:00 +select * from t5 order by colint; +colint col1 +60 14:30:00 +select * from t6 order by colint; +colint col1 +60 14:30:00 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with hour(col1) +------------------------------------------------------------------------- +delete from t11 where col1='14:30'; +delete from t22 where col1='14:30'; +delete from t33 where col1='14:30'; +delete from t44 where col1='14:30'; +delete from t55 where col1='14:30'; +delete from t66 where col1='14:30'; +select * from t11 order by col1; +col1 +10:30:00 +select * from t22 order by col1; +col1 +10:30:00 +21:59:00 +select * from t33 order by col1; +col1 +10:30:00 +21:59:00 +select * from t44 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t55 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +insert into t11 values ('14:30'); +insert into t22 values ('14:30'); +insert into t33 values ('14:30'); +insert into t44 values (60,'14:30'); +insert into t55 values (60,'14:30'); +insert into t66 values (60,'14:30'); +select * from t11 order by col1; +col1 +10:30:00 +14:30:00 +select * from t22 order by col1; +col1 +10:30:00 +14:30:00 +21:59:00 +select * from t33 order by col1; +col1 +10:30:00 +14:30:00 +21:59:00 +select * from t44 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:00 +select * from t55 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:00 +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:00 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +select * from t22 order by col1; +col1 +14:30:00 +21:59:00 +select * from t33 order by col1; +col1 +10:30:00 +14:30:00 +21:59:00 +select * from t44 order by colint; +colint col1 +60 14:30:00 +select * from t55 order by colint; +colint col1 +60 14:30:00 +select * from t66 order by colint; +colint col1 +60 14:30:00 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -2434,44 +7723,83 @@ insert into t2 values ('00:59:22.000024'); insert into t3 values ('09:09:15.000002'); insert into t3 values ('04:30:01.000018'); insert into t3 values ('00:59:22.000024'); -insert into t4 values (1,'09:09:15.000002'); -insert into t4 values (2,'04:30:01.000018'); -insert into t5 values (1,'09:09:15.000002'); -insert into t5 values (2,'04:30:01.000018'); -insert into t5 values (3,'00:59:22.000024'); -insert into t6 values (1,'04:30:01.000018'); -insert into t6 values (2,'00:59:22.000024'); -select microsecond(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6; +select microsecond(col1) from t1 order by col1; microsecond(col1) 0 0 -select * from t1; +select * from t1 order by col1; col1 -09:09:15 04:30:01 -select * from t2; +09:09:15 +select * from t2 order by col1; col1 -09:09:15 -04:30:01 00:59:22 -select * from t3; -col1 -09:09:15 04:30:01 +09:09:15 +select * from t3 order by col1; +col1 00:59:22 -select * from t4; -colint col1 -1 09:09:15 -2 04:30:01 -select * from t5; +04:30:01 +09:09:15 +select * from t4 order by colint; colint col1 1 09:09:15 2 04:30:01 3 00:59:22 -select * from t6; +4 05:30:34 +select * from t5 order by colint; colint col1 -1 04:30:01 -2 00:59:22 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t6 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +update t1 set col1='05:30:34.000037' where col1='09:09:15.000002'; +update t2 set col1='05:30:34.000037' where col1='09:09:15.000002'; +update t3 set col1='05:30:34.000037' where col1='09:09:15.000002'; +update t4 set col1='05:30:34.000037' where col1='09:09:15.000002'; +update t5 set col1='05:30:34.000037' where col1='09:09:15.000002'; +update t6 set col1='05:30:34.000037' where col1='09:09:15.000002'; +select * from t1 order by col1; +col1 +04:30:01 +05:30:34 +select * from t2 order by col1; +col1 +00:59:22 +04:30:01 +05:30:34 +select * from t3 order by col1; +col1 +00:59:22 +04:30:01 +05:30:34 +select * from t4 order by colint; +colint col1 +1 05:30:34 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 05:30:34 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t6 order by colint; +colint col1 +1 05:30:34 +2 04:30:01 +3 00:59:22 +4 05:30:34 ------------------------------------------------------------------------- --- Alter tables with microsecond(col1) ------------------------------------------------------------------------- @@ -2521,33 +7849,301 @@ alter table t66 partition by range(colint) (partition p0 values less than (microsecond('10:30:10.000010')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -09:09:15 04:30:01 -select * from t22; +05:30:34 +select * from t22 order by col1; col1 -09:09:15 -04:30:01 00:59:22 -select * from t33; -col1 -09:09:15 04:30:01 +05:30:34 +select * from t33 order by col1; +col1 00:59:22 -select * from t44; +04:30:01 +05:30:34 +select * from t44 order by colint; colint col1 -1 09:09:15 -2 04:30:01 -select * from t55; -colint col1 -1 09:09:15 +1 05:30:34 2 04:30:01 3 00:59:22 -select * from t66; +4 05:30:34 +select * from t55 order by colint; colint col1 -1 04:30:01 -2 00:59:22 +1 05:30:34 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t66 order by colint; +colint col1 +1 05:30:34 +2 04:30:01 +3 00:59:22 +4 05:30:34 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +04:30:01 +05:30:34 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +04:30:01 +05:30:34 +alter table t55 +partition by list(colint) +subpartition by hash(microsecond(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` time DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (microsecond(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ +select * from t55 order by colint; +colint col1 +1 05:30:34 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 05:30:34 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (microsecond('10:30:10.000010')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 05:30:34 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 05:30:34 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (microsecond('10:30:10.000010')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 05:30:34 +2 04:30:01 +3 00:59:22 +4 05:30:34 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with microsecond(col1) +------------------------------------------------------------------------- +delete from t1 where col1='04:30:01.000018'; +delete from t2 where col1='04:30:01.000018'; +delete from t3 where col1='04:30:01.000018'; +delete from t4 where col1='04:30:01.000018'; +delete from t5 where col1='04:30:01.000018'; +delete from t6 where col1='04:30:01.000018'; +select * from t1 order by col1; +col1 +05:30:34 +select * from t2 order by col1; +col1 +00:59:22 +05:30:34 +select * from t3 order by col1; +col1 +00:59:22 +05:30:34 +select * from t4 order by colint; +colint col1 +1 05:30:34 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 05:30:34 +3 00:59:22 +4 05:30:34 +insert into t1 values ('04:30:01.000018'); +insert into t2 values ('04:30:01.000018'); +insert into t3 values ('04:30:01.000018'); +insert into t4 values (60,'04:30:01.000018'); +insert into t5 values (60,'04:30:01.000018'); +insert into t6 values (60,'04:30:01.000018'); +select * from t1 order by col1; +col1 +04:30:01 +05:30:34 +select * from t2 order by col1; +col1 +00:59:22 +04:30:01 +05:30:34 +select * from t3 order by col1; +col1 +00:59:22 +04:30:01 +05:30:34 +select * from t4 order by colint; +colint col1 +1 05:30:34 +3 00:59:22 +4 05:30:34 +60 04:30:01 +select * from t5 order by colint; +colint col1 +1 05:30:34 +3 00:59:22 +4 05:30:34 +60 04:30:01 +select * from t6 order by colint; +colint col1 +1 05:30:34 +3 00:59:22 +4 05:30:34 +60 04:30:01 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +select * from t2 order by col1; +col1 +select * from t3 order by col1; +col1 +00:59:22 +04:30:01 +05:30:34 +select * from t4 order by colint; +colint col1 +60 04:30:01 +select * from t5 order by colint; +colint col1 +60 04:30:01 +select * from t6 order by colint; +colint col1 +60 04:30:01 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with microsecond(col1) +------------------------------------------------------------------------- +delete from t11 where col1='04:30:01.000018'; +delete from t22 where col1='04:30:01.000018'; +delete from t33 where col1='04:30:01.000018'; +delete from t44 where col1='04:30:01.000018'; +delete from t55 where col1='04:30:01.000018'; +delete from t66 where col1='04:30:01.000018'; +select * from t11 order by col1; +col1 +05:30:34 +select * from t22 order by col1; +col1 +00:59:22 +05:30:34 +select * from t33 order by col1; +col1 +00:59:22 +05:30:34 +select * from t44 order by colint; +colint col1 +1 05:30:34 +3 00:59:22 +4 05:30:34 +select * from t55 order by colint; +colint col1 +1 05:30:34 +3 00:59:22 +4 05:30:34 +insert into t11 values ('04:30:01.000018'); +insert into t22 values ('04:30:01.000018'); +insert into t33 values ('04:30:01.000018'); +insert into t44 values (60,'04:30:01.000018'); +insert into t55 values (60,'04:30:01.000018'); +insert into t66 values (60,'04:30:01.000018'); +select * from t11 order by col1; +col1 +04:30:01 +05:30:34 +select * from t22 order by col1; +col1 +00:59:22 +04:30:01 +05:30:34 +select * from t33 order by col1; +col1 +00:59:22 +04:30:01 +05:30:34 +select * from t44 order by colint; +colint col1 +1 05:30:34 +3 00:59:22 +4 05:30:34 +60 04:30:01 +select * from t55 order by colint; +colint col1 +1 05:30:34 +3 00:59:22 +4 05:30:34 +60 04:30:01 +select * from t66 order by colint; +colint col1 +1 05:30:34 +3 00:59:22 +4 05:30:34 +60 04:30:01 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +select * from t22 order by col1; +col1 +select * from t33 order by col1; +col1 +00:59:22 +04:30:01 +05:30:34 +select * from t44 order by colint; +colint col1 +60 04:30:01 +select * from t55 order by colint; +colint col1 +60 04:30:01 +select * from t66 order by colint; +colint col1 +60 04:30:01 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -2617,44 +8213,83 @@ insert into t2 values ('21:59:22'); insert into t3 values ('09:09:15'); insert into t3 values ('14:30:45'); insert into t3 values ('21:59:22'); -insert into t4 values (1,'09:09:15'); -insert into t4 values (2,'14:30:45'); -insert into t5 values (1,'09:09:15'); -insert into t5 values (2,'14:30:45'); -insert into t5 values (3,'21:59:22'); -insert into t6 values (1,'14:30:45'); -insert into t6 values (2,'21:59:22'); -select minute(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6; +select minute(col1) from t1 order by col1; minute(col1) 9 30 -select * from t1; +select * from t1 order by col1; col1 09:09:15 14:30:45 -select * from t2; +select * from t2 order by col1; col1 09:09:15 14:30:45 21:59:22 -select * from t3; +select * from t3 order by col1; col1 09:09:15 14:30:45 21:59:22 -select * from t4; +select * from t4 order by colint; colint col1 -2 14:30:45 1 09:09:15 -select * from t5; +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; colint col1 -2 14:30:45 1 09:09:15 -3 21:59:22 -select * from t6; +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t6 order by colint; colint col1 -1 14:30:45 -2 21:59:22 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +update t1 set col1='10:24:23' where col1='09:09:15'; +update t2 set col1='10:24:23' where col1='09:09:15'; +update t3 set col1='10:24:23' where col1='09:09:15'; +update t4 set col1='10:24:23' where col1='09:09:15'; +update t5 set col1='10:24:23' where col1='09:09:15'; +update t6 set col1='10:24:23' where col1='09:09:15'; +select * from t1 order by col1; +col1 +10:24:23 +14:30:45 +select * from t2 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t3 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t4 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t6 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 ------------------------------------------------------------------------- --- Alter tables with minute(col1) ------------------------------------------------------------------------- @@ -2704,33 +8339,321 @@ alter table t66 partition by range(colint) (partition p0 values less than (minute('18:30')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -09:09:15 +10:24:23 14:30:45 -select * from t22; +select * from t22 order by col1; col1 -09:09:15 +10:24:23 14:30:45 21:59:22 -select * from t33; +select * from t33 order by col1; col1 -09:09:15 +10:24:23 14:30:45 21:59:22 -select * from t44; +select * from t44 order by colint; colint col1 -2 14:30:45 -1 09:09:15 -select * from t55; +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t55 order by colint; colint col1 -2 14:30:45 -1 09:09:15 -3 21:59:22 -select * from t66; +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t66 order by colint; colint col1 -1 14:30:45 -2 21:59:22 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:24:23 +14:30:45 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:24:23 +14:30:45 +alter table t55 +partition by list(colint) +subpartition by hash(minute(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` time DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (minute(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ +select * from t55 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (minute('18:30')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (minute('18:30')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with minute(col1) +------------------------------------------------------------------------- +delete from t1 where col1='14:30:45'; +delete from t2 where col1='14:30:45'; +delete from t3 where col1='14:30:45'; +delete from t4 where col1='14:30:45'; +delete from t5 where col1='14:30:45'; +delete from t6 where col1='14:30:45'; +select * from t1 order by col1; +col1 +10:24:23 +select * from t2 order by col1; +col1 +10:24:23 +21:59:22 +select * from t3 order by col1; +col1 +10:24:23 +21:59:22 +select * from t4 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +insert into t1 values ('14:30:45'); +insert into t2 values ('14:30:45'); +insert into t3 values ('14:30:45'); +insert into t4 values (60,'14:30:45'); +insert into t5 values (60,'14:30:45'); +insert into t6 values (60,'14:30:45'); +select * from t1 order by col1; +col1 +10:24:23 +14:30:45 +select * from t2 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t3 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t4 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +select * from t5 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +select * from t6 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +10:24:23 +14:30:45 +select * from t2 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t3 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t4 order by colint; +colint col1 +60 14:30:45 +select * from t5 order by colint; +colint col1 +60 14:30:45 +select * from t6 order by colint; +colint col1 +60 14:30:45 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with minute(col1) +------------------------------------------------------------------------- +delete from t11 where col1='14:30:45'; +delete from t22 where col1='14:30:45'; +delete from t33 where col1='14:30:45'; +delete from t44 where col1='14:30:45'; +delete from t55 where col1='14:30:45'; +delete from t66 where col1='14:30:45'; +select * from t11 order by col1; +col1 +10:24:23 +select * from t22 order by col1; +col1 +10:24:23 +21:59:22 +select * from t33 order by col1; +col1 +10:24:23 +21:59:22 +select * from t44 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t55 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +insert into t11 values ('14:30:45'); +insert into t22 values ('14:30:45'); +insert into t33 values ('14:30:45'); +insert into t44 values (60,'14:30:45'); +insert into t55 values (60,'14:30:45'); +insert into t66 values (60,'14:30:45'); +select * from t11 order by col1; +col1 +10:24:23 +14:30:45 +select * from t22 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t33 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t44 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +select * from t55 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +select * from t66 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +10:24:23 +14:30:45 +select * from t22 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t33 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t44 order by colint; +colint col1 +60 14:30:45 +select * from t55 order by colint; +colint col1 +60 14:30:45 +select * from t66 order by colint; +colint col1 +60 14:30:45 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -2800,44 +8723,83 @@ insert into t2 values ('21:59:22'); insert into t3 values ('09:09:09'); insert into t3 values ('14:30:20'); insert into t3 values ('21:59:22'); -insert into t4 values (1,'09:09:09'); -insert into t4 values (2,'14:30:20'); -insert into t5 values (1,'09:09:09'); -insert into t5 values (2,'14:30:20'); -insert into t5 values (3,'21:59:22'); -insert into t6 values (1,'14:30:20'); -insert into t6 values (2,'21:59:22'); -select second(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6; +select second(col1) from t1 order by col1; second(col1) 9 20 -select * from t1; +select * from t1 order by col1; col1 09:09:09 14:30:20 -select * from t2; +select * from t2 order by col1; col1 09:09:09 14:30:20 21:59:22 -select * from t3; +select * from t3 order by col1; col1 09:09:09 14:30:20 21:59:22 -select * from t4; +select * from t4 order by colint; colint col1 -2 14:30:20 -1 09:09:09 -select * from t5; +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; colint col1 -2 14:30:20 -3 21:59:22 -1 09:09:09 -select * from t6; +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t6 order by colint; colint col1 -1 14:30:20 -2 21:59:22 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +update t1 set col1='10:22:33' where col1='09:09:09'; +update t2 set col1='10:22:33' where col1='09:09:09'; +update t3 set col1='10:22:33' where col1='09:09:09'; +update t4 set col1='10:22:33' where col1='09:09:09'; +update t5 set col1='10:22:33' where col1='09:09:09'; +update t6 set col1='10:22:33' where col1='09:09:09'; +select * from t1 order by col1; +col1 +10:22:33 +14:30:20 +select * from t2 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t3 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t4 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t6 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 ------------------------------------------------------------------------- --- Alter tables with second(col1) ------------------------------------------------------------------------- @@ -2887,33 +8849,321 @@ alter table t66 partition by range(colint) (partition p0 values less than (second('18:30:14')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -09:09:09 +10:22:33 14:30:20 -select * from t22; +select * from t22 order by col1; col1 -09:09:09 +10:22:33 14:30:20 21:59:22 -select * from t33; +select * from t33 order by col1; col1 -09:09:09 +10:22:33 14:30:20 21:59:22 -select * from t44; +select * from t44 order by colint; colint col1 -2 14:30:20 -1 09:09:09 -select * from t55; +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t55 order by colint; colint col1 -2 14:30:20 -3 21:59:22 -1 09:09:09 -select * from t66; +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t66 order by colint; colint col1 -1 14:30:20 -2 21:59:22 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:22:33 +14:30:20 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:22:33 +14:30:20 +alter table t55 +partition by list(colint) +subpartition by hash(second(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` time DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (second(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ +select * from t55 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (second('18:30:14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (second('18:30:14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with second(col1) +------------------------------------------------------------------------- +delete from t1 where col1='14:30:20'; +delete from t2 where col1='14:30:20'; +delete from t3 where col1='14:30:20'; +delete from t4 where col1='14:30:20'; +delete from t5 where col1='14:30:20'; +delete from t6 where col1='14:30:20'; +select * from t1 order by col1; +col1 +10:22:33 +select * from t2 order by col1; +col1 +10:22:33 +21:59:22 +select * from t3 order by col1; +col1 +10:22:33 +21:59:22 +select * from t4 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +insert into t1 values ('14:30:20'); +insert into t2 values ('14:30:20'); +insert into t3 values ('14:30:20'); +insert into t4 values (60,'14:30:20'); +insert into t5 values (60,'14:30:20'); +insert into t6 values (60,'14:30:20'); +select * from t1 order by col1; +col1 +10:22:33 +14:30:20 +select * from t2 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t3 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t4 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:20 +select * from t5 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:20 +select * from t6 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:20 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +10:22:33 +14:30:20 +select * from t2 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t3 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t4 order by colint; +colint col1 +60 14:30:20 +select * from t5 order by colint; +colint col1 +60 14:30:20 +select * from t6 order by colint; +colint col1 +60 14:30:20 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with second(col1) +------------------------------------------------------------------------- +delete from t11 where col1='14:30:20'; +delete from t22 where col1='14:30:20'; +delete from t33 where col1='14:30:20'; +delete from t44 where col1='14:30:20'; +delete from t55 where col1='14:30:20'; +delete from t66 where col1='14:30:20'; +select * from t11 order by col1; +col1 +10:22:33 +select * from t22 order by col1; +col1 +10:22:33 +21:59:22 +select * from t33 order by col1; +col1 +10:22:33 +21:59:22 +select * from t44 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t55 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +insert into t11 values ('14:30:20'); +insert into t22 values ('14:30:20'); +insert into t33 values ('14:30:20'); +insert into t44 values (60,'14:30:20'); +insert into t55 values (60,'14:30:20'); +insert into t66 values (60,'14:30:20'); +select * from t11 order by col1; +col1 +10:22:33 +14:30:20 +select * from t22 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t33 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t44 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:20 +select * from t55 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:20 +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:20 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +10:22:33 +14:30:20 +select * from t22 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t33 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t44 order by colint; +colint col1 +60 14:30:20 +select * from t55 order by colint; +colint col1 +60 14:30:20 +select * from t66 order by colint; +colint col1 +60 14:30:20 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -2983,44 +9233,83 @@ insert into t2 values ('21:59:22'); insert into t3 values ('09:09:09'); insert into t3 values ('14:30:20'); insert into t3 values ('21:59:22'); -insert into t4 values (1,'09:09:09'); -insert into t4 values (2,'14:30:20'); -insert into t5 values (1,'09:09:09'); -insert into t5 values (2,'14:30:20'); -insert into t5 values (3,'21:59:22'); -insert into t6 values (1,'14:30:20'); -insert into t6 values (2,'21:59:22'); -select second(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6; +select second(col1) from t1 order by col1; second(col1) 9 20 -select * from t1; +select * from t1 order by col1; col1 09:09:09 14:30:20 -select * from t2; +select * from t2 order by col1; col1 09:09:09 14:30:20 21:59:22 -select * from t3; +select * from t3 order by col1; col1 09:09:09 14:30:20 21:59:22 -select * from t4; +select * from t4 order by colint; colint col1 -2 14:30:20 -1 09:09:09 -select * from t5; +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +select * from t5 order by colint; colint col1 -2 14:30:20 -3 21:59:22 -1 09:09:09 -select * from t6; +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +select * from t6 order by colint; colint col1 -1 14:30:20 -2 21:59:22 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +update t1 set col1='10:22:33' where col1='09:09:09'; +update t2 set col1='10:22:33' where col1='09:09:09'; +update t3 set col1='10:22:33' where col1='09:09:09'; +update t4 set col1='10:22:33' where col1='09:09:09'; +update t5 set col1='10:22:33' where col1='09:09:09'; +update t6 set col1='10:22:33' where col1='09:09:09'; +select * from t1 order by col1; +col1 +10:22:33 +14:30:20 +select * from t2 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t3 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t4 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +select * from t5 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +select * from t6 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 ------------------------------------------------------------------------- --- Alter tables with second(col1) ------------------------------------------------------------------------- @@ -3070,33 +9359,321 @@ alter table t66 partition by range(colint) (partition p0 values less than (second('18:30:14')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -09:09:09 +10:22:33 14:30:20 -select * from t22; +select * from t22 order by col1; col1 -09:09:09 +10:22:33 14:30:20 21:59:22 -select * from t33; +select * from t33 order by col1; col1 -09:09:09 +10:22:33 14:30:20 21:59:22 -select * from t44; +select * from t44 order by colint; colint col1 -2 14:30:20 -1 09:09:09 -select * from t55; +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +select * from t55 order by colint; colint col1 -2 14:30:20 -3 21:59:22 -1 09:09:09 -select * from t66; +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +select * from t66 order by colint; colint col1 -1 14:30:20 -2 21:59:22 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:22:33 +14:30:20 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:22:33 +14:30:20 +alter table t55 +partition by list(colint) +subpartition by hash(second(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` char(30) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (second(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ +select * from t55 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (second('18:30:14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (second('18:30:14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with second(col1) +------------------------------------------------------------------------- +delete from t1 where col1='14:30:20'; +delete from t2 where col1='14:30:20'; +delete from t3 where col1='14:30:20'; +delete from t4 where col1='14:30:20'; +delete from t5 where col1='14:30:20'; +delete from t6 where col1='14:30:20'; +select * from t1 order by col1; +col1 +10:22:33 +select * from t2 order by col1; +col1 +10:22:33 +21:59:22 +select * from t3 order by col1; +col1 +10:22:33 +21:59:22 +select * from t4 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +select * from t5 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +insert into t1 values ('14:30:20'); +insert into t2 values ('14:30:20'); +insert into t3 values ('14:30:20'); +insert into t4 values (60,'14:30:20'); +insert into t5 values (60,'14:30:20'); +insert into t6 values (60,'14:30:20'); +select * from t1 order by col1; +col1 +10:22:33 +14:30:20 +select * from t2 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t3 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t4 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +60 14:30:20 +select * from t5 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +60 14:30:20 +select * from t6 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +60 14:30:20 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +10:22:33 +14:30:20 +select * from t2 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t3 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t4 order by colint; +colint col1 +60 14:30:20 +select * from t5 order by colint; +colint col1 +60 14:30:20 +select * from t6 order by colint; +colint col1 +60 14:30:20 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with second(col1) +------------------------------------------------------------------------- +delete from t11 where col1='14:30:20'; +delete from t22 where col1='14:30:20'; +delete from t33 where col1='14:30:20'; +delete from t44 where col1='14:30:20'; +delete from t55 where col1='14:30:20'; +delete from t66 where col1='14:30:20'; +select * from t11 order by col1; +col1 +10:22:33 +select * from t22 order by col1; +col1 +10:22:33 +21:59:22 +select * from t33 order by col1; +col1 +10:22:33 +21:59:22 +select * from t44 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +select * from t55 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +insert into t11 values ('14:30:20'); +insert into t22 values ('14:30:20'); +insert into t33 values ('14:30:20'); +insert into t44 values (60,'14:30:20'); +insert into t55 values (60,'14:30:20'); +insert into t66 values (60,'14:30:20'); +select * from t11 order by col1; +col1 +10:22:33 +14:30:20 +select * from t22 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t33 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t44 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +60 14:30:20 +select * from t55 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +60 14:30:20 +select * from t66 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +60 14:30:20 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +10:22:33 +14:30:20 +select * from t22 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t33 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t44 order by colint; +colint col1 +60 14:30:20 +select * from t55 order by colint; +colint col1 +60 14:30:20 +select * from t66 order by colint; +colint col1 +60 14:30:20 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -3166,44 +9743,83 @@ insert into t2 values ('2006-05-25'); insert into t3 values ('2006-01-03'); insert into t3 values ('2006-12-17'); insert into t3 values ('2006-05-25'); -insert into t4 values (1,'2006-01-03'); -insert into t4 values (2,'2006-12-17'); -insert into t5 values (1,'2006-01-03'); -insert into t5 values (2,'2006-12-17'); -insert into t5 values (3,'2006-05-25'); -insert into t6 values (1,'2006-12-17'); -insert into t6 values (2,'2006-05-25'); -select month(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select month(col1) from t1 order by col1; month(col1) 1 12 -select * from t1; +select * from t1 order by col1; col1 2006-01-03 2006-12-17 -select * from t2; +select * from t2 order by col1; col1 2006-01-03 2006-05-25 2006-12-17 -select * from t3; +select * from t3 order by col1; col1 2006-01-03 -2006-12-17 2006-05-25 -select * from t4; +2006-12-17 +select * from t4 order by colint; colint col1 -2 2006-12-17 -1 2006-01-03 -select * from t5; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; colint col1 -2 2006-12-17 -1 2006-01-03 -3 2006-05-25 -select * from t6; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; colint col1 -1 2006-12-17 -2 2006-05-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-11-06' where col1='2006-01-03'; +update t2 set col1='2006-11-06' where col1='2006-01-03'; +update t3 set col1='2006-11-06' where col1='2006-01-03'; +update t4 set col1='2006-11-06' where col1='2006-01-03'; +update t5 set col1='2006-11-06' where col1='2006-01-03'; +update t6 set col1='2006-11-06' where col1='2006-01-03'; +select * from t1 order by col1; +col1 +2006-11-06 +2006-12-17 +select * from t2 order by col1; +col1 +2006-05-25 +2006-11-06 +2006-12-17 +select * from t3 order by col1; +col1 +2006-05-25 +2006-11-06 +2006-12-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 ------------------------------------------------------------------------- --- Alter tables with month(col1) ------------------------------------------------------------------------- @@ -3253,33 +9869,315 @@ alter table t66 partition by range(colint) (partition p0 values less than (month('2006-10-14')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -2006-01-03 +2006-11-06 2006-12-17 -select * from t22; +select * from t22 order by col1; col1 -2006-01-03 2006-05-25 +2006-11-06 2006-12-17 -select * from t33; +select * from t33 order by col1; col1 -2006-01-03 -2006-12-17 2006-05-25 -select * from t44; +2006-11-06 +2006-12-17 +select * from t44 order by colint; colint col1 -2 2006-12-17 -1 2006-01-03 -select * from t55; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; colint col1 -2 2006-12-17 -1 2006-01-03 -3 2006-05-25 -select * from t66; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; colint col1 -1 2006-12-17 -2 2006-05-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-11-06 +2006-12-17 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-11-06 +2006-12-17 +alter table t55 +partition by list(colint) +subpartition by hash(month(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (month(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (month('2006-10-14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (month('2006-10-14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with month(col1) +------------------------------------------------------------------------- +delete from t1 where col1='2006-12-17'; +delete from t2 where col1='2006-12-17'; +delete from t3 where col1='2006-12-17'; +delete from t4 where col1='2006-12-17'; +delete from t5 where col1='2006-12-17'; +delete from t6 where col1='2006-12-17'; +select * from t1 order by col1; +col1 +2006-11-06 +select * from t2 order by col1; +col1 +2006-05-25 +2006-11-06 +select * from t3 order by col1; +col1 +2006-05-25 +2006-11-06 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-12-17'); +insert into t2 values ('2006-12-17'); +insert into t3 values ('2006-12-17'); +insert into t4 values (60,'2006-12-17'); +insert into t5 values (60,'2006-12-17'); +insert into t6 values (60,'2006-12-17'); +select * from t1 order by col1; +col1 +2006-11-06 +2006-12-17 +select * from t2 order by col1; +col1 +2006-05-25 +2006-11-06 +2006-12-17 +select * from t3 order by col1; +col1 +2006-05-25 +2006-11-06 +2006-12-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +select * from t2 order by col1; +col1 +2006-11-06 +2006-12-17 +select * from t3 order by col1; +col1 +2006-05-25 +2006-11-06 +2006-12-17 +select * from t4 order by colint; +colint col1 +60 2006-12-17 +select * from t5 order by colint; +colint col1 +60 2006-12-17 +select * from t6 order by colint; +colint col1 +60 2006-12-17 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with month(col1) +------------------------------------------------------------------------- +delete from t11 where col1='2006-12-17'; +delete from t22 where col1='2006-12-17'; +delete from t33 where col1='2006-12-17'; +delete from t44 where col1='2006-12-17'; +delete from t55 where col1='2006-12-17'; +delete from t66 where col1='2006-12-17'; +select * from t11 order by col1; +col1 +2006-11-06 +select * from t22 order by col1; +col1 +2006-05-25 +2006-11-06 +select * from t33 order by col1; +col1 +2006-05-25 +2006-11-06 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-12-17'); +insert into t22 values ('2006-12-17'); +insert into t33 values ('2006-12-17'); +insert into t44 values (60,'2006-12-17'); +insert into t55 values (60,'2006-12-17'); +insert into t66 values (60,'2006-12-17'); +select * from t11 order by col1; +col1 +2006-11-06 +2006-12-17 +select * from t22 order by col1; +col1 +2006-05-25 +2006-11-06 +2006-12-17 +select * from t33 order by col1; +col1 +2006-05-25 +2006-11-06 +2006-12-17 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +select * from t22 order by col1; +col1 +2006-11-06 +2006-12-17 +select * from t33 order by col1; +col1 +2006-05-25 +2006-11-06 +2006-12-17 +select * from t44 order by colint; +colint col1 +60 2006-12-17 +select * from t55 order by colint; +colint col1 +60 2006-12-17 +select * from t66 order by colint; +colint col1 +60 2006-12-17 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -3349,44 +10247,83 @@ insert into t2 values ('2006-09-25'); insert into t3 values ('2006-01-03'); insert into t3 values ('2006-12-17'); insert into t3 values ('2006-09-25'); -insert into t4 values (1,'2006-01-03'); -insert into t4 values (2,'2006-12-17'); -insert into t5 values (1,'2006-01-03'); -insert into t5 values (2,'2006-12-17'); -insert into t5 values (3,'2006-09-25'); -insert into t6 values (1,'2006-12-17'); -insert into t6 values (2,'2006-09-25'); -select quarter(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select quarter(col1) from t1 order by col1; quarter(col1) 1 4 -select * from t1; +select * from t1 order by col1; col1 2006-01-03 2006-12-17 -select * from t2; +select * from t2 order by col1; col1 2006-01-03 -2006-12-17 2006-09-25 -select * from t3; +2006-12-17 +select * from t3 order by col1; col1 2006-01-03 -2006-12-17 2006-09-25 -select * from t4; +2006-12-17 +select * from t4 order by colint; colint col1 -2 2006-12-17 -1 2006-01-03 -select * from t5; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; colint col1 -2 2006-12-17 -1 2006-01-03 -3 2006-09-25 -select * from t6; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; colint col1 -1 2006-12-17 -2 2006-09-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-07-30' where col1='2006-01-03'; +update t2 set col1='2006-07-30' where col1='2006-01-03'; +update t3 set col1='2006-07-30' where col1='2006-01-03'; +update t4 set col1='2006-07-30' where col1='2006-01-03'; +update t5 set col1='2006-07-30' where col1='2006-01-03'; +update t6 set col1='2006-07-30' where col1='2006-01-03'; +select * from t1 order by col1; +col1 +2006-07-30 +2006-12-17 +select * from t2 order by col1; +col1 +2006-07-30 +2006-09-25 +2006-12-17 +select * from t3 order by col1; +col1 +2006-07-30 +2006-09-25 +2006-12-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 ------------------------------------------------------------------------- --- Alter tables with quarter(col1) ------------------------------------------------------------------------- @@ -3436,33 +10373,313 @@ alter table t66 partition by range(colint) (partition p0 values less than (quarter('2006-10-14')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -2006-01-03 +2006-07-30 2006-12-17 -select * from t22; +select * from t22 order by col1; col1 -2006-01-03 -2006-12-17 +2006-07-30 2006-09-25 -select * from t33; -col1 -2006-01-03 2006-12-17 +select * from t33 order by col1; +col1 +2006-07-30 2006-09-25 -select * from t44; +2006-12-17 +select * from t44 order by colint; colint col1 -2 2006-12-17 -1 2006-01-03 -select * from t55; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; colint col1 -2 2006-12-17 -1 2006-01-03 -3 2006-09-25 -select * from t66; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; colint col1 -1 2006-12-17 -2 2006-09-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-07-30 +2006-12-17 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-07-30 +2006-12-17 +alter table t55 +partition by list(colint) +subpartition by hash(quarter(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (quarter(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (quarter('2006-10-14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (quarter('2006-10-14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with quarter(col1) +------------------------------------------------------------------------- +delete from t1 where col1='2006-12-17'; +delete from t2 where col1='2006-12-17'; +delete from t3 where col1='2006-12-17'; +delete from t4 where col1='2006-12-17'; +delete from t5 where col1='2006-12-17'; +delete from t6 where col1='2006-12-17'; +select * from t1 order by col1; +col1 +2006-07-30 +select * from t2 order by col1; +col1 +2006-07-30 +2006-09-25 +select * from t3 order by col1; +col1 +2006-07-30 +2006-09-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-12-17'); +insert into t2 values ('2006-12-17'); +insert into t3 values ('2006-12-17'); +insert into t4 values (60,'2006-12-17'); +insert into t5 values (60,'2006-12-17'); +insert into t6 values (60,'2006-12-17'); +select * from t1 order by col1; +col1 +2006-07-30 +2006-12-17 +select * from t2 order by col1; +col1 +2006-07-30 +2006-09-25 +2006-12-17 +select * from t3 order by col1; +col1 +2006-07-30 +2006-09-25 +2006-12-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +select * from t2 order by col1; +col1 +select * from t3 order by col1; +col1 +2006-07-30 +2006-09-25 +2006-12-17 +select * from t4 order by colint; +colint col1 +60 2006-12-17 +select * from t5 order by colint; +colint col1 +60 2006-12-17 +select * from t6 order by colint; +colint col1 +4 2006-02-05 +60 2006-12-17 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with quarter(col1) +------------------------------------------------------------------------- +delete from t11 where col1='2006-12-17'; +delete from t22 where col1='2006-12-17'; +delete from t33 where col1='2006-12-17'; +delete from t44 where col1='2006-12-17'; +delete from t55 where col1='2006-12-17'; +delete from t66 where col1='2006-12-17'; +select * from t11 order by col1; +col1 +2006-07-30 +select * from t22 order by col1; +col1 +2006-07-30 +2006-09-25 +select * from t33 order by col1; +col1 +2006-07-30 +2006-09-25 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-12-17'); +insert into t22 values ('2006-12-17'); +insert into t33 values ('2006-12-17'); +insert into t44 values (60,'2006-12-17'); +insert into t55 values (60,'2006-12-17'); +insert into t66 values (60,'2006-12-17'); +select * from t11 order by col1; +col1 +2006-07-30 +2006-12-17 +select * from t22 order by col1; +col1 +2006-07-30 +2006-09-25 +2006-12-17 +select * from t33 order by col1; +col1 +2006-07-30 +2006-09-25 +2006-12-17 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +select * from t22 order by col1; +col1 +select * from t33 order by col1; +col1 +2006-07-30 +2006-09-25 +2006-12-17 +select * from t44 order by colint; +colint col1 +60 2006-12-17 +select * from t55 order by colint; +colint col1 +60 2006-12-17 +select * from t66 order by colint; +colint col1 +4 2006-02-05 +60 2006-12-17 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -3532,44 +10749,83 @@ insert into t2 values ('21:59:22'); insert into t3 values ('09:09:15'); insert into t3 values ('14:30:45'); insert into t3 values ('21:59:22'); -insert into t4 values (1,'09:09:15'); -insert into t4 values (2,'14:30:45'); -insert into t5 values (1,'09:09:15'); -insert into t5 values (2,'14:30:45'); -insert into t5 values (3,'21:59:22'); -insert into t6 values (1,'14:30:45'); -insert into t6 values (2,'21:59:22'); -select time_to_sec(col1)-(time_to_sec(col1)-20) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6; +select time_to_sec(col1)-(time_to_sec(col1)-20) from t1 order by col1; time_to_sec(col1)-(time_to_sec(col1)-20) 20 20 -select * from t1; +select * from t1 order by col1; col1 09:09:15 14:30:45 -select * from t2; +select * from t2 order by col1; col1 09:09:15 14:30:45 21:59:22 -select * from t3; +select * from t3 order by col1; col1 09:09:15 14:30:45 21:59:22 -select * from t4; +select * from t4 order by colint; colint col1 1 09:09:15 -2 14:30:45 -select * from t5; +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; colint col1 1 09:09:15 -2 14:30:45 -3 21:59:22 -select * from t6; +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t6 order by colint; colint col1 -1 14:30:45 -2 21:59:22 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +update t1 set col1='10:33:11' where col1='09:09:15'; +update t2 set col1='10:33:11' where col1='09:09:15'; +update t3 set col1='10:33:11' where col1='09:09:15'; +update t4 set col1='10:33:11' where col1='09:09:15'; +update t5 set col1='10:33:11' where col1='09:09:15'; +update t6 set col1='10:33:11' where col1='09:09:15'; +select * from t1 order by col1; +col1 +10:33:11 +14:30:45 +select * from t2 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t3 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t4 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t6 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 ------------------------------------------------------------------------- --- Alter tables with time_to_sec(col1)-(time_to_sec(col1)-20) ------------------------------------------------------------------------- @@ -3619,33 +10875,319 @@ alter table t66 partition by range(colint) (partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -09:09:15 +10:33:11 14:30:45 -select * from t22; +select * from t22 order by col1; col1 -09:09:15 +10:33:11 14:30:45 21:59:22 -select * from t33; +select * from t33 order by col1; col1 -09:09:15 +10:33:11 14:30:45 21:59:22 -select * from t44; +select * from t44 order by colint; colint col1 -1 09:09:15 -2 14:30:45 -select * from t55; +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t55 order by colint; colint col1 -1 09:09:15 -2 14:30:45 -3 21:59:22 -select * from t66; +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t66 order by colint; colint col1 -1 14:30:45 -2 21:59:22 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:33:11 +14:30:45 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:33:11 +14:30:45 +alter table t55 +partition by list(colint) +subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` time DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (time_to_sec(col1)-(time_to_sec(col1)-20)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ +select * from t55 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with time_to_sec(col1)-(time_to_sec(col1)-20) +------------------------------------------------------------------------- +delete from t1 where col1='14:30:45'; +delete from t2 where col1='14:30:45'; +delete from t3 where col1='14:30:45'; +delete from t4 where col1='14:30:45'; +delete from t5 where col1='14:30:45'; +delete from t6 where col1='14:30:45'; +select * from t1 order by col1; +col1 +10:33:11 +select * from t2 order by col1; +col1 +10:33:11 +21:59:22 +select * from t3 order by col1; +col1 +10:33:11 +21:59:22 +select * from t4 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +insert into t1 values ('14:30:45'); +insert into t2 values ('14:30:45'); +insert into t3 values ('14:30:45'); +insert into t4 values (60,'14:30:45'); +insert into t5 values (60,'14:30:45'); +insert into t6 values (60,'14:30:45'); +select * from t1 order by col1; +col1 +10:33:11 +14:30:45 +select * from t2 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t3 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t4 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +select * from t5 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +select * from t6 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +10:33:11 +14:30:45 +select * from t2 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t3 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t4 order by colint; +colint col1 +60 14:30:45 +select * from t5 order by colint; +colint col1 +60 14:30:45 +select * from t6 order by colint; +colint col1 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with time_to_sec(col1)-(time_to_sec(col1)-20) +------------------------------------------------------------------------- +delete from t11 where col1='14:30:45'; +delete from t22 where col1='14:30:45'; +delete from t33 where col1='14:30:45'; +delete from t44 where col1='14:30:45'; +delete from t55 where col1='14:30:45'; +delete from t66 where col1='14:30:45'; +select * from t11 order by col1; +col1 +10:33:11 +select * from t22 order by col1; +col1 +10:33:11 +21:59:22 +select * from t33 order by col1; +col1 +10:33:11 +21:59:22 +select * from t44 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t55 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +insert into t11 values ('14:30:45'); +insert into t22 values ('14:30:45'); +insert into t33 values ('14:30:45'); +insert into t44 values (60,'14:30:45'); +insert into t55 values (60,'14:30:45'); +insert into t66 values (60,'14:30:45'); +select * from t11 order by col1; +col1 +10:33:11 +14:30:45 +select * from t22 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t33 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t44 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +select * from t55 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +select * from t66 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +10:33:11 +14:30:45 +select * from t22 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t33 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t44 order by colint; +colint col1 +60 14:30:45 +select * from t55 order by colint; +colint col1 +60 14:30:45 +select * from t66 order by colint; +colint col1 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -3715,44 +11257,83 @@ insert into t2 values ('2006-01-25'); insert into t3 values ('2006-02-03'); insert into t3 values ('2006-01-17'); insert into t3 values ('2006-01-25'); -insert into t4 values (1,'2006-02-03'); -insert into t4 values (2,'2006-01-17'); -insert into t5 values (1,'2006-02-03'); -insert into t5 values (2,'2006-01-17'); -insert into t5 values (3,'2006-01-25'); -insert into t6 values (1,'2006-01-17'); -insert into t6 values (2,'2006-01-25'); -select to_days(col1)-to_days('2006-01-01') from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select to_days(col1)-to_days('2006-01-01') from t1 order by col1; to_days(col1)-to_days('2006-01-01') -33 16 -select * from t1; +33 +select * from t1 order by col1; col1 -2006-02-03 2006-01-17 -select * from t2; +2006-02-03 +select * from t2 order by col1; col1 2006-01-17 2006-01-25 2006-02-03 -select * from t3; +select * from t3 order by col1; col1 -2006-02-03 2006-01-17 2006-01-25 -select * from t4; +2006-02-03 +select * from t4 order by colint; colint col1 -2 2006-01-17 1 2006-02-03 -select * from t5; -colint col1 2 2006-01-17 3 2006-01-25 -1 2006-02-03 -select * from t6; +4 2006-02-05 +select * from t5 order by colint; colint col1 -1 2006-01-17 -2 2006-01-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-02-06' where col1='2006-02-03'; +update t2 set col1='2006-02-06' where col1='2006-02-03'; +update t3 set col1='2006-02-06' where col1='2006-02-03'; +update t4 set col1='2006-02-06' where col1='2006-02-03'; +update t5 set col1='2006-02-06' where col1='2006-02-03'; +update t6 set col1='2006-02-06' where col1='2006-02-03'; +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-06 +select * from t2 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t3 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t4 order by colint; +colint col1 +1 2006-02-06 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-06 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-06 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 ------------------------------------------------------------------------- --- Alter tables with to_days(col1)-to_days('2006-01-01') ------------------------------------------------------------------------- @@ -3802,33 +11383,311 @@ alter table t66 partition by range(colint) (partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -2006-02-03 2006-01-17 -select * from t22; +2006-02-06 +select * from t22 order by col1; col1 2006-01-17 2006-01-25 -2006-02-03 -select * from t33; +2006-02-06 +select * from t33 order by col1; col1 -2006-02-03 2006-01-17 2006-01-25 -select * from t44; -colint col1 -2 2006-01-17 -1 2006-02-03 -select * from t55; +2006-02-06 +select * from t44 order by colint; colint col1 +1 2006-02-06 2 2006-01-17 3 2006-01-25 -1 2006-02-03 -select * from t66; +4 2006-02-05 +select * from t55 order by colint; colint col1 -1 2006-01-17 -2 2006-01-25 +1 2006-02-06 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; +colint col1 +1 2006-02-06 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-06 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-06 +alter table t55 +partition by list(colint) +subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (to_days(col1)-to_days('2006-01-01')) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ +select * from t55 order by colint; +colint col1 +1 2006-02-06 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-06 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-06 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-06 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-06 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01') +------------------------------------------------------------------------- +delete from t1 where col1='2006-01-17'; +delete from t2 where col1='2006-01-17'; +delete from t3 where col1='2006-01-17'; +delete from t4 where col1='2006-01-17'; +delete from t5 where col1='2006-01-17'; +delete from t6 where col1='2006-01-17'; +select * from t1 order by col1; +col1 +2006-02-06 +select * from t2 order by col1; +col1 +2006-01-25 +2006-02-06 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-06 +select * from t4 order by colint; +colint col1 +1 2006-02-06 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-06 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-01-17'); +insert into t2 values ('2006-01-17'); +insert into t3 values ('2006-01-17'); +insert into t4 values (60,'2006-01-17'); +insert into t5 values (60,'2006-01-17'); +insert into t6 values (60,'2006-01-17'); +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-06 +select * from t2 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t3 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t4 order by colint; +colint col1 +1 2006-02-06 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t5 order by colint; +colint col1 +1 2006-02-06 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t6 order by colint; +colint col1 +1 2006-02-06 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-06 +select * from t2 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t3 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t4 order by colint; +colint col1 +60 2006-01-17 +select * from t5 order by colint; +colint col1 +60 2006-01-17 +select * from t6 order by colint; +colint col1 +60 2006-01-17 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01') +------------------------------------------------------------------------- +delete from t11 where col1='2006-01-17'; +delete from t22 where col1='2006-01-17'; +delete from t33 where col1='2006-01-17'; +delete from t44 where col1='2006-01-17'; +delete from t55 where col1='2006-01-17'; +delete from t66 where col1='2006-01-17'; +select * from t11 order by col1; +col1 +2006-02-06 +select * from t22 order by col1; +col1 +2006-01-25 +2006-02-06 +select * from t33 order by col1; +col1 +2006-01-25 +2006-02-06 +select * from t44 order by colint; +colint col1 +1 2006-02-06 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-06 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-01-17'); +insert into t22 values ('2006-01-17'); +insert into t33 values ('2006-01-17'); +insert into t44 values (60,'2006-01-17'); +insert into t55 values (60,'2006-01-17'); +insert into t66 values (60,'2006-01-17'); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-06 +select * from t22 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t33 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t44 order by colint; +colint col1 +1 2006-02-06 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t55 order by colint; +colint col1 +1 2006-02-06 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t66 order by colint; +colint col1 +1 2006-02-06 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-06 +select * from t22 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t33 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t44 order by colint; +colint col1 +60 2006-01-17 +select * from t55 order by colint; +colint col1 +60 2006-01-17 +select * from t66 order by colint; +colint col1 +60 2006-01-17 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -3898,44 +11757,83 @@ insert into t2 values ('2006-05-25'); insert into t3 values ('2006-12-03'); insert into t3 values ('2006-11-17'); insert into t3 values ('2006-05-25'); -insert into t4 values (1,'2006-12-03'); -insert into t4 values (2,'2006-11-17'); -insert into t5 values (1,'2006-12-03'); -insert into t5 values (2,'2006-11-17'); -insert into t5 values (3,'2006-05-25'); -insert into t6 values (1,'2006-11-17'); -insert into t6 values (2,'2006-05-25'); -select weekday(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select weekday(col1) from t1 order by col1; weekday(col1) -6 4 -select * from t1; +6 +select * from t1 order by col1; col1 -2006-12-03 2006-11-17 -select * from t2; +2006-12-03 +select * from t2 order by col1; col1 -2006-12-03 -2006-11-17 2006-05-25 -select * from t3; -col1 -2006-12-03 2006-11-17 +2006-12-03 +select * from t3 order by col1; +col1 2006-05-25 -select * from t4; +2006-11-17 +2006-12-03 +select * from t4 order by colint; colint col1 -1 2006-12-03 -2 2006-11-17 -select * from t5; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; colint col1 -1 2006-12-03 -2 2006-11-17 -3 2006-05-25 -select * from t6; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; colint col1 -1 2006-11-17 -2 2006-05-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-02-06' where col1='2006-12-03'; +update t2 set col1='2006-02-06' where col1='2006-12-03'; +update t3 set col1='2006-02-06' where col1='2006-12-03'; +update t4 set col1='2006-02-06' where col1='2006-12-03'; +update t5 set col1='2006-02-06' where col1='2006-12-03'; +update t6 set col1='2006-02-06' where col1='2006-12-03'; +select * from t1 order by col1; +col1 +2006-02-06 +2006-11-17 +select * from t2 order by col1; +col1 +2006-02-06 +2006-05-25 +2006-11-17 +select * from t3 order by col1; +col1 +2006-02-06 +2006-05-25 +2006-11-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 ------------------------------------------------------------------------- --- Alter tables with weekday(col1) ------------------------------------------------------------------------- @@ -3985,33 +11883,311 @@ alter table t66 partition by range(colint) (partition p0 values less than (weekday('2006-10-14')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -2006-12-03 +2006-02-06 2006-11-17 -select * from t22; +select * from t22 order by col1; col1 -2006-12-03 -2006-11-17 +2006-02-06 2006-05-25 -select * from t33; -col1 -2006-12-03 2006-11-17 +select * from t33 order by col1; +col1 +2006-02-06 2006-05-25 -select * from t44; +2006-11-17 +select * from t44 order by colint; colint col1 -1 2006-12-03 -2 2006-11-17 -select * from t55; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; colint col1 -1 2006-12-03 -2 2006-11-17 -3 2006-05-25 -select * from t66; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; colint col1 -1 2006-11-17 -2 2006-05-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-02-06 +2006-11-17 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-02-06 +2006-11-17 +alter table t55 +partition by list(colint) +subpartition by hash(weekday(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (weekday(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (weekday('2006-10-14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (weekday('2006-10-14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with weekday(col1) +------------------------------------------------------------------------- +delete from t1 where col1='2006-11-17'; +delete from t2 where col1='2006-11-17'; +delete from t3 where col1='2006-11-17'; +delete from t4 where col1='2006-11-17'; +delete from t5 where col1='2006-11-17'; +delete from t6 where col1='2006-11-17'; +select * from t1 order by col1; +col1 +2006-02-06 +select * from t2 order by col1; +col1 +2006-02-06 +2006-05-25 +select * from t3 order by col1; +col1 +2006-02-06 +2006-05-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-11-17'); +insert into t2 values ('2006-11-17'); +insert into t3 values ('2006-11-17'); +insert into t4 values (60,'2006-11-17'); +insert into t5 values (60,'2006-11-17'); +insert into t6 values (60,'2006-11-17'); +select * from t1 order by col1; +col1 +2006-02-06 +2006-11-17 +select * from t2 order by col1; +col1 +2006-02-06 +2006-05-25 +2006-11-17 +select * from t3 order by col1; +col1 +2006-02-06 +2006-05-25 +2006-11-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-11-17 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-11-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-11-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +select * from t2 order by col1; +col1 +select * from t3 order by col1; +col1 +2006-02-06 +2006-05-25 +2006-11-17 +select * from t4 order by colint; +colint col1 +60 2006-11-17 +select * from t5 order by colint; +colint col1 +60 2006-11-17 +select * from t6 order by colint; +colint col1 +60 2006-11-17 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with weekday(col1) +------------------------------------------------------------------------- +delete from t11 where col1='2006-11-17'; +delete from t22 where col1='2006-11-17'; +delete from t33 where col1='2006-11-17'; +delete from t44 where col1='2006-11-17'; +delete from t55 where col1='2006-11-17'; +delete from t66 where col1='2006-11-17'; +select * from t11 order by col1; +col1 +2006-02-06 +select * from t22 order by col1; +col1 +2006-02-06 +2006-05-25 +select * from t33 order by col1; +col1 +2006-02-06 +2006-05-25 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-11-17'); +insert into t22 values ('2006-11-17'); +insert into t33 values ('2006-11-17'); +insert into t44 values (60,'2006-11-17'); +insert into t55 values (60,'2006-11-17'); +insert into t66 values (60,'2006-11-17'); +select * from t11 order by col1; +col1 +2006-02-06 +2006-11-17 +select * from t22 order by col1; +col1 +2006-02-06 +2006-05-25 +2006-11-17 +select * from t33 order by col1; +col1 +2006-02-06 +2006-05-25 +2006-11-17 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-11-17 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-11-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-11-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +select * from t22 order by col1; +col1 +select * from t33 order by col1; +col1 +2006-02-06 +2006-05-25 +2006-11-17 +select * from t44 order by colint; +colint col1 +60 2006-11-17 +select * from t55 order by colint; +colint col1 +60 2006-11-17 +select * from t66 order by colint; +colint col1 +60 2006-11-17 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -4081,44 +12257,83 @@ insert into t2 values ('2006-05-25'); insert into t3 values ('2006-01-03'); insert into t3 values ('2006-03-17'); insert into t3 values ('2006-05-25'); -insert into t4 values (1,'2006-01-03'); -insert into t4 values (2,'2006-03-17'); -insert into t5 values (1,'2006-01-03'); -insert into t5 values (2,'2006-03-17'); -insert into t5 values (3,'2006-05-25'); -insert into t6 values (1,'2006-03-17'); -insert into t6 values (2,'2006-05-25'); -select weekofyear(col1) from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select weekofyear(col1) from t1 order by col1; weekofyear(col1) 1 11 -select * from t1; +select * from t1 order by col1; col1 2006-01-03 2006-03-17 -select * from t2; +select * from t2 order by col1; col1 2006-01-03 2006-03-17 2006-05-25 -select * from t3; +select * from t3 order by col1; col1 2006-01-03 2006-03-17 2006-05-25 -select * from t4; +select * from t4 order by colint; colint col1 -1 2006-01-03 -2 2006-03-17 -select * from t5; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; colint col1 -1 2006-01-03 -2 2006-03-17 -3 2006-05-25 -select * from t6; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; colint col1 -1 2006-03-17 -2 2006-05-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-09-06' where col1='2006-01-03'; +update t2 set col1='2006-09-06' where col1='2006-01-03'; +update t3 set col1='2006-09-06' where col1='2006-01-03'; +update t4 set col1='2006-09-06' where col1='2006-01-03'; +update t5 set col1='2006-09-06' where col1='2006-01-03'; +update t6 set col1='2006-09-06' where col1='2006-01-03'; +select * from t1 order by col1; +col1 +2006-03-17 +2006-09-06 +select * from t2 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t3 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 ------------------------------------------------------------------------- --- Alter tables with weekofyear(col1) ------------------------------------------------------------------------- @@ -4168,33 +12383,319 @@ alter table t66 partition by range(colint) (partition p0 values less than (weekofyear('2006-02-14')), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -2006-01-03 2006-03-17 -select * from t22; +2006-09-06 +select * from t22 order by col1; col1 -2006-01-03 2006-03-17 2006-05-25 -select * from t33; +2006-09-06 +select * from t33 order by col1; col1 -2006-01-03 2006-03-17 2006-05-25 -select * from t44; +2006-09-06 +select * from t44 order by colint; colint col1 -1 2006-01-03 -2 2006-03-17 -select * from t55; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; colint col1 -1 2006-01-03 -2 2006-03-17 -3 2006-05-25 -select * from t66; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; colint col1 -1 2006-03-17 -2 2006-05-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-03-17 +2006-09-06 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-03-17 +2006-09-06 +alter table t55 +partition by list(colint) +subpartition by hash(weekofyear(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (weekofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (weekofyear('2006-02-14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (weekofyear('2006-02-14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with weekofyear(col1) +------------------------------------------------------------------------- +delete from t1 where col1='2006-03-17'; +delete from t2 where col1='2006-03-17'; +delete from t3 where col1='2006-03-17'; +delete from t4 where col1='2006-03-17'; +delete from t5 where col1='2006-03-17'; +delete from t6 where col1='2006-03-17'; +select * from t1 order by col1; +col1 +2006-09-06 +select * from t2 order by col1; +col1 +2006-05-25 +2006-09-06 +select * from t3 order by col1; +col1 +2006-05-25 +2006-09-06 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-03-17'); +insert into t2 values ('2006-03-17'); +insert into t3 values ('2006-03-17'); +insert into t4 values (60,'2006-03-17'); +insert into t5 values (60,'2006-03-17'); +insert into t6 values (60,'2006-03-17'); +select * from t1 order by col1; +col1 +2006-03-17 +2006-09-06 +select * from t2 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t3 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-03-17 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-03-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-03-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +2006-09-06 +select * from t2 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t3 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t4 order by colint; +colint col1 +60 2006-03-17 +select * from t5 order by colint; +colint col1 +60 2006-03-17 +select * from t6 order by colint; +colint col1 +60 2006-03-17 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with weekofyear(col1) +------------------------------------------------------------------------- +delete from t11 where col1='2006-03-17'; +delete from t22 where col1='2006-03-17'; +delete from t33 where col1='2006-03-17'; +delete from t44 where col1='2006-03-17'; +delete from t55 where col1='2006-03-17'; +delete from t66 where col1='2006-03-17'; +select * from t11 order by col1; +col1 +2006-09-06 +select * from t22 order by col1; +col1 +2006-05-25 +2006-09-06 +select * from t33 order by col1; +col1 +2006-05-25 +2006-09-06 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-03-17'); +insert into t22 values ('2006-03-17'); +insert into t33 values ('2006-03-17'); +insert into t44 values (60,'2006-03-17'); +insert into t55 values (60,'2006-03-17'); +insert into t66 values (60,'2006-03-17'); +select * from t11 order by col1; +col1 +2006-03-17 +2006-09-06 +select * from t22 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t33 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-03-17 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-03-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-03-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +2006-09-06 +select * from t22 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t33 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t44 order by colint; +colint col1 +60 2006-03-17 +select * from t55 order by colint; +colint col1 +60 2006-03-17 +select * from t66 order by colint; +colint col1 +60 2006-03-17 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -4264,44 +12765,83 @@ insert into t2 values ('2004-05-25'); insert into t3 values ('1996-01-03'); insert into t3 values ('2000-02-17'); insert into t3 values ('2004-05-25'); -insert into t4 values (1,'1996-01-03'); -insert into t4 values (2,'2000-02-17'); -insert into t5 values (1,'1996-01-03'); -insert into t5 values (2,'2000-02-17'); -insert into t5 values (3,'2004-05-25'); -insert into t6 values (1,'2000-02-17'); -insert into t6 values (2,'2004-05-25'); -select year(col1)-1990 from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select year(col1)-1990 from t1 order by col1; year(col1)-1990 6 10 -select * from t1; +select * from t1 order by col1; col1 1996-01-03 2000-02-17 -select * from t2; +select * from t2 order by col1; col1 1996-01-03 2000-02-17 2004-05-25 -select * from t3; +select * from t3 order by col1; col1 1996-01-03 2000-02-17 2004-05-25 -select * from t4; +select * from t4 order by colint; colint col1 -1 1996-01-03 -2 2000-02-17 -select * from t5; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; colint col1 -1 1996-01-03 -2 2000-02-17 -3 2004-05-25 -select * from t6; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; colint col1 -1 2000-02-17 -2 2004-05-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2002-02-15' where col1='1996-01-03'; +update t2 set col1='2002-02-15' where col1='1996-01-03'; +update t3 set col1='2002-02-15' where col1='1996-01-03'; +update t4 set col1='2002-02-15' where col1='1996-01-03'; +update t5 set col1='2002-02-15' where col1='1996-01-03'; +update t6 set col1='2002-02-15' where col1='1996-01-03'; +select * from t1 order by col1; +col1 +2000-02-17 +2002-02-15 +select * from t2 order by col1; +col1 +2000-02-17 +2002-02-15 +2004-05-25 +select * from t3 order by col1; +col1 +2000-02-17 +2002-02-15 +2004-05-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 ------------------------------------------------------------------------- --- Alter tables with year(col1)-1990 ------------------------------------------------------------------------- @@ -4351,33 +12891,315 @@ alter table t66 partition by range(colint) (partition p0 values less than (year('2005-10-14')-1990), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -1996-01-03 2000-02-17 -select * from t22; +2002-02-15 +select * from t22 order by col1; col1 -1996-01-03 2000-02-17 +2002-02-15 2004-05-25 -select * from t33; +select * from t33 order by col1; col1 -1996-01-03 2000-02-17 +2002-02-15 2004-05-25 -select * from t44; +select * from t44 order by colint; colint col1 -1 1996-01-03 -2 2000-02-17 -select * from t55; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; colint col1 -1 1996-01-03 -2 2000-02-17 -3 2004-05-25 -select * from t66; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; colint col1 -1 2000-02-17 -2 2004-05-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2000-02-17 +2002-02-15 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2000-02-17 +2002-02-15 +alter table t55 +partition by list(colint) +subpartition by hash(year(col1)-1990) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (year(col1)-1990) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (year('2005-10-14')-1990), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (year('2005-10-14')-1990), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with year(col1)-1990 +------------------------------------------------------------------------- +delete from t1 where col1='2000-02-17'; +delete from t2 where col1='2000-02-17'; +delete from t3 where col1='2000-02-17'; +delete from t4 where col1='2000-02-17'; +delete from t5 where col1='2000-02-17'; +delete from t6 where col1='2000-02-17'; +select * from t1 order by col1; +col1 +2002-02-15 +select * from t2 order by col1; +col1 +2002-02-15 +2004-05-25 +select * from t3 order by col1; +col1 +2002-02-15 +2004-05-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2000-02-17'); +insert into t2 values ('2000-02-17'); +insert into t3 values ('2000-02-17'); +insert into t4 values (60,'2000-02-17'); +insert into t5 values (60,'2000-02-17'); +insert into t6 values (60,'2000-02-17'); +select * from t1 order by col1; +col1 +2000-02-17 +2002-02-15 +select * from t2 order by col1; +col1 +2000-02-17 +2002-02-15 +2004-05-25 +select * from t3 order by col1; +col1 +2000-02-17 +2002-02-15 +2004-05-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2000-02-17 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2000-02-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2000-02-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +select * from t2 order by col1; +col1 +2002-02-15 +2004-05-25 +select * from t3 order by col1; +col1 +2000-02-17 +2002-02-15 +2004-05-25 +select * from t4 order by colint; +colint col1 +60 2000-02-17 +select * from t5 order by colint; +colint col1 +60 2000-02-17 +select * from t6 order by colint; +colint col1 +60 2000-02-17 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with year(col1)-1990 +------------------------------------------------------------------------- +delete from t11 where col1='2000-02-17'; +delete from t22 where col1='2000-02-17'; +delete from t33 where col1='2000-02-17'; +delete from t44 where col1='2000-02-17'; +delete from t55 where col1='2000-02-17'; +delete from t66 where col1='2000-02-17'; +select * from t11 order by col1; +col1 +2002-02-15 +select * from t22 order by col1; +col1 +2002-02-15 +2004-05-25 +select * from t33 order by col1; +col1 +2002-02-15 +2004-05-25 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2000-02-17'); +insert into t22 values ('2000-02-17'); +insert into t33 values ('2000-02-17'); +insert into t44 values (60,'2000-02-17'); +insert into t55 values (60,'2000-02-17'); +insert into t66 values (60,'2000-02-17'); +select * from t11 order by col1; +col1 +2000-02-17 +2002-02-15 +select * from t22 order by col1; +col1 +2000-02-17 +2002-02-15 +2004-05-25 +select * from t33 order by col1; +col1 +2000-02-17 +2002-02-15 +2004-05-25 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2000-02-17 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2000-02-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2000-02-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +select * from t22 order by col1; +col1 +2002-02-15 +2004-05-25 +select * from t33 order by col1; +col1 +2000-02-17 +2002-02-15 +2004-05-25 +select * from t44 order by colint; +colint col1 +60 2000-02-17 +select * from t55 order by colint; +colint col1 +60 2000-02-17 +select * from t66 order by colint; +colint col1 +60 2000-02-17 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; @@ -4447,44 +13269,83 @@ insert into t2 values ('2006-03-25'); insert into t3 values ('2006-01-03'); insert into t3 values ('2006-08-17'); insert into t3 values ('2006-03-25'); -insert into t4 values (1,'2006-01-03'); -insert into t4 values (2,'2006-08-17'); -insert into t5 values (1,'2006-01-03'); -insert into t5 values (2,'2006-08-17'); -insert into t5 values (3,'2006-03-25'); -insert into t6 values (1,'2006-08-17'); -insert into t6 values (2,'2006-03-25'); -select yearweek(col1)-200600 from t1; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select yearweek(col1)-200600 from t1 order by col1; yearweek(col1)-200600 1 33 -select * from t1; +select * from t1 order by col1; col1 2006-01-03 2006-08-17 -select * from t2; +select * from t2 order by col1; col1 2006-01-03 2006-03-25 2006-08-17 -select * from t3; +select * from t3 order by col1; col1 2006-01-03 -2006-08-17 2006-03-25 -select * from t4; +2006-08-17 +select * from t4 order by colint; colint col1 -1 2006-01-03 -2 2006-08-17 -select * from t5; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; colint col1 -3 2006-03-25 -1 2006-01-03 -2 2006-08-17 -select * from t6; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; colint col1 -1 2006-08-17 -2 2006-03-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-11-15' where col1='2006-01-03'; +update t2 set col1='2006-11-15' where col1='2006-01-03'; +update t3 set col1='2006-11-15' where col1='2006-01-03'; +update t4 set col1='2006-11-15' where col1='2006-01-03'; +update t5 set col1='2006-11-15' where col1='2006-01-03'; +update t6 set col1='2006-11-15' where col1='2006-01-03'; +select * from t1 order by col1; +col1 +2006-08-17 +2006-11-15 +select * from t2 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t3 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 ------------------------------------------------------------------------- --- Alter tables with yearweek(col1)-200600 ------------------------------------------------------------------------- @@ -4534,33 +13395,321 @@ alter table t66 partition by range(colint) (partition p0 values less than (yearweek('2006-10-14')-200600), partition p1 values less than maxvalue); -select * from t11; +select * from t11 order by col1; col1 -2006-01-03 2006-08-17 -select * from t22; +2006-11-15 +select * from t22 order by col1; col1 -2006-01-03 2006-03-25 2006-08-17 -select * from t33; +2006-11-15 +select * from t33 order by col1; col1 -2006-01-03 -2006-08-17 2006-03-25 -select * from t44; +2006-08-17 +2006-11-15 +select * from t44 order by colint; colint col1 -1 2006-01-03 -2 2006-08-17 -select * from t55; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; colint col1 -3 2006-03-25 -1 2006-01-03 -2 2006-08-17 -select * from t66; +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; colint col1 -1 2006-08-17 -2 2006-03-25 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-08-17 +2006-11-15 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-08-17 +2006-11-15 +alter table t55 +partition by list(colint) +subpartition by hash(yearweek(col1)-200600) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (yearweek(col1)-200600) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (yearweek('2006-10-14')-200600), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (yearweek('2006-10-14')-200600), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with yearweek(col1)-200600 +------------------------------------------------------------------------- +delete from t1 where col1='2006-08-17'; +delete from t2 where col1='2006-08-17'; +delete from t3 where col1='2006-08-17'; +delete from t4 where col1='2006-08-17'; +delete from t5 where col1='2006-08-17'; +delete from t6 where col1='2006-08-17'; +select * from t1 order by col1; +col1 +2006-11-15 +select * from t2 order by col1; +col1 +2006-03-25 +2006-11-15 +select * from t3 order by col1; +col1 +2006-03-25 +2006-11-15 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-08-17'); +insert into t2 values ('2006-08-17'); +insert into t3 values ('2006-08-17'); +insert into t4 values (60,'2006-08-17'); +insert into t5 values (60,'2006-08-17'); +insert into t6 values (60,'2006-08-17'); +select * from t1 order by col1; +col1 +2006-08-17 +2006-11-15 +select * from t2 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t3 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-08-17 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-08-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-08-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +2006-08-17 +2006-11-15 +select * from t2 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t3 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t4 order by colint; +colint col1 +60 2006-08-17 +select * from t5 order by colint; +colint col1 +60 2006-08-17 +select * from t6 order by colint; +colint col1 +60 2006-08-17 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with yearweek(col1)-200600 +------------------------------------------------------------------------- +delete from t11 where col1='2006-08-17'; +delete from t22 where col1='2006-08-17'; +delete from t33 where col1='2006-08-17'; +delete from t44 where col1='2006-08-17'; +delete from t55 where col1='2006-08-17'; +delete from t66 where col1='2006-08-17'; +select * from t11 order by col1; +col1 +2006-11-15 +select * from t22 order by col1; +col1 +2006-03-25 +2006-11-15 +select * from t33 order by col1; +col1 +2006-03-25 +2006-11-15 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-08-17'); +insert into t22 values ('2006-08-17'); +insert into t33 values ('2006-08-17'); +insert into t44 values (60,'2006-08-17'); +insert into t55 values (60,'2006-08-17'); +insert into t66 values (60,'2006-08-17'); +select * from t11 order by col1; +col1 +2006-08-17 +2006-11-15 +select * from t22 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t33 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-08-17 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-08-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-08-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +2006-08-17 +2006-11-15 +select * from t22 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t33 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t44 order by colint; +colint col1 +60 2006-08-17 +select * from t55 order by colint; +colint col1 +60 2006-08-17 +select * from t66 order by colint; +colint col1 +60 2006-08-17 +------------------------- +---- some alter table end +------------------------- drop table if exists t1 ; drop table if exists t2 ; drop table if exists t3 ; diff --git a/mysql-test/suite/partitions/r/partition_supported_sql_func_ndb.result b/mysql-test/suite/partitions/r/partition_supported_sql_func_ndb.result new file mode 100644 index 00000000000..5dc27d16538 --- /dev/null +++ b/mysql-test/suite/partitions/r/partition_supported_sql_func_ndb.result @@ -0,0 +1,13724 @@ +------------------------------------------------------------------------- +--- abs(col1) in partition with coltype int +------------------------------------------------------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +------------------------------------------------------------------------- +--- Create tables with abs(col1) +------------------------------------------------------------------------- +create table t1 (col1 int) engine='NDB' +partition by range(abs(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t2 (col1 int) engine='NDB' +partition by list(abs(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t3 (col1 int) engine='NDB' +partition by hash(abs(col1)); +create table t4 (colint int, col1 int) engine='NDB' +partition by range(colint) +subpartition by hash(abs(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t5 (colint int, col1 int) engine='NDB' +partition by list(colint) +subpartition by hash(abs(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t6 (colint int, col1 int) engine='NDB' +partition by range(colint) +(partition p0 values less than (abs(15)), +partition p1 values less than maxvalue); +------------------------------------------------------------------------- +--- Access tables with abs(col1) +------------------------------------------------------------------------- +insert into t1 values (5 ); +insert into t1 values (13 ); +insert into t2 values (5 ); +insert into t2 values (13 ); +insert into t2 values (17 ); +insert into t3 values (5 ); +insert into t3 values (13 ); +insert into t3 values (17 ); +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_int.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_int.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_int.in' into table t6; +select abs(col1) from t1 order by col1; +abs(col1) +5 +13 +select * from t1 order by col1; +col1 +5 +13 +select * from t2 order by col1; +col1 +5 +13 +17 +select * from t3 order by col1; +col1 +5 +13 +17 +select * from t4 order by colint; +colint col1 +1 5 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 5 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +select * from t5 order by colint; +colint col1 +1 5 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 5 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +select * from t6 order by colint; +colint col1 +1 5 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 5 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +update t1 set col1=15 where col1=5 ; +update t2 set col1=15 where col1=5 ; +update t3 set col1=15 where col1=5 ; +update t4 set col1=15 where col1=5 ; +update t5 set col1=15 where col1=5 ; +update t6 set col1=15 where col1=5 ; +select * from t1 order by col1; +col1 +13 +15 +select * from t2 order by col1; +col1 +13 +15 +17 +select * from t3 order by col1; +col1 +13 +15 +17 +select * from t4 order by colint; +colint col1 +1 15 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +select * from t5 order by colint; +colint col1 +1 15 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +select * from t6 order by colint; +colint col1 +1 15 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +------------------------------------------------------------------------- +--- Alter tables with abs(col1) +------------------------------------------------------------------------- +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +create table t11 engine='NDB' as select * from t1; +create table t22 engine='NDB' as select * from t2; +create table t33 engine='NDB' as select * from t3; +create table t44 engine='NDB' as select * from t4; +create table t55 engine='NDB' as select * from t5; +create table t66 engine='NDB' as select * from t6; +alter table t11 +partition by range(abs(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t22 +partition by list(abs(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t33 +partition by hash(abs(col1)); +alter table t44 +partition by range(colint) +subpartition by hash(abs(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t55 +partition by list(colint) +subpartition by hash(abs(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t66 +partition by range(colint) +(partition p0 values less than (abs(15)), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +13 +15 +select * from t22 order by col1; +col1 +13 +15 +17 +select * from t33 order by col1; +col1 +13 +15 +17 +select * from t44 order by colint; +colint col1 +1 15 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +select * from t55 order by colint; +colint col1 +1 15 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +select * from t66 order by colint; +colint col1 +1 15 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +13 +15 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +13 +15 +alter table t55 +partition by list(colint) +subpartition by hash(abs(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` int(11) DEFAULT NULL +) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (abs(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */ +select * from t55 order by colint; +colint col1 +1 15 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (abs(15)), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (abs(15)), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15 +2 13 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with abs(col1) +------------------------------------------------------------------------- +delete from t1 where col1=13 ; +delete from t2 where col1=13 ; +delete from t3 where col1=13 ; +delete from t4 where col1=13 ; +delete from t5 where col1=13 ; +delete from t6 where col1=13 ; +select * from t1 order by col1; +col1 +15 +select * from t2 order by col1; +col1 +15 +17 +select * from t3 order by col1; +col1 +15 +17 +select * from t4 order by colint; +colint col1 +1 15 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +select * from t5 order by colint; +colint col1 +1 15 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +insert into t1 values (13 ); +insert into t2 values (13 ); +insert into t3 values (13 ); +insert into t4 values (60,13 ); +insert into t5 values (60,13 ); +insert into t6 values (60,13 ); +select * from t1 order by col1; +col1 +13 +15 +select * from t2 order by col1; +col1 +13 +15 +17 +select * from t3 order by col1; +col1 +13 +15 +17 +select * from t4 order by colint; +colint col1 +1 15 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +select * from t5 order by colint; +colint col1 +1 15 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +select * from t6 order by colint; +colint col1 +1 15 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +15 +select * from t2 order by col1; +col1 +13 +15 +17 +select * from t3 order by col1; +col1 +13 +15 +17 +select * from t4 order by colint; +colint col1 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +select * from t5 order by colint; +colint col1 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +select * from t6 order by colint; +colint col1 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with abs(col1) +------------------------------------------------------------------------- +delete from t11 where col1=13 ; +delete from t22 where col1=13 ; +delete from t33 where col1=13 ; +delete from t44 where col1=13 ; +delete from t55 where col1=13 ; +delete from t66 where col1=13 ; +select * from t11 order by col1; +col1 +15 +select * from t22 order by col1; +col1 +15 +17 +select * from t33 order by col1; +col1 +15 +17 +select * from t44 order by colint; +colint col1 +1 15 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +select * from t55 order by colint; +colint col1 +1 15 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +insert into t11 values (13 ); +insert into t22 values (13 ); +insert into t33 values (13 ); +insert into t44 values (60,13 ); +insert into t55 values (60,13 ); +insert into t66 values (60,13 ); +select * from t11 order by col1; +col1 +13 +15 +select * from t22 order by col1; +col1 +13 +15 +17 +select * from t33 order by col1; +col1 +13 +15 +17 +select * from t44 order by colint; +colint col1 +1 15 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +select * from t55 order by colint; +colint col1 +1 15 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +select * from t66 order by colint; +colint col1 +1 15 +3 15 +4 17 +5 23 +6 34 +7 56 +8 56 +9 45 +10 34 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +15 +select * from t22 order by col1; +col1 +13 +15 +17 +select * from t33 order by col1; +col1 +13 +15 +17 +select * from t44 order by colint; +colint col1 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +select * from t55 order by colint; +colint col1 +11 78 +12 89 +13 67 +14 46 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +select * from t66 order by colint; +colint col1 +15 34 +16 324 +17 345 +18 34 +19 78 +20 567 +21 4 +22 435 +23 34 +24 45 +25 4565 +26 4 +27 3 +28 2 +29 3 +30 15 +31 6 +32 8 +33 9 +34 745 +35 34 +36 34 +37 324 +38 67 +39 78 +40 89 +41 90 +42 78967 +50 56 +51 34 +55 123 +60 13 +------------------------- +---- some alter table end +------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +------------------------------------------------------------------------- +--- ascii(col1) in partition with coltype char(1) +------------------------------------------------------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +------------------------------------------------------------------------- +--- Create tables with ascii(col1) +------------------------------------------------------------------------- +create table t1 (col1 char(1)) engine='NDB' +partition by range(ascii(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t2 (col1 char(1)) engine='NDB' +partition by list(ascii(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t3 (col1 char(1)) engine='NDB' +partition by hash(ascii(col1)); +create table t4 (colint int, col1 char(1)) engine='NDB' +partition by range(colint) +subpartition by hash(ascii(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t5 (colint int, col1 char(1)) engine='NDB' +partition by list(colint) +subpartition by hash(ascii(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t6 (colint int, col1 char(1)) engine='NDB' +partition by range(colint) +(partition p0 values less than (ascii('5')), +partition p1 values less than maxvalue); +------------------------------------------------------------------------- +--- Access tables with ascii(col1) +------------------------------------------------------------------------- +insert into t1 values ('1'); +insert into t1 values ('9'); +insert into t2 values ('1'); +insert into t2 values ('9'); +insert into t2 values ('3'); +insert into t3 values ('1'); +insert into t3 values ('9'); +insert into t3 values ('3'); +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t6; +select ascii(col1) from t1 order by col1; +ascii(col1) +49 +57 +select * from t1 order by col1; +col1 +1 +9 +select * from t2 order by col1; +col1 +1 +3 +9 +select * from t3 order by col1; +col1 +1 +3 +9 +select * from t4 order by colint; +colint col1 +1 1 +2 9 +3 3 +4 8 +select * from t5 order by colint; +colint col1 +1 1 +2 9 +3 3 +4 8 +select * from t6 order by colint; +colint col1 +1 1 +2 9 +3 3 +4 8 +update t1 set col1='8' where col1='1'; +update t2 set col1='8' where col1='1'; +update t3 set col1='8' where col1='1'; +update t4 set col1='8' where col1='1'; +update t5 set col1='8' where col1='1'; +update t6 set col1='8' where col1='1'; +select * from t1 order by col1; +col1 +8 +9 +select * from t2 order by col1; +col1 +3 +8 +9 +select * from t3 order by col1; +col1 +3 +8 +9 +select * from t4 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +select * from t5 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +select * from t6 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +------------------------------------------------------------------------- +--- Alter tables with ascii(col1) +------------------------------------------------------------------------- +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +create table t11 engine='NDB' as select * from t1; +create table t22 engine='NDB' as select * from t2; +create table t33 engine='NDB' as select * from t3; +create table t44 engine='NDB' as select * from t4; +create table t55 engine='NDB' as select * from t5; +create table t66 engine='NDB' as select * from t6; +alter table t11 +partition by range(ascii(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t22 +partition by list(ascii(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t33 +partition by hash(ascii(col1)); +alter table t44 +partition by range(colint) +subpartition by hash(ascii(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t55 +partition by list(colint) +subpartition by hash(ascii(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t66 +partition by range(colint) +(partition p0 values less than (ascii('5')), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +8 +9 +select * from t22 order by col1; +col1 +3 +8 +9 +select * from t33 order by col1; +col1 +3 +8 +9 +select * from t44 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +select * from t55 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +select * from t66 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +8 +9 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +8 +9 +alter table t55 +partition by list(colint) +subpartition by hash(ascii(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` char(1) DEFAULT NULL +) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (ascii(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */ +select * from t55 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (ascii('5')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (ascii('5')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with ascii(col1) +------------------------------------------------------------------------- +delete from t1 where col1='9'; +delete from t2 where col1='9'; +delete from t3 where col1='9'; +delete from t4 where col1='9'; +delete from t5 where col1='9'; +delete from t6 where col1='9'; +select * from t1 order by col1; +col1 +8 +select * from t2 order by col1; +col1 +3 +8 +select * from t3 order by col1; +col1 +3 +8 +select * from t4 order by colint; +colint col1 +1 8 +3 3 +4 8 +select * from t5 order by colint; +colint col1 +1 8 +3 3 +4 8 +insert into t1 values ('9'); +insert into t2 values ('9'); +insert into t3 values ('9'); +insert into t4 values (60,'9'); +insert into t5 values (60,'9'); +insert into t6 values (60,'9'); +select * from t1 order by col1; +col1 +8 +9 +select * from t2 order by col1; +col1 +3 +8 +9 +select * from t3 order by col1; +col1 +3 +8 +9 +select * from t4 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +select * from t5 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +select * from t6 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +8 +9 +select * from t2 order by col1; +col1 +3 +8 +9 +select * from t3 order by col1; +col1 +3 +8 +9 +select * from t4 order by colint; +colint col1 +60 9 +select * from t5 order by colint; +colint col1 +60 9 +select * from t6 order by colint; +colint col1 +60 9 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with ascii(col1) +------------------------------------------------------------------------- +delete from t11 where col1='9'; +delete from t22 where col1='9'; +delete from t33 where col1='9'; +delete from t44 where col1='9'; +delete from t55 where col1='9'; +delete from t66 where col1='9'; +select * from t11 order by col1; +col1 +8 +select * from t22 order by col1; +col1 +3 +8 +select * from t33 order by col1; +col1 +3 +8 +select * from t44 order by colint; +colint col1 +1 8 +3 3 +4 8 +select * from t55 order by colint; +colint col1 +1 8 +3 3 +4 8 +insert into t11 values ('9'); +insert into t22 values ('9'); +insert into t33 values ('9'); +insert into t44 values (60,'9'); +insert into t55 values (60,'9'); +insert into t66 values (60,'9'); +select * from t11 order by col1; +col1 +8 +9 +select * from t22 order by col1; +col1 +3 +8 +9 +select * from t33 order by col1; +col1 +3 +8 +9 +select * from t44 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +select * from t55 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +select * from t66 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +8 +9 +select * from t22 order by col1; +col1 +3 +8 +9 +select * from t33 order by col1; +col1 +3 +8 +9 +select * from t44 order by colint; +colint col1 +60 9 +select * from t55 order by colint; +colint col1 +60 9 +select * from t66 order by colint; +colint col1 +60 9 +------------------------- +---- some alter table end +------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +------------------------------------------------------------------------- +--- cast(ceiling(col1) as signed integer) in partition with coltype float(7,4) +------------------------------------------------------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +------------------------------------------------------------------------- +--- Create tables with cast(ceiling(col1) as signed integer) +------------------------------------------------------------------------- +create table t1 (col1 float(7,4)) engine='NDB' +partition by range(cast(ceiling(col1) as signed integer)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t2 (col1 float(7,4)) engine='NDB' +partition by list(cast(ceiling(col1) as signed integer)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t3 (col1 float(7,4)) engine='NDB' +partition by hash(cast(ceiling(col1) as signed integer)); +create table t4 (colint int, col1 float(7,4)) engine='NDB' +partition by range(colint) +subpartition by hash(cast(ceiling(col1) as signed integer)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t5 (colint int, col1 float(7,4)) engine='NDB' +partition by list(colint) +subpartition by hash(cast(ceiling(col1) as signed integer)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t6 (colint int, col1 float(7,4)) engine='NDB' +partition by range(colint) +(partition p0 values less than (cast(ceiling(15) as signed integer)), +partition p1 values less than maxvalue); +------------------------------------------------------------------------- +--- Access tables with cast(ceiling(col1) as signed integer) +------------------------------------------------------------------------- +insert into t1 values (5.1230); +insert into t1 values (13.345); +insert into t2 values (5.1230); +insert into t2 values (13.345); +insert into t2 values (17.987); +insert into t3 values (5.1230); +insert into t3 values (13.345); +insert into t3 values (17.987); +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t6; +select cast(ceiling(col1) as signed integer) from t1 order by col1; +cast(ceiling(col1) as signed integer) +6 +14 +select * from t1 order by col1; +col1 +5.1230 +13.3450 +select * from t2 order by col1; +col1 +5.1230 +13.3450 +17.9870 +select * from t3 order by col1; +col1 +5.1230 +13.3450 +17.9870 +select * from t4 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t5 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t6 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +update t1 set col1=15.654 where col1=5.1230; +update t2 set col1=15.654 where col1=5.1230; +update t3 set col1=15.654 where col1=5.1230; +update t4 set col1=15.654 where col1=5.1230; +update t5 set col1=15.654 where col1=5.1230; +update t6 set col1=15.654 where col1=5.1230; +select * from t1 order by col1; +col1 +13.3450 +15.6540 +select * from t2 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t3 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t4 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t5 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t6 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +------------------------------------------------------------------------- +--- Alter tables with cast(ceiling(col1) as signed integer) +------------------------------------------------------------------------- +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +create table t11 engine='NDB' as select * from t1; +create table t22 engine='NDB' as select * from t2; +create table t33 engine='NDB' as select * from t3; +create table t44 engine='NDB' as select * from t4; +create table t55 engine='NDB' as select * from t5; +create table t66 engine='NDB' as select * from t6; +alter table t11 +partition by range(cast(ceiling(col1) as signed integer)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t22 +partition by list(cast(ceiling(col1) as signed integer)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t33 +partition by hash(cast(ceiling(col1) as signed integer)); +alter table t44 +partition by range(colint) +subpartition by hash(cast(ceiling(col1) as signed integer)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t55 +partition by list(colint) +subpartition by hash(cast(ceiling(col1) as signed integer)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t66 +partition by range(colint) +(partition p0 values less than (cast(ceiling(15) as signed integer)), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +13.3450 +15.6540 +select * from t22 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t33 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t44 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t55 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t66 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +13.3450 +15.6540 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +13.3450 +15.6540 +alter table t55 +partition by list(colint) +subpartition by hash(cast(ceiling(col1) as signed integer)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` float(7,4) DEFAULT NULL +) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (cast(ceiling(col1) as signed integer)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */ +select * from t55 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (cast(ceiling(15) as signed integer)), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (cast(ceiling(15) as signed integer)), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with cast(ceiling(col1) as signed integer) +------------------------------------------------------------------------- +delete from t1 where col1=13.345; +delete from t2 where col1=13.345; +delete from t3 where col1=13.345; +delete from t4 where col1=13.345; +delete from t5 where col1=13.345; +delete from t6 where col1=13.345; +select * from t1 order by col1; +col1 +15.6540 +select * from t2 order by col1; +col1 +15.6540 +17.9870 +select * from t3 order by col1; +col1 +15.6540 +17.9870 +select * from t4 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +select * from t5 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +insert into t1 values (13.345); +insert into t2 values (13.345); +insert into t3 values (13.345); +insert into t4 values (60,13.345); +insert into t5 values (60,13.345); +insert into t6 values (60,13.345); +select * from t1 order by col1; +col1 +13.3450 +15.6540 +select * from t2 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t3 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t4 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +select * from t5 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +select * from t6 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +15.6540 +select * from t2 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t3 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t4 order by colint; +colint col1 +60 13.3450 +select * from t5 order by colint; +colint col1 +60 13.3450 +select * from t6 order by colint; +colint col1 +60 13.3450 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with cast(ceiling(col1) as signed integer) +------------------------------------------------------------------------- +delete from t11 where col1=13.345; +delete from t22 where col1=13.345; +delete from t33 where col1=13.345; +delete from t44 where col1=13.345; +delete from t55 where col1=13.345; +delete from t66 where col1=13.345; +select * from t11 order by col1; +col1 +15.6540 +select * from t22 order by col1; +col1 +15.6540 +17.9870 +select * from t33 order by col1; +col1 +15.6540 +17.9870 +select * from t44 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +select * from t55 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +insert into t11 values (13.345); +insert into t22 values (13.345); +insert into t33 values (13.345); +insert into t44 values (60,13.345); +insert into t55 values (60,13.345); +insert into t66 values (60,13.345); +select * from t11 order by col1; +col1 +13.3450 +15.6540 +select * from t22 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t33 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t44 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +select * from t55 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +select * from t66 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +15.6540 +select * from t22 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t33 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t44 order by colint; +colint col1 +60 13.3450 +select * from t55 order by colint; +colint col1 +60 13.3450 +select * from t66 order by colint; +colint col1 +60 13.3450 +------------------------- +---- some alter table end +------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +------------------------------------------------------------------------- +--- cast(floor(col1) as signed) in partition with coltype float(7,4) +------------------------------------------------------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +------------------------------------------------------------------------- +--- Create tables with cast(floor(col1) as signed) +------------------------------------------------------------------------- +create table t1 (col1 float(7,4)) engine='NDB' +partition by range(cast(floor(col1) as signed)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t2 (col1 float(7,4)) engine='NDB' +partition by list(cast(floor(col1) as signed)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t3 (col1 float(7,4)) engine='NDB' +partition by hash(cast(floor(col1) as signed)); +create table t4 (colint int, col1 float(7,4)) engine='NDB' +partition by range(colint) +subpartition by hash(cast(floor(col1) as signed)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t5 (colint int, col1 float(7,4)) engine='NDB' +partition by list(colint) +subpartition by hash(cast(floor(col1) as signed)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t6 (colint int, col1 float(7,4)) engine='NDB' +partition by range(colint) +(partition p0 values less than (cast(floor(15.123) as signed)), +partition p1 values less than maxvalue); +------------------------------------------------------------------------- +--- Access tables with cast(floor(col1) as signed) +------------------------------------------------------------------------- +insert into t1 values (5.1230); +insert into t1 values (13.345); +insert into t2 values (5.1230); +insert into t2 values (13.345); +insert into t2 values (17.987); +insert into t3 values (5.1230); +insert into t3 values (13.345); +insert into t3 values (17.987); +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t6; +select cast(floor(col1) as signed) from t1 order by col1; +cast(floor(col1) as signed) +5 +13 +select * from t1 order by col1; +col1 +5.1230 +13.3450 +select * from t2 order by col1; +col1 +5.1230 +13.3450 +17.9870 +select * from t3 order by col1; +col1 +5.1230 +13.3450 +17.9870 +select * from t4 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t5 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t6 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +update t1 set col1=15.654 where col1=5.1230; +update t2 set col1=15.654 where col1=5.1230; +update t3 set col1=15.654 where col1=5.1230; +update t4 set col1=15.654 where col1=5.1230; +update t5 set col1=15.654 where col1=5.1230; +update t6 set col1=15.654 where col1=5.1230; +select * from t1 order by col1; +col1 +13.3450 +15.6540 +select * from t2 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t3 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t4 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t5 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t6 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +------------------------------------------------------------------------- +--- Alter tables with cast(floor(col1) as signed) +------------------------------------------------------------------------- +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +create table t11 engine='NDB' as select * from t1; +create table t22 engine='NDB' as select * from t2; +create table t33 engine='NDB' as select * from t3; +create table t44 engine='NDB' as select * from t4; +create table t55 engine='NDB' as select * from t5; +create table t66 engine='NDB' as select * from t6; +alter table t11 +partition by range(cast(floor(col1) as signed)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t22 +partition by list(cast(floor(col1) as signed)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t33 +partition by hash(cast(floor(col1) as signed)); +alter table t44 +partition by range(colint) +subpartition by hash(cast(floor(col1) as signed)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t55 +partition by list(colint) +subpartition by hash(cast(floor(col1) as signed)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t66 +partition by range(colint) +(partition p0 values less than (cast(floor(15.123) as signed)), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +13.3450 +15.6540 +select * from t22 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t33 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t44 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t55 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t66 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +13.3450 +15.6540 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +13.3450 +15.6540 +alter table t55 +partition by list(colint) +subpartition by hash(cast(floor(col1) as signed)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` float(7,4) DEFAULT NULL +) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (cast(floor(col1) as signed)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */ +select * from t55 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (cast(floor(15.123) as signed)), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (cast(floor(15.123) as signed)), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 15.6540 +2 13.3450 +3 17.9870 +4 15.6540 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with cast(floor(col1) as signed) +------------------------------------------------------------------------- +delete from t1 where col1=13.345; +delete from t2 where col1=13.345; +delete from t3 where col1=13.345; +delete from t4 where col1=13.345; +delete from t5 where col1=13.345; +delete from t6 where col1=13.345; +select * from t1 order by col1; +col1 +15.6540 +select * from t2 order by col1; +col1 +15.6540 +17.9870 +select * from t3 order by col1; +col1 +15.6540 +17.9870 +select * from t4 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +select * from t5 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +insert into t1 values (13.345); +insert into t2 values (13.345); +insert into t3 values (13.345); +insert into t4 values (60,13.345); +insert into t5 values (60,13.345); +insert into t6 values (60,13.345); +select * from t1 order by col1; +col1 +13.3450 +15.6540 +select * from t2 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t3 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t4 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +select * from t5 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +select * from t6 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +15.6540 +select * from t2 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t3 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t4 order by colint; +colint col1 +60 13.3450 +select * from t5 order by colint; +colint col1 +60 13.3450 +select * from t6 order by colint; +colint col1 +60 13.3450 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with cast(floor(col1) as signed) +------------------------------------------------------------------------- +delete from t11 where col1=13.345; +delete from t22 where col1=13.345; +delete from t33 where col1=13.345; +delete from t44 where col1=13.345; +delete from t55 where col1=13.345; +delete from t66 where col1=13.345; +select * from t11 order by col1; +col1 +15.6540 +select * from t22 order by col1; +col1 +15.6540 +17.9870 +select * from t33 order by col1; +col1 +15.6540 +17.9870 +select * from t44 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +select * from t55 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +insert into t11 values (13.345); +insert into t22 values (13.345); +insert into t33 values (13.345); +insert into t44 values (60,13.345); +insert into t55 values (60,13.345); +insert into t66 values (60,13.345); +select * from t11 order by col1; +col1 +13.3450 +15.6540 +select * from t22 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t33 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t44 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +select * from t55 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +select * from t66 order by colint; +colint col1 +1 15.6540 +3 17.9870 +4 15.6540 +60 13.3450 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +15.6540 +select * from t22 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t33 order by col1; +col1 +13.3450 +15.6540 +17.9870 +select * from t44 order by colint; +colint col1 +60 13.3450 +select * from t55 order by colint; +colint col1 +60 13.3450 +select * from t66 order by colint; +colint col1 +60 13.3450 +------------------------- +---- some alter table end +------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +------------------------------------------------------------------------- +--- cast(mod(col1,10) as signed) in partition with coltype float(7,4) +------------------------------------------------------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +------------------------------------------------------------------------- +--- Create tables with cast(mod(col1,10) as signed) +------------------------------------------------------------------------- +create table t1 (col1 float(7,4)) engine='NDB' +partition by range(cast(mod(col1,10) as signed)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t2 (col1 float(7,4)) engine='NDB' +partition by list(cast(mod(col1,10) as signed)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t3 (col1 float(7,4)) engine='NDB' +partition by hash(cast(mod(col1,10) as signed)); +create table t4 (colint int, col1 float(7,4)) engine='NDB' +partition by range(colint) +subpartition by hash(cast(mod(col1,10) as signed)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t5 (colint int, col1 float(7,4)) engine='NDB' +partition by list(colint) +subpartition by hash(cast(mod(col1,10) as signed)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t6 (colint int, col1 float(7,4)) engine='NDB' +partition by range(colint) +(partition p0 values less than (cast(mod(15,10) as signed)), +partition p1 values less than maxvalue); +------------------------------------------------------------------------- +--- Access tables with cast(mod(col1,10) as signed) +------------------------------------------------------------------------- +insert into t1 values (5.0000); +insert into t1 values (19); +insert into t2 values (5.0000); +insert into t2 values (19); +insert into t2 values (17); +insert into t3 values (5.0000); +insert into t3 values (19); +insert into t3 values (17); +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t6; +select cast(mod(col1,10) as signed) from t1 order by col1; +cast(mod(col1,10) as signed) +5 +9 +select * from t1 order by col1; +col1 +5.0000 +19.0000 +select * from t2 order by col1; +col1 +5.0000 +17.0000 +19.0000 +select * from t3 order by col1; +col1 +5.0000 +17.0000 +19.0000 +select * from t4 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t5 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t6 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +update t1 set col1=15 where col1=5.0000; +update t2 set col1=15 where col1=5.0000; +update t3 set col1=15 where col1=5.0000; +update t4 set col1=15 where col1=5.0000; +update t5 set col1=15 where col1=5.0000; +update t6 set col1=15 where col1=5.0000; +select * from t1 order by col1; +col1 +15.0000 +19.0000 +select * from t2 order by col1; +col1 +15.0000 +17.0000 +19.0000 +select * from t3 order by col1; +col1 +15.0000 +17.0000 +19.0000 +select * from t4 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t5 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t6 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +------------------------------------------------------------------------- +--- Alter tables with cast(mod(col1,10) as signed) +------------------------------------------------------------------------- +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +create table t11 engine='NDB' as select * from t1; +create table t22 engine='NDB' as select * from t2; +create table t33 engine='NDB' as select * from t3; +create table t44 engine='NDB' as select * from t4; +create table t55 engine='NDB' as select * from t5; +create table t66 engine='NDB' as select * from t6; +alter table t11 +partition by range(cast(mod(col1,10) as signed)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t22 +partition by list(cast(mod(col1,10) as signed)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t33 +partition by hash(cast(mod(col1,10) as signed)); +alter table t44 +partition by range(colint) +subpartition by hash(cast(mod(col1,10) as signed)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t55 +partition by list(colint) +subpartition by hash(cast(mod(col1,10) as signed)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t66 +partition by range(colint) +(partition p0 values less than (cast(mod(15,10) as signed)), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +15.0000 +19.0000 +select * from t22 order by col1; +col1 +15.0000 +17.0000 +19.0000 +select * from t33 order by col1; +col1 +15.0000 +17.0000 +19.0000 +select * from t44 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t55 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t66 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +15.0000 +19.0000 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +15.0000 +19.0000 +alter table t55 +partition by list(colint) +subpartition by hash(cast(mod(col1,10) as signed)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` float(7,4) DEFAULT NULL +) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (cast(mod(col1,10) as signed)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */ +select * from t55 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (cast(mod(15,10) as signed)), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (cast(mod(15,10) as signed)), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with cast(mod(col1,10) as signed) +------------------------------------------------------------------------- +delete from t1 where col1=19; +delete from t2 where col1=19; +delete from t3 where col1=19; +delete from t4 where col1=19; +delete from t5 where col1=19; +delete from t6 where col1=19; +select * from t1 order by col1; +col1 +15.0000 +select * from t2 order by col1; +col1 +15.0000 +17.0000 +select * from t3 order by col1; +col1 +15.0000 +17.0000 +select * from t4 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t5 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +insert into t1 values (19); +insert into t2 values (19); +insert into t3 values (19); +insert into t4 values (60,19); +insert into t5 values (60,19); +insert into t6 values (60,19); +select * from t1 order by col1; +col1 +15.0000 +19.0000 +select * from t2 order by col1; +col1 +15.0000 +17.0000 +19.0000 +select * from t3 order by col1; +col1 +15.0000 +17.0000 +19.0000 +select * from t4 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +60 19.0000 +select * from t5 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +60 19.0000 +select * from t6 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +60 19.0000 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +select * from t2 order by col1; +col1 +select * from t3 order by col1; +col1 +15.0000 +17.0000 +19.0000 +select * from t4 order by colint; +colint col1 +60 19.0000 +select * from t5 order by colint; +colint col1 +60 19.0000 +select * from t6 order by colint; +colint col1 +60 19.0000 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with cast(mod(col1,10) as signed) +------------------------------------------------------------------------- +delete from t11 where col1=19; +delete from t22 where col1=19; +delete from t33 where col1=19; +delete from t44 where col1=19; +delete from t55 where col1=19; +delete from t66 where col1=19; +select * from t11 order by col1; +col1 +15.0000 +select * from t22 order by col1; +col1 +15.0000 +17.0000 +select * from t33 order by col1; +col1 +15.0000 +17.0000 +select * from t44 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +select * from t55 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +insert into t11 values (19); +insert into t22 values (19); +insert into t33 values (19); +insert into t44 values (60,19); +insert into t55 values (60,19); +insert into t66 values (60,19); +select * from t11 order by col1; +col1 +15.0000 +19.0000 +select * from t22 order by col1; +col1 +15.0000 +17.0000 +19.0000 +select * from t33 order by col1; +col1 +15.0000 +17.0000 +19.0000 +select * from t44 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +60 19.0000 +select * from t55 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +60 19.0000 +select * from t66 order by colint; +colint col1 +1 5.1230 +2 13.3450 +3 17.9870 +4 15.6540 +60 19.0000 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +select * from t22 order by col1; +col1 +select * from t33 order by col1; +col1 +15.0000 +17.0000 +19.0000 +select * from t44 order by colint; +colint col1 +60 19.0000 +select * from t55 order by colint; +colint col1 +60 19.0000 +select * from t66 order by colint; +colint col1 +60 19.0000 +------------------------- +---- some alter table end +------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +------------------------------------------------------------------------- +--- ord(col1) in partition with coltype char(3) +------------------------------------------------------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +------------------------------------------------------------------------- +--- Create tables with ord(col1) +------------------------------------------------------------------------- +create table t1 (col1 char(3)) engine='NDB' +partition by range(ord(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t2 (col1 char(3)) engine='NDB' +partition by list(ord(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t3 (col1 char(3)) engine='NDB' +partition by hash(ord(col1)); +create table t4 (colint int, col1 char(3)) engine='NDB' +partition by range(colint) +subpartition by hash(ord(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t5 (colint int, col1 char(3)) engine='NDB' +partition by list(colint) +subpartition by hash(ord(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t6 (colint int, col1 char(3)) engine='NDB' +partition by range(colint) +(partition p0 values less than (ord('a')), +partition p1 values less than maxvalue); +------------------------------------------------------------------------- +--- Access tables with ord(col1) +------------------------------------------------------------------------- +insert into t1 values ('1'); +insert into t1 values ('9'); +insert into t2 values ('1'); +insert into t2 values ('9'); +insert into t2 values ('3'); +insert into t3 values ('1'); +insert into t3 values ('9'); +insert into t3 values ('3'); +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t6; +select ord(col1) from t1 order by col1; +ord(col1) +49 +57 +select * from t1 order by col1; +col1 +1 +9 +select * from t2 order by col1; +col1 +1 +3 +9 +select * from t3 order by col1; +col1 +1 +3 +9 +select * from t4 order by colint; +colint col1 +1 1 +2 9 +3 3 +4 8 +select * from t5 order by colint; +colint col1 +1 1 +2 9 +3 3 +4 8 +select * from t6 order by colint; +colint col1 +1 1 +2 9 +3 3 +4 8 +update t1 set col1='8' where col1='1'; +update t2 set col1='8' where col1='1'; +update t3 set col1='8' where col1='1'; +update t4 set col1='8' where col1='1'; +update t5 set col1='8' where col1='1'; +update t6 set col1='8' where col1='1'; +select * from t1 order by col1; +col1 +8 +9 +select * from t2 order by col1; +col1 +3 +8 +9 +select * from t3 order by col1; +col1 +3 +8 +9 +select * from t4 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +select * from t5 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +select * from t6 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +------------------------------------------------------------------------- +--- Alter tables with ord(col1) +------------------------------------------------------------------------- +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +create table t11 engine='NDB' as select * from t1; +create table t22 engine='NDB' as select * from t2; +create table t33 engine='NDB' as select * from t3; +create table t44 engine='NDB' as select * from t4; +create table t55 engine='NDB' as select * from t5; +create table t66 engine='NDB' as select * from t6; +alter table t11 +partition by range(ord(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t22 +partition by list(ord(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t33 +partition by hash(ord(col1)); +alter table t44 +partition by range(colint) +subpartition by hash(ord(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t55 +partition by list(colint) +subpartition by hash(ord(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t66 +partition by range(colint) +(partition p0 values less than (ord('a')), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +8 +9 +select * from t22 order by col1; +col1 +3 +8 +9 +select * from t33 order by col1; +col1 +3 +8 +9 +select * from t44 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +select * from t55 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +select * from t66 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +8 +9 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +8 +9 +alter table t55 +partition by list(colint) +subpartition by hash(ord(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` char(3) DEFAULT NULL +) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (ord(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */ +select * from t55 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (ord('a')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (ord('a')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 8 +2 9 +3 3 +4 8 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with ord(col1) +------------------------------------------------------------------------- +delete from t1 where col1='9'; +delete from t2 where col1='9'; +delete from t3 where col1='9'; +delete from t4 where col1='9'; +delete from t5 where col1='9'; +delete from t6 where col1='9'; +select * from t1 order by col1; +col1 +8 +select * from t2 order by col1; +col1 +3 +8 +select * from t3 order by col1; +col1 +3 +8 +select * from t4 order by colint; +colint col1 +1 8 +3 3 +4 8 +select * from t5 order by colint; +colint col1 +1 8 +3 3 +4 8 +insert into t1 values ('9'); +insert into t2 values ('9'); +insert into t3 values ('9'); +insert into t4 values (60,'9'); +insert into t5 values (60,'9'); +insert into t6 values (60,'9'); +select * from t1 order by col1; +col1 +8 +9 +select * from t2 order by col1; +col1 +3 +8 +9 +select * from t3 order by col1; +col1 +3 +8 +9 +select * from t4 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +select * from t5 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +select * from t6 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +8 +9 +select * from t2 order by col1; +col1 +3 +8 +9 +select * from t3 order by col1; +col1 +3 +8 +9 +select * from t4 order by colint; +colint col1 +60 9 +select * from t5 order by colint; +colint col1 +60 9 +select * from t6 order by colint; +colint col1 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with ord(col1) +------------------------------------------------------------------------- +delete from t11 where col1='9'; +delete from t22 where col1='9'; +delete from t33 where col1='9'; +delete from t44 where col1='9'; +delete from t55 where col1='9'; +delete from t66 where col1='9'; +select * from t11 order by col1; +col1 +8 +select * from t22 order by col1; +col1 +3 +8 +select * from t33 order by col1; +col1 +3 +8 +select * from t44 order by colint; +colint col1 +1 8 +3 3 +4 8 +select * from t55 order by colint; +colint col1 +1 8 +3 3 +4 8 +insert into t11 values ('9'); +insert into t22 values ('9'); +insert into t33 values ('9'); +insert into t44 values (60,'9'); +insert into t55 values (60,'9'); +insert into t66 values (60,'9'); +select * from t11 order by col1; +col1 +8 +9 +select * from t22 order by col1; +col1 +3 +8 +9 +select * from t33 order by col1; +col1 +3 +8 +9 +select * from t44 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +select * from t55 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +select * from t66 order by colint; +colint col1 +1 8 +3 3 +4 8 +60 9 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +8 +9 +select * from t22 order by col1; +col1 +3 +8 +9 +select * from t33 order by col1; +col1 +3 +8 +9 +select * from t44 order by colint; +colint col1 +60 9 +select * from t55 order by colint; +colint col1 +60 9 +select * from t66 order by colint; +colint col1 +------------------------- +---- some alter table end +------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +------------------------------------------------------------------------- +--- day(col1) in partition with coltype date +------------------------------------------------------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +------------------------------------------------------------------------- +--- Create tables with day(col1) +------------------------------------------------------------------------- +create table t1 (col1 date) engine='NDB' +partition by range(day(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t2 (col1 date) engine='NDB' +partition by list(day(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t3 (col1 date) engine='NDB' +partition by hash(day(col1)); +create table t4 (colint int, col1 date) engine='NDB' +partition by range(colint) +subpartition by hash(day(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t5 (colint int, col1 date) engine='NDB' +partition by list(colint) +subpartition by hash(day(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t6 (colint int, col1 date) engine='NDB' +partition by range(colint) +(partition p0 values less than (day('2006-12-21')), +partition p1 values less than maxvalue); +------------------------------------------------------------------------- +--- Access tables with day(col1) +------------------------------------------------------------------------- +insert into t1 values ('2006-02-03'); +insert into t1 values ('2006-01-17'); +insert into t2 values ('2006-02-03'); +insert into t2 values ('2006-01-17'); +insert into t2 values ('2006-01-25'); +insert into t3 values ('2006-02-03'); +insert into t3 values ('2006-01-17'); +insert into t3 values ('2006-01-25'); +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select day(col1) from t1 order by col1; +day(col1) +17 +3 +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-03 +select * from t2 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-03 +select * from t3 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-03 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-02-05' where col1='2006-02-03'; +update t2 set col1='2006-02-05' where col1='2006-02-03'; +update t3 set col1='2006-02-05' where col1='2006-02-03'; +update t4 set col1='2006-02-05' where col1='2006-02-03'; +update t5 set col1='2006-02-05' where col1='2006-02-03'; +update t6 set col1='2006-02-05' where col1='2006-02-03'; +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t3 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t4 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Alter tables with day(col1) +------------------------------------------------------------------------- +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +create table t11 engine='NDB' as select * from t1; +create table t22 engine='NDB' as select * from t2; +create table t33 engine='NDB' as select * from t3; +create table t44 engine='NDB' as select * from t4; +create table t55 engine='NDB' as select * from t5; +create table t66 engine='NDB' as select * from t6; +alter table t11 +partition by range(day(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t22 +partition by list(day(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t33 +partition by hash(day(col1)); +alter table t44 +partition by range(colint) +subpartition by hash(day(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t55 +partition by list(colint) +subpartition by hash(day(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t66 +partition by range(colint) +(partition p0 values less than (day('2006-12-21')), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t33 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t44 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +alter table t55 +partition by list(colint) +subpartition by hash(day(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (day(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */ +select * from t55 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (day('2006-12-21')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (day('2006-12-21')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with day(col1) +------------------------------------------------------------------------- +delete from t1 where col1='2006-01-17'; +delete from t2 where col1='2006-01-17'; +delete from t3 where col1='2006-01-17'; +delete from t4 where col1='2006-01-17'; +delete from t5 where col1='2006-01-17'; +delete from t6 where col1='2006-01-17'; +select * from t1 order by col1; +col1 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t4 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-01-17'); +insert into t2 values ('2006-01-17'); +insert into t3 values ('2006-01-17'); +insert into t4 values (60,'2006-01-17'); +insert into t5 values (60,'2006-01-17'); +insert into t6 values (60,'2006-01-17'); +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t3 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t4 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t5 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t6 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +2006-01-17 +select * from t2 order by col1; +col1 +2006-01-17 +2006-01-25 +select * from t3 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t4 order by colint; +colint col1 +60 2006-01-17 +select * from t5 order by colint; +colint col1 +60 2006-01-17 +select * from t6 order by colint; +colint col1 +60 2006-01-17 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with day(col1) +------------------------------------------------------------------------- +delete from t11 where col1='2006-01-17'; +delete from t22 where col1='2006-01-17'; +delete from t33 where col1='2006-01-17'; +delete from t44 where col1='2006-01-17'; +delete from t55 where col1='2006-01-17'; +delete from t66 where col1='2006-01-17'; +select * from t11 order by col1; +col1 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t33 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t44 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-01-17'); +insert into t22 values ('2006-01-17'); +insert into t33 values ('2006-01-17'); +insert into t44 values (60,'2006-01-17'); +insert into t55 values (60,'2006-01-17'); +insert into t66 values (60,'2006-01-17'); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t33 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t44 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t55 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t66 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +2006-01-17 +select * from t22 order by col1; +col1 +2006-01-17 +2006-01-25 +select * from t33 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t44 order by colint; +colint col1 +60 2006-01-17 +select * from t55 order by colint; +colint col1 +60 2006-01-17 +select * from t66 order by colint; +colint col1 +60 2006-01-17 +------------------------- +---- some alter table end +------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +------------------------------------------------------------------------- +--- dayofmonth(col1) in partition with coltype date +------------------------------------------------------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +------------------------------------------------------------------------- +--- Create tables with dayofmonth(col1) +------------------------------------------------------------------------- +create table t1 (col1 date) engine='NDB' +partition by range(dayofmonth(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t2 (col1 date) engine='NDB' +partition by list(dayofmonth(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t3 (col1 date) engine='NDB' +partition by hash(dayofmonth(col1)); +create table t4 (colint int, col1 date) engine='NDB' +partition by range(colint) +subpartition by hash(dayofmonth(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t5 (colint int, col1 date) engine='NDB' +partition by list(colint) +subpartition by hash(dayofmonth(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t6 (colint int, col1 date) engine='NDB' +partition by range(colint) +(partition p0 values less than (dayofmonth('2006-12-24')), +partition p1 values less than maxvalue); +------------------------------------------------------------------------- +--- Access tables with dayofmonth(col1) +------------------------------------------------------------------------- +insert into t1 values ('2006-02-03'); +insert into t1 values ('2006-01-17'); +insert into t2 values ('2006-02-03'); +insert into t2 values ('2006-01-17'); +insert into t2 values ('2006-01-25'); +insert into t3 values ('2006-02-03'); +insert into t3 values ('2006-01-17'); +insert into t3 values ('2006-01-25'); +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select dayofmonth(col1) from t1 order by col1; +dayofmonth(col1) +17 +3 +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-03 +select * from t2 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-03 +select * from t3 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-03 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-02-05' where col1='2006-02-03'; +update t2 set col1='2006-02-05' where col1='2006-02-03'; +update t3 set col1='2006-02-05' where col1='2006-02-03'; +update t4 set col1='2006-02-05' where col1='2006-02-03'; +update t5 set col1='2006-02-05' where col1='2006-02-03'; +update t6 set col1='2006-02-05' where col1='2006-02-03'; +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t3 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t4 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Alter tables with dayofmonth(col1) +------------------------------------------------------------------------- +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +create table t11 engine='NDB' as select * from t1; +create table t22 engine='NDB' as select * from t2; +create table t33 engine='NDB' as select * from t3; +create table t44 engine='NDB' as select * from t4; +create table t55 engine='NDB' as select * from t5; +create table t66 engine='NDB' as select * from t6; +alter table t11 +partition by range(dayofmonth(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t22 +partition by list(dayofmonth(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t33 +partition by hash(dayofmonth(col1)); +alter table t44 +partition by range(colint) +subpartition by hash(dayofmonth(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t55 +partition by list(colint) +subpartition by hash(dayofmonth(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t66 +partition by range(colint) +(partition p0 values less than (dayofmonth('2006-12-24')), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t33 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t44 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +alter table t55 +partition by list(colint) +subpartition by hash(dayofmonth(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofmonth(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */ +select * from t55 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (dayofmonth('2006-12-24')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (dayofmonth('2006-12-24')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-05 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with dayofmonth(col1) +------------------------------------------------------------------------- +delete from t1 where col1='2006-01-17'; +delete from t2 where col1='2006-01-17'; +delete from t3 where col1='2006-01-17'; +delete from t4 where col1='2006-01-17'; +delete from t5 where col1='2006-01-17'; +delete from t6 where col1='2006-01-17'; +select * from t1 order by col1; +col1 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t4 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-01-17'); +insert into t2 values ('2006-01-17'); +insert into t3 values ('2006-01-17'); +insert into t4 values (60,'2006-01-17'); +insert into t5 values (60,'2006-01-17'); +insert into t6 values (60,'2006-01-17'); +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t3 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t4 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t5 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t6 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +2006-01-17 +select * from t2 order by col1; +col1 +2006-01-17 +2006-01-25 +select * from t3 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t4 order by colint; +colint col1 +60 2006-01-17 +select * from t5 order by colint; +colint col1 +60 2006-01-17 +select * from t6 order by colint; +colint col1 +60 2006-01-17 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with dayofmonth(col1) +------------------------------------------------------------------------- +delete from t11 where col1='2006-01-17'; +delete from t22 where col1='2006-01-17'; +delete from t33 where col1='2006-01-17'; +delete from t44 where col1='2006-01-17'; +delete from t55 where col1='2006-01-17'; +delete from t66 where col1='2006-01-17'; +select * from t11 order by col1; +col1 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t33 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t44 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-01-17'); +insert into t22 values ('2006-01-17'); +insert into t33 values ('2006-01-17'); +insert into t44 values (60,'2006-01-17'); +insert into t55 values (60,'2006-01-17'); +insert into t66 values (60,'2006-01-17'); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t33 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t44 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t55 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t66 order by colint; +colint col1 +1 2006-02-05 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +2006-01-17 +select * from t22 order by col1; +col1 +2006-01-17 +2006-01-25 +select * from t33 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-05 +select * from t44 order by colint; +colint col1 +60 2006-01-17 +select * from t55 order by colint; +colint col1 +60 2006-01-17 +select * from t66 order by colint; +colint col1 +60 2006-01-17 +------------------------- +---- some alter table end +------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +------------------------------------------------------------------------- +--- dayofweek(col1) in partition with coltype date +------------------------------------------------------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +------------------------------------------------------------------------- +--- Create tables with dayofweek(col1) +------------------------------------------------------------------------- +create table t1 (col1 date) engine='NDB' +partition by range(dayofweek(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t2 (col1 date) engine='NDB' +partition by list(dayofweek(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t3 (col1 date) engine='NDB' +partition by hash(dayofweek(col1)); +create table t4 (colint int, col1 date) engine='NDB' +partition by range(colint) +subpartition by hash(dayofweek(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t5 (colint int, col1 date) engine='NDB' +partition by list(colint) +subpartition by hash(dayofweek(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t6 (colint int, col1 date) engine='NDB' +partition by range(colint) +(partition p0 values less than (dayofweek('2006-12-24')), +partition p1 values less than maxvalue); +------------------------------------------------------------------------- +--- Access tables with dayofweek(col1) +------------------------------------------------------------------------- +insert into t1 values ('2006-01-03'); +insert into t1 values ('2006-02-17'); +insert into t2 values ('2006-01-03'); +insert into t2 values ('2006-02-17'); +insert into t2 values ('2006-01-25'); +insert into t3 values ('2006-01-03'); +insert into t3 values ('2006-02-17'); +insert into t3 values ('2006-01-25'); +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select dayofweek(col1) from t1 order by col1; +dayofweek(col1) +3 +6 +select * from t1 order by col1; +col1 +2006-01-03 +2006-02-17 +select * from t2 order by col1; +col1 +2006-01-03 +2006-01-25 +2006-02-17 +select * from t3 order by col1; +col1 +2006-01-03 +2006-01-25 +2006-02-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-02-05' where col1='2006-01-03'; +update t2 set col1='2006-02-05' where col1='2006-01-03'; +update t3 set col1='2006-02-05' where col1='2006-01-03'; +update t4 set col1='2006-02-05' where col1='2006-01-03'; +update t5 set col1='2006-02-05' where col1='2006-01-03'; +update t6 set col1='2006-02-05' where col1='2006-01-03'; +select * from t1 order by col1; +col1 +2006-02-05 +2006-02-17 +select * from t2 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Alter tables with dayofweek(col1) +------------------------------------------------------------------------- +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +create table t11 engine='NDB' as select * from t1; +create table t22 engine='NDB' as select * from t2; +create table t33 engine='NDB' as select * from t3; +create table t44 engine='NDB' as select * from t4; +create table t55 engine='NDB' as select * from t5; +create table t66 engine='NDB' as select * from t6; +alter table t11 +partition by range(dayofweek(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t22 +partition by list(dayofweek(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t33 +partition by hash(dayofweek(col1)); +alter table t44 +partition by range(colint) +subpartition by hash(dayofweek(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t55 +partition by list(colint) +subpartition by hash(dayofweek(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t66 +partition by range(colint) +(partition p0 values less than (dayofweek('2006-12-24')), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-02-05 +2006-02-17 +select * from t22 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t33 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-02-05 +2006-02-17 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-02-05 +2006-02-17 +alter table t55 +partition by list(colint) +subpartition by hash(dayofweek(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofweek(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */ +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (dayofweek('2006-12-24')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (dayofweek('2006-12-24')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with dayofweek(col1) +------------------------------------------------------------------------- +delete from t1 where col1='2006-02-17'; +delete from t2 where col1='2006-02-17'; +delete from t3 where col1='2006-02-17'; +delete from t4 where col1='2006-02-17'; +delete from t5 where col1='2006-02-17'; +delete from t6 where col1='2006-02-17'; +select * from t1 order by col1; +col1 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-02-17'); +insert into t2 values ('2006-02-17'); +insert into t3 values ('2006-02-17'); +insert into t4 values (60,'2006-02-17'); +insert into t5 values (60,'2006-02-17'); +insert into t6 values (60,'2006-02-17'); +select * from t1 order by col1; +col1 +2006-02-05 +2006-02-17 +select * from t2 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +select * from t2 order by col1; +col1 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t4 order by colint; +colint col1 +60 2006-02-17 +select * from t5 order by colint; +colint col1 +60 2006-02-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with dayofweek(col1) +------------------------------------------------------------------------- +delete from t11 where col1='2006-02-17'; +delete from t22 where col1='2006-02-17'; +delete from t33 where col1='2006-02-17'; +delete from t44 where col1='2006-02-17'; +delete from t55 where col1='2006-02-17'; +delete from t66 where col1='2006-02-17'; +select * from t11 order by col1; +col1 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t33 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-02-17'); +insert into t22 values ('2006-02-17'); +insert into t33 values ('2006-02-17'); +insert into t44 values (60,'2006-02-17'); +insert into t55 values (60,'2006-02-17'); +insert into t66 values (60,'2006-02-17'); +select * from t11 order by col1; +col1 +2006-02-05 +2006-02-17 +select * from t22 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t33 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +select * from t22 order by col1; +col1 +select * from t33 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t44 order by colint; +colint col1 +60 2006-02-17 +select * from t55 order by colint; +colint col1 +60 2006-02-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +------------------------- +---- some alter table end +------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +------------------------------------------------------------------------- +--- dayofyear(col1) in partition with coltype date +------------------------------------------------------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +------------------------------------------------------------------------- +--- Create tables with dayofyear(col1) +------------------------------------------------------------------------- +create table t1 (col1 date) engine='NDB' +partition by range(dayofyear(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t2 (col1 date) engine='NDB' +partition by list(dayofyear(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t3 (col1 date) engine='NDB' +partition by hash(dayofyear(col1)); +create table t4 (colint int, col1 date) engine='NDB' +partition by range(colint) +subpartition by hash(dayofyear(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t5 (colint int, col1 date) engine='NDB' +partition by list(colint) +subpartition by hash(dayofyear(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t6 (colint int, col1 date) engine='NDB' +partition by range(colint) +(partition p0 values less than (dayofyear('2006-12-25')), +partition p1 values less than maxvalue); +------------------------------------------------------------------------- +--- Access tables with dayofyear(col1) +------------------------------------------------------------------------- +insert into t1 values ('2006-01-03'); +insert into t1 values ('2006-01-17'); +insert into t2 values ('2006-01-03'); +insert into t2 values ('2006-01-17'); +insert into t2 values ('2006-02-25'); +insert into t3 values ('2006-01-03'); +insert into t3 values ('2006-01-17'); +insert into t3 values ('2006-02-25'); +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select dayofyear(col1) from t1 order by col1; +dayofyear(col1) +3 +17 +select * from t1 order by col1; +col1 +2006-01-03 +2006-01-17 +select * from t2 order by col1; +col1 +2006-01-03 +2006-01-17 +2006-02-25 +select * from t3 order by col1; +col1 +2006-01-03 +2006-01-17 +2006-02-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-02-05' where col1='2006-01-03'; +update t2 set col1='2006-02-05' where col1='2006-01-03'; +update t3 set col1='2006-02-05' where col1='2006-01-03'; +update t4 set col1='2006-02-05' where col1='2006-01-03'; +update t5 set col1='2006-02-05' where col1='2006-01-03'; +update t6 set col1='2006-02-05' where col1='2006-01-03'; +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t3 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Alter tables with dayofyear(col1) +------------------------------------------------------------------------- +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +create table t11 engine='NDB' as select * from t1; +create table t22 engine='NDB' as select * from t2; +create table t33 engine='NDB' as select * from t3; +create table t44 engine='NDB' as select * from t4; +create table t55 engine='NDB' as select * from t5; +create table t66 engine='NDB' as select * from t6; +alter table t11 +partition by range(dayofyear(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t22 +partition by list(dayofyear(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t33 +partition by hash(dayofyear(col1)); +alter table t44 +partition by range(colint) +subpartition by hash(dayofyear(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t55 +partition by list(colint) +subpartition by hash(dayofyear(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t66 +partition by range(colint) +(partition p0 values less than (dayofyear('2006-12-25')), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t33 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +alter table t55 +partition by list(colint) +subpartition by hash(dayofyear(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */ +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (dayofyear('2006-12-25')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (dayofyear('2006-12-25')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with dayofyear(col1) +------------------------------------------------------------------------- +delete from t1 where col1='2006-01-17'; +delete from t2 where col1='2006-01-17'; +delete from t3 where col1='2006-01-17'; +delete from t4 where col1='2006-01-17'; +delete from t5 where col1='2006-01-17'; +delete from t6 where col1='2006-01-17'; +select * from t1 order by col1; +col1 +2006-02-05 +select * from t2 order by col1; +col1 +2006-02-05 +2006-02-25 +select * from t3 order by col1; +col1 +2006-02-05 +2006-02-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-01-17'); +insert into t2 values ('2006-01-17'); +insert into t3 values ('2006-01-17'); +insert into t4 values (60,'2006-01-17'); +insert into t5 values (60,'2006-01-17'); +insert into t6 values (60,'2006-01-17'); +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t3 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t3 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t4 order by colint; +colint col1 +60 2006-01-17 +select * from t5 order by colint; +colint col1 +60 2006-01-17 +select * from t6 order by colint; +colint col1 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with dayofyear(col1) +------------------------------------------------------------------------- +delete from t11 where col1='2006-01-17'; +delete from t22 where col1='2006-01-17'; +delete from t33 where col1='2006-01-17'; +delete from t44 where col1='2006-01-17'; +delete from t55 where col1='2006-01-17'; +delete from t66 where col1='2006-01-17'; +select * from t11 order by col1; +col1 +2006-02-05 +select * from t22 order by col1; +col1 +2006-02-05 +2006-02-25 +select * from t33 order by col1; +col1 +2006-02-05 +2006-02-25 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-01-17'); +insert into t22 values ('2006-01-17'); +insert into t33 values ('2006-01-17'); +insert into t44 values (60,'2006-01-17'); +insert into t55 values (60,'2006-01-17'); +insert into t66 values (60,'2006-01-17'); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t33 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t33 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t44 order by colint; +colint col1 +60 2006-01-17 +select * from t55 order by colint; +colint col1 +60 2006-01-17 +select * from t66 order by colint; +colint col1 +------------------------- +---- some alter table end +------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +------------------------------------------------------------------------- +--- dayofyear(col1) in partition with coltype char(30) +------------------------------------------------------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +------------------------------------------------------------------------- +--- Create tables with dayofyear(col1) +------------------------------------------------------------------------- +create table t1 (col1 char(30)) engine='NDB' +partition by range(dayofyear(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t2 (col1 char(30)) engine='NDB' +partition by list(dayofyear(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t3 (col1 char(30)) engine='NDB' +partition by hash(dayofyear(col1)); +create table t4 (colint int, col1 char(30)) engine='NDB' +partition by range(colint) +subpartition by hash(dayofyear(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t5 (colint int, col1 char(30)) engine='NDB' +partition by list(colint) +subpartition by hash(dayofyear(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t6 (colint int, col1 char(30)) engine='NDB' +partition by range(colint) +(partition p0 values less than (dayofyear('2006-12-25')), +partition p1 values less than maxvalue); +------------------------------------------------------------------------- +--- Access tables with dayofyear(col1) +------------------------------------------------------------------------- +insert into t1 values ('2006-01-03'); +insert into t1 values ('2006-01-17'); +insert into t2 values ('2006-01-03'); +insert into t2 values ('2006-01-17'); +insert into t2 values ('2006-02-25'); +insert into t3 values ('2006-01-03'); +insert into t3 values ('2006-01-17'); +insert into t3 values ('2006-02-25'); +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select dayofyear(col1) from t1 order by col1; +dayofyear(col1) +3 +17 +select * from t1 order by col1; +col1 +2006-01-03 +2006-01-17 +select * from t2 order by col1; +col1 +2006-01-03 +2006-01-17 +2006-02-25 +select * from t3 order by col1; +col1 +2006-01-03 +2006-01-17 +2006-02-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-02-05' where col1='2006-01-03'; +update t2 set col1='2006-02-05' where col1='2006-01-03'; +update t3 set col1='2006-02-05' where col1='2006-01-03'; +update t4 set col1='2006-02-05' where col1='2006-01-03'; +update t5 set col1='2006-02-05' where col1='2006-01-03'; +update t6 set col1='2006-02-05' where col1='2006-01-03'; +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t3 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Alter tables with dayofyear(col1) +------------------------------------------------------------------------- +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +create table t11 engine='NDB' as select * from t1; +create table t22 engine='NDB' as select * from t2; +create table t33 engine='NDB' as select * from t3; +create table t44 engine='NDB' as select * from t4; +create table t55 engine='NDB' as select * from t5; +create table t66 engine='NDB' as select * from t6; +alter table t11 +partition by range(dayofyear(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t22 +partition by list(dayofyear(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t33 +partition by hash(dayofyear(col1)); +alter table t44 +partition by range(colint) +subpartition by hash(dayofyear(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t55 +partition by list(colint) +subpartition by hash(dayofyear(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t66 +partition by range(colint) +(partition p0 values less than (dayofyear('2006-12-25')), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t33 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +alter table t55 +partition by list(colint) +subpartition by hash(dayofyear(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` char(30) DEFAULT NULL +) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */ +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (dayofyear('2006-12-25')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (dayofyear('2006-12-25')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with dayofyear(col1) +------------------------------------------------------------------------- +delete from t1 where col1='2006-01-17'; +delete from t2 where col1='2006-01-17'; +delete from t3 where col1='2006-01-17'; +delete from t4 where col1='2006-01-17'; +delete from t5 where col1='2006-01-17'; +delete from t6 where col1='2006-01-17'; +select * from t1 order by col1; +col1 +2006-02-05 +select * from t2 order by col1; +col1 +2006-02-05 +2006-02-25 +select * from t3 order by col1; +col1 +2006-02-05 +2006-02-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-01-17'); +insert into t2 values ('2006-01-17'); +insert into t3 values ('2006-01-17'); +insert into t4 values (60,'2006-01-17'); +insert into t5 values (60,'2006-01-17'); +insert into t6 values (60,'2006-01-17'); +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t3 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t3 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t4 order by colint; +colint col1 +60 2006-01-17 +select * from t5 order by colint; +colint col1 +60 2006-01-17 +select * from t6 order by colint; +colint col1 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with dayofyear(col1) +------------------------------------------------------------------------- +delete from t11 where col1='2006-01-17'; +delete from t22 where col1='2006-01-17'; +delete from t33 where col1='2006-01-17'; +delete from t44 where col1='2006-01-17'; +delete from t55 where col1='2006-01-17'; +delete from t66 where col1='2006-01-17'; +select * from t11 order by col1; +col1 +2006-02-05 +select * from t22 order by col1; +col1 +2006-02-05 +2006-02-25 +select * from t33 order by col1; +col1 +2006-02-05 +2006-02-25 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-01-17'); +insert into t22 values ('2006-01-17'); +insert into t33 values ('2006-01-17'); +insert into t44 values (60,'2006-01-17'); +insert into t55 values (60,'2006-01-17'); +insert into t66 values (60,'2006-01-17'); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t33 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t33 order by col1; +col1 +2006-01-17 +2006-02-05 +2006-02-25 +select * from t44 order by colint; +colint col1 +60 2006-01-17 +select * from t55 order by colint; +colint col1 +60 2006-01-17 +select * from t66 order by colint; +colint col1 +------------------------- +---- some alter table end +------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +------------------------------------------------------------------------- +--- extract(month from col1) in partition with coltype date +------------------------------------------------------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +------------------------------------------------------------------------- +--- Create tables with extract(month from col1) +------------------------------------------------------------------------- +create table t1 (col1 date) engine='NDB' +partition by range(extract(month from col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t2 (col1 date) engine='NDB' +partition by list(extract(month from col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t3 (col1 date) engine='NDB' +partition by hash(extract(month from col1)); +create table t4 (colint int, col1 date) engine='NDB' +partition by range(colint) +subpartition by hash(extract(month from col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t5 (colint int, col1 date) engine='NDB' +partition by list(colint) +subpartition by hash(extract(month from col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t6 (colint int, col1 date) engine='NDB' +partition by range(colint) +(partition p0 values less than (extract(year from '1998-11-23')), +partition p1 values less than maxvalue); +------------------------------------------------------------------------- +--- Access tables with extract(month from col1) +------------------------------------------------------------------------- +insert into t1 values ('2006-01-03'); +insert into t1 values ('2006-02-17'); +insert into t2 values ('2006-01-03'); +insert into t2 values ('2006-02-17'); +insert into t2 values ('2006-01-25'); +insert into t3 values ('2006-01-03'); +insert into t3 values ('2006-02-17'); +insert into t3 values ('2006-01-25'); +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select extract(month from col1) from t1 order by col1; +extract(month from col1) +1 +2 +select * from t1 order by col1; +col1 +2006-01-03 +2006-02-17 +select * from t2 order by col1; +col1 +2006-01-03 +2006-01-25 +2006-02-17 +select * from t3 order by col1; +col1 +2006-01-03 +2006-01-25 +2006-02-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-02-05' where col1='2006-01-03'; +update t2 set col1='2006-02-05' where col1='2006-01-03'; +update t3 set col1='2006-02-05' where col1='2006-01-03'; +update t4 set col1='2006-02-05' where col1='2006-01-03'; +update t5 set col1='2006-02-05' where col1='2006-01-03'; +update t6 set col1='2006-02-05' where col1='2006-01-03'; +select * from t1 order by col1; +col1 +2006-02-05 +2006-02-17 +select * from t2 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Alter tables with extract(month from col1) +------------------------------------------------------------------------- +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +create table t11 engine='NDB' as select * from t1; +create table t22 engine='NDB' as select * from t2; +create table t33 engine='NDB' as select * from t3; +create table t44 engine='NDB' as select * from t4; +create table t55 engine='NDB' as select * from t5; +create table t66 engine='NDB' as select * from t6; +alter table t11 +partition by range(extract(month from col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t22 +partition by list(extract(month from col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t33 +partition by hash(extract(month from col1)); +alter table t44 +partition by range(colint) +subpartition by hash(extract(month from col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t55 +partition by list(colint) +subpartition by hash(extract(month from col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t66 +partition by range(colint) +(partition p0 values less than (extract(year from '1998-11-23')), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-02-05 +2006-02-17 +select * from t22 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t33 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-02-05 +2006-02-17 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-02-05 +2006-02-17 +alter table t55 +partition by list(colint) +subpartition by hash(extract(month from col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (extract(month from col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */ +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (extract(year from '1998-11-23')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (extract(year from '1998-11-23')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with extract(month from col1) +------------------------------------------------------------------------- +delete from t1 where col1='2006-02-17'; +delete from t2 where col1='2006-02-17'; +delete from t3 where col1='2006-02-17'; +delete from t4 where col1='2006-02-17'; +delete from t5 where col1='2006-02-17'; +delete from t6 where col1='2006-02-17'; +select * from t1 order by col1; +col1 +2006-02-05 +select * from t2 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-02-17'); +insert into t2 values ('2006-02-17'); +insert into t3 values ('2006-02-17'); +insert into t4 values (60,'2006-02-17'); +insert into t5 values (60,'2006-02-17'); +insert into t6 values (60,'2006-02-17'); +select * from t1 order by col1; +col1 +2006-02-05 +2006-02-17 +select * from t2 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +select * from t2 order by col1; +col1 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t4 order by colint; +colint col1 +60 2006-02-17 +select * from t5 order by colint; +colint col1 +60 2006-02-17 +select * from t6 order by colint; +colint col1 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with extract(month from col1) +------------------------------------------------------------------------- +delete from t11 where col1='2006-02-17'; +delete from t22 where col1='2006-02-17'; +delete from t33 where col1='2006-02-17'; +delete from t44 where col1='2006-02-17'; +delete from t55 where col1='2006-02-17'; +delete from t66 where col1='2006-02-17'; +select * from t11 order by col1; +col1 +2006-02-05 +select * from t22 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t33 order by col1; +col1 +2006-01-25 +2006-02-05 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-02-17'); +insert into t22 values ('2006-02-17'); +insert into t33 values ('2006-02-17'); +insert into t44 values (60,'2006-02-17'); +insert into t55 values (60,'2006-02-17'); +insert into t66 values (60,'2006-02-17'); +select * from t11 order by col1; +col1 +2006-02-05 +2006-02-17 +select * from t22 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t33 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-02-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +select * from t22 order by col1; +col1 +select * from t33 order by col1; +col1 +2006-01-25 +2006-02-05 +2006-02-17 +select * from t44 order by colint; +colint col1 +60 2006-02-17 +select * from t55 order by colint; +colint col1 +60 2006-02-17 +select * from t66 order by colint; +colint col1 +------------------------- +---- some alter table end +------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +------------------------------------------------------------------------- +--- hour(col1) in partition with coltype time +------------------------------------------------------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +------------------------------------------------------------------------- +--- Create tables with hour(col1) +------------------------------------------------------------------------- +create table t1 (col1 time) engine='NDB' +partition by range(hour(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t2 (col1 time) engine='NDB' +partition by list(hour(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t3 (col1 time) engine='NDB' +partition by hash(hour(col1)); +create table t4 (colint int, col1 time) engine='NDB' +partition by range(colint) +subpartition by hash(hour(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t5 (colint int, col1 time) engine='NDB' +partition by list(colint) +subpartition by hash(hour(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t6 (colint int, col1 time) engine='NDB' +partition by range(colint) +(partition p0 values less than (hour('18:30')), +partition p1 values less than maxvalue); +------------------------------------------------------------------------- +--- Access tables with hour(col1) +------------------------------------------------------------------------- +insert into t1 values ('09:09'); +insert into t1 values ('14:30'); +insert into t2 values ('09:09'); +insert into t2 values ('14:30'); +insert into t2 values ('21:59'); +insert into t3 values ('09:09'); +insert into t3 values ('14:30'); +insert into t3 values ('21:59'); +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6; +select hour(col1) from t1 order by col1; +hour(col1) +9 +14 +select * from t1 order by col1; +col1 +09:09:00 +14:30:00 +select * from t2 order by col1; +col1 +09:09:00 +14:30:00 +21:59:00 +select * from t3 order by col1; +col1 +09:09:00 +14:30:00 +21:59:00 +select * from t4 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t6 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +update t1 set col1='10:30' where col1='09:09'; +update t2 set col1='10:30' where col1='09:09'; +update t3 set col1='10:30' where col1='09:09'; +update t4 set col1='10:30' where col1='09:09'; +update t5 set col1='10:30' where col1='09:09'; +update t6 set col1='10:30' where col1='09:09'; +select * from t1 order by col1; +col1 +10:30:00 +14:30:00 +select * from t2 order by col1; +col1 +10:30:00 +14:30:00 +21:59:00 +select * from t3 order by col1; +col1 +10:30:00 +14:30:00 +21:59:00 +select * from t4 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t6 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +------------------------------------------------------------------------- +--- Alter tables with hour(col1) +------------------------------------------------------------------------- +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +create table t11 engine='NDB' as select * from t1; +create table t22 engine='NDB' as select * from t2; +create table t33 engine='NDB' as select * from t3; +create table t44 engine='NDB' as select * from t4; +create table t55 engine='NDB' as select * from t5; +create table t66 engine='NDB' as select * from t6; +alter table t11 +partition by range(hour(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t22 +partition by list(hour(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t33 +partition by hash(hour(col1)); +alter table t44 +partition by range(colint) +subpartition by hash(hour(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t55 +partition by list(colint) +subpartition by hash(hour(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t66 +partition by range(colint) +(partition p0 values less than (hour('18:30')), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:30:00 +14:30:00 +select * from t22 order by col1; +col1 +10:30:00 +14:30:00 +21:59:00 +select * from t33 order by col1; +col1 +10:30:00 +14:30:00 +21:59:00 +select * from t44 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t55 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:30:00 +14:30:00 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:30:00 +14:30:00 +alter table t55 +partition by list(colint) +subpartition by hash(hour(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` time DEFAULT NULL +) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (hour(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */ +select * from t55 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (hour('18:30')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (hour('18:30')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with hour(col1) +------------------------------------------------------------------------- +delete from t1 where col1='14:30'; +delete from t2 where col1='14:30'; +delete from t3 where col1='14:30'; +delete from t4 where col1='14:30'; +delete from t5 where col1='14:30'; +delete from t6 where col1='14:30'; +select * from t1 order by col1; +col1 +10:30:00 +select * from t2 order by col1; +col1 +10:30:00 +21:59:00 +select * from t3 order by col1; +col1 +10:30:00 +21:59:00 +select * from t4 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +insert into t1 values ('14:30'); +insert into t2 values ('14:30'); +insert into t3 values ('14:30'); +insert into t4 values (60,'14:30'); +insert into t5 values (60,'14:30'); +insert into t6 values (60,'14:30'); +select * from t1 order by col1; +col1 +10:30:00 +14:30:00 +select * from t2 order by col1; +col1 +10:30:00 +14:30:00 +21:59:00 +select * from t3 order by col1; +col1 +10:30:00 +14:30:00 +21:59:00 +select * from t4 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:00 +select * from t5 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:00 +select * from t6 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:00 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +select * from t2 order by col1; +col1 +14:30:00 +21:59:00 +select * from t3 order by col1; +col1 +10:30:00 +14:30:00 +21:59:00 +select * from t4 order by colint; +colint col1 +60 14:30:00 +select * from t5 order by colint; +colint col1 +60 14:30:00 +select * from t6 order by colint; +colint col1 +60 14:30:00 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with hour(col1) +------------------------------------------------------------------------- +delete from t11 where col1='14:30'; +delete from t22 where col1='14:30'; +delete from t33 where col1='14:30'; +delete from t44 where col1='14:30'; +delete from t55 where col1='14:30'; +delete from t66 where col1='14:30'; +select * from t11 order by col1; +col1 +10:30:00 +select * from t22 order by col1; +col1 +10:30:00 +21:59:00 +select * from t33 order by col1; +col1 +10:30:00 +21:59:00 +select * from t44 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t55 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +insert into t11 values ('14:30'); +insert into t22 values ('14:30'); +insert into t33 values ('14:30'); +insert into t44 values (60,'14:30'); +insert into t55 values (60,'14:30'); +insert into t66 values (60,'14:30'); +select * from t11 order by col1; +col1 +10:30:00 +14:30:00 +select * from t22 order by col1; +col1 +10:30:00 +14:30:00 +21:59:00 +select * from t33 order by col1; +col1 +10:30:00 +14:30:00 +21:59:00 +select * from t44 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:00 +select * from t55 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:00 +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:00 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +select * from t22 order by col1; +col1 +14:30:00 +21:59:00 +select * from t33 order by col1; +col1 +10:30:00 +14:30:00 +21:59:00 +select * from t44 order by colint; +colint col1 +60 14:30:00 +select * from t55 order by colint; +colint col1 +60 14:30:00 +select * from t66 order by colint; +colint col1 +60 14:30:00 +------------------------- +---- some alter table end +------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +------------------------------------------------------------------------- +--- microsecond(col1) in partition with coltype time +------------------------------------------------------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +------------------------------------------------------------------------- +--- Create tables with microsecond(col1) +------------------------------------------------------------------------- +create table t1 (col1 time) engine='NDB' +partition by range(microsecond(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t2 (col1 time) engine='NDB' +partition by list(microsecond(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t3 (col1 time) engine='NDB' +partition by hash(microsecond(col1)); +create table t4 (colint int, col1 time) engine='NDB' +partition by range(colint) +subpartition by hash(microsecond(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t5 (colint int, col1 time) engine='NDB' +partition by list(colint) +subpartition by hash(microsecond(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t6 (colint int, col1 time) engine='NDB' +partition by range(colint) +(partition p0 values less than (microsecond('10:30:10.000010')), +partition p1 values less than maxvalue); +------------------------------------------------------------------------- +--- Access tables with microsecond(col1) +------------------------------------------------------------------------- +insert into t1 values ('09:09:15.000002'); +insert into t1 values ('04:30:01.000018'); +insert into t2 values ('09:09:15.000002'); +insert into t2 values ('04:30:01.000018'); +insert into t2 values ('00:59:22.000024'); +insert into t3 values ('09:09:15.000002'); +insert into t3 values ('04:30:01.000018'); +insert into t3 values ('00:59:22.000024'); +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6; +select microsecond(col1) from t1 order by col1; +microsecond(col1) +0 +0 +select * from t1 order by col1; +col1 +04:30:01 +09:09:15 +select * from t2 order by col1; +col1 +00:59:22 +04:30:01 +09:09:15 +select * from t3 order by col1; +col1 +00:59:22 +04:30:01 +09:09:15 +select * from t4 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t6 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +update t1 set col1='05:30:34.000037' where col1='09:09:15.000002'; +update t2 set col1='05:30:34.000037' where col1='09:09:15.000002'; +update t3 set col1='05:30:34.000037' where col1='09:09:15.000002'; +update t4 set col1='05:30:34.000037' where col1='09:09:15.000002'; +update t5 set col1='05:30:34.000037' where col1='09:09:15.000002'; +update t6 set col1='05:30:34.000037' where col1='09:09:15.000002'; +select * from t1 order by col1; +col1 +04:30:01 +05:30:34 +select * from t2 order by col1; +col1 +00:59:22 +04:30:01 +05:30:34 +select * from t3 order by col1; +col1 +00:59:22 +04:30:01 +05:30:34 +select * from t4 order by colint; +colint col1 +1 05:30:34 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 05:30:34 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t6 order by colint; +colint col1 +1 05:30:34 +2 04:30:01 +3 00:59:22 +4 05:30:34 +------------------------------------------------------------------------- +--- Alter tables with microsecond(col1) +------------------------------------------------------------------------- +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +create table t11 engine='NDB' as select * from t1; +create table t22 engine='NDB' as select * from t2; +create table t33 engine='NDB' as select * from t3; +create table t44 engine='NDB' as select * from t4; +create table t55 engine='NDB' as select * from t5; +create table t66 engine='NDB' as select * from t6; +alter table t11 +partition by range(microsecond(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t22 +partition by list(microsecond(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t33 +partition by hash(microsecond(col1)); +alter table t44 +partition by range(colint) +subpartition by hash(microsecond(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t55 +partition by list(colint) +subpartition by hash(microsecond(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t66 +partition by range(colint) +(partition p0 values less than (microsecond('10:30:10.000010')), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +04:30:01 +05:30:34 +select * from t22 order by col1; +col1 +00:59:22 +04:30:01 +05:30:34 +select * from t33 order by col1; +col1 +00:59:22 +04:30:01 +05:30:34 +select * from t44 order by colint; +colint col1 +1 05:30:34 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t55 order by colint; +colint col1 +1 05:30:34 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t66 order by colint; +colint col1 +1 05:30:34 +2 04:30:01 +3 00:59:22 +4 05:30:34 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +04:30:01 +05:30:34 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +04:30:01 +05:30:34 +alter table t55 +partition by list(colint) +subpartition by hash(microsecond(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` time DEFAULT NULL +) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (microsecond(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */ +select * from t55 order by colint; +colint col1 +1 05:30:34 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 05:30:34 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (microsecond('10:30:10.000010')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 05:30:34 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 05:30:34 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (microsecond('10:30:10.000010')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 05:30:34 +2 04:30:01 +3 00:59:22 +4 05:30:34 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with microsecond(col1) +------------------------------------------------------------------------- +delete from t1 where col1='04:30:01.000018'; +delete from t2 where col1='04:30:01.000018'; +delete from t3 where col1='04:30:01.000018'; +delete from t4 where col1='04:30:01.000018'; +delete from t5 where col1='04:30:01.000018'; +delete from t6 where col1='04:30:01.000018'; +select * from t1 order by col1; +col1 +05:30:34 +select * from t2 order by col1; +col1 +00:59:22 +05:30:34 +select * from t3 order by col1; +col1 +00:59:22 +05:30:34 +select * from t4 order by colint; +colint col1 +1 05:30:34 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 05:30:34 +3 00:59:22 +4 05:30:34 +insert into t1 values ('04:30:01.000018'); +insert into t2 values ('04:30:01.000018'); +insert into t3 values ('04:30:01.000018'); +insert into t4 values (60,'04:30:01.000018'); +insert into t5 values (60,'04:30:01.000018'); +insert into t6 values (60,'04:30:01.000018'); +select * from t1 order by col1; +col1 +04:30:01 +05:30:34 +select * from t2 order by col1; +col1 +00:59:22 +04:30:01 +05:30:34 +select * from t3 order by col1; +col1 +00:59:22 +04:30:01 +05:30:34 +select * from t4 order by colint; +colint col1 +1 05:30:34 +3 00:59:22 +4 05:30:34 +60 04:30:01 +select * from t5 order by colint; +colint col1 +1 05:30:34 +3 00:59:22 +4 05:30:34 +60 04:30:01 +select * from t6 order by colint; +colint col1 +1 05:30:34 +3 00:59:22 +4 05:30:34 +60 04:30:01 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +select * from t2 order by col1; +col1 +select * from t3 order by col1; +col1 +00:59:22 +04:30:01 +05:30:34 +select * from t4 order by colint; +colint col1 +60 04:30:01 +select * from t5 order by colint; +colint col1 +60 04:30:01 +select * from t6 order by colint; +colint col1 +60 04:30:01 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with microsecond(col1) +------------------------------------------------------------------------- +delete from t11 where col1='04:30:01.000018'; +delete from t22 where col1='04:30:01.000018'; +delete from t33 where col1='04:30:01.000018'; +delete from t44 where col1='04:30:01.000018'; +delete from t55 where col1='04:30:01.000018'; +delete from t66 where col1='04:30:01.000018'; +select * from t11 order by col1; +col1 +05:30:34 +select * from t22 order by col1; +col1 +00:59:22 +05:30:34 +select * from t33 order by col1; +col1 +00:59:22 +05:30:34 +select * from t44 order by colint; +colint col1 +1 05:30:34 +3 00:59:22 +4 05:30:34 +select * from t55 order by colint; +colint col1 +1 05:30:34 +3 00:59:22 +4 05:30:34 +insert into t11 values ('04:30:01.000018'); +insert into t22 values ('04:30:01.000018'); +insert into t33 values ('04:30:01.000018'); +insert into t44 values (60,'04:30:01.000018'); +insert into t55 values (60,'04:30:01.000018'); +insert into t66 values (60,'04:30:01.000018'); +select * from t11 order by col1; +col1 +04:30:01 +05:30:34 +select * from t22 order by col1; +col1 +00:59:22 +04:30:01 +05:30:34 +select * from t33 order by col1; +col1 +00:59:22 +04:30:01 +05:30:34 +select * from t44 order by colint; +colint col1 +1 05:30:34 +3 00:59:22 +4 05:30:34 +60 04:30:01 +select * from t55 order by colint; +colint col1 +1 05:30:34 +3 00:59:22 +4 05:30:34 +60 04:30:01 +select * from t66 order by colint; +colint col1 +1 05:30:34 +3 00:59:22 +4 05:30:34 +60 04:30:01 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +select * from t22 order by col1; +col1 +select * from t33 order by col1; +col1 +00:59:22 +04:30:01 +05:30:34 +select * from t44 order by colint; +colint col1 +60 04:30:01 +select * from t55 order by colint; +colint col1 +60 04:30:01 +select * from t66 order by colint; +colint col1 +60 04:30:01 +------------------------- +---- some alter table end +------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +------------------------------------------------------------------------- +--- minute(col1) in partition with coltype time +------------------------------------------------------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +------------------------------------------------------------------------- +--- Create tables with minute(col1) +------------------------------------------------------------------------- +create table t1 (col1 time) engine='NDB' +partition by range(minute(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t2 (col1 time) engine='NDB' +partition by list(minute(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t3 (col1 time) engine='NDB' +partition by hash(minute(col1)); +create table t4 (colint int, col1 time) engine='NDB' +partition by range(colint) +subpartition by hash(minute(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t5 (colint int, col1 time) engine='NDB' +partition by list(colint) +subpartition by hash(minute(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t6 (colint int, col1 time) engine='NDB' +partition by range(colint) +(partition p0 values less than (minute('18:30')), +partition p1 values less than maxvalue); +------------------------------------------------------------------------- +--- Access tables with minute(col1) +------------------------------------------------------------------------- +insert into t1 values ('09:09:15'); +insert into t1 values ('14:30:45'); +insert into t2 values ('09:09:15'); +insert into t2 values ('14:30:45'); +insert into t2 values ('21:59:22'); +insert into t3 values ('09:09:15'); +insert into t3 values ('14:30:45'); +insert into t3 values ('21:59:22'); +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6; +select minute(col1) from t1 order by col1; +minute(col1) +9 +30 +select * from t1 order by col1; +col1 +09:09:15 +14:30:45 +select * from t2 order by col1; +col1 +09:09:15 +14:30:45 +21:59:22 +select * from t3 order by col1; +col1 +09:09:15 +14:30:45 +21:59:22 +select * from t4 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t6 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +update t1 set col1='10:24:23' where col1='09:09:15'; +update t2 set col1='10:24:23' where col1='09:09:15'; +update t3 set col1='10:24:23' where col1='09:09:15'; +update t4 set col1='10:24:23' where col1='09:09:15'; +update t5 set col1='10:24:23' where col1='09:09:15'; +update t6 set col1='10:24:23' where col1='09:09:15'; +select * from t1 order by col1; +col1 +10:24:23 +14:30:45 +select * from t2 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t3 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t4 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t6 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +------------------------------------------------------------------------- +--- Alter tables with minute(col1) +------------------------------------------------------------------------- +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +create table t11 engine='NDB' as select * from t1; +create table t22 engine='NDB' as select * from t2; +create table t33 engine='NDB' as select * from t3; +create table t44 engine='NDB' as select * from t4; +create table t55 engine='NDB' as select * from t5; +create table t66 engine='NDB' as select * from t6; +alter table t11 +partition by range(minute(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t22 +partition by list(minute(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t33 +partition by hash(minute(col1)); +alter table t44 +partition by range(colint) +subpartition by hash(minute(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t55 +partition by list(colint) +subpartition by hash(minute(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t66 +partition by range(colint) +(partition p0 values less than (minute('18:30')), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:24:23 +14:30:45 +select * from t22 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t33 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t44 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t55 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t66 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:24:23 +14:30:45 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:24:23 +14:30:45 +alter table t55 +partition by list(colint) +subpartition by hash(minute(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` time DEFAULT NULL +) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (minute(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */ +select * from t55 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (minute('18:30')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (minute('18:30')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with minute(col1) +------------------------------------------------------------------------- +delete from t1 where col1='14:30:45'; +delete from t2 where col1='14:30:45'; +delete from t3 where col1='14:30:45'; +delete from t4 where col1='14:30:45'; +delete from t5 where col1='14:30:45'; +delete from t6 where col1='14:30:45'; +select * from t1 order by col1; +col1 +10:24:23 +select * from t2 order by col1; +col1 +10:24:23 +21:59:22 +select * from t3 order by col1; +col1 +10:24:23 +21:59:22 +select * from t4 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +insert into t1 values ('14:30:45'); +insert into t2 values ('14:30:45'); +insert into t3 values ('14:30:45'); +insert into t4 values (60,'14:30:45'); +insert into t5 values (60,'14:30:45'); +insert into t6 values (60,'14:30:45'); +select * from t1 order by col1; +col1 +10:24:23 +14:30:45 +select * from t2 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t3 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t4 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +select * from t5 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +select * from t6 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +10:24:23 +14:30:45 +select * from t2 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t3 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t4 order by colint; +colint col1 +60 14:30:45 +select * from t5 order by colint; +colint col1 +60 14:30:45 +select * from t6 order by colint; +colint col1 +60 14:30:45 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with minute(col1) +------------------------------------------------------------------------- +delete from t11 where col1='14:30:45'; +delete from t22 where col1='14:30:45'; +delete from t33 where col1='14:30:45'; +delete from t44 where col1='14:30:45'; +delete from t55 where col1='14:30:45'; +delete from t66 where col1='14:30:45'; +select * from t11 order by col1; +col1 +10:24:23 +select * from t22 order by col1; +col1 +10:24:23 +21:59:22 +select * from t33 order by col1; +col1 +10:24:23 +21:59:22 +select * from t44 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t55 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +insert into t11 values ('14:30:45'); +insert into t22 values ('14:30:45'); +insert into t33 values ('14:30:45'); +insert into t44 values (60,'14:30:45'); +insert into t55 values (60,'14:30:45'); +insert into t66 values (60,'14:30:45'); +select * from t11 order by col1; +col1 +10:24:23 +14:30:45 +select * from t22 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t33 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t44 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +select * from t55 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +select * from t66 order by colint; +colint col1 +1 10:24:23 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +10:24:23 +14:30:45 +select * from t22 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t33 order by col1; +col1 +10:24:23 +14:30:45 +21:59:22 +select * from t44 order by colint; +colint col1 +60 14:30:45 +select * from t55 order by colint; +colint col1 +60 14:30:45 +select * from t66 order by colint; +colint col1 +60 14:30:45 +------------------------- +---- some alter table end +------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +------------------------------------------------------------------------- +--- second(col1) in partition with coltype time +------------------------------------------------------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +------------------------------------------------------------------------- +--- Create tables with second(col1) +------------------------------------------------------------------------- +create table t1 (col1 time) engine='NDB' +partition by range(second(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t2 (col1 time) engine='NDB' +partition by list(second(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t3 (col1 time) engine='NDB' +partition by hash(second(col1)); +create table t4 (colint int, col1 time) engine='NDB' +partition by range(colint) +subpartition by hash(second(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t5 (colint int, col1 time) engine='NDB' +partition by list(colint) +subpartition by hash(second(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t6 (colint int, col1 time) engine='NDB' +partition by range(colint) +(partition p0 values less than (second('18:30:14')), +partition p1 values less than maxvalue); +------------------------------------------------------------------------- +--- Access tables with second(col1) +------------------------------------------------------------------------- +insert into t1 values ('09:09:09'); +insert into t1 values ('14:30:20'); +insert into t2 values ('09:09:09'); +insert into t2 values ('14:30:20'); +insert into t2 values ('21:59:22'); +insert into t3 values ('09:09:09'); +insert into t3 values ('14:30:20'); +insert into t3 values ('21:59:22'); +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6; +select second(col1) from t1 order by col1; +second(col1) +9 +20 +select * from t1 order by col1; +col1 +09:09:09 +14:30:20 +select * from t2 order by col1; +col1 +09:09:09 +14:30:20 +21:59:22 +select * from t3 order by col1; +col1 +09:09:09 +14:30:20 +21:59:22 +select * from t4 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t6 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +update t1 set col1='10:22:33' where col1='09:09:09'; +update t2 set col1='10:22:33' where col1='09:09:09'; +update t3 set col1='10:22:33' where col1='09:09:09'; +update t4 set col1='10:22:33' where col1='09:09:09'; +update t5 set col1='10:22:33' where col1='09:09:09'; +update t6 set col1='10:22:33' where col1='09:09:09'; +select * from t1 order by col1; +col1 +10:22:33 +14:30:20 +select * from t2 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t3 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t4 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t6 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +------------------------------------------------------------------------- +--- Alter tables with second(col1) +------------------------------------------------------------------------- +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +create table t11 engine='NDB' as select * from t1; +create table t22 engine='NDB' as select * from t2; +create table t33 engine='NDB' as select * from t3; +create table t44 engine='NDB' as select * from t4; +create table t55 engine='NDB' as select * from t5; +create table t66 engine='NDB' as select * from t6; +alter table t11 +partition by range(second(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t22 +partition by list(second(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t33 +partition by hash(second(col1)); +alter table t44 +partition by range(colint) +subpartition by hash(second(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t55 +partition by list(colint) +subpartition by hash(second(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t66 +partition by range(colint) +(partition p0 values less than (second('18:30:14')), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:22:33 +14:30:20 +select * from t22 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t33 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t44 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t55 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:22:33 +14:30:20 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:22:33 +14:30:20 +alter table t55 +partition by list(colint) +subpartition by hash(second(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` time DEFAULT NULL +) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (second(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */ +select * from t55 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (second('18:30:14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (second('18:30:14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with second(col1) +------------------------------------------------------------------------- +delete from t1 where col1='14:30:20'; +delete from t2 where col1='14:30:20'; +delete from t3 where col1='14:30:20'; +delete from t4 where col1='14:30:20'; +delete from t5 where col1='14:30:20'; +delete from t6 where col1='14:30:20'; +select * from t1 order by col1; +col1 +10:22:33 +select * from t2 order by col1; +col1 +10:22:33 +21:59:22 +select * from t3 order by col1; +col1 +10:22:33 +21:59:22 +select * from t4 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +insert into t1 values ('14:30:20'); +insert into t2 values ('14:30:20'); +insert into t3 values ('14:30:20'); +insert into t4 values (60,'14:30:20'); +insert into t5 values (60,'14:30:20'); +insert into t6 values (60,'14:30:20'); +select * from t1 order by col1; +col1 +10:22:33 +14:30:20 +select * from t2 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t3 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t4 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:20 +select * from t5 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:20 +select * from t6 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:20 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +10:22:33 +14:30:20 +select * from t2 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t3 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t4 order by colint; +colint col1 +60 14:30:20 +select * from t5 order by colint; +colint col1 +60 14:30:20 +select * from t6 order by colint; +colint col1 +60 14:30:20 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with second(col1) +------------------------------------------------------------------------- +delete from t11 where col1='14:30:20'; +delete from t22 where col1='14:30:20'; +delete from t33 where col1='14:30:20'; +delete from t44 where col1='14:30:20'; +delete from t55 where col1='14:30:20'; +delete from t66 where col1='14:30:20'; +select * from t11 order by col1; +col1 +10:22:33 +select * from t22 order by col1; +col1 +10:22:33 +21:59:22 +select * from t33 order by col1; +col1 +10:22:33 +21:59:22 +select * from t44 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t55 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +insert into t11 values ('14:30:20'); +insert into t22 values ('14:30:20'); +insert into t33 values ('14:30:20'); +insert into t44 values (60,'14:30:20'); +insert into t55 values (60,'14:30:20'); +insert into t66 values (60,'14:30:20'); +select * from t11 order by col1; +col1 +10:22:33 +14:30:20 +select * from t22 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t33 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t44 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:20 +select * from t55 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:20 +select * from t66 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:20 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +10:22:33 +14:30:20 +select * from t22 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t33 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t44 order by colint; +colint col1 +60 14:30:20 +select * from t55 order by colint; +colint col1 +60 14:30:20 +select * from t66 order by colint; +colint col1 +60 14:30:20 +------------------------- +---- some alter table end +------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +------------------------------------------------------------------------- +--- second(col1) in partition with coltype char(30) +------------------------------------------------------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +------------------------------------------------------------------------- +--- Create tables with second(col1) +------------------------------------------------------------------------- +create table t1 (col1 char(30)) engine='NDB' +partition by range(second(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t2 (col1 char(30)) engine='NDB' +partition by list(second(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t3 (col1 char(30)) engine='NDB' +partition by hash(second(col1)); +create table t4 (colint int, col1 char(30)) engine='NDB' +partition by range(colint) +subpartition by hash(second(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t5 (colint int, col1 char(30)) engine='NDB' +partition by list(colint) +subpartition by hash(second(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t6 (colint int, col1 char(30)) engine='NDB' +partition by range(colint) +(partition p0 values less than (second('18:30:14')), +partition p1 values less than maxvalue); +------------------------------------------------------------------------- +--- Access tables with second(col1) +------------------------------------------------------------------------- +insert into t1 values ('09:09:09'); +insert into t1 values ('14:30:20'); +insert into t2 values ('09:09:09'); +insert into t2 values ('14:30:20'); +insert into t2 values ('21:59:22'); +insert into t3 values ('09:09:09'); +insert into t3 values ('14:30:20'); +insert into t3 values ('21:59:22'); +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6; +select second(col1) from t1 order by col1; +second(col1) +9 +20 +select * from t1 order by col1; +col1 +09:09:09 +14:30:20 +select * from t2 order by col1; +col1 +09:09:09 +14:30:20 +21:59:22 +select * from t3 order by col1; +col1 +09:09:09 +14:30:20 +21:59:22 +select * from t4 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +select * from t5 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +select * from t6 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +update t1 set col1='10:22:33' where col1='09:09:09'; +update t2 set col1='10:22:33' where col1='09:09:09'; +update t3 set col1='10:22:33' where col1='09:09:09'; +update t4 set col1='10:22:33' where col1='09:09:09'; +update t5 set col1='10:22:33' where col1='09:09:09'; +update t6 set col1='10:22:33' where col1='09:09:09'; +select * from t1 order by col1; +col1 +10:22:33 +14:30:20 +select * from t2 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t3 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t4 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +select * from t5 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +select * from t6 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +------------------------------------------------------------------------- +--- Alter tables with second(col1) +------------------------------------------------------------------------- +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +create table t11 engine='NDB' as select * from t1; +create table t22 engine='NDB' as select * from t2; +create table t33 engine='NDB' as select * from t3; +create table t44 engine='NDB' as select * from t4; +create table t55 engine='NDB' as select * from t5; +create table t66 engine='NDB' as select * from t6; +alter table t11 +partition by range(second(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t22 +partition by list(second(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t33 +partition by hash(second(col1)); +alter table t44 +partition by range(colint) +subpartition by hash(second(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t55 +partition by list(colint) +subpartition by hash(second(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t66 +partition by range(colint) +(partition p0 values less than (second('18:30:14')), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:22:33 +14:30:20 +select * from t22 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t33 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t44 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +select * from t55 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +select * from t66 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:22:33 +14:30:20 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:22:33 +14:30:20 +alter table t55 +partition by list(colint) +subpartition by hash(second(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` char(30) DEFAULT NULL +) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (second(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */ +select * from t55 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (second('18:30:14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (second('18:30:14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with second(col1) +------------------------------------------------------------------------- +delete from t1 where col1='14:30:20'; +delete from t2 where col1='14:30:20'; +delete from t3 where col1='14:30:20'; +delete from t4 where col1='14:30:20'; +delete from t5 where col1='14:30:20'; +delete from t6 where col1='14:30:20'; +select * from t1 order by col1; +col1 +10:22:33 +select * from t2 order by col1; +col1 +10:22:33 +21:59:22 +select * from t3 order by col1; +col1 +10:22:33 +21:59:22 +select * from t4 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +select * from t5 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +insert into t1 values ('14:30:20'); +insert into t2 values ('14:30:20'); +insert into t3 values ('14:30:20'); +insert into t4 values (60,'14:30:20'); +insert into t5 values (60,'14:30:20'); +insert into t6 values (60,'14:30:20'); +select * from t1 order by col1; +col1 +10:22:33 +14:30:20 +select * from t2 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t3 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t4 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +60 14:30:20 +select * from t5 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +60 14:30:20 +select * from t6 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +60 14:30:20 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +10:22:33 +14:30:20 +select * from t2 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t3 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t4 order by colint; +colint col1 +60 14:30:20 +select * from t5 order by colint; +colint col1 +60 14:30:20 +select * from t6 order by colint; +colint col1 +60 14:30:20 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with second(col1) +------------------------------------------------------------------------- +delete from t11 where col1='14:30:20'; +delete from t22 where col1='14:30:20'; +delete from t33 where col1='14:30:20'; +delete from t44 where col1='14:30:20'; +delete from t55 where col1='14:30:20'; +delete from t66 where col1='14:30:20'; +select * from t11 order by col1; +col1 +10:22:33 +select * from t22 order by col1; +col1 +10:22:33 +21:59:22 +select * from t33 order by col1; +col1 +10:22:33 +21:59:22 +select * from t44 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +select * from t55 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +insert into t11 values ('14:30:20'); +insert into t22 values ('14:30:20'); +insert into t33 values ('14:30:20'); +insert into t44 values (60,'14:30:20'); +insert into t55 values (60,'14:30:20'); +insert into t66 values (60,'14:30:20'); +select * from t11 order by col1; +col1 +10:22:33 +14:30:20 +select * from t22 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t33 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t44 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +60 14:30:20 +select * from t55 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +60 14:30:20 +select * from t66 order by colint; +colint col1 +1 09:09:15.000002 +2 04:30:01.000018 +3 00:59:22.000024 +4 05:30:34.000037 +60 14:30:20 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +10:22:33 +14:30:20 +select * from t22 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t33 order by col1; +col1 +10:22:33 +14:30:20 +21:59:22 +select * from t44 order by colint; +colint col1 +60 14:30:20 +select * from t55 order by colint; +colint col1 +60 14:30:20 +select * from t66 order by colint; +colint col1 +60 14:30:20 +------------------------- +---- some alter table end +------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +------------------------------------------------------------------------- +--- month(col1) in partition with coltype date +------------------------------------------------------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +------------------------------------------------------------------------- +--- Create tables with month(col1) +------------------------------------------------------------------------- +create table t1 (col1 date) engine='NDB' +partition by range(month(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t2 (col1 date) engine='NDB' +partition by list(month(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t3 (col1 date) engine='NDB' +partition by hash(month(col1)); +create table t4 (colint int, col1 date) engine='NDB' +partition by range(colint) +subpartition by hash(month(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t5 (colint int, col1 date) engine='NDB' +partition by list(colint) +subpartition by hash(month(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t6 (colint int, col1 date) engine='NDB' +partition by range(colint) +(partition p0 values less than (month('2006-10-14')), +partition p1 values less than maxvalue); +------------------------------------------------------------------------- +--- Access tables with month(col1) +------------------------------------------------------------------------- +insert into t1 values ('2006-01-03'); +insert into t1 values ('2006-12-17'); +insert into t2 values ('2006-01-03'); +insert into t2 values ('2006-12-17'); +insert into t2 values ('2006-05-25'); +insert into t3 values ('2006-01-03'); +insert into t3 values ('2006-12-17'); +insert into t3 values ('2006-05-25'); +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select month(col1) from t1 order by col1; +month(col1) +1 +12 +select * from t1 order by col1; +col1 +2006-01-03 +2006-12-17 +select * from t2 order by col1; +col1 +2006-01-03 +2006-05-25 +2006-12-17 +select * from t3 order by col1; +col1 +2006-01-03 +2006-05-25 +2006-12-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-11-06' where col1='2006-01-03'; +update t2 set col1='2006-11-06' where col1='2006-01-03'; +update t3 set col1='2006-11-06' where col1='2006-01-03'; +update t4 set col1='2006-11-06' where col1='2006-01-03'; +update t5 set col1='2006-11-06' where col1='2006-01-03'; +update t6 set col1='2006-11-06' where col1='2006-01-03'; +select * from t1 order by col1; +col1 +2006-11-06 +2006-12-17 +select * from t2 order by col1; +col1 +2006-05-25 +2006-11-06 +2006-12-17 +select * from t3 order by col1; +col1 +2006-05-25 +2006-11-06 +2006-12-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Alter tables with month(col1) +------------------------------------------------------------------------- +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +create table t11 engine='NDB' as select * from t1; +create table t22 engine='NDB' as select * from t2; +create table t33 engine='NDB' as select * from t3; +create table t44 engine='NDB' as select * from t4; +create table t55 engine='NDB' as select * from t5; +create table t66 engine='NDB' as select * from t6; +alter table t11 +partition by range(month(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t22 +partition by list(month(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t33 +partition by hash(month(col1)); +alter table t44 +partition by range(colint) +subpartition by hash(month(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t55 +partition by list(colint) +subpartition by hash(month(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t66 +partition by range(colint) +(partition p0 values less than (month('2006-10-14')), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-11-06 +2006-12-17 +select * from t22 order by col1; +col1 +2006-05-25 +2006-11-06 +2006-12-17 +select * from t33 order by col1; +col1 +2006-05-25 +2006-11-06 +2006-12-17 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-11-06 +2006-12-17 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-11-06 +2006-12-17 +alter table t55 +partition by list(colint) +subpartition by hash(month(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (month(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */ +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (month('2006-10-14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (month('2006-10-14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with month(col1) +------------------------------------------------------------------------- +delete from t1 where col1='2006-12-17'; +delete from t2 where col1='2006-12-17'; +delete from t3 where col1='2006-12-17'; +delete from t4 where col1='2006-12-17'; +delete from t5 where col1='2006-12-17'; +delete from t6 where col1='2006-12-17'; +select * from t1 order by col1; +col1 +2006-11-06 +select * from t2 order by col1; +col1 +2006-05-25 +2006-11-06 +select * from t3 order by col1; +col1 +2006-05-25 +2006-11-06 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-12-17'); +insert into t2 values ('2006-12-17'); +insert into t3 values ('2006-12-17'); +insert into t4 values (60,'2006-12-17'); +insert into t5 values (60,'2006-12-17'); +insert into t6 values (60,'2006-12-17'); +select * from t1 order by col1; +col1 +2006-11-06 +2006-12-17 +select * from t2 order by col1; +col1 +2006-05-25 +2006-11-06 +2006-12-17 +select * from t3 order by col1; +col1 +2006-05-25 +2006-11-06 +2006-12-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +select * from t2 order by col1; +col1 +2006-11-06 +2006-12-17 +select * from t3 order by col1; +col1 +2006-05-25 +2006-11-06 +2006-12-17 +select * from t4 order by colint; +colint col1 +60 2006-12-17 +select * from t5 order by colint; +colint col1 +60 2006-12-17 +select * from t6 order by colint; +colint col1 +60 2006-12-17 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with month(col1) +------------------------------------------------------------------------- +delete from t11 where col1='2006-12-17'; +delete from t22 where col1='2006-12-17'; +delete from t33 where col1='2006-12-17'; +delete from t44 where col1='2006-12-17'; +delete from t55 where col1='2006-12-17'; +delete from t66 where col1='2006-12-17'; +select * from t11 order by col1; +col1 +2006-11-06 +select * from t22 order by col1; +col1 +2006-05-25 +2006-11-06 +select * from t33 order by col1; +col1 +2006-05-25 +2006-11-06 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-12-17'); +insert into t22 values ('2006-12-17'); +insert into t33 values ('2006-12-17'); +insert into t44 values (60,'2006-12-17'); +insert into t55 values (60,'2006-12-17'); +insert into t66 values (60,'2006-12-17'); +select * from t11 order by col1; +col1 +2006-11-06 +2006-12-17 +select * from t22 order by col1; +col1 +2006-05-25 +2006-11-06 +2006-12-17 +select * from t33 order by col1; +col1 +2006-05-25 +2006-11-06 +2006-12-17 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +select * from t22 order by col1; +col1 +2006-11-06 +2006-12-17 +select * from t33 order by col1; +col1 +2006-05-25 +2006-11-06 +2006-12-17 +select * from t44 order by colint; +colint col1 +60 2006-12-17 +select * from t55 order by colint; +colint col1 +60 2006-12-17 +select * from t66 order by colint; +colint col1 +60 2006-12-17 +------------------------- +---- some alter table end +------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +------------------------------------------------------------------------- +--- quarter(col1) in partition with coltype date +------------------------------------------------------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +------------------------------------------------------------------------- +--- Create tables with quarter(col1) +------------------------------------------------------------------------- +create table t1 (col1 date) engine='NDB' +partition by range(quarter(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t2 (col1 date) engine='NDB' +partition by list(quarter(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t3 (col1 date) engine='NDB' +partition by hash(quarter(col1)); +create table t4 (colint int, col1 date) engine='NDB' +partition by range(colint) +subpartition by hash(quarter(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t5 (colint int, col1 date) engine='NDB' +partition by list(colint) +subpartition by hash(quarter(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t6 (colint int, col1 date) engine='NDB' +partition by range(colint) +(partition p0 values less than (quarter('2006-10-14')), +partition p1 values less than maxvalue); +------------------------------------------------------------------------- +--- Access tables with quarter(col1) +------------------------------------------------------------------------- +insert into t1 values ('2006-01-03'); +insert into t1 values ('2006-12-17'); +insert into t2 values ('2006-01-03'); +insert into t2 values ('2006-12-17'); +insert into t2 values ('2006-09-25'); +insert into t3 values ('2006-01-03'); +insert into t3 values ('2006-12-17'); +insert into t3 values ('2006-09-25'); +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select quarter(col1) from t1 order by col1; +quarter(col1) +1 +4 +select * from t1 order by col1; +col1 +2006-01-03 +2006-12-17 +select * from t2 order by col1; +col1 +2006-01-03 +2006-09-25 +2006-12-17 +select * from t3 order by col1; +col1 +2006-01-03 +2006-09-25 +2006-12-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-07-30' where col1='2006-01-03'; +update t2 set col1='2006-07-30' where col1='2006-01-03'; +update t3 set col1='2006-07-30' where col1='2006-01-03'; +update t4 set col1='2006-07-30' where col1='2006-01-03'; +update t5 set col1='2006-07-30' where col1='2006-01-03'; +update t6 set col1='2006-07-30' where col1='2006-01-03'; +select * from t1 order by col1; +col1 +2006-07-30 +2006-12-17 +select * from t2 order by col1; +col1 +2006-07-30 +2006-09-25 +2006-12-17 +select * from t3 order by col1; +col1 +2006-07-30 +2006-09-25 +2006-12-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Alter tables with quarter(col1) +------------------------------------------------------------------------- +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +create table t11 engine='NDB' as select * from t1; +create table t22 engine='NDB' as select * from t2; +create table t33 engine='NDB' as select * from t3; +create table t44 engine='NDB' as select * from t4; +create table t55 engine='NDB' as select * from t5; +create table t66 engine='NDB' as select * from t6; +alter table t11 +partition by range(quarter(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t22 +partition by list(quarter(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t33 +partition by hash(quarter(col1)); +alter table t44 +partition by range(colint) +subpartition by hash(quarter(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t55 +partition by list(colint) +subpartition by hash(quarter(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t66 +partition by range(colint) +(partition p0 values less than (quarter('2006-10-14')), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-07-30 +2006-12-17 +select * from t22 order by col1; +col1 +2006-07-30 +2006-09-25 +2006-12-17 +select * from t33 order by col1; +col1 +2006-07-30 +2006-09-25 +2006-12-17 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-07-30 +2006-12-17 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-07-30 +2006-12-17 +alter table t55 +partition by list(colint) +subpartition by hash(quarter(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (quarter(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */ +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (quarter('2006-10-14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (quarter('2006-10-14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with quarter(col1) +------------------------------------------------------------------------- +delete from t1 where col1='2006-12-17'; +delete from t2 where col1='2006-12-17'; +delete from t3 where col1='2006-12-17'; +delete from t4 where col1='2006-12-17'; +delete from t5 where col1='2006-12-17'; +delete from t6 where col1='2006-12-17'; +select * from t1 order by col1; +col1 +2006-07-30 +select * from t2 order by col1; +col1 +2006-07-30 +2006-09-25 +select * from t3 order by col1; +col1 +2006-07-30 +2006-09-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-12-17'); +insert into t2 values ('2006-12-17'); +insert into t3 values ('2006-12-17'); +insert into t4 values (60,'2006-12-17'); +insert into t5 values (60,'2006-12-17'); +insert into t6 values (60,'2006-12-17'); +select * from t1 order by col1; +col1 +2006-07-30 +2006-12-17 +select * from t2 order by col1; +col1 +2006-07-30 +2006-09-25 +2006-12-17 +select * from t3 order by col1; +col1 +2006-07-30 +2006-09-25 +2006-12-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +select * from t2 order by col1; +col1 +select * from t3 order by col1; +col1 +2006-07-30 +2006-09-25 +2006-12-17 +select * from t4 order by colint; +colint col1 +60 2006-12-17 +select * from t5 order by colint; +colint col1 +60 2006-12-17 +select * from t6 order by colint; +colint col1 +4 2006-02-05 +60 2006-12-17 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with quarter(col1) +------------------------------------------------------------------------- +delete from t11 where col1='2006-12-17'; +delete from t22 where col1='2006-12-17'; +delete from t33 where col1='2006-12-17'; +delete from t44 where col1='2006-12-17'; +delete from t55 where col1='2006-12-17'; +delete from t66 where col1='2006-12-17'; +select * from t11 order by col1; +col1 +2006-07-30 +select * from t22 order by col1; +col1 +2006-07-30 +2006-09-25 +select * from t33 order by col1; +col1 +2006-07-30 +2006-09-25 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-12-17'); +insert into t22 values ('2006-12-17'); +insert into t33 values ('2006-12-17'); +insert into t44 values (60,'2006-12-17'); +insert into t55 values (60,'2006-12-17'); +insert into t66 values (60,'2006-12-17'); +select * from t11 order by col1; +col1 +2006-07-30 +2006-12-17 +select * from t22 order by col1; +col1 +2006-07-30 +2006-09-25 +2006-12-17 +select * from t33 order by col1; +col1 +2006-07-30 +2006-09-25 +2006-12-17 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-12-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +select * from t22 order by col1; +col1 +select * from t33 order by col1; +col1 +2006-07-30 +2006-09-25 +2006-12-17 +select * from t44 order by colint; +colint col1 +60 2006-12-17 +select * from t55 order by colint; +colint col1 +60 2006-12-17 +select * from t66 order by colint; +colint col1 +4 2006-02-05 +60 2006-12-17 +------------------------- +---- some alter table end +------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +------------------------------------------------------------------------- +--- time_to_sec(col1)-(time_to_sec(col1)-20) in partition with coltype time +------------------------------------------------------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +------------------------------------------------------------------------- +--- Create tables with time_to_sec(col1)-(time_to_sec(col1)-20) +------------------------------------------------------------------------- +create table t1 (col1 time) engine='NDB' +partition by range(time_to_sec(col1)-(time_to_sec(col1)-20)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t2 (col1 time) engine='NDB' +partition by list(time_to_sec(col1)-(time_to_sec(col1)-20)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t3 (col1 time) engine='NDB' +partition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)); +create table t4 (colint int, col1 time) engine='NDB' +partition by range(colint) +subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t5 (colint int, col1 time) engine='NDB' +partition by list(colint) +subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t6 (colint int, col1 time) engine='NDB' +partition by range(colint) +(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))), +partition p1 values less than maxvalue); +------------------------------------------------------------------------- +--- Access tables with time_to_sec(col1)-(time_to_sec(col1)-20) +------------------------------------------------------------------------- +insert into t1 values ('09:09:15'); +insert into t1 values ('14:30:45'); +insert into t2 values ('09:09:15'); +insert into t2 values ('14:30:45'); +insert into t2 values ('21:59:22'); +insert into t3 values ('09:09:15'); +insert into t3 values ('14:30:45'); +insert into t3 values ('21:59:22'); +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6; +select time_to_sec(col1)-(time_to_sec(col1)-20) from t1 order by col1; +time_to_sec(col1)-(time_to_sec(col1)-20) +20 +20 +select * from t1 order by col1; +col1 +09:09:15 +14:30:45 +select * from t2 order by col1; +col1 +09:09:15 +14:30:45 +21:59:22 +select * from t3 order by col1; +col1 +09:09:15 +14:30:45 +21:59:22 +select * from t4 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t6 order by colint; +colint col1 +1 09:09:15 +2 04:30:01 +3 00:59:22 +4 05:30:34 +update t1 set col1='10:33:11' where col1='09:09:15'; +update t2 set col1='10:33:11' where col1='09:09:15'; +update t3 set col1='10:33:11' where col1='09:09:15'; +update t4 set col1='10:33:11' where col1='09:09:15'; +update t5 set col1='10:33:11' where col1='09:09:15'; +update t6 set col1='10:33:11' where col1='09:09:15'; +select * from t1 order by col1; +col1 +10:33:11 +14:30:45 +select * from t2 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t3 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t4 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t6 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +------------------------------------------------------------------------- +--- Alter tables with time_to_sec(col1)-(time_to_sec(col1)-20) +------------------------------------------------------------------------- +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +create table t11 engine='NDB' as select * from t1; +create table t22 engine='NDB' as select * from t2; +create table t33 engine='NDB' as select * from t3; +create table t44 engine='NDB' as select * from t4; +create table t55 engine='NDB' as select * from t5; +create table t66 engine='NDB' as select * from t6; +alter table t11 +partition by range(time_to_sec(col1)-(time_to_sec(col1)-20)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t22 +partition by list(time_to_sec(col1)-(time_to_sec(col1)-20)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t33 +partition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)); +alter table t44 +partition by range(colint) +subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t55 +partition by list(colint) +subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t66 +partition by range(colint) +(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:33:11 +14:30:45 +select * from t22 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t33 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t44 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t55 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t66 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:33:11 +14:30:45 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +10:33:11 +14:30:45 +alter table t55 +partition by list(colint) +subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` time DEFAULT NULL +) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (time_to_sec(col1)-(time_to_sec(col1)-20)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */ +select * from t55 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with time_to_sec(col1)-(time_to_sec(col1)-20) +------------------------------------------------------------------------- +delete from t1 where col1='14:30:45'; +delete from t2 where col1='14:30:45'; +delete from t3 where col1='14:30:45'; +delete from t4 where col1='14:30:45'; +delete from t5 where col1='14:30:45'; +delete from t6 where col1='14:30:45'; +select * from t1 order by col1; +col1 +10:33:11 +select * from t2 order by col1; +col1 +10:33:11 +21:59:22 +select * from t3 order by col1; +col1 +10:33:11 +21:59:22 +select * from t4 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t5 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +insert into t1 values ('14:30:45'); +insert into t2 values ('14:30:45'); +insert into t3 values ('14:30:45'); +insert into t4 values (60,'14:30:45'); +insert into t5 values (60,'14:30:45'); +insert into t6 values (60,'14:30:45'); +select * from t1 order by col1; +col1 +10:33:11 +14:30:45 +select * from t2 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t3 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t4 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +select * from t5 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +select * from t6 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +10:33:11 +14:30:45 +select * from t2 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t3 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t4 order by colint; +colint col1 +60 14:30:45 +select * from t5 order by colint; +colint col1 +60 14:30:45 +select * from t6 order by colint; +colint col1 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with time_to_sec(col1)-(time_to_sec(col1)-20) +------------------------------------------------------------------------- +delete from t11 where col1='14:30:45'; +delete from t22 where col1='14:30:45'; +delete from t33 where col1='14:30:45'; +delete from t44 where col1='14:30:45'; +delete from t55 where col1='14:30:45'; +delete from t66 where col1='14:30:45'; +select * from t11 order by col1; +col1 +10:33:11 +select * from t22 order by col1; +col1 +10:33:11 +21:59:22 +select * from t33 order by col1; +col1 +10:33:11 +21:59:22 +select * from t44 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +select * from t55 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +insert into t11 values ('14:30:45'); +insert into t22 values ('14:30:45'); +insert into t33 values ('14:30:45'); +insert into t44 values (60,'14:30:45'); +insert into t55 values (60,'14:30:45'); +insert into t66 values (60,'14:30:45'); +select * from t11 order by col1; +col1 +10:33:11 +14:30:45 +select * from t22 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t33 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t44 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +select * from t55 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +select * from t66 order by colint; +colint col1 +1 10:33:11 +2 04:30:01 +3 00:59:22 +4 05:30:34 +60 14:30:45 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +10:33:11 +14:30:45 +select * from t22 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t33 order by col1; +col1 +10:33:11 +14:30:45 +21:59:22 +select * from t44 order by colint; +colint col1 +60 14:30:45 +select * from t55 order by colint; +colint col1 +60 14:30:45 +select * from t66 order by colint; +colint col1 +------------------------- +---- some alter table end +------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +------------------------------------------------------------------------- +--- to_days(col1)-to_days('2006-01-01') in partition with coltype date +------------------------------------------------------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +------------------------------------------------------------------------- +--- Create tables with to_days(col1)-to_days('2006-01-01') +------------------------------------------------------------------------- +create table t1 (col1 date) engine='NDB' +partition by range(to_days(col1)-to_days('2006-01-01')) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t2 (col1 date) engine='NDB' +partition by list(to_days(col1)-to_days('2006-01-01')) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t3 (col1 date) engine='NDB' +partition by hash(to_days(col1)-to_days('2006-01-01')); +create table t4 (colint int, col1 date) engine='NDB' +partition by range(colint) +subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t5 (colint int, col1 date) engine='NDB' +partition by list(colint) +subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t6 (colint int, col1 date) engine='NDB' +partition by range(colint) +(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')), +partition p1 values less than maxvalue); +------------------------------------------------------------------------- +--- Access tables with to_days(col1)-to_days('2006-01-01') +------------------------------------------------------------------------- +insert into t1 values ('2006-02-03'); +insert into t1 values ('2006-01-17'); +insert into t2 values ('2006-02-03'); +insert into t2 values ('2006-01-17'); +insert into t2 values ('2006-01-25'); +insert into t3 values ('2006-02-03'); +insert into t3 values ('2006-01-17'); +insert into t3 values ('2006-01-25'); +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select to_days(col1)-to_days('2006-01-01') from t1 order by col1; +to_days(col1)-to_days('2006-01-01') +16 +33 +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-03 +select * from t2 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-03 +select * from t3 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-03 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-02-06' where col1='2006-02-03'; +update t2 set col1='2006-02-06' where col1='2006-02-03'; +update t3 set col1='2006-02-06' where col1='2006-02-03'; +update t4 set col1='2006-02-06' where col1='2006-02-03'; +update t5 set col1='2006-02-06' where col1='2006-02-03'; +update t6 set col1='2006-02-06' where col1='2006-02-03'; +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-06 +select * from t2 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t3 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t4 order by colint; +colint col1 +1 2006-02-06 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-06 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-06 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Alter tables with to_days(col1)-to_days('2006-01-01') +------------------------------------------------------------------------- +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +create table t11 engine='NDB' as select * from t1; +create table t22 engine='NDB' as select * from t2; +create table t33 engine='NDB' as select * from t3; +create table t44 engine='NDB' as select * from t4; +create table t55 engine='NDB' as select * from t5; +create table t66 engine='NDB' as select * from t6; +alter table t11 +partition by range(to_days(col1)-to_days('2006-01-01')) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t22 +partition by list(to_days(col1)-to_days('2006-01-01')) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t33 +partition by hash(to_days(col1)-to_days('2006-01-01')); +alter table t44 +partition by range(colint) +subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t55 +partition by list(colint) +subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t66 +partition by range(colint) +(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-06 +select * from t22 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t33 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t44 order by colint; +colint col1 +1 2006-02-06 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-06 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; +colint col1 +1 2006-02-06 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-06 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-06 +alter table t55 +partition by list(colint) +subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (to_days(col1)-to_days('2006-01-01')) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */ +select * from t55 order by colint; +colint col1 +1 2006-02-06 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-06 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-06 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-06 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-06 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01') +------------------------------------------------------------------------- +delete from t1 where col1='2006-01-17'; +delete from t2 where col1='2006-01-17'; +delete from t3 where col1='2006-01-17'; +delete from t4 where col1='2006-01-17'; +delete from t5 where col1='2006-01-17'; +delete from t6 where col1='2006-01-17'; +select * from t1 order by col1; +col1 +2006-02-06 +select * from t2 order by col1; +col1 +2006-01-25 +2006-02-06 +select * from t3 order by col1; +col1 +2006-01-25 +2006-02-06 +select * from t4 order by colint; +colint col1 +1 2006-02-06 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-06 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-01-17'); +insert into t2 values ('2006-01-17'); +insert into t3 values ('2006-01-17'); +insert into t4 values (60,'2006-01-17'); +insert into t5 values (60,'2006-01-17'); +insert into t6 values (60,'2006-01-17'); +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-06 +select * from t2 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t3 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t4 order by colint; +colint col1 +1 2006-02-06 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t5 order by colint; +colint col1 +1 2006-02-06 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t6 order by colint; +colint col1 +1 2006-02-06 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +2006-01-17 +2006-02-06 +select * from t2 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t3 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t4 order by colint; +colint col1 +60 2006-01-17 +select * from t5 order by colint; +colint col1 +60 2006-01-17 +select * from t6 order by colint; +colint col1 +60 2006-01-17 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01') +------------------------------------------------------------------------- +delete from t11 where col1='2006-01-17'; +delete from t22 where col1='2006-01-17'; +delete from t33 where col1='2006-01-17'; +delete from t44 where col1='2006-01-17'; +delete from t55 where col1='2006-01-17'; +delete from t66 where col1='2006-01-17'; +select * from t11 order by col1; +col1 +2006-02-06 +select * from t22 order by col1; +col1 +2006-01-25 +2006-02-06 +select * from t33 order by col1; +col1 +2006-01-25 +2006-02-06 +select * from t44 order by colint; +colint col1 +1 2006-02-06 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-06 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-01-17'); +insert into t22 values ('2006-01-17'); +insert into t33 values ('2006-01-17'); +insert into t44 values (60,'2006-01-17'); +insert into t55 values (60,'2006-01-17'); +insert into t66 values (60,'2006-01-17'); +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-06 +select * from t22 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t33 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t44 order by colint; +colint col1 +1 2006-02-06 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t55 order by colint; +colint col1 +1 2006-02-06 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +select * from t66 order by colint; +colint col1 +1 2006-02-06 +3 2006-01-25 +4 2006-02-05 +60 2006-01-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +2006-01-17 +2006-02-06 +select * from t22 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t33 order by col1; +col1 +2006-01-17 +2006-01-25 +2006-02-06 +select * from t44 order by colint; +colint col1 +60 2006-01-17 +select * from t55 order by colint; +colint col1 +60 2006-01-17 +select * from t66 order by colint; +colint col1 +60 2006-01-17 +------------------------- +---- some alter table end +------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +------------------------------------------------------------------------- +--- weekday(col1) in partition with coltype date +------------------------------------------------------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +------------------------------------------------------------------------- +--- Create tables with weekday(col1) +------------------------------------------------------------------------- +create table t1 (col1 date) engine='NDB' +partition by range(weekday(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t2 (col1 date) engine='NDB' +partition by list(weekday(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t3 (col1 date) engine='NDB' +partition by hash(weekday(col1)); +create table t4 (colint int, col1 date) engine='NDB' +partition by range(colint) +subpartition by hash(weekday(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t5 (colint int, col1 date) engine='NDB' +partition by list(colint) +subpartition by hash(weekday(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t6 (colint int, col1 date) engine='NDB' +partition by range(colint) +(partition p0 values less than (weekday('2006-10-14')), +partition p1 values less than maxvalue); +------------------------------------------------------------------------- +--- Access tables with weekday(col1) +------------------------------------------------------------------------- +insert into t1 values ('2006-12-03'); +insert into t1 values ('2006-11-17'); +insert into t2 values ('2006-12-03'); +insert into t2 values ('2006-11-17'); +insert into t2 values ('2006-05-25'); +insert into t3 values ('2006-12-03'); +insert into t3 values ('2006-11-17'); +insert into t3 values ('2006-05-25'); +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select weekday(col1) from t1 order by col1; +weekday(col1) +4 +6 +select * from t1 order by col1; +col1 +2006-11-17 +2006-12-03 +select * from t2 order by col1; +col1 +2006-05-25 +2006-11-17 +2006-12-03 +select * from t3 order by col1; +col1 +2006-05-25 +2006-11-17 +2006-12-03 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-02-06' where col1='2006-12-03'; +update t2 set col1='2006-02-06' where col1='2006-12-03'; +update t3 set col1='2006-02-06' where col1='2006-12-03'; +update t4 set col1='2006-02-06' where col1='2006-12-03'; +update t5 set col1='2006-02-06' where col1='2006-12-03'; +update t6 set col1='2006-02-06' where col1='2006-12-03'; +select * from t1 order by col1; +col1 +2006-02-06 +2006-11-17 +select * from t2 order by col1; +col1 +2006-02-06 +2006-05-25 +2006-11-17 +select * from t3 order by col1; +col1 +2006-02-06 +2006-05-25 +2006-11-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Alter tables with weekday(col1) +------------------------------------------------------------------------- +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +create table t11 engine='NDB' as select * from t1; +create table t22 engine='NDB' as select * from t2; +create table t33 engine='NDB' as select * from t3; +create table t44 engine='NDB' as select * from t4; +create table t55 engine='NDB' as select * from t5; +create table t66 engine='NDB' as select * from t6; +alter table t11 +partition by range(weekday(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t22 +partition by list(weekday(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t33 +partition by hash(weekday(col1)); +alter table t44 +partition by range(colint) +subpartition by hash(weekday(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t55 +partition by list(colint) +subpartition by hash(weekday(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t66 +partition by range(colint) +(partition p0 values less than (weekday('2006-10-14')), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-02-06 +2006-11-17 +select * from t22 order by col1; +col1 +2006-02-06 +2006-05-25 +2006-11-17 +select * from t33 order by col1; +col1 +2006-02-06 +2006-05-25 +2006-11-17 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-02-06 +2006-11-17 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-02-06 +2006-11-17 +alter table t55 +partition by list(colint) +subpartition by hash(weekday(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (weekday(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */ +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (weekday('2006-10-14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (weekday('2006-10-14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with weekday(col1) +------------------------------------------------------------------------- +delete from t1 where col1='2006-11-17'; +delete from t2 where col1='2006-11-17'; +delete from t3 where col1='2006-11-17'; +delete from t4 where col1='2006-11-17'; +delete from t5 where col1='2006-11-17'; +delete from t6 where col1='2006-11-17'; +select * from t1 order by col1; +col1 +2006-02-06 +select * from t2 order by col1; +col1 +2006-02-06 +2006-05-25 +select * from t3 order by col1; +col1 +2006-02-06 +2006-05-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-11-17'); +insert into t2 values ('2006-11-17'); +insert into t3 values ('2006-11-17'); +insert into t4 values (60,'2006-11-17'); +insert into t5 values (60,'2006-11-17'); +insert into t6 values (60,'2006-11-17'); +select * from t1 order by col1; +col1 +2006-02-06 +2006-11-17 +select * from t2 order by col1; +col1 +2006-02-06 +2006-05-25 +2006-11-17 +select * from t3 order by col1; +col1 +2006-02-06 +2006-05-25 +2006-11-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-11-17 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-11-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-11-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +select * from t2 order by col1; +col1 +select * from t3 order by col1; +col1 +2006-02-06 +2006-05-25 +2006-11-17 +select * from t4 order by colint; +colint col1 +60 2006-11-17 +select * from t5 order by colint; +colint col1 +60 2006-11-17 +select * from t6 order by colint; +colint col1 +60 2006-11-17 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with weekday(col1) +------------------------------------------------------------------------- +delete from t11 where col1='2006-11-17'; +delete from t22 where col1='2006-11-17'; +delete from t33 where col1='2006-11-17'; +delete from t44 where col1='2006-11-17'; +delete from t55 where col1='2006-11-17'; +delete from t66 where col1='2006-11-17'; +select * from t11 order by col1; +col1 +2006-02-06 +select * from t22 order by col1; +col1 +2006-02-06 +2006-05-25 +select * from t33 order by col1; +col1 +2006-02-06 +2006-05-25 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-11-17'); +insert into t22 values ('2006-11-17'); +insert into t33 values ('2006-11-17'); +insert into t44 values (60,'2006-11-17'); +insert into t55 values (60,'2006-11-17'); +insert into t66 values (60,'2006-11-17'); +select * from t11 order by col1; +col1 +2006-02-06 +2006-11-17 +select * from t22 order by col1; +col1 +2006-02-06 +2006-05-25 +2006-11-17 +select * from t33 order by col1; +col1 +2006-02-06 +2006-05-25 +2006-11-17 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-11-17 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-11-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-11-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +select * from t22 order by col1; +col1 +select * from t33 order by col1; +col1 +2006-02-06 +2006-05-25 +2006-11-17 +select * from t44 order by colint; +colint col1 +60 2006-11-17 +select * from t55 order by colint; +colint col1 +60 2006-11-17 +select * from t66 order by colint; +colint col1 +60 2006-11-17 +------------------------- +---- some alter table end +------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +------------------------------------------------------------------------- +--- weekofyear(col1) in partition with coltype date +------------------------------------------------------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +------------------------------------------------------------------------- +--- Create tables with weekofyear(col1) +------------------------------------------------------------------------- +create table t1 (col1 date) engine='NDB' +partition by range(weekofyear(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t2 (col1 date) engine='NDB' +partition by list(weekofyear(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t3 (col1 date) engine='NDB' +partition by hash(weekofyear(col1)); +create table t4 (colint int, col1 date) engine='NDB' +partition by range(colint) +subpartition by hash(weekofyear(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t5 (colint int, col1 date) engine='NDB' +partition by list(colint) +subpartition by hash(weekofyear(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t6 (colint int, col1 date) engine='NDB' +partition by range(colint) +(partition p0 values less than (weekofyear('2006-02-14')), +partition p1 values less than maxvalue); +------------------------------------------------------------------------- +--- Access tables with weekofyear(col1) +------------------------------------------------------------------------- +insert into t1 values ('2006-01-03'); +insert into t1 values ('2006-03-17'); +insert into t2 values ('2006-01-03'); +insert into t2 values ('2006-03-17'); +insert into t2 values ('2006-05-25'); +insert into t3 values ('2006-01-03'); +insert into t3 values ('2006-03-17'); +insert into t3 values ('2006-05-25'); +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select weekofyear(col1) from t1 order by col1; +weekofyear(col1) +1 +11 +select * from t1 order by col1; +col1 +2006-01-03 +2006-03-17 +select * from t2 order by col1; +col1 +2006-01-03 +2006-03-17 +2006-05-25 +select * from t3 order by col1; +col1 +2006-01-03 +2006-03-17 +2006-05-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-09-06' where col1='2006-01-03'; +update t2 set col1='2006-09-06' where col1='2006-01-03'; +update t3 set col1='2006-09-06' where col1='2006-01-03'; +update t4 set col1='2006-09-06' where col1='2006-01-03'; +update t5 set col1='2006-09-06' where col1='2006-01-03'; +update t6 set col1='2006-09-06' where col1='2006-01-03'; +select * from t1 order by col1; +col1 +2006-03-17 +2006-09-06 +select * from t2 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t3 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Alter tables with weekofyear(col1) +------------------------------------------------------------------------- +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +create table t11 engine='NDB' as select * from t1; +create table t22 engine='NDB' as select * from t2; +create table t33 engine='NDB' as select * from t3; +create table t44 engine='NDB' as select * from t4; +create table t55 engine='NDB' as select * from t5; +create table t66 engine='NDB' as select * from t6; +alter table t11 +partition by range(weekofyear(col1)) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t22 +partition by list(weekofyear(col1)) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t33 +partition by hash(weekofyear(col1)); +alter table t44 +partition by range(colint) +subpartition by hash(weekofyear(col1)) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t55 +partition by list(colint) +subpartition by hash(weekofyear(col1)) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t66 +partition by range(colint) +(partition p0 values less than (weekofyear('2006-02-14')), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-03-17 +2006-09-06 +select * from t22 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t33 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-03-17 +2006-09-06 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-03-17 +2006-09-06 +alter table t55 +partition by list(colint) +subpartition by hash(weekofyear(col1)) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (weekofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */ +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (weekofyear('2006-02-14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (weekofyear('2006-02-14')), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with weekofyear(col1) +------------------------------------------------------------------------- +delete from t1 where col1='2006-03-17'; +delete from t2 where col1='2006-03-17'; +delete from t3 where col1='2006-03-17'; +delete from t4 where col1='2006-03-17'; +delete from t5 where col1='2006-03-17'; +delete from t6 where col1='2006-03-17'; +select * from t1 order by col1; +col1 +2006-09-06 +select * from t2 order by col1; +col1 +2006-05-25 +2006-09-06 +select * from t3 order by col1; +col1 +2006-05-25 +2006-09-06 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-03-17'); +insert into t2 values ('2006-03-17'); +insert into t3 values ('2006-03-17'); +insert into t4 values (60,'2006-03-17'); +insert into t5 values (60,'2006-03-17'); +insert into t6 values (60,'2006-03-17'); +select * from t1 order by col1; +col1 +2006-03-17 +2006-09-06 +select * from t2 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t3 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-03-17 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-03-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-03-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +2006-09-06 +select * from t2 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t3 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t4 order by colint; +colint col1 +60 2006-03-17 +select * from t5 order by colint; +colint col1 +60 2006-03-17 +select * from t6 order by colint; +colint col1 +60 2006-03-17 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with weekofyear(col1) +------------------------------------------------------------------------- +delete from t11 where col1='2006-03-17'; +delete from t22 where col1='2006-03-17'; +delete from t33 where col1='2006-03-17'; +delete from t44 where col1='2006-03-17'; +delete from t55 where col1='2006-03-17'; +delete from t66 where col1='2006-03-17'; +select * from t11 order by col1; +col1 +2006-09-06 +select * from t22 order by col1; +col1 +2006-05-25 +2006-09-06 +select * from t33 order by col1; +col1 +2006-05-25 +2006-09-06 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-03-17'); +insert into t22 values ('2006-03-17'); +insert into t33 values ('2006-03-17'); +insert into t44 values (60,'2006-03-17'); +insert into t55 values (60,'2006-03-17'); +insert into t66 values (60,'2006-03-17'); +select * from t11 order by col1; +col1 +2006-03-17 +2006-09-06 +select * from t22 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t33 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-03-17 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-03-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-03-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +2006-09-06 +select * from t22 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t33 order by col1; +col1 +2006-03-17 +2006-05-25 +2006-09-06 +select * from t44 order by colint; +colint col1 +60 2006-03-17 +select * from t55 order by colint; +colint col1 +60 2006-03-17 +select * from t66 order by colint; +colint col1 +60 2006-03-17 +------------------------- +---- some alter table end +------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +------------------------------------------------------------------------- +--- year(col1)-1990 in partition with coltype date +------------------------------------------------------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +------------------------------------------------------------------------- +--- Create tables with year(col1)-1990 +------------------------------------------------------------------------- +create table t1 (col1 date) engine='NDB' +partition by range(year(col1)-1990) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t2 (col1 date) engine='NDB' +partition by list(year(col1)-1990) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t3 (col1 date) engine='NDB' +partition by hash(year(col1)-1990); +create table t4 (colint int, col1 date) engine='NDB' +partition by range(colint) +subpartition by hash(year(col1)-1990) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t5 (colint int, col1 date) engine='NDB' +partition by list(colint) +subpartition by hash(year(col1)-1990) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t6 (colint int, col1 date) engine='NDB' +partition by range(colint) +(partition p0 values less than (year('2005-10-14')-1990), +partition p1 values less than maxvalue); +------------------------------------------------------------------------- +--- Access tables with year(col1)-1990 +------------------------------------------------------------------------- +insert into t1 values ('1996-01-03'); +insert into t1 values ('2000-02-17'); +insert into t2 values ('1996-01-03'); +insert into t2 values ('2000-02-17'); +insert into t2 values ('2004-05-25'); +insert into t3 values ('1996-01-03'); +insert into t3 values ('2000-02-17'); +insert into t3 values ('2004-05-25'); +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select year(col1)-1990 from t1 order by col1; +year(col1)-1990 +6 +10 +select * from t1 order by col1; +col1 +1996-01-03 +2000-02-17 +select * from t2 order by col1; +col1 +1996-01-03 +2000-02-17 +2004-05-25 +select * from t3 order by col1; +col1 +1996-01-03 +2000-02-17 +2004-05-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2002-02-15' where col1='1996-01-03'; +update t2 set col1='2002-02-15' where col1='1996-01-03'; +update t3 set col1='2002-02-15' where col1='1996-01-03'; +update t4 set col1='2002-02-15' where col1='1996-01-03'; +update t5 set col1='2002-02-15' where col1='1996-01-03'; +update t6 set col1='2002-02-15' where col1='1996-01-03'; +select * from t1 order by col1; +col1 +2000-02-17 +2002-02-15 +select * from t2 order by col1; +col1 +2000-02-17 +2002-02-15 +2004-05-25 +select * from t3 order by col1; +col1 +2000-02-17 +2002-02-15 +2004-05-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Alter tables with year(col1)-1990 +------------------------------------------------------------------------- +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +create table t11 engine='NDB' as select * from t1; +create table t22 engine='NDB' as select * from t2; +create table t33 engine='NDB' as select * from t3; +create table t44 engine='NDB' as select * from t4; +create table t55 engine='NDB' as select * from t5; +create table t66 engine='NDB' as select * from t6; +alter table t11 +partition by range(year(col1)-1990) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t22 +partition by list(year(col1)-1990) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t33 +partition by hash(year(col1)-1990); +alter table t44 +partition by range(colint) +subpartition by hash(year(col1)-1990) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t55 +partition by list(colint) +subpartition by hash(year(col1)-1990) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t66 +partition by range(colint) +(partition p0 values less than (year('2005-10-14')-1990), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2000-02-17 +2002-02-15 +select * from t22 order by col1; +col1 +2000-02-17 +2002-02-15 +2004-05-25 +select * from t33 order by col1; +col1 +2000-02-17 +2002-02-15 +2004-05-25 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2000-02-17 +2002-02-15 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2000-02-17 +2002-02-15 +alter table t55 +partition by list(colint) +subpartition by hash(year(col1)-1990) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (year(col1)-1990) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */ +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (year('2005-10-14')-1990), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (year('2005-10-14')-1990), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with year(col1)-1990 +------------------------------------------------------------------------- +delete from t1 where col1='2000-02-17'; +delete from t2 where col1='2000-02-17'; +delete from t3 where col1='2000-02-17'; +delete from t4 where col1='2000-02-17'; +delete from t5 where col1='2000-02-17'; +delete from t6 where col1='2000-02-17'; +select * from t1 order by col1; +col1 +2002-02-15 +select * from t2 order by col1; +col1 +2002-02-15 +2004-05-25 +select * from t3 order by col1; +col1 +2002-02-15 +2004-05-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2000-02-17'); +insert into t2 values ('2000-02-17'); +insert into t3 values ('2000-02-17'); +insert into t4 values (60,'2000-02-17'); +insert into t5 values (60,'2000-02-17'); +insert into t6 values (60,'2000-02-17'); +select * from t1 order by col1; +col1 +2000-02-17 +2002-02-15 +select * from t2 order by col1; +col1 +2000-02-17 +2002-02-15 +2004-05-25 +select * from t3 order by col1; +col1 +2000-02-17 +2002-02-15 +2004-05-25 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2000-02-17 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2000-02-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2000-02-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +select * from t2 order by col1; +col1 +2002-02-15 +2004-05-25 +select * from t3 order by col1; +col1 +2000-02-17 +2002-02-15 +2004-05-25 +select * from t4 order by colint; +colint col1 +60 2000-02-17 +select * from t5 order by colint; +colint col1 +60 2000-02-17 +select * from t6 order by colint; +colint col1 +60 2000-02-17 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with year(col1)-1990 +------------------------------------------------------------------------- +delete from t11 where col1='2000-02-17'; +delete from t22 where col1='2000-02-17'; +delete from t33 where col1='2000-02-17'; +delete from t44 where col1='2000-02-17'; +delete from t55 where col1='2000-02-17'; +delete from t66 where col1='2000-02-17'; +select * from t11 order by col1; +col1 +2002-02-15 +select * from t22 order by col1; +col1 +2002-02-15 +2004-05-25 +select * from t33 order by col1; +col1 +2002-02-15 +2004-05-25 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2000-02-17'); +insert into t22 values ('2000-02-17'); +insert into t33 values ('2000-02-17'); +insert into t44 values (60,'2000-02-17'); +insert into t55 values (60,'2000-02-17'); +insert into t66 values (60,'2000-02-17'); +select * from t11 order by col1; +col1 +2000-02-17 +2002-02-15 +select * from t22 order by col1; +col1 +2000-02-17 +2002-02-15 +2004-05-25 +select * from t33 order by col1; +col1 +2000-02-17 +2002-02-15 +2004-05-25 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2000-02-17 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2000-02-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2000-02-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +select * from t22 order by col1; +col1 +2002-02-15 +2004-05-25 +select * from t33 order by col1; +col1 +2000-02-17 +2002-02-15 +2004-05-25 +select * from t44 order by colint; +colint col1 +60 2000-02-17 +select * from t55 order by colint; +colint col1 +60 2000-02-17 +select * from t66 order by colint; +colint col1 +60 2000-02-17 +------------------------- +---- some alter table end +------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +------------------------------------------------------------------------- +--- yearweek(col1)-200600 in partition with coltype date +------------------------------------------------------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +------------------------------------------------------------------------- +--- Create tables with yearweek(col1)-200600 +------------------------------------------------------------------------- +create table t1 (col1 date) engine='NDB' +partition by range(yearweek(col1)-200600) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t2 (col1 date) engine='NDB' +partition by list(yearweek(col1)-200600) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t3 (col1 date) engine='NDB' +partition by hash(yearweek(col1)-200600); +create table t4 (colint int, col1 date) engine='NDB' +partition by range(colint) +subpartition by hash(yearweek(col1)-200600) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +create table t5 (colint int, col1 date) engine='NDB' +partition by list(colint) +subpartition by hash(yearweek(col1)-200600) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +create table t6 (colint int, col1 date) engine='NDB' +partition by range(colint) +(partition p0 values less than (yearweek('2006-10-14')-200600), +partition p1 values less than maxvalue); +------------------------------------------------------------------------- +--- Access tables with yearweek(col1)-200600 +------------------------------------------------------------------------- +insert into t1 values ('2006-01-03'); +insert into t1 values ('2006-08-17'); +insert into t2 values ('2006-01-03'); +insert into t2 values ('2006-08-17'); +insert into t2 values ('2006-03-25'); +insert into t3 values ('2006-01-03'); +insert into t3 values ('2006-08-17'); +insert into t3 values ('2006-03-25'); +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5; +load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6; +select yearweek(col1)-200600 from t1 order by col1; +yearweek(col1)-200600 +1 +33 +select * from t1 order by col1; +col1 +2006-01-03 +2006-08-17 +select * from t2 order by col1; +col1 +2006-01-03 +2006-03-25 +2006-08-17 +select * from t3 order by col1; +col1 +2006-01-03 +2006-03-25 +2006-08-17 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +update t1 set col1='2006-11-15' where col1='2006-01-03'; +update t2 set col1='2006-11-15' where col1='2006-01-03'; +update t3 set col1='2006-11-15' where col1='2006-01-03'; +update t4 set col1='2006-11-15' where col1='2006-01-03'; +update t5 set col1='2006-11-15' where col1='2006-01-03'; +update t6 set col1='2006-11-15' where col1='2006-01-03'; +select * from t1 order by col1; +col1 +2006-08-17 +2006-11-15 +select * from t2 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t3 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Alter tables with yearweek(col1)-200600 +------------------------------------------------------------------------- +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; +create table t11 engine='NDB' as select * from t1; +create table t22 engine='NDB' as select * from t2; +create table t33 engine='NDB' as select * from t3; +create table t44 engine='NDB' as select * from t4; +create table t55 engine='NDB' as select * from t5; +create table t66 engine='NDB' as select * from t6; +alter table t11 +partition by range(yearweek(col1)-200600) +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t22 +partition by list(yearweek(col1)-200600) +(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t33 +partition by hash(yearweek(col1)-200600); +alter table t44 +partition by range(colint) +subpartition by hash(yearweek(col1)-200600) subpartitions 2 +(partition p0 values less than (15), +partition p1 values less than maxvalue); +alter table t55 +partition by list(colint) +subpartition by hash(yearweek(col1)-200600) subpartitions 2 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +alter table t66 +partition by range(colint) +(partition p0 values less than (yearweek('2006-10-14')-200600), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-08-17 +2006-11-15 +select * from t22 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t33 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +--------------------------- +---- some alter table begin +--------------------------- +alter table t11 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-08-17 +2006-11-15 +alter table t11 +reorganize partition s1 into +(partition p0 values less than (15), +partition p1 values less than maxvalue); +select * from t11 order by col1; +col1 +2006-08-17 +2006-11-15 +alter table t55 +partition by list(colint) +subpartition by hash(yearweek(col1)-200600) subpartitions 5 +(partition p0 values in (1,2,3,4,5,6,7,8,9,10), +partition p1 values in (11,12,13,14,15,16,17,18,19,20), +partition p2 values in (21,22,23,24,25,26,27,28,29,30), +partition p3 values in (31,32,33,34,35,36,37,38,39,40), +partition p4 values in (41,42,43,44,45,46,47,48,49,50), +partition p5 values in (51,52,53,54,55,56,57,58,59,60) +); +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` date DEFAULT NULL +) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (yearweek(col1)-200600) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */ +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (yearweek('2006-10-14')-200600), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition p0,p1 into +(partition s1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +alter table t66 +reorganize partition s1 into +(partition p0 values less than (yearweek('2006-10-14')-200600), +partition p1 values less than maxvalue); +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with yearweek(col1)-200600 +------------------------------------------------------------------------- +delete from t1 where col1='2006-08-17'; +delete from t2 where col1='2006-08-17'; +delete from t3 where col1='2006-08-17'; +delete from t4 where col1='2006-08-17'; +delete from t5 where col1='2006-08-17'; +delete from t6 where col1='2006-08-17'; +select * from t1 order by col1; +col1 +2006-11-15 +select * from t2 order by col1; +col1 +2006-03-25 +2006-11-15 +select * from t3 order by col1; +col1 +2006-03-25 +2006-11-15 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t1 values ('2006-08-17'); +insert into t2 values ('2006-08-17'); +insert into t3 values ('2006-08-17'); +insert into t4 values (60,'2006-08-17'); +insert into t5 values (60,'2006-08-17'); +insert into t6 values (60,'2006-08-17'); +select * from t1 order by col1; +col1 +2006-08-17 +2006-11-15 +select * from t2 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t3 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t4 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-08-17 +select * from t5 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-08-17 +select * from t6 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-08-17 +alter table t1 drop partition p0; +alter table t2 drop partition p0; +alter table t4 drop partition p0; +alter table t5 drop partition p0; +alter table t6 drop partition p0; +select * from t1 order by col1; +col1 +2006-08-17 +2006-11-15 +select * from t2 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t3 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t4 order by colint; +colint col1 +60 2006-08-17 +select * from t5 order by colint; +colint col1 +60 2006-08-17 +select * from t6 order by colint; +colint col1 +60 2006-08-17 +------------------------------------------------------------------------- +--- Delete rows and partitions of tables with yearweek(col1)-200600 +------------------------------------------------------------------------- +delete from t11 where col1='2006-08-17'; +delete from t22 where col1='2006-08-17'; +delete from t33 where col1='2006-08-17'; +delete from t44 where col1='2006-08-17'; +delete from t55 where col1='2006-08-17'; +delete from t66 where col1='2006-08-17'; +select * from t11 order by col1; +col1 +2006-11-15 +select * from t22 order by col1; +col1 +2006-03-25 +2006-11-15 +select * from t33 order by col1; +col1 +2006-03-25 +2006-11-15 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +insert into t11 values ('2006-08-17'); +insert into t22 values ('2006-08-17'); +insert into t33 values ('2006-08-17'); +insert into t44 values (60,'2006-08-17'); +insert into t55 values (60,'2006-08-17'); +insert into t66 values (60,'2006-08-17'); +select * from t11 order by col1; +col1 +2006-08-17 +2006-11-15 +select * from t22 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t33 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t44 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-08-17 +select * from t55 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-08-17 +select * from t66 order by colint; +colint col1 +1 2006-02-03 +2 2006-01-17 +3 2006-01-25 +4 2006-02-05 +60 2006-08-17 +alter table t11 drop partition p0; +alter table t22 drop partition p0; +alter table t44 drop partition p0; +alter table t55 drop partition p0; +alter table t66 drop partition p0; +select * from t11 order by col1; +col1 +2006-08-17 +2006-11-15 +select * from t22 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t33 order by col1; +col1 +2006-03-25 +2006-08-17 +2006-11-15 +select * from t44 order by colint; +colint col1 +60 2006-08-17 +select * from t55 order by colint; +colint col1 +60 2006-08-17 +select * from t66 order by colint; +colint col1 +60 2006-08-17 +------------------------- +---- some alter table end +------------------------- +drop table if exists t1 ; +drop table if exists t2 ; +drop table if exists t3 ; +drop table if exists t4 ; +drop table if exists t5 ; +drop table if exists t6 ; +drop table if exists t11 ; +drop table if exists t22 ; +drop table if exists t33 ; +drop table if exists t44 ; +drop table if exists t55 ; +drop table if exists t66 ; diff --git a/mysql-test/suite/partitions/r/partition_t55.out b/mysql-test/suite/partitions/r/partition_t55.out new file mode 100644 index 00000000000..d86ceda8c38 --- /dev/null +++ b/mysql-test/suite/partitions/r/partition_t55.out @@ -0,0 +1,68 @@ +show create table t55; +Table Create Table +t55 CREATE TABLE `t55` ( + `colint` int(11) DEFAULT NULL, + `col1` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (abs(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ +27 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp0.MYD +1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp0.MYI +18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp1.MYD +1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp1.MYI +9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp2.MYD +1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp2.MYI +18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp3.MYD +1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp3.MYI +18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp4.MYD +1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp4.MYI +9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp0.MYD +1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp0.MYI +9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp1.MYD +1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp1.MYI +18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp2.MYD +1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp2.MYI +18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp3.MYD +1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp3.MYI +36 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp4.MYD +1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp4.MYI +36 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp0.MYD +1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp0.MYI +0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp1.MYD +1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp1.MYI +9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp2.MYD +1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp2.MYI +18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp3.MYD +1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp3.MYI +27 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp4.MYD +1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp4.MYI +9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp0.MYD +1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp0.MYI +9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp1.MYD +1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp1.MYI +9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp2.MYD +1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp2.MYI +18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp3.MYD +1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp3.MYI +45 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp4.MYD +1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp4.MYI +9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp0.MYD +1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp0.MYI +9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp1.MYD +1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp1.MYI +9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp2.MYD +1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp2.MYI +0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp3.MYD +1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp3.MYI +0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp4.MYD +1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp4.MYI +0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp0.MYD +1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp0.MYI +0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp1.MYD +1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp1.MYI +0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp2.MYD +1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp2.MYI +9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp3.MYD +1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp3.MYI +9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp4.MYD +1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp4.MYI +8594 MYSQL_TEST_DIR/var/master-data/test/t55.frm +408 MYSQL_TEST_DIR/var/master-data/test/t55.par diff --git a/mysql-test/suite/partitions/t/disabled.def b/mysql-test/suite/partitions/t/disabled.def index ede5d6b6e60..212ca0206e2 100644 --- a/mysql-test/suite/partitions/t/disabled.def +++ b/mysql-test/suite/partitions/t/disabled.def @@ -13,4 +13,4 @@ partition_alter2_ndb : cannot create t1 partition_char_innodb : crash. Bug? More investigations partition_sessions : needs system_3_init.inc partition_engine_ndb : cannot create t1 - +partition_supported_sql_func_ndb : cannot create t1 diff --git a/mysql-test/suite/partitions/t/partition_supported_sql_func_innodb.test b/mysql-test/suite/partitions/t/partition_supported_sql_func_innodb.test index 4440f814d1e..135c869c841 100644 --- a/mysql-test/suite/partitions/t/partition_supported_sql_func_innodb.test +++ b/mysql-test/suite/partitions/t/partition_supported_sql_func_innodb.test @@ -2,8 +2,8 @@ # t/partition_supported_sql_funcs_innodb.test # # # # Purpose: # -# Tests around sql functions # -# INNODB branch # +# Tests which SQL functions are allowed in partinioning clauses with # +# INNODB. # # # #------------------------------------------------------------------------------# # Original Author: HH # @@ -18,16 +18,12 @@ # 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 include/partition.pre before changing -# any of the variables. -# - #------------------------------------------------------------------------------# # General not engine specific settings and requirements ##### Options, for debugging support ##### let $debug= 0; -let $do_long_tests= 0; +let $do_long_tests= 1; # The server must support partitioning. --source include/have_partition.inc diff --git a/mysql-test/suite/partitions/t/partition_supported_sql_func_myisam.test b/mysql-test/suite/partitions/t/partition_supported_sql_func_myisam.test index 3daa72c7ff7..131a5e23f39 100644 --- a/mysql-test/suite/partitions/t/partition_supported_sql_func_myisam.test +++ b/mysql-test/suite/partitions/t/partition_supported_sql_func_myisam.test @@ -2,8 +2,8 @@ # t/partition_supported_sql_funcs_myisam.test # # # # Purpose: # -# Tests around sql functions # -# MyISAM branch # +# Tests which SQL functions are allowed in partinioning clauses with # +# MYISAM. # # # #------------------------------------------------------------------------------# # Original Author: HH # @@ -27,7 +27,7 @@ ##### Options, for debugging support ##### let $debug= 0; -let $do_long_tests= 0; +let $do_long_tests= 1; # The server must support partitioning. --source include/have_partition.inc diff --git a/mysql-test/suite/partitions/t/partition_supported_sql_func_ndb.test b/mysql-test/suite/partitions/t/partition_supported_sql_func_ndb.test new file mode 100644 index 00000000000..2a536fbce94 --- /dev/null +++ b/mysql-test/suite/partitions/t/partition_supported_sql_func_ndb.test @@ -0,0 +1,40 @@ +################################################################################ +# t/partition_supported_sql_funcs_myisam.test # +# # +# Purpose: # +# Tests which SQL functions are allowed in partinioning clauses with # +# NDB. # +# # +#------------------------------------------------------------------------------# +# Original Author: HH # +# Original Date: 2006-11-22 # +# Change Author: # +# Change Date: # +# Change: # +################################################################################ + +# +# NOTE: PLEASE DO NOT ADD NOT NDB SPECIFIC TESTCASES HERE ! +# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN +# THE SOURCED FILES ONLY. +#------------------------------------------------------------------------------# +# General not engine specific settings and requirements + +##### Options, for debugging support ##### +let $debug= 0; +let $do_long_tests= 1; + +# The server must support partitioning. +--source include/have_partition.inc + +#------------------------------------------------------------------------------# +# Engine specific settings and requirements + +--source include/have_ndb.inc +##### Storage engine to be tested +let $engine= 'NDB'; + +#------------------------------------------------------------------------------# +--source suite/partitions/include/partition_supported_sql_funcs_main.inc +# --source include/partition_supported_sql_funcs_main.inc + From c5fb0344647bca1d13a060feab3bb7177d8fb540 Mon Sep 17 00:00:00 2001 From: "kent/kboortz@mysql.com/production.mysql.com" <> Date: Sat, 7 Apr 2007 04:14:44 +0200 Subject: [PATCH 13/17] mysql.spec.sh: Removed man page for "mysql_create_system_tables" --- support-files/mysql.spec.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 39e3ada88d6..54e2a6adba6 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -556,7 +556,6 @@ fi %attr(755, root, root) %{_bindir}/myisamlog %attr(755, root, root) %{_bindir}/myisampack %attr(755, root, root) %{_bindir}/mysql_convert_table_format -%attr(755, root, root) %{_bindir}/mysql_create_system_tables %attr(755, root, root) %{_bindir}/mysql_explain_log %attr(755, root, root) %{_bindir}/mysql_fix_extensions %attr(755, root, root) %{_bindir}/mysql_fix_privilege_tables @@ -716,6 +715,10 @@ fi # itself - note that they must be ordered by date (important when # merging BK trees) %changelog +* Sat Apr 07 2007 Kent Boortz + +- Removed man page for "mysql_create_system_tables" + * Wed Mar 21 2007 Daniel Fischer - Add debug server. From 8e7e7d6b37354569799215a98aaaaea857a813e1 Mon Sep 17 00:00:00 2001 From: "df@pippilotta.erinye.com" <> Date: Tue, 10 Apr 2007 11:31:45 +0200 Subject: [PATCH 14/17] add a manual page back --- support-files/mysql.spec.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 99fcfdc9b39..506cdf70604 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -556,6 +556,7 @@ fi %doc %attr(644, root, man) %{_mandir}/man1/mysqld_multi.1* %doc %attr(644, root, man) %{_mandir}/man1/mysqld_safe.1* %doc %attr(644, root, man) %{_mandir}/man1/mysql_fix_privilege_tables.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysql_install_db.1 %doc %attr(644, root, man) %{_mandir}/man1/mysql_upgrade.1* %doc %attr(644, root, man) %{_mandir}/man1/mysqlhotcopy.1* %doc %attr(644, root, man) %{_mandir}/man1/mysqlman.1* From 8bcdaa86cf3655151ab6f1f9007e30c06ba16515 Mon Sep 17 00:00:00 2001 From: "kent@mysql.com/kent-amd64.(none)" <> Date: Wed, 11 Apr 2007 01:47:42 +0200 Subject: [PATCH 15/17] my_memmem.c: Back port of include change and copyright from 5.1 Makefile.am, zlib.m4: Use separate libtool convenience library for the bundled zlib to embed into executables and shared libraries created, and one to install into the pkglib directory --- config/ac-macros/zlib.m4 | 2 +- mysys/my_memmem.c | 18 +++++++++++++++++- zlib/Makefile.am | 17 +++++++++-------- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/config/ac-macros/zlib.m4 b/config/ac-macros/zlib.m4 index 74de715e424..5defdfd6749 100644 --- a/config/ac-macros/zlib.m4 +++ b/config/ac-macros/zlib.m4 @@ -2,7 +2,7 @@ dnl Define zlib paths to point at bundled zlib AC_DEFUN([MYSQL_USE_BUNDLED_ZLIB], [ ZLIB_INCLUDES="-I\$(top_srcdir)/zlib" -ZLIB_LIBS="\$(top_builddir)/zlib/libz.la" +ZLIB_LIBS="\$(top_builddir)/zlib/libzlt.la" dnl Omit -L$pkglibdir as it's always in the list of mysql_config deps. ZLIB_DEPS="-lz" zlib_dir="zlib" diff --git a/mysys/my_memmem.c b/mysys/my_memmem.c index 682a1314f09..9230337409d 100644 --- a/mysys/my_memmem.c +++ b/mysys/my_memmem.c @@ -1,4 +1,20 @@ -#include "my_base.h" +/* Copyright (C) 2000 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include +#include /* my_memmem, port of a GNU extension. diff --git a/zlib/Makefile.am b/zlib/Makefile.am index f5741a782fb..edcbd5f4a75 100644 --- a/zlib/Makefile.am +++ b/zlib/Makefile.am @@ -19,17 +19,18 @@ INCLUDES= -I$(top_builddir)/include -I$(top_srcdir)/include LIBS= $(NON_THREADED_LIBS) -pkglib_LTLIBRARIES=libz.la +pkglib_LTLIBRARIES = libz.la +noinst_LTLIBRARIES = libzlt.la -# We are never interested in a shared version -libz_la_LDFLAGS= -static +libz_la_LDFLAGS = -static -noinst_HEADERS= crc32.h deflate.h inffast.h inffixed.h inflate.h \ - inftrees.h trees.h zconf.h zlib.h zutil.h +noinst_HEADERS = crc32.h deflate.h inffast.h inffixed.h inflate.h \ + inftrees.h trees.h zconf.h zlib.h zutil.h -libz_la_SOURCES= adler32.c compress.c crc32.c deflate.c gzio.c \ - infback.c inffast.c inflate.c inftrees.c trees.c \ - uncompr.c zutil.c +libz_la_SOURCES = adler32.c compress.c crc32.c deflate.c gzio.c \ + infback.c inffast.c inflate.c inftrees.c trees.c \ + uncompr.c zutil.c +libzlt_la_SOURCES = $(libz_la_SOURCES) EXTRA_DIST= README FAQ INDEX ChangeLog algorithm.txt zlib.3 CMakeLists.txt From d5f6363ba107fe4312223c7052538f2f01da9050 Mon Sep 17 00:00:00 2001 From: "df@pippilotta.erinye.com" <> Date: Wed, 11 Apr 2007 13:01:11 +0200 Subject: [PATCH 16/17] make configure handle service pack version strings --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index a447732a06a..d3da80c2a16 100644 --- a/configure.in +++ b/configure.in @@ -30,7 +30,7 @@ NDB_VERSION_STATUS="" # Remember that regexps needs to quote [ and ] since this is run through m4 MYSQL_NO_DASH_VERSION=`echo $VERSION | sed -e "s|[[a-z]]*-.*$||"` MYSQL_BASE_VERSION=`echo $MYSQL_NO_DASH_VERSION | sed -e "s|\.[[^.]]*$||"` -MYSQL_VERSION_ID=`echo $MYSQL_NO_DASH_VERSION. | sed -e 's/[[^0-9.]]//g; s/\./ /g; s/ \([[0-9]]\) / 0\\1 /g; s/ //g'` +MYSQL_VERSION_ID=`echo $MYSQL_NO_DASH_VERSION | sed -e 's|[[^0-9.]].*$||;s|$|.|' | sed -e 's/[[^0-9.]]//g; s/\./ /g; s/ \([[0-9]]\) / 0\\1 /g; s/ //g'` # The port should be constant for a LONG time MYSQL_TCP_PORT_DEFAULT=3306 From 6d70fd8751b09e78018a0a79047c7e84e8cf6e40 Mon Sep 17 00:00:00 2001 From: "df@pippilotta.erinye.com" <> Date: Wed, 11 Apr 2007 14:27:03 +0200 Subject: [PATCH 17/17] don't copy pdb files from the release target output folder, since this target does not build them --- scripts/make_win_bin_dist | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/make_win_bin_dist b/scripts/make_win_bin_dist index 862c572a75a..2e10e530ca6 100755 --- a/scripts/make_win_bin_dist +++ b/scripts/make_win_bin_dist @@ -146,7 +146,11 @@ mkdir $DESTDIR/bin cp client/$TARGET/*.exe $DESTDIR/bin/ cp extra/$TARGET/*.exe $DESTDIR/bin/ cp storage/myisam/$TARGET/*.exe $DESTDIR/bin/ -cp server-tools/instance-manager/$TARGET/*.{exe,map,pdb} $DESTDIR/bin/ +cp server-tools/instance-manager/$TARGET/*.{exe,map} $DESTDIR/bin/ +if [ x"$TARGET" != x"release" ] +then + cp server-tools/instance-manager/$TARGET/*.pdb $DESTDIR/bin/ +fi cp tests/$TARGET/*.exe $DESTDIR/bin/ cp libmysql/$TARGET/*.exe $DESTDIR/bin/ cp libmysql/$TARGET/libmysql.dll $DESTDIR/bin/ @@ -155,8 +159,11 @@ cp libmysql/$TARGET/libmysql.dll $DESTDIR/bin/ mv $DESTDIR/bin/comp_err.exe $DESTDIR/bin/comp-err.exe cp sql/$TARGET/mysqld.exe $DESTDIR/bin/mysqld$EXE_SUFFIX.exe -cp sql/$TARGET/mysqld.pdb $DESTDIR/bin/mysqld$EXE_SUFFIX.pdb cp sql/$TARGET/mysqld.map $DESTDIR/bin/mysqld$EXE_SUFFIX.map +if [ x"$TARGET" != x"release" ] +then + cp sql/$TARGET/mysqld.pdb $DESTDIR/bin/mysqld$EXE_SUFFIX.pdb +fi if [ x"$PACK_DEBUG" = "" -a -f "sql/debug/mysqld.exe" -o \ x"$PACK_DEBUG" = "yes" ] ; then