Merge 10.3 into 10.4

This commit is contained in:
Marko Mäkelä 2018-11-06 16:24:16 +02:00
commit 074c684099
394 changed files with 24300 additions and 10755 deletions

1
.gitignore vendored
View File

@ -262,6 +262,7 @@ storage/mroonga/vendor/groonga/src/groonga-benchmark
storage/mroonga/vendor/groonga/src/suggest/groonga-suggest-create-dataset storage/mroonga/vendor/groonga/src/suggest/groonga-suggest-create-dataset
storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result
storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result
zlib/zconf.h
xxx/* xxx/*
yyy/* yyy/*
zzz/* zzz/*

View File

@ -1,5 +1,5 @@
# Copyright (c) 2006, 2017, Oracle and/or its affiliates. # Copyright (c) 2006, 2017, Oracle and/or its affiliates.
# Copyright (c) 2008, 2017, MariaDB # Copyright (c) 2008, 2018, MariaDB Corporation
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by

View File

@ -64,10 +64,14 @@ and COPYING.thirdparty files.
Bug Reports: Bug Reports:
------------ ------------
Bug and/or error reports regarding MariaDB should be submitted at Bug and/or error reports regarding MariaDB should be submitted at:
https://mariadb.org/jira https://jira.mariadb.org
Bugs in the MySQL code can also be submitted at https://bugs.mysql.com For reporting security vulnerabilities see:
https://mariadb.org/about/security-policy/
Bugs in the MySQL code can also be submitted at:
https://bugs.mysql.com
The code for MariaDB, including all revision history, can be found at: The code for MariaDB, including all revision history, can be found at:
https://github.com/MariaDB/server https://github.com/MariaDB/server

View File

@ -1,4 +1,5 @@
# Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2008, 2018, MariaDB Corporation
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2000, 2014, Oracle and/or its affiliates. Copyright (c) 2000, 2018, Oracle and/or its affiliates.
Copyright (c) 2009, 2017, MariaDB Copyright (c) 2009, 2018, MariaDB Corporation
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -1483,7 +1483,7 @@ static struct my_option my_long_options[] =
{"batch", 'B', {"batch", 'B',
"Don't use history file. Disable interactive behavior. (Enables --silent.)", "Don't use history file. Disable interactive behavior. (Enables --silent.)",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"binary-as-hex", 'b', "Print binary data as hex", &opt_binhex, &opt_binhex, {"binary-as-hex", 0, "Print binary data as hex", &opt_binhex, &opt_binhex,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR, {"character-sets-dir", OPT_CHARSETS_DIR,
"Directory for character set files.", &charsets_dir, "Directory for character set files.", &charsets_dir,

View File

@ -99,12 +99,15 @@ SET(ignored
"%ignore /etc" "%ignore /etc"
"%ignore /etc/init.d" "%ignore /etc/init.d"
"%ignore /etc/logrotate.d" "%ignore /etc/logrotate.d"
"%ignore /etc/systemd"
"%ignore /etc/systemd/system"
"%ignore ${CMAKE_INSTALL_PREFIX}" "%ignore ${CMAKE_INSTALL_PREFIX}"
"%ignore ${CMAKE_INSTALL_PREFIX}/bin" "%ignore ${CMAKE_INSTALL_PREFIX}/bin"
"%ignore ${CMAKE_INSTALL_PREFIX}/include" "%ignore ${CMAKE_INSTALL_PREFIX}/include"
"%ignore ${CMAKE_INSTALL_PREFIX}/lib" "%ignore ${CMAKE_INSTALL_PREFIX}/lib"
"%ignore ${CMAKE_INSTALL_PREFIX}/lib/systemd" "%ignore ${CMAKE_INSTALL_PREFIX}/lib/systemd"
"%ignore ${CMAKE_INSTALL_PREFIX}/lib/systemd/system" "%ignore ${CMAKE_INSTALL_PREFIX}/lib/systemd/system"
"%ignore ${CMAKE_INSTALL_PREFIX}/lib/tmpfiles.d"
"%ignore ${CMAKE_INSTALL_PREFIX}/lib64" "%ignore ${CMAKE_INSTALL_PREFIX}/lib64"
"%ignore ${CMAKE_INSTALL_PREFIX}/sbin" "%ignore ${CMAKE_INSTALL_PREFIX}/sbin"
"%ignore ${CMAKE_INSTALL_PREFIX}/share" "%ignore ${CMAKE_INSTALL_PREFIX}/share"

View File

@ -136,6 +136,10 @@ MACRO(MERGE_STATIC_LIBS TARGET OUTPUT_NAME LIBS_TO_MERGE)
SET(SOURCE_FILE ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_depends.c) SET(SOURCE_FILE ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_depends.c)
ADD_LIBRARY(${TARGET} STATIC ${SOURCE_FILE}) ADD_LIBRARY(${TARGET} STATIC ${SOURCE_FILE})
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES OUTPUT_NAME ${OUTPUT_NAME}) SET_TARGET_PROPERTIES(${TARGET} PROPERTIES OUTPUT_NAME ${OUTPUT_NAME})
IF(NOT _SKIP_PIC)
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES COMPILE_FLAGS
"${CMAKE_SHARED_LIBRARY_C_FLAGS}")
ENDIF()
SET(OSLIBS) SET(OSLIBS)
FOREACH(LIB ${LIBS_TO_MERGE}) FOREACH(LIB ${LIBS_TO_MERGE})
@ -239,11 +243,11 @@ MACRO(MERGE_LIBRARIES)
# check for non-PIC libraries # check for non-PIC libraries
IF(NOT _SKIP_PIC) IF(NOT _SKIP_PIC)
FOREACH(LIB ${LIBS}) FOREACH(LIB ${LIBS})
GET_TARGET_PROPERTY(${LIB} TYPE LIBTYPE) GET_TARGET_PROPERTY(LTYPE ${LIB} TYPE)
IF(LIBTYPE STREQUAL "STATIC_LIBRARY") IF(LTYPE STREQUAL "STATIC_LIBRARY")
GET_TARGET_PROPERTY(LIB COMPILE_FLAGS LIB_COMPILE_FLAGS) GET_TARGET_PROPERTY(LIB_COMPILE_FLAGS ${LIB} COMPILE_FLAGS)
STRING(REPLACE "${CMAKE_SHARED_LIBRARY_C_FLAGS}" STRING(REPLACE "${CMAKE_SHARED_LIBRARY_C_FLAGS}"
"<PIC_FLAG>" LIB_COMPILE_FLAGS ${LIB_COMPILE_FLAG}) "<PIC_FLAG>" LIB_COMPILE_FLAGS "${LIB_COMPILE_FLAGS}")
IF(NOT LIB_COMPILE_FLAGS MATCHES "<PIC_FLAG>") IF(NOT LIB_COMPILE_FLAGS MATCHES "<PIC_FLAG>")
MESSAGE(FATAL_ERROR MESSAGE(FATAL_ERROR
"Attempted to link non-PIC static library ${LIB} to shared library ${TARGET}\n" "Attempted to link non-PIC static library ${LIB} to shared library ${TARGET}\n"

View File

@ -204,9 +204,8 @@ IF(MSVC)
ENDIF() ENDIF()
# Always link with socket library # Always link with socket library
LINK_LIBRARIES(ws2_32) STRING(APPEND CMAKE_C_STANDARD_LIBRARIES " ws2_32.lib")
# ..also for tests STRING(APPEND CMAKE_CXX_STANDARD_LIBRARIES " ws2_32.lib")
SET(CMAKE_REQUIRED_LIBRARIES ws2_32)
# System checks # System checks
SET(SIGNAL_WITH_VIO_CLOSE 1) # Something that runtime team needs SET(SIGNAL_WITH_VIO_CLOSE 1) # Something that runtime team needs

View File

@ -1,4 +1,5 @@
# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2009, 2018, Oracle and/or its affiliates.
# Copyright (c) 2011, 2018, MariaDB Corporation
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by

View File

@ -159,12 +159,12 @@ MACRO (MYSQL_CHECK_SSL)
SET(CMAKE_REQUIRED_LIBRARIES) SET(CMAKE_REQUIRED_LIBRARIES)
ELSE() ELSE()
IF(WITH_SSL STREQUAL "system") IF(WITH_SSL STREQUAL "system")
MESSAGE(SEND_ERROR "Cannot find appropriate system libraries for SSL. Use WITH_SSL=bundled to enable SSL support") MESSAGE(FATAL_ERROR "Cannot find appropriate system libraries for SSL. Use WITH_SSL=bundled to enable SSL support")
ENDIF() ENDIF()
MYSQL_USE_BUNDLED_SSL() MYSQL_USE_BUNDLED_SSL()
ENDIF() ENDIF()
ELSE() ELSE()
MESSAGE(SEND_ERROR MESSAGE(FATAL_ERROR
"Wrong option for WITH_SSL. Valid values are: ${WITH_SSL_DOC}") "Wrong option for WITH_SSL. Valid values are: ${WITH_SSL_DOC}")
ENDIF() ENDIF()
ENDMACRO() ENDMACRO()

View File

@ -1,4 +1,4 @@
# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -14,15 +14,12 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
MACRO (MYSQL_USE_BUNDLED_ZLIB) MACRO (MYSQL_USE_BUNDLED_ZLIB)
SET(ZLIB_LIBRARY zlib) SET(ZLIB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/zlib ${CMAKE_BINARY_DIR}/zlib)
SET(ZLIB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/zlib) SET(BUILD_BUNDLED_ZLIB 1)
SET(ZLIB_LIBRARY zlib CACHE INTERNAL "Bundled zlib library")
SET(ZLIB_FOUND TRUE) SET(ZLIB_FOUND TRUE)
SET(WITH_ZLIB "bundled" CACHE STRING "Use bundled zlib") SET(WITH_ZLIB "bundled" CACHE STRING "Use bundled zlib")
ADD_SUBDIRECTORY(zlib) ADD_SUBDIRECTORY(zlib)
GET_TARGET_PROPERTY(src zlib SOURCES)
FOREACH(file ${src})
SET(ZLIB_SOURCES ${ZLIB_SOURCES} ${CMAKE_SOURCE_DIR}/zlib/${file})
ENDFOREACH()
ENDMACRO() ENDMACRO()
# MYSQL_CHECK_ZLIB_WITH_COMPRESS # MYSQL_CHECK_ZLIB_WITH_COMPRESS
@ -37,15 +34,10 @@ ENDMACRO()
MACRO (MYSQL_CHECK_ZLIB_WITH_COMPRESS) MACRO (MYSQL_CHECK_ZLIB_WITH_COMPRESS)
IF(CMAKE_SYSTEM_NAME STREQUAL "OS400" OR # For NDBCLUSTER: Use bundled zlib by default
CMAKE_SYSTEM_NAME STREQUAL "AIX" OR
CMAKE_SYSTEM_NAME STREQUAL "Windows")
# Use bundled zlib on some platforms by default (system one is too
# old or not existent)
IF (NOT WITH_ZLIB) IF (NOT WITH_ZLIB)
SET(WITH_ZLIB "bundled" CACHE STRING "By default use bundled zlib on this platform") SET(WITH_ZLIB "bundled" CACHE STRING "By default use bundled zlib on this platform")
ENDIF() ENDIF()
ENDIF()
IF(WITH_ZLIB STREQUAL "bundled") IF(WITH_ZLIB STREQUAL "bundled")
MYSQL_USE_BUNDLED_ZLIB() MYSQL_USE_BUNDLED_ZLIB()

View File

@ -986,11 +986,14 @@ CHECK_STRUCT_HAS_MEMBER("struct sockaddr_in6" sin6_len
SET(CMAKE_EXTRA_INCLUDE_FILES) SET(CMAKE_EXTRA_INCLUDE_FILES)
CHECK_INCLUDE_FILE(ucontext.h HAVE_UCONTEXT_H) CHECK_STRUCT_HAS_MEMBER("struct dirent" d_ino "dirent.h" STRUCT_DIRENT_HAS_D_INO)
IF(NOT HAVE_UCONTEXT_H) CHECK_STRUCT_HAS_MEMBER("struct dirent" d_namlen "dirent.h" STRUCT_DIRENT_HAS_D_NAMLEN)
CHECK_INCLUDE_FILE(sys/ucontext.h HAVE_UCONTEXT_H) SET(SPRINTF_RETURNS_INT 1)
CHECK_INCLUDE_FILE(ucontext.h HAVE_FILE_UCONTEXT_H)
IF(NOT HAVE_FILE_UCONTEXT_H)
CHECK_INCLUDE_FILE(sys/ucontext.h HAVE_FILE_UCONTEXT_H)
ENDIF() ENDIF()
IF(HAVE_UCONTEXT_H) IF(HAVE_FILE_UCONTEXT_H)
CHECK_FUNCTION_EXISTS(makecontext HAVE_UCONTEXT_H) CHECK_FUNCTION_EXISTS(makecontext HAVE_UCONTEXT_H)
ENDIF() ENDIF()

1
debian/rules vendored
View File

@ -1,6 +1,7 @@
#!/usr/bin/make -f #!/usr/bin/make -f
export DH_VERBOSE=1 export DH_VERBOSE=1
export DEB_BUILD_HARDENING=1
# enable Debian Hardening # enable Debian Hardening
# see: https://wiki.debian.org/Hardening # see: https://wiki.debian.org/Hardening

View File

@ -35,8 +35,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 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 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 this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02111-1301 USA
*******************************************************/ *******************************************************/

View File

@ -34,8 +34,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 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 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 this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02111-1301 USA
*******************************************************/ *******************************************************/
#define MYSQL_CLIENT #define MYSQL_CLIENT
@ -1759,62 +1759,63 @@ backup_cleanup()
} }
static pthread_mutex_t mdl_lock_con_mutex;
static MYSQL *mdl_con = NULL; static MYSQL *mdl_con = NULL;
std::map<ulint, std::string> spaceid_to_tablename;
void void
mdl_lock_init() mdl_lock_init()
{ {
pthread_mutex_init(&mdl_lock_con_mutex, NULL);
mdl_con = xb_mysql_connect(); mdl_con = xb_mysql_connect();
if (mdl_con) if (!mdl_con)
{ {
xb_mysql_query(mdl_con, "BEGIN", false, true); msg("FATAL: cannot create connection for MDL locks");
exit(1);
} }
const char *query =
"SELECT NAME, SPACE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE '%%/%%'";
MYSQL_RES *mysql_result = xb_mysql_query(mdl_con, query, true, true);
while (MYSQL_ROW row = mysql_fetch_row(mysql_result)) {
int err;
ulint id = (ulint)my_strtoll10(row[1], 0, &err);
spaceid_to_tablename[id] = ut_get_name(0, row[0]);
}
mysql_free_result(mysql_result);
xb_mysql_query(mdl_con, "BEGIN", false, true);
} }
void void
mdl_lock_table(ulint space_id) mdl_lock_table(ulint space_id)
{ {
std::ostringstream oss; if (space_id == 0)
oss << "SELECT NAME " return;
"FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES "
"WHERE SPACE = " << space_id << " AND NAME LIKE '%%/%%'";
pthread_mutex_lock(&mdl_lock_con_mutex); std::string full_table_name = spaceid_to_tablename[space_id];
MYSQL_RES *mysql_result = xb_mysql_query(mdl_con, oss.str().c_str(), true, true); DBUG_EXECUTE_IF("rename_during_mdl_lock_table",
if (full_table_name == "`test`.`t1`")
xb_mysql_query(mysql_connection, "RENAME TABLE test.t1 to test.t2", false, true);
);
while (MYSQL_ROW row = mysql_fetch_row(mysql_result)) { std::ostringstream lock_query;
lock_query << "SELECT 1 FROM " << full_table_name << " LIMIT 0";
DBUG_EXECUTE_IF("rename_during_mdl_lock_table", msg_ts("Locking MDL for %s\n", full_table_name.c_str());
if (strcmp(row[0], "test/t1") == 0) if (mysql_query(mdl_con, lock_query.str().c_str())) {
xb_mysql_query(mysql_connection, "RENAME TABLE test.t1 to test.t2", false, true
););
std::string full_table_name = ut_get_name(0,row[0]);
std::ostringstream lock_query;
lock_query << "SELECT 1 FROM " << full_table_name << " LIMIT 0";
msg_ts("Locking MDL for %s\n", full_table_name.c_str());
if (mysql_query(mdl_con, lock_query.str().c_str())) {
msg_ts("Warning : locking MDL failed for space id %zu, name %s\n", space_id, full_table_name.c_str()); msg_ts("Warning : locking MDL failed for space id %zu, name %s\n", space_id, full_table_name.c_str());
} else { } else {
MYSQL_RES *r = mysql_store_result(mdl_con); MYSQL_RES *r = mysql_store_result(mdl_con);
mysql_free_result(r); mysql_free_result(r);
}
} }
pthread_mutex_unlock(&mdl_lock_con_mutex);
mysql_free_result(mysql_result);
} }
void void
mdl_unlock_all() mdl_unlock_all()
{ {
msg_ts("Unlocking MDL for all tables\n"); msg_ts("Unlocking MDL for all tables\n");
xb_mysql_query(mdl_con, "COMMIT", false, true); xb_mysql_query(mdl_con, "COMMIT", false, true);
mysql_close(mdl_con); mysql_close(mdl_con);
pthread_mutex_destroy(&mdl_lock_con_mutex); spaceid_to_tablename.clear();
} }

View File

@ -35,7 +35,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software * License along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
* *
*/ */

View File

@ -34,8 +34,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 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 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 this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*******************************************************/ *******************************************************/

View File

@ -36,8 +36,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 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 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 this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*******************************************************/ *******************************************************/

View File

@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA */ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1301 USA */
/* /*
Data in big-endian format. Data in big-endian format.

View File

@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA */ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1301 USA */
/* /*
Endianness-independent definitions for architectures other Endianness-independent definitions for architectures other

View File

@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA */ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1301 USA */
/* /*
Optimized function-like macros for the x86 architecture (_WIN32 included). Optimized function-like macros for the x86 architecture (_WIN32 included).

View File

@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA */ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1301 USA */
/* /*
Optimized function-like macros for the x86 architecture (_WIN32 included). Optimized function-like macros for the x86 architecture (_WIN32 included).

View File

@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA */ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1301 USA */
/* /*
Data in little-endian format. Data in little-endian format.

View File

@ -106,11 +106,11 @@ static inline uint32 my_clear_highest_bit(uint32 v)
static inline uint32 my_reverse_bits(uint32 key) static inline uint32 my_reverse_bits(uint32 key)
{ {
return (uint32) return
(_my_bits_reverse_table[ key & 255] << 24) | ((uint32)_my_bits_reverse_table[ key & 255] << 24) |
(_my_bits_reverse_table[(key>> 8) & 255] << 16) | ((uint32)_my_bits_reverse_table[(key>> 8) & 255] << 16) |
(_my_bits_reverse_table[(key>>16) & 255] << 8) | ((uint32)_my_bits_reverse_table[(key>>16) & 255] << 8) |
_my_bits_reverse_table[(key>>24) ]; (uint32)_my_bits_reverse_table[(key>>24) ];
} }
/* /*

View File

@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1301 USA
*/ */
/* instructions for specific cpu's */ /* instructions for specific cpu's */

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2013, Monty Program Ab. /* Copyright (c) 2013, 2018, MariaDB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -27,7 +27,7 @@
time-consuming loops, and gracefully abort the operation if it is time-consuming loops, and gracefully abort the operation if it is
non-zero. non-zero.
thd_is_killed(thd) thd_killed(thd)
@return 0 - no KILL statement was issued, continue normally @return 0 - no KILL statement was issued, continue normally
@return 1 - there was a KILL statement, abort the execution. @return 1 - there was a KILL statement, abort the execution.

View File

@ -25,12 +25,12 @@
#define WSREP_MYSQL_DB (char *)"mysql" #define WSREP_MYSQL_DB (char *)"mysql"
#define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) \ #define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) \
if (WSREP_ON && WSREP(thd) && wsrep_to_isolation_begin(thd, db_, table_, table_list_)) \ if (WSREP_ON && WSREP(thd) && wsrep_to_isolation_begin(thd, db_, table_, table_list_)) \
goto error; goto wsrep_error_label;
#define WSREP_TO_ISOLATION_BEGIN_ALTER(db_, table_, table_list_, alter_info_) \ #define WSREP_TO_ISOLATION_BEGIN_ALTER(db_, table_, table_list_, alter_info_) \
if (WSREP_ON && WSREP(thd) && wsrep_to_isolation_begin(thd, db_, table_, \ if (WSREP_ON && WSREP(thd) && wsrep_to_isolation_begin(thd, db_, table_, \
table_list_, alter_info_)) \ table_list_, alter_info_)) \
goto error; goto wsrep_error_label;
#define WSREP_TO_ISOLATION_END \ #define WSREP_TO_ISOLATION_END \
if (WSREP_ON && (WSREP(thd) || (thd && thd->wsrep_exec_mode==TOTAL_ORDER))) \ if (WSREP_ON && (WSREP(thd) || (thd && thd->wsrep_exec_mode==TOTAL_ORDER))) \
@ -42,7 +42,7 @@
*/ */
#define WSREP_TO_ISOLATION_BEGIN_WRTCHK(db_, table_, table_list_) \ #define WSREP_TO_ISOLATION_BEGIN_WRTCHK(db_, table_, table_list_) \
if (WSREP(thd) && !thd->lex->no_write_to_binlog \ if (WSREP(thd) && !thd->lex->no_write_to_binlog \
&& wsrep_to_isolation_begin(thd, db_, table_, table_list_)) goto error; && wsrep_to_isolation_begin(thd, db_, table_, table_list_)) goto wsrep_error_label;
#define WSREP_DEBUG(...) \ #define WSREP_DEBUG(...) \
if (wsrep_debug) WSREP_LOG(sql_print_information, ##__VA_ARGS__) if (wsrep_debug) WSREP_LOG(sql_print_information, ##__VA_ARGS__)
@ -52,7 +52,7 @@
#define WSREP_SYNC_WAIT(thd_, before_) \ #define WSREP_SYNC_WAIT(thd_, before_) \
{ if (WSREP_CLIENT(thd_) && \ { if (WSREP_CLIENT(thd_) && \
wsrep_sync_wait(thd_, before_)) goto error; } wsrep_sync_wait(thd_, before_)) goto wsrep_error_label; }
#else #else
#define IF_WSREP(A,B) B #define IF_WSREP(A,B) B

View File

@ -1,4 +1,5 @@
# Copyright (c) 2006, 2011, Oracle and/or its affiliates. # Copyright (c) 2006, 2011, Oracle and/or its affiliates.
# Copyright (c) 2009, 2018, MariaDB Corporation
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -452,4 +453,3 @@ IF(NOT DISABLE_SHARED)
ENDIF() ENDIF()
ENDIF() ENDIF()
ENDIF() ENDIF()

View File

@ -14,7 +14,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
# Run gcov and report test coverage on only those code lines touched by # Run gcov and report test coverage on only those code lines touched by
# a given list of commits. # a given list of commits.

View File

@ -0,0 +1,9 @@
disable_query_log;
disable_warnings;
let $VERSION_COMPILE_64BIT=
`SELECT IF(@@version_compile_machine like '%64%', 1, 0)`;
enable_warnings;
enable_query_log;
if ($VERSION_COMPILE_64BIT) {
skip Need a 32 bit machine/binary;
}

View File

@ -0,0 +1,9 @@
disable_query_log;
disable_warnings;
let $VERSION_COMPILE_64BIT=
`SELECT IF(@@version_compile_machine like '%64%', 1, 0)`;
enable_warnings;
enable_query_log;
if (!$VERSION_COMPILE_64BIT) {
skip Need a 64 bit machine/binary;
}

View File

@ -195,14 +195,10 @@ sub value {
my ($self, $option_name)= @_; my ($self, $option_name)= @_;
my $option= $self->option($option_name); my $option= $self->option($option_name);
if (! defined($option) and defined $ENV{$option_name}) { if (! defined($option)) {
my $value= $ENV{$option_name}; my $value= $ENV{$option_name};
$option= My::Config::Option->new($option_name, $value); $option= My::Config::Option->new($option_name, $value);
} }
croak "No option named '$option_name' in group '$self->{name}'"
if ! defined($option);
return $option->value(); return $option->value();
} }

View File

@ -1411,6 +1411,59 @@ t1 CREATE TABLE `t1` (
`consultant_id` bigint(20) DEFAULT NULL `consultant_id` bigint(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ) ENGINE=MyISAM DEFAULT CHARSET=utf8
DROP TABLE t1; DROP TABLE t1;
#
# BUG#27788685: NO WARNING WHEN TRUNCATING A STRING WITH DATA LOSS
#
SET GLOBAL max_allowed_packet=17825792;
connect con1, localhost, root,,;
CREATE TABLE t1 (t1_fld1 TEXT);
CREATE TABLE t2 (t2_fld1 MEDIUMTEXT);
CREATE TABLE t3 (t3_fld1 LONGTEXT);
INSERT INTO t1 VALUES (REPEAT('a',300));
INSERT INTO t2 VALUES (REPEAT('b',65680));
INSERT INTO t3 VALUES (REPEAT('c',16777300));
SELECT LENGTH(t1_fld1) FROM t1;
LENGTH(t1_fld1)
300
SELECT LENGTH(t2_fld1) FROM t2;
LENGTH(t2_fld1)
65680
SELECT LENGTH(t3_fld1) FROM t3;
LENGTH(t3_fld1)
16777300
# With strict mode
SET SQL_MODE='STRICT_ALL_TABLES';
ALTER TABLE t1 CHANGE `t1_fld1` `my_t1_fld1` TINYTEXT;
ERROR 22001: Data too long for column 'my_t1_fld1' at row 1
ALTER TABLE t2 CHANGE `t2_fld1` `my_t2_fld1` TEXT;
ERROR 22001: Data too long for column 'my_t2_fld1' at row 1
ALTER TABLE t3 CHANGE `t3_fld1` `my_t3_fld1` MEDIUMTEXT;
ERROR 22001: Data too long for column 'my_t3_fld1' at row 1
# With non-strict mode
SET SQL_MODE='';
ALTER TABLE t1 CHANGE `t1_fld1` `my_t1_fld1` TINYTEXT;
Warnings:
Warning 1265 Data truncated for column 'my_t1_fld1' at row 1
ALTER TABLE t2 CHANGE `t2_fld1` `my_t2_fld1` TEXT;
Warnings:
Warning 1265 Data truncated for column 'my_t2_fld1' at row 1
ALTER TABLE t3 CHANGE `t3_fld1` `my_t3_fld1` MEDIUMTEXT;
Warnings:
Warning 1265 Data truncated for column 'my_t3_fld1' at row 1
SELECT LENGTH(my_t1_fld1) FROM t1;
LENGTH(my_t1_fld1)
255
SELECT LENGTH(my_t2_fld1) FROM t2;
LENGTH(my_t2_fld1)
65535
SELECT LENGTH(my_t3_fld1) FROM t3;
LENGTH(my_t3_fld1)
16777215
disconnect con1;
connection default;
DROP TABLE t1, t2, t3;
SET SQL_MODE=default;
SET GLOBAL max_allowed_packet=default;
CREATE TABLE t1 ( CREATE TABLE t1 (
id INT(11) NOT NULL, id INT(11) NOT NULL,
x_param INT(11) DEFAULT NULL, x_param INT(11) DEFAULT NULL,

View File

@ -1292,6 +1292,56 @@ MODIFY COLUMN `consultant_id` BIGINT;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # BUG#27788685: NO WARNING WHEN TRUNCATING A STRING WITH DATA LOSS
--echo #
SET GLOBAL max_allowed_packet=17825792;
--connect(con1, localhost, root,,)
CREATE TABLE t1 (t1_fld1 TEXT);
CREATE TABLE t2 (t2_fld1 MEDIUMTEXT);
CREATE TABLE t3 (t3_fld1 LONGTEXT);
INSERT INTO t1 VALUES (REPEAT('a',300));
INSERT INTO t2 VALUES (REPEAT('b',65680));
INSERT INTO t3 VALUES (REPEAT('c',16777300));
SELECT LENGTH(t1_fld1) FROM t1;
SELECT LENGTH(t2_fld1) FROM t2;
SELECT LENGTH(t3_fld1) FROM t3;
--echo # With strict mode
SET SQL_MODE='STRICT_ALL_TABLES';
--error ER_DATA_TOO_LONG
ALTER TABLE t1 CHANGE `t1_fld1` `my_t1_fld1` TINYTEXT;
--error ER_DATA_TOO_LONG
ALTER TABLE t2 CHANGE `t2_fld1` `my_t2_fld1` TEXT;
--error ER_DATA_TOO_LONG
ALTER TABLE t3 CHANGE `t3_fld1` `my_t3_fld1` MEDIUMTEXT;
--echo # With non-strict mode
SET SQL_MODE='';
ALTER TABLE t1 CHANGE `t1_fld1` `my_t1_fld1` TINYTEXT;
ALTER TABLE t2 CHANGE `t2_fld1` `my_t2_fld1` TEXT;
ALTER TABLE t3 CHANGE `t3_fld1` `my_t3_fld1` MEDIUMTEXT;
SELECT LENGTH(my_t1_fld1) FROM t1;
SELECT LENGTH(my_t2_fld1) FROM t2;
SELECT LENGTH(my_t3_fld1) FROM t3;
# Cleanup
--disconnect con1
--source include/wait_until_disconnected.inc
--connection default
DROP TABLE t1, t2, t3;
SET SQL_MODE=default;
SET GLOBAL max_allowed_packet=default;
# #
# Test of ALTER TABLE IF [NOT] EXISTS # Test of ALTER TABLE IF [NOT] EXISTS
# #

View File

@ -503,12 +503,12 @@ CREATE TABLE t3(a INT);
LOCK TABLE t2 WRITE; LOCK TABLE t2 WRITE;
SELECT * FROM t2; SELECT * FROM t2;
a a
CREATE OR REPLACE TEMPORARY TABLE t1(a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; CREATE OR REPLACE TEMPORARY TABLE t1(c INT DEFAULT '');
ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. ERROR 42000: Invalid default value for 'c'
SELECT * FROM t3; SELECT * FROM t3;
ERROR HY000: Table 't3' was not locked with LOCK TABLES ERROR HY000: Table 't3' was not locked with LOCK TABLES
CREATE OR REPLACE TEMPORARY TABLE t2(a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; CREATE OR REPLACE TEMPORARY TABLE t2(c INT DEFAULT '');
ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. ERROR 42000: Invalid default value for 'c'
SELECT * FROM t3; SELECT * FROM t3;
ERROR HY000: Table 't3' was not locked with LOCK TABLES ERROR HY000: Table 't3' was not locked with LOCK TABLES
UNLOCK TABLES; UNLOCK TABLES;

View File

@ -453,14 +453,14 @@ CREATE TABLE t3(a INT);
LOCK TABLE t2 WRITE; LOCK TABLE t2 WRITE;
SELECT * FROM t2; SELECT * FROM t2;
# drops t2 # drops t2
--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE --error ER_INVALID_DEFAULT
CREATE OR REPLACE TEMPORARY TABLE t1(a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; CREATE OR REPLACE TEMPORARY TABLE t1(c INT DEFAULT '');
# make sure we didn't leave locked tables mode # make sure we didn't leave locked tables mode
--error ER_TABLE_NOT_LOCKED --error ER_TABLE_NOT_LOCKED
SELECT * FROM t3; SELECT * FROM t3;
# drops t1 # drops t1
--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE --error ER_INVALID_DEFAULT
CREATE OR REPLACE TEMPORARY TABLE t2(a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; CREATE OR REPLACE TEMPORARY TABLE t2(c INT DEFAULT '');
# make sure we didn't leave locked tables mode # make sure we didn't leave locked tables mode
--error ER_TABLE_NOT_LOCKED --error ER_TABLE_NOT_LOCKED
SELECT * FROM t3; SELECT * FROM t3;

View File

@ -8046,6 +8046,15 @@ ABCDEFGHI-ABCDEFGHI
DROP TABLE t1; DROP TABLE t1;
SET optimizer_switch=@save_optimizer_switch; SET optimizer_switch=@save_optimizer_switch;
# #
# MDEV-17298 ASAN unknown-crash / READ of size 1 in my_strntoul_8bit upon INSERT .. SELECT
#
SET NAMES latin1;
CREATE TABLE t1 (a CHAR);
CREATE TABLE t2 (b ENUM('foo','bar'));
INSERT INTO t1 VALUES ('1');
INSERT INTO t2 SELECT * FROM t1;
DROP TABLE t1, t2;
#
# End of 10.0 tests # End of 10.0 tests
# #
# #

View File

@ -266,6 +266,18 @@ SET NAMES latin1;
--source include/ctype_mdev13118.inc --source include/ctype_mdev13118.inc
--echo #
--echo # MDEV-17298 ASAN unknown-crash / READ of size 1 in my_strntoul_8bit upon INSERT .. SELECT
--echo #
SET NAMES latin1;
CREATE TABLE t1 (a CHAR);
CREATE TABLE t2 (b ENUM('foo','bar'));
INSERT INTO t1 VALUES ('1');
INSERT INTO t2 SELECT * FROM t1;
DROP TABLE t1, t2;
--echo # --echo #
--echo # End of 10.0 tests --echo # End of 10.0 tests
--echo # --echo #

View File

@ -13940,6 +13940,27 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'oe' and `test`.`t1`.`a` = 'oe' Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'oe' and `test`.`t1`.`a` = 'oe'
DROP TABLE t1; DROP TABLE t1;
# #
# MDEV-17064 LIKE function has error behavior on the fields in which the collation is xxx_unicode_xx
#
CREATE TABLE t1 (name VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci);
INSERT INTO t1 VALUES ('radio! test');
SELECT * FROM t1 WHERE name LIKE '%!!%' ESCAPE '!';
name
radio! test
ALTER TABLE t1 CHANGE COLUMN name name VARCHAR(20) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci';
SELECT * FROM t1 WHERE name LIKE '%!!%' ESCAPE '!';
name
radio! test
DROP TABLE t1;
CREATE TABLE t1 (name VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci);
INSERT INTO t1 VALUES ('radio! test');
SELECT name LIKE '%!!%' ESCAPE '!' AS c1,
name LIKE '%!!%' COLLATE utf8_general_ci ESCAPE '!' AS c2
FROM t1;
c1 c2
1 1
DROP TABLE t1;
#
# End of MariaDB-10.0 tests # End of MariaDB-10.0 tests
# #
# #

View File

@ -618,6 +618,24 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='oe' AND a='oe' COLLATE utf8_german2_c
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='oe' COLLATE utf8_german2_ci AND a='oe'; EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='oe' COLLATE utf8_german2_ci AND a='oe';
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-17064 LIKE function has error behavior on the fields in which the collation is xxx_unicode_xx
--echo #
CREATE TABLE t1 (name VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci);
INSERT INTO t1 VALUES ('radio! test');
SELECT * FROM t1 WHERE name LIKE '%!!%' ESCAPE '!';
ALTER TABLE t1 CHANGE COLUMN name name VARCHAR(20) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci';
SELECT * FROM t1 WHERE name LIKE '%!!%' ESCAPE '!';
DROP TABLE t1;
CREATE TABLE t1 (name VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci);
INSERT INTO t1 VALUES ('radio! test');
SELECT name LIKE '%!!%' ESCAPE '!' AS c1,
name LIKE '%!!%' COLLATE utf8_general_ci ESCAPE '!' AS c2
FROM t1;
DROP TABLE t1;
--echo # --echo #
--echo # End of MariaDB-10.0 tests --echo # End of MariaDB-10.0 tests
--echo # --echo #

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -554,7 +554,6 @@ ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
UNLOCK TABLES; UNLOCK TABLES;
LOCK TABLES v1 WRITE; LOCK TABLES v1 WRITE;
FLUSH TABLES v1; FLUSH TABLES v1;
ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
UNLOCK TABLES; UNLOCK TABLES;
LOCK TABLES v1 READ; LOCK TABLES v1 READ;
FLUSH TABLES t1; FLUSH TABLES t1;

View File

@ -688,7 +688,6 @@ FLUSH TABLES v1;
UNLOCK TABLES; UNLOCK TABLES;
LOCK TABLES v1 WRITE; LOCK TABLES v1 WRITE;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
FLUSH TABLES v1; FLUSH TABLES v1;
UNLOCK TABLES; UNLOCK TABLES;

View File

@ -268,3 +268,23 @@ SET optimizer_switch=@save_optimizer_switch;
SELECT UNHEX(CONCAT('414C2', HEX(8 + ROUND(RAND()*7)), SUBSTR(SHA(UUID()),6,33),HEX(2+ROUND(RAND()*8)))) IS NULL AS c1; SELECT UNHEX(CONCAT('414C2', HEX(8 + ROUND(RAND()*7)), SUBSTR(SHA(UUID()),6,33),HEX(2+ROUND(RAND()*8)))) IS NULL AS c1;
c1 c1
0 0
#
# MDEV-13119 Wrong results with CAST(AS CHAR) and subquery
#
SET optimizer_switch=_utf8'derived_merge=on';
CREATE TABLE t1 (t VARCHAR(10) CHARSET latin1);
INSERT INTO t1 VALUES('abcdefghi');
SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT CAST(t AS CHAR CHARACTER SET utf8) t2 FROM t1) sub;
c2
abcdefghi-abcdefghi
DROP TABLE t1;
SET optimizer_switch=@save_optimizer_switch;
#
# MDEV-13120 Wrong results with MAKE_SET() and subquery
#
CREATE TABLE t1 (t VARCHAR(10) CHARSET latin1);
INSERT INTO t1 VALUES('abcdefghi');
SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT MAKE_SET(3,t,t) t2 FROM t1) sub;
c2
abcdefghi,abcdefghi-abcdefghi,abcdefghi
DROP TABLE t1;

View File

@ -242,3 +242,25 @@ SET optimizer_switch=@save_optimizer_switch;
--echo # --echo #
SELECT UNHEX(CONCAT('414C2', HEX(8 + ROUND(RAND()*7)), SUBSTR(SHA(UUID()),6,33),HEX(2+ROUND(RAND()*8)))) IS NULL AS c1; SELECT UNHEX(CONCAT('414C2', HEX(8 + ROUND(RAND()*7)), SUBSTR(SHA(UUID()),6,33),HEX(2+ROUND(RAND()*8)))) IS NULL AS c1;
--echo #
--echo # MDEV-13119 Wrong results with CAST(AS CHAR) and subquery
--echo #
SET optimizer_switch=_utf8'derived_merge=on';
CREATE TABLE t1 (t VARCHAR(10) CHARSET latin1);
INSERT INTO t1 VALUES('abcdefghi');
SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT CAST(t AS CHAR CHARACTER SET utf8) t2 FROM t1) sub;
DROP TABLE t1;
SET optimizer_switch=@save_optimizer_switch;
--echo #
--echo # MDEV-13120 Wrong results with MAKE_SET() and subquery
--echo #
CREATE TABLE t1 (t VARCHAR(10) CHARSET latin1);
INSERT INTO t1 VALUES('abcdefghi');
SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT MAKE_SET(3,t,t) t2 FROM t1) sub;
DROP TABLE t1;

View File

@ -1715,3 +1715,53 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL PRIMARY,c1,i,c2 NULL NULL NULL 69 Using where 1 SIMPLE t1 ALL PRIMARY,c1,i,c2 NULL NULL NULL 69 Using where
DROP TABLE t1; DROP TABLE t1;
set optimizer_switch= @optimizer_switch_save; set optimizer_switch= @optimizer_switch_save;
#
# MDEV-16695: Estimate for rows of derived tables is very high when we are using index_merge union
#
create table t0
(
key1 int not null,
INDEX i1(key1)
);
insert into t0 values (1),(2),(3),(4),(5),(6),(7),(8);
set @d=8;
insert into t0 select key1+ @d from t0;
set @d=@d*2;
insert into t0 select key1+ @d from t0;
set @d=@d*2;
insert into t0 select key1+ @d from t0;
set @d=@d*2;
insert into t0 select key1+ @d from t0;
set @d=@d*2;
insert into t0 select key1+ @d from t0;
set @d=@d*2;
insert into t0 select key1+ @d from t0;
set @d=@d*2;
insert into t0 select key1+ @d from t0;
set @d=@d*2;
alter table t0 add key2 int not null, add index i2(key2);
alter table t0 add key3 int not null, add index i3(key3);
alter table t0 add key8 int not null, add index i8(key8);
update t0 set key2=key1,key3=key1,key8=1024-key1;
analyze table t0;
Table Op Msg_type Msg_text
test.t0 analyze status OK
set @optimizer_switch_save=@@optimizer_switch;
set optimizer_switch='derived_merge=off,derived_with_keys=off';
explain select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z.key8 > 5;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 Using where
2 DERIVED t0 index_merge i1,i2,i8 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where
select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z.key8 > 5;
key1 key2 key3 key8
3 3 3 1021
set optimizer_use_condition_selectivity=2;
explain select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z.key8 > 5;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 Using where
2 DERIVED t0 index_merge i1,i2,i8 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where
select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z.key8 > 5;
key1 key2 key3 key8
3 3 3 1021
set @@optimizer_switch= @optimizer_switch_save;
drop table t0;

View File

@ -243,3 +243,38 @@ DROP TABLE t1;
set optimizer_switch= @optimizer_switch_save; set optimizer_switch= @optimizer_switch_save;
--echo #
--echo # MDEV-16695: Estimate for rows of derived tables is very high when we are using index_merge union
--echo #
create table t0
(
key1 int not null,
INDEX i1(key1)
);
insert into t0 values (1),(2),(3),(4),(5),(6),(7),(8);
let $1=7;
set @d=8;
while ($1)
{
eval insert into t0 select key1+ @d from t0;
eval set @d=@d*2;
dec $1;
}
alter table t0 add key2 int not null, add index i2(key2);
alter table t0 add key3 int not null, add index i3(key3);
alter table t0 add key8 int not null, add index i8(key8);
update t0 set key2=key1,key3=key1,key8=1024-key1;
analyze table t0;
set @optimizer_switch_save=@@optimizer_switch;
set optimizer_switch='derived_merge=off,derived_with_keys=off';
explain select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z.key8 > 5;
select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z.key8 > 5;
set optimizer_use_condition_selectivity=2;
explain select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z.key8 > 5;
select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z.key8 > 5;
set @@optimizer_switch= @optimizer_switch_save;
drop table t0;

View File

@ -2055,7 +2055,7 @@ ON (t5.b=t8.b);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t5 ALL NULL NULL NULL NULL 2 1 SIMPLE t5 ALL NULL NULL NULL NULL 2
1 SIMPLE t6 ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join) 1 SIMPLE t6 ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join)
1 SIMPLE t7 ref b_i b_i 5 const 0 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan 1 SIMPLE t7 ref b_i b_i 5 const 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
1 SIMPLE t8 ALL b_i NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) 1 SIMPLE t8 ALL b_i NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
SELECT t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b SELECT t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b
FROM t5 LEFT JOIN FROM t5 LEFT JOIN

