Merge 10.2 into 10.3

main.derived_cond_pushdown: Move all 10.3 tests to the end,
trim trailing white space, and add an "End of 10.3 tests" marker.
Add --sorted_result to tests where the ordering is not deterministic.

main.win_percentile: Add --sorted_result to tests where the
ordering is no longer deterministic.
This commit is contained in:
Marko Mäkelä 2018-11-06 09:40:39 +02:00
commit df563e0c03
375 changed files with 23445 additions and 10440 deletions

1
.gitignore vendored
View file

@ -261,6 +261,7 @@ storage/mroonga/vendor/groonga/src/groonga-benchmark
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/variable_version.result
zlib/zconf.h
xxx/*
yyy/*
zzz/*

View file

@ -1,5 +1,5 @@
# 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
# 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 and/or error reports regarding MariaDB should be submitted at
https://mariadb.org/jira
Bug and/or error reports regarding MariaDB should be submitted at:
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:
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) 2008, 2018, MariaDB Corporation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View file

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

View file

@ -99,12 +99,15 @@ SET(ignored
"%ignore /etc"
"%ignore /etc/init.d"
"%ignore /etc/logrotate.d"
"%ignore /etc/systemd"
"%ignore /etc/systemd/system"
"%ignore ${CMAKE_INSTALL_PREFIX}"
"%ignore ${CMAKE_INSTALL_PREFIX}/bin"
"%ignore ${CMAKE_INSTALL_PREFIX}/include"
"%ignore ${CMAKE_INSTALL_PREFIX}/lib"
"%ignore ${CMAKE_INSTALL_PREFIX}/lib/systemd"
"%ignore ${CMAKE_INSTALL_PREFIX}/lib/systemd/system"
"%ignore ${CMAKE_INSTALL_PREFIX}/lib/tmpfiles.d"
"%ignore ${CMAKE_INSTALL_PREFIX}/lib64"
"%ignore ${CMAKE_INSTALL_PREFIX}/sbin"
"%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)
ADD_LIBRARY(${TARGET} STATIC ${SOURCE_FILE})
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)
FOREACH(LIB ${LIBS_TO_MERGE})
@ -239,11 +243,11 @@ MACRO(MERGE_LIBRARIES)
# check for non-PIC libraries
IF(NOT _SKIP_PIC)
FOREACH(LIB ${LIBS})
GET_TARGET_PROPERTY(${LIB} TYPE LIBTYPE)
IF(LIBTYPE STREQUAL "STATIC_LIBRARY")
GET_TARGET_PROPERTY(LIB COMPILE_FLAGS LIB_COMPILE_FLAGS)
GET_TARGET_PROPERTY(LTYPE ${LIB} TYPE)
IF(LTYPE STREQUAL "STATIC_LIBRARY")
GET_TARGET_PROPERTY(LIB_COMPILE_FLAGS ${LIB} COMPILE_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>")
MESSAGE(FATAL_ERROR
"Attempted to link non-PIC static library ${LIB} to shared library ${TARGET}\n"

View file

@ -205,9 +205,8 @@ IF(MSVC)
ENDIF()
# Always link with socket library
LINK_LIBRARIES(ws2_32)
# ..also for tests
SET(CMAKE_REQUIRED_LIBRARIES ws2_32)
STRING(APPEND CMAKE_C_STANDARD_LIBRARIES " ws2_32.lib")
STRING(APPEND CMAKE_CXX_STANDARD_LIBRARIES " ws2_32.lib")
# System checks
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
# 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)
ELSE()
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()
MYSQL_USE_BUNDLED_SSL()
ENDIF()
ELSE()
MESSAGE(SEND_ERROR
MESSAGE(FATAL_ERROR
"Wrong option for WITH_SSL. Valid values are: ${WITH_SSL_DOC}")
ENDIF()
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
# 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
MACRO (MYSQL_USE_BUNDLED_ZLIB)
SET(ZLIB_LIBRARY zlib)
SET(ZLIB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/zlib)
SET(ZLIB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/zlib ${CMAKE_BINARY_DIR}/zlib)
SET(BUILD_BUNDLED_ZLIB 1)
SET(ZLIB_LIBRARY zlib CACHE INTERNAL "Bundled zlib library")
SET(ZLIB_FOUND TRUE)
SET(WITH_ZLIB "bundled" CACHE STRING "Use bundled 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()
# MYSQL_CHECK_ZLIB_WITH_COMPRESS
@ -37,15 +34,10 @@ ENDMACRO()
MACRO (MYSQL_CHECK_ZLIB_WITH_COMPRESS)
IF(CMAKE_SYSTEM_NAME STREQUAL "OS400" OR
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)
# For NDBCLUSTER: Use bundled zlib by default
IF (NOT WITH_ZLIB)
SET(WITH_ZLIB "bundled" CACHE STRING "By default use bundled zlib on this platform")
ENDIF()
ENDIF()
IF(WITH_ZLIB STREQUAL "bundled")
MYSQL_USE_BUNDLED_ZLIB()

View file

@ -986,11 +986,14 @@ CHECK_STRUCT_HAS_MEMBER("struct sockaddr_in6" sin6_len
SET(CMAKE_EXTRA_INCLUDE_FILES)
CHECK_INCLUDE_FILE(ucontext.h HAVE_UCONTEXT_H)
IF(NOT HAVE_UCONTEXT_H)
CHECK_INCLUDE_FILE(sys/ucontext.h HAVE_UCONTEXT_H)
CHECK_STRUCT_HAS_MEMBER("struct dirent" d_ino "dirent.h" STRUCT_DIRENT_HAS_D_INO)
CHECK_STRUCT_HAS_MEMBER("struct dirent" d_namlen "dirent.h" STRUCT_DIRENT_HAS_D_NAMLEN)
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()
IF(HAVE_UCONTEXT_H)
IF(HAVE_FILE_UCONTEXT_H)
CHECK_FUNCTION_EXISTS(makecontext HAVE_UCONTEXT_H)
ENDIF()

1
debian/rules vendored
View file

@ -1,6 +1,7 @@
#!/usr/bin/make -f
export DH_VERBOSE=1
export DEB_BUILD_HARDENING=1
# enable Debian 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.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
this program; if not, write to the Free Software Foundation, Inc.,
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.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02111-1301 USA
*******************************************************/
#define MYSQL_CLIENT
@ -1759,62 +1759,63 @@ backup_cleanup()
}
static pthread_mutex_t mdl_lock_con_mutex;
static MYSQL *mdl_con = NULL;
std::map<ulint, std::string> spaceid_to_tablename;
void
mdl_lock_init()
{
pthread_mutex_init(&mdl_lock_con_mutex, NULL);
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
mdl_lock_table(ulint space_id)
{
std::ostringstream oss;
oss << "SELECT NAME "
"FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES "
"WHERE SPACE = " << space_id << " AND NAME LIKE '%%/%%'";
if (space_id == 0)
return;
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)) {
DBUG_EXECUTE_IF("rename_during_mdl_lock_table",
if (strcmp(row[0], "test/t1") == 0)
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())) {
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());
} else {
} else {
MYSQL_RES *r = mysql_store_result(mdl_con);
mysql_free_result(r);
}
}
pthread_mutex_unlock(&mdl_lock_con_mutex);
mysql_free_result(mysql_result);
}
void
mdl_unlock_all()
{
msg_ts("Unlocking MDL for all tables\n");
xb_mysql_query(mdl_con, "COMMIT", false, true);
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
* 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.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
this program; if not, write to the Free Software Foundation, Inc.,
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.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
this program; if not, write to the Free Software Foundation, Inc.,
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
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.

View file

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

View file

@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 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).

