1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-05 12:42:17 +03:00

Merge mysql-5.5-bugfixing -> mysql-5.5-innodb

This commit is contained in:
Vasil Dimov
2010-08-18 10:14:06 +03:00
424 changed files with 19834 additions and 7791 deletions

View File

@ -3101,3 +3101,4 @@ libmysqld/merge_archives_mysqlserver.cmake
libmysqld/mysqlserver_depends.c
libmysqld/examples/mysql_embedded
sql/.empty
mysys/thr_lock

View File

@ -6,6 +6,7 @@ configure="./configure $base_configs $extra_configs"
commands="\
$make -k maintainer-clean || true
/bin/rm -rf */.deps/*.P configure config.cache storage/*/configure storage/*/config.cache autom4te.cache storage/*/autom4te.cache;
/bin/rm -rf CMakeCache.txt CMakeFiles/
path=`dirname $0`
. \"$path/autorun.sh\""

View File

@ -20,7 +20,7 @@
EXTRA_DIST = FINISH.sh \
SETUP.sh \
autorun.sh \
choose_configure.sh \
cmake_configure.sh \
build_mccge.sh \
check-cpu \
cleanup \
@ -52,7 +52,6 @@ EXTRA_DIST = FINISH.sh \
compile-pentium-icc-yassl \
compile-pentium-max \
compile-pentium-myodbc \
compile-pentium-mysqlfs-debug \
compile-pentium-pgcc \
compile-pentium-valgrind-max \
compile-pentium64 \

View File

@ -14,7 +14,6 @@ Usage: $0 [-h|-n] [configure-options]
-h, --help Show this help message.
-n, --just-print Don't actually run any commands; just print them.
-c, --just-configure Stop after running configure.
--with-debug=full Build with full debug.
--warning-mode=[old|pedantic|maintainer]
Influences the debug flags. Old is default.
--prefix=path Build with prefix 'path'.
@ -30,8 +29,6 @@ parse_options()
case "$1" in
--prefix=*)
prefix=`get_key_value "$1"`;;
--with-debug=full)
full_debug="=full";;
--warning-mode=*)
warning_mode=`get_key_value "$1"`;;
-c | --just-configure)
@ -60,7 +57,6 @@ fi
prefix="/usr/local/mysql"
just_print=
just_configure=
full_debug=
warning_mode=
maintainer_mode=
@ -116,7 +112,6 @@ else
cxx_warnings="$warnings -Wno-unused-parameter"
# cxx_warnings="$cxx_warnings -Woverloaded-virtual -Wsign-promo"
cxx_warnings="$cxx_warnings -Wctor-dtor-privacy -Wnon-virtual-dtor"
# Added unless --with-debug=full
debug_extra_cflags="-O0 -g3 -gdwarf-2"
fi
@ -141,11 +136,8 @@ base_cxxflags="-felide-constructors -fno-exceptions -fno-rtti"
# Be as fast as we can be without losing our ability to backtrace.
fast_cflags="-O3 -fno-omit-frame-pointer"
debug_configs="--with-debug$full_debug"
if [ -z "$full_debug" ]
then
debug_cflags="$debug_cflags $debug_extra_cflags"
fi
debug_configs="--with-debug"
debug_cflags="$debug_cflags $debug_extra_cflags"
#
# Configuration options.

View File

@ -34,5 +34,5 @@ autoconf || die "Can't execute autoconf"
# that will either call CMake or original configure shell script at build
# time (CMake is preferred if installed).
mv configure configure.am
cp BUILD/choose_configure.sh configure
cp BUILD/cmake_configure.sh configure
chmod a+x configure

View File

@ -148,7 +148,6 @@ Usage: $0 [options]
--extended-help Show extended help message
--without-debug Build non-debug version
--with-debug Build debug version
--with-debug=full Build with full debug.
--configure-only Stop after running configure.
--use-autotools Start by running autoconf, automake,.. tools
--no-autotools Start from configure
@ -262,10 +261,6 @@ extended_usage()
This flag prevents the use of GPL libraries which cannot be used
under a commercial license, such as the readline library.
--with-debug[=full]
This option will ensure that the version is built with debug
information enabled; the optimisation level is decreased to -O.
--developer
This option changes a number of things to make the version built
more appropriate to the debugging and testing needs of developers.
@ -658,11 +653,6 @@ parse_options()
--datadir=*)
datadir=`get_key_value "$1"`
;;
--with-debug=full)
full_debug="=full"
with_debug_flag="yes"
fast_flag="no"
;;
--without-debug)
with_debug_flag="no"
if test "x$fast_flag" != "xyes" ; then
@ -1044,10 +1034,7 @@ set_warning_flags()
# C++ warnings
cxx_warnings="$warnings -Woverloaded-virtual -Wsign-promo -Wreorder"
cxx_warnings="$warnings -Wctor-dtor-privacy -Wnon-virtual-dtor"
# Added unless --with-debug=full
if test "x$full_debug" = "x" ; then
compiler_flags="$compiler_flags -Wuninitialized"
fi
elif test "x$warning_mode" = "xpedantic" ; then
warnings="-W -Wall -ansi -pedantic -Wno-long-long -D_POSIX_SOURCE"
c_warnings="$warnings"
@ -1113,7 +1100,7 @@ set_base_configs()
base_configs="$base_configs --localstatedir=$datadir"
fi
if test "x$with_debug_flag" = "xyes" ; then
base_configs="$base_configs --with-debug$full_debug"
base_configs="$base_configs --with-debug"
fi
base_configs="$base_configs --enable-local-infile"
base_configs="$base_configs --enable-thread-safe-client"
@ -1546,7 +1533,6 @@ gpl="yes"
version_text=
developer_flag="no"
just_configure=
full_debug=
warning_mode=
with_flags=
error_inject_flag=

View File

@ -7,6 +7,79 @@
# check_cpu_args : Arguments for GCC compiler settings
#
check_compiler_cpu_flags () {
# different compiler versions have different option names
# for CPU specific command line options
if test -z "$CC" ; then
cc="gcc";
else
cc=$CC
fi
# check if compiler is gcc and dump its version
cc_verno=`$cc -dumpversion 2>/dev/null`
if test "x$?" = "x0" ; then
set -- `echo $cc_verno | tr '.' ' '`
cc_ver="GCC"
cc_major=$1
cc_minor=$2
cc_patch=$3
cc_comp=`expr $cc_major '*' 100 '+' $cc_minor`
fi
case "$cc_ver--$cc_verno" in
*GCC*)
# different gcc backends (and versions) have different CPU flags
case `gcc -dumpmachine` in
i?86-* | x86_64-*)
if test "$cc_comp" -lt 304 ; then
check_cpu_cflags="-mcpu=${cpu_arg}"
elif test "$cc_comp" -ge 402 ; then
check_cpu_cflags="-mtune=native"
else
check_cpu_cflags="-mtune=${cpu_arg}"
fi
;;
ppc-*)
check_cpu_cflags="-mcpu=${cpu_arg} -mtune=${cpu_arg}"
;;
*)
check_cpu_cflags=""
return
;;
esac
;;
2.95.*)
# GCC 2.95 doesn't expose its name in --version output
check_cpu_cflags="-m${cpu_arg}"
;;
*)
check_cpu_cflags=""
return
;;
esac
# now we check whether the compiler really understands the cpu type
touch __test.c
while [ "$cpu_arg" ] ; do
printf "testing $cpu_arg ... " >&2
# compile check
eval "$cc -c $check_cpu_cflags __test.c" 2>/dev/null
if test "x$?" = "x0" ; then
echo ok >&2
break;
fi
echo failed >&2
check_cpu_cflags=""
break;
done
rm __test.*
return 0
}
check_cpu () {
CPUINFO=/proc/cpuinfo
if test -n "$TEST_CPUINFO" ; then
@ -179,83 +252,14 @@ check_cpu () {
return
fi
# different compiler versions have different option names
# for CPU specific command line options
if test -z "$CC" ; then
cc="gcc";
else
cc=$CC
if test "x$compiler" = "x" ; then
check_compiler_cpu_flags
fi
if test "x$core2" = "xyes" ; then
cpu_arg="core2"
fi
if test "x$compiler" != "x" ; then
return 0
fi
# check if compiler is gcc and dump its version
cc_verno=`$cc -dumpversion 2>/dev/null`
if test "x$?" = "x0" ; then
set -- `echo $cc_verno | tr '.' ' '`
cc_ver="GCC"
cc_major=$1
cc_minor=$2
cc_patch=$3
cc_comp=`expr $cc_major '*' 100 '+' $cc_minor`
fi
case "$cc_ver--$cc_verno" in
*GCC*)
# different gcc backends (and versions) have different CPU flags
case `gcc -dumpmachine` in
i?86-* | x86_64-*)
if test "$cc_comp" -lt 304 ; then
check_cpu_cflags="-mcpu=${cpu_arg}"
elif test "$cc_comp" -ge 402 ; then
check_cpu_cflags="-mtune=native"
else
check_cpu_cflags="-mtune=${cpu_arg}"
fi
;;
ppc-*)
check_cpu_cflags="-mcpu=${cpu_arg} -mtune=${cpu_arg}"
;;
*)
check_cpu_cflags=""
return
;;
esac
;;
2.95.*)
# GCC 2.95 doesn't expose its name in --version output
check_cpu_cflags="-m${cpu_arg}"
;;
*)
check_cpu_cflags=""
return
;;
esac
# now we check whether the compiler really understands the cpu type
touch __test.c
while [ "$cpu_arg" ] ; do
printf "testing $cpu_arg ... " >&2
# compile check
eval "$cc -c $check_cpu_cflags __test.c" 2>/dev/null
if test "x$?" = "x0" ; then
echo ok >&2
break;
fi
echo failed >&2
check_cpu_cflags=""
break;
done
rm __test.*
return 0
}

View File

@ -4,16 +4,6 @@ path=`dirname $0`
. "$path/SETUP.sh"
extra_configs="$max_configs --with-ndb-test --with-ndb-ccflags='-DERROR_INSERT'"
if [ "$full_debug" ]
then
extra_flags="$debug_cflags"
c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_warnings $debug_extra_warnings"
extra_configs="$debug_configs $extra_configs"
else
extra_flags="$fast_cflags"
fi
extra_flags="$extra_flags $max_cflags -g"
extra_flags="$fast_cflags $max_cflags -g"
. "$path/FINISH.sh"

View File

@ -1,7 +1,6 @@
#! /bin/sh
path=`dirname $0`
set -- "$@" --with-debug=full
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags"

View File

@ -1,7 +1,6 @@
#! /bin/sh
path=`dirname $0`
set -- "$@" --with-debug=full
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags"

View File

@ -1,7 +1,6 @@
#! /bin/sh
path=`dirname $0`
set -- "$@" --with-debug=full
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags"

View File

@ -6,6 +6,6 @@ path=`dirname $0`
extra_flags="$pentium_cflags $debug_cflags"
extra_configs="$pentium_configs $debug_configs"
extra_configs="$extra_configs --with-debug=full --with-ssl=/usr"
extra_configs="$extra_configs --with-debug --with-ssl=/usr"
. "$path/FINISH.sh"

View File

@ -6,6 +6,6 @@ path=`dirname $0`
extra_flags="$pentium_cflags $debug_cflags"
extra_configs="$pentium_configs $debug_configs"
extra_configs="$extra_configs --with-debug=full --with-ssl"
extra_configs="$extra_configs --with-debug --with-ssl"
. "$path/FINISH.sh"

View File

@ -1,11 +0,0 @@
#! /bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags"
extra_configs="$pentium_configs $debug_configs $static_link"
extra_configs="$extra_configs --with-debug=full --with-mysqlfs --without-server --without-pstack"
. "$path/FINISH.sh"

View File

@ -1,7 +1,6 @@
#! /bin/sh
path=`dirname $0`
set -- "$@" --with-debug=full
. "$path/SETUP.sh"
extra_flags="$pentium64_cflags $debug_cflags"

View File

@ -1,7 +1,6 @@
#! /bin/sh
path=`dirname $0`
set -- "$@" --with-debug=full
. "$path/SETUP.sh"
extra_flags="$pentium64_cflags $debug_cflags"

View File

@ -1,4 +1,4 @@
# Copyright (C) 2006-2008 MySQL AB, 2009 Sun Microsystems, Inc
# Copyright (c) 2006, 2010, 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
@ -34,7 +34,6 @@ ENDIF()
SET(CUSTOM_C_FLAGS $ENV{CFLAGS})
OPTION(WITH_DEBUG "Use dbug/safemutex" OFF)
OPTION(WITH_DEBUG_FULL "Use dbug and safemutex. Slow." OFF)
# Distinguish between community and non-community builds, with the
# default being a community build. This does not impact the feature
@ -46,7 +45,8 @@ OPTION(COMMUNITY_BUILD "Set to true if this is a community build" ON)
SET(MANUFACTURER_DOCSTRING
"Set the entity that appears as the manufacturer of packages that support a manufacturer field.")
IF(NOT DEFINED MANUFACTURER)
SET(MANUFACTURER "Built from Source" CACHE BOOL ${MANUFACTURER_DOCSTRING})
SET(MANUFACTURER "Built from Source" CACHE STRING ${MANUFACTURER_DOCSTRING})
MARK_AS_ADVANCED(MANUFACTURER)
ENDIF()
# We choose to provide WITH_DEBUG as alias to standard CMAKE_BUILD_TYPE=Debug
@ -59,7 +59,7 @@ SET(BUILDTYPE_DOCSTRING
"Choose the type of build, options are: None(CMAKE_CXX_FLAGS or
CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel")
IF(WITH_DEBUG OR WITH_DEBUG_FULL)
IF(WITH_DEBUG)
SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING ${BUILDTYPE_DOCSTRING} FORCE)
SET(OLD_WITH_DEBUG 1 CACHE INTERNAL "" FORCE)
ELSEIF(NOT HAVE_CMAKE_BUILD_TYPE OR OLD_WITH_DEBUG)
@ -161,13 +161,6 @@ IF(ENABLE_DEBUG_SYNC)
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
ENDIF()
OPTION(WITH_ERROR_INJECT
"Enable error injection in MySQL Server (debug builds only)" OFF)
IF(WITH_ERROR_INJECT)
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DERROR_INJECT_SUPPORT")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DERROR_INJECT_SUPPORT")
ENDIF()
OPTION(ENABLED_LOCAL_INFILE
"If we should should enable LOAD DATA LOCAL by default" ${IF_WIN})
MARK_AS_ADVANCED(ENABLED_LOCAL_INFILE)
@ -201,15 +194,10 @@ ENDIF()
# Add safemutex for debug configurations, except on Windows
# (safemutex has never worked on Windows)
IF(WITH_DEBUG OR WITH_DEBUG_FULL AND NOT WIN32)
IF(WITH_DEBUG AND NOT WIN32)
FOREACH(LANG C CXX)
IF(WITH_DEBUG_FULL)
SET(CMAKE_${LANG}_FLAGS_DEBUG
"${CMAKE_${LANG}_FLAGS_DEBUG} -DSAFE_MUTEX")
ELSE()
SET(CMAKE_${LANG}_FLAGS_DEBUG
"${CMAKE_${LANG}_FLAGS_DEBUG} -DSAFE_MUTEX")
ENDIF()
ENDFOREACH()
ENDIF()

View File

@ -314,7 +314,7 @@ abi_check_all: abi_check
do_abi_check:
set -ex; \
for file in $(abi_headers); do \
@CC@ -E -nostdinc -dI \
@CC@ -E -nostdinc -dI -DMYSQL_ABI_CHECK \
-I$(top_srcdir)/include \
-I$(top_srcdir)/include/mysql \
-I$(top_srcdir)/sql \

View File

@ -1,4 +1,4 @@
# Copyright (C) 2006 MySQL AB
# Copyright (c) 2006, 2010, 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

View File