View File

@ -2511,4 +2511,72 @@ ORDER BY tb1.i1;
v2 v2
DROP TABLE t1,t2; DROP TABLE t1,t2;
# end of 5.5 tests # end of 5.5 tests
#
# MDEV-17518: Range optimization doesn't use ON expressions from nested outer joins
#
create table t1(a int);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t2(a int);
insert into t2 values (0),(1);
create table t3 (a int, b int, key(a));
insert into t3 select A.a + B.a* 10 + C.a * 100, 12345 from t1 A, t1 B, t1 C;
# Uses range for table t3:
explain select * from t1 left join t3 on t1.a=t3.b and t3.a<5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10
1 SIMPLE t3 range a a 5 NULL 5 Using where
# This must use range for table t3, too:
explain select * from t1 left join (t3 join t2) on t1.a=t3.b and t3.a<5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10
1 SIMPLE t2 ALL NULL NULL NULL NULL 2
1 SIMPLE t3 range a a 5 NULL 5 Using where
#
# .. part 2: make sure condition selectivity can use the condition too.
#
alter table t3 drop key a;
set @tmp1=@@optimizer_use_condition_selectivity;
set @tmp2=@@use_stat_tables;
set @tmp3=@@histogram_size;
set use_stat_tables=preferably;
set optimizer_use_condition_selectivity=4;
set histogram_size=100;
analyze table t3 persistent for all;
Table Op Msg_type Msg_text
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
# t3.filtered is less than 100%:
explain extended select * from t1 left join t3 on t1.a=t3.b and t3.a<5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00
1 SIMPLE t3 ALL NULL NULL NULL NULL 1000 0.99 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` left join `test`.`t3` on(`test`.`t3`.`b` = `test`.`t1`.`a` and `test`.`t3`.`a` < 5) where 1
# t3.filtered must less than 100%, too:
explain extended select * from t1 left join (t3 join t2) on t1.a=t3.b and t3.a<5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00
1 SIMPLE t3 ALL NULL NULL NULL NULL 1000 0.99 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t2`.`a` AS `a` from `test`.`t1` left join (`test`.`t3` join `test`.`t2`) on(`test`.`t3`.`b` = `test`.`t1`.`a` and `test`.`t3`.`a` < 5) where 1
drop table t1,t2,t3;
set optimizer_use_condition_selectivity= @tmp1;
set use_stat_tables= @tmp2;
set histogram_size= @tmp3;
# Another test
CREATE TABLE t1 (i1 int) ;
CREATE TABLE t2 (pk int NOT NULL PRIMARY KEY) ;
CREATE TABLE t3 (pk int NOT NULL, i1 int, PRIMARY KEY (pk)) ;
INSERT INTO t3 VALUES (2, NULL);
CREATE TABLE t4 (pk int NOT NULL, i1 int, PRIMARY KEY (pk), KEY i1 (i1)) ;
CREATE VIEW v4 AS SELECT * FROM t4;
SELECT 1
FROM t3 RIGHT JOIN t1 ON t3.i1 = t1.i1
LEFT JOIN v4
RIGHT JOIN t2 ON v4.i1 = t2.pk ON t1.i1 = t2.pk
WHERE t3.pk IN (2);
1
drop view v4;
drop table t1,t2,t3,t4;
SET optimizer_switch=@save_optimizer_switch; SET optimizer_switch=@save_optimizer_switch;

View File

@ -2042,4 +2042,64 @@ DROP TABLE t1,t2;
--echo # end of 5.5 tests --echo # end of 5.5 tests
--echo #
--echo # MDEV-17518: Range optimization doesn't use ON expressions from nested outer joins
--echo #
create table t1(a int);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t2(a int);
insert into t2 values (0),(1);
create table t3 (a int, b int, key(a));
insert into t3 select A.a + B.a* 10 + C.a * 100, 12345 from t1 A, t1 B, t1 C;
--echo # Uses range for table t3:
explain select * from t1 left join t3 on t1.a=t3.b and t3.a<5;
--echo # This must use range for table t3, too:
explain select * from t1 left join (t3 join t2) on t1.a=t3.b and t3.a<5;
--echo #
--echo # .. part 2: make sure condition selectivity can use the condition too.
--echo #
alter table t3 drop key a;
set @tmp1=@@optimizer_use_condition_selectivity;
set @tmp2=@@use_stat_tables;
set @tmp3=@@histogram_size;
set use_stat_tables=preferably;
set optimizer_use_condition_selectivity=4;
set histogram_size=100;
analyze table t3 persistent for all;
--echo # t3.filtered is less than 100%:
explain extended select * from t1 left join t3 on t1.a=t3.b and t3.a<5;
--echo # t3.filtered must less than 100%, too:
explain extended select * from t1 left join (t3 join t2) on t1.a=t3.b and t3.a<5;
drop table t1,t2,t3;
set optimizer_use_condition_selectivity= @tmp1;
set use_stat_tables= @tmp2;
set histogram_size= @tmp3;
--echo # Another test
CREATE TABLE t1 (i1 int) ;
CREATE TABLE t2 (pk int NOT NULL PRIMARY KEY) ;
CREATE TABLE t3 (pk int NOT NULL, i1 int, PRIMARY KEY (pk)) ;
INSERT INTO t3 VALUES (2, NULL);
CREATE TABLE t4 (pk int NOT NULL, i1 int, PRIMARY KEY (pk), KEY i1 (i1)) ;
CREATE VIEW v4 AS SELECT * FROM t4;
SELECT 1
FROM t3 RIGHT JOIN t1 ON t3.i1 = t1.i1
LEFT JOIN v4
RIGHT JOIN t2 ON v4.i1 = t2.pk ON t1.i1 = t2.pk
WHERE t3.pk IN (2);
drop view v4;
drop table t1,t2,t3,t4;
SET optimizer_switch=@save_optimizer_switch; SET optimizer_switch=@save_optimizer_switch;

View File

@ -2522,6 +2522,74 @@ ORDER BY tb1.i1;
v2 v2
DROP TABLE t1,t2; DROP TABLE t1,t2;
# end of 5.5 tests # end of 5.5 tests
#
# MDEV-17518: Range optimization doesn't use ON expressions from nested outer joins
#
create table t1(a int);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t2(a int);
insert into t2 values (0),(1);
create table t3 (a int, b int, key(a));
insert into t3 select A.a + B.a* 10 + C.a * 100, 12345 from t1 A, t1 B, t1 C;
# Uses range for table t3:
explain select * from t1 left join t3 on t1.a=t3.b and t3.a<5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10
1 SIMPLE t3 range a a 5 NULL 5 Using where; Rowid-ordered scan; Using join buffer (flat, BNL join)
# This must use range for table t3, too:
explain select * from t1 left join (t3 join t2) on t1.a=t3.b and t3.a<5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
1 SIMPLE t3 range a a 5 NULL 5 Using where; Rowid-ordered scan; Using join buffer (incremental, BNL join)
#
# .. part 2: make sure condition selectivity can use the condition too.
#
alter table t3 drop key a;
set @tmp1=@@optimizer_use_condition_selectivity;
set @tmp2=@@use_stat_tables;
set @tmp3=@@histogram_size;
set use_stat_tables=preferably;
set optimizer_use_condition_selectivity=4;
set histogram_size=100;
analyze table t3 persistent for all;
Table Op Msg_type Msg_text
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
# t3.filtered is less than 100%:
explain extended select * from t1 left join t3 on t1.a=t3.b and t3.a<5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00
1 SIMPLE t3 hash_ALL NULL #hash#$hj 5 test.t1.a 1000 0.99 Using where; Using join buffer (flat, BNLH join)
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` left join `test`.`t3` on(`test`.`t3`.`b` = `test`.`t1`.`a` and `test`.`t3`.`a` < 5 and `test`.`t1`.`a` is not null) where 1
# t3.filtered must less than 100%, too:
explain extended select * from t1 left join (t3 join t2) on t1.a=t3.b and t3.a<5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t3 ALL NULL NULL NULL NULL 1000 0.99 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t2`.`a` AS `a` from `test`.`t1` left join (`test`.`t3` join `test`.`t2`) on(`test`.`t3`.`b` = `test`.`t1`.`a` and `test`.`t3`.`a` < 5 and `test`.`t1`.`a` is not null) where 1
drop table t1,t2,t3;
set optimizer_use_condition_selectivity= @tmp1;
set use_stat_tables= @tmp2;
set histogram_size= @tmp3;
# Another test
CREATE TABLE t1 (i1 int) ;
CREATE TABLE t2 (pk int NOT NULL PRIMARY KEY) ;
CREATE TABLE t3 (pk int NOT NULL, i1 int, PRIMARY KEY (pk)) ;
INSERT INTO t3 VALUES (2, NULL);
CREATE TABLE t4 (pk int NOT NULL, i1 int, PRIMARY KEY (pk), KEY i1 (i1)) ;
CREATE VIEW v4 AS SELECT * FROM t4;
SELECT 1
FROM t3 RIGHT JOIN t1 ON t3.i1 = t1.i1
LEFT JOIN v4
RIGHT JOIN t2 ON v4.i1 = t2.pk ON t1.i1 = t2.pk
WHERE t3.pk IN (2);
1
drop view v4;
drop table t1,t2,t3,t4;
SET optimizer_switch=@save_optimizer_switch; SET optimizer_switch=@save_optimizer_switch;
set join_cache_level=default; set join_cache_level=default;
show variables like 'join_cache_level'; show variables like 'join_cache_level';

View File

@ -136,7 +136,7 @@ select * from t1;
ERROR HY000: Table 't1' was not locked with LOCK TABLES ERROR HY000: Table 't1' was not locked with LOCK TABLES
unlock tables; unlock tables;
create or replace view v_bug5719 as select * from t1; create or replace view v_bug5719 as select * from t1;
lock tables v_bug5719 write; lock tables v_bug5719 read;
select * from v_bug5719; select * from v_bug5719;
a a
@ -303,7 +303,7 @@ create table t2 (j int);
# #
# Try to perform DDL on table which is locked through view. # Try to perform DDL on table which is locked through view.
create view v1 as select * from t2; create view v1 as select * from t2;
lock tables t1 write, v1 write; lock tables t1 write, v1 read;
flush table t2; flush table t2;
ERROR HY000: Table 't2' was locked with a READ lock and can't be updated ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
drop table t2; drop table t2;

View File

@ -192,7 +192,7 @@ drop view v_bug5719;
select * from t1; select * from t1;
unlock tables; unlock tables;
create or replace view v_bug5719 as select * from t1; create or replace view v_bug5719 as select * from t1;
lock tables v_bug5719 write; lock tables v_bug5719 read;
select * from v_bug5719; select * from v_bug5719;
--echo --echo
--echo Allowed to use an underlying table under LOCK TABLES <view> --echo Allowed to use an underlying table under LOCK TABLES <view>
@ -368,7 +368,7 @@ create table t2 (j int);
--echo # --echo #
--echo # Try to perform DDL on table which is locked through view. --echo # Try to perform DDL on table which is locked through view.
create view v1 as select * from t2; create view v1 as select * from t2;
lock tables t1 write, v1 write; lock tables t1 write, v1 read;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE --error ER_TABLE_NOT_LOCKED_FOR_WRITE
flush table t2; flush table t2;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE --error ER_TABLE_NOT_LOCKED_FOR_WRITE

View File

@ -394,15 +394,17 @@ DROP VIEW IF EXISTS v1;
# #
# Test 1: LOCK TABLES v1 WRITE, t1 READ; # Test 1: LOCK TABLES v1 WRITE, t1 READ;
# #
# Thanks to the fact that we no longer allow DDL on tables
# which are locked for write implicitly, the exact scenario
# in which assert was failing is no longer repeatable.
CREATE TABLE t1 ( f1 integer ); CREATE TABLE t1 ( f1 integer );
CREATE VIEW v1 AS SELECT f1 FROM t1 ; CREATE VIEW v1 AS SELECT f1 FROM t1 ;
# Connection 2
connect con2,localhost,root;
LOCK TABLES v1 WRITE, t1 READ; LOCK TABLES v1 WRITE, t1 READ;
FLUSH TABLE t1; FLUSH TABLE t1;
ERROR HY000: Table 't1' was locked with a READ lock and can't be updated disconnect con2;
UNLOCK TABLES; # Connection 1
connection default;
LOCK TABLES t1 WRITE;
FLUSH TABLE t1;
DROP TABLE t1; DROP TABLE t1;
DROP VIEW v1; DROP VIEW v1;
# #

View File

@ -734,17 +734,21 @@ DROP VIEW IF EXISTS v1;
--echo # --echo #
--echo # Test 1: LOCK TABLES v1 WRITE, t1 READ; --echo # Test 1: LOCK TABLES v1 WRITE, t1 READ;
--echo # --echo #
--echo # Thanks to the fact that we no longer allow DDL on tables
--echo # which are locked for write implicitly, the exact scenario
--echo # in which assert was failing is no longer repeatable.
CREATE TABLE t1 ( f1 integer ); CREATE TABLE t1 ( f1 integer );
CREATE VIEW v1 AS SELECT f1 FROM t1 ; CREATE VIEW v1 AS SELECT f1 FROM t1 ;
--echo # Connection 2
connect (con2,localhost,root);
LOCK TABLES v1 WRITE, t1 READ; LOCK TABLES v1 WRITE, t1 READ;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
FLUSH TABLE t1; FLUSH TABLE t1;
UNLOCK TABLES; disconnect con2;
--source include/wait_until_disconnected.inc
--echo # Connection 1
connection default;
LOCK TABLES t1 WRITE;
FLUSH TABLE t1; # Assertion happened here
# Cleanup # Cleanup
DROP TABLE t1; DROP TABLE t1;

View File

@ -83,6 +83,74 @@ CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a= 1;
RENAME TABLE t1 TO T1; RENAME TABLE t1 TO T1;
ALTER TABLE T1 RENAME t1; ALTER TABLE T1 RENAME t1;
DROP TABLE t1; DROP TABLE t1;
create database TEST;
create procedure TEST.pr() begin end;
create procedure test.pr() begin end;
Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.index_stats OK
mysql.innodb_index_stats
Error : Unknown storage engine 'InnoDB'
error : Corrupt
mysql.innodb_table_stats
Error : Unknown storage engine 'InnoDB'
error : Corrupt
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.roles_mapping OK
mysql.servers OK
mysql.table_stats OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.transaction_registry
Error : Unknown storage engine 'InnoDB'
error : Corrupt
mysql.user OK
Repairing tables
mysql.innodb_index_stats
Error : Unknown storage engine 'InnoDB'
error : Corrupt
mysql.innodb_table_stats
Error : Unknown storage engine 'InnoDB'
error : Corrupt
mysql.transaction_registry
Error : Unknown storage engine 'InnoDB'
error : Corrupt
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
Phase 4/7: Running 'mysql_fix_privilege_tables'
Phase 5/7: Fixing table and database names
Phase 6/7: Checking and upgrading tables
Processing databases
TEST
information_schema
mtr
mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
drop procedure test.pr;
drop database TEST;
create table t1 (a int); create table t1 (a int);
create trigger t1_bi before insert on t1 for each row set new.a= 1; create trigger t1_bi before insert on t1 for each row set new.a= 1;
show triggers like '%T1%'; show triggers like '%T1%';

View File

@ -105,6 +105,18 @@ RENAME TABLE t1 TO T1;
ALTER TABLE T1 RENAME t1; ALTER TABLE T1 RENAME t1;
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-13912 mysql_upgrade: case (in)sensitivity for stored procedures
#
create database TEST;
create procedure TEST.pr() begin end;
create procedure test.pr() begin end;
--exec $MYSQL_UPGRADE --force 2>&1
drop procedure test.pr;
drop database TEST;
# End of 5.5 tests
# #
# MDEV-9014 SHOW TRIGGERS not case sensitive # MDEV-9014 SHOW TRIGGERS not case sensitive
# #
@ -113,4 +125,7 @@ create trigger t1_bi before insert on t1 for each row set new.a= 1;
show triggers like '%T1%'; show triggers like '%T1%';
drop table t1; drop table t1;
let $datadir= `select @@datadir`;
remove_file $datadir/mysql_upgrade_info;
set GLOBAL sql_mode=default; set GLOBAL sql_mode=default;

View File

@ -25,3 +25,23 @@ Warning 1292 Truncated incorrect CHAR(0) value: '8'
Warning 1292 Truncated incorrect CHAR(0) value: '9' Warning 1292 Truncated incorrect CHAR(0) value: '9'
Warning 1292 Truncated incorrect CHAR(0) value: '10' Warning 1292 Truncated incorrect CHAR(0) value: '10'
drop table t1; drop table t1;
#
# MDEV-17020: Assertion `length > 0' failed in ptr_compare upon ORDER BY with bad conversion
#
set @save_sql_mode= @@sql_mode;
SET @@sql_mode= '';
CREATE TABLE t1 (pk INT PRIMARY KEY);
INSERT INTO t1 VALUES (1),(2);
explain
SELECT * FROM t1 ORDER BY 'foo', CONVERT(pk, CHAR(0)) LIMIT 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 2 Using index; Using filesort
SELECT * FROM t1 ORDER BY 'foo', Cast(pk as CHAR(0)) LIMIT 2;
pk
1
2
Warnings:
Warning 1292 Truncated incorrect CHAR(0) value: '1'
Warning 1292 Truncated incorrect CHAR(0) value: '2'
set @@sql_mode= @save_sql_mode;
drop table t1;

View File

@ -13,3 +13,17 @@ select * from t1 order by now(), cast(pk as char(0));
--enable_warnings --enable_warnings
show warnings; show warnings;
drop table t1; drop table t1;
--echo #
--echo # MDEV-17020: Assertion `length > 0' failed in ptr_compare upon ORDER BY with bad conversion
--echo #
set @save_sql_mode= @@sql_mode;
SET @@sql_mode= '';
CREATE TABLE t1 (pk INT PRIMARY KEY);
INSERT INTO t1 VALUES (1),(2);
explain
SELECT * FROM t1 ORDER BY 'foo', CONVERT(pk, CHAR(0)) LIMIT 2;
SELECT * FROM t1 ORDER BY 'foo', Cast(pk as CHAR(0)) LIMIT 2;
set @@sql_mode= @save_sql_mode;
drop table t1;

View File

@ -1872,3 +1872,22 @@ CREATE TABLE t2 LIKE t1 PARTITION (p0, p2);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PARTITION (p0, p2)' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PARTITION (p0, p2)' at line 1
DROP TABLE t1; DROP TABLE t1;
SET @@default_storage_engine = @old_default_storage_engine; SET @@default_storage_engine = @old_default_storage_engine;
#
# MDEV-14815 - Server crash or AddressSanitizer errors or valgrind warnings in thr_lock / has_old_lock upon FLUSH TABLES
#
CREATE TABLE t1 (i INT) ENGINE=MEMORY PARTITION BY RANGE (i) (PARTITION p0 VALUES LESS THAN (4), PARTITION pm VALUES LESS THAN MAXVALUE);
CREATE TABLE t2 (i INT) ENGINE=MEMORY;
LOCK TABLE t1 WRITE, t2 WRITE;
SELECT * FROM t1 PARTITION (p0);
i
FLUSH TABLES;
SELECT * FROM t1 PARTITION (p0);
i
ALTER TABLE t1 TRUNCATE PARTITION p0;
SELECT * FROM t1 PARTITION (p0);
i
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
SELECT * FROM t1 PARTITION (p0);
i
UNLOCK TABLES;
DROP TABLE t1, t2;

View File

@ -858,3 +858,22 @@ CREATE TABLE t2 LIKE t1 PARTITION (p0, p2);
DROP TABLE t1; DROP TABLE t1;
SET @@default_storage_engine = @old_default_storage_engine; SET @@default_storage_engine = @old_default_storage_engine;
--echo #
--echo # MDEV-14815 - Server crash or AddressSanitizer errors or valgrind warnings in thr_lock / has_old_lock upon FLUSH TABLES
--echo #
CREATE TABLE t1 (i INT) ENGINE=MEMORY PARTITION BY RANGE (i) (PARTITION p0 VALUES LESS THAN (4), PARTITION pm VALUES LESS THAN MAXVALUE);
CREATE TABLE t2 (i INT) ENGINE=MEMORY;
LOCK TABLE t1 WRITE, t2 WRITE;
SELECT * FROM t1 PARTITION (p0);
FLUSH TABLES;
SELECT * FROM t1 PARTITION (p0);
ALTER TABLE t1 TRUNCATE PARTITION p0;
SELECT * FROM t1 PARTITION (p0);
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
SELECT * FROM t1 PARTITION (p0);
UNLOCK TABLES;
# Cleanup
DROP TABLE t1, t2;

View File

@ -3484,3 +3484,36 @@ select * from t1 where (a = 1 AND b < 'd' AND (c = 'b' OR (c = 'c' AND d = 1)) O
a b c d a b c d
1 a b 1 1 a b 1
drop table t1; drop table t1;
#
# MDEV-17493: Partition pruning doesn't work for nested outer joins
#
create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1 (a int, b int, c int);
insert into t1 select a,a,a from t0;
create table t2 (a int, b int, c int);
insert into t2 select a,a,a from t0;
create table t3 (
part_id int,
a int
) partition by list (part_id) (
partition p0 values in (0),
partition p1 values in (1),
partition p2 values in (2),
partition p3 values in (3),
partition p4 values in (4)
);
insert into t3 select mod(a,5), a from t0;
explain partitions
select * from t1 left join t3 on (t1.a=t3.a and t3.part_id=3);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10
1 SIMPLE t3 p3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
# The following should have partitions="p3", NOT p0,p1,p2,p3,p4:
explain partitions
select * from t1 left join (t3 join t2) on (t1.a=t3.a and t3.a=t2.b and t3.part_id=3);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10
1 SIMPLE t3 p3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 10 Using where; Using join buffer (incremental, BNL join)
drop table t0,t1,t2,t3;

View File

@ -1535,4 +1535,35 @@ select * from t1 where (a = 1 AND b < 'd' AND (c = 'b' OR (c = 'c' AND d = 1)) O
(a = 1 AND b >= 'a' AND (c = 'c' OR (c = 'd' AND d = 2)))); (a = 1 AND b >= 'a' AND (c = 'c' OR (c = 'd' AND d = 2))));
drop table t1; drop table t1;
--echo #
--echo # MDEV-17493: Partition pruning doesn't work for nested outer joins
--echo #
create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1 (a int, b int, c int);
insert into t1 select a,a,a from t0;
create table t2 (a int, b int, c int);
insert into t2 select a,a,a from t0;
create table t3 (
part_id int,
a int
) partition by list (part_id) (
partition p0 values in (0),
partition p1 values in (1),
partition p2 values in (2),
partition p3 values in (3),
partition p4 values in (4)
);
insert into t3 select mod(a,5), a from t0;
explain partitions
select * from t1 left join t3 on (t1.a=t3.a and t3.part_id=3);
--echo # The following should have partitions="p3", NOT p0,p1,p2,p3,p4:
explain partitions
select * from t1 left join (t3 join t2) on (t1.a=t3.a and t3.a=t2.b and t3.part_id=3);
drop table t0,t1,t2,t3;

View File