View file

@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 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).

View file

@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA */
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1301 USA */
/*
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)
{
return (uint32)
(_my_bits_reverse_table[ key & 255] << 24) |
(_my_bits_reverse_table[(key>> 8) & 255] << 16) |
(_my_bits_reverse_table[(key>>16) & 255] << 8) |
_my_bits_reverse_table[(key>>24) ];
return
((uint32)_my_bits_reverse_table[ key & 255] << 24) |
((uint32)_my_bits_reverse_table[(key>> 8) & 255] << 16) |
((uint32)_my_bits_reverse_table[(key>>16) & 255] << 8) |
(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
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 */

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
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
non-zero.
thd_is_killed(thd)
thd_killed(thd)
@return 0 - no KILL statement was issued, continue normally
@return 1 - there was a KILL statement, abort the execution.

View file

@ -25,12 +25,12 @@
#define WSREP_MYSQL_DB (char *)"mysql"
#define WSREP_TO_ISOLATION_BEGIN(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_) \
if (WSREP_ON && WSREP(thd) && wsrep_to_isolation_begin(thd, db_, table_, \
table_list_, alter_info_)) \
goto error;
goto wsrep_error_label;
#define WSREP_TO_ISOLATION_END \
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_) \
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(...) \
if (wsrep_debug) WSREP_LOG(sql_print_information, ##__VA_ARGS__)
@ -52,8 +52,8 @@
#define WSREP_SYNC_WAIT(thd_, before_) \
{ if (WSREP_CLIENT(thd_) && \
wsrep_sync_wait(thd_, before_)) goto error; }
wsrep_sync_wait(thd_, before_)) goto wsrep_error_label; }
#define WSREP_ERROR_LABEL wsrep_error_label
#else
#define IF_WSREP(A,B) B
#define DBUG_ASSERT_IF_WSREP(A)
@ -66,6 +66,7 @@
#define WSREP_TO_ISOLATION_END
#define WSREP_TO_ISOLATION_BEGIN_WRTCHK(db_, table_, table_list_)
#define WSREP_SYNC_WAIT(thd_, before_)
#define WSREP_ERROR_LABEL goto wsrep_error_label; wsrep_error_label
#endif /* WITH_WSREP */

View file

@ -1,4 +1,5 @@
# 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
# it under the terms of the GNU General Public License as published by
@ -452,4 +453,3 @@ IF(NOT DISABLE_SHARED)
ENDIF()
ENDIF()
ENDIF()

View file

@ -14,7 +14,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# 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
# 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 $option= $self->option($option_name);
if (! defined($option) and defined $ENV{$option_name}) {
if (! defined($option)) {
my $value= $ENV{$option_name};
$option= My::Config::Option->new($option_name, $value);
}
croak "No option named '$option_name' in group '$self->{name}'"
if ! defined($option);
return $option->value();
}

View file