@ -3652,7 +3652,7 @@ xmlencode_print(const char *src, uint length)
tee_fputs("NULL", PAGER);
else
{
for (const char *p = src; length; *p++, length--)
for (const char *p = src; length; p++, length--)
{
const char *t;
if ((t = array_value(xmlmeta, *p)))
@ -4740,7 +4740,7 @@ static const char* construct_prompt()
struct tm *t = localtime(&lclock);
/* parse thru the settings for the prompt */
for (char *c = current_prompt; *c ; *c++)
for (char *c = current_prompt; *c ; c++)
{
if (*c != PROMPT_CHAR)
processed_prompt.append(*c);

View File

@ -209,6 +209,9 @@ static void add_one_option(DYNAMIC_STRING* ds,
case GET_STR:
arg= argument;
break;
case GET_BOOL:
arg= (*(my_bool *)opt->value) ? "1" : "0";
break;
default:
die("internal error at %s: %d",__FILE__, __LINE__);
}
@ -596,7 +599,10 @@ static int upgrade_already_done(void)
my_fclose(in, MYF(0));
return (strncmp(buf, MYSQL_SERVER_VERSION,
if (!res)
return 0; /* Could not read from file => not sure */
return (strncmp(res, MYSQL_SERVER_VERSION,
sizeof(MYSQL_SERVER_VERSION)-1)==0);
}

View File

@ -199,6 +199,8 @@ static void init_re(void);
static int match_re(my_regex_t *, char *);
static void free_re(void);
static uint opt_protocol=0;
DYNAMIC_ARRAY q_lines;
#include "sslopt-vars.h"
@ -615,8 +617,11 @@ public:
if ((bytes= fread(buf, 1, sizeof(buf), m_file)) <= 0)
{
fprintf(stderr, "Failed to read from '%s', errno: %d\n",
m_file_name, errno);
// ferror=0 will happen here if no queries executed yet
if (ferror(m_file))
fprintf(stderr,
"Failed to read from '%s', errno: %d, feof:%d, ferror:%d\n",
m_file_name, errno, feof(m_file), ferror(m_file));
DBUG_VOID_RETURN;
}
@ -1080,6 +1085,7 @@ void handle_command_error(struct st_command *command, uint error)
command->first_word_len, command->query, error));
DBUG_VOID_RETURN;
}
if (command->expected_errors.count > 0)
die("command \"%.*s\" failed with wrong error: %d",
command->first_word_len, command->query, error);
}
@ -1350,14 +1356,14 @@ void log_msg(const char *fmt, ...)
*/
void cat_file(DYNAMIC_STRING* ds, const char* filename)
int cat_file(DYNAMIC_STRING* ds, const char* filename)
{
int fd;
size_t len;
char buff[512];
if ((fd= my_open(filename, O_RDONLY, MYF(0))) < 0)
die("Failed to open file '%s'", filename);
return 1;
while((len= my_read(fd, (uchar*)&buff,
sizeof(buff), MYF(0))) > 0)
{
@ -1381,6 +1387,7 @@ void cat_file(DYNAMIC_STRING* ds, const char* filename)
dynstr_append_mem(ds, start, p-start);
}
my_close(fd, MYF(0));
return 0;
}
@ -2433,6 +2440,9 @@ void eval_expr(VAR *v, const char *p, const char **p_end)
if ((vp= var_get(p, p_end, 0, 0)))
var_copy(v, vp);
/* Apparently it is not safe to assume null-terminated string */
v->str_val[v->str_val_len]= 0;
/* Make sure there was just a $variable and nothing else */
const char* end= *p_end + 1;
if (end < expected_end)
@ -2779,6 +2789,7 @@ void do_exec(struct st_command *command)
else
{
dynstr_free(&ds_cmd);
if (command->expected_errors.count > 0)
die("command \"%s\" failed with wrong error: %d",
command->first_argument, status);
}
@ -2924,6 +2935,41 @@ void do_system(struct st_command *command)
}
/*
SYNOPSIS
set_wild_chars
set true to set * etc. as wild char, false to reset
DESCRIPTION
Auxiliary function to set "our" wild chars before calling wild_compare
This is needed because the default values are changed to SQL syntax
in mysqltest_embedded.
*/
void set_wild_chars (my_bool set)
{
static char old_many= 0, old_one, old_prefix;
if (set)
{
if (wild_many == '*') return; // No need
old_many= wild_many;
old_one= wild_one;
old_prefix= wild_prefix;
wild_many= '*';
wild_one= '?';
wild_prefix= 0;
}
else
{
if (! old_many) return; // Was not set
wild_many= old_many;
wild_one= old_one;
wild_prefix= old_prefix;
}
}
/*
SYNOPSIS
do_remove_file
@ -3000,6 +3046,10 @@ void do_remove_files_wildcard(struct st_command *command)
dir_separator[0]= FN_LIBCHAR;
dir_separator[1]= 0;
dynstr_append(&ds_file_to_remove, dir_separator);
/* Set default wild chars for wild_compare, is changed in embedded mode */
set_wild_chars(1);
for (i= 0; i < (uint) dir_info->number_off_files; i++)
{
file= dir_info->dir_entry + i;
@ -3019,6 +3069,7 @@ void do_remove_files_wildcard(struct st_command *command)
if (error)
break;
}
set_wild_chars(0);
my_dirend(dir_info);
end:
@ -3264,6 +3315,7 @@ static int get_list_files(DYNAMIC_STRING *ds, const DYNAMIC_STRING *ds_dirname,
/* Note that my_dir sorts the list if not given any flags */
if (!(dir_info= my_dir(ds_dirname->str, MYF(0))))
DBUG_RETURN(1);
set_wild_chars(1);
for (i= 0; i < (uint) dir_info->number_off_files; i++)
{
file= dir_info->dir_entry + i;
@ -3277,6 +3329,7 @@ static int get_list_files(DYNAMIC_STRING *ds, const DYNAMIC_STRING *ds_dirname,
dynstr_append(ds, file->name);
dynstr_append(ds, "\n");
}
set_wild_chars(0);
my_dirend(dir_info);
DBUG_RETURN(0);
}
@ -3559,6 +3612,7 @@ void do_append_file(struct st_command *command)
void do_cat_file(struct st_command *command)
{
int error;
static DYNAMIC_STRING ds_filename;
const struct command_arg cat_file_args[] = {
{ "filename", ARG_STRING, TRUE, &ds_filename, "File to read from" }
@ -3573,8 +3627,8 @@ void do_cat_file(struct st_command *command)
DBUG_PRINT("info", ("Reading from, file: %s", ds_filename.str));
cat_file(&ds_res, ds_filename.str);
error= cat_file(&ds_res, ds_filename.str);
handle_command_error(command, error);
dynstr_free(&ds_filename);
DBUG_VOID_RETURN;
}
@ -3836,7 +3890,8 @@ void do_perl(struct st_command *command)
}
error= pclose(res_file);
/* Remove the temporary file */
/* Remove the temporary file, but keep it if perl failed */
if (!error)
my_delete(temp_file_path, MYF(0));
handle_command_error(command, WEXITSTATUS(error));
@ -4950,7 +5005,7 @@ int connect_n_handle_errors(struct st_command *command,
ds= &ds_res;
/* Only log if an error is expected */
if (!command->abort_on_error &&
if (command->expected_errors.count > 0 &&
!disable_query_log)
{
/*
@ -5196,11 +5251,13 @@ void do_connect(struct st_command *command)
#ifdef __WIN__
if (con_pipe)
{
uint protocol= MYSQL_PROTOCOL_PIPE;
mysql_options(&con_slot->mysql, MYSQL_OPT_PROTOCOL, &protocol);
opt_protocol= MYSQL_PROTOCOL_PIPE;
}
#endif
if (opt_protocol)
mysql_options(&con_slot->mysql, MYSQL_OPT_PROTOCOL, (char*) &opt_protocol);
#ifdef HAVE_SMEM
if (con_shm)
{
@ -5372,7 +5429,19 @@ void do_block(enum block_cmd cmd, struct st_command* command)
/* Define inner block */
cur_block++;
cur_block->cmd= cmd;
cur_block->ok= (v.int_val ? TRUE : FALSE);
if (v.int_val)
{
cur_block->ok= TRUE;
} else
/* Any non-empty string which does not begin with 0 is also TRUE */
{
p= v.str_val;
/* First skip any leading white space or unary -+ */
while (*p && ((my_isspace(charset_info, *p) || *p == '-' || *p == '+')))
p++;
cur_block->ok= (*p && *p != '0') ? TRUE : FALSE;
}
if (not_expr)
cur_block->ok = !cur_block->ok;
@ -5934,6 +6003,8 @@ static struct my_option my_long_options[] =
GET_INT, REQUIRED_ARG, 128, 8, 5120, 0, 0, 0},
{"password", 'p', "Password to use when connecting to server.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection or 0 for default to, in "
"order of preference, my.cnf, $MYSQL_TCP_PORT, "
#if MYSQL_PORT_DEFAULT == 0
@ -6070,7 +6141,7 @@ void read_embedded_server_arguments(const char *name)
static my_bool
get_one_option(int optid, const struct my_option *, char *argument)
get_one_option(int optid, const struct my_option *opt, char *argument)
{
switch(optid) {
case '#':
@ -6156,6 +6227,10 @@ get_one_option(int optid, const struct my_option *, char *argument)
case 'V':
print_version();
exit(0);
case OPT_MYSQL_PROTOCOL:
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);
break;
case '?':
usage();
exit(0);
@ -7617,9 +7692,6 @@ void get_command_type(struct st_command* command)
sizeof(saved_expected_errors));
DBUG_PRINT("info", ("There are %d expected errors",
command->expected_errors.count));
command->abort_on_error= (command->expected_errors.count == 0 &&
abort_on_error);
DBUG_VOID_RETURN;
}
@ -7910,6 +7982,9 @@ int main(int argc, char **argv)
mysql_options(&con->mysql, MYSQL_SET_CHARSET_DIR,
opt_charsets_dir);
if (opt_protocol)
mysql_options(&con->mysql,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol);
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
if (opt_use_ssl)
@ -7968,6 +8043,10 @@ int main(int argc, char **argv)
command->type= Q_COMMENT;
}
/* (Re-)set abort_on_error for this command */
command->abort_on_error= (command->expected_errors.count == 0 &&
abort_on_error);
/* delimiter needs to be executed so we can continue to parse */
my_bool ok_to_do= cur_block->ok || command->type == Q_DELIMITER;
/*
@ -8369,16 +8448,6 @@ int main(int argc, char **argv)
check_result();
}
}
else
{
/*
No result_file_name specified, the result
has been printed to stdout, exit with error
unless script has called "exit" to indicate success
*/
if (abort_flag == 0)
die("Exit with failure! Call 'exit' in script to return with sucess");
}
}
else
{

View File

@ -38,7 +38,7 @@ IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_SYSTEM_NAME MATCHES "Linux")
-DCOMPILER=${COMPILER}
-DSOURCE_DIR=${CMAKE_SOURCE_DIR}
-DBINARY_DIR=${CMAKE_BINARY_DIR}
"-DABI_HEADERS=${API_PREPROCESSOR_HEADER}"
"-DDMYSQL_ABI_CHECK -DABI_HEADERS=${API_PREPROCESSOR_HEADER}"
-P ${CMAKE_SOURCE_DIR}/cmake/do_abi_check.cmake
VERBATIM
)
@ -48,7 +48,7 @@ IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_SYSTEM_NAME MATCHES "Linux")
-DCMAKE_C_COMPILER=${COMPILER}
-DCMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR}
-DCMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}
"-DABI_HEADERS=${API_PREPROCESSOR_HEADER}"
"-DMYSQL_ABI_CHECK -DABI_HEADERS=${API_PREPROCESSOR_HEADER}"
-P ${CMAKE_SOURCE_DIR}/cmake/scripts/do_abi_check.cmake
VERBATIM
)

View File