@ -175,12 +175,12 @@ set @@sql_mode= @org_mode;
## ( Bug#29290 type_datetime.test failure in 5.1 ) ## ( Bug#29290 type_datetime.test failure in 5.1 )
## Therefore we sleep a bit if we are too close to midnight. ## Therefore we sleep a bit if we are too close to midnight.
## The complete test itself needs around 1 second. ## The complete test itself needs around 1 second.
## Therefore a time_distance to midnight of 5 seconds should be sufficient. ## Therefore a time_distance to midnight of 10 seconds should be sufficient.
if (`SELECT CURTIME() > SEC_TO_TIME(24 * 3600 - 5)`) if (`SELECT CURTIME() > SEC_TO_TIME(24 * 3600 - 10)`)
{ {
# We are here when CURTIME() is between '23:59:56' and '23:59:59'. # We are here when CURTIME() is between '23:59:51' and '23:59:59'.
# So a sleep time of 5 seconds brings us between '00:00:01' and '00:00:04'. # So a sleep time of 10 seconds brings us between '00:00:01' and '00:00:09'.
--real_sleep 5 --real_sleep 10
} }
create table t1 (f1 date, f2 datetime, f3 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); create table t1 (f1 date, f2 datetime, f3 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
insert into t1(f1) values(curdate()); insert into t1(f1) values(curdate());

View File

@ -1995,8 +1995,50 @@ select 0.0000000001 mod 1;
select 0.01 mod 1; select 0.01 mod 1;
0.01 mod 1 0.01 mod 1
0.01 0.01
CREATE TABLE t1 (
`FLD1` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD2` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD3` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD4` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD5` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD6` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD7` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD8` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD9` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD10` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD11` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD12` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD13` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD14` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD15` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD16` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD17` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD18` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD19` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD20` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD21` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD22` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD23` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000
);
INSERT INTO t1 VALUES (001.0760,000.9500,001.0000,001.0000,001.0000,
001.0000,001.0000,001.0000,001.0000,001.0000,001.0000,000.5949,001.0194,
001.0000,001.0000,001.0000,001.0000,001.0000,001.0000,000.9220,001.1890,001.2130,327.2690);
select FLD1*FLD2*FLD3*FLD4*FLD5*FLD6*FLD7*FLD8*FLD9*FLD10*FLD11*FLD12*FLD13*FLD14*FLD15*FLD16*FLD17*FLD18*FLD19*FLD20*FLD21*FLD22*FLD23 as calc1 from t1;
calc1
269.77575757644053032218703200000000000000
select FLD23*FLD2*FLD1*FLD4*FLD5*FLD11*FLD12*FLD13*FLD3*FLD15*FLD16*FLD17*FLD18*FLD19*FLD20*FLD21*FLD22*FLD14*FLD6*FLD7*FLD8*FLD9*FLD10 as calc2 from t1;
calc2
269.77575757644053032218703200000000000000
DROP TABLE t1;
CREATE TABLE t1 AS SELECT 1.0 * 2.000;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`1.0 * 2.000` decimal(6,4) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
# #
# Start of 10.0 tests # End of 5.5 tests
# #
# #
# MDEV-6950 Bad results with joins comparing DATE and INT/ENUM/VARCHAR columns # MDEV-6950 Bad results with joins comparing DATE and INT/ENUM/VARCHAR columns

View File

@ -1583,8 +1583,51 @@ select 0.000000000000000000000000000000000000000000000000001 mod 1;
select 0.0000000001 mod 1; select 0.0000000001 mod 1;
select 0.01 mod 1; select 0.01 mod 1;
#
# MDEV-17256 Decimal field multiplication bug
#
CREATE TABLE t1 (
`FLD1` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD2` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD3` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD4` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD5` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD6` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD7` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD8` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD9` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD10` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD11` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD12` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD13` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD14` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD15` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD16` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD17` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD18` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD19` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD20` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD21` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD22` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD23` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000
);
INSERT INTO t1 VALUES (001.0760,000.9500,001.0000,001.0000,001.0000,
001.0000,001.0000,001.0000,001.0000,001.0000,001.0000,000.5949,001.0194,
001.0000,001.0000,001.0000,001.0000,001.0000,001.0000,000.9220,001.1890,001.2130,327.2690);
select FLD1*FLD2*FLD3*FLD4*FLD5*FLD6*FLD7*FLD8*FLD9*FLD10*FLD11*FLD12*FLD13*FLD14*FLD15*FLD16*FLD17*FLD18*FLD19*FLD20*FLD21*FLD22*FLD23 as calc1 from t1;
select FLD23*FLD2*FLD1*FLD4*FLD5*FLD11*FLD12*FLD13*FLD3*FLD15*FLD16*FLD17*FLD18*FLD19*FLD20*FLD21*FLD22*FLD14*FLD6*FLD7*FLD8*FLD9*FLD10 as calc2 from t1;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT 1.0 * 2.000;
SHOW CREATE TABLE t1;
DROP TABLE t1;
--echo # --echo #
--echo # Start of 10.0 tests --echo # End of 5.5 tests
--echo # --echo #
--echo # --echo #

View File

@ -396,7 +396,14 @@ a
drop table t1; drop table t1;
drop function y2k; drop function y2k;
# #
# Start of 10.1 tests # MDEV-17257 Server crashes in Item::field_type_for_temporal_comparison or in get_datetime_value on SELECT with YEAR field and IN
#
CREATE TABLE t1 (y YEAR);
SELECT * FROM t1 WHERE y IN ( CAST( '1993-03-26 10:14:20' AS DATE ), NULL );
y
DROP TABLE t1;
#
# End of 10.0 tests
# #
# #
# MDEV-8741 Equal field propagation leaves some remainders after simplifying WHERE zerofill_column=2010 AND zerofill_column>=2010 # MDEV-8741 Equal field propagation leaves some remainders after simplifying WHERE zerofill_column=2010 AND zerofill_column>=2010

View File

@ -187,9 +187,16 @@ select a from t1 where a=b; # not a constant
drop table t1; drop table t1;
drop function y2k; drop function y2k;
--echo #
--echo # MDEV-17257 Server crashes in Item::field_type_for_temporal_comparison or in get_datetime_value on SELECT with YEAR field and IN
--echo #
CREATE TABLE t1 (y YEAR);
SELECT * FROM t1 WHERE y IN ( CAST( '1993-03-26 10:14:20' AS DATE ), NULL );
DROP TABLE t1;
--echo # --echo #
--echo # Start of 10.1 tests --echo # End of 10.0 tests
--echo # --echo #
--echo # --echo #

View File

@ -38,10 +38,10 @@ a row_number() over (partition by a order by b)
select a, b, x, row_number() over (partition by a order by x) from t1; select a, b, x, row_number() over (partition by a order by x) from t1;
a b x row_number() over (partition by a order by x) a b x row_number() over (partition by a order by x)
2 10 xx 1 2 10 xx 1
2 10 zz 3
2 20 yy 2 2 20 yy 2
3 10 xxx 2 2 10 zz 3
3 20 vvv 1 3 20 vvv 1
3 10 xxx 2
drop table t1; drop table t1;
create table t1 (pk int primary key, a int, b int); create table t1 (pk int primary key, a int, b int);
insert into t1 values insert into t1 values
@ -54,13 +54,14 @@ select
pk, a, b, pk, a, b,
row_number() over (order by a), row_number() over (order by a),
row_number() over (order by b) row_number() over (order by b)
from t1; from t1
order by b;
pk a b row_number() over (order by a) row_number() over (order by b) pk a b row_number() over (order by a) row_number() over (order by b)
1 10 22 1 5
2 11 21 2 4
3 12 20 3 3
4 13 19 4 2
5 14 18 5 1 5 14 18 5 1
4 13 19 4 2
3 12 20 3 3
2 11 21 2 4
1 10 22 1 5
drop table t1; drop table t1;
# #
# Try RANK() function # Try RANK() function
@ -228,16 +229,16 @@ count(*) over (partition by c order by pk desc
rows between 2 preceding and 2 following) as CNT rows between 2 preceding and 2 following) as CNT
from t1; from t1;
pk c CNT pk c CNT
1 1 3
2 1 4
3 1 4
4 1 3 4 1 3
5 2 3 3 1 4
6 2 4 2 1 4
7 2 5 1 1 3
8 2 5
9 2 4
10 2 3 10 2 3
9 2 4
8 2 5
7 2 5
6 2 4
5 2 3
drop table t0,t1; drop table t0,t1;
# #
# Resolution of window names # Resolution of window names
@ -535,42 +536,40 @@ insert into t3 values
(5, 2), (5, 2),
(6, 2); (6, 2);
select select
pk,
val, val,
count(val) over (order by val count(val) over (order by val
range between current row and range between current row and
current row) current row)
as CNT as CNT
from t3; from t3;
pk val CNT val CNT
0 1 3 1 3
1 1 3 1 3
2 1 3 1 3
3 2 4 2 4
4 2 4 2 4
5 2 4 2 4
6 2 4 2 4
insert into t3 values insert into t3 values
(7, 3), (7, 3),
(8, 3); (8, 3);
select select
pk,
val, val,
count(val) over (order by val count(val) over (order by val
range between current row and range between current row and
current row) current row)
as CNT as CNT
from t3; from t3;
pk val CNT val CNT
0 1 3 1 3
1 1 3 1 3
2 1 3 1 3
3 2 4 2 4
4 2 4 2 4
5 2 4 2 4
6 2 4 2 4
7 3 2 3 2
8 3 2 3 2
drop table t3; drop table t3;
# Now, check with PARTITION BY # Now, check with PARTITION BY
create table t4 ( create table t4 (
@ -599,7 +598,6 @@ insert into t4 values
(5678, 208, 3); (5678, 208, 3);
select select
part_id, part_id,
pk,
val, val,
count(val) over (partition by part_id count(val) over (partition by part_id
order by val order by val
@ -607,31 +605,30 @@ range between current row and
current row) current row)
as CNT as CNT
from t4; from t4;
part_id pk val CNT part_id val CNT
1234 100 1 3 1234 1 3
1234 101 1 3 1234 1 3
1234 102 1 3 1234 1 3
1234 103 2 4 1234 2 4
1234 104 2 4 1234 2 4
1234 105 2 4 1234 2 4
1234 106 2 4 1234 2 4
1234 107 3 2 1234 3 2
1234 108 3 2 1234 3 2
5678 200 1 3 5678 1 3
5678 201 1 3 5678 1 3
5678 202 1 3 5678 1 3
5678 203 2 4 5678 2 4
5678 204 2 4 5678 2 4
5678 205 2 4 5678 2 4
5678 206 2 4 5678 2 4
5678 207 3 2 5678 3 2
5678 208 3 2 5678 3 2
# #
# Try RANGE UNBOUNDED PRECEDING | FOLLOWING # Try RANGE UNBOUNDED PRECEDING | FOLLOWING
# #
select select
part_id, part_id,
pk,
val, val,
count(val) over (partition by part_id count(val) over (partition by part_id
order by val order by val
@ -639,28 +636,27 @@ range between unbounded preceding and
current row) current row)
as CNT as CNT
from t4; from t4;
part_id pk val CNT part_id val CNT
1234 100 1 3 1234 1 3
1234 101 1 3 1234 1 3
1234 102 1 3 1234 1 3
1234 103 2 7 1234 2 7
1234 104 2 7 1234 2 7
1234 105 2 7 1234 2 7
1234 106 2 7 1234 2 7
1234 107 3 9 1234 3 9
1234 108 3 9 1234 3 9
5678 200 1 3 5678 1 3
5678 201 1 3 5678 1 3
5678 202 1 3 5678 1 3
5678 203 2 7 5678 2 7
5678 204 2 7 5678 2 7
5678 205 2 7 5678 2 7
5678 206 2 7 5678 2 7
5678 207 3 9 5678 3 9
5678 208 3 9 5678 3 9
select select
part_id, part_id,
pk,
val, val,
count(val) over (partition by part_id count(val) over (partition by part_id
order by val order by val
@ -668,28 +664,27 @@ range between current row and
unbounded following) unbounded following)
as CNT as CNT
from t4; from t4;
part_id pk val CNT part_id val CNT
1234 100 1 9 1234 1 9
1234 101 1 9 1234 1 9
1234 102 1 9 1234 1 9
1234 103 2 6 1234 2 6
1234 104 2 6 1234 2 6
1234 105 2 6 1234 2 6
1234 106 2 6 1234 2 6
1234 107 3 2 1234 3 2
1234 108 3 2 1234 3 2
5678 200 1 9 5678 1 9
5678 201 1 9 5678 1 9
5678 202 1 9 5678 1 9
5678 203 2 6 5678 2 6
5678 204 2 6 5678 2 6
5678 205 2 6 5678 2 6
5678 206 2 6 5678 2 6
5678 207 3 2 5678 3 2
5678 208 3 2 5678 3 2
select select
part_id, part_id,
pk,
val, val,
count(val) over (partition by part_id count(val) over (partition by part_id
order by val order by val
@ -697,25 +692,25 @@ range between unbounded preceding and
unbounded following) unbounded following)
as CNT as CNT
from t4; from t4;
part_id pk val CNT part_id val CNT
1234 100 1 9 1234 1 9
1234 101 1 9 1234 1 9
1234 102 1 9 1234 1 9
1234 103 2 9 1234 2 9
1234 104 2 9 1234 2 9
1234 105 2 9 1234 2 9
1234 106 2 9 1234 2 9
1234 107 3 9 1234 3 9
1234 108 3 9 1234 3 9
5678 200 1 9 5678 1 9
5678 201 1 9 5678 1 9
5678 202 1 9 5678 1 9
5678 203 2 9 5678 2 9
5678 204 2 9 5678 2 9
5678 205 2 9 5678 2 9
5678 206 2 9 5678 2 9
5678 207 3 9 5678 3 9
5678 208 3 9 5678 3 9
drop table t4; drop table t4;
# #
# MDEV-9695: Wrong window frame when using RANGE BETWEEN N FOLLOWING AND PRECEDING # MDEV-9695: Wrong window frame when using RANGE BETWEEN N FOLLOWING AND PRECEDING
@ -881,15 +876,15 @@ RANGE BETWEEN UNBOUNDED PRECEDING
AND 10 FOLLOWING) as cnt AND 10 FOLLOWING) as cnt
from t1; from t1;
pk a cnt pk a cnt
1 1 9
2 2 9
3 4 9
4 8 9
5 26 5
6 27 5
7 40 3
8 71 2
9 72 2 9 72 2
8 71 2
7 40 3
6 27 5
5 26 5
4 8 9
3 4 9
2 2 9
1 1 9
select select
pk, a, pk, a,
count(a) over (ORDER BY a count(a) over (ORDER BY a
@ -929,15 +924,15 @@ RANGE BETWEEN UNBOUNDED PRECEDING
AND 10 PRECEDING) as cnt AND 10 PRECEDING) as cnt
from t1; from t1;
pk a cnt pk a cnt
1 1 5
2 2 5
3 4 5
4 8 5
5 26 3
6 27 3
7 40 2
8 71 0
9 72 0 9 72 0
8 71 0
7 40 2
6 27 3
5 26 3
4 8 5
3 4 5
2 2 5
1 1 5
select select
pk, a, pk, a,
count(a) over (ORDER BY a count(a) over (ORDER BY a
@ -977,15 +972,15 @@ RANGE BETWEEN 1 PRECEDING
AND CURRENT ROW) as cnt AND CURRENT ROW) as cnt
from t1; from t1;
pk a cnt pk a cnt
1 1 2
2 2 1
3 4 1
4 8 1
5 26 2
6 27 1
7 40 1
8 71 2
9 72 1 9 72 1
8 71 2
7 40 1
6 27 1
5 26 2
4 8 1
3 4 1
2 2 1
1 1 2
select select
pk, a, pk, a,
count(a) over (ORDER BY a count(a) over (ORDER BY a
@ -1026,15 +1021,15 @@ range between current row
and 1 following) as cnt and 1 following) as cnt
from t1; from t1;
pk a cnt pk a cnt
1 1 1
2 2 2
3 4 1
4 8 1
5 26 1
6 27 2
7 40 1
8 71 1
9 72 2 9 72 2
8 71 1
7 40 1
6 27 2
5 26 1
4 8 1
3 4 1
2 2 2
1 1 1
insert into t1 select 22, pk, a from t1; insert into t1 select 22, pk, a from t1;
select select
part_id, pk, a, part_id, pk, a,
@ -1137,7 +1132,8 @@ pk, a,
count(b) over (order by a count(b) over (order by a
range between 2 preceding range between 2 preceding
and 2 following) as CNT and 2 following) as CNT
from t1; from t1
order by a, pk;
pk a CNT pk a CNT
1 NULL 3 1 NULL 3
2 NULL 3 2 NULL 3
@ -1969,12 +1965,12 @@ ROW_NUMBER() OVER (order by s1),
CUME_DIST() OVER (order by -s1) CUME_DIST() OVER (order by -s1)
from t1; from t1;
s1 s2 ROW_NUMBER() OVER (order by s1) CUME_DIST() OVER (order by -s1) s1 s2 ROW_NUMBER() OVER (order by s1) CUME_DIST() OVER (order by -s1)
-1 2 1.0000000000
1 a 3 0.8333333333 1 a 3 0.8333333333
NULL NULL 1 0.1666666667 2 b 4 0.6666666667
3 NULL 5 0.5000000000 3 NULL 5 0.5000000000
4 a 6 0.3333333333 4 a 6 0.3333333333
2 b 4 0.6666666667 NULL NULL 1 0.1666666667
-1 2 1.0000000000
drop table t1; drop table t1;
# #
# MDEV-9925: Wrong result with aggregate function as a window function # MDEV-9925: Wrong result with aggregate function as a window function
@ -2012,8 +2008,8 @@ o_custkey avg(o_custkey) OVER (PARTITION BY abs(o_custkey)
ORDER BY o_custkey ORDER BY o_custkey
RANGE BETWEEN 15 FOLLOWING RANGE BETWEEN 15 FOLLOWING
AND 15 FOLLOWING) AND 15 FOLLOWING)
242 NULL
238 NULL 238 NULL
242 NULL
DROP table orders; DROP table orders;
# #
# MDEV-10842: window functions with the same order column # MDEV-10842: window functions with the same order column
@ -2042,20 +2038,20 @@ row_number() over (order by pk desc) as r_desc,
row_number() over (order by pk asc) as r_asc row_number() over (order by pk asc) as r_asc
from t1; from t1;
pk r_desc r_asc pk r_desc r_asc
1 11 1
2 10 2
3 9 3
4 8 4
5 7 5
6 6 6
7 5 7
8 4 8
9 3 9
10 2 10
11 1 11 11 1 11
10 2 10
9 3 9
8 4 8
7 5 7
6 6 6
5 7 5
4 8 4
3 9 3
2 10 2
1 11 1
drop table t1; drop table t1;
# #
# MDEV-10874: two window functions with ccompatible sorting # MDEV-10874: two window functions with compatible sorting
# #
create table t1 ( create table t1 (
pk int primary key, pk int primary key,
@ -2130,17 +2126,17 @@ sum(d) over (order by a
ROWS BETWEEN 1 preceding and 2 following) as sum_2 ROWS BETWEEN 1 preceding and 2 following) as sum_2
from t1; from t1;
pk a d sum_1 sum_2 pk a d sum_1 sum_2
1 0 0.100 0.300 1.400
2 0 0.200 0.500 1.200
3 0 0.300 0.300 0.600 3 0 0.300 0.300 0.600
4 1 0.400 0.900 2.600 2 0 0.200 0.500 1.200
5 1 0.500 1.100 2.400 1 0 0.100 0.300 1.400
6 1 0.600 0.600 1.600 6 1 0.600 0.600 1.600
7 2 0.500 0.500 0.500 5 1 0.500 1.100 2.400
8 2 NULL 0.700 1.200 4 1 0.400 0.900 2.600
9 2 0.700 1.500 2.000
10 2 0.800 1.700 2.400
11 2 0.900 0.900 2.800 11 2 0.900 0.900 2.800
10 2 0.800 1.700 2.400
9 2 0.700 1.500 2.000
8 2 NULL 0.700 1.200
7 2 0.500 0.500 0.500
drop table t1; drop table t1;
# #
# MDEV-9941: two window functions with compatible partitions # MDEV-9941: two window functions with compatible partitions
@ -2232,9 +2228,9 @@ SELECT sum(t.a) over (partition by t.b order by a),
sqrt(ifnull((sum(t.a) over (partition by t.b order by a)), 0)) sqrt(ifnull((sum(t.a) over (partition by t.b order by a)), 0))
from t; from t;
sum(t.a) over (partition by t.b order by a) sqrt(ifnull((sum(t.a) over (partition by t.b order by a)), 0)) sum(t.a) over (partition by t.b order by a) sqrt(ifnull((sum(t.a) over (partition by t.b order by a)), 0))
0.0000000000 0
1.0000000000 1 1.0000000000 1
3.0000000000 1.7320508075688772 3.0000000000 1.7320508075688772
0.0000000000 0
drop table t; drop table t;
# #
# MDEV-10868: view definitions with window functions # MDEV-10868: view definitions with window functions
@ -2391,9 +2387,9 @@ CREATE TABLE t2 (c VARCHAR(8));
INSERT INTO t2 VALUES ('foo'),('bar'),('foo'); INSERT INTO t2 VALUES ('foo'),('bar'),('foo');
SELECT COUNT(*) OVER (PARTITION BY c) FROM t2; SELECT COUNT(*) OVER (PARTITION BY c) FROM t2;
COUNT(*) OVER (PARTITION BY c) COUNT(*) OVER (PARTITION BY c)
2
1 1
2 2
2
SELECT * FROM t1 WHERE i IN ( SELECT COUNT(*) OVER (PARTITION BY c) FROM t2 ); SELECT * FROM t1 WHERE i IN ( SELECT COUNT(*) OVER (PARTITION BY c) FROM t2 );
i i
1 1
@ -2511,14 +2507,14 @@ select id, rank() over (order by id) from t1;
id rank() over (order by id) id rank() over (order by id)
1 1 1 1
2 2 2 2
3 4
2 2 2 2
3 4
select * from v1; select * from v1;
id rnk id rnk
1 1 1 1
2 2 2 2
3 4
2 2 2 2
3 4
drop view v1; drop view v1;
drop table t1; drop table t1;
# #
@ -2879,64 +2875,64 @@ CDEC min(TDEC.CDEC) over ()
NULL -1 NULL -1
-1 -1 -1 -1
0 -1 0 -1
1 -1
0 -1 0 -1
1 -1
10 -1 10 -1
select VDEC.CDEC, min(VDEC.CDEC) over () from VDEC; select VDEC.CDEC, min(VDEC.CDEC) over () from VDEC;
CDEC min(VDEC.CDEC) over () CDEC min(VDEC.CDEC) over ()
NULL -1 NULL -1
-1 -1 -1 -1
0 -1 0 -1
1 -1
0 -1 0 -1
1 -1
10 -1 10 -1
select TDEC.CDEC, max(TDEC.CDEC) over () from TDEC; select TDEC.CDEC, max(TDEC.CDEC) over () from TDEC;
CDEC max(TDEC.CDEC) over () CDEC max(TDEC.CDEC) over ()
NULL 10 NULL 10
-1 10 -1 10
0 10 0 10
1 10
0 10 0 10
1 10
10 10 10 10
select VDEC.CDEC, max(VDEC.CDEC) over () from VDEC; select VDEC.CDEC, max(VDEC.CDEC) over () from VDEC;
CDEC max(VDEC.CDEC) over () CDEC max(VDEC.CDEC) over ()
NULL 10 NULL 10
-1 10 -1 10
0 10 0 10
1 10
0 10 0 10
1 10
10 10 10 10
select TDEC.CDEC, min(distinct TDEC.CDEC) over () from TDEC; select TDEC.CDEC, min(distinct TDEC.CDEC) over () from TDEC;
CDEC min(distinct TDEC.CDEC) over () CDEC min(distinct TDEC.CDEC) over ()
NULL -1 NULL -1
-1 -1 -1 -1
0 -1 0 -1
1 -1
0 -1 0 -1
1 -1
10 -1 10 -1
select VDEC.CDEC, min(distinct VDEC.CDEC) over () from VDEC; select VDEC.CDEC, min(distinct VDEC.CDEC) over () from VDEC;
CDEC min(distinct VDEC.CDEC) over () CDEC min(distinct VDEC.CDEC) over ()
NULL -1 NULL -1
-1 -1 -1 -1
0 -1 0 -1
1 -1
0 -1 0 -1
1 -1
10 -1 10 -1
select TDEC.CDEC, max(distinct TDEC.CDEC) over () from TDEC; select TDEC.CDEC, max(distinct TDEC.CDEC) over () from TDEC;
CDEC max(distinct TDEC.CDEC) over () CDEC max(distinct TDEC.CDEC) over ()
NULL 10 NULL 10
-1 10 -1 10
0 10 0 10
1 10
0 10 0 10
1 10
10 10 10 10
select VDEC.CDEC, max(distinct VDEC.CDEC) over () from VDEC; select VDEC.CDEC, max(distinct VDEC.CDEC) over () from VDEC;
CDEC max(distinct VDEC.CDEC) over () CDEC max(distinct VDEC.CDEC) over ()
NULL 10 NULL 10
-1 10 -1 10
0 10 0 10
1 10
0 10 0 10
1 10
10 10 10 10
# #
# These should be removed once support for them is added. # These should be removed once support for them is added.
@ -3327,6 +3323,45 @@ BIT_AND(0) OVER () MAX(1)
0 1 0 1
drop table t1; drop table t1;
# #
# MDEV-17525: Window functions not working in ONLY_FULL_GROUP_BY mode
#
CREATE TABLE t1 (name CHAR(10), test CHAR(10), score TINYINT);
INSERT INTO t1 VALUES
('Chun', 'SQL', 75), ('Chun', 'Tuning', 73),
('Esben', 'SQL', 43), ('Esben', 'Tuning', 31),
('Kaolin', 'SQL', 56), ('Kaolin', 'Tuning', 88),
('Tatiana', 'SQL', 87), ('Tatiana', 'Tuning', 83);
SET @save_sql_mode= @@sql_mode;
SET sql_mode = 'ONLY_FULL_GROUP_BY';
SELECT name, test, score,
AVG(score) OVER (PARTITION BY test) AS average_by_test
FROM t1
ORDER BY test, name;
name test score average_by_test
Chun SQL 75 65.2500
Esben SQL 43 65.2500
Kaolin SQL 56 65.2500
Tatiana SQL 87 65.2500
Chun Tuning 73 68.7500
Esben Tuning 31 68.7500
Kaolin Tuning 88 68.7500
Tatiana Tuning 83 68.7500
set @@sql_mode= @save_sql_mode;
SELECT name, test, score,
AVG(score) OVER (PARTITION BY test) AS average_by_test
FROM t1
ORDER BY test, name;
name test score average_by_test
Chun SQL 75 65.2500
Esben SQL 43 65.2500
Kaolin SQL 56 65.2500
Tatiana SQL 87 65.2500
Chun Tuning 73 68.7500
Esben Tuning 31 68.7500
Kaolin Tuning 88 68.7500
Tatiana Tuning 83 68.7500
drop table t1;
#
# Start of 10.3 tests # Start of 10.3 tests
# #
# #

View File

@ -58,7 +58,8 @@ select
pk, a, b, pk, a, b,
row_number() over (order by a), row_number() over (order by a),
row_number() over (order by b) row_number() over (order by b)
from t1; from t1
order by b;
drop table t1; drop table t1;
@ -391,7 +392,6 @@ insert into t3 values
(6, 2); (6, 2);
select select
pk,
val, val,
count(val) over (order by val count(val) over (order by val
range between current row and range between current row and
@ -404,7 +404,6 @@ insert into t3 values
(8, 3); (8, 3);
select select
pk,
val, val,
count(val) over (order by val count(val) over (order by val
range between current row and range between current row and
@ -444,7 +443,6 @@ insert into t4 values
select select
part_id, part_id,
pk,
val, val,
count(val) over (partition by part_id count(val) over (partition by part_id
order by val order by val
@ -458,7 +456,6 @@ from t4;
--echo # --echo #
select select
part_id, part_id,
pk,
val, val,
count(val) over (partition by part_id count(val) over (partition by part_id
order by val order by val
@ -469,7 +466,6 @@ from t4;
select select
part_id, part_id,
pk,
val, val,
count(val) over (partition by part_id count(val) over (partition by part_id
order by val order by val
@ -480,7 +476,6 @@ from t4;
select select
part_id, part_id,
pk,
val, val,
count(val) over (partition by part_id count(val) over (partition by part_id
order by val order by val
@ -723,7 +718,8 @@ select
count(b) over (order by a count(b) over (order by a
range between 2 preceding range between 2 preceding
and 2 following) as CNT and 2 following) as CNT
from t1; from t1
order by a, pk;
drop table t1; drop table t1;
--echo # --echo #
@ -1023,6 +1019,7 @@ insert into t1 values
--echo # Check using counters --echo # Check using counters
flush status; flush status;
--sorted_result
select select
rank() over (partition by c order by a), rank() over (partition by c order by a),
rank() over (partition by c order by b) rank() over (partition by c order by b)
@ -1030,6 +1027,7 @@ from t1;
show status like '%sort%'; show status like '%sort%';
flush status; flush status;
--sorted_result
select select
rank() over (partition by c order by a), rank() over (partition by c order by a),
rank() over (partition by c order by a) rank() over (partition by c order by a)
@ -1101,6 +1099,7 @@ insert into t1 values
(2,2), (2,2),
(3,1); (3,1);
--sorted_result
select select
a, b, a, b,
rank() over (order by a), rank() over (order by b), rank() over (order by a), rank() over (order by b),
@ -1192,6 +1191,7 @@ insert into t1 values (4,'a');
insert into t1 values (2,'b'); insert into t1 values (2,'b');
insert into t1 values (-1,''); insert into t1 values (-1,'');
--sorted_result
select select
*, *,
ROW_NUMBER() OVER (order by s1), ROW_NUMBER() OVER (order by s1),
@ -1267,7 +1267,7 @@ from t1;
drop table t1; drop table t1;
--echo # --echo #
--echo # MDEV-10874: two window functions with ccompatible sorting --echo # MDEV-10874: two window functions with compatible sorting
--echo # --echo #
create table t1 ( create table t1 (
@ -2093,6 +2093,33 @@ SELECT DISTINCT row_number() OVER (), MAX(1) FROM t1;
SELECT DISTINCT BIT_AND(0) OVER (), MAX(1) FROM t1; SELECT DISTINCT BIT_AND(0) OVER (), MAX(1) FROM t1;
drop table t1; drop table t1;
--echo #
--echo # MDEV-17525: Window functions not working in ONLY_FULL_GROUP_BY mode
--echo #
CREATE TABLE t1 (name CHAR(10), test CHAR(10), score TINYINT);
INSERT INTO t1 VALUES
('Chun', 'SQL', 75), ('Chun', 'Tuning', 73),
('Esben', 'SQL', 43), ('Esben', 'Tuning', 31),
('Kaolin', 'SQL', 56), ('Kaolin', 'Tuning', 88),
('Tatiana', 'SQL', 87), ('Tatiana', 'Tuning', 83);
SET @save_sql_mode= @@sql_mode;
SET sql_mode = 'ONLY_FULL_GROUP_BY';
SELECT name, test, score,
AVG(score) OVER (PARTITION BY test) AS average_by_test
FROM t1
ORDER BY test, name;
set @@sql_mode= @save_sql_mode;
SELECT name, test, score,
AVG(score) OVER (PARTITION BY test) AS average_by_test
FROM t1
ORDER BY test, name;
drop table t1;
--echo # --echo #
--echo # Start of 10.3 tests --echo # Start of 10.3 tests
--echo # --echo #

View File

@ -68,17 +68,17 @@ first_value(pk) over (order by pk desc),
last_value(pk) over (order by pk desc) last_value(pk) over (order by pk desc)
from t1; from t1;
pk first_value(pk) over (order by pk desc) last_value(pk) over (order by pk desc) pk first_value(pk) over (order by pk desc) last_value(pk) over (order by pk desc)
1 11 1
2 11 2
3 11 3
4 11 4
5 11 5
6 11 6
7 11 7
8 11 8
9 11 9
10 11 10
11 11 11 11 11 11
10 11 10
9 11 9
8 11 8
7 11 7
6 11 6
5 11 5
4 11 4
3 11 3
2 11 2
1 11 1
select pk, a, b, c, d, e, select pk, a, b, c, d, e,
first_value(b) over (partition by a order by pk) as fst_b, first_value(b) over (partition by a order by pk) as fst_b,
last_value(b) over (partition by a order by pk) as lst_b, last_value(b) over (partition by a order by pk) as lst_b,

View File

@ -14,49 +14,49 @@ insert into t1 values
( 7 , 2, 20), ( 7 , 2, 20),
( 9 , 4, 20), ( 9 , 4, 20),
(10 , 4, 20); (10 , 4, 20);
select pk, a, b, select a,
percent_rank() over (order by a), percent_rank() over (order by a),
cume_dist() over (order by a) cume_dist() over (order by a)
from t1; from t1;
pk a b percent_rank() over (order by a) cume_dist() over (order by a) a percent_rank() over (order by a) cume_dist() over (order by a)
1 0 10 0.0000000000 0.2000000000 0 0.0000000000 0.2000000000
2 0 10 0.0000000000 0.2000000000 0 0.0000000000 0.2000000000
3 1 10 0.2222222222 0.4000000000 1 0.2222222222 0.4000000000
4 1 10 0.2222222222 0.4000000000 1 0.2222222222 0.4000000000
8 2 10 0.4444444444 0.8000000000 2 0.4444444444 0.8000000000
5 2 20 0.4444444444 0.8000000000 2 0.4444444444 0.8000000000
6 2 20 0.4444444444 0.8000000000 2 0.4444444444 0.8000000000
7 2 20 0.4444444444 0.8000000000 2 0.4444444444 0.8000000000
9 4 20 0.8888888889 1.0000000000 4 0.8888888889 1.0000000000
10 4 20 0.8888888889 1.0000000000 4 0.8888888889 1.0000000000
select pk, a, b, select pk,
percent_rank() over (order by pk), percent_rank() over (order by pk),
cume_dist() over (order by pk) cume_dist() over (order by pk)
from t1 order by pk; from t1 order by pk;
pk a b percent_rank() over (order by pk) cume_dist() over (order by pk) pk percent_rank() over (order by pk) cume_dist() over (order by pk)
1 0 10 0.0000000000 0.1000000000 1 0.0000000000 0.1000000000
2 0 10 0.1111111111 0.2000000000 2 0.1111111111 0.2000000000
3 1 10 0.2222222222 0.3000000000 3 0.2222222222 0.3000000000
4 1 10 0.3333333333 0.4000000000 4 0.3333333333 0.4000000000
5 2 20 0.4444444444 0.5000000000 5 0.4444444444 0.5000000000
6 2 20 0.5555555556 0.6000000000 6 0.5555555556 0.6000000000
7 2 20 0.6666666667 0.7000000000 7 0.6666666667 0.7000000000
8 2 10 0.7777777778 0.8000000000 8 0.7777777778 0.8000000000
9 4 20 0.8888888889 0.9000000000 9 0.8888888889 0.9000000000
10 4 20 1.0000000000 1.0000000000 10 1.0000000000 1.0000000000
select pk, a, b, select a,
percent_rank() over (partition by a order by a), percent_rank() over (partition by a order by a),
cume_dist() over (partition by a order by a) cume_dist() over (partition by a order by a)
from t1; from t1;
pk a b percent_rank() over (partition by a order by a) cume_dist() over (partition by a order by a) a percent_rank() over (partition by a order by a) cume_dist() over (partition by a order by a)
1 0 10 0.0000000000 1.0000000000 0 0.0000000000 1.0000000000
2 0 10 0.0000000000 1.0000000000 0 0.0000000000 1.0000000000
3 1 10 0.0000000000 1.0000000000 1 0.0000000000 1.0000000000
4 1 10 0.0000000000 1.0000000000 1 0.0000000000 1.0000000000
8 2 10 0.0000000000 1.0000000000 2 0.0000000000 1.0000000000
5 2 20 0.0000000000 1.0000000000 2 0.0000000000 1.0000000000
6 2 20 0.0000000000 1.0000000000 2 0.0000000000 1.0000000000
7 2 20 0.0000000000 1.0000000000 2 0.0000000000 1.0000000000
9 4 20 0.0000000000 1.0000000000 4 0.0000000000 1.0000000000
10 4 20 0.0000000000 1.0000000000 4 0.0000000000 1.0000000000
drop table t1; drop table t1;

View File

@ -17,17 +17,17 @@ insert into t1 values
( 9 , 4, 20), ( 9 , 4, 20),
(10 , 4, 20); (10 , 4, 20);
select pk, a, b, select a,
percent_rank() over (order by a), percent_rank() over (order by a),
cume_dist() over (order by a) cume_dist() over (order by a)
from t1; from t1;
select pk, a, b, select pk,
percent_rank() over (order by pk), percent_rank() over (order by pk),
cume_dist() over (order by pk) cume_dist() over (order by pk)
from t1 order by pk; from t1 order by pk;
select pk, a, b, select a,
percent_rank() over (partition by a order by a), percent_rank() over (partition by a order by a),
cume_dist() over (partition by a order by a) cume_dist() over (partition by a order by a)
from t1; from t1;

View File

@ -32,8 +32,8 @@ Chun 5.0000000000
Kaolin 4.0000000000 Kaolin 4.0000000000
Kaolin 4.0000000000 Kaolin 4.0000000000
Kaolin 4.0000000000 Kaolin 4.0000000000
Tatiana 4.0000000000
Tata 4.0000000000 Tata 4.0000000000
Tatiana 4.0000000000
select name, percentile_disc(0.5) within group(order by score) over (partition by name) as c from t1; select name, percentile_disc(0.5) within group(order by score) over (partition by name) as c from t1;
name c name c
Chun 3.0000000000 Chun 3.0000000000
@ -41,8 +41,8 @@ Chun 3.0000000000
Kaolin 4.0000000000 Kaolin 4.0000000000
Kaolin 4.0000000000 Kaolin 4.0000000000
Kaolin 4.0000000000 Kaolin 4.0000000000
Tatiana 4.0000000000
Tata 4.0000000000 Tata 4.0000000000
Tatiana 4.0000000000
# no partition clause # no partition clause
select name, percentile_disc(0.5) within group(order by score) over () from t1; select name, percentile_disc(0.5) within group(order by score) over () from t1;
name percentile_disc(0.5) within group(order by score) over () name percentile_disc(0.5) within group(order by score) over ()
@ -51,8 +51,8 @@ Chun 4.0000000000
Kaolin 4.0000000000 Kaolin 4.0000000000
Kaolin 4.0000000000 Kaolin 4.0000000000
Kaolin 4.0000000000 Kaolin 4.0000000000
Tatiana 4.0000000000
Tata 4.0000000000 Tata 4.0000000000
Tatiana 4.0000000000
select name, percentile_cont(0.5) within group(order by score) over () from t1; select name, percentile_cont(0.5) within group(order by score) over () from t1;
name percentile_cont(0.5) within group(order by score) over () name percentile_cont(0.5) within group(order by score) over ()
Chun 4.0000000000 Chun 4.0000000000
@ -60,8 +60,8 @@ Chun 4.0000000000
Kaolin 4.0000000000 Kaolin 4.0000000000
Kaolin 4.0000000000 Kaolin 4.0000000000
Kaolin 4.0000000000 Kaolin 4.0000000000
Tatiana 4.0000000000
Tata 4.0000000000 Tata 4.0000000000
Tatiana 4.0000000000
# argument set to null # argument set to null
select name, percentile_cont(null) within group(order by score) over (partition by name) from t1; select name, percentile_cont(null) within group(order by score) over (partition by name) from t1;
ERROR HY000: percentile_cont function only accepts arguments that can be converted to numerical types ERROR HY000: percentile_cont function only accepts arguments that can be converted to numerical types
@ -75,8 +75,8 @@ Chun 5.0000000000
Kaolin 4.0000000000 Kaolin 4.0000000000
Kaolin 4.0000000000 Kaolin 4.0000000000
Kaolin 4.0000000000 Kaolin 4.0000000000
Tatiana 4.0000000000
Tata 4.0000000000 Tata 4.0000000000
Tatiana 4.0000000000
select * from ( select name , percentile_disc(0.5) within group ( order by score) over (partition by name ) from t1 ) as t; select * from ( select name , percentile_disc(0.5) within group ( order by score) over (partition by name ) from t1 ) as t;
name percentile_disc(0.5) within group ( order by score) over (partition by name ) name percentile_disc(0.5) within group ( order by score) over (partition by name )
Chun 3.0000000000 Chun 3.0000000000
@ -84,8 +84,8 @@ Chun 3.0000000000
Kaolin 4.0000000000 Kaolin 4.0000000000
Kaolin 4.0000000000 Kaolin 4.0000000000
Kaolin 4.0000000000 Kaolin 4.0000000000
Tatiana 4.0000000000
Tata 4.0000000000 Tata 4.0000000000
Tatiana 4.0000000000
select name from t1 a where (select percentile_disc(0.5) within group (order by score) over (partition by name) from t1 b limit 1) >= 0.5; select name from t1 a where (select percentile_disc(0.5) within group (order by score) over (partition by name) from t1 b limit 1) >= 0.5;
name name
Chun Chun
@ -93,8 +93,8 @@ Chun
Kaolin Kaolin
Kaolin Kaolin
Kaolin Kaolin
Tatiana
Tata Tata
Tatiana
#disallowed fields in order by #disallowed fields in order by
select score, percentile_cont(0.5) within group(order by name) over (partition by score) from t1; select score, percentile_cont(0.5) within group(order by name) over (partition by score) from t1;
ERROR HY000: Numeric datatype is required for percentile_cont function ERROR HY000: Numeric datatype is required for percentile_cont function
@ -121,10 +121,10 @@ name cume_dist() over (partition by name order by score) c
Chun 0.5000000000 3.0000000000 Chun 0.5000000000 3.0000000000
Chun 1.0000000000 3.0000000000 Chun 1.0000000000 3.0000000000
Kaolin 0.3333333333 4.0000000000 Kaolin 0.3333333333 4.0000000000
Kaolin 1.0000000000 4.0000000000
Kaolin 0.6666666667 4.0000000000 Kaolin 0.6666666667 4.0000000000
Tatiana 1.0000000000 4.0000000000 Kaolin 1.0000000000 4.0000000000
Tata 1.0000000000 4.0000000000 Tata 1.0000000000 4.0000000000
Tatiana 1.0000000000 4.0000000000
select name, percentile_cont(0.5) within group(order by score) over (partition by name) as c from t1; select name, percentile_cont(0.5) within group(order by score) over (partition by name) as c from t1;
name c name c
Chun 5.0000000000 Chun 5.0000000000
@ -132,98 +132,98 @@ Chun 5.0000000000
Kaolin 4.0000000000 Kaolin 4.0000000000
Kaolin 4.0000000000 Kaolin 4.0000000000
Kaolin 4.0000000000 Kaolin 4.0000000000
Tatiana 4.0000000000
Tata 4.0000000000 Tata 4.0000000000
Tatiana 4.0000000000
select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.1) within group(order by score) over (partition by name) as c from t1; select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.1) within group(order by score) over (partition by name) as c from t1;
name b c name b c
Chun 0.5000000000 3.0000000000 Chun 0.5000000000 3.0000000000
Chun 1.0000000000 3.0000000000 Chun 1.0000000000 3.0000000000
Kaolin 0.3333333333 3.0000000000 Kaolin 0.3333333333 3.0000000000
Kaolin 1.0000000000 3.0000000000
Kaolin 0.6666666667 3.0000000000 Kaolin 0.6666666667 3.0000000000
Tatiana 1.0000000000 4.0000000000 Kaolin 1.0000000000 3.0000000000
Tata 1.0000000000 4.0000000000 Tata 1.0000000000 4.0000000000
Tatiana 1.0000000000 4.0000000000
select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.2) within group(order by score) over (partition by name) as c from t1; select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.2) within group(order by score) over (partition by name) as c from t1;
name b c name b c
Chun 0.5000000000 3.0000000000 Chun 0.5000000000 3.0000000000
Chun 1.0000000000 3.0000000000 Chun 1.0000000000 3.0000000000
Kaolin 0.3333333333 3.0000000000 Kaolin 0.3333333333 3.0000000000
Kaolin 1.0000000000 3.0000000000
Kaolin 0.6666666667 3.0000000000 Kaolin 0.6666666667 3.0000000000
Tatiana 1.0000000000 4.0000000000 Kaolin 1.0000000000 3.0000000000
Tata 1.0000000000 4.0000000000 Tata 1.0000000000 4.0000000000
Tatiana 1.0000000000 4.0000000000
select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.3) within group(order by score) over (partition by name) as c from t1; select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.3) within group(order by score) over (partition by name) as c from t1;
name b c name b c
Chun 0.5000000000 3.0000000000 Chun 0.5000000000 3.0000000000
Chun 1.0000000000 3.0000000000 Chun 1.0000000000 3.0000000000
Kaolin 0.3333333333 3.0000000000 Kaolin 0.3333333333 3.0000000000
Kaolin 1.0000000000 3.0000000000
Kaolin 0.6666666667 3.0000000000 Kaolin 0.6666666667 3.0000000000
Tatiana 1.0000000000 4.0000000000 Kaolin 1.0000000000 3.0000000000
Tata 1.0000000000 4.0000000000 Tata 1.0000000000 4.0000000000
Tatiana 1.0000000000 4.0000000000
select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.4) within group(order by score) over (partition by name) as c from t1; select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.4) within group(order by score) over (partition by name) as c from t1;
name b c name b c
Chun 0.5000000000 3.0000000000 Chun 0.5000000000 3.0000000000
Chun 1.0000000000 3.0000000000 Chun 1.0000000000 3.0000000000
Kaolin 0.3333333333 4.0000000000 Kaolin 0.3333333333 4.0000000000
Kaolin 1.0000000000 4.0000000000
Kaolin 0.6666666667 4.0000000000 Kaolin 0.6666666667 4.0000000000
Tatiana 1.0000000000 4.0000000000 Kaolin 1.0000000000 4.0000000000
Tata 1.0000000000 4.0000000000 Tata 1.0000000000 4.0000000000
Tatiana 1.0000000000 4.0000000000
select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.5) within group(order by score) over (partition by name) as c from t1; select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.5) within group(order by score) over (partition by name) as c from t1;
name b c name b c
Chun 0.5000000000 3.0000000000 Chun 0.5000000000 3.0000000000
Chun 1.0000000000 3.0000000000 Chun 1.0000000000 3.0000000000
Kaolin 0.3333333333 4.0000000000 Kaolin 0.3333333333 4.0000000000
Kaolin 1.0000000000 4.0000000000
Kaolin 0.6666666667 4.0000000000 Kaolin 0.6666666667 4.0000000000
Tatiana 1.0000000000 4.0000000000 Kaolin 1.0000000000 4.0000000000
Tata 1.0000000000 4.0000000000 Tata 1.0000000000 4.0000000000
Tatiana 1.0000000000 4.0000000000
select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.6) within group(order by score) over (partition by name) as c from t1; select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.6) within group(order by score) over (partition by name) as c from t1;
name b c name b c
Chun 0.5000000000 7.0000000000 Chun 0.5000000000 7.0000000000
Chun 1.0000000000 7.0000000000 Chun 1.0000000000 7.0000000000
Kaolin 0.3333333333 4.0000000000 Kaolin 0.3333333333 4.0000000000
Kaolin 1.0000000000 4.0000000000
Kaolin 0.6666666667 4.0000000000 Kaolin 0.6666666667 4.0000000000
Tatiana 1.0000000000 4.0000000000 Kaolin 1.0000000000 4.0000000000
Tata 1.0000000000 4.0000000000 Tata 1.0000000000 4.0000000000
Tatiana 1.0000000000 4.0000000000
select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.7) within group(order by score) over (partition by name) as c from t1; select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.7) within group(order by score) over (partition by name) as c from t1;
name b c name b c
Chun 0.5000000000 7.0000000000 Chun 0.5000000000 7.0000000000
Chun 1.0000000000 7.0000000000 Chun 1.0000000000 7.0000000000
Kaolin 0.3333333333 7.0000000000 Kaolin 0.3333333333 7.0000000000
Kaolin 1.0000000000 7.0000000000
Kaolin 0.6666666667 7.0000000000 Kaolin 0.6666666667 7.0000000000
Tatiana 1.0000000000 4.0000000000 Kaolin 1.0000000000 7.0000000000
Tata 1.0000000000 4.0000000000 Tata 1.0000000000 4.0000000000
Tatiana 1.0000000000 4.0000000000
select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.8) within group(order by score) over (partition by name) as c from t1; select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.8) within group(order by score) over (partition by name) as c from t1;
name b c name b c
Chun 0.5000000000 7.0000000000 Chun 0.5000000000 7.0000000000
Chun 1.0000000000 7.0000000000 Chun 1.0000000000 7.0000000000
Kaolin 0.3333333333 7.0000000000 Kaolin 0.3333333333 7.0000000000
Kaolin 1.0000000000 7.0000000000
Kaolin 0.6666666667 7.0000000000 Kaolin 0.6666666667 7.0000000000
Tatiana 1.0000000000 4.0000000000 Kaolin 1.0000000000 7.0000000000
Tata 1.0000000000 4.0000000000 Tata 1.0000000000 4.0000000000
Tatiana 1.0000000000 4.0000000000
select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.9) within group(order by score) over (partition by name) as c from t1; select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.9) within group(order by score) over (partition by name) as c from t1;
name b c name b c
Chun 0.5000000000 7.0000000000 Chun 0.5000000000 7.0000000000
Chun 1.0000000000 7.0000000000 Chun 1.0000000000 7.0000000000
Kaolin 0.3333333333 7.0000000000 Kaolin 0.3333333333 7.0000000000
Kaolin 1.0000000000 7.0000000000
Kaolin 0.6666666667 7.0000000000 Kaolin 0.6666666667 7.0000000000
Tatiana 1.0000000000 4.0000000000 Kaolin 1.0000000000 7.0000000000
Tata 1.0000000000 4.0000000000 Tata 1.0000000000 4.0000000000
Tatiana 1.0000000000 4.0000000000
select name,cume_dist() over (partition by name order by score) as b, percentile_disc(1) within group(order by score) over (partition by name) as c from t1; select name,cume_dist() over (partition by name order by score) as b, percentile_disc(1) within group(order by score) over (partition by name) as c from t1;
name b c name b c
Chun 0.5000000000 7.0000000000 Chun 0.5000000000 7.0000000000
Chun 1.0000000000 7.0000000000 Chun 1.0000000000 7.0000000000
Kaolin 0.3333333333 7.0000000000 Kaolin 0.3333333333 7.0000000000
Kaolin 1.0000000000 7.0000000000
Kaolin 0.6666666667 7.0000000000 Kaolin 0.6666666667 7.0000000000
Tatiana 1.0000000000 4.0000000000 Kaolin 1.0000000000 7.0000000000
Tata 1.0000000000 4.0000000000 Tata 1.0000000000 4.0000000000
Tatiana 1.0000000000 4.0000000000
select median(score) over (partition by name), percentile_cont(0) within group(order by score) over (partition by name) as c from t1; select median(score) over (partition by name), percentile_cont(0) within group(order by score) over (partition by name) as c from t1;
median(score) over (partition by name) c median(score) over (partition by name) c
5.0000000000 3.0000000000 5.0000000000 3.0000000000

