mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
auto-merge + post-merge fixies
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
INCLUDE("${PROJECT_SOURCE_DIR}/win/mysql_manifest.cmake")
|
||||
|
||||
# We use the "mysqlclient_notls" library here just as safety, in case
|
||||
# any of the clients here would go beond the client API and access the
|
||||
# any of the clients here would go beyond the client API and access the
|
||||
# Thread Local Storage directly.
|
||||
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
|
||||
@@ -32,9 +32,9 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
|
||||
ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc ../mysys/my_conio.c)
|
||||
TARGET_LINK_LIBRARIES(mysql mysqlclient_notls wsock32)
|
||||
|
||||
ADD_EXECUTABLE(mysqltest mysqltest.c ../mysys/my_getsystime.c
|
||||
../mysys/my_copy.c ../mysys/my_mkdir.c)
|
||||
TARGET_LINK_LIBRARIES(mysqltest mysqlclient_notls regex wsock32)
|
||||
ADD_EXECUTABLE(mysqltest mysqltest.c)
|
||||
SET_SOURCE_FILES_PROPERTIES(mysqltest.c PROPERTIES COMPILE_FLAGS "-DTHREADS")
|
||||
TARGET_LINK_LIBRARIES(mysqltest mysqlclient mysys regex wsock32 dbug)
|
||||
|
||||
ADD_EXECUTABLE(mysqlcheck mysqlcheck.c)
|
||||
TARGET_LINK_LIBRARIES(mysqlcheck mysqlclient_notls wsock32)
|
||||
|
||||
@@ -86,11 +86,13 @@ mysqlslap_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
|
||||
$(LIBMYSQLCLIENT_LA) \
|
||||
$(top_builddir)/mysys/libmysys.a
|
||||
|
||||
mysqltest_SOURCES= mysqltest.c \
|
||||
$(top_srcdir)/mysys/my_getsystime.c \
|
||||
$(top_srcdir)/mysys/my_copy.c \
|
||||
$(top_srcdir)/mysys/my_mkdir.c
|
||||
mysqltest_LDADD = $(top_builddir)/regex/libregex.a $(LDADD)
|
||||
mysqltest_SOURCES= mysqltest.c
|
||||
mysqltest_CFLAGS= -DTHREAD -UUNDEF_THREADS_HACK
|
||||
mysqltest_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
|
||||
@CLIENT_EXTRA_LDFLAGS@ \
|
||||
$(LIBMYSQLCLIENT_LA) \
|
||||
$(top_builddir)/mysys/libmysys.a \
|
||||
$(top_builddir)/regex/libregex.a
|
||||
|
||||
mysql_upgrade_SOURCES= mysql_upgrade.c \
|
||||
$(top_srcdir)/mysys/my_getpagesize.c
|
||||
|
||||
@@ -1821,7 +1821,7 @@ static int read_and_execute(bool interactive)
|
||||
the very beginning of a text file when
|
||||
you save the file using "Unicode UTF-8" format.
|
||||
*/
|
||||
if (!line_number &&
|
||||
if (line && !line_number &&
|
||||
(uchar) line[0] == 0xEF &&
|
||||
(uchar) line[1] == 0xBB &&
|
||||
(uchar) line[2] == 0xBF)
|
||||
@@ -2176,7 +2176,14 @@ static bool add_line(String &buffer,char *line,char *in_string,
|
||||
}
|
||||
else if (!*ml_comment && (!*in_string && (inchar == '#' ||
|
||||
inchar == '-' && pos[1] == '-' &&
|
||||
my_isspace(charset_info,pos[2]))))
|
||||
/*
|
||||
The third byte is either whitespace or is the
|
||||
end of the line -- which would occur only
|
||||
because of the user sending newline -- which is
|
||||
itself whitespace and should also match.
|
||||
*/
|
||||
(my_isspace(charset_info,pos[2]) ||
|
||||
!pos[2]))))
|
||||
{
|
||||
// Flush previously accepted characters
|
||||
if (out != line)
|
||||
|
||||
@@ -48,7 +48,15 @@
|
||||
#ifdef __WIN__
|
||||
#include <direct.h>
|
||||
#endif
|
||||
#include <signal.h>
|
||||
#include <my_stacktrace.h>
|
||||
|
||||
#ifdef __WIN__
|
||||
#include <crtdbg.h>
|
||||
#define SIGNAL_FMT "exception 0x%x"
|
||||
#else
|
||||
#define SIGNAL_FMT "signal %d"
|
||||
#endif
|
||||
|
||||
/* Use cygwin for --exec and --system before 5.0 */
|
||||
#if MYSQL_VERSION_ID < 50000
|
||||
@@ -216,6 +224,7 @@ struct st_connection
|
||||
/* Used when creating views and sp, to avoid implicit commit */
|
||||
MYSQL* util_mysql;
|
||||
char *name;
|
||||
size_t name_len;
|
||||
MYSQL_STMT* stmt;
|
||||
|
||||
#ifdef EMBEDDED_LIBRARY
|
||||
@@ -269,7 +278,8 @@ enum enum_commands {
|
||||
Q_REPLACE_REGEX, Q_REMOVE_FILE, Q_FILE_EXIST,
|
||||
Q_WRITE_FILE, Q_COPY_FILE, Q_PERL, Q_DIE, Q_EXIT, Q_SKIP,
|
||||
Q_CHMOD_FILE, Q_APPEND_FILE, Q_CAT_FILE, Q_DIFF_FILES,
|
||||
Q_SEND_QUIT, Q_CHANGE_USER, Q_MKDIR, Q_RMDIR,
|
||||
Q_SEND_QUIT, Q_CHANGE_USER, Q_MKDIR, Q_RMDIR, Q_LIST_FILES,
|
||||
Q_LIST_FILES_WRITE_FILE, Q_LIST_FILES_APPEND_FILE,
|
||||
|
||||
Q_UNKNOWN, /* Unknown command. */
|
||||
Q_COMMENT, /* Comments, ignored. */
|
||||
@@ -361,6 +371,9 @@ const char *command_names[]=
|
||||
"change_user",
|
||||
"mkdir",
|
||||
"rmdir",
|
||||
"list_files",
|
||||
"list_files_write_file",
|
||||
"list_files_append_file",
|
||||
|
||||
0
|
||||
};
|
||||
@@ -2822,6 +2835,126 @@ void do_rmdir(struct st_command *command)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
SYNOPSIS
|
||||
get_list_files
|
||||
ds output
|
||||
ds_dirname dir to list
|
||||
ds_wild wild-card file pattern (can be empty)
|
||||
|
||||
DESCRIPTION
|
||||
list all entries in directory (matching ds_wild if given)
|
||||
*/
|
||||
|
||||
static int get_list_files(DYNAMIC_STRING *ds, const DYNAMIC_STRING *ds_dirname,
|
||||
const DYNAMIC_STRING *ds_wild)
|
||||
{
|
||||
uint i;
|
||||
MY_DIR *dir_info;
|
||||
FILEINFO *file;
|
||||
DBUG_ENTER("get_list_files");
|
||||
|
||||
DBUG_PRINT("info", ("listing directory: %s", ds_dirname->str));
|
||||
/* 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);
|
||||
for (i= 0; i < (uint) dir_info->number_off_files; i++)
|
||||
{
|
||||
file= dir_info->dir_entry + i;
|
||||
if (file->name[0] == '.' &&
|
||||
(file->name[1] == '\0' ||
|
||||
(file->name[1] == '.' && file->name[2] == '\0')))
|
||||
continue; /* . or .. */
|
||||
if (ds_wild && ds_wild->length &&
|
||||
wild_compare(file->name, ds_wild->str, 0))
|
||||
continue;
|
||||
dynstr_append(ds, file->name);
|
||||
dynstr_append(ds, "\n");
|
||||
}
|
||||
my_dirend(dir_info);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
SYNOPSIS
|
||||
do_list_files
|
||||
command called command
|
||||
|
||||
DESCRIPTION
|
||||
list_files <dir_name> [<file_name>]
|
||||
List files and directories in directory <dir_name> (like `ls`)
|
||||
[Matching <file_name>, where wild-cards are allowed]
|
||||
*/
|
||||
|
||||
static void do_list_files(struct st_command *command)
|
||||
{
|
||||
int error;
|
||||
static DYNAMIC_STRING ds_dirname;
|
||||
static DYNAMIC_STRING ds_wild;
|
||||
const struct command_arg list_files_args[] = {
|
||||
{"dirname", ARG_STRING, TRUE, &ds_dirname, "Directory to list"},
|
||||
{"file", ARG_STRING, FALSE, &ds_wild, "Filename (incl. wildcard)"}
|
||||
};
|
||||
DBUG_ENTER("do_list_files");
|
||||
|
||||
check_command_args(command, command->first_argument,
|
||||
list_files_args,
|
||||
sizeof(list_files_args)/sizeof(struct command_arg), ' ');
|
||||
|
||||
error= get_list_files(&ds_res, &ds_dirname, &ds_wild);
|
||||
handle_command_error(command, error);
|
||||
dynstr_free(&ds_dirname);
|
||||
dynstr_free(&ds_wild);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
SYNOPSIS
|
||||
do_list_files_write_file_command
|
||||
command called command
|
||||
append append file, or create new
|
||||
|
||||
DESCRIPTION
|
||||
list_files_{write|append}_file <filename> <dir_name> [<match_file>]
|
||||
List files and directories in directory <dir_name> (like `ls`)
|
||||
[Matching <match_file>, where wild-cards are allowed]
|
||||
|
||||
Note: File will be truncated if exists and append is not true.
|
||||
*/
|
||||
|
||||
static void do_list_files_write_file_command(struct st_command *command,
|
||||
my_bool append)
|
||||
{
|
||||
int error;
|
||||
static DYNAMIC_STRING ds_content;
|
||||
static DYNAMIC_STRING ds_filename;
|
||||
static DYNAMIC_STRING ds_dirname;
|
||||
static DYNAMIC_STRING ds_wild;
|
||||
const struct command_arg list_files_args[] = {
|
||||
{"filename", ARG_STRING, TRUE, &ds_filename, "Filename for write"},
|
||||
{"dirname", ARG_STRING, TRUE, &ds_dirname, "Directory to list"},
|
||||
{"file", ARG_STRING, FALSE, &ds_wild, "Filename (incl. wildcard)"}
|
||||
};
|
||||
DBUG_ENTER("do_list_files_write_file");
|
||||
|
||||
check_command_args(command, command->first_argument,
|
||||
list_files_args,
|
||||
sizeof(list_files_args)/sizeof(struct command_arg), ' ');
|
||||
|
||||
init_dynamic_string(&ds_content, "", 1024, 1024);
|
||||
error= get_list_files(&ds_content, &ds_dirname, &ds_wild);
|
||||
handle_command_error(command, error);
|
||||
str_to_file2(ds_filename.str, ds_content.str, ds_content.length, append);
|
||||
dynstr_free(&ds_content);
|
||||
dynstr_free(&ds_filename);
|
||||
dynstr_free(&ds_dirname);
|
||||
dynstr_free(&ds_wild);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Read characters from line buffer or file. This is needed to allow
|
||||
my_ungetc() to buffer MAX_DELIMITER_LENGTH characters for a file
|
||||
@@ -4463,6 +4596,7 @@ void do_connect(struct st_command *command)
|
||||
ds_connection_name.str));
|
||||
if (!(con_slot->name= my_strdup(ds_connection_name.str, MYF(MY_WME))))
|
||||
die("Out of memory");
|
||||
con_slot->name_len= strlen(con_slot->name);
|
||||
cur_con= con_slot;
|
||||
|
||||
if (con_slot == next_con)
|
||||
@@ -6911,6 +7045,104 @@ void mark_progress(struct st_command* command __attribute__((unused)),
|
||||
|
||||
}
|
||||
|
||||
#ifdef HAVE_STACKTRACE
|
||||
|
||||
static void dump_backtrace(void)
|
||||
{
|
||||
struct st_connection *conn= cur_con;
|
||||
|
||||
my_safe_print_str("read_command_buf", read_command_buf,
|
||||
sizeof(read_command_buf));
|
||||
if (conn)
|
||||
{
|
||||
my_safe_print_str("conn->name", conn->name, conn->name_len);
|
||||
#ifdef EMBEDDED_LIBRARY
|
||||
my_safe_print_str("conn->cur_query", conn->cur_query, conn->cur_query_len);
|
||||
#endif
|
||||
}
|
||||
fputs("Attempting backtrace...\n", stderr);
|
||||
my_print_stacktrace(NULL, my_thread_stack_size);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static void dump_backtrace(void)
|
||||
{
|
||||
fputs("Backtrace not available.\n", stderr);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static sig_handler signal_handler(int sig)
|
||||
{
|
||||
fprintf(stderr, "mysqltest got " SIGNAL_FMT "\n", sig);
|
||||
dump_backtrace();
|
||||
}
|
||||
|
||||
#ifdef __WIN__
|
||||
|
||||
LONG WINAPI exception_filter(EXCEPTION_POINTERS *exp)
|
||||
{
|
||||
__try
|
||||
{
|
||||
my_set_exception_pointers(exp);
|
||||
signal_handler(exp->ExceptionRecord->ExceptionCode);
|
||||
}
|
||||
__except(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
fputs("Got exception in exception handler!\n", stderr);
|
||||
}
|
||||
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
|
||||
static void init_signal_handling(void)
|
||||
{
|
||||
UINT mode;
|
||||
|
||||
/* Set output destination of messages to the standard error stream. */
|
||||
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
|
||||
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
|
||||
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
|
||||
_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
|
||||
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
|
||||
_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
|
||||
|
||||
/* Do not not display the a error message box. */
|
||||
mode= SetErrorMode(0) | SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX;
|
||||
SetErrorMode(mode);
|
||||
|
||||
SetUnhandledExceptionFilter(exception_filter);
|
||||
}
|
||||
|
||||
#else /* __WIN__ */
|
||||
|
||||
static void init_signal_handling(void)
|
||||
{
|
||||
struct sigaction sa;
|
||||
DBUG_ENTER("init_signal_handling");
|
||||
|
||||
#ifdef HAVE_STACKTRACE
|
||||
my_init_stacktrace();
|
||||
#endif
|
||||
|
||||
sa.sa_flags = SA_RESETHAND | SA_NODEFER;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigprocmask(SIG_SETMASK, &sa.sa_mask, NULL);
|
||||
|
||||
sa.sa_handler= signal_handler;
|
||||
|
||||
sigaction(SIGSEGV, &sa, NULL);
|
||||
sigaction(SIGABRT, &sa, NULL);
|
||||
#ifdef SIGBUS
|
||||
sigaction(SIGBUS, &sa, NULL);
|
||||
#endif
|
||||
sigaction(SIGILL, &sa, NULL);
|
||||
sigaction(SIGFPE, &sa, NULL);
|
||||
}
|
||||
|
||||
#endif /* !__WIN__ */
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
@@ -6924,6 +7156,8 @@ int main(int argc, char **argv)
|
||||
save_file[0]= 0;
|
||||
TMPDIR[0]= 0;
|
||||
|
||||
init_signal_handling();
|
||||
|
||||
/* Init expected errors */
|
||||
memset(&saved_expected_errors, 0, sizeof(saved_expected_errors));
|
||||
|
||||
@@ -7110,6 +7344,13 @@ int main(int argc, char **argv)
|
||||
case Q_REMOVE_FILE: do_remove_file(command); break;
|
||||
case Q_MKDIR: do_mkdir(command); break;
|
||||
case Q_RMDIR: do_rmdir(command); break;
|
||||
case Q_LIST_FILES: do_list_files(command); break;
|
||||
case Q_LIST_FILES_WRITE_FILE:
|
||||
do_list_files_write_file_command(command, FALSE);
|
||||
break;
|
||||
case Q_LIST_FILES_APPEND_FILE:
|
||||
do_list_files_write_file_command(command, TRUE);
|
||||
break;
|
||||
case Q_FILE_EXIST: do_file_exist(command); break;
|
||||
case Q_WRITE_FILE: do_write_file(command); break;
|
||||
case Q_APPEND_FILE: do_append_file(command); break;
|
||||
|
||||
25
configure.in
25
configure.in
@@ -10,7 +10,7 @@ AC_CANONICAL_SYSTEM
|
||||
#
|
||||
# When changing major version number please also check switch statement
|
||||
# in mysqlbinlog::check_master_version().
|
||||
AM_INIT_AUTOMAKE(mysql, 5.1.26-rc)
|
||||
AM_INIT_AUTOMAKE(mysql, 5.1.28)
|
||||
AM_CONFIG_HEADER([include/config.h:config.h.in])
|
||||
|
||||
PROTOCOL_VERSION=10
|
||||
@@ -2341,10 +2341,31 @@ then
|
||||
fi
|
||||
AC_MSG_RESULT("$netinet_inc")
|
||||
|
||||
AC_CACHE_CHECK([support for weak symbols], mysql_cv_weak_symbol,
|
||||
[AC_TRY_LINK([],[
|
||||
extern void __attribute__((weak)) foo(void);
|
||||
], [mysql_cv_weak_symbol=yes], [mysql_cv_weak_symbol=no])])
|
||||
|
||||
if test "x$mysql_cv_weak_symbol" = xyes; then
|
||||
AC_DEFINE(HAVE_WEAK_SYMBOL, 1,
|
||||
[Define to 1 if compiler supports weak symbol attribute.])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([whether __bss_start is defined], mysql_cv_bss_start,
|
||||
[AC_TRY_LINK([],[
|
||||
extern char *__bss_start;
|
||||
return __bss_start ? 1 : 0;
|
||||
], [mysql_cv_bss_start=yes], [mysql_cv_bss_start=no])])
|
||||
|
||||
if test "x$mysql_cv_bss_start" = xyes; then
|
||||
AC_DEFINE(HAVE_BSS_START, 1,
|
||||
[Define to 1 if compiler defines __bss_start.])
|
||||
fi
|
||||
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
AC_CHECK_HEADERS(cxxabi.h)
|
||||
AC_CACHE_CHECK([checking for abi::__cxa_demangle], mysql_cv_cxa_demangle,
|
||||
AC_CACHE_CHECK([for abi::__cxa_demangle], mysql_cv_cxa_demangle,
|
||||
[AC_TRY_LINK([#include <cxxabi.h>], [
|
||||
char *foo= 0; int bar= 0;
|
||||
foo= abi::__cxa_demangle(foo, foo, 0, &bar);
|
||||
|
||||
@@ -36,7 +36,7 @@ noinst_HEADERS = config-win.h config-netware.h my_bit.h \
|
||||
mysql_version.h.in my_handler.h my_time.h \
|
||||
my_vle.h my_user.h my_atomic.h atomic/nolock.h \
|
||||
atomic/rwlock.h atomic/x86-gcc.h atomic/x86-msvc.h \
|
||||
atomic/gcc_builtins.h my_libwrap.h
|
||||
atomic/gcc_builtins.h my_libwrap.h my_stacktrace.h
|
||||
|
||||
# Remove built files and the symlinked directories
|
||||
CLEANFILES = $(BUILT_SOURCES) readline openssl
|
||||
|
||||
66
include/my_stacktrace.h
Normal file
66
include/my_stacktrace.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/* Copyright (C) 2000 MySQL AB
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#ifndef _my_stacktrace_h_
|
||||
#define _my_stacktrace_h_
|
||||
|
||||
#include <my_global.h>
|
||||
|
||||
#ifdef TARGET_OS_LINUX
|
||||
#if defined (__x86_64__) || defined (__i386__) || \
|
||||
(defined(__alpha__) && defined(__GNUC__))
|
||||
#define HAVE_STACKTRACE 1
|
||||
#endif
|
||||
#elif defined(__WIN__)
|
||||
#define HAVE_STACKTRACE 1
|
||||
#endif
|
||||
|
||||
#if HAVE_BACKTRACE && (HAVE_BACKTRACE_SYMBOLS || HAVE_BACKTRACE_SYMBOLS_FD)
|
||||
#undef HAVE_STACKTRACE
|
||||
#define HAVE_STACKTRACE 1
|
||||
#endif
|
||||
|
||||
#if !defined(__NETWARE__)
|
||||
#define HAVE_WRITE_CORE
|
||||
#endif
|
||||
|
||||
#if HAVE_BACKTRACE && HAVE_BACKTRACE_SYMBOLS && \
|
||||
HAVE_CXXABI_H && HAVE_ABI_CXA_DEMANGLE && \
|
||||
HAVE_WEAK_SYMBOL
|
||||
#define BACKTRACE_DEMANGLE 1
|
||||
#endif
|
||||
|
||||
C_MODE_START
|
||||
|
||||
#if defined(HAVE_STACKTRACE) || defined(HAVE_BACKTRACE)
|
||||
void my_init_stacktrace();
|
||||
void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack);
|
||||
void my_safe_print_str(const char* name, const char* val, int max_len);
|
||||
void my_write_core(int sig);
|
||||
#if BACKTRACE_DEMANGLE
|
||||
char *my_demangle(const char *mangled_name, int *status);
|
||||
#endif
|
||||
#ifdef __WIN__
|
||||
void my_set_exception_pointers(EXCEPTION_POINTERS *ep);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WRITE_CORE
|
||||
void my_write_core(int sig);
|
||||
#endif
|
||||
|
||||
C_MODE_END
|
||||
|
||||
#endif /* _my_stacktrace_h_ */
|
||||
@@ -185,8 +185,7 @@ SET(LIBMYSQLD_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
|
||||
../sql/strfunc.cc ../sql/table.cc ../sql/thr_malloc.cc
|
||||
../sql/time.cc ../sql/tztime.cc ../sql/uniques.cc ../sql/unireg.cc
|
||||
../sql/partition_info.cc ../sql/sql_connect.cc
|
||||
../sql/scheduler.cc ../sql/stacktrace.c
|
||||
../sql/event_parse_data.cc
|
||||
../sql/scheduler.cc ../sql/event_parse_data.cc
|
||||
${GEN_SOURCES}
|
||||
${LIB_SOURCES})
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
|
||||
sql_select.cc sql_do.cc sql_show.cc set_var.cc \
|
||||
sql_string.cc sql_table.cc sql_test.cc sql_udf.cc \
|
||||
sql_update.cc sql_yacc.cc table.cc thr_malloc.cc time.cc \
|
||||
unireg.cc uniques.cc stacktrace.c sql_union.cc hash_filo.cc \
|
||||
unireg.cc uniques.cc sql_union.cc hash_filo.cc \
|
||||
spatial.cc gstream.cc sql_help.cc tztime.cc sql_cursor.cc \
|
||||
sp_head.cc sp_pcontext.cc sp.cc sp_cache.cc sp_rcontext.cc \
|
||||
parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \
|
||||
|
||||
@@ -447,7 +447,8 @@ int emb_load_querycache_result(THD *thd, Querycache_stream *src)
|
||||
if (thd->protocol == &thd->protocol_binary)
|
||||
{
|
||||
uint length;
|
||||
row= (MYSQL_ROWS *)alloc_root(&data->alloc, rows * sizeof(MYSQL_ROWS));
|
||||
row= (MYSQL_ROWS *)alloc_root(&data->alloc,
|
||||
(size_t) (rows * sizeof(MYSQL_ROWS)));
|
||||
end_row= row + rows;
|
||||
data->data= row;
|
||||
|
||||
|
||||
@@ -79,6 +79,15 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
|
||||
my_bool result= 1;
|
||||
THD *thd=(THD *) mysql->thd;
|
||||
NET *net= &mysql->net;
|
||||
my_bool stmt_skip= stmt ? stmt->state != MYSQL_STMT_INIT_DONE : FALSE;
|
||||
|
||||
if (!thd)
|
||||
{
|
||||
/* Do "reconnect" if possible */
|
||||
if (mysql_reconnect(mysql) || stmt_skip)
|
||||
return 1;
|
||||
thd= (THD *) mysql->thd;
|
||||
}
|
||||
|
||||
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
|
||||
thd->profiling.start_new_query();
|
||||
|
||||
@@ -265,6 +265,22 @@ eval SELECT "$last_error" AS Last_SQL_Error;
|
||||
enable_query_log;
|
||||
query_vertical SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
|
||||
|
||||
# BUG#37076: TIMESTAMP/DATETIME values are not replicated correctly
|
||||
# between machines with mixed endiannes
|
||||
# (regression test)
|
||||
|
||||
--echo **** Test for BUG#37076 ****
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (a TIMESTAMP, b DATETIME, c DATE);
|
||||
INSERT INTO t1 VALUES(
|
||||
'2005-11-14 01:01:01', '2005-11-14 01:01:02', '2005-11-14');
|
||||
|
||||
--echo **** On Slave ****
|
||||
sync_slave_with_master slave;
|
||||
SELECT * FROM t1;
|
||||
|
||||
#
|
||||
# cleanup
|
||||
#
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- require r/have_big5.require
|
||||
disable_query_log;
|
||||
show collation like "big5_chinese_ci";
|
||||
show collation like 'big5_chinese_ci';
|
||||
enable_query_log;
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
|
||||
-- require r/have_binlog_format_mixed.require
|
||||
disable_query_log;
|
||||
show variables like "binlog_format";
|
||||
show variables like 'binlog_format';
|
||||
enable_query_log;
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
--require r/have_binlog_format_row.require
|
||||
--disable_query_log
|
||||
--replace_result MIXED ROW
|
||||
show variables like "binlog_format";
|
||||
show variables like 'binlog_format';
|
||||
--enable_query_log
|
||||
|
||||
@@ -4,5 +4,5 @@ source include/have_log_bin.inc;
|
||||
--require r/have_binlog_format_statement.require
|
||||
--disable_query_log
|
||||
--replace_result MIXED STATEMENT
|
||||
show variables like "binlog_format";
|
||||
show variables like 'binlog_format';
|
||||
--enable_query_log
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
|
||||
-- require r/have_binlog_format_row.require
|
||||
disable_query_log;
|
||||
show variables like "binlog_format";
|
||||
show variables like 'binlog_format';
|
||||
enable_query_log;
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
-- require r/have_binlog_format_statement.require
|
||||
--disable_query_log
|
||||
--replace_result ROW STATEMENT
|
||||
show variables like "binlog_format";
|
||||
show variables like 'binlog_format';
|
||||
--enable_query_log
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
|
||||
-- require r/have_binlog_format_statement.require
|
||||
disable_query_log;
|
||||
show variables like "binlog_format";
|
||||
show variables like 'binlog_format';
|
||||
enable_query_log;
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
#
|
||||
--require r/have_bug25714.require
|
||||
disable_query_log;
|
||||
eval select LENGTH("$MYSQL_BUG25714") > 0 as "have_bug25714_exe";
|
||||
eval select LENGTH('$MYSQL_BUG25714') > 0 as 'have_bug25714_exe';
|
||||
enable_query_log;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
--require r/case_sensitive_file_system.require
|
||||
--disable_query_log
|
||||
show variables like "lower_case_file_system";
|
||||
show variables like 'lower_case_file_system';
|
||||
--enable_query_log
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
--require r/have_community_features.require
|
||||
--disable_query_log
|
||||
show variables like "have_community_features";
|
||||
show variables like 'have_community_features';
|
||||
--enable_query_log
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- require r/have_compress.require
|
||||
disable_query_log;
|
||||
show variables like "have_compress";
|
||||
show variables like 'have_compress';
|
||||
enable_query_log;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- require r/have_cp1250_ch.require
|
||||
disable_query_log;
|
||||
show collation like "cp1250_czech_cs";
|
||||
show collation like 'cp1250_czech_cs';
|
||||
enable_query_log;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- require r/have_cp932.require
|
||||
disable_query_log;
|
||||
show collation like "cp932_japanese_ci";
|
||||
show collation like 'cp932_japanese_ci';
|
||||
enable_query_log;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- require r/have_crypt.require
|
||||
disable_query_log;
|
||||
show variables like "have_crypt";
|
||||
show variables like 'have_crypt';
|
||||
enable_query_log;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- require r/have_debug.require
|
||||
disable_query_log;
|
||||
select (version() like "%debug%") as debug;
|
||||
select (version() like '%debug%') as debug;
|
||||
enable_query_log;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- require r/have_eucjpms.require
|
||||
disable_query_log;
|
||||
show collation like "eucjpms_japanese_ci";
|
||||
show collation like 'eucjpms_japanese_ci';
|
||||
enable_query_log;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- require r/have_euckr.require
|
||||
disable_query_log;
|
||||
show collation like "euckr_korean_ci";
|
||||
show collation like 'euckr_korean_ci';
|
||||
enable_query_log;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#
|
||||
--require r/have_dynamic_loading.require
|
||||
disable_query_log;
|
||||
show variables like "have_dynamic_loading";
|
||||
show variables like 'have_dynamic_loading';
|
||||
enable_query_log;
|
||||
|
||||
#
|
||||
@@ -12,5 +12,5 @@ enable_query_log;
|
||||
#
|
||||
--require r/have_example_plugin.require
|
||||
disable_query_log;
|
||||
eval select LENGTH("$EXAMPLE_PLUGIN") > 0 as "have_example_plugin";
|
||||
eval select LENGTH('$EXAMPLE_PLUGIN') > 0 as 'have_example_plugin';
|
||||
enable_query_log;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- require r/have_gb2312.require
|
||||
disable_query_log;
|
||||
show collation like "gb2312_chinese_ci";
|
||||
show collation like 'gb2312_chinese_ci';
|
||||
enable_query_log;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- require r/have_gbk.require
|
||||
disable_query_log;
|
||||
show collation like "gbk_chinese_ci";
|
||||
show collation like 'gbk_chinese_ci';
|
||||
enable_query_log;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
--require r/have_geometry.require
|
||||
--disable_query_log
|
||||
show variables like "have_geometry";
|
||||
show variables like 'have_geometry';
|
||||
--enable_query_log
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- require r/have_latin2_ch.require
|
||||
disable_query_log;
|
||||
show collation like "latin2_czech_cs";
|
||||
show collation like 'latin2_czech_cs';
|
||||
enable_query_log;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- require r/have_log_bin.require
|
||||
disable_query_log;
|
||||
show variables like "log_bin";
|
||||
show variables like 'log_bin';
|
||||
enable_query_log;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
--require r/lowercase0.require
|
||||
--disable_query_log
|
||||
show variables like "lower_case_%";
|
||||
show variables like 'lower_case_%';
|
||||
--enable_query_log
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
--require r/have_ndbapi_examples.require
|
||||
disable_query_log;
|
||||
eval select LENGTH("$MY_NDB_EXAMPLES_BINARY") > 0 as "have_ndb_example";
|
||||
eval select LENGTH('$MY_NDB_EXAMPLES_BINARY') > 0 as 'have_ndb_example';
|
||||
enable_query_log;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
-- require r/have_outfile.require
|
||||
disable_query_log;
|
||||
select load_file(concat(@tmpdir,"/outfile.test"));
|
||||
select load_file(concat(@tmpdir,'/outfile.test'));
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/outfile.test
|
||||
enable_query_log;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- require r/have_partition.require
|
||||
disable_query_log;
|
||||
show variables like "have_partitioning";
|
||||
show variables like 'have_partitioning';
|
||||
enable_query_log;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- require r/have_query_cache.require
|
||||
disable_query_log;
|
||||
show variables like "have_query_cache";
|
||||
show variables like 'have_query_cache';
|
||||
enable_query_log;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- require r/have_sjis.require
|
||||
disable_query_log;
|
||||
show collation like "sjis_japanese_ci";
|
||||
show collation like 'sjis_japanese_ci';
|
||||
enable_query_log;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- require r/have_ssl.require
|
||||
disable_query_log;
|
||||
show variables like "have_ssl";
|
||||
show variables like 'have_ssl';
|
||||
enable_query_log;
|
||||
|
||||
@@ -6,5 +6,5 @@
|
||||
-- require r/have_symlink.require
|
||||
|
||||
disable_query_log;
|
||||
show variables like "have_symlink";
|
||||
show variables like 'have_symlink';
|
||||
enable_query_log;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- require r/have_tis620.require
|
||||
disable_query_log;
|
||||
show collation like "tis620_thai_ci";
|
||||
show collation like 'tis620_thai_ci';
|
||||
enable_query_log;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- require r/have_ucs2.require
|
||||
disable_query_log;
|
||||
show collation like "ucs2_general_ci";
|
||||
show collation like 'ucs2_general_ci';
|
||||
enable_query_log;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#
|
||||
--require r/have_dynamic_loading.require
|
||||
disable_query_log;
|
||||
show variables like "have_dynamic_loading";
|
||||
show variables like 'have_dynamic_loading';
|
||||
enable_query_log;
|
||||
|
||||
#
|
||||
@@ -12,5 +12,5 @@ enable_query_log;
|
||||
#
|
||||
--require r/have_udf_example.require
|
||||
disable_query_log;
|
||||
eval select LENGTH("$UDF_EXAMPLE_LIB") > 0 as "have_udf_example_lib";
|
||||
eval select LENGTH('$UDF_EXAMPLE_LIB') > 0 as 'have_udf_example_lib';
|
||||
enable_query_log;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- require r/have_ujis.require
|
||||
disable_query_log;
|
||||
show collation like "ujis_japanese_ci";
|
||||
show collation like 'ujis_japanese_ci';
|
||||
enable_query_log;
|
||||
|
||||
@@ -1103,6 +1103,24 @@ set @my_innodb_commit_concurrency=@@global.innodb_commit_concurrency;
|
||||
set global innodb_commit_concurrency=0;
|
||||
set global innodb_commit_concurrency=@my_innodb_commit_concurrency;
|
||||
|
||||
#
|
||||
# Bug #37830: ORDER BY ASC/DESC - no difference
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a int, b int, c int, PRIMARY KEY (a), KEY t1_b (b))
|
||||
ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO t1 (a,b,c) VALUES (1,1,1), (2,1,1), (3,1,1), (4,1,1);
|
||||
INSERT INTO t1 (a,b,c) SELECT a+4,b,c FROM t1;
|
||||
|
||||
# should be range access
|
||||
EXPLAIN SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5;
|
||||
|
||||
# should produce '8 7 6 5 4' for a
|
||||
SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
# Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY
|
||||
@@ -1428,29 +1446,31 @@ DROP TABLE t1;
|
||||
# Bug#21704: Renaming column does not update FK definition.
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1(id INT PRIMARY KEY)
|
||||
ENGINE=innodb;
|
||||
|
||||
CREATE TABLE t2(
|
||||
t1_id INT PRIMARY KEY,
|
||||
CONSTRAINT fk1 FOREIGN KEY (t1_id) REFERENCES t1(id))
|
||||
ENGINE=innodb;
|
||||
|
||||
--echo
|
||||
|
||||
--disable_result_log
|
||||
--error ER_ERROR_ON_RENAME
|
||||
ALTER TABLE t1 CHANGE id id2 INT;
|
||||
--enable_result_log
|
||||
|
||||
--echo
|
||||
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# --disable_warnings
|
||||
# DROP TABLE IF EXISTS t1;
|
||||
# DROP TABLE IF EXISTS t2;
|
||||
# --enable_warnings
|
||||
#
|
||||
# CREATE TABLE t1(id INT PRIMARY KEY)
|
||||
# ENGINE=innodb;
|
||||
#
|
||||
# CREATE TABLE t2(
|
||||
# t1_id INT PRIMARY KEY,
|
||||
# CONSTRAINT fk1 FOREIGN KEY (t1_id) REFERENCES t1(id))
|
||||
# ENGINE=innodb;
|
||||
#
|
||||
# --echo
|
||||
#
|
||||
# --disable_result_log
|
||||
# --error ER_ERROR_ON_RENAME
|
||||
# ALTER TABLE t1 CHANGE id id2 INT;
|
||||
# --enable_result_log
|
||||
#
|
||||
# --echo
|
||||
#
|
||||
# DROP TABLE t2;
|
||||
# DROP TABLE t1;
|
||||
#
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
||||
@@ -1,32 +1,35 @@
|
||||
############## mysql-test\t\query_prealloc_size_basic.test ###############
|
||||
# #
|
||||
# Variable Name: query_prealloc_size #
|
||||
# Scope: GLOBAL | SESSION #
|
||||
# Access Type: Dynamic #
|
||||
# Data Type: numeric #
|
||||
# Default Value: 8192 #
|
||||
# Range: 8192-4294967295 #
|
||||
# #
|
||||
# #
|
||||
# Creation Date: 2008-02-07 #
|
||||
# Author: Rizwan #
|
||||
# #
|
||||
# Description: Test Cases of Dynamic System Variable query_prealloc_size #
|
||||
# that checks the behavior of this variable in the following ways#
|
||||
# * Default Value #
|
||||
# * Valid & Invalid values #
|
||||
# * Scope & Access method #
|
||||
# * Data Integrity #
|
||||
# #
|
||||
# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
|
||||
# server-system-variables.html #
|
||||
# #
|
||||
###############################################################################
|
||||
################# mysql-test\t\query_prealloc_size_basic.test ##################
|
||||
# #
|
||||
# Variable Name: query_prealloc_size #
|
||||
# Scope: GLOBAL | SESSION #
|
||||
# Access Type: Dynamic #
|
||||
# Data Type: numeric #
|
||||
# Default Value: 8192 #
|
||||
# Range: 8192-4294967295 #
|
||||
# #
|
||||
# #
|
||||
# Creation Date: 2008-02-07 #
|
||||
# Author: Rizwan #
|
||||
# #
|
||||
# Description: Test Cases of Dynamic System Variable query_prealloc_size #
|
||||
# that checks the behavior of this variable in the following ways #
|
||||
# * Default Value #
|
||||
# * Valid & Invalid values #
|
||||
# * Scope & Access method #
|
||||
# * Data Integrity #
|
||||
# #
|
||||
# Reference: #
|
||||
# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
|
||||
# #
|
||||
# Last Modification: #
|
||||
# 2008-07-14 hhunger removed values for 64 bit platforms. #
|
||||
# #
|
||||
################################################################################
|
||||
|
||||
--source include/load_sysvars.inc
|
||||
|
||||
########################################################################
|
||||
# START OF query_prealloc_size TESTS #
|
||||
# START OF query_prealloc_size TESTS #
|
||||
########################################################################
|
||||
|
||||
|
||||
@@ -42,7 +45,7 @@ SELECT @start_session_value;
|
||||
|
||||
--echo '#--------------------FN_DYNVARS_005_01-------------------------#'
|
||||
########################################################################
|
||||
# Display the DEFAULT value of myisam_block_size #
|
||||
# Display the DEFAULT value of myisam_block_size #
|
||||
########################################################################
|
||||
|
||||
SET @@global.query_prealloc_size = 100;
|
||||
@@ -56,7 +59,7 @@ SELECT @@session.query_prealloc_size ;
|
||||
|
||||
--echo '#--------------------FN_DYNVARS_005_02-------------------------#'
|
||||
########################################################################
|
||||
# Check the DEFAULT value of query_prealloc_size #
|
||||
# Check the DEFAULT value of query_prealloc_size #
|
||||
########################################################################
|
||||
|
||||
SET @@global.query_prealloc_size = DEFAULT;
|
||||
@@ -67,30 +70,32 @@ SELECT @@session.query_prealloc_size = 8192;
|
||||
|
||||
|
||||
--echo '#--------------------FN_DYNVARS_005_03-------------------------#'
|
||||
##################################################################################
|
||||
# Change the value of query_prealloc_size to a valid value for GLOBAL Scope #
|
||||
##################################################################################
|
||||
################################################################################
|
||||
# Change the value of query_prealloc_size to a valid value for GLOBAL Scope #
|
||||
################################################################################
|
||||
|
||||
SET @@global.query_prealloc_size = 8192;
|
||||
SELECT @@global.query_prealloc_size ;
|
||||
|
||||
SET @@global.query_prealloc_size = 4294967295;
|
||||
SELECT @@global.query_prealloc_size ;
|
||||
# Due to problems with 64 bit machines having less than 6 GB main memory.
|
||||
#SET @@global.query_prealloc_size = 4294967295;
|
||||
#SELECT @@global.query_prealloc_size ;
|
||||
|
||||
SET @@global.query_prealloc_size = 655354;
|
||||
SELECT @@global.query_prealloc_size ;
|
||||
|
||||
|
||||
--echo '#--------------------FN_DYNVARS_005_04-------------------------#'
|
||||
###################################################################################
|
||||
# Change the value of query_prealloc_size to a valid value for SESSION Scope #
|
||||
###################################################################################
|
||||
|
||||
##################################################################################
|
||||
# Change the value of query_prealloc_size to a valid value for SESSION Scope #
|
||||
##################################################################################
|
||||
|
||||
SET @@session.query_prealloc_size = 8192;
|
||||
SELECT @@session.query_prealloc_size ;
|
||||
|
||||
SET @@session.query_prealloc_size = 4294967295;
|
||||
SELECT @@session.query_prealloc_size ;
|
||||
# Due to problems with 64 bit machines having less than 6 GB main memory.
|
||||
#SET @@session.query_prealloc_size = 4294967295;
|
||||
#SELECT @@session.query_prealloc_size ;
|
||||
|
||||
SET @@session.query_prealloc_size = 655345;
|
||||
SELECT @@session.query_prealloc_size ;
|
||||
@@ -100,7 +105,7 @@ SELECT @@session.query_prealloc_size ;
|
||||
|
||||
--echo '#------------------FN_DYNVARS_005_05-----------------------#'
|
||||
####################################################################
|
||||
# Change the value of query_prealloc_size to an invalid value #
|
||||
# Change the value of query_prealloc_size to an invalid value #
|
||||
####################################################################
|
||||
|
||||
SET @@global.query_prealloc_size = 0;
|
||||
@@ -109,8 +114,9 @@ SELECT @@global.query_prealloc_size ;
|
||||
SET @@global.query_prealloc_size = -1024;
|
||||
SELECT @@global.query_prealloc_size ;
|
||||
|
||||
SET @@global.query_prealloc_size = 429496729533;
|
||||
SELECT @@global.query_prealloc_size ;
|
||||
# Due to problems with 64 bit machines having less than 6 GB main memory.
|
||||
#SET @@global.query_prealloc_size = 429496729533;
|
||||
#SELECT @@global.query_prealloc_size ;
|
||||
|
||||
|
||||
--Error ER_PARSE_ERROR
|
||||
@@ -161,8 +167,8 @@ SELECT @@session.query_prealloc_size ;
|
||||
####################################################################
|
||||
|
||||
|
||||
SELECT @@global.query_prealloc_size = VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
SELECT @@global.query_prealloc_size = VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
WHERE VARIABLE_NAME='query_prealloc_size ';
|
||||
|
||||
--echo '#------------------FN_DYNVARS_005_07-----------------------#'
|
||||
@@ -170,8 +176,8 @@ WHERE VARIABLE_NAME='query_prealloc_size ';
|
||||
# Check if the value in SESSION Table matches value in variable #
|
||||
####################################################################
|
||||
|
||||
SELECT @@session.query_prealloc_size = VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
|
||||
SELECT @@session.query_prealloc_size = VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
|
||||
WHERE VARIABLE_NAME='query_prealloc_size ';
|
||||
|
||||
|
||||
@@ -188,18 +194,19 @@ SELECT @@global.query_prealloc_size ;
|
||||
|
||||
|
||||
--echo '#---------------------FN_DYNVARS_001_09----------------------#'
|
||||
####################################################################################
|
||||
# Check if accessing variable with and without GLOBAL point to same variable #
|
||||
####################################################################################
|
||||
################################################################################
|
||||
# Check if accessing variable with and without GLOBAL point to same variable #
|
||||
################################################################################
|
||||
|
||||
SET @@global.query_prealloc_size = 10;
|
||||
SELECT @@query_prealloc_size = @@global.query_prealloc_size ;
|
||||
|
||||
|
||||
--echo '#---------------------FN_DYNVARS_001_10----------------------#'
|
||||
########################################################################################################
|
||||
# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
|
||||
########################################################################################################
|
||||
##############################################################################
|
||||
# Check if accessing variable with SESSION,LOCAL and without SCOPE points to #
|
||||
# to the same session variable #
|
||||
##############################################################################
|
||||
|
||||
SET @@query_prealloc_size = 100;
|
||||
SELECT @@query_prealloc_size = @@local.query_prealloc_size ;
|
||||
@@ -207,9 +214,9 @@ SELECT @@local.query_prealloc_size = @@session.query_prealloc_size ;
|
||||
|
||||
|
||||
--echo '#---------------------FN_DYNVARS_001_11----------------------#'
|
||||
###################################################################################
|
||||
# Check if query_prealloc_size can be accessed with and without @@ sign #
|
||||
###################################################################################
|
||||
################################################################################
|
||||
# Check if query_prealloc_size can be accessed with and without @@ sign #
|
||||
################################################################################
|
||||
|
||||
SET query_prealloc_size = 1;
|
||||
SELECT @@query_prealloc_size ;
|
||||
@@ -235,5 +242,6 @@ SELECT @@session.query_prealloc_size ;
|
||||
|
||||
|
||||
#############################################################
|
||||
# END OF query_prealloc_size TESTS #
|
||||
# END OF query_prealloc_size TESTS #
|
||||
#############################################################
|
||||
|
||||
|
||||
59
mysql-test/include/wait_condition.inc.moved
Normal file
59
mysql-test/include/wait_condition.inc.moved
Normal file
@@ -0,0 +1,59 @@
|
||||
# include/wait_condition.inc
|
||||
#
|
||||
# SUMMARY
|
||||
#
|
||||
# Waits until the passed statement returns true, or the operation
|
||||
# times out.
|
||||
#
|
||||
# USAGE
|
||||
#
|
||||
# let $wait_condition=
|
||||
# SELECT c = 3 FROM t;
|
||||
# --source include/wait_condition.inc
|
||||
#
|
||||
# OR
|
||||
#
|
||||
# let $wait_timeout= 60; # Override default 30 seconds with 60.
|
||||
# let $wait_condition=
|
||||
# SELECT c = 3 FROM t;
|
||||
# --source include/wait_condition.inc
|
||||
# --echo Executed the test condition $wait_condition_reps times
|
||||
#
|
||||
# EXAMPLE
|
||||
# events_bugs.test, events_time_zone.test
|
||||
#
|
||||
|
||||
--disable_query_log
|
||||
|
||||
let $wait_counter= 300;
|
||||
if ($wait_timeout)
|
||||
{
|
||||
let $wait_counter= `SELECT $wait_timeout * 10`;
|
||||
}
|
||||
# Reset $wait_timeout so that its value won't be used on subsequent
|
||||
# calls, and default will be used instead.
|
||||
let $wait_timeout= 0;
|
||||
|
||||
# Keep track of how many times the wait condition is tested
|
||||
# This is used by some tests (e.g., main.status)
|
||||
let $wait_condition_reps= 0;
|
||||
while ($wait_counter)
|
||||
{
|
||||
let $success= `$wait_condition`;
|
||||
inc $wait_condition_reps;
|
||||
if ($success)
|
||||
{
|
||||
let $wait_counter= 0;
|
||||
}
|
||||
if (!$success)
|
||||
{
|
||||
real_sleep 0.1;
|
||||
dec $wait_counter;
|
||||
}
|
||||
}
|
||||
if (!$success)
|
||||
{
|
||||
echo Timeout in wait_condition.inc for $wait_condition;
|
||||
}
|
||||
|
||||
--enable_query_log
|
||||
@@ -773,6 +773,13 @@ sub collect_one_test_case($$$$$$$$$) {
|
||||
if ( $::used_default_engine =~ /^innodb/i );
|
||||
}
|
||||
|
||||
#enable federated for this test
|
||||
if ($tinfo->{'federated_test'})
|
||||
{
|
||||
push(@{$tinfo->{'master_opt'}}, "--loose-federated");
|
||||
push(@{$tinfo->{'slave_opt'}}, "--loose-federated");
|
||||
}
|
||||
|
||||
if ( $tinfo->{'big_test'} and ! $::opt_big_test )
|
||||
{
|
||||
$tinfo->{'skip'}= 1;
|
||||
@@ -891,6 +898,8 @@ our @tags=
|
||||
["include/have_ndb_extra.inc", "ndb_extra", 1],
|
||||
["include/ndb_master-slave.inc", "ndb_test", 1],
|
||||
["require_manager", "require_manager", 1],
|
||||
["include/federated.inc", "federated_test", 1],
|
||||
["include/have_federated_db.inc", "federated_test", 1],
|
||||
);
|
||||
|
||||
sub mtr_options_from_test_file($$) {
|
||||
|
||||
@@ -112,6 +112,7 @@ our $glob_basedir;
|
||||
|
||||
our $path_charsetsdir;
|
||||
our $path_client_bindir;
|
||||
our $path_client_libdir;
|
||||
our $path_share;
|
||||
our $path_language;
|
||||
our $path_timefile;
|
||||
@@ -657,6 +658,8 @@ sub command_line_setup () {
|
||||
'vardir=s' => \$opt_vardir,
|
||||
'benchdir=s' => \$glob_mysql_bench_dir,
|
||||
'mem' => \$opt_mem,
|
||||
'client-bindir=s' => \$path_client_bindir,
|
||||
'client-libdir=s' => \$path_client_libdir,
|
||||
|
||||
# Misc
|
||||
'report-features' => \$opt_report_features,
|
||||
@@ -783,12 +786,20 @@ sub command_line_setup () {
|
||||
#
|
||||
|
||||
# Look for the client binaries directory
|
||||
$path_client_bindir= mtr_path_exists("$glob_basedir/client_release",
|
||||
"$glob_basedir/client_debug",
|
||||
vs_config_dirs('client', ''),
|
||||
"$glob_basedir/client",
|
||||
"$glob_basedir/bin");
|
||||
|
||||
if ($path_client_bindir)
|
||||
{
|
||||
# --client-bindir=path set on command line, check that the path exists
|
||||
$path_client_bindir= mtr_path_exists($path_client_bindir);
|
||||
}
|
||||
else
|
||||
{
|
||||
$path_client_bindir= mtr_path_exists("$glob_basedir/client_release",
|
||||
"$glob_basedir/client_debug",
|
||||
vs_config_dirs('client', ''),
|
||||
"$glob_basedir/client",
|
||||
"$glob_basedir/bin");
|
||||
}
|
||||
|
||||
# Look for language files and charsetsdir, use same share
|
||||
$path_share= mtr_path_exists("$glob_basedir/share/mysql",
|
||||
"$glob_basedir/sql/share",
|
||||
@@ -1837,19 +1848,25 @@ sub environment_setup () {
|
||||
|
||||
my @ld_library_paths;
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Setup LD_LIBRARY_PATH so the libraries from this distro/clone
|
||||
# are used in favor of the system installed ones
|
||||
# --------------------------------------------------------------------------
|
||||
if ( $source_dist )
|
||||
if ($path_client_libdir)
|
||||
{
|
||||
push(@ld_library_paths, "$glob_basedir/libmysql/.libs/",
|
||||
"$glob_basedir/libmysql_r/.libs/",
|
||||
"$glob_basedir/zlib.libs/");
|
||||
# Use the --client-libdir passed on commandline
|
||||
push(@ld_library_paths, "$path_client_libdir");
|
||||
}
|
||||
else
|
||||
{
|
||||
push(@ld_library_paths, "$glob_basedir/lib");
|
||||
# Setup LD_LIBRARY_PATH so the libraries from this distro/clone
|
||||
# are used in favor of the system installed ones
|
||||
if ( $source_dist )
|
||||
{
|
||||
push(@ld_library_paths, "$glob_basedir/libmysql/.libs/",
|
||||
"$glob_basedir/libmysql_r/.libs/",
|
||||
"$glob_basedir/zlib.libs/");
|
||||
}
|
||||
else
|
||||
{
|
||||
push(@ld_library_paths, "$glob_basedir/lib");
|
||||
}
|
||||
}
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
@@ -2091,6 +2108,9 @@ sub environment_setup () {
|
||||
{
|
||||
$cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir";
|
||||
}
|
||||
# Always use the given tmpdir for the LOAD files created
|
||||
# by mysqlbinlog
|
||||
$cmdline_mysqlbinlog .=" --local-load=$opt_tmpdir";
|
||||
|
||||
if ( $opt_debug )
|
||||
{
|
||||
@@ -5357,6 +5377,8 @@ Misc options
|
||||
warnings | log-warnings Pass --log-warnings to mysqld
|
||||
|
||||
sleep=SECONDS Passed to mysqltest, will be used as fixed sleep time
|
||||
client-bindir=PATH Path to the directory where client binaries are located
|
||||
client-libdir=PATH Path to the directory where client libraries are located
|
||||
|
||||
Deprecated options
|
||||
with-openssl Deprecated option for ssl
|
||||
|
||||
@@ -1184,3 +1184,42 @@ check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
drop table t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (id int, c int) character set latin1;
|
||||
INSERT INTO t1 VALUES (1,1);
|
||||
ALTER TABLE t1 CHANGE c d int;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
ALTER TABLE t1 CHANGE d c int;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
ALTER TABLE t1 MODIFY c VARCHAR(10);
|
||||
affected rows: 1
|
||||
info: Records: 1 Duplicates: 0 Warnings: 0
|
||||
ALTER TABLE t1 CHANGE c d varchar(10);
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
ALTER TABLE t1 CHANGE d c varchar(10);
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
DROP TABLE t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (id int, c int) character set utf8;
|
||||
INSERT INTO t1 VALUES (1,1);
|
||||
ALTER TABLE t1 CHANGE c d int;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
ALTER TABLE t1 CHANGE d c int;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
ALTER TABLE t1 MODIFY c VARCHAR(10);
|
||||
affected rows: 1
|
||||
info: Records: 1 Duplicates: 0 Warnings: 0
|
||||
ALTER TABLE t1 CHANGE c d varchar(10);
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
ALTER TABLE t1 CHANGE d c varchar(10);
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
set @old_concurrent_insert= @@global.concurrent_insert;
|
||||
set @@global.concurrent_insert= 0;
|
||||
drop table if exists t1;
|
||||
create table t1 (
|
||||
`a&b` int,
|
||||
`a<b` int,
|
||||
|
||||
@@ -45,7 +45,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*! AND 2=2;";
|
||||
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 '' at line 1
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*! AND 2=2;*";
|
||||
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 ';*' at line 1
|
||||
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 '*' at line 1
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*!98765' AND b = 'bar';";
|
||||
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 '/*!98765' AND b = 'bar'' at line 1
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*!98765' AND b = 'bar';*";
|
||||
|
||||
@@ -569,4 +569,10 @@ insert into t1 values (),(),(),(),(),(),(),(),(),();
|
||||
select a from t1 where a not in (a,a,a) group by a;
|
||||
a
|
||||
drop table t1;
|
||||
create table t1 (id int);
|
||||
select * from t1 where NOT id in (select null union all select 1);
|
||||
id
|
||||
select * from t1 where NOT id in (null, 1);
|
||||
id
|
||||
drop table t1;
|
||||
End of 5.1 tests
|
||||
|
||||
@@ -310,6 +310,20 @@ drop table t1;
|
||||
SELECT NAME_CONST('var', 'value') COLLATE latin1_general_cs;
|
||||
NAME_CONST('var', 'value') COLLATE latin1_general_cs
|
||||
value
|
||||
select @@session.time_zone into @save_tz;
|
||||
set @@session.time_zone='UTC';
|
||||
select uuid() into @my_uuid;
|
||||
select mid(@my_uuid,15,1);
|
||||
mid(@my_uuid,15,1)
|
||||
1
|
||||
select 24 * 60 * 60 * 1000 * 1000 * 10 into @my_uuid_one_day;
|
||||
select concat('0',mid(@my_uuid,16,3),mid(@my_uuid,10,4),left(@my_uuid,8)) into @my_uuidate;
|
||||
select floor(conv(@my_uuidate,16,10)/@my_uuid_one_day) into @my_uuid_date;
|
||||
select 141427 + datediff(curdate(),'1970-01-01') into @my_uuid_synthetic;
|
||||
select @my_uuid_date - @my_uuid_synthetic;
|
||||
@my_uuid_date - @my_uuid_synthetic
|
||||
0
|
||||
set @@session.time_zone=@save_tz;
|
||||
End of 5.0 tests
|
||||
select connection_id() > 0;
|
||||
connection_id() > 0
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
drop view if exists v1;
|
||||
drop table if exists t1,t4;
|
||||
create table t4 (
|
||||
pk_col int auto_increment primary key, a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
|
||||
) engine=innodb;
|
||||
@@ -70,3 +72,25 @@ explain select distinct f1, f2 from t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range NULL PRIMARY 5 NULL 3 Using index for group-by; Using temporary
|
||||
drop table t1;
|
||||
create table t1(pk int primary key) engine=innodb;
|
||||
create view v1 as select pk from t1 where pk < 20;
|
||||
insert into t1 values (1), (2), (3), (4);
|
||||
select distinct pk from v1;
|
||||
pk
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
insert into t1 values (5), (6), (7);
|
||||
select distinct pk from v1;
|
||||
pk
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
End of 5.1 tests
|
||||
|
||||
@@ -1362,6 +1362,21 @@ set global innodb_autoextend_increment=@my_innodb_autoextend_increment;
|
||||
set @my_innodb_commit_concurrency=@@global.innodb_commit_concurrency;
|
||||
set global innodb_commit_concurrency=0;
|
||||
set global innodb_commit_concurrency=@my_innodb_commit_concurrency;
|
||||
CREATE TABLE t1 (a int, b int, c int, PRIMARY KEY (a), KEY t1_b (b))
|
||||
ENGINE=InnoDB;
|
||||
INSERT INTO t1 (a,b,c) VALUES (1,1,1), (2,1,1), (3,1,1), (4,1,1);
|
||||
INSERT INTO t1 (a,b,c) SELECT a+4,b,c FROM t1;
|
||||
EXPLAIN SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index t1_b PRIMARY 4 NULL 8 Using where
|
||||
SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5;
|
||||
a b c
|
||||
8 1 1
|
||||
7 1 1
|
||||
6 1 1
|
||||
5 1 1
|
||||
4 1 1
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
CREATE TABLE `t2` (
|
||||
`k` int(11) NOT NULL auto_increment,
|
||||
@@ -1640,19 +1655,6 @@ vid tid idx name type
|
||||
3 1 2 c1 NULL
|
||||
3 1 1 pk NULL
|
||||
DROP TABLE t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
CREATE TABLE t1(id INT PRIMARY KEY)
|
||||
ENGINE=innodb;
|
||||
CREATE TABLE t2(
|
||||
t1_id INT PRIMARY KEY,
|
||||
CONSTRAINT fk1 FOREIGN KEY (t1_id) REFERENCES t1(id))
|
||||
ENGINE=innodb;
|
||||
|
||||
ALTER TABLE t1 CHANGE id id2 INT;
|
||||
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
drop table if exists t1, t2, t3;
|
||||
create table t1(a int);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
** Setup **
|
||||
|
||||
SET @default_max_user_connections = @@max_user_connections;
|
||||
SET @default_max_user_connections = @@global.max_user_connections;
|
||||
Set Global max_user_connections=2;
|
||||
'#--------------------FN_DYNVARS_114_01-------------------------#'
|
||||
** Connecting conn1 using username 'root' **
|
||||
@@ -9,10 +9,11 @@ Set Global max_user_connections=2;
|
||||
ERROR 42000: User root already has more than 'max_user_connections' active connections
|
||||
Expected error "too many connections"
|
||||
** Disconnecting conn1 **
|
||||
** Poll till disconnected conn1 disappears from processlist
|
||||
'#--------------------FN_DYNVARS_114_02-------------------------#'
|
||||
Set Global max_user_connections=3;
|
||||
** Connecting conn5 using username 'root' **
|
||||
** Connecting conn6 using username 'root' **
|
||||
** Connection default **
|
||||
** Disconnecting conn5, conn6 **
|
||||
SET GLOBAL max_user_connections = @default_max_user_connections;
|
||||
SET @@global.max_user_connections = @default_max_user_connections;
|
||||
|
||||
@@ -14,7 +14,7 @@ select otto from (select 1 as otto) as t1;
|
||||
otto
|
||||
1
|
||||
mysqltest: At line 1: query 'select otto from (select 1 as otto) as t1' succeeded - should have failed with sqlstate 42S22...
|
||||
mysqltest: At line 1: expecting a SQL-state (00000) from query 'remove_file /misc/mysql/forest/23921/51-23921/mysql-test/var/tmp/test_nonexistent.tmp' which cannot produce one...
|
||||
mysqltest: At line 1: expecting a SQL-state (00000) from query 'remove_file MYSQLTEST_VARDIR/tmp/test_nonexistent.tmp' which cannot produce one...
|
||||
select friedrich from (select 1 as otto) as t1;
|
||||
ERROR 42S22: Unknown column 'friedrich' in 'field list'
|
||||
mysqltest: At line 1: query 'select friedrich from (select 1 as otto) as t1' failed with wrong sqlstate 42S22: 'Unknown column 'friedrich' in 'field list'', instead of 00000...
|
||||
@@ -726,6 +726,9 @@ drop table t1;
|
||||
mysqltest: At line 1: change user failed: Unknown database 'inexistent'
|
||||
mysqltest: At line 1: change user failed: Access denied for user 'inexistent'@'localhost' (using password: NO)
|
||||
mysqltest: At line 1: change user failed: Access denied for user 'root'@'localhost' (using password: YES)
|
||||
file1.txt
|
||||
file1.txt
|
||||
file2.txt
|
||||
SELECT 'c:\\a.txt' AS col;
|
||||
col
|
||||
z
|
||||
|
||||
@@ -284,6 +284,74 @@ Field Type Null Key Default Extra
|
||||
DROP TABLE table_25930_a;
|
||||
DROP TABLE table_25930_b;
|
||||
SET @@sql_mode=@save_sql_mode;
|
||||
DROP PROCEDURE IF EXISTS p26030;
|
||||
select "non terminated"$$
|
||||
non terminated
|
||||
non terminated
|
||||
select "terminated";$$
|
||||
terminated
|
||||
terminated
|
||||
select "non terminated, space" $$
|
||||
non terminated, space
|
||||
non terminated, space
|
||||
select "terminated, space"; $$
|
||||
terminated, space
|
||||
terminated, space
|
||||
select "non terminated, comment" /* comment */$$
|
||||
non terminated, comment
|
||||
non terminated, comment
|
||||
select "terminated, comment"; /* comment */$$
|
||||
terminated, comment
|
||||
terminated, comment
|
||||
select "stmt 1";select "stmt 2 non terminated"$$
|
||||
stmt 1
|
||||
stmt 1
|
||||
stmt 2 non terminated
|
||||
stmt 2 non terminated
|
||||
select "stmt 1";select "stmt 2 terminated";$$
|
||||
stmt 1
|
||||
stmt 1
|
||||
stmt 2 terminated
|
||||
stmt 2 terminated
|
||||
select "stmt 1";select "stmt 2 non terminated, space" $$
|
||||
stmt 1
|
||||
stmt 1
|
||||
stmt 2 non terminated, space
|
||||
stmt 2 non terminated, space
|
||||
select "stmt 1";select "stmt 2 terminated, space"; $$
|
||||
stmt 1
|
||||
stmt 1
|
||||
stmt 2 terminated, space
|
||||
stmt 2 terminated, space
|
||||
select "stmt 1";select "stmt 2 non terminated, comment" /* comment */$$
|
||||
stmt 1
|
||||
stmt 1
|
||||
stmt 2 non terminated, comment
|
||||
stmt 2 non terminated, comment
|
||||
select "stmt 1";select "stmt 2 terminated, comment"; /* comment */$$
|
||||
stmt 1
|
||||
stmt 1
|
||||
stmt 2 terminated, comment
|
||||
stmt 2 terminated, comment
|
||||
select "stmt 1"; select "space, stmt 2"$$
|
||||
stmt 1
|
||||
stmt 1
|
||||
space, stmt 2
|
||||
space, stmt 2
|
||||
select "stmt 1";/* comment */select "comment, stmt 2"$$
|
||||
stmt 1
|
||||
stmt 1
|
||||
comment, stmt 2
|
||||
comment, stmt 2
|
||||
DROP PROCEDURE IF EXISTS p26030; CREATE PROCEDURE p26030() BEGIN SELECT 1; END; CALL p26030()
|
||||
$$
|
||||
1
|
||||
1
|
||||
DROP PROCEDURE IF EXISTS p26030; CREATE PROCEDURE p26030() SELECT 1; CALL p26030()
|
||||
$$
|
||||
1
|
||||
1
|
||||
DROP PROCEDURE p26030;
|
||||
select pi(3.14);
|
||||
ERROR 42000: Incorrect parameter count in the call to native function 'pi'
|
||||
select tan();
|
||||
|
||||
306
mysql-test/r/parser_stack.result
Normal file
306
mysql-test/r/parser_stack.result
Normal file
@@ -0,0 +1,306 @@
|
||||
use test;
|
||||
SELECT
|
||||
((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
1
|
||||
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
;
|
||||
1
|
||||
1
|
||||
prepare stmt from
|
||||
"
|
||||
SELECT
|
||||
((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
1
|
||||
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
"
|
||||
;
|
||||
execute stmt;
|
||||
1
|
||||
1
|
||||
drop view if exists view_overflow;
|
||||
CREATE VIEW view_overflow AS
|
||||
SELECT
|
||||
((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
1
|
||||
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
;
|
||||
SELECT * from view_overflow;
|
||||
1
|
||||
1
|
||||
drop view view_overflow;
|
||||
drop procedure if exists proc_overflow;
|
||||
CREATE PROCEDURE proc_overflow()
|
||||
BEGIN
|
||||
BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
|
||||
BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
|
||||
BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
|
||||
BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
|
||||
BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
|
||||
BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
|
||||
BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
|
||||
BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
|
||||
BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
|
||||
BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
|
||||
select 1;
|
||||
select 2;
|
||||
select 3;
|
||||
END; END; END; END; END; END; END; END; END; END; END; END;
|
||||
END; END; END; END; END; END; END; END; END; END; END; END;
|
||||
END; END; END; END; END; END; END; END; END; END; END; END;
|
||||
END; END; END; END; END; END; END; END; END; END; END; END;
|
||||
END; END; END; END; END; END; END; END; END; END; END; END;
|
||||
END; END; END; END; END; END; END; END; END; END; END; END;
|
||||
END; END; END; END; END; END; END; END; END; END; END; END;
|
||||
END; END; END; END; END; END; END; END; END; END; END; END;
|
||||
END; END; END; END; END; END; END; END; END; END; END; END;
|
||||
END; END; END; END; END; END; END; END; END; END; END; END;
|
||||
END $$
|
||||
call proc_overflow();
|
||||
1
|
||||
1
|
||||
2
|
||||
2
|
||||
3
|
||||
3
|
||||
drop procedure proc_overflow;
|
||||
drop function if exists func_overflow;
|
||||
create function func_overflow() returns int
|
||||
BEGIN
|
||||
DECLARE x int default 0;
|
||||
BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
|
||||
BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
|
||||
BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
|
||||
BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
|
||||
BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
|
||||
BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
|
||||
BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
|
||||
BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
|
||||
BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
|
||||
BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
|
||||
SET x=x+1;
|
||||
SET x=x+2;
|
||||
SET x=x+3;
|
||||
END; END; END; END; END; END; END; END; END; END; END; END;
|
||||
END; END; END; END; END; END; END; END; END; END; END; END;
|
||||
END; END; END; END; END; END; END; END; END; END; END; END;
|
||||
END; END; END; END; END; END; END; END; END; END; END; END;
|
||||
END; END; END; END; END; END; END; END; END; END; END; END;
|
||||
END; END; END; END; END; END; END; END; END; END; END; END;
|
||||
END; END; END; END; END; END; END; END; END; END; END; END;
|
||||
END; END; END; END; END; END; END; END; END; END; END; END;
|
||||
END; END; END; END; END; END; END; END; END; END; END; END;
|
||||
END; END; END; END; END; END; END; END; END; END; END; END;
|
||||
return x;
|
||||
END $$
|
||||
select func_overflow();
|
||||
func_overflow()
|
||||
6
|
||||
drop function func_overflow;
|
||||
drop table if exists table_overflow;
|
||||
create table table_overflow(a int, b int);
|
||||
create trigger trigger_overflow before insert on table_overflow
|
||||
for each row
|
||||
BEGIN
|
||||
BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
|
||||
BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
|
||||
BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
|
||||
BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
|
||||
BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
|
||||
BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
|
||||
BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
|
||||
BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
|
||||
BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
|
||||
BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
|
||||
SET NEW.b := NEW.a;
|
||||
SET NEW.b := NEW.b + 1;
|
||||
SET NEW.b := NEW.b + 2;
|
||||
SET NEW.b := NEW.b + 3;
|
||||
END; END; END; END; END; END; END; END; END; END; END; END;
|
||||
END; END; END; END; END; END; END; END; END; END; END; END;
|
||||
END; END; END; END; END; END; END; END; END; END; END; END;
|
||||
END; END; END; END; END; END; END; END; END; END; END; END;
|
||||
END; END; END; END; END; END; END; END; END; END; END; END;
|
||||
END; END; END; END; END; END; END; END; END; END; END; END;
|
||||
END; END; END; END; END; END; END; END; END; END; END; END;
|
||||
END; END; END; END; END; END; END; END; END; END; END; END;
|
||||
END; END; END; END; END; END; END; END; END; END; END; END;
|
||||
END; END; END; END; END; END; END; END; END; END; END; END;
|
||||
END $$
|
||||
insert into table_overflow set a=10;
|
||||
insert into table_overflow set a=20;
|
||||
select * from table_overflow;
|
||||
a b
|
||||
10 16
|
||||
20 26
|
||||
drop table table_overflow;
|
||||
drop procedure if exists proc_35577;
|
||||
CREATE PROCEDURE proc_35577()
|
||||
BEGIN
|
||||
DECLARE z_done INT DEFAULT 0;
|
||||
DECLARE t_done VARCHAR(5000);
|
||||
outer_loop: LOOP
|
||||
IF t_done=1 THEN
|
||||
LEAVE outer_loop;
|
||||
END IF;
|
||||
inner_block:BEGIN
|
||||
DECLARE z_done INT DEFAULT 0;
|
||||
SET z_done = 0;
|
||||
inner_loop: LOOP
|
||||
IF z_done=1 THEN
|
||||
LEAVE inner_loop;
|
||||
END IF;
|
||||
IF (t_done = 'a') THEN
|
||||
IF (t_done <> 0) THEN
|
||||
IF ( t_done > 0) THEN
|
||||
IF (t_done = 'a') THEN
|
||||
SET t_done = 'a';
|
||||
ELSEIF (t_done = 'a') THEN
|
||||
SET t_done = 'a';
|
||||
ELSEIF(t_done = 'a') THEN
|
||||
SET t_done = 'a';
|
||||
ELSEIF(t_done = 'a') THEN
|
||||
SET t_done = 'a';
|
||||
ELSEIF(t_done = 'a') THEN
|
||||
SET t_done = 'a';
|
||||
ELSEIF(t_done = 'a') THEN
|
||||
SET t_done = 'a';
|
||||
ELSEIF(t_done = 'a') THEN
|
||||
SET t_done = 'a';
|
||||
ELSEIF(t_done = 'a') THEN
|
||||
SET t_done = 'a';
|
||||
END IF;
|
||||
END IF;
|
||||
END IF;
|
||||
END IF;
|
||||
END LOOP inner_loop;
|
||||
END inner_block;
|
||||
END LOOP outer_loop;
|
||||
END $$
|
||||
drop procedure proc_35577;
|
||||
drop procedure if exists p_37269;
|
||||
create procedure p_37269()
|
||||
begin
|
||||
declare done int default 0;
|
||||
declare varb int default 0;
|
||||
declare vara int default 0;
|
||||
repeat
|
||||
select now();
|
||||
until done end repeat;
|
||||
while varb do
|
||||
select now();
|
||||
begin
|
||||
select now();
|
||||
repeat
|
||||
select now();
|
||||
until done end repeat;
|
||||
if vara then
|
||||
select now();
|
||||
repeat
|
||||
select now();
|
||||
loop
|
||||
select now();
|
||||
end loop;
|
||||
repeat
|
||||
select now();
|
||||
label1: while varb do
|
||||
select now();
|
||||
end while label1;
|
||||
if vara then
|
||||
select now();
|
||||
repeat
|
||||
select now();
|
||||
until done end repeat;
|
||||
begin
|
||||
select now();
|
||||
while varb do
|
||||
select now();
|
||||
label1: while varb do
|
||||
select now();
|
||||
end while label1;
|
||||
if vara then
|
||||
select now();
|
||||
while varb do
|
||||
select now();
|
||||
loop
|
||||
select now();
|
||||
end loop;
|
||||
repeat
|
||||
select now();
|
||||
loop
|
||||
select now();
|
||||
while varb do
|
||||
select now();
|
||||
end while;
|
||||
repeat
|
||||
select now();
|
||||
label1: loop
|
||||
select now();
|
||||
if vara then
|
||||
select now();
|
||||
end if;
|
||||
end loop label1;
|
||||
until done end repeat;
|
||||
end loop;
|
||||
until done end repeat;
|
||||
end while;
|
||||
end if;
|
||||
end while;
|
||||
end;
|
||||
end if;
|
||||
until done end repeat;
|
||||
until done end repeat;
|
||||
end if;
|
||||
end;
|
||||
end while;
|
||||
end $$
|
||||
drop procedure p_37269;
|
||||
drop procedure if exists p_37228;
|
||||
create procedure p_37228 ()
|
||||
BEGIN
|
||||
DECLARE v INT DEFAULT 123;
|
||||
IF (v > 1) THEN SET v = 1;
|
||||
ELSEIF (v < 10) THEN SET v = 10;
|
||||
ELSEIF (v < 11) THEN SET v = 11;
|
||||
ELSEIF (v < 12) THEN SET v = 12;
|
||||
ELSEIF (v < 13) THEN SET v = 13;
|
||||
ELSEIF (v < 14) THEN SET v = 14;
|
||||
ELSEIF (v < 15) THEN SET v = 15;
|
||||
ELSEIF (v < 16) THEN SET v = 16;
|
||||
ELSEIF (v < 17) THEN SET v = 17;
|
||||
ELSEIF (v < 18) THEN SET v = 18;
|
||||
ELSEIF (v < 19) THEN SET v = 19;
|
||||
ELSEIF (v < 20) THEN SET v = 20;
|
||||
ELSEIF (v < 21) THEN SET v = 21;
|
||||
ELSEIF (v < 22) THEN SET v = 22;
|
||||
ELSEIF (v < 23) THEN SET v = 23;
|
||||
ELSEIF (v < 24) THEN SET v = 24;
|
||||
ELSEIF (v < 25) THEN SET v = 25;
|
||||
ELSEIF (v < 26) THEN SET v = 26;
|
||||
ELSEIF (v < 27) THEN SET v = 27;
|
||||
ELSEIF (v < 28) THEN SET v = 28;
|
||||
ELSEIF (v < 29) THEN SET v = 29;
|
||||
ELSEIF (v < 30) THEN SET v = 30;
|
||||
ELSEIF (v < 31) THEN SET v = 31;
|
||||
ELSEIF (v < 32) THEN SET v = 32;
|
||||
ELSEIF (v < 33) THEN SET v = 33;
|
||||
ELSEIF (v < 34) THEN SET v = 34;
|
||||
ELSEIF (v < 35) THEN SET v = 35;
|
||||
ELSEIF (v < 36) THEN SET v = 36;
|
||||
ELSEIF (v < 37) THEN SET v = 37;
|
||||
ELSEIF (v < 38) THEN SET v = 38;
|
||||
ELSEIF (v < 39) THEN SET v = 39;
|
||||
END IF;
|
||||
END $$
|
||||
drop procedure p_37228;
|
||||
@@ -1,4 +1,206 @@
|
||||
drop table if exists t1;
|
||||
drop table if exists t1, t2;
|
||||
CREATE TABLE t1 (
|
||||
a INT NOT NULL,
|
||||
b MEDIUMINT NOT NULL,
|
||||
c INT NOT NULL,
|
||||
KEY b (b)
|
||||
) ENGINE=MyISAM
|
||||
PARTITION BY LIST (a) (
|
||||
PARTITION p0 VALUES IN (1)
|
||||
);
|
||||
INSERT INTO t1 VALUES (1,1,0), (1,1,1), (1,1,2), (1,1,53), (1,1,4), (1,1,5),
|
||||
(1,1,6), (1,1,7), (1,1,8), (1,1,9), (1,1,10), (1,1,11), (1,1,12), (1,1,13),
|
||||
(1,1,14), (1,1,15), (1,1,16), (1,1,67), (1,1,18), (1,1,19), (1,1,20), (1,1,21),
|
||||
(1,1,22), (1,1,23), (1,1,24), (1,1,75), (1,1,26), (1,1,27), (1,1,128),
|
||||
(1,1,79), (1,1,30), (1,1,31), (1,1,32), (1,1,33), (1,1,34), (1,1,85), (1,1,36),
|
||||
(1,1,37), (1,1,38), (1,1,39), (1,1,40), (1,1,241), (1,1,42), (1,1,43),
|
||||
(1,1,44), (1,1,45), (1,1,46), (1,1,147), (1,1,48), (1,1,49), (1,2,0), (1,2,1),
|
||||
(1,2,2), (1,2,3), (1,2,4), (1,2,5), (1,2,6), (1,2,7), (1,2,8), (1,2,9),
|
||||
(1,2,10), (1,2,11), (1,2,12), (1,2,13), (1,2,14), (1,2,15), (1,2,16), (1,2,17),
|
||||
(1,2,18), (1,2,19), (1,2,20), (1,2,21), (1,2,22), (1,2,23), (1,2,24), (1,2,25),
|
||||
(1,2,26), (1,2,27), (1,2,28), (1,2,29), (1,2,30), (1,2,31), (1,2,32), (1,2,33),
|
||||
(1,2,34), (1,2,35), (1,2,36), (1,2,37), (1,2,38), (1,2,39), (1,2,40), (1,2,41),
|
||||
(1,2,42), (1,2,43), (1,2,44), (1,2,45), (1,2,46), (1,2,47), (1,2,48), (1,2,49),
|
||||
(1,6,0), (1,6,1), (1,6,2), (1,6,3), (1,6,4), (1,6,5), (1,6,6), (1,6,7),
|
||||
(1,6,8), (1,6,9), (1,6,10), (1,6,11), (1,6,12), (1,6,13), (1,6,14), (1,6,15),
|
||||
(1,6,16), (1,6,17), (1,6,18), (1,6,19), (1,6,20), (1,6,21), (1,6,22), (1,6,23),
|
||||
(1,6,24), (1,6,25), (1,6,26), (1,6,27), (1,6,28), (1,6,29), (1,6,30), (1,6,31),
|
||||
(1,6,32), (1,6,33), (1,6,34), (1,6,35), (1,6,36), (1,6,37), (1,6,38), (1,6,39),
|
||||
(1,6,40), (1,6,41), (1,6,42), (1,6,43), (1,6,44), (1,6,45), (1,6,46), (1,6,47),
|
||||
(1,6,48), (1,6,49), (1,7,0), (1,7,1), (1,7,2), (1,7,3), (1,7,4), (1,7,5),
|
||||
(1,7,6), (1,7,7), (1,7,8), (1,7,9), (1,7,10), (1,7,11), (1,7,12), (1,7,13),
|
||||
(1,7,14), (1,7,15), (1,7,16), (1,7,17), (1,7,18), (1,7,19), (1,7,20), (1,7,21),
|
||||
(1,7,22), (1,7,23), (1,7,24), (1,7,25), (1,7,26), (1,7,27), (1,7,28), (1,7,29),
|
||||
(1,7,30), (1,7,31), (1,7,32), (1,7,33), (1,7,34), (1,7,35), (1,7,38), (1,7,39),
|
||||
(1,7,90), (1,7,41), (1,7,43), (1,7,48), (1,7,49), (1,9,0), (1,9,1), (1,9,2),
|
||||
(1,9,3), (1,9,4), (1,9,5), (1,9,6), (1,9,7), (1,9,8), (1,9,9), (1,9,10),
|
||||
(1,9,11), (1,9,12), (1,9,13), (1,9,14), (1,9,15), (1,9,16), (1,9,17), (1,9,18),
|
||||
(1,9,19), (1,9,20), (1,9,21), (1,9,22), (1,9,23), (1,9,24), (1,9,25), (1,9,26),
|
||||
(1,9,29), (1,9,32), (1,9,35), (1,9,38), (1,10,0), (1,10,1), (1,10,2), (1,10,3),
|
||||
(1,10,4), (1,10,5), (1,10,6), (1,10,7), (1,10,8), (1,10,9), (1,10,10),
|
||||
(1,10,11), (1,10,13), (1,10,14), (1,10,15), (1,10,16), (1,10,17), (1,10,18),
|
||||
(1,10,22), (1,10,24), (1,10,25), (1,10,26), (1,10,28), (1,10,131), (1,10,33),
|
||||
(1,10,84), (1,10,35), (1,10,40), (1,10,42), (1,10,49), (1,11,0), (1,11,1),
|
||||
(1,11,2), (1,11,3), (1,11,4), (1,11,5), (1,11,6), (1,11,7), (1,11,8), (1,11,9),
|
||||
(1,11,10), (1,11,11), (1,11,12), (1,11,13), (1,11,14), (1,11,15), (1,11,16),
|
||||
(1,11,17), (1,11,18), (1,11,19), (1,11,20), (1,11,21), (1,11,22), (1,11,23),
|
||||
(1,11,24), (1,11,25), (1,11,26), (1,11,27), (1,11,28), (1,11,30), (1,11,31),
|
||||
(1,11,32), (1,11,33), (1,11,34), (1,11,35), (1,11,37), (1,11,39), (1,11,40),
|
||||
(1,11,42), (1,11,44), (1,11,45), (1,11,47), (1,11,48), (1,14,104), (1,14,58),
|
||||
(1,14,12), (1,14,13), (1,14,15), (1,14,16), (1,14,17), (1,14,34), (1,15,0),
|
||||
(1,15,1), (1,15,2), (1,15,3), (1,15,4), (1,15,5), (1,15,7), (1,15,9),
|
||||
(1,15,15), (1,15,27), (1,15,49), (1,16,0), (1,16,1), (1,16,3), (1,17,4),
|
||||
(1,19,1);
|
||||
SELECT COUNT(*) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
|
||||
COUNT(*)
|
||||
24
|
||||
SELECT SUM(c) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
|
||||
SUM(c)
|
||||
400
|
||||
ALTER TABLE t1 DROP INDEX b;
|
||||
SELECT COUNT(*) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
|
||||
COUNT(*)
|
||||
24
|
||||
SELECT SUM(c) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
|
||||
SUM(c)
|
||||
400
|
||||
ALTER TABLE t1 ENGINE = Memory;
|
||||
SELECT COUNT(*) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
|
||||
COUNT(*)
|
||||
24
|
||||
SELECT SUM(c) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
|
||||
SUM(c)
|
||||
400
|
||||
ALTER TABLE t1 ADD INDEX b USING HASH (b);
|
||||
SELECT COUNT(*) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
|
||||
COUNT(*)
|
||||
24
|
||||
SELECT SUM(c) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
|
||||
SUM(c)
|
||||
400
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE `t1` (
|
||||
`c1` int(11) DEFAULT NULL,
|
||||
KEY `c1` (`c1`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
CREATE TABLE `t2` (
|
||||
`c1` int(11) DEFAULT NULL,
|
||||
KEY `c1` (`c1`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c1) (PARTITION a VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION b VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */;
|
||||
INSERT INTO `t1` VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
|
||||
INSERT INTO `t2` VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
|
||||
EXPLAIN PARTITIONS SELECT c1 FROM t1 WHERE (c1 > 10 AND c1 < 13) OR (c1 > 17 AND c1 < 20);
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 NULL range c1 c1 5 NULL 4 Using where; Using index
|
||||
FLUSH STATUS;
|
||||
SELECT c1 FROM t1 WHERE (c1 > 10 AND c1 < 13) OR (c1 > 17 AND c1 < 20);
|
||||
c1
|
||||
11
|
||||
12
|
||||
18
|
||||
19
|
||||
SHOW STATUS LIKE 'Handler_read_%';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
Handler_read_key 2
|
||||
Handler_read_next 4
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_next 0
|
||||
EXPLAIN PARTITIONS SELECT c1 FROM t2 WHERE (c1 > 10 AND c1 < 13) OR (c1 > 17 AND c1 < 20);
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 a range c1 c1 5 NULL 4 Using where; Using index
|
||||
FLUSH STATUS;
|
||||
SELECT c1 FROM t2 WHERE (c1 > 10 AND c1 < 13) OR (c1 > 17 AND c1 < 20);
|
||||
c1
|
||||
11
|
||||
12
|
||||
18
|
||||
19
|
||||
SHOW STATUS LIKE 'Handler_read_%';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
Handler_read_key 2
|
||||
Handler_read_next 4
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_next 0
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE `t1` (
|
||||
`c1` int(11) DEFAULT NULL,
|
||||
KEY `c1` (`c1`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
CREATE TABLE `t2` (
|
||||
`c1` int(11) DEFAULT NULL,
|
||||
KEY `c1` (`c1`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c1) (PARTITION a VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION b VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */;
|
||||
INSERT INTO `t1` VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
|
||||
INSERT INTO `t2` VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
|
||||
EXPLAIN PARTITIONS SELECT c1 FROM t1 WHERE (c1 > 2 AND c1 < 5);
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 NULL range c1 c1 5 NULL 2 Using where; Using index
|
||||
FLUSH STATUS;
|
||||
SELECT c1 FROM t1 WHERE (c1 > 2 AND c1 < 5);
|
||||
c1
|
||||
3
|
||||
4
|
||||
SHOW STATUS LIKE 'Handler_read_%';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
Handler_read_key 1
|
||||
Handler_read_next 2
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_next 0
|
||||
EXPLAIN PARTITIONS SELECT c1 FROM t2 WHERE (c1 > 2 AND c1 < 5);
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 a range c1 c1 5 NULL 2 Using where; Using index
|
||||
FLUSH STATUS;
|
||||
SELECT c1 FROM t2 WHERE (c1 > 2 AND c1 < 5);
|
||||
c1
|
||||
3
|
||||
4
|
||||
SHOW STATUS LIKE 'Handler_read_%';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
Handler_read_key 1
|
||||
Handler_read_next 2
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_next 0
|
||||
EXPLAIN PARTITIONS SELECT c1 FROM t1 WHERE (c1 > 12 AND c1 < 15);
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 NULL range c1 c1 5 NULL 2 Using where; Using index
|
||||
FLUSH STATUS;
|
||||
SELECT c1 FROM t1 WHERE (c1 > 12 AND c1 < 15);
|
||||
c1
|
||||
13
|
||||
14
|
||||
SHOW STATUS LIKE 'Handler_read_%';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
Handler_read_key 1
|
||||
Handler_read_next 2
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_next 0
|
||||
EXPLAIN PARTITIONS SELECT c1 FROM t2 WHERE (c1 > 12 AND c1 < 15);
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 a range c1 c1 5 NULL 2 Using where; Using index
|
||||
FLUSH STATUS;
|
||||
SELECT c1 FROM t2 WHERE (c1 > 12 AND c1 < 15);
|
||||
c1
|
||||
13
|
||||
14
|
||||
SHOW STATUS LIKE 'Handler_read_%';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
Handler_read_key 1
|
||||
Handler_read_next 2
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_next 0
|
||||
DROP TABLE t1,t2;
|
||||
create table t1 (a int) partition by list ((a/3)*10 div 1)
|
||||
(partition p0 values in (0), partition p1 values in (1));
|
||||
ERROR HY000: This partition function is not allowed
|
||||
@@ -929,7 +1131,7 @@ NULL
|
||||
2
|
||||
explain partitions select * from t1 where a is null or a < 0 or a > 1;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 pn,p2 ALL NULL NULL NULL NULL 2 Using where
|
||||
1 SIMPLE t1 pn,p2 ALL NULL NULL NULL NULL 4 Using where
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, name VARCHAR(20))
|
||||
ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
|
||||
@@ -69,25 +69,25 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 Using where
|
||||
explain partitions select * from t1 where a is null or (a >= 5 and a <= 7);
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p0,p2,p3 ALL NULL NULL NULL NULL 7 Using where
|
||||
1 SIMPLE t1 p0,p2,p3 ALL NULL NULL NULL NULL 9 Using where
|
||||
explain partitions select * from t1 where a is null;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 3 Using where
|
||||
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 9 Using where
|
||||
explain partitions select * from t1 where a is not null;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 Using where
|
||||
explain partitions select * from t1 where a >= 1 and a < 3;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 5 Using where
|
||||
1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 9 Using where
|
||||
explain partitions select * from t1 where a >= 3 and a <= 5;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p1,p2 ALL NULL NULL NULL NULL 4 Using where
|
||||
1 SIMPLE t1 p1,p2 ALL NULL NULL NULL NULL 9 Using where
|
||||
explain partitions select * from t1 where a > 2 and a < 4;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 2 Using where
|
||||
1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 9 Using where
|
||||
explain partitions select * from t1 where a > 3 and a <= 6;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p2,p3 ALL NULL NULL NULL NULL 4 Using where
|
||||
1 SIMPLE t1 p2,p3 ALL NULL NULL NULL NULL 9 Using where
|
||||
explain partitions select * from t1 where a > 5;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 Using where
|
||||
|
||||
@@ -31,7 +31,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 p0,p1 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t2 where a=1 and b=1;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 2 Using where
|
||||
1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 3 Using where
|
||||
create table t3 (
|
||||
a int
|
||||
)
|
||||
@@ -89,25 +89,25 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
explain partitions select * from t5
|
||||
where (a=10 and b=1) or (a=10 and b=2) or (a=10 and b = 3);
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t5 p0_p0sp0,p0_p0sp1 ALL NULL NULL NULL NULL 2 Using where
|
||||
1 SIMPLE t5 p0_p0sp0,p0_p0sp1 ALL NULL NULL NULL NULL 4 Using where
|
||||
explain partitions select * from t5 where (a=10 and b=2) or (a=10 and b=3)
|
||||
or (a=10 and b = 4);
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t5 p0_p0sp0,p0_p0sp1,p1_p1sp0,p1_p1sp1 ALL NULL NULL NULL NULL 4 Using where
|
||||
explain partitions select * from t5 where (c=1 and d=1);
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t5 p0_p0sp0,p1_p1sp0 ALL NULL NULL NULL NULL 2 Using where
|
||||
1 SIMPLE t5 p0_p0sp0,p1_p1sp0 ALL NULL NULL NULL NULL 4 Using where
|
||||
explain partitions select * from t5 where (c=2 and d=1);
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t5 p0_p0sp1,p1_p1sp1 ALL NULL NULL NULL NULL 2 Using where
|
||||
1 SIMPLE t5 p0_p0sp1,p1_p1sp1 ALL NULL NULL NULL NULL 4 Using where
|
||||
explain partitions select * from t5 where (a=10 and b=2 and c=1 and d=1) or
|
||||
(c=2 and d=1);
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t5 p0_p0sp0,p0_p0sp1,p1_p1sp1 ALL NULL NULL NULL NULL 3 Using where
|
||||
1 SIMPLE t5 p0_p0sp0,p0_p0sp1,p1_p1sp1 ALL NULL NULL NULL NULL 4 Using where
|
||||
explain partitions select * from t5 where (a=10 and b=2 and c=1 and d=1) or
|
||||
(b=2 and c=2 and d=1);
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t5 p0_p0sp0,p0_p0sp1,p1_p1sp1 ALL NULL NULL NULL NULL 3 Using where
|
||||
1 SIMPLE t5 p0_p0sp0,p0_p0sp1,p1_p1sp1 ALL NULL NULL NULL NULL 4 Using where
|
||||
create table t6 (a int not null) partition by LIST(a) (
|
||||
partition p1 values in (1),
|
||||
partition p3 values in (3),
|
||||
@@ -145,7 +145,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t6 p5,p7,p9 system NULL NULL NULL NULL 1
|
||||
explain partitions select * from t6 where a >= 3 and a <= 8;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t6 p3,p5,p7 ALL NULL NULL NULL NULL 2 Using where
|
||||
1 SIMPLE t6 p3,p5,p7 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t6 where a > 3 and a < 5;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
@@ -187,7 +187,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t6 p5,p7,p9 system NULL NULL NULL NULL 1
|
||||
explain partitions select * from t6 where a >= 3 and a <= 8;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t6 p3,p5,p7 ALL NULL NULL NULL NULL 2 Using where
|
||||
1 SIMPLE t6 p3,p5,p7 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t6 where a > 3 and a < 5;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
@@ -342,7 +342,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
explain partitions
|
||||
select * from t1 X, t1 Y where X.a = Y.a and (X.a=1 or X.a=2);
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE X p1,p2 ALL a NULL NULL NULL 2 Using where
|
||||
1 SIMPLE X p1,p2 ALL a NULL NULL NULL 4 Using where
|
||||
1 SIMPLE Y p1,p2 ref a a 4 test.X.a 2
|
||||
drop table t1;
|
||||
create table t1 (a int) partition by hash(a) partitions 20;
|
||||
@@ -355,7 +355,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p1,p2 ALL NULL NULL NULL NULL 2 Using where
|
||||
explain partitions select * from t1 where a > 1 and a <= 3;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p2,p3 ALL NULL NULL NULL NULL 2 Using where
|
||||
1 SIMPLE t1 p2,p3 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t1 where a >= 1 and a <= 3;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p1,p2,p3 ALL NULL NULL NULL NULL 3 Using where
|
||||
@@ -445,22 +445,22 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 p0,p1,p2,p3,p4 ALL NULL NULL NULL NULL 1010
|
||||
explain partitions select * from t2 where a < 801 and a > 200;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 p1,p2,p3,p4 ALL NULL NULL NULL NULL 800 Using where
|
||||
1 SIMPLE t2 p1,p2,p3,p4 ALL NULL NULL NULL NULL 1010 Using where
|
||||
explain partitions select * from t2 where a < 801 and a > 800;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 p4 ALL NULL NULL NULL NULL 200 Using where
|
||||
1 SIMPLE t2 p4 ALL NULL NULL NULL NULL 1010 Using where
|
||||
explain partitions select * from t2 where a > 600;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 p3,p4 ALL NULL NULL NULL NULL 400 Using where
|
||||
1 SIMPLE t2 p3,p4 ALL NULL NULL NULL NULL 1010 Using where
|
||||
explain partitions select * from t2 where a > 600 and b = 1;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 p3,p4 ALL NULL NULL NULL NULL 400 Using where
|
||||
1 SIMPLE t2 p3,p4 ALL NULL NULL NULL NULL 1010 Using where
|
||||
explain partitions select * from t2 where a > 600 and b = 4;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 p3,p4 ALL NULL NULL NULL NULL 400 Using where
|
||||
1 SIMPLE t2 p3,p4 ALL NULL NULL NULL NULL 1010 Using where
|
||||
explain partitions select * from t2 where a > 600 and b = 5;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 p3,p4 ALL NULL NULL NULL NULL 400 Using where
|
||||
1 SIMPLE t2 p3,p4 ALL NULL NULL NULL NULL 1010 Using where
|
||||
explain partitions select * from t2 where b = 5;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 p0,p1,p2,p3,p4 ALL NULL NULL NULL NULL 1010 Using where
|
||||
@@ -515,19 +515,19 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 p0,p1,p2,p3,p4 ALL NULL NULL NULL NULL 910
|
||||
explain partitions select * from t2 where a = 101;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 110 Using where
|
||||
1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 910 Using where
|
||||
explain partitions select * from t2 where a = 550;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 p2 ALL NULL NULL NULL NULL 200 Using where
|
||||
1 SIMPLE t2 p2 ALL NULL NULL NULL NULL 910 Using where
|
||||
explain partitions select * from t2 where a = 833;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 p4 ALL NULL NULL NULL NULL 200 Using where
|
||||
1 SIMPLE t2 p4 ALL NULL NULL NULL NULL 910 Using where
|
||||
explain partitions select * from t2 where (a = 100 OR a = 900);
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 p0,p4 ALL NULL NULL NULL NULL 310 Using where
|
||||
1 SIMPLE t2 p0,p4 ALL NULL NULL NULL NULL 910 Using where
|
||||
explain partitions select * from t2 where (a > 100 AND a < 600);
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 p0,p1,p2,p3 ALL NULL NULL NULL NULL 710 Using where
|
||||
1 SIMPLE t2 p0,p1,p2,p3 ALL NULL NULL NULL NULL 910 Using where
|
||||
explain partitions select * from t2 where b = 4;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 76 Using where
|
||||
@@ -813,17 +813,17 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
explain partitions select * from t1
|
||||
where a >= 18446744073709551000-1 and a <= 18446744073709551000+1;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p3,p4 ALL NULL NULL NULL NULL 3 Using where
|
||||
1 SIMPLE t1 p3,p4 ALL NULL NULL NULL NULL 4 Using where
|
||||
explain partitions select * from t1
|
||||
where a between 18446744073709551001 and 18446744073709551002;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 2 Using where
|
||||
1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 4 Using where
|
||||
explain partitions select * from t1 where a = 18446744073709551000;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 2 Using where
|
||||
1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 4 Using where
|
||||
explain partitions select * from t1 where a = 18446744073709551613;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 2 Using where
|
||||
1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 4 Using where
|
||||
explain partitions select * from t1 where a = 18446744073709551614;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
@@ -850,10 +850,10 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 2 Using where
|
||||
explain partitions select * from t1 where a=0xFE;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p2 ALL NULL NULL NULL NULL 2 Using where
|
||||
1 SIMPLE t1 p2 ALL NULL NULL NULL NULL 4 Using where
|
||||
explain partitions select * from t2 where a=0xFE;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 p2 ALL NULL NULL NULL NULL 2 Using where
|
||||
1 SIMPLE t2 p2 ALL NULL NULL NULL NULL 4 Using where
|
||||
explain partitions select * from t1 where a > 0xFE AND a <= 0xFF;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
@@ -862,22 +862,22 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t1 where a >= 0xFE AND a <= 0xFF;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p2 ALL NULL NULL NULL NULL 2 Using where
|
||||
1 SIMPLE t1 p2 ALL NULL NULL NULL NULL 4 Using where
|
||||
explain partitions select * from t2 where a >= 0xFE AND a <= 0xFF;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 p2 ALL NULL NULL NULL NULL 2 Using where
|
||||
1 SIMPLE t2 p2 ALL NULL NULL NULL NULL 4 Using where
|
||||
explain partitions select * from t1 where a < 64 AND a >= 63;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 2 Using where
|
||||
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 4 Using where
|
||||
explain partitions select * from t2 where a < 64 AND a >= 63;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 2 Using where
|
||||
1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 4 Using where
|
||||
explain partitions select * from t1 where a <= 64 AND a >= 63;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 4 Using where
|
||||
1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 6 Using where
|
||||
explain partitions select * from t2 where a <= 64 AND a >= 63;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 p0,p1 ALL NULL NULL NULL NULL 4 Using where
|
||||
1 SIMPLE t2 p0,p1 ALL NULL NULL NULL NULL 6 Using where
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
create table t1(a bigint unsigned not null) partition by range(a+0) (
|
||||
|
||||
@@ -57,13 +57,13 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 pnull system NULL NULL NULL NULL 1
|
||||
explain partitions select * from t1 where a >= 0;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 2 Using where
|
||||
1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t1 where a < 0;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t1 where a <= 0;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 pnull,p0 ALL NULL NULL NULL NULL 2 Using where
|
||||
1 SIMPLE t1 pnull,p0 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t1 where a > 1;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
@@ -96,16 +96,16 @@ select * from t1 where a > 1;
|
||||
a b
|
||||
explain partitions select * from t1 where a is null;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 2 Using where
|
||||
1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 6 Using where
|
||||
explain partitions select * from t1 where a >= 0;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p0_p0sp0,p0_p0sp1,p1_p1sp0,p1_p1sp1 ALL NULL NULL NULL NULL 4 Using where
|
||||
1 SIMPLE t1 p0_p0sp0,p0_p0sp1,p1_p1sp0,p1_p1sp1 ALL NULL NULL NULL NULL 6 Using where
|
||||
explain partitions select * from t1 where a < 0;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 2 Using where
|
||||
1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 6 Using where
|
||||
explain partitions select * from t1 where a <= 0;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1,p0_p0sp0,p0_p0sp1 ALL NULL NULL NULL NULL 4 Using where
|
||||
1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1,p0_p0sp0,p0_p0sp1 ALL NULL NULL NULL NULL 6 Using where
|
||||
explain partitions select * from t1 where a > 1;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
|
||||
@@ -85,9 +85,9 @@ NULL
|
||||
NULL
|
||||
NULL
|
||||
prepare stmt6 from 'select 1; select2';
|
||||
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 '; select2' at line 1
|
||||
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 'select2' at line 1
|
||||
prepare stmt6 from 'insert into t1 values (5,"five"); select2';
|
||||
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 '; select2' at line 1
|
||||
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 'select2' at line 1
|
||||
explain prepare stmt6 from 'insert into t1 values (5,"five"); select2';
|
||||
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 'from 'insert into t1 values (5,"five"); select2'' at line 1
|
||||
create table t2
|
||||
|
||||
@@ -290,7 +290,7 @@ SUCCESS
|
||||
|
||||
# Test 7-b: dependent FUNCTION has changed
|
||||
#
|
||||
# Note, this scenario is not supported, subject of Bug#12093
|
||||
# Note, this scenario is supported, subject of Bug#12093
|
||||
#
|
||||
drop trigger t1_ai;
|
||||
create trigger t1_ai after insert on t1 for each row
|
||||
@@ -305,8 +305,7 @@ select @var;
|
||||
drop function f1;
|
||||
create function f1 (a int) returns int return 0;
|
||||
execute stmt using @var;
|
||||
ERROR 42000: FUNCTION test.f1 does not exist
|
||||
call p_verify_reprepare_count(0);
|
||||
call p_verify_reprepare_count(1);
|
||||
SUCCESS
|
||||
|
||||
drop function f1;
|
||||
@@ -359,8 +358,14 @@ a
|
||||
drop view v1;
|
||||
create view v1 as select a from t2;
|
||||
set @var=8;
|
||||
# XXX: bug, the SQL statement in the trigger is still
|
||||
# pointing at table 't3', since the view was expanded
|
||||
# at first statement execution.
|
||||
# Repreparation of the main statement doesn't cause repreparation
|
||||
# of trigger statements.
|
||||
execute stmt using @var;
|
||||
call p_verify_reprepare_count(0);
|
||||
ERROR 42S02: Table 'test.t3' doesn't exist
|
||||
call p_verify_reprepare_count(1);
|
||||
SUCCESS
|
||||
|
||||
#
|
||||
@@ -377,7 +382,6 @@ select * from t3;
|
||||
a
|
||||
6
|
||||
7
|
||||
8
|
||||
flush table t1;
|
||||
set @var=9;
|
||||
execute stmt using @var;
|
||||
@@ -392,7 +396,6 @@ select * from t3;
|
||||
a
|
||||
6
|
||||
7
|
||||
8
|
||||
drop view v1;
|
||||
drop table t1,t2,t3;
|
||||
# Test 7-d: dependent TABLE has changed
|
||||
@@ -798,14 +801,17 @@ SUCCESS
|
||||
|
||||
drop function f1;
|
||||
create function f1() returns int return 2;
|
||||
# XXX: Bug#12093. We only get a different error
|
||||
# XXX: Used to be another manifestation of Bug#12093.
|
||||
# We only used to get a different error
|
||||
# message because the non-existing procedure error is masked
|
||||
# by the view.
|
||||
execute stmt;
|
||||
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||
f1()
|
||||
2
|
||||
execute stmt;
|
||||
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||
call p_verify_reprepare_count(0);
|
||||
f1()
|
||||
2
|
||||
call p_verify_reprepare_count(1);
|
||||
SUCCESS
|
||||
|
||||
# Part 18b: dependent procedure has changed (referred to via a function)
|
||||
@@ -831,19 +837,20 @@ SUCCESS
|
||||
|
||||
drop procedure p1;
|
||||
create procedure p1(out x int) select max(a) from t2 into x;
|
||||
# XXX: bug. The prelocked list is not invalidated
|
||||
# and we keep opening table t1, whereas the procedure
|
||||
# XXX: used to be a bug. The prelocked list was not invalidated
|
||||
# and we kept opening table t1, whereas the procedure
|
||||
# is now referring to table t2
|
||||
execute stmt;
|
||||
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||
call p_verify_reprepare_count(0);
|
||||
f1()
|
||||
6
|
||||
call p_verify_reprepare_count(1);
|
||||
SUCCESS
|
||||
|
||||
flush table t1;
|
||||
execute stmt;
|
||||
f1()
|
||||
6
|
||||
call p_verify_reprepare_count(1);
|
||||
call p_verify_reprepare_count(0);
|
||||
SUCCESS
|
||||
|
||||
execute stmt;
|
||||
@@ -1528,7 +1535,6 @@ drop view v_27690_1;
|
||||
drop table v_27690_2;
|
||||
deallocate prepare stmt;
|
||||
#=====================================================================
|
||||
# TODO: fix the below two bugs and modify their tests
|
||||
#
|
||||
# Bug#21294 Executing a prepared statement that executes
|
||||
# a stored function which was recreat
|
||||
@@ -1541,12 +1547,14 @@ f1()
|
||||
drop function f1;
|
||||
create function f1() returns int return 10;
|
||||
execute stmt;
|
||||
ERROR 42000: FUNCTION test.f1 does not exist
|
||||
f1()
|
||||
10
|
||||
drop function f1;
|
||||
create function f1() returns int return 20;
|
||||
execute stmt;
|
||||
ERROR 42000: FUNCTION test.f1 does not exist
|
||||
call p_verify_reprepare_count(0);
|
||||
f1()
|
||||
20
|
||||
call p_verify_reprepare_count(2);
|
||||
SUCCESS
|
||||
|
||||
drop function f1;
|
||||
@@ -1573,19 +1581,21 @@ execute stmt_sp;
|
||||
a
|
||||
drop function f_12093_unrelated;
|
||||
drop procedure p_12093_unrelated;
|
||||
# XXX: bug
|
||||
# XXX: used to be a bug
|
||||
execute stmt_sf;
|
||||
ERROR 42000: FUNCTION test.f_12093 does not exist
|
||||
# XXX: bug
|
||||
f_12093()
|
||||
0
|
||||
# XXX: used to be a bug
|
||||
execute stmt_sp;
|
||||
ERROR 42000: PROCEDURE test.p_12093 does not exist
|
||||
# XXX: bug
|
||||
a
|
||||
# XXX: used to be a bug
|
||||
execute stmt_sf;
|
||||
ERROR 42000: FUNCTION test.f_12093 does not exist
|
||||
# XXX: bug
|
||||
f_12093()
|
||||
0
|
||||
# XXX: used to be a bug
|
||||
execute stmt_sp;
|
||||
ERROR 42000: PROCEDURE test.p_12093 does not exist
|
||||
call p_verify_reprepare_count(0);
|
||||
a
|
||||
call p_verify_reprepare_count(2);
|
||||
SUCCESS
|
||||
|
||||
drop table t_12093;
|
||||
|
||||
@@ -460,7 +460,7 @@ create schema mysqltest;
|
||||
end|
|
||||
execute stmt;
|
||||
ERROR 42000: PROCEDURE test.p1 does not exist
|
||||
call p_verify_reprepare_count(0);
|
||||
call p_verify_reprepare_count(1);
|
||||
SUCCESS
|
||||
|
||||
execute stmt;
|
||||
|
||||
@@ -35,10 +35,6 @@ SET @@global.query_prealloc_size = 8192;
|
||||
SELECT @@global.query_prealloc_size ;
|
||||
@@global.query_prealloc_size
|
||||
8192
|
||||
SET @@global.query_prealloc_size = 4294967295;
|
||||
SELECT @@global.query_prealloc_size ;
|
||||
@@global.query_prealloc_size
|
||||
4294966272
|
||||
SET @@global.query_prealloc_size = 655354;
|
||||
SELECT @@global.query_prealloc_size ;
|
||||
@@global.query_prealloc_size
|
||||
@@ -48,10 +44,6 @@ SET @@session.query_prealloc_size = 8192;
|
||||
SELECT @@session.query_prealloc_size ;
|
||||
@@session.query_prealloc_size
|
||||
8192
|
||||
SET @@session.query_prealloc_size = 4294967295;
|
||||
SELECT @@session.query_prealloc_size ;
|
||||
@@session.query_prealloc_size
|
||||
4294966272
|
||||
SET @@session.query_prealloc_size = 655345;
|
||||
SELECT @@session.query_prealloc_size ;
|
||||
@@session.query_prealloc_size
|
||||
@@ -69,37 +61,31 @@ Warning 1292 Truncated incorrect query_prealloc_size value: '0'
|
||||
SELECT @@global.query_prealloc_size ;
|
||||
@@global.query_prealloc_size
|
||||
8192
|
||||
SET @@global.query_prealloc_size = 429496729533;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect query_prealloc_size value: '429496729533'
|
||||
SELECT @@global.query_prealloc_size ;
|
||||
@@global.query_prealloc_size
|
||||
4294966272
|
||||
SET @@global.query_prealloc_size = 65530.34.;
|
||||
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 '.' at line 1
|
||||
SELECT @@global.query_prealloc_size ;
|
||||
@@global.query_prealloc_size
|
||||
4294966272
|
||||
8192
|
||||
SET @@global.query_prealloc_size = test;
|
||||
ERROR 42000: Incorrect argument type to variable 'query_prealloc_size'
|
||||
SELECT @@global.query_prealloc_size ;
|
||||
@@global.query_prealloc_size
|
||||
4294966272
|
||||
8192
|
||||
SET @@global.query_prealloc_size = "test";
|
||||
ERROR 42000: Incorrect argument type to variable 'query_prealloc_size'
|
||||
SELECT @@global.query_prealloc_size ;
|
||||
@@global.query_prealloc_size
|
||||
4294966272
|
||||
8192
|
||||
SET @@global.query_prealloc_size = 'test';
|
||||
ERROR 42000: Incorrect argument type to variable 'query_prealloc_size'
|
||||
SELECT @@global.query_prealloc_size ;
|
||||
@@global.query_prealloc_size
|
||||
4294966272
|
||||
8192
|
||||
SET @@global.query_prealloc_size = ON;
|
||||
ERROR 42000: Incorrect argument type to variable 'query_prealloc_size'
|
||||
SELECT @@global.query_prealloc_size ;
|
||||
@@global.query_prealloc_size
|
||||
4294966272
|
||||
8192
|
||||
SET @@session.query_prealloc_size = 0;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect query_prealloc_size value: '0'
|
||||
@@ -128,14 +114,14 @@ SELECT @@session.query_prealloc_size ;
|
||||
@@session.query_prealloc_size
|
||||
8192
|
||||
'#------------------FN_DYNVARS_005_06-----------------------#'
|
||||
SELECT @@global.query_prealloc_size = VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
SELECT @@global.query_prealloc_size = VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
WHERE VARIABLE_NAME='query_prealloc_size ';
|
||||
@@global.query_prealloc_size = VARIABLE_VALUE
|
||||
1
|
||||
'#------------------FN_DYNVARS_005_07-----------------------#'
|
||||
SELECT @@session.query_prealloc_size = VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
|
||||
SELECT @@session.query_prealloc_size = VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
|
||||
WHERE VARIABLE_NAME='query_prealloc_size ';
|
||||
@@session.query_prealloc_size = VARIABLE_VALUE
|
||||
1
|
||||
|
||||
@@ -35,10 +35,6 @@ SET @@global.query_prealloc_size = 8192;
|
||||
SELECT @@global.query_prealloc_size ;
|
||||
@@global.query_prealloc_size
|
||||
8192
|
||||
SET @@global.query_prealloc_size = 4294967295;
|
||||
SELECT @@global.query_prealloc_size ;
|
||||
@@global.query_prealloc_size
|
||||
4294966272
|
||||
SET @@global.query_prealloc_size = 655354;
|
||||
SELECT @@global.query_prealloc_size ;
|
||||
@@global.query_prealloc_size
|
||||
@@ -48,10 +44,6 @@ SET @@session.query_prealloc_size = 8192;
|
||||
SELECT @@session.query_prealloc_size ;
|
||||
@@session.query_prealloc_size
|
||||
8192
|
||||
SET @@session.query_prealloc_size = 4294967295;
|
||||
SELECT @@session.query_prealloc_size ;
|
||||
@@session.query_prealloc_size
|
||||
4294966272
|
||||
SET @@session.query_prealloc_size = 655345;
|
||||
SELECT @@session.query_prealloc_size ;
|
||||
@@session.query_prealloc_size
|
||||
@@ -69,35 +61,31 @@ Warning 1292 Truncated incorrect query_prealloc_size value: '0'
|
||||
SELECT @@global.query_prealloc_size ;
|
||||
@@global.query_prealloc_size
|
||||
8192
|
||||
SET @@global.query_prealloc_size = 429496729533;
|
||||
SELECT @@global.query_prealloc_size ;
|
||||
@@global.query_prealloc_size
|
||||
429496728576
|
||||
SET @@global.query_prealloc_size = 65530.34.;
|
||||
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 '.' at line 1
|
||||
SELECT @@global.query_prealloc_size ;
|
||||
@@global.query_prealloc_size
|
||||
429496728576
|
||||
8192
|
||||
SET @@global.query_prealloc_size = test;
|
||||
ERROR 42000: Incorrect argument type to variable 'query_prealloc_size'
|
||||
SELECT @@global.query_prealloc_size ;
|
||||
@@global.query_prealloc_size
|
||||
429496728576
|
||||
8192
|
||||
SET @@global.query_prealloc_size = "test";
|
||||
ERROR 42000: Incorrect argument type to variable 'query_prealloc_size'
|
||||
SELECT @@global.query_prealloc_size ;
|
||||
@@global.query_prealloc_size
|
||||
429496728576
|
||||
8192
|
||||
SET @@global.query_prealloc_size = 'test';
|
||||
ERROR 42000: Incorrect argument type to variable 'query_prealloc_size'
|
||||
SELECT @@global.query_prealloc_size ;
|
||||
@@global.query_prealloc_size
|
||||
429496728576
|
||||
8192
|
||||
SET @@global.query_prealloc_size = ON;
|
||||
ERROR 42000: Incorrect argument type to variable 'query_prealloc_size'
|
||||
SELECT @@global.query_prealloc_size ;
|
||||
@@global.query_prealloc_size
|
||||
429496728576
|
||||
8192
|
||||
SET @@session.query_prealloc_size = 0;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect query_prealloc_size value: '0'
|
||||
@@ -126,14 +114,14 @@ SELECT @@session.query_prealloc_size ;
|
||||
@@session.query_prealloc_size
|
||||
8192
|
||||
'#------------------FN_DYNVARS_005_06-----------------------#'
|
||||
SELECT @@global.query_prealloc_size = VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
SELECT @@global.query_prealloc_size = VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
WHERE VARIABLE_NAME='query_prealloc_size ';
|
||||
@@global.query_prealloc_size = VARIABLE_VALUE
|
||||
1
|
||||
'#------------------FN_DYNVARS_005_07-----------------------#'
|
||||
SELECT @@session.query_prealloc_size = VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
|
||||
SELECT @@session.query_prealloc_size = VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
|
||||
WHERE VARIABLE_NAME='query_prealloc_size ';
|
||||
@@session.query_prealloc_size = VARIABLE_VALUE
|
||||
1
|
||||
|
||||
@@ -130,7 +130,7 @@ test.t1 check error Table upgrade required. Please do "REPAIR TABLE `t1`" to fix
|
||||
# REPAIR old table USE_FRM should fail
|
||||
REPAIR TABLE t1 USE_FRM;
|
||||
Table Op Msg_type Msg_text
|
||||
t1 repair error Failed reparing incompatible .FRM file
|
||||
t1 repair error Failed repairing incompatible .frm file
|
||||
# Run REPAIR TABLE to upgrade .frm file
|
||||
REPAIR TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
|
||||
@@ -796,7 +796,7 @@ bug11834_2()
|
||||
10
|
||||
drop function bug11834_1;
|
||||
execute stmt;
|
||||
ERROR 42000: FUNCTION test.bug11834_2 does not exist
|
||||
ERROR 42000: FUNCTION test.bug11834_1 does not exist
|
||||
deallocate prepare stmt;
|
||||
drop function bug11834_2;
|
||||
DROP FUNCTION IF EXISTS bug12953|
|
||||
@@ -1045,7 +1045,8 @@ select bug12329();
|
||||
bug12329()
|
||||
101
|
||||
execute stmt1;
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
bug12329()
|
||||
101
|
||||
deallocate prepare stmt1;
|
||||
drop function bug12329;
|
||||
drop table t1, t2;
|
||||
|
||||
@@ -4391,3 +4391,11 @@ SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1);
|
||||
s1
|
||||
a
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(c int, KEY(c));
|
||||
CREATE TABLE t2(a int, b int);
|
||||
INSERT INTO t2 VALUES (1, 10), (2, NULL);
|
||||
INSERT INTO t1 VALUES (1), (3);
|
||||
SELECT * FROM t2 WHERE b NOT IN (SELECT max(t.c) FROM t1, t1 t WHERE t.c>10);
|
||||
a b
|
||||
DROP TABLE t1,t2;
|
||||
End of 5.0 tests.
|
||||
|
||||
12
mysql-test/r/subselect_debug.result
Normal file
12
mysql-test/r/subselect_debug.result
Normal file
@@ -0,0 +1,12 @@
|
||||
CREATE TABLE t1(id INT);
|
||||
INSERT INTO t1 VALUES (1),(2),(3),(4);
|
||||
INSERT INTO t1 SELECT a.id FROM t1 a,t1 b,t1 c,t1 d;
|
||||
SET SESSION debug="d,subselect_exec_fail";
|
||||
SELECT SUM(EXISTS(SELECT RAND() FROM t1)) FROM t1;
|
||||
SUM(EXISTS(SELECT RAND() FROM t1))
|
||||
0
|
||||
SELECT REVERSE(EXISTS(SELECT RAND() FROM t1));
|
||||
REVERSE(EXISTS(SELECT RAND() FROM t1))
|
||||
0
|
||||
SET SESSION debug=DEFAULT;
|
||||
DROP TABLE t1;
|
||||
@@ -95,3 +95,34 @@ table_28127_b CREATE TABLE `table_28127_b` (
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table table_28127_a;
|
||||
drop table table_28127_b;
|
||||
select 0b01000001;
|
||||
0b01000001
|
||||
A
|
||||
select 0x41;
|
||||
0x41
|
||||
A
|
||||
select b'01000001';
|
||||
b'01000001'
|
||||
A
|
||||
select x'41', 0+x'41';
|
||||
x'41' 0+x'41'
|
||||
A 65
|
||||
select N'abc', length(N'abc');
|
||||
abc length(N'abc')
|
||||
abc 3
|
||||
select N'', length(N'');
|
||||
length(N'')
|
||||
0
|
||||
select '', length('');
|
||||
length('')
|
||||
0
|
||||
select b'', 0+b'';
|
||||
b'' 0+b''
|
||||
0
|
||||
select x'', 0+x'';
|
||||
x'' 0+x''
|
||||
0
|
||||
select 0x;
|
||||
ERROR 42S22: Unknown column '0x' in 'field list'
|
||||
select 0b;
|
||||
ERROR 42S22: Unknown column '0b' in 'field list'
|
||||
|
||||
15
mysql-test/suite/bugs/r/rpl_bug33029.result
Normal file
15
mysql-test/suite/bugs/r/rpl_bug33029.result
Normal file
@@ -0,0 +1,15 @@
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
create table `t1` (`id` int not null auto_increment primary key);
|
||||
create trigger `trg` before insert on `t1` for each row begin end;
|
||||
set @@global.debug="+d,simulate_bug33029";
|
||||
stop slave;
|
||||
start slave;
|
||||
insert into `t1` values ();
|
||||
select * from t1;
|
||||
id
|
||||
1
|
||||
25
mysql-test/suite/bugs/t/rpl_bug33029.test
Normal file
25
mysql-test/suite/bugs/t/rpl_bug33029.test
Normal file
@@ -0,0 +1,25 @@
|
||||
#
|
||||
# Bug #36443 Server crashes when executing insert when insert trigger on table
|
||||
#
|
||||
# Emulating the former bug#33029 situation to see that there is no crash anymore.
|
||||
#
|
||||
|
||||
|
||||
source include/master-slave.inc;
|
||||
|
||||
create table `t1` (`id` int not null auto_increment primary key);
|
||||
create trigger `trg` before insert on `t1` for each row begin end;
|
||||
|
||||
sync_slave_with_master;
|
||||
set @@global.debug="+d,simulate_bug33029";
|
||||
|
||||
stop slave;
|
||||
start slave;
|
||||
|
||||
connection master;
|
||||
|
||||
insert into `t1` values ();
|
||||
|
||||
sync_slave_with_master;
|
||||
select * from t1;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#
|
||||
# The amount and properties of character_sets/collations depend on the
|
||||
# build type
|
||||
# 2007-12 MySQL 5.0
|
||||
# 2007-12 MySQL 5.0, 2008-06 MySQL 5.1
|
||||
# ---------------------------------------------------------------------
|
||||
#
|
||||
# Variant 1 fits to
|
||||
@@ -33,10 +33,22 @@
|
||||
# Variant 3 fits to
|
||||
# version_comment MySQL Community Server (GPL)
|
||||
# version_comment MySQL Cluster Server (Commercial)
|
||||
# version_comment MySQL Advanced Server (GPL) 5.1
|
||||
# version_comment MySQL Advanced Server (Commercial) 5.1
|
||||
#
|
||||
# Difference between variant 3 and 2 is within the collation properties
|
||||
# IS_COMPILED and SORTLEN.
|
||||
#
|
||||
# 2008-06 All time excluded variant is "vanilla".
|
||||
# How to build "vanilla":
|
||||
# ./BUILD/autorun.sh
|
||||
# ./configure
|
||||
# ./make
|
||||
# Some properties of "vanilla"
|
||||
# version_comment Source distribution
|
||||
# Compared to the variants 1 to 3 a lot of character sets are missing.
|
||||
# Example: "ucs2_bin" is in variant 1 to 3 but not in "vanilla".
|
||||
#
|
||||
# Created:
|
||||
# 2007-12-18 mleich - remove the unstable character_set/collation subtests
|
||||
# from include/datadict-master.inc
|
||||
|
||||
@@ -84,4 +84,3 @@ SELECT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
|
||||
FROM information_schema.columns
|
||||
$my_where
|
||||
ORDER BY TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION;
|
||||
|
||||
|
||||
362
mysql-test/suite/funcs_1/datadict/is_key_column_usage.inc
Normal file
362
mysql-test/suite/funcs_1/datadict/is_key_column_usage.inc
Normal file
@@ -0,0 +1,362 @@
|
||||
# suite/funcs_1/datadict/is_key_column_usage.inc
|
||||
#
|
||||
# Check the layout of information_schema.key_column_usage and the impact of
|
||||
# CREATE/ALTER/DROP TABLE/VIEW/SCHEMA/COLUMN ... on it.
|
||||
#
|
||||
# Note:
|
||||
# This test is not intended
|
||||
# - to show information about the all time existing tables
|
||||
# within the databases information_schema and mysql
|
||||
# - for checking storage engine properties
|
||||
# Therefore please do not alter $engine_type.
|
||||
#
|
||||
# Author:
|
||||
# 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of
|
||||
# testsuite funcs_1
|
||||
# Create this script based on older scripts and new code.
|
||||
# Last Change:
|
||||
# 2008-06-11 mleich Move t/is_key_column_usage.test to this file and
|
||||
# create variants for embedded/non embedded server.
|
||||
#
|
||||
|
||||
let $engine_type = MEMORY;
|
||||
|
||||
let $is_table = KEY_COLUMN_USAGE;
|
||||
|
||||
# The table INFORMATION_SCHEMA.KEY_COLUMN_USAGE must exist
|
||||
eval SHOW TABLES FROM information_schema LIKE '$is_table';
|
||||
|
||||
--echo #######################################################################
|
||||
--echo # Testcase 3.2.1.1: INFORMATION_SCHEMA tables can be queried via SELECT
|
||||
--echo #######################################################################
|
||||
# Ensure that every INFORMATION_SCHEMA table can be queried with a SELECT
|
||||
# statement, just as if it were an ordinary user-defined table.
|
||||
#
|
||||
--source suite/funcs_1/datadict/is_table_query.inc
|
||||
|
||||
|
||||
--echo #########################################################################
|
||||
--echo # Testcase 3.2.7.1: INFORMATION_SCHEMA.KEY_COLUMN_USAGE layout
|
||||
--echo #########################################################################
|
||||
# Ensure that the INFORMATION_SCHEMA.KEY_COLUMN_USAGE table has the following
|
||||
# columns, in the following order:
|
||||
#
|
||||
# CONSTRAINT_CATALOG (always shows NULL),
|
||||
# CONSTRAINT_SCHEMA (shows the database, or schema, in which an accessible
|
||||
# constraint, or index, resides),
|
||||
# CONSTRAINT_NAME (shows the name of the accessible constraint),
|
||||
# TABLE_CATALOG (always shows NULL),
|
||||
# TABLE_SCHEMA (shows the database, or schema, in which the table constrained
|
||||
# by that constraint resides),
|
||||
# TABLE_NAME (shows the name of the table constrained by the constraint),
|
||||
# COLUMN_NAME (shows the name of a column that is the index key, or part of
|
||||
# the index key),
|
||||
# ORDINAL_POSITION (shows the ordinal position of the column within the
|
||||
# constraint index),
|
||||
# POSITION_IN_UNIQUE_CONSTRAINT (shows, for a foreign key column, the ordinal
|
||||
# position of the referenced column within the referenced unique index;
|
||||
# otherwise NULL).
|
||||
# added with 5.0.6:
|
||||
# REFERENCED_TABLE_SCHEMA,
|
||||
# REFERENCED_TABLE_NAME,
|
||||
# REFERENCED_COLUMN_NAME
|
||||
#
|
||||
--source suite/funcs_1/datadict/datadict_bug_12777.inc
|
||||
eval DESCRIBE information_schema.$is_table;
|
||||
--source suite/funcs_1/datadict/datadict_bug_12777.inc
|
||||
eval SHOW CREATE TABLE information_schema.$is_table;
|
||||
--source suite/funcs_1/datadict/datadict_bug_12777.inc
|
||||
eval SHOW COLUMNS FROM information_schema.$is_table;
|
||||
|
||||
# Note: Retrieval of information within information_schema.columns about
|
||||
# information_schema.key_column_usage is in is_columns_is.test.
|
||||
|
||||
# Show that CONSTRAINT_CATALOG and TABLE_CATALOG are always NULL.
|
||||
SELECT constraint_catalog, constraint_schema, constraint_name, table_catalog,
|
||||
table_schema, table_name, column_name
|
||||
FROM information_schema.key_column_usage
|
||||
WHERE constraint_catalog IS NOT NULL OR table_catalog IS NOT NULL;
|
||||
|
||||
|
||||
--echo ########################################################################################
|
||||
--echo # Testcase 3.2.7.2 + 3.2.7.3: INFORMATION_SCHEMA.KEY_COLUMN_USAGE accessible information
|
||||
--echo ########################################################################################
|
||||
# 3.2.7.2: Ensure that the table shows the relevant information on every column, defined to
|
||||
# be part of an index key, which is accessible to the current user or to PUBLIC.
|
||||
# 3.2.7.3: Ensure that the table does not show any information on any indexed column that is
|
||||
# not accessible to the current user or PUBLIC.
|
||||
#
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS db_datadict;
|
||||
--enable_warnings
|
||||
CREATE DATABASE db_datadict;
|
||||
|
||||
--error 0,ER_CANNOT_USER
|
||||
DROP USER 'testuser1'@'localhost';
|
||||
CREATE USER 'testuser1'@'localhost';
|
||||
--error 0,ER_CANNOT_USER
|
||||
DROP USER 'testuser2'@'localhost';
|
||||
CREATE USER 'testuser2'@'localhost';
|
||||
|
||||
USE db_datadict;
|
||||
|
||||
--replace_result $engine_type <engine_type>
|
||||
eval
|
||||
CREATE TABLE t1_1
|
||||
(f1 INT NOT NULL, PRIMARY KEY(f1),
|
||||
f2 INT, INDEX f2_ind(f2))
|
||||
ENGINE = $engine_type;
|
||||
GRANT SELECT ON t1_1 to 'testuser1'@'localhost';
|
||||
|
||||
--replace_result $engine_type <engine_type>
|
||||
eval
|
||||
CREATE TABLE t1_2
|
||||
(f1 INT NOT NULL, PRIMARY KEY(f1),
|
||||
f2 INT, INDEX f2_ind(f2))
|
||||
ENGINE = $engine_type;
|
||||
GRANT SELECT ON t1_2 to 'testuser2'@'localhost';
|
||||
#FIXME: add foreign keys
|
||||
|
||||
let $select= SELECT * FROM information_schema.key_column_usage
|
||||
WHERE table_name LIKE 't1_%'
|
||||
ORDER BY constraint_catalog, constraint_schema, constraint_name,
|
||||
table_catalog, table_schema, table_name, ordinal_position;
|
||||
|
||||
# show view of user root
|
||||
eval $select;
|
||||
|
||||
--echo # Establish connection testuser1 (user=testuser1)
|
||||
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
||||
connect (testuser1, localhost, testuser1, , db_datadict);
|
||||
eval $select;
|
||||
|
||||
--echo # Establish connection testuser2 (user=testuser2)
|
||||
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
||||
connect (testuser2, localhost, testuser2, , db_datadict);
|
||||
eval $select;
|
||||
|
||||
# Cleanup
|
||||
--echo # Switch to connection default and close connections testuser1, testuser2
|
||||
connection default;
|
||||
disconnect testuser1;
|
||||
disconnect testuser2;
|
||||
DROP USER 'testuser1'@'localhost';
|
||||
DROP USER 'testuser2'@'localhost';
|
||||
DROP TABLE t1_1;
|
||||
DROP TABLE t1_2;
|
||||
DROP DATABASE IF EXISTS db_datadict;
|
||||
|
||||
|
||||
--echo ########################################################################################
|
||||
--echo # Testcase 3.2.1.13+3.2.1.14+3.2.1.15: INFORMATION_SCHEMA.KEY_COLUMN_USAGE modifications
|
||||
--echo ########################################################################################
|
||||
# 3.2.1.13: Ensure that the creation of any new database object (e.g. table or
|
||||
# column) automatically inserts all relevant information on that
|
||||
# object into every appropriate INFORMATION_SCHEMA table.
|
||||
# 3.2.1.14: Ensure that the alteration of any existing database object
|
||||
# automatically updates all relevant information on that object in
|
||||
# every appropriate INFORMATION_SCHEMA table.
|
||||
# 3.2.1.15: Ensure that the dropping of any existing database object
|
||||
# automatically deletes all relevant information on that object from
|
||||
# every appropriate INFORMATION_SCHEMA table.
|
||||
#
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS db_datadict;
|
||||
DROP TABLE IF EXISTS test.t1_my_table;
|
||||
--enable_warnings
|
||||
CREATE DATABASE db_datadict;
|
||||
|
||||
SELECT table_name FROM information_schema.key_column_usage
|
||||
WHERE table_name LIKE 't1_my_table%';
|
||||
--replace_result $engine_type <engine_type>
|
||||
eval
|
||||
CREATE TABLE test.t1_my_table
|
||||
(f1 CHAR(12), f2 TIMESTAMP, f4 BIGINT, PRIMARY KEY(f1,f2))
|
||||
DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci
|
||||
ENGINE = $engine_type;
|
||||
# Settings used in CREATE TABLE must be visible
|
||||
# in information_schema.key_column_usage.
|
||||
--vertical_results
|
||||
SELECT * FROM information_schema.key_column_usage
|
||||
WHERE table_name = 't1_my_table';
|
||||
--horizontal_results
|
||||
#
|
||||
# Check modification of TABLE_NAME
|
||||
SELECT DISTINCT table_name FROM information_schema.key_column_usage
|
||||
WHERE table_name LIKE 't1_my_table%';
|
||||
RENAME TABLE test.t1_my_table TO test.t1_my_tablex;
|
||||
SELECT DISTINCT table_name FROM information_schema.key_column_usage
|
||||
WHERE table_name LIKE 't1_my_table%';
|
||||
#
|
||||
# Check modification of TABLE_SCHEMA
|
||||
SELECT DISTINCT table_schema,table_name FROM information_schema.key_column_usage
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
RENAME TABLE test.t1_my_tablex TO db_datadict.t1_my_tablex;
|
||||
SELECT DISTINCT table_schema,table_name FROM information_schema.key_column_usage
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
#
|
||||
# Check modification of COLUMN_NAME
|
||||
SELECT DISTINCT table_name, column_name FROM information_schema.key_column_usage
|
||||
WHERE table_name = 't1_my_tablex'
|
||||
ORDER BY table_name, column_name;
|
||||
ALTER TABLE db_datadict.t1_my_tablex CHANGE COLUMN f1 first_col CHAR(12);
|
||||
SELECT DISTINCT table_name, column_name FROM information_schema.key_column_usage
|
||||
WHERE table_name = 't1_my_tablex'
|
||||
ORDER BY table_name, column_name;
|
||||
#
|
||||
# Note: The size of the column list and the not very selective qualification
|
||||
# is intended. I want to see that the schema names are equal and
|
||||
# all records about 't1_my_tablex'.
|
||||
let $my_select = SELECT constraint_schema, constraint_name, table_schema,
|
||||
table_name, column_name, ordinal_position
|
||||
FROM information_schema.key_column_usage
|
||||
WHERE table_name = 't1_my_tablex'
|
||||
ORDER BY constraint_schema, constraint_name, table_schema,
|
||||
table_name, ordinal_position;
|
||||
#
|
||||
# Check ADD INDEX being not UNIQUE (does not show up in key_column_usage)
|
||||
eval $my_select;
|
||||
CREATE INDEX f2 ON db_datadict.t1_my_tablex(f2);
|
||||
eval $my_select;
|
||||
DROP INDEX f2 ON db_datadict.t1_my_tablex;
|
||||
#
|
||||
# Check ADD UNIQUE INDEX without name explicit assigned
|
||||
eval $my_select;
|
||||
ALTER TABLE db_datadict.t1_my_tablex ADD UNIQUE (f2);
|
||||
eval $my_select;
|
||||
DROP INDEX f2 ON db_datadict.t1_my_tablex;
|
||||
#
|
||||
# Check ADD UNIQUE INDEX with name explicit assigned
|
||||
eval $my_select;
|
||||
ALTER TABLE db_datadict.t1_my_tablex ADD UNIQUE my_idx (f2);
|
||||
eval $my_select;
|
||||
DROP INDEX my_idx ON db_datadict.t1_my_tablex;
|
||||
eval $my_select;
|
||||
ALTER TABLE db_datadict.t1_my_tablex ADD UNIQUE my_idx (f4,first_col);
|
||||
eval $my_select;
|
||||
#
|
||||
# Check DROP COLUMN
|
||||
eval $my_select;
|
||||
ALTER TABLE db_datadict.t1_my_tablex
|
||||
DROP COLUMN first_col;
|
||||
eval $my_select;
|
||||
#
|
||||
# Check impact of DROP TABLE
|
||||
SELECT table_name, column_name
|
||||
FROM information_schema.key_column_usage
|
||||
WHERE table_name = 't1_my_tablex'
|
||||
ORDER BY table_name, column_name;
|
||||
DROP TABLE db_datadict.t1_my_tablex;
|
||||
SELECT table_name, column_name
|
||||
FROM information_schema.key_column_usage
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
#
|
||||
# No UNIQUE CONSTRAINT -> no entry in key_column_usage
|
||||
SELECT table_name FROM information_schema.key_column_usage
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
--replace_result $engine_type <engine_type>
|
||||
eval
|
||||
CREATE TABLE db_datadict.t1_my_tablex
|
||||
ENGINE = $engine_type AS
|
||||
SELECT 1 AS f1;
|
||||
SELECT table_name FROM information_schema.key_column_usage
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
# UNIQUE CONSTRAINT -> entry in key_column_usage
|
||||
ALTER TABLE db_datadict.t1_my_tablex ADD PRIMARY KEY(f1);
|
||||
SELECT table_name FROM information_schema.key_column_usage
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
#
|
||||
# Check impact of DROP SCHEMA
|
||||
SELECT table_name FROM information_schema.key_column_usage
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
DROP DATABASE db_datadict;
|
||||
SELECT table_name FROM information_schema.key_column_usage
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
#
|
||||
|
||||
|
||||
--echo ########################################################################
|
||||
--echo # Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and
|
||||
--echo # DDL on INFORMATION_SCHEMA table are not supported
|
||||
--echo ########################################################################
|
||||
# 3.2.1.3: Ensure that no user may execute an INSERT statement on any
|
||||
# INFORMATION_SCHEMA table.
|
||||
# 3.2.1.4: Ensure that no user may execute an UPDATE statement on any
|
||||
# INFORMATION_SCHEMA table.
|
||||
# 3.2.1.5: Ensure that no user may execute a DELETE statement on any
|
||||
# INFORMATION_SCHEMA table.
|
||||
# 3.2.1.8: Ensure that no user may create an index on an
|
||||
# INFORMATION_SCHEMA table.
|
||||
# 3.2.1.9: Ensure that no user may alter the definition of an
|
||||
# INFORMATION_SCHEMA table.
|
||||
# 3.2.1.10: Ensure that no user may drop an INFORMATION_SCHEMA table.
|
||||
# 3.2.1.11: Ensure that no user may move an INFORMATION_SCHEMA table to any
|
||||
# other database.
|
||||
# 3.2.1.12: Ensure that no user may directly add to, alter, or delete any data
|
||||
# in an INFORMATION_SCHEMA table.
|
||||
#
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS db_datadict;
|
||||
DROP TABLE IF EXISTS db_datadict.t1;
|
||||
--enable_warnings
|
||||
CREATE DATABASE db_datadict;
|
||||
--replace_result $engine_type <engine_type>
|
||||
eval
|
||||
CREATE TABLE db_datadict.t1 (f1 BIGINT)
|
||||
ENGINE = $engine_type;
|
||||
|
||||
# Note(mleich):
|
||||
# 1. We can get here different error messages.
|
||||
# 2. We do not want to unify the individual messages to the far to unspecific
|
||||
# 'Got one of the listed errors'.
|
||||
let $my_error_message =
|
||||
##### The previous statement must fail ######
|
||||
# Server type | expected error name | expected error message
|
||||
# --------------------------------------------------------------------------------------------------------------------
|
||||
# not embedded | ER_DBACCESS_DENIED_ERROR | ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
# embedded | ER_NON_INSERTABLE_TABLE | ERROR HY000: The target table schemata of the INSERT is not insertable-into
|
||||
# | or similar | or similar
|
||||
;
|
||||
|
||||
--disable_abort_on_error
|
||||
INSERT INTO information_schema.key_column_usage
|
||||
(constraint_schema, constraint_name, table_name)
|
||||
VALUES ( 'mysql', 'primary', 'db');
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
--echo $my_error_message
|
||||
exit;
|
||||
}
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
INSERT INTO information_schema.key_column_usage
|
||||
SELECT * FROM information_schema.key_column_usage;
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
UPDATE information_schema.key_column_usage
|
||||
SET table_name = 'db1' WHERE constraint_name = 'primary';
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
DELETE FROM information_schema.key_column_usage WHERE table_name = 't1';
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
TRUNCATE information_schema.key_column_usage;
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
CREATE INDEX i3 ON information_schema.key_column_usage(table_name);
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
ALTER TABLE information_schema.key_column_usage ADD f1 INT;
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
DROP TABLE information_schema.key_column_usage;
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
ALTER TABLE information_schema.key_column_usage
|
||||
RENAME db_datadict.key_column_usage;
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
ALTER TABLE information_schema.key_column_usage
|
||||
RENAME information_schema.xkey_column_usage;
|
||||
--enable_abort_on_error
|
||||
|
||||
# Cleanup
|
||||
DROP TABLE db_datadict.t1;
|
||||
DROP DATABASE db_datadict;
|
||||
522
mysql-test/suite/funcs_1/datadict/is_routines.inc
Normal file
522
mysql-test/suite/funcs_1/datadict/is_routines.inc
Normal file
@@ -0,0 +1,522 @@
|
||||
# suite/funcs_1/datadict/is_routines.inc
|
||||
#
|
||||
# Check the layout of information_schema.routines and the impact of
|
||||
# CREATE/ALTER/DROP PROCEDURE/FUNCTION ... on it.
|
||||
#
|
||||
# Note:
|
||||
# This test is not intended
|
||||
# - to show information about the all time existing routines (there are no
|
||||
# in the moment) within the databases information_schema and mysql
|
||||
# - for checking storage engine properties
|
||||
# Therefore please do not alter $engine_type and $other_engine_type.
|
||||
#
|
||||
# Author:
|
||||
# 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of
|
||||
# testsuite funcs_1
|
||||
# Create this script based on older scripts and new code.
|
||||
# Last Change:
|
||||
# 2008-06-11 mleich Move t/is_routines.test to this file and
|
||||
# create variants for embedded/non embedded server.
|
||||
#
|
||||
|
||||
let $engine_type = MEMORY;
|
||||
let $other_engine_type = MyISAM;
|
||||
|
||||
let $is_table = ROUTINES;
|
||||
|
||||
# The table INFORMATION_SCHEMA.TABLES must exist
|
||||
eval SHOW TABLES FROM information_schema LIKE '$is_table';
|
||||
|
||||
--echo #######################################################################
|
||||
--echo # Testcase 3.2.1.1: INFORMATION_SCHEMA tables can be queried via SELECT
|
||||
--echo #######################################################################
|
||||
# Ensure that every INFORMATION_SCHEMA table can be queried with a SELECT
|
||||
# statement, just as if it were an ordinary user-defined table.
|
||||
#
|
||||
--source suite/funcs_1/datadict/is_table_query.inc
|
||||
|
||||
|
||||
--echo #########################################################################
|
||||
--echo # Testcase 3.2.8.1: INFORMATION_SCHEMA.ROUTINES layout
|
||||
--echo #########################################################################
|
||||
# Ensure that the INFORMATION_SCHEMA.ROUTINES table has the following columns,
|
||||
# in the following order:
|
||||
#
|
||||
# SPECIFIC_NAME (shows the name of an accessible stored procedure, or routine),
|
||||
# ROUTINE_CATALOG (always shows NULL),
|
||||
# ROUTINE_SCHEMA (shows the database, or schema, in which the routine resides),
|
||||
# ROUTINE_NAME (shows the same stored procedure name),
|
||||
# ROUTINE_TYPE (shows whether the stored procedure is a procedure or a function),
|
||||
# DTD_IDENTIFIER (shows, for a function, the complete data type definition of
|
||||
# the value the function will return; otherwise NULL),
|
||||
# ROUTINE_BODY (shows the language in which the stored procedure is written;
|
||||
# currently always SQL),
|
||||
# ROUTINE_DEFINITION (shows as much of the routine body as is possible in the
|
||||
# allotted space),
|
||||
# EXTERNAL_NAME (always shows NULL),
|
||||
# EXTERNAL_LANGUAGE (always shows NULL),
|
||||
# PARAMETER_STYLE (shows the routine's parameter style; always SQL),
|
||||
# IS_DETERMINISTIC (shows whether the routine is deterministic),
|
||||
# SQL_DATA_ACCESS (shows the routine's defined sql-data-access clause value),
|
||||
# SQL_PATH (always shows NULL),
|
||||
# SECURITY_TYPE (shows whether the routine's defined security_type is 'definer'
|
||||
# or 'invoker'),
|
||||
# CREATED (shows the timestamp of the time the routine was created),
|
||||
# LAST_ALTERED (shows the timestamp of the time the routine was last altered),
|
||||
# SQL_MODE (shows the sql_mode setting at the time the routine was created),
|
||||
# ROUTINE_COMMENT (shows the comment, if any, defined for the routine;
|
||||
# otherwise NULL),
|
||||
# DEFINER (shows the user who created the routine).
|
||||
# Starting with MySQL 5.1
|
||||
# CHARACTER_SET_CLIENT
|
||||
# COLLATION_CONNECTION
|
||||
# DATABASE_COLLATION
|
||||
#
|
||||
--source suite/funcs_1/datadict/datadict_bug_12777.inc
|
||||
eval DESCRIBE information_schema.$is_table;
|
||||
--source suite/funcs_1/datadict/datadict_bug_12777.inc
|
||||
eval SHOW CREATE TABLE information_schema.$is_table;
|
||||
--source suite/funcs_1/datadict/datadict_bug_12777.inc
|
||||
eval SHOW COLUMNS FROM information_schema.$is_table;
|
||||
|
||||
USE test;
|
||||
--disable_warnings
|
||||
DROP PROCEDURE IF EXISTS sp_for_routines;
|
||||
DROP FUNCTION IF EXISTS function_for_routines;
|
||||
--enable_warnings
|
||||
CREATE PROCEDURE sp_for_routines() SELECT 'db_datadict';
|
||||
CREATE FUNCTION function_for_routines() RETURNS INT RETURN 0;
|
||||
|
||||
# Show that the column values of
|
||||
# ROUTINE_CATALOG, EXTERNAL_NAME, EXTERNAL_LANGUAGE, SQL_PATH are always NULL
|
||||
# and
|
||||
# ROUTINE_BODY, PARAMETER_STYLE are 'SQL'
|
||||
# and
|
||||
# SPECIFIC_NAME = ROUTINE_NAME.
|
||||
SELECT specific_name,routine_catalog,routine_schema,routine_name,routine_type,
|
||||
routine_body,external_name,external_language,parameter_style,sql_path
|
||||
FROM information_schema.routines
|
||||
WHERE routine_catalog IS NOT NULL OR external_name IS NOT NULL
|
||||
OR external_language IS NOT NULL OR sql_path IS NOT NULL
|
||||
OR routine_body <> 'SQL' OR parameter_style <> 'SQL'
|
||||
OR specific_name <> routine_name;
|
||||
|
||||
DROP PROCEDURE sp_for_routines;
|
||||
DROP FUNCTION function_for_routines;
|
||||
|
||||
|
||||
--echo ################################################################################
|
||||
--echo # Testcase 3.2.8.2 + 3.2.8.3: INFORMATION_SCHEMA.ROUTINES accessible information
|
||||
--echo ################################################################################
|
||||
# 3.2.8.2: Ensure that the table shows the relevant information on every SQL-invoked
|
||||
# routine (i.e. stored procedure) which is accessible to the current user
|
||||
# or to PUBLIC.
|
||||
# 3.2.8.3: Ensure that the table does not show any information on any stored procedure
|
||||
# that is not accessible to the current user or PUBLIC.
|
||||
#
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS db_datadict;
|
||||
DROP DATABASE IF EXISTS db_datadict_2;
|
||||
--enable_warnings
|
||||
|
||||
CREATE DATABASE db_datadict;
|
||||
USE db_datadict;
|
||||
--replace_result $other_engine_type <other_engine_type>
|
||||
eval
|
||||
CREATE TABLE res_6_408002_1(f1 CHAR(3), f2 TEXT(25), f3 DATE, f4 INT)
|
||||
ENGINE = $other_engine_type;
|
||||
INSERT INTO res_6_408002_1(f1, f2, f3, f4)
|
||||
VALUES('abc', 'xyz', '1989-11-09', 0815);
|
||||
--disable_warnings
|
||||
DROP PROCEDURE IF EXISTS sp_6_408002_1;
|
||||
--enable_warnings
|
||||
delimiter //;
|
||||
CREATE PROCEDURE sp_6_408002_1()
|
||||
BEGIN
|
||||
SELECT * FROM db_datadict.res_6_408002_1;
|
||||
END//
|
||||
delimiter ;//
|
||||
|
||||
CREATE DATABASE db_datadict_2;
|
||||
USE db_datadict_2;
|
||||
--replace_result $other_engine_type <other_engine_type>
|
||||
eval
|
||||
CREATE TABLE res_6_408002_2(f1 CHAR(3), f2 TEXT(25), f3 DATE, f4 INT)
|
||||
ENGINE = $other_engine_type;
|
||||
INSERT INTO res_6_408002_2(f1, f2, f3, f4)
|
||||
VALUES('abc', 'xyz', '1990-10-03', 4711);
|
||||
--disable_warnings
|
||||
DROP PROCEDURE IF EXISTS sp_6_408002_2;
|
||||
--enable_warnings
|
||||
delimiter //;
|
||||
CREATE PROCEDURE sp_6_408002_2()
|
||||
BEGIN
|
||||
SELECT * FROM db_datadict_2.res_6_408002_2;
|
||||
END//
|
||||
delimiter ;//
|
||||
|
||||
--error 0,ER_CANNOT_USER
|
||||
DROP USER 'testuser1'@'localhost';
|
||||
CREATE USER 'testuser1'@'localhost';
|
||||
--error 0,ER_CANNOT_USER
|
||||
DROP USER 'testuser2'@'localhost';
|
||||
CREATE USER 'testuser2'@'localhost';
|
||||
--error 0,ER_CANNOT_USER
|
||||
DROP USER 'testuser3'@'localhost';
|
||||
CREATE USER 'testuser3'@'localhost';
|
||||
|
||||
|
||||
GRANT SELECT ON db_datadict_2.* TO 'testuser1'@'localhost';
|
||||
GRANT EXECUTE ON db_datadict_2.* TO 'testuser1'@'localhost';
|
||||
|
||||
GRANT EXECUTE ON db_datadict.* TO 'testuser1'@'localhost';
|
||||
GRANT SELECT ON db_datadict.* TO 'testuser2'@'localhost';
|
||||
|
||||
GRANT EXECUTE ON PROCEDURE db_datadict_2.sp_6_408002_2
|
||||
TO 'testuser2'@'localhost';
|
||||
GRANT EXECUTE ON db_datadict_2.* TO 'testuser2'@'localhost';
|
||||
FLUSH PRIVILEGES;
|
||||
|
||||
--echo # Establish connection testuser1 (user=testuser1)
|
||||
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
||||
connect (testuser1, localhost, testuser1, , db_datadict);
|
||||
--replace_column 16 "YYYY-MM-DD hh:mm:ss" 17 "YYYY-MM-DD hh:mm:ss"
|
||||
SELECT * FROM information_schema.routines;
|
||||
|
||||
--echo # Establish connection testuser2 (user=testuser2)
|
||||
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
||||
connect (testuser2, localhost, testuser2, , db_datadict);
|
||||
--replace_column 16 "YYYY-MM-DD hh:mm:ss" 17 "YYYY-MM-DD hh:mm:ss"
|
||||
SELECT * FROM information_schema.routines;
|
||||
|
||||
--echo # Establish connection testuser3 (user=testuser3)
|
||||
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
||||
connect (testuser3, localhost, testuser3, , test);
|
||||
--replace_column 16 "YYYY-MM-DD hh:mm:ss" 17 "YYYY-MM-DD hh:mm:ss"
|
||||
SELECT * FROM information_schema.routines;
|
||||
|
||||
# Cleanup
|
||||
--echo # Switch to connection default and close connections testuser1,testuser2,testuser3
|
||||
connection default;
|
||||
disconnect testuser1;
|
||||
disconnect testuser2;
|
||||
disconnect testuser3;
|
||||
|
||||
DROP USER 'testuser1'@'localhost';
|
||||
DROP USER 'testuser2'@'localhost';
|
||||
DROP USER 'testuser3'@'localhost';
|
||||
|
||||
USE test;
|
||||
DROP DATABASE db_datadict;
|
||||
DROP DATABASE db_datadict_2;
|
||||
|
||||
|
||||
--echo #########################################################################
|
||||
--echo # 3.2.1.13+3.2.1.14+3.2.1.15: INFORMATION_SCHEMA.ROUTINES modifications
|
||||
--echo #########################################################################
|
||||
# 3.2.1.13: Ensure that the creation of any new database object (e.g. table or
|
||||
# column) automatically inserts all relevant information on that
|
||||
# object into every appropriate INFORMATION_SCHEMA table.
|
||||
# 3.2.1.14: Ensure that the alteration of any existing database object
|
||||
# automatically updates all relevant information on that object in
|
||||
# every appropriate INFORMATION_SCHEMA table.
|
||||
# 3.2.1.15: Ensure that the dropping of any existing database object
|
||||
# automatically deletes all relevant information on that object from
|
||||
# every appropriate INFORMATION_SCHEMA table.
|
||||
#
|
||||
# Some more tests are in t/information_schema_routines.test which exists
|
||||
# in MySQL 5.1 and up only.
|
||||
#
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS db_datadict;
|
||||
--enable_warnings
|
||||
CREATE DATABASE db_datadict;
|
||||
|
||||
SELECT * FROM information_schema.routines WHERE routine_schema = 'db_datadict';
|
||||
USE db_datadict;
|
||||
CREATE PROCEDURE sp_for_routines() SELECT 'db_datadict';
|
||||
CREATE FUNCTION function_for_routines() RETURNS INT RETURN 0;
|
||||
--vertical_results
|
||||
--replace_column 16 <created> 17 <modified>
|
||||
SELECT * FROM information_schema.routines WHERE routine_schema = 'db_datadict'
|
||||
ORDER BY routine_name;
|
||||
--horizontal_results
|
||||
|
||||
ALTER PROCEDURE sp_for_routines SQL SECURITY INVOKER;
|
||||
ALTER FUNCTION function_for_routines COMMENT 'updated comments';
|
||||
--vertical_results
|
||||
--replace_column 16 <created> 17 <modified>
|
||||
SELECT * FROM information_schema.routines WHERE routine_schema = 'db_datadict'
|
||||
ORDER BY routine_name;
|
||||
--horizontal_results
|
||||
|
||||
DROP PROCEDURE sp_for_routines;
|
||||
DROP FUNCTION function_for_routines;
|
||||
SELECT * FROM information_schema.routines WHERE routine_schema = 'db_datadict';
|
||||
|
||||
CREATE PROCEDURE sp_for_routines() SELECT 'db_datadict';
|
||||
CREATE FUNCTION function_for_routines() RETURNS INT RETURN 0;
|
||||
--vertical_results
|
||||
--replace_column 16 <created> 17 <modified>
|
||||
SELECT * FROM information_schema.routines WHERE routine_schema = 'db_datadict'
|
||||
ORDER BY routine_name;
|
||||
--horizontal_results
|
||||
use test;
|
||||
DROP DATABASE db_datadict;
|
||||
SELECT * FROM information_schema.routines WHERE routine_schema = 'db_datadict';
|
||||
|
||||
|
||||
--echo #########################################################################
|
||||
--echo # 3.2.8.4: INFORMATION_SCHEMA.ROUTINES routine body too big for
|
||||
--echo # ROUTINE_DEFINITION column
|
||||
--echo #########################################################################
|
||||
# Ensure that a stored procedure with a routine body that is too large to fit
|
||||
# into the INFORMATION_SCHEMA.ROUTINES.ROUTINE_DEFINITION column correctly shows
|
||||
# as much of the information as is possible within the allotted size.
|
||||
#
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS db_datadict;
|
||||
--enable_warnings
|
||||
CREATE DATABASE db_datadict;
|
||||
USE db_datadict;
|
||||
#
|
||||
--replace_result $other_engine_type <other_engine_type>
|
||||
eval
|
||||
CREATE TABLE db_datadict.res_6_408004_1
|
||||
(f1 LONGTEXT , f2 MEDIUMINT , f3 LONGBLOB , f4 REAL , f5 YEAR)
|
||||
ENGINE = $other_engine_type;
|
||||
INSERT INTO db_datadict.res_6_408004_1
|
||||
VALUES ('abc', 98765 , 99999999 , 98765, 10);
|
||||
#
|
||||
--replace_result $other_engine_type <other_engine_type>
|
||||
eval
|
||||
CREATE TABLE db_datadict.res_6_408004_2
|
||||
(f1 LONGTEXT , f2 MEDIUMINT , f3 LONGBLOB , f4 REAL , f5 YEAR)
|
||||
ENGINE = $other_engine_type;
|
||||
INSERT INTO db_datadict.res_6_408004_2
|
||||
VALUES ('abc', 98765 , 99999999 , 98765, 10);
|
||||
|
||||
--echo # Checking the max. possible length of (currently) 4 GByte is not
|
||||
--echo # in this environment here.
|
||||
|
||||
delimiter //;
|
||||
CREATE PROCEDURE sp_6_408004 ()
|
||||
BEGIN
|
||||
DECLARE done INTEGER DEFAULt 0;
|
||||
DECLARE variable_number_1 LONGTEXT;
|
||||
DECLARE variable_number_2 MEDIUMINT;
|
||||
DECLARE variable_number_3 LONGBLOB;
|
||||
DECLARE variable_number_4 REAL;
|
||||
DECLARE variable_number_5 YEAR;
|
||||
DECLARE cursor_number_1 CURSOR FOR SELECT * FROM res_6_408004_1 LIMIT 0, 10;
|
||||
DECLARE cursor_number_2 CURSOR FOR SELECT * FROM res_6_408004_1 LIMIT 0, 10;
|
||||
DECLARE cursor_number_3 CURSOR FOR SELECT * FROM res_6_408004_1 LIMIT 0, 10;
|
||||
DECLARE cursor_number_4 CURSOR FOR SELECT * FROM res_6_408004_1 LIMIT 0, 10;
|
||||
DECLARE cursor_number_5 CURSOR FOR SELECT * FROM res_6_408004_1 LIMIT 0, 10;
|
||||
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
|
||||
BEGIN
|
||||
OPEN cursor_number_1;
|
||||
WHILE done <> 1 DO
|
||||
FETCH cursor_number_1
|
||||
INTO variable_number_1, variable_number_2, variable_number_3,
|
||||
variable_number_4, variable_number_5;
|
||||
IF done <> 0 THEN
|
||||
INSERT INTO res_6_408004_2
|
||||
VALUES (variable_number_1, variable_number_2, variable_number_3,
|
||||
variable_number_4, variable_number_5);
|
||||
END IF;
|
||||
END WHILE;
|
||||
BEGIN
|
||||
BEGIN
|
||||
SET done = 0;
|
||||
OPEN cursor_number_2;
|
||||
WHILE done <> 1 DO
|
||||
FETCH cursor_number_2
|
||||
INTO variable_number_1, variable_number_2, variable_number_3,
|
||||
variable_number_4, variable_number_5;
|
||||
IF done <> 0 THEN
|
||||
INSERT INTO res_6_408004_2
|
||||
VALUES(variable_number_1, variable_number_2, variable_number_3,
|
||||
variable_number_4, variable_number_5);
|
||||
END IF;
|
||||
END WHILE;
|
||||
END;
|
||||
SET done = 0;
|
||||
OPEN cursor_number_3;
|
||||
WHILE done <> 1 DO
|
||||
FETCH cursor_number_3
|
||||
INTO variable_number_1, variable_number_2, variable_number_3,
|
||||
variable_number_4, variable_number_5;
|
||||
IF done <> 0 THEN
|
||||
INSERT INTO res_6_408004_2
|
||||
VALUES(variable_number_1, variable_number_2, variable_number_3,
|
||||
variable_number_4, variable_number_5);
|
||||
END IF;
|
||||
END WHILE;
|
||||
END;
|
||||
END;
|
||||
BEGIN
|
||||
SET done = 0;
|
||||
OPEN cursor_number_4;
|
||||
WHILE done <> 1 DO
|
||||
FETCH cursor_number_4
|
||||
INTO variable_number_1, variable_number_2, variable_number_3,
|
||||
variable_number_4, variable_number_5;
|
||||
IF done <> 0 THEN
|
||||
INSERT INTO res_6_408004_2
|
||||
VALUES (variable_number_1, variable_number_2, variable_number_3,
|
||||
variable_number_4, variable_number_5);
|
||||
END IF;
|
||||
END WHILE;
|
||||
END;
|
||||
BEGIN
|
||||
SET @a='test row';
|
||||
SELECT @a;
|
||||
SELECT @a;
|
||||
SELECT @a;
|
||||
END;
|
||||
BEGIN
|
||||
SET done = 0;
|
||||
OPEN cursor_number_5;
|
||||
WHILE done <> 1 DO
|
||||
FETCH cursor_number_5
|
||||
INTO variable_number_1, variable_number_2, variable_number_3,
|
||||
variable_number_4, variable_number_5;
|
||||
IF done <> 0 THEN
|
||||
INSERT INTO res_6_408004_2
|
||||
VALUES (variable_number_1, variable_number_2, variable_number_3,
|
||||
variable_number_4, variable_number_5);
|
||||
END IF;
|
||||
END WHILE;
|
||||
END;
|
||||
BEGIN
|
||||
SET @a='test row';
|
||||
SELECT @a;
|
||||
SELECT @a;
|
||||
SELECT @a;
|
||||
END;
|
||||
END//
|
||||
delimiter ;//
|
||||
|
||||
CALL db_datadict.sp_6_408004 ();
|
||||
SELECT * FROM db_datadict.res_6_408004_2;
|
||||
|
||||
--vertical_results
|
||||
--replace_column 16 "YYYY-MM-DD hh:mm:ss" 17 "YYYY-MM-DD hh:mm:ss"
|
||||
SELECT *, LENGTH(routine_definition) FROM information_schema.routines
|
||||
WHERE routine_schema = 'db_datadict';
|
||||
--horizontal_results
|
||||
|
||||
# Cleanup
|
||||
DROP DATABASE db_datadict;
|
||||
# ----------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
--echo ########################################################################
|
||||
--echo # Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and
|
||||
--echo # DDL on INFORMATION_SCHEMA table are not supported
|
||||
--echo ########################################################################
|
||||
# 3.2.1.3: Ensure that no user may execute an INSERT statement on any
|
||||
# INFORMATION_SCHEMA table.
|
||||
# 3.2.1.4: Ensure that no user may execute an UPDATE statement on any
|
||||
# INFORMATION_SCHEMA table.
|
||||
# 3.2.1.5: Ensure that no user may execute a DELETE statement on any
|
||||
# INFORMATION_SCHEMA table.
|
||||
# 3.2.1.8: Ensure that no user may create an index on an INFORMATION_SCHEMA table.
|
||||
# 3.2.1.9: Ensure that no user may alter the definition of an
|
||||
# INFORMATION_SCHEMA table.
|
||||
# 3.2.1.10: Ensure that no user may drop an INFORMATION_SCHEMA table.
|
||||
# 3.2.1.11: Ensure that no user may move an INFORMATION_SCHEMA table to any
|
||||
# other database.
|
||||
# 3.2.1.12: Ensure that no user may directly add to, alter, or delete any data
|
||||
# in an INFORMATION_SCHEMA table.
|
||||
#
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS db_datadict;
|
||||
--enable_warnings
|
||||
CREATE DATABASE db_datadict;
|
||||
USE db_datadict;
|
||||
CREATE PROCEDURE sp_for_routines() SELECT 'db_datadict';
|
||||
USE test;
|
||||
|
||||
# Note(mleich):
|
||||
# 1. We can get here different error messages.
|
||||
# 2. We do not want to unify the individual messages to the far to unspecific
|
||||
# 'Got one of the listed errors'.
|
||||
let $my_error_message =
|
||||
##### The previous statement must fail ######
|
||||
# Server type | expected error name | expected error message
|
||||
# --------------------------------------------------------------------------------------------------------------------
|
||||
# not embedded | ER_DBACCESS_DENIED_ERROR | ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
# embedded | ER_NON_INSERTABLE_TABLE | ERROR HY000: The target table schemata of the INSERT is not insertable-into
|
||||
# | or similar | or similar
|
||||
;
|
||||
|
||||
--disable_abort_on_error
|
||||
INSERT INTO information_schema.routines (routine_name, routine_type )
|
||||
VALUES ('p2', 'procedure');
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
--echo $my_error_message
|
||||
exit;
|
||||
}
|
||||
UPDATE information_schema.routines SET routine_name = 'p2'
|
||||
WHERE routine_body = 'sql';
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
--echo $my_error_message
|
||||
exit;
|
||||
}
|
||||
DELETE FROM information_schema.routines ;
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
--echo $my_error_message
|
||||
exit;
|
||||
}
|
||||
TRUNCATE information_schema.routines ;
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
--echo $my_error_message
|
||||
exit;
|
||||
}
|
||||
CREATE INDEX i7 ON information_schema.routines (routine_name);
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
--echo $my_error_message
|
||||
exit;
|
||||
}
|
||||
ALTER TABLE information_schema.routines ADD f1 INT;
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
--echo $my_error_message
|
||||
exit;
|
||||
}
|
||||
ALTER TABLE information_schema.routines DISCARD TABLESPACE;
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
--echo $my_error_message
|
||||
exit;
|
||||
}
|
||||
DROP TABLE information_schema.routines ;
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
--echo $my_error_message
|
||||
exit;
|
||||
}
|
||||
ALTER TABLE information_schema.routines RENAME db_datadict.routines;
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
--echo $my_error_message
|
||||
exit;
|
||||
}
|
||||
ALTER TABLE information_schema.routines RENAME information_schema.xroutines;
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
--echo $my_error_message
|
||||
exit;
|
||||
}
|
||||
--enable_abort_on_error
|
||||
|
||||
# Cleanup
|
||||
DROP DATABASE db_datadict;
|
||||
|
||||
300
mysql-test/suite/funcs_1/datadict/is_schemata.inc
Normal file
300
mysql-test/suite/funcs_1/datadict/is_schemata.inc
Normal file
@@ -0,0 +1,300 @@
|
||||
# suite/funcs_1/datadict/is_schemata.inc
|
||||
#
|
||||
# Check the layout of information_schema.schemata, permissions and the impact of
|
||||
# CREATE/ALTER/DROP SCHEMA on it.
|
||||
#
|
||||
# Note:
|
||||
# This test is not intended
|
||||
# - to show information about the all time existing databases
|
||||
# information_schema and mysql
|
||||
# - for checking storage engine properties
|
||||
#
|
||||
# Author:
|
||||
# 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of
|
||||
# testsuite funcs_1
|
||||
# Create this script based on older scripts and new code.
|
||||
# Last Change:
|
||||
# 2008-06-11 mleich Move t/is_schemata.test to this file and
|
||||
# create variants for embedded/non embedded server.
|
||||
#
|
||||
|
||||
let $is_table = SCHEMATA;
|
||||
|
||||
# The table INFORMATION_SCHEMA.SCHEMATA must exist
|
||||
eval SHOW TABLES FROM information_schema LIKE '$is_table';
|
||||
|
||||
--echo #######################################################################
|
||||
--echo # Testcase 3.2.1.1: INFORMATION_SCHEMA tables can be queried via SELECT
|
||||
--echo #######################################################################
|
||||
# Ensure that every INFORMATION_SCHEMA table can be queried with a SELECT
|
||||
# statement, just as if it were an ordinary user-defined table.
|
||||
#
|
||||
--source suite/funcs_1/datadict/is_table_query.inc
|
||||
|
||||
|
||||
--echo #########################################################################
|
||||
--echo # Testcase 3.2.9.1: INFORMATION_SCHEMA.SCHEMATA layout;
|
||||
--echo #########################################################################
|
||||
# Ensure that the INFORMATION_SCHEMA.SCHEMATA table has the following columns,
|
||||
# in the following order:
|
||||
#
|
||||
# CATALOG_NAME (always shows NULL),
|
||||
# SCHEMA_NAME (shows the name of a database, or schema, on which the current
|
||||
# user or PUBLIC has privileges),
|
||||
# DEFAULT_CHARACTER_SET_NAME (shows the name of that database's default
|
||||
# character set),
|
||||
# DEFAULT_COLLATION_NAME (shows the database defaul collation)
|
||||
# SQL_PATH (always shows NULL).
|
||||
#
|
||||
--source suite/funcs_1/datadict/datadict_bug_12777.inc
|
||||
eval DESCRIBE information_schema.$is_table;
|
||||
--source suite/funcs_1/datadict/datadict_bug_12777.inc
|
||||
eval SHOW CREATE TABLE information_schema.$is_table;
|
||||
--source suite/funcs_1/datadict/datadict_bug_12777.inc
|
||||
eval SHOW COLUMNS FROM information_schema.$is_table;
|
||||
|
||||
# Note: Retrieval of information within information_schema.columns about
|
||||
# information_schema.schemata is in is_columns_is.test.
|
||||
|
||||
# Show that CATALOG_NAME and SQL_PATH are always NULL.
|
||||
SELECT catalog_name, schema_name, sql_path
|
||||
FROM information_schema.schemata
|
||||
WHERE catalog_name IS NOT NULL or sql_path IS NOT NULL;
|
||||
|
||||
|
||||
--echo ###############################################################################
|
||||
--echo # Testcases 3.2.9.2+3.2.9.3: INFORMATION_SCHEMA.SCHEMATA accessible information
|
||||
--echo ###############################################################################
|
||||
# 3.2.9.2 Ensure that the table shows the relevant information for every
|
||||
# database on which the current user or PUBLIC have privileges.
|
||||
# 3.2.9.3 Ensure that the table does not show any information on any databases
|
||||
# on which the current user and PUBLIC have no privileges.
|
||||
#
|
||||
# Note: Check of content within information_schema.schemata about the databases
|
||||
# information_schema and mysql is in
|
||||
# suite/funcs_1/t/is_schemata_is_mysql.test.
|
||||
#
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS db_datadict_1;
|
||||
DROP DATABASE IF EXISTS db_datadict_2;
|
||||
--enable_warnings
|
||||
CREATE DATABASE db_datadict_1;
|
||||
CREATE DATABASE db_datadict_2;
|
||||
|
||||
--error 0,ER_CANNOT_USER
|
||||
DROP USER 'testuser1'@'localhost';
|
||||
CREATE USER 'testuser1'@'localhost';
|
||||
--error 0,ER_CANNOT_USER
|
||||
DROP USER 'testuser2'@'localhost';
|
||||
CREATE USER 'testuser2'@'localhost';
|
||||
--error 0,ER_CANNOT_USER
|
||||
DROP USER 'testuser3'@'localhost';
|
||||
CREATE USER 'testuser3'@'localhost';
|
||||
|
||||
GRANT SELECT ON db_datadict_1.* to 'testuser1'@'localhost';
|
||||
GRANT SELECT ON db_datadict_1.* to 'testuser2'@'localhost';
|
||||
GRANT SELECT ON db_datadict_2.* to 'testuser2'@'localhost';
|
||||
|
||||
let $my_select = SELECT * FROM information_schema.schemata
|
||||
WHERE schema_name LIKE 'db_datadict_%' ORDER BY schema_name;
|
||||
let $my_show = SHOW DATABASES LIKE 'db_datadict_%';
|
||||
|
||||
eval $my_select;
|
||||
--sorted_result
|
||||
eval $my_show;
|
||||
|
||||
--echo # Establish connection testuser1 (user=testuser1)
|
||||
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
||||
connect (testuser1, localhost, testuser1, , db_datadict_1);
|
||||
# Shows db_datadict_1
|
||||
eval $my_select;
|
||||
--sorted_result
|
||||
eval $my_show;
|
||||
|
||||
--echo # Establish connection testuser2 (user=testuser2)
|
||||
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
||||
connect (testuser2, localhost, testuser2, , db_datadict_2);
|
||||
# Shows db_datadict_1 and db_datadict_2
|
||||
eval $my_select;
|
||||
--sorted_result
|
||||
eval $my_show;
|
||||
|
||||
--echo # Establish connection testuser3 (user=testuser3)
|
||||
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
||||
connect (testuser3, localhost, testuser3, , test);
|
||||
# Shows neither db_datadict_1 nor db_datadict_2
|
||||
eval $my_select;
|
||||
--sorted_result
|
||||
eval $my_show;
|
||||
|
||||
# Cleanup
|
||||
--echo # Switch to connection default and close connections testuser1,testuser2,testuser3
|
||||
connection default;
|
||||
disconnect testuser1;
|
||||
disconnect testuser2;
|
||||
disconnect testuser3;
|
||||
DROP USER 'testuser1'@'localhost';
|
||||
DROP USER 'testuser2'@'localhost';
|
||||
DROP USER 'testuser3'@'localhost';
|
||||
DROP DATABASE db_datadict_1;
|
||||
DROP DATABASE db_datadict_2;
|
||||
|
||||
|
||||
--echo #################################################################################
|
||||
--echo # Testcases 3.2.1.13+3.2.1.14+3.2.1.15: INFORMATION_SCHEMA.SCHEMATA modifications
|
||||
--echo #################################################################################
|
||||
# 3.2.1.13: Ensure that the creation of any new database object (e.g. table or
|
||||
# column) automatically inserts all relevant information on that
|
||||
# object into every appropriate INFORMATION_SCHEMA table.
|
||||
# 3.2.1.14: Ensure that the alteration of any existing database object
|
||||
# automatically updates all relevant information on that object in
|
||||
# every appropriate INFORMATION_SCHEMA table.
|
||||
# 3.2.1.15: Ensure that the dropping of any existing database object
|
||||
# automatically deletes all relevant information on that object from
|
||||
# every appropriate INFORMATION_SCHEMA table.
|
||||
#
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS db_datadict;
|
||||
--enable_warnings
|
||||
|
||||
SELECT * FROM information_schema.schemata WHERE schema_name = 'db_datadict';
|
||||
CREATE DATABASE db_datadict CHARACTER SET 'latin1' COLLATE 'latin1_swedish_ci';
|
||||
SELECT * FROM information_schema.schemata WHERE schema_name = 'db_datadict';
|
||||
|
||||
# Check modify default CHARACTER SET
|
||||
SELECT schema_name, default_character_set_name
|
||||
FROM information_schema.schemata WHERE schema_name = 'db_datadict';
|
||||
ALTER SCHEMA db_datadict CHARACTER SET 'utf8';
|
||||
SELECT schema_name, default_character_set_name
|
||||
FROM information_schema.schemata WHERE schema_name = 'db_datadict';
|
||||
ALTER SCHEMA db_datadict CHARACTER SET 'latin1';
|
||||
|
||||
# Check modify default COLLATION
|
||||
SELECT schema_name, default_collation_name FROM information_schema.schemata
|
||||
WHERE schema_name = 'db_datadict';
|
||||
ALTER SCHEMA db_datadict COLLATE 'latin1_general_cs';
|
||||
SELECT schema_name, default_collation_name FROM information_schema.schemata
|
||||
WHERE schema_name = 'db_datadict';
|
||||
|
||||
# Check DROP DATABASE
|
||||
SELECT schema_name
|
||||
FROM information_schema.schemata WHERE schema_name = 'db_datadict';
|
||||
DROP DATABASE db_datadict;
|
||||
SELECT schema_name
|
||||
FROM information_schema.schemata WHERE schema_name = 'db_datadict';
|
||||
|
||||
|
||||
--echo ########################################################################
|
||||
--echo # Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and
|
||||
--echo # DDL on INFORMATION_SCHEMA tables are not supported
|
||||
--echo ########################################################################
|
||||
# 3.2.1.3: Ensure that no user may execute an INSERT statement on any
|
||||
# INFORMATION_SCHEMA table.
|
||||
# 3.2.1.4: Ensure that no user may execute an UPDATE statement on any
|
||||
# INFORMATION_SCHEMA table.
|
||||
# 3.2.1.5: Ensure that no user may execute a DELETE statement on any
|
||||
# INFORMATION_SCHEMA table.
|
||||
# 3.2.1.8: Ensure that no user may create an index on an INFORMATION_SCHEMA table.
|
||||
# 3.2.1.9: Ensure that no user may alter the definition of an
|
||||
# INFORMATION_SCHEMA table.
|
||||
# 3.2.1.10: Ensure that no user may drop an INFORMATION_SCHEMA table.
|
||||
# 3.2.1.11: Ensure that no user may move an INFORMATION_SCHEMA table to any
|
||||
# other database.
|
||||
# 3.2.1.12: Ensure that no user may directly add to, alter, or delete any data
|
||||
# in an INFORMATION_SCHEMA table.
|
||||
#
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS db_datadict;
|
||||
--enable_warnings
|
||||
CREATE DATABASE db_datadict CHARACTER SET 'latin1' COLLATE 'latin1_swedish_ci';
|
||||
|
||||
# Note(mleich):
|
||||
# 1. We can get here different error messages.
|
||||
# 2. We do not want to unify the individual messages to the far to unspecific
|
||||
# 'Got one of the listed errors'.
|
||||
let $my_error_message =
|
||||
##### The previous statement must fail ######
|
||||
# Server type | expected error name | expected error message
|
||||
# --------------------------------------------------------------------------------------------------------------------
|
||||
# not embedded | ER_DBACCESS_DENIED_ERROR | ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
# embedded | ER_NON_INSERTABLE_TABLE | ERROR HY000: The target table schemata of the INSERT is not insertable-into
|
||||
# | or similar | or similar
|
||||
;
|
||||
|
||||
--disable_abort_on_error
|
||||
INSERT INTO information_schema.schemata
|
||||
(catalog_name, schema_name, default_character_set_name, sql_path)
|
||||
VALUES (NULL, 'db1', 'latin1', NULL);
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
--echo $my_error_message
|
||||
exit;
|
||||
}
|
||||
INSERT INTO information_schema.schemata
|
||||
SELECT * FROM information_schema.schemata;
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
--echo $my_error_message
|
||||
exit;
|
||||
}
|
||||
UPDATE information_schema.schemata
|
||||
SET default_character_set_name = 'utf8'
|
||||
WHERE schema_name = 'db_datadict';
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
--echo $my_error_message
|
||||
exit;
|
||||
}
|
||||
UPDATE information_schema.schemata SET catalog_name = 't_4711';
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
--echo $my_error_message
|
||||
exit;
|
||||
}
|
||||
DELETE FROM information_schema.schemata WHERE schema_name = 'db_datadict';
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
--echo $my_error_message
|
||||
exit;
|
||||
}
|
||||
TRUNCATE information_schema.schemata;
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
--echo $my_error_message
|
||||
exit;
|
||||
}
|
||||
CREATE INDEX i1 ON information_schema.schemata(schema_name);
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
--echo $my_error_message
|
||||
exit;
|
||||
}
|
||||
ALTER TABLE information_schema.schemata ADD f1 INT;
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
--echo $my_error_message
|
||||
exit;
|
||||
}
|
||||
DROP TABLE information_schema.schemata;
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
--echo $my_error_message
|
||||
exit;
|
||||
}
|
||||
ALTER TABLE information_schema.schemata RENAME db_datadict.schemata;
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
--echo $my_error_message
|
||||
exit;
|
||||
}
|
||||
ALTER TABLE information_schema.schemata RENAME information_schema.xschemata;
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
--echo $my_error_message
|
||||
exit;
|
||||
}
|
||||
--enable_abort_on_error
|
||||
|
||||
# Cleanup
|
||||
DROP DATABASE db_datadict;
|
||||
|
||||
475
mysql-test/suite/funcs_1/datadict/is_tables.inc
Normal file
475
mysql-test/suite/funcs_1/datadict/is_tables.inc
Normal file
@@ -0,0 +1,475 @@
|
||||
# suite/funcs_1/datadict/is_tables.inc
|
||||
#
|
||||
# Check the layout of information_schema.tables and the impact of
|
||||
# CREATE/ALTER/DROP TABLE/VIEW/SCHEMA ... on it.
|
||||
#
|
||||
# Note:
|
||||
# This test is not intended
|
||||
# - to show information about the all time existing tables
|
||||
# within the databases information_schema and mysql
|
||||
# - for checking storage engine properties
|
||||
# Therefore please do not alter $engine_type and $other_engine_type.
|
||||
# Some results of the subtests depend on the storage engines assigned.
|
||||
#
|
||||
# Author:
|
||||
# 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of
|
||||
# testsuite funcs_1
|
||||
# Create this script based on older scripts and new code.
|
||||
# Last Change:
|
||||
# 2008-06-11 mleich Move t/is_tables.test to this file and
|
||||
# create variants for embedded/non embedded server.
|
||||
#
|
||||
|
||||
let $engine_type = MEMORY;
|
||||
let $other_engine_type = MyISAM;
|
||||
|
||||
let $is_table = TABLES;
|
||||
|
||||
# The table INFORMATION_SCHEMA.TABLES must exist
|
||||
eval SHOW TABLES FROM information_schema LIKE '$is_table';
|
||||
|
||||
--echo #######################################################################
|
||||
--echo # Testcase 3.2.1.1: INFORMATION_SCHEMA tables can be queried via SELECT
|
||||
--echo #######################################################################
|
||||
# Ensure that every INFORMATION_SCHEMA table can be queried with a SELECT
|
||||
# statement, just as if it were an ordinary user-defined table.
|
||||
#
|
||||
--source suite/funcs_1/datadict/is_table_query.inc
|
||||
|
||||
|
||||
--echo #########################################################################
|
||||
--echo # Testcase 3.2.12.1: INFORMATION_SCHEMA.TABLES layout
|
||||
--echo #########################################################################
|
||||
# Ensure that the INFORMATION_SCHEMA.TABLES table has the following columns,
|
||||
# in the following order:
|
||||
#
|
||||
# TABLE_CATALOG (always shows NULL),
|
||||
# TABLE_SCHEMA (shows the name of the database, or schema, in which an
|
||||
# accessible table resides),
|
||||
# TABLE_NAME (shows the name of a table which the current user may access),
|
||||
# TABLE_TYPE (shows whether the table is a BASE TABLE, a TEMPORARY table,
|
||||
# or a VIEW),
|
||||
# ENGINE (shows the storage engine used for the table),
|
||||
# VERSION (shows the version number of the table's .frm file),
|
||||
# ROW_FORMAT (shows the table's row storage format; either FIXED, DYNAMIC
|
||||
# or COMPRESSED),
|
||||
# TABLE_ROWS (shows the number of rows in the table),
|
||||
# AVG_ROW_LENGTH (shows the average length of the table's rows),
|
||||
# DATA_LENGTH (shows the length of the table's data file),
|
||||
# MAX_DATA_LENGTH (shows the maximum length of the table's data file),
|
||||
# INDEX_LENGTH (shows the length of the index file associated with the table),
|
||||
# DATA_FREE (shows the number of allocated, unused bytes),
|
||||
# AUTO_INCREMENT (shows the next AUTO_INCREMENT value, where applicable),
|
||||
# CREATE_TIME (shows the timestamp of the time the table was created),
|
||||
# UPDATE_TIME (shows the timestamp of the time the table's data file was
|
||||
# last updated),
|
||||
# CHECK_TIME (shows the timestamp of the time the table was last checked),
|
||||
# TABLE_COLLATION (shows the table's default collation),
|
||||
# CHECKSUM (shows the live checksum value for the table, if any; otherwise NULL),
|
||||
# CREATE_OPTIONS (shows any additional options used in the table's definition;
|
||||
# otherwise NULL),
|
||||
# TABLE_COMMENT (shows the comment added to the table's definition;
|
||||
# otherwise NULL).
|
||||
#
|
||||
--source suite/funcs_1/datadict/datadict_bug_12777.inc
|
||||
eval DESCRIBE information_schema.$is_table;
|
||||
--source suite/funcs_1/datadict/datadict_bug_12777.inc
|
||||
eval SHOW CREATE TABLE information_schema.$is_table;
|
||||
--source suite/funcs_1/datadict/datadict_bug_12777.inc
|
||||
eval SHOW COLUMNS FROM information_schema.$is_table;
|
||||
|
||||
# Note: Retrieval of information within information_schema.columns about
|
||||
# information_schema.tables is in is_columns_is.test.
|
||||
|
||||
# Show that TABLE_CATALOG is always NULL.
|
||||
SELECT table_catalog, table_schema, table_name
|
||||
FROM information_schema.tables WHERE table_catalog IS NOT NULL;
|
||||
|
||||
|
||||
--echo ################################################################################
|
||||
--echo # Testcase 3.2.12.2 + 3.2.12.3: INFORMATION_SCHEMA.TABLES accessible information
|
||||
--echo ################################################################################
|
||||
# 3.2.12.2: Ensure that the table shows the relevant information on every base table
|
||||
# and view on which the current user or PUBLIC has privileges.
|
||||
# 3.2.12.3: Ensure that the table does not show any information on any tables
|
||||
# on which the current user and public have no privileges.
|
||||
#
|
||||
# Note: Check of content within information_schema.tables about tables within
|
||||
# database is in
|
||||
# mysql is_tables_mysql.test
|
||||
# information_schema is_tables_is.test
|
||||
# test% is_tables_<engine>.test
|
||||
#
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS db_datadict;
|
||||
--enable_warnings
|
||||
CREATE DATABASE db_datadict;
|
||||
|
||||
--error 0,ER_CANNOT_USER
|
||||
DROP USER 'testuser1'@'localhost';
|
||||
CREATE USER 'testuser1'@'localhost';
|
||||
GRANT CREATE, CREATE VIEW, INSERT, SELECT ON db_datadict.*
|
||||
TO 'testuser1'@'localhost' WITH GRANT OPTION;
|
||||
--error 0,ER_CANNOT_USER
|
||||
DROP USER 'testuser2'@'localhost';
|
||||
CREATE USER 'testuser2'@'localhost';
|
||||
--error 0,ER_CANNOT_USER
|
||||
DROP USER 'testuser3'@'localhost';
|
||||
CREATE USER 'testuser3'@'localhost';
|
||||
|
||||
--replace_result $engine_type <engine_type>
|
||||
eval
|
||||
CREATE TABLE db_datadict.tb1 (f1 INT, f2 INT, f3 INT)
|
||||
ENGINE = $engine_type;
|
||||
|
||||
GRANT SELECT ON db_datadict.tb1 TO 'testuser1'@'localhost';
|
||||
GRANT ALL ON db_datadict.tb1 TO 'testuser2'@'localhost' WITH GRANT OPTION;
|
||||
|
||||
let $my_select = SELECT * FROM information_schema.tables
|
||||
WHERE table_schema = 'db_datadict' ORDER BY table_name;
|
||||
let $my_show = SHOW TABLES FROM db_datadict;
|
||||
|
||||
--echo # Establish connection testuser1 (user=testuser1)
|
||||
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
||||
connect (testuser1, localhost, testuser1, , db_datadict);
|
||||
# tb2 is not granted to anyone
|
||||
--replace_result $engine_type <engine_type>
|
||||
eval
|
||||
CREATE TABLE tb2 (f1 DECIMAL)
|
||||
ENGINE = $engine_type;
|
||||
--replace_result $engine_type <engine_type>
|
||||
eval
|
||||
CREATE TABLE tb3 (f1 VARCHAR(200))
|
||||
ENGINE = $engine_type;
|
||||
GRANT SELECT ON db_datadict.tb3 to 'testuser3'@'localhost';
|
||||
GRANT INSERT ON db_datadict.tb3 to 'testuser2'@'localhost';
|
||||
CREATE VIEW v3 AS SELECT * FROM tb3;
|
||||
GRANT SELECT ON db_datadict.v3 to 'testuser3'@'localhost';
|
||||
|
||||
if ($have_bug_32285)
|
||||
{
|
||||
--disable_ps_protocol
|
||||
}
|
||||
# We do not want to check here values affected by
|
||||
# - the storage engine used
|
||||
# - Operating system / Filesystem
|
||||
# - start time of test
|
||||
# 1 TABLE_CATALOG
|
||||
# 2 TABLE_SCHEMA
|
||||
# 3 TABLE_NAME
|
||||
# 4 TABLE_TYPE
|
||||
# 5 ENGINE affected by storage engine used
|
||||
# 6 VERSION
|
||||
# 7 ROW_FORMAT affected by storage engine used
|
||||
# 8 TABLE_ROWS
|
||||
# 9 AVG_ROW_LENGTH affected by storage engine used
|
||||
# 10 DATA_LENGTH affected by storage engine used and maybe OS
|
||||
# 11 MAX_DATA_LENGTH affected by storage engine used and maybe OS
|
||||
# 12 INDEX_LENGTH affected by storage engine used and maybe OS
|
||||
# 13 DATA_FREE affected by storage engine used and maybe OS
|
||||
# 14 AUTO_INCREMENT
|
||||
# 15 CREATE_TIME depends roughly on start time of test (*)
|
||||
# 16 UPDATE_TIME depends roughly on start time of test (*)
|
||||
# 17 CHECK_TIME depends roughly on start time of test and storage engine (*)
|
||||
# 18 TABLE_COLLATION
|
||||
# 19 CHECKSUM affected by storage engine used
|
||||
# 20 CREATE_OPTIONS
|
||||
# 21 TABLE_COMMENT affected by some storage engines
|
||||
# (*) In case of view or temporary table NULL.
|
||||
--replace_column 5 "#ENG#" 7 "#RF#" 9 "#ARL#" 10 "#DL#" 11 "#MDL#" 12 "#IL#" 13 "#DF#" 15 "#CRT" 16 "#UT#" 17 "#CT#" 19 "#CS#"
|
||||
eval $my_select;
|
||||
--enable_ps_protocol
|
||||
--sorted_result
|
||||
eval $my_show;
|
||||
|
||||
--echo # Establish connection testuser2 (user=testuser2)
|
||||
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
||||
connect (testuser2, localhost, testuser2, , db_datadict);
|
||||
if ($have_bug_32285)
|
||||
{
|
||||
--disable_ps_protocol
|
||||
}
|
||||
--replace_column 5 "#ENG#" 7 "#RF#" 9 "#ARL#" 10 "#DL#" 11 "#MDL#" 12 "#IL#" 13 "#DF#" 15 "#CRT" 16 "#UT#" 17 "#CT#" 19 "#CS#"
|
||||
eval $my_select;
|
||||
--enable_ps_protocol
|
||||
--sorted_result
|
||||
eval $my_show;
|
||||
|
||||
--echo # Establish connection testuser3 (user=testuser3)
|
||||
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
||||
connect (testuser3, localhost, testuser3, , db_datadict);
|
||||
if ($have_bug_32285)
|
||||
{
|
||||
--disable_ps_protocol
|
||||
}
|
||||
--replace_column 5 "#ENG#" 7 "#RF#" 9 "#ARL#" 10 "#DL#" 11 "#MDL#" 12 "#IL#" 13 "#DF#" 15 "#CRT" 16 "#UT#" 17 "#CT#" 19 "#CS#"
|
||||
eval $my_select;
|
||||
--enable_ps_protocol
|
||||
--sorted_result
|
||||
eval $my_show;
|
||||
|
||||
--echo # Switch to connection default (user=root)
|
||||
connection default;
|
||||
# we see only 'public' tables
|
||||
if ($have_bug_32285)
|
||||
{
|
||||
--disable_ps_protocol
|
||||
}
|
||||
--replace_column 5 "#ENG#" 7 "#RF#" 9 "#ARL#" 10 "#DL#" 11 "#MDL#" 12 "#IL#" 13 "#DF#" 15 "#CRT" 16 "#UT#" 17 "#CT#" 19 "#CS#"
|
||||
eval $my_select;
|
||||
--enable_ps_protocol
|
||||
--sorted_result
|
||||
eval $my_show;
|
||||
|
||||
# Cleanup
|
||||
--echo # Close connection testuser1, testuser2, testuser3
|
||||
disconnect testuser1;
|
||||
disconnect testuser2;
|
||||
disconnect testuser3;
|
||||
DROP USER 'testuser1'@'localhost';
|
||||
DROP USER 'testuser2'@'localhost';
|
||||
DROP USER 'testuser3'@'localhost';
|
||||
DROP DATABASE db_datadict;
|
||||
|
||||
|
||||
--echo #########################################################################
|
||||
--echo # 3.2.1.13+3.2.1.14+3.2.1.15: INFORMATION_SCHEMA.TABLES modifications
|
||||
--echo #########################################################################
|
||||
# 3.2.1.13: Ensure that the creation of any new database object (e.g. table or
|
||||
# column) automatically inserts all relevant information on that
|
||||
# object into every appropriate INFORMATION_SCHEMA table.
|
||||
# 3.2.1.14: Ensure that the alteration of any existing database object
|
||||
# automatically updates all relevant information on that object in
|
||||
# every appropriate INFORMATION_SCHEMA table.
|
||||
# 3.2.1.15: Ensure that the dropping of any existing database object
|
||||
# automatically deletes all relevant information on that object from
|
||||
# every appropriate INFORMATION_SCHEMA table.
|
||||
#
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS test.t1_my_table;
|
||||
DROP DATABASE IF EXISTS db_datadict;
|
||||
--enable_warnings
|
||||
CREATE DATABASE db_datadict;
|
||||
|
||||
SELECT table_name FROM information_schema.tables
|
||||
WHERE table_name LIKE 't1_my_table%';
|
||||
--replace_result $engine_type <engine_type>
|
||||
eval
|
||||
CREATE TABLE test.t1_my_table (f1 BIGINT)
|
||||
DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci
|
||||
COMMENT = 'Initial Comment' ENGINE = $engine_type;
|
||||
# Settings used in CREATE TABLE must be visible in information_schema.tables.
|
||||
--vertical_results
|
||||
--replace_column 5 "#ENG#" 7 "#RF#" 9 "#ARL#" 10 "#DL#" 11 "#MDL#" 12 "#IL#" 13 "#DF#" 15 "#CRT" 16 "#UT#" 17 "#CT#" 19 "#CS#"
|
||||
SELECT * FROM information_schema.tables
|
||||
WHERE table_name = 't1_my_table';
|
||||
--horizontal_results
|
||||
#
|
||||
# Check modification of TABLE_NAME
|
||||
SELECT table_name FROM information_schema.tables
|
||||
WHERE table_name LIKE 't1_my_table%';
|
||||
RENAME TABLE test.t1_my_table TO test.t1_my_tablex;
|
||||
SELECT table_name FROM information_schema.tables
|
||||
WHERE table_name LIKE 't1_my_table%';
|
||||
#
|
||||
# Check modification of TABLE_SCHEMA
|
||||
SELECT table_schema,table_name FROM information_schema.tables
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
RENAME TABLE test.t1_my_tablex TO db_datadict.t1_my_tablex;
|
||||
SELECT table_schema,table_name FROM information_schema.tables
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
#
|
||||
# Check modification of ENGINE
|
||||
--replace_result $engine_type <engine_type>
|
||||
SELECT table_name, engine FROM information_schema.tables
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
--replace_result $other_engine_type <other_engine_type>
|
||||
eval
|
||||
ALTER TABLE db_datadict.t1_my_tablex
|
||||
ENGINE = $other_engine_type;
|
||||
--replace_result $other_engine_type <other_engine_type>
|
||||
SELECT table_name, engine FROM information_schema.tables
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
#
|
||||
# Check modification of TABLE_ROWS
|
||||
SELECT table_name, table_rows FROM information_schema.tables
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
INSERT INTO db_datadict.t1_my_tablex VALUES(1),(2);
|
||||
SELECT table_name, table_rows FROM information_schema.tables
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
#
|
||||
# Check indirect modification of TABLE_COLLATION
|
||||
SELECT table_name, table_collation FROM information_schema.tables
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
ALTER TABLE db_datadict.t1_my_tablex DEFAULT CHARACTER SET utf8;
|
||||
SELECT table_name, table_collation FROM information_schema.tables
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
# Check direct modification of TABLE_COLLATION
|
||||
SELECT table_name, table_collation FROM information_schema.tables
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
ALTER TABLE db_datadict.t1_my_tablex
|
||||
DEFAULT CHARACTER SET latin1 COLLATE latin1_german1_ci;
|
||||
SELECT table_name, table_collation FROM information_schema.tables
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
#
|
||||
# Check modification of TABLE_COMMENT
|
||||
SELECT table_name, TABLE_COMMENT FROM information_schema.tables
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
ALTER TABLE db_datadict.t1_my_tablex COMMENT 'Changed Comment';
|
||||
SELECT table_name, TABLE_COMMENT FROM information_schema.tables
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
#
|
||||
# Check modification of AUTO_INCREMENT
|
||||
SELECT table_name, AUTO_INCREMENT FROM information_schema.tables
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
ALTER TABLE db_datadict.t1_my_tablex
|
||||
ADD f2 BIGINT AUTO_INCREMENT, ADD PRIMARY KEY (f2);
|
||||
SELECT table_name, AUTO_INCREMENT FROM information_schema.tables
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
#
|
||||
# Check modification of ROW_FORMAT
|
||||
SELECT table_name, ROW_FORMAT FROM information_schema.tables
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
ALTER TABLE db_datadict.t1_my_tablex ROW_FORMAT = dynamic;
|
||||
SELECT table_name, ROW_FORMAT FROM information_schema.tables
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
#
|
||||
# Check "growth" of UPDATE_TIME and modification of CHECKSUM
|
||||
SELECT table_name, checksum FROM information_schema.tables
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
ALTER TABLE db_datadict.t1_my_tablex CHECKSUM = 1;
|
||||
SELECT table_name, checksum IS NOT NULL FROM information_schema.tables
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
SELECT UPDATE_TIME, checksum INTO @UPDATE_TIME, @checksum
|
||||
FROM information_schema.tables
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
# Enforce a time difference bigger than the smallest unit (1 second).
|
||||
--real_sleep 1.1
|
||||
INSERT INTO db_datadict.t1_my_tablex SET f1 = 3;
|
||||
SELECT UPDATE_TIME > @UPDATE_TIME
|
||||
AS "Is current UPDATE_TIME bigger than before last INSERT?"
|
||||
FROM information_schema.tables
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
SELECT checksum <> @checksum
|
||||
AS "Is current CHECKSUM different than before last INSERT?"
|
||||
FROM information_schema.tables
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
#
|
||||
# Information is used later
|
||||
SELECT CREATE_TIME INTO @CREATE_TIME FROM information_schema.tables
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
#
|
||||
# Check impact of DROP TABLE
|
||||
SELECT table_name FROM information_schema.tables
|
||||
WHERE table_name LIKE 't1_my_table%';
|
||||
DROP TABLE db_datadict.t1_my_tablex;
|
||||
SELECT table_name FROM information_schema.tables
|
||||
WHERE table_name LIKE 't1_my_table%';
|
||||
#
|
||||
# Check "growth" of CREATE_TIME
|
||||
--replace_result $other_engine_type <other_engine_type>
|
||||
eval
|
||||
CREATE TABLE test.t1_my_tablex (f1 BIGINT)
|
||||
ENGINE = $other_engine_type;
|
||||
SELECT CREATE_TIME > @CREATE_TIME
|
||||
AS "Is current CREATE_TIME bigger than for the old dropped table?"
|
||||
FROM information_schema.tables
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
DROP TABLE test.t1_my_tablex;
|
||||
#
|
||||
# Check a VIEW
|
||||
CREATE VIEW test.t1_my_tablex AS SELECT 1;
|
||||
--vertical_results
|
||||
SELECT * FROM information_schema.tables
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
--horizontal_results
|
||||
DROP VIEW test.t1_my_tablex;
|
||||
SELECT table_name FROM information_schema.tables
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
#
|
||||
# Check a temporary table
|
||||
--replace_result $other_engine_type <other_engine_type>
|
||||
eval
|
||||
CREATE TEMPORARY TABLE test.t1_my_tablex
|
||||
ENGINE = $other_engine_type
|
||||
AS SELECT 1;
|
||||
--vertical_results
|
||||
SELECT table_name, table_type FROM information_schema.tables
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
--horizontal_results
|
||||
DROP TEMPORARY TABLE test.t1_my_tablex;
|
||||
#
|
||||
# Check impact of DROP SCHEMA
|
||||
--replace_result $engine_type <engine_type>
|
||||
eval
|
||||
CREATE TABLE db_datadict.t1_my_tablex
|
||||
ENGINE = $engine_type AS
|
||||
SELECT 1;
|
||||
SELECT table_name FROM information_schema.tables
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
DROP DATABASE db_datadict;
|
||||
SELECT table_name FROM information_schema.tables
|
||||
WHERE table_name = 't1_my_tablex';
|
||||
|
||||
|
||||
--echo ########################################################################
|
||||
--echo # Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and
|
||||
--echo # DDL on INFORMATION_SCHEMA tables are not supported
|
||||
--echo ########################################################################
|
||||
# 3.2.1.3: Ensure that no user may execute an INSERT statement on any
|
||||
# INFORMATION_SCHEMA table.
|
||||
# 3.2.1.4: Ensure that no user may execute an UPDATE statement on any
|
||||
# INFORMATION_SCHEMA table.
|
||||
# 3.2.1.5: Ensure that no user may execute a DELETE statement on any
|
||||
# INFORMATION_SCHEMA table.
|
||||
# 3.2.1.8: Ensure that no user may create an index on an
|
||||
# INFORMATION_SCHEMA table.
|
||||
# 3.2.1.9: Ensure that no user may alter the definition of an
|
||||
# INFORMATION_SCHEMA table.
|
||||
# 3.2.1.10: Ensure that no user may drop an INFORMATION_SCHEMA table.
|
||||
# 3.2.1.11: Ensure that no user may move an INFORMATION_SCHEMA table to any
|
||||
# other database.
|
||||
# 3.2.1.12: Ensure that no user may directly add to, alter, or delete any data
|
||||
# in an INFORMATION_SCHEMA table.
|
||||
#
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS db_datadict;
|
||||
--enable_warnings
|
||||
CREATE DATABASE db_datadict;
|
||||
--replace_result $engine_type <engine_type>
|
||||
eval
|
||||
CREATE TABLE db_datadict.t1 (f1 BIGINT)
|
||||
ENGINE = $engine_type;
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
INSERT INTO information_schema.tables
|
||||
SELECT * FROM information_schema.tables;
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
UPDATE information_schema.tables SET table_schema = 'test'
|
||||
WHERE table_name = 't1';
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
DELETE FROM information_schema.tables WHERE table_name = 't1';
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
TRUNCATE information_schema.tables;
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
CREATE INDEX my_idx_on_tables ON information_schema.tables(table_schema);
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
ALTER TABLE information_schema.tables DROP PRIMARY KEY;
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
ALTER TABLE information_schema.tables ADD f1 INT;
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
DROP TABLE information_schema.tables;
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
ALTER TABLE information_schema.tables RENAME db_datadict.tables;
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
ALTER TABLE information_schema.tables RENAME information_schema.xtables;
|
||||
|
||||
# Cleanup
|
||||
DROP DATABASE db_datadict;
|
||||
|
||||
258
mysql-test/suite/funcs_1/datadict/is_triggers.inc
Normal file
258
mysql-test/suite/funcs_1/datadict/is_triggers.inc
Normal file
@@ -0,0 +1,258 @@
|
||||
# suite/funcs_1/datadict/is_triggers.inc
|
||||
#
|
||||
# Check the layout of information_schema.triggers and the impact of
|
||||
# CREATE/ALTER/DROP TABLE/VIEW/SCHEMA ... on it.
|
||||
#
|
||||
# Note:
|
||||
# This test is not intended
|
||||
# - to show information about the all time existing triggers
|
||||
# (there are no in the moment) within the databases information_schema
|
||||
# and mysql
|
||||
# - for checking storage engine properties
|
||||
# Therefore please do not alter $engine_type and $other_engine_type.
|
||||
#
|
||||
# Author:
|
||||
# 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of
|
||||
# testsuite funcs_1
|
||||
# Create this script based on older scripts and new code.
|
||||
# Last Change:
|
||||
# 2008-06-11 mleich Move t/is_triggers.test to this file and
|
||||
# create variants for embedded/non embedded server.
|
||||
#
|
||||
|
||||
let $engine_type = MEMORY;
|
||||
let $other_engine_type = MyISAM;
|
||||
|
||||
let $is_table = TRIGGERS;
|
||||
|
||||
# The table INFORMATION_SCHEMA.TRIGGERS must exist
|
||||
eval SHOW TABLES FROM information_schema LIKE '$is_table';
|
||||
|
||||
--echo #######################################################################
|
||||
--echo # Testcase 3.2.1.1: INFORMATION_SCHEMA tables can be queried via SELECT
|
||||
--echo #######################################################################
|
||||
# Ensure that every INFORMATION_SCHEMA table can be queried with a SELECT
|
||||
# statement, just as if it were an ordinary user-defined table.
|
||||
#
|
||||
--source suite/funcs_1/datadict/is_table_query.inc
|
||||
|
||||
|
||||
--echo #########################################################################
|
||||
--echo # Testcase 3.2.12.1: INFORMATION_SCHEMA.TRIGGERS layout
|
||||
--echo #########################################################################
|
||||
# Ensure that the INFORMATION_SCHEMA.TRIGGERS table has the following columns,
|
||||
# in the following order:
|
||||
#
|
||||
# TRIGGER_CATALOG NULL
|
||||
# TRIGGER_SCHEMA name of the database in which the trigger occurs
|
||||
# TRIGGER_NAME
|
||||
# EVENT_MANIPULATION event associated with the trigger
|
||||
# ('INSERT', 'DELETE', or 'UPDATE')
|
||||
# EVENT_OBJECT_CATALOG NULL
|
||||
# EVENT_OBJECT_SCHEMA database in which the table associated with the
|
||||
# trigger occurs
|
||||
# EVENT_OBJECT_TABLE name of the table associated with the trigger
|
||||
# ACTION_ORDER 0
|
||||
# ACTION_CONDITION NULL
|
||||
# ACTION_STATEMENT
|
||||
# ACTION_ORIENTATION ROW
|
||||
# ACTION_TIMING 'BEFORE' or 'AFTER'
|
||||
# ACTION_REFERENCE_OLD_TABLE NULL
|
||||
# ACTION_REFERENCE_NEW_TABLE NULL
|
||||
# ACTION_REFERENCE_OLD_ROW OLD
|
||||
# ACTION_REFERENCE_NEW_ROW NEW
|
||||
# CREATED NULL (0)
|
||||
# SQL_MODE server SQL mode that was in effect at the time
|
||||
# when the trigger was created
|
||||
# (also used during trigger execution)
|
||||
# DEFINER who defined the trigger
|
||||
#
|
||||
--source suite/funcs_1/datadict/datadict_bug_12777.inc
|
||||
eval DESCRIBE information_schema.$is_table;
|
||||
--source suite/funcs_1/datadict/datadict_bug_12777.inc
|
||||
eval SHOW CREATE TABLE information_schema.$is_table;
|
||||
--source suite/funcs_1/datadict/datadict_bug_12777.inc
|
||||
eval SHOW COLUMNS FROM information_schema.$is_table;
|
||||
|
||||
|
||||
# Note: Retrieval of information within information_schema.columns about
|
||||
# information_schema.tables is in is_columns_is.test.
|
||||
|
||||
# Show that several columns are always NULL.
|
||||
SELECT * FROM information_schema.triggers
|
||||
WHERE trigger_catalog IS NOT NULL OR event_object_catalog IS NOT NULL
|
||||
OR action_condition IS NOT NULL OR action_reference_old_table IS NOT NULL
|
||||
OR action_reference_new_table IS NOT NULL;
|
||||
|
||||
|
||||
--echo ##################################################################################
|
||||
--echo # Testcase 3.2.18.2 + 3.2.18.3: INFORMATION_SCHEMA.TRIGGERS accessible information
|
||||
--echo ##################################################################################
|
||||
# 3.2.18.2: Ensure that the table shows the relevant information on every
|
||||
# trigger on which the current user or PUBLIC has privileges.
|
||||
# 3.2.18.3: Ensure that the table does not show any information on any trigger
|
||||
# on which the current user and public have no privileges.
|
||||
# The SUPER (before 5.1.22) or TRIGGER (since 5.1.22) privilege is required for
|
||||
# - creation of triggers
|
||||
# - retrieval in INFORMATION_SCHEMA.TRIGGERS (affects size of result set)
|
||||
#
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS db_datadict;
|
||||
--enable_warnings
|
||||
CREATE DATABASE db_datadict;
|
||||
--error 0,ER_CANNOT_USER
|
||||
DROP USER 'testuser1'@'localhost';
|
||||
CREATE USER 'testuser1'@'localhost';
|
||||
--error 0,ER_CANNOT_USER
|
||||
DROP USER 'testuser2'@'localhost';
|
||||
CREATE USER 'testuser2'@'localhost';
|
||||
--error 0,ER_CANNOT_USER
|
||||
DROP USER 'testuser3'@'localhost';
|
||||
CREATE USER 'testuser3'@'localhost';
|
||||
--error 0,ER_CANNOT_USER
|
||||
DROP USER 'testuser4'@'localhost';
|
||||
CREATE USER 'testuser4'@'localhost';
|
||||
|
||||
GRANT TRIGGER ON *.* TO 'testuser1'@'localhost';
|
||||
GRANT TRIGGER ON *.* TO 'testuser3'@'localhost';
|
||||
GRANT TRIGGER ON *.* TO 'testuser4'@'localhost';
|
||||
GRANT ALL ON db_datadict.* TO 'testuser1'@'localhost' WITH GRANT OPTION;
|
||||
|
||||
let $my_select = SELECT * FROM information_schema.triggers
|
||||
WHERE trigger_name = 'trg1';
|
||||
let $my_show = SHOW TRIGGERS FROM db_datadict;
|
||||
--echo # Establish connection testuser1 (user=testuser1)
|
||||
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
||||
connect (testuser1, localhost, testuser1, , db_datadict);
|
||||
--replace_result $engine_type <engine_type>
|
||||
eval
|
||||
CREATE TABLE db_datadict.t1 (f1 INT, f2 INT, f3 INT)
|
||||
ENGINE = $engine_type;
|
||||
CREATE TRIGGER trg1 BEFORE INSERT
|
||||
ON db_datadict.t1 FOR EACH ROW SET @test_before = 2, new.f1 = @test_before;
|
||||
GRANT ALL ON db_datadict.t1 TO 'testuser2'@'localhost';
|
||||
REVOKE TRIGGER ON db_datadict.t1 FROM 'testuser2'@'localhost';
|
||||
GRANT SELECT ON db_datadict.t1 TO 'testuser3'@'localhost';
|
||||
eval $my_select;
|
||||
eval $my_show;
|
||||
|
||||
--echo # Establish connection testuser2 (user=testuser2)
|
||||
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
||||
connect (testuser2, localhost, testuser2, , db_datadict);
|
||||
SHOW GRANTS FOR 'testuser2'@'localhost';
|
||||
--echo # No TRIGGER Privilege --> no result for query
|
||||
eval $my_select;
|
||||
eval $my_show;
|
||||
|
||||
--echo # Establish connection testuser3 (user=testuser3)
|
||||
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
||||
connect (testuser3, localhost, testuser3, , test);
|
||||
SHOW GRANTS FOR 'testuser3'@'localhost';
|
||||
--echo # TRIGGER Privilege + SELECT Privilege on t1 --> result for query
|
||||
eval $my_select;
|
||||
eval $my_show;
|
||||
|
||||
--echo # Establish connection testuser4 (user=testuser4)
|
||||
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
||||
connect (testuser4, localhost, testuser4, , test);
|
||||
SHOW GRANTS FOR 'testuser4'@'localhost';
|
||||
--echo # TRIGGER Privilege + no SELECT Privilege on t1 --> result for query
|
||||
--disable_abort_on_error
|
||||
SELECT * FROM db_datadict.t1;
|
||||
DESC db_datadict.t1;
|
||||
eval $my_select;
|
||||
eval $my_show;
|
||||
|
||||
--echo # Switch to connection default and close connections testuser1 - testuser4
|
||||
connection default;
|
||||
disconnect testuser1;
|
||||
disconnect testuser2;
|
||||
disconnect testuser3;
|
||||
disconnect testuser4;
|
||||
eval $my_select;
|
||||
eval $my_show;
|
||||
DROP USER 'testuser1'@'localhost';
|
||||
DROP USER 'testuser2'@'localhost';
|
||||
DROP USER 'testuser3'@'localhost';
|
||||
DROP USER 'testuser4'@'localhost';
|
||||
DROP DATABASE db_datadict;
|
||||
|
||||
|
||||
--echo #########################################################################
|
||||
--echo # 3.2.1.13+3.2.1.14+3.2.1.15: INFORMATION_SCHEMA.TRIGGERS modifications
|
||||
--echo #########################################################################
|
||||
# 3.2.1.13: Ensure that the creation of any new database object (e.g. table or
|
||||
# column) automatically inserts all relevant information on that
|
||||
# object into every appropriate INFORMATION_SCHEMA table.
|
||||
# 3.2.1.14: Ensure that the alteration of any existing database object
|
||||
# automatically updates all relevant information on that object in
|
||||
# every appropriate INFORMATION_SCHEMA table.
|
||||
# 3.2.1.15: Ensure that the dropping of any existing database object
|
||||
# automatically deletes all relevant information on that object from
|
||||
# every appropriate INFORMATION_SCHEMA table.
|
||||
# FIXME: To be implemented
|
||||
|
||||
|
||||
--echo ########################################################################
|
||||
--echo # Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and
|
||||
--echo # DDL on INFORMATION_SCHEMA tables are not supported
|
||||
--echo ########################################################################
|
||||
# 3.2.1.3: Ensure that no user may execute an INSERT statement on any
|
||||
# INFORMATION_SCHEMA table.
|
||||
# 3.2.1.4: Ensure that no user may execute an UPDATE statement on any
|
||||
# INFORMATION_SCHEMA table.
|
||||
# 3.2.1.5: Ensure that no user may execute a DELETE statement on any
|
||||
# INFORMATION_SCHEMA table.
|
||||
# 3.2.1.8: Ensure that no user may create an index on an
|
||||
# INFORMATION_SCHEMA table.
|
||||
# 3.2.1.9: Ensure that no user may alter the definition of an
|
||||
# INFORMATION_SCHEMA table.
|
||||
# 3.2.1.10: Ensure that no user may drop an INFORMATION_SCHEMA table.
|
||||
# 3.2.1.11: Ensure that no user may move an INFORMATION_SCHEMA table to any
|
||||
# other database.
|
||||
# 3.2.1.12: Ensure that no user may directly add to, alter, or delete any data
|
||||
# in an INFORMATION_SCHEMA table.
|
||||
#
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS db_datadict;
|
||||
--enable_warnings
|
||||
CREATE DATABASE db_datadict;
|
||||
--replace_result $engine_type <engine_type>
|
||||
eval
|
||||
CREATE TABLE db_datadict.t1 (f1 BIGINT)
|
||||
ENGINE = $engine_type;
|
||||
CREATE TRIGGER db_datadict.trg1 BEFORE INSERT
|
||||
ON db_datadict.t1 FOR EACH ROW SET @test_before = 2, new.f1 = @test_before;
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
INSERT INTO information_schema.triggers
|
||||
SELECT * FROM information_schema.triggers;
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
UPDATE information_schema.triggers SET trigger_schema = 'test'
|
||||
WHERE table_name = 't1';
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
DELETE FROM information_schema.triggers WHERE trigger_name = 't1';
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
TRUNCATE information_schema.triggers;
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
CREATE INDEX my_idx_on_triggers ON information_schema.triggers(trigger_schema);
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
ALTER TABLE information_schema.triggers DROP PRIMARY KEY;
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
ALTER TABLE information_schema.triggers ADD f1 INT;
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
DROP TABLE information_schema.triggers;
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
ALTER TABLE information_schema.triggers RENAME db_datadict.triggers;
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
ALTER TABLE information_schema.triggers RENAME information_schema.xtriggers;
|
||||
|
||||
# Cleanup
|
||||
DROP DATABASE db_datadict;
|
||||
|
||||
306
mysql-test/suite/funcs_1/datadict/is_views.inc
Normal file
306
mysql-test/suite/funcs_1/datadict/is_views.inc
Normal file
@@ -0,0 +1,306 @@
|
||||
# suite/funcs_1/datadict/is_views.inc
|
||||
#
|
||||
# Check the layout of information_schema.views and the impact of
|
||||
# CREATE/ALTER/DROP TABLE/VIEW/SCHEMA ... on it.
|
||||
#
|
||||
# Note:
|
||||
# - This test should not check storage engine properties.
|
||||
# - Please do not change the storage engines used within this test
|
||||
# except you know that the impact is acceptable.
|
||||
# Some storage engines might not support the modification of
|
||||
# properties like in the following tests.
|
||||
#
|
||||
# Author:
|
||||
# 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of
|
||||
# testsuite funcs_1
|
||||
# Create this script based on older scripts and new code.
|
||||
# Last Change:
|
||||
# 2008-06-11 mleich Move t/is_views.test to this file and
|
||||
# create variants for embedded/non embedded server.
|
||||
#
|
||||
|
||||
let $engine_type = MEMORY;
|
||||
let $other_engine_type = MyISAM;
|
||||
|
||||
let $is_table = VIEWS;
|
||||
|
||||
# The table INFORMATION_SCHEMA.VIEWS must exist
|
||||
eval SHOW TABLES FROM information_schema LIKE '$is_table';
|
||||
|
||||
--echo #######################################################################
|
||||
--echo # Testcase 3.2.1.1: INFORMATION_SCHEMA tables can be queried via SELECT
|
||||
--echo #######################################################################
|
||||
# Ensure that every INFORMATION_SCHEMA table can be queried with a SELECT
|
||||
# statement, just as if it were an ordinary user-defined table.
|
||||
#
|
||||
--source suite/funcs_1/datadict/is_table_query.inc
|
||||
|
||||
|
||||
--echo #########################################################################
|
||||
--echo # Testcase 3.2.13.1: INFORMATION_SCHEMA.VIEWS layout
|
||||
--echo #########################################################################
|
||||
# Ensure that the INFORMATION_SCHEMA.VIEWS table has the following columns,
|
||||
# in the following order:
|
||||
#
|
||||
# TABLE_CATALOG (always shows NULL),
|
||||
# TABLE_SCHEMA (shows the database, or schema, in which an accessible
|
||||
# view resides),
|
||||
# TABLE_NAME (shows the name of a view accessible to the current user),
|
||||
# VIEW_DEFINITION (shows the SELECT statement that makes up the
|
||||
# view's definition),
|
||||
# CHECK_OPTION (shows the value of the WITH CHECK OPTION clause used to define
|
||||
# the view, either NONE, LOCAL or CASCADED),
|
||||
# IS_UPDATABLE (shows whether the view is an updatable view),
|
||||
# DEFINER (added with 5.0.14),
|
||||
# SECURITY_TYPE (added with 5.0.14).
|
||||
#
|
||||
--source suite/funcs_1/datadict/datadict_bug_12777.inc
|
||||
eval DESCRIBE information_schema.$is_table;
|
||||
--source suite/funcs_1/datadict/datadict_bug_12777.inc
|
||||
eval SHOW CREATE TABLE information_schema.$is_table;
|
||||
--source suite/funcs_1/datadict/datadict_bug_12777.inc
|
||||
eval SHOW COLUMNS FROM information_schema.$is_table;
|
||||
|
||||
# Note: Retrieval of information within information_schema.columns about
|
||||
# information_schema.views is in is_columns_is.test.
|
||||
|
||||
# Show that TABLE_CATALOG is always NULL.
|
||||
SELECT table_catalog, table_schema, table_name
|
||||
FROM information_schema.views WHERE table_catalog IS NOT NULL;
|
||||
|
||||
|
||||
--echo ################################################################################
|
||||
--echo # Testcase 3.2.13.2 + 3.2.13.3: INFORMATION_SCHEMA.VIEWS accessible information
|
||||
--echo ################################################################################
|
||||
# 3.2.13.2: Ensure that the table shows the relevant information on every view for
|
||||
# which the current user or PUBLIC has the SHOW CREATE VIEW privilege.
|
||||
# 3.2.13.3: Ensure that the table does not show any information on any views for which
|
||||
# the current user and PUBLIC have no SHOW CREATE VIEW privilege.
|
||||
#
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS db_datadict;
|
||||
--enable_warnings
|
||||
CREATE DATABASE db_datadict;
|
||||
|
||||
--error 0,ER_CANNOT_USER
|
||||
DROP USER 'testuser1'@'localhost';
|
||||
CREATE USER 'testuser1'@'localhost';
|
||||
--error 0,ER_CANNOT_USER
|
||||
DROP USER 'testuser2'@'localhost';
|
||||
CREATE USER 'testuser2'@'localhost';
|
||||
--error 0,ER_CANNOT_USER
|
||||
DROP USER 'test_no_views'@'localhost';
|
||||
CREATE USER 'test_no_views'@'localhost';
|
||||
|
||||
--replace_result $engine_type <engine_type>
|
||||
eval
|
||||
CREATE TABLE db_datadict.t1(f1 INT, f2 INT, f3 INT)
|
||||
ENGINE = $engine_type;
|
||||
CREATE VIEW db_datadict.v_granted_to_1 AS SELECT * FROM db_datadict.t1;
|
||||
CREATE VIEW db_datadict.v_granted_glob AS SELECT f2, f3 FROM db_datadict.t1;
|
||||
|
||||
GRANT SELECT ON db_datadict.t1 TO 'testuser1'@'localhost';
|
||||
GRANT SELECT ON db_datadict.v_granted_to_1 TO 'testuser1'@'localhost';
|
||||
GRANT SHOW VIEW, CREATE VIEW ON db_datadict.* TO 'testuser2'@'localhost';
|
||||
|
||||
let $select = SELECT * FROM information_schema.views
|
||||
WHERE table_schema = 'db_datadict' ORDER BY table_name;
|
||||
eval $select;
|
||||
|
||||
--echo # Establish connection testuser1 (user=testuser1)
|
||||
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
||||
connect (testuser1, localhost, testuser1, , test);
|
||||
eval $select;
|
||||
|
||||
--echo # Establish connection testuser2 (user=testuser2)
|
||||
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
||||
connect (testuser2, localhost, testuser2, , test);
|
||||
eval $select;
|
||||
|
||||
--echo # Establish connection test_no_views (user=test_no_views)
|
||||
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
||||
connect (test_no_views, localhost, test_no_views, , test);
|
||||
eval $select;
|
||||
|
||||
# Cleanup
|
||||
--echo # Switch to connection default and close all other connections
|
||||
connection default;
|
||||
disconnect testuser1;
|
||||
disconnect testuser2;
|
||||
disconnect test_no_views;
|
||||
DROP USER 'testuser1'@'localhost';
|
||||
DROP USER 'testuser2'@'localhost';
|
||||
DROP USER 'test_no_views'@'localhost';
|
||||
DROP DATABASE db_datadict;
|
||||
|
||||
--echo #########################################################################
|
||||
--echo # 3.2.1.13+3.2.1.14+3.2.1.15: INFORMATION_SCHEMA.VIEWS modifications
|
||||
--echo #########################################################################
|
||||
# 3.2.1.13: Ensure that the creation of any new database object (e.g. table or
|
||||
# column) automatically inserts all relevant information on that
|
||||
# object into every appropriate INFORMATION_SCHEMA table.
|
||||
# 3.2.1.14: Ensure that the alteration of any existing database object
|
||||
# automatically updates all relevant information on that object in
|
||||
# every appropriate INFORMATION_SCHEMA table.
|
||||
# 3.2.1.15: Ensure that the dropping of any existing database object
|
||||
# automatically deletes all relevant information on that object from
|
||||
# every appropriate INFORMATION_SCHEMA table.
|
||||
#
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS test.t1_my_table;
|
||||
DROP DATABASE IF EXISTS db_datadict;
|
||||
--enable_warnings
|
||||
CREATE DATABASE db_datadict;
|
||||
--replace_result $engine_type <engine_type>
|
||||
eval
|
||||
CREATE TABLE test.t1_table (f1 BIGINT, f2 CHAR(10))
|
||||
DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci
|
||||
ENGINE = $engine_type;
|
||||
--error 0,ER_CANNOT_USER
|
||||
DROP USER 'testuser1'@'localhost';
|
||||
CREATE USER 'testuser1'@'localhost';
|
||||
|
||||
# Check just created VIEW
|
||||
SELECT * FROM information_schema.views
|
||||
WHERE table_name LIKE 't1_%';
|
||||
CREATE VIEW test.t1_view AS SELECT DISTINCT f1 FROM test.t1_table;
|
||||
SELECT * FROM information_schema.views
|
||||
WHERE table_name LIKE 't1_%';
|
||||
#
|
||||
# Check modification of DEFINER, SECURITY_TYPE, IS_UPDATABLE, VIEW_DEFINITION,
|
||||
# CHECK_OPTION
|
||||
SELECT table_name,definer FROM information_schema.views
|
||||
WHERE table_name = 't1_view';
|
||||
ALTER DEFINER = 'testuser1'@'localhost' VIEW test.t1_view AS
|
||||
SELECT DISTINCT f1 FROM test.t1_table;
|
||||
# The next result set could suffer from
|
||||
# Bug#22763 Disrepancy between SHOW CREATE VIEW and I_S.VIEWS
|
||||
# because the VIEW definition is missing.
|
||||
# Therefore we exclude the problematic columns from the result set.
|
||||
SELECT table_name,definer,security_type FROM information_schema.views
|
||||
WHERE table_name LIKE 't1_%';
|
||||
ALTER DEFINER = 'root'@'localhost' SQL SECURITY INVOKER VIEW test.t1_view AS
|
||||
SELECT f1 FROM test.t1_table WITH LOCAL CHECK OPTION;
|
||||
SELECT table_name,definer,security_type FROM information_schema.views
|
||||
WHERE table_name LIKE 't1_%';
|
||||
#
|
||||
# Check modification of TABLE_SCHEMA
|
||||
SELECT table_schema,table_name FROM information_schema.views
|
||||
WHERE table_name LIKE 't1_%'
|
||||
ORDER BY table_schema,table_name;
|
||||
--error ER_FORBID_SCHEMA_CHANGE
|
||||
RENAME TABLE test.t1_view TO db_datadict.t1_view;
|
||||
# Workaround for missing move to another database
|
||||
DROP VIEW test.t1_view;
|
||||
CREATE VIEW db_datadict.t1_view AS SELECT * FROM test.t1_table;
|
||||
SELECT table_schema,table_name FROM information_schema.views
|
||||
WHERE table_name LIKE 't1_%'
|
||||
ORDER BY table_schema,table_name;
|
||||
#
|
||||
# Check modification of TABLE_NAME
|
||||
SELECT table_name FROM information_schema.views
|
||||
WHERE table_name LIKE 't1_%'
|
||||
ORDER BY table_name;
|
||||
RENAME TABLE db_datadict.t1_view TO db_datadict.t1_viewx;
|
||||
SELECT table_name FROM information_schema.views
|
||||
WHERE table_name LIKE 't1_%'
|
||||
ORDER BY table_name;
|
||||
#
|
||||
# Check impact of DROP VIEW
|
||||
SELECT table_name FROM information_schema.views
|
||||
WHERE table_name LIKE 't1_%'
|
||||
ORDER BY table_name;
|
||||
DROP VIEW db_datadict.t1_viewx;
|
||||
SELECT table_name FROM information_schema.views
|
||||
WHERE table_name LIKE 't1_%'
|
||||
ORDER BY table_name;
|
||||
CREATE VIEW db_datadict.t1_view AS SELECT * FROM test.t1_table;
|
||||
#
|
||||
# Check impact of DROP base TABLE of VIEW
|
||||
SELECT table_name FROM information_schema.views
|
||||
WHERE table_name LIKE 't1_%'
|
||||
ORDER BY table_name;
|
||||
DROP TABLE test.t1_table;
|
||||
SELECT table_name FROM information_schema.views
|
||||
WHERE table_name LIKE 't1_%'
|
||||
ORDER BY table_name;
|
||||
--replace_result $engine_type <engine_type>
|
||||
eval
|
||||
CREATE TABLE test.t1_table (f1 BIGINT, f2 CHAR(10))
|
||||
DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci COMMENT = 'Initial Comment'
|
||||
ENGINE = $engine_type;
|
||||
#
|
||||
# Check impact of DROP SCHEMA
|
||||
SELECT table_name FROM information_schema.views
|
||||
WHERE table_name LIKE 't1_%'
|
||||
ORDER BY table_name;
|
||||
DROP DATABASE db_datadict;
|
||||
SELECT table_name FROM information_schema.views
|
||||
WHERE table_name LIKE 't1_%'
|
||||
ORDER BY table_name;
|
||||
|
||||
# Cleanup
|
||||
DROP USER 'testuser1'@'localhost';
|
||||
DROP TABLE test.t1_table;
|
||||
|
||||
--echo ########################################################################
|
||||
--echo # Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and
|
||||
--echo # DDL on INFORMATION_SCHEMA table are not supported
|
||||
--echo ########################################################################
|
||||
# 3.2.1.3: Ensure that no user may execute an INSERT statement on any
|
||||
# INFORMATION_SCHEMA table.
|
||||
# 3.2.1.4: Ensure that no user may execute an UPDATE statement on any
|
||||
# INFORMATION_SCHEMA table.
|
||||
# 3.2.1.5: Ensure that no user may execute a DELETE statement on any
|
||||
# INFORMATION_SCHEMA table.
|
||||
# 3.2.1.8: Ensure that no user may create an index on an
|
||||
# INFORMATION_SCHEMA table.
|
||||
# 3.2.1.9: Ensure that no user may alter the definition of an
|
||||
# INFORMATION_SCHEMA table.
|
||||
# 3.2.1.10: Ensure that no user may drop an INFORMATION_SCHEMA table.
|
||||
# 3.2.1.11: Ensure that no user may move an INFORMATION_SCHEMA table to any
|
||||
# other database.
|
||||
# 3.2.1.12: Ensure that no user may directly add to, alter, or delete any data
|
||||
# in an INFORMATION_SCHEMA table.
|
||||
#
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS db_datadict;
|
||||
--enable_warnings
|
||||
CREATE DATABASE db_datadict;
|
||||
CREATE VIEW db_datadict.v1 AS SELECT 1;
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
INSERT INTO information_schema.views
|
||||
SELECT * FROM information_schema.views;
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
INSERT INTO information_schema.views(table_schema, table_name)
|
||||
VALUES ('db2', 'v2');
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
UPDATE information_schema.views SET table_schema = 'test'
|
||||
WHERE table_name = 't1';
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
DELETE FROM information_schema.views WHERE table_name = 't1';
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
TRUNCATE information_schema.views;
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
CREATE INDEX my_idx_on_views ON information_schema.views(table_schema);
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
ALTER TABLE information_schema.views DROP PRIMARY KEY;
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
ALTER TABLE information_schema.views ADD f1 INT;
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
DROP TABLE information_schema.views;
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
ALTER TABLE information_schema.views RENAME db_datadict.views;
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
ALTER TABLE information_schema.views RENAME information_schema.xviews;
|
||||
|
||||
# Cleanup
|
||||
DROP DATABASE db_datadict;
|
||||
|
||||
55
mysql-test/suite/funcs_1/datadict/tables.inc
Normal file
55
mysql-test/suite/funcs_1/datadict/tables.inc
Normal file
@@ -0,0 +1,55 @@
|
||||
# suite/funcs_1/datadict/tables.inc
|
||||
#
|
||||
# Auxiliary script to be sourced by
|
||||
# is_tables_<engine>.test
|
||||
#
|
||||
# The variable $engine_type has to be assigned before sourcing ths script.
|
||||
#
|
||||
# Author:
|
||||
# 2008-06-04 mleich Create this script based on older scripts and new code.
|
||||
#
|
||||
|
||||
# Just have some tables within different databases.
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS test1;
|
||||
DROP DATABASE IF EXISTS test2;
|
||||
--enable_warnings
|
||||
CREATE DATABASE test1;
|
||||
CREATE DATABASE test2;
|
||||
|
||||
--replace_result $engine_type <engine_to_be_used>
|
||||
eval CREATE TABLE test1.t1 (f1 VARCHAR(20)) ENGINE = $engine_type;
|
||||
--replace_result $engine_type <engine_to_be_used>
|
||||
eval CREATE TABLE test1.t2 (f1 VARCHAR(20)) ENGINE = $engine_type;
|
||||
--replace_result $engine_type <engine_to_be_used>
|
||||
eval CREATE TABLE test2.t1 (f1 VARCHAR(20)) ENGINE = $engine_type;
|
||||
|
||||
--source suite/funcs_1/datadict/tables2.inc
|
||||
SHOW TABLES FROM test1;
|
||||
SHOW TABLES FROM test2;
|
||||
|
||||
# Create a low privileged user.
|
||||
# Note: The database db_datadict is just a "home" for the low privileged user
|
||||
# and not in the focus of testing.
|
||||
--error 0,ER_CANNOT_USER
|
||||
DROP USER testuser1@localhost;
|
||||
CREATE USER testuser1@localhost;
|
||||
GRANT SELECT ON test1.* TO testuser1@localhost;
|
||||
|
||||
--echo # Establish connection testuser1 (user=testuser1)
|
||||
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
||||
connect (testuser1,localhost,testuser1,,test1);
|
||||
--source suite/funcs_1/datadict/tables2.inc
|
||||
SHOW TABLES FROM test1;
|
||||
# The lowprivileged user testuser1 will get here an error.
|
||||
--disable_abort_on_error
|
||||
SHOW TABLES FROM test2;
|
||||
--enable_abort_on_error
|
||||
|
||||
--echo # Switch to connection default and close connection testuser1
|
||||
connection default;
|
||||
disconnect testuser1;
|
||||
DROP USER testuser1@localhost;
|
||||
|
||||
DROP DATABASE test1;
|
||||
DROP DATABASE test2;
|
||||
@@ -2,8 +2,8 @@
|
||||
#
|
||||
# Auxiliary script to be sourced by
|
||||
# is_tables_mysql.test
|
||||
# is_tables_mysql_embedded.test
|
||||
# is_tables_is.test
|
||||
# is_tables_<engine>.test
|
||||
#
|
||||
# Author:
|
||||
# 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of
|
||||
@@ -12,28 +12,27 @@
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS db_datadict;
|
||||
DROP DATABASE IF EXISTS test1;
|
||||
--enable_warnings
|
||||
CREATE DATABASE db_datadict;
|
||||
CREATE DATABASE test1;
|
||||
|
||||
--source suite/funcs_1/datadict/tables2.inc
|
||||
|
||||
# Create a low privileged user.
|
||||
# Note: The database db_datadict is just a "home" for the low privileged user
|
||||
# Note: The database test1 is just a "home" for the low privileged user
|
||||
# and not in the focus of testing.
|
||||
--error 0,ER_CANNOT_USER
|
||||
DROP USER testuser1@localhost;
|
||||
CREATE USER testuser1@localhost;
|
||||
GRANT SELECT ON db_datadict.* TO testuser1@localhost;
|
||||
GRANT SELECT ON test1.* TO testuser1@localhost;
|
||||
|
||||
--echo # Establish connection testuser1 (user=testuser1)
|
||||
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
||||
connect (testuser1,localhost,testuser1,,db_datadict);
|
||||
connect (testuser1,localhost,testuser1,,test1);
|
||||
--source suite/funcs_1/datadict/tables2.inc
|
||||
|
||||
--echo # Switch to connection default and close connection testuser1
|
||||
connection default;
|
||||
disconnect testuser1;
|
||||
DROP USER testuser1@localhost;
|
||||
DROP DATABASE db_datadict;
|
||||
|
||||
DROP DATABASE test1;
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
let $innodb_pattern = 'InnoDB free';
|
||||
let $ndb_pattern = 'number_of_replicas';
|
||||
--vertical_results
|
||||
# We do not unify the engine name here, because the rowformat is
|
||||
# specific to the engine.
|
||||
--replace_column 8 "#TBLR#" 9 "#ARL#" 10 "#DL#" 11 "#MDL#" 12 "#IL#" 13 "#DF#" 15 "#CRT#" 16 "#UT#" 17 "#CT#" 20 "#CO#" 21 "#TC#"
|
||||
eval
|
||||
SELECT *,
|
||||
@@ -44,4 +46,3 @@ FROM information_schema.tables
|
||||
$my_where
|
||||
ORDER BY table_schema,table_name;
|
||||
--horizontal_results
|
||||
|
||||
|
||||
13
mysql-test/suite/funcs_1/include/bug28309_skip.inc
Normal file
13
mysql-test/suite/funcs_1/include/bug28309_skip.inc
Normal file
@@ -0,0 +1,13 @@
|
||||
# Skip tests which suffer from
|
||||
# Bug#28309 First insert violates unique constraint
|
||||
# - was "memory" table empty?
|
||||
# if the folowing conditions are fulfilled:
|
||||
# - MySQL Version is 5.0 (Bug is fixed in 5.1 and up)
|
||||
# - use of embedded server
|
||||
# - run on a case insensitive filesystem
|
||||
#
|
||||
let $value= query_get_value(SHOW VARIABLES LIKE 'lower_case_file_system', Value, 1);
|
||||
if (`SELECT '$value' = 'ON' AND VERSION() LIKE '5.0%embedded%'`)
|
||||
{
|
||||
skip # Test requires backport of fix for Bug#28309 First insert violates unique constraint - was "memory" table empty ?;
|
||||
}
|
||||
@@ -7,7 +7,7 @@ create table tb1 (
|
||||
f1 char(0),
|
||||
f2 char(0) binary,
|
||||
f3 char(0) ascii,
|
||||
f4 tinytext unicode,
|
||||
f4 tinytext,
|
||||
f5 text,
|
||||
f6 mediumtext,
|
||||
f7 longtext,
|
||||
|
||||
@@ -10,7 +10,7 @@ f120 char ascii not null DEFAULT b'101',
|
||||
f121 tinytext,
|
||||
f122 text,
|
||||
f123 mediumtext,
|
||||
f124 longtext unicode,
|
||||
f124 longtext,
|
||||
f125 tinyblob,
|
||||
f126 blob,
|
||||
f127 mediumblob,
|
||||
|
||||
@@ -55,13 +55,13 @@ f223 year(3),
|
||||
f224 year(4),
|
||||
f225 enum("1enum","2enum"),
|
||||
f226 set("1set","2set"),
|
||||
f235 char(0) unicode,
|
||||
f235 char(0),
|
||||
f236 char(90),
|
||||
f237 char(255) ascii,
|
||||
f238 varchar(0),
|
||||
f239 varchar(20000) binary,
|
||||
f240 varchar(2000) unicode,
|
||||
f241 char(100) unicode
|
||||
f240 varchar(2000),
|
||||
f241 char(100)
|
||||
) engine = innodb;
|
||||
|
||||
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
|
||||
|
||||
@@ -55,12 +55,12 @@ f223 year(3),
|
||||
f224 year(4),
|
||||
f225 enum("1enum","2enum"),
|
||||
f226 set("1set","2set"),
|
||||
f236 char(95) unicode,
|
||||
f241 char(255) unicode,
|
||||
f236 char(95),
|
||||
f241 char(255),
|
||||
f237 char(130) binary,
|
||||
f238 varchar(25000) binary,
|
||||
f239 varbinary(0),
|
||||
f240 varchar(1200) unicode
|
||||
f240 varchar(1200)
|
||||
) engine = memory;
|
||||
|
||||
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
|
||||
|
||||
@@ -7,7 +7,7 @@ create table tb1 (
|
||||
f1 char,
|
||||
f2 char binary,
|
||||
f3 char ascii,
|
||||
f4 tinytext unicode,
|
||||
f4 tinytext,
|
||||
f5 text,
|
||||
f6 mediumtext,
|
||||
f7 longtext,
|
||||
|
||||
@@ -10,7 +10,7 @@ f120 char ascii not null DEFAULT b'101',
|
||||
f121 tinytext,
|
||||
f122 text,
|
||||
f123 mediumtext,
|
||||
f124 longtext unicode,
|
||||
f124 longtext,
|
||||
f125 tinyblob,
|
||||
f126 blob,
|
||||
f127 mediumblob,
|
||||
|
||||
@@ -63,13 +63,13 @@ f231 VARBINARY(192),
|
||||
f232 VARBINARY(27),
|
||||
f233 VARBINARY(64),
|
||||
f234 VARBINARY(192),
|
||||
f235 char(255) unicode,
|
||||
f235 char(255),
|
||||
f236 char(60) ascii,
|
||||
f237 char(255) binary,
|
||||
f238 varchar(0) binary,
|
||||
f239 varbinary(1000),
|
||||
f240 varchar(120) unicode,
|
||||
f241 char(100) unicode,
|
||||
f240 varchar(120),
|
||||
f241 char(100),
|
||||
f242 bit(30)
|
||||
) engine = myisam;
|
||||
|
||||
|
||||
@@ -3635,13 +3635,9 @@ SELECT count(*) into cnt from t2;
|
||||
set @count = cnt;
|
||||
SELECT @count;
|
||||
END//
|
||||
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 ';
|
||||
set @count = cnt;
|
||||
SELECT @count;
|
||||
END' at line 2
|
||||
ERROR 42S22: Unknown column 'cnt' in 'field list'
|
||||
CALL sp1( 10 );
|
||||
ERROR 42000: PROCEDURE db_storedproc.sp1 does not exist
|
||||
DROP PROCEDURE IF EXISTS sp1;
|
||||
DROP PROCEDURE sp1;
|
||||
CREATE PROCEDURE sp1( cnt int(20) )
|
||||
END
|
||||
SELECT count(*) into cnt from t2;
|
||||
|
||||
@@ -1,141 +1,73 @@
|
||||
USE test;
|
||||
drop table if exists tb3 ;
|
||||
create table tb3 (
|
||||
f118 char not null DEFAULT 'a',
|
||||
f119 char binary not null DEFAULT b'101',
|
||||
f120 char ascii not null DEFAULT b'101',
|
||||
f121 tinytext,
|
||||
f122 text,
|
||||
f123 mediumtext,
|
||||
f124 longtext unicode,
|
||||
f125 tinyblob,
|
||||
f126 blob,
|
||||
f127 mediumblob,
|
||||
f128 longblob,
|
||||
f129 binary not null DEFAULT b'101',
|
||||
f130 tinyint not null DEFAULT 99,
|
||||
f131 tinyint unsigned not null DEFAULT 99,
|
||||
f132 tinyint zerofill not null DEFAULT 99,
|
||||
f133 tinyint unsigned zerofill not null DEFAULT 99,
|
||||
f134 smallint not null DEFAULT 999,
|
||||
f135 smallint unsigned not null DEFAULT 999,
|
||||
f136 smallint zerofill not null DEFAULT 999,
|
||||
f137 smallint unsigned zerofill not null DEFAULT 999,
|
||||
f138 mediumint not null DEFAULT 9999,
|
||||
f139 mediumint unsigned not null DEFAULT 9999,
|
||||
f140 mediumint zerofill not null DEFAULT 9999,
|
||||
f141 mediumint unsigned zerofill not null DEFAULT 9999,
|
||||
f142 int not null DEFAULT 99999,
|
||||
f143 int unsigned not null DEFAULT 99999,
|
||||
f144 int zerofill not null DEFAULT 99999,
|
||||
f145 int unsigned zerofill not null DEFAULT 99999,
|
||||
f146 bigint not null DEFAULT 999999,
|
||||
f147 bigint unsigned not null DEFAULT 999999,
|
||||
f148 bigint zerofill not null DEFAULT 999999,
|
||||
f149 bigint unsigned zerofill not null DEFAULT 999999,
|
||||
f150 decimal not null DEFAULT 999.999,
|
||||
f151 decimal unsigned not null DEFAULT 999.17,
|
||||
f152 decimal zerofill not null DEFAULT 999.999,
|
||||
f153 decimal unsigned zerofill,
|
||||
f154 decimal (0),
|
||||
f155 decimal (64),
|
||||
f156 decimal (0) unsigned,
|
||||
f157 decimal (64) unsigned,
|
||||
f158 decimal (0) zerofill,
|
||||
f159 decimal (64) zerofill,
|
||||
f160 decimal (0) unsigned zerofill,
|
||||
f161 decimal (64) unsigned zerofill,
|
||||
f162 decimal (0,0),
|
||||
f163 decimal (63,30),
|
||||
f164 decimal (0,0) unsigned,
|
||||
f165 decimal (63,30) unsigned,
|
||||
f166 decimal (0,0) zerofill,
|
||||
f167 decimal (63,30) zerofill,
|
||||
f168 decimal (0,0) unsigned zerofill,
|
||||
f169 decimal (63,30) unsigned zerofill,
|
||||
f170 numeric,
|
||||
f171 numeric unsigned,
|
||||
f172 numeric zerofill,
|
||||
f173 numeric unsigned zerofill,
|
||||
f174 numeric (0),
|
||||
f175 numeric (64)
|
||||
) engine = innodb;
|
||||
Warnings:
|
||||
Note 1265 Data truncated for column 'f150' at row 1
|
||||
Note 1265 Data truncated for column 'f151' at row 1
|
||||
Note 1265 Data truncated for column 'f152' at row 1
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/innodb_tb3.txt'
|
||||
into table tb3;
|
||||
|
||||
Testcase x.x.x.1:
|
||||
-----------------
|
||||
DROP TABLE IF EXISTS t0, t1, t2;
|
||||
CREATE TABLE t0 (col1 char(50)) ENGINE=innodb;
|
||||
CREATE TABLE t1 (id INT NOT NULL, col1 char(50),
|
||||
PRIMARY KEY (id)) ENGINE=innodb;
|
||||
CREATE TABLE t0 (col1 CHAR(50))
|
||||
ENGINE = <engine_to_be_tested>;
|
||||
CREATE TABLE t1 (id INT NOT NULL, col1 CHAR(50), PRIMARY KEY (id))
|
||||
ENGINE = <engine_to_be_tested>;
|
||||
CREATE TABLE t2 (id INT PRIMARY KEY, f_id INT,
|
||||
INDEX par_ind (f_id), col1 char(50),
|
||||
FOREIGN KEY (f_id) REFERENCES t1(id)
|
||||
ON DELETE SET NULL) ENGINE=innodb;
|
||||
insert into t1 values (1,'Department A');
|
||||
insert into t1 values (2,'Department B');
|
||||
insert into t1 values (3,'Department C');
|
||||
insert into t2 values (1,2,'Emp 1');
|
||||
insert into t2 values (2,2,'Emp 2');
|
||||
insert into t2 values (3,2,'Emp 3');
|
||||
create trigger trig after insert on t0 for each row
|
||||
delete from t1 where col1=new.col1;
|
||||
select * from t2;
|
||||
INDEX par_ind (f_id), col1 CHAR(50),
|
||||
FOREIGN KEY (f_id) REFERENCES t1(id) ON DELETE SET NULL)
|
||||
ENGINE = <engine_to_be_tested>;
|
||||
INSERT INTO t1 VALUES (1,'Department A');
|
||||
INSERT INTO t1 VALUES (2,'Department B');
|
||||
INSERT INTO t1 VALUES (3,'Department C');
|
||||
INSERT INTO t2 VALUES (1,2,'Emp 1');
|
||||
INSERT INTO t2 VALUES (2,2,'Emp 2');
|
||||
INSERT INTO t2 VALUES (3,2,'Emp 3');
|
||||
CREATE TRIGGER trig AFTER INSERT ON t0 FOR EACH ROW
|
||||
DELETE FROM t1 WHERE col1 = new.col1;
|
||||
SELECT * FROM t2;
|
||||
id f_id col1
|
||||
1 2 Emp 1
|
||||
2 2 Emp 2
|
||||
3 2 Emp 3
|
||||
lock tables t0 write, t1 write;
|
||||
insert into t0 values ('Department B');
|
||||
unlock tables;
|
||||
select * from t2;
|
||||
LOCK TABLES t0 WRITE, t1 WRITE;
|
||||
INSERT INTO t0 VALUES ('Department B');
|
||||
UNLOCK TABLES;
|
||||
SELECT * FROM t2;
|
||||
id f_id col1
|
||||
1 NULL Emp 1
|
||||
2 NULL Emp 2
|
||||
3 NULL Emp 3
|
||||
drop trigger trig;
|
||||
drop table t2, t1;
|
||||
DROP TRIGGER trig;
|
||||
DROP TABLE t2, t1;
|
||||
|
||||
Testcase x.x.x.2:
|
||||
-----------------
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
CREATE TABLE t1 (id INT NOT NULL, col1 char(50),
|
||||
PRIMARY KEY (id)) ENGINE=innodb;
|
||||
CREATE TABLE t1 (id INT NOT NULL, col1 CHAR(50), PRIMARY KEY (id))
|
||||
ENGINE = <engine_to_be_tested>;
|
||||
CREATE TABLE t2 (id INT PRIMARY KEY, f_id INT,
|
||||
INDEX par_ind (f_id), col1 char(50),
|
||||
FOREIGN KEY (f_id) REFERENCES t1(id)
|
||||
ON UPDATE CASCADE) ENGINE=innodb;
|
||||
insert into t1 values (1,'Department A');
|
||||
insert into t1 values (2,'Department B');
|
||||
insert into t1 values (3,'Department C');
|
||||
insert into t2 values (1,2,'Emp 1');
|
||||
insert into t2 values (2,3,'Emp 2');
|
||||
insert into t2 values (3,4,'Emp 3');
|
||||
INDEX par_ind (f_id), col1 CHAR(50),
|
||||
FOREIGN KEY (f_id) REFERENCES t1(id) ON UPDATE CASCADE)
|
||||
ENGINE = <engine_to_be_tested>;
|
||||
INSERT INTO t1 VALUES (1,'Department A');
|
||||
INSERT INTO t1 VALUES (2,'Department B');
|
||||
INSERT INTO t1 VALUES (3,'Department C');
|
||||
INSERT INTO t2 VALUES (1,2,'Emp 1');
|
||||
INSERT INTO t2 VALUES (2,3,'Emp 2');
|
||||
insert into t2 VALUES (3,4,'Emp 3');
|
||||
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f_id`) REFERENCES `t1` (`id`) ON UPDATE CASCADE)
|
||||
create trigger tr_t2 before insert on t2 for each row
|
||||
insert into t1 values(new.f_id, concat('New Department ', new.f_id));
|
||||
lock tables t1 write, t2 write;
|
||||
insert into t2 values (3,4,'Emp 3');
|
||||
unlock tables;
|
||||
select * from t1;
|
||||
CREATE TRIGGER tr_t2 BEFORE INSERT ON t2 FOR EACH ROW
|
||||
INSERT INTO t1 VALUES(new.f_id, CONCAT('New Department ', new.f_id));
|
||||
LOCK TABLES t1 WRITE, t2 WRITE;
|
||||
INSERT INTO t2 VALUES (3,4,'Emp 3');
|
||||
UNLOCK TABLES;
|
||||
SELECT * FROM t1;
|
||||
id col1
|
||||
1 Department A
|
||||
2 Department B
|
||||
3 Department C
|
||||
4 New Department 4
|
||||
select * from t2;
|
||||
SELECT * FROM t2;
|
||||
id f_id col1
|
||||
1 2 Emp 1
|
||||
2 3 Emp 2
|
||||
3 4 Emp 3
|
||||
drop trigger tr_t2;
|
||||
drop table t2, t1, t0;
|
||||
DROP TRIGGER tr_t2;
|
||||
DROP TABLE t2, t1, t0;
|
||||
|
||||
Foreign Key tests disabled (bug 11472 - stored in trig_frkey2.test)
|
||||
-------------------------------------------------------------------
|
||||
DROP TABLE test.tb3;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user