@ -1411,6 +1411,59 @@ t1 CREATE TABLE `t1` (
`consultant_id` bigint(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8
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 (
id INT(11) NOT NULL,
x_param INT(11) DEFAULT NULL,

View file

@ -1292,6 +1292,56 @@ MODIFY COLUMN `consultant_id` BIGINT;
SHOW CREATE 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
#

View file

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

View file

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

View file

@ -8046,6 +8046,15 @@ ABCDEFGHI-ABCDEFGHI
DROP TABLE t1;
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
#
#

View file

@ -266,6 +266,18 @@ SET NAMES latin1;
--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 # End of 10.0 tests
--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'
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
#
#

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';
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 # End of MariaDB-10.0 tests
--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;
LOCK TABLES v1 WRITE;
FLUSH TABLES v1;
ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
UNLOCK TABLES;
LOCK TABLES v1 READ;
FLUSH TABLES t1;

View file

@ -688,7 +688,6 @@ FLUSH TABLES v1;
UNLOCK TABLES;
LOCK TABLES v1 WRITE;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
FLUSH TABLES v1;
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;
c1
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 #
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
DROP TABLE t1;
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;
--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

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

View file

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

View file

@ -395,15 +395,17 @@ DROP VIEW IF EXISTS v1;
#
# 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 VIEW v1 AS SELECT f1 FROM t1 ;
# Connection 2
connect con2,localhost,root;
LOCK TABLES v1 WRITE, t1 READ;
FLUSH TABLE t1;
ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
UNLOCK TABLES;
disconnect con2;
# Connection 1
connection default;
LOCK TABLES t1 WRITE;
FLUSH TABLE t1;
DROP TABLE t1;
DROP VIEW v1;
#

View file

@ -734,17 +734,21 @@ DROP VIEW IF EXISTS v1;
--echo #
--echo # Test 1: LOCK TABLES v1 WRITE, t1 READ;
--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 VIEW v1 AS SELECT f1 FROM t1 ;
--echo # Connection 2
connect (con2,localhost,root);
LOCK TABLES v1 WRITE, t1 READ;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
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
DROP TABLE t1;

View file

@ -83,6 +83,75 @@ CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a= 1;
RENAME TABLE t1 TO T1;
ALTER TABLE T1 RENAME 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.host 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 trigger t1_bi before insert on t1 for each row set new.a= 1;
show triggers like '%T1%';

View file

@ -105,6 +105,18 @@ RENAME TABLE t1 TO T1;
ALTER TABLE T1 RENAME 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
#
@ -113,4 +125,7 @@ create trigger t1_bi before insert on t1 for each row set new.a= 1;
show triggers like '%T1%';
drop table t1;
let $datadir= `select @@datadir`;
remove_file $datadir/mysql_upgrade_info;
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: '10'
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
show warnings;
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

@ -1870,3 +1870,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
DROP TABLE t1;
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;
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

@ -11,10 +11,10 @@ select user, host, password, plugin, authentication_string from mysql.user where
user host password plugin authentication_string
natauth localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
newpass localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
newpassnat localhost mysql_native_password *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
newpassnat localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 mysql_native_password *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
oldauth localhost 378b243e220ca493
oldpass localhost 378b243e220ca493
oldpassold localhost mysql_old_password 378b243e220ca493
oldpassold localhost 378b243e220ca493 mysql_old_password 378b243e220ca493
connect con,localhost,natauth,test,;
select current_user();
current_user()
@ -86,12 +86,12 @@ set password for oldpass@localhost = PASSWORD('test2');
set password for oldpassold@localhost = PASSWORD('test2');
select user, host, password, plugin, authentication_string from mysql.user where user != 'root';
user host password plugin authentication_string
natauth localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
newpass localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
newpassnat localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
oldauth localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
oldpass localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
oldpassold localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
natauth localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
newpass localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
newpassnat localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
oldauth localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
oldpass localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
oldpassold localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
connect con,localhost,natauth,test2,;
select current_user();
current_user()
@ -173,7 +173,7 @@ disconnect foo;
connection default;
select user,host,password,plugin,authentication_string from mysql.user where user='foo';
user host password plugin authentication_string
foo localhost mysql_native_password *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB
foo localhost *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB mysql_native_password *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB
set password for 'foo'@'localhost' = '';
select user,host,password,plugin,authentication_string from mysql.user where user='foo';
user host password plugin authentication_string

View file

@ -71,7 +71,7 @@ connection default;
set password for u1 = PASSWORD('SOMETHINGELSE');
select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
user host password plugin authentication_string
u1 % mysql_native_password *054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6
u1 % *054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6 mysql_native_password *054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6
#
# Here we should use the password field, as that primes over
# the authentication_string field.

View file

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

View file

@ -1995,8 +1995,50 @@ select 0.0000000001 mod 1;
select 0.01 mod 1;
0.01 mod 1
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

View file

@ -1583,8 +1583,51 @@ select 0.000000000000000000000000000000000000000000000000001 mod 1;
select 0.0000000001 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 # Start of 10.0 tests
--echo # End of 5.5 tests
--echo #
--echo #

View file

@ -396,7 +396,14 @@ a
drop table t1;
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

View file

@ -187,9 +187,16 @@ select a from t1 where a=b; # not a constant
drop table t1;
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 # Start of 10.1 tests
--echo # End of 10.0 tests
--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;
a b x row_number() over (partition by a order by x)
2 10 xx 1
2 10 zz 3
2 20 yy 2
3 10 xxx 2
2 10 zz 3
3 20 vvv 1
3 10 xxx 2
drop table t1;
create table t1 (pk int primary key, a int, b int);
insert into t1 values
@ -54,13 +54,14 @@ select
pk, a, b,
row_number() over (order by a),
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)
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
4 13 19 4 2
3 12 20 3 3
2 11 21 2 4
1 10 22 1 5
drop table t1;
#
# 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
from t1;
pk c CNT
1 1 3
2 1 4
3 1 4
4 1 3
5 2 3
6 2 4
7 2 5
8 2 5
9 2 4
3 1 4
2 1 4
1 1 3
10 2 3
9 2 4
8 2 5
7 2 5
6 2 4
5 2 3
drop table t0,t1;
#
# Resolution of window names
@ -535,42 +536,40 @@ insert into t3 values
(5, 2),
(6, 2);
select
pk,
val,
count(val) over (order by val
range between current row and
current row)
as CNT
from t3;
pk val CNT
0 1 3
1 1 3
2 1 3
3 2 4
4 2 4
5 2 4
6 2 4
val CNT
1 3
1 3
1 3
2 4
2 4
2 4
2 4
insert into t3 values
(7, 3),
(8, 3);
select
pk,
val,
count(val) over (order by val
range between current row and
current row)
as CNT
from t3;
pk val CNT
0 1 3
1 1 3
2 1 3
3 2 4
4 2 4
5 2 4
6 2 4
7 3 2
8 3 2
val CNT
1 3
1 3
1 3
2 4
2 4
2 4
2 4
3 2
3 2
drop table t3;
# Now, check with PARTITION BY
create table t4 (
@ -599,7 +598,6 @@ insert into t4 values
(5678, 208, 3);
select
part_id,
pk,
val,
count(val) over (partition by part_id
order by val
@ -607,31 +605,30 @@ range between current row and
current row)
as CNT
from t4;
part_id pk val CNT
1234 100 1 3
1234 101 1 3
1234 102 1 3
1234 103 2 4
1234 104 2 4
1234 105 2 4
1234 106 2 4
1234 107 3 2
1234 108 3 2
5678 200 1 3
5678 201 1 3
5678 202 1 3
5678 203 2 4
5678 204 2 4
5678 205 2 4
5678 206 2 4
5678 207 3 2
5678 208 3 2
part_id val CNT
1234 1 3
1234 1 3
1234 1 3
1234 2 4
1234 2 4
1234 2 4
1234 2 4
1234 3 2
1234 3 2
5678 1 3
5678 1 3
5678 1 3
5678 2 4
5678 2 4
5678 2 4
5678 2 4
5678 3 2
5678 3 2
#
# Try RANGE UNBOUNDED PRECEDING | FOLLOWING
#
select
part_id,
pk,
val,
count(val) over (partition by part_id
order by val
@ -639,28 +636,27 @@ range between unbounded preceding and
current row)
as CNT
from t4;
part_id pk val CNT
1234 100 1 3
1234 101 1 3
1234 102 1 3
1234 103 2 7
1234 104 2 7
1234 105 2 7
1234 106 2 7
1234 107 3 9
1234 108 3 9
5678 200 1 3
5678 201 1 3
5678 202 1 3
5678 203 2 7
5678 204 2 7
5678 205 2 7
5678 206 2 7
5678 207 3 9
5678 208 3 9
part_id val CNT
1234 1 3
1234 1 3
1234 1 3
1234 2 7
1234 2 7
1234 2 7
1234 2 7
1234 3 9
1234 3 9
5678 1 3
5678 1 3
5678 1 3
5678 2 7
5678 2 7
5678 2 7
5678 2 7
5678 3 9
5678 3 9
select
part_id,
pk,
val,
count(val) over (partition by part_id
order by val
@ -668,28 +664,27 @@ range between current row and
unbounded following)
as CNT
from t4;
part_id pk val CNT
1234 100 1 9
1234 101 1 9
1234 102 1 9
1234 103 2 6
1234 104 2 6
1234 105 2 6
1234 106 2 6
1234 107 3 2
1234 108 3 2
5678 200 1 9
5678 201 1 9
5678 202 1 9
5678 203 2 6
5678 204 2 6
5678 205 2 6
5678 206 2 6
5678 207 3 2
5678 208 3 2
part_id val CNT
1234 1 9
1234 1 9
1234 1 9
1234 2 6
1234 2 6
1234 2 6
1234 2 6
1234 3 2
1234 3 2
5678 1 9
5678 1 9
5678 1 9
5678 2 6
5678 2 6
5678 2 6
5678 2 6
5678 3 2
5678 3 2
select
part_id,
pk,
val,
count(val) over (partition by part_id
order by val
@ -697,25 +692,25 @@ range between unbounded preceding and
unbounded following)
as CNT
from t4;
part_id pk val CNT
1234 100 1 9
1234 101 1 9
1234 102 1 9
1234 103 2 9
1234 104 2 9
1234 105 2 9
1234 106 2 9
1234 107 3 9
1234 108 3 9
5678 200 1 9
5678 201 1 9
5678 202 1 9
5678 203 2 9
5678 204 2 9
5678 205 2 9
5678 206 2 9
5678 207 3 9
5678 208 3 9
part_id val CNT
1234 1 9
1234 1 9
1234 1 9
1234 2 9
1234 2 9
1234 2 9
1234 2 9
1234 3 9
1234 3 9
5678 1 9
5678 1 9
5678 1 9
5678 2 9
5678 2 9
5678 2 9
5678 2 9
5678 3 9
5678 3 9
drop table t4;
#
# 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
from t1;
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
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
pk, a,
count(a) over (ORDER BY a
@ -929,15 +924,15 @@ RANGE BETWEEN UNBOUNDED PRECEDING
AND 10 PRECEDING) as cnt
from t1;
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
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
pk, a,
count(a) over (ORDER BY a
@ -977,15 +972,15 @@ RANGE BETWEEN 1 PRECEDING
AND CURRENT ROW) as cnt
from t1;
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
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
pk, a,
count(a) over (ORDER BY a
@ -1026,15 +1021,15 @@ range between current row
and 1 following) as cnt
from t1;
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
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;
select
part_id, pk, a,
@ -1137,7 +1132,8 @@ pk, a,
count(b) over (order by a
range between 2 preceding
and 2 following) as CNT
from t1;
from t1
order by a, pk;
pk a CNT
1 NULL 3
2 NULL 3
@ -1969,12 +1965,12 @@ ROW_NUMBER() OVER (order by s1),
CUME_DIST() OVER (order by -s1)
from t1;
s1 s2 ROW_NUMBER() OVER (order by s1) CUME_DIST() OVER (order by -s1)
-1 2 1.0000000000
1 a 3 0.8333333333
NULL NULL 1 0.1666666667
2 b 4 0.6666666667
3 NULL 5 0.5000000000
4 a 6 0.3333333333
2 b 4 0.6666666667
-1 2 1.0000000000
NULL NULL 1 0.1666666667
drop table t1;
#
# 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
RANGE BETWEEN 15 FOLLOWING
AND 15 FOLLOWING)
242 NULL
238 NULL
242 NULL
DROP table orders;
#
# 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
from t1;
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
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;
#
# MDEV-10874: two window functions with ccompatible sorting
# MDEV-10874: two window functions with compatible sorting
#
create table t1 (
pk int primary key,
@ -2130,17 +2126,17 @@ sum(d) over (order by a
ROWS BETWEEN 1 preceding and 2 following) as sum_2
from t1;
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
4 1 0.400 0.900 2.600
5 1 0.500 1.100 2.400
2 0 0.200 0.500 1.200
1 0 0.100 0.300 1.400
6 1 0.600 0.600 1.600
7 2 0.500 0.500 0.500
8 2 NULL 0.700 1.200
9 2 0.700 1.500 2.000
10 2 0.800 1.700 2.400
5 1 0.500 1.100 2.400
4 1 0.400 0.900 2.600
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;
#
# 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))
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))
0.0000000000 0
1.0000000000 1
3.0000000000 1.7320508075688772
0.0000000000 0
drop table t;
#
# MDEV-10868: view definitions with window functions
@ -2391,9 +2387,9 @@ CREATE TABLE t2 (c VARCHAR(8));
INSERT INTO t2 VALUES ('foo'),('bar'),('foo');
SELECT COUNT(*) OVER (PARTITION BY c) FROM t2;
COUNT(*) OVER (PARTITION BY c)
2
1
2
2
SELECT * FROM t1 WHERE i IN ( SELECT COUNT(*) OVER (PARTITION BY c) FROM t2 );
i
1
@ -2511,14 +2507,14 @@ select id, rank() over (order by id) from t1;
id rank() over (order by id)
1 1
2 2
3 4
2 2
3 4
select * from v1;
id rnk
1 1
2 2
3 4
2 2
3 4
drop view v1;
drop table t1;
#
@ -2879,64 +2875,64 @@ CDEC min(TDEC.CDEC) over ()
NULL -1
-1 -1
0 -1
1 -1
0 -1
1 -1
10 -1
select VDEC.CDEC, min(VDEC.CDEC) over () from VDEC;
CDEC min(VDEC.CDEC) over ()
NULL -1
-1 -1
0 -1
1 -1
0 -1
1 -1
10 -1
select TDEC.CDEC, max(TDEC.CDEC) over () from TDEC;
CDEC max(TDEC.CDEC) over ()
NULL 10
-1 10
0 10
1 10
0 10
1 10
10 10
select VDEC.CDEC, max(VDEC.CDEC) over () from VDEC;
CDEC max(VDEC.CDEC) over ()
NULL 10
-1 10
0 10
1 10
0 10
1 10
10 10
select TDEC.CDEC, min(distinct TDEC.CDEC) over () from TDEC;
CDEC min(distinct TDEC.CDEC) over ()
NULL -1
-1 -1
0 -1
1 -1
0 -1
1 -1
10 -1
select VDEC.CDEC, min(distinct VDEC.CDEC) over () from VDEC;
CDEC min(distinct VDEC.CDEC) over ()
NULL -1
-1 -1
0 -1
1 -1
0 -1
1 -1
10 -1
select TDEC.CDEC, max(distinct TDEC.CDEC) over () from TDEC;
CDEC max(distinct TDEC.CDEC) over ()
NULL 10
-1 10
0 10
1 10
0 10
1 10
10 10
select VDEC.CDEC, max(distinct VDEC.CDEC) over () from VDEC;
CDEC max(distinct VDEC.CDEC) over ()
NULL 10
-1 10
0 10
1 10
0 10
1 10
10 10
#
# These should be removed once support for them is added.
@ -3327,6 +3323,45 @@ BIT_AND(0) OVER () MAX(1)
0 1
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
#
#

View file

@ -58,7 +58,8 @@ select
pk, a, b,
row_number() over (order by a),
row_number() over (order by b)
from t1;
from t1
order by b;
drop table t1;
@ -391,7 +392,6 @@ insert into t3 values
(6, 2);
select
pk,
val,
count(val) over (order by val
range between current row and
@ -404,7 +404,6 @@ insert into t3 values
(8, 3);
select
pk,
val,
count(val) over (order by val
range between current row and
@ -444,7 +443,6 @@ insert into t4 values
select
part_id,
pk,
val,
count(val) over (partition by part_id
order by val
@ -458,7 +456,6 @@ from t4;
--echo #
select
part_id,
pk,
val,
count(val) over (partition by part_id
order by val
@ -469,7 +466,6 @@ from t4;
select
part_id,
pk,
val,
count(val) over (partition by part_id
order by val
@ -480,7 +476,6 @@ from t4;
select
part_id,
pk,
val,
count(val) over (partition by part_id
order by val
@ -723,7 +718,8 @@ select
count(b) over (order by a
range between 2 preceding
and 2 following) as CNT
from t1;
from t1
order by a, pk;
drop table t1;
--echo #
@ -1023,6 +1019,7 @@ insert into t1 values
--echo # Check using counters
flush status;
--sorted_result
select
rank() over (partition by c order by a),
rank() over (partition by c order by b)
@ -1030,6 +1027,7 @@ from t1;
show status like '%sort%';
flush status;
--sorted_result
select
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),
(3,1);
--sorted_result
select
a, 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 (-1,'');
--sorted_result
select
*,
ROW_NUMBER() OVER (order by s1),
@ -1267,7 +1267,7 @@ from t1;
drop table t1;
--echo #
--echo # MDEV-10874: two window functions with ccompatible sorting
--echo # MDEV-10874: two window functions with compatible sorting
--echo #
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;
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 # Start of 10.3 tests
--echo #

View file

@ -68,17 +68,17 @@ first_value(pk) over (order by pk desc),
last_value(pk) over (order by pk desc)
from t1;
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
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,
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,

View file

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

View file

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

View file

@ -32,8 +32,8 @@ Chun 5.0000000000
Kaolin 4.0000000000
Kaolin 4.0000000000
Kaolin 4.0000000000
Tatiana 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;
name c
Chun 3.0000000000
@ -41,8 +41,8 @@ Chun 3.0000000000
Kaolin 4.0000000000
Kaolin 4.0000000000
Kaolin 4.0000000000
Tatiana 4.0000000000
Tata 4.0000000000
Tatiana 4.0000000000
# no partition clause
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 ()
@ -51,8 +51,8 @@ Chun 4.0000000000
Kaolin 4.0000000000
Kaolin 4.0000000000
Kaolin 4.0000000000
Tatiana 4.0000000000
Tata 4.0000000000
Tatiana 4.0000000000
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 ()
Chun 4.0000000000
@ -60,8 +60,8 @@ Chun 4.0000000000
Kaolin 4.0000000000
Kaolin 4.0000000000
Kaolin 4.0000000000
Tatiana 4.0000000000
Tata 4.0000000000
Tatiana 4.0000000000
# argument set to null
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
@ -75,8 +75,8 @@ Chun 5.0000000000
Kaolin 4.0000000000
Kaolin 4.0000000000
Kaolin 4.0000000000
Tatiana 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;
name percentile_disc(0.5) within group ( order by score) over (partition by name )
Chun 3.0000000000
@ -84,8 +84,8 @@ Chun 3.0000000000
Kaolin 4.0000000000
Kaolin 4.0000000000
Kaolin 4.0000000000
Tatiana 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;
name
Chun
@ -93,8 +93,8 @@ Chun
Kaolin
Kaolin
Kaolin
Tatiana
Tata
Tatiana
#disallowed fields in order by
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
@ -121,10 +121,10 @@ name cume_dist() over (partition by name order by score) c
Chun 0.5000000000 3.0000000000
Chun 1.0000000000 3.0000000000
Kaolin 0.3333333333 4.0000000000
Kaolin 1.0000000000 4.0000000000
Kaolin 0.6666666667 4.0000000000
Tatiana 1.0000000000 4.0000000000
Kaolin 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;
name c
Chun 5.0000000000
@ -132,98 +132,98 @@ Chun 5.0000000000
Kaolin 4.0000000000
Kaolin 4.0000000000
Kaolin 4.0000000000
Tatiana 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;
name b c
Chun 0.5000000000 3.0000000000
Chun 1.0000000000 3.0000000000
Kaolin 0.3333333333 3.0000000000
Kaolin 1.0000000000 3.0000000000
Kaolin 0.6666666667 3.0000000000
Tatiana 1.0000000000 4.0000000000
Kaolin 1.0000000000 3.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;
name b c
Chun 0.5000000000 3.0000000000
Chun 1.0000000000 3.0000000000
Kaolin 0.3333333333 3.0000000000
Kaolin 1.0000000000 3.0000000000
Kaolin 0.6666666667 3.0000000000
Tatiana 1.0000000000 4.0000000000
Kaolin 1.0000000000 3.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;
name b c
Chun 0.5000000000 3.0000000000
Chun 1.0000000000 3.0000000000
Kaolin 0.3333333333 3.0000000000
Kaolin 1.0000000000 3.0000000000
Kaolin 0.6666666667 3.0000000000
Tatiana 1.0000000000 4.0000000000
Kaolin 1.0000000000 3.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;
name b c
Chun 0.5000000000 3.0000000000
Chun 1.0000000000 3.0000000000
Kaolin 0.3333333333 4.0000000000
Kaolin 1.0000000000 4.0000000000
Kaolin 0.6666666667 4.0000000000
Tatiana 1.0000000000 4.0000000000
Kaolin 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;
name b c
Chun 0.5000000000 3.0000000000
Chun 1.0000000000 3.0000000000
Kaolin 0.3333333333 4.0000000000
Kaolin 1.0000000000 4.0000000000
Kaolin 0.6666666667 4.0000000000
Tatiana 1.0000000000 4.0000000000
Kaolin 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;
name b c
Chun 0.5000000000 7.0000000000
Chun 1.0000000000 7.0000000000
Kaolin 0.3333333333 4.0000000000
Kaolin 1.0000000000 4.0000000000
Kaolin 0.6666666667 4.0000000000
Tatiana 1.0000000000 4.0000000000
Kaolin 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;
name b c
Chun 0.5000000000 7.0000000000
Chun 1.0000000000 7.0000000000
Kaolin 0.3333333333 7.0000000000
Kaolin 1.0000000000 7.0000000000
Kaolin 0.6666666667 7.0000000000
Tatiana 1.0000000000 4.0000000000
Kaolin 1.0000000000 7.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;
name b c
Chun 0.5000000000 7.0000000000
Chun 1.0000000000 7.0000000000
Kaolin 0.3333333333 7.0000000000
Kaolin 1.0000000000 7.0000000000
Kaolin 0.6666666667 7.0000000000
Tatiana 1.0000000000 4.0000000000
Kaolin 1.0000000000 7.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;
name b c
Chun 0.5000000000 7.0000000000
Chun 1.0000000000 7.0000000000
Kaolin 0.3333333333 7.0000000000
Kaolin 1.0000000000 7.0000000000
Kaolin 0.6666666667 7.0000000000
Tatiana 1.0000000000 4.0000000000
Kaolin 1.0000000000 7.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;
name b c
Chun 0.5000000000 7.0000000000
Chun 1.0000000000 7.0000000000
Kaolin 0.3333333333 7.0000000000
Kaolin 1.0000000000 7.0000000000
Kaolin 0.6666666667 7.0000000000
Tatiana 1.0000000000 4.0000000000
Kaolin 1.0000000000 7.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;
median(score) over (partition by name) c
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 #
--sorted_result
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;
--echo # no partition clause
--sorted_result
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;
--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;
--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;
--sorted_result
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;
--echo #disallowed fields in order by

View file

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

View file

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

View file

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

View file

@ -19,6 +19,9 @@ sub skip_combinations {
# don't run tests for the wrong platform
$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
# check for exact values, in case the default changes to be small everywhere
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};
$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
$skip{'include/not_embedded.inc'} = 'Not run for embedded server'
if $::opt_embedded_server;

View file

@ -17,6 +17,12 @@ master-bin.000002 #
SET @@SESSION.gtid_domain_id=1;
SET @@SESSION.server_id=1;
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);
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;
@ -74,5 +80,11 @@ the following command succeeds with warnings
FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1);
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.
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;
RESET MASTER;

View file

@ -28,6 +28,9 @@ FLUSH BINARY LOGS DELETE_DOMAIN_ID = (99);
SET @@SESSION.gtid_domain_id=1;
SET @@SESSION.server_id=1;
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
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
--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
#

View file

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

View file

@ -171,6 +171,43 @@ UNLOCK TABLES;
DROP TABLES staff, store;
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
#
CREATE TABLE users (
@ -252,7 +289,6 @@ DELETE FROM t1 WHERE id = 1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
connection con1;
COMMIT;
disconnect con1;
connection default;
SELECT * FROM t2;
id ref_id f
@ -332,7 +368,26 @@ PRIMARY KEY (store_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
) ENGINE=InnoDB;
SET FOREIGN_KEY_CHECKS=DEFAULT;
LOCK TABLE staff WRITE;
UNLOCK TABLES;
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;
ERROR 23000: Duplicate entry '1' for key 'uk'
SET DEBUG_SYNC = 'now SIGNAL s2';
disconnect con1;
/* connection default */
connection default;
/* reap */ alter table t1 force, add b int, ALGORITHM=inplace;
ERROR 23000: Duplicate entry '1' for key 'uk'
SET DEBUG_SYNC = 'RESET';
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

@ -726,6 +726,7 @@ t2 CREATE TABLE `t2` (
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c2`) REFERENCES `t1` (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
ALTER TABLE t1 CHANGE COLUMN c1 C1 INT;
ALTER TABLE t2 CHANGE COLUMN c2 C2 INT;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@ -735,24 +736,149 @@ t1 CREATE TABLE `t1` (
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`c2` int(11) NOT NULL,
KEY `c2` (`c2`),
`C2` int(11) DEFAULT NULL,
KEY `c2` (`C2`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c2`) REFERENCES `t1` (`c1`)
) 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;
Table Create Table
t1 CREATE TABLE `t1` (
`C1` int(11) NOT NULL,
PRIMARY KEY (`C1`)
`c5` int(11) NOT NULL,
PRIMARY KEY (`c5`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`c2` int(11) NOT NULL,
KEY `c2` (`c2`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c2`) REFERENCES `t1` (`c1`)
`c6` int(11) DEFAULT NULL,
KEY `c2` (`c6`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c6`) REFERENCES `t1` (`c5`)
) 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;
# 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
# 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

View file

@ -0,0 +1,40 @@
--source include/have_innodb.inc
--source include/have_perfschema.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/not_embedded.inc
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;
let $n=247;
--disable_query_log
while ($n) {
dec $n;
INSERT INTO t1 SELECT NULL, REPEAT('b',255);
}
--enable_query_log
COMMIT;
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL go WAIT_FOR gone';
send ALTER TABLE t1 ADD INDEX(b), ALGORITHM=INPLACE;
connection default;
SET DEBUG_SYNC = 'now WAIT_FOR go';
--replace_regex /.*[\\\/]tmp/tmp/
SELECT DISTINCT object_name FROM performance_schema.events_waits_history_long
WHERE event_name LIKE '%wait%io%file%innodb%innodb_temp_file%';
#--exec lsof -p `pidof mysqld`
SET DEBUG_SYNC = 'now SIGNAL gone';
connection ddl;
reap;
disconnect ddl;
connection default;
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1;

View file

@ -4,11 +4,11 @@
##########################################################################
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/innodb_binlog.inc
--disable_warnings
drop table if exists t1;
--enable_warnings
let $stmt= `SELECT @@GLOBAL.log_bin`;
set global transaction isolation level repeatable read;
@ -69,29 +69,28 @@ CREATE TABLE t1(
k INT,
c CHAR(1),
UNIQUE KEY(k)) ENGINE=InnoDB;
--echo #
--echo # Parallel execution
--echo #
--connect(con1, localhost, root)
--connect(con2, localhost, root)
--send SET DEBUG_SYNC='now WAIT_FOR write_row_done'
--connection con1
--echo #
--echo # Connection 1
--echo #
--connect(con1, localhost, root)
SET DEBUG_SYNC='ha_write_row_end SIGNAL write_row_done WAIT_FOR continue';
--send INSERT INTO t1(k) VALUES (1), (2), (3) ON DUPLICATE KEY UPDATE c='1'
--connection con2
--echo #
--echo # Connection 2
--echo #
--reap
SET DEBUG_SYNC='execute_command_after_close_tables SIGNAL continue';
if ($stmt) {
--error ER_LOCK_WAIT_TIMEOUT
INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2';
}
if (!$stmt) {
INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2';
}
--connection con1
--echo #
@ -138,23 +137,14 @@ CREATE TABLE t1(
--enable_info
--connect(con1, localhost, root)
--connect(con2, localhost, root)
--connection con1
--echo #
--echo # Connection 1
--echo #
SET DEBUG_SYNC='ha_write_row_end SIGNAL continue2 WAIT_FOR continue1';
--send INSERT INTO t1(k) VALUES (1), (2), (3) ON DUPLICATE KEY UPDATE c='1'
--connection con2
--echo #
--echo # Connection 2
--echo #
--connect(con2, localhost, root)
SET DEBUG_SYNC='ha_write_row_start WAIT_FOR continue2';
SET DEBUG_SYNC='after_mysql_insert SIGNAL continue1';
INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2';
--disconnect con2
--connection con1
--reap
@ -167,11 +157,9 @@ SET DEBUG_SYNC='RESET';
SELECT * FROM t1 ORDER BY k;
--disconnect con1
--disconnect con2
--connection default
DROP TABLE t1;
set global transaction isolation level repeatable read;

View file

@ -138,8 +138,61 @@ SET FOREIGN_KEY_CHECKS=DEFAULT;
LOCK TABLE staff WRITE;
UNLOCK TABLES;
DROP TABLES staff, store;
SET FOREIGN_KEY_CHECKS=1;
--echo #
--echo # MDEV-17531 Crash in RENAME TABLE with FOREIGN KEY and FULLTEXT INDEX
--echo #
--disable_query_log
call mtr.add_suppression("InnoDB: Possible reasons:");
call mtr.add_suppression("InnoDB: \\([12]\\) Table ");
call mtr.add_suppression("InnoDB: If table `test`\\.`t2` is a temporary table");
--enable_query_log
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;
--replace_regex /Table '.*t2'/Table 't2'/
--error ER_TABLE_EXISTS_ERROR
RENAME TABLE best.t2 TO test.t2;
SHOW CREATE TABLE best.t2;
DROP DATABASE best;
--echo #
--echo # MDEV-17541 KILL QUERY during lock wait in FOREIGN KEY check hangs
--echo #
connect (fk, localhost, root,,);
INSERT INTO t1 SET a=1;
BEGIN;
DELETE FROM t1;
connection default;
let $ID= `SELECT @id := CONNECTION_ID()`;
send INSERT INTO t3 SET a=1;
connection fk;
# Check that the above SELECT is blocked
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = 'update' and info = 'INSERT INTO t3 SET a=1';
--source include/wait_condition.inc
let $ignore= `SELECT @id := $ID`;
kill query @id;
connection default;
--error ER_QUERY_INTERRUPTED
reap;
disconnect fk;
DROP TABLE t3,t1;
--echo # Start of 10.2 tests
--echo #
--echo # MDEV-13246 Stale rows despite ON DELETE CASCADE constraint
--echo #
@ -228,7 +281,6 @@ DELETE FROM t1 WHERE id = 1;
--connection con1
COMMIT;
--disconnect con1
--connection default
SELECT * FROM t2;
@ -288,8 +340,6 @@ insert into t1 values(1, 1);
insert into t2(f1) values(1);
drop table t2, t1;
--source include/wait_until_count_sessions.inc
#
# MDEV-12669 Circular foreign keys cause a loop and OOM upon LOCK TABLE
#
@ -308,8 +358,44 @@ CREATE TABLE store (
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
) ENGINE=InnoDB;
SET FOREIGN_KEY_CHECKS=DEFAULT;
LOCK TABLE staff WRITE;
UNLOCK TABLES;
DROP TABLES staff, store;
SET FOREIGN_KEY_CHECKS=1;
--echo #
--echo # MDEV-17541 KILL QUERY during lock wait in FOREIGN KEY check hangs
--echo #
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;
let $ID= `SELECT @id := CONNECTION_ID()`;
send INSERT INTO t2 SET a=1;
connection con1;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = 'update' and info = 'INSERT INTO t2 SET a=1';
--source include/wait_condition.inc
let $ignore= `SELECT @id := $ID`;
kill query @id;
connection default;
--error ER_QUERY_INTERRUPTED
reap;
disconnect con1;
DROP TABLE t2,t1;
--echo # End of 10.2 tests
--source include/wait_until_count_sessions.inc

View file

@ -64,7 +64,6 @@ set DEBUG_SYNC = 'now WAIT_FOR s1';
--error ER_DUP_ENTRY
update t1 set a=1 where id=2;
SET DEBUG_SYNC = 'now SIGNAL s2';
disconnect con1;
--echo /* connection default */
connection default;
@ -75,5 +74,29 @@ SET DEBUG_SYNC = 'RESET';
drop table t1;
--echo #
--echo # Bug #27753193 ASSERTION `PREBUILT->TRX->ERROR_KEY_NUM <
--echo # 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';
send ALTER TABLE t1 FORCE, ALGORITHM=INPLACE;
connection con1;
SET DEBUG_SYNC = 'now WAIT_FOR S1';
--error ER_DUP_ENTRY
INSERT INTO t1 VALUES (1);
SET DEBUG_SYNC = 'now SIGNAL S2';
disconnect con1;
CONNECTION default;
--error ER_DUP_ENTRY
reap;
SET DEBUG_SYNC='RESET';
DROP TABLE t1;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

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