@ -179,11 +179,6 @@ foreach my $option (@ARGV)
$cmakeargs = $cmakeargs." -DMYSQL_DATADIR=".substr($option,14);
next;
}
if ($option =~ /with-debug=full/)
{
$cmakeargs = $cmakeargs." -DWITH_DEBUG_FULL=1";
next;
}
if ($option =~ /mysql-maintainer-mode/)
{
$cmakeargs = $cmakeargs." -DMYSQL_MAINTAINER_MODE=" .

View File

@ -57,11 +57,17 @@ MACRO(MYSQL_ADD_PLUGIN)
SET(WITHOUT_NDBCLUSTER 1)
ENDIF()
IF(ARG_DEFAULT)
IF(NOT DEFINED WITH_${plugin} AND
NOT DEFINED WITH_${plugin}_STORAGE_ENGINE)
SET(WITH_${plugin} 1)
ENDIF()
ENDIF()
IF(WITH_${plugin}_STORAGE_ENGINE
OR WITH_{$plugin}
OR WITH_ALL
OR WITH_MAX
OR ARG_DEFAULT
AND NOT WITHOUT_${plugin}_STORAGE_ENGINE
AND NOT WITHOUT_${plugin}
AND NOT ARG_MODULE_ONLY)
@ -88,6 +94,7 @@ MACRO(MYSQL_ADD_PLUGIN)
IF(NOT ARG_DEPENDENCIES)
SET(ARG_DEPENDENCIES)
ENDIF()
SET(BUILD_PLUGIN 1)
# Build either static library or module
IF (WITH_${plugin} AND NOT ARG_MODULE_ONLY)
ADD_LIBRARY(${target} STATIC ${SOURCES})
@ -148,9 +155,6 @@ MACRO(MYSQL_ADD_PLUGIN)
DTRACE_INSTRUMENT(${target})
SET_TARGET_PROPERTIES (${target} PROPERTIES PREFIX ""
COMPILE_DEFINITIONS "MYSQL_DYNAMIC_PLUGIN")
IF(ARG_LINK_LIBRARIES)
TARGET_LINK_LIBRARIES (${target} ${ARG_LINK_LIBRARIES})
ENDIF()
TARGET_LINK_LIBRARIES (${target} mysqlservices)
# Plugin uses symbols defined in mysqld executable.
@ -175,7 +179,20 @@ MACRO(MYSQL_ADD_PLUGIN)
# Install dynamic library
MYSQL_INSTALL_TARGETS(${target} DESTINATION ${INSTALL_PLUGINDIR} COMPONENT Server)
INSTALL_DEBUG_TARGET(${target} DESTINATION ${INSTALL_PLUGINDIR}/debug)
ELSE()
IF(WITHOUT_${plugin})
# Update cache variable
STRING(REPLACE "WITH_" "WITHOUT_" without_var ${with_var})
SET(${without_var} ON CACHE BOOL "Don't build ${plugin}"
FORCE)
ENDIF()
SET(BUILD_PLUGIN 0)
ENDIF()
IF(BUILD_PLUGIN AND ARG_LINK_LIBRARIES)
TARGET_LINK_LIBRARIES (${target} ${ARG_LINK_LIBRARIES})
ENDIF()
ENDMACRO()

View File

@ -1,4 +1,4 @@
# Copyright (C) 2009 Sun Microsystems, Inc
# Copyright (c) 2006, 2010, 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

View File

@ -1,4 +1,4 @@
# Copyright (C) 2007 MySQL AB
# Copyright (c) 2006, 2010, 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

View File

@ -206,7 +206,7 @@ AC_DEFUN([MYSQL_SETUP_NDBCLUSTER], [
NDB_DEFS="-DNDB_DEBUG_FULL -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD"
else
# no extra ndb debug but still do asserts if debug version
if test "$with_debug" = "yes" -o "$with_debug" = "full"
if test "$with_debug" = "yes"
then
NDB_DEFS=""
else

View File

@ -463,16 +463,7 @@ if test "$GCC" != "yes" || expr "$CC" : ".*icc.*"
then
ABI_CHECK=""
else
# Workaround GCC >= 4.5 - See Bug#52514
case `$CC -dumpversion` in
[[4-9]].[[5-9]]*)
AC_MSG_WARN([ABI check disabled (GCC >= 4.5)])
ABI_CHECK=""
;;
*)
ABI_CHECK="abi_check"
;;
esac
fi
AC_SUBST(ABI_CHECK)
@ -1741,22 +1732,14 @@ then
fi
AC_ARG_WITH(debug,
[ --with-debug Add debug code
--with-debug=full Add debug code (adds memory checker, very slow)],
[AS_HELP_STRING([--with-debug], [Add debug code @<:@default=no@:>@])],
[with_debug=$withval],
[with_debug=no])
if test "$with_debug" = "yes"
then
# Medium debug.
AC_DEFINE([DBUG_ON], [1], [Use libdbug])
CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC -DSAFE_MUTEX $CFLAGS"
CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX -DSAFE_MUTEX $CXXFLAGS"
elif test "$with_debug" = "full"
then
# Full debug. Very slow in some cases
AC_DEFINE([DBUG_ON], [1], [Use libdbug])
CFLAGS="$DEBUG_CFLAGS -DSAFE_MUTEX $CFLAGS"
CXXFLAGS="$DEBUG_CXXFLAGS -DSAFE_MUTEX $CXXFLAGS"
else
# Optimized version. No debug
AC_DEFINE([DBUG_OFF], [1], [Don't use libdbug])
@ -1792,21 +1775,6 @@ else
AC_MSG_RESULT([no])
fi
# If we should allow error injection tests
AC_ARG_WITH(error-inject,
AC_HELP_STRING([--with-error-inject],[Enable error injection in MySQL Server]),
[ with_error_inject=$withval ],
[ with_error_inject=no ])
if test $with_debug != "no"
then
if test "$with_error_inject" = "yes"
then
AC_DEFINE([ERROR_INJECT_SUPPORT], [1],
[Enable error injection in MySQL Server])
fi
fi
AC_ARG_WITH([fast-mutexes],
AC_HELP_STRING([--with-fast-mutexes],
[Compile with fast mutexes (default is disabled)]),
@ -3045,7 +3013,8 @@ fi
AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
unittest/Makefile unittest/mytap/Makefile unittest/mytap/t/Makefile dnl
unittest/mysys/Makefile unittest/examples/Makefile dnl
unittest/mysys/Makefile unittest/strings/Makefile dnl
unittest/examples/Makefile dnl
strings/Makefile regex/Makefile storage/Makefile dnl
man/Makefile BUILD/Makefile vio/Makefile dnl
libmysql/Makefile libmysql_r/Makefile client/Makefile dnl

View File

@ -1,4 +1,4 @@
# Copyright (C) 2006 MySQL AB
# Copyright (c) 2006, 2010, 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

View File

@ -1,4 +1,4 @@
# Copyright (C) 2006 MySQL AB
# Copyright (c) 2006, 2010, 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
@ -13,7 +13,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/include
${ZLIB_INCLUDE_DIR}

View File

@ -857,7 +857,6 @@ static struct message *parse_message_string(struct message *new_message,
static struct errors *parse_error_string(char *str, int er_count)
{
struct errors *new_error;
char *start;
DBUG_ENTER("parse_error_string");
DBUG_PRINT("enter", ("str: %s", str));
@ -868,7 +867,6 @@ static struct errors *parse_error_string(char *str, int er_count)
DBUG_RETURN(0); /* OOM: Fatal error */
/* getting the error name */
start= str;
str= skip_delimiters(str);
if (!(new_error->er_name= get_word(&str)))

View File

@ -1,4 +1,4 @@
# Copyright (C) 2006 MySQL AB
# Copyright (c) 2006, 2010, 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

View File

@ -884,21 +884,19 @@ void Alert::Process(input_buffer& input, SSL& ssl)
else
hmac(ssl, verify, data, aSz, alert, true);
// read mac and fill
// read mac and skip fill
int digestSz = ssl.getCrypto().get_digest().get_digestSize();
opaque mac[SHA_LEN];
input.read(mac, digestSz);
if (ssl.getSecurity().get_parms().cipher_type_ == block) {
int ivExtra = 0;
opaque fill;
if (ssl.isTLSv1_1())
ivExtra = ssl.getCrypto().get_cipher().get_blockSize();
int padSz = ssl.getSecurity().get_parms().encrypt_size_ - ivExtra -
aSz - digestSz;
for (int i = 0; i < padSz; i++)
fill = input[AUTO];
input.set_current(input.get_current() + padSz);
}
// verify
@ -981,17 +979,17 @@ output_buffer& operator<<(output_buffer& output, const Data& data)
void Data::Process(input_buffer& input, SSL& ssl)
{
int msgSz = ssl.getSecurity().get_parms().encrypt_size_;
int pad = 0, padByte = 0;
int pad = 0, padSz = 0;
int ivExtra = 0;
if (ssl.getSecurity().get_parms().cipher_type_ == block) {
if (ssl.isTLSv1_1()) // IV
ivExtra = ssl.getCrypto().get_cipher().get_blockSize();
pad = *(input.get_buffer() + input.get_current() + msgSz -ivExtra - 1);
padByte = 1;
padSz = 1;
}
int digestSz = ssl.getCrypto().get_digest().get_digestSize();
int dataSz = msgSz - ivExtra - digestSz - pad - padByte;
int dataSz = msgSz - ivExtra - digestSz - pad - padSz;
opaque verify[SHA_LEN];
const byte* rawData = input.get_buffer() + input.get_current();
@ -1020,14 +1018,10 @@ void Data::Process(input_buffer& input, SSL& ssl)
hmac(ssl, verify, rawData, dataSz, application_data, true);
}
// read mac and fill
// read mac and skip fill
opaque mac[SHA_LEN];
opaque fill;
input.read(mac, digestSz);
for (int i = 0; i < pad; i++)
fill = input[AUTO];
if (padByte)
fill = input[AUTO];
input.set_current(input.get_current() + pad + padSz);
// verify
if (dataSz) {
@ -2073,11 +2067,9 @@ void Finished::Process(input_buffer& input, SSL& ssl)
if (ssl.isTLSv1_1())
ivExtra = ssl.getCrypto().get_cipher().get_blockSize();
opaque fill;
int padSz = ssl.getSecurity().get_parms().encrypt_size_ - ivExtra -
HANDSHAKE_HEADER - finishedSz - digestSz;
for (int i = 0; i < padSz; i++)
fill = input[AUTO];
input.set_current(input.get_current() + padSz);
// verify mac
if (memcmp(mac, verifyMAC, digestSz)) {

View File

@ -1,4 +1,4 @@
# Copyright (C) 2006 MySQL AB
# Copyright (c) 2006, 2010, 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

View File

@ -1,4 +1,4 @@
# Copyright (C) 2009 Sun Microsystems, Inc
# Copyright (c) 2006, 2010, 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

View File

@ -255,14 +255,13 @@ int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */
we want to make sure that no such flags are set.
*/
#if defined(HAVE_SIGACTION) && !defined(my_sigset)
#define my_sigset(A,B) do { struct sigaction l_s; sigset_t l_set; int l_rc; \
#define my_sigset(A,B) do { struct sigaction l_s; sigset_t l_set; \
DBUG_ASSERT((A) != 0); \
sigemptyset(&l_set); \
l_s.sa_handler = (B); \
l_s.sa_mask = l_set; \
l_s.sa_flags = 0; \
l_rc= sigaction((A), &l_s, (struct sigaction *) NULL);\
DBUG_ASSERT(l_rc == 0); \
sigaction((A), &l_s, NULL); \
} while (0)
#elif defined(HAVE_SIGSET) && !defined(my_sigset)
#define my_sigset(A,B) sigset((A),(B))

View File

@ -44,7 +44,9 @@ extern "C" {
#endif
#ifndef _global_h /* If not standard header */
#ifndef MYSQL_ABI_CHECK
#include <sys/types.h>
#endif
#ifdef __LCC__
#include <winsock2.h> /* For windows */
#endif

View File

@ -1,4 +1,3 @@
#include <sys/types.h>
typedef char my_bool;
typedef int my_socket;
#include "mysql_version.h"

View File

@ -1,7 +1,5 @@
#include <mysql/services.h>
#include <mysql/service_my_snprintf.h>
#include <stdarg.h>
#include <stdlib.h>
extern struct my_snprintf_service_st {
size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
@ -9,7 +7,6 @@ extern struct my_snprintf_service_st {
size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
#include <mysql/service_thd_alloc.h>
#include <stdlib.h>
struct st_mysql_lex_string
{
char *str;

View File

@ -70,8 +70,11 @@
extern "C" {
#endif
#ifndef MYSQL_ABI_CHECK
#include <stdarg.h>
#include <stdlib.h>
#endif
extern struct my_snprintf_service_st {
size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);

View File

@ -27,7 +27,9 @@
allocations - they are better served with my_malloc.
*/
#ifndef MYSQL_ABI_CHECK
#include <stdlib.h>
#endif
#ifdef __cplusplus
extern "C" {

View File

@ -63,7 +63,9 @@ extern const char *globerrs[]; /* my_error_messages is here */
#define EE_UNKNOWN_COLLATION 28
#define EE_FILENOTFOUND 29
#define EE_FILE_NOT_CLOSED 30
#define EE_ERROR_LAST 30 /* Copy last error nr */
#define EE_CHANGE_OWNERSHIP 31
#define EE_CHANGE_PERMISSIONS 32
#define EE_ERROR_LAST 32 /* Copy last error nr */
/* Add error numbers before EE_ERROR_LAST and change it accordingly. */
/* exit codes for all MySQL programs */

View File

@ -89,23 +89,11 @@ typedef struct st_thr_lock_info
{
pthread_t thread;
my_thread_id thread_id;
ulong n_cursors;
} THR_LOCK_INFO;
/*
Lock owner identifier. Globally identifies the lock owner within the
thread and among all the threads. The address of an instance of this
structure is used as id.
*/
typedef struct st_thr_lock_owner
{
THR_LOCK_INFO *info;
} THR_LOCK_OWNER;
typedef struct st_thr_lock_data {
THR_LOCK_OWNER *owner;
THR_LOCK_INFO *owner;
struct st_thr_lock_data *next,**prev;
struct st_thr_lock *lock;
mysql_cond_t *cond;
@ -141,19 +129,18 @@ extern LIST *thr_lock_thread_list;
extern mysql_mutex_t THR_LOCK_lock;
my_bool init_thr_lock(void); /* Must be called once/thread */
#define thr_lock_owner_init(owner, info_arg) (owner)->info= (info_arg)
void thr_lock_info_init(THR_LOCK_INFO *info);
void thr_lock_init(THR_LOCK *lock);
void thr_lock_delete(THR_LOCK *lock);
void thr_lock_data_init(THR_LOCK *lock,THR_LOCK_DATA *data,
void *status_param);
enum enum_thr_lock_result thr_lock(THR_LOCK_DATA *data,
THR_LOCK_OWNER *owner,
THR_LOCK_INFO *owner,
enum thr_lock_type lock_type,
ulong lock_wait_timeout);
void thr_unlock(THR_LOCK_DATA *data);
enum enum_thr_lock_result thr_multi_lock(THR_LOCK_DATA **data,
uint count, THR_LOCK_OWNER *owner,
uint count, THR_LOCK_INFO *owner,
ulong lock_wait_timeout);
void thr_multi_unlock(THR_LOCK_DATA **data,uint count);
void

View File

@ -1,4 +1,4 @@
# Copyright (C) 2006 MySQL AB
# Copyright (c) 2006, 2010, 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

View File

@ -1,4 +1,4 @@
# Copyright (C) 2006 MySQL AB
# Copyright (c) 2006, 2010, 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
@ -64,7 +64,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/sql_db.cc ../sql/sql_delete.cc ../sql/sql_derived.cc
../sql/sql_do.cc ../sql/sql_error.cc ../sql/sql_handler.cc
../sql/sql_help.cc ../sql/sql_insert.cc ../sql/datadict.cc
../sql/sql_truncate.cc
../sql/sql_admin.cc ../sql/sql_truncate.cc
../sql/sql_lex.cc ../sql/keycaches.cc
../sql/sql_list.cc ../sql/sql_load.cc ../sql/sql_locale.cc
../sql/sql_binlog.cc ../sql/sql_manager.cc
@ -80,6 +80,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/sql_time.cc ../sql/tztime.cc ../sql/uniques.cc ../sql/unireg.cc
../sql/partition_info.cc ../sql/sql_connect.cc
../sql/scheduler.cc ../sql/sql_audit.cc
../sql/sql_alter.cc ../sql/sql_partition_admin.cc
../sql/event_parse_data.cc
../sql/sql_signal.cc ../sql/rpl_handler.cc
../sql/rpl_utility.cc

View File

@ -63,7 +63,7 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
protocol.cc net_serv.cc opt_range.cc \
opt_sum.cc procedure.cc records.cc sql_acl.cc \
sql_load.cc discover.cc sql_locale.cc \
sql_profile.cc sql_truncate.cc datadict.cc \
sql_profile.cc sql_admin.cc sql_truncate.cc datadict.cc \
sql_analyse.cc sql_base.cc sql_cache.cc sql_class.cc \
sql_crypt.cc sql_db.cc sql_delete.cc sql_error.cc sql_insert.cc \
sql_lex.cc sql_list.cc sql_manager.cc \
@ -78,9 +78,10 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \
rpl_filter.cc sql_partition.cc sql_builtin.cc sql_plugin.cc \
debug_sync.cc sql_tablespace.cc transaction.cc \
rpl_injector.cc my_user.c partition_info.cc \
rpl_injector.cc my_user.c partition_info.cc sql_alter.cc \
sql_servers.cc event_parse_data.cc sql_signal.cc \
rpl_handler.cc mdl.cc keycaches.cc sql_audit.cc
rpl_handler.cc mdl.cc keycaches.cc sql_audit.cc \
sql_partition_admin.cc
libmysqld_int_a_SOURCES= $(libmysqld_sources)
nodist_libmysqld_int_a_SOURCES= $(libmysqlsources) $(sqlsources)

View File

@ -1,4 +1,4 @@
# Copyright (C) 2006 MySQL AB
# Copyright (c) 2006, 2010, 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

View File

@ -1,4 +1,4 @@
# Copyright (C) 2006 MySQL AB
# Copyright (c) 2006, 2010, 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

View File

@ -1,4 +1,4 @@
# Copyright (C) 2009 Sun Microsystems, Inc
# Copyright (c) 2006, 2010, 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

View File

@ -1,4 +1,4 @@
# Copyright (C) 2009 Sun Microsystems, Inc
# Copyright (c) 2006, 2010, 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

View File

@ -200,7 +200,7 @@ if (`SELECT $CRC_ARG_type = 1`) {
if (`SELECT $CRC_ARG_type = 2`) {
# It will be unsafe to call this procedure.
--let $CRC_name= proc_$CRC_ARG_level
--let $CRC_create= CREATE PROCEDURE $CRC_name() BEGIN INSERT INTO ta$CRC_ARG_level VALUES (47); $CRC_ARG_stmt_sidef; END
--let $CRC_create= CREATE PROCEDURE $CRC_name() BEGIN $CRC_ARG_stmt_sidef; INSERT INTO ta$CRC_ARG_level VALUES (47); END
--let $CRC_RET_stmt_sidef= CALL $CRC_name()
--let $CRC_RET_value=
--let $CRC_RET_sel_retval=
@ -344,25 +344,8 @@ if (`SELECT '$CRC_RET_stmt_sidef' != ''`) {
if (`SELECT '$event_type' != 'Table_map'`) {
--enable_query_log
--echo ******** Failure! Event number 3 was a '$event_type', not a 'Table_map'. ********
# Currently, there is a bug causing some statements to be logged
# partially in statement format. Hence, we don't fail here, we
# just print the events (masking out nondeterministic components
# of the output) and continue. When binloggging works perfectly,
# we should instead execute:
#--enable_query_log
#SHOW BINLOG EVENTS;
#--die Wrong events in binlog.
# Here, we should really source
# include/show_binlog_events.inc. But due to BUG#41913, that
# doesn't work, and we have to inline the entire file here. Sigh
# :-(
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR 107 <binlog_start>
--replace_column 2 # 4 # 5 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/
--eval SHOW BINLOG EVENTS FROM 107
--disable_query_log
SHOW BINLOG EVENTS;
--die Wrong events in binlog.
}
SET binlog_format = STATEMENT;

View File

@ -1757,3 +1757,35 @@ disconnect con51355;
--echo # Connection default
connection default;
--echo #
--echo # Bug#54401 assert in Diagnostics_area::set_eof_status , HANDLER
--echo #
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
DROP FUNCTION IF EXISTS f1;
--enable_warnings
delimiter |;
CREATE FUNCTION f1() RETURNS INTEGER
BEGIN
SELECT 1 FROM t2 INTO @a;
RETURN 1;
END|
delimiter ;|
# Get f1() parsed and cached
--error ER_NO_SUCH_TABLE
SELECT f1();
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1);
HANDLER t1 OPEN;
# This used to cause the assert
--error ER_NO_SUCH_TABLE
HANDLER t1 READ FIRST WHERE f1() = 1;
HANDLER t1 CLOSE;
DROP FUNCTION f1;
DROP TABLE t1;

View File

@ -1910,7 +1910,7 @@ select hex(s1) from 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 t2 (s1 binary(2) not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=$engine_type;
@ -2407,7 +2407,7 @@ drop table t1, t2, t3, t5, t6, t8, t9;
}
# End transactional tests
if (test_foreign_keys)
if ($test_foreign_keys)
{
# bug 18934, "InnoDB crashes when table uses column names like DB_ROW_ID"
--error 1005

View File

@ -0,0 +1,30 @@
# Include this in any test using mysql_upgrade
# Can't run test of external client with embedded server
-- source include/not_embedded.inc
# Only run test if "mysql_upgrade" is found
--require r/have_mysql_upgrade.result
--disable_query_log
select LENGTH("$MYSQL_UPGRADE")>0 as have_mysql_upgrade;
--enable_query_log
#
# Hack:
#
# If running with Valgrind ($VALGRIND_TEST <> 0) then the resource
# consumption (CPU) for upgrading a large log table will be intense.
# Therefore, truncate the log table in advance and issue a statement
# that should be logged.
#
if (`SELECT $VALGRIND_TEST`)
{
--disable_query_log
--disable_result_log
--disable_abort_on_error
TRUNCATE TABLE mysql.general_log;
SELECT 1;
--enable_abort_on_error
--enable_result_log
--enable_query_log
}

View File

@ -188,6 +188,8 @@ sub new {
while ( my $line= <$F> ) {
chomp($line);
# Remove any trailing CR from Windows edited files
$line=~ s/\cM$//;
# [group]
if ( $line =~ /^\[(.*)\]/ ) {

View File

@ -30,6 +30,13 @@ sub get_basedir {
return $basedir;
}
sub get_testdir {
my ($self, $group)= @_;
my $testdir= $group->if_exist('testdir') ||
$self->{ARGS}->{testdir};
return $testdir;
}
# Retrive build directory (which is different from basedir in out-of-source build)
sub get_bindir {
if (defined $ENV{MTR_BINDIR})
@ -151,9 +158,8 @@ sub fix_secure_file_priv {
sub fix_std_data {
my ($self, $config, $group_name, $group)= @_;
return my_find_dir($self->get_basedir($group),
["share/mysql-test", "mysql-test"],
"std_data");
my $testdir= $self->get_testdir($group);
return "$testdir/std_data";
}
sub ssl_supported {

View File

@ -60,11 +60,12 @@ use My::Platform;
my %running;
my $_verbose= 0;
my $start_exit= 0;
END {
# Kill any children still running
for my $proc (values %running){
if ( $proc->is_child($$) ){
if ( $proc->is_child($$) and ! $start_exit){
#print "Killing: $proc\n";
if ($proc->wait_one(0)){
$proc->kill();
@ -161,6 +162,11 @@ sub new {
push(@safe_args, "--");
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);
print "### safe_path: ", $safe_path, " ", join(" ", @safe_args), "\n"
@ -540,6 +546,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.

View File

@ -1,4 +1,4 @@
# Copyright (C) 2006 MySQL AB
# Copyright (c) 2006, 2010, 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

View File

@ -598,7 +598,7 @@ sub optimize_cases {
# Check that engine selected by
# --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}} ) {
my $default_engine=

View File

@ -124,7 +124,7 @@ sub mtr_report_test ($) {
my $timest = format_time();
my $fail = "fail";
if ( $::opt_experimental )
if ( @$::experimental_test_cases )
{
# Find out if this test case is an experimental one, so we can treat
# the failure as an expected failure instead of a regression.

View File

@ -3113,7 +3113,6 @@ sub install_db ($$) {
mtr_add_arg($args, "--bootstrap");
mtr_add_arg($args, "--basedir=%s", $path_my_basedir);
mtr_add_arg($args, "--datadir=%s", $data_dir);
mtr_add_arg($args, "--loose-skip-innodb");
mtr_add_arg($args, "--loose-skip-ndbcluster");
mtr_add_arg($args, "--tmpdir=.");
mtr_add_arg($args, "--core-file");
@ -3127,6 +3126,15 @@ sub install_db ($$) {
mtr_add_arg($args, "--lc-messages-dir=%s", $path_language);
mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
# InnoDB arguments that affect file location and sizes may
# need to be given to the bootstrap process as well as the
# server process.
foreach my $extra_opt ( @opt_extra_mysqld_opt ) {
if ($extra_opt =~ /--innodb/) {
mtr_add_arg($args, $extra_opt);
}
}
# If DISABLE_GRANT_OPTIONS is defined when the server is compiled (e.g.,
# configure --disable-grant-options), mysqld will not recognize the
# --bootstrap or --skip-grant-tables options. The user can set
@ -3926,11 +3934,6 @@ sub mysqld_arguments ($$$$) {
mtr_add_arg($args, "%s--local-infile", $prefix);
if ( $idx > 0 or !$use_innodb)
{
mtr_add_arg($args, "%s--loose-skip-innodb", $prefix);
}
my $cluster= $clusters->[$mysqld->{'cluster'}];
if ( $cluster->{'pid'} || # Cluster is started
$cluster->{'use_running'} ) # Using running cluster

View File

@ -206,8 +206,8 @@ our $opt_client_debugger;
my $config; # The currently running config
my $current_config_name; # The currently running config file template
our $opt_experimental;
our $experimental_test_cases;
our @opt_experimentals;
our $experimental_test_cases= [];
my $baseport;
# $opt_build_thread may later be set from $opt_port_base
@ -237,8 +237,10 @@ sub check_timeout { return $opt_testcase_timeout * 6; };
my $opt_start;
my $opt_start_dirty;
my $opt_start_exit;
my $start_only;
my $opt_wait_all;
my $opt_user_args;
my $opt_repeat= 1;
my $opt_retry= 3;
my $opt_retry_failure= env_or_val(MTR_RETRY_FAILURE => 2);
@ -365,6 +367,12 @@ sub main {
}
$ENV{MTR_PARALLEL} = $opt_parallel;
if ($opt_parallel > 1 && $opt_start_exit) {
mtr_warning("Parallel and --start-and-exit cannot be combined\n" .
"Setting parallel to 1");
$opt_parallel= 1;
}
# Create server socket on any free port
my $server = new IO::Socket::INET
(
@ -404,6 +412,8 @@ sub main {
my $completed= run_test_server($server, $tests, $opt_parallel);
exit(0) if $opt_start_exit;
# Send Ctrl-C to any children still running
kill("INT", keys(%children));
@ -857,7 +867,7 @@ sub command_line_setup {
'big-test' => \$opt_big_test,
'combination=s' => \@opt_combinations,
'skip-combinations' => \&collect_option,
'experimental=s' => \$opt_experimental,
'experimental=s' => \@opt_experimentals,
'skip-im' => \&ignore_option,
# Specify ports
@ -930,7 +940,9 @@ sub command_line_setup {
'verbose-restart' => \&report_option,
'sleep=i' => \$opt_sleep,
'start-dirty' => \$opt_start_dirty,
'start-and-exit' => \$opt_start_exit,
'start' => \$opt_start,
'user-args' => \$opt_user_args,
'wait-all' => \$opt_wait_all,
'print-testcases' => \&collect_option,
'repeat=i' => \$opt_repeat,
@ -1044,16 +1056,19 @@ sub command_line_setup {
mtr_print_thick_line('#');
}
if ( $opt_experimental )
if ( @opt_experimentals )
{
# $^O on Windows considered not generic enough
my $plat= (IS_WINDOWS) ? 'windows' : $^O;
# read the list of experimental test cases from the file specified on
# read the list of experimental test cases from the files specified on
# the command line
open(FILE, "<", $opt_experimental) or mtr_error("Can't read experimental file: $opt_experimental");
mtr_report("Using experimental file: $opt_experimental");
$experimental_test_cases = [];
foreach my $exp_file (@opt_experimentals)
{
open(FILE, "<", $exp_file)
or mtr_error("Can't read experimental file: $exp_file");
mtr_report("Using experimental file: $exp_file");
while(<FILE>) {
chomp;
# remove comments (# foo) at the beginning of the line, or after a
@ -1082,6 +1097,7 @@ sub command_line_setup {
}
close FILE;
}
}
foreach my $arg ( @ARGV )
{
@ -1349,18 +1365,29 @@ sub command_line_setup {
# --------------------------------------------------------------------------
# Modified behavior with --start options
# --------------------------------------------------------------------------
if ($opt_start or $opt_start_dirty) {
if ($opt_start or $opt_start_dirty or $opt_start_exit) {
collect_option ('quick-collect', 1);
$start_only= 1;
}
# --------------------------------------------------------------------------
# Check use of user-args
# --------------------------------------------------------------------------
if ($opt_user_args) {
mtr_error("--user-args only valid with --start options")
unless $start_only;
mtr_error("--user-args cannot be combined with named suites or tests")
if $opt_suites || @opt_cases;
}
# --------------------------------------------------------------------------
# Check use of wait-all
# --------------------------------------------------------------------------
if ($opt_wait_all && ! $start_only)
{
mtr_error("--wait-all can only be used with --start or --start-dirty");
mtr_error("--wait-all can only be used with --start options");
}
# --------------------------------------------------------------------------
@ -2815,6 +2842,7 @@ sub default_mysqld {
my $config= My::ConfigFactory->new_config
( {
basedir => $basedir,
testdir => $glob_mysql_test_dir,
template_path => "include/default_my.cnf",
vardir => $opt_vardir,
tmpdir => $opt_tmpdir,
@ -2860,6 +2888,15 @@ sub mysql_install_db {
mtr_add_arg($args, "--lc-messages-dir=%s", $install_lang);
mtr_add_arg($args, "--character-sets-dir=%s", $install_chsdir);
# InnoDB arguments that affect file location and sizes may
# need to be given to the bootstrap process as well as the
# server process.
foreach my $extra_opt ( @opt_extra_mysqld_opt ) {
if ($extra_opt =~ /--innodb/) {
mtr_add_arg($args, $extra_opt);
}
}
# If DISABLE_GRANT_OPTIONS is defined when the server is compiled (e.g.,
# configure --disable-grant-options), mysqld will not recognize the
# --bootstrap or --skip-grant-tables options. The user can set
@ -3060,7 +3097,8 @@ sub check_testcase($$)
my %started;
foreach my $mysqld ( mysqlds() )
{
if ( defined $mysqld->{'proc'} )
# Skip if server has been restarted with additional options
if ( defined $mysqld->{'proc'} && ! exists $mysqld->{'restart_opts'} )
{
my $proc= start_check_testcase($tinfo, $mode, $mysqld);
$started{$proc->pid()}= $proc;
@ -3421,6 +3459,7 @@ sub run_testcase ($) {
$config= My::ConfigFactory->new_config
( {
basedir => $basedir,
testdir => $glob_mysql_test_dir,
template_path => $tinfo->{template_path},
extra_template_path => $tinfo->{extra_template_path},
vardir => $opt_vardir,
@ -3481,6 +3520,18 @@ sub run_testcase ($) {
mtr_print ($mysqld->name() . " " . $mysqld->value('port') .
" " . $mysqld->value('socket'));
}
if ( $opt_start_exit )
{
mtr_print("Server(s) started, not waiting for them to finish");
if (IS_WINDOWS)
{
POSIX::_exit(0); # exit hangs here in ActiveState Perl
}
else
{
exit(0);
}
}
mtr_print("Waiting for server(s) to exit...");
if ( $opt_wait_all ) {
My::SafeProcess->wait_all();
@ -3812,8 +3863,8 @@ sub extract_warning_lines ($$) {
if ($opt_valgrind_mysqld) {
# Skip valgrind summary from tests where server has been restarted
# Should this contain memory leaks, the final report will find it
$skip_valgrind= 1 if $line =~ /^==\d+== ERROR SUMMARY:/;
$skip_valgrind= 1 if $line =~ /^==\d+== HEAP SUMMARY:/;
# Use a generic pattern for summaries
$skip_valgrind= 1 if $line =~ /^==\d+== [A-Z ]+ SUMMARY:/;
$skip_valgrind= 0 unless $line =~ /^==\d+==/;
next if $skip_valgrind;
}
@ -4021,6 +4072,16 @@ sub check_expected_crash_and_restart {
next;
}
# If last line begins "restart:", the rest of the line is read as
# extra command line options to add to the restarted mysqld.
# Anything other than 'wait' or 'restart:' (with a colon) will
# result in a restart with original mysqld options.
if ($last_line =~ /restart:(.+)/) {
my @rest_opt= split(' ', $1);
$mysqld->{'restart_opts'}= \@rest_opt;
} else {
delete $mysqld->{'restart_opts'};
}
unlink($expect_file);
# Start server with same settings as last time
@ -4289,7 +4350,7 @@ sub mysqld_arguments ($$$) {
}
}
if ( $mysql_version_id >= 50106 )
if ( $mysql_version_id >= 50106 && !$opt_user_args)
{
# Turn on logging to file
mtr_add_arg($args, "--log-output=file");
@ -4332,7 +4393,7 @@ sub mysqld_arguments ($$$) {
}
}
$opt_skip_core = $found_skip_core;
if ( !$found_skip_core )
if ( !$found_skip_core && !$opt_user_args )
{
mtr_add_arg($args, "%s", "--core-file");
}
@ -4340,7 +4401,7 @@ sub mysqld_arguments ($$$) {
# Enable the debug sync facility, set default wait timeout.
# Facility stays disabled if timeout value is zero.
mtr_add_arg($args, "--loose-debug-sync-timeout=%s",
$opt_debug_sync_timeout);
$opt_debug_sync_timeout) unless $opt_user_args;
return $args;
}
@ -4368,7 +4429,13 @@ sub mysqld_start ($$) {
}
mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld'));
mysqld_arguments($args,$mysqld,$extra_opts);
# Add any additional options from an in-test restart
my @all_opts= @$extra_opts;
if (exists $mysqld->{'restart_opts'}) {
push (@all_opts, @{$mysqld->{'restart_opts'}});
}
mysqld_arguments($args,$mysqld,\@all_opts);
if ( $opt_debug )
{
@ -4549,7 +4616,10 @@ sub server_need_restart {
my $extra_opts= get_extra_opts($server, $tinfo);
my $started_opts= $server->{'started_opts'};
if (!My::Options::same($started_opts, $extra_opts) )
# Also, always restart if server had been restarted with additional
# options within test.
if (!My::Options::same($started_opts, $extra_opts) ||
exists $server->{'restart_opts'})
{
my $use_dynamic_option_switch= 0;
if (!$use_dynamic_option_switch)
@ -4638,6 +4708,9 @@ sub envsubst {
sub get_extra_opts {
# No extra options if --user-args
return \@opt_extra_mysqld_opt if $opt_user_args;
my ($mysqld, $tinfo)= @_;
my $opts=
@ -4708,6 +4781,12 @@ sub stop_servers($$) {
sub start_servers($) {
my ($tinfo)= @_;
# Make sure the safe_process also exits from now on
# Could not be done before, as we don't want this for the bootstrap
if ($opt_start_exit) {
My::SafeProcess->start_exit();
}
# Start clusters
foreach my $cluster ( clusters() )
{
@ -5503,8 +5582,13 @@ Misc options
startup settings for the first specified test case
Example:
$0 --start alias &
start-and-exit Same as --start, but mysql-test-run terminates and
leaves just the server running
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
--mysqld (if any)
wait-all If --start or --start-dirty option is used, wait for all
servers to exit before finishing the process
fast Run as fast as possible, dont't wait for servers

View File

@ -1370,3 +1370,16 @@ CREATE TABLE t1 (id int);
INSERT INTO t1 VALUES (1), (2);
ALTER TABLE t1 ADD COLUMN (f1 INT), ADD COLUMN (f2 INT), ADD KEY f2k(f2);
DROP TABLE t1;
#
# Test for bug #53820 "ALTER a MEDIUMINT column table causes full
# table copy".
#
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a INT, b MEDIUMINT);
INSERT INTO t1 VALUES (1, 1), (2, 2);
# The below ALTER should not copy table and so no rows should
# be shown as affected.
ALTER TABLE t1 CHANGE a id INT;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
DROP TABLE t1;

View File

@ -5138,7 +5138,7 @@ insert t1 values (1),(2),(3),(4),(5);
truncate table t1;
affected rows: 0
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');
select * from t1;
v
@ -5146,14 +5146,14 @@ def
abc
hij
3r4f
alter table t1 change v v2 varchar(32);
alter table t1 change v v2 varchar(32) not null;
select * from t1;
v2
def
abc
hij
3r4f
alter table t1 change v2 v varchar(64);
alter table t1 change v2 v varchar(64) not null;
select * from t1;
v
def
@ -5163,35 +5163,34 @@ hij
update t1 set v = 'lmn' where v = 'hij';
select * from t1;
v
lmn
def
abc
lmn
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;
i v
1 def
2 abc
3 lmn
4 3r4f
update t1 set i=5 where i=3;
0 lmn
0 def
0 abc
0 3r4f
update t1 set i=3 where v = 'abc';
select * from t1;
i v
1 def
2 abc
5 lmn
4 3r4f
alter table t1 change i i bigint;
3 abc
0 lmn
0 def
0 3r4f
alter table t1 change i i bigint not null;
select * from t1;
i v
1 def
2 abc
5 lmn
4 3r4f
alter table t1 add unique key (i, v);
select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn');
3 abc
0 lmn
0 def
0 3r4f
select * from t1 where i between 2 and 4 and v in ('def','3r4f','abc');
i v
4 3r4f
3 abc
drop table t1;
create table bug15205 (val int(11) not null) engine=csv;
create table bug15205_2 (val int(11) not null) engine=csv;

View File

@ -1714,3 +1714,14 @@ NULL NULL NULL NULL NULL
drop table t1;
#
End of 5.1 tests
#
# Bug#55648: Server crash on MIX/MAX on maximum time value
#
CREATE TABLE t1(c1 TIME NOT NULL);
INSERT INTO t1 VALUES('837:59:59');
INSERT INTO t1 VALUES('838:59:59');
SELECT MAX(c1) FROM t1;
MAX(c1)
838:59:59
DROP TABLE t1;
# End of the bug#55648

View File

@ -1710,3 +1710,23 @@ ERROR 42S02: Table 'test.t1' doesn't exist
HANDLER t1 CLOSE;
# Connection con51355
# Connection default
#
# Bug#54401 assert in Diagnostics_area::set_eof_status , HANDLER
#
DROP TABLE IF EXISTS t1, t2;
DROP FUNCTION IF EXISTS f1;
CREATE FUNCTION f1() RETURNS INTEGER
BEGIN
SELECT 1 FROM t2 INTO @a;
RETURN 1;
END|
SELECT f1();
ERROR 42S02: Table 'test.t2' doesn't exist
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1);
HANDLER t1 OPEN;
HANDLER t1 READ FIRST WHERE f1() = 1;
ERROR 42S02: Table 'test.t2' doesn't exist
HANDLER t1 CLOSE;
DROP FUNCTION f1;
DROP TABLE t1;

View File

@ -1707,6 +1707,26 @@ HANDLER t1 CLOSE;
# Connection con51355
# Connection default
#
# Bug#54401 assert in Diagnostics_area::set_eof_status , HANDLER
#
DROP TABLE IF EXISTS t1, t2;
DROP FUNCTION IF EXISTS f1;
CREATE FUNCTION f1() RETURNS INTEGER
BEGIN
SELECT 1 FROM t2 INTO @a;
RETURN 1;
END|
SELECT f1();
ERROR 42S02: Table 'test.t2' doesn't exist
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1);
HANDLER t1 OPEN;
HANDLER t1 READ FIRST WHERE f1() = 1;
ERROR 42S02: Table 'test.t2' doesn't exist
HANDLER t1 CLOSE;
DROP FUNCTION f1;
DROP TABLE t1;
#
# BUG #46456: HANDLER OPEN + TRUNCATE + DROP (temporary) TABLE, crash
#
CREATE TABLE t1 AS SELECT 1 AS f1;

View File

@ -116,3 +116,35 @@ Table Op Msg_type Msg_text
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
test.t1 optimize status OK
DROP TABLE t1;
#
# Bug#49891 View DDL breaks REPEATABLE READ
#
DROP TABLE IF EXISTS t1, t2;
DROP VIEW IF EXISTS v2;
CREATE TABLE t1 ( f1 INTEGER ) ENGINE = innodb;
CREATE TABLE t2 ( f1 INTEGER );
CREATE VIEW v1 AS SELECT 1 FROM t1;
# Connection con3
LOCK TABLE t1 WRITE;
# Connection default
START TRANSACTION;
# Sending:
SELECT * FROM v1;
# Connection con2
# Waiting for 'SELECT * FROM v1' to sync in.
# Sending:
ALTER VIEW v1 AS SELECT 2 FROM t2;
# Connection con3
# Waiting for 'ALTER VIEW v1 AS SELECT 2 FROM t2' to sync in.
UNLOCK TABLES;
# Connection default;
# Reaping: SELECT * FROM v1
1
SELECT * FROM v1;
1
COMMIT;
# Connection con2
# Reaping: ALTER VIEW v1 AS SELECT 2 FROM t2
# Connection default
DROP TABLE t1, t2;
DROP VIEW v1;

View File

@ -48,3 +48,21 @@ Warnings:
Error 1146 Table 'test.t1' doesn't exist
# Connection default
SET DEBUG_SYNC= "RESET";
#
# Bug#53757 assert in mysql_truncate_by_delete
#
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1(a INT) Engine=InnoDB;
CREATE TABLE t2(id INT);
INSERT INTO t1 VALUES (1), (2);
INSERT INTO t2 VALUES(connection_id());
SET DEBUG_SYNC= "open_and_process_table SIGNAL opening WAIT_FOR killed";
# Sending: (not reaped since connection is killed later)
TRUNCATE t1;
SET DEBUG_SYNC= "now WAIT_FOR opening";
SELECT ((@id := id) - id) FROM t2;
((@id := id) - id)
0
KILL @id;
SET DEBUG_SYNC= "now SIGNAL killed";
DROP TABLE t1, t2;

View File

@ -56,6 +56,7 @@ CREATE DATABASE `TEST_$1`;
SHOW DATABASES LIKE "TEST%";
Database (TEST%)
TEST_$1
test
DROP DATABASE `test_$1`;
CREATE TABLE T1 (a int) engine=innodb;
INSERT INTO T1 VALUES (1);
@ -171,7 +172,7 @@ create table myUC (i int);
select TABLE_SCHEMA,TABLE_NAME FROM information_schema.TABLES
where TABLE_SCHEMA ='mysqltest_LC2';
TABLE_SCHEMA TABLE_NAME
mysqltest_LC2 myUC
mysqltest_lc2 myUC
use test;
drop database mysqltest_LC2;
# End of 5.1 tests

View File

@ -2527,3 +2527,240 @@ SET DEBUG_SYNC= "now SIGNAL completed";
Field Type Collation Null Key Default Extra Privileges Comment
a char(255) latin1_swedish_ci YES NULL #
DROP TABLE t1;
#
# Tests for schema-scope locks
#
DROP DATABASE IF EXISTS db1;
DROP DATABASE IF EXISTS db2;
# Test 1:
# CREATE DATABASE blocks database DDL on the same database, but
# not database DDL on different databases. Tests X vs X lock.
#
# Connection default
SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
# Sending:
CREATE DATABASE db1;
# Connection con2
SET DEBUG_SYNC= 'now WAIT_FOR locked';
# Sending:
CREATE DATABASE db1;
# Connection con3
CREATE DATABASE db2;
ALTER DATABASE db2 DEFAULT CHARACTER SET utf8;
DROP DATABASE db2;
SET DEBUG_SYNC= 'now SIGNAL blocked';
# Connection default
# Reaping: CREATE DATABASE db1
# Connection con2
# Reaping: CREATE DATABASE db1
ERROR HY000: Can't create database 'db1'; database exists
# Test 2:
# ALTER DATABASE blocks database DDL on the same database, but
# not database DDL on different databases. Tests X vs X lock.
#
# Connection default
SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
# Sending:
ALTER DATABASE db1 DEFAULT CHARACTER SET utf8;
# Connection con2
SET DEBUG_SYNC= 'now WAIT_FOR locked';
# Sending:
ALTER DATABASE db1 DEFAULT CHARACTER SET utf8;
# Connection con3
CREATE DATABASE db2;
ALTER DATABASE db2 DEFAULT CHARACTER SET utf8;
DROP DATABASE db2;
SET DEBUG_SYNC= 'now SIGNAL blocked';
# Connection default
# Reaping: ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
# Connection con2
# Reaping: ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
# Connection default
SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
# Sending:
ALTER DATABASE db1 DEFAULT CHARACTER SET utf8;
# Connection con2
SET DEBUG_SYNC= 'now WAIT_FOR locked';
# Sending:
DROP DATABASE db1;
# Connection con3
SET DEBUG_SYNC= 'now SIGNAL blocked';
# Connection default
# Reaping: ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
# Connection con2
# Reaping: DROP DATABASE db1
CREATE DATABASE db1;
# Test 3:
# Two ALTER..UPGRADE of the same database are mutually exclusive, but
# two ALTER..UPGRADE of different databases are not. Tests X vs X lock.
#
# Connection default
SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
# Sending:
ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME;
# Connection con2
SET DEBUG_SYNC= 'now WAIT_FOR locked';
# Sending:
ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME;
# Connection con3
ALTER DATABASE `#mysql50#a-b-c-d` UPGRADE DATA DIRECTORY NAME;
SET DEBUG_SYNC= 'now SIGNAL blocked';
# Connection default
# Reaping: ALTER DATABASE '#mysql50#a-b-c' UPGRADE DATA DIRECTORY NAME
# Connection con2
# Reaping: ALTER DATABASE '#mysql50#a-b-c' UPGRADE DATA DIRECTORY NAME
ERROR 42000: Unknown database '#mysql50#a-b-c'
DROP DATABASE `a-b-c`;
DROP DATABASE `a-b-c-d`;
# Test 4:
# DROP DATABASE blocks database DDL on the same database, but
# not database DDL on different databases. Tests X vs X lock.
#
# Connection default
SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
# Sending:
DROP DATABASE db1;
# Connection con2
SET DEBUG_SYNC= 'now WAIT_FOR locked';
# Sending:
DROP DATABASE db1;
# Connection con3
CREATE DATABASE db2;
ALTER DATABASE db2 DEFAULT CHARACTER SET utf8;
DROP DATABASE db2;
SET DEBUG_SYNC= 'now SIGNAL blocked';
# Connection default
# Reaping: DROP DATABASE db1
# Connection con2
# Reaping: DROP DATABASE db1
ERROR HY000: Can't drop database 'db1'; database doesn't exist
# Connection default
CREATE DATABASE db1;
SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
# Sending:
DROP DATABASE db1;
# Connection con2
SET DEBUG_SYNC= 'now WAIT_FOR locked';
# Sending:
ALTER DATABASE db1 DEFAULT CHARACTER SET utf8;
# Connection con3
SET DEBUG_SYNC= 'now SIGNAL blocked';
# Connection default
# Reaping: DROP DATABASE db1
# Connection con2
# Reaping: ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
Got one of the listed errors
# Test 5:
# Locked database name prevents CREATE of tables in that database.
# Tests X vs IX lock.
#
# Connection default
CREATE DATABASE db1;
SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
# Sending:
DROP DATABASE db1;
# Connection con2
SET DEBUG_SYNC= 'now WAIT_FOR locked';
# Sending:
CREATE TABLE db1.t1 (a INT);
# Connection con3
SET DEBUG_SYNC= 'now SIGNAL blocked';
# Connection default
# Reaping: DROP DATABASE db1
# Connection con2
# Reaping: CREATE TABLE db1.t1 (a INT)
ERROR 42000: Unknown database 'db1'
# Test 6:
# Locked database name prevents RENAME of tables to/from that database.
# Tests X vs IX lock.
#
# Connection default
CREATE DATABASE db1;
CREATE TABLE db1.t1 (a INT);
SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
# Sending:
DROP DATABASE db1;
# Connection con2
SET DEBUG_SYNC= 'now WAIT_FOR locked';
# Sending:
RENAME TABLE db1.t1 TO test.t1;
# Connection con3
SET DEBUG_SYNC= 'now SIGNAL blocked';
# Connection default
# Reaping: DROP DATABASE db1
# Connection con2
# Reaping: RENAME TABLE db1.t1 TO test.t1
Got one of the listed errors
# Connection default
CREATE DATABASE db1;
CREATE TABLE test.t2 (a INT);
SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
# Sending:
DROP DATABASE db1;
# Connection con2
SET DEBUG_SYNC= 'now WAIT_FOR locked';
# Sending:
RENAME TABLE test.t2 TO db1.t2;
# Connection con3
SET DEBUG_SYNC= 'now SIGNAL blocked';
# Connection default
# Reaping: DROP DATABASE db1
# Connection con2
# Reaping: RENAME TABLE test.t2 TO db1.t2
Got one of the listed errors
DROP TABLE test.t2;
# Test 7:
# Locked database name prevents DROP of tables in that database.
# Tests X vs IX lock.
#
# Connection default
CREATE DATABASE db1;
CREATE TABLE db1.t1 (a INT);
SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
# Sending:
DROP DATABASE db1;
# Connection con2
SET DEBUG_SYNC= 'now WAIT_FOR locked';
# Sending:
DROP TABLE db1.t1;
# Connection con3
SET DEBUG_SYNC= 'now SIGNAL blocked';
# Connection default
# Reaping: DROP DATABASE db1
# Connection con2
# Reaping: DROP TABLE db1.t1
ERROR 42S02: Unknown table 't1'
# Connection default
SET DEBUG_SYNC= 'RESET';
#
# End of tests for schema-scope locks
#
#
# Tests of granted global S lock (FLUSH TABLE WITH READ LOCK)
#
CREATE DATABASE db1;
CREATE TABLE db1.t1(a INT);
# Connection default
FLUSH TABLE WITH READ LOCK;
# Connection con2
CREATE TABLE db1.t2(a INT);
# Connection default
UNLOCK TABLES;
# Connection con2
# Reaping CREATE TABLE db1.t2(a INT)
# Connection default
FLUSH TABLE WITH READ LOCK;
# Connection con2
ALTER DATABASE db1 DEFAULT CHARACTER SET utf8;
# Connection default
UNLOCK TABLES;
# Connection con2
# Reaping ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
# Connection default
FLUSH TABLE WITH READ LOCK;
# Connection con2
FLUSH TABLE WITH READ LOCK;
UNLOCK TABLES;
# Connection default
UNLOCK TABLES;
DROP DATABASE db1;

View File

@ -1,3 +1,5 @@
set global storage_engine=myisam;
set session storage_engine=myisam;
drop table if exists t1,t2,t3,t4,t5,t6;
drop database if exists mysqltest;
create table t1 (a int not null primary key auto_increment, message char(20));
@ -584,7 +586,9 @@ INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (2);
CREATE TEMPORARY TABLE t3 (c1 INT NOT NULL) ENGINE=MRG_MYISAM UNION=(t1,t2);
SELECT * FROM t3;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
c1
1
2
CREATE TEMPORARY TABLE t4 (c1 INT NOT NULL);
CREATE TEMPORARY TABLE t5 (c1 INT NOT NULL);
INSERT INTO t4 VALUES (4);
@ -613,7 +617,9 @@ ERROR HY000: Unable to open underlying table which is differently defined or of
drop table t3;
create temporary table t3 (a int not null) ENGINE=MERGE UNION=(t1,t2);
select * from t3;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
a
1
2
drop table t3, t2, t1;
# CREATE...SELECT is not implemented for MERGE tables.
CREATE TEMPORARY TABLE t1 (c1 INT NOT NULL);
@ -1196,12 +1202,13 @@ ERROR HY000: Table 't4' was not locked with LOCK TABLES
# it can even be used.
CREATE TEMPORARY TABLE t4 LIKE t3;
SHOW CREATE TABLE t4;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
Table Create Table
t4 CREATE TEMPORARY TABLE `t4` (
`c1` int(11) DEFAULT NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
INSERT INTO t4 VALUES (4);
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
UNLOCK TABLES;
INSERT INTO t4 VALUES (4);
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
DROP TABLE t4;
#
# Rename child.
@ -1229,6 +1236,8 @@ c1
2
3
4
4
4
RENAME TABLE t2 TO t5;
SELECT * FROM t3 ORDER BY c1;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
@ -1239,6 +1248,8 @@ c1
2
3
4
4
4
#
# 3. Normal rename with locked tables.
LOCK TABLES t1 WRITE, t2 WRITE, t3 WRITE;
@ -1248,6 +1259,8 @@ c1
2
3
4
4
4
RENAME TABLE t2 TO t5;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
SELECT * FROM t3 ORDER BY c1;
@ -1256,6 +1269,8 @@ c1
2
3
4
4
4
RENAME TABLE t5 TO t2;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
SELECT * FROM t3 ORDER BY c1;
@ -1264,6 +1279,8 @@ c1
2
3
4
4
4
UNLOCK TABLES;
#
# 4. Alter table rename.
@ -1277,6 +1294,8 @@ c1
2
3
4
4
4
#
# 5. Alter table rename with locked tables.
LOCK TABLES t1 WRITE, t2 WRITE, t3 WRITE;
@ -1293,6 +1312,8 @@ c1
2
3
4
4
4
#
# Rename parent.
#
@ -1304,6 +1325,8 @@ c1
2
3
4
4
4
RENAME TABLE t3 TO t5;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
SELECT * FROM t3 ORDER BY c1;
@ -1312,6 +1335,8 @@ c1
2
3
4
4
4
RENAME TABLE t5 TO t3;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
SELECT * FROM t3 ORDER BY c1;
@ -1320,6 +1345,8 @@ c1
2
3
4
4
4
#
# 5. Alter table rename with locked tables.
ALTER TABLE t3 RENAME TO t5;
@ -1335,6 +1362,8 @@ c1
2
3
4
4
4
DROP TABLE t1, t2, t3;
#
# Drop locked tables.
@ -2650,6 +2679,705 @@ test.t1 optimize Error Unable to open underlying table which is differently defi
test.t1 optimize note The storage engine for the table doesn't support optimize
DROP TABLE t1;
#
# Bug#36171 - CREATE TEMPORARY TABLE and MERGE engine
# More tests with TEMPORARY MERGE table and permanent children.
# First without locked tables.
#
DROP TABLE IF EXISTS t1, t2, t3, t4, m1, m2;
#
CREATE TABLE t1 (c1 INT, c2 INT) ENGINE=MyISAM;
CREATE TABLE t2 (c1 INT, c2 INT) ENGINE=MyISAM;
CREATE TEMPORARY TABLE m1 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
INSERT_METHOD=LAST;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE TABLE m1;
Table Create Table
m1 CREATE TEMPORARY TABLE `m1` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
SELECT * FROM m1;
c1 c2
INSERT INTO t1 VALUES (111, 121);
INSERT INTO m1 VALUES (211, 221);
SELECT * FROM m1;
c1 c2
111 121
211 221
SELECT * FROM t1;
c1 c2
111 121
SELECT * FROM t2;
c1 c2
211 221
#
ALTER TABLE m1 RENAME m2;
SHOW CREATE TABLE m2;
Table Create Table
m2 CREATE TEMPORARY TABLE `m2` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
SELECT * FROM m2;
c1 c2
111 121
211 221
#
CREATE TEMPORARY TABLE m1 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
INSERT_METHOD=LAST;
ALTER TABLE m2 RENAME m1;
ERROR 42S01: Table 'm1' already exists
DROP TABLE m1;
ALTER TABLE m2 RENAME m1;
SHOW CREATE TABLE m1;
Table Create Table
m1 CREATE TEMPORARY TABLE `m1` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
SELECT * FROM m1;
c1 c2
111 121
211 221
#
ALTER TABLE m1 ADD COLUMN c3 INT;
INSERT INTO m1 VALUES (212, 222, 232);
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
SELECT * FROM m1;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
ALTER TABLE t1 ADD COLUMN c3 INT;
ALTER TABLE t2 ADD COLUMN c3 INT;
INSERT INTO m1 VALUES (212, 222, 232);
SELECT * FROM m1;
c1 c2 c3
111 121 NULL
211 221 NULL
212 222 232
#
ALTER TABLE m1 DROP COLUMN c3;
INSERT INTO m1 VALUES (213, 223);
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
SELECT * FROM m1;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
ALTER TABLE t1 DROP COLUMN c3;
ALTER TABLE t2 DROP COLUMN c3;
INSERT INTO m1 VALUES (213, 223);
SELECT * FROM m1;
c1 c2
111 121
211 221
212 222
213 223
#
CREATE TABLE t3 (c1 INT, c2 INT) ENGINE=MyISAM;
ALTER TABLE m1 UNION=(t1,t2,t3);
INSERT INTO m1 VALUES (311, 321);
SELECT * FROM m1;
c1 c2
111 121
211 221
212 222
213 223
311 321
SELECT * FROM t1;
c1 c2
111 121
SELECT * FROM t2;
c1 c2
211 221
212 222
213 223
SELECT * FROM t3;
c1 c2
311 321
#
CREATE TEMPORARY TABLE t4 (c1 INT, c2 INT) ENGINE=MyISAM;
ALTER TABLE m1 UNION=(t1,t2,t3,t4);
INSERT INTO m1 VALUES (411, 421);
SELECT * FROM m1;
c1 c2
111 121
211 221
212 222
213 223
311 321
411 421
SELECT * FROM t1;
c1 c2
111 121
SELECT * FROM t2;
c1 c2
211 221
212 222
213 223
SELECT * FROM t3;
c1 c2
311 321
SELECT * FROM t4;
c1 c2
411 421
#
ALTER TABLE m1 ENGINE=MyISAM;
SHOW CREATE TABLE m1;
Table Create Table
m1 CREATE TEMPORARY TABLE `m1` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO m1 VALUES (511, 521);
SELECT * FROM m1;
c1 c2
111 121
211 221
212 222
213 223
311 321
411 421
511 521
#
ALTER TABLE m1 ENGINE=MRG_MyISAM UNION=(t1,t2)
INSERT_METHOD=LAST;
SELECT * FROM m1;
c1 c2
111 121
211 221
212 222
213 223
SELECT * FROM t1;
c1 c2
111 121
SELECT * FROM t2;
c1 c2
211 221
212 222
213 223
#
CREATE TEMPORARY TABLE t1 (c1 INT, c2 INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (611, 621);
SELECT * FROM m1;
c1 c2
611 621
211 221
212 222
213 223
DROP TABLE t1;
SELECT * FROM m1;
c1 c2
111 121
211 221
212 222
213 223
#
#
SHOW CREATE TABLE m1;
Table Create Table
m1 CREATE TEMPORARY TABLE `m1` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
#
CREATE TABLE m2 SELECT * FROM m1;
SHOW CREATE TABLE m2;
Table Create Table
m2 CREATE TABLE `m2` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM m2;
c1 c2
111 121
211 221
212 222
213 223
DROP TABLE m2;
#
CREATE TEMPORARY TABLE m2 SELECT * FROM m1;
SHOW CREATE TABLE m2;
Table Create Table
m2 CREATE TEMPORARY TABLE `m2` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM m2;
c1 c2
111 121
211 221
212 222
213 223
DROP TABLE m2;
#
CREATE TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
INSERT_METHOD=LAST;
SELECT * FROM m2;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
DROP TABLE m2;
#
CREATE TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
INSERT_METHOD=LAST SELECT * FROM m1;
ERROR HY000: 'test.m2' is not BASE TABLE
#
CREATE TEMPORARY TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
INSERT_METHOD=LAST SELECT * FROM m1;
ERROR HY000: 'test.m2' is not BASE TABLE
#
CREATE TABLE m2 LIKE m1;
SHOW CREATE TABLE m2;
Table Create Table
m2 CREATE TABLE `m2` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
SELECT * FROM m2;
c1 c2
111 121
211 221
212 222
213 223
INSERT INTO m2 SELECT * FROM m1;
SELECT * FROM m2;
c1 c2
111 121
211 221
212 222
213 223
111 121
211 221
212 222
213 223
DROP TABLE m2;
#
CREATE TEMPORARY TABLE m2 LIKE m1;
SHOW CREATE TABLE m2;
Table Create Table
m2 CREATE TEMPORARY TABLE `m2` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
SELECT * FROM m2;
c1 c2
111 121
211 221
212 222
213 223
111 121
211 221
212 222
213 223
INSERT INTO m2 SELECT * FROM m1;
SELECT * FROM m2;
c1 c2
111 121
211 221
212 222
213 223
111 121
211 221
212 222
213 223
111 121
211 221
212 222
213 223
111 121
211 221
212 222
213 223
DROP TABLE m2;
#
CREATE TEMPORARY TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
INSERT_METHOD=LAST;
INSERT INTO m2 SELECT * FROM m1;
SELECT * FROM m2;
c1 c2
311 321
411 421
111 121
211 221
212 222
213 223
111 121
211 221
212 222
213 223
111 121
211 221
212 222
213 223
111 121
211 221
212 222
213 223
#
#
LOCK TABLE m1 WRITE, m2 WRITE;
SELECT * FROM m1,m2 WHERE m1.c1=m2.c1;
c1 c2 c1 c2
111 121 111 121
111 121 111 121
111 121 111 121
111 121 111 121
211 221 211 221
211 221 211 221
211 221 211 221
211 221 211 221
212 222 212 222
212 222 212 222
212 222 212 222
212 222 212 222
213 223 213 223
213 223 213 223
213 223 213 223
213 223 213 223
111 121 111 121
111 121 111 121
111 121 111 121
111 121 111 121
211 221 211 221
211 221 211 221
211 221 211 221
211 221 211 221
212 222 212 222
212 222 212 222
212 222 212 222
212 222 212 222
213 223 213 223
213 223 213 223
213 223 213 223
213 223 213 223
111 121 111 121
111 121 111 121
111 121 111 121
111 121 111 121
211 221 211 221
211 221 211 221
211 221 211 221
211 221 211 221
212 222 212 222
212 222 212 222
212 222 212 222
212 222 212 222
213 223 213 223
213 223 213 223
213 223 213 223
213 223 213 223
111 121 111 121
111 121 111 121
111 121 111 121
111 121 111 121
211 221 211 221
211 221 211 221
211 221 211 221
211 221 211 221
212 222 212 222
212 222 212 222
212 222 212 222
212 222 212 222
213 223 213 223
213 223 213 223
213 223 213 223
213 223 213 223
UNLOCK TABLES;
DROP TABLE t1, t2, t3, t4, m1, m2;
#
# Bug#36171 - CREATE TEMPORARY TABLE and MERGE engine
# More tests with TEMPORARY MERGE table and permanent children.
# (continued) Now the same with locked table.
#
CREATE TABLE t1 (c1 INT, c2 INT) ENGINE=MyISAM;
CREATE TABLE t2 (c1 INT, c2 INT) ENGINE=MyISAM;
CREATE TEMPORARY TABLE m1 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
INSERT_METHOD=LAST;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE TABLE m1;
Table Create Table
m1 CREATE TEMPORARY TABLE `m1` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
SELECT * FROM m1;
c1 c2
INSERT INTO t1 VALUES (111, 121);
INSERT INTO m1 VALUES (211, 221);
SELECT * FROM m1;
c1 c2
111 121
211 221
SELECT * FROM t1;
c1 c2
111 121
SELECT * FROM t2;
c1 c2
211 221
#
LOCK TABLE m1 WRITE, t1 WRITE, t2 WRITE;
#
ALTER TABLE m1 RENAME m2;
SHOW CREATE TABLE m2;
Table Create Table
m2 CREATE TEMPORARY TABLE `m2` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
SELECT * FROM m2;
c1 c2
111 121
211 221
#
CREATE TEMPORARY TABLE m1 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
INSERT_METHOD=LAST;
ALTER TABLE m2 RENAME m1;
ERROR 42S01: Table 'm1' already exists
DROP TABLE m1;
ALTER TABLE m2 RENAME m1;
SHOW CREATE TABLE m1;
Table Create Table
m1 CREATE TEMPORARY TABLE `m1` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
SELECT * FROM m1;
c1 c2
111 121
211 221
#
ALTER TABLE m1 ADD COLUMN c3 INT;
INSERT INTO m1 VALUES (212, 222, 232);
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
SELECT * FROM m1;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
ALTER TABLE t1 ADD COLUMN c3 INT;
ALTER TABLE t2 ADD COLUMN c3 INT;
INSERT INTO m1 VALUES (212, 222, 232);
SELECT * FROM m1;
c1 c2 c3
111 121 NULL
211 221 NULL
212 222 232
#
ALTER TABLE m1 DROP COLUMN c3;
INSERT INTO m1 VALUES (213, 223);
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
SELECT * FROM m1;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
ALTER TABLE t1 DROP COLUMN c3;
ALTER TABLE t2 DROP COLUMN c3;
INSERT INTO m1 VALUES (213, 223);
SELECT * FROM m1;
c1 c2
111 121
211 221
212 222
213 223
#
UNLOCK TABLES;
CREATE TABLE t3 (c1 INT, c2 INT) ENGINE=MyISAM;
ALTER TABLE m1 UNION=(t1,t2,t3);
LOCK TABLE m1 WRITE;
INSERT INTO m1 VALUES (311, 321);
SELECT * FROM m1;
c1 c2
111 121
211 221
212 222
213 223
311 321
SELECT * FROM t1;
c1 c2
111 121
SELECT * FROM t2;
c1 c2
211 221
212 222
213 223
SELECT * FROM t3;
c1 c2
311 321
#
CREATE TEMPORARY TABLE t4 (c1 INT, c2 INT) ENGINE=MyISAM;
ALTER TABLE m1 UNION=(t1,t2,t3,t4);
INSERT INTO m1 VALUES (411, 421);
SELECT * FROM m1;
c1 c2
111 121
211 221
212 222
213 223
311 321
411 421
SELECT * FROM t1;
c1 c2
111 121
SELECT * FROM t2;
c1 c2
211 221
212 222
213 223
SELECT * FROM t3;
c1 c2
311 321
SELECT * FROM t4;
c1 c2
411 421
#
ALTER TABLE m1 ENGINE=MyISAM;
SHOW CREATE TABLE m1;
Table Create Table
m1 CREATE TEMPORARY TABLE `m1` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO m1 VALUES (511, 521);
SELECT * FROM m1;
c1 c2
111 121
211 221
212 222
213 223
311 321
411 421
511 521
#
ALTER TABLE m1 ENGINE=MRG_MyISAM UNION=(t1,t2)
INSERT_METHOD=LAST;
SELECT * FROM m1;
c1 c2
111 121
211 221
212 222
213 223
SELECT * FROM t1;
c1 c2
111 121
SELECT * FROM t2;
c1 c2
211 221
212 222
213 223
#
CREATE TEMPORARY TABLE t1 (c1 INT, c2 INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (611, 621);
SELECT * FROM m1;
c1 c2
611 621
211 221
212 222
213 223
DROP TABLE t1;
SELECT * FROM m1;
c1 c2
111 121
211 221
212 222
213 223
#
#
SHOW CREATE TABLE m1;
Table Create Table
m1 CREATE TEMPORARY TABLE `m1` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
CREATE TABLE m2 SELECT * FROM m1;
ERROR HY000: Table 'm2' was not locked with LOCK TABLES
#
CREATE TEMPORARY TABLE m2 SELECT * FROM m1;
SHOW CREATE TABLE m2;
Table Create Table
m2 CREATE TEMPORARY TABLE `m2` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM m2;
c1 c2
111 121
211 221
212 222
213 223
DROP TABLE m2;
#
CREATE TEMPORARY TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
INSERT_METHOD=LAST;
SELECT * FROM m2;
c1 c2
311 321
411 421
LOCK TABLE m1 WRITE, m2 WRITE;
UNLOCK TABLES;
DROP TABLE m2;
LOCK TABLE m1 WRITE;
#
# ER_TABLE_NOT_LOCKED is returned in ps-protocol
CREATE TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
INSERT_METHOD=LAST SELECT * FROM m1;
Got one of the listed errors
#
CREATE TEMPORARY TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
INSERT_METHOD=LAST SELECT * FROM m1;
ERROR HY000: 'test.m2' is not BASE TABLE
#
CREATE TEMPORARY TABLE m2 LIKE m1;
SHOW CREATE TABLE m2;
Table Create Table
m2 CREATE TEMPORARY TABLE `m2` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
LOCK TABLE m1 WRITE, m2 WRITE;
SHOW CREATE TABLE m2;
Table Create Table
m2 CREATE TEMPORARY TABLE `m2` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
SELECT * FROM m2;
c1 c2
111 121
211 221
212 222
213 223
INSERT INTO m2 SELECT * FROM m1;
SELECT * FROM m2;
c1 c2
111 121
211 221
212 222
213 223
111 121
211 221
212 222
213 223
DROP TABLE m2;
#
CREATE TEMPORARY TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
INSERT_METHOD=LAST;
LOCK TABLE m1 WRITE, m2 WRITE;
INSERT INTO m2 SELECT * FROM m1;
SELECT * FROM m2;
c1 c2
311 321
411 421
111 121
211 221
212 222
213 223
111 121
211 221
212 222
213 223
#
UNLOCK TABLES;
DROP TABLE t1, t2, t3, t4, m1, m2;
#
# Bug47098 assert in MDL_context::destroy on HANDLER
# <damaged merge table> OPEN
#
@ -2745,4 +3473,106 @@ m2 CREATE TABLE `m2` (
`i` int(11) DEFAULT NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`t1`)
drop tables m1, m2, t1;
#
# Test case for Bug#54811 "Assert in mysql_lock_have_duplicate()"
# Check that unique_table() works correctly for merge tables.
#
drop table if exists t1, t2, t3, m1, m2;
create table t1 (a int);
create table t2 (a int);
create table t3 (b int);
create view v1 as select * from t3,t1;
create table m1 (a int) engine=merge union (t1, t2) insert_method=last;
create table m2 (a int) engine=merge union (t1, t2) insert_method=first;
create temporary table tmp (b int);
insert into tmp (b) values (1);
insert into t1 (a) values (1);
insert into t3 (b) values (1);
insert into m1 (a) values ((select max(a) from m1));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
insert into m1 (a) values ((select max(a) from m2));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
insert into m1 (a) values ((select max(a) from t1));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
insert into m1 (a) values ((select max(a) from t2));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
insert into m1 (a) values ((select max(a) from t3, m1));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
insert into m1 (a) values ((select max(a) from t3, m2));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
insert into m1 (a) values ((select max(a) from t3, t1));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
insert into m1 (a) values ((select max(a) from t3, t2));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
insert into m1 (a) values ((select max(a) from tmp, m1));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
insert into m1 (a) values ((select max(a) from tmp, m2));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
insert into m1 (a) values ((select max(a) from tmp, t1));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
insert into m1 (a) values ((select max(a) from tmp, t2));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
insert into m1 (a) values ((select max(a) from v1));
ERROR HY000: The definition of table 'v1' prevents operation INSERT on table 'm1'.
insert into m1 (a) values ((select max(a) from tmp, v1));
ERROR HY000: The definition of table 'v1' prevents operation INSERT on table 'm1'.
update m1 set a = ((select max(a) from m1));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
update m1 set a = ((select max(a) from m2));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
update m1 set a = ((select max(a) from t1));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
update m1 set a = ((select max(a) from t2));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
update m1 set a = ((select max(a) from t3, m1));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
update m1 set a = ((select max(a) from t3, m2));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
update m1 set a = ((select max(a) from t3, t1));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
update m1 set a = ((select max(a) from t3, t2));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
update m1 set a = ((select max(a) from tmp, m1));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
update m1 set a = ((select max(a) from tmp, m2));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
update m1 set a = ((select max(a) from tmp, t1));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
update m1 set a = ((select max(a) from tmp, t2));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
update m1 set a = ((select max(a) from v1));
ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 'm1'.
update m1 set a = ((select max(a) from tmp, v1));
ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 'm1'.
delete from m1 where a = (select max(a) from m1);
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
delete from m1 where a = (select max(a) from m2);
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
delete from m1 where a = (select max(a) from t1);
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
delete from m1 where a = (select max(a) from t2);
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
delete from m1 where a = (select max(a) from t3, m1);
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
delete from m1 where a = (select max(a) from t3, m2);
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
delete from m1 where a = (select max(a) from t3, t1);
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
delete from m1 where a = (select max(a) from t3, t2);
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
delete from m1 where a = (select max(a) from tmp, m1);
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
delete from m1 where a = (select max(a) from tmp, m2);
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
delete from m1 where a = (select max(a) from tmp, t1);
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
delete from m1 where a = (select max(a) from tmp, t2);
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
delete from m1 where a = (select max(a) from v1);
ERROR HY000: The definition of table 'v1' prevents operation DELETE on table 'm1'.
delete from m1 where a = (select max(a) from tmp, v1);
ERROR HY000: The definition of table 'v1' prevents operation DELETE on table 'm1'.
drop view v1;
drop temporary table tmp;
drop table t1, t2, t3, m1, m2;
End of 6.0 tests

View File

@ -0,0 +1,190 @@
SET GLOBAL storage_engine = MyISAM;
SET SESSION storage_engine = MyISAM;
DROP TABLE IF EXISTS t1, t2, m1, m2;
CREATE TABLE t1 (c1 INT);
CREATE TABLE t2 (c1 INT);
CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
INSERT_METHOD=LAST;
CREATE TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
INSERT_METHOD=LAST;
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (2), (3), (4);
INSERT INTO m2 SELECT * FROM m1;
SELECT * FROM m2;
c1
1
2
3
4
1
2
3
4
SELECT * FROM t2;
c1
2
3
4
1
2
3
4
DROP TABLE m2, m1, t2, t1;
CREATE TABLE t1 (c1 INT);
CREATE TABLE t2 (c1 INT);
CREATE TEMPORARY TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
INSERT_METHOD=LAST;
CREATE TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
INSERT_METHOD=LAST;
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (2), (3), (4);
INSERT INTO m2 SELECT * FROM m1;
SELECT * FROM m2;
c1
1
2
3
4
1
2
3
4
DROP TABLE m2, m1, t2, t1;
CREATE TABLE t1 (c1 INT);
CREATE TABLE t2 (c1 INT);
CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
INSERT_METHOD=LAST;
CREATE TEMPORARY TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
INSERT_METHOD=LAST;
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (2), (3), (4);
INSERT INTO m2 SELECT * FROM m1;
SELECT * FROM m2;
c1
1
2
3
4
1
2
3
4
DROP TABLE m2, m1, t2, t1;
CREATE TABLE t1 (c1 INT);
CREATE TABLE t2 (c1 INT);
CREATE TEMPORARY TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
INSERT_METHOD=LAST;
CREATE TEMPORARY TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
INSERT_METHOD=LAST;
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (2), (3), (4);
INSERT INTO m2 SELECT * FROM m1;
SELECT * FROM m2;
c1
1
2
3
4
1
2
3
4
DROP TABLE m2, m1, t2, t1;
CREATE TABLE t1 (c1 INT);
CREATE TABLE t2 (c1 INT);
CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
INSERT_METHOD=LAST;
CREATE TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
INSERT_METHOD=LAST;
LOCK TABLE m1 WRITE, m2 WRITE;
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (2), (3), (4);
INSERT INTO m2 SELECT * FROM m1;
SELECT * FROM m2;
c1
1
2
3
4
1
2
3
4
SELECT * FROM t2;
c1
2
3
4
1
2
3
4
UNLOCK TABLES;
DROP TABLE m2, m1, t2, t1;
CREATE TABLE t1 (c1 INT);
CREATE TABLE t2 (c1 INT);
CREATE TEMPORARY TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
INSERT_METHOD=LAST;
CREATE TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
INSERT_METHOD=LAST;
LOCK TABLE m1 WRITE, m2 WRITE;
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (2), (3), (4);
INSERT INTO m2 SELECT * FROM m1;
SELECT * FROM m2;
c1
1
2
3
4
1
2
3
4
UNLOCK TABLES;
DROP TABLE m2, m1, t2, t1;
CREATE TABLE t1 (c1 INT);
CREATE TABLE t2 (c1 INT);
CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
INSERT_METHOD=LAST;
CREATE TEMPORARY TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
INSERT_METHOD=LAST;
LOCK TABLE m1 WRITE, m2 WRITE;
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (2), (3), (4);
INSERT INTO m2 SELECT * FROM m1;
SELECT * FROM m2;
c1
1
2
3
4
1
2
3
4
UNLOCK TABLES;
DROP TABLE m2, m1, t2, t1;
CREATE TABLE t1 (c1 INT);
CREATE TABLE t2 (c1 INT);
CREATE TEMPORARY TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
INSERT_METHOD=LAST;
CREATE TEMPORARY TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
INSERT_METHOD=LAST;
LOCK TABLE m1 WRITE, m2 WRITE;
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (2), (3), (4);
INSERT INTO m2 SELECT * FROM m1;
SELECT * FROM m2;
c1
1
2
3
4
1
2
3
4
UNLOCK TABLES;
DROP TABLE m2, m1, t2, t1;
End of 6.0 tests

View File

@ -0,0 +1,32 @@
#
# Bug#55672 mysql_upgrade dies with internal error
#
mtr.global_suppressions OK
mtr.test_suppressions OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
mysql.general_log
Error : You can't use locks with log tables.
status : OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.servers OK
mysql.slow_log
Error : You can't use locks with log tables.
status : OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK

View File

@ -325,6 +325,7 @@ outer=2 ifval=0
outer=1 ifval=1
here is the sourced script
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
here is the sourced script
@ -392,6 +393,9 @@ true-inner again
true-outer
Counter is greater than 0, (counter=10)
Counter is not 0, (counter=0)
Counter is true, (counter=alpha)
Beta is true
while with string, only once
1
Testing while with not
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest_while.inc": At line 64: Nesting too deeply
@ -446,7 +450,6 @@ OK
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 2: Connection test_con1 already exists
connect(localhost,root,,test,MASTER_PORT,MASTER_SOCKET);
show tables;
ERROR 3D000: No database selected
Output from mysqltest-x.inc
@ -572,7 +575,7 @@ if things work as expected
Some data
for cat_file command
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 'from_file' to command 'copy_file'
mysqltest: At line 1: Missing required argument 'to_file' to command 'copy_file'

View File

@ -21,23 +21,17 @@ Table Op Msg_type Msg_text
test.t1 repair Error Unknown storage engine 'partition'
test.t1 repair error Corrupt
ALTER TABLE t1 REPAIR PARTITION ALL;
Table Op Msg_type Msg_text
test.t1 repair Error Unknown storage engine 'partition'
test.t1 repair error Corrupt
ERROR HY000: The 'partitioning' feature is disabled; you need MySQL built with '--with-plugin-partition' to have it working
ALTER TABLE t1 CHECK PARTITION ALL;
Table Op Msg_type Msg_text
test.t1 check Error Unknown storage engine 'partition'
test.t1 check error Corrupt
ERROR HY000: The 'partitioning' feature is disabled; you need MySQL built with '--with-plugin-partition' to have it working
ALTER TABLE t1 OPTIMIZE PARTITION ALL;
Table Op Msg_type Msg_text
test.t1 optimize Error Unknown storage engine 'partition'
test.t1 optimize error Corrupt
ERROR HY000: The 'partitioning' feature is disabled; you need MySQL built with '--with-plugin-partition' to have it working
ALTER TABLE t1 ANALYZE PARTITION ALL;
Table Op Msg_type Msg_text
test.t1 analyze Error Unknown storage engine 'partition'
test.t1 analyze error Corrupt
ERROR HY000: The 'partitioning' feature is disabled; you need MySQL built with '--with-plugin-partition' to have it working
ALTER TABLE t1 REBUILD PARTITION ALL;
ERROR 42000: Unknown storage engine 'partition'
ALTER TABLE t1 TRUNCATE PARTITION ALL;
ERROR HY000: The 'partitioning' feature is disabled; you need MySQL built with '--with-plugin-partition' to have it working
ALTER TABLE t1 ENGINE Memory;
ERROR 42000: Unknown storage engine 'partition'
ALTER TABLE t1 ADD (new INT);

View File

@ -47,7 +47,7 @@ ENGINE = MYISAM
PARTITION p1 VALUES LESS THAN (20),
PARTITION p2 VALUES LESS THAN (100),
PARTITION p3 VALUES LESS THAN MAXVALUE ) */;
SET DEBUG_SYNC= 'open_tables_acquire_upgradable_mdl SIGNAL removing_partitions WAIT_FOR waiting_for_alter';
SET DEBUG_SYNC= 'alter_table_before_open_tables SIGNAL removing_partitions WAIT_FOR waiting_for_alter';
SET DEBUG_SYNC= 'alter_table_before_rename_result_table WAIT_FOR delete_done';
ALTER TABLE t2 REMOVE PARTITIONING;
# Con default

View File

@ -3,7 +3,7 @@ FLUSH TABLES;
SELECT * FROM t1;
ERROR HY000: The MySQL server is running with the --skip-partition option so it cannot execute this statement
TRUNCATE TABLE t1;
ERROR HY000: The MySQL server is running with the --skip-partition option so it cannot execute this statement
ERROR 42S02: Table 'test.t1' doesn't exist
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze Error The MySQL server is running with the --skip-partition option so it cannot execute this statement

View File

@ -1,5 +1,67 @@
drop table if exists t1, t2;
#
# Bug#50418: DROP PARTITION does not interact with transactions
#
CREATE TABLE t1 (
id INT AUTO_INCREMENT NOT NULL,
name CHAR(50) NOT NULL,
myDate DATE NOT NULL,
PRIMARY KEY (id, myDate),
INDEX idx_date (myDate)
) ENGINE=InnoDB
PARTITION BY RANGE ( TO_DAYS(myDate) ) (
PARTITION p0 VALUES LESS THAN (734028),
PARTITION p1 VALUES LESS THAN (734029),
PARTITION p2 VALUES LESS THAN (734030),
PARTITION p3 VALUES LESS THAN MAXVALUE
) ;
INSERT INTO t1 VALUES
(NULL, 'Lachlan', '2009-09-13'),
(NULL, 'Clint', '2009-09-13'),
(NULL, 'John', '2009-09-14'),
(NULL, 'Dave', '2009-09-14'),
(NULL, 'Jeremy', '2009-09-15'),
(NULL, 'Scott', '2009-09-15'),
(NULL, 'Jeff', '2009-09-16'),
(NULL, 'Joe', '2009-09-16');
SET AUTOCOMMIT=0;
SELECT * FROM t1 FOR UPDATE;
id name myDate
1 Lachlan 2009-09-13
2 Clint 2009-09-13
3 John 2009-09-14
4 Dave 2009-09-14
5 Jeremy 2009-09-15
6 Scott 2009-09-15
7 Jeff 2009-09-16
8 Joe 2009-09-16
UPDATE t1 SET name = 'Mattias' WHERE id = 7;
SELECT * FROM t1 WHERE id = 7;
id name myDate
7 Mattias 2009-09-16
# Connection con1
SET lock_wait_timeout = 1;
# After the patch it will wait and fail on timeout.
ALTER TABLE t1 DROP PARTITION p3;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SHOW WARNINGS;
Level Code Message
Error 1205 Lock wait timeout exceeded; try restarting transaction
# Connection default
SELECT * FROM t1;
id name myDate
1 Lachlan 2009-09-13
2 Clint 2009-09-13
3 John 2009-09-14
4 Dave 2009-09-14
5 Jeremy 2009-09-15
6 Scott 2009-09-15
7 Mattias 2009-09-16
8 Joe 2009-09-16
# No changes.
COMMIT;
DROP TABLE t1;
#
# Bug#51830: Incorrect partition pruning on range partition (regression)
#
CREATE TABLE t1 (a INT NOT NULL)

View File

@ -16,3 +16,11 @@ subpartitions 1
alter table t1 truncate partition sp1;
ERROR HY000: Incorrect partition name
drop table t1;
create table t1 (a int);
insert into t1 values (1), (3), (8);
alter table t1 truncate partition p0;
ERROR HY000: Partition management on a not partitioned table is not possible
select count(*) from t1;
count(*)
3
drop table t1;

View File

@ -16,19 +16,21 @@ drop schema foo;
# Bug #48940 MDL deadlocks against mysql_rm_db
#
DROP SCHEMA IF EXISTS schema1;
DROP SCHEMA IF EXISTS schema2;
# Connection default
CREATE SCHEMA schema1;
CREATE SCHEMA schema2;
CREATE TABLE schema1.t1 (a INT);
SET autocommit= FALSE;
INSERT INTO schema1.t1 VALUES (1);
# Connection 2
DROP SCHEMA schema1;
# Connection default
ALTER SCHEMA schema1 DEFAULT CHARACTER SET utf8;
Got one of the listed errors
ALTER SCHEMA schema2 DEFAULT CHARACTER SET utf8;
SET autocommit= TRUE;
# Connection 2
# Connection default
DROP SCHEMA schema2;
#
# Bug #49988 MDL deadlocks with mysql_create_db, reload_acl_and_cache
#
@ -48,3 +50,48 @@ ERROR HY000: Can't execute the given command because you have active locked tabl
UNLOCK TABLES;
# Connection con2
# Connection default
#
# Bug#54360 Deadlock DROP/ALTER/CREATE DATABASE with open HANDLER
#
CREATE DATABASE db1;
CREATE TABLE db1.t1 (a INT);
INSERT INTO db1.t1 VALUES (1), (2);
# Connection con1
HANDLER db1.t1 OPEN;
# Connection default
# Sending:
DROP DATABASE db1;
# Connection con2
# Connection con1
CREATE DATABASE db2;
ALTER DATABASE db2 DEFAULT CHARACTER SET utf8;
DROP DATABASE db2;
HANDLER t1 CLOSE;
# Connection default
# Reaping: DROP DATABASE db1
#
# Tests for increased CREATE/ALTER/DROP DATABASE concurrency with
# database name locks.
#
DROP DATABASE IF EXISTS db1;
DROP DATABASE IF EXISTS db2;
# Connection default
CREATE DATABASE db1;
CREATE TABLE db1.t1 (id INT);
START TRANSACTION;
INSERT INTO db1.t1 VALUES (1);
# Connection 2
# DROP DATABASE should block due to the active transaction
# Sending:
DROP DATABASE db1;
# Connection 3
# But it should still be possible to CREATE/ALTER/DROP other databases.
CREATE DATABASE db2;
ALTER DATABASE db2 DEFAULT CHARACTER SET utf8;
DROP DATABASE db2;
# Connection default
# End the transaction so DROP DATABASE db1 can continue
COMMIT;
# Connection 2
# Reaping: DROP DATABASE db1
# Connection default;

View File

@ -1466,3 +1466,51 @@ t1 CREATE TABLE `t1` (
# Switching to connection 'default'.
UNLOCK TABLES;
DROP TABLE t1;
#
# Bug#54905 Connection with WRITE lock cannot ALTER table due to
# concurrent SHOW CREATE
#
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT);
# Connection con1
LOCK TABLE t1 WRITE;
# Connection default
START TRANSACTION;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
# Connection con1
ALTER TABLE t1 CHARACTER SET = utf8;
UNLOCK TABLES;
# Connection default
COMMIT;
DROP TABLE t1;
#
# Bug#55498 SHOW CREATE TRIGGER takes wrong type of metadata lock.
#
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a INT);
CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a = 1;
# Test 1: SHOW CREATE TRIGGER with WRITE locked table.
# Connection con1
LOCK TABLE t1 WRITE;
# Connection default
SHOW CREATE TRIGGER t1_bi;
Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a = 1 utf8 utf8_general_ci latin1_swedish_ci
# Connection con1
UNLOCK TABLES;
# Test 2: ALTER TABLE with SHOW CREATE TRIGGER in transaction
# Connection default
START TRANSACTION;
SHOW CREATE TRIGGER t1_bi;
Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a = 1 utf8 utf8_general_ci latin1_swedish_ci
# Connection con1
ALTER TABLE t1 CHARACTER SET = utf8;
# Connection default
COMMIT;
DROP TRIGGER t1_bi;
DROP TABLE t1;

View File

@ -1189,6 +1189,8 @@ end $$
call test_signal() $$
Caught by SQLSTATE
Caught by SQLSTATE
Warnings:
Warning 1012 Raising a warning
drop procedure test_signal $$
create procedure test_signal()
begin
@ -1204,6 +1206,8 @@ end $$
call test_signal() $$
Caught by number
Caught by number
Warnings:
Warning 1012 Raising a warning
drop procedure test_signal $$
create procedure test_signal()
begin
@ -1219,6 +1223,8 @@ end $$
call test_signal() $$
Caught by SQLWARNING
Caught by SQLWARNING
Warnings:
Warning 1012 Raising a warning
drop procedure test_signal $$
create procedure test_signal()
begin
@ -1234,6 +1240,8 @@ end $$
call test_signal() $$
Caught by SQLSTATE
Caught by SQLSTATE
Warnings:
Error 1012 Raising a not found
drop procedure test_signal $$
create procedure test_signal()
begin
@ -1249,6 +1257,8 @@ end $$
call test_signal() $$
Caught by number
Caught by number
Warnings:
Error 1012 Raising a not found
drop procedure test_signal $$
create procedure test_signal()
begin
@ -1264,6 +1274,8 @@ end $$
call test_signal() $$
Caught by NOT FOUND
Caught by NOT FOUND
Warnings:
Error 1012 Raising a not found
drop procedure test_signal $$
create procedure test_signal()
begin
@ -1279,6 +1291,8 @@ end $$
call test_signal() $$
Caught by SQLSTATE
Caught by SQLSTATE
Warnings:
Error 1012 Raising an error
drop procedure test_signal $$
create procedure test_signal()
begin
@ -1294,6 +1308,8 @@ end $$
call test_signal() $$
Caught by number
Caught by number
Warnings:
Error 1012 Raising an error
drop procedure test_signal $$
create procedure test_signal()
begin
@ -1309,6 +1325,8 @@ end $$
call test_signal() $$
Caught by SQLEXCEPTION
Caught by SQLEXCEPTION
Warnings:
Error 1012 Raising an error
drop procedure test_signal $$
#
# Test where SIGNAL can be used
@ -1455,6 +1473,7 @@ after RESIGNAL
after RESIGNAL
Warnings:
Warning 1012 Raising a warning
Warning 1012 Raising a warning
drop procedure test_resignal $$
create procedure test_resignal()
begin
@ -1509,6 +1528,7 @@ after RESIGNAL
after RESIGNAL
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Warning 1264 Out of range value for column 'a' at row 1
drop procedure test_resignal $$
create procedure test_resignal()
begin
@ -1565,6 +1585,7 @@ before RESIGNAL
after RESIGNAL
after RESIGNAL
Warnings:
Warning 1012 Raising a warning
Warning 5555 RESIGNAL of a warning
drop procedure test_resignal $$
create procedure test_resignal()
@ -1625,6 +1646,7 @@ before RESIGNAL
after RESIGNAL
after RESIGNAL
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Warning 5555 RESIGNAL of a warning
drop procedure test_resignal $$
create procedure test_resignal()
@ -2126,6 +2148,9 @@ CALL peter_p2() $$
ERROR 42000: Hi, I am a useless error message
show warnings $$
Level Code Message
Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL'
Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL'
Error 9999 Variable 'sql_mode' can't be set to the value of 'NULL'
Error 9999 Hi, I am a useless error message
drop procedure peter_p1 $$
drop procedure peter_p2 $$
@ -2135,15 +2160,17 @@ DECLARE x CONDITION FOR SQLSTATE '42000';
DECLARE EXIT HANDLER FOR x
BEGIN
SELECT '2';
SHOW WARNINGS;
RESIGNAL x SET MYSQL_ERRNO = 9999;
END;
BEGIN
DECLARE EXIT HANDLER FOR x
BEGIN
SELECT '1';
SHOW WARNINGS;
RESIGNAL x SET
SCHEMA_NAME = 'test',
MYSQL_ERRNO= 1231;
MYSQL_ERRNO= 1232;
END;
/* Raises ER_WRONG_VALUE_FOR_VAR : 1231, SQLSTATE 42000 */
SET @@sql_mode=NULL;
@ -2156,6 +2183,7 @@ DECLARE x CONDITION for SQLSTATE '42000';
DECLARE EXIT HANDLER FOR x
BEGIN
SELECT '3';
SHOW WARNINGS;
RESIGNAL x SET
MESSAGE_TEXT = 'Hi, I am a useless error message',
MYSQL_ERRNO = 9999;
@ -2166,15 +2194,24 @@ $$
CALL peter_p2() $$
1
1
Level Code Message
Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL'
2
2
Level Code Message
Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL'
Error 1232 Variable 'sql_mode' can't be set to the value of 'NULL'
3
3
Level Code Message
Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL'
Error 1232 Variable 'sql_mode' can't be set to the value of 'NULL'
Error 9999 Variable 'sql_mode' can't be set to the value of 'NULL'
ERROR 42000: Hi, I am a useless error message
show warnings $$
Level Code Message
Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL'
Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL'
Error 1232 Variable 'sql_mode' can't be set to the value of 'NULL'
Error 9999 Variable 'sql_mode' can't be set to the value of 'NULL'
Error 9999 Hi, I am a useless error message
drop procedure peter_p1 $$

View File

@ -95,11 +95,11 @@ call proc_1();
ERROR 45000: Oops in proc_1
show warnings;
Level Code Message
Error 1644 Oops in proc_5
Error 1644 Oops in proc_4
Error 1644 Oops in proc_3
Error 1644 Oops in proc_2
Error 1644 Oops in proc_1
Error 1051 Unknown table 'oops_it_is_not_here'
Error 1644 Oops in proc_9
Error 1644 Oops in proc_8
Error 1644 Oops in proc_7
Error 1644 Oops in proc_6
SET @@session.max_error_count = 7;
SELECT @@session.max_error_count;
@@session.max_error_count
@ -108,13 +108,13 @@ call proc_1();
ERROR 45000: Oops in proc_1
show warnings;
Level Code Message
Error 1051 Unknown table 'oops_it_is_not_here'
Error 1644 Oops in proc_9
Error 1644 Oops in proc_8
Error 1644 Oops in proc_7
Error 1644 Oops in proc_6
Error 1644 Oops in proc_5
Error 1644 Oops in proc_4
Error 1644 Oops in proc_3
Error 1644 Oops in proc_2
Error 1644 Oops in proc_1
SET @@session.max_error_count = 9;
SELECT @@session.max_error_count;
@@session.max_error_count
@ -123,6 +123,7 @@ call proc_1();
ERROR 45000: Oops in proc_1
show warnings;
Level Code Message
Error 1051 Unknown table 'oops_it_is_not_here'
Error 1644 Oops in proc_9
Error 1644 Oops in proc_8
Error 1644 Oops in proc_7
@ -131,7 +132,6 @@ Error 1644 Oops in proc_5
Error 1644 Oops in proc_4
Error 1644 Oops in proc_3
Error 1644 Oops in proc_2
Error 1644 Oops in proc_1
drop database demo;
SET @@global.max_error_count = @start_global_value;
SELECT @@global.max_error_count;

View File

@ -46,6 +46,8 @@ end while;
close cur1;
end|
call p1();
Warnings:
Error 1329 No data - zero rows fetched, selected, or processed
select count(*) from t1;
count(*)
256

View File

@ -43,6 +43,8 @@ END|
SELECT f2 ();
f2 ()
NULL
Warnings:
Error 1305 FUNCTION testdb.f_not_exists does not exist
DROP SCHEMA testdb;
USE test;
#

View File

@ -711,6 +711,8 @@ looping i
looping 1
looping i
looping 0
Warnings:
Error 1062 Duplicate entry '1' for key 'a'
call proc_26977_works(2);
do something
do something
@ -730,6 +732,8 @@ looping i
looping 0
optimizer: keep hreturn
optimizer: keep hreturn
Warnings:
Error 1062 Duplicate entry '2' for key 'a'
drop table t1;
drop procedure proc_26977_broken;
drop procedure proc_26977_works;
@ -888,3 +892,56 @@ Pos Instruction
4 jump 6
5 error 1339
DROP PROCEDURE p1;
#
# Bug#23032: Handlers declared in a SP do not handle warnings generated in sub-SP
#
# - Case 4: check that "No Data trumps Warning".
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1), (2), (3);
CREATE PROCEDURE p1()
BEGIN
DECLARE c CURSOR FOR SELECT a FROM t1;
OPEN c;
BEGIN
DECLARE v INT;
DECLARE CONTINUE HANDLER FOR SQLWARNING
BEGIN
SELECT "Warning found!";
SHOW WARNINGS;
END;
DECLARE EXIT HANDLER FOR NOT FOUND
BEGIN
SELECT "End of Result Set found!";
SHOW WARNINGS;
END;
WHILE TRUE DO
FETCH c INTO v;
END WHILE;
END;
CLOSE c;
SELECT a INTO @foo FROM t1 LIMIT 1; # Clear warning stack
END|
SET SESSION debug="+d,bug23032_emit_warning";
CALL p1();
Warning found!
Warning found!
Level Code Message
Warning 1105 Unknown error
Warning found!
Warning found!
Level Code Message
Warning 1105 Unknown error
Warning found!
Warning found!
Level Code Message
Warning 1105 Unknown error
End of Result Set found!
End of Result Set found!
Level Code Message
Warning 1105 Unknown error
Error 1329 No data - zero rows fetched, selected, or processed
SET SESSION debug="-d,bug23032_emit_warning";
DROP PROCEDURE p1;
DROP TABLE t1;

View File

@ -1344,6 +1344,8 @@ set @in_func := 0;
select func_20713_a();
func_20713_a()
NULL
Warnings:
Error 1146 Table 'test.bogus_table_20713' doesn't exist
select @in_func;
@in_func
2
@ -1351,6 +1353,8 @@ set @in_func := 0;
select func_20713_b();
func_20713_b()
NULL
Warnings:
Error 1146 Table 'test.bogus_table_20713' doesn't exist
select @in_func;
@in_func
2
@ -1714,3 +1718,246 @@ DROP PROCEDURE p1;
DROP VIEW v1;
DROP TABLE t1;
End of 5.1 tests
#
# Bug#23032: Handlers declared in a SP do not handle warnings generated in sub-SP
#
# - Case 1
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p2;
DROP PROCEDURE IF EXISTS p3;
DROP PROCEDURE IF EXISTS p4;
DROP PROCEDURE IF EXISTS p5;
DROP PROCEDURE IF EXISTS p6;
CREATE PROCEDURE p1()
BEGIN
SELECT CAST('10 ' as unsigned integer);
SELECT 1;
CALL p2();
END|
CREATE PROCEDURE p2()
BEGIN
SELECT CAST('10 ' as unsigned integer);
END|
CALL p1();
CAST('10 ' as unsigned integer)
10
1
1
CAST('10 ' as unsigned integer)
10
Warnings:
Warning 1292 Truncated incorrect INTEGER value: '10 '
DROP PROCEDURE p1;
DROP PROCEDURE p2;
# - Case 2
CREATE PROCEDURE p1()
BEGIN
DECLARE c INT DEFAULT 0;
DECLARE CONTINUE HANDLER FOR SQLWARNING SET c = c + 1;
CALL p2();
CALL p3();
CALL p4();
SELECT c;
SELECT @@warning_count;
SHOW WARNINGS;
END|
CREATE PROCEDURE p2()
BEGIN
SELECT CAST('10 ' as unsigned integer);
END|
CREATE PROCEDURE p3()
BEGIN
SELECT CAST('10 ' as unsigned integer);
SELECT 1;
END|
CREATE PROCEDURE p4()
BEGIN
SELECT CAST('10 ' as unsigned integer);
CALL p2();
END|
CREATE PROCEDURE p5()
BEGIN
SELECT CAST('10 ' as unsigned integer);
SHOW WARNINGS;
END|
CREATE PROCEDURE P6()
BEGIN
DECLARE c INT DEFAULT 0;
DECLARE CONTINUE HANDLER FOR SQLWARNING SET c = c + 1;
CALL p5();
SELECT c;
END|
CALL p1();
CAST('10 ' as unsigned integer)
10
CAST('10 ' as unsigned integer)
10
1
1
CAST('10 ' as unsigned integer)
10
CAST('10 ' as unsigned integer)
10
c
3
@@warning_count
1
Level Code Message
Warning 1292 Truncated incorrect INTEGER value: '10 '
Warnings:
Warning 1292 Truncated incorrect INTEGER value: '10 '
CALL p6();
CAST('10 ' as unsigned integer)
10
Level Code Message
Warning 1292 Truncated incorrect INTEGER value: '10 '
c
1
Warnings:
Warning 1292 Truncated incorrect INTEGER value: '10 '
DROP PROCEDURE p1;
DROP PROCEDURE p2;
DROP PROCEDURE p3;
DROP PROCEDURE p4;
DROP PROCEDURE p5;
DROP PROCEDURE p6;
# - Case 3: check that "Exception trumps No Data".
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1), (2), (3);
CREATE PROCEDURE p1()
BEGIN
DECLARE c CURSOR FOR SELECT a FROM t1;
OPEN c;
BEGIN
DECLARE v1 INT;
DECLARE v2 INT;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
SELECT "Error caught (expected)";
DECLARE EXIT HANDLER FOR NOT FOUND
SELECT "End of Result Set found!";
WHILE TRUE DO
FETCH c INTO v1, v2;
END WHILE;
END;
CLOSE c;
SELECT a INTO @foo FROM t1 LIMIT 1; # Clear warning stack
END|
CALL p1();
Error caught (expected)
Error caught (expected)
DROP PROCEDURE p1;
DROP TABLE t1;
#
# Bug#36185: Incorrect precedence for warning and exception handlers
#
DROP TABLE IF EXISTS t1;
DROP PROCEDURE IF EXISTS p1;
CREATE TABLE t1 (a INT, b INT NOT NULL);
CREATE PROCEDURE p1()
BEGIN
DECLARE CONTINUE HANDLER FOR SQLWARNING SELECT 'warning';
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SELECT 'exception';
INSERT INTO t1 VALUES (CAST('10 ' AS SIGNED), NULL);
END|
CALL p1();
exception
exception
Warnings:
Warning 1292 Truncated incorrect INTEGER value: '10 '
Error 1048 Column 'b' cannot be null
DROP TABLE t1;
DROP PROCEDURE p1;
#
# Bug#5889: Exit handler for a warning doesn't hide the warning in trigger
#
# - Case 1
CREATE TABLE t1(a INT, b INT);
INSERT INTO t1 VALUES (1, 2);
CREATE TRIGGER t1_bu BEFORE UPDATE ON t1 FOR EACH ROW
BEGIN
DECLARE EXIT HANDLER FOR SQLWARNING
SET NEW.a = 10;
SET NEW.a = 99999999999;
END|
UPDATE t1 SET b = 20;
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
SHOW WARNINGS;
Level Code Message
Warning 1264 Out of range value for column 'a' at row 1
SELECT * FROM t1;
a b
10 20
DROP TRIGGER t1_bu;
DROP TABLE t1;
# - Case 2
CREATE TABLE t1(a INT);
CREATE TABLE t2(b CHAR(1));
CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
INSERT INTO t2 VALUES('ab'); # Produces a warning.
INSERT INTO t2 VALUES('b'); # Does not produce a warning,
# previous warning should be cleared.
END|
INSERT INTO t1 VALUES(0);
SHOW WARNINGS;
Level Code Message
SELECT * FROM t1;
a
0
SELECT * FROM t2;
b
a
b
DROP TRIGGER t1_bi;
DROP TABLE t1;
DROP TABLE t2;
#
# Bug#9857: Stored procedures: handler for sqlwarning ignored
#
SET @sql_mode_saved = @@sql_mode;
SET sql_mode = traditional;
CREATE PROCEDURE p1()
BEGIN
DECLARE CONTINUE HANDLER FOR SQLWARNING
SELECT 'warning caught (expected)';
SELECT 5 / 0;
END|
CREATE PROCEDURE p2()
BEGIN
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
SELECT 'error caught (unexpected)';
SELECT 5 / 0;
END|
CALL p1();
5 / 0
NULL
warning caught (expected)
warning caught (expected)
Warnings:
Warning 1365 Division by 0
SHOW WARNINGS;
Level Code Message
Warning 1365 Division by 0
CALL p2();
5 / 0
NULL
Warnings:
Warning 1365 Division by 0
SHOW WARNINGS;
Level Code Message
Warning 1365 Division by 0
DROP PROCEDURE p1;
DROP PROCEDURE p2;
SET sql_mode = @sql_mode_saved;

View File

@ -737,6 +737,8 @@ close c;
end|
insert into t2 values ("foo", 42, -1.9), ("bar", 3, 12.1), ("zap", 666, -3.14)|
call cur1()|
Warnings:
Error 1329 No data - zero rows fetched, selected, or processed
select * from t1|
id data
foo 40
@ -772,6 +774,8 @@ close c1;
close c2;
end|
call cur2()|
Warnings:
Error 1329 No data - zero rows fetched, selected, or processed
select * from t3 order by i,s|
s i
bar 3
@ -861,6 +865,8 @@ end$
set @@sql_mode = ''|
set sql_select_limit = 1|
call modes(@c1, @c2)|
Warnings:
Error 1329 No data - zero rows fetched, selected, or processed
set sql_select_limit = default|
select @c1, @c2|
@c1 @c2
@ -1682,42 +1688,64 @@ end|
call h_ee()|
h_ee
Inner (good)
Warnings:
Error 1062 Duplicate entry '1' for key 'PRIMARY'
call h_es()|
h_es
Outer (good)
Warnings:
Error 1062 Duplicate entry '1' for key 'PRIMARY'
call h_en()|
h_en
Outer (good)
Warnings:
Warning 1329 No data - zero rows fetched, selected, or processed
call h_ew()|
h_ew
Outer (good)
call h_ex()|
h_ex
Outer (good)
Warnings:
Error 1062 Duplicate entry '1' for key 'PRIMARY'
call h_se()|
h_se
Inner (good)
Warnings:
Error 1062 Duplicate entry '1' for key 'PRIMARY'
call h_ss()|
h_ss
Inner (good)
Warnings:
Error 1062 Duplicate entry '1' for key 'PRIMARY'
call h_sn()|
h_sn
Outer (good)
Warnings:
Warning 1329 No data - zero rows fetched, selected, or processed
call h_sw()|
h_sw
Outer (good)
call h_sx()|
h_sx
Outer (good)
Warnings:
Error 1062 Duplicate entry '1' for key 'PRIMARY'
call h_ne()|
h_ne
Inner (good)
Warnings:
Warning 1329 No data - zero rows fetched, selected, or processed
call h_ns()|
h_ns
Inner (good)
Warnings:
Warning 1329 No data - zero rows fetched, selected, or processed
call h_nn()|
h_nn
Inner (good)
Warnings:
Warning 1329 No data - zero rows fetched, selected, or processed
call h_we()|
h_we
Inner (good)
@ -1730,12 +1758,18 @@ Inner (good)
call h_xe()|
h_xe
Inner (good)
Warnings:
Error 1062 Duplicate entry '1' for key 'PRIMARY'
call h_xs()|
h_xs
Inner (good)
Warnings:
Error 1062 Duplicate entry '1' for key 'PRIMARY'
call h_xx()|
h_xx
Inner (good)
Warnings:
Error 1062 Duplicate entry '1' for key 'PRIMARY'
drop table t3|
drop procedure h_ee|
drop procedure h_es|
@ -1884,6 +1918,8 @@ set @x2 = 2;
close c1;
end|
call bug2260()|
Warnings:
Error 1329 No data - zero rows fetched, selected, or processed
select @x2|
@x2
2
@ -2027,6 +2063,8 @@ insert into t3 values (123456789012);
insert into t3 values (0);
end|
call bug2780()|
Warnings:
Warning 1264 Out of range value for column 's1' at row 1
select @x|
@x
1
@ -2449,6 +2487,8 @@ declare continue handler for sqlstate 'HY000' begin end;
select s1 from t3 union select s2 from t3;
end|
call bug4904()|
Warnings:
Error 1267 Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (latin2_general_ci,IMPLICIT) for operation 'UNION'
drop procedure bug4904|
drop table t3|
drop procedure if exists bug336|
@ -2588,13 +2628,17 @@ select row_count()|
row_count()
1
call bug4905()|
Warnings:
Error 1062 Duplicate entry '1' for key 'PRIMARY'
select row_count()|
row_count()
0
-1
call bug4905()|
Warnings:
Error 1062 Duplicate entry '1' for key 'PRIMARY'
select row_count()|
row_count()
0
-1
select * from t3|
s1
1
@ -2615,10 +2659,14 @@ insert into t3 values (1)|
call bug6029()|
sqlstate 23000
sqlstate 23000
Warnings:
Error 1062 Duplicate entry '1' for key 'PRIMARY'
delete from t3|
call bug6029()|
1136
1136
Warnings:
Error 1136 Column count doesn't match value count at row 1
drop procedure bug6029|
drop table t3|
drop procedure if exists bug8540|
@ -2910,15 +2958,23 @@ end|
call bug6900()|
2
2
Warnings:
Error 1136 Column count doesn't match value count at row 1
call bug9074()|
x1 x2 x3 x4 x5 x6
1 1 1 1 1 1
Warnings:
Error 1062 Duplicate entry 'a' for key 'w'
call bug6900_9074(0)|
sqlexception
sqlexception
Warnings:
Error 1136 Column count doesn't match value count at row 1
call bug6900_9074(1)|
23000
23000
Warnings:
Error 1062 Duplicate entry 'a' for key 'w'
drop procedure bug6900|
drop procedure bug9074|
drop procedure bug6900_9074|
@ -2961,9 +3017,13 @@ delete from t1|
call bug9856()|
16
16
Warnings:
Error 1329 No data - zero rows fetched, selected, or processed
call bug9856()|
16
16
Warnings:
Error 1329 No data - zero rows fetched, selected, or processed
drop procedure bug9856|
drop procedure if exists bug9674_1|
drop procedure if exists bug9674_2|
@ -3194,6 +3254,8 @@ x
2
x
3
Warnings:
Error 1326 Cursor is not open
call bug10961()|
x
1
@ -3201,6 +3263,8 @@ x
2
x
3
Warnings:
Error 1326 Cursor is not open
drop procedure bug10961|
DROP PROCEDURE IF EXISTS bug6866|
DROP VIEW IF EXISTS tv|
@ -3316,7 +3380,11 @@ insert into t1 values
('Name4', 13),
('Name5', 14)|
call bug11529()|
Warnings:
Error 1329 No data - zero rows fetched, selected, or processed
call bug11529()|
Warnings:
Error 1329 No data - zero rows fetched, selected, or processed
delete from t1|
drop procedure bug11529|
set character set utf8|
@ -3490,24 +3558,32 @@ end;
end if;
end|
call bug12168('a')|
Warnings:
Error 1329 No data - zero rows fetched, selected, or processed
select * from t4|
a
1
3
truncate t4|
call bug12168('b')|
Warnings:
Error 1329 No data - zero rows fetched, selected, or processed
select * from t4|
a
2
4
truncate t4|
call bug12168('a')|
Warnings:
Error 1329 No data - zero rows fetched, selected, or processed
select * from t4|
a
1
3
truncate t4|
call bug12168('b')|
Warnings:
Error 1329 No data - zero rows fetched, selected, or processed
select * from t4|
a
2
@ -3807,6 +3883,8 @@ end|
call bug7049_2()|
Result
Caught it
Warnings:
Error 1062 Duplicate entry '42' for key 'x'
select * from t3|
x
42
@ -3814,12 +3892,16 @@ delete from t3|
call bug7049_4()|
Result
Caught it
Warnings:
Error 1062 Duplicate entry '42' for key 'x'
select * from t3|
x
42
select bug7049_2()|
bug7049_2()
1
Warnings:
Error 1062 Duplicate entry '42' for key 'x'
drop table t3|
drop procedure bug7049_1|
drop procedure bug7049_2|
@ -3947,6 +4029,8 @@ end|
call bug14845()|
a
0
Warnings:
Error 1329 No data - zero rows fetched, selected, or processed
drop procedure bug14845|
drop procedure if exists bug13549_1|
drop procedure if exists bug13549_2|
@ -4150,6 +4234,8 @@ end|
call bug13729()|
55
55
Warnings:
Error 1062 Duplicate entry '1' for key 'PRIMARY'
select * from t3|
s1
1
@ -4186,11 +4272,15 @@ Handler
boo
v isnull(v)
NULL 1
Warnings:
Error 1054 Unknown column 'undefined_var' in 'field list'
call bug14643_2()|
Handler
boo
Handler
boo
Warnings:
Error 1054 Unknown column 'undefined_var' in 'field list'
drop procedure bug14643_1|
drop procedure bug14643_2|
drop procedure if exists bug14304|
@ -4514,11 +4604,15 @@ Handler
error
End
done
Warnings:
Error 1054 Unknown column 'v' in 'field list'
call bug14498_2()|
Handler
error
End
done
Warnings:
Error 1054 Unknown column 'v' in 'field list'
call bug14498_3()|
v
maybe
@ -4526,16 +4620,22 @@ Handler
error
End
done
Warnings:
Error 1054 Unknown column 'v' in 'field list'
call bug14498_4()|
Handler
error
End
done
Warnings:
Error 1054 Unknown column 'v' in 'field list'
call bug14498_5()|
Handler
error
End
done
Warnings:
Error 1054 Unknown column 'v' in 'field list'
drop procedure bug14498_1|
drop procedure bug14498_2|
drop procedure bug14498_3|
@ -4546,6 +4646,8 @@ drop procedure if exists bug15231_1|
drop procedure if exists bug15231_2|
drop procedure if exists bug15231_3|
drop procedure if exists bug15231_4|
drop procedure if exists bug15231_5|
drop procedure if exists bug15231_6|
create table t3 (id int not null)|
create procedure bug15231_1()
begin
@ -4568,7 +4670,7 @@ end|
create procedure bug15231_3()
begin
declare exit handler for sqlwarning
select 'Caught it (wrong)' as 'Result';
select 'Caught it (correct)' as 'Result';
call bug15231_4();
end|
create procedure bug15231_4()
@ -4576,6 +4678,20 @@ begin
declare x decimal(2,1);
set x = 'zap';
select 'Missed it (correct)' as 'Result';
show warnings;
end|
create procedure bug15231_5()
begin
declare exit handler for sqlwarning
select 'Caught it (wrong)' as 'Result';
call bug15231_6();
end|
create procedure bug15231_6()
begin
declare x decimal(2,1);
set x = 'zap';
select 'Missed it (correct)' as 'Result';
select id from t3;
end|
call bug15231_1()|
1
@ -4583,19 +4699,29 @@ Before NOT FOUND condition is triggered
2
After NOT FOUND condtition is triggered
xid xdone
1 0
1 1
Warnings:
Warning 1329 No data - zero rows fetched, selected, or processed
call bug15231_3()|
Result
Missed it (correct)
Level Code Message
Warning 1366 Incorrect decimal value: 'zap' for column 'x' at row 1
Result
Caught it (correct)
Warnings:
Warning 1366 Incorrect decimal value: 'zap' for column 'x' at row 1
drop table if exists t3|
drop procedure if exists bug15231_1|
drop procedure if exists bug15231_2|
drop procedure if exists bug15231_3|
drop procedure if exists bug15231_4|
call bug15231_5()|
Result
Missed it (correct)
id
drop table t3|
drop procedure bug15231_1|
drop procedure bug15231_2|
drop procedure bug15231_3|
drop procedure bug15231_4|
drop procedure bug15231_5|
drop procedure bug15231_6|
drop procedure if exists bug15011|
create table t3 (c1 int primary key)|
insert into t3 values (1)|
@ -4613,6 +4739,8 @@ end|
call bug15011()|
Handler
Inner
Warnings:
Error 1062 Duplicate entry '1' for key 'PRIMARY'
drop procedure bug15011|
drop table t3|
drop procedure if exists bug17476|
@ -4688,6 +4816,8 @@ i
1
i
0
Warnings:
Error 1329 No data - zero rows fetched, selected, or processed
drop table t3|
drop procedure bug16887|
drop procedure if exists bug16474_1|
@ -4760,6 +4890,8 @@ declare continue handler for sqlexception begin end;
select no_such_function();
end|
call bug18787()|
Warnings:
Error 1305 FUNCTION test.no_such_function does not exist
drop procedure bug18787|
create database bug18344_012345678901|
use bug18344_012345678901|
@ -5133,6 +5265,8 @@ statement failed
statement failed
statement after update
statement after update
Warnings:
Error 1242 Subquery returns more than 1 row
select * from t3|
a
1
@ -5144,6 +5278,8 @@ statement failed
statement failed
statement after update
statement after update
Warnings:
Error 1242 Subquery returns more than 1 row
select * from t3|
a
1
@ -5176,6 +5312,8 @@ in continue handler
in continue handler
reachable code a2
reachable code a2
Warnings:
Error 1242 Subquery returns more than 1 row
select * from t3|
a
1
@ -5191,6 +5329,8 @@ in continue handler
in continue handler
reachable code a2
reachable code a2
Warnings:
Error 1242 Subquery returns more than 1 row
select * from t3|
a
1
@ -5224,6 +5364,8 @@ in continue handler
in continue handler
reachable code a2
reachable code a2
Warnings:
Error 1305 FUNCTION test.no_such_function does not exist
drop procedure bug8153_proc_a|
drop procedure bug8153_proc_b|
drop table t3|
@ -5792,9 +5934,13 @@ end|
select func_8407_a()|
func_8407_a()
NULL
Warnings:
Error 1146 Table 'test.no_such_view' doesn't exist
select func_8407_b()|
func_8407_b()
1500
Warnings:
Error 1146 Table 'test.no_such_view' doesn't exist
drop function func_8407_a|
drop function func_8407_b|
drop table if exists table_26503|
@ -5916,6 +6062,8 @@ looping i
looping 0
leaving handler
leaving handler
Warnings:
Error 1062 Duplicate entry '1' for key 'a'
call proc_26503_ok_2(2)|
do something
do something
@ -5927,6 +6075,8 @@ looping i
looping 4
leaving handler
leaving handler
Warnings:
Error 1062 Duplicate entry '2' for key 'a'
call proc_26503_ok_3(3)|
do something
do something
@ -5946,6 +6096,8 @@ looping i
looping 0
leaving handler
leaving handler
Warnings:
Error 1062 Duplicate entry '3' for key 'a'
call proc_26503_ok_4(4)|
do something
do something
@ -5957,6 +6109,8 @@ looping i
looping 4
leaving handler
leaving handler
Warnings:
Error 1062 Duplicate entry '4' for key 'a'
drop table table_26503|
drop procedure proc_26503_ok_1|
drop procedure proc_26503_ok_2|
@ -6670,6 +6824,8 @@ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @exception:= 'run';
SELECT x FROM t1;
END|
CALL bug29770();
Warnings:
Error 1054 Unknown column 'x' in 'field list'
SELECT @state, @exception;
@state @exception
run NULL
@ -6708,6 +6864,8 @@ end;
end while;
end//
call proc_33618(20);
Warnings:
Error 1329 No data - zero rows fetched, selected, or processed
drop table t_33618;
drop procedure proc_33618;
#

View File

@ -99,6 +99,8 @@ return i;
end|
set @error_in_func:= 0|
insert into t1 values (bug10015_6(5)), (bug10015_6(6))|
Warnings:
Error 1062 Duplicate entry '1' for key 'PRIMARY'
select @error_in_func|
@error_in_func
1
@ -524,6 +526,8 @@ until done end repeat;
close c;
end|
call bug14210()|
Warnings:
Error 1329 No data - zero rows fetched, selected, or processed
select count(*) from t4|
count(*)
256

View File

@ -1190,6 +1190,8 @@ select'a'; insert into t1 values (200); end;|
call t1();
a
a
Warnings:
Error 1264 Out of range value for column 'col1' at row 1
select * from t1;
col1
drop procedure t1;

View File

@ -210,4 +210,16 @@ UPDATE t1,t2 SET t1.a = t2.a;
INSERT INTO t2 SELECT f1();
DROP TABLE t1,t2,t3;
DROP FUNCTION f1;
#
# Bug #48067: A temp table with the same name as an existing table,
# makes drop database fail.
#
DROP TEMPORARY TABLE IF EXISTS bug48067.t1;
DROP DATABASE IF EXISTS bug48067;
CREATE DATABASE bug48067;
CREATE TABLE bug48067.t1 (c1 int);
INSERT INTO bug48067.t1 values (1);
CREATE TEMPORARY TABLE bug48067.t1 (c1 int);
DROP DATABASE bug48067;
DROP TEMPORARY table bug48067.t1;
End of 5.1 tests

View File

@ -1677,3 +1677,25 @@ SET @@sql_quote_show_create = @sql_quote_show_create_saved;
# End of Bug#34828.
# Make sure we can manipulate with autocommit in the
# along with other variables.
drop table if exists t1;
drop function if exists t1_max;
drop function if exists t1_min;
create table t1 (a int) engine=innodb;
insert into t1(a) values (0), (1);
create function t1_max() returns int return (select max(a) from t1);
create function t1_min() returns int return (select min(a) from t1);
select t1_min();
t1_min()
0
select t1_max();
t1_max()
1
set @@session.autocommit=t1_min(), @@session.autocommit=t1_max(),
@@session.autocommit=t1_min(), @@session.autocommit=t1_max(),
@@session.autocommit=t1_min(), @@session.autocommit=t1_max();
# Cleanup.
drop table t1;
drop function t1_min;
drop function t1_max;

View File

@ -1955,15 +1955,15 @@ CHECK TABLE v1, v2, v3, v4, v5, v6;
Table Op Msg_type Msg_text
test.v1 check Error FUNCTION test.f1 does not exist
test.v1 check Error View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
test.v1 check status Operation failed
test.v1 check error Corrupt
test.v2 check status OK
test.v3 check Error FUNCTION test.f1 does not exist
test.v3 check Error View 'test.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
test.v3 check status Operation failed
test.v3 check error Corrupt
test.v4 check status OK
test.v5 check Error FUNCTION test.f1 does not exist
test.v5 check Error View 'test.v5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
test.v5 check status Operation failed
test.v5 check error Corrupt
test.v6 check status OK
create function f1 () returns int return (select max(col1) from t1);
DROP TABLE t1;
@ -3946,6 +3946,8 @@ create view a as select 1;
end|
call p();
call p();
Warnings:
Error 1050 Table 'a' already exists
drop view a;
drop procedure p;
#

View File

@ -28,6 +28,25 @@ INSERT INTO t1 VALUES (1,2), (2,3);
UPDATE t1 SET b='4' WHERE a=1 LIMIT 1;
UPDATE t1 SET b='5' WHERE a=2 ORDER BY a LIMIT 1;
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(1000));
INSERT INTO t1 VALUES (CURRENT_USER());
INSERT INTO t1 VALUES (FOUND_ROWS());
INSERT INTO t1 VALUES (GET_LOCK('tmp', 1));
INSERT INTO t1 VALUES (IS_FREE_LOCK('tmp'));
INSERT INTO t1 VALUES (IS_USED_LOCK('tmp'));
INSERT INTO t1 VALUES (LOAD_FILE('../../std_data/words2.dat'));
INSERT INTO t1 VALUES (MASTER_POS_WAIT('dummy arg', 4711, 1));
INSERT INTO t1 VALUES (RELEASE_LOCK('tmp'));
INSERT INTO t1 VALUES (ROW_COUNT());
INSERT INTO t1 VALUES (SESSION_USER());
INSERT INTO t1 VALUES (SLEEP(1));
INSERT INTO t1 VALUES (SYSDATE());
INSERT INTO t1 VALUES (SYSTEM_USER());
INSERT INTO t1 VALUES (USER());
INSERT INTO t1 VALUES (UUID());
INSERT INTO t1 VALUES (UUID_SHORT());
INSERT INTO t1 VALUES (VERSION());
INSERT INTO t1 VALUES (RAND());
DROP DATABASE b42851;
USE test;
#
@ -67,8 +86,11 @@ Note 1592 Unsafe statement written to the binary log using statement format sinc
SELECT sf_bug50192();
sf_bug50192()
1
Warnings:
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
SHOW WARNINGS;
Level Code Message
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
DROP FUNCTION sf_bug50192;
DROP TRIGGER tr_bug50192;
DROP TABLE t1, t2;

File diff suppressed because it is too large Load Diff

View File

@ -72,6 +72,26 @@ UPDATE t1 SET b='4' WHERE a=1 LIMIT 1;
UPDATE t1 SET b='5' WHERE a=2 ORDER BY a LIMIT 1;
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(1000));
INSERT INTO t1 VALUES (CURRENT_USER()); #marked unsafe before BUG#47995
INSERT INTO t1 VALUES (FOUND_ROWS()); #marked unsafe before BUG#47995
INSERT INTO t1 VALUES (GET_LOCK('tmp', 1)); #marked unsafe in BUG#47995
INSERT INTO t1 VALUES (IS_FREE_LOCK('tmp')); #marked unsafe in BUG#47995
INSERT INTO t1 VALUES (IS_USED_LOCK('tmp')); #marked unsafe in BUG#47995
INSERT INTO t1 VALUES (LOAD_FILE('../../std_data/words2.dat')); #marked unsafe in BUG#39701
INSERT INTO t1 VALUES (MASTER_POS_WAIT('dummy arg', 4711, 1));
INSERT INTO t1 VALUES (RELEASE_LOCK('tmp')); #marked unsafe in BUG#47995
INSERT INTO t1 VALUES (ROW_COUNT()); #marked unsafe before BUG#47995
INSERT INTO t1 VALUES (SESSION_USER()); #marked unsafe before BUG#47995
INSERT INTO t1 VALUES (SLEEP(1)); #marked unsafe in BUG#47995
INSERT INTO t1 VALUES (SYSDATE()); #marked unsafe in BUG#47995
INSERT INTO t1 VALUES (SYSTEM_USER()); #marked unsafe before BUG#47995
INSERT INTO t1 VALUES (USER()); #marked unsafe before BUG#47995
INSERT INTO t1 VALUES (UUID()); #marked unsafe before BUG#47995
INSERT INTO t1 VALUES (UUID_SHORT()); #marked unsafe before BUG#47995
INSERT INTO t1 VALUES (VERSION()); #marked unsafe in BUG#47995
INSERT INTO t1 VALUES (RAND()); #marked unsafe in BUG#49222
# clean up
DROP DATABASE b42851;

View File

@ -468,6 +468,7 @@ BEGIN
END|
DELIMITER ;|
--echo "One unsafe warning should be issued in the following statement"
--error ER_STORED_FUNCTION_PREVENTS_SWITCH_SQL_LOG_BIN
SELECT fun_check_log_bin();
--echo "SQL_LOG_BIN should be ON still"
SHOW VARIABLES LIKE "SQL_LOG_BIN";

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