View File

@ -33,11 +33,15 @@ select percentile_cont() within group() over (partition by name) from t1;
--echo # Test simple syntax --echo # Test simple syntax
--echo # --echo #
--sorted_result
select name, percentile_cont(0.5) within group(order by score) over (partition by name) as c from t1; select name, percentile_cont(0.5) within group(order by score) over (partition by name) as c from t1;
--sorted_result
select name, percentile_disc(0.5) within group(order by score) over (partition by name) as c from t1; select name, percentile_disc(0.5) within group(order by score) over (partition by name) as c from t1;
--echo # no partition clause --echo # no partition clause
--sorted_result
select name, percentile_disc(0.5) within group(order by score) over () from t1; select name, percentile_disc(0.5) within group(order by score) over () from t1;
--sorted_result
select name, percentile_cont(0.5) within group(order by score) over () from t1; select name, percentile_cont(0.5) within group(order by score) over () from t1;
--echo # argument set to null --echo # argument set to null
@ -47,8 +51,11 @@ select name, percentile_cont(null) within group(order by score) over (partition
select name, percentile_disc(null) within group(order by score) over (partition by name) from t1; select name, percentile_disc(null) within group(order by score) over (partition by name) from t1;
--echo #subqueries having percentile functions --echo #subqueries having percentile functions
--sorted_result
select * from ( select name , percentile_cont(0.5) within group ( order by score) over (partition by name ) from t1 ) as t; select * from ( select name , percentile_cont(0.5) within group ( order by score) over (partition by name ) from t1 ) as t;
--sorted_result
select * from ( select name , percentile_disc(0.5) within group ( order by score) over (partition by name ) from t1 ) as t; select * from ( select name , percentile_disc(0.5) within group ( order by score) over (partition by name ) from t1 ) as t;
--sorted_result
select name from t1 a where (select percentile_disc(0.5) within group (order by score) over (partition by name) from t1 b limit 1) >= 0.5; select name from t1 a where (select percentile_disc(0.5) within group (order by score) over (partition by name) from t1 b limit 1) >= 0.5;
--echo #disallowed fields in order by --echo #disallowed fields in order by

View File

@ -17,34 +17,34 @@ insert into t1 values
( 7 , 2, 20), ( 7 , 2, 20),
( 9 , 4, 20), ( 9 , 4, 20),
(10 , 4, 20); (10 , 4, 20);
select pk, a, b, rank() over (order by a) as rank, select a, rank() over (order by a) as rank,
dense_rank() over (order by a) as dense_rank dense_rank() over (order by a) as dense_rank
from t1; from t1;
pk a b rank dense_rank a rank dense_rank
1 0 10 1 1 0 1 1
2 0 10 1 1 0 1 1
3 1 10 3 2 1 3 2
4 1 10 3 2 1 3 2
8 2 10 5 3 2 5 3
5 2 20 5 3 2 5 3
6 2 20 5 3 2 5 3
7 2 20 5 3 2 5 3
9 4 20 9 4 4 9 4
10 4 20 9 4 4 9 4
select pk, a, b, rank() over (partition by b order by a) as rank, select a, b, rank() over (partition by b order by a) as rank,
dense_rank() over (partition by b order by a) as dense_rank dense_rank() over (partition by b order by a) as dense_rank
from t1; from t1;
pk a b rank dense_rank a b rank dense_rank
1 0 10 1 1 0 10 1 1
2 0 10 1 1 0 10 1 1
3 1 10 3 2 1 10 3 2
4 1 10 3 2 1 10 3 2
8 2 10 5 3 2 10 5 3
5 2 20 1 1 2 20 1 1
6 2 20 1 1 2 20 1 1
7 2 20 1 1 2 20 1 1
9 4 20 4 2 4 20 4 2
10 4 20 4 2 4 20 4 2
drop table t1; drop table t1;
# #
# Test with null values in the table. # Test with null values in the table.
@ -59,46 +59,49 @@ insert into t2 values (2,'b');
insert into t2 values (-1,''); insert into t2 values (-1,'');
select *, rank() over (order by s1) as rank, select *, rank() over (order by s1) as rank,
dense_rank() over (order by s1) as dense_rank dense_rank() over (order by s1) as dense_rank
from t2; from t2
order by s1, s2;
s1 s2 rank dense_rank s1 s2 rank dense_rank
1 a 5 3
NULL NULL 1 1 NULL NULL 1 1
1 NULL 5 3
NULL a 1 1 NULL a 1 1
NULL c 1 1 NULL c 1 1
2 b 7 4
-1 4 2 -1 4 2
1 NULL 5 3
1 a 5 3
2 b 7 4
select *, rank() over (partition by s2 order by s1) as rank, select *, rank() over (partition by s2 order by s1) as rank,
dense_rank() over (partition by s2 order by s1) as dense_rank dense_rank() over (partition by s2 order by s1) as dense_rank
from t2; from t2
order by s1, s2;
s1 s2 rank dense_rank s1 s2 rank dense_rank
1 a 2 2
NULL NULL 1 1 NULL NULL 1 1
1 NULL 2 2
NULL a 1 1 NULL a 1 1
NULL c 1 1 NULL c 1 1
2 b 1 1
-1 1 1 -1 1 1
1 NULL 2 2
1 a 2 2
2 b 1 1
select *, rank() over (order by s2) as rank, select *, rank() over (order by s2) as rank,
dense_rank() over (order by s2) as dense_rank dense_rank() over (order by s2) as dense_rank
from t2; from t2
order by s2, s1;
s1 s2 rank dense_rank s1 s2 rank dense_rank
1 a 4 3
NULL NULL 1 1 NULL NULL 1 1
1 NULL 1 1 1 NULL 1 1
NULL a 4 3
NULL c 7 5
2 b 6 4
-1 3 2 -1 3 2
NULL a 4 3
1 a 4 3
2 b 6 4
NULL c 7 5
select *, rank() over (partition by s1 order by s2) as rank, select *, rank() over (partition by s1 order by s2) as rank,
dense_rank() over (partition by s1 order by s2) as dense_rank dense_rank() over (partition by s1 order by s2) as dense_rank
from t2; from t2;
s1 s2 rank dense_rank s1 s2 rank dense_rank
1 a 2 2
NULL NULL 1 1 NULL NULL 1 1
1 NULL 1 1
NULL a 2 2 NULL a 2 2
NULL c 3 3 NULL c 3 3
2 b 1 1
-1 1 1 -1 1 1
1 NULL 1 1
1 a 2 2
2 b 1 1
drop table t2; drop table t2;

View File

@ -20,11 +20,11 @@ insert into t1 values
( 9 , 4, 20), ( 9 , 4, 20),
(10 , 4, 20); (10 , 4, 20);
select pk, a, b, rank() over (order by a) as rank, select a, rank() over (order by a) as rank,
dense_rank() over (order by a) as dense_rank dense_rank() over (order by a) as dense_rank
from t1; from t1;
select pk, a, b, rank() over (partition by b order by a) as rank, select a, b, rank() over (partition by b order by a) as rank,
dense_rank() over (partition by b order by a) as dense_rank dense_rank() over (partition by b order by a) as dense_rank
from t1; from t1;
drop table t1; drop table t1;
@ -44,13 +44,16 @@ insert into t2 values (-1,'');
select *, rank() over (order by s1) as rank, select *, rank() over (order by s1) as rank,
dense_rank() over (order by s1) as dense_rank dense_rank() over (order by s1) as dense_rank
from t2; from t2
order by s1, s2;
select *, rank() over (partition by s2 order by s1) as rank, select *, rank() over (partition by s2 order by s1) as rank,
dense_rank() over (partition by s2 order by s1) as dense_rank dense_rank() over (partition by s2 order by s1) as dense_rank
from t2; from t2
order by s1, s2;
select *, rank() over (order by s2) as rank, select *, rank() over (order by s2) as rank,
dense_rank() over (order by s2) as dense_rank dense_rank() over (order by s2) as dense_rank
from t2; from t2
order by s2, s1;
select *, rank() over (partition by s1 order by s2) as rank, select *, rank() over (partition by s1 order by s2) as rank,
dense_rank() over (partition by s1 order by s2) as dense_rank dense_rank() over (partition by s1 order by s2) as dense_rank
from t2; from t2;

View File

@ -80,9 +80,11 @@ select std(b) over (order by a rows between current row and 0 following)
from t2; from t2;
--echo # Only peers frame. --echo # Only peers frame.
--sorted_result
select a, b, std(b) over (order by a range between 0 preceding and 0 preceding) select a, b, std(b) over (order by a range between 0 preceding and 0 preceding)
from t2; from t2;
--sorted_result
select a, b, std(b) over (order by a range between 0 preceding and current row) select a, b, std(b) over (order by a range between 0 preceding and current row)
from t2; from t2;
@ -90,9 +92,11 @@ from t2;
select a, b, std(b) over (order by a range between current row and 0 preceding) select a, b, std(b) over (order by a range between current row and 0 preceding)
from t2; from t2;
--sorted_result
select a, b, std(b) over (order by a range between current row and 0 following) select a, b, std(b) over (order by a range between current row and 0 following)
from t2; from t2;
--sorted_result
select a, b, std(b) over (order by a range between 0 following and 0 following) select a, b, std(b) over (order by a range between 0 following and 0 following)
from t2; from t2;

View File

@ -19,6 +19,9 @@ sub skip_combinations {
# don't run tests for the wrong platform # don't run tests for the wrong platform
$skip{'include/platform.combinations'} = [ (IS_WINDOWS) ? 'unix' : 'win' ]; $skip{'include/platform.combinations'} = [ (IS_WINDOWS) ? 'unix' : 'win' ];
$skip{'include/maybe_debug.combinations'} =
[ defined $::mysqld_variables{'debug-dbug'} ? 'release' : 'debug' ];
# and for the wrong word size # and for the wrong word size
# check for exact values, in case the default changes to be small everywhere # check for exact values, in case the default changes to be small everywhere
my $longsysvar= $::mysqld_variables{'max-binlog-stmt-cache-size'}; my $longsysvar= $::mysqld_variables{'max-binlog-stmt-cache-size'};
@ -29,9 +32,6 @@ sub skip_combinations {
die "unknown value max-binlog-stmt-cache-size=$longsysvar" unless $val_map{$longsysvar}; die "unknown value max-binlog-stmt-cache-size=$longsysvar" unless $val_map{$longsysvar};
$skip{'include/word_size.combinations'} = [ $val_map{$longsysvar} ]; $skip{'include/word_size.combinations'} = [ $val_map{$longsysvar} ];
$skip{'include/maybe_debug.combinations'} =
[ defined $::mysqld_variables{'debug-dbug'} ? 'release' : 'debug' ];
# as a special case, disable certain include files as a whole # as a special case, disable certain include files as a whole
$skip{'include/not_embedded.inc'} = 'Not run for embedded server' $skip{'include/not_embedded.inc'} = 'Not run for embedded server'
if $::opt_embedded_server; if $::opt_embedded_server;

View File

@ -17,6 +17,12 @@ master-bin.000002 #
SET @@SESSION.gtid_domain_id=1; SET @@SESSION.gtid_domain_id=1;
SET @@SESSION.server_id=1; SET @@SESSION.server_id=1;
CREATE TABLE t (a int); CREATE TABLE t (a int);
SELECT @@GLOBAL.gtid_binlog_state, @@GLOBAL.gtid_binlog_pos;
@@GLOBAL.gtid_binlog_state @@GLOBAL.gtid_binlog_pos
1-1-1 1-1-1
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Rotate # # master-bin.000002;pos=POS
FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1); FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1);
ERROR HY000: Could not delete gtid domain. Reason: binlog files may contain gtids from the domain ('1') being deleted. Make sure to first purge those files. ERROR HY000: Could not delete gtid domain. Reason: binlog files may contain gtids from the domain ('1') being deleted. Make sure to first purge those files.
FLUSH BINARY LOGS; FLUSH BINARY LOGS;
@ -74,5 +80,11 @@ the following command succeeds with warnings
FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1); FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1);
Warnings: Warnings:
Warning 1076 The current gtid binlog state is incompatible with a former one having a gtid '11-11-1' which is less than the '11-11-11' of the gtid list describing an earlier state. The state may have been affected by manually injecting a lower sequence number gtid or via replication. Warning 1076 The current gtid binlog state is incompatible with a former one having a gtid '11-11-1' which is less than the '11-11-11' of the gtid list describing an earlier state. The state may have been affected by manually injecting a lower sequence number gtid or via replication.
RESET MASTER;
FLUSH BINARY LOGS DELETE_DOMAIN_ID = (4294967296);
ERROR HY000: The value of gtid domain being deleted ('4294967296') exceeds its maximum size of 32 bit unsigned integer
FLUSH BINARY LOGS DELETE_DOMAIN_ID = (4294967295);
Warnings:
Warning 1076 The gtid domain being deleted ('4294967295') is not in the current binlog state
DROP TABLE t; DROP TABLE t;
RESET MASTER; RESET MASTER;

