bzr merge -rtag:mariadb-10.0.12 maria/10.0

This commit is contained in:
Nirbhay Choubey 2014-06-19 13:12:38 -04:00
commit a76a6601ec
379 changed files with 15201 additions and 8280 deletions

View File

@ -1468,3 +1468,5 @@ storage/connect/connect.cnf
storage/cassandra/cassandra.cnf
libmysql/libmysql_versions.ld
scripts/mysql_config.pl
pcre/pcre_chartables.c
pcre/test*grep

View File

@ -61,6 +61,7 @@ IF(UNIX AND NOT APPLE)
# Compiling with PIC speeds up embedded build, on PIC sensitive systems
# Predefine it to OFF in release builds, because of the performance penalty
SET(WITH_PIC ${WITH_PIC_DEFAULT} CACHE BOOL "Compile with PIC.")
MARK_AS_ADVANCED(WITH_PIC)
ENDIF()
# Optionally set project name, e.g.
@ -266,6 +267,10 @@ IF (ENABLE_GCOV AND NOT WIN32 AND NOT APPLE)
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage -lgcov")
ENDIF()
MY_CHECK_C_COMPILER_FLAG(-ggdb3 HAVE_GGDB3)
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb3")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ggdb3")
OPTION(ENABLED_LOCAL_INFILE
"If we should should enable LOAD DATA LOCAL by default" ${IF_WIN})
MARK_AS_ADVANCED(ENABLED_LOCAL_INFILE)
@ -487,7 +492,7 @@ ADD_CUSTOM_TARGET(INFO_BIN ALL
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
INSTALL_DOCUMENTATION(README TODO CREDITS COPYING COPYING.LESSER
INSTALL_DOCUMENTATION(README CREDITS COPYING COPYING.LESSER EXCEPTIONS-CLIENT
COMPONENT Readme)
INSTALL_DOCUMENTATION(${CMAKE_BINARY_DIR}/Docs/INFO_SRC
${CMAKE_BINARY_DIR}/Docs/INFO_BIN)

136
EXCEPTIONS-CLIENT Normal file
View File

@ -0,0 +1,136 @@
FOSS License Exception
http://www.mysql.com/about/legal/licensing/foss-exception/
Updated February 23, 2012
What is the FOSS License Exception?
Oracle's Free and Open Source Software ("FOSS") License Exception
(formerly known as the FLOSS License Exception) allows developers of FOSS
applications to include Oracle's MySQL Client Libraries (also referred to
as "MySQL Drivers" or "MySQL Connectors") with their FOSS applications.
MySQL Client Libraries are typically licensed pursuant to version 2 of the
General Public License ("GPL"), but this exception permits distribution of
certain MySQL Client Libraries with a developer's FOSS applications
licensed under the terms of another FOSS license listed below, even though
such other FOSS license may be incompatible with the GPL.
The following terms and conditions describe the circumstances under which
Oracle's FOSS License Exception applies.
Oracle's FOSS License Exception Terms and Conditions
1. Definitions. "Derivative Work" means a derivative work, as defined
under applicable copyright law, formed entirely from the Program and
one or more FOSS Applications.
"FOSS Application" means a free and open source software application
distributed subject to a license listed in the section below titled
"FOSS License List."
"FOSS Notice" means a notice placed by Oracle or MySQL in a copy of
the MySQL Client Libraries stating that such copy of the MySQL Client
Libraries may be distributed under Oracle's or MySQL's FOSS (or FLOSS)
License Exception.
"Independent Work" means portions of the Derivative Work that are not
derived from the Program and can reasonably be considered independent
and separate works.
"Program" means a copy of Oracle's MySQL Client Libraries that
contains a FOSS Notice.
2. A FOSS application developer ("you" or "your") may distribute a
Derivative Work provided that you and the Derivative Work meet all of
the following conditions:
a. You obey the GPL in all respects for the Program and all portions
(including modifications) of the Program included in the
Derivative Work (provided that this condition does not apply to
Independent Works);
b. The Derivative Work does not include any work licensed under the
GPL other than the Program;
c. You distribute Independent Works subject to a license listed in
the section below titled "FOSS License List";
d. You distribute Independent Works in object code or executable
form with the complete corresponding machine-readable source code
on the same medium and under the same FOSS license applying to
the object code or executable forms;
e. All works that are aggregated with the Program or the Derivative
Work on a medium or volume of storage are not derivative works of
the Program, Derivative Work or FOSS Application, and must
reasonably be considered independent and separate works.
3. Oracle reserves all rights not expressly granted in these terms and
conditions. If all of the above conditions are not met, then this FOSS
License Exception does not apply to you or your Derivative Work.
FOSS License List
+------------------------------------------------------------------------+
|License Name |Version(s)/Copyright Date|
|----------------------------------------------+-------------------------|
|Academic Free License |2.0 |
|----------------------------------------------+-------------------------|
|Apache Software License |1.0/1.1/2.0 |
|----------------------------------------------+-------------------------|
|Apple Public Source License |2.0 |
|----------------------------------------------+-------------------------|
|Artistic license |From Perl 5.8.0 |
|----------------------------------------------+-------------------------|
|BSD license |"July 22 1999" |
|----------------------------------------------+-------------------------|
|Common Development and Distribution License |1.0 |
|(CDDL) | |
|----------------------------------------------+-------------------------|
|Common Public License |1.0 |
|----------------------------------------------+-------------------------|
|Eclipse Public License |1.0 |
|----------------------------------------------+-------------------------|
|European Union Public License (EUPL)¹ |1.1 |
|----------------------------------------------+-------------------------|
|GNU Affero General Public License (AGPL) |3.0 |
|----------------------------------------------+-------------------------|
|GNU Library or "Lesser" General Public License|2.0/2.1/3.0 |
|(LGPL) | |
|----------------------------------------------+-------------------------|
|GNU General Public License (GPL) |3.0 |
|----------------------------------------------+-------------------------|
|IBM Public License |1.0 |
|----------------------------------------------+-------------------------|
|Jabber Open Source License |1.0 |
|----------------------------------------------+-------------------------|
|MIT License (As listed in file |- |
|MIT-License.txt) | |
|----------------------------------------------+-------------------------|
|Mozilla Public License (MPL) |1.0/1.1 |
|----------------------------------------------+-------------------------|
|Open Software License |2.0 |
|----------------------------------------------+-------------------------|
|OpenSSL license (with original SSLeay license)|"2003" ("1998") |
|----------------------------------------------+-------------------------|
|PHP License |3.0/3.01 |
|----------------------------------------------+-------------------------|
|Python license (CNRI Python License) |- |
|----------------------------------------------+-------------------------|
|Python Software Foundation License |2.1.1 |
|----------------------------------------------+-------------------------|
|Sleepycat License |"1999" |
|----------------------------------------------+-------------------------|
|University of Illinois/NCSA Open Source |- |
|License | |
|----------------------------------------------+-------------------------|
|W3C License |"2001" |
|----------------------------------------------+-------------------------|
|X11 License |"2001" |
|----------------------------------------------+-------------------------|
|Zlib/libpng License |- |
|----------------------------------------------+-------------------------|
|Zope Public License |2.0 |
+------------------------------------------------------------------------+
¹) When an Independent Work is licensed under a "Compatible License"
pursuant to the EUPL, the Compatible License rather than the EUPL is the
applicable license for purposes of these FOSS License Exception Terms and
Conditions.

View File

@ -949,9 +949,13 @@ static int do_read_query_result(struct st_connection *cn)
{
DBUG_ASSERT(cn->has_thread);
wait_query_thread_done(cn);
if (cn->result)
goto exit_func;
signal_connection_thd(cn, EMB_READ_QUERY_RESULT);
wait_query_thread_done(cn);
exit_func:
return cn->result;
}

View File

@ -370,4 +370,5 @@ SET(HAVE_SYS_UTSNAME_H CACHE INTERNAL "")
SET(HAVE_PTHREAD_ATTR_GETGUARDSIZE CACHE INTERNAL "")
SET(HAVE_UCONTEXT_H CACHE INTERNAL "")
SET(HAVE_SOCKPEERCRED CACHE INTERNAL "")
ENDIF()
SET(HAVE_GGDB3 CACHE INTERNAL "")
ENDIF(MSVC)

View File

