Merge 5.5 -> 5.5-mwl248.
This commit is contained in:
commit
4a6a08309c
11
BUILD-CMAKE
11
BUILD-CMAKE
@ -1,6 +1,7 @@
|
||||
Copyright (c) 2009, 2010 Sun Microsystems, Inc.
|
||||
Copyright (c) 2012 Monty Program Ab
|
||||
|
||||
How to Build MySQL server with CMake
|
||||
How to Build MariaDB server with CMake
|
||||
|
||||
WHAT YOU NEED
|
||||
---------------------------------------------------------------
|
||||
@ -11,7 +12,7 @@ HOW TO INSTALL:
|
||||
Linux distributions:
|
||||
shell> sudo apt-get install cmake
|
||||
|
||||
The above works on do Debian/Ubuntu based distributions.On others, command
|
||||
The above works on Debian/Ubuntu based distributions. On others, the command
|
||||
line needs to be modified to e.g "yum install" on Fedora or "zypper install"
|
||||
on OpenSUSE.
|
||||
|
||||
@ -20,8 +21,9 @@ shell> pfexec pkgadd install SUNWcmake
|
||||
|
||||
Windows and Mac OSX:
|
||||
Download and install the latest distribution from
|
||||
http://www.cmake.org/cmake/resources/software.html.On Windows, download
|
||||
installer exe file and run it. On Mac, download the .dmg image and open it.
|
||||
http://www.cmake.org/cmake/resources/software.html
|
||||
On Windows, download installer exe file and run it. On MacOS, download
|
||||
the .dmg image and open it.
|
||||
|
||||
Other Unixes:
|
||||
Precompiled packages for other Unix flavors (HPUX, AIX) are available from
|
||||
@ -243,3 +245,4 @@ later corrected, the cached result is still used. If you encounter this
|
||||
situation, which should be a rare occation, you need either to remove the
|
||||
offending entry from CMakeCache.txt (if test was for HAVE_FOO, remove lines
|
||||
containing HAVE_FOO from CMakeCache.txt) or just remove the cache file.
|
||||
|
||||
|
@ -131,6 +131,10 @@ IF (NOT CPACK_GENERATOR)
|
||||
ENDIF(WIN32)
|
||||
ENDIF(NOT CPACK_GENERATOR)
|
||||
|
||||
IF(DEB)
|
||||
SET(INSTALL_LAYOUT "DEB")
|
||||
ENDIF(DEB)
|
||||
|
||||
INCLUDE(mysql_version)
|
||||
INCLUDE(cpack_rpm)
|
||||
INCLUDE(cpack_source_ignore_files)
|
||||
|
@ -31,7 +31,7 @@ also applies.
|
||||
first.
|
||||
|
||||
If you run into problems and need to file a bug report,
|
||||
please report them to: http://bugs.launchpad.net/maria
|
||||
please report them to: http://mariadb.org/jira
|
||||
|
||||
See the instructions in Section 1.6, "How to Report Bugs or Problems."
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
MariaDB is in most aspects identical to MySQL.
|
||||
|
||||
Differences between MySQL and MariaDB can be found at:
|
||||
http://askmonty.org/wiki/index.php/MariaDB_versus_MySQL
|
||||
http://kb.askmonty.org/en/mariadb-versus-mysql-features/
|
||||
http://kb.askmonty.org/en/mariadb-versus-mysql-compatibility/
|
||||
|
||||
The MariaDB references manual can be found at:
|
||||
http://askmonty.org/wiki/index.php/Manual
|
||||
The MariaDB manual can be found at:
|
||||
http://kb.askmonty.org/
|
||||
|
||||
The MySQL Reference Manual is available in various formats on
|
||||
http://dev.mysql.com/doc; if you're interested in the DocBook XML
|
||||
|
@ -1,3 +1,14 @@
|
||||
Installing and Upgrading MariaDB
|
||||
|
||||
This file contains chapter two of the MySQL manual and describes how
|
||||
to obtain and install MySQL. The instructions below are generally
|
||||
applicable to both MySQL and MariaDB, but differ in some particulars
|
||||
(like, for example, the GPG signing key we use is different).
|
||||
|
||||
Detailed, MariaDB-specific instructions are available at:
|
||||
http://kb.askmonty.org/en/getting-installing-and-upgrading-mariadb/
|
||||
|
||||
- - - -
|
||||
|
||||
Chapter 2. Installing and Upgrading MySQL
|
||||
|
||||
|
@ -1,2 +1,3 @@
|
||||
Up-to-date instructions on MariaDB building on Windows can be found in http://kb.askmonty.org/en/building-mariadb-on-windows.
|
||||
Up-to-date instructions about building MariaDB on Windows can be found
|
||||
at: http://kb.askmonty.org/en/building-mariadb-on-windows
|
||||
|
||||
|
@ -1,35 +1,35 @@
|
||||
This file should contain all know fatal bugs in the Mariadb and the
|
||||
Maria storage engine for the last source or binary release. Minor
|
||||
bugs, extensions and feature request and bugs found since this release
|
||||
can be find in the MariaDB bugs database at:
|
||||
https://bugs.launchpad.net/maria and in the MySQL bugs databases at:
|
||||
http://bugs.mysql.com/ (category "Maria storage engine").
|
||||
This file should contain all known fatal bugs in Mariadb and the Aria
|
||||
storage engine for the last source or binary release. Minor bugs,
|
||||
extensions and feature requests, and bugs found since this release can
|
||||
be found in the MariaDB bugs database at: http://mariadb.org/jira and
|
||||
in the MySQL bugs databases at: http://bugs.mysql.com/ (category
|
||||
"Maria storage engine").
|
||||
|
||||
There shouldn't normally be any bugs that affects normal operations in
|
||||
any MariaDB release. Still, there are always exceptions and edge cases
|
||||
and that's what this file is for.
|
||||
There should not normally be any bugs which affect normal operations
|
||||
in any MariaDB release. Still, there are always exceptions and edge
|
||||
cases and that is what this file is for.
|
||||
|
||||
If you have found a bug that is not listed here, please add it to
|
||||
http://bugs.launchpad.net/maria so that we can either fix it for next
|
||||
release or in the worst case add it here for others to know!
|
||||
http://mariadb.org/jira so we can either fix it for next release or in
|
||||
the worst case add it here for others to know!
|
||||
|
||||
|
||||
IMPORTANT:
|
||||
|
||||
If you have been using the Maria storage engine with
|
||||
MySQL-5.1-Maria-alpha build and upgrading to a newer MariaDB you MUST
|
||||
run maria_chk --recover on all your Maria tables. This is because we
|
||||
made an incompatible change of how transaction id is stored and old
|
||||
transaction id's must be reset!
|
||||
If you have been using the Maria (now Aria) storage engine with the
|
||||
MySQL-5.1-Maria-alpha build and are upgrading to a newer MariaDB you
|
||||
MUST run [m]aria_chk --recover on all your Aria tables. This is because
|
||||
we made an incompatible change with how the transaction id is stored
|
||||
and old transaction id's must be reset!
|
||||
|
||||
cd mysql-data-directory
|
||||
maria_chk --recover */*.MAI
|
||||
aria_chk --recover */*.MAI
|
||||
|
||||
As the Maria storage engine is now in beta we will do our best to not
|
||||
introduce any incompatible changes in the data format for the Maria
|
||||
tables; If this would be ever be needed, we will, if possible, support
|
||||
both the old and the new version to make upgrades as easy as possible.
|
||||
Going forward, we will do our best to not introduce any incompatible
|
||||
changes in the data format for Aria tables. If this would be ever be
|
||||
needed, we will, if possible, support both the old and the new version
|
||||
to make upgrades as easy as possible.
|
||||
|
||||
Note that for the MariaDB 5.1 release the Maria storage engine is
|
||||
classified as 'beta'; It should work, but use it with caution. Please
|
||||
report all bugs to https://bugs.launchpad.net/maria so that we can fix
|
||||
them!
|
||||
Note that for the MariaDB 5.1 release the Aria storage engine is
|
||||
classified as 'beta'; It should work, but use it with caution. Please
|
||||
report all bugs to http://mariadb.org/jira so we can fix them!
|
||||
|
8
README
8
README
@ -13,9 +13,9 @@ see the Credits appendix. You can also do 'SHOW authors' to get a
|
||||
list of active contributors.
|
||||
|
||||
A description of the MariaDB project and a manual can be found at:
|
||||
http://askmonty.org/wiki/index.php/MariaDB
|
||||
http://askmonty.org/wiki/index.php/MariaDB_versus_MySQL
|
||||
http://askmonty.org/wiki/index.php/Manual:Contents
|
||||
http://kb.askmonty.org/
|
||||
http://kb.askmonty.org/en/mariadb-versus-mysql-features/
|
||||
http://kb.askmonty.org/en/mariadb-versus-mysql-compatibility/
|
||||
|
||||
As MariaDB is a full replacement of MySQL, the MySQL manual at
|
||||
http://dev.mysql.com/doc is generally applicable.
|
||||
@ -41,7 +41,7 @@ EXCEPTIONS-CLIENT file.
|
||||
IMPORTANT:
|
||||
|
||||
Bug and/or error reports regarding MariaDB should be submitted at
|
||||
https://bugs.launchpad.net/maria
|
||||
http://mariadb.org/jira
|
||||
|
||||
Bugs in the MySQL code can also be submitted at http://bugs.mysql.com
|
||||
|
||||
|
2
VERSION
2
VERSION
@ -1,4 +1,4 @@
|
||||
MYSQL_VERSION_MAJOR=5
|
||||
MYSQL_VERSION_MINOR=5
|
||||
MYSQL_VERSION_PATCH=24
|
||||
MYSQL_VERSION_PATCH=25
|
||||
MYSQL_VERSION_EXTRA=
|
||||
|
@ -2916,7 +2916,7 @@ com_help(String *buffer __attribute__((unused)),
|
||||
}
|
||||
|
||||
put_info("\nGeneral information about MariaDB can be found at\n"
|
||||
"http://askmonty.org/wiki/index.php/Manual:Contents\n", INFO_INFO);
|
||||
"http://mariadb.org\n", INFO_INFO);
|
||||
put_info("List of all MySQL commands:", INFO_INFO);
|
||||
if (!named_cmds)
|
||||
put_info("Note that all text commands must be first on line and end with ';'",INFO_INFO);
|
||||
|
@ -86,6 +86,15 @@
|
||||
/* Chars needed to store LONGLONG, excluding trailing '\0'. */
|
||||
#define LONGLONG_LEN 20
|
||||
|
||||
/* general_log or slow_log tables under mysql database */
|
||||
static inline my_bool general_log_or_slow_log_tables(const char *db,
|
||||
const char *table)
|
||||
{
|
||||
return (strcmp(db, "mysql") == 0) &&
|
||||
((strcmp(table, "general_log") == 0) ||
|
||||
(strcmp(table, "slow_log") == 0));
|
||||
}
|
||||
|
||||
static void add_load_option(DYNAMIC_STRING *str, const char *option,
|
||||
const char *option_value);
|
||||
static ulong find_set(TYPELIB *lib, const char *x, uint length,
|
||||
@ -2503,6 +2512,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
|
||||
"TABLE_SCHEMA = '%s' AND TABLE_NAME = '%s'";
|
||||
FILE *sql_file= md_result_file;
|
||||
int len;
|
||||
my_bool is_log_table;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
DBUG_ENTER("get_table_structure");
|
||||
@ -2587,9 +2597,12 @@ static uint get_table_structure(char *table, char *db, char *table_type,
|
||||
/*
|
||||
Even if the "table" is a view, we do a DROP TABLE here. The
|
||||
view-specific code below fills in the DROP VIEW.
|
||||
We will skip the DROP TABLE for general_log and slow_log, since
|
||||
those stmts will fail, in case we apply dump by enabling logging.
|
||||
*/
|
||||
fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n",
|
||||
opt_quoted_table);
|
||||
if (!general_log_or_slow_log_tables(db, table))
|
||||
fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n",
|
||||
opt_quoted_table);
|
||||
check_io(sql_file);
|
||||
}
|
||||
|
||||
@ -2701,12 +2714,25 @@ static uint get_table_structure(char *table, char *db, char *table_type,
|
||||
|
||||
row= mysql_fetch_row(result);
|
||||
|
||||
fprintf(sql_file, (opt_compatible_mode & 3) ? "%s;\n" :
|
||||
"/*!40101 SET @saved_cs_client = @@character_set_client */;\n"
|
||||
"/*!40101 SET character_set_client = utf8 */;\n"
|
||||
"%s;\n"
|
||||
"/*!40101 SET character_set_client = @saved_cs_client */;\n",
|
||||
row[1]);
|
||||
is_log_table= general_log_or_slow_log_tables(db, table);
|
||||
if (is_log_table)
|
||||
row[1]+= 13; /* strlen("CREATE TABLE ")= 13 */
|
||||
if (opt_compatible_mode & 3)
|
||||
{
|
||||
fprintf(sql_file,
|
||||
is_log_table ? "CREATE TABLE IF NOT EXISTS %s;\n" : "%s;\n",
|
||||
row[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(sql_file,
|
||||
"/*!40101 SET @saved_cs_client = @@character_set_client */;\n"
|
||||
"/*!40101 SET character_set_client = utf8 */;\n"
|
||||
"%s%s;\n"
|
||||
"/*!40101 SET character_set_client = @saved_cs_client */;\n",
|
||||
is_log_table ? "CREATE TABLE IF NOT EXISTS " : "",
|
||||
row[1]);
|
||||
}
|
||||
|
||||
check_io(sql_file);
|
||||
mysql_free_result(result);
|
||||
@ -4315,6 +4341,22 @@ static int dump_all_tables_in_db(char *database)
|
||||
if (opt_xml)
|
||||
print_xml_tag(md_result_file, "", "\n", "database", "name=", database, NullS);
|
||||
|
||||
if (strcmp(database, "mysql") == 0)
|
||||
{
|
||||
char table_type[NAME_LEN];
|
||||
char ignore_flag;
|
||||
uint num_fields;
|
||||
num_fields= get_table_structure((char *) "general_log",
|
||||
database, table_type, &ignore_flag);
|
||||
if (num_fields == 0)
|
||||
verbose_msg("-- Warning: get_table_structure() failed with some internal "
|
||||
"error for 'general_log' table\n");
|
||||
num_fields= get_table_structure((char *) "slow_log",
|
||||
database, table_type, &ignore_flag);
|
||||
if (num_fields == 0)
|
||||
verbose_msg("-- Warning: get_table_structure() failed with some internal "
|
||||
"error for 'slow_log' table\n");
|
||||
}
|
||||
if (lock_tables)
|
||||
{
|
||||
DYNAMIC_STRING query;
|
||||
@ -4773,7 +4815,7 @@ static int do_show_slave_status(MYSQL *mysql_con)
|
||||
if (row[1])
|
||||
fprintf(md_result_file, "MASTER_HOST='%s', ", row[1]);
|
||||
if (row[3])
|
||||
fprintf(md_result_file, "MASTER_PORT='%s', ", row[3]);
|
||||
fprintf(md_result_file, "MASTER_PORT=%s, ", row[3]);
|
||||
}
|
||||
fprintf(md_result_file,
|
||||
"MASTER_LOG_FILE='%s', MASTER_LOG_POS=%s;\n", row[9], row[21]);
|
||||
|
@ -9012,8 +9012,12 @@ int main(int argc, char **argv)
|
||||
command->abort_on_error= (command->expected_errors.count == 0 &&
|
||||
abort_on_error);
|
||||
|
||||
/* delimiter needs to be executed so we can continue to parse */
|
||||
ok_to_do= cur_block->ok || command->type == Q_DELIMITER;
|
||||
/*
|
||||
some commmands need to be executed or at least parsed unconditionally,
|
||||
because they change the grammar.
|
||||
*/
|
||||
ok_to_do= cur_block->ok || command->type == Q_DELIMITER
|
||||
|| command->type == Q_PERL;
|
||||
/*
|
||||
Some commands need to be "done" the first time if they may get
|
||||
re-iterated over in a true context. This can only happen if there's
|
||||
@ -9024,8 +9028,7 @@ int main(int argc, char **argv)
|
||||
if (command->type == Q_SOURCE ||
|
||||
command->type == Q_ERROR ||
|
||||
command->type == Q_WRITE_FILE ||
|
||||
command->type == Q_APPEND_FILE ||
|
||||
command->type == Q_PERL)
|
||||
command->type == Q_APPEND_FILE)
|
||||
{
|
||||
for (struct st_block *stb= cur_block-1; stb >= block_stack; stb--)
|
||||
{
|
||||
|
@ -94,8 +94,19 @@ IF(FEATURE_SET)
|
||||
ENDIF()
|
||||
|
||||
OPTION(ENABLED_LOCAL_INFILE "" ON)
|
||||
SET(WITH_SSL bundled CACHE STRING "")
|
||||
SET(WITH_ZLIB bundled CACHE STRING "")
|
||||
IF(RPM)
|
||||
SET(WITH_SSL system CACHE STRING "")
|
||||
SET(WITH_ZLIB system CACHE STRING "")
|
||||
ELSEIF(DEB)
|
||||
SET(WITH_SSL system CACHE STRING "")
|
||||
SET(WITH_ZLIB system CACHE STRING "")
|
||||
SET(WITH_LIBWRAP ON)
|
||||
SET(WITH_MAX ON)
|
||||
SET(HAVE_EMBEDDED_PRIVILEGE_CONTROL ON)
|
||||
ELSE()
|
||||
SET(WITH_SSL bundled CACHE STRING "")
|
||||
SET(WITH_ZLIB bundled CACHE STRING "")
|
||||
ENDIF()
|
||||
|
||||
IF(NOT COMPILATION_COMMENT)
|
||||
SET(COMPILATION_COMMENT "MariaDB Server")
|
||||
|
@ -77,9 +77,7 @@ IF(UNIX)
|
||||
IF(INSTALL_LAYOUT MATCHES "RPM")
|
||||
SET(default_prefix "/usr")
|
||||
ELSEIF(INSTALL_LAYOUT MATCHES "DEB")
|
||||
SET(default_prefix "/opt/mysql/server-${MYSQL_BASE_VERSION}")
|
||||
# This is required to avoid "cpack -GDEB" default of prefix=/usr
|
||||
SET(CPACK_SET_DESTDIR ON)
|
||||
SET(default_prefix "/usr")
|
||||
ELSEIF(INSTALL_LAYOUT MATCHES "SVR4")
|
||||
SET(default_prefix "/opt/mysql/mysql")
|
||||
ELSE()
|
||||
@ -191,7 +189,7 @@ SET(INSTALL_SUPPORTFILESDIR_DEB "support-files")
|
||||
SET(INSTALL_MYSQLDATADIR_DEB "/var/lib/mysql")
|
||||
SET(INSTALL_PLUGINTESTDIR_DEB ${plugin_tests})
|
||||
|
||||
SET(INSTALL_UNIX_ADDRDIR_DEB "/tmp/mysql.sock")
|
||||
SET(INSTALL_UNIX_ADDRDIR_DEB "/var/run/mysqld/mysqld.sock")
|
||||
#
|
||||
# SVR4 layout
|
||||
#
|
||||
|
@ -150,6 +150,7 @@
|
||||
#cmakedefine HAVE_FCNTL 1
|
||||
#cmakedefine HAVE_FCONVERT 1
|
||||
#cmakedefine HAVE_FDATASYNC 1
|
||||
#cmakedefine HAVE_DECL_FDATASYNC 1
|
||||
#cmakedefine HAVE_FESETROUND 1
|
||||
#cmakedefine HAVE_FINITE 1
|
||||
#cmakedefine HAVE_FP_EXCEPT 1
|
||||
|
@ -151,7 +151,7 @@ IF(UNIX)
|
||||
|
||||
IF(CMAKE_REQUIRED_LIBRARIES)
|
||||
LIST(REMOVE_DUPLICATES CMAKE_REQUIRED_LIBRARIES)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
LINK_LIBRARIES(${CMAKE_THREAD_LIBS_INIT})
|
||||
|
||||
OPTION(WITH_LIBWRAP "Compile with tcp wrappers support" OFF)
|
||||
|
2
debian/additions/mariadb.cnf
vendored
2
debian/additions/mariadb.cnf
vendored
@ -3,7 +3,7 @@
|
||||
|
||||
[client]
|
||||
# Default is Latin1, if you need UTF-8 set this (also in server section)
|
||||
#character-set-server = utf8
|
||||
#default-character-set = utf8
|
||||
|
||||
[mysqld]
|
||||
#
|
||||
|
7
debian/dist/Debian/control
vendored
7
debian/dist/Debian/control
vendored
@ -124,8 +124,9 @@ Provides: virtual-mysql-client, mysql-client,
|
||||
mysql-client-4.1, mysql-client-5.1, mysql-client-5.5
|
||||
Conflicts: mysql-client (<< 5.0.51), mysql-client-5.0, mysql-client-5.1,
|
||||
mariadb-client (<< ${source:Version}),
|
||||
mariadb-client-5.1, mariadb-client-5.2, mariadb-client-5.3
|
||||
mariadb-client-5.1, mariadb-client-5.2, mariadb-client-5.3, mysql-client-5.5
|
||||
Replaces: mysql-client (<< 5.0.51), mysql-client-5.0, mysql-client-5.1,
|
||||
mysql-client-5.5,
|
||||
mariadb-client (<< ${source:Version}),
|
||||
mariadb-client-5.1, mariadb-client-5.2, mariadb-client-5.3
|
||||
Description: MariaDB database client binaries
|
||||
@ -185,10 +186,10 @@ Pre-Depends: mariadb-common, adduser (>= 3.40), debconf
|
||||
Depends: mariadb-client-5.5 (>= ${source:Version}), libdbi-perl, perl (>= 5.6), ${shlibs:Depends}, ${misc:Depends}, psmisc, passwd, lsb-base (>= 3.0-10), mariadb-server-core-5.5 (>= ${binary:Version})
|
||||
Provides: mariadb-server, mysql-server, virtual-mysql-server
|
||||
Conflicts: mariadb-server (<< ${source:Version}), mysql-server (<< ${source:Version}),
|
||||
mysql-server-4.1, mysql-server-5.0, mysql-server-5.1,
|
||||
mysql-server-4.1, mysql-server-5.0, mysql-server-5.1, mysql-server-5.5,
|
||||
mariadb-server-5.1, mariadb-server-5.2, mariadb-server-5.3
|
||||
Replaces: mariadb-server (<< ${source:Version}), mysql-server (<< ${source:Version}),
|
||||
mysql-server-4.1, mysql-server-5.0, mysql-server-5.1,
|
||||
mysql-server-4.1, mysql-server-5.0, mysql-server-5.1, mysql-server-5.5,
|
||||
mariadb-server-5.1, mariadb-server-5.2, mariadb-server-5.3,
|
||||
libmariadbclient16 (<< 5.3.4),
|
||||
libmariadbclient-dev (<< 5.5.0)
|
||||
|
23
debian/dist/Debian/rules
vendored
23
debian/dist/Debian/rules
vendored
@ -70,30 +70,11 @@ endif
|
||||
CXX=$${MYSQL_BUILD_CXX:-g++} \
|
||||
CXXFLAGS=$${MYSQL_BUILD_CXXFLAGS:-"-O2 -fno-omit-frame-pointer -g -pipe -Wall -Wno-uninitialized"} \
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DINSTALL_SBINDIR=sbin \
|
||||
-DMYSQL_DATADIR=/var/lib/mysql \
|
||||
-DINSTALL_INCLUDEDIR=include/mysql \
|
||||
-DINSTALL_INFODIR=share/info \
|
||||
-DINSTALL_MANDIR=share/man \
|
||||
\
|
||||
-DMYSQL_SERVER_SUFFIX="-$(DEBVERSION)" \
|
||||
-DBUILD_CONFIG=mysql_release \
|
||||
-DCOMPILATION_COMMENT="mariadb.org binary distribution" \
|
||||
-DSYSTEM_TYPE="debian-linux-gnu" \
|
||||
-DINSTALL_LAYOUT=DEB \
|
||||
\
|
||||
-DENABLED_LOCAL_INFILE=1 \
|
||||
-DWITH_FAST_MUTEXES=1 \
|
||||
\
|
||||
-DMYSQL_UNIX_ADDR=/var/run/mysqld/mysqld.sock \
|
||||
\
|
||||
-DEXTRA_CHARSETS=all \
|
||||
-DWITH_LIBWRAP=1 \
|
||||
-DWITH_SSL=system \
|
||||
-DWITH_ZLIB=system \
|
||||
-DWITH_EMBEDDED_SERVER=1 \
|
||||
-DHAVE_EMBEDDED_PRIVILEGE_CONTROL=ON \
|
||||
-DWITH_MAX=1'
|
||||
-DDEB=debian'
|
||||
|
||||
touch $@
|
||||
|
||||
|
7
debian/dist/Ubuntu/control
vendored
7
debian/dist/Ubuntu/control
vendored
@ -124,8 +124,9 @@ Provides: virtual-mysql-client, mysql-client,
|
||||
mysql-client-4.1, mysql-client-5.1, mysql-client-5.5
|
||||
Conflicts: mysql-client (<< 5.0.51), mysql-client-5.0, mysql-client-5.1,
|
||||
mariadb-client (<< ${source:Version}),
|
||||
mariadb-client-5.1, mariadb-client-5.2, mariadb-client-5.3
|
||||
mariadb-client-5.1, mariadb-client-5.2, mariadb-client-5.3, mysql-client-5.5
|
||||
Replaces: mysql-client (<< 5.0.51), mysql-client-5.0, mysql-client-5.1,
|
||||
mysql-client-5.5,
|
||||
mariadb-client (<< ${source:Version}),
|
||||
mariadb-client-5.1, mariadb-client-5.2, mariadb-client-5.3
|
||||
Description: MariaDB database client binaries
|
||||
@ -179,10 +180,10 @@ Pre-Depends: mariadb-common, adduser (>= 3.40), debconf
|
||||
Depends: mariadb-client-5.5 (>= ${source:Version}), libdbi-perl, perl (>= 5.6), ${shlibs:Depends}, ${misc:Depends}, psmisc, passwd, lsb-base (>= 3.0-10), mariadb-server-core-5.5 (>= ${binary:Version})
|
||||
Provides: mariadb-server, mysql-server, virtual-mysql-server
|
||||
Conflicts: mariadb-server (<< ${source:Version}), mysql-server (<< ${source:Version}),
|
||||
mysql-server-4.1, mysql-server-5.0, mysql-server-5.1,
|
||||
mysql-server-4.1, mysql-server-5.0, mysql-server-5.1, mysql-server-5.5,
|
||||
mariadb-server-5.1, mariadb-server-5.2, mariadb-server-5.3
|
||||
Replaces: mariadb-server (<< ${source:Version}), mysql-server (<< ${source:Version}),
|
||||
mysql-server-4.1, mysql-server-5.0, mysql-server-5.1,
|
||||
mysql-server-4.1, mysql-server-5.0, mysql-server-5.1, mysql-server-5.5,
|
||||
mariadb-server-5.1, mariadb-server-5.2, mariadb-server-5.3,
|
||||
libmariadbclient16 (<< 5.3.4),
|
||||
libmariadbclient-dev (<< 5.5.0)
|
||||
|
23
debian/dist/Ubuntu/rules
vendored
23
debian/dist/Ubuntu/rules
vendored
@ -70,30 +70,11 @@ endif
|
||||
CXX=$${MYSQL_BUILD_CXX:-g++} \
|
||||
CXXFLAGS=$${MYSQL_BUILD_CXXFLAGS:-"-O2 -fno-omit-frame-pointer -g -pipe -Wall -Wno-uninitialized"} \
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DINSTALL_SBINDIR=sbin \
|
||||
-DMYSQL_DATADIR=/var/lib/mysql \
|
||||
-DINSTALL_INCLUDEDIR=include/mysql \
|
||||
-DINSTALL_INFODIR=share/info \
|
||||
-DINSTALL_MANDIR=share/man \
|
||||
\
|
||||
-DMYSQL_SERVER_SUFFIX="-$(DEBVERSION)" \
|
||||
-DBUILD_CONFIG=mysql_release \
|
||||
-DCOMPILATION_COMMENT="mariadb.org binary distribution" \
|
||||
-DSYSTEM_TYPE="debian-linux-gnu" \
|
||||
-DINSTALL_LAYOUT=DEB \
|
||||
\
|
||||
-DENABLED_LOCAL_INFILE=1 \
|
||||
-DWITH_FAST_MUTEXES=1 \
|
||||
\
|
||||
-DMYSQL_UNIX_ADDR=/var/run/mysqld/mysqld.sock \
|
||||
\
|
||||
-DEXTRA_CHARSETS=all \
|
||||
-DWITH_LIBWRAP=1 \
|
||||
-DWITH_SSL=system \
|
||||
-DWITH_ZLIB=system \
|
||||
-DWITH_EMBEDDED_SERVER=1 \
|
||||
-DHAVE_EMBEDDED_PRIVILEGE_CONTROL=ON \
|
||||
-DWITH_MAX=1'
|
||||
-DDEB=ubuntu'
|
||||
|
||||
touch $@
|
||||
|
||||
|
@ -148,9 +148,10 @@ typedef struct st_key_cache
|
||||
ulonglong param_partitions; /* number of the key cache partitions */
|
||||
my_bool key_cache_inited; /* <=> key cache has been created */
|
||||
my_bool can_be_used; /* usage of cache for read/write is allowed */
|
||||
my_bool in_init; /* Set to 1 in MySQL during init/resize */
|
||||
my_bool in_init; /* set to 1 in MySQL during init/resize */
|
||||
uint partitions; /* actual number of partitions */
|
||||
size_t key_cache_mem_size; /* specified size of the cache memory */
|
||||
pthread_mutex_t op_lock; /* to serialize operations like 'resize' */
|
||||
} KEY_CACHE;
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
/* 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
|
||||
@ -10,8 +10,8 @@
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
|
||||
|
||||
/*
|
||||
* Vio Lite.
|
||||
|
@ -69,10 +69,10 @@ extension. For example:
|
||||
|
||||
If you want to submit your test case you can send it
|
||||
to maria-developers@lists.launchpad.com or attach it to a bug report on
|
||||
https://bugs.launchpad.net/maria/.
|
||||
http://mariadb.org/jira/.
|
||||
|
||||
If the test case is really big or if it contains 'not public' data,
|
||||
then put your .test file and .result file(s) into a tar.gz archive,
|
||||
add a README that explains the problem, ftp the archive to
|
||||
ftp://ftp.askmonty.org/private and send a mail to
|
||||
https://bugs.launchpad.net/maria/ about it.
|
||||
ftp://ftp.askmonty.org/private and submit a report to
|
||||
http://mariadb.org/jira about it.
|
||||
|
@ -874,3 +874,21 @@ show status like "Handler_icp%";
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# MDEV-308 lp:1008516 - Failing assertion: templ->mysql_col_len == len
|
||||
#
|
||||
create table t1 (a int,b char(5),primary key (a), key (b(1)));
|
||||
insert into t1 values ('a','b');
|
||||
select 1 from t1 where a and b >= 'aa';
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#58015 "Assert in row_sel_field_store_in_mysql_format
|
||||
--echo # when running innodb_mrr_icp test"
|
||||
--echo #
|
||||
|
||||
create table t1 (a char(2) charset utf8,b double, primary key (a(1)),key (b));
|
||||
insert into t1 values ('',1);
|
||||
select 1 from t1 where b <= 1 and a <> '';
|
||||
drop table t1;
|
||||
|
||||
|
@ -1518,7 +1518,7 @@ sub command_line_setup {
|
||||
|
||||
# We make the path absolute, as the server will do a chdir() before usage
|
||||
unless ( $opt_vardir =~ m,^/, or
|
||||
(IS_WINDOWS and $opt_vardir =~ m,^[a-z]:/,i) )
|
||||
(IS_WINDOWS and $opt_vardir =~ m,^[a-z]:[/\\],i) )
|
||||
{
|
||||
# Make absolute path, relative test dir
|
||||
$opt_vardir= "$glob_mysql_test_dir/$opt_vardir";
|
||||
@ -2717,6 +2717,7 @@ sub setup_vardir() {
|
||||
# hm, what paths work for debs and for rpms ?
|
||||
for (<$bindir/lib64/mysql/plugin/*.so>,
|
||||
<$bindir/lib/mysql/plugin/*.so>,
|
||||
<$bindir/lib/plugin/*.so>, # bintar
|
||||
<$bindir/lib/plugin/*.dll>)
|
||||
{
|
||||
my $pname=basename($_);
|
||||
@ -3463,12 +3464,6 @@ sub mysql_install_db {
|
||||
mtr_add_arg($args, "--lc-messages-dir=%s", $install_lang);
|
||||
mtr_add_arg($args, "--character-sets-dir=%s", $install_chsdir);
|
||||
|
||||
# On some old linux kernels, aio on tmpfs is not supported
|
||||
# Remove this if/when Bug #58421 fixes this in the server
|
||||
if ($^O eq "linux" && $opt_mem) {
|
||||
mtr_add_arg($args, "--loose-skip-innodb-use-native-aio");
|
||||
}
|
||||
|
||||
# InnoDB arguments that affect file location and sizes may
|
||||
# need to be given to the bootstrap process as well as the
|
||||
# server process.
|
||||
@ -4742,6 +4737,7 @@ sub extract_warning_lines ($$) {
|
||||
qr|Access denied for user|,
|
||||
qr|Aborted connection|,
|
||||
qr|table.*is full|,
|
||||
qr|Linux Native AIO|, # warning that aio does not work on /dev/shm
|
||||
);
|
||||
|
||||
my $matched_lines= [];
|
||||
@ -5245,13 +5241,6 @@ sub mysqld_arguments ($$$) {
|
||||
mtr_add_arg($args, "--user=root");
|
||||
}
|
||||
|
||||
# On some old linux kernels, aio on tmpfs is not supported
|
||||
# Remove this if/when Bug #58421 fixes this in the server
|
||||
if ($^O eq "linux" && $opt_mem)
|
||||
{
|
||||
mtr_add_arg($args, "--loose-skip-innodb-use-native-aio");
|
||||
}
|
||||
|
||||
if (!using_extern() and !$opt_user_args)
|
||||
{
|
||||
# Turn on logging to file
|
||||
@ -5292,6 +5281,7 @@ sub mysqld_arguments ($$$) {
|
||||
}
|
||||
elsif ($plugin = mtr_match_prefix($arg, "--plugin-load="))
|
||||
{
|
||||
next if $plugin =~ /=$/;
|
||||
push @plugins, $plugin unless $seen{$plugin};
|
||||
$seen{$plugin} = 1;
|
||||
}
|
||||
|
@ -516,3 +516,25 @@ pk
|
||||
1
|
||||
18446744073709551614
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (pk BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY (pk));
|
||||
insert into t1 values((1<<63)+1);
|
||||
insert into t1 values(null);
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
9223372036854775810
|
||||
select * from t1;
|
||||
pk
|
||||
9223372036854775809
|
||||
9223372036854775810
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (pk BIGINT AUTO_INCREMENT, PRIMARY KEY (pk));
|
||||
insert into t1 values(-5);
|
||||
insert into t1 values(null);
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
1
|
||||
select * from t1;
|
||||
pk
|
||||
-5
|
||||
1
|
||||
drop table t1;
|
||||
|
56
mysql-test/r/bug12427262.result
Normal file
56
mysql-test/r/bug12427262.result
Normal file
@ -0,0 +1,56 @@
|
||||
#
|
||||
# Bug#12427262 : 60961: SHOW TABLES VERY SLOW WHEN NOT IN SYSTEM DISK CACHE.
|
||||
#
|
||||
create database show_table_lw_db;
|
||||
use show_table_lw_db;
|
||||
create table t1 (c1 int);
|
||||
create table t2 (c1 int);
|
||||
create table t3 (c1 int);
|
||||
create table t4 (c1 int);
|
||||
create table t5 (c1 int);
|
||||
create table t6 (c1 int);
|
||||
create table t7 (c1 int);
|
||||
create table t8 (c1 int);
|
||||
create table t9 (c1 int);
|
||||
create table t10 (c1 int);
|
||||
select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME
|
||||
like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM'
|
||||
into @count_read_before;
|
||||
show tables;
|
||||
Tables_in_show_table_lw_db
|
||||
t1
|
||||
t10
|
||||
t2
|
||||
t3
|
||||
t4
|
||||
t5
|
||||
t6
|
||||
t7
|
||||
t8
|
||||
t9
|
||||
select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME
|
||||
like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM'
|
||||
into @count_read_after;
|
||||
select @count_read_after-@count_read_before;
|
||||
@count_read_after-@count_read_before
|
||||
0.000000000000000000000000000000
|
||||
show full tables;
|
||||
Tables_in_show_table_lw_db Table_type
|
||||
t1 BASE TABLE
|
||||
t10 BASE TABLE
|
||||
t2 BASE TABLE
|
||||
t3 BASE TABLE
|
||||
t4 BASE TABLE
|
||||
t5 BASE TABLE
|
||||
t6 BASE TABLE
|
||||
t7 BASE TABLE
|
||||
t8 BASE TABLE
|
||||
t9 BASE TABLE
|
||||
select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME
|
||||
like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM'
|
||||
into @count_read_after;
|
||||
select @count_read_after-@count_read_before;
|
||||
@count_read_after-@count_read_before
|
||||
10.000000000000000000000000000000
|
||||
drop table t1;
|
||||
drop database show_table_lw_db;
|
@ -266,3 +266,27 @@ connect(localhost,mysqltest_nouser,,test,MASTER_PORT,MASTER_SOCKET);
|
||||
ERROR 28000: Access denied for user 'mysqltest_nouser'@'localhost' (using password: NO)
|
||||
DROP USER mysqltest_up1@'%';
|
||||
DROP USER mysqltest_up2@'%';
|
||||
#
|
||||
# BUG#1010351: New "via" keyword in 5.2+ can't be used as identifier anymore
|
||||
#
|
||||
create table t1 (via int);
|
||||
alter table t1 add key(via);
|
||||
drop table t1;
|
||||
create table t1 (col1 int);
|
||||
alter table t1 add via int not null;
|
||||
drop table t1;
|
||||
drop procedure if exists p1;
|
||||
create procedure p1(x int)
|
||||
foo: loop
|
||||
if x = 0 then
|
||||
leave foo;
|
||||
end if;
|
||||
select 'test';
|
||||
set x = x-1;
|
||||
end loop foo|
|
||||
call p1(2);
|
||||
test
|
||||
test
|
||||
test
|
||||
test
|
||||
drop procedure p1;
|
||||
|
@ -161,24 +161,24 @@ prepare stmt1 from @stmt ;
|
||||
execute stmt1 ;
|
||||
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
|
||||
5 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
4 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
4 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
execute stmt1 ;
|
||||
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
|
||||
5 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
4 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
4 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain SELECT (SELECT SUM(c1 + c12 + 0.0) FROM t2 where (t1.c2 - 0e-3) = t2.c2 GROUP BY t1.c15 LIMIT 1) as scalar_s, exists (select 1.0e+0 from t2 where t2.c3 * 9.0000000000 = t1.c4) as exists_s, c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s, (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s FROM t1, (select c25 x, c32 y from t2) tt WHERE x * 1 = c25;
|
||||
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
|
||||
5 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
4 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
4 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
deallocate prepare stmt1;
|
||||
drop tables t1,t2;
|
||||
set @@optimizer_switch=@save_optimizer_switch;
|
||||
|
@ -1682,7 +1682,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and `test`.`t2`.`b`)
|
||||
Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t2`.`b` <> 0))
|
||||
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;
|
||||
@ -1713,7 +1713,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
|
||||
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on((`test`.`t3`.`b` = `test`.`t2`.`a`)) where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and `test`.`t2`.`b`)
|
||||
Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on((`test`.`t3`.`b` = `test`.`t2`.`a`)) where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t2`.`b` <> 0))
|
||||
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;
|
||||
|
@ -225,10 +225,10 @@ INSERT INTO t2 VALUES (NULL), (0);
|
||||
EXPLAIN EXTENDED SELECT (SELECT 1 FROM t2 WHERE d = c) FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.c' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select <expr_cache><NULL>((select 1 from `test`.`t2` where (`test`.`t2`.`d` = NULL))) AS `(SELECT 1 FROM t2 WHERE d = c)` from dual
|
||||
Note 1003 select (select 1 from `test`.`t2` where (`test`.`t2`.`d` = NULL)) AS `(SELECT 1 FROM t2 WHERE d = c)` from dual
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# Bug#30302: Tables that were optimized away are printed in the
|
||||
@ -260,7 +260,7 @@ FLUSH TABLES;
|
||||
EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT 1 FROM t1 t JOIN t2 WHERE b <= 1 AND t.a);
|
||||
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 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# Bug #48573: difference of index selection between rpm binary and
|
||||
@ -287,7 +287,7 @@ WHERE t1.f1 GROUP BY t1.f1));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 1
|
||||
2 SUBQUERY a system NULL NULL NULL NULL 1
|
||||
2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1 Using where
|
||||
2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1
|
||||
PREPARE stmt FROM
|
||||
'EXPLAIN SELECT 1 FROM t1
|
||||
WHERE 1 > ALL((SELECT t1.f1 FROM t1 RIGHT OUTER JOIN t1 a
|
||||
@ -297,12 +297,12 @@ EXECUTE stmt;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 1
|
||||
2 SUBQUERY a system NULL NULL NULL NULL 1
|
||||
2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1 Using where
|
||||
2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1
|
||||
EXECUTE stmt;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 1
|
||||
2 SUBQUERY a system NULL NULL NULL NULL 1
|
||||
2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1 Using where
|
||||
2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1
|
||||
DEALLOCATE PREPARE stmt;
|
||||
PREPARE stmt FROM
|
||||
'EXPLAIN SELECT 1 FROM t1
|
||||
@ -313,12 +313,12 @@ EXECUTE stmt;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 1
|
||||
2 SUBQUERY a system NULL NULL NULL NULL 1
|
||||
2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1 Using where
|
||||
2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1
|
||||
EXECUTE stmt;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 1
|
||||
2 SUBQUERY a system NULL NULL NULL NULL 1
|
||||
2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1 Using where
|
||||
2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1
|
||||
DEALLOCATE PREPARE stmt;
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests.
|
||||
|
@ -204,4 +204,30 @@ SELECT BIT_XOR(t1.b) FROM t1 JOIN t2 ON t1.c=t2.c WHERE t1.pk=1;
|
||||
BIT_XOR(t1.b)
|
||||
0
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# Bug#12713907: STRANGE OPTIMIZE & WRONG RESULT UNDER ORDER BY
|
||||
# COUNT(*) LIMIT.
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
id BIGINT(20) ,
|
||||
member_id_to INT(11) ,
|
||||
r_date DATE ,
|
||||
PRIMARY KEY (id,r_date),
|
||||
KEY r_date_idx (r_date),
|
||||
KEY t1_idx01 (member_id_to)
|
||||
) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES
|
||||
(107924526,518491,'2011-05-01'),
|
||||
(107924527,518491,'2011-05-01'),
|
||||
(107924534,518491,'2011-06-21'),
|
||||
(107924535,518491,'2011-06-21'),
|
||||
(107924542,1601319,'2011-06-21'),
|
||||
(107924543,1601319,'2011-06-21'),
|
||||
(107924544,1601319,'2011-06-21'),
|
||||
(107924545,1601319,'2011-06-21');
|
||||
SELECT member_id_to, COUNT(*) FROM t1 WHERE r_date =
|
||||
'2011-06-21' GROUP BY member_id_to ORDER BY 2 LIMIT 1;
|
||||
member_id_to COUNT(*)
|
||||
518491 2
|
||||
DROP TABLE t1;
|
||||
End of 5.5 tests
|
||||
|
@ -789,3 +789,26 @@ DROP TABLE t1;
|
||||
# End of test BUG#13012483
|
||||
#
|
||||
End of 5.1 tests
|
||||
create table t1 (a bigint, b int);
|
||||
insert t1 values (1,1),(2,2),(3,3);
|
||||
select * from t1 where a in ('2.1');
|
||||
a b
|
||||
select * from t1 where b in ('2.1');
|
||||
a b
|
||||
select * from t1 where a='2.1';
|
||||
a b
|
||||
select * from t1 where b='2.1';
|
||||
a b
|
||||
select * from t1 where IF(1,a,a)='2.1';
|
||||
a b
|
||||
drop table t1;
|
||||
#
|
||||
# LP bug#992380 Crash when creating PS for a query with
|
||||
# subquery in WHERE (see also mysql bug#13012483)
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
PREPARE s FROM "SELECT 1 FROM t1 WHERE 1 < ALL (SELECT @:= (1 IN (SELECT 1 FROM t1)) FROM t1)";
|
||||
EXECUTE s;
|
||||
1
|
||||
DROP TABLE t1;
|
||||
# End of 5.3 tests
|
||||
|
@ -279,3 +279,44 @@ NULL
|
||||
SELECT GREATEST(1.5E+2,1.3E+2,NULL) FROM DUAL;
|
||||
GREATEST(1.5E+2,1.3E+2,NULL)
|
||||
NULL
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1), (100), (0), (NULL);
|
||||
select not a from t1;
|
||||
not a
|
||||
0
|
||||
0
|
||||
1
|
||||
NULL
|
||||
explain extended select not a from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00
|
||||
Warnings:
|
||||
Note 1003 select (`test`.`t1`.`a` = 0) AS `not a` from `test`.`t1`
|
||||
select * from t1 where not a;
|
||||
a
|
||||
0
|
||||
explain extended select * from t1 where not a;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 0)
|
||||
select not (a+0) from t1;
|
||||
not (a+0)
|
||||
0
|
||||
0
|
||||
1
|
||||
NULL
|
||||
explain extended select not (a+0) from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00
|
||||
Warnings:
|
||||
Note 1003 select (not((`test`.`t1`.`a` + 0))) AS `not (a+0)` from `test`.`t1`
|
||||
select * from t1 where not (a+0);
|
||||
a
|
||||
0
|
||||
explain extended select * from t1 where not (a+0);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (not((`test`.`t1`.`a` + 0)))
|
||||
drop table t1;
|
||||
|
@ -20,7 +20,17 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range g g 34 NULL 8 Using where
|
||||
SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
|
||||
fid AsText(g)
|
||||
1 LINESTRING(150 150,150 150)
|
||||
3 LINESTRING(148 148,152 152)
|
||||
4 LINESTRING(147 147,153 153)
|
||||
5 LINESTRING(146 146,154 154)
|
||||
6 LINESTRING(145 145,155 155)
|
||||
7 LINESTRING(144 144,156 156)
|
||||
8 LINESTRING(143 143,157 157)
|
||||
9 LINESTRING(142 142,158 158)
|
||||
10 LINESTRING(141 141,159 159)
|
||||
11 LINESTRING(140 140,160 160)
|
||||
2 LINESTRING(149 149,151 151)
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
@ -45,5 +55,8 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g,
|
||||
GeomFromText('Polygon((40 40,60 40,60 60,40 40))'));
|
||||
fid AsText(g)
|
||||
46 LINESTRING(51 41,60 50)
|
||||
56 LINESTRING(41 41,50 50)
|
||||
45 LINESTRING(51 51,60 60)
|
||||
DROP TABLE t1;
|
||||
End of 5.5 tests.
|
||||
|
@ -170,7 +170,17 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range g g 34 NULL 8 Using where
|
||||
SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
|
||||
fid AsText(g)
|
||||
1 LINESTRING(150 150,150 150)
|
||||
3 LINESTRING(148 148,152 152)
|
||||
4 LINESTRING(147 147,153 153)
|
||||
5 LINESTRING(146 146,154 154)
|
||||
6 LINESTRING(145 145,155 155)
|
||||
7 LINESTRING(144 144,156 156)
|
||||
8 LINESTRING(143 143,157 157)
|
||||
9 LINESTRING(142 142,158 158)
|
||||
10 LINESTRING(141 141,159 159)
|
||||
11 LINESTRING(140 140,160 160)
|
||||
2 LINESTRING(149 149,151 151)
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t2 (
|
||||
fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
@ -295,6 +305,10 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
SELECT fid, AsText(g) FROM t2 WHERE Within(g,
|
||||
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
|
||||
fid AsText(g)
|
||||
46 LINESTRING(51 41,60 50)
|
||||
56 LINESTRING(41 41,50 50)
|
||||
45 LINESTRING(51 51,60 60)
|
||||
55 LINESTRING(41 51,50 60)
|
||||
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10))));
|
||||
SELECT count(*) FROM t2;
|
||||
count(*)
|
||||
|
@ -2398,12 +2398,12 @@ EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE EXISTS
|
||||
(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1_outer index NULL a 10 NULL 15 Using index
|
||||
2 SUBQUERY t1 index NULL a 10 NULL 1 Using index
|
||||
2 SUBQUERY t1 index NULL a 10 NULL 15 Using index
|
||||
EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
|
||||
(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1_outer index NULL a 10 NULL 15 Using index
|
||||
2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY t1 index NULL a 10 NULL 15 Using index
|
||||
EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
|
||||
a IN (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -2419,9 +2419,9 @@ EXPLAIN SELECT 1 FROM t1 AS t1_outer1 JOIN t1 AS t1_outer2
|
||||
ON t1_outer1.a = (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2)
|
||||
AND t1_outer1.b = t1_outer2.b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1_outer1 ref a a 5 const 2 Using where; Using index
|
||||
1 PRIMARY t1_outer1 ref a a 5 const 1 Using where; Using index
|
||||
1 PRIMARY t1_outer2 index NULL a 10 NULL 15 Using where; Using index; Using join buffer (flat, BNL join)
|
||||
2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by
|
||||
2 SUBQUERY t1 index NULL a 10 NULL 15 Using index
|
||||
EXPLAIN SELECT (SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x
|
||||
FROM t1 AS t1_outer) x2 FROM t1 AS t1_outer2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -2756,8 +2756,8 @@ NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Using where; Using index
|
||||
x x x x x x x x x Using where; Using index
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
x x x x x x x x x Using index
|
||||
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
|
||||
MIN( a )
|
||||
NULL
|
||||
@ -2828,8 +2828,8 @@ NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Using where; Using index
|
||||
x x x x x x x x x Using where; Using index
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
x x x x x x x x x Using index
|
||||
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
|
||||
MIN( a )
|
||||
NULL
|
||||
@ -2907,8 +2907,8 @@ NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Using where; Using index
|
||||
x x x x x x x x x Using where; Using index
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
x x x x x x x x x Using index
|
||||
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
|
||||
MIN( a )
|
||||
NULL
|
||||
|
@ -654,7 +654,7 @@ EXPLAIN SELECT t1.f1 FROM t1
|
||||
WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f1 = 2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1 Using index
|
||||
2 DEPENDENT SUBQUERY t2 index_merge f2,f3 f3,f2 2,5 NULL 1 Using intersect(f3,f2); Using where; Using index
|
||||
2 SUBQUERY t2 index_merge f2,f3 f3,f2 2,5 NULL 1 Using intersect(f3,f2); Using where; Using index
|
||||
DROP TABLE t1,t2;
|
||||
#
|
||||
# BUG#56862/640419: Wrong result with sort_union index merge when one
|
||||
@ -745,4 +745,36 @@ WHERE v1 IN ('f', 'd', 'h', 'u' ) AND i = 2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref i,v i 5 const 2 Using where
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# BUG#1006164: Multi-table DELETE that uses innodb + index_merge/intersect may fail to delete rows
|
||||
#
|
||||
create table t0(a int);
|
||||
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
create table t1 (
|
||||
pk int auto_increment,
|
||||
zone_id int,
|
||||
modified tinyint,
|
||||
primary key(pk),
|
||||
key (zone_id),
|
||||
key (modified)
|
||||
) engine=innodb;
|
||||
insert into t1 (zone_id, modified) select 0,0 from t0 A, t0 B, t0 C, t0 D;
|
||||
update t1 set zone_id=487, modified=9 where pk=7259;
|
||||
update t1 set zone_id=487, modified=9 where pk=7260;
|
||||
update t1 set zone_id=830, modified=9 where pk=8434;
|
||||
update t1 set zone_id=830, modified=9 where pk=8435;
|
||||
update t1 set zone_id=830, modified=9 where pk=8436;
|
||||
update t1 set zone_id=830, modified=9 where pk=8437;
|
||||
select * from t1 where t1.zone_id=830 AND modified=9;
|
||||
pk zone_id modified
|
||||
8434 830 9
|
||||
8435 830 9
|
||||
8436 830 9
|
||||
8437 830 9
|
||||
begin;
|
||||
DELETE t1 FROM t1 WHERE t1.zone_id=830 AND modified=9;
|
||||
commit;
|
||||
select * from t1 where t1.zone_id=830 AND modified=9;
|
||||
pk zone_id modified
|
||||
drop table t0, t1;
|
||||
set optimizer_switch= @optimizer_switch_save;
|
||||
|
@ -1487,7 +1487,7 @@ EXPLAIN SELECT t1.f1 FROM t1
|
||||
WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f1 = 2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
|
||||
2 DEPENDENT SUBQUERY t2 ref f2,f3 f2 5 const 1 Using where
|
||||
2 SUBQUERY t2 ref f2,f3 f2 5 const 1 Using where
|
||||
DROP TABLE t1,t2;
|
||||
create table t0 (a int);
|
||||
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
|
@ -835,6 +835,22 @@ Variable_name Value
|
||||
Handler_icp_attempts 2
|
||||
Handler_icp_match 1
|
||||
DROP TABLE t1;
|
||||
create table t1 (a int,b char(5),primary key (a), key (b(1)));
|
||||
insert into t1 values ('a','b');
|
||||
Warnings:
|
||||
Warning 1366 Incorrect integer value: 'a' for column 'a' at row 1
|
||||
select 1 from t1 where a and b >= 'aa';
|
||||
1
|
||||
drop table t1;
|
||||
#
|
||||
# Bug#58015 "Assert in row_sel_field_store_in_mysql_format
|
||||
# when running innodb_mrr_icp test"
|
||||
#
|
||||
create table t1 (a char(2) charset utf8,b double, primary key (a(1)),key (b));
|
||||
insert into t1 values ('',1);
|
||||
select 1 from t1 where b <= 1 and a <> '';
|
||||
1
|
||||
drop table t1;
|
||||
#
|
||||
# BUG#920132: Assert trx->n_active_thrs == 1 failed at que0que.c line 1050
|
||||
#
|
||||
|
@ -1895,10 +1895,10 @@ EXPLAIN EXTENDED
|
||||
SELECT t2.a FROM t1 LEFT JOIN t2 ON (6) IN (SELECT a FROM t3);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 1 100.00 Using where
|
||||
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
1 PRIMARY t2 system NULL NULL NULL NULL 1 100.00
|
||||
2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where 1
|
||||
Note 1003 select NULL AS `a` from `test`.`t2` where 1
|
||||
DROP TABLE t1,t2,t3;
|
||||
#
|
||||
# LP bug #817384 Wrong result with outer join + subquery in ON
|
||||
|
@ -1906,10 +1906,10 @@ EXPLAIN EXTENDED
|
||||
SELECT t2.a FROM t1 LEFT JOIN t2 ON (6) IN (SELECT a FROM t3);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 1 100.00 Using where
|
||||
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
1 PRIMARY t2 system NULL NULL NULL NULL 1 100.00
|
||||
2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where 1
|
||||
Note 1003 select NULL AS `a` from `test`.`t2` where 1
|
||||
DROP TABLE t1,t2,t3;
|
||||
#
|
||||
# LP bug #817384 Wrong result with outer join + subquery in ON
|
||||
|
@ -598,8 +598,8 @@ VALUES
|
||||
EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
|
||||
(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1_outer index NULL a 10 NULL 15 Using index
|
||||
2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY t1 index NULL a 10 NULL 15 Using index
|
||||
SELECT 1 as RES FROM t1 AS t1_outer WHERE
|
||||
(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12;
|
||||
RES
|
||||
|
@ -679,7 +679,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 1 Using temporary
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 3 Distinct
|
||||
2 SUBQUERY t3 ALL NULL NULL NULL NULL 3
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 3
|
||||
SELECT DISTINCT a AS field1 FROM t1, t2
|
||||
WHERE EXISTS (SELECT c FROM t3 LEFT JOIN t2 ON b = d)
|
||||
HAVING field1 > 'aaa' LIMIT ROWS EXAMINED 20;
|
||||
|
22
mysql-test/r/mdev316.result
Normal file
22
mysql-test/r/mdev316.result
Normal file
@ -0,0 +1,22 @@
|
||||
set names swe7;
|
||||
select '' in ('',convert(0,time));
|
||||
'' in ('',convert(0,time))
|
||||
1
|
||||
select case '' when '' then 1 when convert(0,time) then 2 end;
|
||||
case '' when '' then 1 when convert(0,time) then 2 end
|
||||
1
|
||||
select convert(0x0030 using ucs2) div 1, concat(convert(0x0030 using ucs2)) div 1;
|
||||
convert(0x0030 using ucs2) div 1 concat(convert(0x0030 using ucs2)) div 1
|
||||
0 0
|
||||
select cast(convert(0x0030 using ucs2) as double), cast(concat(convert(0x0030 using ucs2)) as double);
|
||||
cast(convert(0x0030 using ucs2) as double) cast(concat(convert(0x0030 using ucs2)) as double)
|
||||
0 0
|
||||
select cast(convert(0x0030 using ucs2) as decimal(5.2)), cast(concat(convert(0x0030 using ucs2)) as decimal(5.2));
|
||||
cast(convert(0x0030 using ucs2) as decimal(5.2)) cast(concat(convert(0x0030 using ucs2)) as decimal(5.2))
|
||||
0 0
|
||||
select cast(convert(_ucs2 0x0030 using latin1) as date), cast(concat(convert(_ucs2 0x0030 using latin1)) as date);
|
||||
cast(convert(_ucs2 0x0030 using latin1) as date) cast(concat(convert(_ucs2 0x0030 using latin1)) as date)
|
||||
NULL NULL
|
||||
Warnings:
|
||||
Warning 1292 Incorrect datetime value: '0'
|
||||
Warning 1292 Incorrect datetime value: '0'
|
@ -165,7 +165,7 @@ WHERE ts BETWEEN '0000-00-00' AND '2010-00-01 00:00:00'
|
||||
ORDER BY ts DESC
|
||||
LIMIT 2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 4 Using index condition
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 4 Using where
|
||||
|
||||
DROP TABLE t1;
|
||||
#
|
||||
@ -839,6 +839,22 @@ Variable_name Value
|
||||
Handler_icp_attempts 2
|
||||
Handler_icp_match 1
|
||||
DROP TABLE t1;
|
||||
create table t1 (a int,b char(5),primary key (a), key (b(1)));
|
||||
insert into t1 values ('a','b');
|
||||
Warnings:
|
||||
Warning 1366 Incorrect integer value: 'a' for column 'a' at row 1
|
||||
select 1 from t1 where a and b >= 'aa';
|
||||
1
|
||||
drop table t1;
|
||||
#
|
||||
# Bug#58015 "Assert in row_sel_field_store_in_mysql_format
|
||||
# when running innodb_mrr_icp test"
|
||||
#
|
||||
create table t1 (a char(2) charset utf8,b double, primary key (a(1)),key (b));
|
||||
insert into t1 values ('',1);
|
||||
select 1 from t1 where b <= 1 and a <> '';
|
||||
1
|
||||
drop table t1;
|
||||
drop table if exists t0, t1, t1i, t1m;
|
||||
#
|
||||
# BUG#826935 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed
|
||||
@ -914,4 +930,23 @@ Warning 1292 Truncated incorrect DOUBLE value: 'c'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'c'
|
||||
SET optimizer_switch=@save_optimizer_switch;
|
||||
DROP TABLE t1,t2,t3,t4;
|
||||
#
|
||||
# BUG#1000051: Query with simple join and ORDER BY takes thousands times longer when run with ICP
|
||||
#
|
||||
create table t0 (a int);
|
||||
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
create table t1 (a int, col int, filler char(100), key(a, col));
|
||||
insert into t1 select A.a + 10*B.a, 1234, 'filler' from t0 A, t0 B, t0 C;
|
||||
set @tmp_10000051= @@optimizer_switch;
|
||||
set optimizer_switch='mrr=off';
|
||||
# Must not use ICP:
|
||||
explain select * from t1 where a between 5 and 8 order by a desc, col desc;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range a a 5 NULL 39 Using where
|
||||
set optimizer_switch= @tmp_10000051;
|
||||
# Must not use ICP:
|
||||
explain select * from t1 where a=3 and col > 500 order by a desc, col desc;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range a a 10 NULL 10 Using where
|
||||
drop table t0, t1;
|
||||
set optimizer_switch=@myisam_icp_tmp;
|
||||
|
@ -349,10 +349,10 @@ WHERE t2.int_key IS NULL
|
||||
GROUP BY t2.pk
|
||||
);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY t2 ref int_key int_key 5 const 1 100.00 Using index condition
|
||||
Warnings:
|
||||
Note 1003 select min(1) AS `MIN(t1.pk)` from dual where exists(select `test`.`t2`.`pk` from `test`.`t2` where isnull(`test`.`t2`.`int_key`))
|
||||
Note 1003 select min(`test`.`t1`.`pk`) AS `MIN(t1.pk)` from `test`.`t1` where 0
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# BUG#42048 Discrepancy between MyISAM and Maria's ICP implementation
|
||||
|
@ -159,6 +159,10 @@ The following options may be given as the first argument:
|
||||
Enable the event scheduler. Possible values are ON, OFF,
|
||||
and DISABLED (keep the event scheduler completely
|
||||
deactivated, it cannot be activated run-time)
|
||||
--expensive-subquery-limit=#
|
||||
The maximum number of rows a subquery may examine in
|
||||
order to be executed during optimization and used for
|
||||
constant optimization
|
||||
--expire-logs-days=#
|
||||
If non-zero, binary logs will be purged after
|
||||
expire_logs_days days; possible purges happen at startup
|
||||
@ -888,6 +892,7 @@ delayed-queue-size 1000
|
||||
div-precision-increment 4
|
||||
engine-condition-pushdown FALSE
|
||||
event-scheduler OFF
|
||||
expensive-subquery-limit 100
|
||||
expire-logs-days 0
|
||||
external-locking FALSE
|
||||
extra-max-connections 1
|
||||
|
@ -5222,3 +5222,48 @@ DROP DATABASE b12809202_db;
|
||||
# Delete all existing binary logs.
|
||||
#
|
||||
RESET MASTER;
|
||||
#
|
||||
# Bug#45740 MYSQLDUMP DOESN'T DUMP GENERAL_LOG AND SLOW_QUERY CAUSES RESTORE PROBLEM
|
||||
#
|
||||
SET @old_log_output_state= @@global.log_output;
|
||||
SET @old_general_log_state= @@global.general_log;
|
||||
SET @old_slow_query_log_state= @@global.slow_query_log;
|
||||
call mtr.add_suppression("Failed to write to mysql.general_log");
|
||||
SET @@global.log_output="TABLE";
|
||||
SET @@global.general_log='OFF';
|
||||
SET @@global.slow_query_log='OFF';
|
||||
DROP DATABASE mysql;
|
||||
Warnings:
|
||||
Error 1146 Table 'mysql.proc' doesn't exist
|
||||
Error 1146 Table 'mysql.event' doesn't exist
|
||||
SHOW CREATE TABLE mysql.general_log;
|
||||
Table Create Table
|
||||
general_log CREATE TABLE `general_log` (
|
||||
`event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`user_host` mediumtext NOT NULL,
|
||||
`thread_id` int(11) NOT NULL,
|
||||
`server_id` int(10) unsigned NOT NULL,
|
||||
`command_type` varchar(64) NOT NULL,
|
||||
`argument` mediumtext NOT NULL
|
||||
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'
|
||||
SHOW CREATE TABLE mysql.slow_log;
|
||||
Table Create Table
|
||||
slow_log CREATE TABLE `slow_log` (
|
||||
`start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`user_host` mediumtext NOT NULL,
|
||||
`query_time` time(6) NOT NULL,
|
||||
`lock_time` time(6) NOT NULL,
|
||||
`rows_sent` int(11) NOT NULL,
|
||||
`rows_examined` int(11) NOT NULL,
|
||||
`db` varchar(512) NOT NULL,
|
||||
`last_insert_id` int(11) NOT NULL,
|
||||
`insert_id` int(11) NOT NULL,
|
||||
`server_id` int(10) unsigned NOT NULL,
|
||||
`sql_text` mediumtext NOT NULL
|
||||
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
|
||||
SET @@global.log_output= @old_log_output_state;
|
||||
SET @@global.slow_query_log= @old_slow_query_log_state;
|
||||
SET @@global.general_log= @old_general_log_state;
|
||||
#
|
||||
# End of 5.1 tests
|
||||
#
|
||||
|
1
mysql-test/r/mysqltest_256.result
Normal file
1
mysql-test/r/mysqltest_256.result
Normal file
@ -0,0 +1 @@
|
||||
# Done
|
@ -321,7 +321,7 @@ select * from t1 where not(NULL or a);
|
||||
a
|
||||
explain select * from t1 where not(NULL and a);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index NULL a 5 NULL 21 Using where; Using index
|
||||
1 SIMPLE t1 ref a a 5 const 1 Using index
|
||||
select * from t1 where not(NULL and a);
|
||||
a
|
||||
0
|
||||
@ -502,5 +502,5 @@ explain extended select a, not(not(a)), not(a <= 2 and not(a)), not(a not like "
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 range a a 5 NULL 4 100.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,(`test`.`t1`.`a` <> 0) AS `not(not(a))`,((`test`.`t1`.`a` > 2) or `test`.`t1`.`a`) AS `not(a <= 2 and not(a))`,(`test`.`t1`.`a` like '1') AS `not(a not like "1")`,(`test`.`t1`.`a` in (1,2)) AS `not (a not in (1,2))`,(`test`.`t1`.`a` = 2) AS `not(a != 2)` from `test`.`t1` where (`test`.`t1`.`a` <> 0) having (`test`.`t1`.`a` <> 0)
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,(`test`.`t1`.`a` <> 0) AS `not(not(a))`,((`test`.`t1`.`a` > 2) or (`test`.`t1`.`a` <> 0)) AS `not(a <= 2 and not(a))`,(`test`.`t1`.`a` like '1') AS `not(a not like "1")`,(`test`.`t1`.`a` in (1,2)) AS `not (a not in (1,2))`,(`test`.`t1`.`a` = 2) AS `not(a != 2)` from `test`.`t1` where (`test`.`t1`.`a` <> 0) having (`test`.`t1`.`a` <> 0)
|
||||
drop table t1;
|
||||
|
@ -2461,3 +2461,15 @@ SELECT 1 FROM t1 JOIN t1 AS t2 USING (a);
|
||||
1
|
||||
1
|
||||
drop table t1;
|
||||
#
|
||||
# LP BUG#1001117 Crash on a simple select that uses a temptable view
|
||||
# MySQL Bug #12330344 Crash and/or valgrind errors in free_io_cache with join, view,
|
||||
# partitioned table
|
||||
#
|
||||
CREATE TABLE t1(a INT PRIMARY KEY) PARTITION BY LINEAR KEY (a);
|
||||
CREATE ALGORITHM=TEMPTABLE VIEW vtmp AS
|
||||
SELECT 1 FROM t1 AS t1_0 JOIN t1 ON t1_0.a LIKE (SELECT 1 FROM t1);
|
||||
SELECT * FROM vtmp;
|
||||
1
|
||||
DROP VIEW vtmp;
|
||||
DROP TABLE t1;
|
||||
|
@ -160,26 +160,26 @@ execute stmt1 ;
|
||||
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
|
||||
6 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
5 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
4 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
4 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
execute stmt1 ;
|
||||
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
|
||||
6 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
5 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
4 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
4 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain SELECT (SELECT SUM(c1 + c12 + 0.0) FROM t2 where (t1.c2 - 0e-3) = t2.c2 GROUP BY t1.c15 LIMIT 1) as scalar_s, exists (select 1.0e+0 from t2 where t2.c3 * 9.0000000000 = t1.c4) as exists_s, c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s, (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s FROM t1, (select c25 x, c32 y from t2) tt WHERE x * 1 = c25;
|
||||
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
|
||||
6 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
5 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
4 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
4 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
deallocate prepare stmt1;
|
||||
set optimizer_switch=@tmp_optimizer_switch;
|
||||
drop tables t1,t2;
|
||||
@ -255,15 +255,15 @@ deallocate prepare StMt1;
|
||||
deallocate prepare Stmt1;
|
||||
ERROR HY000: Unknown prepared statement handler (Stmt1) given to DEALLOCATE PREPARE
|
||||
set names utf8;
|
||||
prepare `ü` from 'select 1234';
|
||||
execute `ü` ;
|
||||
prepare `ü` from 'select 1234';
|
||||
execute `ü` ;
|
||||
1234
|
||||
1234
|
||||
set names latin1;
|
||||
execute `ü`;
|
||||
execute `ü`;
|
||||
1234
|
||||
1234
|
||||
deallocate prepare `ü`;
|
||||
deallocate prepare `ü`;
|
||||
set names default;
|
||||
create table t1 (a varchar(10)) charset=utf8;
|
||||
insert into t1 (a) values ('yahoo');
|
||||
@ -3055,6 +3055,62 @@ DEALLOCATE PREPARE stmt;
|
||||
DROP TABLE t1;
|
||||
|
||||
End of 5.1 tests.
|
||||
#
|
||||
# LP bug#1001500 Crash on the second execution of the PS for
|
||||
# a query with degenerated conjunctive condition
|
||||
# (see also mysql bug#12582849)
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
pk INTEGER AUTO_INCREMENT,
|
||||
col_int_nokey INTEGER,
|
||||
col_int_key INTEGER,
|
||||
col_varchar_key VARCHAR(1),
|
||||
col_varchar_nokey VARCHAR(1),
|
||||
PRIMARY KEY (pk),
|
||||
KEY (col_int_key),
|
||||
KEY (col_varchar_key, col_int_key)
|
||||
);
|
||||
INSERT INTO t1 (
|
||||
col_int_key, col_int_nokey,
|
||||
col_varchar_key, col_varchar_nokey
|
||||
) VALUES
|
||||
(4, 2, 'v', 'v'),
|
||||
(62, 150, 'v', 'v');
|
||||
CREATE TABLE t2 (
|
||||
pk INTEGER AUTO_INCREMENT,
|
||||
col_int_nokey INTEGER,
|
||||
col_int_key INTEGER,
|
||||
col_varchar_key VARCHAR(1),
|
||||
col_varchar_nokey VARCHAR(1),
|
||||
PRIMARY KEY (pk),
|
||||
KEY (col_int_key),
|
||||
KEY (col_varchar_key, col_int_key)
|
||||
);
|
||||
INSERT INTO t2 (
|
||||
col_int_key, col_int_nokey,
|
||||
col_varchar_key, col_varchar_nokey
|
||||
) VALUES
|
||||
(8, NULL, 'x', 'x'),
|
||||
(7, 8, 'd', 'd');
|
||||
PREPARE stmt FROM '
|
||||
SELECT
|
||||
( SELECT MAX( SQ1_alias2 .col_int_nokey ) AS SQ1_field1
|
||||
FROM ( t2 AS SQ1_alias1 RIGHT JOIN t1 AS SQ1_alias2
|
||||
ON ( SQ1_alias2.col_varchar_key = SQ1_alias1.col_varchar_nokey )
|
||||
)
|
||||
WHERE SQ1_alias2.pk < alias1.col_int_nokey OR alias1.pk
|
||||
) AS field1
|
||||
FROM ( t1 AS alias1 JOIN t2 AS alias2 ON alias2.pk )
|
||||
GROUP BY field1
|
||||
';
|
||||
EXECUTE stmt;
|
||||
field1
|
||||
150
|
||||
EXECUTE stmt;
|
||||
field1
|
||||
150
|
||||
DEALLOCATE PREPARE stmt;
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
#
|
||||
# WL#4435: Support OUT-parameters in prepared statements.
|
||||
@ -4044,3 +4100,4 @@ c1 c2 count(c3)
|
||||
2012-03-01 01:00:00 3 1
|
||||
2012-03-01 02:00:00 3 1
|
||||
DEALLOCATE PREPARE s1;
|
||||
# End of 5.3 tests
|
||||
|
@ -75,18 +75,16 @@ connection default;
|
||||
set global read_only=1;
|
||||
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
|
||||
unlock tables ;
|
||||
send set global read_only=1;
|
||||
set global read_only=1;
|
||||
connection con1;
|
||||
select @@global.read_only;
|
||||
@@global.read_only
|
||||
0
|
||||
unlock tables ;
|
||||
select @@global.read_only;
|
||||
@@global.read_only
|
||||
1
|
||||
connection con1;
|
||||
select @@global.read_only;
|
||||
@@global.read_only
|
||||
1
|
||||
unlock tables ;
|
||||
connection default;
|
||||
reap;
|
||||
connection default;
|
||||
set global read_only=0;
|
||||
BEGIN;
|
||||
|
@ -43,6 +43,15 @@ a
|
||||
1
|
||||
COMMIT;
|
||||
UNLOCK TABLES;
|
||||
connection con1;
|
||||
lock table t1 read;
|
||||
connection default;
|
||||
set global read_only=1;
|
||||
connection con1;
|
||||
unlock tables;
|
||||
connection default;
|
||||
SET GLOBAL read_only=0;
|
||||
UNLOCK TABLES;
|
||||
DROP TABLE t1;
|
||||
DROP USER test@localhost;
|
||||
echo End of 5.1 tests
|
||||
|
@ -9,6 +9,6 @@ STOP SLAVE;
|
||||
CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_START;
|
||||
START SLAVE;
|
||||
STOP SLAVE;
|
||||
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT='MASTER_MYPORT', MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_START;
|
||||
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_MYPORT, MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_START;
|
||||
START SLAVE;
|
||||
include/rpl_end.inc
|
||||
|
@ -7849,3 +7849,36 @@ c1 c2 count(c3)
|
||||
2012-03-01 01:00:00 3 1
|
||||
2012-03-01 02:00:00 3 1
|
||||
DROP PROCEDURE p1;
|
||||
#
|
||||
# LP bug#1002157 : testing stored function
|
||||
# bug#62125 result for null incorrectly yields 1292 warning.
|
||||
#
|
||||
DROP FUNCTION IF EXISTS f1;
|
||||
DROP FUNCTION IF EXISTS f2;
|
||||
DROP FUNCTION IF EXISTS f3;
|
||||
DROP FUNCTION IF EXISTS f4;
|
||||
CREATE FUNCTION f1() RETURNS VARCHAR(1)
|
||||
BEGIN RETURN 'X'; END;/
|
||||
CREATE FUNCTION f2() RETURNS CHAR(1)
|
||||
BEGIN RETURN 'X'; END;/
|
||||
CREATE FUNCTION f3() RETURNS VARCHAR(1)
|
||||
BEGIN RETURN NULL; END;/
|
||||
CREATE FUNCTION f4() RETURNS CHAR(1)
|
||||
BEGIN RETURN NULL; END;/
|
||||
SELECT f1() IS NULL;
|
||||
f1() IS NULL
|
||||
0
|
||||
SELECT f2() IS NULL;
|
||||
f2() IS NULL
|
||||
0
|
||||
SELECT f3() IS NULL;
|
||||
f3() IS NULL
|
||||
1
|
||||
SELECT f4() IS NULL;
|
||||
f4() IS NULL
|
||||
1
|
||||
DROP FUNCTION f1;
|
||||
DROP FUNCTION f2;
|
||||
DROP FUNCTION f3;
|
||||
DROP FUNCTION f4;
|
||||
# End of 5.5 test
|
||||
|
@ -51,12 +51,12 @@ ERROR 42S22: Reference 'a' not supported (forward reference in item list)
|
||||
EXPLAIN EXTENDED SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 1 100.00
|
||||
3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select 1 AS `1` from dual having (<expr_cache><1>((select 1)) = 1)
|
||||
Note 1003 select 1 AS `1` from dual having ((select 1) = 1)
|
||||
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
|
||||
1
|
||||
1
|
||||
@ -371,12 +371,12 @@ INSERT INTO t8 (pseudo,email) VALUES ('joce1','test1');
|
||||
INSERT INTO t8 (pseudo,email) VALUES ('2joce1','2test1');
|
||||
EXPLAIN EXTENDED SELECT pseudo,(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce')) FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using where; Using index
|
||||
1 PRIMARY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
|
||||
4 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
|
||||
2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using where
|
||||
2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00
|
||||
3 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t8`.`pseudo` AS `pseudo`,(select `test`.`t8`.`email` from `test`.`t8` where (`test`.`t8`.`pseudo` = (select 'joce' from `test`.`t8` where 1))) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where (`test`.`t8`.`pseudo` = (select 'joce' from `test`.`t8` where 1))
|
||||
Note 1003 select 'joce' AS `pseudo`,(select 'test' from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
|
||||
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
|
||||
t8 WHERE pseudo='joce');
|
||||
ERROR 21000: Operand should contain 1 column(s)
|
||||
@ -517,6 +517,7 @@ ERROR 21000: Subquery returns more than 1 row
|
||||
show warnings;
|
||||
Level Code Message
|
||||
Error 1242 Subquery returns more than 1 row
|
||||
Error 1028 Sort aborted: Subquery returns more than 1 row
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1),(2),(3);
|
||||
@ -547,11 +548,7 @@ SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT
|
||||
numreponse (SELECT numeropost FROM t1 HAVING numreponse=1)
|
||||
INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
|
||||
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using where; Using index
|
||||
2 SUBQUERY t1 ref PRIMARY PRIMARY 3 const 2 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`numreponse` AS `numreponse` from `test`.`t1` where ((`test`.`t1`.`numeropost` = '1') and (`test`.`t1`.`numreponse` = (select 1 from `test`.`t1` where (`test`.`t1`.`numeropost` = '1'))))
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
|
||||
@ -907,7 +904,7 @@ a t1.a in (select t2.a from t2)
|
||||
explain extended SELECT t1.a, t1.a in (select t2.a from t2) FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
|
||||
2 DEPENDENT SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index
|
||||
2 SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t2 on a checking NULL having <is_not_null_test>(`test`.`t2`.`a`))))) AS `t1.a in (select t2.a from t2)` from `test`.`t1`
|
||||
CREATE TABLE t3 (a int(11) default '0');
|
||||
@ -1320,7 +1317,7 @@ SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
Warnings:
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 from dual where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
INSERT INTO t1 (pseudo) VALUES ('test1');
|
||||
@ -1330,7 +1327,7 @@ SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
Warnings:
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
drop table t1;
|
||||
@ -1608,25 +1605,25 @@ a3 1
|
||||
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2) from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
|
||||
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
|
||||
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1`
|
||||
explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
|
||||
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
|
||||
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`s1` AS `s1`,<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1`
|
||||
explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
|
||||
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
|
||||
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1`
|
||||
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
|
||||
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key
|
||||
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where (`test`.`t2`.`s1` < 'a2') having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
|
||||
drop table t1,t2;
|
||||
@ -1675,34 +1672,34 @@ select * from t3 where NULL >= any (select b from t2);
|
||||
a
|
||||
explain extended select * from t3 where NULL >= any (select b from t2);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
|
||||
select * from t3 where NULL >= any (select b from t2 group by 1);
|
||||
a
|
||||
explain extended select * from t3 where NULL >= any (select b from t2 group by 1);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
|
||||
select * from t3 where NULL >= some (select b from t2);
|
||||
a
|
||||
explain extended select * from t3 where NULL >= some (select b from t2);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
|
||||
select * from t3 where NULL >= some (select b from t2 group by 1);
|
||||
a
|
||||
explain extended select * from t3 where NULL >= some (select b from t2 group by 1);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
|
||||
insert into t2 values (2,2), (2,1), (3,3), (3,1);
|
||||
select * from t3 where a > all (select max(b) from t2 group by a);
|
||||
a
|
||||
@ -1764,7 +1761,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 UNION t1 system NULL NULL NULL NULL 1 100.00
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1003 select 'e' AS `s1` from dual where <nop>(<in_optimizer>('f',(<min>(select 'e' from dual union select 'e' from dual) < 'f')))
|
||||
Note 1003 select 'e' AS `s1` from dual where 1
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (number char(11) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1;
|
||||
INSERT INTO t1 VALUES ('69294728265'),('18621828126'),('89356874041'),('95895001874');
|
||||
@ -3099,8 +3096,8 @@ ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
|
||||
ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
|
||||
1 PRIMARY r eq_ref PRIMARY PRIMARY 4 const 1 Using where
|
||||
2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using index condition
|
||||
1 PRIMARY r const PRIMARY PRIMARY 4 const 1
|
||||
2 SUBQUERY t2 range b b 40 NULL 2 Using where
|
||||
SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
|
||||
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
|
||||
ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
|
||||
@ -3111,8 +3108,8 @@ ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
|
||||
ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
|
||||
1 PRIMARY r eq_ref PRIMARY PRIMARY 4 const 1 Using where
|
||||
2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using index condition
|
||||
1 PRIMARY r const PRIMARY PRIMARY 4 const 1
|
||||
2 SUBQUERY t2 range b b 40 NULL 2 Using index condition
|
||||
SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
|
||||
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
|
||||
ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
|
||||
@ -3163,7 +3160,7 @@ INSERT INTO t2 VALUES (1),(2),(3);
|
||||
EXPLAIN SELECT a, a IN (SELECT a FROM t1) FROM t2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 3
|
||||
2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 2 Using index; Full scan on NULL key
|
||||
2 SUBQUERY t1 index_subquery a a 5 func 2 Using index; Full scan on NULL key
|
||||
SELECT a, a IN (SELECT a FROM t1) FROM t2;
|
||||
a a IN (SELECT a FROM t1)
|
||||
1 1
|
||||
@ -3699,7 +3696,7 @@ ORDER BY t1.t DESC LIMIT 1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 system NULL NULL NULL NULL 1
|
||||
1 PRIMARY t1 index NULL PRIMARY 16 NULL 11 Using where; Using index
|
||||
2 DEPENDENT SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index
|
||||
2 SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index
|
||||
SELECT * FROM t1,t2
|
||||
WHERE t1.t = (SELECT t1.t FROM t1
|
||||
WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1
|
||||
@ -3726,9 +3723,9 @@ from t1' at line 1
|
||||
explain select * from t1 where not exists
|
||||
((select t11.i from t1 t11) union (select t12.i from t1 t12));
|
||||
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 SUBQUERY t11 system NULL NULL NULL NULL 0 const row not found
|
||||
3 UNION t12 system NULL NULL NULL NULL 0 const row not found
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(250), b INT auto_increment, PRIMARY KEY (b));
|
||||
@ -4198,8 +4195,8 @@ CREATE TABLE t1 (a int, b int, KEY (a));
|
||||
INSERT INTO t1 VALUES (1,1),(2,1);
|
||||
EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT COUNT(*) FROM t1 GROUP BY b);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ref a a 5 const 0 Using where; Using index
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
|
||||
1 PRIMARY t1 ref a a 5 const 1 Using where; Using index
|
||||
2 SUBQUERY internal_tmp_table ALL group_key NULL NULL NULL 1 Using temporary; Using filesort
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id));
|
||||
INSERT INTO t1 VALUES
|
||||
@ -4580,7 +4577,7 @@ FROM t1
|
||||
WHERE a = 230;
|
||||
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 NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
|
||||
FROM t1
|
||||
WHERE a = 230;
|
||||
@ -4626,7 +4623,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <nop>(<in_optimizer>(1,((select max(`test`.`t1`.`a1`) from `test`.`t1`) > 1)))
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where 1
|
||||
SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t1);
|
||||
1
|
||||
1
|
||||
@ -5725,7 +5722,7 @@ WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a )
|
||||
GROUP BY b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
SELECT b FROM t1
|
||||
WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a )
|
||||
GROUP BY b;
|
||||
@ -5969,7 +5966,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
|
||||
2 SUBQUERY t1 ref a a 5 const 1 Using index
|
||||
2 SUBQUERY t1 ref a a 5 const 1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
|
||||
@ -6130,7 +6127,7 @@ set optimizer_switch=@tmp_optimizer_switch;
|
||||
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
|
||||
2 SUBQUERY t1 ref a a 5 const 1 Using index
|
||||
2 SUBQUERY t1 ref a a 5 const 1
|
||||
|
||||
DROP TABLE t1;
|
||||
#
|
||||
@ -6542,7 +6539,7 @@ EXPLAIN
|
||||
SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
|
||||
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 t1 ALL NULL NULL NULL NULL 2
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
|
||||
COUNT(f1) f4
|
||||
0 NULL
|
||||
@ -6550,7 +6547,7 @@ EXPLAIN
|
||||
SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
|
||||
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 t1 ALL NULL NULL NULL NULL 2
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
|
||||
COUNT(f1) f4
|
||||
0 0
|
||||
@ -6571,5 +6568,205 @@ SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE
|
||||
COUNT(f1) f4
|
||||
0 0
|
||||
drop table t1,t2;
|
||||
#
|
||||
# LP BUG#1002079 Server crashes in Item_singlerow_subselect::val_int with constant table,
|
||||
# HAVING, UNION in subquery
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (7),(0);
|
||||
CREATE TABLE t2 (b INT);
|
||||
EXPLAIN
|
||||
SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
|
||||
SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7;
|
||||
f1 f2
|
||||
drop table t1,t2;
|
||||
#
|
||||
# LP BUG#1008686 Server crashes in subselect_union_engine::no_rows on SELECT with impossible
|
||||
# WHERE and UNION in HAVING
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (1),(7);
|
||||
EXPLAIN
|
||||
SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_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 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
|
||||
SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_a != 1;
|
||||
min_a a
|
||||
EXPLAIN
|
||||
SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_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 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
3 DEPENDENT UNION t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
|
||||
SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_a != 1;
|
||||
min_a a
|
||||
drop table t1;
|
||||
#
|
||||
# LP BUG#944706 Query with impossible or constant subquery in WHERE or HAVING is not
|
||||
# precomputed and thus not part of optimization
|
||||
#
|
||||
CREATE TABLE t1 ( a VARCHAR(16), KEY (a) );
|
||||
INSERT INTO t1 VALUES ('Abilene'),('Akron'),('Albany'),('Albuquerque'),('Alexandria'),('Allentown'),
|
||||
('Amarillo'),('Anaheim'),('Anchorage'),('Ann Arbor'),('Arden-Arcade');
|
||||
EXPLAIN
|
||||
SELECT MAX( alias2.a ) AS field
|
||||
FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
|
||||
WHERE alias1.a = alias2.a OR alias1.a = 'y'
|
||||
HAVING field>'B' AND ( 'Moscow' ) IN ( SELECT a FROM t1 );
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible HAVING
|
||||
2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where
|
||||
SELECT MAX( alias2.a ) AS field
|
||||
FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
|
||||
WHERE alias1.a = alias2.a OR alias1.a = 'y'
|
||||
HAVING field>'B' AND ( 'Moscow' ) IN ( SELECT a FROM t1 );
|
||||
field
|
||||
EXPLAIN
|
||||
SELECT MAX( alias2.a )
|
||||
FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
|
||||
WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 );
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY alias1 index a a 19 NULL 11 Using where; Using index
|
||||
1 PRIMARY alias2 ref a a 19 test.alias1.a 2 Using index
|
||||
1 PRIMARY alias3 index NULL a 19 NULL 11 Using index; Using join buffer (flat, BNL join)
|
||||
2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where
|
||||
SELECT MAX( alias2.a )
|
||||
FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
|
||||
WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 );
|
||||
MAX( alias2.a )
|
||||
Arden-Arcade
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-277 CHEAP SQ: Server crashes in st_join_table::get_examined_rows
|
||||
# with semijoin+materialization, IN and = subqueries
|
||||
#
|
||||
CREATE TABLE t1 (a1 INT);
|
||||
INSERT INTO t1 VALUES (4),(6);
|
||||
CREATE TABLE t2 (b1 INT);
|
||||
INSERT INTO t2 VALUES (1),(7);
|
||||
EXPLAIN
|
||||
SELECT * FROM t1
|
||||
WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
2 SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1
|
||||
3 MATERIALIZED t1 ALL NULL NULL NULL NULL 2
|
||||
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
|
||||
SELECT * FROM t1
|
||||
WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2));
|
||||
a1
|
||||
drop table t1, t2;
|
||||
#
|
||||
# MDEV-287 CHEAP SQ: A query with subquery in SELECT list, EXISTS,
|
||||
# inner joins takes hundreds times longer
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (1),(7);
|
||||
CREATE TABLE t2 (b INT);
|
||||
INSERT INTO t2 VALUES (4),(5);
|
||||
CREATE TABLE t3 (c INT);
|
||||
INSERT INTO t3 VALUES (8),(3);
|
||||
set @@expensive_subquery_limit= 0;
|
||||
EXPLAIN
|
||||
SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
|
||||
FROM t2 alias1, t1 alias2, t1 alias3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
|
||||
1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
|
||||
1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
|
||||
flush status;
|
||||
SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
|
||||
FROM t2 alias1, t1 alias2, t1 alias3;
|
||||
(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
show status like "subquery_cache%";
|
||||
Variable_name Value
|
||||
Subquery_cache_hit 6
|
||||
Subquery_cache_miss 2
|
||||
show status like '%Handler_read%';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
Handler_read_key 8
|
||||
Handler_read_last 0
|
||||
Handler_read_next 0
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_deleted 0
|
||||
Handler_read_rnd_next 22
|
||||
set @@expensive_subquery_limit= default;
|
||||
EXPLAIN
|
||||
SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
|
||||
FROM t2 alias1, t1 alias2, t1 alias3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
|
||||
1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
|
||||
1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
|
||||
flush status;
|
||||
SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
|
||||
FROM t2 alias1, t1 alias2, t1 alias3;
|
||||
(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
show status like "subquery_cache%";
|
||||
Variable_name Value
|
||||
Subquery_cache_hit 0
|
||||
Subquery_cache_miss 0
|
||||
show status like '%Handler_read%';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
Handler_read_key 0
|
||||
Handler_read_last 0
|
||||
Handler_read_next 0
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_deleted 0
|
||||
Handler_read_rnd_next 16
|
||||
drop table t1, t2, t3;
|
||||
#
|
||||
# MDEV-288 CHEAP SQ: Valgrind warnings "Memory lost" with IN and EXISTS nested subquery, materialization+semijoin
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (0),(8);
|
||||
CREATE TABLE t2 (b INT PRIMARY KEY);
|
||||
INSERT INTO t2 VALUES (1),(2);
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1));
|
||||
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 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
3 SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1));
|
||||
a
|
||||
drop table t1,t2;
|
||||
# return optimizer switch changed in the beginning of this test
|
||||
set optimizer_switch=@subselect_tmp;
|
||||
|
@ -1479,7 +1479,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (not(<expr_cache><(select `test`.`t2`.`a` from `test`.`t2` where (`test`.`t2`.`a` = 9))>(<in_optimizer>((select `test`.`t2`.`a` from `test`.`t2` where (`test`.`t2`.`a` = 9)),(select `test`.`t2`.`a` from `test`.`t2` where (`test`.`t2`.`a` = 9)) in ( <materialize> (select `test`.`t3`.`b` from `test`.`t3` ), <primary_index_lookup>(9 in <temporary table> on distinct_key where ((9 = `<subquery3>`.`b`))))))))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1
|
||||
SELECT * FROM t1
|
||||
WHERE (
|
||||
( SELECT a FROM t2 WHERE a = 9 ),
|
||||
|
@ -1489,7 +1489,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (not(<expr_cache><(select `test`.`t2`.`a` from `test`.`t2` where (`test`.`t2`.`a` = 9))>(<in_optimizer>((select `test`.`t2`.`a` from `test`.`t2` where (`test`.`t2`.`a` = 9)),(select `test`.`t2`.`a` from `test`.`t2` where (`test`.`t2`.`a` = 9)) in ( <materialize> (select `test`.`t3`.`b` from `test`.`t3` ), <primary_index_lookup>(9 in <temporary table> on distinct_key where ((9 = `<subquery3>`.`b`))))))))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1
|
||||
SELECT * FROM t1
|
||||
WHERE (
|
||||
( SELECT a FROM t2 WHERE a = 9 ),
|
||||
|
@ -226,10 +226,10 @@ NULL
|
||||
EXPLAIN EXTENDED SELECT (SELECT 1 FROM t2 WHERE d = c) AS RESULT FROM t1 ;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.c' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select <expr_cache><>((select 1 from `test`.`t2` where 0)) AS `RESULT` from dual
|
||||
Note 1003 select (select 1 from `test`.`t2` where 0) AS `RESULT` from dual
|
||||
first equivalent variant
|
||||
SELECT (SELECT 1 FROM t2 WHERE d = IFNULL(c,NULL)) AS RESULT FROM t1 GROUP BY c ;
|
||||
RESULT
|
||||
@ -237,10 +237,10 @@ NULL
|
||||
EXPLAIN EXTENDED SELECT (SELECT 1 FROM t2 WHERE d = IFNULL(c,NULL)) AS RESULT FROM t1 GROUP BY c;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.c' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select <expr_cache><>((select 1 from `test`.`t2` where 0)) AS `RESULT` from dual group by NULL
|
||||
Note 1003 select (select 1 from `test`.`t2` where 0) AS `RESULT` from dual group by NULL
|
||||
second equivalent variant
|
||||
SELECT (SELECT 1 FROM t2 WHERE d = c) AS RESULT FROM t1 GROUP BY c ;
|
||||
RESULT
|
||||
@ -248,10 +248,10 @@ NULL
|
||||
EXPLAIN EXTENDED SELECT (SELECT 1 FROM t2 WHERE d = c) AS RESULT FROM t1 GROUP BY c ;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.c' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select <expr_cache><>((select 1 from `test`.`t2` where 0)) AS `RESULT` from dual group by NULL
|
||||
Note 1003 select (select 1 from `test`.`t2` where 0) AS `RESULT` from dual group by NULL
|
||||
DROP TABLE t1,t2;
|
||||
#
|
||||
# BUG#45928 "Differing query results depending on MRR and
|
||||
@ -562,7 +562,7 @@ WHERE f3 = (
|
||||
SELECT t1.f3 FROM t1
|
||||
WHERE ( t1.f10 ) IN ( SELECT f11 FROM t2 GROUP BY f11 ));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ref f3 f3 5 const 0 Using where
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
2 SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1
|
||||
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2
|
||||
@ -577,7 +577,7 @@ WHERE f3 = (
|
||||
SELECT f3 FROM t1
|
||||
WHERE ( f10, f10 ) IN ( SELECT f11, f11 FROM t2 GROUP BY f11 ));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ref f3 f3 5 const 0 Using where
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
2 SUBQUERY <subquery3> eq_ref distinct_key distinct_key 8 func,func 1
|
||||
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2
|
||||
@ -649,7 +649,7 @@ EXPLAIN
|
||||
SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2) as not_in;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2) as not_in;
|
||||
not_in
|
||||
NULL
|
||||
@ -671,7 +671,7 @@ EXPLAIN
|
||||
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2) as not_in;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2) as not_in;
|
||||
not_in
|
||||
NULL
|
||||
@ -679,7 +679,7 @@ EXPLAIN
|
||||
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) > 7) as not_in;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) > 7) as not_in;
|
||||
not_in
|
||||
1
|
||||
@ -687,7 +687,7 @@ EXPLAIN
|
||||
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) is null) as not_in;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) is null) as not_in;
|
||||
not_in
|
||||
NULL
|
||||
@ -695,7 +695,7 @@ EXPLAIN
|
||||
SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2) as not_in;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2) as not_in;
|
||||
not_in
|
||||
NULL
|
||||
@ -703,7 +703,7 @@ EXPLAIN
|
||||
SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2) as not_in;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2) as not_in;
|
||||
not_in
|
||||
NULL
|
||||
@ -719,28 +719,28 @@ EXPLAIN
|
||||
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4) FROM t2);
|
||||
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 t2 system NULL NULL NULL NULL 0 const row not found
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4) FROM t2);
|
||||
f1 f2
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2);
|
||||
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 t2 system NULL NULL NULL NULL 0 const row not found
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2);
|
||||
f1 f2
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2);
|
||||
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 t2 system NULL NULL NULL NULL 0 const row not found
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2);
|
||||
f1 f2
|
||||
EXPLAIN
|
||||
SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2) as not_in;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2) as not_in;
|
||||
not_in
|
||||
NULL
|
||||
@ -748,21 +748,21 @@ EXPLAIN
|
||||
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2);
|
||||
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 t2 system NULL NULL NULL NULL 0 const row not found
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2);
|
||||
f1 f2
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2);
|
||||
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 t2 system NULL NULL NULL NULL 0 const row not found
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2);
|
||||
f1 f2
|
||||
EXPLAIN
|
||||
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2) as not_in;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2) as not_in;
|
||||
not_in
|
||||
NULL
|
||||
@ -770,7 +770,7 @@ EXPLAIN
|
||||
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) > 7) as not_in;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) > 7) as not_in;
|
||||
not_in
|
||||
1
|
||||
@ -778,7 +778,7 @@ EXPLAIN
|
||||
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) is null) as not_in;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) is null) as not_in;
|
||||
not_in
|
||||
NULL
|
||||
@ -786,7 +786,7 @@ EXPLAIN
|
||||
SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2) as not_in;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2) as not_in;
|
||||
not_in
|
||||
NULL
|
||||
@ -794,7 +794,7 @@ EXPLAIN
|
||||
SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2) as not_in;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2) as not_in;
|
||||
not_in
|
||||
NULL
|
||||
@ -835,7 +835,7 @@ EXPLAIN
|
||||
SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2 WHERE f3 > 10) as not_in;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2 WHERE f3 > 10) as not_in;
|
||||
not_in
|
||||
NULL
|
||||
@ -857,7 +857,7 @@ EXPLAIN
|
||||
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10) as not_in;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10) as not_in;
|
||||
not_in
|
||||
NULL
|
||||
@ -865,7 +865,7 @@ EXPLAIN
|
||||
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) > 7) as not_in;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) > 7) as not_in;
|
||||
not_in
|
||||
1
|
||||
@ -873,7 +873,7 @@ EXPLAIN
|
||||
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) is null) as not_in;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) is null) as not_in;
|
||||
not_in
|
||||
NULL
|
||||
@ -881,7 +881,7 @@ EXPLAIN
|
||||
SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2 WHERE f3 > 10) as not_in;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2 WHERE f3 > 10) as not_in;
|
||||
not_in
|
||||
NULL
|
||||
@ -889,7 +889,7 @@ EXPLAIN
|
||||
SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2 WHERE f3 > 10) as not_in;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2 WHERE f3 > 10) as not_in;
|
||||
not_in
|
||||
NULL
|
||||
@ -905,28 +905,28 @@ EXPLAIN
|
||||
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4) FROM t2 WHERE f3 > 10);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
||||
2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4) FROM t2 WHERE f3 > 10);
|
||||
f1 f2
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2 WHERE f3 > 10);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
||||
2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2 WHERE f3 > 10);
|
||||
f1 f2
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2 WHERE f3 > 10);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
||||
2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2 WHERE f3 > 10);
|
||||
f1 f2
|
||||
EXPLAIN
|
||||
SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2 WHERE f3 > 10) as not_in;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2 WHERE f3 > 10) as not_in;
|
||||
not_in
|
||||
NULL
|
||||
@ -934,21 +934,21 @@ EXPLAIN
|
||||
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
||||
2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10);
|
||||
f1 f2
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2 WHERE f3 > 10);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
||||
2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2 WHERE f3 > 10);
|
||||
f1 f2
|
||||
EXPLAIN
|
||||
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10) as not_in;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10) as not_in;
|
||||
not_in
|
||||
NULL
|
||||
@ -956,7 +956,7 @@ EXPLAIN
|
||||
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) > 7) as not_in;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) > 7) as not_in;
|
||||
not_in
|
||||
1
|
||||
@ -964,7 +964,7 @@ EXPLAIN
|
||||
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) is null) as not_in;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) is null) as not_in;
|
||||
not_in
|
||||
NULL
|
||||
@ -972,7 +972,7 @@ EXPLAIN
|
||||
SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2 WHERE f3 > 10) as not_in;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2 WHERE f3 > 10) as not_in;
|
||||
not_in
|
||||
NULL
|
||||
@ -980,7 +980,7 @@ EXPLAIN
|
||||
SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2 WHERE f3 > 10) as not_in;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan
|
||||
SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2 WHERE f3 > 10) as not_in;
|
||||
not_in
|
||||
NULL
|
||||
@ -1220,6 +1220,13 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
|
||||
3 SUBQUERY SQ1_t1 index NULL f4 5 NULL 2 Using index; Using temporary
|
||||
3 SUBQUERY SQ1_t3 index f4 f4 5 NULL 2 Using where; Using index; Using join buffer (flat, BNL join)
|
||||
SELECT * FROM t1 WHERE
|
||||
(SELECT f2 FROM t2
|
||||
WHERE f4 <= ALL
|
||||
(SELECT max(SQ1_t1.f4)
|
||||
FROM t3 AS SQ1_t1 JOIN t3 AS SQ1_t3 ON SQ1_t3.f4
|
||||
GROUP BY SQ1_t1.f4));
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
drop table t1, t2, t3;
|
||||
#
|
||||
# BUG#52317: Assertion failing in Field_varstring::store()
|
||||
@ -1233,7 +1240,7 @@ EXPLAIN
|
||||
SELECT i FROM t1 WHERE (1) NOT IN (SELECT i FROM t2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 1
|
||||
2 DEPENDENT SUBQUERY t2 index_subquery k k 5 const 2 Using index
|
||||
2 SUBQUERY t2 index_subquery k k 5 const 2 Using index
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
@ -1250,10 +1257,9 @@ FROM t2 JOIN t1 ON t1.f3
|
||||
WHERE ('v') IN (SELECT f4 FROM t2)
|
||||
GROUP BY f9;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 system NULL NULL NULL NULL 1
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
SELECT COUNT(t2.f3),
|
||||
(SELECT COUNT(f3) FROM t1 WHERE t2.f1) AS f9
|
||||
FROM t2 JOIN t1 ON t1.f3
|
||||
@ -1267,17 +1273,16 @@ FROM t2 JOIN t1 ON t1.f3
|
||||
WHERE ('v') IN (SELECT f4 FROM t2)
|
||||
ORDER BY f9;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 system NULL NULL NULL NULL 1
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
SELECT COUNT(t2.f3),
|
||||
(SELECT COUNT(f3) FROM t1 WHERE t2.f1) AS f9
|
||||
FROM t2 JOIN t1 ON t1.f3
|
||||
WHERE ('v') IN (SELECT f4 FROM t2)
|
||||
ORDER BY f9;
|
||||
COUNT(t2.f3) f9
|
||||
0 2
|
||||
0 NULL
|
||||
EXPLAIN
|
||||
SELECT COUNT(t2.f3),
|
||||
(SELECT t2.f1 FROM t1 limit 1) AS f9
|
||||
@ -1285,9 +1290,8 @@ FROM t2 JOIN t1
|
||||
WHERE ('v') IN (SELECT f4 FROM t2)
|
||||
GROUP BY f9;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 system NULL NULL NULL NULL 1
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
||||
3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
SELECT COUNT(t2.f3),
|
||||
(SELECT t2.f1 FROM t1 limit 1) AS f9
|
||||
@ -1302,9 +1306,8 @@ FROM t2 JOIN t1
|
||||
WHERE ('v') IN (SELECT f4 FROM t2)
|
||||
ORDER BY f9;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 system NULL NULL NULL NULL 1
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
||||
3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
SELECT COUNT(t2.f3),
|
||||
(SELECT t2.f1 FROM t1 limit 1) AS f9
|
||||
@ -1325,7 +1328,7 @@ EXPLAIN
|
||||
SELECT (SELECT f1 FROM t1) AS field1 FROM t2 GROUP BY field1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2
|
||||
2 SUBQUERY t1 system NULL NULL NULL NULL 0 const row not found
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
SELECT (SELECT f1 FROM t1) AS field1 FROM t2 GROUP BY field1;
|
||||
field1
|
||||
NULL
|
||||
@ -1333,7 +1336,7 @@ EXPLAIN
|
||||
SELECT (SELECT f1 FROM t1) AS field1 FROM t2 ORDER BY field1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2
|
||||
2 SUBQUERY t1 system NULL NULL NULL NULL 0 const row not found
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
SELECT (SELECT f1 FROM t1) AS field1 FROM t2 ORDER BY field1;
|
||||
field1
|
||||
NULL
|
||||
@ -1387,7 +1390,7 @@ EXPLAIN
|
||||
SELECT 'bug' FROM DUAL WHERE ( 5 ) IN ( SELECT * FROM v1 );
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 Using where
|
||||
2 SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 Using where
|
||||
3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
4 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL
|
||||
@ -1397,7 +1400,7 @@ EXPLAIN
|
||||
SELECT ( 5 ) IN ( SELECT * FROM v1 );
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 Using where
|
||||
2 SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 Using where
|
||||
3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
4 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL
|
||||
@ -1408,7 +1411,7 @@ EXPLAIN
|
||||
SELECT 'bug' FROM DUAL WHERE ( 5 ) IN (SELECT * FROM v2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 Using where
|
||||
2 SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 Using where
|
||||
3 DERIVED t1 system NULL NULL NULL NULL 1
|
||||
4 UNION t2 system NULL NULL NULL NULL 1
|
||||
NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL
|
||||
@ -1428,7 +1431,7 @@ EXPLAIN
|
||||
SELECT ( 5 ) IN ( SELECT * FROM v2 );
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 Using where
|
||||
2 SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 Using where
|
||||
3 DERIVED t1 system NULL NULL NULL NULL 1
|
||||
4 UNION t2 system NULL NULL NULL NULL 1
|
||||
NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL
|
||||
@ -1440,7 +1443,7 @@ EXPLAIN
|
||||
SELECT 'bug' FROM DUAL WHERE ( 5 ) IN ( SELECT * FROM v1 );
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 Using where
|
||||
2 SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 Using where
|
||||
3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
4 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL
|
||||
@ -1450,7 +1453,7 @@ EXPLAIN
|
||||
SELECT ( 5 ) IN ( SELECT * FROM v1 );
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 Using where
|
||||
2 SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 Using where
|
||||
3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
4 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL
|
||||
@ -1461,7 +1464,7 @@ EXPLAIN
|
||||
SELECT 'bug' FROM DUAL WHERE ( 5 ) IN (SELECT * FROM v2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 Using where
|
||||
2 SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 Using where
|
||||
3 DERIVED t1 system NULL NULL NULL NULL 1
|
||||
4 UNION t2 system NULL NULL NULL NULL 1
|
||||
NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL
|
||||
@ -1471,7 +1474,7 @@ EXPLAIN
|
||||
SELECT 'bug' FROM t3 WHERE ( 5 ) IN (SELECT * FROM v2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t3 system NULL NULL NULL NULL 1
|
||||
2 DEPENDENT SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 Using where
|
||||
2 SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 Using where
|
||||
3 DERIVED t1 system NULL NULL NULL NULL 1
|
||||
4 UNION t2 system NULL NULL NULL NULL 1
|
||||
NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL
|
||||
@ -1481,7 +1484,7 @@ EXPLAIN
|
||||
SELECT ( 5 ) IN ( SELECT * FROM v2 );
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 Using where
|
||||
2 SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 Using where
|
||||
3 DERIVED t1 system NULL NULL NULL NULL 1
|
||||
4 UNION t2 system NULL NULL NULL NULL 1
|
||||
NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL
|
||||
@ -1631,9 +1634,9 @@ SET SESSION optimizer_switch='in_to_exists=on,materialization=off';
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE ( 6 ) NOT IN ( SELECT t2.f3 FROM t2 JOIN t3 ON t3.f10 = t2.f10);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
||||
2 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 1
|
||||
2 DEPENDENT SUBQUERY t2 ref_or_null f10 f10 10 const,const 2 Using where; Using index
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY t3 system NULL NULL NULL NULL 1
|
||||
2 SUBQUERY t2 ref_or_null f10 f10 10 const,const 2 Using where; Using index
|
||||
SELECT * FROM t1 WHERE ( 6 ) NOT IN ( SELECT t2.f3 FROM t2 JOIN t3 ON t3.f10 = t2.f10);
|
||||
f4
|
||||
drop table t1,t2,t3;
|
||||
@ -1852,8 +1855,8 @@ GROUP BY 1, 2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t3 system NULL NULL NULL NULL 1 Using temporary; Using filesort
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
3 MATERIALIZED t1 system NULL NULL NULL NULL 0 const row not found
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
3 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
PREPARE st1 FROM "
|
||||
SELECT t2.f1, (SELECT f2 FROM t1 WHERE (7) IN (SELECT f1 FROM t1))
|
||||
FROM t2 JOIN t3 ON t3.f4 = t2.f4
|
||||
@ -2014,6 +2017,76 @@ ERROR 21000: Subquery returns more than 1 row
|
||||
DROP TABLE t2;
|
||||
ERROR 42S02: Unknown table 't2'
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# LP BUG#1000649 EXPLAIN shows incorrectly a non-correlated constant IN subquery is correlated
|
||||
#
|
||||
create table ten (a int);
|
||||
insert into ten values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
create table t1 (a int, b int, c int);
|
||||
insert into t1 select a,a,a from ten;
|
||||
create table five (a int, b int, c int);
|
||||
insert into five select a,a,a from ten limit 5;
|
||||
set @@optimizer_switch='semijoin=on,in_to_exists=on,materialization=off';
|
||||
explain select * from t1 where 33 in (select b from five) or c > 11;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using where
|
||||
2 SUBQUERY five ALL NULL NULL NULL NULL 5 Using where
|
||||
drop table ten, t1, five;
|
||||
#
|
||||
# LP BUG#1008773 Wrong result (NULL instead of a value) with no matching rows, subquery in FROM and HAVING
|
||||
#
|
||||
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
|
||||
CREATE TABLE t2 (b INT) ENGINE=MyISAM;
|
||||
INSERT INTO t2 VALUES (1);
|
||||
EXPLAIN
|
||||
SELECT MAX(a), ( SELECT 1 FROM t2 ) AS bb FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 1
|
||||
SELECT MAX(a), ( SELECT 1 FROM t2 ) AS bb FROM t1;
|
||||
MAX(a) bb
|
||||
NULL 1
|
||||
EXPLAIN
|
||||
SELECT MAX(a), 1 in ( SELECT b FROM t2 ) AS bb FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 1
|
||||
SELECT MAX(a), 1 in ( SELECT b FROM t2 ) AS bb FROM t1;
|
||||
MAX(a) bb
|
||||
NULL 1
|
||||
EXPLAIN
|
||||
SELECT MAX(a), 1 >= ALL ( SELECT b FROM t2 ) AS bb FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
SELECT MAX(a), 1 >= ALL ( SELECT b FROM t2 ) AS bb FROM t1;
|
||||
MAX(a) bb
|
||||
NULL 1
|
||||
EXPLAIN
|
||||
SELECT MAX(a), ( SELECT 1 FROM t2 where b = a) AS bb FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
SELECT MAX(a), ( SELECT 1 FROM t2 where b = a) AS bb FROM t1;
|
||||
MAX(a) bb
|
||||
NULL NULL
|
||||
EXPLAIN
|
||||
SELECT MAX(a), a in ( SELECT b FROM t2 ) AS bb FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
|
||||
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1
|
||||
SELECT MAX(a), a in ( SELECT b FROM t2 ) AS bb FROM t1;
|
||||
MAX(a) bb
|
||||
NULL NULL
|
||||
EXPLAIN
|
||||
SELECT MAX(a), a >= ALL ( SELECT b FROM t2 ) AS bb FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
|
||||
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1
|
||||
SELECT MAX(a), a >= ALL ( SELECT b FROM t2 ) AS bb FROM t1;
|
||||
MAX(a) bb
|
||||
NULL NULL
|
||||
drop table t1, t2;
|
||||
set optimizer_switch=@subselect4_tmp;
|
||||
SET optimizer_switch= @@global.optimizer_switch;
|
||||
set @@tmp_table_size= @@global.tmp_table_size;
|
||||
|
@ -486,9 +486,9 @@ Handler_read_key 7
|
||||
Handler_read_last 0
|
||||
Handler_read_next 0
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 10
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_deleted 0
|
||||
Handler_read_rnd_next 42
|
||||
Handler_read_rnd_next 31
|
||||
set optimizer_switch='subquery_cache=off';
|
||||
flush status;
|
||||
select a from t1 ORDER BY (select d from t2 where b=c);
|
||||
@ -514,9 +514,9 @@ Handler_read_key 0
|
||||
Handler_read_last 0
|
||||
Handler_read_next 0
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 10
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_deleted 0
|
||||
Handler_read_rnd_next 72
|
||||
Handler_read_rnd_next 61
|
||||
set optimizer_switch='subquery_cache=on';
|
||||
#single value subquery test (distinct ORDER BY)
|
||||
flush status;
|
||||
|
@ -46,7 +46,7 @@ select * from t1
|
||||
where id in (select id from t1 as x1 where (t1.cur_date is null));
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.cur_date' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select 1 AS `id`,'2007-04-25 18:30:22' AS `cur_date` from dual where <expr_cache><1>(<in_optimizer>(1,<exists>(select `test`.`x1`.`id` from `test`.`t1` `x1` where 0)))
|
||||
@ -58,7 +58,7 @@ select * from t2
|
||||
where id in (select id from t2 as x1 where (t2.cur_date is null));
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t2 system NULL NULL NULL NULL 1 100.00
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t2.cur_date' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select 1 AS `id`,'2007-04-25' AS `cur_date` from dual where <expr_cache><1>(<in_optimizer>(1,<exists>(select `test`.`x1`.`id` from `test`.`t2` `x1` where 0)))
|
||||
|
@ -332,8 +332,8 @@ FROM t2
|
||||
WHERE (SELECT DISTINCT b FROM t3) > 0);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1 Using where; Using index
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 1
|
||||
3 SUBQUERY t3 ALL NULL NULL NULL NULL 1 Using temporary
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
3 SUBQUERY internal_tmp_table ALL group_key NULL NULL NULL 0 Using temporary
|
||||
SELECT *
|
||||
FROM t1
|
||||
WHERE t1.a = (
|
||||
@ -361,7 +361,7 @@ GROUP BY 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 noticed after reading const tables
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 1
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
3 SUBQUERY t3 ALL NULL NULL NULL NULL 1
|
||||
SELECT MAX( f1 ) FROM t2
|
||||
WHERE f2 >= (
|
||||
@ -376,4 +376,19 @@ GROUP BY 1
|
||||
MAX( f1 )
|
||||
NULL
|
||||
drop table t1, t2, t3;
|
||||
#
|
||||
# LP BUG#1006231 crash in select_describe
|
||||
#
|
||||
create table t1(a1 int) ENGINE=InnoDB;
|
||||
insert into t1 values (1);
|
||||
explain
|
||||
select 1 from t1 where 1 like (select 1 from t1 where 1 <=> (select 1 from t1 group by a1));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 1
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 1
|
||||
3 SUBQUERY internal_tmp_table ALL group_key NULL NULL NULL 1 Using temporary; Using filesort
|
||||
select 1 from t1 where 1 like (select 1 from t1 where 1 <=> (select 1 from t1 group by a1));
|
||||
1
|
||||
1
|
||||
drop table t1;
|
||||
set optimizer_switch=@subselect_innodb_tmp;
|
||||
|
@ -1152,8 +1152,8 @@ create table t2 (b1 int);
|
||||
insert into t1 values (5);
|
||||
explain select min(a1) from t1 where 7 in (select max(b1) from t2 group by b1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 1
|
||||
2 MATERIALIZED t2 system NULL NULL NULL NULL 0 const row not found
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
select min(a1) from t1 where 7 in (select max(b1) from t2 group by b1);
|
||||
min(a1)
|
||||
NULL
|
||||
@ -1162,8 +1162,8 @@ set @@optimizer_switch=@optimizer_switch_local_default;
|
||||
set @@optimizer_switch='materialization=off,in_to_exists=on';
|
||||
explain select min(a1) from t1 where 7 in (select max(b1) from t2 group by b1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 1
|
||||
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
select min(a1) from t1 where 7 in (select max(b1) from t2 group by b1);
|
||||
min(a1)
|
||||
NULL
|
||||
@ -1171,8 +1171,8 @@ set @@optimizer_switch=@optimizer_switch_local_default;
|
||||
set @@optimizer_switch='semijoin=off';
|
||||
explain select min(a1) from t1 where 7 in (select b1 from t2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 1
|
||||
2 MATERIALIZED t2 system NULL NULL NULL NULL 0 const row not found
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
select min(a1) from t1 where 7 in (select b1 from t2);
|
||||
min(a1)
|
||||
NULL
|
||||
@ -1181,16 +1181,16 @@ set @@optimizer_switch='materialization=off,in_to_exists=on';
|
||||
# with MariaDB and MWL#90, this particular case is solved:
|
||||
explain select min(a1) from t1 where 7 in (select b1 from t2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 1
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
select min(a1) from t1 where 7 in (select b1 from t2);
|
||||
min(a1)
|
||||
NULL
|
||||
# but when we go around MWL#90 code, the problem still shows up:
|
||||
explain select min(a1) from t1 where 7 in (select b1 from t2) or 2> 4;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 1
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
select min(a1) from t1 where 7 in (select b1 from t2) or 2> 4;
|
||||
min(a1)
|
||||
NULL
|
||||
@ -1932,7 +1932,7 @@ WHERE s2.d = s1.e AND s1.e = (SELECT MAX(e) FROM t2));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 1
|
||||
1 PRIMARY t2 index NULL c 5 NULL 8 Using where; Using index
|
||||
2 MATERIALIZED s2 ref d d 4 const 1 Using where; Using index
|
||||
2 MATERIALIZED s2 ref d d 4 const 2 Using where; Using index
|
||||
2 MATERIALIZED s1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
|
||||
3 SUBQUERY t2 ALL NULL NULL NULL NULL 8
|
||||
SELECT a, c FROM t1, t2
|
||||
@ -1951,8 +1951,8 @@ WHERE s2.d = s1.e AND s1.e = (SELECT MAX(e) FROM t2));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 1
|
||||
1 PRIMARY t2 index NULL c 5 NULL 8 Using where; Using index
|
||||
2 MATERIALIZED s2 ref d d 4 const 1 Using where; Using index
|
||||
2 MATERIALIZED s1 hash_ALL NULL #hash#$hj 5 test.s2.d 8 Using where; Using join buffer (flat, BNLH join)
|
||||
2 MATERIALIZED s2 ref d d 4 const 2 Using where; Using index
|
||||
2 MATERIALIZED s1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
|
||||
3 SUBQUERY t2 ALL NULL NULL NULL NULL 8
|
||||
SELECT a, c FROM t1, t2
|
||||
WHERE (a, c) IN (SELECT s1.b, s1.c FROM t2 AS s1, t2 AS s2
|
||||
@ -2166,7 +2166,7 @@ set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_
|
||||
EXPLAIN
|
||||
SELECT * FROM t2 WHERE (SELECT f3a FROM t3) NOT IN (SELECT f1a FROM t1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
3 MATERIALIZED t1 ALL NULL NULL NULL NULL 2
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
SELECT * FROM t2 WHERE (SELECT f3a FROM t3) NOT IN (SELECT f1a FROM t1);
|
||||
@ -2175,7 +2175,7 @@ EXPLAIN
|
||||
SELECT (SELECT f3a FROM t3) NOT IN (SELECT f1a FROM t1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
3 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
SELECT (SELECT f3a FROM t3) NOT IN (SELECT f1a FROM t1);
|
||||
(SELECT f3a FROM t3) NOT IN (SELECT f1a FROM t1)
|
||||
@ -2192,7 +2192,7 @@ EXPLAIN
|
||||
SELECT (SELECT f3a, f3b FROM t3) NOT IN (SELECT f1a, f1b FROM t1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
3 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
SELECT (SELECT f3a, f3b FROM t3) NOT IN (SELECT f1a, f1b FROM t1);
|
||||
(SELECT f3a, f3b FROM t3) NOT IN (SELECT f1a, f1b FROM t1)
|
||||
@ -2235,10 +2235,10 @@ NULL
|
||||
EXPLAIN EXTENDED
|
||||
SELECT MAX(t1.b) AS max_res FROM t1 WHERE (9) IN (SELECT a FROM t2);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 index NULL b 5 NULL 2 100.00 Using index
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00
|
||||
Warnings:
|
||||
Note 1003 select max(`test`.`t1`.`b`) AS `max_res` from `test`.`t1` where <expr_cache><9>(<in_optimizer>(9,9 in ( <materialize> (select `test`.`t2`.`a` from `test`.`t2` ), <primary_index_lookup>(9 in <temporary table> on distinct_key where ((9 = `<subquery2>`.`a`))))))
|
||||
Note 1003 select max(`test`.`t1`.`b`) AS `max_res` from `test`.`t1` where 0
|
||||
set @@optimizer_switch='materialization=off,in_to_exists=on,semijoin=off';
|
||||
SELECT MAX(t1.b) AS max_res FROM t1 WHERE (9) IN (SELECT a FROM t2);
|
||||
max_res
|
||||
@ -2246,10 +2246,10 @@ NULL
|
||||
EXPLAIN EXTENDED
|
||||
SELECT MAX(t1.b) AS max_res FROM t1 WHERE (9) IN (SELECT a FROM t2);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 index NULL b 5 NULL 2 100.00 Using index
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select max(`test`.`t1`.`b`) AS `max_res` from `test`.`t1` where <expr_cache><9>(<in_optimizer>(9,<exists>(select `test`.`t2`.`a` from `test`.`t2` where (9 = `test`.`t2`.`a`))))
|
||||
Note 1003 select max(`test`.`t1`.`b`) AS `max_res` from `test`.`t1` where 0
|
||||
DROP TABLE t1,t2;
|
||||
#
|
||||
# LPBUG#825095: Wrong result with materialization and NOT IN with 2 expressions
|
||||
|
@ -496,7 +496,7 @@ from City
|
||||
where City.population > 10000000;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY City range Population Population 5 NULL 4 Using index condition; Rowid-ordered scan
|
||||
2 DEPENDENT SUBQUERY Country index_subquery CountryCapital CountryCapital 5 func 2 Using index; Using where
|
||||
2 SUBQUERY Country index_subquery CountryCapital CountryCapital 5 func 2 Using index; Using where
|
||||
select Name, City.id in (select capital from Country where capital is not null) as is_capital
|
||||
from City
|
||||
where City.population > 10000000;
|
||||
|
@ -124,7 +124,7 @@ FROM t3 RIGHT JOIN t1 ON t1.pk = t3.f1
|
||||
WHERE t3.f3 OR ( 3 ) IN ( SELECT f2 FROM t2 );
|
||||
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 NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
SELECT t1.*
|
||||
FROM t3 RIGHT JOIN t1 ON t1.pk = t3.f1
|
||||
WHERE t3.f3 OR ( 3 ) IN ( SELECT f2 FROM t2 );
|
||||
@ -148,7 +148,7 @@ FROM t2 GROUP BY f1
|
||||
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 SUBQUERY t1 system NULL NULL NULL NULL 1
|
||||
3 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
|
||||
3 SUBQUERY internal_tmp_table ALL group_key NULL NULL NULL 1 Using temporary; Using filesort
|
||||
drop table t1, t2, t3;
|
||||
#
|
||||
# LP BUG#715034 Item_sum_distinct::clear(): Assertion `tree != 0' failed
|
||||
@ -209,8 +209,8 @@ WHERE t1.f1 AND alias2.f10
|
||||
ORDER BY field1 ;
|
||||
field1
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: 'f'
|
||||
Warning 1292 Truncated incorrect INTEGER value: 'd'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'f'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'd'
|
||||
set optimizer_switch=@tmp_optimizer_switch;
|
||||
drop table t1,t2;
|
||||
#
|
||||
|
@ -58,12 +58,12 @@ ERROR 42S22: Reference 'a' not supported (forward reference in item list)
|
||||
EXPLAIN EXTENDED SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 1 100.00
|
||||
3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select 1 AS `1` from dual having (<expr_cache><1>((select 1)) = 1)
|
||||
Note 1003 select 1 AS `1` from dual having ((select 1) = 1)
|
||||
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
|
||||
1
|
||||
1
|
||||
@ -378,12 +378,12 @@ INSERT INTO t8 (pseudo,email) VALUES ('joce1','test1');
|
||||
INSERT INTO t8 (pseudo,email) VALUES ('2joce1','2test1');
|
||||
EXPLAIN EXTENDED SELECT pseudo,(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce')) FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using where; Using index
|
||||
1 PRIMARY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
|
||||
4 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
|
||||
2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using where
|
||||
2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00
|
||||
3 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t8`.`pseudo` AS `pseudo`,(select `test`.`t8`.`email` from `test`.`t8` where (`test`.`t8`.`pseudo` = (select 'joce' from `test`.`t8` where 1))) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where (`test`.`t8`.`pseudo` = (select 'joce' from `test`.`t8` where 1))
|
||||
Note 1003 select 'joce' AS `pseudo`,(select 'test' from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
|
||||
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
|
||||
t8 WHERE pseudo='joce');
|
||||
ERROR 21000: Operand should contain 1 column(s)
|
||||
@ -524,6 +524,7 @@ ERROR 21000: Subquery returns more than 1 row
|
||||
show warnings;
|
||||
Level Code Message
|
||||
Error 1242 Subquery returns more than 1 row
|
||||
Error 1028 Sort aborted: Subquery returns more than 1 row
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1),(2),(3);
|
||||
@ -554,11 +555,7 @@ SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT
|
||||
numreponse (SELECT numeropost FROM t1 HAVING numreponse=1)
|
||||
INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
|
||||
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using where; Using index
|
||||
2 SUBQUERY t1 ref PRIMARY PRIMARY 3 const 2 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`numreponse` AS `numreponse` from `test`.`t1` where ((`test`.`t1`.`numeropost` = '1') and (`test`.`t1`.`numreponse` = (select 1 from `test`.`t1` where (`test`.`t1`.`numeropost` = '1'))))
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
|
||||
@ -914,7 +911,7 @@ a t1.a in (select t2.a from t2)
|
||||
explain extended SELECT t1.a, t1.a in (select t2.a from t2) FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
|
||||
2 DEPENDENT SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index
|
||||
2 SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t2 on a checking NULL having <is_not_null_test>(`test`.`t2`.`a`))))) AS `t1.a in (select t2.a from t2)` from `test`.`t1`
|
||||
CREATE TABLE t3 (a int(11) default '0');
|
||||
@ -1327,7 +1324,7 @@ SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
Warnings:
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 from dual where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
INSERT INTO t1 (pseudo) VALUES ('test1');
|
||||
@ -1337,7 +1334,7 @@ SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
Warnings:
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
drop table t1;
|
||||
@ -1615,25 +1612,25 @@ a3 1
|
||||
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2) from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
|
||||
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
|
||||
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1`
|
||||
explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
|
||||
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
|
||||
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`s1` AS `s1`,<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1`
|
||||
explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
|
||||
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
|
||||
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1`
|
||||
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
|
||||
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key
|
||||
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where (`test`.`t2`.`s1` < 'a2') having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
|
||||
drop table t1,t2;
|
||||
@ -1682,34 +1679,34 @@ select * from t3 where NULL >= any (select b from t2);
|
||||
a
|
||||
explain extended select * from t3 where NULL >= any (select b from t2);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
|
||||
select * from t3 where NULL >= any (select b from t2 group by 1);
|
||||
a
|
||||
explain extended select * from t3 where NULL >= any (select b from t2 group by 1);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
|
||||
select * from t3 where NULL >= some (select b from t2);
|
||||
a
|
||||
explain extended select * from t3 where NULL >= some (select b from t2);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
|
||||
select * from t3 where NULL >= some (select b from t2 group by 1);
|
||||
a
|
||||
explain extended select * from t3 where NULL >= some (select b from t2 group by 1);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
|
||||
insert into t2 values (2,2), (2,1), (3,3), (3,1);
|
||||
select * from t3 where a > all (select max(b) from t2 group by a);
|
||||
a
|
||||
@ -1771,7 +1768,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 UNION t1 system NULL NULL NULL NULL 1 100.00
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1003 select 'e' AS `s1` from dual where <nop>(<in_optimizer>('f',(<min>(select 'e' from dual union select 'e' from dual) < 'f')))
|
||||
Note 1003 select 'e' AS `s1` from dual where 1
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (number char(11) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1;
|
||||
INSERT INTO t1 VALUES ('69294728265'),('18621828126'),('89356874041'),('95895001874');
|
||||
@ -3105,8 +3102,8 @@ ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
|
||||
ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
|
||||
1 PRIMARY r eq_ref PRIMARY PRIMARY 4 const 1 Using where
|
||||
2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using index condition
|
||||
1 PRIMARY r const PRIMARY PRIMARY 4 const 1
|
||||
2 SUBQUERY t2 range b b 40 NULL 2 Using where
|
||||
SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
|
||||
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
|
||||
ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
|
||||
@ -3117,8 +3114,8 @@ ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
|
||||
ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
|
||||
1 PRIMARY r eq_ref PRIMARY PRIMARY 4 const 1 Using where
|
||||
2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using index condition
|
||||
1 PRIMARY r const PRIMARY PRIMARY 4 const 1
|
||||
2 SUBQUERY t2 range b b 40 NULL 2 Using index condition
|
||||
SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
|
||||
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
|
||||
ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
|
||||
@ -3169,7 +3166,7 @@ INSERT INTO t2 VALUES (1),(2),(3);
|
||||
EXPLAIN SELECT a, a IN (SELECT a FROM t1) FROM t2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 3
|
||||
2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 2 Using index; Full scan on NULL key
|
||||
2 SUBQUERY t1 index_subquery a a 5 func 2 Using index; Full scan on NULL key
|
||||
SELECT a, a IN (SELECT a FROM t1) FROM t2;
|
||||
a a IN (SELECT a FROM t1)
|
||||
1 1
|
||||
@ -3703,7 +3700,7 @@ ORDER BY t1.t DESC LIMIT 1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 system NULL NULL NULL NULL 1
|
||||
1 PRIMARY t1 index NULL PRIMARY 16 NULL 11 Using where; Using index
|
||||
2 DEPENDENT SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index
|
||||
2 SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index
|
||||
SELECT * FROM t1,t2
|
||||
WHERE t1.t = (SELECT t1.t FROM t1
|
||||
WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1
|
||||
@ -3730,9 +3727,9 @@ from t1' at line 1
|
||||
explain select * from t1 where not exists
|
||||
((select t11.i from t1 t11) union (select t12.i from t1 t12));
|
||||
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 SUBQUERY t11 system NULL NULL NULL NULL 0 const row not found
|
||||
3 UNION t12 system NULL NULL NULL NULL 0 const row not found
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(250), b INT auto_increment, PRIMARY KEY (b));
|
||||
@ -4202,8 +4199,8 @@ CREATE TABLE t1 (a int, b int, KEY (a));
|
||||
INSERT INTO t1 VALUES (1,1),(2,1);
|
||||
EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT COUNT(*) FROM t1 GROUP BY b);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ref a a 5 const 0 Using where; Using index
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
|
||||
1 PRIMARY t1 ref a a 5 const 1 Using where; Using index
|
||||
2 SUBQUERY internal_tmp_table ALL group_key NULL NULL NULL 1 Using temporary; Using filesort
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id));
|
||||
INSERT INTO t1 VALUES
|
||||
@ -4529,15 +4526,15 @@ SET join_cache_level=0;
|
||||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 GROUP BY a);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <expr_cache><1>(<in_optimizer>(1,<exists>(select min(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`a` having (1 = <ref_null_helper>(min(`test`.`t1`.`a`))))))
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where 1
|
||||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 WHERE a > 3 GROUP BY a);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <expr_cache><1>(<in_optimizer>(1,<exists>(select min(`test`.`t1`.`a`) from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` having (1 = <ref_null_helper>(min(`test`.`t1`.`a`))))))
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where 0
|
||||
SET join_cache_level=@save_join_cache_level;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
@ -4582,7 +4579,7 @@ FROM t1
|
||||
WHERE a = 230;
|
||||
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 NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
|
||||
FROM t1
|
||||
WHERE a = 230;
|
||||
@ -4628,7 +4625,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <nop>(<in_optimizer>(1,((select max(`test`.`t1`.`a1`) from `test`.`t1`) > 1)))
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where 1
|
||||
SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t1);
|
||||
1
|
||||
1
|
||||
@ -5726,7 +5723,7 @@ WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a )
|
||||
GROUP BY b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
SELECT b FROM t1
|
||||
WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a )
|
||||
GROUP BY b;
|
||||
@ -5970,7 +5967,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
|
||||
2 SUBQUERY t1 ref a a 5 const 1 Using index
|
||||
2 SUBQUERY t1 ref a a 5 const 1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
|
||||
@ -6129,7 +6126,7 @@ set optimizer_switch=@tmp_optimizer_switch;
|
||||
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
|
||||
2 SUBQUERY t1 ref a a 5 const 1 Using index
|
||||
2 SUBQUERY t1 ref a a 5 const 1
|
||||
|
||||
DROP TABLE t1;
|
||||
#
|
||||
@ -6541,7 +6538,7 @@ EXPLAIN
|
||||
SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
|
||||
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 t1 ALL NULL NULL NULL NULL 2
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
|
||||
COUNT(f1) f4
|
||||
0 NULL
|
||||
@ -6549,7 +6546,7 @@ EXPLAIN
|
||||
SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
|
||||
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 t1 ALL NULL NULL NULL NULL 2
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
|
||||
COUNT(f1) f4
|
||||
0 0
|
||||
@ -6570,6 +6567,205 @@ SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE
|
||||
COUNT(f1) f4
|
||||
0 0
|
||||
drop table t1,t2;
|
||||
#
|
||||
# LP BUG#1002079 Server crashes in Item_singlerow_subselect::val_int with constant table,
|
||||
# HAVING, UNION in subquery
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (7),(0);
|
||||
CREATE TABLE t2 (b INT);
|
||||
EXPLAIN
|
||||
SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
|
||||
SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7;
|
||||
f1 f2
|
||||
drop table t1,t2;
|
||||
#
|
||||
# LP BUG#1008686 Server crashes in subselect_union_engine::no_rows on SELECT with impossible
|
||||
# WHERE and UNION in HAVING
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (1),(7);
|
||||
EXPLAIN
|
||||
SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_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 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
|
||||
SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_a != 1;
|
||||
min_a a
|
||||
EXPLAIN
|
||||
SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_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 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
3 DEPENDENT UNION t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
|
||||
SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_a != 1;
|
||||
min_a a
|
||||
drop table t1;
|
||||
#
|
||||
# LP BUG#944706 Query with impossible or constant subquery in WHERE or HAVING is not
|
||||
# precomputed and thus not part of optimization
|
||||
#
|
||||
CREATE TABLE t1 ( a VARCHAR(16), KEY (a) );
|
||||
INSERT INTO t1 VALUES ('Abilene'),('Akron'),('Albany'),('Albuquerque'),('Alexandria'),('Allentown'),
|
||||
('Amarillo'),('Anaheim'),('Anchorage'),('Ann Arbor'),('Arden-Arcade');
|
||||
EXPLAIN
|
||||
SELECT MAX( alias2.a ) AS field
|
||||
FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
|
||||
WHERE alias1.a = alias2.a OR alias1.a = 'y'
|
||||
HAVING field>'B' AND ( 'Moscow' ) IN ( SELECT a FROM t1 );
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible HAVING
|
||||
2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where
|
||||
SELECT MAX( alias2.a ) AS field
|
||||
FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
|
||||
WHERE alias1.a = alias2.a OR alias1.a = 'y'
|
||||
HAVING field>'B' AND ( 'Moscow' ) IN ( SELECT a FROM t1 );
|
||||
field
|
||||
EXPLAIN
|
||||
SELECT MAX( alias2.a )
|
||||
FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
|
||||
WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 );
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY alias1 index a a 19 NULL 11 Using where; Using index
|
||||
1 PRIMARY alias2 ref a a 19 test.alias1.a 2 Using index
|
||||
1 PRIMARY alias3 index NULL a 19 NULL 11 Using index; Using join buffer (flat, BNL join)
|
||||
2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where
|
||||
SELECT MAX( alias2.a )
|
||||
FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
|
||||
WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 );
|
||||
MAX( alias2.a )
|
||||
Arden-Arcade
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-277 CHEAP SQ: Server crashes in st_join_table::get_examined_rows
|
||||
# with semijoin+materialization, IN and = subqueries
|
||||
#
|
||||
CREATE TABLE t1 (a1 INT);
|
||||
INSERT INTO t1 VALUES (4),(6);
|
||||
CREATE TABLE t2 (b1 INT);
|
||||
INSERT INTO t2 VALUES (1),(7);
|
||||
EXPLAIN
|
||||
SELECT * FROM t1
|
||||
WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where; Start temporary; Using join buffer (flat, BNL join)
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 End temporary; Using join buffer (flat, BNL join)
|
||||
SELECT * FROM t1
|
||||
WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2));
|
||||
a1
|
||||
drop table t1, t2;
|
||||
#
|
||||
# MDEV-287 CHEAP SQ: A query with subquery in SELECT list, EXISTS,
|
||||
# inner joins takes hundreds times longer
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (1),(7);
|
||||
CREATE TABLE t2 (b INT);
|
||||
INSERT INTO t2 VALUES (4),(5);
|
||||
CREATE TABLE t3 (c INT);
|
||||
INSERT INTO t3 VALUES (8),(3);
|
||||
set @@expensive_subquery_limit= 0;
|
||||
EXPLAIN
|
||||
SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
|
||||
FROM t2 alias1, t1 alias2, t1 alias3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
|
||||
1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
|
||||
1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
|
||||
flush status;
|
||||
SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
|
||||
FROM t2 alias1, t1 alias2, t1 alias3;
|
||||
(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
show status like "subquery_cache%";
|
||||
Variable_name Value
|
||||
Subquery_cache_hit 6
|
||||
Subquery_cache_miss 2
|
||||
show status like '%Handler_read%';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
Handler_read_key 8
|
||||
Handler_read_last 0
|
||||
Handler_read_next 0
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_deleted 0
|
||||
Handler_read_rnd_next 22
|
||||
set @@expensive_subquery_limit= default;
|
||||
EXPLAIN
|
||||
SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
|
||||
FROM t2 alias1, t1 alias2, t1 alias3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
|
||||
1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
|
||||
1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
|
||||
flush status;
|
||||
SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
|
||||
FROM t2 alias1, t1 alias2, t1 alias3;
|
||||
(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
show status like "subquery_cache%";
|
||||
Variable_name Value
|
||||
Subquery_cache_hit 0
|
||||
Subquery_cache_miss 0
|
||||
show status like '%Handler_read%';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
Handler_read_key 0
|
||||
Handler_read_last 0
|
||||
Handler_read_next 0
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_deleted 0
|
||||
Handler_read_rnd_next 16
|
||||
drop table t1, t2, t3;
|
||||
#
|
||||
# MDEV-288 CHEAP SQ: Valgrind warnings "Memory lost" with IN and EXISTS nested subquery, materialization+semijoin
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (0),(8);
|
||||
CREATE TABLE t2 (b INT PRIMARY KEY);
|
||||
INSERT INTO t2 VALUES (1),(2);
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
3 SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1));
|
||||
a
|
||||
drop table t1,t2;
|
||||
# return optimizer switch changed in the beginning of this test
|
||||
set optimizer_switch=@subselect_tmp;
|
||||
set optimizer_switch=default;
|
||||
|
@ -54,7 +54,7 @@ ERROR 42S22: Reference 'a' not supported (forward reference in item list)
|
||||
EXPLAIN EXTENDED SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 1 100.00
|
||||
3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
|
||||
@ -374,12 +374,12 @@ INSERT INTO t8 (pseudo,email) VALUES ('joce1','test1');
|
||||
INSERT INTO t8 (pseudo,email) VALUES ('2joce1','2test1');
|
||||
EXPLAIN EXTENDED SELECT pseudo,(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce')) FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using where; Using index
|
||||
1 PRIMARY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
|
||||
4 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
|
||||
2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using where
|
||||
2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00
|
||||
3 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t8`.`pseudo` AS `pseudo`,(select `test`.`t8`.`email` from `test`.`t8` where (`test`.`t8`.`pseudo` = (select 'joce' from `test`.`t8` where 1))) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where (`test`.`t8`.`pseudo` = (select 'joce' from `test`.`t8` where 1))
|
||||
Note 1003 select 'joce' AS `pseudo`,(select 'test' from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
|
||||
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
|
||||
t8 WHERE pseudo='joce');
|
||||
ERROR 21000: Operand should contain 1 column(s)
|
||||
@ -520,6 +520,7 @@ ERROR 21000: Subquery returns more than 1 row
|
||||
show warnings;
|
||||
Level Code Message
|
||||
Error 1242 Subquery returns more than 1 row
|
||||
Error 1028 Sort aborted: Subquery returns more than 1 row
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1),(2),(3);
|
||||
@ -550,11 +551,7 @@ SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT
|
||||
numreponse (SELECT numeropost FROM t1 HAVING numreponse=1)
|
||||
INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
|
||||
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using where; Using index
|
||||
2 SUBQUERY t1 ref PRIMARY PRIMARY 3 const 2 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`numreponse` AS `numreponse` from `test`.`t1` where ((`test`.`t1`.`numeropost` = '1') and (`test`.`t1`.`numreponse` = (select 1 from `test`.`t1` where (`test`.`t1`.`numeropost` = '1'))))
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
|
||||
@ -910,7 +907,7 @@ a t1.a in (select t2.a from t2)
|
||||
explain extended SELECT t1.a, t1.a in (select t2.a from t2) FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
|
||||
2 DEPENDENT SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index
|
||||
2 SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t2 on a checking NULL having <is_not_null_test>(`test`.`t2`.`a`)))) AS `t1.a in (select t2.a from t2)` from `test`.`t1`
|
||||
CREATE TABLE t3 (a int(11) default '0');
|
||||
@ -1323,7 +1320,7 @@ SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
Warnings:
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 from dual where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
INSERT INTO t1 (pseudo) VALUES ('test1');
|
||||
@ -1333,7 +1330,7 @@ SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
Warnings:
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
drop table t1;
|
||||
@ -1611,25 +1608,25 @@ a3 1
|
||||
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2) from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
|
||||
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
|
||||
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`))))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1`
|
||||
explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
|
||||
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
|
||||
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`s1` AS `s1`,<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1`
|
||||
explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
|
||||
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
|
||||
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`))))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1`
|
||||
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
|
||||
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key
|
||||
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where (`test`.`t2`.`s1` < 'a2') having trigcond(<is_not_null_test>(`test`.`t2`.`s1`))))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
|
||||
drop table t1,t2;
|
||||
@ -1678,34 +1675,34 @@ select * from t3 where NULL >= any (select b from t2);
|
||||
a
|
||||
explain extended select * from t3 where NULL >= any (select b from t2);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
|
||||
select * from t3 where NULL >= any (select b from t2 group by 1);
|
||||
a
|
||||
explain extended select * from t3 where NULL >= any (select b from t2 group by 1);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
|
||||
select * from t3 where NULL >= some (select b from t2);
|
||||
a
|
||||
explain extended select * from t3 where NULL >= some (select b from t2);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
|
||||
select * from t3 where NULL >= some (select b from t2 group by 1);
|
||||
a
|
||||
explain extended select * from t3 where NULL >= some (select b from t2 group by 1);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
|
||||
insert into t2 values (2,2), (2,1), (3,3), (3,1);
|
||||
select * from t3 where a > all (select max(b) from t2 group by a);
|
||||
a
|
||||
@ -1767,7 +1764,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 UNION t1 system NULL NULL NULL NULL 1 100.00
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1003 select 'e' AS `s1` from dual where <nop>(<in_optimizer>('f',(<min>(select 'e' from dual union select 'e' from dual) < 'f')))
|
||||
Note 1003 select 'e' AS `s1` from dual where 1
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (number char(11) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1;
|
||||
INSERT INTO t1 VALUES ('69294728265'),('18621828126'),('89356874041'),('95895001874');
|
||||
@ -3101,8 +3098,8 @@ ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
|
||||
ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
|
||||
1 PRIMARY r eq_ref PRIMARY PRIMARY 4 const 1 Using where
|
||||
2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using index condition
|
||||
1 PRIMARY r const PRIMARY PRIMARY 4 const 1
|
||||
2 SUBQUERY t2 range b b 40 NULL 2 Using where
|
||||
SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
|
||||
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
|
||||
ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
|
||||
@ -3113,8 +3110,8 @@ ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
|
||||
ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
|
||||
1 PRIMARY r eq_ref PRIMARY PRIMARY 4 const 1 Using where
|
||||
2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using index condition
|
||||
1 PRIMARY r const PRIMARY PRIMARY 4 const 1
|
||||
2 SUBQUERY t2 range b b 40 NULL 2 Using index condition
|
||||
SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
|
||||
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
|
||||
ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
|
||||
@ -3165,7 +3162,7 @@ INSERT INTO t2 VALUES (1),(2),(3);
|
||||
EXPLAIN SELECT a, a IN (SELECT a FROM t1) FROM t2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 3
|
||||
2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 2 Using index; Full scan on NULL key
|
||||
2 SUBQUERY t1 index_subquery a a 5 func 2 Using index; Full scan on NULL key
|
||||
SELECT a, a IN (SELECT a FROM t1) FROM t2;
|
||||
a a IN (SELECT a FROM t1)
|
||||
1 1
|
||||
@ -3699,7 +3696,7 @@ ORDER BY t1.t DESC LIMIT 1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 system NULL NULL NULL NULL 1
|
||||
1 PRIMARY t1 index NULL PRIMARY 16 NULL 11 Using where; Using index
|
||||
2 DEPENDENT SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index
|
||||
2 SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index
|
||||
SELECT * FROM t1,t2
|
||||
WHERE t1.t = (SELECT t1.t FROM t1
|
||||
WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1
|
||||
@ -3726,9 +3723,9 @@ from t1' at line 1
|
||||
explain select * from t1 where not exists
|
||||
((select t11.i from t1 t11) union (select t12.i from t1 t12));
|
||||
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 SUBQUERY t11 system NULL NULL NULL NULL 0 const row not found
|
||||
3 UNION t12 system NULL NULL NULL NULL 0 const row not found
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(250), b INT auto_increment, PRIMARY KEY (b));
|
||||
@ -4198,8 +4195,8 @@ CREATE TABLE t1 (a int, b int, KEY (a));
|
||||
INSERT INTO t1 VALUES (1,1),(2,1);
|
||||
EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT COUNT(*) FROM t1 GROUP BY b);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ref a a 5 const 0 Using where; Using index
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
|
||||
1 PRIMARY t1 ref a a 5 const 1 Using where; Using index
|
||||
2 SUBQUERY internal_tmp_table ALL group_key NULL NULL NULL 1 Using temporary; Using filesort
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id));
|
||||
INSERT INTO t1 VALUES
|
||||
@ -4525,15 +4522,15 @@ SET join_cache_level=0;
|
||||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 GROUP BY a);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,<exists>(select min(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`a` having (1 = <ref_null_helper>(min(`test`.`t1`.`a`)))))
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where 1
|
||||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 WHERE a > 3 GROUP BY a);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,<exists>(select min(`test`.`t1`.`a`) from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` having (1 = <ref_null_helper>(min(`test`.`t1`.`a`)))))
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where 0
|
||||
SET join_cache_level=@save_join_cache_level;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
@ -4578,7 +4575,7 @@ FROM t1
|
||||
WHERE a = 230;
|
||||
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 NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
|
||||
FROM t1
|
||||
WHERE a = 230;
|
||||
@ -4624,7 +4621,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <nop>(<in_optimizer>(1,((select max(`test`.`t1`.`a1`) from `test`.`t1`) > 1)))
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where 1
|
||||
SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t1);
|
||||
1
|
||||
1
|
||||
@ -5722,7 +5719,7 @@ WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a )
|
||||
GROUP BY b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
SELECT b FROM t1
|
||||
WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a )
|
||||
GROUP BY b;
|
||||
@ -5966,7 +5963,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
|
||||
2 SUBQUERY t1 ref a a 5 const 1 Using index
|
||||
2 SUBQUERY t1 ref a a 5 const 1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
|
||||
@ -6125,7 +6122,7 @@ set optimizer_switch=@tmp_optimizer_switch;
|
||||
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
|
||||
2 SUBQUERY t1 ref a a 5 const 1 Using index
|
||||
2 SUBQUERY t1 ref a a 5 const 1
|
||||
|
||||
DROP TABLE t1;
|
||||
#
|
||||
@ -6537,7 +6534,7 @@ EXPLAIN
|
||||
SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
|
||||
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 t1 ALL NULL NULL NULL NULL 2
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
|
||||
COUNT(f1) f4
|
||||
0 NULL
|
||||
@ -6545,7 +6542,7 @@ EXPLAIN
|
||||
SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
|
||||
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 t1 ALL NULL NULL NULL NULL 2
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
|
||||
COUNT(f1) f4
|
||||
0 0
|
||||
@ -6566,6 +6563,206 @@ SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE
|
||||
COUNT(f1) f4
|
||||
0 0
|
||||
drop table t1,t2;
|
||||
#
|
||||
# LP BUG#1002079 Server crashes in Item_singlerow_subselect::val_int with constant table,
|
||||
# HAVING, UNION in subquery
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (7),(0);
|
||||
CREATE TABLE t2 (b INT);
|
||||
EXPLAIN
|
||||
SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
|
||||
SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7;
|
||||
f1 f2
|
||||
drop table t1,t2;
|
||||
#
|
||||
# LP BUG#1008686 Server crashes in subselect_union_engine::no_rows on SELECT with impossible
|
||||
# WHERE and UNION in HAVING
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (1),(7);
|
||||
EXPLAIN
|
||||
SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_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 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
|
||||
SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_a != 1;
|
||||
min_a a
|
||||
EXPLAIN
|
||||
SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_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 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
3 DEPENDENT UNION t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
|
||||
SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_a != 1;
|
||||
min_a a
|
||||
drop table t1;
|
||||
#
|
||||
# LP BUG#944706 Query with impossible or constant subquery in WHERE or HAVING is not
|
||||
# precomputed and thus not part of optimization
|
||||
#
|
||||
CREATE TABLE t1 ( a VARCHAR(16), KEY (a) );
|
||||
INSERT INTO t1 VALUES ('Abilene'),('Akron'),('Albany'),('Albuquerque'),('Alexandria'),('Allentown'),
|
||||
('Amarillo'),('Anaheim'),('Anchorage'),('Ann Arbor'),('Arden-Arcade');
|
||||
EXPLAIN
|
||||
SELECT MAX( alias2.a ) AS field
|
||||
FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
|
||||
WHERE alias1.a = alias2.a OR alias1.a = 'y'
|
||||
HAVING field>'B' AND ( 'Moscow' ) IN ( SELECT a FROM t1 );
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible HAVING
|
||||
2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where
|
||||
SELECT MAX( alias2.a ) AS field
|
||||
FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
|
||||
WHERE alias1.a = alias2.a OR alias1.a = 'y'
|
||||
HAVING field>'B' AND ( 'Moscow' ) IN ( SELECT a FROM t1 );
|
||||
field
|
||||
EXPLAIN
|
||||
SELECT MAX( alias2.a )
|
||||
FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
|
||||
WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 );
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY alias1 index a a 19 NULL 11 Using where; Using index
|
||||
1 PRIMARY alias2 ref a a 19 test.alias1.a 2 Using index
|
||||
1 PRIMARY alias3 index NULL a 19 NULL 11 Using index; Using join buffer (flat, BNL join)
|
||||
2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where
|
||||
SELECT MAX( alias2.a )
|
||||
FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
|
||||
WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 );
|
||||
MAX( alias2.a )
|
||||
Arden-Arcade
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-277 CHEAP SQ: Server crashes in st_join_table::get_examined_rows
|
||||
# with semijoin+materialization, IN and = subqueries
|
||||
#
|
||||
CREATE TABLE t1 (a1 INT);
|
||||
INSERT INTO t1 VALUES (4),(6);
|
||||
CREATE TABLE t2 (b1 INT);
|
||||
INSERT INTO t2 VALUES (1),(7);
|
||||
EXPLAIN
|
||||
SELECT * FROM t1
|
||||
WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
2 SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1
|
||||
3 MATERIALIZED t1 ALL NULL NULL NULL NULL 2
|
||||
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
|
||||
SELECT * FROM t1
|
||||
WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2));
|
||||
a1
|
||||
drop table t1, t2;
|
||||
#
|
||||
# MDEV-287 CHEAP SQ: A query with subquery in SELECT list, EXISTS,
|
||||
# inner joins takes hundreds times longer
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (1),(7);
|
||||
CREATE TABLE t2 (b INT);
|
||||
INSERT INTO t2 VALUES (4),(5);
|
||||
CREATE TABLE t3 (c INT);
|
||||
INSERT INTO t3 VALUES (8),(3);
|
||||
set @@expensive_subquery_limit= 0;
|
||||
EXPLAIN
|
||||
SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
|
||||
FROM t2 alias1, t1 alias2, t1 alias3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
|
||||
1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
|
||||
1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
|
||||
flush status;
|
||||
SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
|
||||
FROM t2 alias1, t1 alias2, t1 alias3;
|
||||
(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
show status like "subquery_cache%";
|
||||
Variable_name Value
|
||||
Subquery_cache_hit 6
|
||||
Subquery_cache_miss 2
|
||||
show status like '%Handler_read%';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
Handler_read_key 8
|
||||
Handler_read_last 0
|
||||
Handler_read_next 0
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_deleted 0
|
||||
Handler_read_rnd_next 22
|
||||
set @@expensive_subquery_limit= default;
|
||||
EXPLAIN
|
||||
SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
|
||||
FROM t2 alias1, t1 alias2, t1 alias3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
|
||||
1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
|
||||
1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
|
||||
flush status;
|
||||
SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
|
||||
FROM t2 alias1, t1 alias2, t1 alias3;
|
||||
(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
show status like "subquery_cache%";
|
||||
Variable_name Value
|
||||
Subquery_cache_hit 0
|
||||
Subquery_cache_miss 0
|
||||
show status like '%Handler_read%';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
Handler_read_key 0
|
||||
Handler_read_last 0
|
||||
Handler_read_next 0
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_deleted 0
|
||||
Handler_read_rnd_next 16
|
||||
drop table t1, t2, t3;
|
||||
#
|
||||
# MDEV-288 CHEAP SQ: Valgrind warnings "Memory lost" with IN and EXISTS nested subquery, materialization+semijoin
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (0),(8);
|
||||
CREATE TABLE t2 (b INT PRIMARY KEY);
|
||||
INSERT INTO t2 VALUES (1),(2);
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1));
|
||||
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 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
3 SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1));
|
||||
a
|
||||
drop table t1,t2;
|
||||
# return optimizer switch changed in the beginning of this test
|
||||
set optimizer_switch=@subselect_tmp;
|
||||
set @optimizer_switch_for_subselect_test=null;
|
||||
|
@ -57,7 +57,7 @@ ERROR 42S22: Reference 'a' not supported (forward reference in item list)
|
||||
EXPLAIN EXTENDED SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 1 100.00
|
||||
3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
|
||||
@ -377,12 +377,12 @@ INSERT INTO t8 (pseudo,email) VALUES ('joce1','test1');
|
||||
INSERT INTO t8 (pseudo,email) VALUES ('2joce1','2test1');
|
||||
EXPLAIN EXTENDED SELECT pseudo,(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce')) FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using where; Using index
|
||||
1 PRIMARY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
|
||||
4 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
|
||||
2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using where
|
||||
2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00
|
||||
3 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t8`.`pseudo` AS `pseudo`,(select `test`.`t8`.`email` from `test`.`t8` where (`test`.`t8`.`pseudo` = (select 'joce' from `test`.`t8` where 1))) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where (`test`.`t8`.`pseudo` = (select 'joce' from `test`.`t8` where 1))
|
||||
Note 1003 select 'joce' AS `pseudo`,(select 'test' from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
|
||||
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
|
||||
t8 WHERE pseudo='joce');
|
||||
ERROR 21000: Operand should contain 1 column(s)
|
||||
@ -523,6 +523,7 @@ ERROR 21000: Subquery returns more than 1 row
|
||||
show warnings;
|
||||
Level Code Message
|
||||
Error 1242 Subquery returns more than 1 row
|
||||
Error 1028 Sort aborted: Subquery returns more than 1 row
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1),(2),(3);
|
||||
@ -553,11 +554,7 @@ SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT
|
||||
numreponse (SELECT numeropost FROM t1 HAVING numreponse=1)
|
||||
INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
|
||||
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using where; Using index
|
||||
2 SUBQUERY t1 ref PRIMARY PRIMARY 3 const 2 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`numreponse` AS `numreponse` from `test`.`t1` where ((`test`.`t1`.`numeropost` = '1') and (`test`.`t1`.`numreponse` = (select 1 from `test`.`t1` where (`test`.`t1`.`numeropost` = '1'))))
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
|
||||
@ -913,7 +910,7 @@ a t1.a in (select t2.a from t2)
|
||||
explain extended SELECT t1.a, t1.a in (select t2.a from t2) FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
|
||||
2 DEPENDENT SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index
|
||||
2 SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t2 on a checking NULL having <is_not_null_test>(`test`.`t2`.`a`)))) AS `t1.a in (select t2.a from t2)` from `test`.`t1`
|
||||
CREATE TABLE t3 (a int(11) default '0');
|
||||
@ -1326,7 +1323,7 @@ SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
Warnings:
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 from dual where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
INSERT INTO t1 (pseudo) VALUES ('test1');
|
||||
@ -1336,7 +1333,7 @@ SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
Warnings:
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
drop table t1;
|
||||
@ -1614,25 +1611,25 @@ a3 1
|
||||
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2) from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
|
||||
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
|
||||
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`))))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1`
|
||||
explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
|
||||
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
|
||||
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`s1` AS `s1`,<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1`
|
||||
explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
|
||||
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
|
||||
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`))))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1`
|
||||
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
|
||||
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key
|
||||
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where (`test`.`t2`.`s1` < 'a2') having trigcond(<is_not_null_test>(`test`.`t2`.`s1`))))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
|
||||
drop table t1,t2;
|
||||
@ -1681,34 +1678,34 @@ select * from t3 where NULL >= any (select b from t2);
|
||||
a
|
||||
explain extended select * from t3 where NULL >= any (select b from t2);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
|
||||
select * from t3 where NULL >= any (select b from t2 group by 1);
|
||||
a
|
||||
explain extended select * from t3 where NULL >= any (select b from t2 group by 1);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
|
||||
select * from t3 where NULL >= some (select b from t2);
|
||||
a
|
||||
explain extended select * from t3 where NULL >= some (select b from t2);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
|
||||
select * from t3 where NULL >= some (select b from t2 group by 1);
|
||||
a
|
||||
explain extended select * from t3 where NULL >= some (select b from t2 group by 1);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
|
||||
insert into t2 values (2,2), (2,1), (3,3), (3,1);
|
||||
select * from t3 where a > all (select max(b) from t2 group by a);
|
||||
a
|
||||
@ -1770,7 +1767,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 UNION t1 system NULL NULL NULL NULL 1 100.00
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1003 select 'e' AS `s1` from dual where <nop>(<in_optimizer>('f',(<min>(select 'e' from dual union select 'e' from dual) < 'f')))
|
||||
Note 1003 select 'e' AS `s1` from dual where 1
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (number char(11) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1;
|
||||
INSERT INTO t1 VALUES ('69294728265'),('18621828126'),('89356874041'),('95895001874');
|
||||
@ -3105,8 +3102,8 @@ ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
|
||||
ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
|
||||
1 PRIMARY r eq_ref PRIMARY PRIMARY 4 const 1 Using where
|
||||
2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using index condition
|
||||
1 PRIMARY r const PRIMARY PRIMARY 4 const 1
|
||||
2 SUBQUERY t2 range b b 40 NULL 2 Using where
|
||||
SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
|
||||
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
|
||||
ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
|
||||
@ -3117,8 +3114,8 @@ ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
|
||||
ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
|
||||
1 PRIMARY r eq_ref PRIMARY PRIMARY 4 const 1 Using where
|
||||
2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using index condition
|
||||
1 PRIMARY r const PRIMARY PRIMARY 4 const 1
|
||||
2 SUBQUERY t2 range b b 40 NULL 2 Using index condition
|
||||
SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
|
||||
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
|
||||
ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
|
||||
@ -3169,7 +3166,7 @@ INSERT INTO t2 VALUES (1),(2),(3);
|
||||
EXPLAIN SELECT a, a IN (SELECT a FROM t1) FROM t2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 3
|
||||
2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 2 Using index; Full scan on NULL key
|
||||
2 SUBQUERY t1 index_subquery a a 5 func 2 Using index; Full scan on NULL key
|
||||
SELECT a, a IN (SELECT a FROM t1) FROM t2;
|
||||
a a IN (SELECT a FROM t1)
|
||||
1 1
|
||||
@ -3705,7 +3702,7 @@ ORDER BY t1.t DESC LIMIT 1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 system NULL NULL NULL NULL 1
|
||||
1 PRIMARY t1 index NULL PRIMARY 16 NULL 11 Using where; Using index
|
||||
2 DEPENDENT SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index
|
||||
2 SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index
|
||||
SELECT * FROM t1,t2
|
||||
WHERE t1.t = (SELECT t1.t FROM t1
|
||||
WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1
|
||||
@ -3732,9 +3729,9 @@ from t1' at line 1
|
||||
explain select * from t1 where not exists
|
||||
((select t11.i from t1 t11) union (select t12.i from t1 t12));
|
||||
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 SUBQUERY t11 system NULL NULL NULL NULL 0 const row not found
|
||||
3 UNION t12 system NULL NULL NULL NULL 0 const row not found
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(250), b INT auto_increment, PRIMARY KEY (b));
|
||||
@ -4204,8 +4201,8 @@ CREATE TABLE t1 (a int, b int, KEY (a));
|
||||
INSERT INTO t1 VALUES (1,1),(2,1);
|
||||
EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT COUNT(*) FROM t1 GROUP BY b);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ref a a 5 const 0 Using where; Using index
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
|
||||
1 PRIMARY t1 ref a a 5 const 1 Using where; Using index
|
||||
2 SUBQUERY internal_tmp_table ALL group_key NULL NULL NULL 1 Using temporary; Using filesort
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id));
|
||||
INSERT INTO t1 VALUES
|
||||
@ -4586,7 +4583,7 @@ FROM t1
|
||||
WHERE a = 230;
|
||||
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 NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
|
||||
FROM t1
|
||||
WHERE a = 230;
|
||||
@ -4632,7 +4629,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <nop>(<in_optimizer>(1,((select max(`test`.`t1`.`a1`) from `test`.`t1`) > 1)))
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where 1
|
||||
SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t1);
|
||||
1
|
||||
1
|
||||
@ -5731,7 +5728,7 @@ WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a )
|
||||
GROUP BY b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
SELECT b FROM t1
|
||||
WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a )
|
||||
GROUP BY b;
|
||||
@ -5975,7 +5972,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
|
||||
2 SUBQUERY t1 ref a a 5 const 1 Using index
|
||||
2 SUBQUERY t1 ref a a 5 const 1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
|
||||
@ -6136,7 +6133,7 @@ set optimizer_switch=@tmp_optimizer_switch;
|
||||
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
|
||||
2 SUBQUERY t1 ref a a 5 const 1 Using index
|
||||
2 SUBQUERY t1 ref a a 5 const 1
|
||||
|
||||
DROP TABLE t1;
|
||||
#
|
||||
@ -6548,7 +6545,7 @@ EXPLAIN
|
||||
SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
|
||||
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 t1 ALL NULL NULL NULL NULL 2
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
|
||||
COUNT(f1) f4
|
||||
0 NULL
|
||||
@ -6556,7 +6553,7 @@ EXPLAIN
|
||||
SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
|
||||
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 t1 ALL NULL NULL NULL NULL 2
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
|
||||
COUNT(f1) f4
|
||||
0 0
|
||||
@ -6577,6 +6574,206 @@ SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE
|
||||
COUNT(f1) f4
|
||||
0 0
|
||||
drop table t1,t2;
|
||||
#
|
||||
# LP BUG#1002079 Server crashes in Item_singlerow_subselect::val_int with constant table,
|
||||
# HAVING, UNION in subquery
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (7),(0);
|
||||
CREATE TABLE t2 (b INT);
|
||||
EXPLAIN
|
||||
SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
|
||||
SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7;
|
||||
f1 f2
|
||||
drop table t1,t2;
|
||||
#
|
||||
# LP BUG#1008686 Server crashes in subselect_union_engine::no_rows on SELECT with impossible
|
||||
# WHERE and UNION in HAVING
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (1),(7);
|
||||
EXPLAIN
|
||||
SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_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 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
|
||||
SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_a != 1;
|
||||
min_a a
|
||||
EXPLAIN
|
||||
SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_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 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
3 DEPENDENT UNION t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
|
||||
SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_a != 1;
|
||||
min_a a
|
||||
drop table t1;
|
||||
#
|
||||
# LP BUG#944706 Query with impossible or constant subquery in WHERE or HAVING is not
|
||||
# precomputed and thus not part of optimization
|
||||
#
|
||||
CREATE TABLE t1 ( a VARCHAR(16), KEY (a) );
|
||||
INSERT INTO t1 VALUES ('Abilene'),('Akron'),('Albany'),('Albuquerque'),('Alexandria'),('Allentown'),
|
||||
('Amarillo'),('Anaheim'),('Anchorage'),('Ann Arbor'),('Arden-Arcade');
|
||||
EXPLAIN
|
||||
SELECT MAX( alias2.a ) AS field
|
||||
FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
|
||||
WHERE alias1.a = alias2.a OR alias1.a = 'y'
|
||||
HAVING field>'B' AND ( 'Moscow' ) IN ( SELECT a FROM t1 );
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible HAVING
|
||||
2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where
|
||||
SELECT MAX( alias2.a ) AS field
|
||||
FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
|
||||
WHERE alias1.a = alias2.a OR alias1.a = 'y'
|
||||
HAVING field>'B' AND ( 'Moscow' ) IN ( SELECT a FROM t1 );
|
||||
field
|
||||
EXPLAIN
|
||||
SELECT MAX( alias2.a )
|
||||
FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
|
||||
WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 );
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY alias1 index a a 19 NULL 11 Using where; Using index
|
||||
1 PRIMARY alias2 ref a a 19 test.alias1.a 2 Using index
|
||||
1 PRIMARY alias3 index NULL a 19 NULL 11 Using index; Using join buffer (flat, BNL join)
|
||||
2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where
|
||||
SELECT MAX( alias2.a )
|
||||
FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
|
||||
WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 );
|
||||
MAX( alias2.a )
|
||||
Arden-Arcade
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-277 CHEAP SQ: Server crashes in st_join_table::get_examined_rows
|
||||
# with semijoin+materialization, IN and = subqueries
|
||||
#
|
||||
CREATE TABLE t1 (a1 INT);
|
||||
INSERT INTO t1 VALUES (4),(6);
|
||||
CREATE TABLE t2 (b1 INT);
|
||||
INSERT INTO t2 VALUES (1),(7);
|
||||
EXPLAIN
|
||||
SELECT * FROM t1
|
||||
WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
2 SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1
|
||||
3 MATERIALIZED t1 ALL NULL NULL NULL NULL 2
|
||||
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
|
||||
SELECT * FROM t1
|
||||
WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2));
|
||||
a1
|
||||
drop table t1, t2;
|
||||
#
|
||||
# MDEV-287 CHEAP SQ: A query with subquery in SELECT list, EXISTS,
|
||||
# inner joins takes hundreds times longer
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (1),(7);
|
||||
CREATE TABLE t2 (b INT);
|
||||
INSERT INTO t2 VALUES (4),(5);
|
||||
CREATE TABLE t3 (c INT);
|
||||
INSERT INTO t3 VALUES (8),(3);
|
||||
set @@expensive_subquery_limit= 0;
|
||||
EXPLAIN
|
||||
SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
|
||||
FROM t2 alias1, t1 alias2, t1 alias3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
|
||||
1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
|
||||
1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
|
||||
flush status;
|
||||
SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
|
||||
FROM t2 alias1, t1 alias2, t1 alias3;
|
||||
(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
show status like "subquery_cache%";
|
||||
Variable_name Value
|
||||
Subquery_cache_hit 0
|
||||
Subquery_cache_miss 0
|
||||
show status like '%Handler_read%';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
Handler_read_key 0
|
||||
Handler_read_last 0
|
||||
Handler_read_next 0
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_deleted 0
|
||||
Handler_read_rnd_next 58
|
||||
set @@expensive_subquery_limit= default;
|
||||
EXPLAIN
|
||||
SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
|
||||
FROM t2 alias1, t1 alias2, t1 alias3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
|
||||
1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
|
||||
1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
|
||||
flush status;
|
||||
SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
|
||||
FROM t2 alias1, t1 alias2, t1 alias3;
|
||||
(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
show status like "subquery_cache%";
|
||||
Variable_name Value
|
||||
Subquery_cache_hit 0
|
||||
Subquery_cache_miss 0
|
||||
show status like '%Handler_read%';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
Handler_read_key 0
|
||||
Handler_read_last 0
|
||||
Handler_read_next 0
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_deleted 0
|
||||
Handler_read_rnd_next 16
|
||||
drop table t1, t2, t3;
|
||||
#
|
||||
# MDEV-288 CHEAP SQ: Valgrind warnings "Memory lost" with IN and EXISTS nested subquery, materialization+semijoin
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (0),(8);
|
||||
CREATE TABLE t2 (b INT PRIMARY KEY);
|
||||
INSERT INTO t2 VALUES (1),(2);
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1));
|
||||
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 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
3 SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1));
|
||||
a
|
||||
drop table t1,t2;
|
||||
# return optimizer switch changed in the beginning of this test
|
||||
set optimizer_switch=@subselect_tmp;
|
||||
set optimizer_switch=default;
|
||||
|
@ -54,12 +54,12 @@ ERROR 42S22: Reference 'a' not supported (forward reference in item list)
|
||||
EXPLAIN EXTENDED SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 1 100.00
|
||||
3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select 1 AS `1` from dual having (<expr_cache><1>((select 1)) = 1)
|
||||
Note 1003 select 1 AS `1` from dual having ((select 1) = 1)
|
||||
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
|
||||
1
|
||||
1
|
||||
@ -374,12 +374,12 @@ INSERT INTO t8 (pseudo,email) VALUES ('joce1','test1');
|
||||
INSERT INTO t8 (pseudo,email) VALUES ('2joce1','2test1');
|
||||
EXPLAIN EXTENDED SELECT pseudo,(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce')) FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using where; Using index
|
||||
1 PRIMARY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
|
||||
4 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
|
||||
2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using where
|
||||
2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00
|
||||
3 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t8`.`pseudo` AS `pseudo`,(select `test`.`t8`.`email` from `test`.`t8` where (`test`.`t8`.`pseudo` = (select 'joce' from `test`.`t8` where 1))) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where (`test`.`t8`.`pseudo` = (select 'joce' from `test`.`t8` where 1))
|
||||
Note 1003 select 'joce' AS `pseudo`,(select 'test' from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
|
||||
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
|
||||
t8 WHERE pseudo='joce');
|
||||
ERROR 21000: Operand should contain 1 column(s)
|
||||
@ -520,6 +520,7 @@ ERROR 21000: Subquery returns more than 1 row
|
||||
show warnings;
|
||||
Level Code Message
|
||||
Error 1242 Subquery returns more than 1 row
|
||||
Error 1028 Sort aborted: Subquery returns more than 1 row
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1),(2),(3);
|
||||
@ -550,11 +551,7 @@ SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT
|
||||
numreponse (SELECT numeropost FROM t1 HAVING numreponse=1)
|
||||
INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
|
||||
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using where; Using index
|
||||
2 SUBQUERY t1 ref PRIMARY PRIMARY 3 const 2 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`numreponse` AS `numreponse` from `test`.`t1` where ((`test`.`t1`.`numeropost` = '1') and (`test`.`t1`.`numreponse` = (select 1 from `test`.`t1` where (`test`.`t1`.`numeropost` = '1'))))
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
|
||||
@ -1323,7 +1320,7 @@ SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
Warnings:
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 from dual where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
INSERT INTO t1 (pseudo) VALUES ('test1');
|
||||
@ -1333,7 +1330,7 @@ SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
Warnings:
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
drop table t1;
|
||||
@ -1678,34 +1675,34 @@ select * from t3 where NULL >= any (select b from t2);
|
||||
a
|
||||
explain extended select * from t3 where NULL >= any (select b from t2);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
|
||||
select * from t3 where NULL >= any (select b from t2 group by 1);
|
||||
a
|
||||
explain extended select * from t3 where NULL >= any (select b from t2 group by 1);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
|
||||
select * from t3 where NULL >= some (select b from t2);
|
||||
a
|
||||
explain extended select * from t3 where NULL >= some (select b from t2);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
|
||||
select * from t3 where NULL >= some (select b from t2 group by 1);
|
||||
a
|
||||
explain extended select * from t3 where NULL >= some (select b from t2 group by 1);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(NULL,((select min(NULL) from `test`.`t2`) <= NULL)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
|
||||
insert into t2 values (2,2), (2,1), (3,3), (3,1);
|
||||
select * from t3 where a > all (select max(b) from t2 group by a);
|
||||
a
|
||||
@ -1767,7 +1764,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 UNION t1 system NULL NULL NULL NULL 1 100.00
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1003 select 'e' AS `s1` from dual where <nop>(<in_optimizer>('f',(<min>(select 'e' from dual union select 'e' from dual) < 'f')))
|
||||
Note 1003 select 'e' AS `s1` from dual where 1
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (number char(11) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1;
|
||||
INSERT INTO t1 VALUES ('69294728265'),('18621828126'),('89356874041'),('95895001874');
|
||||
@ -3101,8 +3098,8 @@ ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
|
||||
ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
|
||||
1 PRIMARY r eq_ref PRIMARY PRIMARY 4 const 1 Using where
|
||||
2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using index condition
|
||||
1 PRIMARY r const PRIMARY PRIMARY 4 const 1
|
||||
2 SUBQUERY t2 range b b 40 NULL 2 Using where
|
||||
SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
|
||||
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
|
||||
ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
|
||||
@ -3113,8 +3110,8 @@ ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
|
||||
ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
|
||||
1 PRIMARY r eq_ref PRIMARY PRIMARY 4 const 1 Using where
|
||||
2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using index condition
|
||||
1 PRIMARY r const PRIMARY PRIMARY 4 const 1
|
||||
2 SUBQUERY t2 range b b 40 NULL 2 Using index condition
|
||||
SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
|
||||
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
|
||||
ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
|
||||
@ -3699,7 +3696,7 @@ ORDER BY t1.t DESC LIMIT 1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 system NULL NULL NULL NULL 1
|
||||
1 PRIMARY t1 index NULL PRIMARY 16 NULL 11 Using where; Using index
|
||||
2 DEPENDENT SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index
|
||||
2 SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index
|
||||
SELECT * FROM t1,t2
|
||||
WHERE t1.t = (SELECT t1.t FROM t1
|
||||
WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1
|
||||
@ -3726,9 +3723,9 @@ from t1' at line 1
|
||||
explain select * from t1 where not exists
|
||||
((select t11.i from t1 t11) union (select t12.i from t1 t12));
|
||||
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 SUBQUERY t11 system NULL NULL NULL NULL 0 const row not found
|
||||
3 UNION t12 system NULL NULL NULL NULL 0 const row not found
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(250), b INT auto_increment, PRIMARY KEY (b));
|
||||
@ -4198,8 +4195,8 @@ CREATE TABLE t1 (a int, b int, KEY (a));
|
||||
INSERT INTO t1 VALUES (1,1),(2,1);
|
||||
EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT COUNT(*) FROM t1 GROUP BY b);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ref a a 5 const 0 Using where; Using index
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
|
||||
1 PRIMARY t1 ref a a 5 const 1 Using where; Using index
|
||||
2 SUBQUERY internal_tmp_table ALL group_key NULL NULL NULL 1 Using temporary; Using filesort
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id));
|
||||
INSERT INTO t1 VALUES
|
||||
@ -4525,15 +4522,15 @@ SET join_cache_level=0;
|
||||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 GROUP BY a);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||
2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <expr_cache><1>(<in_optimizer>(1,1 in ( <materialize> (select min(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`a` ), <primary_index_lookup>(1 in <temporary table> on distinct_key where ((1 = `<subquery2>`.`min(a)`))))))
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where 1
|
||||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 WHERE a > 3 GROUP BY a);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||
2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <expr_cache><1>(<in_optimizer>(1,1 in ( <materialize> (select min(`test`.`t1`.`a`) from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` ), <primary_index_lookup>(1 in <temporary table> on distinct_key where ((1 = `<subquery2>`.`min(a)`))))))
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where 0
|
||||
SET join_cache_level=@save_join_cache_level;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
@ -4578,7 +4575,7 @@ FROM t1
|
||||
WHERE a = 230;
|
||||
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 NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
|
||||
FROM t1
|
||||
WHERE a = 230;
|
||||
@ -4624,7 +4621,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <nop>(<in_optimizer>(1,((select max(`test`.`t1`.`a1`) from `test`.`t1`) > 1)))
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where 1
|
||||
SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t1);
|
||||
1
|
||||
1
|
||||
@ -5722,7 +5719,7 @@ WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a )
|
||||
GROUP BY b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
SELECT b FROM t1
|
||||
WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a )
|
||||
GROUP BY b;
|
||||
@ -5966,7 +5963,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
|
||||
2 SUBQUERY t1 ref a a 5 const 1 Using index
|
||||
2 SUBQUERY t1 ref a a 5 const 1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
|
||||
@ -6125,7 +6122,7 @@ set optimizer_switch=@tmp_optimizer_switch;
|
||||
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
|
||||
2 SUBQUERY t1 ref a a 5 const 1 Using index
|
||||
2 SUBQUERY t1 ref a a 5 const 1
|
||||
|
||||
DROP TABLE t1;
|
||||
#
|
||||
@ -6537,7 +6534,7 @@ EXPLAIN
|
||||
SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
|
||||
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 t1 ALL NULL NULL NULL NULL 2
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
|
||||
COUNT(f1) f4
|
||||
0 NULL
|
||||
@ -6545,7 +6542,7 @@ EXPLAIN
|
||||
SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
|
||||
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 t1 ALL NULL NULL NULL NULL 2
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
|
||||
COUNT(f1) f4
|
||||
0 0
|
||||
@ -6566,6 +6563,206 @@ SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE
|
||||
COUNT(f1) f4
|
||||
0 0
|
||||
drop table t1,t2;
|
||||
#
|
||||
# LP BUG#1002079 Server crashes in Item_singlerow_subselect::val_int with constant table,
|
||||
# HAVING, UNION in subquery
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (7),(0);
|
||||
CREATE TABLE t2 (b INT);
|
||||
EXPLAIN
|
||||
SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
|
||||
SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7;
|
||||
f1 f2
|
||||
drop table t1,t2;
|
||||
#
|
||||
# LP BUG#1008686 Server crashes in subselect_union_engine::no_rows on SELECT with impossible
|
||||
# WHERE and UNION in HAVING
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (1),(7);
|
||||
EXPLAIN
|
||||
SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_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 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
|
||||
SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_a != 1;
|
||||
min_a a
|
||||
EXPLAIN
|
||||
SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_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 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
3 DEPENDENT UNION t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
|
||||
SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_a != 1;
|
||||
min_a a
|
||||
drop table t1;
|
||||
#
|
||||
# LP BUG#944706 Query with impossible or constant subquery in WHERE or HAVING is not
|
||||
# precomputed and thus not part of optimization
|
||||
#
|
||||
CREATE TABLE t1 ( a VARCHAR(16), KEY (a) );
|
||||
INSERT INTO t1 VALUES ('Abilene'),('Akron'),('Albany'),('Albuquerque'),('Alexandria'),('Allentown'),
|
||||
('Amarillo'),('Anaheim'),('Anchorage'),('Ann Arbor'),('Arden-Arcade');
|
||||
EXPLAIN
|
||||
SELECT MAX( alias2.a ) AS field
|
||||
FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
|
||||
WHERE alias1.a = alias2.a OR alias1.a = 'y'
|
||||
HAVING field>'B' AND ( 'Moscow' ) IN ( SELECT a FROM t1 );
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible HAVING
|
||||
2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where
|
||||
SELECT MAX( alias2.a ) AS field
|
||||
FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
|
||||
WHERE alias1.a = alias2.a OR alias1.a = 'y'
|
||||
HAVING field>'B' AND ( 'Moscow' ) IN ( SELECT a FROM t1 );
|
||||
field
|
||||
EXPLAIN
|
||||
SELECT MAX( alias2.a )
|
||||
FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
|
||||
WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 );
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY alias1 index a a 19 NULL 11 Using where; Using index
|
||||
1 PRIMARY alias2 ref a a 19 test.alias1.a 2 Using index
|
||||
1 PRIMARY alias3 index NULL a 19 NULL 11 Using index; Using join buffer (flat, BNL join)
|
||||
2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where
|
||||
SELECT MAX( alias2.a )
|
||||
FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
|
||||
WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 );
|
||||
MAX( alias2.a )
|
||||
Arden-Arcade
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-277 CHEAP SQ: Server crashes in st_join_table::get_examined_rows
|
||||
# with semijoin+materialization, IN and = subqueries
|
||||
#
|
||||
CREATE TABLE t1 (a1 INT);
|
||||
INSERT INTO t1 VALUES (4),(6);
|
||||
CREATE TABLE t2 (b1 INT);
|
||||
INSERT INTO t2 VALUES (1),(7);
|
||||
EXPLAIN
|
||||
SELECT * FROM t1
|
||||
WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
2 SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1
|
||||
3 MATERIALIZED t1 ALL NULL NULL NULL NULL 2
|
||||
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
|
||||
SELECT * FROM t1
|
||||
WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2));
|
||||
a1
|
||||
drop table t1, t2;
|
||||
#
|
||||
# MDEV-287 CHEAP SQ: A query with subquery in SELECT list, EXISTS,
|
||||
# inner joins takes hundreds times longer
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (1),(7);
|
||||
CREATE TABLE t2 (b INT);
|
||||
INSERT INTO t2 VALUES (4),(5);
|
||||
CREATE TABLE t3 (c INT);
|
||||
INSERT INTO t3 VALUES (8),(3);
|
||||
set @@expensive_subquery_limit= 0;
|
||||
EXPLAIN
|
||||
SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
|
||||
FROM t2 alias1, t1 alias2, t1 alias3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
|
||||
1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
|
||||
1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
|
||||
flush status;
|
||||
SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
|
||||
FROM t2 alias1, t1 alias2, t1 alias3;
|
||||
(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
show status like "subquery_cache%";
|
||||
Variable_name Value
|
||||
Subquery_cache_hit 6
|
||||
Subquery_cache_miss 2
|
||||
show status like '%Handler_read%';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
Handler_read_key 8
|
||||
Handler_read_last 0
|
||||
Handler_read_next 0
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_deleted 0
|
||||
Handler_read_rnd_next 22
|
||||
set @@expensive_subquery_limit= default;
|
||||
EXPLAIN
|
||||
SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
|
||||
FROM t2 alias1, t1 alias2, t1 alias3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
|
||||
1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
|
||||
1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
|
||||
flush status;
|
||||
SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
|
||||
FROM t2 alias1, t1 alias2, t1 alias3;
|
||||
(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
show status like "subquery_cache%";
|
||||
Variable_name Value
|
||||
Subquery_cache_hit 0
|
||||
Subquery_cache_miss 0
|
||||
show status like '%Handler_read%';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
Handler_read_key 0
|
||||
Handler_read_last 0
|
||||
Handler_read_next 0
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_deleted 0
|
||||
Handler_read_rnd_next 16
|
||||
drop table t1, t2, t3;
|
||||
#
|
||||
# MDEV-288 CHEAP SQ: Valgrind warnings "Memory lost" with IN and EXISTS nested subquery, materialization+semijoin
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (0),(8);
|
||||
CREATE TABLE t2 (b INT PRIMARY KEY);
|
||||
INSERT INTO t2 VALUES (1),(2);
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1));
|
||||
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 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
3 SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||
SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1));
|
||||
a
|
||||
drop table t1,t2;
|
||||
# return optimizer switch changed in the beginning of this test
|
||||
set optimizer_switch=@subselect_tmp;
|
||||
set @optimizer_switch_for_subselect_test=null;
|
||||
|
@ -879,7 +879,7 @@ EXPLAIN
|
||||
SELECT * FROM t1 WHERE (6, 4 ) NOT IN (SELECT b, a FROM t2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
|
||||
SELECT * FROM t1 WHERE (6, 4 ) NOT IN (SELECT b, a FROM t2);
|
||||
c
|
||||
0
|
||||
@ -888,7 +888,7 @@ EXPLAIN
|
||||
SELECT * FROM t1 WHERE (6, 4 ) NOT IN (SELECT a, b FROM t2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
|
||||
SELECT * FROM t1 WHERE (6, 4 ) NOT IN (SELECT a, b FROM t2);
|
||||
c
|
||||
0
|
||||
@ -913,7 +913,7 @@ set @@optimizer_switch='in_to_exists=on,materialization=off';
|
||||
EXPLAIN SELECT * FROM t2 WHERE ( 3 , 1 ) NOT IN ( SELECT f1 , f2 FROM t1 );
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 system NULL NULL NULL NULL 1
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where
|
||||
SELECT * FROM t2 WHERE ( 3 , 1 ) NOT IN ( SELECT f1 , f2 FROM t1 );
|
||||
f3
|
||||
5
|
||||
|
@ -2753,4 +2753,18 @@ AND ( alias1.a1, alias2.a1 ) IN ( SELECT c1, c1 FROM t3 )
|
||||
GROUP BY field1;
|
||||
field1
|
||||
DROP TABLE t1,t3,t2;
|
||||
#
|
||||
# BUG#1002630: Valgrind warnings 'Invalid read' in subselect_engine::calc_const_tables with SELECT
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (1),(7);
|
||||
CREATE TABLE t2 (b INT);
|
||||
INSERT INTO t2 VALUES (4),(6);
|
||||
SELECT ( SELECT SUM(a) FROM t1 ) AS t1sum, b
|
||||
FROM t2
|
||||
WHERE (1,1) IN ( SELECT MAX(a), MIN(a) FROM t1 )
|
||||
GROUP BY b
|
||||
HAVING t1sum <> 1;
|
||||
t1sum b
|
||||
DROP TABLE t1, t2;
|
||||
set optimizer_switch=@subselect_sj_tmp;
|
||||
|
@ -2767,6 +2767,20 @@ AND ( alias1.a1, alias2.a1 ) IN ( SELECT c1, c1 FROM t3 )
|
||||
GROUP BY field1;
|
||||
field1
|
||||
DROP TABLE t1,t3,t2;
|
||||
#
|
||||
# BUG#1002630: Valgrind warnings 'Invalid read' in subselect_engine::calc_const_tables with SELECT
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (1),(7);
|
||||
CREATE TABLE t2 (b INT);
|
||||
INSERT INTO t2 VALUES (4),(6);
|
||||
SELECT ( SELECT SUM(a) FROM t1 ) AS t1sum, b
|
||||
FROM t2
|
||||
WHERE (1,1) IN ( SELECT MAX(a), MIN(a) FROM t1 )
|
||||
GROUP BY b
|
||||
HAVING t1sum <> 1;
|
||||
t1sum b
|
||||
DROP TABLE t1, t2;
|
||||
set optimizer_switch=@subselect_sj_tmp;
|
||||
#
|
||||
# BUG#49129: Wrong result with IN-subquery with join_cache_level=6 and firstmatch=off
|
||||
|
@ -1197,8 +1197,8 @@ set @@optimizer_switch=@optimizer_switch_local_default;
|
||||
set @@optimizer_switch='materialization=off,in_to_exists=on';
|
||||
explain select min(a1) from t1 where 7 in (select max(b1) from t2 group by b1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 1
|
||||
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
select min(a1) from t1 where 7 in (select max(b1) from t2 group by b1);
|
||||
min(a1)
|
||||
NULL
|
||||
@ -1206,8 +1206,8 @@ set @@optimizer_switch=@optimizer_switch_local_default;
|
||||
set @@optimizer_switch='semijoin=off';
|
||||
explain select min(a1) from t1 where 7 in (select b1 from t2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 1
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
select min(a1) from t1 where 7 in (select b1 from t2);
|
||||
min(a1)
|
||||
NULL
|
||||
@ -1223,8 +1223,8 @@ NULL
|
||||
# but when we go around MWL#90 code, the problem still shows up:
|
||||
explain select min(a1) from t1 where 7 in (select b1 from t2) or 2> 4;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 1
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
select min(a1) from t1 where 7 in (select b1 from t2) or 2> 4;
|
||||
min(a1)
|
||||
NULL
|
||||
@ -1971,7 +1971,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 1
|
||||
1 PRIMARY t2 index c c 5 NULL 8 Using index
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1
|
||||
2 MATERIALIZED s2 ref d d 4 const 1 Using where; Using index
|
||||
2 MATERIALIZED s2 ref d d 4 const 2 Using where; Using index
|
||||
2 MATERIALIZED s1 ALL c NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
|
||||
3 SUBQUERY t2 ALL NULL NULL NULL NULL 8
|
||||
SELECT a, c FROM t1, t2
|
||||
@ -1991,8 +1991,8 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 1
|
||||
1 PRIMARY t2 index c c 5 NULL 8 Using index
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1
|
||||
2 MATERIALIZED s2 ref d d 4 const 1 Using where; Using index
|
||||
2 MATERIALIZED s1 hash_ALL c #hash#$hj 10 const,test.s2.d 8 Using where; Using join buffer (flat, BNLH join)
|
||||
2 MATERIALIZED s2 ref d d 4 const 2 Using where; Using index
|
||||
2 MATERIALIZED s1 hash_ALL c #hash#$hj 5 const 8 Using where; Using join buffer (flat, BNLH join)
|
||||
3 SUBQUERY t2 ALL NULL NULL NULL NULL 8
|
||||
SELECT a, c FROM t1, t2
|
||||
WHERE (a, c) IN (SELECT s1.b, s1.c FROM t2 AS s1, t2 AS s2
|
||||
|
@ -339,3 +339,17 @@ select @a;
|
||||
@a
|
||||
0111-01-01
|
||||
#
|
||||
#
|
||||
# BUG LP:1008487 virtual bool Item_cache::is_expensive(): Assertion `example' failed
|
||||
#
|
||||
create table t1(a date,key(a));
|
||||
insert into t1 values ('2012-01-01'),('2012-02-02');
|
||||
explain
|
||||
select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1_0 ref a a 4 const 0 Using where; Using index
|
||||
1 SIMPLE t2 index NULL a 4 NULL 2 Using index; Using join buffer (flat, BNL join)
|
||||
1 SIMPLE t1 index NULL a 4 NULL 2 Using index; Using join buffer (incremental, BNL join)
|
||||
select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1;
|
||||
1
|
||||
drop table t1;
|
||||
|
@ -1845,3 +1845,20 @@ dev
|
||||
SELECT(SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev;
|
||||
dev
|
||||
1
|
||||
#
|
||||
# LP bug#1010729: Unexpected syntax error from UNION
|
||||
# (bug #54382) with single-table join nest
|
||||
#
|
||||
CREATE TABLE t1 (a int);
|
||||
CREATE TABLE t2 (b int);
|
||||
CREATE TABLE t3 (c int);
|
||||
SELECT a FROM t1 UNION SELECT b FROM t2 JOIN (t3) ON ( t2.b = t3.c );
|
||||
a
|
||||
DROP TABLE t1, t2, t3;
|
||||
CREATE TABLE t1 (pk int NOT NULL);
|
||||
CREATE TABLE t2 (pk int NOT NULL, fk int NOT NULL);
|
||||
SELECT t1.pk FROM t1 LEFT JOIN (t2) ON (t1.pk = t2.fk)
|
||||
UNION
|
||||
SELECT t1.pk FROM t1 LEFT JOIN (t2) ON (t1.pk = t2.fk);
|
||||
pk
|
||||
DROP TABLE t1,t2;
|
||||
|
@ -454,6 +454,13 @@ SELECT (@v:=a) <> (@v:=1) FROM t1;
|
||||
(@v:=a) <> (@v:=1)
|
||||
1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(a int);
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
SELECT DISTINCT @a:=MIN(t1.a) FROM t1, t1 AS t2
|
||||
GROUP BY @b:=(SELECT COUNT(*) > t2.a);
|
||||
@a:=MIN(t1.a)
|
||||
1
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1(f1 INT AUTO_INCREMENT, PRIMARY KEY(f1));
|
||||
|
@ -4324,13 +4324,13 @@ MM
|
||||
ZZ
|
||||
ZZ
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: 'VV'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'VV'
|
||||
EXPLAIN EXTENDED
|
||||
SELECT * FROM v1 WHERE a > 'JJ' OR a AND a = 'VV';
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 range a a 13 NULL 4 100.00 Using where; Using index
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: 'VV'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'VV'
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > 'JJ')
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
|
@ -22,3 +22,7 @@ ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) fo
|
||||
**** Clean up ****
|
||||
set global binlog_format = @saved_binlog_format;
|
||||
drop user mysqltest_1@localhost;
|
||||
GRANT REPLICATION CLIENT ON *.* TO 'mysqltest_1'@'localhost';
|
||||
SHOW MASTER LOGS;
|
||||
SHOW BINARY LOGS;
|
||||
DROP USER 'mysqltest_1'@'localhost';
|
||||
|
30
mysql-test/suite/binlog/r/binlog_mdev342.result
Normal file
30
mysql-test/suite/binlog/r/binlog_mdev342.result
Normal file
@ -0,0 +1,30 @@
|
||||
SET GLOBAL max_binlog_size= 4096;
|
||||
SET GLOBAL innodb_flush_log_at_trx_commit= 1;
|
||||
RESET MASTER;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb;
|
||||
SET DEBUG_SYNC= "binlog_open_before_update_index SIGNAL con1_ready WAIT_FOR con1_cont";
|
||||
SET SESSION debug_dbug="+d,crash_create_critical_before_update_index";
|
||||
INSERT INTO t1 VALUES (1, REPEAT("x", 4100));
|
||||
SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
|
||||
SET DEBUG_SYNC= "ha_commit_trans_after_prepare SIGNAL con2_ready";
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
SET DEBUG_SYNC= "now WAIT_FOR con2_ready";
|
||||
SET DEBUG_SYNC= "now SIGNAL con1_cont";
|
||||
Got one of the listed errors
|
||||
SELECT a FROM t1 ORDER BY a;
|
||||
a
|
||||
1
|
||||
show binary logs;
|
||||
Log_name File_size
|
||||
master-bin.000001 #
|
||||
master-bin.000002 #
|
||||
show binlog events in 'master-bin.000001' from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Rotate # # master-bin.000002;pos=<binlog_start>
|
||||
DROP TABLE t1;
|
@ -54,3 +54,22 @@ disconnect root;
|
||||
connection default;
|
||||
set global binlog_format = @saved_binlog_format;
|
||||
drop user mysqltest_1@localhost;
|
||||
|
||||
|
||||
# Testing if REPLICATION CLIENT privilege is enough to execute
|
||||
# SHOW MASTER LOGS and SHOW BINARY.
|
||||
GRANT REPLICATION CLIENT ON *.* TO 'mysqltest_1'@'localhost';
|
||||
--connect(rpl,localhost,mysqltest_1,,)
|
||||
|
||||
--connection rpl
|
||||
# We are only interested if the following commands succeed and not on
|
||||
# their output.
|
||||
--disable_result_log
|
||||
SHOW MASTER LOGS;
|
||||
SHOW BINARY LOGS;
|
||||
--enable_result_log
|
||||
|
||||
# clean up
|
||||
--disconnect rpl
|
||||
connection default;
|
||||
DROP USER 'mysqltest_1'@'localhost';
|
||||
|
1
mysql-test/suite/binlog/t/binlog_mdev342-master.opt
Normal file
1
mysql-test/suite/binlog/t/binlog_mdev342-master.opt
Normal file
@ -0,0 +1 @@
|
||||
--skip-stack-trace --skip-core-file
|
66
mysql-test/suite/binlog/t/binlog_mdev342.test
Normal file
66
mysql-test/suite/binlog/t/binlog_mdev342.test
Normal file
@ -0,0 +1,66 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_debug.inc
|
||||
--source include/have_debug_sync.inc
|
||||
--source include/have_binlog_format_row.inc
|
||||
# Valgrind does not work well with test that crashes the server
|
||||
--source include/not_valgrind.inc
|
||||
|
||||
# (We do not need to restore these settings, as we crash the server).
|
||||
SET GLOBAL max_binlog_size= 4096;
|
||||
SET GLOBAL innodb_flush_log_at_trx_commit= 1;
|
||||
RESET MASTER;
|
||||
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb;
|
||||
|
||||
# One connection does an insert that causes a binlog rotate.
|
||||
# The rotate is paused after writing new file but before updating index.
|
||||
connect(con1,localhost,root,,);
|
||||
SET DEBUG_SYNC= "binlog_open_before_update_index SIGNAL con1_ready WAIT_FOR con1_cont";
|
||||
SET SESSION debug_dbug="+d,crash_create_critical_before_update_index";
|
||||
send INSERT INTO t1 VALUES (1, REPEAT("x", 4100));
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
|
||||
|
||||
# Another connection creates a prepared transaction.
|
||||
# After the transaction is prepared, it will hang waiting for LOCK_log.
|
||||
connect(con2,localhost,root,,);
|
||||
SET DEBUG_SYNC= "ha_commit_trans_after_prepare SIGNAL con2_ready";
|
||||
send INSERT INTO t1 VALUES (2, NULL);
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC= "now WAIT_FOR con2_ready";
|
||||
|
||||
# Now crash the server in con1, with old binlog closed, new binlog not yet in
|
||||
# index, and one transaction in prepared-but-not-committed state.
|
||||
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
wait-binlog_mdev342.test
|
||||
EOF
|
||||
# If con1 manages to race ahead and crash, we can see the crash already in the
|
||||
# SET DEBUG_SYNC statement, so need --error here also.
|
||||
--error 0,2006,2013
|
||||
SET DEBUG_SYNC= "now SIGNAL con1_cont";
|
||||
connection con1;
|
||||
--error 2006,2013
|
||||
reap;
|
||||
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
restart-binlog_mdev342.test
|
||||
EOF
|
||||
|
||||
connection default;
|
||||
--enable_reconnect
|
||||
--source include/wait_until_connected_again.inc
|
||||
|
||||
# Check that all transactions are recovered.
|
||||
SELECT a FROM t1 ORDER BY a;
|
||||
|
||||
--source include/show_binary_logs.inc
|
||||
--let $binlog_file= master-bin.000001
|
||||
--let $binlog_start= 4
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
# Cleanup
|
||||
connection default;
|
||||
DROP TABLE t1;
|
6
mysql-test/suite/innodb/r/innodb_bug12902967.result
Normal file
6
mysql-test/suite/innodb/r/innodb_bug12902967.result
Normal file
@ -0,0 +1,6 @@
|
||||
create table t1 (f1 integer primary key) engine innodb;
|
||||
alter table t1 add constraint c1 foreign key (f1) references t1(f1);
|
||||
ERROR HY000: Error on rename of '#sql-temporary' to './test/t1' (errno: 150)
|
||||
InnoDB: has or is referenced in foreign key constraints
|
||||
InnoDB: which are not compatible with the new table definition.
|
||||
drop table t1;
|
56
mysql-test/suite/innodb/r/innodb_bug14007649.result
Normal file
56
mysql-test/suite/innodb/r/innodb_bug14007649.result
Normal file
@ -0,0 +1,56 @@
|
||||
create table t1 (
|
||||
rowid int,
|
||||
f1 int,
|
||||
f2 int,
|
||||
key i1 (f1, f2),
|
||||
key i2 (f2)) engine=innodb;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`rowid` int(11) DEFAULT NULL,
|
||||
`f1` int(11) DEFAULT NULL,
|
||||
`f2` int(11) DEFAULT NULL,
|
||||
KEY `i1` (`f1`,`f2`),
|
||||
KEY `i2` (`f2`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
insert into `t1` (rowid, f1, f2) values (1, 1, 10), (2, 1, NULL);
|
||||
start transaction with consistent snapshot;
|
||||
start transaction;
|
||||
update t1 set f2 = 4 where f1 = 1 and f2 is null;
|
||||
(b) Number of rows updated:
|
||||
select row_count();
|
||||
row_count()
|
||||
1
|
||||
insert into t1 values (3, 1, null);
|
||||
(b) After update and insert query.
|
||||
select rowid, f1, f2 from t1;
|
||||
rowid f1 f2
|
||||
1 1 10
|
||||
2 1 4
|
||||
3 1 NULL
|
||||
commit;
|
||||
(a) Before the update statement is executed.
|
||||
select rowid, f1, f2 from t1;
|
||||
rowid f1 f2
|
||||
1 1 10
|
||||
2 1 NULL
|
||||
SET SESSION debug_dbug="+d,bug14007649";
|
||||
update t1 set f2 = 6 where f1 = 1 and f2 is null;
|
||||
(a) Number of rows updated:
|
||||
select row_count();
|
||||
row_count()
|
||||
1
|
||||
(a) After the update statement is executed.
|
||||
select rowid, f1, f2 from t1;
|
||||
rowid f1 f2
|
||||
1 1 10
|
||||
2 1 NULL
|
||||
3 1 6
|
||||
commit;
|
||||
"The trx with consistent snapshot ended."
|
||||
select rowid, f1, f2 from t1;
|
||||
rowid f1 f2
|
||||
1 1 10
|
||||
2 1 4
|
||||
3 1 6
|
||||
drop table t1;
|
@ -4,11 +4,6 @@
|
||||
|
||||
--source include/have_innodb.inc
|
||||
|
||||
if (`select plugin_auth_version <= "1.1.8-24.1" from information_schema.plugins where plugin_name='innodb'`)
|
||||
{
|
||||
--skip Not fixed in XtraDB 1.1.8-24.1 or earlier
|
||||
}
|
||||
|
||||
# DEBUG_SYNC must be compiled in.
|
||||
--source include/have_debug_sync.inc
|
||||
|
||||
|
@ -1,10 +1,5 @@
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
if (`select plugin_auth_version <= "1.0.17-13.0" from information_schema.plugins where plugin_name='innodb'`)
|
||||
{
|
||||
--skip Not fixed in XtraDB 1.0.17-13.0 or earlier
|
||||
}
|
||||
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
|
||||
let $per_table=`select @@innodb_file_per_table`;
|
||||
|
@ -1,10 +1,5 @@
|
||||
--source include/have_innodb.inc
|
||||
|
||||
if (`select plugin_auth_version <= "1.0.17-13.0" from information_schema.plugins where plugin_name='innodb'`)
|
||||
{
|
||||
--skip Not fixed in XtraDB 1.0.17-13.0 or earlier
|
||||
}
|
||||
|
||||
#
|
||||
# Check and select innodb lock type
|
||||
#
|
||||
|
30
mysql-test/suite/innodb/t/innodb_bug12902967.test
Normal file
30
mysql-test/suite/innodb/t/innodb_bug12902967.test
Normal file
@ -0,0 +1,30 @@
|
||||
# Bug 12902967: Creating self referencing fk on same index unhandled,
|
||||
# confusing error
|
||||
#
|
||||
# Creating a self referencing foreign key on the same
|
||||
# column/index is an unhandled exception, it should throw a sensible
|
||||
# error but instead implies that your data dictionary may now be out
|
||||
# of sync:
|
||||
|
||||
--source include/have_innodb.inc
|
||||
--source include/not_embedded.inc
|
||||
|
||||
let error_log= $MYSQLTEST_VARDIR/log/mysqld.1.err;
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
create table t1 (f1 integer primary key) engine innodb;
|
||||
|
||||
# The below statement should produce error message in error log.
|
||||
# This error message should mention problem with foreign keys
|
||||
# rather than with data dictionary.
|
||||
--replace_regex /'\.\/test\/#sql-[0-9a-f_]*'/'#sql-temporary'/
|
||||
--error ER_ERROR_ON_RENAME
|
||||
alter table t1 add constraint c1 foreign key (f1) references t1(f1);
|
||||
--source include/restart_mysqld.inc
|
||||
perl;
|
||||
$file = $ENV{error_log};
|
||||
open (FILE, '<', $file) or die "can't open(< $file): $!\n";
|
||||
print ((grep { /^InnoDB:/ and not /aio/i } <FILE>)[-2..-1]);
|
||||
EOF
|
||||
|
||||
drop table t1;
|
@ -2,11 +2,6 @@
|
||||
--source include/have_debug_sync.inc
|
||||
--source include/not_embedded.inc
|
||||
|
||||
if (`select plugin_auth_version <= "1.1.8-24.1" from information_schema.plugins where plugin_name='innodb'`)
|
||||
{
|
||||
--skip Not fixed in XtraDB 1.1.8-24.1 or earlier
|
||||
}
|
||||
|
||||
SET DEBUG_SYNC='reset';
|
||||
|
||||
# Save the initial number of concurrent sessions
|
||||
|
63
mysql-test/suite/innodb/t/innodb_bug14007649.test
Normal file
63
mysql-test/suite/innodb/t/innodb_bug14007649.test
Normal file
@ -0,0 +1,63 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_debug.inc
|
||||
|
||||
if (`select plugin_auth_version <= "1.1.8-26.0" from information_schema.plugins where plugin_name='innodb'`)
|
||||
{
|
||||
--skip Not fixed in XtraDB 1.1.8-26.0 or earlier
|
||||
}
|
||||
|
||||
create table t1 (
|
||||
rowid int,
|
||||
f1 int,
|
||||
f2 int,
|
||||
key i1 (f1, f2),
|
||||
key i2 (f2)) engine=innodb;
|
||||
|
||||
show create table t1;
|
||||
insert into `t1` (rowid, f1, f2) values (1, 1, 10), (2, 1, NULL);
|
||||
|
||||
connect (a,localhost,root,,);
|
||||
connect (b,localhost,root,,);
|
||||
|
||||
connection a;
|
||||
start transaction with consistent snapshot;
|
||||
|
||||
connection b;
|
||||
start transaction;
|
||||
update t1 set f2 = 4 where f1 = 1 and f2 is null;
|
||||
|
||||
-- echo (b) Number of rows updated:
|
||||
select row_count();
|
||||
|
||||
insert into t1 values (3, 1, null);
|
||||
|
||||
-- echo (b) After update and insert query.
|
||||
select rowid, f1, f2 from t1;
|
||||
|
||||
commit;
|
||||
|
||||
connection a;
|
||||
|
||||
-- echo (a) Before the update statement is executed.
|
||||
select rowid, f1, f2 from t1;
|
||||
|
||||
SET SESSION debug_dbug="+d,bug14007649";
|
||||
update t1 set f2 = 6 where f1 = 1 and f2 is null;
|
||||
|
||||
-- echo (a) Number of rows updated:
|
||||
select row_count();
|
||||
|
||||
-- echo (a) After the update statement is executed.
|
||||
select rowid, f1, f2 from t1;
|
||||
|
||||
commit;
|
||||
|
||||
--echo "The trx with consistent snapshot ended."
|
||||
|
||||
select rowid, f1, f2 from t1;
|
||||
|
||||
connection default;
|
||||
disconnect a;
|
||||
disconnect b;
|
||||
|
||||
drop table t1;
|
@ -167,7 +167,7 @@ WHERE ts BETWEEN '0000-00-00' AND '2010-00-01 00:00:00'
|
||||
ORDER BY ts DESC
|
||||
LIMIT 2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 4 Using index condition
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 4 Using where
|
||||
|
||||
DROP TABLE t1;
|
||||
#
|
||||
@ -841,5 +841,21 @@ Variable_name Value
|
||||
Handler_icp_attempts 2
|
||||
Handler_icp_match 1
|
||||
DROP TABLE t1;
|
||||
create table t1 (a int,b char(5),primary key (a), key (b(1)));
|
||||
insert into t1 values ('a','b');
|
||||
Warnings:
|
||||
Warning 1366 Incorrect integer value: 'a' for column 'a' at row 1
|
||||
select 1 from t1 where a and b >= 'aa';
|
||||
1
|
||||
drop table t1;
|
||||
#
|
||||
# Bug#58015 "Assert in row_sel_field_store_in_mysql_format
|
||||
# when running innodb_mrr_icp test"
|
||||
#
|
||||
create table t1 (a char(2) charset utf8,b double, primary key (a(1)),key (b));
|
||||
insert into t1 values ('',1);
|
||||
select 1 from t1 where b <= 1 and a <> '';
|
||||
1
|
||||
drop table t1;
|
||||
set storage_engine= @save_storage_engine;
|
||||
set optimizer_switch=@maria_icp_tmp;
|
||||
|
@ -306,6 +306,10 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
SELECT fid, AsText(g) FROM t2 WHERE Within(g,
|
||||
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
|
||||
fid AsText(g)
|
||||
45 LINESTRING(51 51,60 60)
|
||||
46 LINESTRING(51 41,60 50)
|
||||
55 LINESTRING(41 51,50 60)
|
||||
56 LINESTRING(41 41,50 50)
|
||||
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10)))));
|
||||
SELECT count(*) FROM t2;
|
||||
count(*)
|
||||
|
@ -306,6 +306,10 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
SELECT fid, AsText(g) FROM t2 WHERE Within(g,
|
||||
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
|
||||
fid AsText(g)
|
||||
45 LINESTRING(51 51,60 60)
|
||||
46 LINESTRING(51 41,60 50)
|
||||
55 LINESTRING(41 51,50 60)
|
||||
56 LINESTRING(41 41,50 50)
|
||||
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10)))));
|
||||
SELECT count(*) FROM t2;
|
||||
count(*)
|
||||
|
@ -306,6 +306,10 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
SELECT fid, AsText(g) FROM t2 WHERE Within(g,
|
||||
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
|
||||
fid AsText(g)
|
||||
45 LINESTRING(51 51,60 60)
|
||||
46 LINESTRING(51 41,60 50)
|
||||
55 LINESTRING(41 51,50 60)
|
||||
56 LINESTRING(41 41,50 50)
|
||||
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10)))));
|
||||
SELECT count(*) FROM t2;
|
||||
count(*)
|
||||
|
@ -1,3 +1,5 @@
|
||||
percona_sync_flush: removed from XtraDB-26.0
|
||||
|
||||
percona_suppress_log_warning_1592: Feature not merged into MariaDB
|
||||
percona_log_slow_slave_statements: Feature not merged into MariaDB
|
||||
percona_log_slow_slave_statements-and-use_global_long_query_time: Feature not merged into MariaDB
|
||||
|
41
mysql-test/suite/rpl/r/rpl_auto_increment_bug45679.result
Normal file
41
mysql-test/suite/rpl/r/rpl_auto_increment_bug45679.result
Normal file
@ -0,0 +1,41 @@
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.');
|
||||
create table tm (b int auto_increment, a int, primary key (a,b)) engine= myisam;
|
||||
create table ti (b int auto_increment, a int, primary key (a,b)) engine= innodb;
|
||||
ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
|
||||
create table ti (b int auto_increment, a int, primary key (b,a)) engine= innodb;
|
||||
set @@binlog_format=statement;
|
||||
*** autoincrement field is not the first in PK warning must be there: ***
|
||||
insert into tm set b=null, a=1;
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT into autoincrement field which is not the first part in the composed primary key is unsafe.
|
||||
show warnings;
|
||||
Level Code Message
|
||||
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT into autoincrement field which is not the first part in the composed primary key is unsafe.
|
||||
*** no warning when autoincrement is the first in PK
|
||||
insert into ti set b=null, a=1;
|
||||
show warnings;
|
||||
Level Code Message
|
||||
create function multi_part_pk_with_autoinc (arg int)
|
||||
returns int
|
||||
begin
|
||||
insert into tm set b=null, a=arg;
|
||||
return arg;
|
||||
end//
|
||||
select multi_part_pk_with_autoinc (3);
|
||||
multi_part_pk_with_autoinc (3)
|
||||
3
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
|
||||
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT into autoincrement field which is not the first part in the composed primary key is unsafe.
|
||||
*** autoincrement field is not the first in PK warning must be there: ***
|
||||
show warnings;
|
||||
Level Code Message
|
||||
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
|
||||
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT into autoincrement field which is not the first part in the composed primary key is unsafe.
|
||||
set @@binlog_format=mixed;
|
||||
insert into tm set b=null, a=2;
|
||||
drop table tm, ti;
|
||||
drop function multi_part_pk_with_autoinc;
|
||||
include/rpl_end.inc
|
@ -114,4 +114,23 @@ id c
|
||||
3 3
|
||||
[on master]
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
CREATE TABLE test.t5 (a INT AUTO_INCREMENT PRIMARY KEY, b INT, c INT);
|
||||
CREATE TABLE test.t1 (a INT);
|
||||
INSERT INTO test.t1 VALUES(1);
|
||||
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
|
||||
CREATE TABLE test.t_slave (a INT AUTO_INCREMENT PRIMARY KEY, b INT, c INT);
|
||||
CREATE TRIGGER t1_update AFTER UPDATE ON test.t1 FOR EACH ROW
|
||||
INSERT INTO test.t_slave VALUES(NULL, ROUND(RAND() * 1000), @c);
|
||||
SET INSERT_ID=2;
|
||||
SET @c=2;
|
||||
SET @@rand_seed1=10000000, @@rand_seed2=1000000;
|
||||
INSERT INTO t5 VALUES (NULL, ROUND(RAND() * 1000), @c);
|
||||
SELECT b into @b FROM test.t5;
|
||||
UPDATE test.t1 SET a=2;
|
||||
SELECT a AS 'ONE' into @a FROM test.t_slave;
|
||||
SELECT c AS 'NULL' into @c FROM test.t_slave;
|
||||
SELECT b into @b FROM test.t_slave;
|
||||
drop table test.t5;
|
||||
drop table test.t1;
|
||||
drop table test.t_slave;
|
||||
include/rpl_end.inc
|
||||
|
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