View File

@ -28,6 +28,9 @@ FLUSH BINARY LOGS DELETE_DOMAIN_ID = (99);
SET @@SESSION.gtid_domain_id=1; SET @@SESSION.gtid_domain_id=1;
SET @@SESSION.server_id=1; SET @@SESSION.server_id=1;
CREATE TABLE t (a int); CREATE TABLE t (a int);
SELECT @@GLOBAL.gtid_binlog_state, @@GLOBAL.gtid_binlog_pos;
--let $binlog_start=
--source include/show_binlog_events.inc
--error ER_BINLOG_CANT_DELETE_GTID_DOMAIN --error ER_BINLOG_CANT_DELETE_GTID_DOMAIN
FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1); FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1);
@ -129,6 +132,22 @@ SELECT @gtid_binlog_state_saved "as original state", @@GLOBAL.gtid_binlog_state
--echo the following command succeeds with warnings --echo the following command succeeds with warnings
--eval FLUSH BINARY LOGS DELETE_DOMAIN_ID = ($del_d_id) --eval FLUSH BINARY LOGS DELETE_DOMAIN_ID = ($del_d_id)
# cleanup: forget the out-of-order
RESET MASTER;
#
# MDEV-14431
# Check rejection to delete a domain with value exceeding its range's maximum
#
--let $d_max_plus_1=`SELECT 1 << 32`
--error ER_BINLOG_CANT_DELETE_GTID_DOMAIN
--eval FLUSH BINARY LOGS DELETE_DOMAIN_ID = ($d_max_plus_1)
# accepted maximum:
--let $d_max=`SELECT (1 << 32) - 1`
--error 0
--eval FLUSH BINARY LOGS DELETE_DOMAIN_ID = ($d_max)
# #
# Cleanup # Cleanup
# #

View File