@ -30,6 +30,8 @@ TARGET_LINK_LIBRARIES(factorial dbug)
IF(NOT WIN32 AND NOT CMAKE_GENERATOR MATCHES Xcode)
FIND_PROGRAM(GROFF groff)
FIND_PROGRAM(NROFF nroff)
MARK_AS_ADVANCED(GROFF)
MARK_AS_ADVANCED(NROFF)
SET(OUTPUT_INC output1.r output2.r output3.r output4.r output5.r)
SET(SOURCE_INC factorial.r main.r example1.r example2.r example3.r)
ADD_CUSTOM_COMMAND(OUTPUT ${OUTPUT_INC}

View File

@ -1,16 +0,0 @@
.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
.SH NAME
msql2mysql \- MySQL importer for msql style data.
.SH SYNOPSIS
msql2mysql [options]
.SH DESCRIPTION
This program imports old msql database files.
For more information start the program with '--help'.
.SH "SEE ALSO"
mysql (1), mysqld (1)
.SH AUTHOR
This manpage was written by Christian Hammers <ch@debian.org>.
MySQL is available at http://www.mysql.com/.
.\" end of man page

View File

@ -1,16 +0,0 @@
.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
.SH NAME
my_print_defaults \- MySQL helper script that prints defaults.
.SH SYNOPSIS
my_print_defaults [options]
.SH DESCRIPTION
Prints all arguments that is give to some program using the default files.
For more information start the program with '--help'.
.SH "SEE ALSO"
mysql (1), mysqld (1)
.SH AUTHOR
This manpage was written by Christian Hammers <ch@debian.org>.
MySQL is available at http://www.mysql.com/.
.\" end of man page

View File

@ -1,16 +0,0 @@
.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
.SH NAME
myisam_ftdump \- Dumps full text tables.
.SH SYNOPSIS
myisam_ftdump [options]
.SH DESCRIPTION
Dumps information and contents of full text tables.
For more information start the program with '--help'.
.SH "SEE ALSO"
mysql (1), mysqld (1)
.SH AUTHOR
This manpage was written by Christian Hammers <ch@debian.org>.
MySQL is available at http://www.mysql.com/.
.\" end of man page

View File

@ -1,17 +0,0 @@
.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
.SH NAME
myisamchk \- Checks MySQL myisam type databases.
.SH SYNOPSIS
myisamchk [options]
.SH DESCRIPTION
Description, check and repair of ISAM tables.
Used without options all tables on the command will be checked for errors
For more information start the program with '--help'.
.SH "SEE ALSO"
mysql (1), mysqld (1)
.SH AUTHOR
This manpage was written by Christian Hammers <ch@debian.org>.
MySQL is available at http://www.mysql.com/.
.\" end of man page

View File

@ -1,16 +0,0 @@
.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
.SH NAME
myisamlog \- MySQL helper script.
.SH SYNOPSIS
myisamlog [options]
.SH DESCRIPTION
Function unknown. Mail to ch@debian.org.
For more information start the program with '--help'.
.SH "SEE ALSO"
mysql (1), mysqld (1)
.SH AUTHOR
This manpage was written by Christian Hammers <ch@debian.org>.
MySQL is available at http://www.mysql.com/.
.\" end of man page

View File

@ -1,19 +0,0 @@
.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
.SH NAME
myisampack \- Compresses MySQL database files.
.SH SYNOPSIS
myisampack [options]
.SH DESCRIPTION
Pack a MyISAM-table to take much less space.
Keys are not updated, you must run myisamchk -rq on the datafile
afterwards to update the keys.
You should give the .MYI file as the filename argument.
For more information start the program with '--help'.
.SH "SEE ALSO"
mysql (1), mysqld (1)
.SH AUTHOR
This manpage was written by Christian Hammers <ch@debian.org>.
MySQL is available at http://www.mysql.com/.
.\" end of man page

View File

@ -1,17 +0,0 @@
.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
.SH NAME
mysqlconfig \- MySQL compile settings.
.SH SYNOPSIS
mysqlconfig [options]
.SH DESCRIPTION
This program is only useful for people who want to compile agains
libmysqlclient.
For more information start the program with '--help'.
.SH "SEE ALSO"
mysql (1), mysqld (1)
.SH AUTHOR
This manpage was written by Christian Hammers <ch@debian.org>.
MySQL is available at http://www.mysql.com/.
.\" end of man page

View File

@ -1,17 +0,0 @@
.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
.SH NAME
mysql_convert_table_format \- MySQL table converter.
.SH SYNOPSIS
mysql_convert_table_format [options]
.SH DESCRIPTION
Conversion of a MySQL tables to other table types.
If no tables has been specifed, all tables in the database will be converted.
For more information start the program with '--help'.
.SH "SEE ALSO"
mysql (1), mysqld (1)
.SH AUTHOR
This manpage was written by Christian Hammers <ch@debian.org>.
MySQL is available at http://www.mysql.com/.
.\" end of man page

View File

@ -1,18 +0,0 @@
.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
.SH NAME
mysql_find_rows \- MySQL shell skript for searching in update logs.
.SH SYNOPSIS
mysql_find_rows [options]
.SH DESCRIPTION
Prints all SQL queries that matches a regexp or contains a 'use
database' or 'set ..' command to stdout. A SQL query may contain
newlines. This is useful to find things in a MySQL update log.
For more information start the program with '--help'.
.SH "SEE ALSO"
mysql (1), mysqld (1)
.SH AUTHOR
This manpage was written by Christian Hammers <ch@debian.org>.
MySQL is available at http://www.mysql.com/.
.\" end of man page

View File

@ -1,18 +0,0 @@
.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
.SH NAME
mysql_fix_extensions \- Corrects MySQL database file names.
.SH SYNOPSIS
mysql_fix_extensions <datadir>
.SH DESCRIPTION
Makes .frm lowercase and .MYI/MYD/ISM/ISD uppercase
useful when datafiles are copied from windows.
Does not work with RAID, with InnoDB or BDB tables.
For more information start the program with '--help'.
.SH "SEE ALSO"
mysql (1), mysqld (8)
.SH AUTHOR
This manpage was written by Christian Hammers <ch@debian.org>.
MySQL is available at http://www.mysql.com/.
.\" end of man page

View File

@ -1,16 +0,0 @@
.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
.SH NAME
mysql_install_db \- MySQL helper program.
.SH SYNOPSIS
mysql_install_db [options]
.SH DESCRIPTION
This program is normally not needed by any user.
For more information start the program with '--help'.
.SH "SEE ALSO"
mysql (1), mysqld (1)
.SH AUTHOR
This manpage was written by Christian Hammers <ch@debian.org>.
MySQL is available at http://www.mysql.com/.
.\" end of man page

View File

@ -1,17 +0,0 @@
.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
.SH NAME
mysql_secure_installation \- Secures the MySQL access control lists.
.SH SYNOPSIS
mysql_secure_installation [options]
.SH DESCRIPTION
This interactive programm suggests changes like removing anonymous users that
are supposed to make your installation more secure.
For more information start the program with '--help'.
.SH "SEE ALSO"
mysql (1), mysqld (8)
.SH AUTHOR
This manpage was written by Christian Hammers <ch@debian.org>.
MySQL is available at http://www.mysql.com/.
.\" end of man page

View File

@ -1,23 +0,0 @@
.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
.SH NAME
mysql_setpermission \- Adds MySQL users or changes passwords.
.SH SYNOPSIS
mysql_setpermission [options]
.SH DESCRIPTION
The permission setter is a little program which can help you add users
or databases or change passwords in MySQL. Keep in mind that we don't
check permissions which already been set in MySQL. So if you can't
connect to MySQL using the permission you just added, take a look at
the permissions which have already been set in MySQL.
The permission setter first reads your .my.cnf file in your Home
directory if it exists.
For more information start the program with '--help'.
.SH "SEE ALSO"
mysql (1), mysqld (1)
.SH AUTHOR
This manpage was written by Christian Hammers <ch@debian.org>.
MySQL is available at http://www.mysql.com/.
.\" end of man page

View File

@ -1,322 +0,0 @@
.\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sh \" Subsection heading
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. | will give a
.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
.\" expand to `' in nroff, nothing in troff, for use with C<>.
.tr \(*W-|\(bv\*(Tr
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
'br\}
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.\"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.hy 0
.if n .na
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "MYSQL_TABLEINFO 1"
.TH MYSQL_TABLEINFO 1 "2003-04-05" "perl v5.8.0" "User Contributed Perl Documentation"
.SH "NAME"
mysql_tableinfo \- creates and populates information tables with
the output of SHOW DATABASES, SHOW TABLES (or SHOW TABLE STATUS),
SHOW COLUMNS and SHOW INDEX.
.PP
This is version 1.1.
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\& mysql_tableinfo [OPTIONS] database_to_write [database_like_wild] [table_like_wild]
.Ve
.PP
.Vb 2
\& Do not backquote (``) database_to_write,
\& and do not quote ('') database_like_wild or table_like_wild
.Ve
.PP
.Vb 1
\& Examples:
.Ve
.PP
.Vb 1
\& mysql_tableinfo info
.Ve
.PP
.Vb 1
\& mysql_tableinfo info this_db
.Ve
.PP
.Vb 1
\& mysql_tableinfo info %a% b%
.Ve
.PP
.Vb 1
\& mysql_tableinfo info --clear-only
.Ve
.PP
.Vb 1
\& mysql_tableinfo info --col --idx --table-status
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
mysql_tableinfo asks a MySQL server information about its
databases, tables, table columns and index, and stores this
in tables called `db`, `tbl` (or `tbl_status`), `col`, `idx`
(with an optional prefix specified with \-\-prefix).
After that, you can query these information tables, for example
to build your admin scripts with \s-1SQL\s0 queries, like
.PP
\&\s-1SELECT\s0 \s-1CONCAT\s0(\*(L"\s-1CHECK\s0 \s-1TABLE\s0 \*(R",`database`,\*(L".\*(R",`table`,\*(L" \s-1EXTENDED\s0;\*(R")
\&\s-1FROM\s0 info.tbl \s-1WHERE\s0 ... ;
.PP
as people usually do with some other \s-1RDBMS\s0
(note: to increase the speed of your queries on the info tables,
you may add some index on them).
.PP
The database_like_wild and table_like_wild instructs the program
to gather information only about databases and tables
whose names match these patterns. If the info
tables already exist, their rows matching the patterns are simply
deleted and replaced by the new ones. That is,
old rows not matching the patterns are not touched.
If the database_like_wild and table_like_wild arguments
are not specified on the command-line they default to \*(L"%\*(R".
.PP
The program :
.PP
\&\- does \s-1CREATE\s0 \s-1DATABASE\s0 \s-1IF\s0 \s-1NOT\s0 \s-1EXISTS\s0 database_to_write
where database_to_write is the database name specified on the command\-line.
.PP
\&\- does \s-1CREATE\s0 \s-1TABLE\s0 \s-1IF\s0 \s-1NOT\s0 \s-1EXISTS\s0 database_to_write.`db`
.PP
\&\- fills database_to_write.`db` with the output of
\&\s-1SHOW\s0 \s-1DATABASES\s0 \s-1LIKE\s0 database_like_wild
.PP
\&\- does \s-1CREATE\s0 \s-1TABLE\s0 \s-1IF\s0 \s-1NOT\s0 \s-1EXISTS\s0 database_to_write.`tbl`
(respectively database_to_write.`tbl_status`
if the \-\-tbl\-status option is on)
.PP
\&\- for every found database,
fills database_to_write.`tbl` (respectively database_to_write.`tbl_status`)
with the output of
\&\s-1SHOW\s0 \s-1TABLES\s0 \s-1FROM\s0 found_db \s-1LIKE\s0 table_like_wild
(respectively \s-1SHOW\s0 \s-1TABLE\s0 \s-1STATUS\s0 \s-1FROM\s0 found_db \s-1LIKE\s0 table_like_wild)
.PP
\&\- if the \-\-col option is on,
* does \s-1CREATE\s0 \s-1TABLE\s0 \s-1IF\s0 \s-1NOT\s0 \s-1EXISTS\s0 database_to_write.`col`
* for every found table,
fills database_to_write.`col` with the output of
\s-1SHOW\s0 \s-1COLUMNS\s0 \s-1FROM\s0 found_tbl \s-1FROM\s0 found_db
.PP
\&\- if the \-\-idx option is on,
* does \s-1CREATE\s0 \s-1TABLE\s0 \s-1IF\s0 \s-1NOT\s0 \s-1EXISTS\s0 database_to_write.`idx`
* for every found table,
fills database_to_write.`idx` with the output of
\s-1SHOW\s0 \s-1INDEX\s0 \s-1FROM\s0 found_tbl \s-1FROM\s0 found_db
.PP
Some options may modify this general scheme (see below).
.PP
As mentioned, the contents of the info tables are the output of
\&\s-1SHOW\s0 commands. In fact the contents are slightly more complete :
.PP
\&\- the `tbl` (or `tbl_status`) info table
has an extra column which contains the database name,
.PP
\&\- the `col` info table
has an extra column which contains the table name,
and an extra column which contains, for each described column,
the number of this column in the table owning it (this extra column
is called `Seq_in_table`). `Seq_in_table` makes it possible for you
to retrieve your columns in sorted order, when you are querying
the `col` table.
.PP
\&\- the `index` info table
has an extra column which contains the database name.
.PP
Caution: info tables contain certain columns (e.g.
Database, Table, Null...) whose names, as they are MySQL reserved words,
need to be backquoted (`...`) when used in \s-1SQL\s0 statements.
.PP
Caution: as information fetching and info tables filling happen at the
same time, info tables may contain inaccurate information about
themselves.
.SH "OPTIONS"
.IX Header "OPTIONS"
.IP "\-\-clear" 4
.IX Item "--clear"
Does \s-1DROP\s0 \s-1TABLE\s0 on the info tables (only those that the program is
going to fill, for example if you do not use \-\-col it won't drop
the `col` table) and processes normally. Does not drop database_to_write.
.IP "\-\-clear\-only" 4
.IX Item "--clear-only"
Same as \-\-clear but exits after the DROPs.
.IP "\-\-col" 4
.IX Item "--col"
Adds columns information (into table `col`).
.IP "\-\-idx" 4
.IX Item "--idx"
Adds index information (into table `idx`).
.IP "\-\-prefix prefix" 4
.IX Item "--prefix prefix"
The info tables are named from the concatenation of prefix and,
respectively, db, tbl (or tbl_status), col, idx. Do not quote ('')
or backquote (``) prefix.
.IP "\-q, \-\-quiet" 4
.IX Item "-q, --quiet"
Does not warn you about what the script is going to do (\s-1DROP\s0 \s-1TABLE\s0 etc)
and does not ask for a confirmation before starting.
.IP "\-\-tbl\-status" 4
.IX Item "--tbl-status"
Instead of using \s-1SHOW\s0 \s-1TABLES\s0, uses \s-1SHOW\s0 \s-1TABLE\s0 \s-1STATUS\s0
(much more complete information, but slower).
.IP "\-\-help" 4
.IX Item "--help"
Display helpscreen and exit
.IP "\-u, \-\-user=#" 4
.IX Item "-u, --user=#"
user for database login if not current user. Give a user
who has sufficient privileges (\s-1CREATE\s0, ...).
.IP "\-p, \-\-password=# (INSECURE)" 4
.IX Item "-p, --password=# (INSECURE)"
password to use when connecting to server.
WARNING: Providing a password on command line is insecure as it is visible through /proc to anyone for a short time.
.IP "\-h, \-\-host=#" 4
.IX Item "-h, --host=#"
host to connect to
.IP "\-P, \-\-port=#" 4
.IX Item "-P, --port=#"
port to use when connecting to server
.IP "\-S, \-\-socket=#" 4
.IX Item "-S, --socket=#"
\&\s-1UNIX\s0 domain socket to use when connecting to server
.SH "WARRANTY"
.IX Header "WARRANTY"
This software is free and comes without warranty of any kind. You
should never trust backup software without studying the code yourself.
Study the code inside this script and only rely on it if \fIyou\fR believe
that it does the right thing for you.
.Sp
Patches adding bug fixes, documentation and new features are welcome.
.SH "TO DO"
.IX Header "TO DO"
Use extended inserts to be faster (for servers with many databases
or tables). But to do that, must care about net\-buffer\-length.
.SH "AUTHOR"
.IX Header "AUTHOR"
2002\-06\-18 Guilhem Bichot (guilhem.bichot@mines\-paris.org)
.Sp
And all the authors of mysqlhotcopy, which served as a model for
the structure of the program.

View File

@ -1,20 +0,0 @@
.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
.SH NAME
mysql_waitpid \- Waits a specified amount of seconds for a PID to terminate.
.SH SYNOPSIS
mysql_waitpid [options] <pid> <seconds>
.SH DESCRIPTION
Description: Waits for a program, which program id is #pid, to
terminate within #time seconds. If the program terminates within
this time, or if the #pid no longer exists, value 0 is returned.
Otherwise 1 is returned. Both #pid and #time must be positive
integer arguments.
See mysql_waitpid for options.
.SH "SEE ALSO"
mysql (1), mysqld (1)
.SH AUTHOR
This manpage was written by Christian Hammers <ch@debian.org>.
MySQL is available at http://www.mysql.com/.
.\" end of man page

View File

@ -1,17 +0,0 @@
.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
.SH NAME
mysqlbinlog \- Dumps MySQL binary logs.
.SH SYNOPSIS
mysqlbinlog [options]
.SH DESCRIPTION
Dumps a MySQL binary log in a format usable for viewing or for pipeing to
the mysql command line client
For more information start the program with '--help'.
.SH "SEE ALSO"
mysql (1), mysqld (1)
.SH AUTHOR
This manpage was written by Christian Hammers <ch@debian.org>.
MySQL is available at http://www.mysql.com/.
.\" end of man page

View File

@ -1,14 +0,0 @@
.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
.SH NAME
mysqlbug \- MySQL bug reporting tool.
.SH SYNOPSIS
mysqlbug [options]
.SH DESCRIPTION
Interactive bug reporting tool. Use reportbug on Debian systems.
.SH "SEE ALSO"
mysql (1), mysqld (1)
.SH AUTHOR
This manpage was written by Christian Hammers <ch@debian.org>.
MySQL is available at http://www.mysql.com/.
.\" end of man page

View File

@ -1,28 +0,0 @@
.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
.SH NAME
mysqlcheck \- MySQL program for repairing, checking and optimizing tables.
.SH SYNOPSIS
mysqlcheck | mysqlanalyze | mysqloptimize [options]
.SH DESCRIPTION
This program can be used to CHECK (-c,-m,-C), REPAIR (-r), ANALYZE (-a)
or OPTIMIZE (-o) tables. Some of the options (like -e or -q) can be
used same time. It works on MyISAM and in some cases on BDB tables.
Please consult the MySQL manual for latest information about the
above. The options -c,-r,-a and -o are exclusive to each other, which
means that the last option will be used, if several was specified.
The option -c will be used by default, if none was specified. You
can change the default behavior by making a symbolic link, or
copying this file somewhere with another name, the alternatives are:
mysqlrepair: The default option will be -r
mysqlanalyze: The default option will be -a
mysqloptimize: The default option will be -o
For more information start the program with '--help'.
.SH "SEE ALSO"
mysql (1), mysqld (8)
.SH AUTHOR
This manpage was written by Christian Hammers <ch@debian.org>.
MySQL is available at http://www.mysql.com/.
.\" end of man page

View File

@ -1,50 +0,0 @@
.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
.SH NAME
mysqldumpslow \- Parse and summarize the MySQL slow query log.
.SH SYNOPSIS
mysqldumpslow [options]
.SH DESCRIPTION
This program parses and summarizes a 'slow query log'.
.TP
\fB\-v\fR
verbose
.TP
\fB\-d\fR
debug
.TP
\fB\-s=WORD\fR
what to sort by (t, at, l, al, r, ar etc)
.TP
\fB\-r\fR
reverse the sort order (largest last instead of first)
.TP
\fB\-t=NUMBER\fR
just show the top n queries
.TP
\fB\-a\fR
don't abstract all numbers to N and strings to 'S'
.TP
\fB\-n=NUMBER\fR
abstract numbers with at least n digits within names
.TP
\fB\-g=WORD\fR
grep: only consider stmts that include this string
.TP
\fB\-h=WORD\fR
hostname of db server for *-slow.log filename (can be wildcard)
.TP
\fB\-i=WORD\fR
name of server instance (if using mysql.server startup script)
.TP
\fB\-l\fR
don't subtract lock time from total time
.SH "SEE ALSO"
mysql (1), mysqld (1)
.SH AUTHOR
This manpage was written by Christian Hammers <ch@debian.org> based on
the commends in the code.
MySQL is available at http://www.mysql.com/.
.\" end of man page

View File

@ -1,20 +0,0 @@
.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
.SH NAME
mysqlimport \- Imports text files with MySQL database queries.
.SH SYNOPSIS
mysqlimport [options]
.SH DESCRIPTION
Loads tables from text files in various formats. The base name of the
text file must be the name of the table that should be used.
If one uses sockets to connect to the MySQL server, the server will open and
read the text file directly. In other cases the client will open the text
file. The SQL command 'LOAD DATA INFILE' is used to import the rows.
For more information start the program with '--help'.
.SH "SEE ALSO"
mysql (1), mysqld (1)
.SH AUTHOR
This manpage was written by Christian Hammers <ch@debian.org>.
MySQL is available at http://www.mysql.com/.
.\" end of man page

View File

@ -1,16 +0,0 @@
.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
.SH NAME
mysqltest \- Regressiontest program for MySQL.
.SH SYNOPSIS
mysqltest [options]
.SH DESCRIPTION
Runs a test against the mysql server and compares output with a results file.
For more information start the program with '--help'.
.SH "SEE ALSO"
mysql (1), mysqld (1)
.SH AUTHOR
This manpage was written by Christian Hammers <ch@debian.org>.
MySQL is available at http://www.mysql.com/.
.\" end of man page

View File

@ -1,19 +0,0 @@
.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
.SH NAME
myisampack \- Compresses MySQL database files.
.SH SYNOPSIS
myisampack [options]
.SH DESCRIPTION
Pack a ISAM-table to take much smaller space
Keys are not updated, so you must run isamchk -rq on any table
that has keys after you have compressed it
You should give the .ISM file as the filename argument
For more information start the program with '--help'.
.SH "SEE ALSO"
mysql (1), mysqld (1)
.SH AUTHOR
This manpage was written by Christian Hammers <ch@debian.org>.
MySQL is available at http://www.mysql.com/.
.\" end of man page

View File

@ -1,16 +0,0 @@
.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
.SH NAME
resolve_stack_dump \- MySQL helper program for reporting bugs.
.SH SYNOPSIS
resolve_stack_dump [options]
.SH DESCRIPTION
Resolve numeric stack strace dump into symbols.
For more information start the program with '--help'.
.SH "SEE ALSO"
mysql (1), mysqld (1)
.SH AUTHOR
This manpage was written by Christian Hammers <ch@debian.org>.
MySQL is available at http://www.mysql.com/.
.\" end of man page

View File

@ -1,16 +0,0 @@
.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database"
.SH NAME
resolveip \- MySQL helper program to retrive IP addresses.
.SH SYNOPSIS
resolveip [options]
.SH DESCRIPTION
Get hostname based on IP-address or IP-address based on hostname.
For more information start the program with '--help'.
.SH "SEE ALSO"
mysql (1), mysqld (1)
.SH AUTHOR
This manpage was written by Christian Hammers <ch@debian.org>.
MySQL is available at http://www.mysql.com/.
.\" end of man page

View File

@ -1,7 +1,7 @@
#ifndef ERRMSG_INCLUDED
#define ERRMSG_INCLUDED
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2000, 2014, 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
@ -36,7 +36,9 @@ extern const char *client_errors[]; /* Error messages */
#define CR_MIN_ERROR 2000 /* For easier client code */
#define CR_MAX_ERROR 2999
#if !defined(ER)
#define ER(X) client_errors[(X)-CR_MIN_ERROR]
#define ER(X) (((X) >= CR_ERROR_FIRST && (X) <= CR_ERROR_LAST)? \
client_errors[(X)-CR_ERROR_FIRST]: client_errors[CR_UNKNOWN_ERROR])
#endif
#define CLIENT_ERRMAP 2 /* Errormap used by my_error() */

View File

@ -125,7 +125,7 @@ longlong double_to_datetime(double nr, MYSQL_TIME *ltime, uint flags, int *cut)
ltime, flags, cut);
}
int number_to_time(my_bool neg, longlong nr, ulong sec_part,
int number_to_time(my_bool neg, ulonglong nr, ulong sec_part,
MYSQL_TIME *ltime, int *was_cut);
ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *);
ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *);

View File

@ -111,7 +111,7 @@ enum enum_server_command
#define MYSQL_TYPE_VIRTUAL 245
/*
Length of random string sent by server on handshake; this is also length of
obfuscated password, recieved from client
obfuscated password, received from client
*/
#define SCRAMBLE_LENGTH 20
#define SCRAMBLE_LENGTH_323 8

View File

@ -138,6 +138,7 @@ my_print_help
)
SET(CLIENT_API_FUNCTIONS_5_5
my_progname
mysql_stmt_next_result
# Charsets
my_charset_bin

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2000, 2014, 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
@ -81,7 +81,7 @@ const char *client_errors[]=
"Attempt to read a row while there is no result set associated with the statement",
"This feature is not implemented yet",
"Lost connection to MySQL server at '%s', system error: %M",
"Statement closed indirectly because of a preceeding %s() call",
"Statement closed indirectly because of a preceding %s() call",
"The number of columns in the result set differs from the number of bound buffers. You must reset the statement, rebind the result set columns, and execute the statement again",
"This handle is already connected. Use a separate handle for each connection.",
"Authentication plugin '%s' cannot be loaded: %s",
@ -107,6 +107,8 @@ const char** get_client_errmsgs()
void init_client_errs(void)
{
compile_time_assert(array_elements(client_errors) ==
(CR_ERROR_LAST - CR_ERROR_FIRST + 2));
(void) my_error_register(get_client_errmsgs, CR_ERROR_FIRST, CR_ERROR_LAST);
}

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates
Copyright (c) 2009, 2013, Monty Program Ab
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates.
Copyright (c) 2009, 2014, SkySQL Ab.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -1340,6 +1340,10 @@ static my_bool my_realloc_str(NET *net, ulong length)
res= net_realloc(net, buf_length + length);
if (res)
{
if (net->last_errno == ER_OUT_OF_RESOURCES)
net->last_errno= CR_OUT_OF_MEMORY;
else if (net->last_errno == ER_NET_PACKET_TOO_LARGE)
net->last_errno= CR_NET_PACKET_TOO_LARGE;
strmov(net->sqlstate, unknown_sqlstate);
strmov(net->last_error, ER(net->last_errno));
}

View File

@ -104,6 +104,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/sql_explain.cc ../sql/sql_explain.h
../sql/compat56.cc
../sql/table_cache.cc
../sql/item_inetfunc.cc
${GEN_SOURCES}
${MYSYS_LIBWRAP_SOURCE}
)

View File

@ -16,13 +16,13 @@
SET(MAN1_SERVER innochecksum.1 my_print_defaults.1 myisam_ftdump.1 myisamchk.1
myisamlog.1 myisampack.1 mysql.server.1
mysql_convert_table_format.1 mysql_fix_extensions.1
mysql_fix_privilege_tables.1 mysql_install_db.1
mysql_install_db.1
mysql_secure_installation.1 mysql_setpermission.1
mysql_tzinfo_to_sql.1 mysql_upgrade.1 mysql_zap.1
mysqld_multi.1 mysqld_safe.1 mysqldumpslow.1 mysqlhotcopy.1
mysqlman.1 mysqltest.1 perror.1 replace.1 resolve_stack_dump.1
mysqltest.1 perror.1 replace.1 resolve_stack_dump.1
resolveip.1 mysqlbug.1)
SET(MAN8_SERVER mysqld.8 mysqlmanager.8)
SET(MAN8_SERVER mysqld.8)
SET(MAN1_CLIENT msql2mysql.1 mysql.1 mysql_find_rows.1 mysql_waitpid.1
mysqlaccess.1 mysqladmin.1 mysqlbinlog.1 mysqlcheck.1
mysqldump.1 mysqlimport.1 mysqlshow.1 mysqlslap.1

245
man/aria_chk.1 Normal file
View File

@ -0,0 +1,245 @@
.TH ARIA_CHK "1" "May 2014" "aria_chk Ver 1.2" "User Commands"
.SH NAME
aria_chk \- Aria table\-maintenance utility
.SH SYNOPSIS
.B aria_chk
[\fIOPTIONS\fR] \fItables\fR[\fI.MAI\fR]
.SH DESCRIPTION
Describe, check and repair of Aria tables.
Used without options all tables on the command will be checked for errors
.SS "Global options"
.TP
\fB\-#\fR, \fB\-\-debug=\fR...
Output debug log. Often this is 'd:t:o,filename'.
.TP
\fB\-H\fR, \fB\-\-HELP\fR
Print all argument options sorted alphabetically.
.TP
\fB\-?\fR, \fB\-\-help\fR
Print all options by groups
.TP
\fB\-\-datadir\fR=\fIpath\fR
Path for control file (and logs if \fB\-\-logdir\fR not used)
.TP
\fB\-\-logdir\fR=\fIpath\fR
Path for log files
.TP
\fB\-\-ignore\-control\-file\fR
Don't open the control file. Only use this if you
are sure the tables are not in use by another
program!
.TP
\fB\-\-require\-control\-file\fR
Abort if we can't find/read the maria_log_control
file
.TP
\fB\-s\fR, \fB\-\-silent\fR
Only print errors. One can use two \fB\-s\fR to make
maria_chk very silent.
.TP
\fB\-t\fR, \fB\-\-tmpdir\fR=\fIpath\fR
Path for temporary files. Multiple paths can be
specified, separated by colon (:), they will be used
in a round\-robin fashion.
.TP
\fB\-v\fR, \fB\-\-verbose\fR
Print more information. This can be used with
\fB\-\-description\fR and \fB\-\-check\fR. Use many \fB\-v\fR for more verbosity.
.TP
\fB\-V\fR, \fB\-\-version\fR
Print version and exit.
.TP
\fB\-w\fR, \fB\-\-wait\fR
Wait if table is locked.
.SS "Check options (check is the default action for aria_chk)"
.TP
\fB\-c\fR, \fB\-\-check\fR
Check table for errors.
.TP
\fB\-e\fR, \fB\-\-extend\-check\fR
Check the table VERY throughly. Only use this in
extreme cases as aria_chk should normally be able to
find out if the table is ok even without this switch.
.TP
\fB\-F\fR, \fB\-\-fast\fR
Check only tables that haven't been closed properly.
.TP
\fB\-C\fR, \fB\-\-check\-only\-changed\fR
Check only tables that have changed since last check.
.TP
\fB\-f\fR, \fB\-\-force\fR
Restart with '\-r' if there are any errors in the table.
States will be updated as with '\-\-update\-state'.
.TP
\fB\-i\fR, \fB\-\-information\fR
Print statistics information about table that is checked.
.TP
\fB\-m\fR, \fB\-\-medium\-check\fR
Faster than extend\-check, but only finds 99.99% of
all errors. Should be good enough for most cases.
.TP
\fB\-T\fR, \fB\-\-read\-only\fR
Don't mark table as checked.
.TP
\fB\-U\fR, \fB\-\-update\-state\fR
Mark tables as crashed if any errors were found and
clean if check didn't find any errors but table was
marked as 'not clean' before. This allows one to get
rid of warnings like 'table not properly closed'. If
table was updated, update also the timestamp for when
the check was made. This option is on by default!
Use \fB\-\-skip\-update\-state\fR to disable.
.HP
\fB\-\-warning\-for\-wrong\-transaction\-id\fR
.IP
Give a warning if we find a transaction id in the table that is bigger
than what exists in the control file. Use \fB\-\-skip\-\fR... to disable warning
.SS "Recover (repair)/ options (When using '--recover' or '--safe-recover')"
.TP
\fB\-B\fR, \fB\-\-backup\fR
Make a backup of the .MAD file as 'filename\-time.BAK'.
.TP
\fB\-\-correct\-checksum\fR
Correct checksum information for table.
.TP
\fB\-D\fR, \fB\-\-data\-file\-length=\fR#
Max length of data file (when recreating data
file when it's full).
.TP
\fB\-e\fR, \fB\-\-extend\-check\fR
Try to recover every possible row from the data file
Normally this will also find a lot of garbage rows;
Don't use this option if you are not totally desperate.
.TP
\fB\-f\fR, \fB\-\-force\fR
Overwrite old temporary files.
.TP
\fB\-k\fR, \fB\-\-keys\-used=\fR#
Tell Aria to update only some specific keys. # is a
bit mask of which keys to use. This can be used to
get faster inserts.
.TP
\fB\-\-max\-record\-length=\fR#
Skip rows bigger than this if aria_chk can't allocate
memory to hold it.
.TP
\fB\-r\fR, \fB\-\-recover\fR
Can fix almost anything except unique keys that aren't
unique.
.TP
\fB\-n\fR, \fB\-\-sort\-recover\fR
Forces recovering with sorting even if the temporary
file would be very big.
.TP
\fB\-p\fR, \fB\-\-parallel\-recover\fR
Uses the same technique as '\-r' and '\-n', but creates
all the keys in parallel, in different threads.
.TP
\fB\-o\fR, \fB\-\-safe\-recover\fR
Uses old recovery method; Slower than '\-r' but can
handle a couple of cases where '\-r' reports that it
can't fix the data file.
.TP
\fB\-\-transaction\-log\fR
Log repair command to transaction log. This is needed
if one wants to use the aria_read_log to repeat the
repair
.TP
\fB\-\-character\-sets\-dir=\fR...
Directory where character sets are.
.TP
\fB\-\-set\-collation\fR=\fIname\fR
Change the collation used by the index.
.TP
\fB\-q\fR, \fB\-\-quick\fR
Faster repair by not modifying the data file.
One can give a second '\-q' to force aria_chk to
modify the original datafile in case of duplicate keys.
NOTE: Tables where the data file is currupted can't be
fixed with this option.
.TP
\fB\-u\fR, \fB\-\-unpack\fR
Unpack file packed with ariapack.
.SS "Other actions"
.TP
\fB\-a\fR, \fB\-\-analyze\fR
Analyze distribution of keys. Will make some joins in
MariaDB faster. You can check the calculated distribution
by using '\-\-description \fB\-\-verbose\fR table_name'.
.TP
\fB\-\-stats_method\fR=\fIname\fR
Specifies how index statistics collection code should
treat NULLs. Possible values of name are "nulls_unequal"
(default for 4.1/5.0), "nulls_equal" (emulate 4.0), and
"nulls_ignored".
.TP
\fB\-d\fR, \fB\-\-description\fR
Prints some information about table.
.TP
\fB\-A\fR, \fB\-\-set\-auto\-increment\fR[=\fIvalue\fR]
Force auto_increment to start at this or higher value
If no value is given, then sets the next auto_increment
value to the highest used value for the auto key + 1.
.TP
\fB\-S\fR, \fB\-\-sort\-index\fR
Sort index blocks. This speeds up 'read\-next' in
applications.
.TP
\fB\-R\fR, \fB\-\-sort\-records=\fR#
Sort records according to an index. This makes your
data much more localized and may speed up things
(It may be VERY slow to do a sort the first time!).
.TP
\fB\-b\fR, \fB\-\-block\-search=\fR#
Find a record, a block at given offset belongs to.
.TP
\fB\-z\fR, \fB\-\-zerofill\fR
Fill empty space in data and index files with zeroes.
This makes the data file movable between different
servers.
.TP
\fB\-\-zerofill\-keep\-lsn\fR
Like \fB\-\-zerofill\fR but does not zero out LSN of
data/index pages.
.PP
.SS "Variables"
.TP
\fB\-\-page_buffer_size=\fR#
Size of page buffer. Used by \fB\-\-safe\-repair\fR
.TP
\fB\-\-read_buffer_size=\fR#
Read buffer size for sequential reads during scanning
.TP
\fB\-\-sort_buffer_size=\fR#
Size of sort buffer. Used by \fB\-\-recover\fR
.TP
\fB\-\-sort_key_blocks=\fR#
Internal buffer for sorting keys; Don't touch.
.TP
\fB\-\-write_buffer_size=\fR#
Write buffer size for sequential writes during repair
.PP
Default options are read from the following files in the given order:
\fB/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf\fR
.PP
The following groups are read: \fBaria_chk\fR
.PP
The following options may be given as the first argument:
.TP
\fB\-\-print\-defaults\fR
Print the program argument list and exit.
.TP
\fB\-\-no\-defaults\fR
Don't read default options from any option file.
.TP
\fB\-\-defaults\-file=\fR#
Only read default options from the given file #.
.TP
\fB\-\-defaults\-extra\-file=\fR#
Read this file after the global files are read.
.PP
.SH "SEE ALSO"
\fBmyisamchk(1)\fR
.PP
For more information, please refer to the MariaDB Knowledge Base,
which is available online at http://mariadb.com/kb/

54
man/aria_dump_log.1 Normal file
View File

@ -0,0 +1,54 @@
.TH ARIA_DUMP_LOG "1" "May 2014" "aria_dump_log Ver 1.0" "User Commands"
.SH NAME
aria_dump_log \- Dump content of Aria log pages.
.SH SYNOPSIS
.B aria_dump_log
\fI-f file OPTIONS\fR
.SH DESCRIPTION
Dump content of Aria log pages.
.TP
\fB\-#\fR, \fB\-\-debug\fR[=\fIname\fR]
Output debug log. Often the argument is 'd:t:o,filename'.
.TP
\fB\-f\fR, \fB\-\-file\fR=\fIname\fR
Path to file which will be read
.TP
\fB\-?\fR, \fB\-\-help\fR
Display this help and exit.
.TP
\fB\-o\fR, \fB\-\-offset=\fR#
Start reading log from this offset
.TP
\fB\-n\fR, \fB\-\-pages=\fR#
Number of pages to read
.TP
\fB\-U\fR, \fB\-\-unit\-test\fR
Use unit test record table (for logs created by unittests
.TP
\fB\-V\fR, \fB\-\-version\fR
Print version and exit.
.PP
Default options are read from the following files in the given order:
\fB/etc/my.cnf\fB
\fB/etc/mysql/my.cnf\fB
\fB~/.my.cnf\fB
.PP
The following groups are read: \fBaria_dump_log\fR
.PP
The following options may be given as the first argument:
.TP
\fB\-\-print\-defaults\fR
Print the program argument list and exit.
.TP
\fB\-\-no\-defaults\fR
Don't read default options from any option file.
.TP
\fB\-\-defaults\-file=\fR#
Only read default options from the given file #.
.TP
\fB\-\-defaults\-extra\-file=\fR#
Read this file after the global files are read.
.PP
.SH "SEE ALSO"
For more information, please refer to the MariaDB Knowledge Base,
which is available online at http://mariadb.com/kb/

29
man/aria_ftdump.1 Normal file
View File

@ -0,0 +1,29 @@
.TH ARIA_FTDUMP "1" "May 2014" "aria_ftdump Ver 1.0" "User Commands"
.SH NAME
aria_ftdump \- display full\-text index information
.SH DESCRIPTION
Use: aria_ft_dump <table_name> <index_num>
.TP
\fB\-?\fR, \fB\-h\fR, \fB\-\-help\fR
Display help and exit.
.TP
\fB\-c\fR, \fB\-\-count\fR
Calculate per\-word stats (counts and global weights).
.TP
\fB\-d\fR, \fB\-\-dump\fR
Dump index (incl. data offsets and word weights).
.TP
\fB\-l\fR, \fB\-\-length\fR
Report length distribution.
.TP
\fB\-s\fR, \fB\-\-stats\fR
Report global stats.
.TP
\fB\-v\fR, \fB\-\-verbose\fR
Be verbose.
.PP
.SH "SEE ALSO"
\fBmyisam_ftdump(1)\fR
.PP
For more information, please refer to the MariaDB Knowledge Base,
which is available online at http://mariadb.com/kb/

76
man/aria_pack.1 Normal file
View File

@ -0,0 +1,76 @@
.TH ARIA_PACK "1" "May 2014" "aria_pack Ver 1.0" "User Commands"
.SH NAME
aria_pack \- manual page for aria_pack Ver 1.0
.SH SYNOPSIS
.B aria_pack
[\fIOPTIONS\fR] \fIfilename\fR...
.SH DESCRIPTION
Pack a Aria\-table to take much less space.
Keys are not updated, you must run \fBaria_chk \-rq\fR on the index (.MAI) file
afterwards to update the keys.
You should give the .MAI file as the filename argument.
To unpack a packed table, run \fBaria_chk \-u\fR on the table
.TP
\fB\-b\fR, \fB\-\-backup\fR
Make a backup of the table as table_name.OLD.
.TP
\fB\-\-character\-sets\-dir\fR=\fIname\fR
Directory where character sets are.
.TP
\fB\-#\fR, \fB\-\-debug\fR[=\fIname\fR]
Output debug log. Often this is 'd:t:o,filename'.
.TP
\fB\-f\fR, \fB\-\-force\fR
Force packing of table even if it gets bigger or if
tempfile exists.
.TP
\fB\-j\fR, \fB\-\-join\fR=\fIname\fR
Join all given tables into 'new_table_name'. All tables
MUST have identical layouts.
.TP
\fB\-?\fR, \fB\-\-help\fR
Display this help and exit.
.TP
\fB\-s\fR, \fB\-\-silent\fR
Be more silent.
.TP
\fB\-T\fR, \fB\-\-tmpdir\fR=\fIname\fR
Use temporary directory to store temporary table.
.TP
\fB\-t\fR, \fB\-\-test\fR
Don't pack table, only test packing it.
.TP
\fB\-v\fR, \fB\-\-verbose\fR
Write info about progress and packing result. Use many \fB\-v\fR
for more verbosity!
.TP
\fB\-V\fR, \fB\-\-version\fR
Output version information and exit.
.TP
\fB\-w\fR, \fB\-\-wait\fR
Wait and retry if table is in use.
.PP
Default options are read from the following files in the given order:
\fB/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf\fR
.PP
The following groups are read: \fBariapack\fR
.PP
The following options may be given as the first argument:
.TP
\fB\-\-print\-defaults\fR
Print the program argument list and exit.
.TP
\fB\-\-no\-defaults\fR
Don't read default options from any option file.
.TP
\fB\-\-defaults\-file=\fR#
Only read default options from the given file #.
.TP
\fB\-\-defaults\-extra\-file=\fR#
Read this file after the global files are read.
.PP
.SH "SEE ALSO"
\fBmyisampack(1)\fR
.PP
For more information, please refer to the MariaDB Knowledge Base,
which is available online at http://mariadb.com/kb/

108
man/aria_read_log.1 Normal file
View File

@ -0,0 +1,108 @@
.TH ARIA_READ_LOG "1" "May 2014" "aria_read_log Ver 1.3" "User Commands"
.SH NAME
aria_read_log \- display Aria log file contents
.SH SYNOPSIS
.B aria_read_log
\fIOPTIONS\fR
.SH DESCRIPTION
Display and apply log records from a Aria transaction log
found in the current directory (for now)
.PP
Note: Aria is compiled without \fB\-DIDENTICAL_PAGES_AFTER_RECOVERY\fR
which means that the table files are not byte\-to\-byte identical to
files created during normal execution. This should be ok, except for
test scripts that tries to compare files before and after recovery.
.PP
You need to use one of \fB\-d\fR or \fB\-a\fR
.TP
\fB\-a\fR, \fB\-\-apply\fR
Apply log to tables: modifies tables! you should make a
backup first! Displays a lot of information if not run
with \fB\-\-silent\fR
.TP
\fB\-\-character\-sets\-dir\fR=\fIname\fR
Directory where character sets are.
.TP
\fB\-c\fR, \fB\-\-check\fR
if \fB\-\-display\-only\fR, check if record is fully readable (for
debugging)
.TP
\fB\-#\fR, \fB\-\-debug\fR[=\fIname\fR]
Output debug log. Often the argument is 'd:t:o,filename'.
.TP
\fB\-\-force\-crash=\fR#
Force crash after # recovery events
.TP
\fB\-?\fR, \fB\-\-help\fR
Display this help and exit.
.TP
\fB\-d\fR, \fB\-\-display\-only\fR
display brief info read from records' header
.TP
\fB\-e\fR, \fB\-\-end\-lsn=\fR#
Stop applying at this lsn. If end\-lsn is used, UNDO:s
will not be applied
.TP
\fB\-h\fR, \fB\-\-aria\-log\-dir\-path\fR=\fIname\fR
Path to the directory where to store transactional log
.TP
\fB\-P\fR, \fB\-\-page\-buffer\-size=\fR#
The size of the buffer used for index blocks for Aria
tables
.TP
\fB\-o\fR, \fB\-\-start\-from\-lsn=\fR#
Start reading log from this lsn
.TP
\fB\-C\fR, \fB\-\-start\-from\-checkpoint\fR
Start applying from last checkpoint
.TP
\fB\-s\fR, \fB\-\-silent\fR
Print less information during apply/undo phase
.TP
\fB\-T\fR, \fB\-\-tables\-to\-redo\fR=\fIname\fR
List of tables sepearated with , that we should apply
REDO on. Use this if you only want to recover some tables
.TP
\fB\-t\fR, \fB\-\-tmpdir\fR=\fIname\fR
Path for temporary files. Multiple paths can be
specified, separated by colon (:)
.TP
\fB\-\-translog\-buffer\-size=\fR#
The size of the buffer used for transaction log for Aria
tables
.TP
\fB\-u\fR, \fB\-\-undo\fR
Apply UNDO records to tables. (disable with
\fB\-\-disable\-undo\fR)
(Defaults to on; use \fB\-\-skip\-undo\fR to disable.)
.TP
\fB\-v\fR, \fB\-\-verbose\fR
Print more information during apply/undo phase
.TP
\fB\-V\fR, \fB\-\-version\fR
Print version and exit.
.PP
Default options are read from the following files in the given order:
\fB/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf\fR
.PP
The following groups are read: \fBaria_read_log\fR
.PP
The following options may be given as the first argument:
.TP
\fB\-\-print\-defaults\fR
Print the program argument list and exit.
.TP
\fB\-\-no\-defaults\fR
Don't read default options from any option file.
.TP
\fB\-\-defaults\-file=\fR#
Only read default options from the given file #.
.TP
\fB\-\-defaults\-extra\-file=\fR#
Read this file after the global files are read.
.PP
.SH "SEE ALSO"
\fBmyisamlog(1)\fR
.PP
For more information, please refer to the MariaDB Knowledge Base,
which is available online at http://mariadb.com/kb/

View File

@ -332,7 +332,7 @@ is defined so that
can invoke itself with
exec $MYSQL_TEST\&.
.PP
Other tests may refer to the last three variables listed in the preceeding table, to locate files to read or write\&. For example, tests that need to create files will typically put them in
Other tests may refer to the last three variables listed in the preceding table, to locate files to read or write\&. For example, tests that need to create files will typically put them in
$MYSQL_TMP_DIR/\fIfile_name\fR\&.
.PP
If you are running

View File

@ -1,175 +0,0 @@
'\" t
.\" Title: \fBmysql_fix_privilege_tables\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
.\" Date: 04/06/2010
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
.TH "\FBMYSQL_FIX_PRIVILE" "1" "04/06/2010" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.\" mysql_fix_privilege_tables
.\" upgrading: grant tables
.\" grant tables: upgrading
.SH "NAME"
mysql_fix_privilege_tables \- upgrade MySQL system tables
.SH "SYNOPSIS"
.HP \w'\fBmysql_fix_privilege_tables\ \-\-password=\fR\fB\fIroot_password\fR\fR\ 'u
\fBmysql_fix_privilege_tables \-\-password=\fR\fB\fIroot_password\fR\fR
.SH "DESCRIPTION"
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
.PP
In MySQL 5\&.1\&.7,
\fBmysql_fix_privilege_tables\fR
was superseded by
\fBmysql_upgrade\fR, which should be used instead\&. See
\fBmysql_upgrade\fR(1)\&.
.sp .5v
.RE
.PP
Some releases of MySQL introduce changes to the structure of the system tables in the
mysql
database to add new privileges or support new features\&. When you update to a new version of MySQL, you should update your system tables as well to make sure that their structure is up to date\&. Otherwise, there might be capabilities that you cannot take advantage of\&.
.PP
\fBmysql_fix_privilege_tables\fR
is an older script that previously was used to uprade the system tables in the
mysql
database after a MySQL upgrade\&.
.PP
Before running
\fBmysql_fix_privilege_tables\fR, make a backup of your
mysql
database\&.
.PP
On Unix or Unix\-like systems, update the system tables by running the
\fBmysql_fix_privilege_tables\fR
script:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmysql_fix_privilege_tables\fR
.fi
.if n \{\
.RE
.\}
.PP
You must run this script while the server is running\&. It attempts to connect to the server running on the local host as
root\&. If your
root
account requires a password, indicate the password on the command line like this:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmysql_fix_privilege_tables \-\-password=\fR\fB\fIroot_password\fR\fR
.fi
.if n \{\
.RE
.\}
.PP
The
\fBmysql_fix_privilege_tables\fR
script performs any actions necessary to convert your system tables to the current format\&. You might see some
Duplicate column name
warnings as it runs; you can ignore them\&.
.PP
After running the script, stop the server and restart it so that any changes made to the system tables take effect\&.
.PP
On Windows systems, MySQL distributions include a
mysql_fix_privilege_tables\&.sql
SQL script that you can run using the
\fBmysql\fR
client\&. For example, if your MySQL installation is located at
C:\eProgram Files\eMySQL\eMySQL Server 5\&.1, the commands look like this:
.sp
.if n \{\
.RS 4
.\}
.nf
C:\e> \fBcd "C:\eProgram Files\eMySQL\eMySQL Server 5\&.1"\fR
C:\e> \fBbin\emysql \-u root \-p mysql\fR
mysql> \fBSOURCE share/mysql_fix_privilege_tables\&.sql\fR
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
.PP
Prior to version 5\&.1\&.17, the
mysql_fix_privilege_tables\&.sql
script is found in the
scripts
directory\&.
.sp .5v
.RE
.PP
The
\fBmysql\fR
command will prompt you for the
root
password; enter it when prompted\&.
.PP
If your installation is located in some other directory, adjust the path names appropriately\&.
.PP
As with the Unix procedure, you might see some
Duplicate column name
warnings as
\fBmysql\fR
processes the statements in the
mysql_fix_privilege_tables\&.sql
script; you can ignore them\&.
.PP
After running the script, stop the server and restart it\&.
.SH "COPYRIGHT"
.br
.PP
Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc.
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
.PP
You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see http://www.gnu.org/licenses/.
.sp
.SH "SEE ALSO"
For more information, please refer to the MySQL Reference Manual,
which may already be installed locally and which is also available
online at http://dev.mysql.com/doc/.
.SH AUTHOR
Sun Microsystems, Inc. (http://www.mysql.com/).

View File

@ -24,8 +24,8 @@
.SH "NAME"
mysqladmin \- client for administering a MySQL server
.SH "SYNOPSIS"
.HP \w'\fBmysqladmin\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIcommand\fR\fR\fB\ [\fR\fB\fIcommand\-options\fR\fR\fB]\ [\fR\fB\fIcommand\fR\fR\fB\ [\fR\fB\fIcommand\-options\fR\fR\fB]]\ \&.\&.\&.\fR\ 'u
\fBmysqladmin [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIcommand\fR\fR\fB [\fR\fB\fIcommand\-options\fR\fR\fB] [\fR\fB\fIcommand\fR\fR\fB [\fR\fB\fIcommand\-options\fR\fR\fB]] \&.\&.\&.\fR
.HP \w'\fBmysqladmin\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIcommand\fR\fR\fB\ [\fR\fB\fIcommand\-arg\fR\fR\fB]\ [\fR\fB\fIcommand\fR\fR\fB\ [\fR\fB\fIcommand\-arg\fR\fR\fB]]\ \&.\&.\&.\fR\ 'u
\fBmysqladmin [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIcommand\fR\fR\fB [\fR\fB\fIcommand\-arg\fR\fR\fB] [\fR\fB\fIcommand\fR\fR\fB [\fR\fB\fIcommand\-arg\fR\fR\fB]] \&.\&.\&.\fR
.SH "DESCRIPTION"
.PP
\fBmysqladmin\fR

View File

@ -1255,33 +1255,6 @@ indicates a
FORMAT_DESCRIPTION_EVENT\&. The following table lists the possible type codes\&.
.TS
allbox tab(:);
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l.
T{
Type
@ -1310,7 +1283,7 @@ T}:T{
QUERY_EVENT
T}:T{
The most common type of events\&. These contain statements executed on the
master\&.
master\&.
T}
T{
03
@ -1332,8 +1305,8 @@ T}:T{
INTVAR_EVENT
T}:T{
Used for AUTO_INCREMENT values or when the
LAST_INSERT_ID()
function is used in the statement\&.
LAST_INSERT_ID()
function is used in the statement\&.
T}
T{
06
@ -1341,7 +1314,7 @@ T}:T{
LOAD_EVENT
T}:T{
Used for LOAD DATA
INFILE in MySQL 3\&.23\&.
INFILE in MySQL 3\&.23\&.
T}
T{
07
@ -1356,9 +1329,9 @@ T}:T{
CREATE_FILE_EVENT
T}:T{
Used for LOAD DATA
INFILE statements\&. This indicates the
start of execution of such a statement\&. A temporary
file is created on the slave\&. Used in MySQL 4 only\&.
INFILE statements\&. This indicates the
start of execution of such a statement\&. A temporary
file is created on the slave\&. Used in MySQL 4 only\&.
T}
T{
09
@ -1366,9 +1339,9 @@ T}:T{
APPEND_BLOCK_EVENT
T}:T{
Contains data for use in a
LOAD DATA
INFILE statement\&. The data is stored in
the temporary file on the slave\&.
LOAD DATA
INFILE statement\&. The data is stored in
the temporary file on the slave\&.
T}
T{
0a
@ -1376,9 +1349,9 @@ T}:T{
EXEC_LOAD_EVENT
T}:T{
Used for LOAD DATA
INFILE statements\&. The contents of the
temporary file is stored in the table on the slave\&.
Used in MySQL 4 only\&.
INFILE statements\&. The contents of the
temporary file is stored in the table on the slave\&.
Used in MySQL 4 only\&.
T}
T{
0b
@ -1386,8 +1359,8 @@ T}:T{
DELETE_FILE_EVENT
T}:T{
Rollback of a LOAD DATA
INFILE statement\&. The temporary file
should be deleted on the slave\&.
INFILE statement\&. The temporary file
should be deleted on the slave\&.
T}
T{
0c
@ -1395,7 +1368,7 @@ T}:T{
NEW_LOAD_EVENT
T}:T{
Used for LOAD DATA
INFILE in MySQL 4 and earlier\&.
INFILE in MySQL 4 and earlier\&.
T}
T{
0d
@ -1403,8 +1376,8 @@ T}:T{
RAND_EVENT
T}:T{
Used to send information about random values if the
RAND() function is
used in the statement\&.
RAND() function is
used in the statement\&.
T}
T{
0e
@ -1433,7 +1406,7 @@ T}:T{
BEGIN_LOAD_QUERY_EVENT
T}:T{
Used for LOAD DATA
INFILE statements in MySQL 5 and later\&.
INFILE statements in MySQL 5 and later\&.
T}
T{
12
@ -1441,7 +1414,7 @@ T}:T{
EXECUTE_LOAD_QUERY_EVENT
T}:T{
Used for LOAD DATA
INFILE statements in MySQL 5 and later\&.
INFILE statements in MySQL 5 and later\&.
T}
T{
13
@ -1456,7 +1429,7 @@ T}:T{
PRE_GA_WRITE_ROWS_EVENT
T}:T{
Row data for a single table that should be created\&. Used in MySQL 5\&.1\&.5
to 5\&.1\&.17\&.
to 5\&.1\&.17\&.
T}
T{
15
@ -1464,7 +1437,7 @@ T}:T{
PRE_GA_UPDATE_ROWS_EVENT
T}:T{
Row data for a single table that needs to be updated\&. Used in MySQL
5\&.1\&.5 to 5\&.1\&.17\&.
5\&.1\&.5 to 5\&.1\&.17\&.
T}
T{
16
@ -1472,7 +1445,7 @@ T}:T{
PRE_GA_DELETE_ROWS_EVENT
T}:T{
Row data for a single table that should be deleted\&. Used in MySQL 5\&.1\&.5
to 5\&.1\&.17\&.
to 5\&.1\&.17\&.
T}
T{
17
@ -1480,7 +1453,7 @@ T}:T{
WRITE_ROWS_EVENT
T}:T{
Row data for a single table that should be created\&. Used in MySQL 5\&.1\&.18
and later\&.
and later\&.
T}
T{
18
@ -1488,7 +1461,7 @@ T}:T{
UPDATE_ROWS_EVENT
T}:T{
Row data for a single table that needs to be updated\&. Used in MySQL
5\&.1\&.18 and later\&.
5\&.1\&.18 and later\&.
T}
T{
19
@ -1496,7 +1469,7 @@ T}:T{
DELETE_ROWS_EVENT
T}:T{
Row data for a single table that should be deleted\&. Used in MySQL 5\&.1\&.18
and later\&.
and later\&.
T}
T{
1a
@ -1553,10 +1526,6 @@ Master Pos: The position of the next event in the original master log file\&.
Flags: 16 flags\&. Currently, the following flags are used\&. The others are reserved for future use\&.
.TS
allbox tab(:);
l l l
l l l
l l l
l l l
l l l.
T{
Flag
@ -1571,13 +1540,13 @@ T}:T{
LOG_EVENT_BINLOG_IN_USE_F
T}:T{
Log file correctly closed\&. (Used only in
FORMAT_DESCRIPTION_EVENT\&.) If
this flag is set (if the flags are, for example,
\'01 00\') in a
FORMAT_DESCRIPTION_EVENT, the log
file has not been properly closed\&. Most probably
this is because of a master crash (for example, due
to power failure)\&.
FORMAT_DESCRIPTION_EVENT\&.) If
this flag is set (if the flags are, for example,
\'01 00\') in a
FORMAT_DESCRIPTION_EVENT, the log
file has not been properly closed\&. Most probably
this is because of a master crash (for example, due
to power failure)\&.
T}
T{
02
@ -1592,8 +1561,8 @@ T}:T{
LOG_EVENT_THREAD_SPECIFIC_F
T}:T{
Set if the event is dependent on the connection it was executed in (for
example, \'04 00\'), for example,
if the event uses temporary tables\&.
example, \'04 00\'), for example,
if the event uses temporary tables\&.
T}
T{
08
@ -1601,7 +1570,7 @@ T}:T{
LOG_EVENT_SUPPRESS_USE_F
T}:T{
Set in some circumstances when the event is not dependent on the default
database\&.
database\&.
T}
.TE
.sp 1

View File

@ -2027,9 +2027,6 @@ value, an empty string, and the string value
are distinguished from one another in the output generated by this option as follows\&.
.TS
allbox tab(:);
l l
l l
l l
l l.
T{
\fBValue\fR:

View File

@ -1,15 +0,0 @@
.TH mysqlman 1 "20 July 2004" "MySQL" "MySQL database"
.SH NAME
mysqlman \- default man page for mysql
.SH "DESCRIPTION"
Certain executables distributed with the MySQL database management system do
not have specific man pages.
.SH "SEE ALSO"
In most cases, you can run the executable from the command line with a "--help"
argument to display a brief summary of the executable's arguments and function.
For more information about MySQL, please refer to the MySQL reference manual,
which may already be installed locally and which is also available online at
http://dev.mysql.com/doc/mysql/en
.SH BUGS
Please refer to http://bugs.mysql.com/ to report bugs.
.\" end of man page

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,6 @@ main.signal_demo3 @solaris # Bug#11753919 2010-01-20 alik Several
main.sp @solaris # Bug#11753919 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
main.wait_timeout @solaris # Bug#11758972 2010-04-26 alik wait_timeout fails on OpenSolaris
rpl.rpl_innodb_bug28430 # Bug#11754425
rpl.rpl_row_sp011 @solaris # Bug#11753919 2011-07-25 sven Several test cases fail on Solaris with error Thread stack overrun
rpl.rpl_spec_variables @solaris # Bug #17337114 2013-08-20 Luis Soares failing on pb2 with timeout for 'CHECK WARNINGS'

0
mysql-test/collections/default.weekly Executable file → Normal file
View File

View File

@ -98,8 +98,8 @@
# --> less switching of AUTOCOMMIT mode on master side.
#
# 4. Never use a test object, which was direct or indirect affected by a
# preceeding test sequence again.
# If one preceeding test sequence hits a (sometimes not visible,
# preceding test sequence again.
# If one preceding test sequence hits a (sometimes not visible,
# because the sql error code of the statement might be 0) bug
# and these rules are ignored, a following test sequence might earn ugly
# effects like failing 'sync_slave_with_master', crashes of the slave or

View File

@ -221,7 +221,7 @@ INSERT INTO t7 VALUES (1,3), (2,6), (3,9);
SELECT * FROM t7 ORDER BY C1;
# since bug#31552/31609 idempotency is not default any longer. In order
# the preceeding test INSERT INTO t7 to pass the mode is switched
# the preceding test INSERT INTO t7 to pass the mode is switched
# temprorarily
set @@global.slave_exec_mode= 'IDEMPOTENT';
@ -260,7 +260,7 @@ INSERT INTO t8 VALUES (1,2,3), (2,4,6), (3,6,9);
SELECT * FROM t8 ORDER BY a;
# since bug#31552/31609 idempotency is not default any longer. In order
# the preceeding test INSERT INTO t8 to pass the mode is switched
# the preceding test INSERT INTO t8 to pass the mode is switched
# temprorarily
set @@global.slave_exec_mode= 'IDEMPOTENT';

View File

@ -10,7 +10,7 @@
# 1. We wait for $current_sessions <= $count_sessions because in the use case
# with count_sessions.inc before and wait_until_count_sessions.inc after
# the core of the test it could happen that the disconnects of sessions
# belonging to the preceeding test are not finished.
# belonging to the preceding test are not finished.
# sessions at test begin($count_sessions) = m + n
# sessions of the previous test which will be soon disconnected = n (n >= 0)
# sessions at test end ($current sessions, assuming the test disconnects

View File

@ -321,7 +321,7 @@ sub parse_disabled {
chomp;
next if /^\s*#/ or /^\s*$/;
mtr_error("Syntax error in $filename line $.")
unless /^\s*(?:([-0-9A-Za-z_]+)\.)?([-0-9A-Za-z_]+)\s*:\s*(.*?)\s*$/;
unless /^\s*(?:([-0-9A-Za-z_\/]+)\.)?([-0-9A-Za-z_]+)\s*:\s*(.*?)\s*$/;
mtr_error("Wrong suite name in $filename line $.")
if defined $1 and defined $suitename and $1 ne $suitename;
$disabled{($1 || $suitename || '') . ".$2"} = $3;

View File

@ -3654,6 +3654,9 @@ sub mysql_install_db {
mtr_appendfile_to_file("$sql_dir/fill_help_tables.sql",
$bootstrap_sql_file);
# mysql.gtid_slave_pos was created in InnoDB, but many tests
# run without InnoDB. Alter it to MyISAM now
mtr_tofile($bootstrap_sql_file, "ALTER TABLE gtid_slave_pos ENGINE=MyISAM;\n");
}
else
{
@ -6582,7 +6585,7 @@ Misc options
start-dirty Only start the servers (without initialization) for
the first specified test case
user-args In combination with start* and no test name, drops
arguments to mysqld except those speficied with
arguments to mysqld except those specified with
--mysqld (if any)
wait-all If --start or --start-dirty option is used, wait for all
servers to exit before finishing the process

View File

@ -1460,6 +1460,33 @@ t2 CREATE TABLE `t2` (
KEY `id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 (
id INT(11) NOT NULL);
ALTER TABLE t2 ADD COLUMN a INT, ADD COLUMN IF NOT EXISTS a INT;
Warnings:
Note 1060 Duplicate column name 'a'
ALTER TABLE t2 ADD KEY k_id(id), ADD KEY IF NOT EXISTS k_id(id);
Warnings:
Note 1061 Duplicate key name 'k_id'
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL,
`a` int(11) DEFAULT NULL,
KEY `k_id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
ALTER TABLE t2 DROP KEY k_id, DROP KEY IF EXISTS k_id;
Warnings:
Note 1091 Can't DROP 'k_id'; check that column/key exists
ALTER TABLE t2 DROP COLUMN a, DROP COLUMN IF EXISTS a;
Warnings:
Note 1091 Can't DROP 'a'; check that column/key exists
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
DROP TABLE t1;
# Bug#11748057 (formerly known as 34972): ALTER TABLE statement doesn't
# identify correct column name.

View File

@ -78,7 +78,7 @@ cast(cast(20010203101112.121314 as double) as datetime)
2001-02-03 10:11:12
select cast(cast(010203101112.12 as double) as datetime);
cast(cast(010203101112.12 as double) as datetime)
0001-02-03 10:11:12
2001-02-03 10:11:12
select cast(cast(20010203101112.121314 as decimal(32,6)) as datetime);
cast(cast(20010203101112.121314 as decimal(32,6)) as datetime)
2001-02-03 10:11:12
@ -87,10 +87,10 @@ cast(20010203101112.121314 as datetime)
2001-02-03 10:11:12
select cast(110203101112.121314 as datetime);
cast(110203101112.121314 as datetime)
0011-02-03 10:11:12
2011-02-03 10:11:12
select cast(cast(010203101112.12 as double) as datetime);
cast(cast(010203101112.12 as double) as datetime)
0001-02-03 10:11:12
2001-02-03 10:11:12
select cast("2011-02-03 10:11:12.123456" as datetime);
cast("2011-02-03 10:11:12.123456" as datetime)
2011-02-03 10:11:12
@ -111,7 +111,7 @@ cast(cast(20010203101112.5 as double) as datetime(1))
2001-02-03 10:11:12.5
select cast(cast(010203101112.12 as double) as datetime(2));
cast(cast(010203101112.12 as double) as datetime(2))
0001-02-03 10:11:12.12
2001-02-03 10:11:12.12
select cast(cast(20010203101112.121314 as decimal(32,6)) as datetime(6));
cast(cast(20010203101112.121314 as decimal(32,6)) as datetime(6))
2001-02-03 10:11:12.121314
@ -120,10 +120,10 @@ cast(20010203101112.121314 as datetime(6))
2001-02-03 10:11:12.121314
select cast(110203101112.121314 as datetime(6));
cast(110203101112.121314 as datetime(6))
0011-02-03 10:11:12.121314
2011-02-03 10:11:12.121314
select cast(cast(010203101112.12 as double) as datetime(6));
cast(cast(010203101112.12 as double) as datetime(6))
0001-02-03 10:11:12.120000
2001-02-03 10:11:12.120000
select cast("2011-02-03 10:11:12.123456" as time);
cast("2011-02-03 10:11:12.123456" as time)
10:11:12
@ -266,7 +266,7 @@ Warnings:
Warning 1264 Out of range value for column 'cast(-1000 as double(5,2))' at row 1
select cast(010203101112.121314 as datetime);
cast(010203101112.121314 as datetime)
0001-02-03 10:11:12
2001-02-03 10:11:12
select cast(120010203101112.121314 as datetime);
cast(120010203101112.121314 as datetime)
NULL
@ -327,7 +327,7 @@ cast(cast(120010203101112.121314 as double) as datetime)
NULL
select cast(cast(1.1 as double) as datetime);
cast(cast(1.1 as double) as datetime)
0000-00-00 00:00:01
NULL
select cast(cast(-1.1 as double) as datetime);
cast(cast(-1.1 as double) as datetime)
NULL

View File

@ -273,6 +273,20 @@ connect(localhost,mysqltest_nouser,newpw,test,MASTER_PORT,MASTER_SOCKET);
ERROR 28000: Access denied for user 'mysqltest_nouser'@'localhost' (using password: YES)
connect(localhost,mysqltest_nouser,,test,MASTER_PORT,MASTER_SOCKET);
ERROR 28000: Access denied for user 'mysqltest_nouser'@'localhost' (using password: NO)
update mysql.user set password=authentication_string, authentication_string=''
where user like 'mysqltest_up_';
select user, password, plugin, authentication_string from mysql.user
where user like 'mysqltest_up_';
user password plugin authentication_string
mysqltest_up1 *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB mysql_native_password
mysqltest_up2 09301740536db389 mysql_old_password
flush privileges;
select user(), current_user();
user() current_user()
mysqltest_up1@localhost mysqltest_up1@%
select user(), current_user();
user() current_user()
mysqltest_up2@localhost mysqltest_up2@%
DROP USER mysqltest_up1@'%';
DROP USER mysqltest_up2@'%';
#

View File

@ -539,6 +539,7 @@ n d1 d2 result
2085 2012-01-01 00:00:00 2013-01-01 00:00:00 0
2084 2012-02-01 00:00:00 2013-01-01 00:00:00 0
drop table t1;
set @save_derived_optimizer_switch_bug=@@optimizer_switch;
SET optimizer_switch = 'derived_merge=on,derived_with_keys=on,in_to_exists=on';
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (8);
@ -553,4 +554,17 @@ id select_type table type possible_keys key key_len ref rows Extra
Warnings:
Note 1249 Select 4 was reduced during optimization
DROP TABLE t1, t2;
set optimizer_switch=@save_derived_optimizer_switch_bug;
#
# MDEV-6163: Error while executing an update query that has the
# same table in a sub-query
#
set @save_derived_optimizer_switch_bug=@@optimizer_switch;
SET optimizer_switch = 'derived_merge=on';
create table t1 (balance float, accountId varchar(64), primary key (accountId));
insert into t1 (accountId,balance) values
('dealer-1',199354.0),('dealer-2',0),('dealer-3',0),('dealer-5',0),('FINANCE',-200000),('OPERATOR',0);
update t1 set balance=(select sum(balance) from (SELECT balance FROM t1 where accountId like 'dealer%') AS copied) where accountId = 'OPERATOR';
set optimizer_switch=@save_derived_optimizer_switch_bug;
drop table t1;
set optimizer_switch=@save_derived_optimizer_switch;

View File

@ -1288,7 +1288,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 't.a' of SELECT #3 was resolved in SELECT #1
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists(select 28 from `test`.`t3` where ('j' < `test`.`t1`.`a`)))
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <in_optimizer>(1,<expr_cache><`test`.`t1`.`a`>(exists(select 28 from `test`.`t3` where ('j' < `test`.`t1`.`a`))))
SELECT * FROM (SELECT * FROM t1) AS t
WHERE EXISTS (SELECT t2.a FROM t3 RIGHT JOIN t2 ON (t3.a = t2.a)
WHERE t2.b < t.a);

View File

@ -1001,29 +1001,29 @@ Warnings:
Warning 1292 Truncated incorrect time value: '1223.5aa'
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as time);
column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as time)
NULL
838:59:59
Warnings:
Warning 1292 Incorrect datetime value: '1.8446744073709552e19'
Warning 1292 Truncated incorrect time value: '1.8446744073709552e19'
select column_get(column_create(1, 9223372036854775807 AS int), 1 as time);
column_get(column_create(1, 9223372036854775807 AS int), 1 as time)
NULL
838:59:59
Warnings:
Warning 1292 Incorrect datetime value: '9223372036854775807'
Warning 1292 Truncated incorrect time value: '9223372036854775807'
select column_get(column_create(1, -9223372036854775808 AS int), 1 as time);
column_get(column_create(1, -9223372036854775808 AS int), 1 as time)
NULL
-838:59:59
Warnings:
Warning 1292 Incorrect datetime value: '-9223372036854775808'
Warning 1292 Truncated incorrect time value: '-9223372036854775808'
select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as time);
column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as time)
NULL
838:59:59
Warnings:
Warning 1292 Incorrect datetime value: '99999999999999999999999999999'
Warning 1292 Truncated incorrect time value: '99999999999999999999999999999'
select column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as time);
column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as time)
NULL
838:59:59
Warnings:
Warning 1292 Incorrect datetime value: '1e29'
Warning 1292 Truncated incorrect time value: '1e29'
select column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as time);
column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as time)
NULL
@ -1435,6 +1435,17 @@ Warning 1265 Data truncated for column 'dyncol' at row 1
SELECT COLUMN_ADD( dyncol, 'a', '22:22:22', 'c', REPEAT('x',270) AS CHAR ) FROM t1;
DROP table t1;
#
# MDEV-4858 Wrong results for a huge unsigned value inserted into a TIME column
#
SELECT
column_get(column_create(1, -999999999999999 AS int), 1 AS TIME) AS t1,
column_get(column_create(1, -9223372036854775808 AS int), 1 AS TIME) AS t2;
t1 t2
-838:59:59 -838:59:59
Warnings:
Warning 1292 Truncated incorrect time value: '-999999999999999'
Warning 1292 Truncated incorrect time value: '-9223372036854775808'
#
# end of 5.3 tests
#
select column_get(column_create(1, "18446744073709552001" as char), 1 as int);

View File

@ -602,8 +602,8 @@ WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE)
);
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 DEPENDENT SUBQUERY t2 fulltext b2 b2 0 1 Using where
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 Using where
2 MATERIALIZED t2 fulltext b2 b2 0 1 Using where
2 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 Using where
# should return 0
SELECT count(*) FROM t1 WHERE
not exists(

View File

@ -584,3 +584,591 @@ ERROR 42000: Identifier name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
#
# End of 5.5 tests
#
# --
# -- WL#5787: IPv6-capable INET_ATON and INET_NTOA functions.
# --
# -- INET6_ATON: checking NULL, invalid types, out-of range values...
SELECT INET6_ATON(NULL) IS NULL;
INET6_ATON(NULL) IS NULL
1
SELECT INET6_ATON(123) IS NULL;
INET6_ATON(123) IS NULL
1
SELECT INET6_ATON(123.45) IS NULL;
INET6_ATON(123.45) IS NULL
1
SELECT INET6_ATON(NOW()) IS NULL;
INET6_ATON(NOW()) IS NULL
1
SELECT INET6_ATON('1.2.3') IS NULL;
INET6_ATON('1.2.3') IS NULL
1
SELECT INET6_ATON('1.2.3.') IS NULL;
INET6_ATON('1.2.3.') IS NULL
1
SELECT INET6_ATON('1..3.4') IS NULL;
INET6_ATON('1..3.4') IS NULL
1
SELECT INET6_ATON('-1.2.3.4') IS NULL;
INET6_ATON('-1.2.3.4') IS NULL
1
SELECT INET6_ATON('1.2.3.256') IS NULL;
INET6_ATON('1.2.3.256') IS NULL
1
SELECT INET6_ATON('1.2.3.4.5') IS NULL;
INET6_ATON('1.2.3.4.5') IS NULL
1
SELECT INET6_ATON('0001.2.3.4') IS NULL;
INET6_ATON('0001.2.3.4') IS NULL
1
SELECT INET6_ATON('0x1.2.3.4') IS NULL;
INET6_ATON('0x1.2.3.4') IS NULL
1
SELECT INET6_ATON('a.2.3.4') IS NULL;
INET6_ATON('a.2.3.4') IS NULL
1
SELECT INET6_ATON('1.2.3.4:80') IS NULL;
INET6_ATON('1.2.3.4:80') IS NULL
1
SELECT INET6_ATON('1.2.3.4/32') IS NULL;
INET6_ATON('1.2.3.4/32') IS NULL
1
SELECT INET6_ATON('mysql.com') IS NULL;
INET6_ATON('mysql.com') IS NULL
1
SELECT INET6_ATON(':::') IS NULL;
INET6_ATON(':::') IS NULL
1
SELECT INET6_ATON(':1:2:3') IS NULL;
INET6_ATON(':1:2:3') IS NULL
1
SELECT INET6_ATON('1:2:3:') IS NULL;
INET6_ATON('1:2:3:') IS NULL
1
SELECT INET6_ATON(':1::2:3') IS NULL;
INET6_ATON(':1::2:3') IS NULL
1
SELECT INET6_ATON('1::2:3:') IS NULL;
INET6_ATON('1::2:3:') IS NULL
1
SELECT INET6_ATON('::00001') IS NULL;
INET6_ATON('::00001') IS NULL
1
SELECT INET6_ATON('::00001:2') IS NULL;
INET6_ATON('::00001:2') IS NULL
1
SELECT INET6_ATON('::12345') IS NULL;
INET6_ATON('::12345') IS NULL
1
SELECT INET6_ATON('1020::3040::5060') IS NULL;
INET6_ATON('1020::3040::5060') IS NULL
1
SELECT INET6_ATON('::ABCZ') IS NULL;
INET6_ATON('::ABCZ') IS NULL
1
SELECT INET6_ATON('::0x1.2.3.4') IS NULL;
INET6_ATON('::0x1.2.3.4') IS NULL
1
SELECT INET6_ATON('::1.0x2.3.4') IS NULL;
INET6_ATON('::1.0x2.3.4') IS NULL
1
SELECT INET6_ATON('::a.b.c.d') IS NULL;
INET6_ATON('::a.b.c.d') IS NULL
1
SELECT INET6_ATON('::FFFF:0x1.2.3.4') IS NULL;
INET6_ATON('::FFFF:0x1.2.3.4') IS NULL
1
SELECT INET6_ATON('::FFFF:1.0x2.3.4') IS NULL;
INET6_ATON('::FFFF:1.0x2.3.4') IS NULL
1
SELECT INET6_ATON('::FFFF:a.b.c.d') IS NULL;
INET6_ATON('::FFFF:a.b.c.d') IS NULL
1
SELECT INET6_ATON('::1.2.3.4:ABCD') IS NULL;
INET6_ATON('::1.2.3.4:ABCD') IS NULL
1
# NOTE: such addresses are supported because getaddrinfo() supports them.
# This is just to record the current behaviour.
SELECT HEX(INET6_ATON('::ABCD:1.2.3.4'));
HEX(INET6_ATON('::ABCD:1.2.3.4'))
00000000000000000000ABCD01020304
# -- INET6_ATON: checking binary representation...
SELECT HEX(INET6_ATON('0.0.0.0'));
HEX(INET6_ATON('0.0.0.0'))
00000000
SELECT HEX(INET6_ATON('00.00.00.00'));
HEX(INET6_ATON('00.00.00.00'))
00000000
SELECT HEX(INET6_ATON('000.000.000.000'));
HEX(INET6_ATON('000.000.000.000'))
00000000
SELECT HEX(INET6_ATON('1.2.3.4'));
HEX(INET6_ATON('1.2.3.4'))
01020304
SELECT HEX(INET6_ATON('01.02.03.04'));
HEX(INET6_ATON('01.02.03.04'))
01020304
SELECT HEX(INET6_ATON('001.002.003.004'));
HEX(INET6_ATON('001.002.003.004'))
01020304
SELECT HEX(INET6_ATON('255.255.255.255'));
HEX(INET6_ATON('255.255.255.255'))
FFFFFFFF
SELECT HEX(INET6_ATON('::'));
HEX(INET6_ATON('::'))
00000000000000000000000000000000
SELECT HEX(INET6_ATON('0::0'));
HEX(INET6_ATON('0::0'))
00000000000000000000000000000000
SELECT HEX(INET6_ATON('1::2'));
HEX(INET6_ATON('1::2'))
00010000000000000000000000000002
SELECT HEX(INET6_ATON('0::'));
HEX(INET6_ATON('0::'))
00000000000000000000000000000000
SELECT HEX(INET6_ATON('1::'));
HEX(INET6_ATON('1::'))
00010000000000000000000000000000
SELECT HEX(INET6_ATON('::0'));
HEX(INET6_ATON('::0'))
00000000000000000000000000000000
SELECT HEX(INET6_ATON('::1'));
HEX(INET6_ATON('::1'))
00000000000000000000000000000001
SELECT HEX(INET6_ATON('1:2:3:4:5:6:7:8'));
HEX(INET6_ATON('1:2:3:4:5:6:7:8'))
00010002000300040005000600070008
SELECT HEX(INET6_ATON('::2:3:4:5:6:7:8'));
HEX(INET6_ATON('::2:3:4:5:6:7:8'))
00000002000300040005000600070008
SELECT HEX(INET6_ATON('1::3:4:5:6:7:8'));
HEX(INET6_ATON('1::3:4:5:6:7:8'))
00010000000300040005000600070008
SELECT HEX(INET6_ATON('1:2::4:5:6:7:8'));
HEX(INET6_ATON('1:2::4:5:6:7:8'))
00010002000000040005000600070008
SELECT HEX(INET6_ATON('1:2:3::5:6:7:8'));
HEX(INET6_ATON('1:2:3::5:6:7:8'))
00010002000300000005000600070008
SELECT HEX(INET6_ATON('1:2:3:4::6:7:8'));
HEX(INET6_ATON('1:2:3:4::6:7:8'))
00010002000300040000000600070008
SELECT HEX(INET6_ATON('1:2:3:4:5::7:8'));
HEX(INET6_ATON('1:2:3:4:5::7:8'))
00010002000300040005000000070008
SELECT HEX(INET6_ATON('1:2:3:4:5:6::8'));
HEX(INET6_ATON('1:2:3:4:5:6::8'))
00010002000300040005000600000008
SELECT HEX(INET6_ATON('1:2:3:4:5:6:7::'));
HEX(INET6_ATON('1:2:3:4:5:6:7::'))
00010002000300040005000600070000
SELECT HEX(INET6_ATON('0000:0000::0000:0001'));
HEX(INET6_ATON('0000:0000::0000:0001'))
00000000000000000000000000000001
SELECT HEX(INET6_ATON('1234:5678:9abc:def0:4321:8765:cba9:0fed'));
HEX(INET6_ATON('1234:5678:9abc:def0:4321:8765:cba9:0fed'))
123456789ABCDEF043218765CBA90FED
SELECT HEX(INET6_ATON('0000:0000:0000:0000:0000:0000:0000:0001'));
HEX(INET6_ATON('0000:0000:0000:0000:0000:0000:0000:0001'))
00000000000000000000000000000001
SELECT HEX(INET6_ATON('::C0A8:0102'));
HEX(INET6_ATON('::C0A8:0102'))
000000000000000000000000C0A80102
SELECT HEX(INET6_ATON('::c0a8:0102'));
HEX(INET6_ATON('::c0a8:0102'))
000000000000000000000000C0A80102
SELECT HEX(INET6_ATON('::192.168.1.2'));
HEX(INET6_ATON('::192.168.1.2'))
000000000000000000000000C0A80102
SELECT HEX(INET6_ATON('::FfFf:C0a8:0102'));
HEX(INET6_ATON('::FfFf:C0a8:0102'))
00000000000000000000FFFFC0A80102
SELECT HEX(INET6_ATON('::ffff:c0a8:0102'));
HEX(INET6_ATON('::ffff:c0a8:0102'))
00000000000000000000FFFFC0A80102
SELECT HEX(INET6_ATON('::ffff:192.168.1.2'));
HEX(INET6_ATON('::ffff:192.168.1.2'))
00000000000000000000FFFFC0A80102
SELECT HEX(INET6_ATON('::01.2.3.4'));
HEX(INET6_ATON('::01.2.3.4'))
00000000000000000000000001020304
SELECT HEX(INET6_ATON('::1.02.3.4'));
HEX(INET6_ATON('::1.02.3.4'))
00000000000000000000000001020304
SELECT HEX(INET6_ATON('::1.2.03.4'));
HEX(INET6_ATON('::1.2.03.4'))
00000000000000000000000001020304
SELECT HEX(INET6_ATON('::1.2.3.04'));
HEX(INET6_ATON('::1.2.3.04'))
00000000000000000000000001020304
SELECT HEX(INET6_ATON('::1.2.3.00'));
HEX(INET6_ATON('::1.2.3.00'))
00000000000000000000000001020300
SELECT HEX(INET6_ATON('::FFFF:01.2.3.4'));
HEX(INET6_ATON('::FFFF:01.2.3.4'))
00000000000000000000FFFF01020304
SELECT HEX(INET6_ATON('::FFFF:1.02.3.4'));
HEX(INET6_ATON('::FFFF:1.02.3.4'))
00000000000000000000FFFF01020304
SELECT HEX(INET6_ATON('::FFFF:1.2.03.4'));
HEX(INET6_ATON('::FFFF:1.2.03.4'))
00000000000000000000FFFF01020304
SELECT HEX(INET6_ATON('::FFFF:1.2.3.04'));
HEX(INET6_ATON('::FFFF:1.2.3.04'))
00000000000000000000FFFF01020304
SELECT HEX(INET6_ATON('::FFFF:1.2.3.00'));
HEX(INET6_ATON('::FFFF:1.2.3.00'))
00000000000000000000FFFF01020300
# -- INET6_ATON: checking the length is either 4 or 16...
SELECT LENGTH(INET6_ATON('0.0.0.0'));
LENGTH(INET6_ATON('0.0.0.0'))
4
SELECT LENGTH(INET6_ATON('255.255.255.255'));
LENGTH(INET6_ATON('255.255.255.255'))
4
SELECT LENGTH(INET6_ATON('::'));
LENGTH(INET6_ATON('::'))
16
SELECT LENGTH(INET6_ATON('1020:3040:5060:7080:90A0:B0C0:D0E0:F010'));
LENGTH(INET6_ATON('1020:3040:5060:7080:90A0:B0C0:D0E0:F010'))
16
# -- INET6_NTOA: checking NULL, invalid types, out-of range values...
SELECT INET6_NTOA(NULL);
INET6_NTOA(NULL)
NULL
SELECT INET6_NTOA(123);
INET6_NTOA(123)
NULL
SELECT INET6_NTOA(123.456);
INET6_NTOA(123.456)
NULL
SELECT INET6_NTOA(NOW());
INET6_NTOA(NOW())
NULL
SELECT INET6_NTOA(UNHEX('C0A801'));
INET6_NTOA(UNHEX('C0A801'))
NULL
SELECT INET6_NTOA(UNHEX('C0A80102'));
INET6_NTOA(UNHEX('C0A80102'))
192.168.1.2
SELECT INET6_NTOA(UNHEX('C0A8010203'));
INET6_NTOA(UNHEX('C0A8010203'))
NULL
SELECT INET6_NTOA(UNHEX('0102030405060708090A0B0C0D0E0F'));
INET6_NTOA(UNHEX('0102030405060708090A0B0C0D0E0F'))
NULL
SELECT INET6_NTOA(UNHEX('0102030405060708090A0B0C0D0E0F10'));
INET6_NTOA(UNHEX('0102030405060708090A0B0C0D0E0F10'))
102:304:506:708:90a:b0c:d0e:f10
SELECT INET6_NTOA(UNHEX('0102030405060708090A0B0C0D0E0F1011'));
INET6_NTOA(UNHEX('0102030405060708090A0B0C0D0E0F1011'))
NULL
SELECT INET6_NTOA('1234'), INET6_NTOA(BINARY('1234'));
INET6_NTOA('1234') INET6_NTOA(BINARY('1234'))
NULL 49.50.51.52
SELECT INET6_NTOA('0123456789abcdef'), INET6_NTOA(BINARY('0123456789abcdef'));
INET6_NTOA('0123456789abcdef') INET6_NTOA(BINARY('0123456789abcdef'))
NULL 3031:3233:3435:3637:3839:6162:6364:6566
# -- Checking double-conversion...
SELECT INET6_NTOA(INET6_ATON('::'));
INET6_NTOA(INET6_ATON('::'))
::
SELECT INET6_NTOA(INET6_ATON('0::0'));
INET6_NTOA(INET6_ATON('0::0'))
::
SELECT INET6_NTOA(INET6_ATON('1::2'));
INET6_NTOA(INET6_ATON('1::2'))
1::2
SELECT INET6_NTOA(INET6_ATON('0::'));
INET6_NTOA(INET6_ATON('0::'))
::
SELECT INET6_NTOA(INET6_ATON('1::'));
INET6_NTOA(INET6_ATON('1::'))
1::
SELECT INET6_NTOA(INET6_ATON('::0'));
INET6_NTOA(INET6_ATON('::0'))
::
SELECT INET6_NTOA(INET6_ATON('::1'));
INET6_NTOA(INET6_ATON('::1'))
::1
SELECT INET6_NTOA(INET6_ATON('1:2:3:4:5:6:7:8'));
INET6_NTOA(INET6_ATON('1:2:3:4:5:6:7:8'))
1:2:3:4:5:6:7:8
SELECT INET6_NTOA(INET6_ATON('::2:3:4:5:6:7:8'));
INET6_NTOA(INET6_ATON('::2:3:4:5:6:7:8'))
::2:3:4:5:6:7:8
SELECT INET6_NTOA(INET6_ATON('1::3:4:5:6:7:8'));
INET6_NTOA(INET6_ATON('1::3:4:5:6:7:8'))
1::3:4:5:6:7:8
SELECT INET6_NTOA(INET6_ATON('1:2::4:5:6:7:8'));
INET6_NTOA(INET6_ATON('1:2::4:5:6:7:8'))
1:2::4:5:6:7:8
SELECT INET6_NTOA(INET6_ATON('1:2:3::5:6:7:8'));
INET6_NTOA(INET6_ATON('1:2:3::5:6:7:8'))
1:2:3::5:6:7:8
SELECT INET6_NTOA(INET6_ATON('1:2:3:4::6:7:8'));
INET6_NTOA(INET6_ATON('1:2:3:4::6:7:8'))
1:2:3:4::6:7:8
SELECT INET6_NTOA(INET6_ATON('1:2:3:4:5::7:8'));
INET6_NTOA(INET6_ATON('1:2:3:4:5::7:8'))
1:2:3:4:5::7:8
SELECT INET6_NTOA(INET6_ATON('1:2:3:4:5:6::8'));
INET6_NTOA(INET6_ATON('1:2:3:4:5:6::8'))
1:2:3:4:5:6::8
SELECT INET6_NTOA(INET6_ATON('1:2:3:4:5:6:7::'));
INET6_NTOA(INET6_ATON('1:2:3:4:5:6:7::'))
1:2:3:4:5:6:7::
SELECT INET6_NTOA(INET6_ATON('0000:0000::0000:0001'));
INET6_NTOA(INET6_ATON('0000:0000::0000:0001'))
::1
SELECT INET6_NTOA(INET6_ATON('1234:5678:9abc:def0:4321:8765:cba9:0fed'));
INET6_NTOA(INET6_ATON('1234:5678:9abc:def0:4321:8765:cba9:0fed'))
1234:5678:9abc:def0:4321:8765:cba9:fed
SELECT INET6_NTOA(INET6_ATON('0000:0000:0000:0000:0000:0000:0000:0001'));
INET6_NTOA(INET6_ATON('0000:0000:0000:0000:0000:0000:0000:0001'))
::1
SELECT INET6_NTOA(INET6_ATON('::C0A8:0102'));
INET6_NTOA(INET6_ATON('::C0A8:0102'))
::192.168.1.2
SELECT INET6_NTOA(INET6_ATON('::c0a8:0102'));
INET6_NTOA(INET6_ATON('::c0a8:0102'))
::192.168.1.2
SELECT INET6_NTOA(INET6_ATON('::192.168.1.2'));
INET6_NTOA(INET6_ATON('::192.168.1.2'))
::192.168.1.2
SELECT INET6_NTOA(INET6_ATON('::FfFf:C0a8:0102'));
INET6_NTOA(INET6_ATON('::FfFf:C0a8:0102'))
::ffff:192.168.1.2
SELECT INET6_NTOA(INET6_ATON('::ffff:c0a8:0102'));
INET6_NTOA(INET6_ATON('::ffff:c0a8:0102'))
::ffff:192.168.1.2
SELECT INET6_NTOA(INET6_ATON('::ffff:192.168.1.2'));
INET6_NTOA(INET6_ATON('::ffff:192.168.1.2'))
::ffff:192.168.1.2
SELECT INET6_NTOA(INET6_ATON('::01.2.3.4'));
INET6_NTOA(INET6_ATON('::01.2.3.4'))
::1.2.3.4
SELECT INET6_NTOA(INET6_ATON('::1.02.3.4'));
INET6_NTOA(INET6_ATON('::1.02.3.4'))
::1.2.3.4
SELECT INET6_NTOA(INET6_ATON('::1.2.03.4'));
INET6_NTOA(INET6_ATON('::1.2.03.4'))
::1.2.3.4
SELECT INET6_NTOA(INET6_ATON('::1.2.3.04'));
INET6_NTOA(INET6_ATON('::1.2.3.04'))
::1.2.3.4
SELECT INET6_NTOA(INET6_ATON('::1.2.3.00'));
INET6_NTOA(INET6_ATON('::1.2.3.00'))
::1.2.3.0
SELECT INET6_NTOA(INET6_ATON('::FFFF:01.2.3.4'));
INET6_NTOA(INET6_ATON('::FFFF:01.2.3.4'))
::ffff:1.2.3.4
SELECT INET6_NTOA(INET6_ATON('::FFFF:1.02.3.4'));
INET6_NTOA(INET6_ATON('::FFFF:1.02.3.4'))
::ffff:1.2.3.4
SELECT INET6_NTOA(INET6_ATON('::FFFF:1.2.03.4'));
INET6_NTOA(INET6_ATON('::FFFF:1.2.03.4'))
::ffff:1.2.3.4
SELECT INET6_NTOA(INET6_ATON('::FFFF:1.2.3.04'));
INET6_NTOA(INET6_ATON('::FFFF:1.2.3.04'))
::ffff:1.2.3.4
SELECT INET6_NTOA(INET6_ATON('::FFFF:1.2.3.00'));
INET6_NTOA(INET6_ATON('::FFFF:1.2.3.00'))
::ffff:1.2.3.0
# -- Comparing INET_ATON() and INET6_ATON()...
SELECT HEX(INET_ATON('192.168.1.2'));
HEX(INET_ATON('192.168.1.2'))
C0A80102
SELECT HEX(INET6_ATON('192.168.1.2'));
HEX(INET6_ATON('192.168.1.2'))
C0A80102
SELECT HEX(INET_ATON('255.255.255.255'));
HEX(INET_ATON('255.255.255.255'))
FFFFFFFF
SELECT HEX(INET6_ATON('255.255.255.255'));
HEX(INET6_ATON('255.255.255.255'))
FFFFFFFF
SELECT HEX(INET_ATON('192.168.08.2'));
HEX(INET_ATON('192.168.08.2'))
C0A80802
SELECT HEX(INET6_ATON('192.168.08.2'));
HEX(INET6_ATON('192.168.08.2'))
C0A80802
SELECT HEX(INET_ATON('192.168.0x8.2'));
HEX(INET_ATON('192.168.0x8.2'))
NULL
SELECT HEX(INET6_ATON('192.168.0x8.2'));
HEX(INET6_ATON('192.168.0x8.2'))
NULL
SELECT HEX(INET_ATON('1.2.255'));
HEX(INET_ATON('1.2.255'))
10200FF
SELECT HEX(INET6_ATON('1.2.255'));
HEX(INET6_ATON('1.2.255'))
NULL
SELECT HEX(INET_ATON('1.2.256'));
HEX(INET_ATON('1.2.256'))
NULL
SELECT HEX(INET6_ATON('1.2.256'));
HEX(INET6_ATON('1.2.256'))
NULL
SELECT HEX(INET_ATON('1.0002.3.4'));
HEX(INET_ATON('1.0002.3.4'))
1020304
SELECT HEX(INET6_ATON('1.0002.3.4'));
HEX(INET6_ATON('1.0002.3.4'))
NULL
SELECT HEX(INET_ATON('1.2.3.4.5'));
HEX(INET_ATON('1.2.3.4.5'))
102030405
SELECT HEX(INET6_ATON('1.2.3.4.5'));
HEX(INET6_ATON('1.2.3.4.5'))
NULL
# -- Checking mix of INET- and INET6- functions...
SELECT HEX(INET6_ATON(INET_NTOA(INET_ATON('1.2.3.4')))) AS x;
x
01020304
# -- Checking IS_IPV4() / IS_IPV6()...
SELECT IS_IPV4(NULL);
IS_IPV4(NULL)
0
SELECT IS_IPV4(1);
IS_IPV4(1)
0
SELECT IS_IPV4(1.0);
IS_IPV4(1.0)
0
SELECT IS_IPV4('1.2.3.4');
IS_IPV4('1.2.3.4')
1
SELECT IS_IPV4('001.02.000.255');
IS_IPV4('001.02.000.255')
1
SELECT IS_IPV4('::1.2.0.255');
IS_IPV4('::1.2.0.255')
0
SELECT IS_IPV4('::1');
IS_IPV4('::1')
0
SELECT IS_IPV4(BINARY('1.2.3.4'));
IS_IPV4(BINARY('1.2.3.4'))
1
SELECT IS_IPV6(NULL);
IS_IPV6(NULL)
0
SELECT IS_IPV6(1);
IS_IPV6(1)
0
SELECT IS_IPV6(1.0);
IS_IPV6(1.0)
0
SELECT IS_IPV6('1.2.3.4');
IS_IPV6('1.2.3.4')
0
SELECT IS_IPV6('001.02.000.255');
IS_IPV6('001.02.000.255')
0
SELECT IS_IPV6('::001.02.000.255');
IS_IPV6('::001.02.000.255')
1
SELECT IS_IPV6('::1.2.0.255');
IS_IPV6('::1.2.0.255')
1
SELECT IS_IPV6('::1');
IS_IPV6('::1')
1
SELECT IS_IPV6('0000:0000:0000:0000:0000:0000:0000:0001');
IS_IPV6('0000:0000:0000:0000:0000:0000:0000:0001')
1
SELECT IS_IPV6(BINARY('0000:0000:0000:0000:0000:0000:0000:0001'));
IS_IPV6(BINARY('0000:0000:0000:0000:0000:0000:0000:0001'))
1
# -- Checking IS_IPV4_MAPPED() and IS_IPV4_COMPAT()...
SELECT IS_IPV4_MAPPED(INET6_ATON('1.2.3.4')),
IS_IPV4_COMPAT(INET6_ATON('1.2.3.4'));
IS_IPV4_MAPPED(INET6_ATON('1.2.3.4')) IS_IPV4_COMPAT(INET6_ATON('1.2.3.4'))
0 0
SELECT IS_IPV4_MAPPED(INET6_ATON('::1.2.3.4')),
IS_IPV4_COMPAT(INET6_ATON('::1.2.3.4'));
IS_IPV4_MAPPED(INET6_ATON('::1.2.3.4')) IS_IPV4_COMPAT(INET6_ATON('::1.2.3.4'))
0 1
SELECT IS_IPV4_MAPPED(INET6_ATON('::FFFF:1.2.3.4')),
IS_IPV4_COMPAT(INET6_ATON('::FFFF:1.2.3.4'));
IS_IPV4_MAPPED(INET6_ATON('::FFFF:1.2.3.4')) IS_IPV4_COMPAT(INET6_ATON('::FFFF:1.2.3.4'))
1 0
SELECT IS_IPV4_MAPPED(INET6_ATON('::ABCD:1.2.3.4')),
IS_IPV4_COMPAT(INET6_ATON('::ABCD:1.2.3.4'));
IS_IPV4_MAPPED(INET6_ATON('::ABCD:1.2.3.4')) IS_IPV4_COMPAT(INET6_ATON('::ABCD:1.2.3.4'))
0 0
SELECT IS_IPV4_MAPPED(INET6_ATON('::1')),
IS_IPV4_COMPAT(INET6_ATON('::1'));
IS_IPV4_MAPPED(INET6_ATON('::1')) IS_IPV4_COMPAT(INET6_ATON('::1'))
0 0
SELECT IS_IPV4_MAPPED(INET6_ATON('::')),
IS_IPV4_COMPAT(INET6_ATON('::'));
IS_IPV4_MAPPED(INET6_ATON('::')) IS_IPV4_COMPAT(INET6_ATON('::'))
0 0
# -- Checking IS_IPV4_COMPAT()...
# -- Working with a table...
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1(ip INT UNSIGNED);
CREATE TABLE t2(ip VARBINARY(16));
INSERT INTO t1 VALUES
(INET_ATON('1.2.3.4')), (INET_ATON('255.255.255.255'));
SELECT INET_NTOA(ip) FROM t1;
INET_NTOA(ip)
1.2.3.4
255.255.255.255
INSERT INTO t2 SELECT INET6_ATON(INET_NTOA(ip)) FROM t1;
SELECT INET6_NTOA(ip), HEX(ip), LENGTH(ip) FROM t2;
INET6_NTOA(ip) HEX(ip) LENGTH(ip)
1.2.3.4 01020304 4
255.255.255.255 FFFFFFFF 4
DELETE FROM t2;
INSERT INTO t2 VALUES
(INET6_ATON('1.2.3.4')), (INET6_ATON('255.255.255.255')),
(INET6_ATON('::1.2.3.4')), (INET6_ATON('::ffff:255.255.255.255')),
(INET6_ATON('::')), (INET6_ATON('::1')),
(INET6_ATON('1020:3040:5060:7080:90A0:B0C0:D0E0:F010'));
SELECT INET6_NTOA(ip), HEX(ip), LENGTH(ip) FROM t2;
INET6_NTOA(ip) HEX(ip) LENGTH(ip)
1.2.3.4 01020304 4
255.255.255.255 FFFFFFFF 4
::1.2.3.4 00000000000000000000000001020304 16
::ffff:255.255.255.255 00000000000000000000FFFFFFFFFFFF 16
:: 00000000000000000000000000000000 16
::1 00000000000000000000000000000001 16
1020:3040:5060:7080:90a0:b0c0:d0e0:f010 102030405060708090A0B0C0D0E0F010 16
DROP TABLE t1;
DROP TABLE t2;
# -- Done.

View File

@ -2658,6 +2658,17 @@ group_concat( i ) field
NULL NULL
8
drop table t1;
#
# Bug#11766684 59851: UNINITIALISED VALUE IN ITEM_FUNC_LIKE::SELECT_OPTIMIZE WITH SUBQUERY AND
#
CREATE TABLE t2(a INT, KEY(a));
INSERT INTO t2 VALUES (1),(2);
CREATE TABLE t1(b INT, PRIMARY KEY(b));
INSERT INTO t1 VALUES (0),(254);
SELECT 1 FROM t2 WHERE a LIKE
(SELECT EXPORT_SET(1, b, b, b, b) FROM t1 LIMIT 1);
1
DROP TABLE t1, t2;
End of 5.1 tests
#
# Start of 5.3 tests

View File

@ -1091,9 +1091,9 @@ NULL
select isnull(week(now() + 0)), isnull(week(now() + 0.2)),
week(20061108), week(20061108.01), week(20061108085411.000002);
isnull(week(now() + 0)) isnull(week(now() + 0.2)) week(20061108) week(20061108.01) week(20061108085411.000002)
0 0 45 NULL 45
0 0 45 45 45
Warnings:
Warning 1292 Incorrect datetime value: '20061108.01'
Warning 1292 Truncated incorrect datetime value: '20061108.01'
End of 4.1 tests
select time_format('100:00:00', '%H %k %h %I %l');
time_format('100:00:00', '%H %k %h %I %l')
@ -1878,9 +1878,15 @@ least(1, f1)
Warnings:
Warning 1292 Incorrect datetime value: '1'
drop table t1;
SET timestamp=UNIX_TIMESTAMP('2014-04-14 10:10:10');
select now() > coalesce(time('21:43:24'), date('2010-05-03'));
now() > coalesce(time('21:43:24'), date('2010-05-03'))
0
SET timestamp=UNIX_TIMESTAMP('2014-04-14 22:22:22');
select now() > coalesce(time('21:43:24'), date('2010-05-03'));
now() > coalesce(time('21:43:24'), date('2010-05-03'))
1
SET timestamp=DEFAULT;
create table t1 (f1 timestamp);
select * from t1 where f1 > f1 and f1 <=> timestampadd(hour, 9 , '2010-01-01 16:55:35');
f1
@ -1918,15 +1924,20 @@ select cast(f1 AS time) from t1;
cast(f1 AS time)
00:00:00
drop table t1;
SET timestamp=UNIX_TIMESTAMP('2014-06-01 10:20:30');
select greatest(cast("0-0-0" as date), cast("10:20:05" as time));
greatest(cast("0-0-0" as date), cast("10:20:05" as time))
0000-00-00
2014-06-01
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '0000-00-00';
greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '0000-00-00'
0
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01';
greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01'
1
select cast(greatest(cast("0-0-0" as date), cast("10:20:05" as time)) as datetime(6));
cast(greatest(cast("0-0-0" as date), cast("10:20:05" as time)) as datetime(6))
0000-00-00 00:00:00.000000
2014-06-01 00:00:00.000000
SET timestamp=DEFAULT;
select microsecond('12:00:00.123456'), microsecond('2009-12-31 23:59:59.000010');
microsecond('12:00:00.123456') microsecond('2009-12-31 23:59:59.000010')
123456 10
@ -2134,15 +2145,16 @@ DROP TABLE t1;
#
# MDEV-4870 Wrong values of CASE, COALESCE, IFNULL on a combination of different temporal types
#
SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30');
CREATE TABLE t1 (dt2 DATETIME(2), t3 TIME(3), d DATE);
INSERT INTO t1 VALUES ('2001-01-01 00:00:00.12', '00:00:00.567', '2002-01-01');
SELECT CASE WHEN 0 THEN dt2 ELSE t3 END FROM t1;
CASE WHEN 0 THEN dt2 ELSE t3 END
0000-00-00 00:00:00.567
2001-01-01 00:00:00.567
CREATE TABLE t2 AS SELECT CASE WHEN 0 THEN dt2 ELSE t3 END FROM t1;
SELECT * FROM t2;
CASE WHEN 0 THEN dt2 ELSE t3 END
0000-00-00 00:00:00.567
2001-01-01 00:00:00.567
SHOW COLUMNS FROM t2;
Field Type Null Key Default Extra
CASE WHEN 0 THEN dt2 ELSE t3 END datetime(3) YES NULL
@ -2161,7 +2173,7 @@ CONCAT(CASE WHEN 1 THEN d ELSE t3 END)
2002-01-01 00:00:00.000
SELECT CASE WHEN 1 THEN t3 ELSE d END FROM t1;
CASE WHEN 1 THEN t3 ELSE d END
0000-00-00 00:00:00.567
2001-01-01 00:00:00.567
SELECT COALESCE(d, t3) FROM t1;
COALESCE(d, t3)
2002-01-01 00:00:00.000
@ -2181,6 +2193,7 @@ SELECT IFNULL(d, t3), CONCAT(IFNULL(d, t3)) FROM t1;
IFNULL(d, t3) CONCAT(IFNULL(d, t3))
2002-01-01 00:00:00.000 2002-01-01 00:00:00.000
DROP TABLE t1;
SET timestamp=DEFAULT;
#
# MDEV-4724 Some temporal functions do not preserve microseconds
#
@ -2483,6 +2496,14 @@ SELECT 1 FROM t1 GROUP BY MONTHNAME(0) WITH ROLLUP;
1
DROP TABLE t1;
#
# MDEV-6099 Bad results for DATE_ADD(.., INTERVAL 2000000000000000000.0 SECOND)
#
SELECT DATE_ADD('2001-01-01 10:20:30',INTERVAL 250000000000.0 SECOND) AS c1, DATE_ADD('2001-01-01 10:20:30',INTERVAL 2000000000000000000.0 SECOND) AS c2;
c1 c2
9923-03-10 22:47:10.0 NULL
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '2000000000000000000.0'
#
# MDEV-4838 Wrong metadata for DATE_ADD('string', INVERVAL)
#
SELECT DATE_ADD('2011-01-02 12:13:14', INTERVAL 1 MINUTE);
@ -2562,3 +2583,20 @@ Warnings:
Warning 1441 Datetime function: datetime field overflow
Warning 1441 Datetime function: datetime field overflow
DROP TABLE t1;
#
# MDEV-6101 Hybrid functions do not add CURRENT_DATE when converting TIME to DATETIME
#
SET timestamp=UNIX_TIMESTAMP('2014-04-15 01:02:03');
SELECT IF(1,TIME'10:20:30',DATE'2001-01-01');
IF(1,TIME'10:20:30',DATE'2001-01-01')
2014-04-15 10:20:30
SELECT IFNULL(TIME'10:20:30',DATE'2001-01-01');
IFNULL(TIME'10:20:30',DATE'2001-01-01')
2014-04-15 10:20:30
SELECT CASE WHEN 1 THEN TIME'10:20:30' ELSE DATE'2001-01-01' END;
CASE WHEN 1 THEN TIME'10:20:30' ELSE DATE'2001-01-01' END
2014-04-15 10:20:30
SELECT COALESCE(TIME'10:20:30',DATE'2001-01-01');
COALESCE(TIME'10:20:30',DATE'2001-01-01')
2014-04-15 10:20:30
SET timestamp=DEFAULT;

View File

@ -2525,3 +2525,29 @@ DROP USER mysqltest_u1@localhost;
# End of Bug#38347.
#
# Bug#11756966 - 48958: STORED PROCEDURES CAN BE LEVERAGED TO BYPASS
# DATABASE SECURITY
#
DROP DATABASE IF EXISTS secret;
DROP DATABASE IF EXISTS no_such_db;
CREATE DATABASE secret;
GRANT USAGE ON *.* TO untrusted@localhost;
# Connection con1
SHOW GRANTS;
Grants for untrusted@localhost
GRANT USAGE ON *.* TO 'untrusted'@'localhost'
SHOW DATABASES;
Database
information_schema
test
# Both statements below should fail with the same error.
# They used to give different errors, thereby
# hinting that the secret database exists.
CREATE PROCEDURE no_such_db.foo() BEGIN END;
ERROR 42000: Access denied for user 'untrusted'@'localhost' to database 'no_such_db'
CREATE PROCEDURE secret.peek_at_secret() BEGIN END;
ERROR 42000: Access denied for user 'untrusted'@'localhost' to database 'secret'
# Connection default
DROP USER untrusted@localhost;
DROP DATABASE secret;

View File

@ -1358,8 +1358,9 @@ explain select a1,a2,b,min(c),max(c) from t1
where exists ( select * from t2 where t2.c = t1.c )
group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL idx_t1_1 163 NULL 128 Using where; Using index
2 DEPENDENT SUBQUERY t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index
1 PRIMARY t1 index NULL idx_t1_1 163 NULL 128 Using index
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 func 1
2 MATERIALIZED t2 index NULL idx_t2_1 163 NULL 164 Using index
select a1,a2,b,min(c),max(c) from t1
where exists ( select * from t2 where t2.c = t1.c )
group by a1,a2,b;
@ -1384,7 +1385,7 @@ explain select a1,a2,b,min(c),max(c) from t1
where exists ( select * from t2 where t2.c > 'b1' )
group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by
1 PRIMARY t1 index NULL idx_t1_1 163 NULL 128 Using index
2 SUBQUERY t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index
select a1,a2,b,min(c),max(c) from t1
where exists ( select * from t2 where t2.c > 'b1' )
@ -1410,20 +1411,20 @@ explain select a1,a2,b,c,min(c), max(c) from t1
where exists ( select * from t2 where t1.b > 'a' and t2.c > 'b1' )
group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by
1 PRIMARY t1 index NULL idx_t1_1 163 NULL 128 Using where; Using index
2 DEPENDENT SUBQUERY t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index
select a1,a2,b,c,min(c), max(c) from t1
where exists ( select * from t2 where t1.b > 'a' and t2.c > 'b1' )
group by a1,a2,b;
a1 a2 b c min(c) max(c)
a a b h112 e112 h112
a b b p122 m122 p122
b a b h212 e212 h212
b b b p222 m222 p222
c a b h312 e312 h312
c b b p322 m322 p322
d a b h412 e412 h412
d b b p422 m422 p422
a a b e112 e112 h112
a b b m122 m122 p122
b a b e212 e212 h212
b b b m222 m222 p222
c a b e312 e312 h312
c b b m322 m322 p322
d a b e412 e412 h412
d b b m422 m422 p422
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='semijoin_with_cache=off';
explain select a1,a2,b,c,min(c), max(c) from t1
@ -1432,7 +1433,7 @@ where t2.c in (select c from t3 where t3.c > t1.b) and
t2.c > 'b1' )
group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by
1 PRIMARY t1 index NULL idx_t1_1 163 NULL 128 Using where; Using index
2 DEPENDENT SUBQUERY t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index
2 DEPENDENT SUBQUERY t3 index NULL idx_t3_1 10 NULL 192 Using where; Using index; FirstMatch(t2)
select a1,a2,b,c,min(c), max(c) from t1
@ -1441,22 +1442,22 @@ where t2.c in (select c from t3 where t3.c > t1.b) and
t2.c > 'b1' )
group by a1,a2,b;
a1 a2 b c min(c) max(c)
a a a d111 a111 d111
a a b h112 e112 h112
a b a l121 i121 l121
a b b p122 m122 p122
b a a d211 a211 d211
b a b h212 e212 h212
b b a l221 i221 l221
b b b p222 m222 p222
c a a d311 a311 d311
c a b h312 e312 h312
c b a l321 i321 l321
c b b p322 m322 p322
d a a d411 a411 d411
d a b h412 e412 h412
d b a l421 i421 l421
d b b p422 m422 p422
a a a a111 a111 d111
a a b e112 e112 h112
a b a i121 i121 l121
a b b m122 m122 p122
b a a a211 a211 d211
b a b e212 e212 h212
b b a i221 i221 l221
b b b m222 m222 p222
c a a a311 a311 d311
c a b e312 e312 h312
c b a i321 i321 l321
c b b m322 m322 p322
d a a a411 a411 d411
d a b e412 e412 h412
d b a i421 i421 l421
d b b m422 m422 p422
SET optimizer_switch=@save_optimizer_switch;
explain select a1,a2,b,c,min(c), max(c) from t1
where exists ( select * from t2 where t1.c > 'a' and t2.c > 'b1' )

View File

@ -552,9 +552,9 @@ explain select * from t1
where exists (select 1 from t2, t3
where t2.a=t1.a and (t3.a=t2.b or t3.b=t2.b or t3.b=t2.b+1));
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 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t3 ALL a,b NULL NULL NULL 1002 Range checked for each record (index map: 0x3)
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
1 PRIMARY t3 ALL a,b NULL NULL NULL 1002 Range checked for each record (index map: 0x3); FirstMatch(t1)
select * from t1
where exists (select 1 from t2, t3
where t2.a=t1.a and (t3.a=t2.b or t3.b=t2.b or t3.b=t2.b+1));

View File

@ -1130,7 +1130,7 @@ CREATE PROCEDURE p1 ()
BEGIN
SELECT 'foo' FROM DUAL;
END |
ERROR 42000: Unknown database 'information_schema'
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
select ROUTINE_NAME from routines where ROUTINE_SCHEMA='information_schema';
ROUTINE_NAME
grant all on information_schema.* to 'user1'@'localhost';

View File

@ -5577,8 +5577,8 @@ EXPLAIN
SELECT * FROM t1, t2 LEFT JOIN t3 ON t2.b=t3.b WHERE t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
1 SIMPLE t2 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t2 ALL NULL NULL NULL NULL 12 Using where
1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where
SELECT * FROM t1, t2 LEFT JOIN t3 ON t2.b=t3.b WHERE t1.a=t2.a;
a a b b c
3 3 30 30 300
@ -5703,4 +5703,27 @@ select @counter;
2
drop table t1,t2,t3;
set expensive_subquery_limit=default;
#
# mdev-6071: EXPLAIN chooses to use join buffer while execution turns it down
#
create table t1 (a int);
insert into t1 values
(7), (9), (1), (4), (2), (3), (5), (8), (11), (6), (10);
explain select count(*) from t1, t1 t2 where t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 11
1 SIMPLE t2 ALL NULL NULL NULL NULL 11 Using where; Using join buffer (flat, BNL join)
set join_buffer_space_limit=1024*8;
select @@join_buffer_space_limit;
@@join_buffer_space_limit
8192
select @@join_buffer_size;
@@join_buffer_size
131072
explain select count(*) from t1, t1 t2 where t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 11
1 SIMPLE t2 ALL NULL NULL NULL NULL 11 Using where
set join_buffer_space_limit=default;
drop table t1;
set @@optimizer_switch=@save_optimizer_switch;

View File

@ -520,3 +520,15 @@ LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug11735141.txt' INTO TABLE t1;
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1;
End of 5.1 tests
#
# Bug#11759519 INFINITE HANG WITH 100% CPU USAGE WITH LOAD DATA LOCAL AND IMPORT ERRORS
#
SET @old_mode= @@sql_mode;
CREATE TABLE t1 (fld1 INT);
SET sql_mode='strict_all_tables';
# Without fix, load data hangs forever.
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/mysql' REPLACE INTO TABLE t1
FIELDS TERMINATED BY 't' LINES TERMINATED BY '';
Got one of the listed errors
SET @@sql_mode= @old_mode;
DROP TABLE t1;

View File

@ -1172,12 +1172,12 @@ INSERT INTO t1 (i) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19),
#
EXPLAIN DELETE FROM t1 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 8 Using where
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 5 Using where
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED DELETE FROM t1 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 8 100.00 Using where
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 5 100.00 Using where
# Status of EXPLAIN EXTENDED query
Variable_name Value
FLUSH STATUS;
@ -1479,12 +1479,12 @@ INSERT INTO t2 (i) SELECT i FROM t1;
#
EXPLAIN DELETE FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 8 Using where
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 5 Using where
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED DELETE FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 8 100.00 Using where
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 5 100.00 Using where
# Status of EXPLAIN EXTENDED query
Variable_name Value
FLUSH STATUS;
@ -1606,12 +1606,12 @@ INSERT INTO t2 (i) SELECT i FROM t1;
#
EXPLAIN UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 8 Using where; Using buffer
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 5 Using where; Using buffer
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 8 100.00 Using where; Using buffer
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 5 100.00 Using where; Using buffer
# Status of EXPLAIN EXTENDED query
Variable_name Value
FLUSH STATUS;
@ -1915,12 +1915,12 @@ INSERT INTO t2 (i) SELECT i FROM t1;
#
EXPLAIN UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 8 Using where; Using buffer
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 5 Using where; Using buffer
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 8 100.00 Using where; Using buffer
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 5 100.00 Using where; Using buffer
# Status of EXPLAIN EXTENDED query
Variable_name Value
FLUSH STATUS;

View File

@ -150,6 +150,60 @@ CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
create table `t1` (`id` varchar(15) DEFAULT NULL) ENGINE=MyISAM ROW_FORMAT=FIXED;
insert into t1 values ('aaa'),('bbb'),('ccc'),('ddd'),('eee');
insert into t1 (select * from t1);
insert into t1 (select * from t1);
insert into t1 (select * from t1);
insert into t1 (select * from t1);
checksum table t1;
Table Checksum
test.t1 2696656816
insert into t1 values(NULL);
checksum table t1;
Table Checksum
test.t1 2679879600
flush table t1;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
checksum table t1;
Table Checksum
test.t1 2679879600
alter table t1 checksum=1 row_format=fixed;
checksum table t1;
Table Checksum
test.t1 2679879600
flush table t1;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
checksum table t1;
Table Checksum
test.t1 2679879600
alter table t1 row_format=dynamic checksum=0;
checksum table t1;
Table Checksum
test.t1 2330021136
flush table t1;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
checksum table t1;
Table Checksum
test.t1 2330021136
alter table t1 checksum=1 row_format=dynamic;
checksum table t1;
Table Checksum
test.t1 2330021136
flush table t1;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
checksum table t1;
Table Checksum
test.t1 2330021136
drop table t1;
#
# BUG#11751736: DROP DATABASE STATEMENT SHOULD REMOVE .OLD SUFFIX FROM
# DATABASE DIRECTORY

View File

@ -553,7 +553,6 @@ The following options may be given as the first argument:
record samples
--performance-schema
Enable the performance schema.
(Defaults to on; use --skip-performance-schema to disable.)
--performance-schema-accounts-size=#
Maximum number of instrumented user@host accounts. Use 0
to disable, -1 for automated sizing.
@ -683,7 +682,7 @@ The following options may be given as the first argument:
plugins from a given library_file will be loaded.
--plugin-load-add=name
Optional semicolon-separated list of plugins to load.
This option adds to the list speficied by --plugin-load
This option adds to the list specified by --plugin-load
in an incremental way. It can be specified many times,
adding more plugins every time.
--plugin-maturity=name
@ -756,7 +755,7 @@ The following options may be given as the first argument:
--relay-log-space-limit=#
Maximum space to use for all relay logs
--replicate-annotate-row-events
Tells the slave to write annotate rows events recieved
Tells the slave to write annotate rows events received
from the master to its own binary log. Ignored if
log_slave_updates is not set
--replicate-do-db=name
@ -1284,10 +1283,10 @@ old-style-user-limits FALSE
optimizer-prune-level 1
optimizer-search-depth 62
optimizer-selectivity-sampling-limit 100
optimizer-switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on
optimizer-switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on
optimizer-use-condition-selectivity 1
performance-schema TRUE
performance-schema-accounts-size 10
performance-schema FALSE
performance-schema-accounts-size -1
performance-schema-consumer-events-stages-current FALSE
performance-schema-consumer-events-stages-history FALSE
performance-schema-consumer-events-stages-history-long FALSE
@ -1300,36 +1299,36 @@ performance-schema-consumer-events-waits-history-long FALSE
performance-schema-consumer-global-instrumentation TRUE
performance-schema-consumer-statements-digest TRUE
performance-schema-consumer-thread-instrumentation TRUE
performance-schema-digests-size 1000
performance-schema-events-stages-history-long-size 100
performance-schema-events-stages-history-size 5
performance-schema-events-statements-history-long-size 100
performance-schema-events-statements-history-size 5
performance-schema-events-waits-history-long-size 100
performance-schema-events-waits-history-size 5
performance-schema-hosts-size 20
performance-schema-digests-size -1
performance-schema-events-stages-history-long-size -1
performance-schema-events-stages-history-size -1
performance-schema-events-statements-history-long-size -1
performance-schema-events-statements-history-size -1
performance-schema-events-waits-history-long-size -1
performance-schema-events-waits-history-size -1
performance-schema-hosts-size -1
performance-schema-instrument
performance-schema-max-cond-classes 80
performance-schema-max-cond-instances 836
performance-schema-max-cond-instances -1
performance-schema-max-file-classes 50
performance-schema-max-file-handles 32768
performance-schema-max-file-instances 1556
performance-schema-max-file-instances -1
performance-schema-max-mutex-classes 200
performance-schema-max-mutex-instances 3282
performance-schema-max-mutex-instances -1
performance-schema-max-rwlock-classes 40
performance-schema-max-rwlock-instances 1724
performance-schema-max-rwlock-instances -1
performance-schema-max-socket-classes 10
performance-schema-max-socket-instances 179
performance-schema-max-socket-instances -1
performance-schema-max-stage-classes 150
performance-schema-max-statement-classes 180
performance-schema-max-table-handles 445
performance-schema-max-table-instances 445
performance-schema-max-table-handles -1
performance-schema-max-table-instances -1
performance-schema-max-thread-classes 50
performance-schema-max-thread-instances 224
performance-schema-session-connect-attrs-size 512
performance-schema-max-thread-instances -1
performance-schema-session-connect-attrs-size -1
performance-schema-setup-actors-size 100
performance-schema-setup-objects-size 100
performance-schema-users-size 5
performance-schema-users-size -1
plugin-maturity unknown
port 3306
port-open-timeout 0

View File

@ -95,8 +95,9 @@ INSERT INTO t1 VALUES (NULL, '00:20:12');
INSERT INTO t1 VALUES (NULL, '-00:20:12');
SELECT IF(1,ADDDATE(IFNULL(a,b),0),1) FROM t1;
IF(1,ADDDATE(IFNULL(a,b),0),1)
0000-00-00 00:20:12
NULL
NULL
Warnings:
Warning 1292 Incorrect datetime value: '0000-00-00 00:20:12'
Warning 1292 Truncated incorrect datetime value: '-00:20:12'
DROP TABLE t1;

View File

@ -2936,3 +2936,16 @@ where A.b = B.b
order by A.col2, B.col2 limit 10, 1000000;
drop table t1,t2,t3;
End of 5.5 tests
#
# MDEV-5884: EXPLAIN UPDATE ... ORDER BY LIMIT shows wrong #rows
#
create table t2(a int);
insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1 (key1 int, col1 int, key(key1));
insert into t1
select A.a + 10 * B.a + 100 * C.a, 1234 from t2 A, t2 B, t2 C;
# Should show rows=2, not rows=100
explain update t1 set key1=key1+1 where key1 between 10 and 110 order by key1 limit 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range key1 key1 5 NULL 2 Using where; Using buffer
drop table t1,t2;

View File

@ -147,6 +147,14 @@ SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
a b c
1 ABC-АБВ DEF-ÂÃÄ
2 NULL NULL
SELECT * FROM t1;
a b c
1 ABC-АБВ DEF-ÂÃÄ
2 NULL NULL
SELECT * FROM t2;
a b c
1 ABC-АБВ DEF-ÂÃÄ
2 NULL NULL
SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' LINES STARTING BY 'ъ';
Warnings:
Warning 1638 Non-ASCII separator arguments are not fully supported
@ -175,6 +183,14 @@ SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
a b c
1 ABC-АБВ DEF-ÂÃÄ
2 NULL NULL
SELECT * FROM t1;
a b c
1 ABC-АБВ DEF-ÂÃÄ
2 NULL NULL
SELECT * FROM t2;
a b c
1 ABC-АБВ DEF-ÂÃÄ
2 NULL NULL
# Default (binary) charset:
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' FROM t1;
##################################################

View File

@ -3301,3 +3301,55 @@ explain partitions select * from t1 where a between 10 and 10+33;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1,p2 ALL NULL NULL NULL NULL 100 Using where
drop table t0, t1;
#
# MDEV-6239: Partition pruning is not working as expected in an inner query
#
create table t1
(
company_id bigint(5),
dept_id bigint(5),
emp_id bigint(5),
emp_name varchar(100),
primary key (company_id, emp_id)
) partition by list (company_id) (
partition p_1000 values in (1000),
partition p_2000 values in (2000),
partition p_3000 values in (3000)
);
create table t2
(
company_id bigint(5),
dept_id bigint(5),
dept_name varchar(100),
primary key (company_id, dept_id)
) partition by list (company_id) (
partition p_1000 values in (1000),
partition p_2000 values in (2000),
partition p_3000 values in (3000)
);
insert into t2 values
(1000, 10, 'Engineering'),
(1000, 20, 'Product Management'),
(1000, 30, 'QA'),
(2000, 40, 'Support'),
(2000, 50, 'Professional Services');
insert into t1 values
(1000, 10, 1, 'John'),
(1000, 10, 2, 'Smith'),
(1000, 20, 3, 'Jacob'),
(1000, 20, 4, 'Brian'),
(1000, 30, 5, 'Chris'),
(1000, 30, 6, 'Ryan'),
(2000, 40, 7, 'Karin'),
(2000, 40, 8, 'Jay'),
(2000, 50, 9, 'Ana'),
(2000, 50, 10, 'Jessica');
# Table t2 should have only partition p_1000.
explain partitions
select * from t1
where company_id = 1000
and dept_id in (select dept_id from t2 where COMPANY_ID = 1000);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 PRIMARY t2 p_1000 ref PRIMARY PRIMARY 8 const 2 Using index
1 PRIMARY t1 p_1000 ALL PRIMARY NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
drop table t1,t2;

View File

@ -613,8 +613,8 @@ insert into t2 values ("1", "1", "sup", "0"), ("2", "1", "sup", "1"),
("4", "1", "sup", "0");
create table t3 (
id int(11) not null default '0',
preceeding_id int(11) not null default '0',
primary key (id,preceeding_id)
preceding_id int(11) not null default '0',
primary key (id,preceding_id)
);
create table t4 (
user_id varchar(50) not null,
@ -625,7 +625,7 @@ insert into t4 values("nicke", "imp");
prepare stmt from
'select distinct t1.partner_id
from t1 left join t3 on t1.id = t3.id
left join t1 pp on pp.id = t3.preceeding_id
left join t1 pp on pp.id = t3.preceding_id
where
exists (
select *

View File

@ -3256,7 +3256,7 @@ values
( 50, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 ) ;
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1265 Data truncated for column 'c16' at row 1
Note 1265 Data truncated for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
insert into t9
( c1, c13, c14, c15, c16, c17 )
@ -3264,7 +3264,7 @@ values
( 51, @arg00, @arg00, @arg00, @arg00, @arg00) ;
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1265 Data truncated for column 'c16' at row 1
Note 1265 Data truncated for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
prepare stmt1 from "insert into t9
( c1, c13, c14, c15, c16, c17 )
@ -3273,7 +3273,7 @@ values
execute stmt1 ;
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1265 Data truncated for column 'c16' at row 1
Note 1265 Data truncated for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
prepare stmt2 from "insert into t9
( c1, c13, c14, c15, c16, c17 )
@ -3282,7 +3282,7 @@ values
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1265 Data truncated for column 'c16' at row 1
Note 1265 Data truncated for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
set @arg00= 'abc' ;
set @arg00= NULL ;

View File

@ -3239,7 +3239,7 @@ values
( 50, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 ) ;
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1265 Data truncated for column 'c16' at row 1
Note 1265 Data truncated for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
insert into t9
( c1, c13, c14, c15, c16, c17 )
@ -3247,7 +3247,7 @@ values
( 51, @arg00, @arg00, @arg00, @arg00, @arg00) ;
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1265 Data truncated for column 'c16' at row 1
Note 1265 Data truncated for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
prepare stmt1 from "insert into t9
( c1, c13, c14, c15, c16, c17 )
@ -3256,7 +3256,7 @@ values
execute stmt1 ;
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1265 Data truncated for column 'c16' at row 1
Note 1265 Data truncated for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
prepare stmt2 from "insert into t9
( c1, c13, c14, c15, c16, c17 )
@ -3265,7 +3265,7 @@ values
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1265 Data truncated for column 'c16' at row 1
Note 1265 Data truncated for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
set @arg00= 'abc' ;
set @arg00= NULL ;

View File

@ -3240,7 +3240,7 @@ values
( 50, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 ) ;
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1265 Data truncated for column 'c16' at row 1
Note 1265 Data truncated for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
insert into t9
( c1, c13, c14, c15, c16, c17 )
@ -3248,7 +3248,7 @@ values
( 51, @arg00, @arg00, @arg00, @arg00, @arg00) ;
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1265 Data truncated for column 'c16' at row 1
Note 1265 Data truncated for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
prepare stmt1 from "insert into t9
( c1, c13, c14, c15, c16, c17 )
@ -3257,7 +3257,7 @@ values
execute stmt1 ;
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1265 Data truncated for column 'c16' at row 1
Note 1265 Data truncated for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
prepare stmt2 from "insert into t9
( c1, c13, c14, c15, c16, c17 )
@ -3266,7 +3266,7 @@ values
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1265 Data truncated for column 'c16' at row 1
Note 1265 Data truncated for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
set @arg00= 'abc' ;
set @arg00= NULL ;

View File

@ -3176,7 +3176,7 @@ values
( 50, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 ) ;
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1265 Data truncated for column 'c16' at row 1
Note 1265 Data truncated for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
insert into t9
( c1, c13, c14, c15, c16, c17 )
@ -3184,7 +3184,7 @@ values
( 51, @arg00, @arg00, @arg00, @arg00, @arg00) ;
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1265 Data truncated for column 'c16' at row 1
Note 1265 Data truncated for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
prepare stmt1 from "insert into t9
( c1, c13, c14, c15, c16, c17 )
@ -3193,7 +3193,7 @@ values
execute stmt1 ;
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1265 Data truncated for column 'c16' at row 1
Note 1265 Data truncated for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
prepare stmt2 from "insert into t9
( c1, c13, c14, c15, c16, c17 )
@ -3202,7 +3202,7 @@ values
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1265 Data truncated for column 'c16' at row 1
Note 1265 Data truncated for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
set @arg00= 'abc' ;
set @arg00= NULL ;
@ -6530,7 +6530,7 @@ values
( 50, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 ) ;
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1265 Data truncated for column 'c16' at row 1
Note 1265 Data truncated for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
insert into t9
( c1, c13, c14, c15, c16, c17 )
@ -6538,7 +6538,7 @@ values
( 51, @arg00, @arg00, @arg00, @arg00, @arg00) ;
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1265 Data truncated for column 'c16' at row 1
Note 1265 Data truncated for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
prepare stmt1 from "insert into t9
( c1, c13, c14, c15, c16, c17 )
@ -6547,7 +6547,7 @@ values
execute stmt1 ;
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1265 Data truncated for column 'c16' at row 1
Note 1265 Data truncated for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
prepare stmt2 from "insert into t9
( c1, c13, c14, c15, c16, c17 )
@ -6556,7 +6556,7 @@ values
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1265 Data truncated for column 'c16' at row 1
Note 1265 Data truncated for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
set @arg00= 'abc' ;
set @arg00= NULL ;

View File

@ -2047,6 +2047,60 @@ f1 f2 f3 f4
DROP TABLE t1;
DROP VIEW v3;
#
# MDEV-6105: Emoji unicode character string search query makes mariadb performance down
#
SET NAMES utf8;
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 'test.t1'
CREATE TABLE t1(
id int AUTO_INCREMENT,
fd varchar(20),
primary key(id),
index ix_fd(fd)
)engine=innodb default charset=UTF8;
INSERT INTO t1(id, fd) VALUES (null, ''),(null, 'matt'),(null, 'pitt'),(null, 'lee'),(null, 'kim');
INSERT INTO t1 (fd) SELECT fd FROM t1;
INSERT INTO t1 (fd) SELECT fd FROM t1;
INSERT INTO t1 (fd) SELECT fd FROM t1;
INSERT INTO t1 (fd) SELECT fd FROM t1;
INSERT INTO t1 (fd) SELECT fd FROM t1;
INSERT INTO t1 (fd) SELECT fd FROM t1;
INSERT INTO t1 (fd) SELECT fd FROM t1;
INSERT INTO t1 (fd) SELECT fd FROM t1;
INSERT INTO t1 (fd) SELECT fd FROM t1;
INSERT INTO t1 (fd) SELECT fd FROM t1;
INSERT INTO t1 (fd) SELECT fd FROM t1;
INSERT INTO t1 (fd) SELECT fd FROM t1;
INSERT INTO t1 (fd) SELECT fd FROM t1;
# The following should show "Impossible WHERE" :
explain
SELECT * FROM t1 WHERE fd='😁';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1
SELECT * FROM t1 WHERE fd='😁';
id fd
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1
# The following must not use range access:
explain select count(*) from t1 where fd <'😁';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ix_fd ix_fd 63 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1
select count(*) from t1 where fd <'😁';
count(*)
40960
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1
select count(*) from t1 ignore index (ix_fd) where fd <'😁';
count(*)
40960
drop table t1;
set names default;
#
# BUG#13731380: RANGE OPTIMIZER CALLS RECORDS_IN_RANGE() FOR OPEN RANGE
#
CREATE TABLE t1 (pk INT PRIMARY KEY);

View File

@ -2049,6 +2049,60 @@ f1 f2 f3 f4
DROP TABLE t1;
DROP VIEW v3;
#
# MDEV-6105: Emoji unicode character string search query makes mariadb performance down
#
SET NAMES utf8;
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 'test.t1'
CREATE TABLE t1(
id int AUTO_INCREMENT,
fd varchar(20),
primary key(id),
index ix_fd(fd)
)engine=innodb default charset=UTF8;
INSERT INTO t1(id, fd) VALUES (null, ''),(null, 'matt'),(null, 'pitt'),(null, 'lee'),(null, 'kim');
INSERT INTO t1 (fd) SELECT fd FROM t1;
INSERT INTO t1 (fd) SELECT fd FROM t1;
INSERT INTO t1 (fd) SELECT fd FROM t1;
INSERT INTO t1 (fd) SELECT fd FROM t1;
INSERT INTO t1 (fd) SELECT fd FROM t1;
INSERT INTO t1 (fd) SELECT fd FROM t1;
INSERT INTO t1 (fd) SELECT fd FROM t1;
INSERT INTO t1 (fd) SELECT fd FROM t1;
INSERT INTO t1 (fd) SELECT fd FROM t1;
INSERT INTO t1 (fd) SELECT fd FROM t1;
INSERT INTO t1 (fd) SELECT fd FROM t1;
INSERT INTO t1 (fd) SELECT fd FROM t1;
INSERT INTO t1 (fd) SELECT fd FROM t1;
# The following should show "Impossible WHERE" :
explain
SELECT * FROM t1 WHERE fd='😁';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1
SELECT * FROM t1 WHERE fd='😁';
id fd
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1
# The following must not use range access:
explain select count(*) from t1 where fd <'😁';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index ix_fd ix_fd 63 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1
select count(*) from t1 where fd <'😁';
count(*)
40960
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1
select count(*) from t1 ignore index (ix_fd) where fd <'😁';
count(*)
40960
drop table t1;
set names default;
#
# BUG#13731380: RANGE OPTIMIZER CALLS RECORDS_IN_RANGE() FOR OPEN RANGE
#
CREATE TABLE t1 (pk INT PRIMARY KEY);

View File

@ -291,11 +291,7 @@ select found_rows();
found_rows()
1
drop table t1, t2;
create table t1 (
a1 int auto_increment primary key,
b1 datetime,
c1 int
);
create table t1 (a1 int auto_increment primary key, c1 int);
insert t1 (a1) values (null);
insert t1 (a1) select null from t1;
insert t1 (a1) select null from t1;
@ -307,20 +303,32 @@ insert t1 (a1) select null from t1;
insert t1 (a1) select null from t1;
insert t1 (a1) select null from t1;
update t1 set c1=a1 % 2;
create table t2 (
a2 int,
b2 int,
c2 char(16) default '',
primary key (a2, b2)
);
create table t2 (a2 int, b2 int, c2 char(16) default '', primary key (a2, b2));
insert t2 select a1, 1, 'ok' from t1;
insert t2 select a1, 2, 'ko' from t1;
insert t2 select a1, 3, 'ko' from t1;
insert t2 select a1, 4, 'ok' from t1;
insert t2 select a1, 5, 'ok' from t1;
select sql_calc_found_rows distinct a1,b1,c2 from t1 join t2 on a2=a1
where a1 <= 256 and c1=0 and c2='ok' order by b1 desc, a1 desc limit 46;
select sql_calc_found_rows distinct a1,c2 from t1 join t2 on a2=a1
where a1 <= 256 and c1=0 and c2='ok' order by a1 desc limit 46;
select found_rows();
found_rows()
128
drop table t1, t2;
create table t1 (i1 int, v1 int, primary key(i1,v1));
insert into t1 values (1,1),(2,2),(3,3);
create table t2 (i2 int primary key, v2 int);
insert into t2 values (1,5),(2,5),(3,10);
select 1 as res from t1 left join t2 on i1 = i2 where v2 = 5 or v1 = 5 or v1 = 10 order by v1;
res
1
1
select sql_calc_found_rows 1 as res from t1 left join t2 on i1 = i2 where v2 = 5 or v1 = 5 or v1 = 10 order by v1 limit 1;
select found_rows() as count;
count
2
select sql_calc_found_rows 1 as res from t1 left join t2 on i1 = i2 where v2 = 5 order by v1 limit 1;
select found_rows() as count;
count
2
drop table t1, t2;

View File

@ -400,7 +400,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 SUBQUERY customer ALL NULL NULL NULL NULL 150 100.00 Using where
Warnings:
Note 1276 Field or reference 'dbt3_s001.customer.c_custkey' of SELECT #4 was resolved in SELECT #2
Note 1003 select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where ((substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and (`dbt3_s001`.`customer`.`c_acctbal` > (select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where ((`dbt3_s001`.`customer`.`c_acctbal` > 0.00) and (substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25'))))) and (not(exists(select 1 from `dbt3_s001`.`orders` where (`dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey`))))) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2)
Note 1003 select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where ((substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and (`dbt3_s001`.`customer`.`c_acctbal` > (select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where ((`dbt3_s001`.`customer`.`c_acctbal` > 0.00) and (substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25'))))) and (not(<in_optimizer>(1,exists(select 1 from `dbt3_s001`.`orders` where (`dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey`)))))) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2)
select cntrycode, count(*) as numcust, sum(c_acctbal) as totacctbal
from (
select substr(c_phone, 1, 2) as cntrycode, c_acctbal
@ -441,7 +441,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 SUBQUERY customer ALL NULL NULL NULL NULL 150 91.00 Using where
Warnings:
Note 1276 Field or reference 'dbt3_s001.customer.c_custkey' of SELECT #4 was resolved in SELECT #2
Note 1003 select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where ((substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and (`dbt3_s001`.`customer`.`c_acctbal` > (select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where ((`dbt3_s001`.`customer`.`c_acctbal` > 0.00) and (substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25'))))) and (not(exists(select 1 from `dbt3_s001`.`orders` where (`dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey`))))) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2)
Note 1003 select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where ((substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and (`dbt3_s001`.`customer`.`c_acctbal` > (select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where ((`dbt3_s001`.`customer`.`c_acctbal` > 0.00) and (substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25'))))) and (not(<in_optimizer>(1,exists(select 1 from `dbt3_s001`.`orders` where (`dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey`)))))) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2)
select cntrycode, count(*) as numcust, sum(c_acctbal) as totacctbal
from (
select substr(c_phone, 1, 2) as cntrycode, c_acctbal
@ -985,7 +985,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 SUBQUERY t2 ALL NULL NULL NULL NULL 7 100.00
2 SUBQUERY t1 ALL NULL NULL NULL NULL 14 100.00 Using join buffer (flat, BNL join)
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where ((exists(select 1 from `test`.`t1` join `test`.`t2`) and (`test`.`t1`.`a` <> `test`.`t2`.`b`)) or (`test`.`t1`.`a` <= 4))
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where ((<cache>(<in_optimizer>(1,exists(select 1 from `test`.`t1` join `test`.`t2`))) and (`test`.`t1`.`a` <> `test`.`t2`.`b`)) or (`test`.`t1`.`a` <= 4))
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
DROP TABLE t1,t2;
set use_stat_tables=@save_use_stat_tables;

View File

@ -403,7 +403,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 SUBQUERY customer ALL NULL NULL NULL NULL 150 100.00 Using where
Warnings:
Note 1276 Field or reference 'dbt3_s001.customer.c_custkey' of SELECT #4 was resolved in SELECT #2
Note 1003 select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where ((substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and (`dbt3_s001`.`customer`.`c_acctbal` > (select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where ((`dbt3_s001`.`customer`.`c_acctbal` > 0.00) and (substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25'))))) and (not(exists(select 1 from `dbt3_s001`.`orders` where (`dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey`))))) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2)
Note 1003 select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where ((substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and (`dbt3_s001`.`customer`.`c_acctbal` > (select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where ((`dbt3_s001`.`customer`.`c_acctbal` > 0.00) and (substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25'))))) and (not(<in_optimizer>(1,exists(select 1 from `dbt3_s001`.`orders` where (`dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey`)))))) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2)
select cntrycode, count(*) as numcust, sum(c_acctbal) as totacctbal
from (
select substr(c_phone, 1, 2) as cntrycode, c_acctbal
@ -444,7 +444,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 SUBQUERY customer ALL NULL NULL NULL NULL 150 91.00 Using where
Warnings:
Note 1276 Field or reference 'dbt3_s001.customer.c_custkey' of SELECT #4 was resolved in SELECT #2
Note 1003 select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where ((substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and (`dbt3_s001`.`customer`.`c_acctbal` > (select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where ((`dbt3_s001`.`customer`.`c_acctbal` > 0.00) and (substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25'))))) and (not(exists(select 1 from `dbt3_s001`.`orders` where (`dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey`))))) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2)
Note 1003 select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where ((substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and (`dbt3_s001`.`customer`.`c_acctbal` > (select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where ((`dbt3_s001`.`customer`.`c_acctbal` > 0.00) and (substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25'))))) and (not(<in_optimizer>(1,exists(select 1 from `dbt3_s001`.`orders` where (`dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey`)))))) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2)
select cntrycode, count(*) as numcust, sum(c_acctbal) as totacctbal
from (
select substr(c_phone, 1, 2) as cntrycode, c_acctbal
@ -995,7 +995,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 SUBQUERY t2 ALL NULL NULL NULL NULL 7 100.00
2 SUBQUERY t1 ALL NULL NULL NULL NULL 14 100.00 Using join buffer (flat, BNL join)
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where ((exists(select 1 from `test`.`t1` join `test`.`t2`) and (`test`.`t1`.`a` <> `test`.`t2`.`b`)) or (`test`.`t1`.`a` <= 4))
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where ((<cache>(<in_optimizer>(1,exists(select 1 from `test`.`t1` join `test`.`t2`))) and (`test`.`t1`.`a` <> `test`.`t2`.`b`)) or (`test`.`t1`.`a` <= 4))
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
DROP TABLE t1,t2;
set use_stat_tables=@save_use_stat_tables;

View File

@ -23,9 +23,9 @@ create table t1(a int);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t2 (col1 int);
# one value in 1..100 range
insert into t2 select A.a + B.a*10 from t1 A, t1 B;
insert into t2 select ta.a + tb.a*10 from t1 ta, t1 tb;
# ten values in 100...200 range
insert into t2 select 100 + A.a + B.a*10 from t1 A, t1 B, t1 C;
insert into t2 select 100 + ta.a + tb.a*10 from t1 ta, t1 tb, t1 tc;
set histogram_type='SINGLE_PREC_HB';
set histogram_size=100;
set optimizer_use_condition_selectivity=4;
@ -51,7 +51,7 @@ drop table t1, t2;
create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(a int);
insert into t1 select A.a from t0 A, t0 B, t0 C;
insert into t1 select ta.a from t0 ta, t0 tb, t0 tc;
set histogram_size=20;
set histogram_type='single_prec_hb';
analyze table t1 persistent for all;
@ -90,8 +90,8 @@ drop table t0, t1;
#
create table t1 (col1 int);
set @a=-1;
create table t2 (a int) select (@a:=@a+1) as a from information_schema.session_variables A limit 100;
insert into t1 select A.a from t2 A, t2 B where A.a < 100 and B.a < 100;
create table t2 (a int) select (@a:=@a+1) as a from information_schema.session_variables ta limit 100;
insert into t1 select ta.a from t2 ta, t2 tb where ta.a < 100 and tb.a < 100;
select min(col1), max(col1), count(*) from t1;
min(col1) max(col1) count(*)
0 99 10000
@ -123,7 +123,7 @@ drop table t1, t2;
create table t1(a int);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t2 (a int, b int, col1 varchar(64), col2 varchar(64), key(a,b));
insert into t2 select A.a+10*B.a, C.a+10*D.a, 'filler-data1', 'filler-data2' from t1 A, t1 B, t1 C, t1 D;
insert into t2 select ta.a+10*tb.a, tc.a+10*td.a, 'filler-data1', 'filler-data2' from t1 ta, t1 tb, t1 tc, t1 td;
set histogram_size=100;
set optimizer_use_condition_selectivity=4;
set use_stat_tables='preferably';
@ -144,7 +144,7 @@ drop table t2, t1;
create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(key1 int, col1 int, key(key1));
insert into t1 select A.a, A.a from t0 A, t0 B, t0 C;
insert into t1 select ta.a, ta.a from t0 ta, t0 tb, t0 tc;
set histogram_size=100;
set use_stat_tables='preferably';
set optimizer_use_condition_selectivity=4;
@ -177,11 +177,11 @@ key(kp1, kp2)
);
insert into t1
select
A.a,
B.a,
ta.a,
tb.a,
'filler-data-1',
'filler-data-2'
from t0 A, t0 B, t0 C;
from t0 ta, t0 tb, t0 tc;
set histogram_size=100;
set use_stat_tables='preferably';
set optimizer_use_condition_selectivity=4;
@ -215,6 +215,68 @@ SELECT * FROM t1 AS t1_1, t1 AS t1_2 WHERE NOT ( t1_1.a <> 'baz');
a b a b
DROP TABLE t1;
#
# MDEV-6308: Server crashes in table_multi_eq_cond_selectivity with ...
#
CREATE TABLE t1 (
id varchar(40) COLLATE utf8_bin,
dt datetime,
PRIMARY KEY (id)
);
INSERT INTO t1 VALUES ('foo','2011-04-12 05:18:08'),
('bar','2013-09-19 11:37:03');
CREATE TABLE t2 (
t1_id varchar(40) COLLATE utf8_bin,
f1 varchar(64),
f2 varchar(1024),
KEY (f1,f2(255))
);
INSERT INTO t2 VALUES ('foo','baz','qux'),('bar','baz','qux');
set optimizer_use_condition_selectivity=2;
explain
select * from t1,t2 where t1.id = t2.t1_id and t2.f2='qux' and t2.f1='baz';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref f1 f1 325 const,const 1 Using index condition; Using where
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 122 test.t2.t1_id 1
select * from t1,t2 where t1.id = t2.t1_id and t2.f2='qux' and t2.f1='baz';
id dt t1_id f1 f2
foo 2011-04-12 05:18:08 foo baz qux
bar 2013-09-19 11:37:03 bar baz qux
drop table t1,t2;
#
# MDEV-5985: EITS: selectivity estimates look illogical for join and non-key equalities
#
create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(a int);
insert into t1 select ta.a + tb.a* 10 + tc.a * 100 from t0 ta, t0 tb, t0 tc;
create table t2 as select * from t1;
set histogram_size=100;
set use_stat_tables='preferably';
set optimizer_use_condition_selectivity=4;
analyze table t1 persistent for all;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
analyze table t2 persistent for all;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
# Filtered will be 4.95, 9.90
explain extended select * from t1 ta, t2 tb where ta.a < 40 and tb.a < 100;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE ta ALL NULL NULL NULL NULL 1000 4.95 Using where
1 SIMPLE tb ALL NULL NULL NULL NULL 1000 9.90 Using where; Using join buffer (flat, BNL join)
Warnings:
Note 1003 select `test`.`ta`.`a` AS `a`,`test`.`tb`.`a` AS `a` from `test`.`t1` `ta` join `test`.`t2` `tb` where ((`test`.`ta`.`a` < 40) and (`test`.`tb`.`a` < 100))
# Here, tb.filtered should not become 100%:
explain extended select * from t1 ta, t2 tb where ta.a < 40 and tb.a < 100 and tb.a=ta.a;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE ta ALL NULL NULL NULL NULL 1000 4.95 Using where
1 SIMPLE tb ALL NULL NULL NULL NULL 1000 4.95 Using where; Using join buffer (flat, BNL join)
Warnings:
Note 1003 select `test`.`ta`.`a` AS `a`,`test`.`tb`.`a` AS `a` from `test`.`t1` `ta` join `test`.`t2` `tb` where ((`test`.`tb`.`a` = `test`.`ta`.`a`) and (`test`.`ta`.`a` < 40) and (`test`.`ta`.`a` < 100))
drop table t0,t1,t2;
#
# End of the test file
#
set use_stat_tables= @save_use_stat_tables;

View File

@ -337,11 +337,11 @@ patient_uq clinic_uq
2 2
explain extended select * from t6 where exists (select * from t7 where uq = clinic_uq);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t6 ALL NULL NULL NULL NULL 4 100.00 Using where
2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1 100.00 Using index
1 PRIMARY t7 index PRIMARY PRIMARY 4 NULL 2 100.00 Using index
1 PRIMARY t6 ALL i1 NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
Warnings:
Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where <expr_cache><`test`.`t6`.`clinic_uq`>(exists(select 1 from `test`.`t7` where (`test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`)))
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where (`test`.`t6`.`clinic_uq` = `test`.`t7`.`uq`)
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
ERROR 23000: Column 'a' in field list is ambiguous
drop table t1,t2,t3;
@ -1887,7 +1887,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index
Warnings:
Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(<expr_cache><`test`.`tt`.`id`>(exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null)))))
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(<in_optimizer>(1,<expr_cache><`test`.`tt`.`id`>(exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null))))))
insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001');
create table t2 (id int not null, text varchar(20) not null default '', primary key (id));
insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10');
@ -2419,11 +2419,12 @@ a b
3 4
explain extended select * from t1 up where exists (select * from t1 where t1.a=up.a);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY up ALL NULL NULL NULL NULL 2 100.00 Using where
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
1 PRIMARY up ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1276 Field or reference 'test.up.a' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where <expr_cache><`test`.`up`.`a`>(exists(select 1 from `test`.`t1` where (`test`.`t1`.`a` = `test`.`up`.`a`)))
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` semi join (`test`.`t1`) where 1
drop table t1;
CREATE TABLE t1 (t1_a int);
INSERT INTO t1 VALUES (1);
@ -4428,11 +4429,12 @@ SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a));
EXPLAIN EXTENDED
SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.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 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists(select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)))
Note 1003 select 2 AS `2` from `test`.`t1` semi join (`test`.`t2`) where 1
EXPLAIN EXTENDED
SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION
(SELECT 1 FROM t2 WHERE t1.a = t2.a));
@ -5670,8 +5672,9 @@ EXPLAIN
SELECT * FROM t1
WHERE EXISTS (SELECT a FROM t2 USE INDEX() WHERE t2.a = t1.a);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 Using where
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join)
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3
SELECT * FROM t1
WHERE EXISTS (SELECT a FROM t2 WHERE t2.a = t1.a);
a
@ -5680,8 +5683,9 @@ EXPLAIN
SELECT * FROM t1
WHERE EXISTS (SELECT a FROM t2 WHERE t2.a = t1.a);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
2 DEPENDENT SUBQUERY t2 ref idx idx 5 test.t1.a 2 Using index
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join)
2 MATERIALIZED t2 index idx idx 5 NULL 3 Using index
DROP TABLE t1,t2;
#
# BUG#752992: Wrong results for a subquery with 'semijoin=on'

View File

@ -227,7 +227,7 @@ where t2.c in (select c from t3 where t3.c > t1.b) and
t2.c > 'b1' )
group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by
1 PRIMARY t1 index NULL idx_t1_1 163 NULL 128 Using where; Using index
2 DEPENDENT SUBQUERY t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index
2 DEPENDENT SUBQUERY t3 index NULL idx_t3_1 10 NULL 192 Using where; Using index; FirstMatch(t2); Using join buffer (flat, BNL join)
select a1,a2,b,c,min(c), max(c) from t1
@ -236,22 +236,22 @@ where t2.c in (select c from t3 where t3.c > t1.b) and
t2.c > 'b1' )
group by a1,a2,b;
a1 a2 b c min(c) max(c)
a a a d111 a111 d111
a a b h112 e112 h112
a b a l121 i121 l121
a b b p122 m122 p122
b a a d211 a211 d211
b a b h212 e212 h212
b b a l221 i221 l221
b b b p222 m222 p222
c a a d311 a311 d311
c a b h312 e312 h312
c b a l321 i321 l321
c b b p322 m322 p322
d a a d411 a411 d411
d a b h412 e412 h412
d b a l421 i421 l421
d b b p422 m422 p422
a a a a111 a111 d111
a a b e112 e112 h112
a b a i121 i121 l121
a b b m122 m122 p122
b a a a211 a211 d211
b a b e212 e212 h212
b b a i221 i221 l221
b b b m222 m222 p222
c a a a311 a311 d311
c a b e312 e312 h312
c b a i321 i321 l321
c b b m322 m322 p322
d a a a411 a411 d411
d a b e412 e412 h412
d b a i421 i421 l421
d b b m422 m422 p422
explain select a1,a2,b,c,min(c), max(c) from t1
where exists ( select * from t2
where t2.c in (select c from t3 where t3.c > t1.c) and

View File

@ -231,7 +231,7 @@ where t2.c in (select c from t3 where t3.c > t1.b) and
t2.c > 'b1' )
group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by
1 PRIMARY t1 index NULL idx_t1_1 163 NULL 128 Using where; Using index
2 DEPENDENT SUBQUERY t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index
3 DEPENDENT SUBQUERY t3 index NULL idx_t3_1 10 NULL 192 Using where; Using index
select a1,a2,b,c,min(c), max(c) from t1
@ -240,22 +240,22 @@ where t2.c in (select c from t3 where t3.c > t1.b) and
t2.c > 'b1' )
group by a1,a2,b;
a1 a2 b c min(c) max(c)
a a a d111 a111 d111
a a b h112 e112 h112
a b a l121 i121 l121
a b b p122 m122 p122
b a a d211 a211 d211
b a b h212 e212 h212
b b a l221 i221 l221
b b b p222 m222 p222
c a a d311 a311 d311
c a b h312 e312 h312
c b a l321 i321 l321
c b b p322 m322 p322
d a a d411 a411 d411
d a b h412 e412 h412
d b a l421 i421 l421
d b b p422 m422 p422
a a a a111 a111 d111
a a b e112 e112 h112
a b a i121 i121 l121
a b b m122 m122 p122
b a a a211 a211 d211
b a b e212 e212 h212
b b a i221 i221 l221
b b b m222 m222 p222
c a a a311 a311 d311
c a b e312 e312 h312
c b a i321 i321 l321
c b b m322 m322 p322
d a a a411 a411 d411
d a b e412 e412 h412
d b a i421 i421 l421
d b b m422 m422 p422
explain select a1,a2,b,c,min(c), max(c) from t1
where exists ( select * from t2
where t2.c in (select c from t3 where t3.c > t1.c) and

View File

@ -1,7 +1,7 @@
select @@optimizer_switch like '%exists_to_in=on%';
@@optimizer_switch like '%exists_to_in=on%'
select @@optimizer_switch like '%exists_to_in=off%';
@@optimizer_switch like '%exists_to_in=off%'
0
set optimizer_switch='exists_to_in=on';
set optimizer_switch='exists_to_in=off';
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t11,t12;
drop view if exists v2;
set @subselect_tmp=@@optimizer_switch;
@ -341,11 +341,11 @@ patient_uq clinic_uq
2 2
explain extended select * from t6 where exists (select * from t7 where uq = clinic_uq);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t7 index PRIMARY PRIMARY 4 NULL 2 100.00 Using index
1 PRIMARY t6 ALL i1 NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
1 PRIMARY t6 ALL NULL NULL NULL NULL 4 100.00 Using where
2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1 100.00 Using index
Warnings:
Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where (`test`.`t6`.`clinic_uq` = `test`.`t7`.`uq`)
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where <expr_cache><`test`.`t6`.`clinic_uq`>(exists(select 1 from `test`.`t7` where (`test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`)))
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
ERROR 23000: Column 'a' in field list is ambiguous
drop table t1,t2,t3;
@ -1891,7 +1891,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index
Warnings:
Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(<in_optimizer>(1,<expr_cache><`test`.`tt`.`id`>(exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null))))))
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(<expr_cache><`test`.`tt`.`id`>(exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null)))))
insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001');
create table t2 (id int not null, text varchar(20) not null default '', primary key (id));
insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10');
@ -2423,12 +2423,11 @@ a b
3 4
explain extended select * from t1 up where exists (select * from t1 where t1.a=up.a);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY up ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY up ALL NULL NULL NULL NULL 2 100.00 Using where
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.up.a' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` semi join (`test`.`t1`) where 1
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where <expr_cache><`test`.`up`.`a`>(exists(select 1 from `test`.`t1` where (`test`.`t1`.`a` = `test`.`up`.`a`)))
drop table t1;
CREATE TABLE t1 (t1_a int);
INSERT INTO t1 VALUES (1);
@ -4433,12 +4432,11 @@ SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a));
EXPLAIN EXTENDED
SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.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
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1003 select 2 AS `2` from `test`.`t1` semi join (`test`.`t2`) where 1
Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists(select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)))
EXPLAIN EXTENDED
SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION
(SELECT 1 FROM t2 WHERE t1.a = t2.a));
@ -5676,9 +5674,8 @@ EXPLAIN
SELECT * FROM t1
WHERE EXISTS (SELECT a FROM t2 USE INDEX() WHERE t2.a = t1.a);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join)
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 Using where
SELECT * FROM t1
WHERE EXISTS (SELECT a FROM t2 WHERE t2.a = t1.a);
a
@ -5687,9 +5684,8 @@ EXPLAIN
SELECT * FROM t1
WHERE EXISTS (SELECT a FROM t2 WHERE t2.a = t1.a);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join)
2 MATERIALIZED t2 index idx idx 5 NULL 3 Using index
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
2 DEPENDENT SUBQUERY t2 ref idx idx 5 test.t1.a 2 Using index
DROP TABLE t1,t2;
#
# BUG#752992: Wrong results for a subquery with 'semijoin=on'
@ -7024,6 +7020,6 @@ exists(select 1 from t1 group by `c` in (select `c` from t1))
0
drop table t1;
set optimizer_switch=default;
select @@optimizer_switch like '%exists_to_in=on%';
@@optimizer_switch like '%exists_to_in=on%'
select @@optimizer_switch like '%exists_to_in=off%';
@@optimizer_switch like '%exists_to_in=off%'
0

View File

@ -344,11 +344,11 @@ patient_uq clinic_uq
2 2
explain extended select * from t6 where exists (select * from t7 where uq = clinic_uq);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t6 ALL NULL NULL NULL NULL 4 100.00 Using where
2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1 100.00 Using index
1 PRIMARY t7 index PRIMARY PRIMARY 4 NULL 2 100.00 Using index
1 PRIMARY t6 ALL i1 NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
Warnings:
Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where <expr_cache><`test`.`t6`.`clinic_uq`>(exists(select 1 from `test`.`t7` where (`test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`)))
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where (`test`.`t6`.`clinic_uq` = `test`.`t7`.`uq`)
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
ERROR 23000: Column 'a' in field list is ambiguous
drop table t1,t2,t3;
@ -1894,7 +1894,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index
Warnings:
Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(<expr_cache><`test`.`tt`.`id`>(exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null)))))
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(<in_optimizer>(1,<expr_cache><`test`.`tt`.`id`>(exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null))))))
insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001');
create table t2 (id int not null, text varchar(20) not null default '', primary key (id));
insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10');
@ -2426,11 +2426,11 @@ a b
3 4
explain extended select * from t1 up where exists (select * from t1 where t1.a=up.a);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY up ALL NULL NULL NULL NULL 2 100.00 Using where
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
1 PRIMARY up ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; FirstMatch(up); Using join buffer (flat, BNL join)
Warnings:
Note 1276 Field or reference 'test.up.a' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where <expr_cache><`test`.`up`.`a`>(exists(select 1 from `test`.`t1` where (`test`.`t1`.`a` = `test`.`up`.`a`)))
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` semi join (`test`.`t1`) where (`test`.`t1`.`a` = `test`.`up`.`a`)
drop table t1;
CREATE TABLE t1 (t1_a int);
INSERT INTO t1 VALUES (1);
@ -4432,11 +4432,11 @@ SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a));
EXPLAIN EXTENDED
SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.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 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; FirstMatch(t1); Using join buffer (flat, BNL join)
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists(select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)))
Note 1003 select 2 AS `2` from `test`.`t1` semi join (`test`.`t2`) where (`test`.`t2`.`a` = `test`.`t1`.`a`)
EXPLAIN EXTENDED
SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION
(SELECT 1 FROM t2 WHERE t1.a = t2.a));
@ -5671,8 +5671,8 @@ EXPLAIN
SELECT * FROM t1
WHERE EXISTS (SELECT a FROM t2 USE INDEX() WHERE t2.a = t1.a);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 Using where
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
1 PRIMARY t2 ALL NULL NULL NULL NULL 3 Using where; FirstMatch(t1); Using join buffer (flat, BNL join)
SELECT * FROM t1
WHERE EXISTS (SELECT a FROM t2 WHERE t2.a = t1.a);
a
@ -5681,8 +5681,8 @@ EXPLAIN
SELECT * FROM t1
WHERE EXISTS (SELECT a FROM t2 WHERE t2.a = t1.a);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
2 DEPENDENT SUBQUERY t2 ref idx idx 5 test.t1.a 2 Using index
1 PRIMARY t2 index idx idx 5 NULL 3 Using index; LooseScan
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join)
DROP TABLE t1,t2;
#
# BUG#752992: Wrong results for a subquery with 'semijoin=on'

View File

@ -341,10 +341,10 @@ patient_uq clinic_uq
explain extended select * from t6 where exists (select * from t7 where uq = clinic_uq);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t6 ALL NULL NULL NULL NULL 4 100.00 Using where
2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1 100.00 Using index
2 DEPENDENT SUBQUERY t7 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index
Warnings:
Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where exists(select 1 from `test`.`t7` where (`test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`))
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where <in_optimizer>(`test`.`t6`.`clinic_uq`,<exists>(<primary_index_lookup>(<cache>(`test`.`t6`.`clinic_uq`) in t7 on PRIMARY)))
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
ERROR 23000: Column 'a' in field list is ambiguous
drop table t1,t2,t3;
@ -1890,7 +1890,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index
Warnings:
Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null))))
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(<in_optimizer>(1,exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null)))))
insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001');
create table t2 (id int not null, text varchar(20) not null default '', primary key (id));
insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10');
@ -2426,7 +2426,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.up.a' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where exists(select 1 from `test`.`t1` where (`test`.`t1`.`a` = `test`.`up`.`a`))
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where <in_optimizer>(`test`.`up`.`a`,<exists>(select `test`.`t1`.`a` from `test`.`t1` where (<cache>(`test`.`up`.`a`) = `test`.`t1`.`a`)))
drop table t1;
CREATE TABLE t1 (t1_a int);
INSERT INTO t1 VALUES (1);
@ -4432,7 +4432,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1003 select 2 AS `2` from `test`.`t1` where exists(select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`))
Note 1003 select 2 AS `2` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t2`.`a` from `test`.`t2` where (<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`)))
EXPLAIN EXTENDED
SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION
(SELECT 1 FROM t2 WHERE t1.a = t2.a));
@ -5678,7 +5678,7 @@ SELECT * FROM t1
WHERE EXISTS (SELECT a FROM t2 WHERE t2.a = t1.a);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
2 DEPENDENT SUBQUERY t2 ref idx idx 5 test.t1.a 2 Using index
2 DEPENDENT SUBQUERY t2 index_subquery idx idx 5 func 2 Using index
DROP TABLE t1,t2;
#
# BUG#752992: Wrong results for a subquery with 'semijoin=on'

View File

@ -343,11 +343,11 @@ patient_uq clinic_uq
2 2
explain extended select * from t6 where exists (select * from t7 where uq = clinic_uq);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t6 ALL NULL NULL NULL NULL 4 100.00 Using where
2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1 100.00 Using index
1 PRIMARY t7 index PRIMARY PRIMARY 4 NULL 2 100.00 Using index
1 PRIMARY t6 ALL i1 NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
Warnings:
Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where exists(select 1 from `test`.`t7` where (`test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`))
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where (`test`.`t6`.`clinic_uq` = `test`.`t7`.`uq`)
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
ERROR 23000: Column 'a' in field list is ambiguous
drop table t1,t2,t3;
@ -1893,7 +1893,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index
Warnings:
Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null))))
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(<in_optimizer>(1,exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null)))))
insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001');
create table t2 (id int not null, text varchar(20) not null default '', primary key (id));
insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10');
@ -2425,11 +2425,12 @@ a b
3 4
explain extended select * from t1 up where exists (select * from t1 where t1.a=up.a);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY up ALL NULL NULL NULL NULL 2 100.00 Using where
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
1 PRIMARY up ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1276 Field or reference 'test.up.a' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where exists(select 1 from `test`.`t1` where (`test`.`t1`.`a` = `test`.`up`.`a`))
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` semi join (`test`.`t1`) where 1
drop table t1;
CREATE TABLE t1 (t1_a int);
INSERT INTO t1 VALUES (1);
@ -4434,11 +4435,12 @@ SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a));
EXPLAIN EXTENDED
SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.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 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1003 select 2 AS `2` from `test`.`t1` where exists(select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`))
Note 1003 select 2 AS `2` from `test`.`t1` semi join (`test`.`t2`) where 1
EXPLAIN EXTENDED
SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION
(SELECT 1 FROM t2 WHERE t1.a = t2.a));
@ -5676,8 +5678,9 @@ EXPLAIN
SELECT * FROM t1
WHERE EXISTS (SELECT a FROM t2 USE INDEX() WHERE t2.a = t1.a);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 Using where
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join)
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3
SELECT * FROM t1
WHERE EXISTS (SELECT a FROM t2 WHERE t2.a = t1.a);
a
@ -5686,8 +5689,9 @@ EXPLAIN
SELECT * FROM t1
WHERE EXISTS (SELECT a FROM t2 WHERE t2.a = t1.a);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
2 DEPENDENT SUBQUERY t2 ref idx idx 5 test.t1.a 2 Using index
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join)
2 MATERIALIZED t2 index idx idx 5 NULL 3 Using index
DROP TABLE t1,t2;
#
# BUG#752992: Wrong results for a subquery with 'semijoin=on'

View File

@ -341,10 +341,10 @@ patient_uq clinic_uq
explain extended select * from t6 where exists (select * from t7 where uq = clinic_uq);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t6 ALL NULL NULL NULL NULL 4 100.00 Using where
2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1 100.00 Using index
2 MATERIALIZED t7 index PRIMARY PRIMARY 4 NULL 2 100.00 Using index
Warnings:
Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where <expr_cache><`test`.`t6`.`clinic_uq`>(exists(select 1 from `test`.`t7` where (`test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`)))
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where <expr_cache><`test`.`t6`.`clinic_uq`>(<in_optimizer>(`test`.`t6`.`clinic_uq`,`test`.`t6`.`clinic_uq` in ( <materialize> (select `test`.`t7`.`uq` from `test`.`t7` where 1 ), <primary_index_lookup>(`test`.`t6`.`clinic_uq` in <temporary table> on distinct_key where ((`test`.`t6`.`clinic_uq` = `<subquery2>`.`uq`))))))
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
ERROR 23000: Column 'a' in field list is ambiguous
drop table t1,t2,t3;
@ -1890,7 +1890,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index
Warnings:
Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(<expr_cache><`test`.`tt`.`id`>(exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null)))))
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(<in_optimizer>(1,<expr_cache><`test`.`tt`.`id`>(exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null))))))
insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001');
create table t2 (id int not null, text varchar(20) not null default '', primary key (id));
insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10');
@ -2423,10 +2423,10 @@ a b
explain extended select * from t1 up where exists (select * from t1 where t1.a=up.a);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY up ALL NULL NULL NULL NULL 2 100.00 Using where
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1276 Field or reference 'test.up.a' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where <expr_cache><`test`.`up`.`a`>(exists(select 1 from `test`.`t1` where (`test`.`t1`.`a` = `test`.`up`.`a`)))
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where <expr_cache><`test`.`up`.`a`>(<in_optimizer>(`test`.`up`.`a`,`test`.`up`.`a` in ( <materialize> (select `test`.`t1`.`a` from `test`.`t1` where 1 ), <primary_index_lookup>(`test`.`up`.`a` in <temporary table> on distinct_key where ((`test`.`up`.`a` = `<subquery2>`.`a`))))))
drop table t1;
CREATE TABLE t1 (t1_a int);
INSERT INTO t1 VALUES (1);
@ -4429,10 +4429,10 @@ EXPLAIN EXTENDED
SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.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 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists(select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)))
Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`a` from `test`.`t2` where 1 ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `<subquery2>`.`a`))))))
EXPLAIN EXTENDED
SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION
(SELECT 1 FROM t2 WHERE t1.a = t2.a));
@ -5668,7 +5668,7 @@ SELECT * FROM t1
WHERE EXISTS (SELECT a FROM t2 USE INDEX() WHERE t2.a = t1.a);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 Using where
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3
SELECT * FROM t1
WHERE EXISTS (SELECT a FROM t2 WHERE t2.a = t1.a);
a
@ -5678,7 +5678,7 @@ SELECT * FROM t1
WHERE EXISTS (SELECT a FROM t2 WHERE t2.a = t1.a);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
2 DEPENDENT SUBQUERY t2 ref idx idx 5 test.t1.a 2 Using index
2 MATERIALIZED t2 index idx idx 5 NULL 3 Using index
DROP TABLE t1,t2;
#
# BUG#752992: Wrong results for a subquery with 'semijoin=on'

View File

@ -94,6 +94,7 @@ id select_type tABle type possiBle_keys key key_len ref rows filtered ExtrA
2 MATERIALIZED t10 index PRIMARY PRIMARY 4 NULL 10 100.00 Using index
Warnings:
Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join `test`.`t2` on(((`test`.`t2`.`A` = `test`.`t1`.`A`) And <in_optimizer>(`test`.`t1`.`A`,`test`.`t1`.`A` in ( <mAteriAlize> (select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`t1`.`A` in <temporAry tABle> on distinct_key where ((`test`.`t1`.`A` = `<suBquery2>`.`pk`))))))) where 1
set join_buffer_size=8*1024;
we shouldn't flatten if we're going to get a join of > MAX_TABLES.
explain select * from
t1 s00, t1 s01, t1 s02, t1 s03, t1 s04,t1 s05,t1 s06,t1 s07,t1 s08,t1 s09,
@ -185,6 +186,7 @@ a b a b
0 0 0 0
1 1 1 1
2 2 2 2
set join_buffer_size=default;
prepare s1 from
' select * from
t1 left join t2 on (t2.a= t1.a and t2.a in (select pk from t10))
@ -1007,8 +1009,8 @@ insert into t2 values ("1", "1", "sup", "0"), ("2", "1", "sup", "1"),
("4", "1", "sup", "0");
create table t3 (
id int(11) not null default '0',
preceeding_id int(11) not null default '0',
primary key (id,preceeding_id)
preceding_id int(11) not null default '0',
primary key (id,preceding_id)
);
create table t4 (
user_id varchar(50) not null,

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