Merge mariadb-5.5 -> 10.0-base.
This commit is contained in:
commit
7760efad74
@ -320,6 +320,10 @@ IF(NOT WITHOUT_SERVER)
|
||||
ADD_SUBDIRECTORY(mysql-test)
|
||||
ADD_SUBDIRECTORY(mysql-test/lib/My/SafeProcess)
|
||||
ADD_SUBDIRECTORY(sql-bench)
|
||||
|
||||
IF(EXISTS ${CMAKE_SOURCE_DIR}/internal/CMakeLists.txt)
|
||||
ADD_SUBDIRECTORY(internal)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(UNIX)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Copyright (C) 2000-2009 MySQL AB
|
||||
Copyright 2000, 2010-2011, Oracle and/or its affiliates.
|
||||
Copyright 2000-2010 Monty Program Ab
|
||||
/*
|
||||
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2012, Monty Program Ab.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -15,10 +15,6 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#define COPYRIGHT_NOTICE "\
|
||||
This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\
|
||||
and you are welcome to modify and redistribute it under the GPL v2 license\n"
|
||||
|
||||
/* mysql command tool
|
||||
* Commands compatible with mSQL by David J. Hughes
|
||||
*
|
||||
@ -111,6 +107,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#include "completion_hash.h"
|
||||
#include <welcome_copyright_notice.h> // ORACLE_WELCOME_COPYRIGHT_NOTICE
|
||||
|
||||
#define PROMPT_CHAR '\\'
|
||||
#define DEFAULT_DELIMITER ";"
|
||||
@ -1193,7 +1190,7 @@ int main(int argc,char *argv[])
|
||||
mysql_thread_id(&mysql), server_version_string(&mysql));
|
||||
put_info((char*) glob_buffer.ptr(),INFO_INFO);
|
||||
|
||||
put_info(COPYRIGHT_NOTICE, INFO_INFO);
|
||||
put_info(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"), INFO_INFO);
|
||||
|
||||
#ifdef HAVE_READLINE
|
||||
initialize_readline((char*) my_progname);
|
||||
@ -1624,7 +1621,7 @@ static void usage(int version)
|
||||
|
||||
if (version)
|
||||
return;
|
||||
printf("%s", COPYRIGHT_NOTICE);
|
||||
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
|
||||
printf("Usage: %s [OPTIONS] [database]\n", my_progname);
|
||||
my_print_help(my_long_options);
|
||||
print_defaults("my", load_default_groups);
|
||||
@ -2808,7 +2805,7 @@ static int com_server_help(String *buffer __attribute__((unused)),
|
||||
char *line __attribute__((unused)), char *help_arg)
|
||||
{
|
||||
MYSQL_ROW cur;
|
||||
const char *server_cmd= buffer->ptr();
|
||||
const char *server_cmd;
|
||||
char cmd_buf[100 + 1];
|
||||
MYSQL_RES *result;
|
||||
int error;
|
||||
@ -2823,9 +2820,12 @@ static int com_server_help(String *buffer __attribute__((unused)),
|
||||
*++end_arg= '\0';
|
||||
}
|
||||
(void) strxnmov(cmd_buf, sizeof(cmd_buf), "help '", help_arg, "'", NullS);
|
||||
server_cmd= cmd_buf;
|
||||
}
|
||||
|
||||
else
|
||||
(void) strxnmov(cmd_buf, sizeof(cmd_buf), "help ", help_arg, NullS);
|
||||
|
||||
server_cmd= cmd_buf;
|
||||
|
||||
if (!status.batch)
|
||||
{
|
||||
old_buffer= *buffer;
|
||||
@ -2893,6 +2893,11 @@ static int com_server_help(String *buffer __attribute__((unused)),
|
||||
else
|
||||
{
|
||||
put_info("\nNothing found", INFO_INFO);
|
||||
if (strncasecmp(server_cmd, "help 'contents'", 15) == 0)
|
||||
{
|
||||
put_info("\nPlease check if 'help tables' are loaded.\n", INFO_INFO);
|
||||
goto err;
|
||||
}
|
||||
put_info("Please try to run 'help contents' for a list of all accessible topics\n", INFO_INFO);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
/*
|
||||
Copyright (C) 2000 MySQL AB
|
||||
Copyright (c) 2006, 2011, Oracle and/or its affiliates.
|
||||
Copyright (C) 2010-2011 Monty Program Ab
|
||||
Copyright (c) 2006, 2012, Oracle and/or its affiliates.
|
||||
Copyright (C) 2010, 2012, Monty Program Ab.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -252,7 +251,7 @@ get_one_option(int optid, const struct my_option *opt,
|
||||
case '?':
|
||||
printf("%s Ver %s Distrib %s, for %s (%s)\n",
|
||||
my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
|
||||
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010"));
|
||||
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
|
||||
puts("MariaDB utility for upgrading databases to new MariaDB versions.\n");
|
||||
my_print_help(my_long_options);
|
||||
die(0);
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
Copyright (c) 2000, 2011, Oracle and/or its affiliates.
|
||||
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
|
||||
Copyright (c) 2010, 2012, Monty Program Ab.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -22,6 +23,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <mysql.h>
|
||||
#include <sql_common.h>
|
||||
#include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */
|
||||
|
||||
#define ADMIN_VERSION "9.1"
|
||||
#define MAX_MYSQL_VAR 512
|
||||
@ -704,9 +706,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
|
||||
case ADMIN_VER:
|
||||
new_line=1;
|
||||
print_version();
|
||||
puts("Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc,\n"
|
||||
"2009 Monty Program Ab");
|
||||
puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n");
|
||||
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
|
||||
printf("Server version\t\t%s\n", mysql_get_server_info(mysql));
|
||||
printf("Protocol version\t%d\n", mysql_get_proto_info(mysql));
|
||||
printf("Connection\t\t%s\n",mysql_get_host_info(mysql));
|
||||
@ -1219,9 +1219,7 @@ static void print_version(void)
|
||||
static void usage(void)
|
||||
{
|
||||
print_version();
|
||||
puts("Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc,\n"
|
||||
"2009 Monty Program Ab");
|
||||
puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n");
|
||||
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
|
||||
puts("Administration program for the mysqld daemon.");
|
||||
printf("Usage: %s [OPTIONS] command command....\n", my_progname);
|
||||
my_print_help(my_long_options);
|
||||
|
@ -38,6 +38,9 @@
|
||||
#include "sql_priv.h"
|
||||
#include "log_event.h"
|
||||
#include "sql_common.h"
|
||||
#include "my_dir.h"
|
||||
#include <welcome_copyright_notice.h> // ORACLE_WELCOME_COPYRIGHT_NOTICE
|
||||
|
||||
|
||||
#include "sql_string.h" // needed for Rpl_filter
|
||||
#include "sql_list.h" // needed for Rpl_filter
|
||||
@ -1501,10 +1504,7 @@ static void print_version()
|
||||
static void usage()
|
||||
{
|
||||
print_version();
|
||||
puts("By Monty and Sasha, for your professional use\n\
|
||||
This software comes with NO WARRANTY: This is free software,\n\
|
||||
and you are welcome to modify and redistribute it under the GPL license.\n");
|
||||
|
||||
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
|
||||
printf("\
|
||||
Dumps a MySQL binary log in a format usable for viewing or for piping to\n\
|
||||
the mysql command line client.\n\n");
|
||||
@ -2087,6 +2087,7 @@ static Exit_status check_header(IO_CACHE* file,
|
||||
uchar header[BIN_LOG_HEADER_SIZE];
|
||||
uchar buf[PROBE_HEADER_LEN];
|
||||
my_off_t tmp_pos, pos;
|
||||
MY_STAT my_file_stat;
|
||||
|
||||
delete glob_description_event;
|
||||
if (!(glob_description_event= new Format_description_log_event(3)))
|
||||
@ -2096,7 +2097,16 @@ static Exit_status check_header(IO_CACHE* file,
|
||||
}
|
||||
|
||||
pos= my_b_tell(file);
|
||||
my_b_seek(file, (my_off_t)0);
|
||||
|
||||
/* fstat the file to check if the file is a regular file. */
|
||||
if (my_fstat(file->file, &my_file_stat, MYF(0)) == -1)
|
||||
{
|
||||
error("Unable to stat the file.");
|
||||
return ERROR_STOP;
|
||||
}
|
||||
if ((my_file_stat.st_mode & S_IFMT) == S_IFREG)
|
||||
my_b_seek(file, (my_off_t)0);
|
||||
|
||||
if (my_b_read(file, header, sizeof(header)))
|
||||
{
|
||||
error("Failed reading header; probably an empty file.");
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Copyright (C) 2000 MySQL AB & Jani Tolonen
|
||||
Copyright (c) 2001, 2011, Oracle and/or its affiliates.
|
||||
Copyright (C) 2010-2011 Monty Program Ab
|
||||
/*
|
||||
Copyright (c) 2001, 2012, Oracle and/or its affiliates.
|
||||
Copyright (c) 2010, 2011, Monty Program Ab.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -25,6 +25,7 @@
|
||||
#include <mysql_version.h>
|
||||
#include <mysqld_error.h>
|
||||
#include <sslopt-vars.h>
|
||||
#include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */
|
||||
|
||||
/* Exit codes */
|
||||
|
||||
@ -229,13 +230,7 @@ static void usage(void)
|
||||
{
|
||||
DBUG_ENTER("usage");
|
||||
print_version();
|
||||
puts("By Jani Tolonen, 2001-04-20, MySQL Development Team.\n");
|
||||
puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,");
|
||||
puts("and you are welcome to modify and redistribute it under the GPL license.\n");
|
||||
printf("Usage: %s [OPTIONS] database [tables]\n", my_progname);
|
||||
printf("OR %s [OPTIONS] --databases DB1 [DB2 DB3...]\n",
|
||||
my_progname);
|
||||
printf("OR %s [OPTIONS] --all-databases\n\n", my_progname);
|
||||
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
|
||||
puts("This program can be used to CHECK (-c, -m, -C), REPAIR (-r), ANALYZE (-a),");
|
||||
puts("or OPTIMIZE (-o) tables. Some of the options (like -e or -q) can be");
|
||||
puts("used at the same time. Not all options are supported by all storage engines.");
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
|
||||
Copyright (c) 2010, 2012, Monty Program Ab.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -616,8 +617,7 @@ static void short_usage_sub(void)
|
||||
static void usage(void)
|
||||
{
|
||||
print_version();
|
||||
puts("By Igor Romanenko, Monty, Jani & Sinisa and others.");
|
||||
puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license.\n");
|
||||
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
|
||||
puts("Dumping structure and contents of MySQL databases and tables.");
|
||||
short_usage_sub();
|
||||
print_defaults("my",load_default_groups);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2000, 2011, Oracle and/or its affiliates.
|
||||
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
|
||||
|
||||
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
|
||||
@ -208,7 +208,8 @@ static void usage(void)
|
||||
puts("Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.");
|
||||
puts("Copyright 2008-2011 Oracle and Monty Program Ab.");
|
||||
print_version();
|
||||
printf("\n\
|
||||
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
|
||||
printf("\
|
||||
Loads tables from text files in various formats. The base name of the\n\
|
||||
text file must be the name of the table that should be used.\n\
|
||||
If one uses sockets to connect to the MySQL server, the server will open and\n\
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
Copyright (c) 2000, 2011, Oracle and/or its affiliates.
|
||||
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
|
||||
Copyright (c) 2010, 2012, Monty Program Ab
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -27,6 +28,7 @@
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
#include <sslopt-vars.h>
|
||||
#include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */
|
||||
|
||||
static char * host=0, *opt_password=0, *user=0;
|
||||
static my_bool opt_show_keys= 0, opt_compress= 0, opt_count=0, opt_status= 0;
|
||||
@ -266,9 +268,7 @@ static void print_version(void)
|
||||
static void usage(void)
|
||||
{
|
||||
print_version();
|
||||
puts("Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.");
|
||||
puts("Copyright 2008-2011 Oracle and Monty Program Ab.");
|
||||
puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license.\n");
|
||||
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
|
||||
puts("Shows the structure of a MySQL database (databases, tables, and columns).\n");
|
||||
printf("Usage: %s [OPTIONS] [database [table [column]]]\n",my_progname);
|
||||
puts("\n\
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2005, 2011, Oracle and/or its affiliates.
|
||||
Copyright (c) 2005, 2012, Oracle and/or its affiliates.
|
||||
|
||||
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
|
||||
@ -722,7 +722,7 @@ static void print_version(void)
|
||||
static void usage(void)
|
||||
{
|
||||
print_version();
|
||||
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2005, 2010"));
|
||||
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2005"));
|
||||
puts("Run a query multiple times against the server.\n");
|
||||
printf("Usage: %s [OPTIONS]\n",my_progname);
|
||||
print_defaults("my",load_default_groups);
|
||||
|
@ -54,6 +54,8 @@
|
||||
#include <signal.h>
|
||||
#include <my_stacktrace.h>
|
||||
|
||||
#include <welcome_copyright_notice.h> // ORACLE_WELCOME_COPYRIGHT_NOTICE
|
||||
|
||||
#ifdef __WIN__
|
||||
#include <crtdbg.h>
|
||||
#define SIGNAL_FMT "exception 0x%x"
|
||||
@ -6985,8 +6987,7 @@ void print_version(void)
|
||||
void usage()
|
||||
{
|
||||
print_version();
|
||||
printf("MySQL AB, by Sasha, Matt, Monty & Jani and others\n");
|
||||
printf("This software comes with ABSOLUTELY NO WARRANTY\n\n");
|
||||
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
|
||||
printf("Runs a test against the mysql server and compares output with a results file.\n\n");
|
||||
printf("Usage: %s [OPTIONS] [database] < test_file\n", my_progname);
|
||||
my_print_help(my_long_options);
|
||||
|
@ -1,8 +1,7 @@
|
||||
#ifndef SQL_STRING_INCLUDED
|
||||
#define SQL_STRING_INCLUDED
|
||||
|
||||
/*
|
||||
Copyright (c) 2000, 2010, Oracle and/or its affiliates
|
||||
/* Copyright (c) 2000, 2012, 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
|
||||
@ -194,8 +193,12 @@ public:
|
||||
}
|
||||
bool real_alloc(uint32 arg_length); // Empties old string
|
||||
bool realloc(uint32 arg_length);
|
||||
inline void shrink(uint32 arg_length) // Shrink buffer
|
||||
|
||||
// Shrink the buffer, but only if it is allocated on the heap.
|
||||
inline void shrink(uint32 arg_length)
|
||||
{
|
||||
if (!is_alloced())
|
||||
return;
|
||||
if (arg_length < Alloced_length)
|
||||
{
|
||||
char *new_ptr;
|
||||
@ -211,7 +214,7 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
bool is_alloced() { return alloced; }
|
||||
bool is_alloced() const { return alloced; }
|
||||
inline String& operator = (const String &s)
|
||||
{
|
||||
if (&s != this)
|
||||
|
@ -64,8 +64,10 @@ SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}
|
||||
|
||||
SET(CPACK_RPM_PACKAGE_REQUIRES "MariaDB-common")
|
||||
|
||||
SET(CPACK_RPM_server_USER_FILELIST "%ignore /etc" "%ignore /etc/init.d")
|
||||
SET(CPACK_RPM_server_USER_FILELIST "%ignore /etc" "%ignore /etc/init.d" "%config(noreplace) /etc/my.cnf.d/*")
|
||||
SET(CPACK_RPM_common_USER_FILELIST "%config(noreplace) /etc/my.cnf")
|
||||
SET(CPACK_RPM_shared_USER_FILELIST "%config(noreplace) /etc/my.cnf.d/*")
|
||||
SET(CPACK_RPM_client_USER_FILELIST "%config(noreplace) /etc/my.cnf.d/*")
|
||||
|
||||
SET(CPACK_RPM_client_PACKAGE_OBSOLETES "mysql-client MySQL-client MySQL-OurDelta-client")
|
||||
SET(CPACK_RPM_client_PACKAGE_PROVIDES "MariaDB-client MySQL-client mysql-client")
|
||||
@ -84,9 +86,10 @@ SET(CPACK_RPM_server_PACKAGE_PROVIDES "MariaDB MariaDB-server MySQL-server confi
|
||||
SET(CPACK_RPM_server_PRE_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-prein.sh)
|
||||
SET(CPACK_RPM_server_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-preun.sh)
|
||||
SET(CPACK_RPM_server_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-postin.sh)
|
||||
SET(CPACK_RPM_server_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-postun.sh)
|
||||
|
||||
SET(CPACK_RPM_shared_PACKAGE_OBSOLETES "mysql-shared MySQL-shared-standard MySQL-shared-pro MySQL-shared-pro-cert MySQL-shared-pro-gpl MySQL-shared-pro-gpl-cert MySQL-shared MySQL-OurDelta-shared")
|
||||
SET(CPACK_RPM_shared_PACKAGE_PROVIDES "MariaDB-shared MySQL-shared mysql-shared libmysqlclient.so.${SHARED_LIB_MAJOR_VERSION} libmysqlclient.so.${SHARED_LIB_MAJOR_VERSION}(libmysqlclient_${SHARED_LIB_MAJOR_VERSION}) libmysqlclient_r.so.${SHARED_LIB_MAJOR_VERSION} libmysqlclient_r.so.${SHARED_LIB_MAJOR_VERSION}(libmysqlclient_${SHARED_LIB_MAJOR_VERSION})")
|
||||
SET(CPACK_RPM_shared_PACKAGE_PROVIDES "MariaDB-shared MySQL-shared mysql-shared libmysqlclient.so.18 libmysqlclient.so.18(libmysqlclient_16) libmysqlclient.so.18(libmysqlclient_18) libmysqlclient_r.so.18 libmysqlclient_r.so.18(libmysqlclient_18)")
|
||||
SET(CPACK_RPM_shared_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/shared-post.sh)
|
||||
SET(CPACK_RPM_shared_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/shared-post.sh)
|
||||
|
||||
|
@ -67,7 +67,7 @@ IF(NOT "${MAJOR_VERSION}" MATCHES "[0-9]+" OR
|
||||
MARK_AS_ADVANCED(VERSION MYSQL_VERSION_ID MYSQL_BASE_VERSION)
|
||||
SET(CPACK_PACKAGE_VERSION_MAJOR ${MAJOR_VERSION})
|
||||
SET(CPACK_PACKAGE_VERSION_MINOR ${MINOR_VERSION})
|
||||
SET(CPACK_PACKAGE_VERSION_PATCH ${PATCH_VERSION})
|
||||
SET(CPACK_PACKAGE_VERSION_PATCH ${PATCH_VERSION}${EXTRA_VERSION})
|
||||
ENDMACRO()
|
||||
|
||||
# Get mysql version and other interesting variables
|
||||
|
@ -133,7 +133,6 @@ MACRO(MYSQL_ADD_PLUGIN)
|
||||
ENDIF()
|
||||
|
||||
ADD_LIBRARY(${target} STATIC ${SOURCES})
|
||||
SET_TARGET_PROPERTIES(${target} PROPERTIES COMPILE_DEFINITONS "MYSQL_SERVER")
|
||||
DTRACE_INSTRUMENT(${target})
|
||||
ADD_DEPENDENCIES(${target} GenError ${ARG_DEPENDENCIES})
|
||||
RESTRICT_SYMBOL_EXPORTS(${target})
|
||||
@ -146,7 +145,7 @@ MACRO(MYSQL_ADD_PLUGIN)
|
||||
DTRACE_INSTRUMENT(${target}_embedded)
|
||||
IF(ARG_RECOMPILE_FOR_EMBEDDED)
|
||||
SET_TARGET_PROPERTIES(${target}_embedded
|
||||
PROPERTIES COMPILE_DEFINITIONS "MYSQL_SERVER;EMBEDDED_LIBRARY")
|
||||
PROPERTIES COMPILE_DEFINITIONS "EMBEDDED_LIBRARY")
|
||||
ENDIF()
|
||||
ADD_DEPENDENCIES(${target}_embedded GenError)
|
||||
ENDIF()
|
||||
|
@ -25,7 +25,7 @@ MACRO (MYSQL_USE_BUNDLED_SSL)
|
||||
SET(SSL_LIBRARIES yassl taocrypt)
|
||||
SET(SSL_INCLUDE_DIRS ${INC_DIRS})
|
||||
SET(SSL_INTERNAL_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/mySTL)
|
||||
SET(SSL_DEFINES "-DHAVE_YASSL -DYASSL_PURE_C -DYASSL_PREFIX -DHAVE_OPENSSL -DYASSL_THREAD_SAFE")
|
||||
SET(SSL_DEFINES "-DHAVE_YASSL -DYASSL_PURE_C -DYASSL_PREFIX -DHAVE_OPENSSL -DMULTI_THREADED")
|
||||
CHANGE_SSL_SETTINGS("bundled")
|
||||
#Remove -fno-implicit-templates
|
||||
#(yassl sources cannot be compiled with it)
|
||||
|
1
debian/mariadb-client-5.5.files
vendored
1
debian/mariadb-client-5.5.files
vendored
@ -11,7 +11,6 @@ usr/bin/mysqlimport
|
||||
usr/bin/mysqlreport
|
||||
usr/bin/mysqlshow
|
||||
usr/bin/mysqlslap
|
||||
usr/bin/mytop
|
||||
usr/bin/mysql_waitpid
|
||||
usr/share/lintian/overrides/mariadb-client-5.5
|
||||
usr/share/man/man1/innotop.1
|
||||
|
@ -13,8 +13,8 @@
|
||||
fi
|
||||
|
||||
# Create database directories
|
||||
-for dir in $ldata $ldata/mysql $ldata/test
|
||||
+for dir in $ldata $ldata/mysql
|
||||
-for dir in "$ldata" "$ldata/mysql" "$ldata/test"
|
||||
+for dir in "$ldata" "$ldata/mysql"
|
||||
do
|
||||
if test ! -d $dir
|
||||
then
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2000, 2011, Oracle and/or its affiliates
|
||||
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
|
||||
|
||||
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
|
||||
@ -28,6 +28,7 @@
|
||||
#include "../storage/ndb/src/kernel/error/ndbd_exit_codes.c"
|
||||
#include "../storage/ndb/include/mgmapi/mgmapi_error.h"
|
||||
#endif
|
||||
#include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */
|
||||
|
||||
static my_bool verbose, print_all_codes;
|
||||
|
||||
@ -113,7 +114,7 @@ static void print_version(void)
|
||||
static void usage(void)
|
||||
{
|
||||
print_version();
|
||||
puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n");
|
||||
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
|
||||
printf("Print a description for a system error code or a MySQL error code.\n");
|
||||
printf("If you want to get the error for a negative error code, you should use\n-- before the first error code to tell perror that there was no more options.\n\n");
|
||||
printf("Usage: %s [OPTIONS] [ERRORCODE [ERRORCODE...]]\n",my_progname);
|
||||
|
@ -12,7 +12,16 @@ before calling SSL_new();
|
||||
|
||||
*** end Note ***
|
||||
|
||||
yaSSL Release notes, version 2.1.2 (9/2/2011)
|
||||
yaSSL Release notes, version 2.2.2 (7/5/2012)
|
||||
|
||||
This release of yaSSL contains bug fixes and more security checks around
|
||||
malicious certificates.
|
||||
|
||||
See normal build instructions below under 1.0.6.
|
||||
See libcurl build instructions below under 1.3.0 and note in 1.5.8.
|
||||
|
||||
|
||||
*****************yaSSL Release notes, version 2.1.2 (9/2/2011)
|
||||
|
||||
This release of yaSSL contains bug fixes, better non-blocking support with
|
||||
SSL_write, and OpenSSL RSA public key format support.
|
||||
|
@ -27,7 +27,7 @@
|
||||
Visual Studio Source Annotations header (sourceannotations.h) fails
|
||||
to compile if outside of the global namespace.
|
||||
*/
|
||||
#ifdef YASSL_THREAD_SAFE
|
||||
#ifdef MULTI_THREADED
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
@ -36,8 +36,9 @@
|
||||
namespace yaSSL {
|
||||
|
||||
|
||||
#ifdef YASSL_THREAD_SAFE
|
||||
#ifdef MULTI_THREADED
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
|
||||
class Mutex {
|
||||
CRITICAL_SECTION cs_;
|
||||
@ -77,7 +78,7 @@ namespace yaSSL {
|
||||
};
|
||||
|
||||
#endif // _WIN32
|
||||
#else // YASSL_THREAD_SAFE (WE'RE SINGLE)
|
||||
#else // MULTI_THREADED (WE'RE SINGLE)
|
||||
|
||||
class Mutex {
|
||||
public:
|
||||
@ -87,7 +88,7 @@ namespace yaSSL {
|
||||
};
|
||||
};
|
||||
|
||||
#endif // YASSL_THREAD_SAFE
|
||||
#endif // MULTI_THREADED
|
||||
|
||||
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "rsa.h"
|
||||
|
||||
|
||||
#define YASSL_VERSION "2.2.0"
|
||||
#define YASSL_VERSION "2.2.2"
|
||||
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
@ -65,7 +65,7 @@ enum YasslError {
|
||||
enum Library { yaSSL_Lib = 0, CryptoLib, SocketLib };
|
||||
enum { MAX_ERROR_SZ = 80 };
|
||||
|
||||
void SetErrorString(unsigned long, char*);
|
||||
void SetErrorString(YasslError, char*);
|
||||
|
||||
/* remove for now, if go back to exceptions use this wrapper
|
||||
// Base class for all yaSSL exceptions
|
||||
|
@ -250,8 +250,7 @@ int CertManager::Validate()
|
||||
TaoCrypt::Source source((*last)->get_buffer(), (*last)->get_length());
|
||||
TaoCrypt::CertDecoder cert(source, true, &signers_, verifyNone_);
|
||||
|
||||
int err = cert.GetError().What();
|
||||
if ( err )
|
||||
if (int err = cert.GetError().What())
|
||||
return err;
|
||||
|
||||
const TaoCrypt::PublicKey& key = cert.GetPublicKey();
|
||||
|
@ -26,7 +26,7 @@
|
||||
namespace yaSSL {
|
||||
|
||||
|
||||
#ifdef YASSL_THREAD_SAFE
|
||||
#ifdef MULTI_THREADED
|
||||
#ifdef _WIN32
|
||||
|
||||
Mutex::Mutex()
|
||||
@ -79,7 +79,7 @@ namespace yaSSL {
|
||||
|
||||
|
||||
#endif // _WIN32
|
||||
#endif // YASSL_THREAD_SAFE
|
||||
#endif // MULTI_THREADED
|
||||
|
||||
|
||||
|
||||
|
@ -27,7 +27,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
/* see man pages for function descriptions */
|
||||
|
||||
#include "runtime.hpp"
|
||||
@ -747,7 +746,7 @@ void SSL_CTX_set_verify(SSL_CTX* ctx, int mode, VerifyCallback vc)
|
||||
int SSL_CTX_load_verify_locations(SSL_CTX* ctx, const char* file,
|
||||
const char* path)
|
||||
{
|
||||
int ret = SSL_SUCCESS;
|
||||
int ret = SSL_FAILURE;
|
||||
const int HALF_PATH = 128;
|
||||
|
||||
if (file) ret = read_file(ctx, file, SSL_FILETYPE_PEM, CA);
|
||||
@ -1014,7 +1013,7 @@ char* ERR_error_string(unsigned long errNumber, char* buffer)
|
||||
static char* msg = (char*)"Please supply a buffer for error string";
|
||||
|
||||
if (buffer) {
|
||||
SetErrorString(errNumber, buffer);
|
||||
SetErrorString(YasslError(errNumber), buffer);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
@ -31,11 +31,6 @@
|
||||
#pragma warning(disable: 4996)
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// 4996 warning to use MS extensions e.g., strcpy_s instead of strncpy
|
||||
#pragma warning(disable: 4996)
|
||||
#endif
|
||||
|
||||
namespace yaSSL {
|
||||
|
||||
|
||||
@ -60,7 +55,7 @@ Library Error::get_lib() const
|
||||
*/
|
||||
|
||||
|
||||
void SetErrorString(unsigned long error, char* buffer)
|
||||
void SetErrorString(YasslError error, char* buffer)
|
||||
{
|
||||
using namespace TaoCrypt;
|
||||
const int max = MAX_ERROR_SZ; // shorthand
|
||||
|
@ -92,7 +92,6 @@ typedef BlockCipher<ENCRYPTION, AES, CBC> AES_CBC_Encryption;
|
||||
typedef BlockCipher<DECRYPTION, AES, CBC> AES_CBC_Decryption;
|
||||
|
||||
|
||||
|
||||
} // naemspace
|
||||
|
||||
#endif // TAO_CRYPT_AES_HPP
|
||||
|
@ -136,9 +136,13 @@ void CleanUp();
|
||||
|
||||
// Turn on ia32 ASM for Big Integer
|
||||
// CodeWarrior defines _MSC_VER
|
||||
//
|
||||
// Do not use assembler with GCC, as the implementation for it is broken;
|
||||
// it does not use proper GCC asm contraints and makes assumptions about
|
||||
// frame pointers and so on, which breaks depending on GCC version and
|
||||
// optimization level.
|
||||
#if !defined(TAOCRYPT_DISABLE_X86ASM) && ((defined(_MSC_VER) && \
|
||||
!defined(__MWERKS__) && defined(_M_IX86)) || \
|
||||
(defined(__GNUC__) && defined(__i386__)))
|
||||
!defined(__MWERKS__) && defined(_M_IX86)))
|
||||
#define TAOCRYPT_X86ASM_AVAILABLE
|
||||
#endif
|
||||
|
||||
|
@ -48,9 +48,11 @@ word32 PBKDF2_HMAC<T>::DeriveKey(byte* derived, word32 dLen, const byte* pwd,
|
||||
word32 pLen, const byte* salt, word32 sLen,
|
||||
word32 iterations) const
|
||||
{
|
||||
if (dLen > MaxDerivedKeyLength())
|
||||
if (dLen > MaxDerivedKeyLength())
|
||||
return 0;
|
||||
|
||||
if (iterations < 0)
|
||||
return 0;
|
||||
|
||||
ByteBlock buffer(T::DIGEST_SIZE);
|
||||
HMAC<T> hmac;
|
||||
|
@ -154,6 +154,8 @@ word32 GetLength(Source& source)
|
||||
else
|
||||
length = b;
|
||||
|
||||
if (source.IsLeft(length) == false) return 0;
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
@ -832,7 +834,7 @@ void CertDecoder::GetName(NameType nt)
|
||||
if (email) {
|
||||
if (!(ptr = AddTag(ptr, buf_end, "/emailAddress=", 14, length))) {
|
||||
source_.SetError(CONTENT_E);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,6 +103,16 @@ void HexDecoder::Decode()
|
||||
byte b = coded_.next() - 0x30; // 0 starts at 0x30
|
||||
byte b2 = coded_.next() - 0x30;
|
||||
|
||||
// sanity checks
|
||||
if (b >= sizeof(hexDecode)/sizeof(hexDecode[0])) {
|
||||
coded_.SetError(PEM_E);
|
||||
return;
|
||||
}
|
||||
if (b2 >= sizeof(hexDecode)/sizeof(hexDecode[0])) {
|
||||
coded_.SetError(PEM_E);
|
||||
return;
|
||||
}
|
||||
|
||||
b = hexDecode[b];
|
||||
b2 = hexDecode[b2];
|
||||
|
||||
@ -178,6 +188,7 @@ void Base64Decoder::Decode()
|
||||
{
|
||||
word32 bytes = coded_.size();
|
||||
word32 plainSz = bytes - ((bytes + (pemLineSz - 1)) / pemLineSz);
|
||||
const byte maxIdx = (byte)sizeof(base64Decode) + 0x2B - 1;
|
||||
plainSz = ((plainSz * 3) / 4) + 3;
|
||||
decoded_.New(plainSz);
|
||||
|
||||
@ -200,6 +211,16 @@ void Base64Decoder::Decode()
|
||||
if (e4 == pad)
|
||||
pad4 = true;
|
||||
|
||||
if (e1 < 0x2B || e2 < 0x2B || e3 < 0x2B || e4 < 0x2B) {
|
||||
coded_.SetError(PEM_E);
|
||||
return;
|
||||
}
|
||||
|
||||
if (e1 > maxIdx || e2 > maxIdx || e3 > maxIdx || e4 > maxIdx) {
|
||||
coded_.SetError(PEM_E);
|
||||
return;
|
||||
}
|
||||
|
||||
e1 = base64Decode[e1 - 0x2B];
|
||||
e2 = base64Decode[e2 - 0x2B];
|
||||
e3 = (e3 == pad) ? 0 : base64Decode[e3 - 0x2B];
|
||||
|
@ -1,37 +0,0 @@
|
||||
/*
|
||||
Copyright (C) 2000-2007 MySQL AB
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
|
||||
MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
/* put features that other apps expect from OpenSSL type crypto */
|
||||
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
// for libcurl configure test, these are the signatures they use
|
||||
// locking handled internally by library
|
||||
char CRYPTO_lock() { return 0;}
|
||||
char CRYPTO_add_lock() { return 0;}
|
||||
|
||||
|
||||
// for openvpn, test are the signatures they use
|
||||
char EVP_CIPHER_CTX_init() { return 0; }
|
||||
char CRYPTO_mem_ctrl() { return 0; }
|
||||
} // extern "C"
|
||||
|
||||
|
||||
|
@ -3,6 +3,21 @@ Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "benchmark"=.\benchmark\benchmark.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name taocrypt
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "taocrypt"=.\taocrypt.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
@ -15,7 +30,7 @@ Package=<4>
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "test"=.\test.dsp - Package Owner=<4>
|
||||
Project: "test"=.\test\test.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
|
@ -31,7 +31,7 @@
|
||||
To use MemoryTracker merely add this file to your project
|
||||
No need to instantiate anything
|
||||
|
||||
If your app is multi threaded define YASSL_THREAD_SAFE
|
||||
If your app is multi threaded define MULTI_THREADED
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
|
@ -37,12 +37,12 @@ RSC=rc.exe
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "test\Release"
|
||||
# PROP Intermediate_Dir "test\Release"
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /O2 /I "include" /I "mySTL" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /O2 /I "../include" /I "../mySTL" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
@ -61,12 +61,12 @@ LINK32=link.exe
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "test\Debug"
|
||||
# PROP Intermediate_Dir "test\Debug"
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /I "include" /I "mySTL" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../include" /I "../mySTL" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
@ -87,7 +87,7 @@ LINK32=link.exe
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\test\test.cpp
|
||||
SOURCE=.\test.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
@ -90,7 +90,7 @@ Package=<4>
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "test"=.\taocrypt\test.dsp - Package Owner=<4>
|
||||
Project: "test"=.\taocrypt\test\test.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
@ -113,9 +113,6 @@ Package=<5>
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name taocrypt
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name yassl
|
||||
End Project Dependency
|
||||
|
@ -283,6 +283,9 @@ enum ha_base_keytype {
|
||||
#define HA_USES_BLOCK_SIZE ((uint) 32768)
|
||||
#define HA_SORT_ALLOWS_SAME 512 /* Intern bit when sorting records */
|
||||
|
||||
/* This flag can be used only in KEY::ext_key_flags */
|
||||
#define HA_EXT_NOSAME 131072
|
||||
|
||||
/* These flags can be added to key-seg-flag */
|
||||
|
||||
#define HA_SPACE_PACK 1 /* Pack space in key-seg */
|
||||
|
@ -47,9 +47,6 @@ extern "C" {
|
||||
#ifndef MYSQL_ABI_CHECK
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef __LCC__
|
||||
#include <winsock2.h> /* For windows */
|
||||
#endif
|
||||
typedef char my_bool;
|
||||
#if (defined(_WIN32) || defined(_WIN64)) && !defined(__WIN__)
|
||||
#define __WIN__
|
||||
@ -61,11 +58,13 @@ typedef char my_bool;
|
||||
#endif
|
||||
|
||||
#ifndef my_socket_defined
|
||||
#ifdef __WIN__
|
||||
#define my_socket SOCKET
|
||||
#if defined (_WIN64)
|
||||
#define my_socket unsigned long long
|
||||
#elif defined (_WIN32)
|
||||
#define my_socket unsigned int
|
||||
#else
|
||||
typedef int my_socket;
|
||||
#endif /* __WIN__ */
|
||||
#endif /* _WIN64 */
|
||||
#endif /* my_socket_defined */
|
||||
#endif /* _global_h */
|
||||
|
||||
@ -848,6 +847,7 @@ int STDCALL mysql_close_start(MYSQL *sock);
|
||||
int STDCALL mysql_close_cont(MYSQL *sock, int status);
|
||||
my_socket STDCALL mysql_get_socket(const MYSQL *mysql);
|
||||
unsigned int STDCALL mysql_get_timeout_value(const MYSQL *mysql);
|
||||
unsigned int STDCALL mysql_get_timeout_value_ms(const MYSQL *mysql);
|
||||
|
||||
/* status return codes */
|
||||
#define MYSQL_NO_DATA 100
|
||||
|
@ -729,3 +729,4 @@ int mysql_close_start(MYSQL *sock);
|
||||
int mysql_close_cont(MYSQL *sock, int status);
|
||||
my_socket mysql_get_socket(const MYSQL *mysql);
|
||||
unsigned int mysql_get_timeout_value(const MYSQL *mysql);
|
||||
unsigned int mysql_get_timeout_value_ms(const MYSQL *mysql);
|
||||
|
@ -57,9 +57,6 @@
|
||||
#define LOCAL_HOST "localhost"
|
||||
#define LOCAL_HOST_NAMEDPIPE "."
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
|
||||
#if defined(__WIN__) && !defined( _CUSTOMCONFIG_)
|
||||
#define MYSQL_NAMEDPIPE "MySQL"
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <debug_sync.h>
|
||||
#include <sql_profile.h>
|
||||
#include <table.h>
|
||||
#include <sql_list.h>
|
||||
|
||||
/* Needed to get access to scheduler variables */
|
||||
void* thd_get_scheduler_data(THD *thd);
|
||||
@ -56,9 +57,14 @@ void thd_unlock_data(THD *thd);
|
||||
bool thd_is_transaction_active(THD *thd);
|
||||
int thd_connection_has_data(THD *thd);
|
||||
void thd_set_net_read_write(THD *thd, uint val);
|
||||
uint thd_get_net_read_write(THD *thd);
|
||||
void thd_set_mysys_var(THD *thd, st_my_thread_var *mysys_var);
|
||||
ulong thd_get_net_wait_timeout(THD *thd);
|
||||
my_socket thd_get_fd(THD *thd);
|
||||
|
||||
THD *first_global_thread();
|
||||
THD *next_global_thread(THD *thd);
|
||||
|
||||
/* Print to the MySQL error log */
|
||||
void sql_print_error(const char *format, ...);
|
||||
|
||||
|
@ -177,6 +177,12 @@ void vio_end(void);
|
||||
#endif /* !defined(DONT_MAP_VIO) */
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
/* shutdown(2) flags */
|
||||
#ifndef SHUT_RD
|
||||
#define SHUT_RD SD_BOTH
|
||||
#endif
|
||||
|
||||
/*
|
||||
Set thread id for io cancellation (required on Windows XP only,
|
||||
and should to be removed if XP is no more supported)
|
||||
|
@ -1,4 +1,5 @@
|
||||
/* Copyright (c) 2010, 2011, Oracle and/or its affiliates.
|
||||
/* Copyright (c) 2011, 2012, Oracle and/or its affiliates.
|
||||
Copyright (c) 2011, 2012, Monty Program Ab
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -16,11 +17,14 @@
|
||||
#ifndef _welcome_copyright_notice_h_
|
||||
#define _welcome_copyright_notice_h_
|
||||
|
||||
#define COPYRIGHT_NOTICE_CURRENT_YEAR "2012"
|
||||
|
||||
/*
|
||||
This define specifies copyright notice which is displayed by every MySQL
|
||||
program on start, or on help screen.
|
||||
*/
|
||||
#define ORACLE_WELCOME_COPYRIGHT_NOTICE(years) \
|
||||
"Copyright (c) " years ", Oracle, Monty Program Ab and others.\n"
|
||||
#define ORACLE_WELCOME_COPYRIGHT_NOTICE(first_year) \
|
||||
"Copyright (c) " first_year ", " COPYRIGHT_NOTICE_CURRENT_YEAR \
|
||||
", Oracle, Monty Program Ab and others.\n"
|
||||
|
||||
#endif /* _welcome_copyright_notice_h_ */
|
||||
|
@ -1004,7 +1004,7 @@ bool Protocol::send_result_set_metadata(List<Item> *list, uint flags)
|
||||
thd_cs->mbmaxlen);
|
||||
}
|
||||
client_field->type= server_field.type;
|
||||
client_field->flags= server_field.flags;
|
||||
client_field->flags= (uint16) server_field.flags;
|
||||
client_field->decimals= server_field.decimals;
|
||||
client_field->db_length= strlen(client_field->db);
|
||||
client_field->table_length= strlen(client_field->table);
|
||||
|
@ -4,6 +4,9 @@ plugin-load=$HA_INNODB_SO
|
||||
innodb
|
||||
innodb-cmpmem
|
||||
innodb-trx
|
||||
innodb-buffer-pool-stats
|
||||
innodb-buffer-page
|
||||
innodb-buffer-page-lru
|
||||
|
||||
[xtradb_plugin]
|
||||
ignore-builtin-innodb
|
||||
@ -11,8 +14,14 @@ plugin-load=$HA_XTRADB_SO
|
||||
innodb
|
||||
innodb-cmpmem
|
||||
innodb-trx
|
||||
innodb-buffer-pool-stats
|
||||
innodb-buffer-page
|
||||
innodb-buffer-page-lru
|
||||
|
||||
[xtradb]
|
||||
innodb
|
||||
innodb-cmpmem
|
||||
innodb-trx
|
||||
innodb-buffer-pool-stats
|
||||
innodb-buffer-page
|
||||
innodb-buffer-page-lru
|
||||
|
@ -97,7 +97,6 @@ INSERT INTO global_suppressions VALUES
|
||||
("Failed to open log"),
|
||||
("Failed to open the existing master info file"),
|
||||
("Forcing shutdown of [0-9]* plugins"),
|
||||
("Forcing close of thread"),
|
||||
|
||||
/*
|
||||
Due to timing issues, it might be that this warning
|
||||
|
@ -282,4 +282,74 @@ CREATE TABLE t1 ( i INT );
|
||||
INSERT INTO t1 VALUES ( (SELECT 1 FROM ( SELECT * FROM t1 ) as a) );
|
||||
drop table t1;
|
||||
set optimizer_switch=@save_optimizer_switch;
|
||||
#
|
||||
# MDEV-3801 Reproducible sub select join crash on 5.3.8 and 5.3.9
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
pk int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
a char(2) DEFAULT NULL,
|
||||
PRIMARY KEY (pk),
|
||||
KEY a (a)
|
||||
) ENGINE=MyISAM;
|
||||
INSERT INTO t1 (a)
|
||||
VALUES (NULL),(NULL),(NULL),('AB'),(NULL),('CD'),(NULL),(NULL);
|
||||
INSERT INTO t1 SELECT NULL, a1.a FROM t1 a1, t1 a2, t1 a3, t1 a4, t1 a5;
|
||||
CREATE TABLE t2 (
|
||||
pk int(10) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY
|
||||
) ENGINE=MyISAM;
|
||||
INSERT INTO t2 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
|
||||
INSERT INTO t2 SELECT NULL FROM t2 a1, t2 a2, t2 a3, t2 a4, t2 a5;
|
||||
CREATE TABLE t3 (
|
||||
pk int(10) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY
|
||||
) ENGINE=MyISAM;
|
||||
INSERT INTO t3 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
|
||||
INSERT INTO t3 SELECT NULL FROM t3 a1, t3 a2, t3 a3, t3 a4, t3 a5;
|
||||
CREATE TABLE t4 (
|
||||
a char(2) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (a)
|
||||
) ENGINE=MyISAM;
|
||||
INSERT INTO t4 VALUES ('CD');
|
||||
set @@tmp_table_size=8192;
|
||||
EXPLAIN
|
||||
SELECT * FROM t3 AS tx JOIN t2 AS ty ON (tx.pk = ty.pk)
|
||||
WHERE
|
||||
tx.pk IN
|
||||
(SELECT *
|
||||
FROM (SELECT DISTINCT ta.pk
|
||||
FROM t3 AS ta
|
||||
JOIN t2 AS tb ON (ta.pk = tb.pk)
|
||||
JOIN t1 AS tc ON (tb.pk = tc.pk)
|
||||
JOIN t4 AS td ON tc.a = td.a) tu)
|
||||
limit 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL #
|
||||
1 PRIMARY tx eq_ref PRIMARY PRIMARY 4 tu.pk # Using index
|
||||
1 PRIMARY ty eq_ref PRIMARY PRIMARY 4 tu.pk # Using index
|
||||
2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL #
|
||||
3 DERIVED td system PRIMARY NULL NULL NULL # Using temporary
|
||||
3 DERIVED tc ref PRIMARY,a a 3 const #
|
||||
3 DERIVED ta eq_ref PRIMARY PRIMARY 4 test.tc.pk # Using index
|
||||
3 DERIVED tb eq_ref PRIMARY PRIMARY 4 test.tc.pk # Using index; Distinct
|
||||
SELECT * FROM t3 AS tX JOIN t2 AS tY ON (tX.pk = tY.pk)
|
||||
WHERE
|
||||
tX.pk IN
|
||||
(SELECT *
|
||||
FROM (SELECT DISTINCT tA.pk
|
||||
FROM t3 AS tA
|
||||
JOIN t2 AS tB ON (tA.pk = tB.pk)
|
||||
JOIN t1 AS tC ON (tB.pk = tC.pk)
|
||||
JOIN t4 AS tD ON tC.a = tD.a) tU)
|
||||
limit 10;
|
||||
pk pk
|
||||
6 6
|
||||
16 16
|
||||
24 24
|
||||
32 32
|
||||
40 40
|
||||
48 48
|
||||
56 56
|
||||
64 64
|
||||
72 72
|
||||
80 80
|
||||
drop table t1, t2, t3, t4;
|
||||
set optimizer_switch=@exit_optimizer_switch;
|
||||
|
@ -1687,6 +1687,7 @@ SELECT t.b, t.c, t1.a
|
||||
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
|
||||
WHERE t.b AND t.c = t1.a;
|
||||
b c a
|
||||
8 c c
|
||||
EXPLAIN EXTENDED
|
||||
SELECT t.b, t.c, t1.a
|
||||
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
|
||||
@ -1701,6 +1702,7 @@ SELECT t.b, t.c, t1.a
|
||||
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
|
||||
WHERE t.b <> 0 AND t.c = t1.a;
|
||||
b c a
|
||||
8 c c
|
||||
INSERT INTO t3 VALUES (100), (200);
|
||||
EXPLAIN EXTENDED
|
||||
SELECT t.b, t.c, t1.a
|
||||
@ -1716,7 +1718,7 @@ SELECT t.b, t.c, t1.a
|
||||
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
|
||||
WHERE t.b AND t.c = t1.a;
|
||||
b c a
|
||||
NULL NULL c
|
||||
8 c c
|
||||
EXPLAIN EXTENDED
|
||||
SELECT t.b, t.c, t1.a
|
||||
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
|
||||
@ -1731,7 +1733,7 @@ SELECT t.b, t.c, t1.a
|
||||
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
|
||||
WHERE t.b <> 0 AND t.c = t1.a;
|
||||
b c a
|
||||
NULL NULL c
|
||||
8 c c
|
||||
SET optimizer_switch=@save_optimizer_switch;
|
||||
DROP TABLE t1,t2,t3;
|
||||
#
|
||||
|
@ -2867,3 +2867,16 @@ SET @@global.max_allowed_packet:= @tmp_max;
|
||||
#
|
||||
# End of 5.5 tests
|
||||
#
|
||||
SELECT @tmp_max:= @@global.max_allowed_packet;
|
||||
@tmp_max:= @@global.max_allowed_packet
|
||||
1048576
|
||||
SET @@global.max_allowed_packet=1024*1024*1024;
|
||||
SELECT @@global.max_allowed_packet;
|
||||
@@global.max_allowed_packet
|
||||
1073741824
|
||||
SELECT CHAR_LENGTH(EXPORT_SET(1,1,1,REPEAT(1,100000000)));
|
||||
CHAR_LENGTH(EXPORT_SET(1,1,1,REPEAT(1,100000000)))
|
||||
NULL
|
||||
Warnings:
|
||||
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
|
||||
SET @@global.max_allowed_packet:= @tmp_max;
|
||||
|
@ -2119,6 +2119,17 @@ FROM t2
|
||||
GROUP BY 1;
|
||||
a
|
||||
DROP TABLE t1, t2;
|
||||
FLUSH STATUS;
|
||||
CREATE TABLE t1 (f1 INT, f2 decimal(20,1), f3 blob);
|
||||
INSERT INTO t1 values(11,NULL,'blob'),(11,NULL,'blob');
|
||||
SELECT f3, MIN(f2) FROM t1 GROUP BY f1 LIMIT 1;
|
||||
f3 MIN(f2)
|
||||
blob NULL
|
||||
DROP TABLE t1;
|
||||
the value below *must* be 1
|
||||
show status like 'Created_tmp_disk_tables';
|
||||
Variable_name Value
|
||||
Created_tmp_disk_tables 1
|
||||
# End of 5.3 tests
|
||||
#
|
||||
# Bug#49771: Incorrect MIN (date) when minimum value is 0000-00-00
|
||||
|
@ -1678,6 +1678,12 @@ SELECT length(CAST(b AS CHAR)) FROM ubig;
|
||||
length(CAST(b AS CHAR))
|
||||
20
|
||||
DROP TABLE ubig;
|
||||
select 1 from information_schema.tables where table_schema=repeat('a', 2000);
|
||||
1
|
||||
grant usage on *.* to mysqltest_1@localhost;
|
||||
select 1 from information_schema.tables where table_schema=repeat('a', 2000);
|
||||
1
|
||||
drop user mysqltest_1@localhost;
|
||||
End of 5.1 tests.
|
||||
#
|
||||
# Additional test for WL#3726 "DDL locking for all metadata objects"
|
||||
|
@ -16,6 +16,7 @@ INDEX_STATISTICS
|
||||
INNODB_BUFFER_POOL_PAGES
|
||||
INNODB_BUFFER_POOL_PAGES_BLOB
|
||||
INNODB_BUFFER_POOL_PAGES_INDEX
|
||||
INNODB_CHANGED_PAGES
|
||||
INNODB_CMP
|
||||
INNODB_CMPMEM
|
||||
INNODB_CMPMEM_RESET
|
||||
@ -88,6 +89,7 @@ INDEX_STATISTICS TABLE_SCHEMA
|
||||
INNODB_BUFFER_POOL_PAGES page_type
|
||||
INNODB_BUFFER_POOL_PAGES_BLOB space_id
|
||||
INNODB_BUFFER_POOL_PAGES_INDEX index_id
|
||||
INNODB_CHANGED_PAGES space_id
|
||||
INNODB_CMP page_size
|
||||
INNODB_CMPMEM page_size
|
||||
INNODB_CMPMEM_RESET page_size
|
||||
@ -160,6 +162,7 @@ INDEX_STATISTICS TABLE_SCHEMA
|
||||
INNODB_BUFFER_POOL_PAGES page_type
|
||||
INNODB_BUFFER_POOL_PAGES_BLOB space_id
|
||||
INNODB_BUFFER_POOL_PAGES_INDEX index_id
|
||||
INNODB_CHANGED_PAGES space_id
|
||||
INNODB_CMP page_size
|
||||
INNODB_CMPMEM page_size
|
||||
INNODB_CMPMEM_RESET page_size
|
||||
@ -238,6 +241,7 @@ INDEX_STATISTICS information_schema.INDEX_STATISTICS 1
|
||||
INNODB_BUFFER_POOL_PAGES information_schema.INNODB_BUFFER_POOL_PAGES 1
|
||||
INNODB_BUFFER_POOL_PAGES_BLOB information_schema.INNODB_BUFFER_POOL_PAGES_BLOB 1
|
||||
INNODB_BUFFER_POOL_PAGES_INDEX information_schema.INNODB_BUFFER_POOL_PAGES_INDEX 1
|
||||
INNODB_CHANGED_PAGES information_schema.INNODB_CHANGED_PAGES 1
|
||||
INNODB_CMP information_schema.INNODB_CMP 1
|
||||
INNODB_CMPMEM information_schema.INNODB_CMPMEM 1
|
||||
INNODB_CMPMEM_RESET information_schema.INNODB_CMPMEM_RESET 1
|
||||
@ -299,6 +303,7 @@ Database: information_schema
|
||||
| INNODB_BUFFER_POOL_PAGES |
|
||||
| INNODB_BUFFER_POOL_PAGES_BLOB |
|
||||
| INNODB_BUFFER_POOL_PAGES_INDEX |
|
||||
| INNODB_CHANGED_PAGES |
|
||||
| INNODB_CMP |
|
||||
| INNODB_CMPMEM |
|
||||
| INNODB_CMPMEM_RESET |
|
||||
@ -361,6 +366,7 @@ Database: INFORMATION_SCHEMA
|
||||
| INNODB_BUFFER_POOL_PAGES |
|
||||
| INNODB_BUFFER_POOL_PAGES_BLOB |
|
||||
| INNODB_BUFFER_POOL_PAGES_INDEX |
|
||||
| INNODB_CHANGED_PAGES |
|
||||
| INNODB_CMP |
|
||||
| INNODB_CMPMEM |
|
||||
| INNODB_CMPMEM_RESET |
|
||||
@ -411,5 +417,5 @@ Wildcard: inf_rmation_schema
|
||||
| information_schema |
|
||||
SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA;
|
||||
table_schema count(*)
|
||||
information_schema 57
|
||||
information_schema 58
|
||||
mysql 23
|
||||
|
@ -613,6 +613,26 @@ Handler_read_prev 0
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_deleted 0
|
||||
Handler_read_rnd_next 0
|
||||
#
|
||||
# Bug mdev-3851: ref access used instead of expected eq_ref access
|
||||
# when extended_keys=on
|
||||
#
|
||||
create table t0 (a int);
|
||||
insert into t0 values (1), (2), (3), (4), (5);
|
||||
create index i_p_size on part(p_size);
|
||||
set optimizer_switch='extended_keys=on';
|
||||
explain
|
||||
select * from t0, part ignore index (primary)
|
||||
where p_partkey=t0.a and p_size=1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 ALL NULL NULL NULL NULL 5 Using where
|
||||
1 SIMPLE part eq_ref i_p_size i_p_size 9 const,dbt3_s001.t0.a 1
|
||||
select * from t0, part ignore index (primary)
|
||||
where p_partkey=t0.a and p_size=1;
|
||||
a p_partkey p_name p_mfgr p_brand p_type p_size p_container p_retailprice p_comment
|
||||
2 2 blush rosy metallic lemon navajo Manufacturer#1 Brand#13 LARGE BRUSHED BRASS 1 LG CASE 902 final platelets hang f
|
||||
drop table t0;
|
||||
drop index i_p_size on part;
|
||||
DROP DATABASE dbt3_s001;
|
||||
use test;
|
||||
#
|
||||
@ -724,5 +744,33 @@ SELECT * FROM t1, t2 WHERE b=a;
|
||||
a b
|
||||
set optimizer_switch=@save_optimizer_switch;
|
||||
DROP TABLE t1,t2;
|
||||
#
|
||||
# Bug mdev-3888: INSERT with UPDATE on duplicate keys
|
||||
# with extended_keys=on
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
c1 bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
c2 bigint(20) unsigned NOT NULL,
|
||||
c3 bigint(20) unsigned NOT NULL,
|
||||
c4 varchar(128) DEFAULT NULL,
|
||||
PRIMARY KEY (c1),
|
||||
UNIQUE KEY uq (c2,c3),
|
||||
KEY c3 (c3),
|
||||
KEY c4 (c4)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
|
||||
set @save_optimizer_switch=@@optimizer_switch;
|
||||
set session optimizer_switch='extended_keys=off';
|
||||
INSERT INTO t1 (c2, c3, c4) VALUES (58291525, 2580, 'foobar')
|
||||
ON DUPLICATE KEY UPDATE c4 = VALUES(c4);
|
||||
INSERT INTO t1 (c2, c3, c4) VALUES (58291525, 2580, 'foobar')
|
||||
ON DUPLICATE KEY UPDATE c4 = VALUES(c4);
|
||||
DELETE FROM t1;
|
||||
set session optimizer_switch='extended_keys=on';
|
||||
INSERT INTO t1 (c2, c3, c4) VALUES (58291525, 2580, 'foobar')
|
||||
ON DUPLICATE KEY UPDATE c4 = VALUES(c4);
|
||||
INSERT INTO t1 (c2, c3, c4) VALUES (58291525, 2580, 'foobar')
|
||||
ON DUPLICATE KEY UPDATE c4 = VALUES(c4);
|
||||
set optimizer_switch=@save_optimizer_switch;
|
||||
DROP TABLE t1;
|
||||
set optimizer_switch=@save_ext_key_optimizer_switch;
|
||||
SET SESSION STORAGE_ENGINE=DEFAULT;
|
||||
|
@ -5589,4 +5589,52 @@ set join_buffer_size=default;
|
||||
set join_cache_level=default;
|
||||
set optimizer_switch=@tmp_optimizer_switch;
|
||||
DROP TABLE t1,t2,t3;
|
||||
#
|
||||
# Bug #1058071: LEFT JOIN using blobs
|
||||
# (mdev-564) when join buffer size is small
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
col269 decimal(31,10) unsigned DEFAULT NULL,
|
||||
col280 multipoint DEFAULT NULL,
|
||||
col281 tinyint(1) DEFAULT NULL,
|
||||
col282 time NOT NULL,
|
||||
col284 datetime DEFAULT NULL,
|
||||
col286 date DEFAULT NULL,
|
||||
col287 datetime DEFAULT NULL,
|
||||
col288 decimal(30,29) DEFAULT NULL,
|
||||
col291 time DEFAULT NULL,
|
||||
col292 time DEFAULT NULL
|
||||
) ENGINE=Aria;
|
||||
INSERT INTO t1 VALUES
|
||||
(0.0,PointFromText('POINT(9 0)'),0,'11:24:05','2013-04-14 21:30:28',NULL,'2011-12-20 06:00:34',9.9,'13:04:39',NULL),
|
||||
(0.0,NULL,127,'05:43:12','2012-09-05 06:15:27','2027-01-01','2011-10-29 10:48:29',0.0,'06:24:05','11:33:37'),
|
||||
(0.0,NULL,127,'12:54:41','2013-01-12 11:32:58','2011-11-03','2013-01-03 02:00:34',00,'11:54:15','20:19:15'),
|
||||
(0.0,PointFromText('POINT(9 0)'),0,'19:48:07','2012-07-16 15:45:25','2012-03-25','2013-09-07 17:21:52',0.5,'17:36:54','21:24:19'),
|
||||
(0.0,PointFromText('POINT(9 0)'),0,'03:43:48','2012-09-28 00:00:00','2012-06-26','2011-11-16 05:01:09',00,'01:25:42','19:30:06'),
|
||||
(0.0,LineStringFromText('LINESTRING(0 0,9 9,0 0,9 0,0 0)'),127,'11:33:21','2012-03-31 10:29:22','2012-10-10','2012-04-21 19:21:06',NULL,'05:13:22','09:48:34'),
|
||||
(NULL,PointFromText('POINT(9 0)'),127,'00:00:00','0000-00-00','2012-04-04 21:26:12','2013-03-04',0.0,'12:54:30',NULL),
|
||||
(NULL,PointFromText('POINT(9 0)'),1,'00:00:00','2013-05-01 22:37:49','2013-06-26','2012-09-22 17:31:03',0.0,'08:09:57','11:15:36');
|
||||
Warnings:
|
||||
Note 1265 Data truncated for column 'col286' at row 7
|
||||
CREATE TABLE t2 (b int) ENGINE=Aria;
|
||||
INSERT INTO t2 VALUES (NULL);
|
||||
CREATE TABLE t3 (c int) ENGINE=Aria;
|
||||
INSERT INTO t3 VALUES (NULL);
|
||||
set @tmp_optimizer_switch=@@optimizer_switch;
|
||||
set optimizer_switch = 'outer_join_with_cache=on,join_cache_incremental=on';
|
||||
set join_buffer_size=128;
|
||||
EXPLAIN
|
||||
SELECT 1 AS c FROM t1 NATURAL LEFT JOIN t2 LEFT OUTER JOIN t3 ON 1
|
||||
GROUP BY elt(t1.col282,1,t1.col280);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using temporary; Using filesort
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (flat, BNL join)
|
||||
1 SIMPLE t3 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
|
||||
SELECT 1 AS c FROM t1 NATURAL LEFT JOIN t2 LEFT OUTER JOIN t3 ON 1
|
||||
GROUP BY elt(t1.col282,1,t1.col280);
|
||||
c
|
||||
1
|
||||
set join_buffer_size=default;
|
||||
set optimizer_switch=@tmp_optimizer_switch;
|
||||
DROP table t1,t2,t3;
|
||||
set @@optimizer_switch=@save_optimizer_switch;
|
||||
|
@ -318,7 +318,7 @@ LIMIT ROWS EXAMINED 9;
|
||||
c1
|
||||
bb
|
||||
Warnings:
|
||||
Warning 1931 Query execution was interrupted. The query examined at least 10 rows, which exceeds LIMIT ROWS EXAMINED (9). The query result may be incomplete.
|
||||
Warning 1931 Query execution was interrupted. The query examined at least 12 rows, which exceeds LIMIT ROWS EXAMINED (9). The query result may be incomplete.
|
||||
Same as above, without subquery cache
|
||||
set @@optimizer_switch='subquery_cache=off';
|
||||
select * from t1
|
||||
@ -347,7 +347,7 @@ LIMIT ROWS EXAMINED 5;
|
||||
c1
|
||||
bb
|
||||
Warnings:
|
||||
Warning 1931 Query execution was interrupted. The query examined at least 6 rows, which exceeds LIMIT ROWS EXAMINED (5). The query result may be incomplete.
|
||||
Warning 1931 Query execution was interrupted. The query examined at least 7 rows, which exceeds LIMIT ROWS EXAMINED (5). The query result may be incomplete.
|
||||
Subqueries with materialization
|
||||
set @@optimizer_switch='semijoin=off,in_to_exists=off,materialization=on,subquery_cache=on';
|
||||
explain
|
||||
|
@ -199,7 +199,7 @@ SELECT @@general_log, @@log;
|
||||
1 1
|
||||
SET GLOBAL log = 0;
|
||||
Warnings:
|
||||
Warning 1287 The syntax '@@log' is deprecated and will be removed in MariaDB 10.1. Please use '@@general_log' instead
|
||||
Warning 1287 '@@log' is deprecated and will be removed in a future release. Please use '@@general_log' instead
|
||||
SHOW VARIABLES LIKE 'general_log';
|
||||
Variable_name Value
|
||||
general_log OFF
|
||||
@ -230,7 +230,7 @@ SELECT @@slow_query_log, @@log_slow_queries;
|
||||
0 0
|
||||
SET GLOBAL log_slow_queries = 0;
|
||||
Warnings:
|
||||
Warning 1287 The syntax '@@log_slow_queries' is deprecated and will be removed in MariaDB 10.1. Please use '@@slow_query_log' instead
|
||||
Warning 1287 '@@log_slow_queries' is deprecated and will be removed in a future release. Please use '@@slow_query_log' instead
|
||||
SHOW VARIABLES LIKE 'slow_query_log';
|
||||
Variable_name Value
|
||||
slow_query_log OFF
|
||||
@ -283,16 +283,16 @@ SET GLOBAL slow_query_log_file = @old_slow_query_log_file;
|
||||
deprecated:
|
||||
SET GLOBAL log = 0;
|
||||
Warnings:
|
||||
Warning 1287 The syntax '@@log' is deprecated and will be removed in MariaDB 10.1. Please use '@@general_log' instead
|
||||
Warning 1287 '@@log' is deprecated and will be removed in a future release. Please use '@@general_log' instead
|
||||
SET GLOBAL log_slow_queries = 0;
|
||||
Warnings:
|
||||
Warning 1287 The syntax '@@log_slow_queries' is deprecated and will be removed in MariaDB 10.1. Please use '@@slow_query_log' instead
|
||||
Warning 1287 '@@log_slow_queries' is deprecated and will be removed in a future release. Please use '@@slow_query_log' instead
|
||||
SET GLOBAL log = DEFAULT;
|
||||
Warnings:
|
||||
Warning 1287 The syntax '@@log' is deprecated and will be removed in MariaDB 10.1. Please use '@@general_log' instead
|
||||
Warning 1287 '@@log' is deprecated and will be removed in a future release. Please use '@@general_log' instead
|
||||
SET GLOBAL log_slow_queries = DEFAULT;
|
||||
Warnings:
|
||||
Warning 1287 The syntax '@@log_slow_queries' is deprecated and will be removed in MariaDB 10.1. Please use '@@slow_query_log' instead
|
||||
Warning 1287 '@@log_slow_queries' is deprecated and will be removed in a future release. Please use '@@slow_query_log' instead
|
||||
not deprecated:
|
||||
SELECT @@global.general_log_file INTO @my_glf;
|
||||
SELECT @@global.slow_query_log_file INTO @my_sqlf;
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- r/mysqld--help.result 2012-01-13 16:50:49.000000000 +0100
|
||||
+++ r/mysqld--help-win.result 2012-01-19 14:12:00.000000000 +0100
|
||||
@@ -240,7 +240,6 @@
|
||||
--- mysql-test/r/mysqld--help.result 2012-09-08 22:22:06 +0000
|
||||
+++ mysql-test/r/mysqld--help.result 2012-10-01 14:03:59 +0000
|
||||
@@ -244,7 +244,6 @@
|
||||
The number of segments in a key cache
|
||||
-L, --language=name Client error messages in given language. May be given as
|
||||
a full path. Deprecated. Use --lc-messages-dir instead.
|
||||
@ -8,7 +8,7 @@
|
||||
--lc-messages=name Set the language used for the error messages.
|
||||
-L, --lc-messages-dir=name
|
||||
Directory where error messages are
|
||||
@@ -436,6 +435,7 @@
|
||||
@@ -440,6 +439,7 @@
|
||||
NULLS_UNEQUAL (default behavior for 4.1 and later),
|
||||
NULLS_EQUAL (emulate 4.0 behavior), and NULLS_IGNORED
|
||||
--myisam-use-mmap Use memory mapping for reading and writing MyISAM tables
|
||||
@ -16,7 +16,7 @@
|
||||
--net-buffer-length=#
|
||||
Buffer length for TCP/IP and socket communication
|
||||
--net-read-timeout=#
|
||||
@@ -695,6 +695,9 @@
|
||||
@@ -707,6 +707,9 @@
|
||||
files within specified directory
|
||||
--server-id=# Uniquely identifies the server instance in the community
|
||||
of replication partners
|
||||
@ -26,7 +26,7 @@
|
||||
--show-slave-auth-info
|
||||
Show user and password in SHOW SLAVE HOSTS on this
|
||||
master.
|
||||
@@ -759,6 +762,10 @@
|
||||
@@ -774,6 +777,10 @@
|
||||
Log slow queries to given log file. Defaults logging to
|
||||
'hostname'-slow.log. Must be enabled to activate other
|
||||
slow log options
|
||||
@ -37,7 +37,7 @@
|
||||
--socket=name Socket file to use for connection
|
||||
--sort-buffer-size=#
|
||||
Each thread that needs to do a sort allocates a buffer of
|
||||
@@ -767,6 +774,7 @@
|
||||
@@ -782,6 +789,7 @@
|
||||
for the complete list of valid sql modes
|
||||
--stack-trace Print a symbolic stack trace on failure
|
||||
(Defaults to on; use --skip-stack-trace to disable.)
|
||||
@ -45,7 +45,7 @@
|
||||
--stored-program-cache=#
|
||||
The soft upper limit for number of cached stored routines
|
||||
for one connection.
|
||||
@@ -807,8 +815,8 @@
|
||||
@@ -822,8 +830,8 @@
|
||||
size, MySQL will automatically convert it to an on-disk
|
||||
MyISAM or Aria table
|
||||
-t, --tmpdir=name Path for temporary files. Several paths may be specified,
|
||||
@ -56,15 +56,15 @@
|
||||
--transaction-alloc-block-size=#
|
||||
Allocation block size for transactions to be stored in
|
||||
binary log
|
||||
@@ -908,7 +916,6 @@
|
||||
@@ -923,7 +931,6 @@ key-cache-age-threshold 300
|
||||
key-cache-block-size 1024
|
||||
key-cache-division-limit 100
|
||||
key-cache-segments 0
|
||||
language MYSQL_SHAREDIR/
|
||||
-large-pages FALSE
|
||||
lc-messages en_US
|
||||
lc-messages-dir MYSQL_SHAREDIR/
|
||||
lc-time-names en_US
|
||||
@@ -971,6 +978,7 @@
|
||||
@@ -986,6 +993,7 @@ myisam-repair-threads 1
|
||||
myisam-sort-buffer-size 8388608
|
||||
myisam-stats-method nulls_unequal
|
||||
myisam-use-mmap FALSE
|
||||
@ -72,7 +72,7 @@
|
||||
net-buffer-length 16384
|
||||
net-read-timeout 30
|
||||
net-retry-count 10
|
||||
@@ -1035,6 +1043,8 @@
|
||||
@@ -1051,6 +1059,8 @@ safe-user-create FALSE
|
||||
secure-auth FALSE
|
||||
secure-file-priv (No default value)
|
||||
server-id 0
|
||||
@ -81,7 +81,7 @@
|
||||
show-slave-auth-info FALSE
|
||||
skip-grant-tables TRUE
|
||||
skip-name-resolve FALSE
|
||||
@@ -1050,6 +1060,7 @@
|
||||
@@ -1067,6 +1077,7 @@ slave-transaction-retries 10
|
||||
slave-type-conversions
|
||||
slow-launch-time 2
|
||||
slow-query-log FALSE
|
||||
@ -89,3 +89,4 @@
|
||||
sort-buffer-size 2097152
|
||||
sql-mode
|
||||
stack-trace TRUE
|
||||
|
||||
|
@ -204,6 +204,10 @@ The following options may be given as the first argument:
|
||||
-?, --help Display this help and exit.
|
||||
--ignore-builtin-innodb
|
||||
Disable initialization of builtin InnoDB plugin
|
||||
--ignore-db-dirs=name
|
||||
Specifies a directory to add to the ignore list when
|
||||
collecting database names from the datadir. Put a blank
|
||||
argument to reset the list accumulated so far.
|
||||
--init-connect=name Command(s) that are executed for each new connection
|
||||
(unless the user has SUPER privilege)
|
||||
--init-file=name Read SQL commands from this file at startup
|
||||
@ -908,6 +912,7 @@ general-log FALSE
|
||||
group-concat-max-len 1024
|
||||
help TRUE
|
||||
ignore-builtin-innodb FALSE
|
||||
ignore-db-dirs
|
||||
init-connect
|
||||
init-file (No default value)
|
||||
init-rpl-role MASTER
|
||||
|
@ -44,9 +44,9 @@ ERROR 42000: DELETE command denied to user 'ssl_user4'@'localhost' for table 't1
|
||||
drop user ssl_user1@localhost, ssl_user2@localhost,
|
||||
ssl_user3@localhost, ssl_user4@localhost, ssl_user5@localhost;
|
||||
drop table t1;
|
||||
mysqltest: Could not open connection 'default': 2026 SSL connection error: ASN: bad other signature confirmation
|
||||
mysqltest: Could not open connection 'default': 2026 SSL connection error: ASN: bad other signature confirmation
|
||||
mysqltest: Could not open connection 'default': 2026 SSL connection error: ASN: bad other signature confirmation
|
||||
mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxx
|
||||
mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxx
|
||||
mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxx
|
||||
SSL error: Unable to get private key from ''
|
||||
mysqltest: Could not open connection 'default': 2026 SSL connection error: Unable to get private key
|
||||
SSL error: Unable to get certificate from ''
|
||||
@ -83,7 +83,7 @@ Ssl_cipher AES128-SHA
|
||||
SHOW STATUS LIKE 'Ssl_cipher';
|
||||
Variable_name Value
|
||||
Ssl_cipher AES128-SHA
|
||||
mysqltest: Could not open connection 'default': 2026 SSL connection error: SSL_CTX_new failed
|
||||
mysqltest: Could not open connection 'default': 2026 SSL connection error: Failed to set ciphers to use
|
||||
CREATE TABLE t1(a int);
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
|
||||
|
@ -2830,3 +2830,79 @@ f0 f1 f2
|
||||
set sort_buffer_size= @save_sort_buffer_size;
|
||||
DROP TABLE t1;
|
||||
End of 5.3 tests
|
||||
#
|
||||
# Bug 54599: discarded fast range scan for query with
|
||||
# GROUP BY + ORDER BY + LIMIT
|
||||
#
|
||||
create table t0 (a int);
|
||||
insert into t0 values (0), (1), (2), (3), (4), (5), (6), (7), (8), (9);
|
||||
create table t1 (a int, b int, index idx1(a,b), index idx2(b,a));
|
||||
insert into t1
|
||||
select 1000*s4.a+100*s3.a+10*s2.a + s1.a, 1000*s4.a+100*s3.a+10*s2.a+s1.a
|
||||
from t0 s1, t0 s2, t0 s3, t0 s4;
|
||||
analyze table t1;
|
||||
explain
|
||||
select b, count(*) num_cnt from t1
|
||||
where a > 9750 group by b order by num_cnt;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range idx1 idx1 5 NULL 502 Using where; Using index; Using temporary; Using filesort
|
||||
flush status;
|
||||
select b, count(*) num_cnt from t1
|
||||
where a > 9750 group by b order by num_cnt;
|
||||
show status like '%Handler_read%';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
Handler_read_key 250
|
||||
Handler_read_last 0
|
||||
Handler_read_next 249
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 249
|
||||
Handler_read_rnd_deleted 0
|
||||
Handler_read_rnd_next 250
|
||||
explain
|
||||
select b, count(*) num_cnt from t1
|
||||
where a > 9750 group by b order by num_cnt limit 1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range idx1 idx1 5 NULL 502 Using where; Using index; Using temporary; Using filesort
|
||||
flush status;
|
||||
select b, count(*) num_cnt from t1
|
||||
where a > 9750 group by b order by num_cnt limit 1;
|
||||
show status like '%Handler_read%';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
Handler_read_key 250
|
||||
Handler_read_last 0
|
||||
Handler_read_next 249
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 1
|
||||
Handler_read_rnd_deleted 0
|
||||
Handler_read_rnd_next 250
|
||||
drop table t0, t1;
|
||||
#
|
||||
# LP bug #1002508 : the number of expected rows to be examined is off
|
||||
# (bug #13528826)
|
||||
#
|
||||
CREATE TABLE t1(a int PRIMARY KEY, b int) ENGINE=myisam;
|
||||
INSERT INTO t1 VALUES
|
||||
(5, 10), (2, 70), (7, 80), (6, 20), (1, 50), (9, 40), (8, 30), (3, 60);
|
||||
CREATE TABLE t2 (p int, a int, INDEX i_a(a)) ENGINE=myisam;
|
||||
INSERT INTO t2 VALUES
|
||||
(103, 7), (109, 3), (102, 3), (108, 1), (106, 3),
|
||||
(107, 7), (105, 1), (101, 3), (100, 7), (110, 1);
|
||||
EXPLAIN
|
||||
SELECT t1.a FROM t1 LEFT JOIN t2 ON t1.a=t2.a ORDER BY t1.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index NULL PRIMARY 4 NULL 8 Using index
|
||||
1 SIMPLE t2 ref i_a i_a 5 test.t1.a 2 Using index
|
||||
EXPLAIN
|
||||
SELECT t1.a FROM t1 LEFT JOIN t2 ON t1.a=t2.a ORDER BY t1.a LIMIT 8;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index
|
||||
1 SIMPLE t2 ref i_a i_a 5 test.t1.a 2 Using index
|
||||
EXPLAIN
|
||||
SELECT t1.a FROM t1 LEFT JOIN t2 ON t1.a=t2.a ORDER BY t1.a LIMIT 100;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index NULL PRIMARY 4 NULL 8 Using index
|
||||
1 SIMPLE t2 ref i_a i_a 5 test.t1.a 2 Using index
|
||||
DROP TABLE t1,t2;
|
||||
End of 5.5 tests
|
||||
|
@ -1,4 +1,5 @@
|
||||
drop table if exists t1,t2;
|
||||
set @@sort_buffer_size=32804;
|
||||
CREATE TABLE `t1` (
|
||||
`id` int(11) NOT NULL default '0',
|
||||
`id2` int(11) NOT NULL default '0',
|
||||
|
@ -2394,6 +2394,12 @@ HAVING b > geomfromtext("")
|
||||
);
|
||||
1
|
||||
DROP TABLE t1;
|
||||
|
||||
MDEV-612 Valgrind error in ha_maria::check_if_incompatible_data
|
||||
|
||||
CREATE TABLE t1 (a INT, b INT, KEY(a)) ENGINE=Aria PARTITION BY KEY(a) PARTITIONS 2;
|
||||
ALTER TABLE t1 ADD KEY (b);
|
||||
drop table t1;
|
||||
End of 5.1 tests
|
||||
#
|
||||
# BUG#55385: UPDATE statement throws an error, but still updates
|
||||
|
@ -777,3 +777,14 @@ execute stmt1 ;
|
||||
prepare stmt1 from ' select * from t5 ' ;
|
||||
execute stmt1 ;
|
||||
drop table t1, t5, t9;
|
||||
#
|
||||
# testcase for bug#11765413 - Crash with dependent subquery and
|
||||
# prepared statement
|
||||
create table t1 (c1 int);
|
||||
insert into t1 values (1);
|
||||
prepare stmt1 from "select 1 from t1 where 1=(select 1 from t1 having c1)";
|
||||
execute stmt1;
|
||||
1
|
||||
1
|
||||
drop prepare stmt1;
|
||||
drop table t1;
|
||||
|
@ -1221,6 +1221,153 @@ Lugansk UKR 469000
|
||||
Seattle USA 563374
|
||||
Caracas VEN 1975294
|
||||
set optimizer_switch=@save_optimizer_switch;
|
||||
#
|
||||
# Bug mdev-585: range vs index-merge with ORDER BY ... LIMIT n
|
||||
# (LP bug #637962)
|
||||
#
|
||||
DROP INDEX CountryPopulation ON City;
|
||||
DROP INDEX CountryName ON City;
|
||||
DROP INDEX CityName on City;
|
||||
CREATE INDEX Name ON City(Name);
|
||||
CREATE INDEX Population ON City(Population);
|
||||
EXPLAIN
|
||||
SELECT * FROM City
|
||||
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H'))
|
||||
AND (Population >= 100000 AND Population < 120000);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City index_merge Country,Name,Population Name,Country 35,3 NULL # Using sort_union(Name,Country); Using where
|
||||
FLUSH STATUS;
|
||||
SELECT * FROM City
|
||||
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H'))
|
||||
AND (Population >= 100000 AND Population < 120000);
|
||||
ID Name Country Population
|
||||
384 Cabo Frio BRA 119503
|
||||
387 Camaragibe BRA 118968
|
||||
403 Catanduva BRA 107761
|
||||
412 Cachoeirinha BRA 103240
|
||||
508 Watford GBR 113080
|
||||
509 Ipswich GBR 114000
|
||||
510 Slough GBR 112000
|
||||
511 Exeter GBR 111000
|
||||
512 Cheltenham GBR 106000
|
||||
513 Gloucester GBR 107000
|
||||
514 Saint Helens GBR 106293
|
||||
515 Sutton Coldfield GBR 106001
|
||||
516 York GBR 104425
|
||||
517 Oldham GBR 103931
|
||||
518 Basildon GBR 100924
|
||||
519 Worthing GBR 100000
|
||||
635 Mallawi EGY 119283
|
||||
636 Bilbays EGY 113608
|
||||
637 Mit Ghamr EGY 101801
|
||||
638 al-Arish EGY 100447
|
||||
701 Tarragona ESP 113016
|
||||
702 Lleida (Lérida) ESP 112207
|
||||
703 Jaén ESP 109247
|
||||
704 Ourense (Orense) ESP 109120
|
||||
705 Mataró ESP 104095
|
||||
706 Algeciras ESP 103106
|
||||
707 Marbella ESP 101144
|
||||
759 Gonder ETH 112249
|
||||
869 Cabuyao PHL 106630
|
||||
870 Calapan PHL 105910
|
||||
873 Cauayan PHL 103952
|
||||
903 Serekunda GMB 102600
|
||||
909 Sohumi GEO 111700
|
||||
913 Tema GHA 109975
|
||||
914 Sekondi-Takoradi GHA 103653
|
||||
924 Villa Nueva GTM 101295
|
||||
1844 Cape Breton CAN 114733
|
||||
1847 Cambridge CAN 109186
|
||||
2406 Herakleion GRC 116178
|
||||
2407 Kallithea GRC 114233
|
||||
2408 Larisa GRC 113090
|
||||
2908 Cajamarca PER 108009
|
||||
3002 Besançon FRA 117733
|
||||
3003 Caen FRA 113987
|
||||
3004 Orléans FRA 113126
|
||||
3005 Mulhouse FRA 110359
|
||||
3006 Rouen FRA 106592
|
||||
3007 Boulogne-Billancourt FRA 106367
|
||||
3008 Perpignan FRA 105115
|
||||
3009 Nancy FRA 103605
|
||||
3411 Ceyhan TUR 102412
|
||||
3567 Carúpano VEN 119639
|
||||
3568 Catia La Mar VEN 117012
|
||||
3571 Calabozo VEN 107146
|
||||
3786 Cam Ranh VNM 114041
|
||||
3792 Tartu EST 101246
|
||||
4002 Carrollton USA 109576
|
||||
4027 Cape Coral USA 102286
|
||||
4032 Cambridge USA 101355
|
||||
SHOW STATUS LIKE 'Handler_read_%';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
Handler_read_key 2
|
||||
Handler_read_last 0
|
||||
Handler_read_next 385
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 377
|
||||
Handler_read_rnd_deleted 0
|
||||
Handler_read_rnd_next 0
|
||||
EXPLAIN
|
||||
SELECT * FROM City
|
||||
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H'))
|
||||
AND (Population >= 100000 AND Population < 120000)
|
||||
ORDER BY Population LIMIT 5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City range Country,Name,Population Population 4 NULL # Using where
|
||||
FLUSH STATUS;
|
||||
SELECT * FROM City
|
||||
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H'))
|
||||
AND (Population >= 100000 AND Population < 120000)
|
||||
ORDER BY Population LIMIT 5;
|
||||
ID Name Country Population
|
||||
519 Worthing GBR 100000
|
||||
638 al-Arish EGY 100447
|
||||
518 Basildon GBR 100924
|
||||
707 Marbella ESP 101144
|
||||
3792 Tartu EST 101246
|
||||
SHOW STATUS LIKE 'Handler_read_%';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
Handler_read_key 1
|
||||
Handler_read_last 0
|
||||
Handler_read_next 59
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_deleted 0
|
||||
Handler_read_rnd_next 0
|
||||
set optimizer_switch='index_merge=off';
|
||||
EXPLAIN
|
||||
SELECT * FROM City
|
||||
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H'))
|
||||
AND (Population >= 100000 AND Population < 120000)
|
||||
ORDER BY Population LIMIT 5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City range Country,Name,Population Population 4 NULL # Using index condition; Using where
|
||||
FLUSH STATUS;
|
||||
SELECT * FROM City
|
||||
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H'))
|
||||
AND (Population >= 100000 AND Population < 120000)
|
||||
ORDER BY Population LIMIT 5;
|
||||
ID Name Country Population
|
||||
519 Worthing GBR 100000
|
||||
638 al-Arish EGY 100447
|
||||
518 Basildon GBR 100924
|
||||
707 Marbella ESP 101144
|
||||
3792 Tartu EST 101246
|
||||
SHOW STATUS LIKE 'Handler_read_%';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
Handler_read_key 1
|
||||
Handler_read_last 0
|
||||
Handler_read_next 59
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_deleted 0
|
||||
Handler_read_rnd_next 0
|
||||
set optimizer_switch=@save_optimizer_switch;
|
||||
DROP DATABASE world;
|
||||
use test;
|
||||
CREATE TABLE t1 (
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- r/range_vs_index_merge_innodb.result 2012-03-24 17:12:02.124422000 +0100
|
||||
+++ r/range_vs_index_merge_innodb,innodb_plugin.reject 2012-03-24 18:00:13.647902620 +0100
|
||||
--- ./r/range_vs_index_merge_innodb.result 2012-11-21 19:35:14.000000000 +0100
|
||||
+++ ./r/range_vs_index_merge_innodb,innodb_plugin.reject 2012-11-21 20:56:00.000000000 +0100
|
||||
@@ -50,14 +50,14 @@
|
||||
WHERE (Population >= 100000 OR Name LIKE 'P%') AND Country='CAN' OR
|
||||
(Population < 100000 OR Name Like 'T%') AND Country='ARG';
|
||||
@ -269,3 +269,12 @@
|
||||
SELECT Name, Country, Population FROM City WHERE
|
||||
(Name='Manila' AND Country='PHL') OR
|
||||
(Name='Addis Abeba' AND Country='ETH') OR
|
||||
@@ -1346,7 +1346,7 @@
|
||||
AND (Population >= 100000 AND Population < 120000)
|
||||
ORDER BY Population LIMIT 5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
-1 SIMPLE City range Country,Name,Population Population 4 NULL # Using index condition; Using where
|
||||
+1 SIMPLE City range Country,Name,Population Population 4 NULL # Using where
|
||||
FLUSH STATUS;
|
||||
SELECT * FROM City
|
||||
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H'))
|
||||
|
@ -1222,6 +1222,153 @@ Lugansk UKR 469000
|
||||
Seattle USA 563374
|
||||
Caracas VEN 1975294
|
||||
set optimizer_switch=@save_optimizer_switch;
|
||||
#
|
||||
# Bug mdev-585: range vs index-merge with ORDER BY ... LIMIT n
|
||||
# (LP bug #637962)
|
||||
#
|
||||
DROP INDEX CountryPopulation ON City;
|
||||
DROP INDEX CountryName ON City;
|
||||
DROP INDEX CityName on City;
|
||||
CREATE INDEX Name ON City(Name);
|
||||
CREATE INDEX Population ON City(Population);
|
||||
EXPLAIN
|
||||
SELECT * FROM City
|
||||
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H'))
|
||||
AND (Population >= 100000 AND Population < 120000);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City index_merge Country,Name,Population Name,Country 35,3 NULL # Using sort_union(Name,Country); Using where
|
||||
FLUSH STATUS;
|
||||
SELECT * FROM City
|
||||
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H'))
|
||||
AND (Population >= 100000 AND Population < 120000);
|
||||
ID Name Country Population
|
||||
384 Cabo Frio BRA 119503
|
||||
387 Camaragibe BRA 118968
|
||||
403 Catanduva BRA 107761
|
||||
412 Cachoeirinha BRA 103240
|
||||
508 Watford GBR 113080
|
||||
509 Ipswich GBR 114000
|
||||
510 Slough GBR 112000
|
||||
511 Exeter GBR 111000
|
||||
512 Cheltenham GBR 106000
|
||||
513 Gloucester GBR 107000
|
||||
514 Saint Helens GBR 106293
|
||||
515 Sutton Coldfield GBR 106001
|
||||
516 York GBR 104425
|
||||
517 Oldham GBR 103931
|
||||
518 Basildon GBR 100924
|
||||
519 Worthing GBR 100000
|
||||
635 Mallawi EGY 119283
|
||||
636 Bilbays EGY 113608
|
||||
637 Mit Ghamr EGY 101801
|
||||
638 al-Arish EGY 100447
|
||||
701 Tarragona ESP 113016
|
||||
702 Lleida (Lérida) ESP 112207
|
||||
703 Jaén ESP 109247
|
||||
704 Ourense (Orense) ESP 109120
|
||||
705 Mataró ESP 104095
|
||||
706 Algeciras ESP 103106
|
||||
707 Marbella ESP 101144
|
||||
759 Gonder ETH 112249
|
||||
869 Cabuyao PHL 106630
|
||||
870 Calapan PHL 105910
|
||||
873 Cauayan PHL 103952
|
||||
903 Serekunda GMB 102600
|
||||
909 Sohumi GEO 111700
|
||||
913 Tema GHA 109975
|
||||
914 Sekondi-Takoradi GHA 103653
|
||||
924 Villa Nueva GTM 101295
|
||||
1844 Cape Breton CAN 114733
|
||||
1847 Cambridge CAN 109186
|
||||
2406 Herakleion GRC 116178
|
||||
2407 Kallithea GRC 114233
|
||||
2408 Larisa GRC 113090
|
||||
2908 Cajamarca PER 108009
|
||||
3002 Besançon FRA 117733
|
||||
3003 Caen FRA 113987
|
||||
3004 Orléans FRA 113126
|
||||
3005 Mulhouse FRA 110359
|
||||
3006 Rouen FRA 106592
|
||||
3007 Boulogne-Billancourt FRA 106367
|
||||
3008 Perpignan FRA 105115
|
||||
3009 Nancy FRA 103605
|
||||
3411 Ceyhan TUR 102412
|
||||
3567 Carúpano VEN 119639
|
||||
3568 Catia La Mar VEN 117012
|
||||
3571 Calabozo VEN 107146
|
||||
3786 Cam Ranh VNM 114041
|
||||
3792 Tartu EST 101246
|
||||
4002 Carrollton USA 109576
|
||||
4027 Cape Coral USA 102286
|
||||
4032 Cambridge USA 101355
|
||||
SHOW STATUS LIKE 'Handler_read_%';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
Handler_read_key 2
|
||||
Handler_read_last 0
|
||||
Handler_read_next 385
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 377
|
||||
Handler_read_rnd_deleted 0
|
||||
Handler_read_rnd_next 0
|
||||
EXPLAIN
|
||||
SELECT * FROM City
|
||||
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H'))
|
||||
AND (Population >= 100000 AND Population < 120000)
|
||||
ORDER BY Population LIMIT 5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City range Country,Name,Population Population 4 NULL # Using where
|
||||
FLUSH STATUS;
|
||||
SELECT * FROM City
|
||||
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H'))
|
||||
AND (Population >= 100000 AND Population < 120000)
|
||||
ORDER BY Population LIMIT 5;
|
||||
ID Name Country Population
|
||||
519 Worthing GBR 100000
|
||||
638 al-Arish EGY 100447
|
||||
518 Basildon GBR 100924
|
||||
707 Marbella ESP 101144
|
||||
3792 Tartu EST 101246
|
||||
SHOW STATUS LIKE 'Handler_read_%';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
Handler_read_key 1
|
||||
Handler_read_last 0
|
||||
Handler_read_next 59
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_deleted 0
|
||||
Handler_read_rnd_next 0
|
||||
set optimizer_switch='index_merge=off';
|
||||
EXPLAIN
|
||||
SELECT * FROM City
|
||||
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H'))
|
||||
AND (Population >= 100000 AND Population < 120000)
|
||||
ORDER BY Population LIMIT 5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City range Country,Name,Population Population 4 NULL # Using index condition; Using where
|
||||
FLUSH STATUS;
|
||||
SELECT * FROM City
|
||||
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H'))
|
||||
AND (Population >= 100000 AND Population < 120000)
|
||||
ORDER BY Population LIMIT 5;
|
||||
ID Name Country Population
|
||||
519 Worthing GBR 100000
|
||||
638 al-Arish EGY 100447
|
||||
518 Basildon GBR 100924
|
||||
707 Marbella ESP 101144
|
||||
3792 Tartu EST 101246
|
||||
SHOW STATUS LIKE 'Handler_read_%';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
Handler_read_key 1
|
||||
Handler_read_last 0
|
||||
Handler_read_next 59
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_deleted 0
|
||||
Handler_read_rnd_next 0
|
||||
set optimizer_switch=@save_optimizer_switch;
|
||||
DROP DATABASE world;
|
||||
use test;
|
||||
CREATE TABLE t1 (
|
||||
|
@ -4887,7 +4887,7 @@ CREATE TABLE t5 (f1 int) ;
|
||||
INSERT INTO t5 VALUES (20),(5);
|
||||
CREATE TABLE t6(f1 int);
|
||||
INSERT INTO t6 VALUES (9),(7);
|
||||
SET SESSION join_buffer_size = 2048;
|
||||
SET SESSION join_buffer_size = 2176;
|
||||
EXPLAIN
|
||||
SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -4901,50 +4901,50 @@ SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6;
|
||||
f1 f1 f1 f1 f2 f1 f1
|
||||
3 9 NULL NULL NULL 20 9
|
||||
7 9 NULL NULL NULL 20 9
|
||||
3 9 NULL NULL NULL 20 7
|
||||
7 9 NULL NULL NULL 20 7
|
||||
3 9 NULL NULL NULL 5 9
|
||||
7 9 NULL NULL NULL 5 9
|
||||
3 9 NULL NULL NULL 5 7
|
||||
7 9 NULL NULL NULL 5 7
|
||||
18 9 NULL NULL NULL 20 9
|
||||
3 9 NULL NULL NULL 20 9
|
||||
18 9 NULL NULL NULL 20 7
|
||||
3 9 NULL NULL NULL 20 7
|
||||
18 9 NULL NULL NULL 5 9
|
||||
3 9 NULL NULL NULL 5 9
|
||||
18 9 NULL NULL NULL 5 7
|
||||
3 9 NULL NULL NULL 5 7
|
||||
7 9 NULL NULL NULL 20 9
|
||||
18 9 NULL NULL NULL 20 9
|
||||
7 9 NULL NULL NULL 20 7
|
||||
18 9 NULL NULL NULL 20 7
|
||||
7 9 NULL NULL NULL 5 9
|
||||
18 9 NULL NULL NULL 5 9
|
||||
7 9 NULL NULL NULL 5 7
|
||||
18 9 NULL NULL NULL 5 7
|
||||
3 9 NULL NULL NULL 20 9
|
||||
7 9 NULL NULL NULL 20 9
|
||||
3 9 NULL NULL NULL 20 7
|
||||
7 9 NULL NULL NULL 20 7
|
||||
3 9 NULL NULL NULL 5 9
|
||||
7 9 NULL NULL NULL 5 9
|
||||
3 9 NULL NULL NULL 5 7
|
||||
7 9 NULL NULL NULL 5 7
|
||||
18 9 NULL NULL NULL 20 9
|
||||
3 9 NULL NULL NULL 20 9
|
||||
18 9 NULL NULL NULL 20 7
|
||||
3 9 NULL NULL NULL 20 7
|
||||
18 9 NULL NULL NULL 5 9
|
||||
3 9 NULL NULL NULL 5 9
|
||||
18 9 NULL NULL NULL 5 7
|
||||
3 9 NULL NULL NULL 5 7
|
||||
7 9 NULL NULL NULL 20 9
|
||||
18 9 NULL NULL NULL 20 9
|
||||
7 9 NULL NULL NULL 20 7
|
||||
18 9 NULL NULL NULL 20 7
|
||||
18 9 NULL NULL NULL 20 9
|
||||
3 9 NULL NULL NULL 20 9
|
||||
3 9 NULL NULL NULL 5 9
|
||||
7 9 NULL NULL NULL 5 9
|
||||
18 9 NULL NULL NULL 5 9
|
||||
18 9 NULL NULL NULL 20 7
|
||||
3 9 NULL NULL NULL 20 7
|
||||
3 9 NULL NULL NULL 5 7
|
||||
7 9 NULL NULL NULL 5 7
|
||||
18 9 NULL NULL NULL 5 7
|
||||
3 9 NULL NULL NULL 5 9
|
||||
7 9 NULL NULL NULL 5 9
|
||||
18 9 NULL NULL NULL 5 9
|
||||
3 9 NULL NULL NULL 5 9
|
||||
7 9 NULL NULL NULL 20 9
|
||||
3 9 NULL NULL NULL 5 7
|
||||
7 9 NULL NULL NULL 5 7
|
||||
18 9 NULL NULL NULL 5 7
|
||||
3 9 NULL NULL NULL 5 7
|
||||
7 9 NULL NULL NULL 20 7
|
||||
18 9 NULL NULL NULL 20 9
|
||||
3 9 NULL NULL NULL 20 9
|
||||
7 9 NULL NULL NULL 20 9
|
||||
18 9 NULL NULL NULL 20 9
|
||||
7 9 NULL NULL NULL 5 9
|
||||
18 9 NULL NULL NULL 20 7
|
||||
3 9 NULL NULL NULL 20 7
|
||||
7 9 NULL NULL NULL 20 7
|
||||
18 9 NULL NULL NULL 20 7
|
||||
7 9 NULL NULL NULL 5 7
|
||||
18 9 NULL NULL NULL 5 9
|
||||
3 9 NULL NULL NULL 5 9
|
||||
7 9 NULL NULL NULL 5 9
|
||||
18 9 NULL NULL NULL 5 9
|
||||
18 9 NULL NULL NULL 5 7
|
||||
3 9 NULL NULL NULL 5 7
|
||||
7 9 NULL NULL NULL 5 7
|
||||
18 9 NULL NULL NULL 5 7
|
||||
SET SESSION join_buffer_size = DEFAULT;
|
||||
|
@ -4898,7 +4898,7 @@ CREATE TABLE t5 (f1 int) ;
|
||||
INSERT INTO t5 VALUES (20),(5);
|
||||
CREATE TABLE t6(f1 int);
|
||||
INSERT INTO t6 VALUES (9),(7);
|
||||
SET SESSION join_buffer_size = 2048;
|
||||
SET SESSION join_buffer_size = 2176;
|
||||
EXPLAIN
|
||||
SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -4913,48 +4913,48 @@ f1 f1 f1 f1 f2 f1 f1
|
||||
3 9 NULL NULL NULL 20 9
|
||||
7 9 NULL NULL NULL 20 9
|
||||
18 9 NULL NULL NULL 20 9
|
||||
3 9 NULL NULL NULL 5 9
|
||||
7 9 NULL NULL NULL 5 9
|
||||
18 9 NULL NULL NULL 5 9
|
||||
3 9 NULL NULL NULL 20 7
|
||||
7 9 NULL NULL NULL 20 7
|
||||
18 9 NULL NULL NULL 20 7
|
||||
3 9 NULL NULL NULL 5 7
|
||||
7 9 NULL NULL NULL 5 7
|
||||
18 9 NULL NULL NULL 5 7
|
||||
3 9 NULL NULL NULL 20 9
|
||||
7 9 NULL NULL NULL 20 9
|
||||
18 9 NULL NULL NULL 20 9
|
||||
3 9 NULL NULL NULL 20 9
|
||||
7 9 NULL NULL NULL 20 9
|
||||
18 9 NULL NULL NULL 20 9
|
||||
3 9 NULL NULL NULL 20 9
|
||||
7 9 NULL NULL NULL 20 9
|
||||
18 9 NULL NULL NULL 20 9
|
||||
3 9 NULL NULL NULL 5 9
|
||||
7 9 NULL NULL NULL 5 9
|
||||
18 9 NULL NULL NULL 5 9
|
||||
3 9 NULL NULL NULL 20 7
|
||||
7 9 NULL NULL NULL 20 7
|
||||
18 9 NULL NULL NULL 20 7
|
||||
3 9 NULL NULL NULL 5 7
|
||||
7 9 NULL NULL NULL 5 7
|
||||
18 9 NULL NULL NULL 5 7
|
||||
3 9 NULL NULL NULL 20 9
|
||||
7 9 NULL NULL NULL 20 9
|
||||
18 9 NULL NULL NULL 20 9
|
||||
3 9 NULL NULL NULL 5 9
|
||||
7 9 NULL NULL NULL 5 9
|
||||
18 9 NULL NULL NULL 5 9
|
||||
3 9 NULL NULL NULL 5 9
|
||||
7 9 NULL NULL NULL 5 9
|
||||
18 9 NULL NULL NULL 5 9
|
||||
3 9 NULL NULL NULL 5 9
|
||||
7 9 NULL NULL NULL 5 9
|
||||
18 9 NULL NULL NULL 5 9
|
||||
3 9 NULL NULL NULL 20 7
|
||||
7 9 NULL NULL NULL 20 7
|
||||
18 9 NULL NULL NULL 20 7
|
||||
3 9 NULL NULL NULL 5 7
|
||||
7 9 NULL NULL NULL 5 7
|
||||
18 9 NULL NULL NULL 5 7
|
||||
3 9 NULL NULL NULL 20 9
|
||||
7 9 NULL NULL NULL 20 9
|
||||
18 9 NULL NULL NULL 20 9
|
||||
3 9 NULL NULL NULL 5 9
|
||||
7 9 NULL NULL NULL 5 9
|
||||
18 9 NULL NULL NULL 5 9
|
||||
3 9 NULL NULL NULL 20 7
|
||||
7 9 NULL NULL NULL 20 7
|
||||
18 9 NULL NULL NULL 20 7
|
||||
3 9 NULL NULL NULL 20 7
|
||||
7 9 NULL NULL NULL 20 7
|
||||
18 9 NULL NULL NULL 20 7
|
||||
3 9 NULL NULL NULL 20 7
|
||||
7 9 NULL NULL NULL 20 7
|
||||
18 9 NULL NULL NULL 20 7
|
||||
3 9 NULL NULL NULL 5 7
|
||||
7 9 NULL NULL NULL 5 7
|
||||
18 9 NULL NULL NULL 5 7
|
||||
3 9 NULL NULL NULL 5 7
|
||||
7 9 NULL NULL NULL 5 7
|
||||
18 9 NULL NULL NULL 5 7
|
||||
3 9 NULL NULL NULL 5 7
|
||||
7 9 NULL NULL NULL 5 7
|
||||
18 9 NULL NULL NULL 5 7
|
||||
3 9 NULL NULL NULL 5 7
|
||||
7 9 NULL NULL NULL 5 7
|
||||
18 9 NULL NULL NULL 5 7
|
||||
|
@ -4887,7 +4887,7 @@ CREATE TABLE t5 (f1 int) ;
|
||||
INSERT INTO t5 VALUES (20),(5);
|
||||
CREATE TABLE t6(f1 int);
|
||||
INSERT INTO t6 VALUES (9),(7);
|
||||
SET SESSION join_buffer_size = 2048;
|
||||
SET SESSION join_buffer_size = 2176;
|
||||
EXPLAIN
|
||||
SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -4901,50 +4901,50 @@ SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6;
|
||||
f1 f1 f1 f1 f2 f1 f1
|
||||
3 9 NULL NULL NULL 20 9
|
||||
7 9 NULL NULL NULL 20 9
|
||||
3 9 NULL NULL NULL 20 7
|
||||
7 9 NULL NULL NULL 20 7
|
||||
3 9 NULL NULL NULL 5 9
|
||||
7 9 NULL NULL NULL 5 9
|
||||
3 9 NULL NULL NULL 5 7
|
||||
7 9 NULL NULL NULL 5 7
|
||||
18 9 NULL NULL NULL 20 9
|
||||
3 9 NULL NULL NULL 20 9
|
||||
18 9 NULL NULL NULL 20 7
|
||||
3 9 NULL NULL NULL 20 7
|
||||
18 9 NULL NULL NULL 5 9
|
||||
3 9 NULL NULL NULL 5 9
|
||||
18 9 NULL NULL NULL 5 7
|
||||
3 9 NULL NULL NULL 5 7
|
||||
7 9 NULL NULL NULL 20 9
|
||||
18 9 NULL NULL NULL 20 9
|
||||
7 9 NULL NULL NULL 20 7
|
||||
18 9 NULL NULL NULL 20 7
|
||||
7 9 NULL NULL NULL 5 9
|
||||
18 9 NULL NULL NULL 5 9
|
||||
7 9 NULL NULL NULL 5 7
|
||||
18 9 NULL NULL NULL 5 7
|
||||
3 9 NULL NULL NULL 20 9
|
||||
7 9 NULL NULL NULL 20 9
|
||||
3 9 NULL NULL NULL 20 7
|
||||
7 9 NULL NULL NULL 20 7
|
||||
3 9 NULL NULL NULL 5 9
|
||||
7 9 NULL NULL NULL 5 9
|
||||
3 9 NULL NULL NULL 5 7
|
||||
7 9 NULL NULL NULL 5 7
|
||||
18 9 NULL NULL NULL 20 9
|
||||
3 9 NULL NULL NULL 20 9
|
||||
18 9 NULL NULL NULL 20 7
|
||||
3 9 NULL NULL NULL 20 7
|
||||
18 9 NULL NULL NULL 5 9
|
||||
3 9 NULL NULL NULL 5 9
|
||||
18 9 NULL NULL NULL 5 7
|
||||
3 9 NULL NULL NULL 5 7
|
||||
7 9 NULL NULL NULL 20 9
|
||||
18 9 NULL NULL NULL 20 9
|
||||
7 9 NULL NULL NULL 20 7
|
||||
18 9 NULL NULL NULL 20 7
|
||||
18 9 NULL NULL NULL 20 9
|
||||
3 9 NULL NULL NULL 20 9
|
||||
3 9 NULL NULL NULL 5 9
|
||||
7 9 NULL NULL NULL 5 9
|
||||
18 9 NULL NULL NULL 5 9
|
||||
18 9 NULL NULL NULL 20 7
|
||||
3 9 NULL NULL NULL 20 7
|
||||
3 9 NULL NULL NULL 5 7
|
||||
7 9 NULL NULL NULL 5 7
|
||||
18 9 NULL NULL NULL 5 7
|
||||
3 9 NULL NULL NULL 5 9
|
||||
7 9 NULL NULL NULL 5 9
|
||||
18 9 NULL NULL NULL 5 9
|
||||
3 9 NULL NULL NULL 5 9
|
||||
7 9 NULL NULL NULL 20 9
|
||||
3 9 NULL NULL NULL 5 7
|
||||
7 9 NULL NULL NULL 5 7
|
||||
18 9 NULL NULL NULL 5 7
|
||||
3 9 NULL NULL NULL 5 7
|
||||
7 9 NULL NULL NULL 20 7
|
||||
18 9 NULL NULL NULL 20 9
|
||||
3 9 NULL NULL NULL 20 9
|
||||
7 9 NULL NULL NULL 20 9
|
||||
18 9 NULL NULL NULL 20 9
|
||||
7 9 NULL NULL NULL 5 9
|
||||
18 9 NULL NULL NULL 20 7
|
||||
3 9 NULL NULL NULL 20 7
|
||||
7 9 NULL NULL NULL 20 7
|
||||
18 9 NULL NULL NULL 20 7
|
||||
7 9 NULL NULL NULL 5 7
|
||||
18 9 NULL NULL NULL 5 9
|
||||
3 9 NULL NULL NULL 5 9
|
||||
7 9 NULL NULL NULL 5 9
|
||||
18 9 NULL NULL NULL 5 9
|
||||
18 9 NULL NULL NULL 5 7
|
||||
3 9 NULL NULL NULL 5 7
|
||||
7 9 NULL NULL NULL 5 7
|
||||
18 9 NULL NULL NULL 5 7
|
||||
SET SESSION join_buffer_size = DEFAULT;
|
||||
|
@ -6060,6 +6060,116 @@ WHERE (col_varchar_nokey, 'x') IN
|
||||
col_int_nokey
|
||||
1
|
||||
DROP TABLE ot,it1,it2;
|
||||
#
|
||||
# MDEV-746
|
||||
# Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY
|
||||
# HAS AN EMPTY RESULT
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
pk int NOT NULL,
|
||||
col_int_nokey int NOT NULL,
|
||||
col_int_key int NOT NULL,
|
||||
col_time_key time NOT NULL,
|
||||
col_varchar_key varchar(1) NOT NULL,
|
||||
col_varchar_nokey varchar(1) NOT NULL,
|
||||
PRIMARY KEY (pk),
|
||||
KEY col_int_key (col_int_key),
|
||||
KEY col_time_key (col_time_key),
|
||||
KEY col_varchar_key (col_varchar_key,col_int_key)
|
||||
) ENGINE=MyISAM;
|
||||
CREATE TABLE t2 (
|
||||
pk int NOT NULL AUTO_INCREMENT,
|
||||
col_int_nokey int NOT NULL,
|
||||
col_int_key int NOT NULL,
|
||||
col_time_key time NOT NULL,
|
||||
col_varchar_key varchar(1) NOT NULL,
|
||||
col_varchar_nokey varchar(1) NOT NULL,
|
||||
PRIMARY KEY (pk),
|
||||
KEY col_int_key (col_int_key),
|
||||
KEY col_time_key (col_time_key),
|
||||
KEY col_varchar_key (col_varchar_key,col_int_key)
|
||||
) ENGINE=MyISAM;
|
||||
INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b');
|
||||
SET @var2:=4, @var3:=8;
|
||||
|
||||
Testcase without inner subquery
|
||||
EXPLAIN SELECT @var3:=12, sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
|
||||
sq4_alias1.col_varchar_key = @var3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
SELECT @var3:=12, sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
|
||||
sq4_alias1.col_varchar_key = @var3;
|
||||
@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
|
||||
SELECT @var3;
|
||||
@var3
|
||||
8
|
||||
EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
|
||||
sq4_alias1.col_varchar_key = @var3 ) AS alias3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE <derived2> system NULL NULL NULL NULL 0 const row not found
|
||||
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
|
||||
sq4_alias1.col_varchar_key = @var3 ) AS alias3;
|
||||
@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
|
||||
SELECT @var3;
|
||||
@var3
|
||||
8
|
||||
|
||||
Testcase with inner subquery; crashed WL#6095
|
||||
SET @var3=8;
|
||||
EXPLAIN SELECT sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
|
||||
NOT IN
|
||||
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
|
||||
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
|
||||
FROM t2 AS c_sq1_alias1
|
||||
WHERE (c_sq1_alias1.col_int_nokey != @var2
|
||||
OR c_sq1_alias1.pk != @var3));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1
|
||||
SELECT sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
|
||||
NOT IN
|
||||
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
|
||||
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
|
||||
FROM t2 AS c_sq1_alias1
|
||||
WHERE (c_sq1_alias1.col_int_nokey != @var2
|
||||
OR c_sq1_alias1.pk != @var3));
|
||||
pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
|
||||
EXPLAIN SELECT * FROM ( SELECT sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
|
||||
NOT IN
|
||||
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
|
||||
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
|
||||
FROM t2 AS c_sq1_alias1
|
||||
WHERE (c_sq1_alias1.col_int_nokey != @var2
|
||||
OR c_sq1_alias1.pk != @var3)) ) AS alias3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
3 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1
|
||||
SELECT * FROM ( SELECT sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
|
||||
NOT IN
|
||||
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
|
||||
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
|
||||
FROM t2 AS c_sq1_alias1
|
||||
WHERE (c_sq1_alias1.col_int_nokey != @var2
|
||||
OR c_sq1_alias1.pk != @var3)) ) AS alias3;
|
||||
pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
|
||||
DROP TABLE t1,t2;
|
||||
End of 5.2 tests
|
||||
#
|
||||
# BUG#779885: Crash in eliminate_item_equal with materialization=on in
|
||||
@ -6638,6 +6748,23 @@ a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
|
||||
set optimizer_switch=@mdev367_optimizer_switch;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-521 single value subselect transformation problem
|
||||
#
|
||||
CREATE TABLE t1 (f1 char(2), PRIMARY KEY (f1)) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES ('u1'),('u2');
|
||||
SELECT a.* FROM t1 a WHERE ( SELECT EXISTS ( SELECT 1 FROM t1 b WHERE b.f1 = a.f1 ) );
|
||||
f1
|
||||
u1
|
||||
u2
|
||||
FLUSH TABLES;
|
||||
SELECT a.* FROM t1 a WHERE ( SELECT EXISTS ( SELECT 1 FROM t1 b WHERE b.f1 = a.f1 ) );
|
||||
f1
|
||||
u1
|
||||
u2
|
||||
DROP TABLE t1;
|
||||
# return optimizer switch changed in the beginning of this test
|
||||
set optimizer_switch=@subselect_tmp;
|
||||
#
|
||||
# lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not
|
||||
# precomputed and thus not part of optimization
|
||||
#
|
||||
@ -6843,10 +6970,31 @@ INSERT INTO t2 VALUES (45),(17),(20);
|
||||
EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
|
||||
2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index
|
||||
2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
|
||||
DROP TABLE t1,t2;
|
||||
#
|
||||
# MDEV-435: Expensive subqueries may be evaluated during optimization in merge_key_fields
|
||||
#
|
||||
CREATE TABLE t1 (a INT, KEY(a)) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES (8),(0);
|
||||
CREATE TABLE t2 (b INT, c VARCHAR(1)) ENGINE=MyISAM;
|
||||
INSERT INTO t2 VALUES (4,'j'),(6,'v');
|
||||
CREATE TABLE t3 (d VARCHAR(1)) ENGINE=MyISAM;
|
||||
INSERT INTO t3 VALUES ('b'),('c');
|
||||
EXPLAIN
|
||||
SELECT * FROM t1
|
||||
WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 index a a 5 NULL 2 Using where; Using index
|
||||
2 SUBQUERY <subquery3> ALL distinct_key NULL NULL NULL 1
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2
|
||||
SELECT * FROM t1
|
||||
WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
|
||||
a
|
||||
drop table t1, t2, t3;
|
||||
#
|
||||
# MDEV-405: Server crashes in test_if_skip_sort_order on EXPLAIN with GROUP BY and HAVING in EXISTS subquery
|
||||
#
|
||||
CREATE TABLE t1 (a INT, KEY(a));
|
||||
@ -6856,6 +7004,6 @@ INSERT INTO t2 VALUES (45),(17),(20);
|
||||
EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
|
||||
2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index
|
||||
2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
|
||||
DROP TABLE t1,t2;
|
||||
|
@ -179,4 +179,120 @@ pk a b
|
||||
SET optimizer_switch=@tmp_optimizer_switch;
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1,t2,t3;
|
||||
#
|
||||
# MDEV-536: LP:1050806 - different result for a query using subquery
|
||||
#
|
||||
DROP TABLE IF EXISTS `t1`;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
CREATE TABLE `t1` (
|
||||
`node_uid` bigint(20) unsigned DEFAULT NULL,
|
||||
`date` datetime DEFAULT NULL,
|
||||
`mirror_date` datetime DEFAULT NULL,
|
||||
KEY `date` (`date`)
|
||||
) ENGINE=MyISAM;
|
||||
INSERT INTO `t1` VALUES (2085,'2012-01-01 00:00:00','2013-01-01 00:00:00');
|
||||
INSERT INTO `t1` VALUES (2084,'2012-02-01 00:00:00','2013-01-01 00:00:00');
|
||||
INSERT INTO `t1` VALUES (2088,'2012-03-01 00:00:00','2013-01-01 00:00:00');
|
||||
SELECT * FROM (
|
||||
SELECT node_uid, date, mirror_date, @result := 0 AS result
|
||||
FROM t1
|
||||
WHERE date < '2012-12-12 12:12:12'
|
||||
AND node_uid in (2085, 2084)
|
||||
ORDER BY mirror_date ASC
|
||||
) AS calculated_result;
|
||||
node_uid date mirror_date result
|
||||
2085 2012-01-01 00:00:00 2013-01-01 00:00:00 0
|
||||
2084 2012-02-01 00:00:00 2013-01-01 00:00:00 0
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-567: Wrong result from a query with correlated subquery if ICP is allowed
|
||||
#
|
||||
CREATE TABLE t1 (a int, b int, INDEX idx(a));
|
||||
INSERT INTO t1 VALUES (9,0), (7,1), (1,9), (7,3), (2,1);
|
||||
CREATE TABLE t2 (a int, b int, INDEX idx(a));
|
||||
INSERT INTO t2 VALUES (2,1), (6,4), (7,6), (9,4);
|
||||
CREATE TABLE t3 (a int, b int);
|
||||
INSERT INTO t3 VALUES (1,0), (1,1), (1,3);
|
||||
SELECT * FROM t3
|
||||
WHERE a = (SELECT COUNT(DISTINCT t2.b) FROM t1, t2
|
||||
WHERE t1.a = t2.a AND t2.a BETWEEN 7 AND 9
|
||||
AND t3.b = t1.b
|
||||
GROUP BY t1.b);
|
||||
a b
|
||||
1 0
|
||||
1 1
|
||||
1 3
|
||||
set @tmp_mdev567=@@optimizer_switch;
|
||||
set optimizer_switch='mrr=off';
|
||||
SELECT * FROM t3
|
||||
WHERE a = (SELECT COUNT(DISTINCT t2.b) FROM t1, t2
|
||||
WHERE t1.a = t2.a AND t2.a BETWEEN 7 AND 9
|
||||
AND t3.b = t1.b
|
||||
GROUP BY t1.b);
|
||||
a b
|
||||
1 0
|
||||
1 1
|
||||
1 3
|
||||
DROP TABLE t1,t2,t3;
|
||||
set optimizer_switch=@tmp_mdev567;
|
||||
#
|
||||
# MDEV-614, also MDEV-536, also LP:1050806:
|
||||
# different result for a query using subquery between 5.5.25 and 5.5.27
|
||||
#
|
||||
CREATE TABLE `t1` (
|
||||
`node_uid` bigint(20) unsigned DEFAULT NULL,
|
||||
`date` datetime DEFAULT NULL,
|
||||
`mirror_date` datetime DEFAULT NULL,
|
||||
KEY `date` (`date`)
|
||||
) ENGINE=MyISAM;
|
||||
INSERT INTO `t1` VALUES (2085,'2012-01-01 00:00:00','2013-01-01 00:00:00');
|
||||
INSERT INTO `t1` VALUES (2084,'2012-02-01 00:00:00','2013-01-01 00:00:00');
|
||||
INSERT INTO `t1` VALUES (2088,'2012-03-01 00:00:00','2013-01-01 00:00:00');
|
||||
explain
|
||||
SELECT * FROM (
|
||||
SELECT node_uid, date, mirror_date, @result := 0 AS result
|
||||
FROM t1
|
||||
WHERE date < '2012-12-12 12:12:12'
|
||||
AND node_uid in (2085, 2084)
|
||||
ORDER BY mirror_date ASC
|
||||
) AS calculated_result;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE <derived2> ALL NULL NULL NULL NULL 2
|
||||
2 DERIVED t1 range date date 9 NULL 2 Using index condition; Using where; Rowid-ordered scan; Using filesort
|
||||
SELECT * FROM (
|
||||
SELECT node_uid, date, mirror_date, @result := 0 AS result
|
||||
FROM t1
|
||||
WHERE date < '2012-12-12 12:12:12'
|
||||
AND node_uid in (2085, 2084)
|
||||
ORDER BY mirror_date ASC
|
||||
) AS calculated_result;
|
||||
node_uid date mirror_date result
|
||||
2085 2012-01-01 00:00:00 2013-01-01 00:00:00 0
|
||||
2084 2012-02-01 00:00:00 2013-01-01 00:00:00 0
|
||||
set @tmp_mdev614=@@optimizer_switch;
|
||||
set optimizer_switch='mrr=off';
|
||||
explain
|
||||
SELECT * FROM (
|
||||
SELECT node_uid, date, mirror_date, @result := 0 AS result
|
||||
FROM t1
|
||||
WHERE date < '2012-12-12 12:12:12'
|
||||
AND node_uid in (2085, 2084)
|
||||
ORDER BY mirror_date ASC
|
||||
) AS calculated_result;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE <derived2> ALL NULL NULL NULL NULL 2
|
||||
2 DERIVED t1 range date date 9 NULL 2 Using index condition; Using where; Using filesort
|
||||
SELECT * FROM (
|
||||
SELECT node_uid, date, mirror_date, @result := 0 AS result
|
||||
FROM t1
|
||||
WHERE date < '2012-12-12 12:12:12'
|
||||
AND node_uid in (2085, 2084)
|
||||
ORDER BY mirror_date ASC
|
||||
) AS calculated_result;
|
||||
node_uid date mirror_date result
|
||||
2085 2012-01-01 00:00:00 2013-01-01 00:00:00 0
|
||||
2084 2012-02-01 00:00:00 2013-01-01 00:00:00 0
|
||||
set optimizer_switch=@tmp_mdev614;
|
||||
DROP TABLE t1;
|
||||
set optimizer_switch=@subselect2_test_tmp;
|
||||
|
@ -126,7 +126,7 @@ Handler_read_next 0
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_deleted 0
|
||||
Handler_read_rnd_next 50
|
||||
Handler_read_rnd_next 41
|
||||
select 'No key lookups, seq reads: 29= 5 reads from t2 + 4 * 6 reads from t1.' Z;
|
||||
Z
|
||||
No key lookups, seq reads: 29= 5 reads from t2 + 4 * 6 reads from t1.
|
||||
|
@ -136,7 +136,7 @@ Handler_read_next 0
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_deleted 0
|
||||
Handler_read_rnd_next 50
|
||||
Handler_read_rnd_next 41
|
||||
select 'No key lookups, seq reads: 29= 5 reads from t2 + 4 * 6 reads from t1.' Z;
|
||||
Z
|
||||
No key lookups, seq reads: 29= 5 reads from t2 + 4 * 6 reads from t1.
|
||||
|
@ -430,7 +430,7 @@ set @old_optimizer_switch = @@session.optimizer_switch,
|
||||
SET SESSION OPTIMIZER_SWITCH = 'materialization=off,semijoin=off,loosescan=off,firstmatch=off,mrr=on';
|
||||
SET SESSION engine_condition_pushdown = 1;
|
||||
Warnings:
|
||||
Warning 1287 The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MariaDB 10.1. Please use '@@optimizer_switch' instead
|
||||
Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. Please use '@@optimizer_switch' instead
|
||||
SELECT `time_nokey` G1 FROM t1 WHERE ( `varchar_nokey` , `varchar_key` ) IN (
|
||||
SELECT `varchar_nokey` , `varchar_nokey` ) AND `varchar_key` >= 'c' HAVING G1 ORDER
|
||||
BY `pk` ;
|
||||
@ -438,7 +438,7 @@ G1
|
||||
set @@session.optimizer_switch = @old_optimizer_switch,
|
||||
@@session.engine_condition_pushdown = @old_engine_condition_pushdown;
|
||||
Warnings:
|
||||
Warning 1287 The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MariaDB 10.1. Please use '@@optimizer_switch' instead
|
||||
Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. Please use '@@optimizer_switch' instead
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# During work with BUG#45863 I had problems with a query that was
|
||||
@ -625,7 +625,7 @@ SELECT @old_icp:=@@engine_condition_pushdown;
|
||||
#
|
||||
SET SESSION engine_condition_pushdown = 'ON';
|
||||
Warnings:
|
||||
Warning 1287 The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MariaDB 10.1. Please use '@@optimizer_switch' instead
|
||||
Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. Please use '@@optimizer_switch' instead
|
||||
|
||||
SELECT pk
|
||||
FROM t2
|
||||
@ -640,7 +640,7 @@ pk
|
||||
# Restore old value for Index condition pushdown
|
||||
SET SESSION engine_condition_pushdown=@old_icp;
|
||||
Warnings:
|
||||
Warning 1287 The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MariaDB 10.1. Please use '@@optimizer_switch' instead
|
||||
Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. Please use '@@optimizer_switch' instead
|
||||
DROP TABLE t1,t2;
|
||||
#
|
||||
# End of 5.3 tests.
|
||||
@ -1351,7 +1351,7 @@ ON SUBQUERY2_t3.f2)
|
||||
GROUP BY t1.f4 ORDER BY t1.f1 LIMIT 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 system NULL NULL NULL NULL 1 Using temporary; Using filesort
|
||||
1 PRIMARY t1 index NULL f4 5 NULL 11 Using where
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 11 Using where
|
||||
2 DEPENDENT SUBQUERY SUBQUERY2_t1 system NULL NULL NULL NULL 1
|
||||
2 DEPENDENT SUBQUERY SUBQUERY2_t2 index NULL f4 5 NULL 11 Using index
|
||||
2 DEPENDENT SUBQUERY SUBQUERY2_t3 ALL NULL NULL NULL NULL 11 Using where; Using join buffer (flat, BNL join)
|
||||
|
@ -6059,6 +6059,116 @@ WHERE (col_varchar_nokey, 'x') IN
|
||||
col_int_nokey
|
||||
1
|
||||
DROP TABLE ot,it1,it2;
|
||||
#
|
||||
# MDEV-746
|
||||
# Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY
|
||||
# HAS AN EMPTY RESULT
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
pk int NOT NULL,
|
||||
col_int_nokey int NOT NULL,
|
||||
col_int_key int NOT NULL,
|
||||
col_time_key time NOT NULL,
|
||||
col_varchar_key varchar(1) NOT NULL,
|
||||
col_varchar_nokey varchar(1) NOT NULL,
|
||||
PRIMARY KEY (pk),
|
||||
KEY col_int_key (col_int_key),
|
||||
KEY col_time_key (col_time_key),
|
||||
KEY col_varchar_key (col_varchar_key,col_int_key)
|
||||
) ENGINE=MyISAM;
|
||||
CREATE TABLE t2 (
|
||||
pk int NOT NULL AUTO_INCREMENT,
|
||||
col_int_nokey int NOT NULL,
|
||||
col_int_key int NOT NULL,
|
||||
col_time_key time NOT NULL,
|
||||
col_varchar_key varchar(1) NOT NULL,
|
||||
col_varchar_nokey varchar(1) NOT NULL,
|
||||
PRIMARY KEY (pk),
|
||||
KEY col_int_key (col_int_key),
|
||||
KEY col_time_key (col_time_key),
|
||||
KEY col_varchar_key (col_varchar_key,col_int_key)
|
||||
) ENGINE=MyISAM;
|
||||
INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b');
|
||||
SET @var2:=4, @var3:=8;
|
||||
|
||||
Testcase without inner subquery
|
||||
EXPLAIN SELECT @var3:=12, sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
|
||||
sq4_alias1.col_varchar_key = @var3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
SELECT @var3:=12, sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
|
||||
sq4_alias1.col_varchar_key = @var3;
|
||||
@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
|
||||
SELECT @var3;
|
||||
@var3
|
||||
8
|
||||
EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
|
||||
sq4_alias1.col_varchar_key = @var3 ) AS alias3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE <derived2> system NULL NULL NULL NULL 0 const row not found
|
||||
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
|
||||
sq4_alias1.col_varchar_key = @var3 ) AS alias3;
|
||||
@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
|
||||
SELECT @var3;
|
||||
@var3
|
||||
8
|
||||
|
||||
Testcase with inner subquery; crashed WL#6095
|
||||
SET @var3=8;
|
||||
EXPLAIN SELECT sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
|
||||
NOT IN
|
||||
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
|
||||
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
|
||||
FROM t2 AS c_sq1_alias1
|
||||
WHERE (c_sq1_alias1.col_int_nokey != @var2
|
||||
OR c_sq1_alias1.pk != @var3));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1
|
||||
SELECT sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
|
||||
NOT IN
|
||||
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
|
||||
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
|
||||
FROM t2 AS c_sq1_alias1
|
||||
WHERE (c_sq1_alias1.col_int_nokey != @var2
|
||||
OR c_sq1_alias1.pk != @var3));
|
||||
pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
|
||||
EXPLAIN SELECT * FROM ( SELECT sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
|
||||
NOT IN
|
||||
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
|
||||
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
|
||||
FROM t2 AS c_sq1_alias1
|
||||
WHERE (c_sq1_alias1.col_int_nokey != @var2
|
||||
OR c_sq1_alias1.pk != @var3)) ) AS alias3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
3 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1
|
||||
SELECT * FROM ( SELECT sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
|
||||
NOT IN
|
||||
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
|
||||
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
|
||||
FROM t2 AS c_sq1_alias1
|
||||
WHERE (c_sq1_alias1.col_int_nokey != @var2
|
||||
OR c_sq1_alias1.pk != @var3)) ) AS alias3;
|
||||
pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
|
||||
DROP TABLE t1,t2;
|
||||
End of 5.2 tests
|
||||
#
|
||||
# BUG#779885: Crash in eliminate_item_equal with materialization=on in
|
||||
@ -6637,6 +6747,23 @@ a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
|
||||
set optimizer_switch=@mdev367_optimizer_switch;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-521 single value subselect transformation problem
|
||||
#
|
||||
CREATE TABLE t1 (f1 char(2), PRIMARY KEY (f1)) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES ('u1'),('u2');
|
||||
SELECT a.* FROM t1 a WHERE ( SELECT EXISTS ( SELECT 1 FROM t1 b WHERE b.f1 = a.f1 ) );
|
||||
f1
|
||||
u1
|
||||
u2
|
||||
FLUSH TABLES;
|
||||
SELECT a.* FROM t1 a WHERE ( SELECT EXISTS ( SELECT 1 FROM t1 b WHERE b.f1 = a.f1 ) );
|
||||
f1
|
||||
u1
|
||||
u2
|
||||
DROP TABLE t1;
|
||||
# return optimizer switch changed in the beginning of this test
|
||||
set optimizer_switch=@subselect_tmp;
|
||||
#
|
||||
# lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not
|
||||
# precomputed and thus not part of optimization
|
||||
#
|
||||
@ -6841,10 +6968,30 @@ INSERT INTO t2 VALUES (45),(17),(20);
|
||||
EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
|
||||
2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index
|
||||
2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
|
||||
DROP TABLE t1,t2;
|
||||
#
|
||||
# MDEV-435: Expensive subqueries may be evaluated during optimization in merge_key_fields
|
||||
#
|
||||
CREATE TABLE t1 (a INT, KEY(a)) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES (8),(0);
|
||||
CREATE TABLE t2 (b INT, c VARCHAR(1)) ENGINE=MyISAM;
|
||||
INSERT INTO t2 VALUES (4,'j'),(6,'v');
|
||||
CREATE TABLE t3 (d VARCHAR(1)) ENGINE=MyISAM;
|
||||
INSERT INTO t3 VALUES ('b'),('c');
|
||||
EXPLAIN
|
||||
SELECT * FROM t1
|
||||
WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 index a a 5 NULL 2 Using where; Using index
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
|
||||
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2
|
||||
SELECT * FROM t1
|
||||
WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
|
||||
a
|
||||
drop table t1, t2, t3;
|
||||
#
|
||||
# MDEV-405: Server crashes in test_if_skip_sort_order on EXPLAIN with GROUP BY and HAVING in EXISTS subquery
|
||||
#
|
||||
CREATE TABLE t1 (a INT, KEY(a));
|
||||
@ -6854,7 +7001,7 @@ INSERT INTO t2 VALUES (45),(17),(20);
|
||||
EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
|
||||
2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index
|
||||
2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
|
||||
DROP TABLE t1,t2;
|
||||
set optimizer_switch=default;
|
||||
|
@ -6055,6 +6055,116 @@ WHERE (col_varchar_nokey, 'x') IN
|
||||
col_int_nokey
|
||||
1
|
||||
DROP TABLE ot,it1,it2;
|
||||
#
|
||||
# MDEV-746
|
||||
# Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY
|
||||
# HAS AN EMPTY RESULT
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
pk int NOT NULL,
|
||||
col_int_nokey int NOT NULL,
|
||||
col_int_key int NOT NULL,
|
||||
col_time_key time NOT NULL,
|
||||
col_varchar_key varchar(1) NOT NULL,
|
||||
col_varchar_nokey varchar(1) NOT NULL,
|
||||
PRIMARY KEY (pk),
|
||||
KEY col_int_key (col_int_key),
|
||||
KEY col_time_key (col_time_key),
|
||||
KEY col_varchar_key (col_varchar_key,col_int_key)
|
||||
) ENGINE=MyISAM;
|
||||
CREATE TABLE t2 (
|
||||
pk int NOT NULL AUTO_INCREMENT,
|
||||
col_int_nokey int NOT NULL,
|
||||
col_int_key int NOT NULL,
|
||||
col_time_key time NOT NULL,
|
||||
col_varchar_key varchar(1) NOT NULL,
|
||||
col_varchar_nokey varchar(1) NOT NULL,
|
||||
PRIMARY KEY (pk),
|
||||
KEY col_int_key (col_int_key),
|
||||
KEY col_time_key (col_time_key),
|
||||
KEY col_varchar_key (col_varchar_key,col_int_key)
|
||||
) ENGINE=MyISAM;
|
||||
INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b');
|
||||
SET @var2:=4, @var3:=8;
|
||||
|
||||
Testcase without inner subquery
|
||||
EXPLAIN SELECT @var3:=12, sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
|
||||
sq4_alias1.col_varchar_key = @var3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
SELECT @var3:=12, sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
|
||||
sq4_alias1.col_varchar_key = @var3;
|
||||
@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
|
||||
SELECT @var3;
|
||||
@var3
|
||||
8
|
||||
EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
|
||||
sq4_alias1.col_varchar_key = @var3 ) AS alias3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE <derived2> system NULL NULL NULL NULL 0 const row not found
|
||||
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
|
||||
sq4_alias1.col_varchar_key = @var3 ) AS alias3;
|
||||
@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
|
||||
SELECT @var3;
|
||||
@var3
|
||||
8
|
||||
|
||||
Testcase with inner subquery; crashed WL#6095
|
||||
SET @var3=8;
|
||||
EXPLAIN SELECT sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
|
||||
NOT IN
|
||||
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
|
||||
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
|
||||
FROM t2 AS c_sq1_alias1
|
||||
WHERE (c_sq1_alias1.col_int_nokey != @var2
|
||||
OR c_sq1_alias1.pk != @var3));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1
|
||||
SELECT sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
|
||||
NOT IN
|
||||
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
|
||||
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
|
||||
FROM t2 AS c_sq1_alias1
|
||||
WHERE (c_sq1_alias1.col_int_nokey != @var2
|
||||
OR c_sq1_alias1.pk != @var3));
|
||||
pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
|
||||
EXPLAIN SELECT * FROM ( SELECT sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
|
||||
NOT IN
|
||||
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
|
||||
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
|
||||
FROM t2 AS c_sq1_alias1
|
||||
WHERE (c_sq1_alias1.col_int_nokey != @var2
|
||||
OR c_sq1_alias1.pk != @var3)) ) AS alias3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
3 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1
|
||||
SELECT * FROM ( SELECT sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
|
||||
NOT IN
|
||||
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
|
||||
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
|
||||
FROM t2 AS c_sq1_alias1
|
||||
WHERE (c_sq1_alias1.col_int_nokey != @var2
|
||||
OR c_sq1_alias1.pk != @var3)) ) AS alias3;
|
||||
pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
|
||||
DROP TABLE t1,t2;
|
||||
End of 5.2 tests
|
||||
#
|
||||
# BUG#779885: Crash in eliminate_item_equal with materialization=on in
|
||||
@ -6633,6 +6743,23 @@ a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
|
||||
set optimizer_switch=@mdev367_optimizer_switch;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-521 single value subselect transformation problem
|
||||
#
|
||||
CREATE TABLE t1 (f1 char(2), PRIMARY KEY (f1)) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES ('u1'),('u2');
|
||||
SELECT a.* FROM t1 a WHERE ( SELECT EXISTS ( SELECT 1 FROM t1 b WHERE b.f1 = a.f1 ) );
|
||||
f1
|
||||
u1
|
||||
u2
|
||||
FLUSH TABLES;
|
||||
SELECT a.* FROM t1 a WHERE ( SELECT EXISTS ( SELECT 1 FROM t1 b WHERE b.f1 = a.f1 ) );
|
||||
f1
|
||||
u1
|
||||
u2
|
||||
DROP TABLE t1;
|
||||
# return optimizer switch changed in the beginning of this test
|
||||
set optimizer_switch=@subselect_tmp;
|
||||
#
|
||||
# lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not
|
||||
# precomputed and thus not part of optimization
|
||||
#
|
||||
@ -6838,10 +6965,31 @@ INSERT INTO t2 VALUES (45),(17),(20);
|
||||
EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
|
||||
2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index
|
||||
2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
|
||||
DROP TABLE t1,t2;
|
||||
#
|
||||
# MDEV-435: Expensive subqueries may be evaluated during optimization in merge_key_fields
|
||||
#
|
||||
CREATE TABLE t1 (a INT, KEY(a)) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES (8),(0);
|
||||
CREATE TABLE t2 (b INT, c VARCHAR(1)) ENGINE=MyISAM;
|
||||
INSERT INTO t2 VALUES (4,'j'),(6,'v');
|
||||
CREATE TABLE t3 (d VARCHAR(1)) ENGINE=MyISAM;
|
||||
INSERT INTO t3 VALUES ('b'),('c');
|
||||
EXPLAIN
|
||||
SELECT * FROM t1
|
||||
WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 index a a 5 NULL 2 Using where; Using index
|
||||
2 SUBQUERY <subquery3> ALL distinct_key NULL NULL NULL 1
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2
|
||||
SELECT * FROM t1
|
||||
WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
|
||||
a
|
||||
drop table t1, t2, t3;
|
||||
#
|
||||
# MDEV-405: Server crashes in test_if_skip_sort_order on EXPLAIN with GROUP BY and HAVING in EXISTS subquery
|
||||
#
|
||||
CREATE TABLE t1 (a INT, KEY(a));
|
||||
@ -6851,7 +6999,7 @@ INSERT INTO t2 VALUES (45),(17),(20);
|
||||
EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
|
||||
2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index
|
||||
2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
|
||||
DROP TABLE t1,t2;
|
||||
set @optimizer_switch_for_subselect_test=null;
|
||||
|
@ -6066,6 +6066,116 @@ WHERE (col_varchar_nokey, 'x') IN
|
||||
col_int_nokey
|
||||
1
|
||||
DROP TABLE ot,it1,it2;
|
||||
#
|
||||
# MDEV-746
|
||||
# Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY
|
||||
# HAS AN EMPTY RESULT
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
pk int NOT NULL,
|
||||
col_int_nokey int NOT NULL,
|
||||
col_int_key int NOT NULL,
|
||||
col_time_key time NOT NULL,
|
||||
col_varchar_key varchar(1) NOT NULL,
|
||||
col_varchar_nokey varchar(1) NOT NULL,
|
||||
PRIMARY KEY (pk),
|
||||
KEY col_int_key (col_int_key),
|
||||
KEY col_time_key (col_time_key),
|
||||
KEY col_varchar_key (col_varchar_key,col_int_key)
|
||||
) ENGINE=MyISAM;
|
||||
CREATE TABLE t2 (
|
||||
pk int NOT NULL AUTO_INCREMENT,
|
||||
col_int_nokey int NOT NULL,
|
||||
col_int_key int NOT NULL,
|
||||
col_time_key time NOT NULL,
|
||||
col_varchar_key varchar(1) NOT NULL,
|
||||
col_varchar_nokey varchar(1) NOT NULL,
|
||||
PRIMARY KEY (pk),
|
||||
KEY col_int_key (col_int_key),
|
||||
KEY col_time_key (col_time_key),
|
||||
KEY col_varchar_key (col_varchar_key,col_int_key)
|
||||
) ENGINE=MyISAM;
|
||||
INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b');
|
||||
SET @var2:=4, @var3:=8;
|
||||
|
||||
Testcase without inner subquery
|
||||
EXPLAIN SELECT @var3:=12, sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
|
||||
sq4_alias1.col_varchar_key = @var3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
SELECT @var3:=12, sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
|
||||
sq4_alias1.col_varchar_key = @var3;
|
||||
@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
|
||||
SELECT @var3;
|
||||
@var3
|
||||
8
|
||||
EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
|
||||
sq4_alias1.col_varchar_key = @var3 ) AS alias3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE <derived2> system NULL NULL NULL NULL 0 const row not found
|
||||
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
|
||||
sq4_alias1.col_varchar_key = @var3 ) AS alias3;
|
||||
@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
|
||||
SELECT @var3;
|
||||
@var3
|
||||
8
|
||||
|
||||
Testcase with inner subquery; crashed WL#6095
|
||||
SET @var3=8;
|
||||
EXPLAIN SELECT sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
|
||||
NOT IN
|
||||
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
|
||||
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
|
||||
FROM t2 AS c_sq1_alias1
|
||||
WHERE (c_sq1_alias1.col_int_nokey != @var2
|
||||
OR c_sq1_alias1.pk != @var3));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1
|
||||
SELECT sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
|
||||
NOT IN
|
||||
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
|
||||
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
|
||||
FROM t2 AS c_sq1_alias1
|
||||
WHERE (c_sq1_alias1.col_int_nokey != @var2
|
||||
OR c_sq1_alias1.pk != @var3));
|
||||
pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
|
||||
EXPLAIN SELECT * FROM ( SELECT sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
|
||||
NOT IN
|
||||
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
|
||||
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
|
||||
FROM t2 AS c_sq1_alias1
|
||||
WHERE (c_sq1_alias1.col_int_nokey != @var2
|
||||
OR c_sq1_alias1.pk != @var3)) ) AS alias3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
3 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1
|
||||
SELECT * FROM ( SELECT sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
|
||||
NOT IN
|
||||
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
|
||||
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
|
||||
FROM t2 AS c_sq1_alias1
|
||||
WHERE (c_sq1_alias1.col_int_nokey != @var2
|
||||
OR c_sq1_alias1.pk != @var3)) ) AS alias3;
|
||||
pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
|
||||
DROP TABLE t1,t2;
|
||||
End of 5.2 tests
|
||||
#
|
||||
# BUG#779885: Crash in eliminate_item_equal with materialization=on in
|
||||
@ -6644,6 +6754,23 @@ a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
|
||||
set optimizer_switch=@mdev367_optimizer_switch;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-521 single value subselect transformation problem
|
||||
#
|
||||
CREATE TABLE t1 (f1 char(2), PRIMARY KEY (f1)) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES ('u1'),('u2');
|
||||
SELECT a.* FROM t1 a WHERE ( SELECT EXISTS ( SELECT 1 FROM t1 b WHERE b.f1 = a.f1 ) );
|
||||
f1
|
||||
u1
|
||||
u2
|
||||
FLUSH TABLES;
|
||||
SELECT a.* FROM t1 a WHERE ( SELECT EXISTS ( SELECT 1 FROM t1 b WHERE b.f1 = a.f1 ) );
|
||||
f1
|
||||
u1
|
||||
u2
|
||||
DROP TABLE t1;
|
||||
# return optimizer switch changed in the beginning of this test
|
||||
set optimizer_switch=@subselect_tmp;
|
||||
#
|
||||
# lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not
|
||||
# precomputed and thus not part of optimization
|
||||
#
|
||||
@ -6849,10 +6976,31 @@ INSERT INTO t2 VALUES (45),(17),(20);
|
||||
EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
|
||||
2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index
|
||||
2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
|
||||
DROP TABLE t1,t2;
|
||||
#
|
||||
# MDEV-435: Expensive subqueries may be evaluated during optimization in merge_key_fields
|
||||
#
|
||||
CREATE TABLE t1 (a INT, KEY(a)) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES (8),(0);
|
||||
CREATE TABLE t2 (b INT, c VARCHAR(1)) ENGINE=MyISAM;
|
||||
INSERT INTO t2 VALUES (4,'j'),(6,'v');
|
||||
CREATE TABLE t3 (d VARCHAR(1)) ENGINE=MyISAM;
|
||||
INSERT INTO t3 VALUES ('b'),('c');
|
||||
EXPLAIN
|
||||
SELECT * FROM t1
|
||||
WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 index a a 5 NULL 2 Using where; Using index
|
||||
2 SUBQUERY <subquery3> ALL distinct_key NULL NULL NULL 1
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2
|
||||
SELECT * FROM t1
|
||||
WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
|
||||
a
|
||||
drop table t1, t2, t3;
|
||||
#
|
||||
# MDEV-405: Server crashes in test_if_skip_sort_order on EXPLAIN with GROUP BY and HAVING in EXISTS subquery
|
||||
#
|
||||
CREATE TABLE t1 (a INT, KEY(a));
|
||||
@ -6862,7 +7010,7 @@ INSERT INTO t2 VALUES (45),(17),(20);
|
||||
EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
|
||||
2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index
|
||||
2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
|
||||
DROP TABLE t1,t2;
|
||||
set optimizer_switch=default;
|
||||
|
@ -6055,6 +6055,116 @@ WHERE (col_varchar_nokey, 'x') IN
|
||||
col_int_nokey
|
||||
1
|
||||
DROP TABLE ot,it1,it2;
|
||||
#
|
||||
# MDEV-746
|
||||
# Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY
|
||||
# HAS AN EMPTY RESULT
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
pk int NOT NULL,
|
||||
col_int_nokey int NOT NULL,
|
||||
col_int_key int NOT NULL,
|
||||
col_time_key time NOT NULL,
|
||||
col_varchar_key varchar(1) NOT NULL,
|
||||
col_varchar_nokey varchar(1) NOT NULL,
|
||||
PRIMARY KEY (pk),
|
||||
KEY col_int_key (col_int_key),
|
||||
KEY col_time_key (col_time_key),
|
||||
KEY col_varchar_key (col_varchar_key,col_int_key)
|
||||
) ENGINE=MyISAM;
|
||||
CREATE TABLE t2 (
|
||||
pk int NOT NULL AUTO_INCREMENT,
|
||||
col_int_nokey int NOT NULL,
|
||||
col_int_key int NOT NULL,
|
||||
col_time_key time NOT NULL,
|
||||
col_varchar_key varchar(1) NOT NULL,
|
||||
col_varchar_nokey varchar(1) NOT NULL,
|
||||
PRIMARY KEY (pk),
|
||||
KEY col_int_key (col_int_key),
|
||||
KEY col_time_key (col_time_key),
|
||||
KEY col_varchar_key (col_varchar_key,col_int_key)
|
||||
) ENGINE=MyISAM;
|
||||
INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b');
|
||||
SET @var2:=4, @var3:=8;
|
||||
|
||||
Testcase without inner subquery
|
||||
EXPLAIN SELECT @var3:=12, sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
|
||||
sq4_alias1.col_varchar_key = @var3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
SELECT @var3:=12, sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
|
||||
sq4_alias1.col_varchar_key = @var3;
|
||||
@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
|
||||
SELECT @var3;
|
||||
@var3
|
||||
8
|
||||
EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
|
||||
sq4_alias1.col_varchar_key = @var3 ) AS alias3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE <derived2> system NULL NULL NULL NULL 0 const row not found
|
||||
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
|
||||
sq4_alias1.col_varchar_key = @var3 ) AS alias3;
|
||||
@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
|
||||
SELECT @var3;
|
||||
@var3
|
||||
8
|
||||
|
||||
Testcase with inner subquery; crashed WL#6095
|
||||
SET @var3=8;
|
||||
EXPLAIN SELECT sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
|
||||
NOT IN
|
||||
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
|
||||
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
|
||||
FROM t2 AS c_sq1_alias1
|
||||
WHERE (c_sq1_alias1.col_int_nokey != @var2
|
||||
OR c_sq1_alias1.pk != @var3));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1
|
||||
SELECT sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
|
||||
NOT IN
|
||||
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
|
||||
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
|
||||
FROM t2 AS c_sq1_alias1
|
||||
WHERE (c_sq1_alias1.col_int_nokey != @var2
|
||||
OR c_sq1_alias1.pk != @var3));
|
||||
pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
|
||||
EXPLAIN SELECT * FROM ( SELECT sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
|
||||
NOT IN
|
||||
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
|
||||
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
|
||||
FROM t2 AS c_sq1_alias1
|
||||
WHERE (c_sq1_alias1.col_int_nokey != @var2
|
||||
OR c_sq1_alias1.pk != @var3)) ) AS alias3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
3 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1
|
||||
SELECT * FROM ( SELECT sq4_alias1.*
|
||||
FROM t1 AS sq4_alias1
|
||||
WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
|
||||
NOT IN
|
||||
(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
|
||||
c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
|
||||
FROM t2 AS c_sq1_alias1
|
||||
WHERE (c_sq1_alias1.col_int_nokey != @var2
|
||||
OR c_sq1_alias1.pk != @var3)) ) AS alias3;
|
||||
pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
|
||||
DROP TABLE t1,t2;
|
||||
End of 5.2 tests
|
||||
#
|
||||
# BUG#779885: Crash in eliminate_item_equal with materialization=on in
|
||||
@ -6633,6 +6743,23 @@ a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
|
||||
set optimizer_switch=@mdev367_optimizer_switch;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-521 single value subselect transformation problem
|
||||
#
|
||||
CREATE TABLE t1 (f1 char(2), PRIMARY KEY (f1)) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES ('u1'),('u2');
|
||||
SELECT a.* FROM t1 a WHERE ( SELECT EXISTS ( SELECT 1 FROM t1 b WHERE b.f1 = a.f1 ) );
|
||||
f1
|
||||
u1
|
||||
u2
|
||||
FLUSH TABLES;
|
||||
SELECT a.* FROM t1 a WHERE ( SELECT EXISTS ( SELECT 1 FROM t1 b WHERE b.f1 = a.f1 ) );
|
||||
f1
|
||||
u1
|
||||
u2
|
||||
DROP TABLE t1;
|
||||
# return optimizer switch changed in the beginning of this test
|
||||
set optimizer_switch=@subselect_tmp;
|
||||
#
|
||||
# lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not
|
||||
# precomputed and thus not part of optimization
|
||||
#
|
||||
@ -6838,10 +6965,31 @@ INSERT INTO t2 VALUES (45),(17),(20);
|
||||
EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
|
||||
2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index
|
||||
2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
|
||||
DROP TABLE t1,t2;
|
||||
#
|
||||
# MDEV-435: Expensive subqueries may be evaluated during optimization in merge_key_fields
|
||||
#
|
||||
CREATE TABLE t1 (a INT, KEY(a)) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES (8),(0);
|
||||
CREATE TABLE t2 (b INT, c VARCHAR(1)) ENGINE=MyISAM;
|
||||
INSERT INTO t2 VALUES (4,'j'),(6,'v');
|
||||
CREATE TABLE t3 (d VARCHAR(1)) ENGINE=MyISAM;
|
||||
INSERT INTO t3 VALUES ('b'),('c');
|
||||
EXPLAIN
|
||||
SELECT * FROM t1
|
||||
WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 index a a 5 NULL 2 Using where; Using index
|
||||
2 SUBQUERY <subquery3> ALL distinct_key NULL NULL NULL 1
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2
|
||||
SELECT * FROM t1
|
||||
WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
|
||||
a
|
||||
drop table t1, t2, t3;
|
||||
#
|
||||
# MDEV-405: Server crashes in test_if_skip_sort_order on EXPLAIN with GROUP BY and HAVING in EXISTS subquery
|
||||
#
|
||||
CREATE TABLE t1 (a INT, KEY(a));
|
||||
@ -6851,7 +6999,7 @@ INSERT INTO t2 VALUES (45),(17),(20);
|
||||
EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
|
||||
2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index
|
||||
2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
|
||||
DROP TABLE t1,t2;
|
||||
set @optimizer_switch_for_subselect_test=null;
|
||||
|
@ -498,4 +498,36 @@ DROP TABLE t1;
|
||||
#
|
||||
SET @bug12408412=1;
|
||||
SELECT GROUP_CONCAT(@bug12408412 ORDER BY 1) INTO @bug12408412;
|
||||
CREATE TABLE t1(a INT);
|
||||
INSERT INTO t1 VALUES (0);
|
||||
SELECT DISTINCT POW(COUNT(*), @a:=(SELECT 1 FROM t1 LEFT JOIN t1 AS t2 ON @a))
|
||||
AS b FROM t1 GROUP BY a;
|
||||
b
|
||||
1
|
||||
SELECT @a;
|
||||
@a
|
||||
1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(f1 INT, f2 INT);
|
||||
INSERT INTO t1 VALUES (1,2),(2,3),(3,1);
|
||||
CREATE TABLE t2(a INT);
|
||||
INSERT INTO t2 VALUES (1);
|
||||
SET @var=NULL;
|
||||
SELECT @var:=(SELECT f2 FROM t2 WHERE @var) FROM t1 GROUP BY f1 ORDER BY f2 DESC
|
||||
LIMIT 1;
|
||||
@var:=(SELECT f2 FROM t2 WHERE @var)
|
||||
NULL
|
||||
SELECT @var;
|
||||
@var
|
||||
NULL
|
||||
DROP TABLE t1, t2;
|
||||
CREATE TABLE t1(a INT);
|
||||
INSERT INTO t1 VALUES (0),(1),(3);
|
||||
SELECT DISTINCT POW(COUNT(distinct a), @a:=(SELECT 1 FROM t1 LEFT JOIN t1 AS t2 ON @a limit 1)) AS b FROM t1 GROUP BY a;
|
||||
b
|
||||
1
|
||||
SELECT @a;
|
||||
@a
|
||||
1
|
||||
DROP TABLE t1;
|
||||
End of 5.5 tests
|
||||
|
@ -538,7 +538,7 @@ Warning 1292 Truncated incorrect read_buffer_size value: '100'
|
||||
set read_rnd_buffer_size=100;
|
||||
set global rpl_recovery_rank=100;
|
||||
Warnings:
|
||||
Warning 1287 The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MariaDB 10.1.
|
||||
Warning 1287 '@@rpl_recovery_rank' is deprecated and will be removed in a future release.
|
||||
set global server_id=100;
|
||||
set global slow_launch_time=100;
|
||||
set sort_buffer_size=100;
|
||||
@ -1060,7 +1060,7 @@ set global net_write_timeout =@my_net_write_timeout;
|
||||
set global net_read_timeout =@my_net_read_timeout;
|
||||
set global rpl_recovery_rank =@my_rpl_recovery_rank;
|
||||
Warnings:
|
||||
Warning 1287 The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MariaDB 10.1.
|
||||
Warning 1287 '@@rpl_recovery_rank' is deprecated and will be removed in a future release.
|
||||
set global server_id =@my_server_id;
|
||||
set global slow_launch_time =@my_slow_launch_time;
|
||||
set global default_storage_engine =@my_storage_engine;
|
||||
|
@ -4530,6 +4530,55 @@ WHERE t4.a >= v1.a);
|
||||
a a
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1,t2,t3,t4;
|
||||
#
|
||||
# LP bug #823237: dependent subquery with LEFT JOIN
|
||||
# referencing view in WHERE
|
||||
# (duplicate of LP bug #823189)
|
||||
#
|
||||
CREATE TABLE t1 (a int);
|
||||
CREATE TABLE t2 ( b int, d int, e int);
|
||||
INSERT INTO t2 VALUES (7,8,0);
|
||||
CREATE TABLE t3 ( c int);
|
||||
INSERT INTO t3 VALUES (0);
|
||||
CREATE TABLE t4 (a int, b int, c int);
|
||||
INSERT INTO t4 VALUES (93,1,0), (95,NULL,0);
|
||||
CREATE VIEW v4 AS SELECT * FROM t4;
|
||||
EXPLAIN EXTENDED
|
||||
SELECT * FROM t3 , t4
|
||||
WHERE t4.c <= (SELECT t2.e FROM t2 LEFT JOIN t1 ON ( t1.a = t2.d )
|
||||
WHERE t2.b > t4.b);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 system NULL NULL NULL NULL 1 100.00
|
||||
1 PRIMARY t4 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 100.00
|
||||
2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t4.b' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select 0 AS `c`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c` from `test`.`t4` where (`test`.`t4`.`c` <= <expr_cache><`test`.`t4`.`b`>((select 0 from dual where (7 > `test`.`t4`.`b`))))
|
||||
SELECT * FROM t3 , t4
|
||||
WHERE t4.c <= (SELECT t2.e FROM t2 LEFT JOIN t1 ON ( t1.a = t2.d )
|
||||
WHERE t2.b > t4.b);
|
||||
c a b c
|
||||
0 93 1 0
|
||||
EXPLAIN EXTENDED
|
||||
SELECT * FROM t3, v4
|
||||
WHERE v4.c <= (SELECT t2.e FROM t2 LEFT JOIN t1 ON ( t1.a = t2.d )
|
||||
WHERE t2.b > v4.b);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 system NULL NULL NULL NULL 1 100.00
|
||||
1 PRIMARY t4 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 100.00
|
||||
2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'v4.b' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select 0 AS `c`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c` from `test`.`t4` where (`test`.`t4`.`c` <= <expr_cache><`test`.`t4`.`b`>((select 0 from dual where (7 > `test`.`t4`.`b`))))
|
||||
SELECT * FROM t3, v4
|
||||
WHERE v4.c <= (SELECT t2.e FROM t2 LEFT JOIN t1 ON ( t1.a = t2.d )
|
||||
WHERE t2.b > v4.b);
|
||||
c a b c
|
||||
0 93 1 0
|
||||
DROP VIEW v4;
|
||||
DROP TABLE t1,t2,t3,t4;
|
||||
drop table if exists t_9801;
|
||||
drop view if exists v_9801;
|
||||
create table t_9801 (s1 int);
|
||||
@ -4730,7 +4779,82 @@ id id bbb iddqd val1
|
||||
30631 NULL NULL NULL NULL
|
||||
drop view v2;
|
||||
drop table t1,t2;
|
||||
#
|
||||
# MDEV-589 (LP BUG#1007647) :
|
||||
# Assertion `vcol_table == 0 || vcol_table == table' failed in
|
||||
# fill_record(THD*, List<Item>&, List<Item>&, bool)
|
||||
#
|
||||
CREATE TABLE t1 (f1 INT, f2 INT);
|
||||
CREATE TABLE t2 (f1 INT, f2 INT);
|
||||
CREATE ALGORITHM=MERGE VIEW v1 AS SELECT a1.f1, a2.f2 FROM t1 AS a1, t1 AS a2;
|
||||
CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM v1;
|
||||
CREATE ALGORITHM=MERGE VIEW v3 AS SELECT a1.f1, a2.f2 FROM t1 AS a1, t2 AS a2;
|
||||
CREATE ALGORITHM=MERGE VIEW v4 AS SELECT * FROM v3;
|
||||
INSERT INTO v3 (f1, f2) VALUES (1, 2);
|
||||
ERROR HY000: Can not modify more than one base table through a join view 'test.v3'
|
||||
INSERT INTO v1 (f1, f2) VALUES (1, 2);
|
||||
ERROR HY000: Can not modify more than one base table through a join view 'test.v1'
|
||||
INSERT INTO v4 (f1, f2) VALUES (1, 2);
|
||||
ERROR HY000: Can not modify more than one base table through a join view 'test.v4'
|
||||
INSERT INTO v2 (f1, f2) VALUES (1, 2);
|
||||
ERROR HY000: Can not modify more than one base table through a join view 'test.v2'
|
||||
drop view v4,v3,v2,v1;
|
||||
drop table t1,t2;
|
||||
#
|
||||
# MDEV-3799 fix of above bugfix (MDEV-589)
|
||||
# Wrong result (NULLs instead of real values) with RIGHT JOIN
|
||||
# in a FROM subquery and derived_merge=on
|
||||
#
|
||||
CREATE TABLE t1 (f1 INT) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES (4),(6);
|
||||
CREATE TABLE t2 (f2 INT) ENGINE=MyISAM;
|
||||
INSERT INTO t2 VALUES (7),(8);
|
||||
SELECT * FROM (
|
||||
SELECT * FROM t1 RIGHT JOIN t2 ON f1 = f2
|
||||
) AS alias;
|
||||
f1 f2
|
||||
NULL 7
|
||||
NULL 8
|
||||
SELECT * FROM (
|
||||
SELECT * FROM t2 LEFT JOIN t1 ON f1 = f2
|
||||
) AS alias;
|
||||
f2 f1
|
||||
7 NULL
|
||||
8 NULL
|
||||
drop tables t1,t2;
|
||||
# -----------------------------------------------------------------
|
||||
# -- End of 5.3 tests.
|
||||
# -----------------------------------------------------------------
|
||||
#
|
||||
# MDEV-3874: Server crashes in Item_field::print on a SELECT
|
||||
# from a MERGE view with materialization+semijoin, subquery, ORDER BY
|
||||
#
|
||||
SET @save_optimizer_switch_MDEV_3874=@@optimizer_switch;
|
||||
SET optimizer_switch = 'materialization=on,semijoin=on';
|
||||
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES (1),(7);
|
||||
CREATE TABLE t2 (b INT) ENGINE=MyISAM;
|
||||
INSERT INTO t2 VALUES (4),(6);
|
||||
CREATE TABLE t3 (c INT) ENGINE=MyISAM;
|
||||
INSERT INTO t3 VALUES (1),(2);
|
||||
CREATE ALGORITHM=MERGE VIEW v1 AS SELECT
|
||||
( SELECT a FROM t1 WHERE ( 1, 1 ) IN (
|
||||
SELECT b, c FROM t2, t3 HAVING c > 2 ) ) AS field1,
|
||||
b + c AS field2
|
||||
FROM t2, t3 AS table1
|
||||
GROUP BY field1, field2 ORDER BY field1;
|
||||
Warnings:
|
||||
Warning 1354 View merge algorithm can't be used here for now (assumed undefined algorithm)
|
||||
SELECT * FROM v1;
|
||||
field1 field2
|
||||
NULL 5
|
||||
NULL 7
|
||||
NULL 6
|
||||
NULL 8
|
||||
drop view v1;
|
||||
drop table t1,t2,t3;
|
||||
SET optimizer_switch=@save_optimizer_switch_MDEV_3874;
|
||||
# -----------------------------------------------------------------
|
||||
# -- End of 5.5 tests.
|
||||
# -----------------------------------------------------------------
|
||||
SET optimizer_switch=@save_optimizer_switch;
|
||||
|
@ -1,5 +1,5 @@
|
||||
source include/have_archive.inc;
|
||||
source federated.inc;
|
||||
source suite/federated/include/federated.inc;
|
||||
|
||||
|
||||
connection slave;
|
||||
@ -54,5 +54,5 @@ connection slave;
|
||||
DROP TABLE federated.archive_table;
|
||||
|
||||
|
||||
source federated_cleanup.inc;
|
||||
source suite/federated/include/federated_cleanup.inc;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
source federated.inc;
|
||||
source suite/federated/include/federated.inc;
|
||||
|
||||
connection slave;
|
||||
--disable_warnings
|
||||
@ -37,5 +37,5 @@ connection slave;
|
||||
DROP TABLE federated.bug_13118_table;
|
||||
|
||||
|
||||
source federated_cleanup.inc;
|
||||
source suite/federated/include/federated_cleanup.inc;
|
||||
|
||||
|
@ -4,7 +4,7 @@ if (!$MYSQL_BUG25714)
|
||||
skip Need bug25714 test program;
|
||||
}
|
||||
|
||||
source federated.inc;
|
||||
source suite/federated/include/federated.inc;
|
||||
|
||||
connection master;
|
||||
# Disable concurrent inserts to avoid test failures when reading
|
||||
@ -59,4 +59,4 @@ SET @@GLOBAL.CONCURRENT_INSERT= @OLD_SLAVE_CONCURRENT_INSERT;
|
||||
|
||||
|
||||
|
||||
source federated_cleanup.inc;
|
||||
source suite/federated/include/federated_cleanup.inc;
|
||||
|
@ -1,4 +1,4 @@
|
||||
source federated.inc;
|
||||
source include/federated.inc;
|
||||
|
||||
--echo #
|
||||
--echo # Bug #32426: FEDERATED query returns corrupt results for ORDER BY
|
||||
@ -21,4 +21,4 @@ DROP TABLE federated.t1;
|
||||
|
||||
connection default;
|
||||
|
||||
source federated_cleanup.inc;
|
||||
source include/federated_cleanup.inc;
|
||||
|
@ -9,7 +9,7 @@
|
||||
--echo # to complete while still indicating a problem. This fix applies to any non-fatal system
|
||||
--echo # error that occurs during a query against I_S.TABLES.de
|
||||
|
||||
--source federated.inc
|
||||
--source suite/federated/include/federated.inc
|
||||
|
||||
--disable_warnings
|
||||
# Federated database exists
|
||||
@ -74,4 +74,4 @@ DROP TABLE t1;
|
||||
--echo # Cleanup
|
||||
--echo #
|
||||
|
||||
--source federated_cleanup.inc
|
||||
--source suite/federated/include/federated_cleanup.inc
|
||||
|
@ -1,4 +1,4 @@
|
||||
source federated.inc;
|
||||
source include/federated.inc;
|
||||
|
||||
--echo #
|
||||
--echo # Bug #585688: maridb crashes in federatedx code
|
||||
@ -49,5 +49,5 @@ DROP TABLE federated.t1;
|
||||
|
||||
connection default;
|
||||
|
||||
source federated_cleanup.inc;
|
||||
source include/federated_cleanup.inc;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
--source include/have_debug.inc
|
||||
--source include/long_test.inc
|
||||
--source federated.inc
|
||||
--source include/federated.inc
|
||||
|
||||
--echo #
|
||||
--echo # Bug#47525: MySQL crashed (Federated)
|
||||
@ -37,4 +37,4 @@ DROP TABLE t1;
|
||||
|
||||
connection default;
|
||||
--echo # Federated cleanup
|
||||
source federated_cleanup.inc;
|
||||
source suite/federated/include/federated_cleanup.inc;
|
||||
|
@ -4,7 +4,7 @@
|
||||
# See Bug #40645 Test main.federated_innodb does not always clean up after itself
|
||||
|
||||
source include/have_innodb.inc;
|
||||
source federated.inc;
|
||||
source suite/federated/include/federated.inc;
|
||||
|
||||
#
|
||||
# Bug#25513 Federated transaction failures
|
||||
@ -36,4 +36,4 @@ connection slave;
|
||||
drop table federated.t1;
|
||||
|
||||
|
||||
source federated_cleanup.inc;
|
||||
source suite/federated/include/federated_cleanup.inc;
|
||||
|
@ -4,7 +4,7 @@
|
||||
source have_federatedx.inc;
|
||||
source include/have_partition.inc;
|
||||
source include/have_innodb.inc;
|
||||
source federated.inc;
|
||||
source include/federated.inc;
|
||||
|
||||
disable_warnings;
|
||||
drop table if exists t1;
|
||||
@ -50,4 +50,4 @@ drop table federated.t1_2;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
||||
source federated_cleanup.inc;
|
||||
source include/federated_cleanup.inc;
|
||||
|
@ -4,7 +4,7 @@
|
||||
# Slow test, don't run during staging part
|
||||
-- source include/not_staging.inc
|
||||
-- source include/big_test.inc
|
||||
-- source federated.inc
|
||||
-- source include/federated.inc
|
||||
|
||||
connection slave;
|
||||
create database first_db;
|
||||
@ -343,4 +343,4 @@ drop table t1;
|
||||
drop server if exists s;
|
||||
|
||||
|
||||
source federated_cleanup.inc;
|
||||
source suite/federated/include/federated_cleanup.inc;
|
||||
|
@ -1,6 +1,6 @@
|
||||
source have_federatedx.inc;
|
||||
source include/have_innodb.inc;
|
||||
source federated.inc;
|
||||
source suite/federated/include/federated.inc;
|
||||
|
||||
connection slave;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
@ -36,4 +36,4 @@ INSERT INTO federated.t1 (id, name) VALUES (6, 'fig');
|
||||
SELECT * FROM federated.t1;
|
||||
DELETE FROM federated.t1;
|
||||
|
||||
source federated_cleanup.inc;
|
||||
source suite/federated/include/federated_cleanup.inc;
|
||||
|
@ -4,7 +4,7 @@
|
||||
#
|
||||
|
||||
|
||||
--source federated.inc
|
||||
--source include/federated.inc
|
||||
--source have_federatedx.inc
|
||||
|
||||
connection default;
|
||||
@ -1999,4 +1999,4 @@ connection slave;
|
||||
SET @@GLOBAL.CONCURRENT_INSERT= @OLD_SLAVE_CONCURRENT_INSERT;
|
||||
|
||||
connection default;
|
||||
source federated_cleanup.inc;
|
||||
source include/federated_cleanup.inc;
|
||||
|
@ -59,7 +59,7 @@ def mysql func ret 2 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(1)
|
||||
def mysql func type 4 NULL NO enum 9 27 NULL NULL NULL utf8 utf8_general_ci enum('function','aggregate')
|
||||
def mysql general_log argument 6 NULL NO mediumtext 16777215 16777215 NULL NULL NULL utf8 utf8_general_ci mediumtext
|
||||
def mysql general_log command_type 5 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64)
|
||||
def mysql general_log event_time 1 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 6 NULL NULL timestamp(6) on update CURRENT_TIMESTAMP
|
||||
def mysql general_log event_time 1 CURRENT_TIMESTAMP(6) NO timestamp NULL NULL NULL NULL 6 NULL NULL timestamp(6) on update CURRENT_TIMESTAMP
|
||||
def mysql general_log server_id 4 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned
|
||||
def mysql general_log thread_id 3 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11)
|
||||
def mysql general_log user_host 2 NULL NO mediumtext 16777215 16777215 NULL NULL NULL utf8 utf8_general_ci mediumtext
|
||||
@ -159,7 +159,7 @@ def mysql slow_log rows_examined 6 NULL NO int NULL NULL 10 0 NULL NULL NULL int
|
||||
def mysql slow_log rows_sent 5 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11)
|
||||
def mysql slow_log server_id 10 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned
|
||||
def mysql slow_log sql_text 11 NULL NO mediumtext 16777215 16777215 NULL NULL NULL utf8 utf8_general_ci mediumtext
|
||||
def mysql slow_log start_time 1 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 6 NULL NULL timestamp(6) on update CURRENT_TIMESTAMP
|
||||
def mysql slow_log start_time 1 CURRENT_TIMESTAMP(6) NO timestamp NULL NULL NULL NULL 6 NULL NULL timestamp(6) on update CURRENT_TIMESTAMP
|
||||
def mysql slow_log user_host 2 NULL NO mediumtext 16777215 16777215 NULL NULL NULL utf8 utf8_general_ci mediumtext
|
||||
def mysql tables_priv Column_priv 8 NO set 31 93 NULL NULL NULL utf8 utf8_general_ci set('Select','Insert','Update','References')
|
||||
def mysql tables_priv Db 2 NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) PRI
|
||||
|
@ -382,6 +382,26 @@ INSERT INTO t1 VALUES('A ', 'A ');
|
||||
ERROR 23000: Duplicate entry 'A -A ' for key 'key1'
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
#
|
||||
# MDEV-568 (AKA LP BUG#1007981, AKA MySQL bug#44771)
|
||||
# Wrong result for a hash index look-up if the index is unique and
|
||||
# the key is NULL
|
||||
#
|
||||
CREATE TABLE t1 ( pk INT PRIMARY KEY, val INT, UNIQUE KEY USING HASH(val)) ENGINE=MEMORY;
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
INSERT INTO t1 VALUES (3, 1);
|
||||
INSERT INTO t1 VALUES (4, NULL);
|
||||
EXPLAIN SELECT * FROM t1 WHERE val IS NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref val val 5 const 1 Using where
|
||||
SELECT * FROM t1 WHERE val IS NULL;
|
||||
pk val
|
||||
4 NULL
|
||||
2 NULL
|
||||
1 NULL
|
||||
drop table t1;
|
||||
End of 5.2 tests
|
||||
# bit index in heap tables
|
||||
create table t1 (a bit(63) not null) engine=heap;
|
||||
insert into t1 values (869751),(736494),(226312),(802616),(728912);
|
||||
|
@ -285,6 +285,23 @@ DROP TABLE t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-568 (AKA LP BUG#1007981, AKA MySQL bug#44771)
|
||||
--echo # Wrong result for a hash index look-up if the index is unique and
|
||||
--echo # the key is NULL
|
||||
--echo #
|
||||
CREATE TABLE t1 ( pk INT PRIMARY KEY, val INT, UNIQUE KEY USING HASH(val)) ENGINE=MEMORY;
|
||||
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
INSERT INTO t1 VALUES (3, 1);
|
||||
INSERT INTO t1 VALUES (4, NULL);
|
||||
EXPLAIN SELECT * FROM t1 WHERE val IS NULL;
|
||||
SELECT * FROM t1 WHERE val IS NULL;
|
||||
drop table t1;
|
||||
|
||||
--echo End of 5.2 tests
|
||||
|
||||
-- echo # bit index in heap tables
|
||||
|
||||
create table t1 (a bit(63) not null) engine=heap;
|
||||
|
@ -0,0 +1,130 @@
|
||||
SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS;
|
||||
SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS;
|
||||
SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE;
|
||||
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE;
|
||||
CREATE TABLE infoschema_buffer_test (col1 INT) ENGINE = INNODB;
|
||||
INSERT INTO infoschema_buffer_test VALUES(9);
|
||||
SELECT TABLE_NAME, INDEX_NAME, NUMBER_RECORDS, DATA_SIZE, PAGE_STATE, PAGE_TYPE
|
||||
FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
|
||||
WHERE TABLE_NAME like "%infoschema_buffer_test"
|
||||
and PAGE_STATE="file_page" and PAGE_TYPE="index";
|
||||
TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE PAGE_STATE PAGE_TYPE
|
||||
test/infoschema_buffer_test GEN_CLUST_INDEX 1 29 FILE_PAGE INDEX
|
||||
INSERT INTO infoschema_buffer_test VALUES(19);
|
||||
SELECT TABLE_NAME, INDEX_NAME, NUMBER_RECORDS, DATA_SIZE, PAGE_STATE, PAGE_TYPE
|
||||
FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
|
||||
WHERE TABLE_NAME like "%infoschema_buffer_test"
|
||||
and PAGE_STATE="file_page" and PAGE_TYPE="index";
|
||||
TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE PAGE_STATE PAGE_TYPE
|
||||
test/infoschema_buffer_test GEN_CLUST_INDEX 2 58 FILE_PAGE INDEX
|
||||
CREATE INDEX idx ON infoschema_buffer_test(col1);
|
||||
SELECT TABLE_NAME, INDEX_NAME, NUMBER_RECORDS, DATA_SIZE, PAGE_STATE, PAGE_TYPE
|
||||
FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
|
||||
WHERE TABLE_NAME like "%infoschema_buffer_test"
|
||||
and PAGE_STATE="file_page" and INDEX_NAME = "idx" and PAGE_TYPE="index";
|
||||
TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE PAGE_STATE PAGE_TYPE
|
||||
test/infoschema_buffer_test idx 2 32 FILE_PAGE INDEX
|
||||
DROP TABLE infoschema_buffer_test;
|
||||
SELECT TABLE_NAME, INDEX_NAME, NUMBER_RECORDS, DATA_SIZE, PAGE_STATE, PAGE_TYPE
|
||||
FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
|
||||
WHERE TABLE_NAME like "%infoschema_buffer_test";
|
||||
TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE PAGE_STATE PAGE_TYPE
|
||||
CREATE TABLE infoschema_parent (id INT NOT NULL, PRIMARY KEY (id))
|
||||
ENGINE=INNODB;
|
||||
CREATE TABLE infoschema_child (id INT, parent_id INT, INDEX par_ind (parent_id),
|
||||
FOREIGN KEY (parent_id)
|
||||
REFERENCES infoschema_parent(id)
|
||||
ON DELETE CASCADE)
|
||||
ENGINE=INNODB;
|
||||
SELECT count(*)
|
||||
FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
|
||||
WHERE TABLE_NAME like "%infoschema_child" and PAGE_STATE="file_page"
|
||||
and PAGE_TYPE="index";
|
||||
count(*)
|
||||
2
|
||||
DROP TABLE infoschema_child;
|
||||
DROP TABLE infoschema_parent;
|
||||
show create table information_schema.innodb_buffer_page;
|
||||
Table Create Table
|
||||
INNODB_BUFFER_PAGE CREATE TEMPORARY TABLE `INNODB_BUFFER_PAGE` (
|
||||
`POOL_ID` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`BLOCK_ID` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`SPACE` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`PAGE_NUMBER` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`PAGE_TYPE` varchar(64) DEFAULT NULL,
|
||||
`FLUSH_TYPE` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`FIX_COUNT` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`IS_HASHED` varchar(3) DEFAULT NULL,
|
||||
`NEWEST_MODIFICATION` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`OLDEST_MODIFICATION` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`ACCESS_TIME` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`TABLE_NAME` varchar(1024) DEFAULT NULL,
|
||||
`INDEX_NAME` varchar(1024) DEFAULT NULL,
|
||||
`NUMBER_RECORDS` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`DATA_SIZE` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`COMPRESSED_SIZE` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`PAGE_STATE` varchar(64) DEFAULT NULL,
|
||||
`IO_FIX` varchar(64) DEFAULT NULL,
|
||||
`IS_OLD` varchar(3) DEFAULT NULL,
|
||||
`FREE_PAGE_CLOCK` bigint(21) unsigned NOT NULL DEFAULT '0'
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=utf8
|
||||
show create table information_schema.innodb_buffer_page_lru;
|
||||
Table Create Table
|
||||
INNODB_BUFFER_PAGE_LRU CREATE TEMPORARY TABLE `INNODB_BUFFER_PAGE_LRU` (
|
||||
`POOL_ID` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`LRU_POSITION` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`SPACE` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`PAGE_NUMBER` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`PAGE_TYPE` varchar(64) DEFAULT NULL,
|
||||
`FLUSH_TYPE` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`FIX_COUNT` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`IS_HASHED` varchar(3) DEFAULT NULL,
|
||||
`NEWEST_MODIFICATION` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`OLDEST_MODIFICATION` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`ACCESS_TIME` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`TABLE_NAME` varchar(1024) DEFAULT NULL,
|
||||
`INDEX_NAME` varchar(1024) DEFAULT NULL,
|
||||
`NUMBER_RECORDS` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`DATA_SIZE` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`COMPRESSED_SIZE` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`COMPRESSED` varchar(3) DEFAULT NULL,
|
||||
`IO_FIX` varchar(64) DEFAULT NULL,
|
||||
`IS_OLD` varchar(3) DEFAULT NULL,
|
||||
`FREE_PAGE_CLOCK` bigint(21) unsigned NOT NULL DEFAULT '0'
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=utf8
|
||||
show create table information_schema.innodb_buffer_pool_stats;
|
||||
Table Create Table
|
||||
INNODB_BUFFER_POOL_STATS CREATE TEMPORARY TABLE `INNODB_BUFFER_POOL_STATS` (
|
||||
`POOL_ID` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`POOL_SIZE` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`FREE_BUFFERS` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`DATABASE_PAGES` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`OLD_DATABASE_PAGES` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`MODIFIED_DATABASE_PAGES` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`PENDING_DECOMPRESS` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`PENDING_READS` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`PENDING_FLUSH_LRU` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`PENDING_FLUSH_LIST` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`PAGES_MADE_YOUNG` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`PAGES_NOT_MADE_YOUNG` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`PAGES_MADE_YOUNG_RATE` double NOT NULL DEFAULT '0',
|
||||
`PAGES_MADE_NOT_YOUNG_RATE` double NOT NULL DEFAULT '0',
|
||||
`NUMBER_PAGES_READ` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`NUMBER_PAGES_CREATED` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`NUMBER_PAGES_WRITTEN` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`PAGES_READ_RATE` double NOT NULL DEFAULT '0',
|
||||
`PAGES_CREATE_RATE` double NOT NULL DEFAULT '0',
|
||||
`PAGES_WRITTEN_RATE` double NOT NULL DEFAULT '0',
|
||||
`NUMBER_PAGES_GET` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`HIT_RATE` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`YOUNG_MAKE_PER_THOUSAND_GETS` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`NOT_YOUNG_MAKE_PER_THOUSAND_GETS` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`NUMBER_PAGES_READ_AHEAD` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`NUMBER_READ_AHEAD_EVICTED` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`READ_AHEAD_RATE` double NOT NULL DEFAULT '0',
|
||||
`READ_AHEAD_EVICTED_RATE` double NOT NULL DEFAULT '0',
|
||||
`LRU_IO_TOTAL` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`LRU_IO_CURRENT` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`UNCOMPRESS_TOTAL` bigint(21) unsigned NOT NULL DEFAULT '0',
|
||||
`UNCOMPRESS_CURRENT` bigint(21) unsigned NOT NULL DEFAULT '0'
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=utf8
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user