@ -207,3 +207,35 @@ t1 CREATE TABLE `t1` (
KEY `n` (`col2`) KEY `n` (`col2`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
DROP TABLE t1; DROP TABLE t1;
#
# Bug #27968952 INNODB CRASH/CORRUPTION WITH TEXT PREFIX INDEXES
#
CREATE TABLE t1(
a INT NOT NULL UNIQUE,
b INT NOT NULL,
c TEXT GENERATED ALWAYS AS (a <> b) VIRTUAL,
d TEXT NOT NULL,
UNIQUE KEY (c(1)), KEY(d(1))
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
SET @t = REPEAT('t',@@innodb_page_size);
INSERT INTO t1 (a,b,d) VALUES (1,0,@t), (0,0,@t);
UPDATE t1 SET b = a;
ERROR 23000: Duplicate entry '0' for key 'c'
REPLACE INTO t1 SET a = 0, b = 1, d = 'd';
SELECT * FROM t1;
a b c d
0 1 1 d
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
CREATE TABLE t1(
a VARCHAR(1000) GENERATED ALWAYS AS ('1') VIRTUAL,
b VARCHAR(1000) NOT NULL,
c VARCHAR(1000) GENERATED ALWAYS AS (b) STORED,
KEY (b(1)),
KEY (a(1))
) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
INSERT INTO t1(b) VALUES(REPEAT('b',1000));
DELETE FROM t1;
DROP TABLE t1;

View File

@ -232,3 +232,34 @@ CREATE TABLE t1 (col1 int(10)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
ALTER TABLE t1 ADD col2 char(21) AS (col1 * col1), ADD INDEX n (col2); ALTER TABLE t1 ADD col2 char(21) AS (col1 * col1), ADD INDEX n (col2);
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # Bug #27968952 INNODB CRASH/CORRUPTION WITH TEXT PREFIX INDEXES
--echo #
CREATE TABLE t1(
a INT NOT NULL UNIQUE,
b INT NOT NULL,
c TEXT GENERATED ALWAYS AS (a <> b) VIRTUAL,
d TEXT NOT NULL,
UNIQUE KEY (c(1)), KEY(d(1))
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
SET @t = REPEAT('t',@@innodb_page_size);
INSERT INTO t1 (a,b,d) VALUES (1,0,@t), (0,0,@t);
--error ER_DUP_ENTRY
UPDATE t1 SET b = a;
REPLACE INTO t1 SET a = 0, b = 1, d = 'd';
SELECT * FROM t1;
CHECK TABLE t1;
DROP TABLE t1;
CREATE TABLE t1(
a VARCHAR(1000) GENERATED ALWAYS AS ('1') VIRTUAL,
b VARCHAR(1000) NOT NULL,
c VARCHAR(1000) GENERATED ALWAYS AS (b) STORED,
KEY (b(1)),
KEY (a(1))
) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
INSERT INTO t1(b) VALUES(REPEAT('b',1000));
DELETE FROM t1;
DROP TABLE t1;

View File

@ -379,3 +379,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range uniq_id uniq_id 8 NULL 4 Using where 1 SIMPLE t1 range uniq_id uniq_id 8 NULL 4 Using where
drop table t1; drop table t1;
End of 5.3 tests End of 5.3 tests
create table t1 (id int, a varchar(300) not null, key using btree(a)) engine=heap;
insert t1 values (1, repeat('a', 300));
drop table t1;
End of 5.5 tests

View File

@ -279,3 +279,12 @@ explain select 0+a from t1 where a in (869751,736494,226312,802616);
drop table t1; drop table t1;
--echo End of 5.3 tests --echo End of 5.3 tests
#
# Bug#27799513: POTENTIAL DOUBLE FREE OR CORRUPTION OF HEAP INFO (HP_INFO)
#
create table t1 (id int, a varchar(300) not null, key using btree(a)) engine=heap;
insert t1 values (1, repeat('a', 300));
drop table t1;
--echo End of 5.5 tests

View File

@ -0,0 +1,3 @@
[log-bin]
log-bin
[skip-log-bin]

View File

@ -0,0 +1,3 @@
# See innodb_binlog.combinations
# --log-bin is ignored in the embedded server
--source include/not_embedded.inc

View File

@ -0,0 +1,20 @@
connect ddl, localhost, root,,;
update performance_schema.setup_instruments set enabled='yes';
update performance_schema.setup_consumers set enabled='yes';
CREATE TABLE t1 (a serial, b varchar(255)) ENGINE=InnoDB;
BEGIN;
COMMIT;
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL go WAIT_FOR gone';
ALTER TABLE t1 ADD INDEX(b), ALGORITHM=INPLACE;
connection default;
SET DEBUG_SYNC = 'now WAIT_FOR go';
SELECT DISTINCT object_name FROM performance_schema.events_waits_history_long
WHERE event_name LIKE '%wait%io%file%innodb%innodb_temp_file%';
object_name
tmp/Innodb Merge Temp File
SET DEBUG_SYNC = 'now SIGNAL gone';
connection ddl;
disconnect ddl;
connection default;
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1;

View File

@ -0,0 +1,51 @@
--- auto_increment_dup.result
+++ auto_increment_dup,skip-log-bin.reject
@@ -89,13 +89,14 @@
SET DEBUG_SYNC='execute_command_after_close_tables SIGNAL continue';
affected rows: 0
INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2';
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+affected rows: 3
+info: Records: 3 Duplicates: 0 Warnings: 0
connection con1;
#
# 2 duplicates
#
-affected rows: 3
-info: Records: 3 Duplicates: 0 Warnings: 0
+affected rows: 4
+info: Records: 3 Duplicates: 1 Warnings: 0
connection default;
#
# 3 rows
@@ -103,19 +104,21 @@
SELECT * FROM t1 order by k;
id k c
1 1 NULL
-2 2 NULL
-3 3 NULL
-affected rows: 3
+4 2 1
+2 3 NULL
+5 4 NULL
+6 5 NULL
+affected rows: 5
INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2';
-affected rows: 4
-info: Records: 3 Duplicates: 1 Warnings: 0
+affected rows: 6
+info: Records: 3 Duplicates: 3 Warnings: 0
SELECT * FROM t1 order by k;
id k c
1 1 NULL
-2 2 2
-3 3 NULL
-7 4 NULL
-8 5 NULL
+4 2 2
+2 3 NULL
+5 4 2
+6 5 2
affected rows: 5
disconnect con1;
disconnect con2;

View File

@ -1,4 +1,3 @@
drop table if exists t1;
set global transaction isolation level repeatable read; set global transaction isolation level repeatable read;
CREATE TABLE t1( CREATE TABLE t1(
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
@ -79,20 +78,13 @@ affected rows: 0
# #
# Parallel execution # Parallel execution
# #
connect con1, localhost, root;
connect con2, localhost, root; connect con2, localhost, root;
SET DEBUG_SYNC='now WAIT_FOR write_row_done'; SET DEBUG_SYNC='now WAIT_FOR write_row_done';
connection con1; connect con1, localhost, root;
#
# Connection 1
#
SET DEBUG_SYNC='ha_write_row_end SIGNAL write_row_done WAIT_FOR continue'; SET DEBUG_SYNC='ha_write_row_end SIGNAL write_row_done WAIT_FOR continue';
affected rows: 0 affected rows: 0
INSERT INTO t1(k) VALUES (1), (2), (3) ON DUPLICATE KEY UPDATE c='1'; INSERT INTO t1(k) VALUES (1), (2), (3) ON DUPLICATE KEY UPDATE c='1';
connection con2; connection con2;
#
# Connection 2
#
affected rows: 0 affected rows: 0
SET DEBUG_SYNC='execute_command_after_close_tables SIGNAL continue'; SET DEBUG_SYNC='execute_command_after_close_tables SIGNAL continue';
affected rows: 0 affected rows: 0
@ -140,18 +132,10 @@ k INT,
c CHAR(1), c CHAR(1),
UNIQUE KEY(k)) ENGINE=InnoDB; UNIQUE KEY(k)) ENGINE=InnoDB;
connect con1, localhost, root; connect con1, localhost, root;
connect con2, localhost, root;
connection con1;
#
# Connection 1
#
SET DEBUG_SYNC='ha_write_row_end SIGNAL continue2 WAIT_FOR continue1'; SET DEBUG_SYNC='ha_write_row_end SIGNAL continue2 WAIT_FOR continue1';
affected rows: 0 affected rows: 0
INSERT INTO t1(k) VALUES (1), (2), (3) ON DUPLICATE KEY UPDATE c='1'; INSERT INTO t1(k) VALUES (1), (2), (3) ON DUPLICATE KEY UPDATE c='1';
connection con2; connect con2, localhost, root;
#
# Connection 2
#
SET DEBUG_SYNC='ha_write_row_start WAIT_FOR continue2'; SET DEBUG_SYNC='ha_write_row_start WAIT_FOR continue2';
affected rows: 0 affected rows: 0
SET DEBUG_SYNC='after_mysql_insert SIGNAL continue1'; SET DEBUG_SYNC='after_mysql_insert SIGNAL continue1';
@ -159,6 +143,7 @@ affected rows: 0
INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2'; INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2';
affected rows: 3 affected rows: 3
info: Records: 3 Duplicates: 0 Warnings: 0 info: Records: 3 Duplicates: 0 Warnings: 0
disconnect con2;
connection con1; connection con1;
affected rows: 4 affected rows: 4
info: Records: 3 Duplicates: 1 Warnings: 0 info: Records: 3 Duplicates: 1 Warnings: 0
@ -174,7 +159,6 @@ id k c
5 4 NULL 5 4 NULL
6 5 NULL 6 5 NULL
disconnect con1; disconnect con1;
disconnect con2;
connection default; connection default;
DROP TABLE t1; DROP TABLE t1;
set global transaction isolation level repeatable read; set global transaction isolation level repeatable read;

View File

@ -171,6 +171,43 @@ UNLOCK TABLES;
DROP TABLES staff, store; DROP TABLES staff, store;
SET FOREIGN_KEY_CHECKS=1; SET FOREIGN_KEY_CHECKS=1;
# #
# MDEV-17531 Crash in RENAME TABLE with FOREIGN KEY and FULLTEXT INDEX
#
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
CREATE DATABASE best;
CREATE TABLE t3 (a INT PRIMARY KEY,
CONSTRAINT t2_ibfk_1 FOREIGN KEY (a) REFERENCES t1(a)) ENGINE=InnoDB;
CREATE TABLE best.t2 (a INT PRIMARY KEY, b TEXT, FULLTEXT INDEX(b),
FOREIGN KEY (a) REFERENCES test.t1(a)) ENGINE=InnoDB;
RENAME TABLE best.t2 TO test.t2;
ERROR 42S01: Table 't2' already exists
SHOW CREATE TABLE best.t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` int(11) NOT NULL,
`b` text DEFAULT NULL,
PRIMARY KEY (`a`),
FULLTEXT KEY `b` (`b`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `test`.`t1` (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP DATABASE best;
#
# MDEV-17541 KILL QUERY during lock wait in FOREIGN KEY check hangs
#
connect fk, localhost, root,,;
INSERT INTO t1 SET a=1;
BEGIN;
DELETE FROM t1;
connection default;
INSERT INTO t3 SET a=1;
connection fk;
kill query @id;
connection default;
ERROR 70100: Query execution was interrupted
disconnect fk;
DROP TABLE t3,t1;
# Start of 10.2 tests
#
# MDEV-13246 Stale rows despite ON DELETE CASCADE constraint # MDEV-13246 Stale rows despite ON DELETE CASCADE constraint
# #
CREATE TABLE users ( CREATE TABLE users (
@ -252,7 +289,6 @@ DELETE FROM t1 WHERE id = 1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
connection con1; connection con1;
COMMIT; COMMIT;
disconnect con1;
connection default; connection default;
SELECT * FROM t2; SELECT * FROM t2;
id ref_id f id ref_id f
@ -332,7 +368,26 @@ PRIMARY KEY (store_id),
UNIQUE KEY idx_unique_manager (manager_staff_id), UNIQUE KEY idx_unique_manager (manager_staff_id),
CONSTRAINT fk_store_staff FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id) ON DELETE RESTRICT ON UPDATE CASCADE CONSTRAINT fk_store_staff FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id) ON DELETE RESTRICT ON UPDATE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB;
SET FOREIGN_KEY_CHECKS=DEFAULT;
LOCK TABLE staff WRITE; LOCK TABLE staff WRITE;
UNLOCK TABLES; UNLOCK TABLES;
DROP TABLES staff, store; DROP TABLES staff, store;
SET FOREIGN_KEY_CHECKS=1;
#
# MDEV-17541 KILL QUERY during lock wait in FOREIGN KEY check hangs
#
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t2 (a INT PRIMARY KEY, FOREIGN KEY (a) REFERENCES t1(a))
ENGINE=InnoDB;
connection con1;
INSERT INTO t1 SET a=1;
BEGIN;
DELETE FROM t1;
connection default;
INSERT INTO t2 SET a=1;
connection con1;
kill query @id;
connection default;
ERROR 70100: Query execution was interrupted
disconnect con1;
DROP TABLE t2,t1;
# End of 10.2 tests

View File

@ -52,10 +52,26 @@ set DEBUG_SYNC = 'now WAIT_FOR s1';
update t1 set a=1 where id=2; update t1 set a=1 where id=2;
ERROR 23000: Duplicate entry '1' for key 'uk' ERROR 23000: Duplicate entry '1' for key 'uk'
SET DEBUG_SYNC = 'now SIGNAL s2'; SET DEBUG_SYNC = 'now SIGNAL s2';
disconnect con1;
/* connection default */ /* connection default */
connection default; connection default;
/* reap */ alter table t1 force, add b int, ALGORITHM=inplace; /* reap */ alter table t1 force, add b int, ALGORITHM=inplace;
ERROR 23000: Duplicate entry '1' for key 'uk' ERROR 23000: Duplicate entry '1' for key 'uk'
SET DEBUG_SYNC = 'RESET'; SET DEBUG_SYNC = 'RESET';
drop table t1; drop table t1;
#
# Bug #27753193 ASSERTION `PREBUILT->TRX->ERROR_KEY_NUM <
# HA_ALTER_INFO->KEY_COUNT'
CREATE TABLE t1 (a INT, UNIQUE KEY(a)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
SET DEBUG_SYNC = 'row_log_table_apply1_before signal S1 WAIT_FOR S2';
ALTER TABLE t1 FORCE, ALGORITHM=INPLACE;
connection con1;
SET DEBUG_SYNC = 'now WAIT_FOR S1';
INSERT INTO t1 VALUES (1);
ERROR 23000: Duplicate entry '1' for key 'a'
SET DEBUG_SYNC = 'now SIGNAL S2';
disconnect con1;
connection default;
ERROR 23000: Duplicate entry '1' for key 'a'
SET DEBUG_SYNC='RESET';
DROP TABLE t1;

View File

@ -728,6 +728,7 @@ t2 CREATE TABLE `t2` (
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c2`) REFERENCES `t1` (`c1`) CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c2`) REFERENCES `t1` (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
ALTER TABLE t1 CHANGE COLUMN c1 C1 INT; ALTER TABLE t1 CHANGE COLUMN c1 C1 INT;
ALTER TABLE t2 CHANGE COLUMN c2 C2 INT;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
@ -737,24 +738,149 @@ t1 CREATE TABLE `t1` (
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c2` int(11) NOT NULL, `C2` int(11) DEFAULT NULL,
KEY `c2` (`c2`), KEY `c2` (`C2`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c2`) REFERENCES `t1` (`c1`) CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c2`) REFERENCES `t1` (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
ALTER TABLE t1 CHANGE COLUMN C1 c5 INT;
ALTER TABLE t2 CHANGE COLUMN C2 c6 INT;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`C1` int(11) NOT NULL, `c5` int(11) NOT NULL,
PRIMARY KEY (`C1`) PRIMARY KEY (`c5`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`c2` int(11) NOT NULL, `c6` int(11) DEFAULT NULL,
KEY `c2` (`c2`), KEY `c2` (`c6`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c2`) REFERENCES `t1` (`c1`) CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c6`) REFERENCES `t1` (`c5`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT C.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS C INNER JOIN
INFORMATION_SCHEMA.INNODB_SYS_TABLES T ON C.TABLE_ID=T.TABLE_ID
WHERE T.NAME='test/t1';
NAME
c5
SELECT F.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS F INNER JOIN
INFORMATION_SCHEMA.INNODB_SYS_INDEXES I ON F.INDEX_ID=I.INDEX_ID INNER JOIN
INFORMATION_SCHEMA.INNODB_SYS_TABLES T ON I.TABLE_ID=T.TABLE_ID
WHERE T.NAME='test/t1' AND I.NAME='PRIMARY';
NAME
c5
SELECT C.REF_COL_NAME, C.FOR_COL_NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS C INNER JOIN
INFORMATION_SCHEMA.INNODB_SYS_FOREIGN F ON C.ID=F.ID
WHERE F.FOR_NAME='test/t2';
REF_COL_NAME FOR_COL_NAME
c5 c6
DROP TABLE t2, t1; DROP TABLE t2, t1;
# virtual columns case too
CREATE TABLE t1 (a INT, b INT GENERATED ALWAYS AS (a) VIRTUAL) ENGINE = InnoDB;
ALTER TABLE t1 CHANGE COLUMN a A INT;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`A` int(11) DEFAULT NULL,
`b` int(11) GENERATED ALWAYS AS (`A`) VIRTUAL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT C.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS C INNER JOIN
INFORMATION_SCHEMA.INNODB_SYS_TABLES T ON C.TABLE_ID=T.TABLE_ID
WHERE T.NAME='test/t1';
NAME
a
b
DROP TABLE t1;
# different FOREIGN KEY cases
CREATE TABLE t1 (
a INT UNIQUE KEY,
b INT UNIQUE KEY,
c INT UNIQUE KEY,
d INT UNIQUE KEY
) ENGINE=INNODB;
CREATE TABLE t2 (
aa INT,
bb INT,
cc INT,
dd INT
) ENGINE=INNODB;
INSERT INTO t1 VALUES (1, 1, 1, 1);
INSERT INTO t2 VALUES (1, 1, 1, 1);
ALTER TABLE t1 CHANGE a A INT, ALGORITHM=INPLACE;
ALTER TABLE t1 CHANGE c C INT, ALGORITHM=INPLACE;
ALTER TABLE t2 CHANGE cc CC INT, ALGORITHM=INPLACE;
ALTER TABLE t2 CHANGE dd DD INT, ALGORITHM=INPLACE;
SET foreign_key_checks=0;
ALTER TABLE t2
ADD FOREIGN KEY(aa) REFERENCES t1(a),
ADD FOREIGN KEY(bb) REFERENCES t1(b),
ADD FOREIGN KEY(cc) REFERENCES t1(c),
ADD FOREIGN KEY(dd) REFERENCES t1(d),
ALGORITHM=INPLACE;
ALTER TABLE t1 CHANGE b B INT, ALGORITHM=INPLACE;
ALTER TABLE t2 CHANGE aa AA INT, ALGORITHM=INPLACE;
ALTER TABLE t1 CHANGE d D INT, ALGORITHM=INPLACE;
ALTER TABLE t2 CHANGE bb BB INT, ALGORITHM=INPLACE;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`A` int(11) DEFAULT NULL,
`B` int(11) DEFAULT NULL,
`C` int(11) DEFAULT NULL,
`D` int(11) DEFAULT NULL,
UNIQUE KEY `a` (`A`),
UNIQUE KEY `b` (`B`),
UNIQUE KEY `c` (`C`),
UNIQUE KEY `d` (`D`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`AA` int(11) DEFAULT NULL,
`BB` int(11) DEFAULT NULL,
`CC` int(11) DEFAULT NULL,
`DD` int(11) DEFAULT NULL,
KEY `aa` (`AA`),
KEY `bb` (`BB`),
KEY `CC` (`CC`),
KEY `DD` (`DD`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`),
CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`bb`) REFERENCES `t1` (`b`),
CONSTRAINT `t2_ibfk_3` FOREIGN KEY (`cc`) REFERENCES `t1` (`c`),
CONSTRAINT `t2_ibfk_4` FOREIGN KEY (`dd`) REFERENCES `t1` (`d`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DELETE FROM t1 WHERE a=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
DELETE FROM t1 WHERE A=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
DELETE FROM t1 WHERE b=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
DELETE FROM t1 WHERE B=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
DELETE FROM t1 WHERE c=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
DELETE FROM t1 WHERE C=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
DELETE FROM t1 WHERE d=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
DELETE FROM t1 WHERE D=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
DROP TABLE t2, t1;
# virtual columns case too
CREATE TABLE t1 (a INT, b INT GENERATED ALWAYS AS (a) VIRTUAL) ENGINE = InnoDB;
ALTER TABLE t1 CHANGE COLUMN a A INT;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`A` int(11) DEFAULT NULL,
`b` int(11) GENERATED ALWAYS AS (`A`) VIRTUAL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT C.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS C INNER JOIN
INFORMATION_SCHEMA.INNODB_SYS_TABLES T ON C.TABLE_ID=T.TABLE_ID
WHERE T.NAME='test/t1';
NAME
a
b
DROP TABLE t1;
# #
# BUG 20029625 - HANDLE_FATAL_SIGNAL (SIG=11) IN # BUG 20029625 - HANDLE_FATAL_SIGNAL (SIG=11) IN
# DICT_MEM_TABLE_COL_RENAME_LOW # DICT_MEM_TABLE_COL_RENAME_LOW

View File

@ -0,0 +1,132 @@
--- suite/innodb/r/table_flags.result
+++ suite/innodb/r/table_flags,32k,debug.reject
@@ -5,96 +5,98 @@
SET innodb_strict_mode=OFF;
CREATE TABLE tz(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=COMPRESSED
KEY_BLOCK_SIZE=1;
+Warnings:
+Warning 1478 InnoDB: Cannot create a COMPRESSED table when innodb_page_size > 16k. Assuming ROW_FORMAT=DYNAMIC.
SET innodb_strict_mode=ON;
CREATE TABLE tp(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=DYNAMIC
PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=9;
SYS_TABLES clustered index root page (8):
N_RECS=10; LEVEL=0; INDEX_ID=0x0000000000000001
-header=0x01000003016e (NAME=0x696e66696d756d00)
-header=0x00002815008d (NAME='SYS_DATAFILES',
+header=0x0100000301bf (NAME=0x696e66696d756d00)
+header=0x0000301500de (NAME='SYS_DATAFILES',
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
- ID=0x000000000000000e,
+ ID=0x000000000000000f,
N_COLS=0x00000002,
TYPE=0x00000001,
MIX_ID=0x0000000000000000,
MIX_LEN=0x00000040,
CLUSTER_NAME=NULL(0 bytes),
SPACE=0x00000000)
-header=0x0000101500d5 (NAME='SYS_FOREIGN',
+header=0x000018150126 (NAME='SYS_FOREIGN',
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
- ID=0x000000000000000b,
+ ID=0x000000000000000c,
N_COLS=0x00000004,
TYPE=0x00000001,
MIX_ID=0x0000000000000000,
MIX_LEN=0x00000040,
CLUSTER_NAME=NULL(0 bytes),
SPACE=0x00000000)
-header=0x000018150122 (NAME='SYS_FOREIGN_COLS',
+header=0x000020150173 (NAME='SYS_FOREIGN_COLS',
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
- ID=0x000000000000000c,
+ ID=0x000000000000000d,
N_COLS=0x00000004,
TYPE=0x00000001,
MIX_ID=0x0000000000000000,
MIX_LEN=0x00000040,
CLUSTER_NAME=NULL(0 bytes),
SPACE=0x00000000)
-header=0x0400201501b8 (NAME='SYS_TABLESPACES',
+header=0x040028150209 (NAME='SYS_TABLESPACES',
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
- ID=0x000000000000000d,
+ ID=0x000000000000000e,
N_COLS=0x00000003,
TYPE=0x00000001,
MIX_ID=0x0000000000000000,
MIX_LEN=0x00000040,
CLUSTER_NAME=NULL(0 bytes),
SPACE=0x00000000)
-header=0x000030150244 (NAME='SYS_VIRTUAL',
+header=0x000038150251 (NAME='SYS_VIRTUAL',
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
- ID=0x000000000000000f,
+ ID=0x0000000000000010,
N_COLS=0x00000003,
TYPE=0x00000001,
MIX_ID=0x0000000000000000,
MIX_LEN=0x00000040,
CLUSTER_NAME=NULL(0 bytes),
SPACE=0x00000000)
-header=0x000040150288 (NAME='test/tc',
+header=0x000040150295 (NAME='test/tc',
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
- ID=0x0000000000000011,
+ ID=0x0000000000000012,
N_COLS=0x80000001,
TYPE=0x00000001,
MIX_ID=0x0000000000000000,
MIX_LEN=0x00000050,
CLUSTER_NAME=NULL(0 bytes),
SPACE=0x00000002)
-header=0x000048150310 (NAME='test/td',
+header=0x00004815031d (NAME='test/td',
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
- ID=0x0000000000000012,
+ ID=0x0000000000000013,
N_COLS=0x80000001,
TYPE=0x00000021,
MIX_ID=0x0000000000000000,
MIX_LEN=0x00000050,
CLUSTER_NAME=NULL(0 bytes),
SPACE=0x00000003)
-header=0x000058150200 (NAME='test/tp',
+header=0x00005815008d (NAME='test/tp',
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
- ID=0x0000000000000014,
+ ID=0x0000000000000015,
N_COLS=0x80000001,
TYPE=0x000009a1,
MIX_ID=0x0000000000000000,
MIX_LEN=0x00000050,
CLUSTER_NAME=NULL(0 bytes),
SPACE=0x00000005)
-header=0x0000381502cc (NAME='test/tr',
+header=0x0000101502d9 (NAME='test/tr',
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
- ID=0x0000000000000010,
+ ID=0x0000000000000011,
N_COLS=0x00000001,
TYPE=0x00000001,
MIX_ID=0x0000000000000000,
@@ -104,9 +106,9 @@
header=0x000050150074 (NAME='test/tz',
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
- ID=0x0000000000000013,
+ ID=0x0000000000000014,
N_COLS=0x80000001,
- TYPE=0x00000023,
+ TYPE=0x00000021,
MIX_ID=0x0000000000000000,
MIX_LEN=0x00000050,
CLUSTER_NAME=NULL(0 bytes),

View File

@ -0,0 +1,132 @@
--- suite/innodb/r/table_flags.result
+++ suite/innodb/r/table_flags,64k,debug.reject
@@ -5,96 +5,98 @@
SET innodb_strict_mode=OFF;
CREATE TABLE tz(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=COMPRESSED
KEY_BLOCK_SIZE=1;
+Warnings:
+Warning 1478 InnoDB: Cannot create a COMPRESSED table when innodb_page_size > 16k. Assuming ROW_FORMAT=DYNAMIC.
SET innodb_strict_mode=ON;
CREATE TABLE tp(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=DYNAMIC
PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=9;
SYS_TABLES clustered index root page (8):
N_RECS=10; LEVEL=0; INDEX_ID=0x0000000000000001
-header=0x01000003016e (NAME=0x696e66696d756d00)
-header=0x00002815008d (NAME='SYS_DATAFILES',
+header=0x0100000301bf (NAME=0x696e66696d756d00)
+header=0x0000301500de (NAME='SYS_DATAFILES',
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
- ID=0x000000000000000e,
+ ID=0x000000000000000f,
N_COLS=0x00000002,
TYPE=0x00000001,
MIX_ID=0x0000000000000000,
MIX_LEN=0x00000040,
CLUSTER_NAME=NULL(0 bytes),
SPACE=0x00000000)
-header=0x0000101500d5 (NAME='SYS_FOREIGN',
+header=0x000018150126 (NAME='SYS_FOREIGN',
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
- ID=0x000000000000000b,
+ ID=0x000000000000000c,
N_COLS=0x00000004,
TYPE=0x00000001,
MIX_ID=0x0000000000000000,
MIX_LEN=0x00000040,
CLUSTER_NAME=NULL(0 bytes),
SPACE=0x00000000)
-header=0x000018150122 (NAME='SYS_FOREIGN_COLS',
+header=0x000020150173 (NAME='SYS_FOREIGN_COLS',
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
- ID=0x000000000000000c,
+ ID=0x000000000000000d,
N_COLS=0x00000004,
TYPE=0x00000001,
MIX_ID=0x0000000000000000,
MIX_LEN=0x00000040,
CLUSTER_NAME=NULL(0 bytes),
SPACE=0x00000000)
-header=0x0400201501b8 (NAME='SYS_TABLESPACES',
+header=0x040028150209 (NAME='SYS_TABLESPACES',
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
- ID=0x000000000000000d,
+ ID=0x000000000000000e,
N_COLS=0x00000003,
TYPE=0x00000001,
MIX_ID=0x0000000000000000,
MIX_LEN=0x00000040,
CLUSTER_NAME=NULL(0 bytes),
SPACE=0x00000000)
-header=0x000030150244 (NAME='SYS_VIRTUAL',
+header=0x000038150251 (NAME='SYS_VIRTUAL',
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
- ID=0x000000000000000f,
+ ID=0x0000000000000010,
N_COLS=0x00000003,
TYPE=0x00000001,
MIX_ID=0x0000000000000000,
MIX_LEN=0x00000040,
CLUSTER_NAME=NULL(0 bytes),
SPACE=0x00000000)
-header=0x000040150288 (NAME='test/tc',
+header=0x000040150295 (NAME='test/tc',
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
- ID=0x0000000000000011,
+ ID=0x0000000000000012,
N_COLS=0x80000001,
TYPE=0x00000001,
MIX_ID=0x0000000000000000,
MIX_LEN=0x00000050,
CLUSTER_NAME=NULL(0 bytes),
SPACE=0x00000002)
-header=0x000048150310 (NAME='test/td',
+header=0x00004815031d (NAME='test/td',
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
- ID=0x0000000000000012,
+ ID=0x0000000000000013,
N_COLS=0x80000001,
TYPE=0x00000021,
MIX_ID=0x0000000000000000,
MIX_LEN=0x00000050,
CLUSTER_NAME=NULL(0 bytes),
SPACE=0x00000003)
-header=0x000058150200 (NAME='test/tp',
+header=0x00005815008d (NAME='test/tp',
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
- ID=0x0000000000000014,
+ ID=0x0000000000000015,
N_COLS=0x80000001,
TYPE=0x000009a1,
MIX_ID=0x0000000000000000,
MIX_LEN=0x00000050,
CLUSTER_NAME=NULL(0 bytes),
SPACE=0x00000005)
-header=0x0000381502cc (NAME='test/tr',
+header=0x0000101502d9 (NAME='test/tr',
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
- ID=0x0000000000000010,
+ ID=0x0000000000000011,
N_COLS=0x00000001,
TYPE=0x00000001,
MIX_ID=0x0000000000000000,
@@ -104,9 +106,9 @@
header=0x000050150074 (NAME='test/tz',
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
- ID=0x0000000000000013,
+ ID=0x0000000000000014,
N_COLS=0x80000001,
- TYPE=0x00000023,
+ TYPE=0x00000021,
MIX_ID=0x0000000000000000,
MIX_LEN=0x00000050,
CLUSTER_NAME=NULL(0 bytes),

View File

@ -0,0 +1,122 @@
--- suite/innodb/r/table_flags.result
+++ suite/innodb/r/table_flags,debug.reject
@@ -10,91 +10,91 @@
PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=9;
SYS_TABLES clustered index root page (8):
N_RECS=10; LEVEL=0; INDEX_ID=0x0000000000000001
-header=0x01000003016e (NAME=0x696e66696d756d00)
-header=0x00002815008d (NAME='SYS_DATAFILES',
+header=0x0100000301bf (NAME=0x696e66696d756d00)
+header=0x0000301500de (NAME='SYS_DATAFILES',
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
- ID=0x000000000000000e,
+ ID=0x000000000000000f,
N_COLS=0x00000002,
TYPE=0x00000001,
MIX_ID=0x0000000000000000,
MIX_LEN=0x00000040,
CLUSTER_NAME=NULL(0 bytes),
SPACE=0x00000000)
-header=0x0000101500d5 (NAME='SYS_FOREIGN',
+header=0x000018150126 (NAME='SYS_FOREIGN',
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
- ID=0x000000000000000b,
+ ID=0x000000000000000c,
N_COLS=0x00000004,
TYPE=0x00000001,
MIX_ID=0x0000000000000000,
MIX_LEN=0x00000040,
CLUSTER_NAME=NULL(0 bytes),
SPACE=0x00000000)
-header=0x000018150122 (NAME='SYS_FOREIGN_COLS',
+header=0x000020150173 (NAME='SYS_FOREIGN_COLS',
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
- ID=0x000000000000000c,
+ ID=0x000000000000000d,
N_COLS=0x00000004,
TYPE=0x00000001,
MIX_ID=0x0000000000000000,
MIX_LEN=0x00000040,
CLUSTER_NAME=NULL(0 bytes),
SPACE=0x00000000)
-header=0x0400201501b8 (NAME='SYS_TABLESPACES',
+header=0x040028150209 (NAME='SYS_TABLESPACES',
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
- ID=0x000000000000000d,
+ ID=0x000000000000000e,
N_COLS=0x00000003,
TYPE=0x00000001,
MIX_ID=0x0000000000000000,
MIX_LEN=0x00000040,
CLUSTER_NAME=NULL(0 bytes),
SPACE=0x00000000)
-header=0x000030150244 (NAME='SYS_VIRTUAL',
+header=0x000038150251 (NAME='SYS_VIRTUAL',
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
- ID=0x000000000000000f,
+ ID=0x0000000000000010,
N_COLS=0x00000003,
TYPE=0x00000001,
MIX_ID=0x0000000000000000,
MIX_LEN=0x00000040,
CLUSTER_NAME=NULL(0 bytes),
SPACE=0x00000000)
-header=0x000040150288 (NAME='test/tc',
+header=0x000040150295 (NAME='test/tc',
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
- ID=0x0000000000000011,
+ ID=0x0000000000000012,
N_COLS=0x80000001,
TYPE=0x00000001,
MIX_ID=0x0000000000000000,
MIX_LEN=0x00000050,
CLUSTER_NAME=NULL(0 bytes),
SPACE=0x00000002)
-header=0x000048150310 (NAME='test/td',
+header=0x00004815031d (NAME='test/td',
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
- ID=0x0000000000000012,
+ ID=0x0000000000000013,
N_COLS=0x80000001,
TYPE=0x00000021,
MIX_ID=0x0000000000000000,
MIX_LEN=0x00000050,
CLUSTER_NAME=NULL(0 bytes),
SPACE=0x00000003)
-header=0x000058150200 (NAME='test/tp',
+header=0x00005815008d (NAME='test/tp',
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
- ID=0x0000000000000014,
+ ID=0x0000000000000015,
N_COLS=0x80000001,
TYPE=0x000009a1,
MIX_ID=0x0000000000000000,
MIX_LEN=0x00000050,
CLUSTER_NAME=NULL(0 bytes),
SPACE=0x00000005)
-header=0x0000381502cc (NAME='test/tr',
+header=0x0000101502d9 (NAME='test/tr',
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
- ID=0x0000000000000010,
+ ID=0x0000000000000011,
N_COLS=0x00000001,
TYPE=0x00000001,
MIX_ID=0x0000000000000000,
@@ -104,7 +104,7 @@
header=0x000050150074 (NAME='test/tz',
DB_TRX_ID=0x000000000000,
DB_ROLL_PTR=0x80000000000000,
- ID=0x0000000000000013,
+ ID=0x0000000000000014,
N_COLS=0x80000001,
TYPE=0x00000023,
MIX_ID=0x0000000000000000,

View File

@ -0,0 +1,2 @@
--innodb-sort-buffer-size=64k
--tmpdir=$MYSQLTEST_VARDIR/tmp

Some files were not shown because too many files have changed in this diff Show More