Commit 57f59c73 authored by Vasil Dimov's avatar Vasil Dimov

Merge mysql-5.1-bugteam -> mysql-5.1-innodb

parents 844a8098 58dfba28
This diff is collapsed.
...@@ -16,12 +16,14 @@ check_cpu () { ...@@ -16,12 +16,14 @@ check_cpu () {
# on Linux (and others?) we can get detailed CPU information out of /proc # on Linux (and others?) we can get detailed CPU information out of /proc
cpuinfo="cat $CPUINFO" cpuinfo="cat $CPUINFO"
# detect CPU architecture
cpu_arch=`$cpuinfo | grep 'arch' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
# detect CPU family # detect CPU family
cpu_family=`$cpuinfo | grep 'family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1` cpu_family=`$cpuinfo | grep 'family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
if test -z "$cpu_family" ; then if test -z "$cpu_family" ; then
cpu_family=`$cpuinfo | grep 'cpu' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1` cpu_family=`$cpuinfo | grep 'cpu' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
fi fi
# detect CPU vendor and model # detect CPU vendor and model
cpu_vendor=`$cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1` cpu_vendor=`$cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
model_name=`$cpuinfo | grep 'model name' | cut -d ':' -f 2 | head -1` model_name=`$cpuinfo | grep 'model name' | cut -d ':' -f 2 | head -1`
...@@ -56,8 +58,8 @@ check_cpu () { ...@@ -56,8 +58,8 @@ check_cpu () {
fi fi
;; ;;
*) *)
cpu_family=`uname -m`; cpu_family=`uname -p`;
model_name=`uname -p`; model_name=`uname -m`;
;; ;;
esac esac
fi fi
...@@ -65,9 +67,10 @@ check_cpu () { ...@@ -65,9 +67,10 @@ check_cpu () {
# detect CPU shortname as used by gcc options # detect CPU shortname as used by gcc options
# this list is not complete, feel free to add further entries # this list is not complete, feel free to add further entries
cpu_arg="" cpu_arg=""
case "$cpu_family--$model_name" in low_cpu_arg=""
case "$cpu_vendor--$cpu_family--$model_name--$cpu_arch" in
# DEC Alpha # DEC Alpha
Alpha*EV6*) *Alpha*EV6*)
cpu_arg="ev6"; cpu_arg="ev6";
;; ;;
#Core 2 Duo #Core 2 Duo
...@@ -96,6 +99,13 @@ check_cpu () { ...@@ -96,6 +99,13 @@ check_cpu () {
*Pentium*4*Mobile*) *Pentium*4*Mobile*)
cpu_arg="pentium4m" cpu_arg="pentium4m"
;; ;;
*Pentium\(R\)*\ M*)
cpu_arg="pentium-m"
low_cpu_arg="pentium3"
;;
*Pentium\(R\)*\ D*)
cpu_arg="prescott"
;;
*Pentium*4*) *Pentium*4*)
cpu_arg="pentium4" cpu_arg="pentium4"
;; ;;
...@@ -120,6 +130,12 @@ check_cpu () { ...@@ -120,6 +130,12 @@ check_cpu () {
*Celeron*) *Celeron*)
cpu_arg="pentium2" cpu_arg="pentium2"
;; ;;
*Atom*)
cpu_arg="prescott"
;;
*GenuineIntel*)
cpu_arg="pentium"
;;
*Turion*) *Turion*)
cpu_arg="athlon64" cpu_arg="athlon64"
;; ;;
...@@ -129,9 +145,30 @@ check_cpu () { ...@@ -129,9 +145,30 @@ check_cpu () {
*Athlon*) *Athlon*)
cpu_arg="athlon" cpu_arg="athlon"
;; ;;
*AMD-K7*)
cpu_arg="athlon"
;;
*Athlon*XP\ *)
cpu_arg="athlon-xp"
;;
*AMD*Sempron\(tm\)*)
cpu_arg="athlon-mp"
;;
*AMD*Athlon\(tm\)\ 64*)
cpu_arg="k8"
;;
*Opteron*) *Opteron*)
cpu_arg="opteron" cpu_arg="opteron"
;; ;;
*Phenom*)
cpu_arg="k8"
;;
*AuthenticAMD*)
cpu_arg="k6"
;;
*VIA\ *)
cpu_arg="i686"
;;
# MacOSX / Intel # MacOSX / Intel
*i386*i486*) *i386*i486*)
cpu_arg="pentium-m" cpu_arg="pentium-m"
...@@ -143,8 +180,11 @@ check_cpu () { ...@@ -143,8 +180,11 @@ check_cpu () {
*Itanium*) *Itanium*)
cpu_arg="itanium" cpu_arg="itanium"
;; ;;
*IA-64*)
cpu_arg="itanium"
;;
# Solaris Sparc # Solaris Sparc
*sparc*sun4u*) *sparc*sun4[uv]*)
cpu_arg="sparc" cpu_arg="sparc"
;; ;;
# Power PC # Power PC
...@@ -160,6 +200,10 @@ check_cpu () { ...@@ -160,6 +200,10 @@ check_cpu () {
;; ;;
esac esac
if test "x$low_cpu_arg" = "x" ; then
low_cpu_arg="$cpu_arg"
fi
if test -z "$cpu_arg" ; then if test -z "$cpu_arg" ; then
if test "$CPUINFO" != " " ; then if test "$CPUINFO" != " " ; then
# fallback to uname if necessary # fallback to uname if necessary
...@@ -198,7 +242,7 @@ check_cpu () { ...@@ -198,7 +242,7 @@ check_cpu () {
case `gcc -dumpmachine` in case `gcc -dumpmachine` in
i?86-* | x86_64-*) i?86-* | x86_64-*)
if test "$cc_comp" -lt 304 ; then if test "$cc_comp" -lt 304 ; then
check_cpu_cflags="-mcpu=${cpu_arg}" check_cpu_cflags="-mcpu=${low_cpu_arg}"
elif test "$cc_comp" -ge 402 ; then elif test "$cc_comp" -ge 402 ; then
check_cpu_cflags="-mtune=native" check_cpu_cflags="-mtune=native"
else else
......
This is a release of MySQL, a dual-license SQL database server. This is a release of MySQL, a dual-license SQL DBMS.
MySQL is brought to you by the MySQL team at Sun Microsystems, Inc. MySQL is brought to you by the MySQL team at Oracle Corporation.
License information can be found in these files: License information can be found in these files:
- For GPL (free) distributions, see the COPYING file and - For GPL (free) distributions, see the COPYING file and
......
This diff is collapsed.
...@@ -16,7 +16,7 @@ AC_DEFUN([MY_MAINTAINER_MODE], [ ...@@ -16,7 +16,7 @@ AC_DEFUN([MY_MAINTAINER_MODE], [
AC_DEFUN([MY_MAINTAINER_MODE_WARNINGS], [ AC_DEFUN([MY_MAINTAINER_MODE_WARNINGS], [
# Setup GCC warning options. # Setup GCC warning options.
AS_IF([test "$GCC" = "yes"], [ AS_IF([test "$GCC" = "yes"], [
C_WARNINGS="-Wall -Wextra -Wunused -Wwrite-strings -Werror" C_WARNINGS="-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Werror"
CXX_WARNINGS="${C_WARNINGS} -Wno-unused-parameter" CXX_WARNINGS="${C_WARNINGS} -Wno-unused-parameter"
]) ])
......
...@@ -12,7 +12,7 @@ dnl ...@@ -12,7 +12,7 @@ dnl
dnl When changing the major version number please also check the switch dnl When changing the major version number please also check the switch
dnl statement in mysqlbinlog::check_master_version(). You may also need dnl statement in mysqlbinlog::check_master_version(). You may also need
dnl to update version.c in ndb. dnl to update version.c in ndb.
AC_INIT([MySQL Server], [5.1.50], [], [mysql]) AC_INIT([MySQL Server], [5.1.51], [], [mysql])
AC_CONFIG_SRCDIR([sql/mysqld.cc]) AC_CONFIG_SRCDIR([sql/mysqld.cc])
AC_CANONICAL_SYSTEM AC_CANONICAL_SYSTEM
......
...@@ -185,7 +185,7 @@ void Base64Decoder::Decode() ...@@ -185,7 +185,7 @@ void Base64Decoder::Decode()
{ {
word32 bytes = coded_.size(); word32 bytes = coded_.size();
word32 plainSz = bytes - ((bytes + (pemLineSz - 1)) / pemLineSz); word32 plainSz = bytes - ((bytes + (pemLineSz - 1)) / pemLineSz);
plainSz = (plainSz * 3 + 3) / 4; plainSz = ((plainSz * 3) / 4) + 3;
decoded_.New(plainSz); decoded_.New(plainSz);
word32 i = 0; word32 i = 0;
......
...@@ -26,7 +26,8 @@ pkginclude_HEADERS = $(HEADERS_ABI) my_dbug.h m_string.h my_sys.h \ ...@@ -26,7 +26,8 @@ pkginclude_HEADERS = $(HEADERS_ABI) my_dbug.h m_string.h my_sys.h \
decimal.h errmsg.h my_global.h my_net.h \ decimal.h errmsg.h my_global.h my_net.h \
my_getopt.h sslopt-longopts.h my_dir.h \ my_getopt.h sslopt-longopts.h my_dir.h \
sslopt-vars.h sslopt-case.h sql_common.h keycache.h \ sslopt-vars.h sslopt-case.h sql_common.h keycache.h \
m_ctype.h my_attribute.h $(HEADERS_GEN_CONFIGURE) \ m_ctype.h my_attribute.h my_compiler.h \
$(HEADERS_GEN_CONFIGURE) \
$(HEADERS_GEN_MAKE) $(HEADERS_GEN_MAKE)
noinst_HEADERS = config-win.h config-netware.h my_bit.h \ noinst_HEADERS = config-win.h config-netware.h my_bit.h \
...@@ -37,7 +38,7 @@ noinst_HEADERS = config-win.h config-netware.h my_bit.h \ ...@@ -37,7 +38,7 @@ noinst_HEADERS = config-win.h config-netware.h my_bit.h \
my_aes.h my_tree.h my_trie.h hash.h thr_alarm.h \ my_aes.h my_tree.h my_trie.h hash.h thr_alarm.h \
thr_lock.h t_ctype.h violite.h my_md5.h base64.h \ thr_lock.h t_ctype.h violite.h my_md5.h base64.h \
my_handler.h my_time.h my_vle.h my_user.h \ my_handler.h my_time.h my_vle.h my_user.h \
my_libwrap.h my_stacktrace.h my_compiler.h my_libwrap.h my_stacktrace.h
EXTRA_DIST = mysql.h.pp mysql/plugin.h.pp EXTRA_DIST = mysql.h.pp mysql/plugin.h.pp
......
...@@ -224,7 +224,8 @@ struct st_mysql_options { ...@@ -224,7 +224,8 @@ struct st_mysql_options {
enum mysql_status enum mysql_status
{ {
MYSQL_STATUS_READY,MYSQL_STATUS_GET_RESULT,MYSQL_STATUS_USE_RESULT MYSQL_STATUS_READY, MYSQL_STATUS_GET_RESULT, MYSQL_STATUS_USE_RESULT,
MYSQL_STATUS_STATEMENT_GET_RESULT
}; };
enum mysql_protocol_type enum mysql_protocol_type
......
...@@ -293,7 +293,8 @@ struct st_mysql_options { ...@@ -293,7 +293,8 @@ struct st_mysql_options {
}; };
enum mysql_status enum mysql_status
{ {
MYSQL_STATUS_READY,MYSQL_STATUS_GET_RESULT,MYSQL_STATUS_USE_RESULT MYSQL_STATUS_READY, MYSQL_STATUS_GET_RESULT, MYSQL_STATUS_USE_RESULT,
MYSQL_STATUS_STATEMENT_GET_RESULT
}; };
enum mysql_protocol_type enum mysql_protocol_type
{ {
......
...@@ -2503,6 +2503,8 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length) ...@@ -2503,6 +2503,8 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length)
set_stmt_errmsg(stmt, net); set_stmt_errmsg(stmt, net);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
else if (mysql->status == MYSQL_STATUS_GET_RESULT)
stmt->mysql->status= MYSQL_STATUS_STATEMENT_GET_RESULT;
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -2641,7 +2643,7 @@ static int stmt_read_row_unbuffered(MYSQL_STMT *stmt, unsigned char **row) ...@@ -2641,7 +2643,7 @@ static int stmt_read_row_unbuffered(MYSQL_STMT *stmt, unsigned char **row)
set_stmt_error(stmt, CR_SERVER_LOST, unknown_sqlstate, NULL); set_stmt_error(stmt, CR_SERVER_LOST, unknown_sqlstate, NULL);
return 1; return 1;
} }
if (mysql->status != MYSQL_STATUS_GET_RESULT) if (mysql->status != MYSQL_STATUS_STATEMENT_GET_RESULT)
{ {
set_stmt_error(stmt, stmt->unbuffered_fetch_cancelled ? set_stmt_error(stmt, stmt->unbuffered_fetch_cancelled ?
CR_FETCH_CANCELED : CR_COMMANDS_OUT_OF_SYNC, CR_FETCH_CANCELED : CR_COMMANDS_OUT_OF_SYNC,
...@@ -4847,7 +4849,7 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt) ...@@ -4847,7 +4849,7 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
DBUG_RETURN(1); DBUG_RETURN(1);
} }
} }
else if (mysql->status != MYSQL_STATUS_GET_RESULT) else if (mysql->status != MYSQL_STATUS_STATEMENT_GET_RESULT)
{ {
set_stmt_error(stmt, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate, NULL); set_stmt_error(stmt, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate, NULL);
DBUG_RETURN(1); DBUG_RETURN(1);
......
...@@ -16,7 +16,6 @@ innodb_plugin.* @solaris # Bug#56063 InnoDB Plugin mysql-tests f ...@@ -16,7 +16,6 @@ innodb_plugin.* @solaris # Bug#56063 InnoDB Plugin mysql-tests f
main.ctype_gbk_binlog @solaris # Bug#46010: main.ctype_gbk_binlog fails sporadically : Table 't2' already exists main.ctype_gbk_binlog @solaris # Bug#46010: main.ctype_gbk_binlog fails sporadically : Table 't2' already exists
main.func_str @solaris # joro: Bug#40928 main.func_str @solaris # joro: Bug#40928
main.plugin_load @solaris # Bug#42144
main.sp @solaris # joro : Bug#54138 main.sp @solaris # joro : Bug#54138
main.outfile_loaddata @solaris # joro : Bug #46895 main.outfile_loaddata @solaris # joro : Bug #46895
......
# Requires statement logging # Requires statement logging
-- source include/have_binlog_format_mixed_or_statement.inc -- source include/have_binlog_format_statement.inc
# See if replication of a "LOAD DATA in an autoincrement column" # See if replication of a "LOAD DATA in an autoincrement column"
# Honours autoincrement values # Honours autoincrement values
......
--echo
--echo
connection master;
if ($is_temporary)
{
--let $_temporary=TEMPORARY
}
CREATE TABLE t2(c1 INT, c2 char(10));
INSERT INTO t2 VALUES(1, 'abc'), (2, 'abc');
--echo
--echo # The original query should be binlogged if the table does not exist.
--echo # ------------------------------------------------------------------
--echo
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
eval CREATE $_temporary TABLE IF NOT EXISTS t1 (c1 INT , c2 INT, c3 char(10), c4 INT KEY)
SELECT 'abc' AS c3, 1 AS c4;
source include/show_binlog_events.inc;
if (!$is_temporary)
{
let $diff_table= test.t1;
source include/rpl_diff_tables.inc;
}
--echo
--echo # The statement should be binlogged as two events. one is
--echo # 'CREATE $_temporary TABLE IF NOT EXISTS ..', another one is
--echo # 'INSERT ... SELECT'.
--echo # ------------------------------------------------------------------
--echo
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
eval CREATE $_temporary TABLE IF NOT EXISTS t1
SELECT 'abc', 2;
source include/show_binlog_events.inc;
if (!$is_temporary)
{
let $diff_table= test.t1;
source include/rpl_diff_tables.inc;
}
--echo
--echo # Verify if it can be binlogged with right database name when the table
--echo # is not in the default database
--echo
--disable_warnings
DROP DATABASE IF EXISTS db1;
--enable_warnings
CREATE DATABASE db1;
USE db1;
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
eval CREATE $_temporary TABLE IF NOT EXISTS test.t1
SELECT 'abc', 20;
source include/show_binlog_events.inc;
if (!$is_temporary)
{
let $diff_table= test.t1;
source include/rpl_diff_tables.inc;
}
USE test;
DROP DATABASE db1;
--echo
--echo # It should be binlogged as 'REPLACE ... SELECT'
--echo # if the original statement has option REPLACE
--echo
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
eval CREATE $_temporary TABLE IF NOT EXISTS t1
REPLACE SELECT '123', 2;
source include/show_binlog_events.inc;
if (!$is_temporary)
{
let $diff_table= test.t1;
source include/rpl_diff_tables.inc;
}
--echo
--echo # It should be binlogged as 'INSERT IGNORE... SELECT'
--echo # if the original statement has option IGNORE
--echo
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
eval CREATE $_temporary TABLE IF NOT EXISTS t1
IGNORE SELECT '123', 2;
source include/show_binlog_events.inc;
if (!$is_temporary)
{
let $diff_table= test.t1;
source include/rpl_diff_tables.inc;
}
--echo
--echo # Nothing should be binlogged if error happens and no any row is inserted
--echo
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
--error ER_DUP_ENTRY
eval CREATE $_temporary TABLE IF NOT EXISTS t1
SELECT '123', 2;
source include/show_binlog_events.inc;
if (!$is_temporary)
{
let $diff_table= test.t1;
source include/rpl_diff_tables.inc;
}
--echo
--echo # Verify it can binlog well when there are some braces('(')
--echo
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
eval CREATE $_temporary TABLE IF NOT EXISTS t1
(SELECT '123', 3) UNION (SELECT '123', 4);
eval CREATE $_temporary TABLE IF NOT EXISTS t1
REPLACE (SELECT 'abc', 3) UNION (SELECT 'abc', 4);
eval CREATE $_temporary TABLE IF NOT EXISTS t1
IGNORE (SELECT '123', 3) UNION (SELECT '123', 4);
source include/show_binlog_events.inc;
if (!$is_temporary)
{
let $diff_table= test.t1;
source include/rpl_diff_tables.inc;
}
if (!$is_temporary)
{
--echo
--echo # Throw a warning that table already exists and don't insert anything
--echo
CREATE VIEW t3 AS SELECT * FROM t2;
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
CREATE TABLE IF NOT EXISTS t3
SELECT '123', 2;
source include/show_binlog_events.inc;
DROP VIEW t3;
}
--echo
--echo # The statement can be binlogged correctly when it is in a SP/EVENT/TRIGGER
--echo
--disable_warnings
DROP PROCEDURE IF EXISTS p1;
--enable_warnings
eval CREATE PROCEDURE p1(IN a INT)
CREATE $_temporary TABLE IF NOT EXISTS t1 SELECT '123', a;
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
call p1(500);
call p1(600);
source include/show_binlog_events.inc;
if (!$is_temporary)
{
let $diff_table= test.t1;
source include/rpl_diff_tables.inc;
}
DROP PROCEDURE p1;
--echo
--echo # The statement can be binlogged correctly when it is in a prepared statement
--echo
eval PREPARE stm FROM "CREATE $_temporary TABLE IF NOT EXISTS t1 SELECT '123', ?";
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
SET @a= 700;
EXECUTE stm USING @a;
SET @a= 800;
EXECUTE stm USING @a;
source include/show_binlog_events.inc;
if (!$is_temporary)
{
let $diff_table= test.t1;
source include/rpl_diff_tables.inc;
}
--echo
--echo # The statement can be binlogged correctly when it is in a conditional comment
--echo
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
--echo # The whole statement in a conditional comment
eval /*!CREATE $_temporary TABLE IF NOT EXISTS t1
SELECT 'abc', 900*/;
source include/show_binlog_events.inc;
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
--echo
--echo # There is an long comment before SELECT
eval /*!CREATE $_temporary /*blabla*/ TABLE IF NOT EXISTS t1
SELECT 'abc', 901*/;
source include/show_binlog_events.inc;
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
--echo
--echo # Conditional comment starts just from SELECT
eval CREATE $_temporary TABLE IF NOT EXISTS t1
/*!SELECT 'abc',*/ 902;
source include/show_binlog_events.inc;
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
--echo
--echo # Only SELECT keyword is in the conditional comment
eval CREATE $_temporary TABLE IF NOT EXISTS t1
/*!SELECT*/ /*!'abc',*/ 904;
source include/show_binlog_events.inc;
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
--echo
--echo # Conditional comment is after SELECT keyword
eval CREATE $_temporary TABLE IF NOT EXISTS t1
SELECT /*!'abc',*/ 903;
source include/show_binlog_events.inc;
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
--echo
--echo # Conditional comment ends just before SELECT keyword
eval /*!CREATE $_temporary TABLE IF NOT EXISTS t1
*/SELECT 'abc', 905;
source include/show_binlog_events.inc;
if (!$is_temporary)
{
let $diff_table= test.t1;
source include/rpl_diff_tables.inc;
}
DROP TABLE t2;
eval DROP $_temporary TABLE t1;
...@@ -126,3 +126,19 @@ WHERE ...@@ -126,3 +126,19 @@ WHERE
drop table t1; drop table t1;
--echo #
--echo # Bug#50402 Optimizer producing wrong results when using Index Merge on InnoDB
--echo #
CREATE TABLE t1 (f1 INT, PRIMARY KEY (f1));
INSERT INTO t1 VALUES (2);
CREATE TABLE t2 (f1 INT, f2 INT, f3 char(1),
PRIMARY KEY (f1), KEY (f2), KEY (f3) );
INSERT INTO t2 VALUES (1, 1, 'h'), (2, 3, 'h'), (3, 2, ''), (4, 2, '');
SELECT t1.f1 FROM t1
WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f1 = 2;
EXPLAIN SELECT t1.f1 FROM t1
WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f1 = 2;
DROP TABLE t1,t2;
...@@ -1910,7 +1910,7 @@ select hex(s1) from t4; ...@@ -1910,7 +1910,7 @@ select hex(s1) from t4;
drop table t1,t2,t3,t4; drop table t1,t2,t3,t4;
} }
if (test_foreign_keys) if ($test_foreign_keys)
{ {
eval create table t1 (a int primary key,s1 varbinary(3) not null unique) engine=$engine_type; eval create table t1 (a int primary key,s1 varbinary(3) not null unique) engine=$engine_type;
eval create table t2 (s1 binary(2) not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=$engine_type; eval create table t2 (s1 binary(2) not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=$engine_type;
...@@ -2405,7 +2405,7 @@ drop table t1, t2, t3, t5, t6, t8, t9; ...@@ -2405,7 +2405,7 @@ drop table t1, t2, t3, t5, t6, t8, t9;
} }
# End transactional tests # End transactional tests
if (test_foreign_keys) if ($test_foreign_keys)
{ {
# bug 18934, "InnoDB crashes when table uses column names like DB_ROW_ID" # bug 18934, "InnoDB crashes when table uses column names like DB_ROW_ID"
--error 1005 --error 1005
......
if (`SELECT count(*) FROM information_schema.engines WHERE
(support = 'YES' OR support = 'DEFAULT') AND
engine = 'blackhole'`){
skip Blackhole engine enabled;
}
...@@ -33,3 +33,4 @@ while (`SELECT "XX$_servers" <> "XX"`) ...@@ -33,3 +33,4 @@ while (`SELECT "XX$_servers" <> "XX"`)
--source include/diff_tables.inc --source include/diff_tables.inc
connection $_slave; connection $_slave;
} }
connection $_master;
...@@ -188,6 +188,8 @@ sub new { ...@@ -188,6 +188,8 @@ sub new {
while ( my $line= <$F> ) { while ( my $line= <$F> ) {
chomp($line); chomp($line);
# Remove any trailing CR from Windows edited files
$line=~ s/\cM$//;
# [group] # [group]
if ( $line =~ /^\[(.*)\]/ ) { if ( $line =~ /^\[(.*)\]/ ) {
......
...@@ -30,6 +30,13 @@ sub get_basedir { ...@@ -30,6 +30,13 @@ sub get_basedir {
return $basedir; return $basedir;
} }
sub get_testdir {
my ($self, $group)= @_;
my $testdir= $group->if_exist('testdir') ||
$self->{ARGS}->{testdir};
return $testdir;
}
sub fix_charset_dir { sub fix_charset_dir {
my ($self, $config, $group_name, $group)= @_; my ($self, $config, $group_name, $group)= @_;
...@@ -142,8 +149,8 @@ sub fix_secure_file_priv { ...@@ -142,8 +149,8 @@ sub fix_secure_file_priv {
sub fix_std_data { sub fix_std_data {
my ($self, $config, $group_name, $group)= @_; my ($self, $config, $group_name, $group)= @_;
my $basedir= $self->get_basedir($group); my $testdir= $self->get_testdir($group);
return "$basedir/mysql-test/std_data"; return "$testdir/std_data";
} }
sub ssl_supported { sub ssl_supported {
......
...@@ -60,11 +60,12 @@ use My::Platform; ...@@ -60,11 +60,12 @@ use My::Platform;
my %running; my %running;
my $_verbose= 0; my $_verbose= 0;
my $start_exit= 0;
END { END {
# Kill any children still running # Kill any children still running
for my $proc (values %running){ for my $proc (values %running){
if ( $proc->is_child($$) ){ if ( $proc->is_child($$) and ! $start_exit){
#print "Killing: $proc\n"; #print "Killing: $proc\n";
if ($proc->wait_one(0)){ if ($proc->wait_one(0)){
$proc->kill(); $proc->kill();
...@@ -149,6 +150,11 @@ sub new { ...@@ -149,6 +150,11 @@ sub new {
push(@safe_args, "--"); push(@safe_args, "--");
push(@safe_args, $path); # The program safe_process should execute push(@safe_args, $path); # The program safe_process should execute
if ($start_exit) { # Bypass safe_process instead, start program directly
@safe_args= ();
$safe_path= $path;
}
push(@safe_args, @$$args); push(@safe_args, @$$args);
print "### safe_path: ", $safe_path, " ", join(" ", @safe_args), "\n" print "### safe_path: ", $safe_path, " ", join(" ", @safe_args), "\n"
...@@ -528,6 +534,13 @@ sub wait_all { ...@@ -528,6 +534,13 @@ sub wait_all {
} }
} }
#
# Set global flag to tell all safe_process to exit after starting child
#
sub start_exit {
$start_exit= 1;
}
# #
# Check if any process has exited, but don't wait. # Check if any process has exited, but don't wait.
......
...@@ -266,11 +266,11 @@ sub collect_one_suite($) ...@@ -266,11 +266,11 @@ sub collect_one_suite($)
} }
else else
{ {
$suitedir= my_find_dir($::basedir, $suitedir= my_find_dir($suitedir,
["mysql-test/suite", ["suite",
"mysql-test", ".",
# Look in storage engine specific suite dirs # Look in storage engine specific suite dirs
"storage/*/mysql-test-suites" "../storage/*/mysql-test-suites"
], ],
[$suite]); [$suite]);
} }
...@@ -584,7 +584,7 @@ sub optimize_cases { ...@@ -584,7 +584,7 @@ sub optimize_cases {
# Check that engine selected by # Check that engine selected by
# --default-storage-engine=<engine> is supported # --default-storage-engine=<engine> is supported
# ======================================================= # =======================================================
my %builtin_engines = ('myisam' => 1, 'memory' => 1); my %builtin_engines = ('myisam' => 1, 'memory' => 1, 'csv' => 1);
foreach my $opt ( @{$tinfo->{master_opt}} ) { foreach my $opt ( @{$tinfo->{master_opt}} ) {
my $default_engine= my $default_engine=
...@@ -684,6 +684,13 @@ sub process_opts_file { ...@@ -684,6 +684,13 @@ sub process_opts_file {
next; next;
} }
$value= mtr_match_prefix($opt, "--testcase-timeout=");
if ( defined $value ) {
# Overrides test case timeout for this test
$tinfo->{'case-timeout'}= $value;
next;
}
# Ok, this was a real option, add it # Ok, this was a real option, add it
push(@{$tinfo->{$opt_name}}, $opt); push(@{$tinfo->{$opt_name}}, $opt);
} }
......
...@@ -124,7 +124,7 @@ sub mtr_report_test ($) { ...@@ -124,7 +124,7 @@ sub mtr_report_test ($) {
my $timest = format_time(); my $timest = format_time();
my $fail = "fail"; my $fail = "fail";
if ( $::opt_experimental ) if ( @$::experimental_test_cases )
{ {
# Find out if this test case is an experimental one, so we can treat # Find out if this test case is an experimental one, so we can treat
# the failure as an expected failure instead of a regression. # the failure as an expected failure instead of a regression.
......
This diff is collapsed.
...@@ -5138,7 +5138,7 @@ insert t1 values (1),(2),(3),(4),(5); ...@@ -5138,7 +5138,7 @@ insert t1 values (1),(2),(3),(4),(5);
truncate table t1; truncate table t1;
affected rows: 0 affected rows: 0
drop table t1; drop table t1;
create table t1 (v varchar(32) not null); create table t1 (v varchar(32) not null) engine=csv;
insert into t1 values ('def'),('abc'),('hij'),('3r4f'); insert into t1 values ('def'),('abc'),('hij'),('3r4f');
select * from t1; select * from t1;
v v
...@@ -5146,14 +5146,14 @@ def ...@@ -5146,14 +5146,14 @@ def
abc abc
hij hij
3r4f 3r4f
alter table t1 change v v2 varchar(32); alter table t1 change v v2 varchar(32) not null;
select * from t1; select * from t1;
v2 v2
def def
abc abc
hij hij
3r4f 3r4f
alter table t1 change v2 v varchar(64); alter table t1 change v2 v varchar(64) not null;
select * from t1; select * from t1;
v v
def def
...@@ -5163,35 +5163,34 @@ hij ...@@ -5163,35 +5163,34 @@ hij
update t1 set v = 'lmn' where v = 'hij'; update t1 set v = 'lmn' where v = 'hij';
select * from t1; select * from t1;
v v
lmn
def def
abc abc
lmn
3r4f 3r4f
alter table t1 add i int auto_increment not null primary key first; alter table t1 add i int not null first;
select * from t1; select * from t1;
i v i v
1 def 0 lmn
2 abc 0 def
3 lmn 0 abc
4 3r4f 0 3r4f
update t1 set i=5 where i=3; update t1 set i=3 where v = 'abc';
select * from t1; select * from t1;
i v i v
1 def 3 abc
2 abc 0 lmn
5 lmn 0 def
4 3r4f 0 3r4f
alter table t1 change i i bigint; alter table t1 change i i bigint not null;
select * from t1; select * from t1;
i v i v
1 def 3 abc
2 abc 0 lmn
5 lmn 0 def
4 3r4f 0 3r4f
alter table t1 add unique key (i, v); select * from t1 where i between 2 and 4 and v in ('def','3r4f','abc');
select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn');
i v i v
4 3r4f 3 abc
drop table t1; drop table t1;
create table bug15205 (val int(11) not null) engine=csv; create table bug15205 (val int(11) not null) engine=csv;
create table bug15205_2 (val int(11) not null) engine=csv; create table bug15205_2 (val int(11) not null) engine=csv;
......
...@@ -358,4 +358,13 @@ INDEX(a), INDEX(b), INDEX(c)); ...@@ -358,4 +358,13 @@ INDEX(a), INDEX(b), INDEX(c));
INSERT INTO t1 VALUES (1,2,3), (4,5,6), (7,8,9); INSERT INTO t1 VALUES (1,2,3), (4,5,6), (7,8,9);
DELETE FROM t1 WHERE a = 10 OR b = 20 ORDER BY c LIMIT 1; DELETE FROM t1 WHERE a = 10 OR b = 20 ORDER BY c LIMIT 1;
DROP TABLE t1; DROP TABLE t1;
#
# Bug #53034: Multiple-table DELETE statements not accepting
# "Access compatibility" syntax
#
CREATE TABLE t1 (id INT);
CREATE TABLE t2 LIKE t1;
CREATE TABLE t3 LIKE t1;
DELETE FROM t1.*, test.t2.*, a.* USING t1, t2, t3 AS a;
DROP TABLE t1, t2, t3;
End of 5.1 tests End of 5.1 tests
...@@ -995,6 +995,7 @@ SELECT 1 FROM ...@@ -995,6 +995,7 @@ SELECT 1 FROM
1 1
1 1
DROP TABLE t1; DROP TABLE t1;
End of 5.0 tests
# #
# Bug #52397: another crash with explain extended and group_concat # Bug #52397: another crash with explain extended and group_concat
# #
...@@ -1010,4 +1011,22 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1010,4 +1011,22 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings: Warnings:
Note 1003 select 1 AS `1` from (select group_concat(`test`.`t1`.`a` order by `test`.`t1`.`a` ASC separator ',') AS `GROUP_CONCAT(t1.a ORDER BY t1.a ASC)` from `test`.`t1` `t2` join `test`.`t1` group by `test`.`t1`.`a`) `d` Note 1003 select 1 AS `1` from (select group_concat(`test`.`t1`.`a` order by `test`.`t1`.`a` ASC separator ',') AS `GROUP_CONCAT(t1.a ORDER BY t1.a ASC)` from `test`.`t1` `t2` join `test`.`t1` group by `test`.`t1`.`a`) `d`
DROP TABLE t1; DROP TABLE t1;
End of 5.0 tests #
# Bug #54476: crash when group_concat and 'with rollup' in prepared statements
#
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1), (2);
PREPARE stmt FROM "SELECT GROUP_CONCAT(t1.a ORDER BY t1.a) FROM t1 JOIN t1 t2 GROUP BY t1.a WITH ROLLUP";
EXECUTE stmt;
GROUP_CONCAT(t1.a ORDER BY t1.a)
1,1
2,2
1,1,2,2
EXECUTE stmt;
GROUP_CONCAT(t1.a ORDER BY t1.a)
1,1
2,2
1,1,2,2
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
End of 5.1 tests
...@@ -1713,4 +1713,15 @@ f1 f2 f3 f4 f1 = f2 ...@@ -1713,4 +1713,15 @@ f1 f2 f3 f4 f1 = f2
NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
drop table t1; drop table t1;
# #
# Bug #54465: assert: field_types == 0 || field_types[field_pos] ==
# MYSQL_TYPE_LONGLONG
#
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1), (2);
SELECT MAX((SELECT 1 FROM t1 ORDER BY @var LIMIT 1)) m FROM t1 t2, t1
ORDER BY t1.a;
m
1
DROP TABLE t1;
#
End of 5.1 tests End of 5.1 tests
...@@ -336,4 +336,19 @@ End of 5.0 tests ...@@ -336,4 +336,19 @@ End of 5.0 tests
select connection_id() > 0; select connection_id() > 0;
connection_id() > 0 connection_id() > 0
1 1
#
# Bug #54461: crash with longblob and union or update with subquery
#
CREATE TABLE t1 (a INT, b LONGBLOB);
INSERT INTO t1 VALUES (1, '2'), (2, '3'), (3, '2');
SELECT DISTINCT LEAST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
LEAST(a, (SELECT b FROM t1 LIMIT 1))
1
2
SELECT DISTINCT GREATEST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
GREATEST(a, (SELECT b FROM t1 LIMIT 1))
2
3
1
DROP TABLE t1;
End of tests End of tests
...@@ -194,7 +194,7 @@ date("1997-12-31 23:59:59.000001") as f8, ...@@ -194,7 +194,7 @@ date("1997-12-31 23:59:59.000001") as f8,
time("1997-12-31 23:59:59.000001") as f9; time("1997-12-31 23:59:59.000001") as f9;
describe t1; describe t1;
Field Type Null Key Default Extra Field Type Null Key Default Extra
f1 date NO 0000-00-00 f1 date YES NULL
f2 datetime YES NULL f2 datetime YES NULL
f3 time YES NULL f3 time YES NULL
f4 time YES NULL f4 time YES NULL
......
...@@ -1335,4 +1335,12 @@ date_sub("0069-01-01 00:00:01",INTERVAL 2 SECOND) ...@@ -1335,4 +1335,12 @@ date_sub("0069-01-01 00:00:01",INTERVAL 2 SECOND)
select date_sub("0169-01-01 00:00:01",INTERVAL 2 SECOND); select date_sub("0169-01-01 00:00:01",INTERVAL 2 SECOND);
date_sub("0169-01-01 00:00:01",INTERVAL 2 SECOND) date_sub("0169-01-01 00:00:01",INTERVAL 2 SECOND)
0168-12-31 23:59:59 0168-12-31 23:59:59
CREATE TABLE t1(a DOUBLE NOT NULL);
INSERT INTO t1 VALUES (0),(9.216e-096);
# should not crash
SELECT 1 FROM t1 ORDER BY @x:=makedate(a,a);
1
1
1
DROP TABLE t1;
End of 5.1 tests End of 5.1 tests
...@@ -1057,4 +1057,11 @@ NULL ...@@ -1057,4 +1057,11 @@ NULL
SELECT Polygon(12345123,''); SELECT Polygon(12345123,'');
Polygon(12345123,'') Polygon(12345123,'')
NULL NULL
#
# BUG#51875: crash when loading data into geometry function polyfromwkb
#
SET @a=0x00000000030000000100000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440;
SET @a=POLYFROMWKB(@a);
SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440;
SET @a=POLYFROMWKB(@a);
End of 5.1 tests End of 5.1 tests
...@@ -1810,4 +1810,39 @@ MAX(t2.a) ...@@ -1810,4 +1810,39 @@ MAX(t2.a)
2 2
DROP TABLE t1, t2; DROP TABLE t1, t2;
# #
# Bug#55188: GROUP BY, GROUP_CONCAT and TEXT - inconsistent results
#
CREATE TABLE t1 (a text, b varchar(10));
INSERT INTO t1 VALUES (repeat('1', 1300),'one'), (repeat('1', 1300),'two');
EXPLAIN
SELECT SUBSTRING(a,1,10), LENGTH(a), GROUP_CONCAT(b) FROM t1 GROUP BY a;
id 1
select_type SIMPLE
table t1
type ALL
possible_keys NULL
key NULL
key_len NULL
ref NULL
rows 2
Extra Using filesort
SELECT SUBSTRING(a,1,10), LENGTH(a), GROUP_CONCAT(b) FROM t1 GROUP BY a;
SUBSTRING(a,1,10) LENGTH(a) GROUP_CONCAT(b)
1111111111 1300 one,two
EXPLAIN
SELECT SUBSTRING(a,1,10), LENGTH(a) FROM t1 GROUP BY a;
id 1
select_type SIMPLE
table t1
type ALL
possible_keys NULL
key NULL
key_len NULL
ref NULL
rows 2
Extra Using temporary; Using filesort
SELECT SUBSTRING(a,1,10), LENGTH(a) FROM t1 GROUP BY a;
SUBSTRING(a,1,10) LENGTH(a)
1111111111 1300
DROP TABLE t1;
# End of 5.1 tests # End of 5.1 tests
...@@ -581,3 +581,21 @@ WHERE ...@@ -581,3 +581,21 @@ WHERE
`RUNID`= '' AND `SUBMITNR`= '' AND `ORDERNR`='' AND `PROGRAMM`='' AND `RUNID`= '' AND `SUBMITNR`= '' AND `ORDERNR`='' AND `PROGRAMM`='' AND
`TESTID`='' AND `UCCHECK`=''; `TESTID`='' AND `UCCHECK`='';
drop table t1; drop table t1;
#
# Bug#50402 Optimizer producing wrong results when using Index Merge on InnoDB
#
CREATE TABLE t1 (f1 INT, PRIMARY KEY (f1));
INSERT INTO t1 VALUES (2);
CREATE TABLE t2 (f1 INT, f2 INT, f3 char(1),
PRIMARY KEY (f1), KEY (f2), KEY (f3) );
INSERT INTO t2 VALUES (1, 1, 'h'), (2, 3, 'h'), (3, 2, ''), (4, 2, '');
SELECT t1.f1 FROM t1
WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f1 = 2;
f1
2
EXPLAIN SELECT t1.f1 FROM t1
WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f1 = 2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1 Using index
2 DEPENDENT SUBQUERY t2 index_merge f2,f3 f3,f2 2,5 NULL 1 Using intersect(f3,f2); Using where; Using index
DROP TABLE t1,t2;
...@@ -1416,6 +1416,24 @@ WHERE ...@@ -1416,6 +1416,24 @@ WHERE
`TESTID`='' AND `UCCHECK`=''; `TESTID`='' AND `UCCHECK`='';
drop table t1; drop table t1;
# #
# Bug#50402 Optimizer producing wrong results when using Index Merge on InnoDB
#
CREATE TABLE t1 (f1 INT, PRIMARY KEY (f1));
INSERT INTO t1 VALUES (2);
CREATE TABLE t2 (f1 INT, f2 INT, f3 char(1),
PRIMARY KEY (f1), KEY (f2), KEY (f3) );
INSERT INTO t2 VALUES (1, 1, 'h'), (2, 3, 'h'), (3, 2, ''), (4, 2, '');
SELECT t1.f1 FROM t1
WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f1 = 2;
f1
2
EXPLAIN SELECT t1.f1 FROM t1
WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f1 = 2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
2 DEPENDENT SUBQUERY t2 ref f2,f3 f2 5 1 Using where
DROP TABLE t1,t2;
#
# Generic @@optimizer_switch tests (move those into a separate file if # Generic @@optimizer_switch tests (move those into a separate file if
# we get another @@optimizer_switch user) # we get another @@optimizer_switch user)
# #
......
...@@ -639,3 +639,18 @@ CREATE TABLE t2(f1 CHAR(1)); ...@@ -639,3 +639,18 @@ CREATE TABLE t2(f1 CHAR(1));
INSERT INTO t2 SELECT f1 FROM t1; INSERT INTO t2 SELECT f1 FROM t1;
DROP TABLE t1, t2; DROP TABLE t1, t2;
End of 5.0 tests. End of 5.0 tests.
#
# Bug#54106 assert in Protocol::end_statement,
# INSERT IGNORE ... SELECT ... UNION SELECT ...
#
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a INT);
INSERT INTO t1 (a, a) VALUES (1, 1);
ERROR 42000: Column 'a' specified twice
INSERT IGNORE t1 (a, a) VALUES (1, 1);
ERROR 42000: Column 'a' specified twice
INSERT IGNORE t1 (a, a) SELECT 1,1;
ERROR 42000: Column 'a' specified twice
INSERT IGNORE t1 (a, a) SELECT 1,1 UNION SELECT 2,2;
ERROR 42000: Column 'a' specified twice
DROP TABLE t1;
...@@ -2298,4 +2298,45 @@ t2 WHERE b SOUNDS LIKE e AND d = 1; ...@@ -2298,4 +2298,45 @@ t2 WHERE b SOUNDS LIKE e AND d = 1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
DROP TABLE t2, t1; DROP TABLE t2, t1;
#
# Bug#46339 - crash on REPAIR TABLE merge table USE_FRM
#
DROP TABLE IF EXISTS m1, t1;
CREATE TABLE t1 (c1 INT) ENGINE=MYISAM;
CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1) INSERT_METHOD=LAST;
LOCK TABLE m1 READ;
REPAIR TABLE m1 USE_FRM;
Table Op Msg_type Msg_text
test.m1 repair note The storage engine for the table doesn't support repair
UNLOCK TABLES;
REPAIR TABLE m1 USE_FRM;
Table Op Msg_type Msg_text
test.m1 repair note The storage engine for the table doesn't support repair
DROP TABLE m1,t1;
CREATE TABLE m1 (f1 BIGINT) ENGINE=MRG_MyISAM UNION(t1);
REPAIR TABLE m1 USE_FRM;
Table Op Msg_type Msg_text
test.m1 repair Error Can't open table
test.m1 repair error Corrupt
CREATE TABLE t1 (f1 BIGINT) ENGINE = MyISAM;
REPAIR TABLE m1 USE_FRM;
Table Op Msg_type Msg_text
test.m1 repair note The storage engine for the table doesn't support repair
REPAIR TABLE m1;
Table Op Msg_type Msg_text
test.m1 repair note The storage engine for the table doesn't support repair
DROP TABLE m1, t1;
CREATE TEMPORARY TABLE m1 (f1 BIGINT) ENGINE=MRG_MyISAM UNION(t1);
REPAIR TABLE m1 USE_FRM;
Table Op Msg_type Msg_text
test.m1 repair Error Table 'test.m1' doesn't exist
test.m1 repair error Corrupt
CREATE TEMPORARY TABLE t1 (f1 BIGINT) ENGINE=MyISAM;
REPAIR TABLE m1 USE_FRM;
Table Op Msg_type Msg_text
m1 repair error Cannot repair temporary table from .frm file
REPAIR TABLE m1;
Table Op Msg_type Msg_text
test.m1 repair note The storage engine for the table doesn't support repair
DROP TABLE m1, t1;
End of 5.1 tests End of 5.1 tests
...@@ -639,4 +639,24 @@ SET SESSION sql_safe_updates = 1; ...@@ -639,4 +639,24 @@ SET SESSION sql_safe_updates = 1;
UPDATE IGNORE t1, t1 t1a SET t1.a = 1 WHERE t1a.a = 1; UPDATE IGNORE t1, t1 t1a SET t1.a = 1 WHERE t1a.a = 1;
ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
DROP TABLE t1; DROP TABLE t1;
#
# Bug#54543: update ignore with incorrect subquery leads to assertion
# failure: inited==INDEX
#
SET SESSION sql_safe_updates = 0;
CREATE TABLE t1 ( a INT );
INSERT INTO t1 VALUES (1), (2);
CREATE TABLE t2 ( a INT );
INSERT INTO t2 VALUES (1), (2);
CREATE TABLE t3 ( a INT );
INSERT INTO t3 VALUES (1), (2);
# Should not crash
UPDATE IGNORE
( SELECT ( SELECT COUNT(*) FROM t1 GROUP BY a, @v ) a FROM t2 ) x, t3
SET t3.a = 0;
Warnings:
Error 1242 Subquery returns more than 1 row
Error 1242 Subquery returns more than 1 row
DROP TABLE t1, t2, t3;
SET SESSION sql_safe_updates = DEFAULT;
end of tests end of tests
SET @old_general_log= @@global.general_log; SET @old_general_log= @@global.general_log;
SET @old_slow_query_log= @@global.slow_query_log;
ok ok
SET @@global.general_log= @old_general_log; SET @@global.general_log= @old_general_log;
SET @@global.slow_query_log= @old_slow_query_log;
...@@ -262,6 +262,9 @@ a long \$where variable content ...@@ -262,6 +262,9 @@ a long \$where variable content
banana = banana banana = banana
Not a banana: ba\$cat\$cat Not a banana: ba\$cat\$cat
with\`some"escaped\'quotes
with\`some"escaped\'quotes
single'tick`backtick
mysqltest: At line 1: Missing arguments to let mysqltest: At line 1: Missing arguments to let
mysqltest: At line 1: Missing variable name in let mysqltest: At line 1: Missing variable name in let
mysqltest: At line 1: Missing assignment operator in let mysqltest: At line 1: Missing assignment operator in let
...@@ -325,6 +328,7 @@ outer=2 ifval=0 ...@@ -325,6 +328,7 @@ outer=2 ifval=0
outer=1 ifval=1 outer=1 ifval=1
here is the sourced script here is the sourced script
ERROR 42S02: Table 'test.nowhere' doesn't exist ERROR 42S02: Table 'test.nowhere' doesn't exist
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'else' at line 1
In loop In loop
here is the sourced script here is the sourced script
...@@ -392,6 +396,9 @@ true-inner again ...@@ -392,6 +396,9 @@ true-inner again
true-outer true-outer
Counter is greater than 0, (counter=10) Counter is greater than 0, (counter=10)
Counter is not 0, (counter=0) Counter is not 0, (counter=0)
Counter is true, (counter=alpha)
Beta is true
while with string, only once
1 1
Testing while with not Testing while with not
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest_while.inc": At line 64: Nesting too deeply mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest_while.inc": At line 64: Nesting too deeply
...@@ -446,7 +453,6 @@ OK ...@@ -446,7 +453,6 @@ OK
mysqltest: The test didn't produce any output mysqltest: The test didn't produce any output
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 3: connection 'test_con1' not found in connection pool mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 3: connection 'test_con1' not found in connection pool
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 2: Connection test_con1 already exists mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 2: Connection test_con1 already exists
connect(localhost,root,,test,MASTER_PORT,MASTER_SOCKET);
show tables; show tables;
ERROR 3D000: No database selected ERROR 3D000: No database selected
Output from mysqltest-x.inc Output from mysqltest-x.inc
...@@ -572,7 +578,7 @@ if things work as expected ...@@ -572,7 +578,7 @@ if things work as expected
Some data Some data
for cat_file command for cat_file command
of mysqltest of mysqltest
mysqltest: At line 1: Failed to open file 'non_existing_file' mysqltest: At line 1: command "cat_file" failed with error 1
mysqltest: At line 1: Missing required argument 'filename' to command 'file_exists' mysqltest: At line 1: Missing required argument 'filename' to command 'file_exists'
mysqltest: At line 1: Missing required argument 'from_file' to command 'copy_file' mysqltest: At line 1: Missing required argument 'from_file' to command 'copy_file'
mysqltest: At line 1: Missing required argument 'to_file' to command 'copy_file' mysqltest: At line 1: Missing required argument 'to_file' to command 'copy_file'
......
...@@ -1617,4 +1617,25 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -1617,4 +1617,25 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 2 Using where; Using temporary; Using filesort 1 SIMPLE t1 range a a 5 NULL 2 Using where; Using temporary; Using filesort
1 SIMPLE t2 ALL NULL NULL NULL NULL 10 Using join buffer 1 SIMPLE t2 ALL NULL NULL NULL NULL 10 Using join buffer
DROP TABLE t1, t2; DROP TABLE t1, t2;
#
# Bug #50394: Regression in EXPLAIN with index scan, LIMIT, GROUP BY and
# ORDER BY computed col
#
CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL, KEY( a, b ) );
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
INSERT INTO t1 SELECT a + 5, b + 5 FROM t1;
CREATE TABLE t2( a INT PRIMARY KEY, b INT );
INSERT INTO t2 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
INSERT INTO t2 SELECT a + 5, b + 5 FROM t2;
EXPLAIN
SELECT count(*) AS c, t1.a
FROM t1 JOIN t2 ON t1.b = t2.a
WHERE t2.b = 1
GROUP BY t1.a
ORDER by c
LIMIT 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL a 8 NULL 10 Using index; Using temporary; Using filesort
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 Using where
DROP TABLE t1, t2;
End of 5.1 tests End of 5.1 tests
drop table if exists t1, t2; drop table if exists t1, t2;
#
# Bug#55458: Partitioned MyISAM table gets crashed by multi-table update
#
CREATE TABLE t1 (
`id` int NOT NULL,
`user_num` int DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM CHARSET=latin1;
INSERT INTO t1 VALUES (1,8601);
INSERT INTO t1 VALUES (2,8601);
INSERT INTO t1 VALUES (3,8601);
INSERT INTO t1 VALUES (4,8601);
CREATE TABLE t2 (
`id` int(11) NOT NULL,
`user_num` int DEFAULT NULL,
`name` varchar(64) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM CHARSET=latin1
PARTITION BY HASH (id)
PARTITIONS 2;
INSERT INTO t2 VALUES (1,8601,'John');
INSERT INTO t2 VALUES (2,8601,'JS');
INSERT INTO t2 VALUES (3,8601,'John S');
UPDATE t1, t2 SET t2.name = 'John Smith' WHERE t1.user_num = t2.user_num;
DROP TABLE t1, t2;
CREATE TABLE t1 (a INT, b INT) CREATE TABLE t1 (a INT, b INT)
PARTITION BY LIST (a) PARTITION BY LIST (a)
SUBPARTITION BY HASH (b) SUBPARTITION BY HASH (b)
...@@ -1382,7 +1407,7 @@ NULL ...@@ -1382,7 +1407,7 @@ NULL
2 2
explain partitions select * from t1 where a is null or a < 0 or a > 1; explain partitions select * from t1 where a is null or a < 0 or a > 1;
id select_type table partitions type possible_keys key key_len ref rows Extra id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 pn,p2 ALL NULL NULL NULL NULL 4 Using where 1 SIMPLE t1 pn,p2 ALL NULL NULL NULL NULL 2 Using where
drop table t1; drop table t1;
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, name VARCHAR(20)) CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, name VARCHAR(20))
ENGINE=MyISAM DEFAULT CHARSET=latin1 ENGINE=MyISAM DEFAULT CHARSET=latin1
......
...@@ -69,25 +69,25 @@ id select_type table partitions type possible_keys key key_len ref rows Extra ...@@ -69,25 +69,25 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 Using where 1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 Using where
explain partitions select * from t1 where a is null or (a >= 5 and a <= 7); explain partitions select * from t1 where a is null or (a >= 5 and a <= 7);
id select_type table partitions type possible_keys key key_len ref rows Extra id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p2,p3 ALL NULL NULL NULL NULL 9 Using where 1 SIMPLE t1 p0,p2,p3 ALL NULL NULL NULL NULL 7 Using where
explain partitions select * from t1 where a is null; explain partitions select * from t1 where a is null;
id select_type table partitions type possible_keys key key_len ref rows Extra id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 9 Using where 1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 3 Using where
explain partitions select * from t1 where a is not null; explain partitions select * from t1 where a is not null;
id select_type table partitions type possible_keys key key_len ref rows Extra id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 Using where 1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 Using where
explain partitions select * from t1 where a >= 1 and a < 3; explain partitions select * from t1 where a >= 1 and a < 3;
id select_type table partitions type possible_keys key key_len ref rows Extra id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 9 Using where 1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 5 Using where
explain partitions select * from t1 where a >= 3 and a <= 5; explain partitions select * from t1 where a >= 3 and a <= 5;
id select_type table partitions type possible_keys key key_len ref rows Extra id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p1,p2 ALL NULL NULL NULL NULL 9 Using where 1 SIMPLE t1 p1,p2 ALL NULL NULL NULL NULL 4 Using where
explain partitions select * from t1 where a > 2 and a < 4; explain partitions select * from t1 where a > 2 and a < 4;
id select_type table partitions type possible_keys key key_len ref rows Extra id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 9 Using where 1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 2 Using where
explain partitions select * from t1 where a > 3 and a <= 6; explain partitions select * from t1 where a > 3 and a <= 6;
id select_type table partitions type possible_keys key key_len ref rows Extra id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p2,p3 ALL NULL NULL NULL NULL 9 Using where 1 SIMPLE t1 p2,p3 ALL NULL NULL NULL NULL 4 Using where
explain partitions select * from t1 where a > 5; explain partitions select * from t1 where a > 5;
id select_type table partitions type possible_keys key key_len ref rows Extra id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 Using where 1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 Using where
......
...@@ -22,31 +22,31 @@ insert INTO t1 VALUES (110); ...@@ -22,31 +22,31 @@ insert INTO t1 VALUES (110);
ERROR HY000: Table has no partition for value 110 ERROR HY000: Table has no partition for value 110
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 90; EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 90;
id select_type table partitions type possible_keys key key_len ref rows Extra id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where 1 SIMPLE t1 ALL NULL NULL NULL NULL 0 Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 90; EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 90;
id select_type table partitions type possible_keys key key_len ref rows Extra id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where 1 SIMPLE t1 ALL NULL NULL NULL NULL 0 Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 90; EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 90;
id select_type table partitions type possible_keys key key_len ref rows Extra id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where 1 SIMPLE t1 ALL NULL NULL NULL NULL 0 Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 89; EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 89;
id select_type table partitions type possible_keys key key_len ref rows Extra id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p90 ALL NULL NULL NULL NULL 7 Using where 1 SIMPLE t1 p90 ALL NULL NULL NULL NULL 3 Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 89; EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 89;
id select_type table partitions type possible_keys key key_len ref rows Extra id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p90 ALL NULL NULL NULL NULL 7 Using where 1 SIMPLE t1 p90 ALL NULL NULL NULL NULL 3 Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 89; EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 89;
id select_type table partitions type possible_keys key key_len ref rows Extra id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where 1 SIMPLE t1 ALL NULL NULL NULL NULL 0 Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 100; EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 100;
id select_type table partitions type possible_keys key key_len ref rows Extra id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where 1 SIMPLE t1 ALL NULL NULL NULL NULL 0 Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 100; EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 100;
id select_type table partitions type possible_keys key key_len ref rows Extra id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where 1 SIMPLE t1 ALL NULL NULL NULL NULL 0 Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 100; EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 100;
id select_type table partitions type possible_keys key key_len ref rows Extra id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where 1 SIMPLE t1 ALL NULL NULL NULL NULL 0 Using where
DROP TABLE t1; DROP TABLE t1;
# #
# Bug#50104: Partitioned table with just 1 partion works with fk # Bug#50104: Partitioned table with just 1 partion works with fk
......
DROP TABLE IF EXISTS t1;
#
# Bug#46086: crash when dropping a partitioned table and
# the original engine is disabled
# Copy a .frm and .par file which was created with:
# create table `t1` (`id` int primary key) engine=blackhole
# partition by key () partitions 1;
SHOW TABLES;
Tables_in_test
t1
SHOW CREATE TABLE t1;
ERROR HY000: Incorrect information in file: './test/t1.frm'
DROP TABLE t1;
ERROR 42S02: Unknown table 't1'
t1.frm
t1.par
This diff is collapsed.
...@@ -73,13 +73,13 @@ id select_type table partitions type possible_keys key key_len ref rows Extra ...@@ -73,13 +73,13 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 pnull system NULL NULL NULL NULL 1 1 SIMPLE t1 pnull system NULL NULL NULL NULL 1
explain partitions select * from t1 where a >= 0; explain partitions select * from t1 where a >= 0;
id select_type table partitions type possible_keys key key_len ref rows Extra id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 3 Using where 1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 2 Using where
explain partitions select * from t1 where a < 0; explain partitions select * from t1 where a < 0;
id select_type table partitions type possible_keys key key_len ref rows Extra id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
explain partitions select * from t1 where a <= 0; explain partitions select * from t1 where a <= 0;
id select_type table partitions type possible_keys key key_len ref rows Extra id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 pnull,p0 ALL NULL NULL NULL NULL 3 Using where 1 SIMPLE t1 pnull,p0 ALL NULL NULL NULL NULL 2 Using where
explain partitions select * from t1 where a > 1; explain partitions select * from t1 where a > 1;
id select_type table partitions type possible_keys key key_len ref rows Extra id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
...@@ -112,16 +112,16 @@ select * from t1 where a > 1; ...@@ -112,16 +112,16 @@ select * from t1 where a > 1;
a b a b
explain partitions select * from t1 where a is null; explain partitions select * from t1 where a is null;
id select_type table partitions type possible_keys key key_len ref rows Extra id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 6 Using where 1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 2 Using where
explain partitions select * from t1 where a >= 0; explain partitions select * from t1 where a >= 0;
id select_type table partitions type possible_keys key key_len ref rows Extra id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0_p0sp0,p0_p0sp1,p1_p1sp0,p1_p1sp1 ALL NULL NULL NULL NULL 6 Using where 1 SIMPLE t1 p0_p0sp0,p0_p0sp1,p1_p1sp0,p1_p1sp1 ALL NULL NULL NULL NULL 4 Using where
explain partitions select * from t1 where a < 0; explain partitions select * from t1 where a < 0;
id select_type table partitions type possible_keys key key_len ref rows Extra id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 6 Using where 1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 2 Using where
explain partitions select * from t1 where a <= 0; explain partitions select * from t1 where a <= 0;
id select_type table partitions type possible_keys key key_len ref rows Extra id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1,p0_p0sp0,p0_p0sp1 ALL NULL NULL NULL NULL 6 Using where 1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1,p0_p0sp0,p0_p0sp1 ALL NULL NULL NULL NULL 4 Using where
explain partitions select * from t1 where a > 1; explain partitions select * from t1 where a > 1;
id select_type table partitions type possible_keys key key_len ref rows Extra id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
...@@ -808,3 +808,47 @@ select sum(count) from t2 ch where ch.defid in (50,52) and ch.day between 200703 ...@@ -808,3 +808,47 @@ select sum(count) from t2 ch where ch.defid in (50,52) and ch.day between 200703
sum(count) sum(count)
579 579
drop table t1, t2; drop table t1, t2;
#
# Bug#50939: Loose Index Scan unduly relies on engine to remember range
# endpoints
#
CREATE TABLE t1 (
a INT,
b INT,
KEY ( a, b )
) PARTITION BY HASH (a) PARTITIONS 1;
CREATE TABLE t2 (
a INT,
b INT,
KEY ( a, b )
);
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
INSERT INTO t1 SELECT a + 5, b + 5 FROM t1;
INSERT INTO t1 SELECT a + 10, b + 10 FROM t1;
INSERT INTO t1 SELECT a + 20, b + 20 FROM t1;
INSERT INTO t1 SELECT a + 40, b + 40 FROM t1;
INSERT INTO t2 SELECT * FROM t1;
# plans should be identical
EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10,100) GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index for group-by
EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range a a 5 NULL 2 Using where; Using index for group-by
FLUSH status;
SELECT a, MAX(b) FROM t1 WHERE a IN (10, 100) GROUP BY a;
a MAX(b)
10 10
# Should be no more than 4 reads.
SHOW status LIKE 'handler_read_key';
Variable_name Value
Handler_read_key 4
FLUSH status;
SELECT a, MAX(b) FROM t2 WHERE a IN (10, 100) GROUP BY a;
a MAX(b)
10 10
# Should be no more than 4 reads.
SHOW status LIKE 'handler_read_key';
Variable_name Value
Handler_read_key 4
DROP TABLE t1, t2;
...@@ -1654,47 +1654,16 @@ a b ...@@ -1654,47 +1654,16 @@ a b
1 1 1 1
DROP TABLE t1; DROP TABLE t1;
# #
# Bug#50939: Loose Index Scan unduly relies on engine to remember range # Bug #54802: 'NOT BETWEEN' evaluation is incorrect
# endpoints
# #
CREATE TABLE t1 ( CREATE TABLE t1 (c_key INT, c_notkey INT, KEY(c_key));
a INT, INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3);
b INT, EXPLAIN SELECT * FROM t1 WHERE 2 NOT BETWEEN c_notkey AND c_key;
KEY ( a, b ) id select_type table type possible_keys key key_len ref rows Extra
) PARTITION BY HASH (a) PARTITIONS 1; 1 SIMPLE t1 ALL c_key NULL NULL NULL 3 Using where
CREATE TABLE t2 ( SELECT * FROM t1 WHERE 2 NOT BETWEEN c_notkey AND c_key;
a INT, c_key c_notkey
b INT, 1 1
KEY ( a, b ) 3 3
); DROP TABLE t1;
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
INSERT INTO t1 SELECT a + 5, b + 5 FROM t1;
INSERT INTO t1 SELECT a + 10, b + 10 FROM t1;
INSERT INTO t1 SELECT a + 20, b + 20 FROM t1;
INSERT INTO t1 SELECT a + 40, b + 40 FROM t1;
INSERT INTO t2 SELECT * FROM t1;
# plans should be identical
EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10,100) GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index for group-by
EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range a a 5 NULL 2 Using where; Using index for group-by
FLUSH status;
SELECT a, MAX(b) FROM t1 WHERE a IN (10, 100) GROUP BY a;
a MAX(b)
10 10
# Should be no more than 4 reads.
SHOW status LIKE 'handler_read_key';
Variable_name Value
Handler_read_key 4
FLUSH status;
SELECT a, MAX(b) FROM t2 WHERE a IN (10, 100) GROUP BY a;
a MAX(b)
10 10
# Should be no more than 4 reads.
SHOW status LIKE 'handler_read_key';
Variable_name Value
Handler_read_key 4
DROP TABLE t1, t2;
End of 5.1 tests End of 5.1 tests
...@@ -466,3 +466,26 @@ SELECT 1 FROM t1 WHERE ROW(a, b) >= ...@@ -466,3 +466,26 @@ SELECT 1 FROM t1 WHERE ROW(a, b) >=
ROW('1', (SELECT 1 FROM t1 WHERE a > 1234)); ROW('1', (SELECT 1 FROM t1 WHERE a > 1234));
1 1
DROP TABLE t1; DROP TABLE t1;
#
# Bug #54190: Comparison to row subquery produces incorrect result
#
SELECT ROW(1,2) = (SELECT 1,2 FROM DUAL WHERE 1 = 0);
ROW(1,2) = (SELECT 1,2 FROM DUAL WHERE 1 = 0)
NULL
SELECT ROW(1,2) = (SELECT 1,3 FROM DUAL WHERE 1 = 0);
ROW(1,2) = (SELECT 1,3 FROM DUAL WHERE 1 = 0)
NULL
CREATE TABLE t1 (i INT);
INSERT INTO t1 () VALUES (1), (2), (3);
SELECT ROW(1,2) = (SELECT 1,2 FROM t1 WHERE 1 = 0);
ROW(1,2) = (SELECT 1,2 FROM t1 WHERE 1 = 0)
NULL
SELECT ROW(1,2) = (SELECT 1,3 FROM t1 WHERE 1 = 0);
ROW(1,2) = (SELECT 1,3 FROM t1 WHERE 1 = 0)
NULL
SELECT i FROM t1 WHERE ROW(1,2) = (SELECT 1,2 FROM DUAL WHERE 1 = 0);
i
SELECT i FROM t1 WHERE ROW(1,2) = (SELECT 1,3 FROM DUAL WHERE 1 = 0);
i
DROP TABLE t1;
End of 5.1 tests
...@@ -922,7 +922,7 @@ select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a'),(select c from t ...@@ -922,7 +922,7 @@ select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a'),(select c from t
a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a') (select c from t1 where a=t2.a) a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a') (select c from t1 where a=t2.a)
1 1 a 1 1 a
2 0 b 2 0 b
NULL 0 NULL NULL NULL NULL
select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b'),(select c from t1 where a=t2.a) from t2; select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b'),(select c from t1 where a=t2.a) from t2;
a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b') (select c from t1 where a=t2.a) a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b') (select c from t1 where a=t2.a)
1 0 a 1 0 a
...@@ -932,7 +932,7 @@ select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c'),(select c from t ...@@ -932,7 +932,7 @@ select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c'),(select c from t
a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c') (select c from t1 where a=t2.a) a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c') (select c from t1 where a=t2.a)
1 0 a 1 0 a
2 0 b 2 0 b
NULL 0 NULL NULL NULL NULL
drop table t1,t2; drop table t1,t2;
create table t1 (a int, b real, c varchar(10)); create table t1 (a int, b real, c varchar(10));
insert into t1 values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b'); insert into t1 values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b');
......
...@@ -59,3 +59,110 @@ FROM t3 WHERE 1 = 0 GROUP BY 1; ...@@ -59,3 +59,110 @@ FROM t3 WHERE 1 = 0 GROUP BY 1;
(SELECT 1 FROM t1,t2 WHERE t2.b > t3.b) (SELECT 1 FROM t1,t2 WHERE t2.b > t3.b)
DROP TABLE t1,t2,t3; DROP TABLE t1,t2,t3;
End of 5.0 tests. End of 5.0 tests.
#
# Bug#54568: create view cause Assertion failed: 0,
# file .\item_subselect.cc, line 836
#
EXPLAIN SELECT 1 LIKE ( 1 IN ( SELECT 1 ) );
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1249 Select 2 was reduced during optimization
DESCRIBE SELECT 1 LIKE ( 1 IN ( SELECT 1 ) );
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1249 Select 2 was reduced during optimization
# None of the below should crash
CREATE VIEW v1 AS SELECT 1 LIKE ( 1 IN ( SELECT 1 ) );
CREATE VIEW v2 AS SELECT 1 LIKE '%' ESCAPE ( 1 IN ( SELECT 1 ) );
DROP VIEW v1, v2;
#
# Bug#51070: Query with a NOT IN subquery predicate returns a wrong
# result set
#
CREATE TABLE t1 ( a INT, b INT );
INSERT INTO t1 VALUES ( 1, NULL ), ( 2, NULL );
CREATE TABLE t2 ( c INT, d INT );
INSERT INTO t2 VALUES ( NULL, 3 ), ( NULL, 4 );
CREATE TABLE t3 ( e INT, f INT );
INSERT INTO t3 VALUES ( NULL, NULL ), ( NULL, NULL );
CREATE TABLE t4 ( a INT );
INSERT INTO t4 VALUES (1), (2), (3);
CREATE TABLE t5 ( a INT );
INSERT INTO t5 VALUES (NULL), (2);
EXPLAIN
SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 );
id select_type table type possible_keys key key_len ref rows Extra
x PRIMARY x x x x x x x x
x DEPENDENT SUBQUERY x x x x x x x x
SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 );
a b
EXPLAIN
SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ) IS NULL;
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
SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ) IS NULL;
a b
1 NULL
2 NULL
SELECT * FROM t1 WHERE ( a, b ) IN ( SELECT c, d FROM t2 ) IS NULL;
a b
1 NULL
2 NULL
SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ) IS UNKNOWN;
a b
1 NULL
2 NULL
SELECT * FROM t1 WHERE (( a, b ) NOT IN ( SELECT c, d FROM t2 )) IS UNKNOWN;
a b
1 NULL
2 NULL
SELECT * FROM t1 WHERE 1 = 1 AND ( a, b ) NOT IN ( SELECT c, d FROM t2 );
a b
EXPLAIN
SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT e, f FROM t3 );
id select_type table type possible_keys key key_len ref rows Extra
x PRIMARY x x x x x x x x
x DEPENDENT SUBQUERY x x x x x x x x
SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT e, f FROM t3 );
a b
EXPLAIN
SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT a, b FROM t1 );
id select_type table type possible_keys key key_len ref rows Extra
x PRIMARY x x x x x x x x
x DEPENDENT SUBQUERY x x x x x x x x
SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT a, b FROM t1 );
c d
EXPLAIN
SELECT * FROM t3 WHERE ( e, f ) NOT IN ( SELECT c, d FROM t2 );
id select_type table type possible_keys key key_len ref rows Extra
x PRIMARY x x x x x x x x
x DEPENDENT SUBQUERY x x x x x x x x
SELECT * FROM t3 WHERE ( e, f ) NOT IN ( SELECT c, d FROM t2 );
e f
EXPLAIN
SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT e, f FROM t3 );
id select_type table type possible_keys key key_len ref rows Extra
x PRIMARY x x x x x x x x
x DEPENDENT SUBQUERY x x x x x x x x
SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT e, f FROM t3 );
c d
SELECT * FROM t1 WHERE ( a, b ) NOT IN
( SELECT c, d FROM t2 WHERE c = 1 AND c <> 1 );
a b
1 NULL
2 NULL
SELECT * FROM t1 WHERE b NOT IN ( SELECT c FROM t2 WHERE c = 1 );
a b
1 NULL
2 NULL
SELECT * FROM t1 WHERE NULL NOT IN ( SELECT c FROM t2 WHERE c = 1 AND c <> 1 );
a b
1 NULL
2 NULL
DROP TABLE t1, t2, t3, t4, t5;
#
# End of 5.1 tests.
#
...@@ -1824,11 +1824,8 @@ Note 1050 Table 'v1' already exists ...@@ -1824,11 +1824,8 @@ Note 1050 Table 'v1' already exists
set @id=last_insert_id(); set @id=last_insert_id();
select * from t1; select * from t1;
id operation id operation
1 CREATE TABLE ... SELECT, inserting a new key
select * from t1_op_log; select * from t1_op_log;
operation operation
Before INSERT, new=CREATE TABLE ... SELECT, inserting a new key
After INSERT, new=CREATE TABLE ... SELECT, inserting a new key
truncate t1_op_log; truncate t1_op_log;
create table if not exists v1 replace create table if not exists v1 replace
select @id, "CREATE TABLE ... REPLACE SELECT, deleting a duplicate key"; select @id, "CREATE TABLE ... REPLACE SELECT, deleting a duplicate key";
...@@ -1836,13 +1833,8 @@ Warnings: ...@@ -1836,13 +1833,8 @@ Warnings:
Note 1050 Table 'v1' already exists Note 1050 Table 'v1' already exists
select * from t1; select * from t1;
id operation id operation
1 CREATE TABLE ... REPLACE SELECT, deleting a duplicate key
select * from t1_op_log; select * from t1_op_log;
operation operation
Before INSERT, new=CREATE TABLE ... REPLACE SELECT, deleting a duplicate key
Before DELETE, old=CREATE TABLE ... SELECT, inserting a new key
After DELETE, old=CREATE TABLE ... SELECT, inserting a new key
After INSERT, new=CREATE TABLE ... REPLACE SELECT, deleting a duplicate key
truncate t1; truncate t1;
truncate t1_op_log; truncate t1_op_log;
insert into v1 (id, operation) insert into v1 (id, operation)
......
...@@ -474,4 +474,25 @@ SHOW CREATE TRIGGER db1.trg; ...@@ -474,4 +474,25 @@ SHOW CREATE TRIGGER db1.trg;
ERROR 42000: Access denied; you need the TRIGGER privilege for this operation ERROR 42000: Access denied; you need the TRIGGER privilege for this operation
DROP USER 'no_rights'@'localhost'; DROP USER 'no_rights'@'localhost';
DROP DATABASE db1; DROP DATABASE db1;
DROP DATABASE IF EXISTS mysqltest_db1;
CREATE DATABASE mysqltest_db1;
USE mysqltest_db1;
GRANT ALL ON mysqltest_db1.* TO mysqltest_u1@localhost;
CREATE TABLE t1 (
a1 int,
a2 int
);
INSERT INTO t1 VALUES (1, 20);
CREATE TRIGGER mysqltest_db1.upd_t1
BEFORE UPDATE ON t1 FOR EACH ROW SET new.a2 = 200;
CREATE TABLE t2 (
a1 int
);
INSERT INTO t2 VALUES (2);
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
UPDATE IGNORE t1, t2 SET t1.a1 = 2, t2.a1 = 3 WHERE t1.a1 = 1 AND t2.a1 = 2;
ERROR 42000: TRIGGER command denied to user 'mysqltest_u1'@'localhost' for table 't1'
DROP DATABASE mysqltest_db1;
DROP USER mysqltest_u1@localhost;
USE test;
End of 5.1 tests. End of 5.1 tests.
...@@ -527,3 +527,24 @@ f1 f2-f3 ...@@ -527,3 +527,24 @@ f1 f2-f3
5 0 5 0
DROP TABLE t1; DROP TABLE t1;
End of 5.0 tests End of 5.0 tests
#
# Bug #55779: select does not work properly in mysql server
# Version "5.1.42 SUSE MySQL RPM"
#
CREATE TABLE t1 (a TIMESTAMP, KEY (a));
INSERT INTO t1 VALUES ('2000-01-01 00:00:00'), ('2000-01-01 00:00:00'),
('2000-01-01 00:00:01'), ('2000-01-01 00:00:01');
SELECT a FROM t1 WHERE a >= 20000101000000;
a
2000-01-01 00:00:00
2000-01-01 00:00:00
2000-01-01 00:00:01
2000-01-01 00:00:01
SELECT a FROM t1 WHERE a >= '20000101000000';
a
2000-01-01 00:00:00
2000-01-01 00:00:00
2000-01-01 00:00:01
2000-01-01 00:00:01
DROP TABLE t1;
End of 5.1 tests
This diff is collapsed.
This diff is collapsed.
RESET MASTER;
CREATE TABLE t1 (word CHAR(20) NOT NULL) ENGINE=MYISAM;
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP TABLE t1;
-- source include/have_debug.inc -- source include/have_debug.inc
-- source include/have_binlog_format_mixed_or_statement.inc -- source include/have_binlog_format_statement.inc
# #
# bug#27571 asynchronous setting mysql_$query()'s local error and # bug#27571 asynchronous setting mysql_$query()'s local error and
# Query_log_event::error_code # Query_log_event::error_code
......
This diff is collapsed.
...@@ -2,5 +2,5 @@ ...@@ -2,5 +2,5 @@
# For both statement and row based bin logs 9/19/2005 [jbm] # For both statement and row based bin logs 9/19/2005 [jbm]
-- source include/not_embedded.inc -- source include/not_embedded.inc
-- source include/have_binlog_format_mixed_or_statement.inc -- source include/have_binlog_format_statement.inc
-- source extra/binlog_tests/blackhole.test -- source extra/binlog_tests/blackhole.test
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment