diff options
author | Chad MILLER <chad@mysql.com> | 2008-07-14 16:16:37 -0400 |
---|---|---|
committer | Chad MILLER <chad@mysql.com> | 2008-07-14 16:16:37 -0400 |
commit | a4e7283a9254c09057c92ec20fc145c52bea1d51 (patch) | |
tree | 6009880c2c51b3422d95a760220fb7a20ebdb3e0 | |
parent | c425bf421da9ffa55d3d568f70508fa12dd07aa0 (diff) | |
parent | 55ab1ef6951428e0be31956e152537dec670e7df (diff) | |
download | mariadb-git-a4e7283a9254c09057c92ec20fc145c52bea1d51.tar.gz |
Merge from 5.0 trunk.
415 files changed, 25610 insertions, 17917 deletions
diff --git a/.bzr-mysql/default.conf b/.bzr-mysql/default.conf new file mode 100644 index 00000000000..f79c1cd6319 --- /dev/null +++ b/.bzr-mysql/default.conf @@ -0,0 +1,4 @@ +[MYSQL] +post_commit_to = "commits@lists.mysql.com" +post_push_to = "commits@lists.mysql.com" +tree_name = "mysql-5.0" diff --git a/BUILD/Makefile.am b/BUILD/Makefile.am index d06106d4431..ee0f07864e8 100644 --- a/BUILD/Makefile.am +++ b/BUILD/Makefile.am @@ -27,6 +27,8 @@ EXTRA_DIST = FINISH.sh \ compile-alpha-cxx \ compile-alpha-debug \ compile-amd64-debug-max \ + compile-amd64-gcov \ + compile-amd64-gprof \ compile-amd64-max \ compile-amd64-max-sci \ compile-darwin-mwcc \ @@ -54,6 +56,8 @@ EXTRA_DIST = FINISH.sh \ compile-pentium-valgrind-max \ compile-pentium64-debug \ compile-pentium64-debug-max \ + compile-pentium64-gcov \ + compile-pentium64-gprof \ compile-pentium64-max-sci \ compile-pentium64-valgrind-max \ compile-ppc \ @@ -61,6 +65,10 @@ EXTRA_DIST = FINISH.sh \ compile-ppc-debug-max \ compile-ppc-debug-max-no-ndb \ compile-ppc-max \ + compile-solaris-amd64 \ + compile-solaris-amd64-debug \ + compile-solaris-amd64-forte \ + compile-solaris-amd64-forte-debug \ compile-solaris-sparc \ compile-solaris-sparc-debug \ compile-solaris-sparc-forte \ diff --git a/CMakeLists.txt b/CMakeLists.txt index 55489da784c..37956204faa 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,6 +78,10 @@ SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DDBUG_OFF SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DDBUG_OFF") SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DDBUG_OFF") +#TODO: update the code and remove the disabled warnings +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805") + IF(CMAKE_GENERATOR MATCHES "Visual Studio 8") SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /wd4996") SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /wd4996") diff --git a/Makefile.am b/Makefile.am index eb837b1fdd4..774239eaad2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -154,7 +154,7 @@ test-bt: -cd mysql-test ; MTR_BUILD_THREAD=auto \ @PERL@ ./mysql-test-run.pl --force --comment=ps --ps-protocol -cd mysql-test ; MTR_BUILD_THREAD=auto \ - @PERL@ ./mysql-test-run.pl --force --comment=funcs1_ps --ps-protocol --suite=funcs_1 + @PERL@ ./mysql-test-run.pl --force --comment=funcs1_ps --ps-protocol --reorder --suite=funcs_1 -cd mysql-test ; MTR_BUILD_THREAD=auto \ @PERL@ ./mysql-test-run.pl --force --comment=funcs2 --suite=funcs_2 -if [ -d mysql-test/suite/nist ] ; then \ @@ -179,7 +179,7 @@ test-force-full-pl: test-force-full test-ext-funcs: cd mysql-test ; \ - @PERL@ ./mysql-test-run.pl --force --suite=funcs_1 ; \ + @PERL@ ./mysql-test-run.pl --force --reorder --suite=funcs_1 ; \ @PERL@ ./mysql-test-run.pl --force --suite=funcs_2 test-ext: test-ext-funcs diff --git a/client/mysql.cc b/client/mysql.cc index 483b1829ec0..c8d5522628d 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1216,21 +1216,35 @@ sig_handler mysql_sigint(int sig) char kill_buffer[40]; MYSQL *kill_mysql= NULL; - signal(SIGINT, mysql_sigint); - /* terminate if no query being executed, or we already tried interrupting */ if (!executing_query || interrupted_query++) - mysql_end(sig); + goto err; kill_mysql= mysql_init(kill_mysql); if (!mysql_real_connect(kill_mysql,current_host, current_user, opt_password, "", opt_mysql_port, opt_mysql_unix_port,0)) - mysql_end(sig); + goto err; /* kill_buffer is always big enough because max length of %lu is 15 */ sprintf(kill_buffer, "KILL /*!50000 QUERY */ %lu", mysql_thread_id(&mysql)); mysql_real_query(kill_mysql, kill_buffer, strlen(kill_buffer)); mysql_close(kill_mysql); tee_fprintf(stdout, "Query aborted by Ctrl+C\n"); + + return; + +err: +#ifdef _WIN32 + /* + When SIGINT is raised on Windows, the OS creates a new thread to handle the + interrupt. Once that thread completes, the main thread continues running + only to find that it's resources have already been free'd when the sigint + handler called mysql_end(). + */ + mysql_thread_end(); + return; +#else + mysql_end(sig); +#endif } sig_handler mysql_end(int sig) @@ -1271,7 +1285,7 @@ sig_handler mysql_end(int sig) my_free(current_prompt,MYF(MY_ALLOW_ZERO_PTR)); mysql_server_end(); free_defaults(defaults_argv); - my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : 0); + my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR); exit(status.exit_status); } @@ -1765,7 +1779,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) @@ -2067,37 +2081,6 @@ static bool add_line(String &buffer,char *line,char *in_string, continue; } } - else if (!*ml_comment && !*in_string && - (end_of_line - pos) >= 10 && - !my_strnncoll(charset_info, (uchar*) pos, 10, - (const uchar*) "delimiter ", 10)) - { - // Flush previously accepted characters - if (out != line) - { - buffer.append(line, (uint32) (out - line)); - out= line; - } - - // Flush possible comments in the buffer - if (!buffer.is_empty()) - { - if (com_go(&buffer, 0) > 0) // < 0 is not fatal - DBUG_RETURN(1); - buffer.length(0); - } - - /* - Delimiter wants the get rest of the given line as argument to - allow one to change ';' to ';;' and back - */ - buffer.append(pos); - if (com_delimiter(&buffer, pos) > 0) - DBUG_RETURN(1); - - buffer.length(0); - break; - } else if (!*ml_comment && !*in_string && is_prefix(pos, delimiter)) { // Found a statement. Continue parsing after the delimiter @@ -2142,7 +2125,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) diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 02829cd2178..ded9d465d3a 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -40,6 +40,8 @@ static DYNAMIC_STRING ds_args; static char *opt_password= 0; static my_bool tty_password= 0; +static char opt_tmpdir[FN_REFLEN]; + #ifndef DBUG_OFF static char *default_dbug_option= (char*) "d:t:O,/tmp/mysql_upgrade.trace"; #endif @@ -105,6 +107,8 @@ static struct my_option my_long_options[]= #endif {"socket", 'S', "Socket file to use for connection.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"tmpdir", 't', "Directory for temporary files", + 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"user", 'u', "User for login if not current user.", (gptr*) &opt_user, (gptr*) &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #include <sslopt-longopts.h> @@ -229,6 +233,11 @@ get_one_option(int optid, const struct my_option *opt, } break; + case 't': + strnmov(opt_tmpdir, argument, sizeof(opt_tmpdir)); + add_option= FALSE; + break; + case 'b': /* --basedir */ case 'v': /* --verbose */ case 'd': /* --datadir */ @@ -449,7 +458,7 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res, char query_file_path[FN_REFLEN]; DBUG_ENTER("run_query"); DBUG_PRINT("enter", ("query: %s", query)); - if ((fd= create_temp_file(query_file_path, NULL, + if ((fd= create_temp_file(query_file_path, opt_tmpdir, "sql", O_CREAT | O_SHARE | O_RDWR, MYF(MY_WME))) < 0) die("Failed to create temporary file for defaults"); diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index b4086b59c01..f0a4c8d2abf 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -1474,7 +1474,7 @@ int main(int argc, char** argv) DBUG_ENTER("main"); DBUG_PROCESS(argv[0]); - init_time(); // for time functions + my_init_time(); // for time functions parse_args(&argc, (char***)&argv); defaults_argv=argv; diff --git a/client/mysqltest.c b/client/mysqltest.c index 05c9ced3848..9c7c4d62f6f 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -550,6 +550,17 @@ static int do_send_query(struct st_connection *cn, const char *q, int q_len, return 0; } +static void wait_query_thread_end(struct st_connection *con) +{ + if (!con->query_done) + { + pthread_mutex_lock(&con->mutex); + while (!con->query_done) + pthread_cond_wait(&con->cond, &con->mutex); + pthread_mutex_unlock(&con->mutex); + } +} + #else /*EMBEDDED_LIBRARY*/ #define do_send_query(cn,q,q_len,flags) mysql_send_query(&cn->mysql, q, q_len) @@ -1525,7 +1536,7 @@ int dyn_string_cmp(DYNAMIC_STRING* ds, const char *fname) DBUG_ENTER("dyn_string_cmp"); DBUG_PRINT("enter", ("fname: %s", fname)); - if ((fd= create_temp_file(temp_file_path, NULL, + if ((fd= create_temp_file(temp_file_path, TMPDIR, "tmp", O_CREAT | O_SHARE | O_RDWR, MYF(MY_WME))) < 0) die("Failed to create temporary file for ds"); @@ -4071,7 +4082,14 @@ void do_close_connection(struct st_command *command) con->mysql.net.vio = 0; } } -#endif +#else + /* + As query could be still executed in a separate theread + we need to check if the query's thread was finished and probably wait + (embedded-server specific) + */ + wait_query_thread_end(con); +#endif /*EMBEDDED_LIBRARY*/ if (con->stmt) mysql_stmt_close(con->stmt); con->stmt= 0; @@ -4361,6 +4379,9 @@ void do_connect(struct st_command *command) (int) (sizeof(connections)/sizeof(struct st_connection))); } +#ifdef EMBEDDED_LIBRARY + con_slot->query_done= 1; +#endif if (!mysql_init(&con_slot->mysql)) die("Failed on mysql_init()"); if (opt_compress || con_compress) @@ -5443,6 +5464,7 @@ void init_win_path_patterns() const char* paths[] = { "$MYSQL_TEST_DIR", "$MYSQL_TMP_DIR", "$MYSQLTEST_VARDIR", + "$MASTER_MYSOCK", "./test/" }; int num_paths= sizeof(paths)/sizeof(char*); int i; @@ -5848,16 +5870,11 @@ void run_query_normal(struct st_connection *cn, struct st_command *command, } #ifdef EMBEDDED_LIBRARY /* - Here we handle 'reap' command, so we need to check if the - query's thread was finished and probably wait + Here we handle 'reap' command, so we need to check if the + query's thread was finished and probably wait */ else if (flags & QUERY_REAP_FLAG) - { - pthread_mutex_lock(&cn->mutex); - while (!cn->query_done) - pthread_cond_wait(&cn->cond, &cn->mutex); - pthread_mutex_unlock(&cn->mutex); - } + wait_query_thread_end(cn); #endif /*EMBEDDED_LIBRARY*/ if (!(flags & QUERY_REAP_FLAG)) DBUG_VOID_RETURN; diff --git a/configure.in b/configure.in index 41ca923c4d6..8ac0ee407d8 100644 --- a/configure.in +++ b/configure.in @@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! # remember to also change ndb version below and update version.c in ndb -AM_INIT_AUTOMAKE(mysql, 5.0.60) +AM_INIT_AUTOMAKE(mysql, 5.0.68) AM_CONFIG_HEADER([include/config.h:config.h.in]) PROTOCOL_VERSION=10 @@ -23,7 +23,7 @@ NDB_SHARED_LIB_VERSION=$NDB_SHARED_LIB_MAJOR_VERSION:0:0 # ndb version NDB_VERSION_MAJOR=5 NDB_VERSION_MINOR=0 -NDB_VERSION_BUILD=60 +NDB_VERSION_BUILD=68 NDB_VERSION_STATUS="" # Set all version vars based on $VERSION. How do we do this more elegant ? @@ -1776,15 +1776,18 @@ AC_ARG_WITH(debug, if test "$with_debug" = "yes" then # Medium debug. + AC_DEFINE([DBUG_ON], [1], [Use libdbug]) CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC -DDBUG_ON -DSAFE_MUTEX $CFLAGS" CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX -DDBUG_ON -DSAFE_MUTEX $CXXFLAGS" elif test "$with_debug" = "full" then # Full debug. Very slow in some cases + AC_DEFINE([DBUG_ON], [1], [Use libdbug]) CFLAGS="$DEBUG_CFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC $CFLAGS" CXXFLAGS="$DEBUG_CXXFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC $CXXFLAGS" else # Optimized version. No debug + AC_DEFINE([DBUG_OFF], [1], [Don't use libdbug]) CFLAGS="$OPTIMIZE_CFLAGS -DDBUG_OFF $CFLAGS" CXXFLAGS="$OPTIMIZE_CXXFLAGS -DDBUG_OFF $CXXFLAGS" fi diff --git a/dbug/dbug.c b/dbug/dbug.c index c991daf3617..baf080f5e27 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -1,74 +1,77 @@ /****************************************************************************** - * * - * N O T I C E * - * * - * Copyright Abandoned, 1987, Fred Fish * - * * - * * - * This previously copyrighted work has been placed into the public * - * domain by the author and may be freely used for any purpose, * - * private or commercial. * - * * - * Because of the number of inquiries I was receiving about the use * - * of this product in commercially developed works I have decided to * - * simply make it public domain to further its unrestricted use. I * - * specifically would be most happy to see this material become a * - * part of the standard Unix distributions by AT&T and the Berkeley * - * Computer Science Research Group, and a standard part of the GNU * - * system from the Free Software Foundation. * - * * - * I would appreciate it, as a courtesy, if this notice is left in * - * all copies and derivative works. Thank you. * - * * - * The author makes no warranty of any kind with respect to this * + * * + * N O T I C E * + * * + * Copyright Abandoned, 1987, Fred Fish * + * * + * * + * This previously copyrighted work has been placed into the public * + * domain by the author and may be freely used for any purpose, * + * private or commercial. * + * * + * Because of the number of inquiries I was receiving about the use * + * of this product in commercially developed works I have decided to * + * simply make it public domain to further its unrestricted use. I * + * specifically would be most happy to see this material become a * + * part of the standard Unix distributions by AT&T and the Berkeley * + * Computer Science Research Group, and a standard part of the GNU * + * system from the Free Software Foundation. * + * * + * I would appreciate it, as a courtesy, if this notice is left in * + * all copies and derivative works. Thank you. * + * * + * The author makes no warranty of any kind with respect to this * * product and explicitly disclaims any implied warranties of mer- * - * chantability or fitness for any particular purpose. * - * * + * chantability or fitness for any particular purpose. * + * * ****************************************************************************** */ - /* * FILE * - * dbug.c runtime support routines for dbug package + * dbug.c runtime support routines for dbug package * * SCCS * - * @(#)dbug.c 1.25 7/25/89 + * @(#)dbug.c 1.25 7/25/89 * * DESCRIPTION * - * These are the runtime support routines for the dbug package. - * The dbug package has two main components; the user include - * file containing various macro definitions, and the runtime - * support routines which are called from the macro expansions. + * These are the runtime support routines for the dbug package. + * The dbug package has two main components; the user include + * file containing various macro definitions, and the runtime + * support routines which are called from the macro expansions. * - * Externally visible functions in the runtime support module - * use the naming convention pattern "_db_xx...xx_", thus - * they are unlikely to collide with user defined function names. + * Externally visible functions in the runtime support module + * use the naming convention pattern "_db_xx...xx_", thus + * they are unlikely to collide with user defined function names. * * AUTHOR(S) * - * Fred Fish (base code) - * Enhanced Software Technologies, Tempe, AZ - * asuvax!mcdphx!estinc!fnf + * Fred Fish (base code) + * Enhanced Software Technologies, Tempe, AZ + * asuvax!mcdphx!estinc!fnf * - * Binayak Banerjee (profiling enhancements) - * seismo!bpa!sjuvax!bbanerje + * Binayak Banerjee (profiling enhancements) + * seismo!bpa!sjuvax!bbanerje * - * Michael Widenius: - * DBUG_DUMP - To dump a block of memory. + * Michael Widenius: + * DBUG_DUMP - To dump a block of memory. * PUSH_FLAG "O" - To be used insted of "o" if we * want flushing after each write - * PUSH_FLAG "A" - as 'O', but we will append to the out file instead - * of creating a new one. - * Check of malloc on entry/exit (option "S") + * PUSH_FLAG "A" - as 'O', but we will append to the out file instead + * of creating a new one. + * Check of malloc on entry/exit (option "S") + * + * DBUG_EXECUTE_IF + * incremental mode (-#+t:-d,info ...) + * DBUG_SET, _db_explain_ + * thread-local settings + * */ -#ifdef DBUG_OFF -#undef DBUG_OFF -#endif + #include <my_global.h> #include <m_string.h> #include <errno.h> @@ -76,51 +79,44 @@ #include <process.h> #endif -#ifdef _DBUG_CONDITION_ -#define _DBUG_START_CONDITION_ "d:t" -#else -#define _DBUG_START_CONDITION_ "" -#endif -/* - * Manifest constants that should not require any changes. - */ +#ifndef DBUG_OFF -#define EOS '\000' /* End Of String marker */ /* - * Manifest constants which may be "tuned" if desired. + * Manifest constants which may be "tuned" if desired. */ -#define PRINTBUF 1024 /* Print buffer size */ -#define INDENT 2 /* Indentation per trace level */ -#define MAXDEPTH 200 /* Maximum trace depth default */ +#define PRINTBUF 1024 /* Print buffer size */ +#define INDENT 2 /* Indentation per trace level */ +#define MAXDEPTH 200 /* Maximum trace depth default */ /* - * The following flags are used to determine which - * capabilities the user has enabled with the state - * push macro. + * The following flags are used to determine which + * capabilities the user has enabled with the settings + * push macro. */ -#define TRACE_ON 000001 /* Trace enabled */ -#define DEBUG_ON 000002 /* Debug enabled */ -#define FILE_ON 000004 /* File name print enabled */ -#define LINE_ON 000010 /* Line number print enabled */ -#define DEPTH_ON 000020 /* Function nest level print enabled */ -#define PROCESS_ON 000040 /* Process name print enabled */ -#define NUMBER_ON 000100 /* Number each line of output */ -#define PROFILE_ON 000200 /* Print out profiling code */ -#define PID_ON 000400 /* Identify each line with process id */ -#define SANITY_CHECK_ON 001000 /* Check safemalloc on DBUG_ENTER */ -#define FLUSH_ON_WRITE 002000 /* Flush on every write */ - -#define TRACING (stack -> flags & TRACE_ON) -#define DEBUGGING (stack -> flags & DEBUG_ON) -#define PROFILING (stack -> flags & PROFILE_ON) -#define STREQ(a,b) (strcmp(a,b) == 0) +#define TRACE_ON 000001 /* Trace enabled */ +#define DEBUG_ON 000002 /* Debug enabled */ +#define FILE_ON 000004 /* File name print enabled */ +#define LINE_ON 000010 /* Line number print enabled */ +#define DEPTH_ON 000020 /* Function nest level print enabled */ +#define PROCESS_ON 000040 /* Process name print enabled */ +#define NUMBER_ON 000100 /* Number each line of output */ +#define PROFILE_ON 000200 /* Print out profiling code */ +#define PID_ON 000400 /* Identify each line with process id */ +#define TIMESTAMP_ON 001000 /* timestamp every line of output */ +#define SANITY_CHECK_ON 002000 /* Check safemalloc on DBUG_ENTER */ +#define FLUSH_ON_WRITE 004000 /* Flush on every write */ +#define OPEN_APPEND 010000 /* Open for append */ + +#define TRACING (cs->stack->flags & TRACE_ON) +#define DEBUGGING (cs->stack->flags & DEBUG_ON) +#define PROFILING (cs->stack->flags & PROFILE_ON) /* - * Typedefs to make things more obvious. + * Typedefs to make things more obvious. */ #ifndef __WIN__ @@ -130,13 +126,13 @@ typedef int BOOLEAN; #endif /* - * Make it easy to change storage classes if necessary. + * Make it easy to change storage classes if necessary. */ -#define IMPORT extern /* Names defined externally */ -#define EXPORT /* Allocated here, available globally */ -#define AUTO auto /* Names to be allocated on stack */ -#define REGISTER register /* Names to be placed in registers */ +#define IMPORT extern /* Names defined externally */ +#define EXPORT /* Allocated here, available globally */ +#define AUTO auto /* Names to be allocated on stack */ +#define REGISTER register /* Names to be placed in registers */ /* * The default file for profiling. Could also add another flag @@ -151,153 +147,150 @@ typedef int BOOLEAN; * */ -#define PROF_FILE "dbugmon.out" -#define PROF_EFMT "E\t%ld\t%s\n" -#define PROF_SFMT "S\t%lx\t%lx\t%s\n" -#define PROF_XFMT "X\t%ld\t%s\n" +#define PROF_FILE "dbugmon.out" +#define PROF_EFMT "E\t%ld\t%s\n" +#define PROF_SFMT "S\t%lx\t%lx\t%s\n" +#define PROF_XFMT "X\t%ld\t%s\n" -#ifdef M_I386 /* predefined by xenix 386 compiler */ +#ifdef M_I386 /* predefined by xenix 386 compiler */ #define AUTOS_REVERSE 1 #endif /* - * Variables which are available externally but should only - * be accessed via the macro package facilities. - */ - -EXPORT FILE *_db_fp_ = (FILE *) 0; /* Output stream, default stderr */ -EXPORT char *_db_process_ = (char*) "dbug"; /* Pointer to process name; argv[0] */ -EXPORT FILE *_db_pfp_ = (FILE *)0; /* Profile stream, 'dbugmon.out' */ -EXPORT BOOLEAN _db_on_ = FALSE; /* TRUE if debugging currently on */ -EXPORT BOOLEAN _db_pon_ = FALSE; /* TRUE if profile currently on */ -EXPORT BOOLEAN _no_db_ = FALSE; /* TRUE if no debugging at all */ - -/* - * Externally supplied functions. + * Externally supplied functions. */ #ifndef HAVE_PERROR -static void perror (); /* Fake system/library error print routine */ +static void perror(); /* Fake system/library error print routine */ #endif -IMPORT int _sanity(const char *file,uint line); +IMPORT int _sanity(const char *file,uint line); /* safemalloc sanity checker */ /* - * The user may specify a list of functions to trace or - * debug. These lists are kept in a linear linked list, - * a very simple implementation. + * The user may specify a list of functions to trace or + * debug. These lists are kept in a linear linked list, + * a very simple implementation. */ struct link { - char *str; /* Pointer to link's contents */ struct link *next_link; /* Pointer to the next link */ + char str[1]; /* Pointer to link's contents */ }; /* - * Debugging states can be pushed or popped off of a - * stack which is implemented as a linked list. Note - * that the head of the list is the current state and the - * stack is pushed by adding a new state to the head of the - * list or popped by removing the first link. + * Debugging settings can be pushed or popped off of a + * stack which is implemented as a linked list. Note + * that the head of the list is the current settings and the + * stack is pushed by adding a new settings to the head of the + * list or popped by removing the first link. + * + * Note: if out_file is NULL, the other fields are not initialized at all! */ -struct state { - int flags; /* Current state flags */ - int maxdepth; /* Current maximum trace depth */ - uint delay; /* Delay after each output line */ - int sub_level; /* Sub this from code_state->level */ - FILE *out_file; /* Current output stream */ - FILE *prof_file; /* Current profiling stream */ - char name[FN_REFLEN]; /* Name of output file */ - struct link *functions; /* List of functions */ - struct link *p_functions; /* List of profiled functions */ - struct link *keywords; /* List of debug keywords */ - struct link *processes; /* List of process names */ - struct state *next_state; /* Next state in the list */ +struct settings { + int flags; /* Current settings flags */ + int maxdepth; /* Current maximum trace depth */ + uint delay; /* Delay after each output line */ + int sub_level; /* Sub this from code_state->level */ + FILE *out_file; /* Current output stream */ + FILE *prof_file; /* Current profiling stream */ + char name[FN_REFLEN]; /* Name of output file */ + struct link *functions; /* List of functions */ + struct link *p_functions; /* List of profiled functions */ + struct link *keywords; /* List of debug keywords */ + struct link *processes; /* List of process names */ + struct settings *next; /* Next settings in the list */ }; +#define is_shared(S, V) ((S)->next && (S)->next->V == (S)->V) /* - * Local variables not seen by user. + * Local variables not seen by user. */ -static my_bool init_done = FALSE; /* Set to TRUE when initialization done */ -static struct state *stack=0; +static BOOLEAN init_done= FALSE; /* Set to TRUE when initialization done */ +static struct settings init_settings; +static const char *db_process= 0;/* Pointer to process name; argv[0] */ -typedef struct st_code_state { - const char *func; /* Name of current user function */ - const char *file; /* Name of current user file */ - char **framep; /* Pointer to current frame */ - const char *jmpfunc; /* Remember current function for setjmp */ - const char *jmpfile; /* Remember current file for setjmp */ - int lineno; /* Current debugger output line number */ - int level; /* Current function nesting level */ - int disable_output; /* Set to it if output is disabled */ - int jmplevel; /* Remember nesting level at setjmp () */ +typedef struct _db_code_state_ { + const char *process; /* Pointer to process name; usually argv[0] */ + const char *func; /* Name of current user function */ + const char *file; /* Name of current user file */ + char **framep; /* Pointer to current frame */ + struct settings *stack; /* debugging settings */ + const char *jmpfunc; /* Remember current function for setjmp */ + const char *jmpfile; /* Remember current file for setjmp */ + int lineno; /* Current debugger output line number */ + int level; /* Current function nesting level */ + int jmplevel; /* Remember nesting level at setjmp() */ /* - * The following variables are used to hold the state information - * between the call to _db_pargs_() and _db_doprnt_(), during - * expansion of the DBUG_PRINT macro. This is the only macro - * that currently uses these variables. + * The following variables are used to hold the state information + * between the call to _db_pargs_() and _db_doprnt_(), during + * expansion of the DBUG_PRINT macro. This is the only macro + * that currently uses these variables. * - * These variables are currently used only by _db_pargs_() and - * _db_doprnt_(). + * These variables are currently used only by _db_pargs_() and + * _db_doprnt_(). */ - uint u_line; /* User source code line number */ - int locked; /* If locked with _db_lock_file */ - const char *u_keyword; /* Keyword for current macro */ + uint u_line; /* User source code line number */ + int locked; /* If locked with _db_lock_file_ */ + const char *u_keyword; /* Keyword for current macro */ } CODE_STATE; - /* Parse a debug command string */ -static struct link *ListParse(char *ctlp); - /* Make a fresh copy of a string */ -static char *StrDup(const char *str); - /* Open debug output stream */ -static void DBUGOpenFile(const char *name, int append); -#ifndef THREAD - /* Open profile output stream */ -static FILE *OpenProfile(const char *name); - /* Profile if asked for it */ -static BOOLEAN DoProfile(void); -#endif - /* Return current user time (ms) */ -#ifndef THREAD -static unsigned long Clock (void); -#endif - /* Close debug output stream */ -static void CloseFile(FILE *fp); - /* Push current debug state */ -static void PushState(void); +/* + The test below is so we could call functions with DBUG_ENTER before + my_thread_init(). +*/ +#define get_code_state_or_return if (!cs && !((cs=code_state()))) return + + /* Handling lists */ +static struct link *ListAdd(struct link *, const char *, const char *); +static struct link *ListDel(struct link *, const char *, const char *); +static struct link *ListCopy(struct link *); +static void FreeList(struct link *linkp); + + /* OpenClose debug output stream */ +static void DBUGOpenFile(CODE_STATE *,const char *, const char *, int); +static void DBUGCloseFile(CODE_STATE *cs, FILE *fp); + /* Push current debug settings */ +static void PushState(CODE_STATE *cs); /* Free memory associated with debug state. */ -static void FreeState (struct state *state); - /* Test for tracing enabled */ -static BOOLEAN DoTrace(CODE_STATE *state); - /* Test to see if file is writable */ +static void FreeState (CODE_STATE *cs, struct settings *state, int free_state); + /* Test for tracing enabled */ +static BOOLEAN DoTrace(CODE_STATE *cs); + + /* Test to see if file is writable */ #if !(!defined(HAVE_ACCESS) || defined(MSDOS)) -static BOOLEAN Writable(char *pathname); - /* Change file owner and group */ -static void ChangeOwner(char *pathname); - /* Allocate memory for runtime support */ +static BOOLEAN Writable(const char *pathname); + /* Change file owner and group */ +static void ChangeOwner(CODE_STATE *cs, char *pathname); + /* Allocate memory for runtime support */ #endif + +static void DoPrefix(CODE_STATE *cs, uint line); + static char *DbugMalloc(size_t size); - /* Remove leading pathname components */ -static char *BaseName(const char *pathname); -static void DoPrefix(uint line); -static void FreeList(struct link *linkp); -static void Indent(int indent); +static const char *BaseName(const char *pathname); +static void Indent(CODE_STATE *cs, int indent); static BOOLEAN InList(struct link *linkp,const char *cp); static void dbug_flush(CODE_STATE *); static void DbugExit(const char *why); -static int DelayArg(int value); - /* Supplied in Sys V runtime environ */ - /* Break string into tokens */ -static char *static_strtok(char *s1,pchar chr); +static const char *DbugStrTok(const char *s); + +#ifndef THREAD + /* Open profile output stream */ +static FILE *OpenProfile(CODE_STATE *cs, const char *name); + /* Profile if asked for it */ +static BOOLEAN DoProfile(CODE_STATE *); + /* Return current user time (ms) */ +static unsigned long Clock(void); +#endif /* - * Miscellaneous printf format strings. + * Miscellaneous printf format strings. */ #define ERR_MISSING_RETURN "%s: missing DBUG_RETURN or DBUG_VOID_RETURN macro in function \"%s\"\n" @@ -307,31 +300,19 @@ static char *static_strtok(char *s1,pchar chr); #define ERR_CHOWN "%s: can't change owner/group of \"%s\": " /* - * Macros and defines for testing file accessibility under UNIX and MSDOS. + * Macros and defines for testing file accessibility under UNIX and MSDOS. */ #undef EXISTS #if !defined(HAVE_ACCESS) || defined(MSDOS) -#define EXISTS(pathname) (FALSE) /* Assume no existance */ +#define EXISTS(pathname) (FALSE) /* Assume no existance */ #define Writable(name) (TRUE) #else -#define EXISTS(pathname) (access (pathname, F_OK) == 0) -#define WRITABLE(pathname) (access (pathname, W_OK) == 0) +#define EXISTS(pathname) (access(pathname, F_OK) == 0) +#define WRITABLE(pathname) (access(pathname, W_OK) == 0) #endif #ifndef MSDOS -#define ChangeOwner(name) -#endif - -/* - * Translate some calls among different systems. - */ - -#if defined(unix) || defined(xenix) || defined(VMS) || defined(__NetBSD__) -# define Delay(A) sleep((uint) A) -#elif defined(AMIGA) -IMPORT int Delay (); /* Pause for given number of ticks */ -#else -static int Delay(int ticks); +#define ChangeOwner(cs,name) #endif @@ -343,578 +324,843 @@ static int Delay(int ticks); #include <my_pthread.h> pthread_mutex_t THR_LOCK_dbug; -static void init_dbug_state(void) -{ - pthread_mutex_init(&THR_LOCK_dbug,MY_MUTEX_INIT_FAST); -} - static CODE_STATE *code_state(void) { - CODE_STATE *state=0; - struct st_my_thread_var *tmp=my_thread_var; - if (tmp) + CODE_STATE *cs=0; + struct st_my_thread_var *tmp; + + if (!init_done) { - if (!(state=(CODE_STATE *) tmp->dbug)) + pthread_mutex_init(&THR_LOCK_dbug,MY_MUTEX_INIT_FAST); + bzero(&init_settings, sizeof(init_settings)); + init_settings.out_file=stderr; + init_settings.flags=OPEN_APPEND; + init_done=TRUE; + } + + if ((tmp=my_thread_var)) + { + if (!(cs=(CODE_STATE *) tmp->dbug)) { - state=(CODE_STATE*) DbugMalloc(sizeof(*state)); - bzero((char*) state,sizeof(*state)); - state->func="?func"; - state->file="?file"; - tmp->dbug=(gptr) state; + cs=(CODE_STATE*) DbugMalloc(sizeof(*cs)); + bzero((uchar*) cs,sizeof(*cs)); + cs->process= db_process ? db_process : "dbug"; + cs->func="?func"; + cs->file="?file"; + cs->stack=&init_settings; + tmp->dbug= (void*) cs; } } - return state; + return cs; } #else /* !THREAD */ -#define init_dbug_state() -#define code_state() (&static_code_state) -#define pthread_mutex_lock(A) {} -#define pthread_mutex_unlock(A) {} static CODE_STATE static_code_state= { - "?func", "?file", NULL, NullS, NullS, 0,0,0,0,0,0, NullS + "dbug", "?func", "?file", NULL, &init_settings, + NullS, NullS, 0,0,0,0,0,NullS }; + +static CODE_STATE *code_state(void) +{ + if (!init_done) + { + bzero(&init_settings, sizeof(init_settings)); + init_settings.out_file=stderr; + init_settings.flags=OPEN_APPEND; + init_done=TRUE; + } + return &static_code_state; +} + +#define pthread_mutex_lock(A) {} +#define pthread_mutex_unlock(A) {} #endif +/* + * Translate some calls among different systems. + */ + +#ifdef HAVE_SLEEP +/* sleep() wants seconds */ +#define Delay(A) sleep(((uint) A)/10) +#else +#define Delay(A) (0) +#endif /* * FUNCTION * - * _db_push_ push current debugger state and set up new one + * _db_process_ give the name to the current process/thread * * SYNOPSIS * - * VOID _db_push_ (control) - * char *control; - * - * DESCRIPTION - * - * Given pointer to a debug control string in "control", pushes - * the current debug state, parses the control string, and sets - * up a new debug state. - * - * The only attribute of the new state inherited from the previous - * state is the current function nesting level. This can be - * overridden by using the "r" flag in the control string. - * - * The debug control string is a sequence of colon separated fields - * as follows: - * - * <field_1>:<field_2>:...:<field_N> + * VOID _process_(name) + * char *name; * - * Each field consists of a mandatory flag character followed by - * an optional "," and comma separated list of modifiers: - * - * flag[,modifier,modifier,...,modifier] - * - * The currently recognized flag characters are: - * - * d Enable output from DBUG_<N> macros for - * for the current state. May be followed - * by a list of keywords which selects output - * only for the DBUG macros with that keyword. - * A null list of keywords implies output for - * all macros. - * - * D Delay after each debugger output line. - * The argument is the number of tenths of seconds - * to delay, subject to machine capabilities. - * I.E. -#D,20 is delay two seconds. - * - * f Limit debugging and/or tracing, and profiling to the - * list of named functions. Note that a null list will - * disable all functions. The appropriate "d" or "t" - * flags must still be given, this flag only limits their - * actions if they are enabled. - * - * F Identify the source file name for each - * line of debug or trace output. - * - * i Identify the process with the pid for each line of - * debug or trace output. - * - * g Enable profiling. Create a file called 'dbugmon.out' - * containing information that can be used to profile - * the program. May be followed by a list of keywords - * that select profiling only for the functions in that - * list. A null list implies that all functions are - * considered. - * - * L Identify the source file line number for - * each line of debug or trace output. - * - * n Print the current function nesting depth for - * each line of debug or trace output. - * - * N Number each line of dbug output. - * - * o Redirect the debugger output stream to the - * specified file. The default output is stderr. + */ + +void _db_process_(const char *name) +{ + CODE_STATE *cs=0; + + if (!db_process) + db_process= name; + + get_code_state_or_return; + cs->process= name; +} + + +/* + * FUNCTION * - * O As O but the file is really flushed between each - * write. When neaded the file is closed and reopened - * between each write. + * DbugParse parse control string and set current debugger setting * - * p Limit debugger actions to specified processes. - * A process must be identified with the - * DBUG_PROCESS macro and match one in the list - * for debugger actions to occur. + * DESCRIPTION * - * P Print the current process name for each - * line of debug or trace output. + * Given pointer to a debug control string in "control", + * parses the control string, and sets + * up a current debug settings. * - * r When pushing a new state, do not inherit - * the previous state's function nesting level. - * Useful when the output is to start at the - * left margin. + * The debug control string is a sequence of colon separated fields + * as follows: * - * S Do function _sanity(_file_,_line_) at each - * debugged function until _sanity() returns - * something that differs from 0. - * (Moustly used with safemalloc) + * [+]<field_1>:<field_2>:...:<field_N> * - * t Enable function call/exit trace lines. - * May be followed by a list (containing only - * one modifier) giving a numeric maximum - * trace level, beyond which no output will - * occur for either debugging or tracing - * macros. The default is a compile time - * option. + * Each field consists of a mandatory flag character followed by + * an optional "," and comma separated list of modifiers: * - * Some examples of debug control strings which might appear - * on a shell command line (the "-#" is typically used to - * introduce a control string to an application program) are: + * [sign]flag[,modifier,modifier,...,modifier] * - * -#d:t - * -#d:f,main,subr1:F:L:t,20 - * -#d,input,output,files:n + * See the manual for the list of supported signs, flags, and modifiers * - * For convenience, any leading "-#" is stripped off. + * For convenience, any leading "-#" is stripped off. * */ -void _db_push_ (const char *control) +static void DbugParse(CODE_STATE *cs, const char *control) { - reg1 char *scan; - reg2 struct link *temp; - CODE_STATE *state; - char *new_str; + const char *end; + int rel=0; + struct settings *stack; + + get_code_state_or_return; + stack= cs->stack; - if (! _db_fp_) - _db_fp_= stderr; /* Output stream, default stderr */ + if (control[0] == '-' && control[1] == '#') + control+=2; - if (*control == '-') + rel= control[0] == '+' || control[0] == '-'; + if ((!rel || (!stack->out_file && !stack->next))) { - if (*++control == '#') - control++; + stack->flags= 0; + stack->delay= 0; + stack->maxdepth= 0; + stack->sub_level= 0; + stack->out_file= stderr; + stack->prof_file= NULL; + stack->functions= NULL; + stack->p_functions= NULL; + stack->keywords= NULL; + stack->processes= NULL; + } + else if (!stack->out_file) + { + stack->flags= stack->next->flags; + stack->delay= stack->next->delay; + stack->maxdepth= stack->next->maxdepth; + stack->sub_level= stack->next->sub_level; + strcpy(stack->name, stack->next->name); + stack->out_file= stack->next->out_file; + stack->prof_file= stack->next->prof_file; + if (stack->next == &init_settings) + { + /* never share with the global parent - it can change under your feet */ + stack->functions= ListCopy(init_settings.functions); + stack->p_functions= ListCopy(init_settings.p_functions); + stack->keywords= ListCopy(init_settings.keywords); + stack->processes= ListCopy(init_settings.processes); + } + else + { + stack->functions= stack->next->functions; + stack->p_functions= stack->next->p_functions; + stack->keywords= stack->next->keywords; + stack->processes= stack->next->processes; + } } - if (*control) - _no_db_=0; /* We are using dbug after all */ - - new_str = StrDup (control); - PushState (); - state=code_state(); - scan = static_strtok (new_str, ':'); - for (; scan != NULL; scan = static_strtok ((char *)NULL, ':')) { - switch (*scan++) { + end= DbugStrTok(control); + while (control < end) + { + int c, sign= (*control == '+') ? 1 : (*control == '-') ? -1 : 0; + if (sign) control++; + if (!rel) sign=0; + c= *control++; + if (*control == ',') control++; + /* XXX when adding new cases here, don't forget _db_explain_ ! */ + switch (c) { case 'd': - _db_on_ = TRUE; - stack -> flags |= DEBUG_ON; - if (*scan++ == ',') { - stack -> keywords = ListParse (scan); + if (sign < 0 && control == end) + { + if (!is_shared(stack, keywords)) + FreeList(stack->keywords); + stack->keywords=NULL; + stack->flags &= ~DEBUG_ON; + break; } + if (rel && is_shared(stack, keywords)) + stack->keywords= ListCopy(stack->keywords); + if (sign < 0) + { + if (DEBUGGING) + stack->keywords= ListDel(stack->keywords, control, end); break; - case 'D': - stack -> delay = 0; - if (*scan++ == ',') { - temp = ListParse (scan); - stack -> delay = DelayArg (atoi (temp -> str)); - FreeList (temp); } + stack->keywords= ListAdd(stack->keywords, control, end); + stack->flags |= DEBUG_ON; + break; + case 'D': + stack->delay= atoi(control); break; case 'f': - if (*scan++ == ',') { - stack -> functions = ListParse (scan); + if (sign < 0 && control == end) + { + if (!is_shared(stack,functions)) + FreeList(stack->functions); + stack->functions=NULL; + break; } + if (rel && is_shared(stack,functions)) + stack->functions= ListCopy(stack->functions); + if (sign < 0) + stack->functions= ListDel(stack->functions, control, end); + else + stack->functions= ListAdd(stack->functions, control, end); break; case 'F': - stack -> flags |= FILE_ON; + if (sign < 0) + stack->flags &= ~FILE_ON; + else + stack->flags |= FILE_ON; break; case 'i': - stack -> flags |= PID_ON; + if (sign < 0) + stack->flags &= ~PID_ON; + else + stack->flags |= PID_ON; break; #ifndef THREAD case 'g': - _db_pon_ = TRUE; - if (OpenProfile(PROF_FILE)) + if (OpenProfile(cs, PROF_FILE)) { - stack -> flags |= PROFILE_ON; - if (*scan++ == ',') - stack -> p_functions = ListParse (scan); + stack->flags |= PROFILE_ON; + stack->p_functions= ListAdd(stack->p_functions, control, end); } break; #endif case 'L': - stack -> flags |= LINE_ON; + if (sign < 0) + stack->flags &= ~LINE_ON; + else + stack->flags |= LINE_ON; break; case 'n': - stack -> flags |= DEPTH_ON; + if (sign < 0) + stack->flags &= ~DEPTH_ON; + else + stack->flags |= DEPTH_ON; break; case 'N': - stack -> flags |= NUMBER_ON; + if (sign < 0) + stack->flags &= ~NUMBER_ON; + else + stack->flags |= NUMBER_ON; break; case 'A': case 'O': - stack -> flags |= FLUSH_ON_WRITE; + stack->flags |= FLUSH_ON_WRITE; + /* fall through */ case 'a': case 'o': - if (*scan++ == ',') { - temp = ListParse (scan); - DBUGOpenFile(temp -> str, (int) (scan[-2] == 'A' || scan[-2] == 'a')); - FreeList (temp); - } else { - DBUGOpenFile ("-",0); + if (sign < 0) + { + if (!is_shared(stack, out_file)) + DBUGCloseFile(cs, stack->out_file); + stack->flags &= ~FLUSH_ON_WRITE; + stack->out_file= stderr; + break; } + if (c == 'a' || c == 'A') + stack->flags |= OPEN_APPEND; + else + stack->flags &= ~OPEN_APPEND; + if (control != end) + DBUGOpenFile(cs, control, end, stack->flags & OPEN_APPEND); + else + DBUGOpenFile(cs, "-",0,0); break; case 'p': - if (*scan++ == ',') { - stack -> processes = ListParse (scan); + if (sign < 0 && control == end) + { + if (!is_shared(stack,processes)) + FreeList(stack->processes); + stack->processes=NULL; + break; } + if (rel && is_shared(stack, processes)) + stack->processes= ListCopy(stack->processes); + if (sign < 0) + stack->processes= ListDel(stack->processes, control, end); + else + stack->processes= ListAdd(stack->processes, control, end); break; case 'P': - stack -> flags |= PROCESS_ON; + if (sign < 0) + stack->flags &= ~PROCESS_ON; + else + stack->flags |= PROCESS_ON; break; case 'r': - stack->sub_level= state->level; + stack->sub_level= cs->level; break; case 't': - stack -> flags |= TRACE_ON; - if (*scan++ == ',') { - temp = ListParse (scan); - stack -> maxdepth = atoi (temp -> str); - FreeList (temp); + if (sign < 0) + { + if (control != end) + stack->maxdepth-= atoi(control); + else + stack->maxdepth= 0; } + else + { + if (control != end) + stack->maxdepth+= atoi(control); + else + stack->maxdepth= MAXDEPTH; + } + if (stack->maxdepth > 0) + stack->flags |= TRACE_ON; + else + stack->flags &= ~TRACE_ON; + break; + case 'T': + if (sign < 0) + stack->flags &= ~TIMESTAMP_ON; + else + stack->flags |= TIMESTAMP_ON; break; case 'S': - stack -> flags |= SANITY_CHECK_ON; + if (sign < 0) + stack->flags &= ~SANITY_CHECK_ON; + else + stack->flags |= SANITY_CHECK_ON; break; } + if (!*end) + break; + control=end+1; + end= DbugStrTok(control); } - free (new_str); } /* * FUNCTION * - * _db_pop_ pop the debug stack + * _db_set_ set current debugger settings + * + * SYNOPSIS + * + * VOID _db_set_(control) + * char *control; * * DESCRIPTION * - * Pops the debug stack, returning the debug state to its - * condition prior to the most recent _db_push_ invocation. - * Note that the pop will fail if it would remove the last - * valid state from the stack. This prevents user errors - * in the push/pop sequence from screwing up the debugger. - * Maybe there should be some kind of warning printed if the - * user tries to pop too many states. + * Given pointer to a debug control string in "control", + * parses the control string, and sets up a current debug + * settings. Pushes a new debug settings if the current is + * set to the initial debugger settings. + */ + +void _db_set_(CODE_STATE *cs, const char *control) +{ + get_code_state_or_return; + + if (cs->stack == &init_settings) + PushState(cs); + + DbugParse(cs, control); +} + + +/* + * FUNCTION + * + * _db_push_ push current debugger settings and set up new one + * + * SYNOPSIS + * + * VOID _db_push_(control) + * char *control; + * + * DESCRIPTION + * + * Given pointer to a debug control string in "control", pushes + * the current debug settings, parses the control string, and sets + * up a new debug settings with DbugParse() * */ -void _db_pop_ () +void _db_push_(const char *control) { - reg1 struct state *discard; - discard = stack; - if (discard != NULL && discard -> next_state != NULL) { - stack = discard -> next_state; - _db_fp_ = stack -> out_file; - _db_pfp_ = stack -> prof_file; - FreeState(discard); - if (!(stack->flags & DEBUG_ON)) - _db_on_=0; - } - else + CODE_STATE *cs=0; + get_code_state_or_return; + PushState(cs); + DbugParse(cs, control); +} + +/* + * FUNCTION + * + * _db_set_init_ set initial debugger settings + * + * SYNOPSIS + * + * VOID _db_set_init_(control) + * char *control; + * + * DESCRIPTION + * see _db_set_ + * + */ + +void _db_set_init_(const char *control) +{ + CODE_STATE tmp_cs; + bzero((uchar*) &tmp_cs, sizeof(tmp_cs)); + tmp_cs.stack= &init_settings; + DbugParse(&tmp_cs, control); +} + +/* + * FUNCTION + * + * _db_pop_ pop the debug stack + * + * DESCRIPTION + * + * Pops the debug stack, returning the debug settings to its + * condition prior to the most recent _db_push_ invocation. + * Note that the pop will fail if it would remove the last + * valid settings from the stack. This prevents user errors + * in the push/pop sequence from screwing up the debugger. + * Maybe there should be some kind of warning printed if the + * user tries to pop too many states. + * + */ + +void _db_pop_() +{ + struct settings *discard; + CODE_STATE *cs=0; + + get_code_state_or_return; + + discard= cs->stack; + if (discard->next != NULL) { - _db_on_=0; + cs->stack= discard->next; + FreeState(cs, discard, 1); } } +/* + * FUNCTION + * + * _db_explain_ generates 'control' string for the current settings + * + * RETURN + * 0 - ok + * 1 - buffer too short, output truncated + * + */ + +/* helper macros */ +#define char_to_buf(C) do { \ + *buf++=(C); \ + if (buf >= end) goto overflow; \ + } while (0) +#define str_to_buf(S) do { \ + char_to_buf(','); \ + buf=strnmov(buf, (S), len+1); \ + if (buf >= end) goto overflow; \ + } while (0) +#define list_to_buf(l) do { \ + struct link *listp=(l); \ + while (listp) \ + { \ + str_to_buf(listp->str); \ + listp=listp->next_link; \ + } \ + } while (0) +#define int_to_buf(i) do { \ + char b[50]; \ + int10_to_str((i), b, 10); \ + str_to_buf(b); \ + } while (0) +#define colon_to_buf do { \ + if (buf != start) char_to_buf(':'); \ + } while(0) +#define op_int_to_buf(C, val, def) do { \ + if ((val) != (def)) \ + { \ + colon_to_buf; \ + char_to_buf((C)); \ + int_to_buf(val); \ + } \ + } while (0) +#define op_intf_to_buf(C, val, def, cond) do { \ + if ((cond)) \ + { \ + colon_to_buf; \ + char_to_buf((C)); \ + if ((val) != (def)) int_to_buf(val); \ + } \ + } while (0) +#define op_str_to_buf(C, val, cond) do { \ + if ((cond)) \ + { \ + char *s=(val); \ + colon_to_buf; \ + char_to_buf((C)); \ + if (*s) str_to_buf(s); \ + } \ + } while (0) +#define op_list_to_buf(C, val, cond) do { \ + if ((cond)) \ + { \ + colon_to_buf; \ + char_to_buf((C)); \ + list_to_buf(val); \ + } \ + } while (0) +#define op_bool_to_buf(C, cond) do { \ + if ((cond)) \ + { \ + colon_to_buf; \ + char_to_buf((C)); \ + } \ + } while (0) + +int _db_explain_ (CODE_STATE *cs, char *buf, size_t len) +{ + char *start=buf, *end=buf+len-4; + + get_code_state_or_return *buf=0; + + op_list_to_buf('d', cs->stack->keywords, DEBUGGING); + op_int_to_buf ('D', cs->stack->delay, 0); + op_list_to_buf('f', cs->stack->functions, cs->stack->functions); + op_bool_to_buf('F', cs->stack->flags & FILE_ON); + op_bool_to_buf('i', cs->stack->flags & PID_ON); + op_list_to_buf('g', cs->stack->p_functions, PROFILING); + op_bool_to_buf('L', cs->stack->flags & LINE_ON); + op_bool_to_buf('n', cs->stack->flags & DEPTH_ON); + op_bool_to_buf('N', cs->stack->flags & NUMBER_ON); + op_str_to_buf( + ((cs->stack->flags & FLUSH_ON_WRITE ? 0 : 32) | + (cs->stack->flags & OPEN_APPEND ? 'A' : 'O')), + cs->stack->name, cs->stack->out_file != stderr); + op_list_to_buf('p', cs->stack->processes, cs->stack->processes); + op_bool_to_buf('P', cs->stack->flags & PROCESS_ON); + op_bool_to_buf('r', cs->stack->sub_level != 0); + op_intf_to_buf('t', cs->stack->maxdepth, MAXDEPTH, TRACING); + op_bool_to_buf('T', cs->stack->flags & TIMESTAMP_ON); + op_bool_to_buf('S', cs->stack->flags & SANITY_CHECK_ON); + + *buf= '\0'; + return 0; + +overflow: + *end++= '.'; + *end++= '.'; + *end++= '.'; + *end= '\0'; + return 1; +} + +#undef char_to_buf +#undef str_to_buf +#undef list_to_buf +#undef int_to_buf +#undef colon_to_buf +#undef op_int_to_buf +#undef op_intf_to_buf +#undef op_str_to_buf +#undef op_list_to_buf +#undef op_bool_to_buf /* * FUNCTION * - * _db_enter_ process entry point to user function + * _db_explain_init_ explain initial debugger settings + * + * DESCRIPTION + * see _db_explain_ + */ + +int _db_explain_init_(char *buf, size_t len) +{ + CODE_STATE cs; + bzero((uchar*) &cs,sizeof(cs)); + cs.stack=&init_settings; + return _db_explain_(&cs, buf, len); +} + +/* + * FUNCTION + * + * _db_enter_ process entry point to user function * * SYNOPSIS * - * VOID _db_enter_ (_func_, _file_, _line_, - * _sfunc_, _sfile_, _slevel_, _sframep_) - * char *_func_; points to current function name - * char *_file_; points to current file name - * int _line_; called from source line number - * char **_sfunc_; save previous _func_ - * char **_sfile_; save previous _file_ - * int *_slevel_; save previous nesting level - * char ***_sframep_; save previous frame pointer + * VOID _db_enter_(_func_, _file_, _line_, + * _sfunc_, _sfile_, _slevel_, _sframep_) + * char *_func_; points to current function name + * char *_file_; points to current file name + * int _line_; called from source line number + * char **_sfunc_; save previous _func_ + * char **_sfile_; save previous _file_ + * int *_slevel_; save previous nesting level + * char ***_sframep_; save previous frame pointer * * DESCRIPTION * - * Called at the beginning of each user function to tell - * the debugger that a new function has been entered. - * Note that the pointers to the previous user function - * name and previous user file name are stored on the - * caller's stack (this is why the ENTER macro must be - * the first "executable" code in a function, since it - * allocates these storage locations). The previous nesting - * level is also stored on the callers stack for internal - * self consistency checks. + * Called at the beginning of each user function to tell + * the debugger that a new function has been entered. + * Note that the pointers to the previous user function + * name and previous user file name are stored on the + * caller's stack (this is why the ENTER macro must be + * the first "executable" code in a function, since it + * allocates these storage locations). The previous nesting + * level is also stored on the callers stack for internal + * self consistency checks. * - * Also prints a trace line if tracing is enabled and - * increments the current function nesting depth. + * Also prints a trace line if tracing is enabled and + * increments the current function nesting depth. * - * Note that this mechanism allows the debugger to know - * what the current user function is at all times, without - * maintaining an internal stack for the function names. + * Note that this mechanism allows the debugger to know + * what the current user function is at all times, without + * maintaining an internal stack for the function names. * */ -void _db_enter_ ( -const char *_func_, -const char *_file_, -uint _line_, -const char **_sfunc_, -const char **_sfile_, -uint *_slevel_, -char ***_sframep_ __attribute__((unused))) +void _db_enter_(const char *_func_, const char *_file_, + uint _line_, const char **_sfunc_, const char **_sfile_, + uint *_slevel_, char ***_sframep_ __attribute__((unused))) { - reg1 CODE_STATE *state; - - if (!_no_db_) - { - int save_errno=errno; - /* - Sasha: the test below is so we could call functions with DBUG_ENTER - before my_thread_init(). I needed this because I suspected corruption - of a block allocated by my_thread_init() itself, so I wanted to use - my_malloc()/my_free() in my_thread_init()/my_thread_end() - */ - if (!(state=code_state())) - return; - if (!init_done) - _db_push_ (_DBUG_START_CONDITION_); - - *_sfunc_ = state->func; - *_sfile_ = state->file; - state->func =(char*) _func_; - state->file = (char*) _file_; /* BaseName takes time !! */ - *_slevel_ = ++state->level; + int save_errno=errno; + CODE_STATE *cs=0; + get_code_state_or_return; + + *_sfunc_= cs->func; + *_sfile_= cs->file; + cs->func= _func_; + cs->file= _file_; + *_slevel_= ++cs->level; #ifndef THREAD - *_sframep_ = state->framep; - state->framep = (char **) _sframep_; - if (DoProfile ()) + *_sframep_= cs->framep; + cs->framep= (char **) _sframep_; + if (DoProfile(cs)) + { + long stackused; + if (*cs->framep == NULL) + stackused= 0; + else { - long stackused; - if (*state->framep == NULL) - { - stackused = 0; - } - else - { - stackused = ((long)(*state->framep)) - ((long)(state->framep)); - stackused = stackused > 0 ? stackused : -stackused; - } - (void) fprintf (_db_pfp_, PROF_EFMT , Clock (), state->func); + stackused= ((long)(*cs->framep)) - ((long)(cs->framep)); + stackused= stackused > 0 ? stackused : -stackused; + } + (void) fprintf(cs->stack->prof_file, PROF_EFMT , Clock(), cs->func); #ifdef AUTOS_REVERSE - (void) fprintf (_db_pfp_, PROF_SFMT, state->framep, stackused, *_sfunc_); + (void) fprintf(cs->stack->prof_file, PROF_SFMT, cs->framep, stackused, *_sfunc_); #else - (void) fprintf (_db_pfp_, PROF_SFMT, (ulong) state->framep, stackused, - state->func); + (void) fprintf(cs->stack->prof_file, PROF_SFMT, (ulong) cs->framep, stackused, + cs->func); #endif - (void) fflush (_db_pfp_); - } + (void) fflush(cs->stack->prof_file); + } #endif - if (DoTrace(state)) - { - if (!state->locked) - pthread_mutex_lock(&THR_LOCK_dbug); - DoPrefix (_line_); - Indent (state -> level); - (void) fprintf (_db_fp_, ">%s\n", state->func); - dbug_flush (state); /* This does a unlock */ - } + if (DoTrace(cs)) + { + if (!cs->locked) + pthread_mutex_lock(&THR_LOCK_dbug); + DoPrefix(cs, _line_); + Indent(cs, cs->level); + (void) fprintf(cs->stack->out_file, ">%s\n", cs->func); + dbug_flush(cs); /* This does a unlock */ + } #ifdef SAFEMALLOC - if (stack->flags & SANITY_CHECK_ON && !state->disable_output) - if (_sanity(_file_,_line_)) /* Check of safemalloc */ - stack -> flags &= ~SANITY_CHECK_ON; + if (cs->stack->flags & SANITY_CHECK_ON) + if (_sanity(_file_,_line_)) /* Check of safemalloc */ + cs->stack->flags &= ~SANITY_CHECK_ON; #endif - errno=save_errno; - } + errno=save_errno; } /* * FUNCTION * - * _db_return_ process exit from user function + * _db_return_ process exit from user function * * SYNOPSIS * - * VOID _db_return_ (_line_, _sfunc_, _sfile_, _slevel_) - * int _line_; current source line number - * char **_sfunc_; where previous _func_ is to be retrieved - * char **_sfile_; where previous _file_ is to be retrieved - * int *_slevel_; where previous level was stashed + * VOID _db_return_(_line_, _sfunc_, _sfile_, _slevel_) + * int _line_; current source line number + * char **_sfunc_; where previous _func_ is to be retrieved + * char **_sfile_; where previous _file_ is to be retrieved + * int *_slevel_; where previous level was stashed * * DESCRIPTION * - * Called just before user function executes an explicit or implicit - * return. Prints a trace line if trace is enabled, decrements - * the current nesting level, and restores the current function and - * file names from the defunct function's stack. + * Called just before user function executes an explicit or implicit + * return. Prints a trace line if trace is enabled, decrements + * the current nesting level, and restores the current function and + * file names from the defunct function's stack. * */ -void _db_return_ ( -uint _line_, -const char **_sfunc_, -const char **_sfile_, -uint *_slevel_) +/* helper macro */ +void _db_return_(uint _line_, const char **_sfunc_, + const char **_sfile_, uint *_slevel_) { - CODE_STATE *state; + int save_errno=errno; + CODE_STATE *cs=0; + get_code_state_or_return; - if (!_no_db_) + if (cs->level != (int) *_slevel_) + { + if (!cs->locked) + pthread_mutex_lock(&THR_LOCK_dbug); + (void) fprintf(cs->stack->out_file, ERR_MISSING_RETURN, cs->process, + cs->func); + dbug_flush(cs); + } + else { - int save_errno=errno; - if (!(state=code_state())) - return; - if (!init_done) - _db_push_ (""); - if (stack->flags & (TRACE_ON | DEBUG_ON | PROFILE_ON)) - { - if (!state->locked) - pthread_mutex_lock(&THR_LOCK_dbug); - if (state->level != (int) *_slevel_) - (void) fprintf (_db_fp_, ERR_MISSING_RETURN, _db_process_, - state->func); - else - { #ifdef SAFEMALLOC - if (stack->flags & SANITY_CHECK_ON && !state->disable_output) - { - if (_sanity(*_sfile_,_line_)) - stack->flags &= ~SANITY_CHECK_ON; - } + if (cs->stack->flags & SANITY_CHECK_ON) + { + if (_sanity(*_sfile_,_line_)) + cs->stack->flags &= ~SANITY_CHECK_ON; + } #endif #ifndef THREAD - if (DoProfile ()) - (void) fprintf (_db_pfp_, PROF_XFMT, Clock(), state->func); + if (DoProfile(cs)) + (void) fprintf(cs->stack->prof_file, PROF_XFMT, Clock(), cs->func); #endif - if (DoTrace (state)) - { - DoPrefix (_line_); - Indent (state->level); - (void) fprintf (_db_fp_, "<%s\n", state->func); - } - } - dbug_flush(state); + if (DoTrace(cs)) + { + if (!cs->locked) + pthread_mutex_lock(&THR_LOCK_dbug); + DoPrefix(cs, _line_); + Indent(cs, cs->level); + (void) fprintf(cs->stack->out_file, "<%s\n", cs->func); + dbug_flush(cs); } - state->level = *_slevel_-1; - state->func = *_sfunc_; - state->file = *_sfile_; + } + cs->level= *_slevel_-1; + cs->func= *_sfunc_; + cs->file= *_sfile_; #ifndef THREAD - if (state->framep != NULL) - state->framep = (char **) *state->framep; + if (cs->framep != NULL) + cs->framep= (char **) *cs->framep; #endif - errno=save_errno; - } + errno=save_errno; } /* * FUNCTION * - * _db_pargs_ log arguments for subsequent use by _db_doprnt_() + * _db_pargs_ log arguments for subsequent use by _db_doprnt_() * * SYNOPSIS * - * VOID _db_pargs_ (_line_, keyword) - * int _line_; - * char *keyword; + * VOID _db_pargs_(_line_, keyword) + * int _line_; + * char *keyword; * * DESCRIPTION * - * The new universal printing macro DBUG_PRINT, which replaces - * all forms of the DBUG_N macros, needs two calls to runtime - * support routines. The first, this function, remembers arguments - * that are used by the subsequent call to _db_doprnt_(). + * The new universal printing macro DBUG_PRINT, which replaces + * all forms of the DBUG_N macros, needs two calls to runtime + * support routines. The first, this function, remembers arguments + * that are used by the subsequent call to _db_doprnt_(). * */ -void _db_pargs_ ( -uint _line_, -const char *keyword) +void _db_pargs_(uint _line_, const char *keyword) { - CODE_STATE *state=code_state(); - /* Sasha: pre-my_thread_init() safety */ - if (!state) - return; - state->u_line = _line_; - state->u_keyword = (char*) keyword; + CODE_STATE *cs=0; + get_code_state_or_return; + cs->u_line= _line_; + cs->u_keyword= keyword; } /* * FUNCTION * - * _db_doprnt_ handle print of debug lines + * _db_doprnt_ handle print of debug lines * * SYNOPSIS * - * VOID _db_doprnt_ (format, va_alist) - * char *format; - * va_dcl; + * VOID _db_doprnt_(format, va_alist) + * char *format; + * va_dcl; * * DESCRIPTION * - * When invoked via one of the DBUG macros, tests the current keyword - * set by calling _db_pargs_() to see if that macro has been selected - * for processing via the debugger control string, and if so, handles - * printing of the arguments via the format string. The line number - * of the DBUG macro in the source is found in u_line. + * When invoked via one of the DBUG macros, tests the current keyword + * set by calling _db_pargs_() to see if that macro has been selected + * for processing via the debugger control string, and if so, handles + * printing of the arguments via the format string. The line number + * of the DBUG macro in the source is found in u_line. * - * Note that the format string SHOULD NOT include a terminating - * newline, this is supplied automatically. + * Note that the format string SHOULD NOT include a terminating + * newline, this is supplied automatically. * */ #include <stdarg.h> -void _db_doprnt_ (const char *format,...) +void _db_doprnt_(const char *format,...) { va_list args; - CODE_STATE *state; - /* Sasha: pre-my_thread_init() safety */ - if (!(state=code_state())) - return; + + CODE_STATE *cs=0; + get_code_state_or_return; va_start(args,format); - if (_db_keyword_ (state->u_keyword)) { + if (_db_keyword_(cs, cs->u_keyword)) + { int save_errno=errno; - if (!state->locked) + if (!cs->locked) pthread_mutex_lock(&THR_LOCK_dbug); - DoPrefix (state->u_line); - if (TRACING) { - Indent (state->level + 1); - } else { - (void) fprintf (_db_fp_, "%s: ", state->func); - } - (void) fprintf (_db_fp_, "%s: ", state->u_keyword); - (void) vfprintf (_db_fp_, format, args); - (void) fputc('\n',_db_fp_); - dbug_flush(state); + DoPrefix(cs, cs->u_line); + if (TRACING) + Indent(cs, cs->level + 1); + else + (void) fprintf(cs->stack->out_file, "%s: ", cs->func); + (void) fprintf(cs->stack->out_file, "%s: ", cs->u_keyword); + (void) vfprintf(cs->stack->out_file, format, args); + (void) fputc('\n',cs->stack->out_file); + dbug_flush(cs); errno=save_errno; } va_end(args); @@ -928,46 +1174,43 @@ void _db_doprnt_ (const char *format,...) * * SYNOPSIS * - * void _db_dump_ (_line_,keyword,memory,length) - * int _line_; current source line number - * char *keyword; - * char *memory; Memory to print - * int length; Bytes to print + * void _db_dump_(_line_,keyword,memory,length) + * int _line_; current source line number + * char *keyword; + * char *memory; Memory to print + * int length; Bytes to print * * DESCRIPTION * Dump N characters in a binary array. * Is used to examine corrputed memory or arrays. */ -void _db_dump_( -uint _line_, -const char *keyword, -const char *memory, -uint length) +void _db_dump_(uint _line_, const char *keyword, + const unsigned char *memory, size_t length) { int pos; char dbuff[90]; - CODE_STATE *state; - if (!(state=code_state())) - return; - if (_db_keyword_ ((char*) keyword)) + CODE_STATE *cs=0; + get_code_state_or_return; + + if (_db_keyword_(cs, keyword)) { - if (!state->locked) + if (!cs->locked) pthread_mutex_lock(&THR_LOCK_dbug); - DoPrefix (_line_); + DoPrefix(cs, _line_); if (TRACING) { - Indent (state->level + 1); - pos= min(max(state->level-stack->sub_level,0)*INDENT,80); + Indent(cs, cs->level + 1); + pos= min(max(cs->level-cs->stack->sub_level,0)*INDENT,80); } else { - fprintf(_db_fp_, "%s: ", state->func); + fprintf(cs->stack->out_file, "%s: ", cs->func); } - sprintf(dbuff,"%s: Memory: 0x%lx Bytes: (%d)\n", - keyword,(ulong) memory, length); - (void) fputs(dbuff,_db_fp_); + sprintf(dbuff,"%s: Memory: 0x%lx Bytes: (%ld)\n", + keyword, (ulong) memory, (long) length); + (void) fputs(dbuff,cs->stack->out_file); pos=0; while (length-- > 0) @@ -975,176 +1218,231 @@ uint length) uint tmp= *((unsigned char*) memory++); if ((pos+=3) >= 80) { - fputc('\n',_db_fp_); - pos=3; + fputc('\n',cs->stack->out_file); + pos=3; } - fputc(_dig_vec_upper[((tmp >> 4) & 15)], _db_fp_); - fputc(_dig_vec_upper[tmp & 15], _db_fp_); - fputc(' ',_db_fp_); + fputc(_dig_vec_upper[((tmp >> 4) & 15)], cs->stack->out_file); + fputc(_dig_vec_upper[tmp & 15], cs->stack->out_file); + fputc(' ',cs->stack->out_file); } - (void) fputc('\n',_db_fp_); - dbug_flush(state); + (void) fputc('\n',cs->stack->out_file); + dbug_flush(cs); } } /* - Enable/Disable output for this thread + * FUNCTION + * + * ListAdd add to the list modifiers from debug control string + * + * SYNOPSIS + * + * static struct link *ListAdd(listp, ctlp, end) + * struct link *listp; + * char *ctlp; + * char *end; + * + * DESCRIPTION + * + * Given pointer to a comma separated list of strings in "cltp", + * parses the list, and adds it to listp, returning a pointer + * to the new list + * + * Note that since each link is added at the head of the list, + * the final list will be in "reverse order", which is not + * significant for our usage here. + * + */ - SYNOPSIS - _db_output_() - flag 1 = enable output, 0 = disable_output +static struct link *ListAdd(struct link *head, + const char *ctlp, const char *end) +{ + const char *start; + struct link *new_malloc; + int len; -*/ + while (ctlp < end) + { + start= ctlp; + while (ctlp < end && *ctlp != ',') + ctlp++; + len=ctlp-start; + new_malloc= (struct link *) DbugMalloc(sizeof(struct link)+len); + memcpy(new_malloc->str, start, len); + new_malloc->str[len]=0; + new_malloc->next_link= head; + head= new_malloc; + ctlp++; + } + return head; +} -void _db_output_(uint flag) +/* + * FUNCTION + * + * ListDel remove from the list modifiers in debug control string + * + * SYNOPSIS + * + * static struct link *ListDel(listp, ctlp, end) + * struct link *listp; + * char *ctlp; + * char *end; + * + * DESCRIPTION + * + * Given pointer to a comma separated list of strings in "cltp", + * parses the list, and removes these strings from the listp, + * returning a pointer to the new list. + * + */ + +static struct link *ListDel(struct link *head, + const char *ctlp, const char *end) { - CODE_STATE *state; - if (!(state=code_state())) - return; - state->disable_output= !flag; -} + const char *start; + struct link **cur; + int len; + while (ctlp < end) + { + start= ctlp; + while (ctlp < end && *ctlp != ',') + ctlp++; + len=ctlp-start; + cur=&head; + do + { + while (*cur && !strncmp((*cur)->str, start, len)) + { + struct link *delme=*cur; + *cur=(*cur)->next_link; + free((void*) delme); + } + } while (*cur && *(cur=&((*cur)->next_link))); + } + return head; +} /* * FUNCTION * - * ListParse parse list of modifiers in debug control string + * ListCopy make a copy of the list * * SYNOPSIS * - * static struct link *ListParse (ctlp) - * char *ctlp; + * static struct link *ListCopy(orig) + * struct link *orig; * * DESCRIPTION * - * Given pointer to a comma separated list of strings in "cltp", - * parses the list, building a list and returning a pointer to it. - * The original comma separated list is destroyed in the process of - * building the linked list, thus it had better be a duplicate - * if it is important. + * Given pointer to list, which contains a copy of every element from + * the original list. + * + * the orig pointer can be NULL * - * Note that since each link is added at the head of the list, - * the final list will be in "reverse order", which is not - * significant for our usage here. + * Note that since each link is added at the head of the list, + * the final list will be in "reverse order", which is not + * significant for our usage here. * */ -static struct link *ListParse ( -char *ctlp) +static struct link *ListCopy(struct link *orig) { - REGISTER char *start; - REGISTER struct link *new_malloc; - REGISTER struct link *head; - - head = NULL; - while (*ctlp != EOS) { - start = ctlp; - while (*ctlp != EOS && *ctlp != ',') { - ctlp++; - } - if (*ctlp == ',') { - *ctlp++ = EOS; - } - new_malloc = (struct link *) DbugMalloc (sizeof (struct link)); - new_malloc -> str = StrDup (start); - new_malloc -> next_link = head; - head = new_malloc; + struct link *new_malloc; + struct link *head; + int len; + + head= NULL; + while (orig != NULL) + { + len= strlen(orig->str); + new_malloc= (struct link *) DbugMalloc(sizeof(struct link)+len); + memcpy(new_malloc->str, orig->str, len); + new_malloc->str[len]= 0; + new_malloc->next_link= head; + head= new_malloc; + orig= orig->next_link; } - return (head); + return head; } /* * FUNCTION * - * InList test a given string for member of a given list + * InList test a given string for member of a given list * * SYNOPSIS * - * static BOOLEAN InList (linkp, cp) - * struct link *linkp; - * char *cp; + * static BOOLEAN InList(linkp, cp) + * struct link *linkp; + * char *cp; * * DESCRIPTION * - * Tests the string pointed to by "cp" to determine if it is in - * the list pointed to by "linkp". Linkp points to the first - * link in the list. If linkp is NULL then the string is treated - * as if it is in the list (I.E all strings are in the null list). - * This may seem rather strange at first but leads to the desired - * operation if no list is given. The net effect is that all - * strings will be accepted when there is no list, and when there - * is a list, only those strings in the list will be accepted. + * Tests the string pointed to by "cp" to determine if it is in + * the list pointed to by "linkp". Linkp points to the first + * link in the list. If linkp is NULL then the string is treated + * as if it is in the list (I.E all strings are in the null list). + * This may seem rather strange at first but leads to the desired + * operation if no list is given. The net effect is that all + * strings will be accepted when there is no list, and when there + * is a list, only those strings in the list will be accepted. * */ -static BOOLEAN InList ( -struct link *linkp, -const char *cp) +static BOOLEAN InList(struct link *linkp, const char *cp) { REGISTER struct link *scan; REGISTER BOOLEAN result; - if (linkp == NULL) { - result = TRUE; - } else { - result = FALSE; - for (scan = linkp; scan != NULL; scan = scan -> next_link) { - if (STREQ (scan -> str, cp)) { - result = TRUE; - break; + if (linkp == NULL) + result= TRUE; + else + { + result= FALSE; + for (scan= linkp; scan != NULL; scan= scan->next_link) + { + if (!strcmp(scan->str, cp)) + { + result= TRUE; + break; } } } - return (result); + return result; } /* * FUNCTION * - * PushState push current state onto stack and set up new one + * PushState push current settings onto stack and set up new one * * SYNOPSIS * - * static VOID PushState () + * static VOID PushState() * * DESCRIPTION * - * Pushes the current state on the state stack, and initializes - * a new state. The only parameter inherited from the previous - * state is the function nesting level. This action can be - * inhibited if desired, via the "r" flag. + * Pushes the current settings on the settings stack, and creates + * a new settings. The new settings is NOT initialized * - * The state stack is a linked list of states, with the new - * state added at the head. This allows the stack to grow - * to the limits of memory if necessary. + * The settings stack is a linked list of settings, with the new + * settings added at the head. This allows the stack to grow + * to the limits of memory if necessary. * */ -static void PushState () +static void PushState(CODE_STATE *cs) { - REGISTER struct state *new_malloc; + struct settings *new_malloc; - if (!init_done) - { - init_dbug_state(); - init_done=TRUE; - } - (void) code_state(); /* Alloc memory */ - new_malloc = (struct state *) DbugMalloc(sizeof (struct state)); - new_malloc -> flags = 0; - new_malloc -> delay = 0; - new_malloc -> maxdepth = MAXDEPTH; - new_malloc -> sub_level=0; - new_malloc -> out_file = stderr; - new_malloc -> prof_file = (FILE*) 0; - new_malloc -> functions = NULL; - new_malloc -> p_functions = NULL; - new_malloc -> keywords = NULL; - new_malloc -> processes = NULL; - new_malloc -> next_state = stack; - stack=new_malloc; + new_malloc= (struct settings *) DbugMalloc(sizeof(struct settings)); + new_malloc->next= cs->stack; + new_malloc->out_file= NULL; + cs->stack= new_malloc; } /* @@ -1156,32 +1454,31 @@ static void PushState () * * static void FreeState (state) * struct state *state; + * int free_state; * * DESCRIPTION * * Deallocates the memory allocated for various information in a - * state. + * state. If free_state is set, also free 'state' * */ -static void FreeState ( -struct state *state) +static void FreeState(CODE_STATE *cs, struct settings *state, int free_state) { - if (state -> keywords != NULL) { - FreeList (state -> keywords); - } - if (state -> functions != NULL) { - FreeList (state -> functions); - } - if (state -> processes != NULL) { - FreeList (state -> processes); - } - if (state -> p_functions != NULL) { - FreeList (state -> p_functions); - } - CloseFile (state -> out_file); - if (state -> prof_file) - CloseFile (state -> prof_file); - free ((char *) state); + if (!is_shared(state, keywords)) + FreeList(state->keywords); + if (!is_shared(state, functions)) + FreeList(state->functions); + if (!is_shared(state, processes)) + FreeList(state->processes); + if (!is_shared(state, p_functions)) + FreeList(state->p_functions); + if (!is_shared(state, out_file)) + DBUGCloseFile(cs, state->out_file); + (void) fflush(cs->stack->out_file); + if (state->prof_file) + DBUGCloseFile(cs, state->prof_file); + if (free_state) + free((void*) state); } @@ -1202,85 +1499,104 @@ struct state *state) * To be called at the very end of the program. * */ -void _db_end_ () +void _db_end_() { - reg1 struct state *discard; - while((discard= stack) != NULL) { - stack= discard -> next_state; - FreeState (discard); + struct settings *discard; + static struct settings tmp; + CODE_STATE *cs=0; + + get_code_state_or_return; + + while ((discard= cs->stack)) + { + if (discard == &init_settings) + break; + cs->stack= discard->next; + FreeState(cs, discard, 1); } - _db_on_=0; + tmp= init_settings; + + /* Use mutex lock to make it less likely anyone access out_file */ + pthread_mutex_lock(&THR_LOCK_dbug); + init_settings.flags= OPEN_APPEND; + init_settings.out_file= stderr; + init_settings.prof_file= stderr; + init_settings.maxdepth= 0; + init_settings.delay= 0; + init_settings.sub_level= 0; + init_settings.functions= 0; + init_settings.p_functions= 0; + init_settings.keywords= 0; + init_settings.processes= 0; + pthread_mutex_unlock(&THR_LOCK_dbug); + FreeState(cs, &tmp, 0); } /* * FUNCTION * - * DoTrace check to see if tracing is current enabled + * DoTrace check to see if tracing is current enabled * * SYNOPSIS * - * static BOOLEAN DoTrace (stack) + * static BOOLEAN DoTrace(stack) * * DESCRIPTION * - * Checks to see if tracing is enabled based on whether the - * user has specified tracing, the maximum trace depth has - * not yet been reached, the current function is selected, - * and the current process is selected. Returns TRUE if - * tracing is enabled, FALSE otherwise. + * Checks to see if tracing is enabled based on whether the + * user has specified tracing, the maximum trace depth has + * not yet been reached, the current function is selected, + * and the current process is selected. Returns TRUE if + * tracing is enabled, FALSE otherwise. * */ -static BOOLEAN DoTrace (CODE_STATE *state) +static BOOLEAN DoTrace(CODE_STATE *cs) { - reg2 BOOLEAN trace=FALSE; - - if (TRACING && !state->disable_output && - state->level <= stack -> maxdepth && - InList (stack -> functions, state->func) && - InList (stack -> processes, _db_process_)) - trace = TRUE; - return (trace); + return (TRACING && cs->level <= cs->stack->maxdepth && + InList(cs->stack->functions, cs->func) && + InList(cs->stack->processes, cs->process)); } /* * FUNCTION * - * DoProfile check to see if profiling is current enabled + * DoProfile check to see if profiling is current enabled * * SYNOPSIS * - * static BOOLEAN DoProfile () + * static BOOLEAN DoProfile() * * DESCRIPTION * - * Checks to see if profiling is enabled based on whether the - * user has specified profiling, the maximum trace depth has - * not yet been reached, the current function is selected, - * and the current process is selected. Returns TRUE if - * profiling is enabled, FALSE otherwise. + * Checks to see if profiling is enabled based on whether the + * user has specified profiling, the maximum trace depth has + * not yet been reached, the current function is selected, + * and the current process is selected. Returns TRUE if + * profiling is enabled, FALSE otherwise. * */ #ifndef THREAD -static BOOLEAN DoProfile () +static BOOLEAN DoProfile(CODE_STATE *cs) { - REGISTER BOOLEAN profile; - CODE_STATE *state; - state=code_state(); - - profile = FALSE; - if (PROFILING && !state->disable_output && - state->level <= stack -> maxdepth && - InList (stack -> p_functions, state->func) && - InList (stack -> processes, _db_process_)) - profile = TRUE; - return (profile); + return PROFILING && + cs->level <= cs->stack->maxdepth && + InList(cs->stack->p_functions, cs->func) && + InList(cs->stack->processes, cs->process); } #endif +FILE *_db_fp_(void) +{ + CODE_STATE *cs=0; + get_code_state_or_return NULL; + return cs->stack->out_file; +} + + /* * FUNCTION * @@ -1288,7 +1604,7 @@ static BOOLEAN DoProfile () * * SYNOPSIS * - * BOOLEAN _db_strict_keyword_ (keyword) + * BOOLEAN _db_strict_keyword_(keyword) * char *keyword; * * DESCRIPTION @@ -1301,93 +1617,83 @@ static BOOLEAN DoProfile () * */ -BOOLEAN _db_strict_keyword_ ( -const char *keyword) +BOOLEAN _db_strict_keyword_(const char *keyword) { - if (stack -> keywords == NULL) + CODE_STATE *cs=0; + get_code_state_or_return FALSE; + if (!DEBUGGING || cs->stack->keywords == NULL) return FALSE; - return _db_keyword_ (keyword); + return _db_keyword_(cs, keyword); } /* * FUNCTION * - * _db_keyword_ test keyword for member of keyword list + * _db_keyword_ test keyword for member of keyword list * * SYNOPSIS * - * BOOLEAN _db_keyword_ (keyword) - * char *keyword; + * BOOLEAN _db_keyword_(keyword) + * char *keyword; * * DESCRIPTION * - * Test a keyword to determine if it is in the currently active - * keyword list. As with the function list, a keyword is accepted - * if the list is null, otherwise it must match one of the list - * members. When debugging is not on, no keywords are accepted. - * After the maximum trace level is exceeded, no keywords are - * accepted (this behavior subject to change). Additionally, - * the current function and process must be accepted based on - * their respective lists. + * Test a keyword to determine if it is in the currently active + * keyword list. As with the function list, a keyword is accepted + * if the list is null, otherwise it must match one of the list + * members. When debugging is not on, no keywords are accepted. + * After the maximum trace level is exceeded, no keywords are + * accepted (this behavior subject to change). Additionally, + * the current function and process must be accepted based on + * their respective lists. * - * Returns TRUE if keyword accepted, FALSE otherwise. + * Returns TRUE if keyword accepted, FALSE otherwise. * */ -BOOLEAN _db_keyword_ ( -const char *keyword) +BOOLEAN _db_keyword_(CODE_STATE *cs, const char *keyword) { - REGISTER BOOLEAN result; - CODE_STATE *state; + get_code_state_or_return FALSE; - if (!init_done) - _db_push_ (""); - /* Sasha: pre-my_thread_init() safety */ - if (!(state=code_state())) - return FALSE; - result = FALSE; - if (DEBUGGING && !state->disable_output && - state->level <= stack -> maxdepth && - InList (stack -> functions, state->func) && - InList (stack -> keywords, keyword) && - InList (stack -> processes, _db_process_)) - result = TRUE; - return (result); + return (DEBUGGING && + (!TRACING || cs->level <= cs->stack->maxdepth) && + InList(cs->stack->functions, cs->func) && + InList(cs->stack->keywords, keyword) && + InList(cs->stack->processes, cs->process)); } /* * FUNCTION * - * Indent indent a line to the given indentation level + * Indent indent a line to the given indentation level * * SYNOPSIS * - * static VOID Indent (indent) - * int indent; + * static VOID Indent(indent) + * int indent; * * DESCRIPTION * - * Indent a line to the given level. Note that this is - * a simple minded but portable implementation. - * There are better ways. + * Indent a line to the given level. Note that this is + * a simple minded but portable implementation. + * There are better ways. * - * Also, the indent must be scaled by the compile time option - * of character positions per nesting level. + * Also, the indent must be scaled by the compile time option + * of character positions per nesting level. * */ -static void Indent ( -int indent) +static void Indent(CODE_STATE *cs, int indent) { REGISTER int count; - indent= max(indent-1-stack->sub_level,0)*INDENT; - for (count = 0; count < indent ; count++) + indent= max(indent-1-cs->stack->sub_level,0)*INDENT; + for (count= 0; count < indent ; count++) { if ((count % INDENT) == 0) - fputc('|',_db_fp_); + fputc('|',cs->stack->out_file); else - fputc(' ',_db_fp_); + fputc(' ',cs->stack->out_file); } } @@ -1395,32 +1701,29 @@ int indent) /* * FUNCTION * - * FreeList free all memory associated with a linked list + * FreeList free all memory associated with a linked list * * SYNOPSIS * - * static VOID FreeList (linkp) - * struct link *linkp; + * static VOID FreeList(linkp) + * struct link *linkp; * * DESCRIPTION * - * Given pointer to the head of a linked list, frees all - * memory held by the list and the members of the list. + * Given pointer to the head of a linked list, frees all + * memory held by the list and the members of the list. * */ -static void FreeList ( -struct link *linkp) +static void FreeList(struct link *linkp) { REGISTER struct link *old; - while (linkp != NULL) { - old = linkp; - linkp = linkp -> next_link; - if (old -> str != NULL) { - free (old -> str); - } - free ((char *) old); + while (linkp != NULL) + { + old= linkp; + linkp= linkp->next_link; + free((void*) old); } } @@ -1428,139 +1731,140 @@ struct link *linkp) /* * FUNCTION * - * StrDup make a duplicate of a string in new memory + * DoPrefix print debugger line prefix prior to indentation * * SYNOPSIS * - * static char *StrDup (my_string) - * char *string; + * static VOID DoPrefix(_line_) + * int _line_; * * DESCRIPTION * - * Given pointer to a string, allocates sufficient memory to make - * a duplicate copy, and copies the string to the newly allocated - * memory. Failure to allocated sufficient memory is immediately - * fatal. + * Print prefix common to all debugger output lines, prior to + * doing indentation if necessary. Print such information as + * current process name, current source file name and line number, + * and current function nesting depth. * */ - -static char *StrDup (const char *str) +static void DoPrefix(CODE_STATE *cs, uint _line_) { - reg1 char *new_malloc; - new_malloc = DbugMalloc((size_t) strlen (str) + 1); - (void) strcpy (new_malloc, str); - return (new_malloc); -} - - -/* - * FUNCTION - * - * DoPrefix print debugger line prefix prior to indentation - * - * SYNOPSIS - * - * static VOID DoPrefix (_line_) - * int _line_; - * - * DESCRIPTION - * - * Print prefix common to all debugger output lines, prior to - * doing indentation if necessary. Print such information as - * current process name, current source file name and line number, - * and current function nesting depth. - * - */ - -static void DoPrefix ( -uint _line_) -{ - CODE_STATE *state; - state=code_state(); - - state->lineno++; - if (stack -> flags & PID_ON) { + cs->lineno++; + if (cs->stack->flags & PID_ON) + { #ifdef THREAD - (void) fprintf (_db_fp_, "%-7s: ", my_thread_name()); + (void) fprintf(cs->stack->out_file, "%-7s: ", my_thread_name()); #else - (void) fprintf (_db_fp_, "%5d: ", (int) getpid ()); + (void) fprintf(cs->stack->out_file, "%5d: ", (int) getpid()); #endif } - if (stack -> flags & NUMBER_ON) { - (void) fprintf (_db_fp_, "%5d: ", state->lineno); - } - if (stack -> flags & PROCESS_ON) { - (void) fprintf (_db_fp_, "%s: ", _db_process_); - } - if (stack -> flags & FILE_ON) { - (void) fprintf (_db_fp_, "%14s: ", BaseName(state->file)); - } - if (stack -> flags & LINE_ON) { - (void) fprintf (_db_fp_, "%5d: ", _line_); - } - if (stack -> flags & DEPTH_ON) { - (void) fprintf (_db_fp_, "%4d: ", state->level); + if (cs->stack->flags & NUMBER_ON) + (void) fprintf(cs->stack->out_file, "%5d: ", cs->lineno); + if (cs->stack->flags & TIMESTAMP_ON) + { +#ifdef __WIN__ + /* FIXME This doesn't give microseconds as in Unix case, and the resolution is + in system ticks, 10 ms intervals. See my_getsystime.c for high res */ + SYSTEMTIME loc_t; + GetLocalTime(&loc_t); + (void) fprintf (cs->stack->out_file, + /* "%04d-%02d-%02d " */ + "%02d:%02d:%02d.%06d ", + /*tm_p->tm_year + 1900, tm_p->tm_mon + 1, tm_p->tm_mday,*/ + loc_t.wHour, loc_t.wMinute, loc_t.wSecond, loc_t.wMilliseconds); +#else + struct timeval tv; + struct tm *tm_p; + if (gettimeofday(&tv, NULL) != -1) + { + if ((tm_p= localtime((const time_t *)&tv.tv_sec))) + { + (void) fprintf (cs->stack->out_file, + /* "%04d-%02d-%02d " */ + "%02d:%02d:%02d.%06d ", + /*tm_p->tm_year + 1900, tm_p->tm_mon + 1, tm_p->tm_mday,*/ + tm_p->tm_hour, tm_p->tm_min, tm_p->tm_sec, + (int) (tv.tv_usec)); + } + } +#endif } + if (cs->stack->flags & PROCESS_ON) + (void) fprintf(cs->stack->out_file, "%s: ", cs->process); + if (cs->stack->flags & FILE_ON) + (void) fprintf(cs->stack->out_file, "%14s: ", BaseName(cs->file)); + if (cs->stack->flags & LINE_ON) + (void) fprintf(cs->stack->out_file, "%5d: ", _line_); + if (cs->stack->flags & DEPTH_ON) + (void) fprintf(cs->stack->out_file, "%4d: ", cs->level); } /* * FUNCTION * - * DBUGOpenFile open new output stream for debugger output + * DBUGOpenFile open new output stream for debugger output * * SYNOPSIS * - * static VOID DBUGOpenFile (name) - * char *name; + * static VOID DBUGOpenFile(name) + * char *name; * * DESCRIPTION * - * Given name of a new file (or "-" for stdout) opens the file - * and sets the output stream to the new file. + * Given name of a new file (or "-" for stdout) opens the file + * and sets the output stream to the new file. * */ -static void DBUGOpenFile (const char *name,int append) +static void DBUGOpenFile(CODE_STATE *cs, + const char *name,const char *end,int append) { REGISTER FILE *fp; REGISTER BOOLEAN newfile; if (name != NULL) { - strmov(stack->name,name); - if (strcmp (name, "-") == 0) + if (end) { - _db_fp_ = stdout; - stack -> out_file = _db_fp_; - stack -> flags |= FLUSH_ON_WRITE; + int len=end-name; + memcpy(cs->stack->name, name, len); + cs->stack->name[len]=0; } else + strmov(cs->stack->name,name); + name=cs->stack->name; + if (strcmp(name, "-") == 0) { - if (!Writable((char*)name)) + cs->stack->out_file= stdout; + cs->stack->flags |= FLUSH_ON_WRITE; + cs->stack->name[0]=0; + } + else + { + if (!Writable(name)) { - (void) fprintf (stderr, ERR_OPEN, _db_process_, name); - perror (""); - fflush(stderr); + (void) fprintf(stderr, ERR_OPEN, cs->process, name); + perror(""); + fflush(stderr); } else { - newfile= !EXISTS (name); - if (!(fp = fopen(name, append ? "a+" : "w"))) - { - (void) fprintf (stderr, ERR_OPEN, _db_process_, name); - perror (""); - fflush(stderr); - } - else - { - _db_fp_ = fp; - stack -> out_file = fp; - if (newfile) { - ChangeOwner (name); - } - } + newfile= !EXISTS(name); + if (!(fp= fopen(name, append ? "a+" : "w"))) + { + (void) fprintf(stderr, ERR_OPEN, cs->process, name); + perror(""); + fflush(stderr); + } + else + { + cs->stack->out_file= fp; + if (newfile) + { + ChangeOwner(cs, name); + } + } } } } @@ -1570,59 +1874,56 @@ static void DBUGOpenFile (const char *name,int append) /* * FUNCTION * - * OpenProfile open new output stream for profiler output + * OpenProfile open new output stream for profiler output * * SYNOPSIS * - * static FILE *OpenProfile (name) - * char *name; + * static FILE *OpenProfile(name) + * char *name; * * DESCRIPTION * - * Given name of a new file, opens the file - * and sets the profiler output stream to the new file. - * - * It is currently unclear whether the prefered behavior is - * to truncate any existing file, or simply append to it. - * The latter behavior would be desirable for collecting - * accumulated runtime history over a number of separate - * runs. It might take some changes to the analyzer program - * though, and the notes that Binayak sent with the profiling - * diffs indicated that append was the normal mode, but this - * does not appear to agree with the actual code. I haven't - * investigated at this time [fnf; 24-Jul-87]. + * Given name of a new file, opens the file + * and sets the profiler output stream to the new file. + * + * It is currently unclear whether the prefered behavior is + * to truncate any existing file, or simply append to it. + * The latter behavior would be desirable for collecting + * accumulated runtime history over a number of separate + * runs. It might take some changes to the analyzer program + * though, and the notes that Binayak sent with the profiling + * diffs indicated that append was the normal mode, but this + * does not appear to agree with the actual code. I haven't + * investigated at this time [fnf; 24-Jul-87]. */ #ifndef THREAD -static FILE *OpenProfile (const char *name) +static FILE *OpenProfile(CODE_STATE *cs, const char *name) { REGISTER FILE *fp; REGISTER BOOLEAN newfile; fp=0; - if (!Writable (name)) + if (!Writable(name)) { - (void) fprintf (_db_fp_, ERR_OPEN, _db_process_, name); - perror (""); - dbug_flush(0); - (void) Delay (stack -> delay); + (void) fprintf(cs->stack->out_file, ERR_OPEN, cs->process, name); + perror(""); + (void) Delay(cs->stack->delay); } else { - newfile= !EXISTS (name); - if (!(fp = fopen (name, "w"))) + newfile= !EXISTS(name); + if (!(fp= fopen(name, "w"))) { - (void) fprintf (_db_fp_, ERR_OPEN, _db_process_, name); - perror (""); - dbug_flush(0); + (void) fprintf(cs->stack->out_file, ERR_OPEN, cs->process, name); + perror(""); } else { - _db_pfp_ = fp; - stack -> prof_file = fp; + cs->stack->prof_file= fp; if (newfile) { - ChangeOwner (name); + ChangeOwner(cs, name); } } } @@ -1633,30 +1934,28 @@ static FILE *OpenProfile (const char *name) /* * FUNCTION * - * CloseFile close the debug output stream + * DBUGCloseFile close the debug output stream * * SYNOPSIS * - * static VOID CloseFile (fp) - * FILE *fp; + * static VOID DBUGCloseFile(fp) + * FILE *fp; * * DESCRIPTION * - * Closes the debug output stream unless it is standard output - * or standard error. + * Closes the debug output stream unless it is standard output + * or standard error. * */ -static void CloseFile ( -FILE *fp) +static void DBUGCloseFile(CODE_STATE *cs, FILE *fp) { - if (fp != stderr && fp != stdout) { - if (fclose (fp) == EOF) { - pthread_mutex_lock(&THR_LOCK_dbug); - (void) fprintf (_db_fp_, ERR_CLOSE, _db_process_); - perror (""); - dbug_flush(0); - } + if (fp != stderr && fp != stdout && fclose(fp) == EOF) + { + pthread_mutex_lock(&THR_LOCK_dbug); + (void) fprintf(cs->stack->out_file, ERR_CLOSE, cs->process); + perror(""); + dbug_flush(cs); } } @@ -1664,176 +1963,154 @@ FILE *fp) /* * FUNCTION * - * DbugExit print error message and exit + * DbugExit print error message and exit * * SYNOPSIS * - * static VOID DbugExit (why) - * char *why; + * static VOID DbugExit(why) + * char *why; * * DESCRIPTION * - * Prints error message using current process name, the reason for - * aborting (typically out of memory), and exits with status 1. - * This should probably be changed to use a status code - * defined in the user's debugger include file. + * Prints error message using current process name, the reason for + * aborting (typically out of memory), and exits with status 1. + * This should probably be changed to use a status code + * defined in the user's debugger include file. * */ -static void DbugExit (const char *why) +static void DbugExit(const char *why) { - (void) fprintf (stderr, ERR_ABORT, _db_process_, why); - (void) fflush (stderr); - exit (1); + CODE_STATE *cs=code_state(); + (void) fprintf(stderr, ERR_ABORT, cs ? cs->process : "(null)", why); + (void) fflush(stderr); + exit(1); } /* * FUNCTION * - * DbugMalloc allocate memory for debugger runtime support + * DbugMalloc allocate memory for debugger runtime support * * SYNOPSIS * - * static long *DbugMalloc (size) - * int size; + * static long *DbugMalloc(size) + * int size; * * DESCRIPTION * - * Allocate more memory for debugger runtime support functions. - * Failure to to allocate the requested number of bytes is - * immediately fatal to the current process. This may be - * rather unfriendly behavior. It might be better to simply - * print a warning message, freeze the current debugger state, - * and continue execution. + * Allocate more memory for debugger runtime support functions. + * Failure to to allocate the requested number of bytes is + * immediately fatal to the current process. This may be + * rather unfriendly behavior. It might be better to simply + * print a warning message, freeze the current debugger cs, + * and continue execution. * */ -static char *DbugMalloc (size_t size) +static char *DbugMalloc(size_t size) { register char *new_malloc; - if (!(new_malloc = (char*) malloc((size_t) size))) - DbugExit ("out of memory"); - return (new_malloc); + if (!(new_malloc= (char*) malloc(size))) + DbugExit("out of memory"); + return new_malloc; } /* - * As strtok but two separators in a row are changed to one - * separator (to allow directory-paths in dos). + * strtok lookalike - splits on ':', magically handles ::, :\ and :/ */ -static char *static_strtok (char *s1, pchar separator) +static const char *DbugStrTok(const char *s) { - static char *end = NULL; - reg1 char *rtnval,*cpy; - - rtnval = NULL; - if (s1 != NULL) - end = s1; - if (end != NULL && *end != EOS) - { - rtnval=cpy=end; - do - { - if ((*cpy++ = *end++) == separator) - { - if (*end != separator) - { - cpy--; /* Point at separator */ - break; - } - end++; /* Two separators in a row, skip one */ - } - } while (*end != EOS); - *cpy=EOS; /* Replace last separator */ - } - return (rtnval); + while (s[0] && (s[0] != ':' || + (s[1] == '\\' || s[1] == '/' || (s[1] == ':' && s++)))) + s++; + return s; } /* * FUNCTION * - * BaseName strip leading pathname components from name + * BaseName strip leading pathname components from name * * SYNOPSIS * - * static char *BaseName (pathname) - * char *pathname; + * static char *BaseName(pathname) + * char *pathname; * * DESCRIPTION * - * Given pointer to a complete pathname, locates the base file - * name at the end of the pathname and returns a pointer to - * it. + * Given pointer to a complete pathname, locates the base file + * name at the end of the pathname and returns a pointer to + * it. * */ -static char *BaseName (const char *pathname) +static const char *BaseName(const char *pathname) { register const char *base; - base = strrchr (pathname, FN_LIBCHAR); + base= strrchr(pathname, FN_LIBCHAR); if (base++ == NullS) - base = pathname; - return ((char*) base); + base= pathname; + return base; } /* * FUNCTION * - * Writable test to see if a pathname is writable/creatable + * Writable test to see if a pathname is writable/creatable * * SYNOPSIS * - * static BOOLEAN Writable (pathname) - * char *pathname; + * static BOOLEAN Writable(pathname) + * char *pathname; * * DESCRIPTION * - * Because the debugger might be linked in with a program that - * runs with the set-uid-bit (suid) set, we have to be careful - * about opening a user named file for debug output. This consists - * of checking the file for write access with the real user id, - * or checking the directory where the file will be created. + * Because the debugger might be linked in with a program that + * runs with the set-uid-bit (suid) set, we have to be careful + * about opening a user named file for debug output. This consists + * of checking the file for write access with the real user id, + * or checking the directory where the file will be created. * - * Returns TRUE if the user would normally be allowed write or - * create access to the named file. Returns FALSE otherwise. + * Returns TRUE if the user would normally be allowed write or + * create access to the named file. Returns FALSE otherwise. * */ #ifndef Writable -static BOOLEAN Writable ( -char *pathname) +static BOOLEAN Writable(const char *pathname) { REGISTER BOOLEAN granted; REGISTER char *lastslash; - granted = FALSE; - if (EXISTS (pathname)) { - if (WRITABLE (pathname)) { - granted = TRUE; - } - } else { - lastslash = strrchr (pathname, '/'); - if (lastslash != NULL) { - *lastslash = EOS; - } else { - pathname = "."; - } - if (WRITABLE (pathname)) { - granted = TRUE; - } - if (lastslash != NULL) { - *lastslash = '/'; - } + granted= FALSE; + if (EXISTS(pathname)) + { + if (WRITABLE(pathname)) + granted= TRUE; } - return (granted); + else + { + lastslash= strrchr(pathname, '/'); + if (lastslash != NULL) + *lastslash= '\0'; + else + pathname= "."; + if (WRITABLE(pathname)) + granted= TRUE; + if (lastslash != NULL) + *lastslash= '/'; + } + return granted; } #endif @@ -1841,35 +2118,34 @@ char *pathname) /* * FUNCTION * - * ChangeOwner change owner to real user for suid programs + * ChangeOwner change owner to real user for suid programs * * SYNOPSIS * - * static VOID ChangeOwner (pathname) + * static VOID ChangeOwner(pathname) * * DESCRIPTION * - * For unix systems, change the owner of the newly created debug - * file to the real owner. This is strictly for the benefit of - * programs that are running with the set-user-id bit set. + * For unix systems, change the owner of the newly created debug + * file to the real owner. This is strictly for the benefit of + * programs that are running with the set-user-id bit set. * - * Note that at this point, the fact that pathname represents - * a newly created file has already been established. If the - * program that the debugger is linked to is not running with - * the suid bit set, then this operation is redundant (but - * harmless). + * Note that at this point, the fact that pathname represents + * a newly created file has already been established. If the + * program that the debugger is linked to is not running with + * the suid bit set, then this operation is redundant (but + * harmless). * */ #ifndef ChangeOwner -static void ChangeOwner ( -char *pathname) +static void ChangeOwner(CODE_STATE *cs, char *pathname) { - if (chown (pathname, getuid (), getgid ()) == -1) + if (chown(pathname, getuid(), getgid()) == -1) { - (void) fprintf (stderr, ERR_CHOWN, _db_process_, pathname); - perror (""); - (void) fflush (stderr); + (void) fprintf(stderr, ERR_CHOWN, cs->process, pathname); + perror(""); + (void) fflush(stderr); } } #endif @@ -1878,205 +2154,130 @@ char *pathname) /* * FUNCTION * - * _db_setjmp_ save debugger environment + * _db_setjmp_ save debugger environment * * SYNOPSIS * - * VOID _db_setjmp_ () + * VOID _db_setjmp_() * * DESCRIPTION * - * Invoked as part of the user's DBUG_SETJMP macro to save - * the debugger environment in parallel with saving the user's - * environment. + * Invoked as part of the user's DBUG_SETJMP macro to save + * the debugger environment in parallel with saving the user's + * environment. * */ #ifdef HAVE_LONGJMP -EXPORT void _db_setjmp_ () -{ - CODE_STATE *state; - state=code_state(); - - state->jmplevel = state->level; - state->jmpfunc = state->func; - state->jmpfile = state->file; -} - -/* - * FUNCTION - * - * _db_longjmp_ restore previously saved debugger environment - * - * SYNOPSIS - * - * VOID _db_longjmp_ () - * - * DESCRIPTION - * - * Invoked as part of the user's DBUG_LONGJMP macro to restore - * the debugger environment in parallel with restoring the user's - * previously saved environment. - * - */ - -EXPORT void _db_longjmp_ () +EXPORT void _db_setjmp_() { - CODE_STATE *state; - state=code_state(); + CODE_STATE *cs=0; + get_code_state_or_return; - state->level = state->jmplevel; - if (state->jmpfunc) { - state->func = state->jmpfunc; - } - if (state->jmpfile) { - state->file = state->jmpfile; - } + cs->jmplevel= cs->level; + cs->jmpfunc= cs->func; + cs->jmpfile= cs->file; } -#endif /* * FUNCTION * - * DelayArg convert D flag argument to appropriate value + * _db_longjmp_ restore previously saved debugger environment * * SYNOPSIS * - * static int DelayArg (value) - * int value; + * VOID _db_longjmp_() * * DESCRIPTION * - * Converts delay argument, given in tenths of a second, to the - * appropriate numerical argument used by the system to delay - * that that many tenths of a second. For example, on the - * amiga, there is a system call "Delay()" which takes an - * argument in ticks (50 per second). On unix, the sleep - * command takes seconds. Thus a value of "10", for one - * second of delay, gets converted to 50 on the amiga, and 1 - * on unix. Other systems will need to use a timing loop. + * Invoked as part of the user's DBUG_LONGJMP macro to restore + * the debugger environment in parallel with restoring the user's + * previously saved environment. * */ -#ifdef AMIGA -#define HZ (50) /* Probably in some header somewhere */ -#endif - -static int DelayArg ( -int value) +EXPORT void _db_longjmp_() { - uint delayarg = 0; - -#if (unix || xenix) - delayarg = value / 10; /* Delay is in seconds for sleep () */ -#endif -#ifdef AMIGA - delayarg = (HZ * value) / 10; /* Delay in ticks for Delay () */ -#endif - return (delayarg); -} - - -/* - * A dummy delay stub for systems that do not support delays. - * With a little work, this can be turned into a timing loop. - */ - -#if ! defined(Delay) && ! defined(AMIGA) -static int Delay ( -int ticks) -{ - return ticks; + CODE_STATE *cs=0; + get_code_state_or_return; + + cs->level= cs->jmplevel; + if (cs->jmpfunc) + cs->func= cs->jmpfunc; + if (cs->jmpfile) + cs->file= cs->jmpfile; } #endif - /* * FUNCTION * - * perror perror simulation for systems that don't have it + * perror perror simulation for systems that don't have it * * SYNOPSIS * - * static VOID perror (s) - * char *s; + * static VOID perror(s) + * char *s; * * DESCRIPTION * - * Perror produces a message on the standard error stream which - * provides more information about the library or system error - * just encountered. The argument string s is printed, followed - * by a ':', a blank, and then a message and a newline. + * Perror produces a message on the standard error stream which + * provides more information about the library or system error + * just encountered. The argument string s is printed, followed + * by a ':', a blank, and then a message and a newline. * - * An undocumented feature of the unix perror is that if the string - * 's' is a null string (NOT a NULL pointer!), then the ':' and - * blank are not printed. + * An undocumented feature of the unix perror is that if the string + * 's' is a null string (NOT a NULL pointer!), then the ':' and + * blank are not printed. * - * This version just complains about an "unknown system error". + * This version just complains about an "unknown system error". * */ #ifndef HAVE_PERROR -static void perror (s) +static void perror(s) char *s; { - if (s && *s != EOS) { - (void) fprintf (stderr, "%s: ", s); - } - (void) fprintf (stderr, "<unknown system error>\n"); + if (s && *s != '\0') + (void) fprintf(stderr, "%s: ", s); + (void) fprintf(stderr, "<unknown system error>\n"); } #endif /* HAVE_PERROR */ - /* flush dbug-stream, free mutex lock & wait delay */ - /* This is because some systems (MSDOS!!) dosn't flush fileheader */ - /* and dbug-file isn't readable after a system crash !! */ + /* flush dbug-stream, free mutex lock & wait delay */ + /* This is because some systems (MSDOS!!) dosn't flush fileheader */ + /* and dbug-file isn't readable after a system crash !! */ -static void dbug_flush(CODE_STATE *state) +static void dbug_flush(CODE_STATE *cs) { #ifndef THREAD - if (stack->flags & FLUSH_ON_WRITE) + if (cs->stack->flags & FLUSH_ON_WRITE) #endif { -#if defined(MSDOS) || defined(__WIN__) - if (_db_fp_ != stdout && _db_fp_ != stderr) - { - if (!(freopen(stack->name,"a",_db_fp_))) - { - (void) fprintf(stderr, ERR_OPEN, _db_process_, stack->name); - fflush(stderr); - _db_fp_ = stdout; - stack -> out_file = _db_fp_; - stack -> flags|=FLUSH_ON_WRITE; - } - } - else -#endif - { - (void) fflush (_db_fp_); - if (stack->delay) - (void) Delay (stack->delay); - } + (void) fflush(cs->stack->out_file); + if (cs->stack->delay) + (void) Delay(cs->stack->delay); } - if (!state || !state->locked) + if (!cs->locked) pthread_mutex_unlock(&THR_LOCK_dbug); } /* dbug_flush */ -void _db_lock_file() +void _db_lock_file_() { - CODE_STATE *state; - state=code_state(); + CODE_STATE *cs=0; + get_code_state_or_return; pthread_mutex_lock(&THR_LOCK_dbug); - state->locked=1; + cs->locked=1; } -void _db_unlock_file() +void _db_unlock_file_() { - CODE_STATE *state; - state=code_state(); - state->locked=0; + CODE_STATE *cs=0; + get_code_state_or_return; + cs->locked=0; pthread_mutex_unlock(&THR_LOCK_dbug); } @@ -2098,57 +2299,59 @@ void _db_unlock_file() * far. */ -static unsigned long Clock () +static unsigned long Clock() { struct rusage ru; - (void) getrusage (RUSAGE_SELF, &ru); - return ((ru.ru_utime.tv_sec * 1000) + (ru.ru_utime.tv_usec / 1000)); + (void) getrusage(RUSAGE_SELF, &ru); + return ru.ru_utime.tv_sec*1000 + ru.ru_utime.tv_usec/1000; } -#elif defined(MSDOS) || defined(__WIN__) || defined(OS2) +#elif defined(MSDOS) || defined(__WIN__) static ulong Clock() { return clock()*(1000/CLOCKS_PER_SEC); } -#elif defined (amiga) +#elif defined(amiga) -struct DateStamp { /* Yes, this is a hack, but doing it right */ - long ds_Days; /* is incredibly ugly without splitting this */ - long ds_Minute; /* off into a separate file */ - long ds_Tick; +struct DateStamp { /* Yes, this is a hack, but doing it right */ + long ds_Days; /* is incredibly ugly without splitting this */ + long ds_Minute; /* off into a separate file */ + long ds_Tick; }; -static int first_clock = TRUE; +static int first_clock= TRUE; static struct DateStamp begin; static struct DateStamp elapsed; -static unsigned long Clock () +static unsigned long Clock() { register struct DateStamp *now; - register unsigned long millisec = 0; - extern VOID *AllocMem (); - - now = (struct DateStamp *) AllocMem ((long) sizeof (struct DateStamp), 0L); - if (now != NULL) { - if (first_clock == TRUE) { - first_clock = FALSE; - (void) DateStamp (now); - begin = *now; - } - (void) DateStamp (now); - millisec = 24 * 3600 * (1000 / HZ) * (now -> ds_Days - begin.ds_Days); - millisec += 60 * (1000 / HZ) * (now -> ds_Minute - begin.ds_Minute); - millisec += (1000 / HZ) * (now -> ds_Tick - begin.ds_Tick); - (void) FreeMem (now, (long) sizeof (struct DateStamp)); + register unsigned long millisec= 0; + extern VOID *AllocMem(); + + now= (struct DateStamp *) AllocMem((long) sizeof(struct DateStamp), 0L); + if (now != NULL) + { + if (first_clock == TRUE) + { + first_clock= FALSE; + (void) DateStamp(now); + begin= *now; + } + (void) DateStamp(now); + millisec= 24 * 3600 * (1000 / HZ) * (now->ds_Days - begin.ds_Days); + millisec += 60 * (1000 / HZ) * (now->ds_Minute - begin.ds_Minute); + millisec += (1000 / HZ) * (now->ds_Tick - begin.ds_Tick); + (void) FreeMem(now, (long) sizeof(struct DateStamp)); } - return (millisec); + return millisec; } #else -static unsigned long Clock () +static unsigned long Clock() { - return (0); + return 0; } #endif /* RUSAGE */ #endif /* THREADS */ @@ -2156,11 +2359,11 @@ static unsigned long Clock () #ifdef NO_VARARGS /* - * Fake vfprintf for systems that don't support it. If this - * doesn't work, you are probably SOL... + * Fake vfprintf for systems that don't support it. If this + * doesn't work, you are probably SOL... */ -static int vfprintf (stream, format, ap) +static int vfprintf(stream, format, ap) FILE *stream; char *format; va_list ap; @@ -2168,18 +2371,34 @@ va_list ap; int rtnval; ARGS_DCL; - ARG0 = va_arg (ap, ARGS_TYPE); - ARG1 = va_arg (ap, ARGS_TYPE); - ARG2 = va_arg (ap, ARGS_TYPE); - ARG3 = va_arg (ap, ARGS_TYPE); - ARG4 = va_arg (ap, ARGS_TYPE); - ARG5 = va_arg (ap, ARGS_TYPE); - ARG6 = va_arg (ap, ARGS_TYPE); - ARG7 = va_arg (ap, ARGS_TYPE); - ARG8 = va_arg (ap, ARGS_TYPE); - ARG9 = va_arg (ap, ARGS_TYPE); - rtnval = fprintf (stream, format, ARGS_LIST); - return (rtnval); + ARG0= va_arg(ap, ARGS_TYPE); + ARG1= va_arg(ap, ARGS_TYPE); + ARG2= va_arg(ap, ARGS_TYPE); + ARG3= va_arg(ap, ARGS_TYPE); + ARG4= va_arg(ap, ARGS_TYPE); + ARG5= va_arg(ap, ARGS_TYPE); + ARG6= va_arg(ap, ARGS_TYPE); + ARG7= va_arg(ap, ARGS_TYPE); + ARG8= va_arg(ap, ARGS_TYPE); + ARG9= va_arg(ap, ARGS_TYPE); + rtnval= fprintf(stream, format, ARGS_LIST); + return rtnval; } -#endif /* NO_VARARGS */ +#endif /* NO_VARARGS */ + +#else + +/* + * Dummy function, workaround for MySQL bug#14420 related + * build failure on a platform where linking with an empty + * archive fails. + * + * This block can be removed as soon as a fix for bug#14420 + * is implemented. + */ +int i_am_a_dummy_function() { + return 0; +} + +#endif diff --git a/dbug/factorial.c b/dbug/factorial.c index 56197aef29e..7b190ea8d8e 100644 --- a/dbug/factorial.c +++ b/dbug/factorial.c @@ -1,6 +1,13 @@ #ifdef DBUG_OFF /* We are testing dbug */ -#undef DBUG_OFF -#endif + +int factorial(register int value) { + if(value > 1) { + value *= factorial(value-1); + } + return value; +} + +#else #include <my_global.h> @@ -15,3 +22,6 @@ register int value) DBUG_PRINT ("result", ("result is %d", value)); DBUG_RETURN (value); } + +#endif + diff --git a/dbug/user.r b/dbug/user.r index 198f88cf272..19de840d0ad 100644 --- a/dbug/user.r +++ b/dbug/user.r @@ -672,52 +672,26 @@ from the standard include directory. .SP 2 .BL 20 .LI DBUG_ENTER\ -Used to tell the runtime support module the name of the function -being entered. -The argument must be of type "pointer to character". -The -DBUG_ENTER -macro must precede all executable lines in the -function just entered, and must come after all local declarations. -Each -DBUG_ENTER -macro must have a matching -DBUG_RETURN -or -DBUG_VOID_RETURN -macro -at the function exit points. -DBUG_ENTER -macros used without a matching -DBUG_RETURN -or -DBUG_VOID_RETURN -macro -will cause warning messages from the +Used to tell the runtime support module the name of the function being +entered. The argument must be of type "pointer to character". The +DBUG_ENTER macro must precede all executable lines in the function +just entered, and must come after all local declarations. Each +DBUG_ENTER macro must have a matching DBUG_RETURN or DBUG_VOID_RETURN +macro at the function exit points. DBUG_ENTER macros used without a +matching DBUG_RETURN or DBUG_VOID_RETURN macro will cause warning +messages from the .I dbug package runtime support module. .SP 1 EX:\ \fCDBUG_ENTER\ ("main");\fR .SP 1 .LI DBUG_RETURN\ -Used at each exit point of a function containing a -DBUG_ENTER -macro -at the entry point. -The argument is the value to return. -Functions which return no value (void) should use the -DBUG_VOID_RETURN -macro. -It -is an error to have a -DBUG_RETURN -or -DBUG_VOID_RETURN -macro in a function -which has no matching -DBUG_ENTER -macro, and the compiler will complain -if the macros are actually used (expanded). +Used at each exit point of a function containing a DBUG_ENTER macro at +the entry point. The argument is the value to return. Functions +which return no value (void) should use the DBUG_VOID_RETURN macro. +It is an error to have a DBUG_RETURN or DBUG_VOID_RETURN macro in a +function which has no matching DBUG_ENTER macro, and the compiler will +complain if the macros are actually used (expanded). .SP 1 EX:\ \fCDBUG_RETURN\ (value);\fR .br @@ -727,24 +701,20 @@ EX:\ \fCDBUG_VOID_RETURN;\fR Used to name the current process being executed. A typical argument for this macro is "argv[0]", though it will be perfectly happy with any other string. +Im multi-threaded environment threads may have different names. .SP 1 EX:\ \fCDBUG_PROCESS\ (argv[0]);\fR .SP 1 .LI DBUG_PUSH\ Sets a new debugger state by pushing the current .B dbug -state onto an -internal stack and setting up the new state using the debug control -string passed as the macro argument. -The most common usage is to set the state specified by a debug -control string retrieved from the argument list. -Note that the leading "-#" in a debug control string specified -as a command line argument must -.B not -be passed as part of the macro argument. -The proper usage is to pass a pointer to the first character -.B after -the "-#" string. +state onto an internal stack and setting up the new state using the +debug control string passed as the macro argument. The most common +usage is to set the state specified by a debug control string +retrieved from the argument list. If the control string is +.I incremental, +the new state is a copy of the old state, modified by the control +string. .SP 1 EX:\ \fCDBUG_PUSH\ (\&(argv[i][2]));\fR .br @@ -755,32 +725,38 @@ EX:\ \fCDBUG_PUSH\ ("");\fR .LI DBUG_POP\ Restores the previous debugger state by popping the state stack. Attempting to pop more states than pushed will be ignored and no -warning will be given. -The -DBUG_POP -macro has no arguments. +warning will be given. The DBUG_POP macro has no arguments. .SP 1 EX:\ \fCDBUG_POP\ ();\fR .SP 1 +.LI DBUG_SET\ +Modifies the current debugger state on top of the stack or pushes +a new state if the current is set to the initial settings, using +the debug control string passed as the macro argument. Unless +.I incremental +control string is used (see below), it's equivalent to a combination of +DBUG_POP and DBUG_PUSH. +.SP 1 +EX:\ \fCDBUG_SET\ ("d:t");\fR +.br +EX:\ \fCDBUG_SET\ ("+d,info");\fR +.br +EX:\ \fCDBUG_SET\ ("+t:-d");\fR +.SP 1 .LI DBUG_FILE\ -The -DBUG_FILE -macro is used to do explicit I/O on the debug output -stream. -It is used in the same manner as the symbols "stdout" and "stderr" -in the standard I/O package. +The DBUG_FILE macro is used to do explicit I/O on the debug output +stream. It is used in the same manner as the symbols "stdout" and +"stderr" in the standard I/O package. .SP 1 EX:\ \fCfprintf\ (DBUG_FILE,\ "Doing\ my\ own\ I/O!\\n");\fR .SP 1 .LI DBUG_EXECUTE\ -The DBUG_EXECUTE macro is used to execute any arbitrary C code. -The first argument is the debug keyword, used to trigger execution -of the code specified as the second argument. -This macro must be used cautiously because, like the -DBUG_PRINT -macro, -it is automatically selected by default whenever the 'd' flag has -no argument list (i.e., a "-#d:t" control string). +The DBUG_EXECUTE macro is used to execute any arbitrary C code. The +first argument is the debug keyword, used to trigger execution of the +code specified as the second argument. This macro must be used +cautiously because, like the DBUG_PRINT macro, it is automatically +selected by default whenever the 'd' flag has no argument list (i.e., +a "-#d:t" control string). .SP 1 EX:\ \fCDBUG_EXECUTE\ ("status",\ print_status\ ());\fR .SP 1 @@ -794,17 +770,40 @@ artificial delay checking for race conditions. .SP 1 EX:\ \fCDBUG_EXECUTE_IF\ ("crashme",\ abort\ ());\fR .SP 1 -.LI DBUG_N\ -These macros, where N is in the range 2-5, are currently obsolete -and will be removed in a future release. -Use the new DBUG_PRINT macro. +.LI DBUG_EVALUATE\ +The DBUG_EVALUATE macro is similar to DBUG_EXECUTE, but it can be used in +the expression context. The first argument is the debug keyword that is used to +choose whether the second (keyword is enabled) or the third (keyword is not +enabled) argument is evaluated. When +.B dbug +is compiled off, the third argument is evaluated. +.SP 1 +EX:\fC +.br + printf("Info-debug is %s", +.br + DBUG_EVALUATE\ ("info", "ON", "OFF"));\fR +.SP 1 +.LI DBUG_EVALUATE_IF\ +Works like DBUG_EVALUATE macro, but the second argument is +.B not +evaluated, if the keyword is not explicitly listed in +the 'd' flag. Like DBUG_EXECUTE_IF this could be used to conditionally execute +"dangerous" actions. +.SP 1 +EX:\fC +.br + if (prepare_transaction () || +.br + DBUG_EVALUATE ("crashme", (abort (), 0), 0) || +.br + commit_transaction () )\fR +.SP 1 .LI DBUG_PRINT\ -Used to do printing via the "fprintf" library function on the -current debug stream, -DBUG_FILE. -The first argument is a debug keyword, the second is a format string -and the corresponding argument list. -Note that the format string and argument list are all one macro argument +Used to do printing via the "fprintf" library function on the current +debug stream, DBUG_FILE. The first argument is a debug keyword, the +second is a format string and the corresponding argument list. Note +that the format string and argument list are all one macro argument and .B must be enclosed in parentheses. @@ -816,10 +815,10 @@ EX:\ \fCDBUG_PRINT\ ("type",\ ("type\ is\ %x", type));\fR EX:\ \fCDBUG_PRINT\ ("stp",\ ("%x\ ->\ %s", stp, stp\ ->\ name));\fR .SP 1 .LI DBUG_DUMP\ -Used to dump a memory block in hex via the "fprintf" library function on the -current debug stream, DBUG_FILE. -The first argument is a debug keyword, the second is a pointer to -a memory to dump, the third is a number of bytes to dump. +Used to dump a memory block in hex via the "fprintf" library function +on the current debug stream, DBUG_FILE. The first argument is a debug +keyword, the second is a pointer to a memory to dump, the third is a +number of bytes to dump. .SP 1 EX: \fCDBUG_DBUG\ ("net",\ packet,\ len);\fR .SP 1 @@ -875,13 +874,28 @@ library. So there will be no need to disable asserts separately with NDEBUG. .SP 1 EX:\ \fCDBUG_ASSERT(\ a\ >\ 0\ );\fR .SP 1 -.LI DBUG_OUTPUT\ -In multi-threaded environment disables (or enables) any -.I dbug -output from the current thread. +.LI DBUG_EXPLAIN\ +Generates control string corresponding to the current debug state. +The macro takes two arguments - a buffer to store the result string +into and its length. The macro (which could be used as a function) +returns 1 if the control string didn't fit into the buffer and was +truncated and 0 otherwise. .SP 1 -EX:\ \fCDBUG_OUTPUT(\ 0\ );\fR +EX:\fC +.br + char buf[256]; +.br + DBUG_EXPLAIN( buf, sizeof(buf) );\fR .SP 1 +.LI DBUG_SET_INITIAL\ +.LI DBUG_EXPLAIN_INITIAL\ +.br +These two macros are identical to DBUG_SET and DBUG_EXPLAIN, but they +operate on the debug state that any new thread starts from. +Modifying +.I initial +value does not affect threads that are already running. Obviously, +these macros are only useful in the multi-threaded environment. .LE .SK @@ -893,42 +907,51 @@ DEBUG CONTROL STRING The debug control string is used to set the state of the debugger via the .B DBUG_PUSH -macro. -This section summarizes the currently available debugger options -and the flag characters which enable or disable them. -Argument lists enclosed in '[' and ']' are optional. +or +.B DBUG_SET +macros. Control string consists of colon separate flags. Colons +that are part of ':\\', ':/', or '::' are not considered flag +separators. A flag may take an argument or a list of arguments. +If a control string starts from a '+' sign it works +.I incrementally, +that is, it can modify existing state without overriding it. In such a +string every flag may be preceded by a '+' or '-' to enable or disable +a corresponding option in the debugger state. This section summarizes +the currently available debugger options and the flag characters which +enable or disable them. Argument lists enclosed in '[' and ']' are +optional. .SP 2 .BL 22 .LI a[,file] -Redirect the debugger output stream and append it to the specified file. -The default output stream is stderr. -A null argument list causes output to be redirected to stdout. -Double the colon, if you want it in the path +Redirect the debugger output stream and append it to the specified +file. The default output stream is stderr. A null argument list +causes output to be redirected to stdout. .SP 1 -EX: \fCa,C::\\tmp\\log\fR +EX: \fCa,C:\\tmp\\log\fR .LI A[,file] Like 'a[,file]' but ensure that data are written after each write (this typically implies flush or close/reopen). It helps to get -a complete log file in case of crashes. This mode is implied in +a complete log file in case of crashes. This mode is implicit in multi-threaded environment. .LI d[,keywords] Enable output from macros with specified keywords. -A null list of keywords implies that all keywords are selected. +An empty list of keywords implies that all keywords are selected. .LI D[,time] Delay for specified time after each output line, to let output drain. Time is given in tenths of a second (value of 10 is one second). Default is zero. .LI f[,functions] Limit debugger actions to the specified list of functions. -A null list of functions implies that all functions are selected. +An empty list of functions implies that all functions are selected. .LI F Mark each debugger output line with the name of the source file containing the macro causing the output. .LI i -Mark each debugger output line with the PID of the current process. +Mark each debugger output line with the PID (or thread ID) of the +current process. .LI g,[functions] Enable profiling for the specified list of functions. -By default profiling is enabled for all functions. +An empty list of functions enables profiling for all functions. See .B PROFILING\ WITH\ DBUG below. @@ -946,20 +969,18 @@ Like 'a[,file]' but overwrite old file, do not append. .LI O[,file] Like 'A[,file]' but overwrite old file, do not append. .LI p[,processes] -Limit debugger actions to the specified processes. -A null list implies all processes. -This is useful for processes which run child processes. -Note that each debugger output line can be marked with the name of -the current process via the 'P' flag. -The process name must match the argument passed to the +Limit debugger actions to the specified processes. An empty list +implies all processes. This is useful for processes which run child +processes. Note that each debugger output line can be marked with the +name of the current process via the 'P' flag. The process name must +match the argument passed to the .B DBUG_PROCESS macro. .LI P Mark each debugger output line with the name of the current process. Most useful when used with a process which runs child processes that -are also being debugged. -Note that the parent process must arrange for the debugger control -string to be passed to the child processes. +are also being debugged. Note that the parent process must arrange +for the debugger control string to be passed to the child processes. .LI r Used in conjunction with the .B DBUG_PUSH @@ -981,7 +1002,59 @@ and Enable function control flow tracing. The maximum nesting depth is specified by N, and defaults to 200. +.LI T +Mark each debugger output line with the current timestamp. +The value is printed with microsecond resolution, as returned by +.I gettimeofday() +system call. The actual resolution is OS- and hardware-dependent. .LE + +.SK +.B +MULTI-THREADED DEBUGGING +.R + +.P +When +.I dbug +is used in a multi-threaded environment there are few differences from a single-threaded +case to keep in mind. This section tries to summarize them. +.SP 2 +.BL 5 +.LI +Every thread has its own stack of debugger states. +.B DBUG_PUSH +and +.B DBUG_POP +affect only the thread that executed them. +.LI +At the bottom of the stack for all threads there is the common +.I initial +state. Changes to this state (for example, with +.B DBUG_SET_INITIAL +macro) affect all new threads and all running threads that didn't +.B DBUG_PUSH +yet. +.LI +Every thread can have its own name, that can be set with +.B DBUG_PROCESS +macro. Thus, "-#p,name1,name2" can be used to limit the output to specific threads. +.LI +When printing directly to +.B DBUG_FILE +it may be necessary to prevent other threads from writing something between two parts +of logically indivisible output. It is done with +.B DBUG_LOCK_FILE +and +.B DBUG_UNLOCK_FILE +macors. See the appropriate section for examples. +.LI +"-#o,file" and "-#O,file" are treated as "-#a,file" and "-#A,file" respectively. That is +all writes to a file are always followed by a flush. +.LI +"-#i" prints not a PID but a thread id in the form of "T@nnn" +.LE + .SK .B PROFILING WITH DBUG diff --git a/extra/charset2html.c b/extra/charset2html.c index 8795c82bc34..8dcfa0c8990 100644 --- a/extra/charset2html.c +++ b/extra/charset2html.c @@ -153,7 +153,9 @@ int main(int argc, char **argv) { my_init(); if (argc > argcnt && argv[argcnt][0] == '-' && argv[argcnt][1] == '#') + { DBUG_PUSH(argv[argcnt++]+2); + } if (argc > argcnt) the_set = argv[argcnt++]; diff --git a/heap/hp_test2.c b/heap/hp_test2.c index 7b756ae10a4..73cad6c2043 100644 --- a/heap/hp_test2.c +++ b/heap/hp_test2.c @@ -617,7 +617,6 @@ err: static int get_options(int argc,char *argv[]) { char *pos,*progname; - DEBUGGER_OFF; progname= argv[0]; @@ -646,7 +645,6 @@ static int get_options(int argc,char *argv[]) printf("Usage: %s [-?ABIKLsWv] [-m#] [-t#]\n",progname); exit(0); case '#': - DEBUGGER_ON; DBUG_PUSH (++pos); break; } diff --git a/include/config-win.h b/include/config-win.h index f3c48510494..59c2d2706e5 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -157,14 +157,12 @@ typedef uint rf_SetTimer; #define Socket_defined #define my_socket SOCKET -#define bool BOOL #define SIGPIPE SIGINT #define RETQSORTTYPE void #define QSORT_TYPE_IS_VOID #define RETSIGTYPE void #define SOCKET_SIZE_TYPE int #define my_socket_defined -#define bool_defined #define byte_defined #define HUGE_PTR #define STDCALL __stdcall /* Used by libmysql.dll */ @@ -406,4 +404,4 @@ inline double ulonglong2double(ulonglong value) #define HAVE_CHARSET_ujis 1 #define HAVE_CHARSET_utf8 1 #define HAVE_UCA_COLLATIONS 1 - +#define HAVE_BOOL 1 diff --git a/include/my_dbug.h b/include/my_dbug.h index 9aa8ef3c197..514cd17099b 100644 --- a/include/my_dbug.h +++ b/include/my_dbug.h @@ -20,15 +20,18 @@ extern "C" { #endif #if !defined(DBUG_OFF) && !defined(_lint) -extern int _db_on_,_no_db_; -extern FILE *_db_fp_; -extern char *_db_process_; -extern int _db_keyword_(const char *keyword); +struct _db_code_state_; +extern int _db_keyword_(struct _db_code_state_ *cs, const char *keyword); extern int _db_strict_keyword_(const char *keyword); +extern int _db_explain_(struct _db_code_state_ *cs, char *buf, size_t len); +extern int _db_explain_init_(char *buf, size_t len); extern void _db_setjmp_(void); extern void _db_longjmp_(void); +extern void _db_process_(const char *name); extern void _db_push_(const char *control); extern void _db_pop_(void); +extern void _db_set_(struct _db_code_state_ *cs, const char *control); +extern void _db_set_init_(const char *control); extern void _db_enter_(const char *_func_,const char *_file_,uint _line_, const char **_sfunc_,const char **_sfile_, uint *_slevel_, char ***); @@ -37,68 +40,73 @@ extern void _db_return_(uint _line_,const char **_sfunc_,const char **_sfile_, extern void _db_pargs_(uint _line_,const char *keyword); extern void _db_doprnt_ _VARARGS((const char *format,...)) ATTRIBUTE_FORMAT(printf, 1, 2); -extern void _db_dump_(uint _line_,const char *keyword,const char *memory, - uint length); -extern void _db_output_(uint flag); +extern void _db_dump_(uint _line_,const char *keyword, + const unsigned char *memory, size_t length); extern void _db_end_(void); -extern void _db_lock_file(void); -extern void _db_unlock_file(void); +extern void _db_lock_file_(void); +extern void _db_unlock_file_(void); +extern FILE *_db_fp_(void); #define DBUG_ENTER(a) const char *_db_func_, *_db_file_; uint _db_level_; \ char **_db_framep_; \ _db_enter_ (a,__FILE__,__LINE__,&_db_func_,&_db_file_,&_db_level_, \ &_db_framep_) #define DBUG_LEAVE \ - (_db_return_ (__LINE__, &_db_func_, &_db_file_, &_db_level_)) + _db_return_ (__LINE__, &_db_func_, &_db_file_, &_db_level_) #define DBUG_RETURN(a1) do {DBUG_LEAVE; return(a1);} while(0) #define DBUG_VOID_RETURN do {DBUG_LEAVE; return;} while(0) #define DBUG_EXECUTE(keyword,a1) \ - do {if (_db_on_) {if (_db_keyword_ (keyword)) { a1 }}} while(0) + do {if (_db_keyword_(0, (keyword))) { a1 }} while(0) +#define DBUG_EXECUTE_IF(keyword,a1) \ + do {if (_db_strict_keyword_ (keyword)) { a1 } } while(0) +#define DBUG_EVALUATE(keyword,a1,a2) \ + (_db_keyword_(0,(keyword)) ? (a1) : (a2)) +#define DBUG_EVALUATE_IF(keyword,a1,a2) \ + (_db_strict_keyword_((keyword)) ? (a1) : (a2)) #define DBUG_PRINT(keyword,arglist) \ - do {if (_db_on_) {_db_pargs_(__LINE__,keyword); _db_doprnt_ arglist;}} while(0) + do {_db_pargs_(__LINE__,keyword); _db_doprnt_ arglist;} while(0) #define DBUG_PUSH(a1) _db_push_ (a1) #define DBUG_POP() _db_pop_ () -#define DBUG_PROCESS(a1) (_db_process_ = a1) -#define DBUG_FILE (_db_fp_) +#define DBUG_SET(a1) _db_set_ (0, (a1)) +#define DBUG_SET_INITIAL(a1) _db_set_init_ (a1) +#define DBUG_PROCESS(a1) _db_process_(a1) +#define DBUG_FILE _db_fp_() #define DBUG_SETJMP(a1) (_db_setjmp_ (), setjmp (a1)) #define DBUG_LONGJMP(a1,a2) (_db_longjmp_ (), longjmp (a1, a2)) -#define DBUG_DUMP(keyword,a1,a2)\ - do {if (_db_on_) {_db_dump_(__LINE__,keyword,a1,a2);}} while(0) -#define DBUG_IN_USE (_db_fp_ && _db_fp_ != stderr) -#define DEBUGGER_OFF _no_db_=1;_db_on_=0; -#define DEBUGGER_ON _no_db_=0 +#define DBUG_DUMP(keyword,a1,a2) _db_dump_(__LINE__,keyword,a1,a2) #define DBUG_END() _db_end_ () -#define DBUG_LOCK_FILE { _db_lock_file(); } -#define DBUG_UNLOCK_FILE { _db_unlock_file(); } -#define DBUG_OUTPUT(A) { _db_output_(A); } +#define DBUG_LOCK_FILE _db_lock_file_() +#define DBUG_UNLOCK_FILE _db_unlock_file_() #define DBUG_ASSERT(A) assert(A) -#define DBUG_EXECUTE_IF(keyword,a1) \ - do {if (_db_on_) {if (_db_strict_keyword_ (keyword)) { a1 }}} while(0) +#define DBUG_EXPLAIN(buf,len) _db_explain_(0, (buf),(len)) +#define DBUG_EXPLAIN_INITIAL(buf,len) _db_explain_init_((buf),(len)) #define IF_DBUG(A) A #else /* No debugger */ #define DBUG_ENTER(a1) -#define DBUG_RETURN(a1) return(a1) -#define DBUG_VOID_RETURN return -#define DBUG_EXECUTE(keyword,a1) {} -#define DBUG_EXECUTE_IF(keyword,a1) {} -#define DBUG_PRINT(keyword,arglist) {} -#define DBUG_PUSH(a1) {} -#define DBUG_POP() {} -#define DBUG_PROCESS(a1) {} -#define DBUG_FILE (stderr) -#define DBUG_SETJMP setjmp -#define DBUG_LONGJMP longjmp -#define DBUG_DUMP(keyword,a1,a2) {} -#define DBUG_IN_USE 0 -#define DEBUGGER_OFF -#define DEBUGGER_ON +#define DBUG_LEAVE +#define DBUG_RETURN(a1) do { return(a1); } while(0) +#define DBUG_VOID_RETURN do { return; } while(0) +#define DBUG_EXECUTE(keyword,a1) do { } while(0) +#define DBUG_EXECUTE_IF(keyword,a1) do { } while(0) +#define DBUG_EVALUATE(keyword,a1,a2) (a2) +#define DBUG_EVALUATE_IF(keyword,a1,a2) (a2) +#define DBUG_PRINT(keyword,arglist) do { } while(0) +#define DBUG_PUSH(a1) +#define DBUG_SET(a1) +#define DBUG_SET_INITIAL(a1) +#define DBUG_POP() +#define DBUG_PROCESS(a1) +#define DBUG_SETJMP(a1) setjmp(a1) +#define DBUG_LONGJMP(a1) longjmp(a1) +#define DBUG_DUMP(keyword,a1,a2) #define DBUG_END() +#define DBUG_ASSERT(A) #define DBUG_LOCK_FILE +#define DBUG_FILE (stderr) #define DBUG_UNLOCK_FILE -#define DBUG_OUTPUT(A) -#define DBUG_ASSERT(A) {} -#define DBUG_LEAVE +#define DBUG_EXPLAIN(buf,len) +#define DBUG_EXPLAIN_INITIAL(buf,len) #define IF_DBUG(A) #endif #ifdef __cplusplus diff --git a/include/my_global.h b/include/my_global.h index f290b690630..e474b620d27 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -533,8 +533,12 @@ C_MODE_END #undef DBUG_OFF #endif -#if defined(_lint) && !defined(DBUG_OFF) -#define DBUG_OFF +/* We might be forced to turn debug off, if not turned off already */ +#if (defined(FORCE_DBUG_OFF) || defined(_lint)) && !defined(DBUG_OFF) +# define DBUG_OFF +# ifdef DBUG_ON +# undef DBUG_ON +# endif #endif #include <my_dbug.h> @@ -980,7 +984,7 @@ typedef int myf; /* Type of MyFlags in my_funcs */ typedef char byte; /* Smallest addressable unit */ #endif typedef char my_bool; /* Small bool */ -#if !defined(bool) && !defined(bool_defined) && (!defined(HAVE_BOOL) || !defined(__cplusplus)) +#if !defined(bool) && (!defined(HAVE_BOOL) || !defined(__cplusplus)) typedef char bool; /* Ordinary boolean values 0 1 */ #endif /* Macros for converting *constants* to the right type */ diff --git a/include/my_time.h b/include/my_time.h index 99eb5c36c6b..014327d6fd8 100644 --- a/include/my_time.h +++ b/include/my_time.h @@ -94,7 +94,7 @@ long calc_daynr(uint year,uint month,uint day); uint calc_days_in_year(uint year); uint year_2000_handling(uint year); -void init_time(void); +void my_init_time(void); /* diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 97e0835b99f..dd66a325169 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -298,16 +298,12 @@ mysql_debug(const char *debug __attribute__((unused))) { #ifndef DBUG_OFF char *env; - if (_db_on_) - return; /* Already using debugging */ if (debug) { - DEBUGGER_ON; DBUG_PUSH(debug); } else if ((env = getenv("MYSQL_DEBUG"))) { - DEBUGGER_ON; DBUG_PUSH(env); #if !defined(_WINVER) && !defined(WINVER) puts("\n-------------------------------------------------------"); @@ -2448,7 +2444,7 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length) my_bool res; DBUG_ENTER("execute"); - DBUG_DUMP("packet", packet, length); + DBUG_DUMP("packet", (uchar*)packet, length); mysql->last_used_con= mysql; int4store(buff, stmt->stmt_id); /* Send stmt id to server */ diff --git a/myisam/mi_check.c b/myisam/mi_check.c index 4407a787950..daa5886f3ba 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -741,7 +741,7 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, char llbuff[22]; uint diff_pos[2]; DBUG_ENTER("chk_index"); - DBUG_DUMP("buff",(byte*) buff,mi_getint(buff)); + DBUG_DUMP("buff",(uchar*) buff,mi_getint(buff)); /* TODO: implement appropriate check for RTree keys */ if (keyinfo->flag & HA_SPATIAL) @@ -799,9 +799,9 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, (flag=ha_key_cmp(keyinfo->seg,info->lastkey,key,key_length, comp_flag, diff_pos)) >=0) { - DBUG_DUMP("old",(byte*) info->lastkey, info->lastkey_length); - DBUG_DUMP("new",(byte*) key, key_length); - DBUG_DUMP("new_in_page",(char*) old_keypos,(uint) (keypos-old_keypos)); + DBUG_DUMP("old",(uchar*) info->lastkey, info->lastkey_length); + DBUG_DUMP("new",(uchar*) key, key_length); + DBUG_DUMP("new_in_page",(uchar*) old_keypos,(uint) (keypos-old_keypos)); if (comp_flag & SEARCH_FIND && flag == 0) mi_check_print_error(param,"Found duplicated key at page %s",llstr(page,llbuff)); @@ -870,8 +870,8 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, DBUG_PRINT("test",("page: %s record: %s filelength: %s", llstr(page,llbuff),llstr(record,llbuff2), llstr(info->state->data_file_length,llbuff3))); - DBUG_DUMP("key",(byte*) key,key_length); - DBUG_DUMP("new_in_page",(char*) old_keypos,(uint) (keypos-old_keypos)); + DBUG_DUMP("key",(uchar*) key,key_length); + DBUG_DUMP("new_in_page",(uchar*) old_keypos,(uint) (keypos-old_keypos)); goto err; } param->record_checksum+=(ha_checksum) record; @@ -1631,7 +1631,7 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info, { if (my_errno != HA_ERR_FOUND_DUPP_KEY) goto err; - DBUG_DUMP("record",(byte*) sort_param.record,share->base.pack_reclength); + DBUG_DUMP("record",(uchar*) sort_param.record,share->base.pack_reclength); mi_check_print_info(param,"Duplicate key %2d for record at %10s against new record at %10s", info->errkey+1, llstr(sort_param.start_recpos,llbuff), @@ -1935,7 +1935,7 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name) for (key= 0,keyinfo= &share->keyinfo[0]; key < share->base.keys ; key++,keyinfo++) if (keyinfo->key_alg == HA_KEY_ALG_RTREE) - return 0; + DBUG_RETURN(0); if (!(param->testflag & T_SILENT)) printf("- Sorting index for MyISAM-table '%s'\n",name); @@ -2062,7 +2062,7 @@ static int sort_one_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, ("From page: %ld, keyoffset: %lu used_length: %d", (ulong) pagepos, (ulong) (keypos - buff), (int) used_length)); - DBUG_DUMP("buff",(byte*) buff,used_length); + DBUG_DUMP("buff",(uchar*) buff,used_length); goto err; } } @@ -4024,7 +4024,7 @@ static int sort_insert_key(MI_SORT_PARAM *sort_param, else if (my_pwrite(info->s->kfile,(byte*) anc_buff, (uint) keyinfo->block_length,filepos, param->myf_rw)) DBUG_RETURN(1); - DBUG_DUMP("buff",(byte*) anc_buff,mi_getint(anc_buff)); + DBUG_DUMP("buff",(uchar*) anc_buff,mi_getint(anc_buff)); /* Write separator-key to block in next level */ if (sort_insert_key(sort_param,key_block+1,key_block->lastkey,filepos)) @@ -4129,7 +4129,7 @@ int flush_pending_blocks(MI_SORT_PARAM *sort_param) else if (my_pwrite(info->s->kfile,(byte*) key_block->buff, (uint) keyinfo->block_length,filepos, myf_rw)) DBUG_RETURN(1); - DBUG_DUMP("buff",(byte*) key_block->buff,length); + DBUG_DUMP("buff",(uchar*) key_block->buff,length); nod_flag=1; } info->s->state.key_root[sort_param->key]=filepos; /* Last is root for tree */ diff --git a/myisam/mi_delete.c b/myisam/mi_delete.c index 409930ff7fb..ca8a537b322 100644 --- a/myisam/mi_delete.c +++ b/myisam/mi_delete.c @@ -223,7 +223,7 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, my_off_t leaf_page,next_block; uchar lastkey[MI_MAX_KEY_BUFF]; DBUG_ENTER("d_search"); - DBUG_DUMP("page",(byte*) anc_buff,mi_getint(anc_buff)); + DBUG_DUMP("page",(uchar*) anc_buff,mi_getint(anc_buff)); search_key_length= (comp_flag & SEARCH_FIND) ? key_length : USE_WHOLE_KEY; flag=(*keyinfo->bin_search)(info,keyinfo,anc_buff,key, search_key_length, @@ -381,7 +381,7 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, ret_value|=_mi_write_keypage(info,keyinfo,page,DFLT_INIT_HITS,anc_buff); else { - DBUG_DUMP("page",(byte*) anc_buff,mi_getint(anc_buff)); + DBUG_DUMP("page",(uchar*) anc_buff,mi_getint(anc_buff)); } my_afree((byte*) leaf_buff); DBUG_PRINT("exit",("Return: %d",ret_value)); @@ -411,7 +411,7 @@ static int del(register MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *key, DBUG_ENTER("del"); DBUG_PRINT("enter",("leaf_page: %ld keypos: 0x%lx", (long) leaf_page, (ulong) keypos)); - DBUG_DUMP("leaf_buff",(byte*) leaf_buff,mi_getint(leaf_buff)); + DBUG_DUMP("leaf_buff",(uchar*) leaf_buff,mi_getint(leaf_buff)); endpos=leaf_buff+mi_getint(leaf_buff); if (!(key_start=_mi_get_last_key(info,keyinfo,leaf_buff,keybuff,endpos, @@ -428,7 +428,7 @@ static int del(register MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *key, ret_value= -1; else { - DBUG_DUMP("next_page",(byte*) next_buff,mi_getint(next_buff)); + DBUG_DUMP("next_page",(uchar*) next_buff,mi_getint(next_buff)); if ((ret_value=del(info,keyinfo,key,anc_buff,next_page,next_buff, keypos,next_block,ret_key)) >0) { @@ -517,8 +517,8 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, DBUG_ENTER("underflow"); DBUG_PRINT("enter",("leaf_page: %ld keypos: 0x%lx",(long) leaf_page, (ulong) keypos)); - DBUG_DUMP("anc_buff",(byte*) anc_buff,mi_getint(anc_buff)); - DBUG_DUMP("leaf_buff",(byte*) leaf_buff,mi_getint(leaf_buff)); + DBUG_DUMP("anc_buff",(uchar*) anc_buff,mi_getint(anc_buff)); + DBUG_DUMP("leaf_buff",(uchar*) leaf_buff,mi_getint(leaf_buff)); buff=info->buff; info->buff_used=1; @@ -554,7 +554,7 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, if (!_mi_fetch_keypage(info,keyinfo,next_page,DFLT_INIT_HITS,buff,0)) goto err; buff_length=mi_getint(buff); - DBUG_DUMP("next",(byte*) buff,buff_length); + DBUG_DUMP("next",(uchar*) buff,buff_length); /* find keys to make a big key-page */ bmove((byte*) next_keypos-key_reflength,(byte*) buff+2, @@ -659,7 +659,7 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, goto err; buff_length=mi_getint(buff); endpos=buff+buff_length; - DBUG_DUMP("prev",(byte*) buff,buff_length); + DBUG_DUMP("prev",(uchar*) buff,buff_length); /* find keys to make a big key-page */ bmove((byte*) next_keypos - key_reflength,(byte*) leaf_buff+2, @@ -715,8 +715,8 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, goto err; _mi_kpointer(info,leaf_key+key_length,leaf_page); /* Save key in anc_buff */ - DBUG_DUMP("anc_buff",(byte*) anc_buff,anc_length); - DBUG_DUMP("key_to_anc",(byte*) leaf_key,key_length); + DBUG_DUMP("anc_buff",(uchar*) anc_buff,anc_length); + DBUG_DUMP("key_to_anc",(uchar*) leaf_key,key_length); temp_pos=anc_buff+anc_length; t_length=(*keyinfo->pack_key)(keyinfo,key_reflength, @@ -737,7 +737,7 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, bmove((byte*) leaf_buff+2,(byte*) half_pos-nod_flag,(size_t) nod_flag); if (!(length=(*keyinfo->get_key)(keyinfo,nod_flag,&half_pos,leaf_key))) goto err; - DBUG_DUMP("key_to_leaf",(byte*) leaf_key,length); + DBUG_DUMP("key_to_leaf",(uchar*) leaf_key,length); t_length=(*keyinfo->pack_key)(keyinfo,nod_flag, (uchar*) 0, (uchar*) 0, (uchar*) 0, leaf_key, &s_temp); length=(uint) ((buff+buff_length)-half_pos); diff --git a/myisam/mi_dynrec.c b/myisam/mi_dynrec.c index 67d40ec50bf..3542a82be59 100644 --- a/myisam/mi_dynrec.c +++ b/myisam/mi_dynrec.c @@ -509,7 +509,7 @@ int _mi_write_part_record(MI_INFO *info, } length= *reclength+head_length; /* Write only what is needed */ } - DBUG_DUMP("header",(byte*) temp,head_length); + DBUG_DUMP("header",(uchar*) temp,head_length); /* Make a long block for one write */ record_end= *record+length-head_length; @@ -1137,7 +1137,7 @@ err: my_errno= HA_ERR_WRONG_IN_RECORD; DBUG_PRINT("error",("to_end: 0x%lx -> 0x%lx from_end: 0x%lx -> 0x%lx", (long) to, (long) to_end, (long) from, (long) from_end)); - DBUG_DUMP("from",(byte*) info->rec_buff,info->s->base.min_pack_length); + DBUG_DUMP("from",(uchar*) info->rec_buff,info->s->base.min_pack_length); DBUG_RETURN(MY_FILE_ERROR); } /* _mi_rec_unpack */ @@ -1698,7 +1698,7 @@ uint _mi_get_block_info(MI_BLOCK_INFO *info, File file, my_off_t filepos) sizeof(info->header)) goto err; } - DBUG_DUMP("header",(byte*) header,MI_BLOCK_INFO_HEADER_LENGTH); + DBUG_DUMP("header",(uchar*) header,MI_BLOCK_INFO_HEADER_LENGTH); if (info->second_read) { if (info->header[0] <= 6 || info->header[0] == 13) diff --git a/myisam/mi_key.c b/myisam/mi_key.c index 377972b5a5f..90bd6f5a717 100644 --- a/myisam/mi_key.c +++ b/myisam/mi_key.c @@ -189,7 +189,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key, } _mi_dpointer(info,key,filepos); DBUG_PRINT("exit",("keynr: %d",keynr)); - DBUG_DUMP("key",(byte*) start,(uint) (key-start)+keyseg->length); + DBUG_DUMP("key",(uchar*) start,(uint) (key-start)+keyseg->length); DBUG_EXECUTE("key", _mi_print_key(DBUG_FILE,info->s->keyinfo[keynr].seg,start, (uint) (key-start));); diff --git a/myisam/mi_keycache.c b/myisam/mi_keycache.c index bb465dbecce..6694893e9c3 100644 --- a/myisam/mi_keycache.c +++ b/myisam/mi_keycache.c @@ -158,4 +158,5 @@ void mi_change_key_cache(KEY_CACHE *old_key_cache, */ multi_key_cache_change(old_key_cache, new_key_cache); pthread_mutex_unlock(&THR_LOCK_myisam); + DBUG_VOID_RETURN; } diff --git a/myisam/mi_open.c b/myisam/mi_open.c index c014b45cec5..6865708a941 100644 --- a/myisam/mi_open.c +++ b/myisam/mi_open.c @@ -130,7 +130,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) (byte*) myisam_file_magic, 4)) { DBUG_PRINT("error",("Wrong header in %s",name_buff)); - DBUG_DUMP("error_dump",(char*) share->state.header.file_version, + DBUG_DUMP("error_dump",(uchar*) share->state.header.file_version, head_length); my_errno=HA_ERR_NOT_A_TABLE; goto err; diff --git a/myisam/mi_packrec.c b/myisam/mi_packrec.c index 81fc4d046e7..63d624a1445 100644 --- a/myisam/mi_packrec.c +++ b/myisam/mi_packrec.c @@ -1368,7 +1368,7 @@ uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff, VOID(my_seek(file,filepos,MY_SEEK_SET,MYF(0))); if (my_read(file,(char*) header,ref_length,MYF(MY_NABP))) return BLOCK_FATAL_ERROR; - DBUG_DUMP("header",(byte*) header,ref_length); + DBUG_DUMP("header",(uchar*) header,ref_length); } head_length= read_pack_length((uint) myisam->s->pack.version, header, &info->rec_len); diff --git a/myisam/mi_page.c b/myisam/mi_page.c index eb26cf52ed2..27cddaefb1e 100644 --- a/myisam/mi_page.c +++ b/myisam/mi_page.c @@ -49,7 +49,7 @@ uchar *_mi_fetch_keypage(register MI_INFO *info, MI_KEYDEF *keyinfo, { DBUG_PRINT("error",("page %lu had wrong page length: %u", (ulong) page, page_size)); - DBUG_DUMP("page", (char*) tmp, keyinfo->block_length); + DBUG_DUMP("page", (uchar*) tmp, keyinfo->block_length); info->last_keypage = HA_OFFSET_ERROR; mi_print_error(info->s, HA_ERR_CRASHED); my_errno = HA_ERR_CRASHED; @@ -80,7 +80,7 @@ int _mi_write_keypage(register MI_INFO *info, register MI_KEYDEF *keyinfo, DBUG_RETURN((-1)); } DBUG_PRINT("page",("write page at: %lu",(long) page)); - DBUG_DUMP("buff",(byte*) buff,mi_getint(buff)); + DBUG_DUMP("buff",(uchar*) buff,mi_getint(buff)); #endif if ((length=keyinfo->block_length) > IO_SIZE*2 && diff --git a/myisam/mi_search.c b/myisam/mi_search.c index 7016a3a6876..530be5e042f 100644 --- a/myisam/mi_search.c +++ b/myisam/mi_search.c @@ -78,7 +78,7 @@ int _mi_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, if (!(buff=_mi_fetch_keypage(info,keyinfo,pos,DFLT_INIT_HITS,info->buff, test(!(nextflag & SEARCH_SAVE_BUFF))))) goto err; - DBUG_DUMP("page",(byte*) buff,mi_getint(buff)); + DBUG_DUMP("page",(uchar*) buff,mi_getint(buff)); flag=(*keyinfo->bin_search)(info,keyinfo,buff,key,key_len,nextflag, &keypos,lastkey, &last_key); @@ -814,7 +814,7 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, DBUG_PRINT("error", ("Found too long null packed key: %u of %u at %lx", length, keyseg->length, (long) *page_pos)); - DBUG_DUMP("key",(char*) *page_pos,16); + DBUG_DUMP("key",(uchar*) *page_pos,16); mi_print_error(keyinfo->share, HA_ERR_CRASHED); my_errno=HA_ERR_CRASHED; return 0; @@ -871,7 +871,7 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, { DBUG_PRINT("error",("Found too long packed key: %u of %u at %lx", length, keyseg->length, (long) *page_pos)); - DBUG_DUMP("key",(char*) *page_pos,16); + DBUG_DUMP("key",(uchar*) *page_pos,16); mi_print_error(keyinfo->share, HA_ERR_CRASHED); my_errno=HA_ERR_CRASHED; return 0; /* Error */ @@ -942,7 +942,7 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, { DBUG_PRINT("error",("Found too long binary packed key: %u of %u at %lx", length, keyinfo->maxlength, (long) *page_pos)); - DBUG_DUMP("key",(char*) *page_pos,16); + DBUG_DUMP("key",(uchar*) *page_pos,16); mi_print_error(keyinfo->share, HA_ERR_CRASHED); my_errno=HA_ERR_CRASHED; DBUG_RETURN(0); /* Wrong key */ diff --git a/myisam/mi_statrec.c b/myisam/mi_statrec.c index f88e5b02bcf..70a09895a3f 100644 --- a/myisam/mi_statrec.c +++ b/myisam/mi_statrec.c @@ -137,8 +137,8 @@ int _mi_cmp_static_record(register MI_INFO *info, register const byte *old) if (memcmp((byte*) info->rec_buff, (byte*) old, (uint) info->s->base.reclength)) { - DBUG_DUMP("read",old,info->s->base.reclength); - DBUG_DUMP("disk",info->rec_buff,info->s->base.reclength); + DBUG_DUMP("read",(uchar *)old,info->s->base.reclength); + DBUG_DUMP("disk",(uchar *)info->rec_buff,info->s->base.reclength); my_errno=HA_ERR_RECORD_CHANGED; /* Record have changed */ DBUG_RETURN(1); } diff --git a/myisam/mi_test1.c b/myisam/mi_test1.c index 3540ac0f580..380f9f412b7 100644 --- a/myisam/mi_test1.c +++ b/myisam/mi_test1.c @@ -647,7 +647,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), printf("test1 Ver 1.2 \n"); exit(0); case '#': - DEBUGGER_ON; DBUG_PUSH (argument); break; case '?': diff --git a/myisam/mi_test2.c b/myisam/mi_test2.c index 5aa9250cf18..3c88ffce2db 100644 --- a/myisam/mi_test2.c +++ b/myisam/mi_test2.c @@ -449,8 +449,8 @@ int main(int argc, char *argv[]) bcmp(read_record2,read_record3,reclength)) { printf("Can't find last record\n"); - DBUG_DUMP("record2",(byte*) read_record2,reclength); - DBUG_DUMP("record3",(byte*) read_record3,reclength); + DBUG_DUMP("record2",(uchar*) read_record2,reclength); + DBUG_DUMP("record3",(uchar*) read_record3,reclength); goto end; } ant=1; @@ -863,7 +863,6 @@ err: static void get_options(int argc, char **argv) { char *pos,*progname; - DEBUGGER_OFF; progname= argv[0]; @@ -976,7 +975,6 @@ static void get_options(int argc, char **argv) progname); exit(0); case '#': - DEBUGGER_ON; DBUG_PUSH (++pos); break; default: diff --git a/myisam/mi_test3.c b/myisam/mi_test3.c index dd798f1a161..cc86f21a28e 100644 --- a/myisam/mi_test3.c +++ b/myisam/mi_test3.c @@ -119,7 +119,6 @@ int main(int argc,char **argv) static void get_options(int argc, char **argv) { char *pos,*progname; - DEBUGGER_OFF; progname= argv[0]; @@ -149,7 +148,6 @@ static void get_options(int argc, char **argv) printf("Usage: %s [-?lKA] [-f#] [-t#]\n",progname); exit(0); case '#': - DEBUGGER_ON; DBUG_PUSH (++pos); break; default: diff --git a/myisam/mi_write.c b/myisam/mi_write.c index 967fbdc2330..4f11fc78ccf 100644 --- a/myisam/mi_write.c +++ b/myisam/mi_write.c @@ -476,7 +476,7 @@ int _mi_insert(register MI_INFO *info, register MI_KEYDEF *keyinfo, if (key_pos != anc_buff+2+nod_flag && (keyinfo->flag & (HA_BINARY_PACK_KEY | HA_PACK_KEY))) { - DBUG_DUMP("prev_key",(byte*) key_buff,_mi_keylength(keyinfo,key_buff)); + DBUG_DUMP("prev_key",(uchar*) key_buff,_mi_keylength(keyinfo,key_buff)); } if (keyinfo->flag & HA_PACK_KEY) { @@ -583,7 +583,7 @@ int _mi_split_page(register MI_INFO *info, register MI_KEYDEF *keyinfo, MI_KEY_PARAM s_temp; DBUG_ENTER("mi_split_page"); LINT_INIT(after_key); - DBUG_DUMP("buff",(byte*) buff,mi_getint(buff)); + DBUG_DUMP("buff",(uchar*) buff,mi_getint(buff)); if (info->s->keyinfo+info->lastinx == keyinfo) info->page_changed=1; /* Info->buff is used */ @@ -630,7 +630,7 @@ int _mi_split_page(register MI_INFO *info, register MI_KEYDEF *keyinfo, if (_mi_write_keypage(info,keyinfo,new_pos,DFLT_INIT_HITS,info->buff)) DBUG_RETURN(-1); - DBUG_DUMP("key",(byte*) key,_mi_keylength(keyinfo,key)); + DBUG_DUMP("key",(uchar*) key,_mi_keylength(keyinfo,key)); DBUG_RETURN(2); /* Middle key up */ } /* _mi_split_page */ @@ -784,7 +784,7 @@ static int _mi_balance_page(register MI_INFO *info, MI_KEYDEF *keyinfo, if (!_mi_fetch_keypage(info,keyinfo,next_page,DFLT_INIT_HITS,info->buff,0)) goto err; - DBUG_DUMP("next",(byte*) info->buff,mi_getint(info->buff)); + DBUG_DUMP("next",(uchar*) info->buff,mi_getint(info->buff)); /* Test if there is room to share keys */ diff --git a/myisammrg/myrg_rkey.c b/myisammrg/myrg_rkey.c index 0f9e9a9b822..627839331c6 100644 --- a/myisammrg/myrg_rkey.c +++ b/myisammrg/myrg_rkey.c @@ -92,6 +92,6 @@ int myrg_rkey(MYRG_INFO *info,byte *buf,int inx, const byte *key, mi->once_flags|= RRND_PRESERVE_LASTINX; DBUG_PRINT("info", ("using table no: %d", (int) (info->current_table - info->open_tables + 1))); - DBUG_DUMP("result key", (byte*) mi->lastkey, mi->lastkey_length); + DBUG_DUMP("result key", (uchar*) mi->lastkey, mi->lastkey_length); DBUG_RETURN(_myrg_mi_read_record(mi,buf)); } diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am index 75d00457d14..0c4a708dd14 100644 --- a/mysql-test/Makefile.am +++ b/mysql-test/Makefile.am @@ -45,7 +45,8 @@ dist-hook: mkdir -p $(distdir)/t $(distdir)/r $(distdir)/include \ $(distdir)/std_data \ $(distdir)/std_data/ndb_backup50_data_be $(distdir)/std_data/ndb_backup50_data_le \ - $(distdir)/lib + $(distdir)/lib \ + $(distdir)/std_data/funcs_1 -$(INSTALL_DATA) $(srcdir)/t/*.def $(distdir)/t $(INSTALL_DATA) $(srcdir)/t/*.test $(distdir)/t -$(INSTALL_DATA) $(srcdir)/t/*.imtest $(distdir)/t @@ -66,6 +67,7 @@ dist-hook: $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50_data_be/BACKUP* $(distdir)/std_data/ndb_backup50_data_be $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50_data_le/BACKUP* $(distdir)/std_data/ndb_backup50_data_le + $(INSTALL_DATA) $(srcdir)/std_data/funcs_1/*.txt $(distdir)/std_data/funcs_1 $(INSTALL_DATA) $(srcdir)/lib/*.pl $(distdir)/lib -rm -rf `find $(distdir)/suite -type d -name SCCS` @@ -77,7 +79,8 @@ install-data-local: $(DESTDIR)$(testdir)/std_data \ $(DESTDIR)$(testdir)/std_data/ndb_backup50_data_be \ $(DESTDIR)$(testdir)/std_data/ndb_backup50_data_le \ - $(DESTDIR)$(testdir)/lib + $(DESTDIR)$(testdir)/lib \ + $(DESTDIR)$(testdir)/std_data/funcs_1 $(INSTALL_DATA) $(srcdir)/README $(DESTDIR)$(testdir) -$(INSTALL_DATA) $(srcdir)/t/*.def $(DESTDIR)$(testdir)/t $(INSTALL_DATA) $(srcdir)/t/*.test $(DESTDIR)$(testdir)/t @@ -103,6 +106,7 @@ install-data-local: $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50_data_be/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup50_data_be $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50_data_le/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup50_data_le + $(INSTALL_DATA) $(srcdir)/std_data/funcs_1/*.txt $(DESTDIR)$(testdir)/std_data/funcs_1 $(INSTALL_DATA) $(srcdir)/lib/*.pl $(DESTDIR)$(testdir)/lib for f in `(cd $(srcdir); find suite -type f | grep -v SCCS)`; \ do \ diff --git a/mysql-test/include/show_binary_logs.inc b/mysql-test/include/show_binary_logs.inc new file mode 100644 index 00000000000..43a9d5d2eed --- /dev/null +++ b/mysql-test/include/show_binary_logs.inc @@ -0,0 +1,3 @@ +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--replace_column 2 # +show binary logs; diff --git a/mysql-test/include/show_binlog_events.inc b/mysql-test/include/show_binlog_events.inc index 5d60fb19cb5..50b910b553b 100644 --- a/mysql-test/include/show_binlog_events.inc +++ b/mysql-test/include/show_binlog_events.inc @@ -1,4 +1,10 @@ ---let $binlog_start=98 ---replace_column 5 # ---replace_regex /\/\* xid=.* \*\//\/* XID *\// +# $binlog_start can be set by caller or take a default value + +if (!$binlog_start) +{ + let $binlog_start=98; +} +--replace_result $binlog_start <binlog_start> +--replace_column 2 # 4 # 5 # +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ --eval show binlog events from $binlog_start diff --git a/mysql-test/include/wait_condition.inc b/mysql-test/include/wait_condition.inc new file mode 100644 index 00000000000..a41d8080c9b --- /dev/null +++ b/mysql-test/include/wait_condition.inc @@ -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 diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 7c4677b8274..7b9206f0dfd 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -110,6 +110,7 @@ our $glob_basedir; our $path_charsetsdir; our $path_client_bindir; +our $path_client_libdir; our $path_language; our $path_timefile; our $path_snapshot; @@ -623,6 +624,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, @@ -717,11 +720,19 @@ 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"); + } if (!$opt_extern) { @@ -1367,7 +1378,15 @@ sub datadir_list_setup () { sub collect_mysqld_features () { my $found_variable_list_start= 0; - my $tmpdir= tempdir(CLEANUP => 0); # Directory removed by this function + my $tmpdir; + if ( $opt_tmpdir ) { + # Use the requested tmpdir + mkpath($opt_tmpdir) if (! -d $opt_tmpdir); + $tmpdir= $opt_tmpdir; + } + else { + $tmpdir= tempdir(CLEANUP => 0); # Directory removed by this function + } # # Execute "mysqld --no-defaults --help --verbose" to get a @@ -1428,7 +1447,7 @@ sub collect_mysqld_features () { } } } - rmtree($tmpdir); + rmtree($tmpdir) if (!$opt_tmpdir); mtr_error("Could not find version of MySQL") unless $mysql_version_id; mtr_error("Could not find variabes list") unless $found_variable_list_start; @@ -1737,6 +1756,7 @@ sub mysql_upgrade_arguments() mtr_add_arg($args, "--socket=$master->[0]->{'path_sock'}"); mtr_add_arg($args, "--datadir=$master->[0]->{'path_myddir'}"); mtr_add_arg($args, "--basedir=$glob_basedir"); + mtr_add_arg($args, "--tmpdir=$opt_tmpdir"); if ( $opt_debug ) { @@ -1755,19 +1775,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"); + } } # -------------------------------------------------------------------------- @@ -2019,6 +2045,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 ) { @@ -3739,9 +3768,9 @@ sub mysqld_arguments ($$$$) { { # By default, prevent the started mysqld to access files outside of vardir my $secure_file_dir= $opt_vardir; - if ( $opt_suite ne "main" ) + if ( $opt_suite ne "main" and $opt_suite ne "funcs_1" ) { - # When running a suite other than default allow the mysqld + # When running a suite other than default or funcs_1 allow the mysqld # access to subdirs of mysql-test/ in order to make it possible # to "load data" from the suites data/ directory. $secure_file_dir= $glob_mysql_test_dir; @@ -5235,6 +5264,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 diff --git a/mysql-test/r/bdb.result b/mysql-test/r/bdb.result index fefeeb405c5..3356d23053f 100644 --- a/mysql-test/r/bdb.result +++ b/mysql-test/r/bdb.result @@ -1325,7 +1325,6 @@ set @a=repeat(' ',20); insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a)); Warnings: Note 1265 Data truncated for column 'v' at row 1 -Note 1265 Data truncated for column 'c' at row 1 select concat('*',v,'*',c,'*',t,'*') from t1; concat('*',v,'*',c,'*',t,'*') *+ *+*+ * diff --git a/mysql-test/r/binlog_index.result b/mysql-test/r/binlog_index.result new file mode 100644 index 00000000000..82fc26092f4 --- /dev/null +++ b/mysql-test/r/binlog_index.result @@ -0,0 +1,39 @@ +flush logs; +flush logs; +flush logs; +show binary logs; +Log_name File_size +master-bin.000001 # +master-bin.000002 # +master-bin.000003 # +master-bin.000004 # +purge binary logs TO 'master-bin.000004'; +Warnings: +Warning 1477 Being purged log MYSQLTEST_VARDIR/log/master-bin.000001 was not found +*** must show a list starting from the 'TO' argument of PURGE *** +show binary logs; +Log_name File_size +master-bin.000004 # +reset master; +flush logs; +flush logs; +flush logs; +*** must be a warning master-bin.000001 was not found *** +Warnings: +Warning 1477 Being purged log MYSQLTEST_VARDIR/log/master-bin.000001 was not found +*** must show one record, of the active binlog, left in the index file after PURGE *** +show binary logs; +Log_name File_size +master-bin.000004 # +reset master; +flush logs; +flush logs; +flush logs; +purge binary logs TO 'master-bin.000002'; +ERROR HY000: Fatal error during log purge +show warnings; +Level Code Message +Error 1377 a problem with deleting MYSQLTEST_VARDIR/log/master-bin.000001; consider examining correspondence of your binlog index file to the actual binlog files +Error 1377 Fatal error during log purge +reset master; +End of tests diff --git a/mysql-test/r/binlog_innodb.result b/mysql-test/r/binlog_innodb.result index 18b4b7c1c93..180b43f42ac 100644 --- a/mysql-test/r/binlog_innodb.result +++ b/mysql-test/r/binlog_innodb.result @@ -34,6 +34,6 @@ END| INSERT INTO t2 VALUES (2),(10+bug23333()); SHOW MASTER STATUS; File Position Binlog_Do_DB Binlog_Ignore_DB -# 184136 +# 184141 DROP FUNCTION bug23333; DROP TABLE t1, t2; diff --git a/mysql-test/r/binlog_killed_simulate.result b/mysql-test/r/binlog_killed_simulate.result index a21ac5b1e32..c0087316420 100644 --- a/mysql-test/r/binlog_killed_simulate.result +++ b/mysql-test/r/binlog_killed_simulate.result @@ -16,10 +16,10 @@ create table t2 (a int, b int) ENGINE=MyISAM; reset master; load data infile '../std_data_ln/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */; ERROR 70100: Query execution was interrupted -show binlog events from 98; +show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 98 Begin_load_query 1 # ;file_id=1;block_len=12 -master-bin.000001 133 Execute_load_query 1 # use `test`; load data infile '../std_data_ln/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */ ;file_id=1 +master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=12 +master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */ ;file_id=# select (@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog")) is not null; diff --git a/mysql-test/r/blackhole.result b/mysql-test/r/blackhole.result index a4b780f9db5..51c19c29b0f 100644 --- a/mysql-test/r/blackhole.result +++ b/mysql-test/r/blackhole.result @@ -138,3 +138,20 @@ ALTER TABLE t1 DROP INDEX a; ALTER TABLE t1 ADD PRIMARY KEY(a); DELETE FROM t1 WHERE a=10; DROP TABLE t1; +reset master; +create table t1 (a int auto_increment, primary key (a)) engine=blackhole; +insert into t1 values (11), (NULL), (NULL), (NULL); +set insert_id= 3; +insert into t1 values (NULL), (33), (NULL); +set insert_id= 5; +insert into t1 values (55), (NULL); +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query 1 # use `test`; create table t1 (a int auto_increment, primary key (a)) engine=blackhole +master-bin.000001 # Intvar 1 # INSERT_ID=1 +master-bin.000001 # Query 1 # use `test`; insert into t1 values (11), (NULL), (NULL), (NULL) +master-bin.000001 # Intvar 1 # INSERT_ID=3 +master-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL), (33), (NULL) +master-bin.000001 # Intvar 1 # INSERT_ID=5 +master-bin.000001 # Query 1 # use `test`; insert into t1 values (55), (NULL) +drop table t1; diff --git a/mysql-test/r/ctype_cp932_binlog.result b/mysql-test/r/ctype_cp932_binlog.result index 0b4ca93a0dd..b00124b7799 100644 --- a/mysql-test/r/ctype_cp932_binlog.result +++ b/mysql-test/r/ctype_cp932_binlog.result @@ -34,12 +34,12 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 362 Query 1 528 use `test`; CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1, s2 CHAR(50) CHARACTER SET cp932, d DECIMAL(10,2)) -master-bin.000001 528 Query 1 776 use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE bug18293 (IN ins1 CHAR(50), +master-bin.000001 528 Query 1 777 use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `bug18293`(IN ins1 CHAR(50), IN ins2 CHAR(50) CHARACTER SET cp932, IN ind DECIMAL(10,2)) BEGIN INSERT INTO t4 VALUES (ins1, ins2, ind); END -master-bin.000001 776 Query 1 987 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93)) -master-bin.000001 987 Query 1 1076 use `test`; DROP PROCEDURE bug18293 -master-bin.000001 1076 Query 1 1155 use `test`; DROP TABLE t4 +master-bin.000001 777 Query 1 988 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93)) +master-bin.000001 988 Query 1 1077 use `test`; DROP PROCEDURE bug18293 +master-bin.000001 1077 Query 1 1156 use `test`; DROP TABLE t4 diff --git a/mysql-test/r/ctype_gbk.result b/mysql-test/r/ctype_gbk.result index 6066246a2ef..1b425134095 100644 --- a/mysql-test/r/ctype_gbk.result +++ b/mysql-test/r/ctype_gbk.result @@ -247,4 +247,11 @@ t1 CREATE TABLE `t1` ( `c2` text NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=gbk drop table t1; +CREATE TABLE t1(a MEDIUMTEXT CHARACTER SET gbk, +b MEDIUMTEXT CHARACTER SET big5); +INSERT INTO t1 VALUES +(REPEAT(0x1125,200000), REPEAT(0x1125,200000)), ('', ''), ('', ''); +SELECT a FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll; +SELECT b FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll; +DROP TABLES t1; End of 5.0 tests diff --git a/mysql-test/r/federated_disabled.result b/mysql-test/r/federated_disabled.result new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/mysql-test/r/federated_disabled.result diff --git a/mysql-test/r/flush.result b/mysql-test/r/flush.result index ce64e09c1d3..778f138f29d 100644 --- a/mysql-test/r/flush.result +++ b/mysql-test/r/flush.result @@ -72,3 +72,4 @@ flush tables with read lock; unlock tables; drop table t1, t2; set session low_priority_updates=default; +select benchmark(200, (select sin(1))) > 1000; diff --git a/mysql-test/r/func_concat.result b/mysql-test/r/func_concat.result index 66808afd4e9..7e7c163716e 100644 --- a/mysql-test/r/func_concat.result +++ b/mysql-test/r/func_concat.result @@ -82,3 +82,10 @@ a 1234562 x drop table t1; +CREATE TABLE t1 (c1 varchar(100), c2 varchar(100)); +INSERT INTO t1 VALUES ('',''), ('','First'), ('Random','Random'); +SELECT * FROM t1 WHERE CONCAT(c1,' ',c2) REGEXP 'First.*'; +c1 c2 + First +DROP TABLE t1; +# End of 5.0 tests diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result index 77d11831842..4dddc35e8a8 100644 --- a/mysql-test/r/func_gconcat.result +++ b/mysql-test/r/func_gconcat.result @@ -946,4 +946,30 @@ GROUP BY 1 d1 NULL DROP TABLE t1; +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a INT); +INSERT INTO t1 VALUES(1); +SELECT GROUP_CONCAT(DISTINCT t2.a) FROM t1 LEFT JOIN t2 ON t2.a = t1.a GROUP BY t1.a; +GROUP_CONCAT(DISTINCT t2.a) +NULL +DROP TABLE t1, t2; +CREATE TABLE t1 (a INT, KEY(a)); +CREATE TABLE t2 (b INT); +INSERT INTO t1 VALUES (NULL), (8), (2); +INSERT INTO t2 VALUES (4), (10); +SELECT 1 FROM t1 WHERE t1.a NOT IN +( +SELECT GROUP_CONCAT(DISTINCT t1.a) +FROM t1 WHERE t1.a IN +( +SELECT b FROM t2 +) +AND NOT t1.a >= (SELECT t1.a FROM t1 LIMIT 1) +GROUP BY t1.a +); +1 +1 +1 +1 +DROP TABLE t1, t2; End of 5.0 tests diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result index 4785ca9919d..772e432355b 100644 --- a/mysql-test/r/func_group.result +++ b/mysql-test/r/func_group.result @@ -1419,4 +1419,10 @@ Note 1003 select (`test`.`t1`.`a` + 1) AS `y` from `test`.`t1` group by (`test`. DROP VIEW v1; DROP TABLE t1; SET SQL_MODE=DEFAULT; +CREATE TABLE t1(a DOUBLE); +INSERT INTO t1 VALUES (10), (20); +SELECT AVG(a), CAST(AVG(a) AS DECIMAL) FROM t1; +AVG(a) CAST(AVG(a) AS DECIMAL) +15 15 +DROP TABLE t1; End of 5.0 tests diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result index ac81a2b4b11..d50dda55bfb 100644 --- a/mysql-test/r/func_misc.result +++ b/mysql-test/r/func_misc.result @@ -99,41 +99,99 @@ t1 CREATE TABLE `t1` ( `length(uuid())` int(10) NOT NULL default '0' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; -create table t1 (a timestamp default '2005-05-05 01:01:01', -b timestamp default '2005-05-05 01:01:01'); -insert into t1 set a = now(); -select sleep(3); -sleep(3) -0 -update t1 set b = now(); -select timediff(b, a) >= '00:00:03' from t1; -timediff(b, a) >= '00:00:03' -1 -drop table t1; -set global query_cache_size=1355776; -create table t1 (a int); -insert into t1 values (1),(1),(1); -create table t2 (a datetime default null, b datetime default null); -insert into t2 set a = now(); -select a from t1 where sleep(1); -a -update t2 set b = now() where b is null; -insert into t2 set a = now(); -select a from t1 where sleep(a); -a -update t2 set b = now() where b is null; -insert into t2 set a = now(); -select a from t1 where sleep(1); -a -update t2 set b = now() where b is null; -select timediff(b, a) >= '00:00:03' from t2; -timediff(b, a) >= '00:00:03' +#------------------------------------------------------------------------ +# Tests for Bug#6760 and Bug#12689 +SET @row_count = 4; +SET @sleep_time_per_result_row = 1; +SET @max_acceptable_delay = 2; +SET @@global.query_cache_size = 1024 * 64; +DROP TEMPORARY TABLE IF EXISTS t_history; +DROP TABLE IF EXISTS t1; +CREATE TEMPORARY TABLE t_history (attempt SMALLINT, +start_ts DATETIME, end_ts DATETIME, +start_cached INTEGER, end_cached INTEGER); +CREATE TABLE t1 (f1 BIGINT); +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (1); +INSERT INTO t_history +SET attempt = 4 - 4 + 1, start_ts = NOW(), +start_cached = 0; +SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1; +f1 SLEEP(@sleep_time_per_result_row) +1 0 +1 0 +1 0 +1 0 +UPDATE t_history SET end_ts = NOW() +WHERE attempt = 4 - 4 + 1; +UPDATE t_history SET end_cached = 0 +WHERE attempt = 4 - 4 + 1; +INSERT INTO t_history +SET attempt = 4 - 3 + 1, start_ts = NOW(), +start_cached = 0; +SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1; +f1 SLEEP(@sleep_time_per_result_row) +1 0 +1 0 +1 0 +1 0 +UPDATE t_history SET end_ts = NOW() +WHERE attempt = 4 - 3 + 1; +UPDATE t_history SET end_cached = 0 +WHERE attempt = 4 - 3 + 1; +INSERT INTO t_history +SET attempt = 4 - 2 + 1, start_ts = NOW(), +start_cached = 0; +SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1; +f1 SLEEP(@sleep_time_per_result_row) +1 0 +1 0 +1 0 +1 0 +UPDATE t_history SET end_ts = NOW() +WHERE attempt = 4 - 2 + 1; +UPDATE t_history SET end_cached = 0 +WHERE attempt = 4 - 2 + 1; +INSERT INTO t_history +SET attempt = 4 - 1 + 1, start_ts = NOW(), +start_cached = 0; +SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1; +f1 SLEEP(@sleep_time_per_result_row) +1 0 +1 0 +1 0 +1 0 +UPDATE t_history SET end_ts = NOW() +WHERE attempt = 4 - 1 + 1; +UPDATE t_history SET end_cached = 0 +WHERE attempt = 4 - 1 + 1; +# Test 1: Does the query with SLEEP need a reasonable time? +SELECT COUNT(*) >= 4 - 1 INTO @aux1 FROM t_history +WHERE TIMEDIFF(end_ts,start_ts) - @sleep_time_per_result_row * @row_count +BETWEEN 0 AND @max_acceptable_delay; +SELECT @aux1 AS "Expect 1"; +Expect 1 1 +# Test 2: Does the query with SLEEP need a reasonable time even in case +# of the non first execution? +SELECT COUNT(*) >= 4 - 1 - 1 INTO @aux2 FROM t_history +WHERE TIMEDIFF(end_ts,start_ts) - @sleep_time_per_result_row * @row_count +BETWEEN 0 AND @max_acceptable_delay +AND attempt > 1; +SELECT @aux2 AS "Expect 1"; +Expect 1 1 +# Test 3: The query with SLEEP must be not cached. +SELECT COUNT(*) = 4 INTO @aux3 FROM t_history +WHERE end_cached = start_cached; +SELECT @aux3 AS "Expect 1"; +Expect 1 1 -drop table t2; -drop table t1; -set global query_cache_size=default; +DROP TABLE t1; +DROP TEMPORARY TABLE t_history; +SET @@global.query_cache_size = default; create table t1 select INET_ATON('255.255.0.1') as `a`; show create table t1; Table Create Table diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index e27ef64af43..d56020c3090 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -1129,4 +1129,26 @@ DROP USER mysqltest_1@localhost; DROP DATABASE db27878; use test; DROP TABLE t1; +drop table if exists test; +Warnings: +Note 1051 Unknown table 'test' +drop function if exists test_function; +Warnings: +Note 1305 FUNCTION test_function does not exist +drop view if exists v1; +Warnings: +Note 1051 Unknown table 'test.v1' +create table test (col1 varchar(30)); +create function test_function() returns varchar(30) +begin +declare tmp varchar(30); +select col1 from test limit 1 into tmp; +return '1'; +end| +create view v1 as select test.* from test where test.col1=test_function(); +grant update (col1) on v1 to 'greg'@'localhost'; +drop user 'greg'@'localhost'; +drop view v1; +drop table test; +drop function test_function; End of 5.0 tests diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index 7574aa916ae..28a9e15d473 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -1213,4 +1213,150 @@ FROM t1; ERROR 21000: Subquery returns more than 1 row DROP TABLE t1; SET @@sql_mode = @old_sql_mode; +# +# Bug#27219: Aggregate functions in ORDER BY. +# +SET @save_sql_mode=@@sql_mode; +SET @@sql_mode='ONLY_FULL_GROUP_BY'; +CREATE TABLE t1 (a INT, b INT, c INT DEFAULT 0); +INSERT INTO t1 (a, b) VALUES (3,3), (2,2), (3,3), (2,2), (3,3), (4,4); +CREATE TABLE t2 SELECT * FROM t1; +SELECT 1 FROM t1 ORDER BY COUNT(*); +1 +1 +SELECT 1 FROM t1 ORDER BY COUNT(*) + 1; +1 +1 +SELECT 1 FROM t1 ORDER BY COUNT(*) + a; +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT 1 FROM t1 ORDER BY COUNT(*), 1; +1 +1 +SELECT 1 FROM t1 ORDER BY COUNT(*), a; +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT 1 FROM t1 ORDER BY SUM(a); +1 +1 +SELECT 1 FROM t1 ORDER BY SUM(a + 1); +1 +1 +SELECT 1 FROM t1 ORDER BY SUM(a) + 1; +1 +1 +SELECT 1 FROM t1 ORDER BY SUM(a), b; +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT a FROM t1 ORDER BY COUNT(b); +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT t1.a FROM t1 ORDER BY (SELECT SUM(t2.a) FROM t2); +a +3 +2 +3 +2 +3 +4 +SELECT t1.a FROM t1 ORDER BY (SELECT SUM(t2.a), t2.a FROM t2); +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT t1.a FROM t1 ORDER BY (SELECT SUM(t2.a) FROM t2 ORDER BY t2.a); +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT t1.a FROM t1 ORDER BY (SELECT t2.a FROM t2 ORDER BY SUM(t2.b) LIMIT 1); +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT t1.a FROM t1 +WHERE t1.a = (SELECT t2.a FROM t2 ORDER BY SUM(t2.b) LIMIT 1); +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT t1.a FROM t1 GROUP BY t1.a +HAVING t1.a = (SELECT t2.a FROM t2 ORDER BY SUM(t2.a) LIMIT 1); +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT t1.a FROM t1 GROUP BY t1.a +HAVING t1.a IN (SELECT t2.a FROM t2 ORDER BY SUM(t1.b)); +a +2 +3 +4 +SELECT t1.a FROM t1 GROUP BY t1.a +HAVING t1.a IN (SELECT t2.a FROM t2 ORDER BY t2.a, SUM(t2.b)); +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT t1.a FROM t1 GROUP BY t1.a +HAVING t1.a > ANY (SELECT t2.a FROM t2 ORDER BY t2.a, SUM(t2.b)); +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT t1.a FROM t1 +WHERE t1.a = (SELECT t2.a FROM t2 ORDER BY SUM(t1.b)); +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT 1 FROM t1 GROUP BY t1.a +HAVING (SELECT AVG(SUM(t1.b) + 1) FROM t2 ORDER BY SUM(t2.a) LIMIT 1); +1 +1 +1 +1 +SELECT 1 FROM t1 GROUP BY t1.a +HAVING (SELECT AVG(SUM(t1.b) + t2.b) FROM t2 ORDER BY SUM(t2.a) LIMIT 1); +1 +1 +1 +1 +SELECT 1 FROM t1 GROUP BY t1.a +HAVING (SELECT AVG(t1.b + t2.b) FROM t2 ORDER BY SUM(t2.a) LIMIT 1); +1 +1 +1 +1 +SELECT 1 FROM t1 GROUP BY t1.a +HAVING (SELECT AVG(SUM(t1.b) + 1) FROM t2 ORDER BY t2.a LIMIT 1); +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT 1 FROM t1 GROUP BY t1.a +HAVING (SELECT AVG(SUM(t1.b) + t2.b) FROM t2 ORDER BY t2.a LIMIT 1); +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT 1 FROM t1 GROUP BY t1.a +HAVING (SELECT AVG(t1.b + t2.b) FROM t2 ORDER BY t2.a LIMIT 1); +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT t1.a FROM t1 +WHERE t1.a = (SELECT t2.a FROM t2 GROUP BY t2.a +ORDER BY SUM(t2.b), SUM(t1.b) LIMIT 1); +a +4 +SELECT t1.a, SUM(t1.b) FROM t1 +WHERE t1.a = (SELECT SUM(t2.b) FROM t2 GROUP BY t2.a +ORDER BY SUM(t2.b), SUM(t1.b) LIMIT 1) +GROUP BY t1.a; +a SUM(t1.b) +4 4 +SELECT t1.a, SUM(t1.b) FROM t1 +WHERE t1.a = (SELECT SUM(t2.b) FROM t2 +ORDER BY SUM(t2.b) + SUM(t1.b) LIMIT 1) +GROUP BY t1.a; +a SUM(t1.b) +SELECT t1.a, SUM(t1.b) FROM t1 +WHERE t1.a = (SELECT SUM(t2.b) FROM t2 +ORDER BY SUM(t2.b + t1.a) LIMIT 1) +GROUP BY t1.a; +a SUM(t1.b) +SELECT t1.a FROM t1 GROUP BY t1.a +HAVING (1, 1) = (SELECT SUM(t1.a), t1.a FROM t2 LIMIT 1); +a +select avg ( +(select +(select sum(outr.a + innr.a) from t1 as innr limit 1) as tt +from t1 as outr order by outr.a limit 1)) +from t1 as most_outer; +avg ( +(select +(select sum(outr.a + innr.a) from t1 as innr limit 1) as tt +from t1 as outr order by outr.a limit 1)) +29.0000 +select avg ( +(select ( +(select sum(outr.a + innr.a) from t1 as innr limit 1)) as tt +from t1 as outr order by count(outr.a) limit 1)) as tt +from t1 as most_outer; +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +select (select sum(outr.a + t1.a) from t1 limit 1) as tt from t1 as outr order by outr.a; +tt +29 +29 +35 +35 +35 +41 +SET sql_mode=@save_sql_mode; +DROP TABLE t1, t2; End of 5.0 tests diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result index adfcc00174f..906c431b834 100644 --- a/mysql-test/r/heap.result +++ b/mysql-test/r/heap.result @@ -256,7 +256,6 @@ set @a=repeat(' ',20); insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a)); Warnings: Note 1265 Data truncated for column 'v' at row 1 -Note 1265 Data truncated for column 'c' at row 1 select concat('*',v,'*',c,'*',t,'*') from t1; concat('*',v,'*',c,'*',t,'*') *+ *+*+ * diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 265769eb436..e8736463ea2 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -1428,8 +1428,19 @@ select * from `information_schema`.`VIEWS` where `TABLE_SCHEMA` = NULL; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE select * from `information_schema`.`VIEWS` where `TABLE_NAME` = NULL; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE -End of 5.0 tests. show fields from information_schema.table_names; ERROR 42S02: Unknown table 'table_names' in information_schema show keys from information_schema.table_names; ERROR 42S02: Unknown table 'table_names' in information_schema +USE information_schema; +SET max_heap_table_size = 16384; +CREATE TABLE test.t1( a INT ); +SELECT * +FROM tables ta +JOIN collations co ON ( co.collation_name = ta.table_catalog ) +JOIN character_sets cs ON ( cs.character_set_name = ta.table_catalog ); +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT COLLATION_NAME CHARACTER_SET_NAME ID IS_DEFAULT IS_COMPILED SORTLEN CHARACTER_SET_NAME DEFAULT_COLLATE_NAME DESCRIPTION MAXLEN +DROP TABLE test.t1; +SET max_heap_table_size = DEFAULT; +USE test; +End of 5.0 tests. diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 774e0bd167b..854712fdb1d 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -1901,7 +1901,6 @@ set @a=repeat(' ',20); insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a)); Warnings: Note 1265 Data truncated for column 'v' at row 1 -Note 1265 Data truncated for column 'c' at row 1 select concat('*',v,'*',c,'*',t,'*') from t1; concat('*',v,'*',c,'*',t,'*') *+ *+*+ * diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result index 7fff2700779..18b0d84a296 100644 --- a/mysql-test/r/loaddata.result +++ b/mysql-test/r/loaddata.result @@ -252,3 +252,79 @@ SELECT * FROM t1; c1 c2 c3 c4 10 1970-02-01 01:02:03 1.1e-100 1.1e+100 DROP TABLE t1; + +# -- +# -- Bug#35469: server crash with LOAD DATA INFILE to a VIEW. +# -- + +DROP TABLE IF EXISTS t1; +DROP VIEW IF EXISTS v1; +DROP VIEW IF EXISTS v2; +DROP VIEW IF EXISTS v3; + +CREATE TABLE t1(c1 INT, c2 VARCHAR(255)); + +CREATE VIEW v1 AS SELECT * FROM t1; +CREATE VIEW v2 AS SELECT 1 + 2 AS c0, c1, c2 FROM t1; +CREATE VIEW v3 AS SELECT 1 AS d1, 2 AS d2; + +LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v1 +FIELDS ESCAPED BY '\\' + TERMINATED BY ',' + ENCLOSED BY '"' + LINES TERMINATED BY '\n' (c1, c2); + +SELECT * FROM t1; +c1 c2 +1 "string1" +2 "string2" +3 "string3" + +SELECT * FROM v1; +c1 c2 +1 "string1" +2 "string2" +3 "string3" + +DELETE FROM t1; + +LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v2 +FIELDS ESCAPED BY '\\' + TERMINATED BY ',' + ENCLOSED BY '"' + LINES TERMINATED BY '\n' (c1, c2); + +SELECT * FROM t1; +c1 c2 +1 "string1" +2 "string2" +3 "string3" + +SELECT * FROM v2; +c0 c1 c2 +3 1 "string1" +3 2 "string2" +3 3 "string3" + +DELETE FROM t1; + +LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v2 +FIELDS ESCAPED BY '\\' + TERMINATED BY ',' + ENCLOSED BY '"' + LINES TERMINATED BY '\n' (c0, c2); +ERROR HY000: Invalid column reference (v2.c0) in LOAD DATA + +LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v3 +FIELDS ESCAPED BY '\\' + TERMINATED BY ',' + ENCLOSED BY '"' + LINES TERMINATED BY '\n' (d1, d2); +ERROR HY000: The target table v3 of the LOAD is not updatable + +DROP TABLE t1; +DROP VIEW v1; +DROP VIEW v2; +DROP VIEW v3; + +# -- End of Bug#35469. diff --git a/mysql-test/r/mix_innodb_myisam_binlog.result b/mysql-test/r/mix_innodb_myisam_binlog.result index b1d328a61dc..eda3ff41c89 100644 --- a/mysql-test/r/mix_innodb_myisam_binlog.result +++ b/mysql-test/r/mix_innodb_myisam_binlog.result @@ -6,12 +6,12 @@ begin; insert into t1 values(1); insert into t2 select * from t1; commit; -show binlog events from 98; +show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 98 Query 1 # use `test`; BEGIN -master-bin.000001 166 Query 1 # use `test`; insert into t1 values(1) -master-bin.000001 253 Query 1 # use `test`; insert into t2 select * from t1 -master-bin.000001 347 Xid 1 # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; insert into t1 values(1) +master-bin.000001 # Query # # use `test`; insert into t2 select * from t1 +master-bin.000001 # Xid # # COMMIT /* XID */ delete from t1; delete from t2; reset master; @@ -21,12 +21,12 @@ insert into t2 select * from t1; rollback; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back -show binlog events from 98; +show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 98 Query 1 # use `test`; BEGIN -master-bin.000001 166 Query 1 # use `test`; insert into t1 values(2) -master-bin.000001 253 Query 1 # use `test`; insert into t2 select * from t1 -master-bin.000001 347 Query 1 # use `test`; ROLLBACK +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; insert into t1 values(2) +master-bin.000001 # Query # # use `test`; insert into t2 select * from t1 +master-bin.000001 # Query # # use `test`; ROLLBACK delete from t1; delete from t2; reset master; @@ -39,15 +39,15 @@ rollback to savepoint my_savepoint; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back commit; -show binlog events from 98; +show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 98 Query 1 # use `test`; BEGIN -master-bin.000001 166 Query 1 # use `test`; insert into t1 values(3) -master-bin.000001 253 Query 1 # use `test`; savepoint my_savepoint -master-bin.000001 338 Query 1 # use `test`; insert into t1 values(4) -master-bin.000001 425 Query 1 # use `test`; insert into t2 select * from t1 -master-bin.000001 519 Query 1 # use `test`; rollback to savepoint my_savepoint -master-bin.000001 616 Xid 1 # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; insert into t1 values(3) +master-bin.000001 # Query # # use `test`; savepoint my_savepoint +master-bin.000001 # Query # # use `test`; insert into t1 values(4) +master-bin.000001 # Query # # use `test`; insert into t2 select * from t1 +master-bin.000001 # Query # # use `test`; rollback to savepoint my_savepoint +master-bin.000001 # Xid # # COMMIT /* XID */ delete from t1; delete from t2; reset master; @@ -65,16 +65,16 @@ select a from t1 order by a; a 5 7 -show binlog events from 98; +show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 98 Query 1 # use `test`; BEGIN -master-bin.000001 166 Query 1 # use `test`; insert into t1 values(5) -master-bin.000001 253 Query 1 # use `test`; savepoint my_savepoint -master-bin.000001 338 Query 1 # use `test`; insert into t1 values(6) -master-bin.000001 425 Query 1 # use `test`; insert into t2 select * from t1 -master-bin.000001 519 Query 1 # use `test`; rollback to savepoint my_savepoint -master-bin.000001 616 Query 1 # use `test`; insert into t1 values(7) -master-bin.000001 703 Xid 1 # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; insert into t1 values(5) +master-bin.000001 # Query # # use `test`; savepoint my_savepoint +master-bin.000001 # Query # # use `test`; insert into t1 values(6) +master-bin.000001 # Query # # use `test`; insert into t2 select * from t1 +master-bin.000001 # Query # # use `test`; rollback to savepoint my_savepoint +master-bin.000001 # Query # # use `test`; insert into t1 values(7) +master-bin.000001 # Xid # # COMMIT /* XID */ delete from t1; delete from t2; reset master; @@ -87,46 +87,46 @@ insert into t2 select * from t1; select get_lock("a",10); get_lock("a",10) 1 -show binlog events from 98; +show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 98 Query 1 # use `test`; BEGIN -master-bin.000001 166 Query 1 # use `test`; insert into t1 values(8) -master-bin.000001 253 Query 1 # use `test`; insert into t2 select * from t1 -master-bin.000001 347 Query 1 # use `test`; ROLLBACK +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; insert into t1 values(8) +master-bin.000001 # Query # # use `test`; insert into t2 select * from t1 +master-bin.000001 # Query # # use `test`; ROLLBACK delete from t1; delete from t2; reset master; insert into t1 values(9); insert into t2 select * from t1; -show binlog events from 98; +show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 98 Query 1 # use `test`; BEGIN -master-bin.000001 166 Query 1 # use `test`; insert into t1 values(9) -master-bin.000001 253 Xid 1 # COMMIT /* XID */ -master-bin.000001 280 Query 1 # use `test`; insert into t2 select * from t1 +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; insert into t1 values(9) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; insert into t2 select * from t1 delete from t1; delete from t2; reset master; insert into t1 values(10); begin; insert into t2 select * from t1; -show binlog events from 98; +show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 98 Query 1 # use `test`; BEGIN -master-bin.000001 166 Query 1 # use `test`; insert into t1 values(10) -master-bin.000001 254 Xid 1 # COMMIT /* XID */ -master-bin.000001 281 Query 1 # use `test`; insert into t2 select * from t1 +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; insert into t1 values(10) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; insert into t2 select * from t1 insert into t1 values(11); commit; -show binlog events from 98; +show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 98 Query 1 # use `test`; BEGIN -master-bin.000001 166 Query 1 # use `test`; insert into t1 values(10) -master-bin.000001 254 Xid 1 # COMMIT /* XID */ -master-bin.000001 281 Query 1 # use `test`; insert into t2 select * from t1 -master-bin.000001 375 Query 1 # use `test`; BEGIN -master-bin.000001 443 Query 1 # use `test`; insert into t1 values(11) -master-bin.000001 531 Xid 1 # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; insert into t1 values(10) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; insert into t2 select * from t1 +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; insert into t1 values(11) +master-bin.000001 # Xid # # COMMIT /* XID */ alter table t2 engine=INNODB; delete from t1; delete from t2; @@ -135,12 +135,12 @@ begin; insert into t1 values(12); insert into t2 select * from t1; commit; -show binlog events from 98; +show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 98 Query 1 # use `test`; BEGIN -master-bin.000001 166 Query 1 # use `test`; insert into t1 values(12) -master-bin.000001 254 Query 1 # use `test`; insert into t2 select * from t1 -master-bin.000001 348 Xid 1 # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; insert into t1 values(12) +master-bin.000001 # Query # # use `test`; insert into t2 select * from t1 +master-bin.000001 # Xid # # COMMIT /* XID */ delete from t1; delete from t2; reset master; @@ -148,7 +148,7 @@ begin; insert into t1 values(13); insert into t2 select * from t1; rollback; -show binlog events from 98; +show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info delete from t1; delete from t2; @@ -160,11 +160,11 @@ insert into t1 values(15); insert into t2 select * from t1; rollback to savepoint my_savepoint; commit; -show binlog events from 98; +show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 98 Query 1 # use `test`; BEGIN -master-bin.000001 166 Query 1 # use `test`; insert into t1 values(14) -master-bin.000001 254 Xid 1 # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; insert into t1 values(14) +master-bin.000001 # Xid # # COMMIT /* XID */ delete from t1; delete from t2; reset master; @@ -180,12 +180,12 @@ select a from t1 order by a; a 16 18 -show binlog events from 98; +show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 98 Query 1 # use `test`; BEGIN -master-bin.000001 166 Query 1 # use `test`; insert into t1 values(16) -master-bin.000001 254 Query 1 # use `test`; insert into t1 values(18) -master-bin.000001 342 Xid 1 # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; insert into t1 values(16) +master-bin.000001 # Query # # use `test`; insert into t1 values(18) +master-bin.000001 # Xid # # COMMIT /* XID */ delete from t1; delete from t2; alter table t2 type=MyISAM; @@ -232,35 +232,35 @@ insert into t2 values (3); select get_lock("lock1",60); get_lock("lock1",60) 1 -show binlog events from 98; +show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 98 Query 1 # use `test`; BEGIN -master-bin.000001 166 Query 1 # use `test`; insert into t1 values(16) -master-bin.000001 254 Query 1 # use `test`; insert into t1 values(18) -master-bin.000001 342 Xid 1 # COMMIT /* XID */ -master-bin.000001 369 Query 1 # use `test`; BEGIN -master-bin.000001 437 Query 1 # use `test`; delete from t1 -master-bin.000001 514 Xid 1 # COMMIT /* XID */ -master-bin.000001 541 Query 1 # use `test`; BEGIN -master-bin.000001 609 Query 1 # use `test`; delete from t2 -master-bin.000001 686 Xid 1 # COMMIT /* XID */ -master-bin.000001 713 Query 1 # use `test`; alter table t2 type=MyISAM -master-bin.000001 802 Query 1 # use `test`; BEGIN -master-bin.000001 870 Query 1 # use `test`; insert into t1 values (1) -master-bin.000001 958 Xid 1 # COMMIT /* XID */ -master-bin.000001 985 Query 1 # use `test`; insert into t2 values (20) -master-bin.000001 1074 Query 1 # use `test`; drop table t1,t2 -master-bin.000001 1153 Query 1 # use `test`; create temporary table ti (a int) engine=innodb -master-bin.000001 1263 Query 1 # use `test`; BEGIN -master-bin.000001 1331 Query 1 # use `test`; insert into ti values(1) -master-bin.000001 1418 Xid 1 # COMMIT /* XID */ -master-bin.000001 1445 Query 1 # use `test`; create temporary table t1 (a int) engine=myisam -master-bin.000001 1555 Query 1 # use `test`; insert t1 values (1) -master-bin.000001 1638 Query 1 # use `test`; create table t0 (n int) -master-bin.000001 1724 Query 1 # use `test`; insert t0 select * from t1 -master-bin.000001 1813 Query 1 # use `test`; insert into t0 select GET_LOCK("lock1",null) -master-bin.000001 1920 Query 1 # use `test`; create table t2 (n int) engine=innodb -master-bin.000001 2020 Query 1 # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `test`.`t1`,`test`.`ti` +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; insert into t1 values(16) +master-bin.000001 # Query # # use `test`; insert into t1 values(18) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; delete from t1 +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; delete from t2 +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; alter table t2 type=MyISAM +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; insert into t1 values (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; insert into t2 values (20) +master-bin.000001 # Query # # use `test`; drop table t1,t2 +master-bin.000001 # Query # # use `test`; create temporary table ti (a int) engine=innodb +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; insert into ti values(1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; create temporary table t1 (a int) engine=myisam +master-bin.000001 # Query # # use `test`; insert t1 values (1) +master-bin.000001 # Query # # use `test`; create table t0 (n int) +master-bin.000001 # Query # # use `test`; insert t0 select * from t1 +master-bin.000001 # Query # # use `test`; insert into t0 select GET_LOCK("lock1",null) +master-bin.000001 # Query # # use `test`; create table t2 (n int) engine=innodb +master-bin.000001 # Query # # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `test`.`t1`,`test`.`ti` do release_lock("lock1"); drop table t0,t2; reset master; diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index 7a12fc87bdc..18394bfc88a 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -573,8 +573,8 @@ count(*) select count(*) from t3 /* must be 1 */; count(*) 1 -show binlog events from 98; +show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 98 Query 1 # use `test`; delete t3.* from t2,t3 where t2.a=t3.a +master-bin.000001 # Query # # use `test`; delete t3.* from t2,t3 where t2.a=t3.a drop table t1, t2, t3; end of tests diff --git a/mysql-test/r/multi_update_tiny_hash.result b/mysql-test/r/multi_update_tiny_hash.result new file mode 100644 index 00000000000..d8983123aac --- /dev/null +++ b/mysql-test/r/multi_update_tiny_hash.result @@ -0,0 +1,45 @@ +drop table if exists t1, t2; +# +# Bug #36676: multiupdate using LEFT JOIN updates only +# first row or fails with an error: +# ERROR 1022 (23000): Can't write; duplicate key in table '' +# + +# +# Multiupdate creates MyISAM temporary table without MEMORY table +# +CREATE TABLE t1 (ID INT); +CREATE TABLE t2 (ID INT, +s1 TEXT, s2 TEXT, s3 VARCHAR(10), s4 TEXT, s5 VARCHAR(10)); +INSERT INTO t1 VALUES (1),(2); +INSERT INTO t2 VALUES (1,'test', 'test', 'test', 'test', 'test'), +(2,'test', 'test', 'test', 'test', 'test'); +SELECT * FROM t1 LEFT JOIN t2 USING(ID); +ID s1 s2 s3 s4 s5 +1 test test test test test +2 test test test test test +UPDATE t1 LEFT JOIN t2 USING(ID) SET s1 = 'changed'; +UPDATE t1 JOIN t2 USING(ID) SET s2 = 'changed'; +UPDATE t1 LEFT JOIN t2 USING(ID) SET s3 = 'changed'; +UPDATE t1 LEFT JOIN t2 USING(ID) SET s4 = 'changed', s5 = 'changed'; +SELECT * FROM t1 LEFT JOIN t2 USING(ID); +ID s1 s2 s3 s4 s5 +1 changed changed changed changed changed +2 changed changed changed changed changed +DROP TABLE t1, t2; +# +# Multiupdate creates temporary MyISAM table from MEMORY table +# +CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY); +CREATE TABLE t2 (id INT, s1 CHAR(255)); +INSERT INTO t1 VALUES (0), (0), (0), (0), (0), (0), (0), (0); +INSERT INTO t1 (SELECT 0 FROM t1); +INSERT INTO t1 (SELECT 0 FROM t1); +INSERT INTO t1 (SELECT 0 FROM t1); +INSERT INTO t2 (SELECT ID, 'a' FROM t1); +UPDATE t1 LEFT JOIN t2 USING(id) SET s1 = 'b'; +SELECT DISTINCT s1 FROM t1 LEFT JOIN t2 USING(id); +s1 +b +DROP TABLE t1, t2; +# End of 5.0 tests diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 24c1cecfb4f..33f64d600bb 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -1104,7 +1104,6 @@ set @a=repeat(' ',20); insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a)); Warnings: Note 1265 Data truncated for column 'v' at row 1 -Note 1265 Data truncated for column 'c' at row 1 select concat('*',v,'*',c,'*',t,'*') from t1; concat('*',v,'*',c,'*',t,'*') *+ *+*+ * diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result index eded1a3fc3b..bc50c686ac6 100644 --- a/mysql-test/r/mysql.result +++ b/mysql-test/r/mysql.result @@ -38,6 +38,8 @@ t2 t3 Tables_in_test t1 +delimiter +1 _ Test delimiter : from command line a diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index 469250a6fa2..4fd87861ded 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -268,7 +268,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; -CREATE DEFINER=`root`@`localhost` procedure p1() +CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() begin select 1; end diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index 9b1da4ffc48..0c4c332395a 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -1166,3 +1166,42 @@ EXPLAIN SELECT a FROM t1 WHERE a='b' OR a='B'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range a a 35 NULL 3 Using where; Using index DROP TABLE t1; +CREATE TABLE t1 (f1 TINYINT(11) UNSIGNED NOT NULL, PRIMARY KEY (f1)); +INSERT INTO t1 VALUES (127),(254),(0),(1),(255); +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 256; +COUNT(*) +5 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 256.0; +COUNT(*) +5 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 255; +COUNT(*) +4 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < -1; +COUNT(*) +0 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -1; +COUNT(*) +5 +DROP TABLE t1; +CREATE TABLE t1 ( f1 TINYINT(11) NOT NULL, PRIMARY KEY (f1)); +INSERT INTO t1 VALUES (127),(126),(0),(-128),(-127); +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 128; +COUNT(*) +5 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 128.0; +COUNT(*) +5 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 127; +COUNT(*) +4 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -129; +COUNT(*) +5 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -129.0; +COUNT(*) +5 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -128; +COUNT(*) +4 +DROP TABLE t1; diff --git a/mysql-test/r/repair.result b/mysql-test/r/repair.result index e0548233b86..c59a5300e64 100644 --- a/mysql-test/r/repair.result +++ b/mysql-test/r/repair.result @@ -115,3 +115,39 @@ SET myisam_repair_threads=@@global.myisam_repair_threads; SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size; DROP TABLE t1; End of 4.1 tests +# Test with a saved table from 4.1 +SHOW TABLE STATUS LIKE 't1'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +t1 MyISAM 9 Fixed 2 5 10 21474836479 1024 0 NULL # # NULL latin1_swedish_ci NULL +SELECT * FROM t1; +id +1 +2 +# Run CHECK TABLE, it should indicate table need a REPAIR TABLE +CHECK TABLE t1 FOR UPGRADE; +Table Op Msg_type Msg_text +test.t1 check error Table upgrade required. Please do "REPAIR TABLE `t1`" to fix it! +# 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 +# Run REPAIR TABLE to upgrade .frm file +REPAIR TABLE t1; +Table Op Msg_type Msg_text +test.t1 repair status OK +SHOW TABLE STATUS LIKE 't1'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +t1 MyISAM 10 Fixed 2 7 14 1970324836974591 1024 0 NULL # # NULL latin1_swedish_ci NULL +SELECT * FROM t1; +id +1 +2 +REPAIR TABLE t1 USE_FRM; +Table Op Msg_type Msg_text +test.t1 repair warning Number of rows changed from 0 to 2 +test.t1 repair status OK +SELECT * FROM t1; +id +1 +2 +DROP TABLE t1; diff --git a/mysql-test/r/rpl_auto_increment_bug33029.result b/mysql-test/r/rpl_auto_increment_bug33029.result new file mode 100644 index 00000000000..fb17553f5a0 --- /dev/null +++ b/mysql-test/r/rpl_auto_increment_bug33029.result @@ -0,0 +1,165 @@ +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; +DROP TABLE IF EXISTS t1, t2; +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS p2; +DROP TRIGGER IF EXISTS tr1; +DROP FUNCTION IF EXISTS f1; +CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY); +CREATE TABLE t2 (id INT AUTO_INCREMENT PRIMARY KEY); +CREATE PROCEDURE p1() +BEGIN +DECLARE ins_count INT DEFAULT 10; +WHILE ins_count > 0 DO +INSERT INTO t1 VALUES (NULL); +SET ins_count = ins_count - 1; +END WHILE; +DELETE FROM t1 WHERE id = 1; +DELETE FROM t1 WHERE id = 2; +DELETE FROM t2 WHERE id = 1; +DELETE FROM t2 WHERE id = 2; +END// +CREATE PROCEDURE p2() +BEGIN +INSERT INTO t1 VALUES (NULL); +DELETE FROM t1 WHERE id = f1(3); +DELETE FROM t1 WHERE id = f1(4); +DELETE FROM t2 WHERE id = 3; +DELETE FROM t2 WHERE id = 4; +END// +CREATE TRIGGER tr1 BEFORE DELETE +ON t1 FOR EACH ROW +BEGIN +INSERT INTO t2 VALUES (NULL); +END// +CREATE FUNCTION f1 (i int) RETURNS int +BEGIN +INSERT INTO t2 VALUES (NULL); +RETURN i; +END// +CALL p1(); +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Intvar # # INSERT_ID=1 +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (NULL) +master-bin.000001 # Intvar # # INSERT_ID=2 +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (NULL) +master-bin.000001 # Intvar # # INSERT_ID=3 +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (NULL) +master-bin.000001 # Intvar # # INSERT_ID=4 +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (NULL) +master-bin.000001 # Intvar # # INSERT_ID=5 +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (NULL) +master-bin.000001 # Intvar # # INSERT_ID=6 +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (NULL) +master-bin.000001 # Intvar # # INSERT_ID=7 +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (NULL) +master-bin.000001 # Intvar # # INSERT_ID=8 +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (NULL) +master-bin.000001 # Intvar # # INSERT_ID=9 +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (NULL) +master-bin.000001 # Intvar # # INSERT_ID=10 +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (NULL) +master-bin.000001 # Query # # use `test`; DELETE FROM t1 WHERE id = 1 +master-bin.000001 # Query # # use `test`; DELETE FROM t1 WHERE id = 2 +master-bin.000001 # Query # # use `test`; DELETE FROM t2 WHERE id = 1 +master-bin.000001 # Query # # use `test`; DELETE FROM t2 WHERE id = 2 +# Result on master +SELECT * FROM t1; +id +3 +4 +5 +6 +7 +8 +9 +10 +SELECT * FROM t2; +id +# Result on slave +SELECT * FROM t1; +id +3 +4 +5 +6 +7 +8 +9 +10 +SELECT * FROM t2; +id +DROP TRIGGER tr1; +CALL p2(); +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Intvar # # INSERT_ID=11 +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (NULL) +master-bin.000001 # Query # # use `test`; DELETE FROM t1 WHERE id = f1(3) +master-bin.000001 # Query # # use `test`; DELETE FROM t1 WHERE id = f1(4) +master-bin.000001 # Query # # use `test`; DELETE FROM t2 WHERE id = 3 +master-bin.000001 # Query # # use `test`; DELETE FROM t2 WHERE id = 4 +# Result on master +SELECT * FROM t1; +id +5 +6 +7 +8 +9 +10 +11 +SELECT * FROM t2; +id +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +# Result on slave +SELECT * FROM t1; +id +5 +6 +7 +8 +9 +10 +11 +SELECT * FROM t2; +id +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +DROP TABLE IF EXISTS t1, t2; +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS p2; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS tr1; diff --git a/mysql-test/r/rpl_packet.result b/mysql-test/r/rpl_packet.result index 9425724b434..88c63994fff 100644 --- a/mysql-test/r/rpl_packet.result +++ b/mysql-test/r/rpl_packet.result @@ -6,6 +6,10 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; drop database if exists DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________; create database DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________; +SET @@global.max_allowed_packet=1024; +SET @@global.net_buffer_length=1024; +STOP SLAVE; +START SLAVE; select @@net_buffer_length, @@max_allowed_packet; @@net_buffer_length @@max_allowed_packet 1024 1024 diff --git a/mysql-test/r/rpl_sp.result b/mysql-test/r/rpl_sp.result index 0fe1b4b908e..a5d01f693f5 100644 --- a/mysql-test/r/rpl_sp.result +++ b/mysql-test/r/rpl_sp.result @@ -386,7 +386,7 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # drop database if exists mysqltest1 master-bin.000001 # Query 1 # create database mysqltest1 master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a varchar(100)) -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo() +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo`() begin declare b int; set b = 8; @@ -396,20 +396,20 @@ end master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values ( NAME_CONST('b',8)) master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (unix_timestamp()) master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo2() +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo2`() select * from mysqltest1.t1 master-bin.000001 # Query 1 # use `mysqltest1`; alter procedure foo2 contains sql master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1 master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int) master-bin.000001 # Query 1 # use `mysqltest1`; create table t2 like t1 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo3() -deterministic +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo3`() + DETERMINISTIC insert into t1 values (15) master-bin.000001 # Query 1 # use `mysqltest1`; grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1 master-bin.000001 # Query 1 # use `mysqltest1`; grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1 master-bin.000001 # Query 1 # use `mysqltest1`; grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` procedure foo4() -deterministic +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` PROCEDURE `foo4`() + DETERMINISTIC begin insert into t2 values(3); insert into t1 values (5); @@ -423,8 +423,8 @@ master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (5) master-bin.000001 # Query 1 # use `mysqltest1`; delete from t2 master-bin.000001 # Query 1 # use `mysqltest1`; alter table t2 add unique (a) master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo4 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo4() -deterministic +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo4`() + DETERMINISTIC begin insert into t2 values(20),(20); end @@ -433,9 +433,8 @@ master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo4 master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo2 master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo3 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn1(x int) -returns int -deterministic +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`(x int) RETURNS int(11) + DETERMINISTIC begin insert into t1 values (x); return x+2; @@ -444,32 +443,27 @@ master-bin.000001 # Query 1 # use `mysqltest1`; delete t1,t2 from t1,t2 master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(20) master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(fn1(21)) master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn1() -returns int -no sql +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`() RETURNS int(11) + NO SQL begin return unix_timestamp(); end master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values(fn1()) -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` function fn2() -returns int -no sql +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` FUNCTION `fn2`() RETURNS int(11) + NO SQL begin return unix_timestamp(); end -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn3() -returns int -not deterministic -reads sql data +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` FUNCTION `fn3`() RETURNS int(11) + READS SQL DATA begin return 0; end master-bin.000001 # Query 1 # use `mysqltest1`; delete from t2 master-bin.000001 # Query 1 # use `mysqltest1`; alter table t2 add unique (a) master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn1(x int) -returns int +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`(x int) RETURNS int(11) begin insert into t2 values(x),(x); return 10; @@ -482,15 +476,15 @@ master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (1) master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 master-bin.000001 # Query 1 # use `mysqltest1`; drop trigger trg master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (1) -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo() -not deterministic -reads sql data +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo`() + READS SQL DATA select * from t1 master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1 master-bin.000001 # Query 1 # drop database mysqltest1 master-bin.000001 # Query 1 # drop user "zedjzlcsjhd"@127.0.0.1 -master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` function f1() returns int reads sql data +master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) + READS SQL DATA begin declare var integer; declare c cursor for select a from v1; @@ -499,19 +493,21 @@ fetch c into var; close c; return var; end -master-bin.000001 # Query 1 # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 as a +master-bin.000001 # Query 1 # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `a` master-bin.000001 # Query 1 # use `test`; create table t1 (a int) master-bin.000001 # Query 1 # use `test`; insert into t1 (a) values (f1()) master-bin.000001 # Query 1 # use `test`; drop view v1 master-bin.000001 # Query 1 # use `test`; drop function f1 master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS t1 master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1(col VARCHAR(10)) -master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE p1(arg VARCHAR(10)) +master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`(arg VARCHAR(10)) INSERT INTO t1 VALUES(arg) master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test')) master-bin.000001 # Query 1 # use `test`; DROP PROCEDURE p1 -master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE p1() SET @a = 1 -master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION f1() RETURNS INT RETURN 0 +master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() +SET @a = 1 +master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) +RETURN 0 master-bin.000001 # Query 1 # use `test`; DROP PROCEDURE p1 master-bin.000001 # Query 1 # use `test`; DROP FUNCTION f1 master-bin.000001 # Query 1 # use `test`; drop table t1 @@ -520,9 +516,10 @@ master-bin.000001 # Query 1 # drop database if exists mysqltest2 master-bin.000001 # Query 1 # create database mysqltest master-bin.000001 # Query 1 # create database mysqltest2 master-bin.000001 # Query 1 # use `mysqltest2`; create table t ( t integer ) -master-bin.000001 # Query 1 # use `mysqltest2`; CREATE DEFINER=`root`@`localhost` procedure mysqltest.test() begin end +master-bin.000001 # Query 1 # use `mysqltest2`; CREATE DEFINER=`root`@`localhost` PROCEDURE `mysqltest`.`test`() +begin end master-bin.000001 # Query 1 # use `mysqltest2`; insert into t values ( 1 ) -master-bin.000001 # Query 1 # use `mysqltest2`; CREATE DEFINER=`root`@`localhost` function f1 () returns int +master-bin.000001 # Query 1 # use `mysqltest2`; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) begin insert into t values (1); return 0; @@ -532,3 +529,407 @@ set global log_bin_trust_function_creators=0; set global log_bin_trust_function_creators=0; drop database mysqltest; drop database mysqltest2; +use test; +/*!50001 create procedure `mysqltestbug36570_p1`() */ +begin +select 1; +end| +use mysql| +create procedure test.` mysqltestbug36570_p2`(/*!50001 a int*/)`label`: +begin +select a; +end| +/*!50001 create function test.mysqltestbug36570_f1() */ +returns int +/*!50001 deterministic */ +begin +return 3; +end| +use test| +show procedure status like '%mysqltestbug36570%'; +Db Name Type Definer Modified Created Security_type Comment +test mysqltestbug36570_p2 PROCEDURE root@localhost t t DEFINER +test mysqltestbug36570_p1 PROCEDURE root@localhost t t DEFINER +show create procedure ` mysqltestbug36570_p2`; +Procedure sql_mode Create Procedure + mysqltestbug36570_p2 CREATE DEFINER=`root`@`localhost` PROCEDURE ` mysqltestbug36570_p2`(/*!50001 a int*/) +`label`: +begin +select a; +end +show procedure status like '%mysqltestbug36570%'; +Db Name Type Definer Modified Created Security_type Comment +test mysqltestbug36570_p2 PROCEDURE root@localhost t t DEFINER +test mysqltestbug36570_p1 PROCEDURE root@localhost t t DEFINER +show create procedure ` mysqltestbug36570_p2`; +Procedure sql_mode Create Procedure + mysqltestbug36570_p2 CREATE DEFINER=`root`@`localhost` PROCEDURE ` mysqltestbug36570_p2`(/*!50001 a int*/) +`label`: +begin +select a; +end +call ` mysqltestbug36570_p2`(42); +a +42 +show function status like '%mysqltestbug36570%'; +Db Name Type Definer Modified Created Security_type Comment +test mysqltestbug36570_f1 FUNCTION root@localhost t t DEFINER +flush logs; +/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +DELIMITER /*!*/; +ROLLBACK/*!*/; +SET TIMESTAMP=t/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +drop database if exists mysqltest1 +/*!*/; +SET TIMESTAMP=t/*!*/; +create database mysqltest1 +/*!*/; +use mysqltest1/*!*/; +SET TIMESTAMP=t/*!*/; +create table t1 (a varchar(100)) +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` PROCEDURE `foo`() +begin +declare b int; +set b = 8; +insert into t1 values (b); +insert into t1 values (unix_timestamp()); +end +/*!*/; +SET TIMESTAMP=t/*!*/; +insert into t1 values ( NAME_CONST('b',8)) +/*!*/; +SET TIMESTAMP=t/*!*/; +insert into t1 values (unix_timestamp()) +/*!*/; +SET TIMESTAMP=t/*!*/; +delete from t1 +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` PROCEDURE `foo2`() +select * from mysqltest1.t1 +/*!*/; +SET TIMESTAMP=t/*!*/; +alter procedure foo2 contains sql +/*!*/; +SET TIMESTAMP=t/*!*/; +drop table t1 +/*!*/; +SET TIMESTAMP=t/*!*/; +create table t1 (a int) +/*!*/; +SET TIMESTAMP=t/*!*/; +create table t2 like t1 +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` PROCEDURE `foo3`() + DETERMINISTIC +insert into t1 values (15) +/*!*/; +SET TIMESTAMP=t/*!*/; +grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1 +/*!*/; +SET TIMESTAMP=t/*!*/; +grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1 +/*!*/; +SET TIMESTAMP=t/*!*/; +grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1 +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` PROCEDURE `foo4`() + DETERMINISTIC +begin +insert into t2 values(3); +insert into t1 values (5); +end +/*!*/; +SET TIMESTAMP=t/*!*/; +insert into t2 values(3) +/*!*/; +SET TIMESTAMP=t/*!*/; +insert into t1 values (15) +/*!*/; +SET TIMESTAMP=t/*!*/; +insert into t2 values(3) +/*!*/; +SET TIMESTAMP=t/*!*/; +alter procedure foo4 sql security invoker +/*!*/; +SET TIMESTAMP=t/*!*/; +insert into t2 values(3) +/*!*/; +SET TIMESTAMP=t/*!*/; +insert into t1 values (5) +/*!*/; +SET TIMESTAMP=t/*!*/; +delete from t2 +/*!*/; +SET TIMESTAMP=t/*!*/; +alter table t2 add unique (a) +/*!*/; +SET TIMESTAMP=t/*!*/; +drop procedure foo4 +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` PROCEDURE `foo4`() + DETERMINISTIC +begin +insert into t2 values(20),(20); +end +/*!*/; +SET TIMESTAMP=t/*!*/; +insert into t2 values(20),(20) +/*!*/; +SET TIMESTAMP=t/*!*/; +drop procedure foo4 +/*!*/; +SET TIMESTAMP=t/*!*/; +drop procedure foo +/*!*/; +SET TIMESTAMP=t/*!*/; +drop procedure foo2 +/*!*/; +SET TIMESTAMP=t/*!*/; +drop procedure foo3 +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`(x int) RETURNS int(11) + DETERMINISTIC +begin +insert into t1 values (x); +return x+2; +end +/*!*/; +SET TIMESTAMP=t/*!*/; +delete t1,t2 from t1,t2 +/*!*/; +SET TIMESTAMP=t/*!*/; +SELECT `mysqltest1`.`fn1`(20) +/*!*/; +SET TIMESTAMP=t/*!*/; +insert into t2 values(fn1(21)) +/*!*/; +SET TIMESTAMP=t/*!*/; +drop function fn1 +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`() RETURNS int(11) + NO SQL +begin +return unix_timestamp(); +end +/*!*/; +SET TIMESTAMP=t/*!*/; +delete from t1 +/*!*/; +SET TIMESTAMP=t/*!*/; +insert into t1 values(fn1()) +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` FUNCTION `fn2`() RETURNS int(11) + NO SQL +begin +return unix_timestamp(); +end +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` FUNCTION `fn3`() RETURNS int(11) + READS SQL DATA +begin +return 0; +end +/*!*/; +SET TIMESTAMP=t/*!*/; +delete from t2 +/*!*/; +SET TIMESTAMP=t/*!*/; +alter table t2 add unique (a) +/*!*/; +SET TIMESTAMP=t/*!*/; +drop function fn1 +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`(x int) RETURNS int(11) +begin +insert into t2 values(x),(x); +return 10; +end +/*!*/; +SET TIMESTAMP=t/*!*/; +SELECT `mysqltest1`.`fn1`(100) +/*!*/; +SET TIMESTAMP=t/*!*/; +SELECT `mysqltest1`.`fn1`(20) +/*!*/; +SET TIMESTAMP=t/*!*/; +delete from t1 +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10 +/*!*/; +SET TIMESTAMP=t/*!*/; +insert into t1 values (1) +/*!*/; +SET TIMESTAMP=t/*!*/; +delete from t1 +/*!*/; +SET TIMESTAMP=t/*!*/; +drop trigger trg +/*!*/; +SET TIMESTAMP=t/*!*/; +insert into t1 values (1) +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` PROCEDURE `foo`() + READS SQL DATA +select * from t1 +/*!*/; +SET TIMESTAMP=t/*!*/; +drop procedure foo +/*!*/; +SET TIMESTAMP=t/*!*/; +drop function fn1 +/*!*/; +SET TIMESTAMP=t/*!*/; +drop database mysqltest1 +/*!*/; +SET TIMESTAMP=t/*!*/; +drop user "zedjzlcsjhd"@127.0.0.1 +/*!*/; +use test/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) + READS SQL DATA +begin +declare var integer; +declare c cursor for select a from v1; +open c; +fetch c into var; +close c; +return var; +end +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `a` +/*!*/; +SET TIMESTAMP=t/*!*/; +create table t1 (a int) +/*!*/; +SET TIMESTAMP=t/*!*/; +insert into t1 (a) values (f1()) +/*!*/; +SET TIMESTAMP=t/*!*/; +drop view v1 +/*!*/; +SET TIMESTAMP=t/*!*/; +drop function f1 +/*!*/; +SET TIMESTAMP=t/*!*/; +DROP TABLE IF EXISTS t1 +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE TABLE t1(col VARCHAR(10)) +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`(arg VARCHAR(10)) +INSERT INTO t1 VALUES(arg) +/*!*/; +SET TIMESTAMP=t/*!*/; +INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test')) +/*!*/; +SET TIMESTAMP=t/*!*/; +DROP PROCEDURE p1 +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() +SET @a = 1 +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) +RETURN 0 +/*!*/; +SET TIMESTAMP=t/*!*/; +DROP PROCEDURE p1 +/*!*/; +SET TIMESTAMP=t/*!*/; +DROP FUNCTION f1 +/*!*/; +SET TIMESTAMP=t/*!*/; +drop table t1 +/*!*/; +SET TIMESTAMP=t/*!*/; +drop database if exists mysqltest +/*!*/; +SET TIMESTAMP=t/*!*/; +drop database if exists mysqltest2 +/*!*/; +SET TIMESTAMP=t/*!*/; +create database mysqltest +/*!*/; +SET TIMESTAMP=t/*!*/; +create database mysqltest2 +/*!*/; +use mysqltest2/*!*/; +SET TIMESTAMP=t/*!*/; +create table t ( t integer ) +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` PROCEDURE `mysqltest`.`test`() +begin end +/*!*/; +SET TIMESTAMP=t/*!*/; +insert into t values ( 1 ) +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) +begin +insert into t values (1); +return 0; +end +/*!*/; +use mysqltest/*!*/; +SET TIMESTAMP=t/*!*/; +SELECT `mysqltest2`.`f1`() +/*!*/; +SET TIMESTAMP=t/*!*/; +drop database mysqltest +/*!*/; +SET TIMESTAMP=t/*!*/; +drop database mysqltest2 +/*!*/; +use test/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` PROCEDURE `mysqltestbug36570_p1`() +begin +select 1; +end +/*!*/; +use mysql/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` PROCEDURE `test`.` mysqltestbug36570_p2`(/*!50001 a int*/) +`label`: +begin +select a; +end +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` FUNCTION `test`.`mysqltestbug36570_f1`() RETURNS int(11) + DETERMINISTIC +begin +return 3; +end +/*!*/; +DELIMITER ; +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +use test; +drop procedure mysqltestbug36570_p1; +drop procedure ` mysqltestbug36570_p2`; +drop function mysqltestbug36570_f1; diff --git a/mysql-test/r/rpl_user.result b/mysql-test/r/rpl_user.result index 25e0f310f55..be24ce0bc46 100644 --- a/mysql-test/r/rpl_user.result +++ b/mysql-test/r/rpl_user.result @@ -35,11 +35,11 @@ drop user 'not_exist_user1'@'fakehost', 'not_exist_user2'@'fakehost'; ERROR HY000: Operation DROP USER failed for 'not_exist_user1'@'fakehost','not_exist_user2'@'fakehost' select Host,User from mysql.user where Host='fakehost'; Host User -show binlog events from 98; +show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 98 Query 1 # use `test`; create user 'foo'@'fakehost' -master-bin.000001 189 Query 1 # use `test`; create user 'foo'@'fakehost', 'bar'@'fakehost' -master-bin.000001 298 Query 1 # use `test`; rename user 'foo'@'fakehost' to 'foofoo'@'fakehost' -master-bin.000001 412 Query 1 # use `test`; rename user 'not_exist_user1'@'fakehost' to 'foobar'@'fakehost', 'bar'@'fakehost' to 'barbar'@'fakehost' -master-bin.000001 579 Query 1 # use `test`; drop user 'foofoo'@'fakehost' -master-bin.000001 671 Query 1 # use `test`; drop user 'not_exist_user1'@'fakehost', 'barbar'@'fakehost' +master-bin.000001 # Query # # use `test`; create user 'foo'@'fakehost' +master-bin.000001 # Query # # use `test`; create user 'foo'@'fakehost', 'bar'@'fakehost' +master-bin.000001 # Query # # use `test`; rename user 'foo'@'fakehost' to 'foofoo'@'fakehost' +master-bin.000001 # Query # # use `test`; rename user 'not_exist_user1'@'fakehost' to 'foobar'@'fakehost', 'bar'@'fakehost' to 'barbar'@'fakehost' +master-bin.000001 # Query # # use `test`; drop user 'foofoo'@'fakehost' +master-bin.000001 # Query # # use `test`; drop user 'not_exist_user1'@'fakehost', 'barbar'@'fakehost' diff --git a/mysql-test/r/rpl_view.result b/mysql-test/r/rpl_view.result index be7ed6e8c2a..addaba8c379 100644 --- a/mysql-test/r/rpl_view.result +++ b/mysql-test/r/rpl_view.result @@ -47,11 +47,11 @@ show binlog events limit 1,100; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Query 1 # use `test`; create table t1 (a int) slave-bin.000001 # Query 1 # use `test`; insert into t1 values (1) -slave-bin.000001 # Query 1 # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select a from t1 +slave-bin.000001 # Query 1 # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`a` AS `a` from `test`.`t1` slave-bin.000001 # Query 1 # use `test`; insert into v1 values (2) slave-bin.000001 # Query 1 # use `test`; update v1 set a=3 where a=1 slave-bin.000001 # Query 1 # use `test`; delete from v1 where a=2 -slave-bin.000001 # Query 1 # use `test`; ALTER ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select a as b from t1 +slave-bin.000001 # Query 1 # use `test`; ALTER ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`a` AS `b` from `test`.`t1` slave-bin.000001 # Query 1 # use `test`; drop view v1 slave-bin.000001 # Query 1 # use `test`; drop table t1 @@ -112,4 +112,18 @@ CREATE VIEW v1 AS SELECT * FROM t1; ERROR 42S01: Table 'v1' already exists DROP VIEW v1; DROP TABLE t1; +CREATE TABLE t1 (a INT); +# create view as output from mysqldump 10.11 (5.0.62) +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` < 3) */ +/*!50002 WITH CASCADED CHECK OPTION */; +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` < 3) WITH CASCADED CHECK OPTION +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` < 3) WITH CASCADED CHECK OPTION +DROP VIEW v1; +DROP TABLE t1; End of 5.0 tests diff --git a/mysql-test/r/sp-code.result b/mysql-test/r/sp-code.result index 855cabc25d8..2848306b442 100644 --- a/mysql-test/r/sp-code.result +++ b/mysql-test/r/sp-code.result @@ -842,4 +842,32 @@ Pos Instruction 21 jump 3 drop procedure proc_33618_h; drop procedure proc_33618_c; +drop procedure if exists p_20906_a; +drop procedure if exists p_20906_b; +create procedure p_20906_a() SET @a=@a+1, @b=@b+1; +show procedure code p_20906_a; +Pos Instruction +0 stmt 32 "SET @a=@a+1" +1 stmt 32 "SET @b=@b+1" +set @a=1; +set @b=1; +call p_20906_a(); +select @a, @b; +@a @b +2 2 +create procedure p_20906_b() SET @a=@a+1, @b=@b+1, @c=@c+1; +show procedure code p_20906_b; +Pos Instruction +0 stmt 32 "SET @a=@a+1" +1 stmt 32 "SET @b=@b+1" +2 stmt 32 "SET @c=@c+1" +set @a=1; +set @b=1; +set @c=1; +call p_20906_b(); +select @a, @b, @c; +@a @b @c +2 2 2 +drop procedure p_20906_a; +drop procedure p_20906_b; End of 5.0 tests. diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result index 0a714635f70..34869862a63 100644 --- a/mysql-test/r/strict.result +++ b/mysql-test/r/strict.result @@ -934,8 +934,6 @@ NULL NULL DROP TABLE t1; CREATE TABLE t1 (col1 CHAR(5), col2 VARCHAR(6)); INSERT INTO t1 VALUES ('hello', 'hello'),('he', 'he'),('hello ', 'hello '); -Warnings: -Note 1265 Data truncated for column 'col1' at row 3 INSERT INTO t1 (col1) VALUES ('hellobob'); ERROR 22001: Data too long for column 'col1' at row 1 INSERT INTO t1 (col2) VALUES ('hellobob'); diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 2de2589fc92..12e3aac486e 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -4374,4 +4374,26 @@ a4 f3 a6 1 NULL NULL 2 NULL NULL DROP TABLE t1, t2, t3, t4; +create table t1 (a float(5,4) zerofill); +create table t2 (a float(5,4),b float(2,0)); +select t1.a from t1 where +t1.a= (select b from t2 limit 1) and not +t1.a= (select a from t2 limit 1) ; +a +drop table t1, t2; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 GROUP BY a); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +Warnings: +Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,<exists>(select 1 AS `1` from `test`.`t1` group by `test`.`t1`.`a` having (<cache>(1) = <ref_null_helper>(1)))) +EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 WHERE a > 3 GROUP BY a); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort +Warnings: +Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,<exists>(select 1 AS `1` from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` having (<cache>(1) = <ref_null_helper>(1)))) +DROP TABLE t1; End of 5.0 tests. diff --git a/mysql-test/r/subselect3.result b/mysql-test/r/subselect3.result index bdf00e4c307..5221fa09744 100644 --- a/mysql-test/r/subselect3.result +++ b/mysql-test/r/subselect3.result @@ -758,5 +758,25 @@ EXPLAIN SELECT a FROM t1 WHERE a NOT IN (SELECT a FROM t2); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where 2 DEPENDENT SUBQUERY t2 unique_subquery PRIMARY PRIMARY 4 func 1 Using index; Using where -DROP TABLE t1; +DROP TABLE t1, t2; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES(1); +CREATE TABLE t2 (placeholder CHAR(11)); +INSERT INTO t2 VALUES("placeholder"); +SELECT ROW(1, 2) IN (SELECT t1.a, 2) FROM t1 GROUP BY t1.a; +ROW(1, 2) IN (SELECT t1.a, 2) +1 +SELECT ROW(1, 2) IN (SELECT t1.a, 2 FROM t2) FROM t1 GROUP BY t1.a; +ROW(1, 2) IN (SELECT t1.a, 2 FROM t2) +1 +DROP TABLE t1, t2; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +CREATE TABLE t2 SELECT * FROM t1; +SELECT 1 FROM t1 WHERE t1.a NOT IN (SELECT 1 FROM t1, t2 WHERE 0); +1 +1 +1 +1 +DROP TABLE t1, t2; End of 5.0 tests diff --git a/mysql-test/r/type_binary.result b/mysql-test/r/type_binary.result index aaa46ab415e..debf4ff8fb8 100644 --- a/mysql-test/r/type_binary.result +++ b/mysql-test/r/type_binary.result @@ -125,7 +125,6 @@ create table t1 (c char(2), vc varchar(2)); insert into t1 values(0x4120, 0x4120); insert into t1 values(0x412020, 0x412020); Warnings: -Note 1265 Data truncated for column 'c' at row 1 Note 1265 Data truncated for column 'vc' at row 1 drop table t1; set @old_sql_mode= @@sql_mode, sql_mode= 'traditional'; diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result index 80d233ee16a..8eba0de9e89 100644 --- a/mysql-test/r/type_blob.result +++ b/mysql-test/r/type_blob.result @@ -821,4 +821,156 @@ LENGTH(c) CHAR_LENGTH(c) 65535 65535 65535 65535 DROP TABLE t; +drop table if exists b15776; +create table b15776 (data blob(2147483647)); +drop table b15776; +create table b15776 (data blob(-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 '-1))' at line 1 +create table b15776 (data blob(2147483648)); +drop table b15776; +create table b15776 (data blob(4294967294)); +drop table b15776; +create table b15776 (data blob(4294967295)); +drop table b15776; +create table b15776 (data blob(4294967296)); +ERROR 42000: Display width out of range for column 'data' (max = 4294967295) +CREATE TABLE b15776 (a blob(2147483647), b blob(2147483648), c blob(4294967295), a1 text(2147483647), b1 text(2147483648), c1 text(4294967295) ); +show columns from b15776; +Field Type Null Key Default Extra +a longblob YES NULL +b longblob YES NULL +c longblob YES NULL +a1 longtext YES NULL +b1 longtext YES NULL +c1 longtext YES NULL +drop table b15776; +CREATE TABLE b15776 (a blob(4294967296)); +ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +CREATE TABLE b15776 (a text(4294967296)); +ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +CREATE TABLE b15776 (a blob(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); +ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +CREATE TABLE b15776 (a text(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); +ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +CREATE TABLE b15776 (a int(0)); +INSERT INTO b15776 values (NULL), (1), (42), (654); +SELECT * from b15776 ORDER BY a; +a +NULL +1 +42 +654 +DROP TABLE b15776; +CREATE TABLE b15776 (a int(-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 '-1))' at line 1 +CREATE TABLE b15776 (a int(255)); +DROP TABLE b15776; +CREATE TABLE b15776 (a int(256)); +ERROR 42000: Display width out of range for column 'a' (max = 255) +CREATE TABLE b15776 (data blob(-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 '-1))' at line 1 +CREATE TABLE b15776 (a char(2147483647)); +ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead +CREATE TABLE b15776 (a char(2147483648)); +ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead +CREATE TABLE b15776 (a char(4294967295)); +ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead +CREATE TABLE b15776 (a char(4294967296)); +ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +CREATE TABLE b15776 (a year(4294967295)); +INSERT INTO b15776 VALUES (42); +SELECT * FROM b15776; +a +2042 +DROP TABLE b15776; +CREATE TABLE b15776 (a year(4294967296)); +ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +CREATE TABLE b15776 (a year(0)); +DROP TABLE b15776; +CREATE TABLE b15776 (a year(-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 '-2))' at line 1 +CREATE TABLE b15776 (a timestamp(4294967294)); +Warnings: +Warning 1287 'TIMESTAMP(4294967294)' is deprecated; use 'TIMESTAMP' instead +DROP TABLE b15776; +CREATE TABLE b15776 (a timestamp(4294967295)); +Warnings: +Warning 1287 'TIMESTAMP(4294967295)' is deprecated; use 'TIMESTAMP' instead +DROP TABLE b15776; +CREATE TABLE b15776 (a timestamp(4294967296)); +ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +CREATE TABLE b15776 (a timestamp(-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 '-1))' at line 1 +CREATE TABLE b15776 (a timestamp(-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 '-2))' at line 1 +CREATE TABLE b15776 (a int(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); +ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +CREATE TABLE b15776 (a char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); +ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +CREATE TABLE b15776 (a year(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); +ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +CREATE TABLE b15776 (a timestamp(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); +ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +CREATE TABLE b15776 select cast(null as char(4294967295)); +show columns from b15776; +Field Type Null Key Default Extra +cast(null as char(4294967295)) char(0) YES NULL +drop table b15776; +CREATE TABLE b15776 select cast(null as nchar(4294967295)); +show columns from b15776; +Field Type Null Key Default Extra +cast(null as nchar(4294967295)) char(0) YES NULL +drop table b15776; +CREATE TABLE b15776 select cast(null as binary(4294967295)); +show columns from b15776; +Field Type Null Key Default Extra +cast(null as binary(4294967295)) binary(0) YES NULL +drop table b15776; +explain select cast(1 as char(4294967295)); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used +explain select cast(1 as nchar(4294967295)); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used +explain select cast(1 as binary(4294967295)); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used +explain select cast(1 as char(4294967296)); +ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295) +explain select cast(1 as nchar(4294967296)); +ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295) +explain select cast(1 as binary(4294967296)); +ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295) +explain select cast(1 as decimal(-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 '-1))' at line 1 +explain select cast(1 as decimal(64, 30)); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used +explain select cast(1 as decimal(64, 999999999999999999999999999999)); +Got one of the listed errors +explain select cast(1 as decimal(4294967296)); +Got one of the listed errors +explain select cast(1 as decimal(999999999999999999999999999999999999)); +Got one of the listed errors +explain select convert(1, char(4294967295)); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used +explain select convert(1, char(4294967296)); +ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295) +explain select convert(1, char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); +ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295) +explain select convert(1, nchar(4294967295)); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used +explain select convert(1, nchar(4294967296)); +ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295) +explain select convert(1, nchar(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); +ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295) +explain select convert(1, binary(4294967295)); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used +explain select convert(1, binary(4294967296)); +ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295) +explain select convert(1, binary(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); +ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295) End of 5.0 tests diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result index 2afd42f702e..03fbc898cc5 100644 --- a/mysql-test/r/type_decimal.result +++ b/mysql-test/r/type_decimal.result @@ -946,4 +946,11 @@ SELECT ROUND(20061108085411.000002); ROUND(20061108085411.000002) 20061108085411 DROP TABLE t1, t2, t3, t4, t5, t6; +create table t1(`c` decimal(9,2)); +insert into t1 values (300),(201.11); +select max(case 1 when 1 then c else null end) from t1 group by c; +max(case 1 when 1 then c else null end) +201.11 +300.00 +drop table t1; End of 5.0 tests diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 520bf9426b8..eb7a89c3d12 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -3660,5 +3660,23 @@ DROP TABLE t1; # -- End of test case for Bug#34337. # ----------------------------------------------------------------- +# -- Bug#35193: VIEW query is rewritten without "FROM DUAL", +# -- causing syntax error +# ----------------------------------------------------------------- + +CREATE VIEW v1 AS SELECT 1 FROM DUAL WHERE 1; + +SELECT * FROM v1; +1 +1 +SHOW CREATE TABLE v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `1` from DUAL where 1 + +DROP VIEW v1; + +# -- End of test case for Bug#35193. + +# ----------------------------------------------------------------- # -- End of 5.0 tests. # ----------------------------------------------------------------- diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result index e74f92205aa..94170a04674 100644 --- a/mysql-test/r/warnings.result +++ b/mysql-test/r/warnings.result @@ -305,7 +305,6 @@ set @q = repeat('q', 256); set sql_mode = ''; insert into t1 values(@c, @c, @c); Warnings: -Note 1265 Data truncated for column 'c_char' at row 1 Note 1265 Data truncated for column 'c_varchar' at row 1 Note 1265 Data truncated for column 'c_tinytext' at row 1 insert into t2 values(@c); @@ -322,7 +321,6 @@ Warning 1265 Data truncated for column 'c_tinyblob' at row 1 set sql_mode = 'traditional'; insert into t1 values(@c, @c, @c); Warnings: -Note 1265 Data truncated for column 'c_char' at row 1 Note 1265 Data truncated for column 'c_varchar' at row 1 Note 1265 Data truncated for column 'c_tinytext' at row 1 insert into t2 values(@c); diff --git a/mysql-test/std_data/bug35469.dat b/mysql-test/std_data/bug35469.dat new file mode 100644 index 00000000000..afcd9e9cc95 --- /dev/null +++ b/mysql-test/std_data/bug35469.dat @@ -0,0 +1,3 @@ +"1", "string1" +"2", "string2" +"3", "string3" diff --git a/mysql-test/std_data/bug36055.MYD b/mysql-test/std_data/bug36055.MYD Binary files differnew file mode 100644 index 00000000000..4932a077113 --- /dev/null +++ b/mysql-test/std_data/bug36055.MYD diff --git a/mysql-test/std_data/bug36055.MYI b/mysql-test/std_data/bug36055.MYI Binary files differnew file mode 100644 index 00000000000..531c505c102 --- /dev/null +++ b/mysql-test/std_data/bug36055.MYI diff --git a/mysql-test/std_data/bug36055.frm b/mysql-test/std_data/bug36055.frm Binary files differnew file mode 100644 index 00000000000..11c9cb31dad --- /dev/null +++ b/mysql-test/std_data/bug36055.frm diff --git a/mysql-test/suite/funcs_1/data/innodb_tb1.txt b/mysql-test/std_data/funcs_1/innodb_tb1.txt index 4c20ed1661b..4c20ed1661b 100644 --- a/mysql-test/suite/funcs_1/data/innodb_tb1.txt +++ b/mysql-test/std_data/funcs_1/innodb_tb1.txt diff --git a/mysql-test/suite/funcs_1/data/innodb_tb2.txt b/mysql-test/std_data/funcs_1/innodb_tb2.txt index 8ae7dea6df4..8ae7dea6df4 100644 --- a/mysql-test/suite/funcs_1/data/innodb_tb2.txt +++ b/mysql-test/std_data/funcs_1/innodb_tb2.txt diff --git a/mysql-test/suite/funcs_1/data/innodb_tb3.txt b/mysql-test/std_data/funcs_1/innodb_tb3.txt index a01cc36da54..a01cc36da54 100644 --- a/mysql-test/suite/funcs_1/data/innodb_tb3.txt +++ b/mysql-test/std_data/funcs_1/innodb_tb3.txt diff --git a/mysql-test/suite/funcs_1/data/innodb_tb4.txt b/mysql-test/std_data/funcs_1/innodb_tb4.txt index 5092371d093..5092371d093 100644 --- a/mysql-test/suite/funcs_1/data/innodb_tb4.txt +++ b/mysql-test/std_data/funcs_1/innodb_tb4.txt diff --git a/mysql-test/std_data/funcs_1/load_file.txt b/mysql-test/std_data/funcs_1/load_file.txt new file mode 100644 index 00000000000..930ac1cf371 --- /dev/null +++ b/mysql-test/std_data/funcs_1/load_file.txt @@ -0,0 +1 @@ +Here is content from load_file diff --git a/mysql-test/suite/funcs_1/data/memory_tb1.txt b/mysql-test/std_data/funcs_1/memory_tb1.txt index e266c70f9b8..e266c70f9b8 100644 --- a/mysql-test/suite/funcs_1/data/memory_tb1.txt +++ b/mysql-test/std_data/funcs_1/memory_tb1.txt diff --git a/mysql-test/suite/funcs_1/data/memory_tb2.txt b/mysql-test/std_data/funcs_1/memory_tb2.txt index 8ae7dea6df4..8ae7dea6df4 100644 --- a/mysql-test/suite/funcs_1/data/memory_tb2.txt +++ b/mysql-test/std_data/funcs_1/memory_tb2.txt diff --git a/mysql-test/suite/funcs_1/data/memory_tb3.txt b/mysql-test/std_data/funcs_1/memory_tb3.txt index 2c0433304a8..2c0433304a8 100644 --- a/mysql-test/suite/funcs_1/data/memory_tb3.txt +++ b/mysql-test/std_data/funcs_1/memory_tb3.txt diff --git a/mysql-test/suite/funcs_1/data/memory_tb4.txt b/mysql-test/std_data/funcs_1/memory_tb4.txt index 5a0f0da3415..5a0f0da3415 100644 --- a/mysql-test/suite/funcs_1/data/memory_tb4.txt +++ b/mysql-test/std_data/funcs_1/memory_tb4.txt diff --git a/mysql-test/suite/funcs_1/data/myisam_tb1.txt b/mysql-test/std_data/funcs_1/myisam_tb1.txt index da21f6c71d0..da21f6c71d0 100644 --- a/mysql-test/suite/funcs_1/data/myisam_tb1.txt +++ b/mysql-test/std_data/funcs_1/myisam_tb1.txt diff --git a/mysql-test/suite/funcs_1/data/myisam_tb2.txt b/mysql-test/std_data/funcs_1/myisam_tb2.txt index 4fb43f72a1c..4fb43f72a1c 100644 --- a/mysql-test/suite/funcs_1/data/myisam_tb2.txt +++ b/mysql-test/std_data/funcs_1/myisam_tb2.txt diff --git a/mysql-test/suite/funcs_1/data/myisam_tb3.txt b/mysql-test/std_data/funcs_1/myisam_tb3.txt index 785e51e6b95..785e51e6b95 100644 --- a/mysql-test/suite/funcs_1/data/myisam_tb3.txt +++ b/mysql-test/std_data/funcs_1/myisam_tb3.txt diff --git a/mysql-test/suite/funcs_1/data/myisam_tb4.txt b/mysql-test/std_data/funcs_1/myisam_tb4.txt index 510c6bd3cf9..510c6bd3cf9 100644 --- a/mysql-test/suite/funcs_1/data/myisam_tb4.txt +++ b/mysql-test/std_data/funcs_1/myisam_tb4.txt diff --git a/mysql-test/suite/funcs_1/data/t3.txt b/mysql-test/std_data/funcs_1/t3.txt index a2287c20d43..a2287c20d43 100644 --- a/mysql-test/suite/funcs_1/data/t3.txt +++ b/mysql-test/std_data/funcs_1/t3.txt diff --git a/mysql-test/suite/funcs_1/data/t4.txt b/mysql-test/std_data/funcs_1/t4.txt index 4e2ab19b47c..4e2ab19b47c 100644 --- a/mysql-test/suite/funcs_1/data/t4.txt +++ b/mysql-test/std_data/funcs_1/t4.txt diff --git a/mysql-test/suite/funcs_1/data/t7.txt b/mysql-test/std_data/funcs_1/t7.txt index e3c9aa4c58f..e3c9aa4c58f 100644 --- a/mysql-test/suite/funcs_1/data/t7.txt +++ b/mysql-test/std_data/funcs_1/t7.txt diff --git a/mysql-test/suite/funcs_1/data/t9.txt b/mysql-test/std_data/funcs_1/t9.txt index bac7a54fee5..bac7a54fee5 100644 --- a/mysql-test/suite/funcs_1/data/t9.txt +++ b/mysql-test/std_data/funcs_1/t9.txt diff --git a/mysql-test/suite/funcs_1/README.txt b/mysql-test/suite/funcs_1/README.txt index 7e98d1bc117..65f6226d0f2 100644 --- a/mysql-test/suite/funcs_1/README.txt +++ b/mysql-test/suite/funcs_1/README.txt @@ -25,7 +25,7 @@ SESSION_STATUS SESSION_VARIABLES -3. Some hints: +3. Some hints for maintainers of this suite: - SHOW TABLES ... LIKE '<pattern>' does a case sensitive comparison between the tablename and the pattern. @@ -43,4 +43,12 @@ ERROR 42000: Access denied for user ... to database 'information_schema' DROP DATABASE INFORMATION_SCHEMA; ERROR 42000: Access denied for user ... to database 'INFORMATION_SCHEMA' + - Try to unify results by + --replace_result $engine_type <engine_to_be_tested> + if we could expect that the results for storage engine variants of a + test differ only in the engine names. + This makes future maintenance easier. + - Avoid the use of include/show_msg*.inc. + They produce "SQL" noise which annoys during server debugging and can be + easy replaced by "--echo ...". diff --git a/mysql-test/suite/funcs_1/datadict/charset_collation.inc b/mysql-test/suite/funcs_1/datadict/charset_collation.inc index f8fc58b082b..ae03996b073 100644 --- a/mysql-test/suite/funcs_1/datadict/charset_collation.inc +++ b/mysql-test/suite/funcs_1/datadict/charset_collation.inc @@ -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 diff --git a/mysql-test/suite/funcs_1/datadict/columns.inc b/mysql-test/suite/funcs_1/datadict/columns.inc index 86f8afeff73..64318492b00 100644 --- a/mysql-test/suite/funcs_1/datadict/columns.inc +++ b/mysql-test/suite/funcs_1/datadict/columns.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; - diff --git a/mysql-test/suite/funcs_1/datadict/datadict_bug_12777.inc b/mysql-test/suite/funcs_1/datadict/datadict_bug_12777.inc index 0bca30b1dc3..5ba969fe4cb 100644 --- a/mysql-test/suite/funcs_1/datadict/datadict_bug_12777.inc +++ b/mysql-test/suite/funcs_1/datadict/datadict_bug_12777.inc @@ -2,7 +2,7 @@ # # columns in INFORMATION_SCHEMA with VARCHAR(4096) on Linux and Intel or AMD -# processor are shown as VARCHAR(512) on Windows, VARCHAR(1023) on AIX and HPUX, +# processor are shown as VARCHAR(512) on Windows, VARCHAR(1023) on AIX and HPUX, # VARCHAR(1024) on Solaris10, ... see below and in bug #12777 for details. # So we need to replace the output for these systems. There may be other still # not tested / detected systems. @@ -10,10 +10,10 @@ # Setting the variables used below has been moved to the beginning of the datadict # tests to "suite/funcs_1/datadict/datadict_load.inc". # -# SELECT character_maximum_length INTO @CML -# FROM information_schema.columns -# WHERE table_schema = 'information_schema' -# AND table_name = 'columns' +# SELECT character_maximum_length INTO @CML +# FROM information_schema.columns +# WHERE table_schema = 'information_schema' +# AND table_name = 'columns' # AND column_name = 'table_catalog'; # this enables the --replace_result only if needed, using this we never replace @@ -31,7 +31,7 @@ if ($bug_12777_0512) --replace_result 512 4096 1536 12288 } -# aix52, aix52-64bit, hp3750, hp3750-64bit, hpux11, hpux11-64bit, +# aix52, aix52-64bit, hp3750, hp3750-64bit, hpux11, hpux11-64bit, if ($bug_12777_1023) { # nnnn 3*n diff --git a/mysql-test/suite/funcs_1/datadict/datadict_load.inc b/mysql-test/suite/funcs_1/datadict/datadict_load.inc index 542f3bb8eb6..67b25b555ed 100644 --- a/mysql-test/suite/funcs_1/datadict/datadict_load.inc +++ b/mysql-test/suite/funcs_1/datadict/datadict_load.inc @@ -12,14 +12,14 @@ --disable_query_log # ------------------------------------------------------------------------------ -# Get the size of ONE known colum and check the size against some values to -# be able to use the correct --replace_result statement. Using this only the -# one pair of 'wrong' values is replaced and not all occurrencies of all +# Get the size of ONE known colum and check the size against some values to +# be able to use the correct --replace_result statement. Using this only the +# one pair of 'wrong' values is replaced and not all occurrencies of all # possible pairs of values. See bug #12777 for details. -SELECT character_maximum_length INTO @CML - FROM information_schema.columns - WHERE table_schema = 'information_schema' - AND table_name = 'columns' +SELECT character_maximum_length INTO @CML + FROM information_schema.columns + WHERE table_schema = 'information_schema' + AND table_name = 'columns' AND column_name = 'table_catalog'; let $bug_12777_0512= `SELECT @CML = 512`; @@ -53,7 +53,7 @@ let $SERVER_NAME= `SELECT DISTINCT host FROM mysql.user WHERE host NOT In ("loca # load tables # ----------- # -# this was part of the 3 files $<engine>_datadict.test, but it has been moved +# this was part of the 3 files $<engine>_datadict.test, but it has been moved # here to have only one place where all preparation for the test is done. # ################################################################################ diff --git a/mysql-test/suite/funcs_1/datadict/is_key_column_usage.inc b/mysql-test/suite/funcs_1/datadict/is_key_column_usage.inc new file mode 100644 index 00000000000..46d828b2e72 --- /dev/null +++ b/mysql-test/suite/funcs_1/datadict/is_key_column_usage.inc @@ -0,0 +1,344 @@ +# 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; + +--error ER_DBACCESS_DENIED_ERROR +INSERT INTO information_schema.key_column_usage + (constraint_schema, constraint_name, table_name) +VALUES ( 'mysql', 'primary', 'db'); +--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; + +# Cleanup +DROP TABLE db_datadict.t1; +DROP DATABASE db_datadict; + diff --git a/mysql-test/suite/funcs_1/datadict/is_routines.inc b/mysql-test/suite/funcs_1/datadict/is_routines.inc new file mode 100644 index 00000000000..3e9aa874a66 --- /dev/null +++ b/mysql-test/suite/funcs_1/datadict/is_routines.inc @@ -0,0 +1,472 @@ +# 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). +# +--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; + +--error ER_DBACCESS_DENIED_ERROR +INSERT INTO information_schema.routines (routine_name, routine_type ) +VALUES ('p2', 'procedure'); + +--error ER_DBACCESS_DENIED_ERROR +UPDATE information_schema.routines SET routine_name = 'p2' +WHERE routine_body = 'sql'; + +--error ER_DBACCESS_DENIED_ERROR +DELETE FROM information_schema.routines ; +# +--error ER_DBACCESS_DENIED_ERROR +TRUNCATE information_schema.routines ; + +--error ER_DBACCESS_DENIED_ERROR +CREATE INDEX i7 ON information_schema.routines (routine_name); + +--error ER_DBACCESS_DENIED_ERROR +ALTER TABLE information_schema.routines ADD f1 INT; +# +--error ER_DBACCESS_DENIED_ERROR +ALTER TABLE information_schema.routines DISCARD TABLESPACE; + +--error ER_DBACCESS_DENIED_ERROR +DROP TABLE information_schema.routines ; + +--error ER_DBACCESS_DENIED_ERROR +ALTER TABLE information_schema.routines RENAME db_datadict.routines; +# +--error ER_DBACCESS_DENIED_ERROR +ALTER TABLE information_schema.routines RENAME information_schema.xroutines; + +# Cleanup +DROP DATABASE db_datadict; + diff --git a/mysql-test/suite/funcs_1/datadict/is_schemata.inc b/mysql-test/suite/funcs_1/datadict/is_schemata.inc new file mode 100644 index 00000000000..b2a6139b839 --- /dev/null +++ b/mysql-test/suite/funcs_1/datadict/is_schemata.inc @@ -0,0 +1,247 @@ +# 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'; + +--error ER_DBACCESS_DENIED_ERROR +INSERT INTO information_schema.schemata + (catalog_name, schema_name, default_character_set_name, sql_path) +VALUES (NULL, 'db1', 'latin1', NULL); +--error ER_DBACCESS_DENIED_ERROR +INSERT INTO information_schema.schemata +SELECT * FROM information_schema.schemata; + +--error ER_DBACCESS_DENIED_ERROR +UPDATE information_schema.schemata +SET default_character_set_name = 'utf8' +WHERE schema_name = 'db_datadict'; +--error ER_DBACCESS_DENIED_ERROR +UPDATE information_schema.schemata SET catalog_name = 't_4711'; + +--error ER_DBACCESS_DENIED_ERROR +DELETE FROM information_schema.schemata WHERE schema_name = 'db_datadict'; +--error ER_DBACCESS_DENIED_ERROR +TRUNCATE information_schema.schemata; + +--error ER_DBACCESS_DENIED_ERROR +CREATE INDEX i1 ON information_schema.schemata(schema_name); + +--error ER_DBACCESS_DENIED_ERROR +ALTER TABLE information_schema.schemata ADD f1 INT; + +--error ER_DBACCESS_DENIED_ERROR +DROP TABLE information_schema.schemata; + +--error ER_DBACCESS_DENIED_ERROR +ALTER TABLE information_schema.schemata RENAME db_datadict.schemata; +--error ER_DBACCESS_DENIED_ERROR +ALTER TABLE information_schema.schemata RENAME information_schema.xschemata; + +# Cleanup +DROP DATABASE db_datadict; + diff --git a/mysql-test/suite/funcs_1/datadict/is_tables.inc b/mysql-test/suite/funcs_1/datadict/is_tables.inc new file mode 100644 index 00000000000..6d47c33e715 --- /dev/null +++ b/mysql-test/suite/funcs_1/datadict/is_tables.inc @@ -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; + diff --git a/mysql-test/suite/funcs_1/datadict/is_triggers.inc b/mysql-test/suite/funcs_1/datadict/is_triggers.inc new file mode 100644 index 00000000000..1e659f00485 --- /dev/null +++ b/mysql-test/suite/funcs_1/datadict/is_triggers.inc @@ -0,0 +1,254 @@ +# 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 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 SUPER ON *.* TO 'testuser1'@'localhost'; +GRANT SUPER ON *.* TO 'testuser3'@'localhost'; +GRANT SUPER 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'; +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 SUPER 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 # SUPER 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 # SUPER Privilege + no SELECT Privilege on t1 --> no result for query +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; + diff --git a/mysql-test/suite/funcs_1/datadict/is_views.inc b/mysql-test/suite/funcs_1/datadict/is_views.inc new file mode 100644 index 00000000000..32e66e4f684 --- /dev/null +++ b/mysql-test/suite/funcs_1/datadict/is_views.inc @@ -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; + diff --git a/mysql-test/suite/funcs_1/datadict/tables.inc b/mysql-test/suite/funcs_1/datadict/tables.inc new file mode 100644 index 00000000000..5aa072d184c --- /dev/null +++ b/mysql-test/suite/funcs_1/datadict/tables.inc @@ -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; diff --git a/mysql-test/suite/funcs_1/datadict/tables1.inc b/mysql-test/suite/funcs_1/datadict/tables1.inc index a03304028f6..2e054a9dcfb 100644 --- a/mysql-test/suite/funcs_1/datadict/tables1.inc +++ b/mysql-test/suite/funcs_1/datadict/tables1.inc @@ -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; diff --git a/mysql-test/suite/funcs_1/datadict/tables2.inc b/mysql-test/suite/funcs_1/datadict/tables2.inc index 1066e52f8f0..6442aab493c 100644 --- a/mysql-test/suite/funcs_1/datadict/tables2.inc +++ b/mysql-test/suite/funcs_1/datadict/tables2.inc @@ -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 - diff --git a/mysql-test/suite/funcs_1/include/bug28309_skip.inc b/mysql-test/suite/funcs_1/include/bug28309_skip.inc new file mode 100644 index 00000000000..18ba6641fad --- /dev/null +++ b/mysql-test/suite/funcs_1/include/bug28309_skip.inc @@ -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 ?; +} diff --git a/mysql-test/suite/funcs_1/include/innodb_tb1.inc b/mysql-test/suite/funcs_1/include/innodb_tb1.inc index 115d8b6318d..c6b6395d91f 100644 --- a/mysql-test/suite/funcs_1/include/innodb_tb1.inc +++ b/mysql-test/suite/funcs_1/include/innodb_tb1.inc @@ -4,66 +4,67 @@ drop table if exists tb1 ; --enable_warnings create table tb1 ( -f1 char(0), -f2 char(0) binary, -f3 char(0) ascii, -f4 tinytext unicode, -f5 text, -f6 mediumtext, -f7 longtext, -f8 tinyblob, +f1 char(0), +f2 char(0) binary, +f3 char(0) ascii, +f4 tinytext, +f5 text, +f6 mediumtext, +f7 longtext, +f8 tinyblob, f9 blob, -f10 mediumblob, -f11 longblob, -f12 binary, -f13 tinyint, -f14 tinyint unsigned, -f15 tinyint zerofill, -f16 tinyint unsigned zerofill, -f17 smallint, -f18 smallint unsigned, -f19 smallint zerofill, -f20 smallint unsigned zerofill, -f21 mediumint, -f22 mediumint unsigned, -f23 mediumint zerofill, -f24 mediumint unsigned zerofill, -f25 int, -f26 int unsigned, -f27 int zerofill, -f28 int unsigned zerofill, -f29 bigint, -f30 bigint unsigned, -f31 bigint zerofill, -f32 bigint unsigned zerofill, -f33 decimal, -f34 decimal unsigned, -f35 decimal zerofill, -f36 decimal unsigned zerofill not null DEFAULT 9.9, -f37 decimal (0) not null DEFAULT 9.9, -f38 decimal (64) not null DEFAULT 9.9, -f39 decimal (0) unsigned not null DEFAULT 9.9, -f40 decimal (64) unsigned not null DEFAULT 9.9, -f41 decimal (0) zerofill not null DEFAULT 9.9, -f42 decimal (64) zerofill not null DEFAULT 9.9, -f43 decimal (0) unsigned zerofill not null DEFAULT 9.9, -f44 decimal (64) unsigned zerofill not null DEFAULT 9.9, -f45 decimal (0,0) not null DEFAULT 9.9, -f46 decimal (63,30) not null DEFAULT 9.9, -f47 decimal (0,0) unsigned not null DEFAULT 9.9, -f48 decimal (63,30) unsigned not null DEFAULT 9.9, -f49 decimal (0,0) zerofill not null DEFAULT 9.9, -f50 decimal (63,30) zerofill not null DEFAULT 9.9, -f51 decimal (0,0) unsigned zerofill not null DEFAULT 9.9, -f52 decimal (63,30) unsigned zerofill not null DEFAULT 9.9, -f53 numeric not null DEFAULT 99, -f54 numeric unsigned not null DEFAULT 99, -f55 numeric zerofill not null DEFAULT 99, -f56 numeric unsigned zerofill not null DEFAULT 99, -f57 numeric (0) not null DEFAULT 99, +f10 mediumblob, +f11 longblob, +f12 binary, +f13 tinyint, +f14 tinyint unsigned, +f15 tinyint zerofill, +f16 tinyint unsigned zerofill, +f17 smallint, +f18 smallint unsigned, +f19 smallint zerofill, +f20 smallint unsigned zerofill, +f21 mediumint, +f22 mediumint unsigned, +f23 mediumint zerofill, +f24 mediumint unsigned zerofill, +f25 int, +f26 int unsigned, +f27 int zerofill, +f28 int unsigned zerofill, +f29 bigint, +f30 bigint unsigned, +f31 bigint zerofill, +f32 bigint unsigned zerofill, +f33 decimal, +f34 decimal unsigned, +f35 decimal zerofill, +f36 decimal unsigned zerofill not null DEFAULT 9.9, +f37 decimal (0) not null DEFAULT 9.9, +f38 decimal (64) not null DEFAULT 9.9, +f39 decimal (0) unsigned not null DEFAULT 9.9, +f40 decimal (64) unsigned not null DEFAULT 9.9, +f41 decimal (0) zerofill not null DEFAULT 9.9, +f42 decimal (64) zerofill not null DEFAULT 9.9, +f43 decimal (0) unsigned zerofill not null DEFAULT 9.9, +f44 decimal (64) unsigned zerofill not null DEFAULT 9.9, +f45 decimal (0,0) not null DEFAULT 9.9, +f46 decimal (63,30) not null DEFAULT 9.9, +f47 decimal (0,0) unsigned not null DEFAULT 9.9, +f48 decimal (63,30) unsigned not null DEFAULT 9.9, +f49 decimal (0,0) zerofill not null DEFAULT 9.9, +f50 decimal (63,30) zerofill not null DEFAULT 9.9, +f51 decimal (0,0) unsigned zerofill not null DEFAULT 9.9, +f52 decimal (63,30) unsigned zerofill not null DEFAULT 9.9, +f53 numeric not null DEFAULT 99, +f54 numeric unsigned not null DEFAULT 99, +f55 numeric zerofill not null DEFAULT 99, +f56 numeric unsigned zerofill not null DEFAULT 99, +f57 numeric (0) not null DEFAULT 99, f58 numeric (64) not null DEFAULT 99 ) engine = innodb; - ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval load data infile '$MYSQL_TEST_DIR/suite/funcs_1/data/innodb_tb1.txt' into table tb1 ; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +load data infile '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/innodb_tb1.txt' +into table tb1; diff --git a/mysql-test/suite/funcs_1/include/innodb_tb2.inc b/mysql-test/suite/funcs_1/include/innodb_tb2.inc index 99c09c1d963..b9a0910a0af 100644 --- a/mysql-test/suite/funcs_1/include/innodb_tb2.inc +++ b/mysql-test/suite/funcs_1/include/innodb_tb2.inc @@ -4,58 +4,60 @@ drop table if exists tb2 ; --enable_warnings create table tb2 ( -f59 numeric (0) unsigned, -f60 numeric (64) unsigned, -f61 numeric (0) zerofill, -f62 numeric (64) zerofill, -f63 numeric (0) unsigned zerofill, -f64 numeric (64) unsigned zerofill, -f65 numeric (0,0), -f66 numeric (63,30), -f67 numeric (0,0) unsigned, -f68 numeric (63,30) unsigned, -f69 numeric (0,0) zerofill, -f70 numeric (63,30) zerofill, -f71 numeric (0,0) unsigned zerofill, -f72 numeric (63,30) unsigned zerofill, -f73 real, -f74 real unsigned, -f75 real zerofill, -f76 real unsigned zerofill, -f77 double default 7.7, -f78 double unsigned default 7.7, -f79 double zerofill default 7.7, -f80 double unsigned zerofill default 8.8, -f81 float not null default 8.8, -f82 float unsigned not null default 8.8, -f83 float zerofill not null default 8.8, -f84 float unsigned zerofill not null default 8.8, -f85 float(0) not null default 8.8, -f86 float(23) not null default 8.8, -f87 float(0) unsigned not null default 8.8, -f88 float(23) unsigned not null default 8.8, -f89 float(0) zerofill not null default 8.8, -f90 float(23) zerofill not null default 8.8, -f91 float(0) unsigned zerofill not null default 8.8, -f92 float(23) unsigned zerofill not null default 8.8, -f93 float(24) not null default 8.8, -f94 float(53) not null default 8.8, -f95 float(24) unsigned not null default 8.8, -f96 float(53) unsigned not null default 8.8, -f97 float(24) zerofill not null default 8.8, -f98 float(53) zerofill not null default 8.8, -f99 float(24) unsigned zerofill not null default 8.8, -f100 float(53) unsigned zerofill not null default 8.8, -f101 date not null default '2000-01-01', -f102 time not null default 20, -f103 datetime not null default '2/2/2', -f104 timestamp not null default 20001231235959, -f105 year not null default 2000, -f106 year(3) not null default 2000, -f107 year(4) not null default 2000, -f108 enum("1enum","2enum") not null default "1enum", +f59 numeric (0) unsigned, +f60 numeric (64) unsigned, +f61 numeric (0) zerofill, +f62 numeric (64) zerofill, +f63 numeric (0) unsigned zerofill, +f64 numeric (64) unsigned zerofill, +f65 numeric (0,0), +f66 numeric (63,30), +f67 numeric (0,0) unsigned, +f68 numeric (63,30) unsigned, +f69 numeric (0,0) zerofill, +f70 numeric (63,30) zerofill, +f71 numeric (0,0) unsigned zerofill, +f72 numeric (63,30) unsigned zerofill, +f73 real, +f74 real unsigned, +f75 real zerofill, +f76 real unsigned zerofill, +f77 double default 7.7, +f78 double unsigned default 7.7, +f79 double zerofill default 7.7, +f80 double unsigned zerofill default 8.8, +f81 float not null default 8.8, +f82 float unsigned not null default 8.8, +f83 float zerofill not null default 8.8, +f84 float unsigned zerofill not null default 8.8, +f85 float(0) not null default 8.8, +f86 float(23) not null default 8.8, +f87 float(0) unsigned not null default 8.8, +f88 float(23) unsigned not null default 8.8, +f89 float(0) zerofill not null default 8.8, +f90 float(23) zerofill not null default 8.8, +f91 float(0) unsigned zerofill not null default 8.8, +f92 float(23) unsigned zerofill not null default 8.8, +f93 float(24) not null default 8.8, +f94 float(53) not null default 8.8, +f95 float(24) unsigned not null default 8.8, +f96 float(53) unsigned not null default 8.8, +f97 float(24) zerofill not null default 8.8, +f98 float(53) zerofill not null default 8.8, +f99 float(24) unsigned zerofill not null default 8.8, +f100 float(53) unsigned zerofill not null default 8.8, +f101 date not null default '2000-01-01', +f102 time not null default 20, +f103 datetime not null default '2/2/2', +f104 timestamp not null default 20001231235959, +f105 year not null default 2000, +f106 year(3) not null default 2000, +f107 year(4) not null default 2000, +f108 enum("1enum","2enum") not null default "1enum", f109 set("1set","2set") not null default "1set" ) engine = innodb; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval load data infile '$MYSQL_TEST_DIR/suite/funcs_1/data/innodb_tb2.txt' into table tb2 ; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +load data infile '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/innodb_tb2.txt' +into table tb2; diff --git a/mysql-test/suite/funcs_1/include/innodb_tb3.inc b/mysql-test/suite/funcs_1/include/innodb_tb3.inc index d8397b2b581..ffdb20b7eef 100644 --- a/mysql-test/suite/funcs_1/include/innodb_tb3.inc +++ b/mysql-test/suite/funcs_1/include/innodb_tb3.inc @@ -4,65 +4,67 @@ drop table if exists tb3 ; --enable_warnings 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) +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, +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; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval load data infile '$MYSQL_TEST_DIR/suite/funcs_1/data/innodb_tb3.txt' into table tb3 ; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +load data infile '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/innodb_tb3.txt' +into table tb3; diff --git a/mysql-test/suite/funcs_1/include/innodb_tb4.inc b/mysql-test/suite/funcs_1/include/innodb_tb4.inc index 2cff9e57075..c7c919c829d 100644 --- a/mysql-test/suite/funcs_1/include/innodb_tb4.inc +++ b/mysql-test/suite/funcs_1/include/innodb_tb4.inc @@ -4,65 +4,67 @@ drop table if exists tb4; --enable_warnings create table tb4 ( -f176 numeric (0) unsigned not null DEFAULT 9, -f177 numeric (64) unsigned not null DEFAULT 9, -f178 numeric (0) zerofill not null DEFAULT 9, -f179 numeric (64) zerofill not null DEFAULT 9, -f180 numeric (0) unsigned zerofill not null DEFAULT 9, -f181 numeric (64) unsigned zerofill not null DEFAULT 9, -f182 numeric (0,0) not null DEFAULT 9, -f183 numeric (63,30) not null DEFAULT 9, -f184 numeric (0,0) unsigned not null DEFAULT 9, -f185 numeric (63,30) unsigned not null DEFAULT 9, -f186 numeric (0,0) zerofill not null DEFAULT 9, -f187 numeric (63,30) zerofill not null DEFAULT 9, -f188 numeric (0,0) unsigned zerofill not null DEFAULT 9, -f189 numeric (63,30) unsigned zerofill not null DEFAULT 9, -f190 real not null DEFAULT 88.8, -f191 real unsigned not null DEFAULT 88.8, -f192 real zerofill not null DEFAULT 88.8, -f193 real unsigned zerofill not null DEFAULT 88.8, -f194 double not null DEFAULT 55.5, -f195 double unsigned not null DEFAULT 55.5, -f196 double zerofill not null DEFAULT 55.5, -f197 double unsigned zerofill not null DEFAULT 55.5, -f198 float, -f199 float unsigned, -f200 float zerofill, -f201 float unsigned zerofill, -f202 float(0), -f203 float(23), -f204 float(0) unsigned, -f205 float(23) unsigned, -f206 float(0) zerofill, -f207 float(23) zerofill, -f208 float(0) unsigned zerofill, -f209 float(23) unsigned zerofill, -f210 float(24), -f211 float(53), -f212 float(24) unsigned, -f213 float(53) unsigned, -f214 float(24) zerofill, -f215 float(53) zerofill, -f216 float(24) unsigned zerofill, -f217 float(53) unsigned zerofill, -f218 date, -f219 time, -f220 datetime, -f221 timestamp, -f222 year, -f223 year(3), -f224 year(4), -f225 enum("1enum","2enum"), +f176 numeric (0) unsigned not null DEFAULT 9, +f177 numeric (64) unsigned not null DEFAULT 9, +f178 numeric (0) zerofill not null DEFAULT 9, +f179 numeric (64) zerofill not null DEFAULT 9, +f180 numeric (0) unsigned zerofill not null DEFAULT 9, +f181 numeric (64) unsigned zerofill not null DEFAULT 9, +f182 numeric (0,0) not null DEFAULT 9, +f183 numeric (63,30) not null DEFAULT 9, +f184 numeric (0,0) unsigned not null DEFAULT 9, +f185 numeric (63,30) unsigned not null DEFAULT 9, +f186 numeric (0,0) zerofill not null DEFAULT 9, +f187 numeric (63,30) zerofill not null DEFAULT 9, +f188 numeric (0,0) unsigned zerofill not null DEFAULT 9, +f189 numeric (63,30) unsigned zerofill not null DEFAULT 9, +f190 real not null DEFAULT 88.8, +f191 real unsigned not null DEFAULT 88.8, +f192 real zerofill not null DEFAULT 88.8, +f193 real unsigned zerofill not null DEFAULT 88.8, +f194 double not null DEFAULT 55.5, +f195 double unsigned not null DEFAULT 55.5, +f196 double zerofill not null DEFAULT 55.5, +f197 double unsigned zerofill not null DEFAULT 55.5, +f198 float, +f199 float unsigned, +f200 float zerofill, +f201 float unsigned zerofill, +f202 float(0), +f203 float(23), +f204 float(0) unsigned, +f205 float(23) unsigned, +f206 float(0) zerofill, +f207 float(23) zerofill, +f208 float(0) unsigned zerofill, +f209 float(23) unsigned zerofill, +f210 float(24), +f211 float(53), +f212 float(24) unsigned, +f213 float(53) unsigned, +f214 float(24) zerofill, +f215 float(53) zerofill, +f216 float(24) unsigned zerofill, +f217 float(53) unsigned zerofill, +f218 date, +f219 time, +f220 datetime, +f221 timestamp, +f222 year, +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 $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval load data infile '$MYSQL_TEST_DIR/suite/funcs_1/data/innodb_tb4.txt' into table tb4 ; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +load data infile '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/innodb_tb4.txt' +into table tb4; diff --git a/mysql-test/suite/funcs_1/include/memory_tb1.inc b/mysql-test/suite/funcs_1/include/memory_tb1.inc index 7d66443c62f..3a4ebb0c484 100644 --- a/mysql-test/suite/funcs_1/include/memory_tb1.inc +++ b/mysql-test/suite/funcs_1/include/memory_tb1.inc @@ -4,57 +4,59 @@ drop table if exists tb1 ; --enable_warnings create table tb1 ( -f1 char, -f2 char binary, -f3 char ascii, -f12 binary, -f13 tinyint, -f14 tinyint unsigned, -f15 tinyint zerofill, -f16 tinyint unsigned zerofill, -f17 smallint, -f18 smallint unsigned, -f19 smallint zerofill, -f20 smallint unsigned zerofill, -f21 mediumint, -f22 mediumint unsigned, -f23 mediumint zerofill, -f24 mediumint unsigned zerofill, -f25 int, -f26 int unsigned, -f27 int zerofill, -f28 int unsigned zerofill, -f29 bigint, -f30 bigint unsigned, -f31 bigint zerofill, -f32 bigint unsigned zerofill, -f33 decimal not null DEFAULT 9.9, -f34 decimal unsigned not null DEFAULT 9.9, -f35 decimal zerofill not null DEFAULT 9.9, -f36 decimal unsigned zerofill not null DEFAULT 9.9, -f37 decimal (0) not null DEFAULT 9.9, -f38 decimal (64) not null DEFAULT 9.9, -f39 decimal (0) unsigned not null DEFAULT 9.9, -f40 decimal (64) unsigned not null DEFAULT 9.9, -f41 decimal (0) zerofill not null DEFAULT 9.9, -f42 decimal (64) zerofill not null DEFAULT 9.9, -f43 decimal (0) unsigned zerofill not null DEFAULT 9.9, -f44 decimal (64) unsigned zerofill not null DEFAULT 9.9, -f45 decimal (0,0) not null DEFAULT 9.9, -f46 decimal (63,30) not null DEFAULT 9.9, -f47 decimal (0,0) unsigned not null DEFAULT 9.9, -f48 decimal (63,30) unsigned not null DEFAULT 9.9, -f49 decimal (0,0) zerofill not null DEFAULT 9.9, -f50 decimal (63,30) zerofill not null DEFAULT 9.9, -f51 decimal (0,0) unsigned zerofill not null DEFAULT 9.9, -f52 decimal (63,30) unsigned zerofill not null DEFAULT 9.9, -f53 numeric not null DEFAULT 99, -f54 numeric unsigned not null DEFAULT 99, -f55 numeric zerofill not null DEFAULT 99, -f56 numeric unsigned zerofill not null DEFAULT 99, -f57 numeric (0) not null DEFAULT 99, +f1 char, +f2 char binary, +f3 char ascii, +f12 binary, +f13 tinyint, +f14 tinyint unsigned, +f15 tinyint zerofill, +f16 tinyint unsigned zerofill, +f17 smallint, +f18 smallint unsigned, +f19 smallint zerofill, +f20 smallint unsigned zerofill, +f21 mediumint, +f22 mediumint unsigned, +f23 mediumint zerofill, +f24 mediumint unsigned zerofill, +f25 int, +f26 int unsigned, +f27 int zerofill, +f28 int unsigned zerofill, +f29 bigint, +f30 bigint unsigned, +f31 bigint zerofill, +f32 bigint unsigned zerofill, +f33 decimal not null DEFAULT 9.9, +f34 decimal unsigned not null DEFAULT 9.9, +f35 decimal zerofill not null DEFAULT 9.9, +f36 decimal unsigned zerofill not null DEFAULT 9.9, +f37 decimal (0) not null DEFAULT 9.9, +f38 decimal (64) not null DEFAULT 9.9, +f39 decimal (0) unsigned not null DEFAULT 9.9, +f40 decimal (64) unsigned not null DEFAULT 9.9, +f41 decimal (0) zerofill not null DEFAULT 9.9, +f42 decimal (64) zerofill not null DEFAULT 9.9, +f43 decimal (0) unsigned zerofill not null DEFAULT 9.9, +f44 decimal (64) unsigned zerofill not null DEFAULT 9.9, +f45 decimal (0,0) not null DEFAULT 9.9, +f46 decimal (63,30) not null DEFAULT 9.9, +f47 decimal (0,0) unsigned not null DEFAULT 9.9, +f48 decimal (63,30) unsigned not null DEFAULT 9.9, +f49 decimal (0,0) zerofill not null DEFAULT 9.9, +f50 decimal (63,30) zerofill not null DEFAULT 9.9, +f51 decimal (0,0) unsigned zerofill not null DEFAULT 9.9, +f52 decimal (63,30) unsigned zerofill not null DEFAULT 9.9, +f53 numeric not null DEFAULT 99, +f54 numeric unsigned not null DEFAULT 99, +f55 numeric zerofill not null DEFAULT 99, +f56 numeric unsigned zerofill not null DEFAULT 99, +f57 numeric (0) not null DEFAULT 99, f58 numeric (64) not null DEFAULT 99 ) engine = memory; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval load data infile '$MYSQL_TEST_DIR/suite/funcs_1/data/memory_tb1.txt' into table tb1 ; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +load data infile '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/memory_tb1.txt' +into table tb1; diff --git a/mysql-test/suite/funcs_1/include/memory_tb2.inc b/mysql-test/suite/funcs_1/include/memory_tb2.inc index 869a4904ce0..c059e565c64 100644 --- a/mysql-test/suite/funcs_1/include/memory_tb2.inc +++ b/mysql-test/suite/funcs_1/include/memory_tb2.inc @@ -4,58 +4,60 @@ drop table if exists tb2 ; --enable_warnings create table tb2 ( -f59 numeric (0) unsigned, -f60 numeric (64) unsigned, -f61 numeric (0) zerofill, -f62 numeric (64) zerofill, -f63 numeric (0) unsigned zerofill, -f64 numeric (64) unsigned zerofill, -f65 numeric (0,0), -f66 numeric (63,30), -f67 numeric (0,0) unsigned, -f68 numeric (63,30) unsigned, -f69 numeric (0,0) zerofill, -f70 numeric (63,30) zerofill, -f71 numeric (0,0) unsigned zerofill, -f72 numeric (63,30) unsigned zerofill, -f73 real, -f74 real unsigned, -f75 real zerofill, -f76 real unsigned zerofill, -f77 double default 7.7, -f78 double unsigned default 7.7, -f79 double zerofill default 7.7, -f80 double unsigned zerofill default 8.8, -f81 float not null default 8.8, -f82 float unsigned not null default 8.8, -f83 float zerofill not null default 8.8, -f84 float unsigned zerofill not null default 8.8, -f85 float(0) not null default 8.8, -f86 float(23) not null default 8.8, -f87 float(0) unsigned not null default 8.8, -f88 float(23) unsigned not null default 8.8, -f89 float(0) zerofill not null default 8.8, -f90 float(23) zerofill not null default 8.8, -f91 float(0) unsigned zerofill not null default 8.8, -f92 float(23) unsigned zerofill not null default 8.8, -f93 float(24) not null default 8.8, -f94 float(53) not null default 8.8, -f95 float(24) unsigned not null default 8.8, -f96 float(53) unsigned not null default 8.8, -f97 float(24) zerofill not null default 8.8, -f98 float(53) zerofill not null default 8.8, -f99 float(24) unsigned zerofill not null default 8.8, -f100 float(53) unsigned zerofill not null default 8.8, -f101 date not null default '2000-01-01', -f102 time not null default 20, -f103 datetime not null default '2/2/2', -f104 timestamp not null default 20001231235959, -f105 year not null default 2000, -f106 year(3) not null default 2000, -f107 year(4) not null default 2000, -f108 enum("1enum","2enum") not null default "1enum", +f59 numeric (0) unsigned, +f60 numeric (64) unsigned, +f61 numeric (0) zerofill, +f62 numeric (64) zerofill, +f63 numeric (0) unsigned zerofill, +f64 numeric (64) unsigned zerofill, +f65 numeric (0,0), +f66 numeric (63,30), +f67 numeric (0,0) unsigned, +f68 numeric (63,30) unsigned, +f69 numeric (0,0) zerofill, +f70 numeric (63,30) zerofill, +f71 numeric (0,0) unsigned zerofill, +f72 numeric (63,30) unsigned zerofill, +f73 real, +f74 real unsigned, +f75 real zerofill, +f76 real unsigned zerofill, +f77 double default 7.7, +f78 double unsigned default 7.7, +f79 double zerofill default 7.7, +f80 double unsigned zerofill default 8.8, +f81 float not null default 8.8, +f82 float unsigned not null default 8.8, +f83 float zerofill not null default 8.8, +f84 float unsigned zerofill not null default 8.8, +f85 float(0) not null default 8.8, +f86 float(23) not null default 8.8, +f87 float(0) unsigned not null default 8.8, +f88 float(23) unsigned not null default 8.8, +f89 float(0) zerofill not null default 8.8, +f90 float(23) zerofill not null default 8.8, +f91 float(0) unsigned zerofill not null default 8.8, +f92 float(23) unsigned zerofill not null default 8.8, +f93 float(24) not null default 8.8, +f94 float(53) not null default 8.8, +f95 float(24) unsigned not null default 8.8, +f96 float(53) unsigned not null default 8.8, +f97 float(24) zerofill not null default 8.8, +f98 float(53) zerofill not null default 8.8, +f99 float(24) unsigned zerofill not null default 8.8, +f100 float(53) unsigned zerofill not null default 8.8, +f101 date not null default '2000-01-01', +f102 time not null default 20, +f103 datetime not null default '2/2/2', +f104 timestamp not null default 20001231235959, +f105 year not null default 2000, +f106 year(3) not null default 2000, +f107 year(4) not null default 2000, +f108 enum("1enum","2enum") not null default "1enum", f109 set("1set","2set") not null default "1set" ) engine = memory; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval load data infile '$MYSQL_TEST_DIR/suite/funcs_1/data/memory_tb2.txt' into table tb2 ; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +load data infile '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/memory_tb2.txt' +into table tb2 ; diff --git a/mysql-test/suite/funcs_1/include/memory_tb3.inc b/mysql-test/suite/funcs_1/include/memory_tb3.inc index 5aa56d06ede..b5d4bb93f12 100644 --- a/mysql-test/suite/funcs_1/include/memory_tb3.inc +++ b/mysql-test/suite/funcs_1/include/memory_tb3.inc @@ -4,60 +4,61 @@ drop table if exists tb3; --enable_warnings 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 char(50), -f122 char(50), -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) +f118 char not null DEFAULT 'a', +f119 char binary not null DEFAULT b'101', +f120 char ascii not null DEFAULT b'101', +f121 char(50), +f122 char(50), +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 = memory; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval load data infile '$MYSQL_TEST_DIR/suite/funcs_1/data/memory_tb3.txt' into table tb3 ; - +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +load data infile '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/memory_tb3.txt' +into table tb3; diff --git a/mysql-test/suite/funcs_1/include/memory_tb4.inc b/mysql-test/suite/funcs_1/include/memory_tb4.inc index 97bc04118bd..0cf17127d32 100644 --- a/mysql-test/suite/funcs_1/include/memory_tb4.inc +++ b/mysql-test/suite/funcs_1/include/memory_tb4.inc @@ -4,64 +4,66 @@ drop table if exists tb4 ; --enable_warnings create table tb4 ( -f176 numeric (0) unsigned not null DEFAULT 9, -f177 numeric (64) unsigned not null DEFAULT 9, -f178 numeric (0) zerofill not null DEFAULT 9, -f179 numeric (64) zerofill not null DEFAULT 9, -f180 numeric (0) unsigned zerofill not null DEFAULT 9, -f181 numeric (64) unsigned zerofill not null DEFAULT 9, -f182 numeric (0,0) not null DEFAULT 9, -f183 numeric (63,30) not null DEFAULT 9, -f184 numeric (0,0) unsigned not null DEFAULT 9, -f185 numeric (63,30) unsigned not null DEFAULT 9, -f186 numeric (0,0) zerofill not null DEFAULT 9, -f187 numeric (63,30) zerofill not null DEFAULT 9, -f188 numeric (0,0) unsigned zerofill not null DEFAULT 9, -f189 numeric (63,30) unsigned zerofill not null DEFAULT 9, -f190 real not null DEFAULT 88.8, -f191 real unsigned not null DEFAULT 88.8, -f192 real zerofill not null DEFAULT 88.8, -f193 real unsigned zerofill not null DEFAULT 88.8, -f194 double not null DEFAULT 55.5, -f195 double unsigned not null DEFAULT 55.5, -f196 double zerofill not null DEFAULT 55.5, -f197 double unsigned zerofill not null DEFAULT 55.5, -f198 float, -f199 float unsigned, -f200 float zerofill, -f201 float unsigned zerofill, -f202 float(0), -f203 float(23), -f204 float(0) unsigned, -f205 float(23) unsigned, -f206 float(0) zerofill, -f207 float(23) zerofill, -f208 float(0) unsigned zerofill, -f209 float(23) unsigned zerofill, -f210 float(24), -f211 float(53), -f212 float(24) unsigned, -f213 float(53) unsigned, -f214 float(24) zerofill, -f215 float(53) zerofill, -f216 float(24) unsigned zerofill, -f217 float(53) unsigned zerofill, -f218 date, -f219 time, -f220 datetime, -f221 timestamp, -f222 year, -f223 year(3), -f224 year(4), -f225 enum("1enum","2enum"), +f176 numeric (0) unsigned not null DEFAULT 9, +f177 numeric (64) unsigned not null DEFAULT 9, +f178 numeric (0) zerofill not null DEFAULT 9, +f179 numeric (64) zerofill not null DEFAULT 9, +f180 numeric (0) unsigned zerofill not null DEFAULT 9, +f181 numeric (64) unsigned zerofill not null DEFAULT 9, +f182 numeric (0,0) not null DEFAULT 9, +f183 numeric (63,30) not null DEFAULT 9, +f184 numeric (0,0) unsigned not null DEFAULT 9, +f185 numeric (63,30) unsigned not null DEFAULT 9, +f186 numeric (0,0) zerofill not null DEFAULT 9, +f187 numeric (63,30) zerofill not null DEFAULT 9, +f188 numeric (0,0) unsigned zerofill not null DEFAULT 9, +f189 numeric (63,30) unsigned zerofill not null DEFAULT 9, +f190 real not null DEFAULT 88.8, +f191 real unsigned not null DEFAULT 88.8, +f192 real zerofill not null DEFAULT 88.8, +f193 real unsigned zerofill not null DEFAULT 88.8, +f194 double not null DEFAULT 55.5, +f195 double unsigned not null DEFAULT 55.5, +f196 double zerofill not null DEFAULT 55.5, +f197 double unsigned zerofill not null DEFAULT 55.5, +f198 float, +f199 float unsigned, +f200 float zerofill, +f201 float unsigned zerofill, +f202 float(0), +f203 float(23), +f204 float(0) unsigned, +f205 float(23) unsigned, +f206 float(0) zerofill, +f207 float(23) zerofill, +f208 float(0) unsigned zerofill, +f209 float(23) unsigned zerofill, +f210 float(24), +f211 float(53), +f212 float(24) unsigned, +f213 float(53) unsigned, +f214 float(24) zerofill, +f215 float(53) zerofill, +f216 float(24) unsigned zerofill, +f217 float(53) unsigned zerofill, +f218 date, +f219 time, +f220 datetime, +f221 timestamp, +f222 year, +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 $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval load data infile '$MYSQL_TEST_DIR/suite/funcs_1/data/memory_tb4.txt' into table tb4 ; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +load data infile '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/memory_tb4.txt' +into table tb4; diff --git a/mysql-test/suite/funcs_1/include/myisam_tb1.inc b/mysql-test/suite/funcs_1/include/myisam_tb1.inc index f2a8be4f5d6..1c95c6c53c0 100644 --- a/mysql-test/suite/funcs_1/include/myisam_tb1.inc +++ b/mysql-test/suite/funcs_1/include/myisam_tb1.inc @@ -4,65 +4,67 @@ drop table if exists tb1 ; --enable_warnings create table tb1 ( -f1 char, -f2 char binary, -f3 char ascii, -f4 tinytext unicode, -f5 text, -f6 mediumtext, -f7 longtext, -f8 tinyblob, +f1 char, +f2 char binary, +f3 char ascii, +f4 tinytext, +f5 text, +f6 mediumtext, +f7 longtext, +f8 tinyblob, f9 blob, -f10 mediumblob, -f11 longblob, -f12 binary, -f13 tinyint, -f14 tinyint unsigned, -f15 tinyint zerofill, -f16 tinyint unsigned zerofill, -f17 smallint, -f18 smallint unsigned, -f19 smallint zerofill, -f20 smallint unsigned zerofill, -f21 mediumint, -f22 mediumint unsigned, -f23 mediumint zerofill, -f24 mediumint unsigned zerofill, -f25 int, -f26 int unsigned, -f27 int zerofill, -f28 int unsigned zerofill, -f29 bigint, -f30 bigint unsigned, -f31 bigint zerofill, -f32 bigint unsigned zerofill, -f33 decimal not null DEFAULT 9.9, -f34 decimal unsigned not null DEFAULT 9.9, -f35 decimal zerofill not null DEFAULT 9.9, -f36 decimal unsigned zerofill not null DEFAULT 9.9, -f37 decimal (0) not null DEFAULT 9.9, -f38 decimal (64) not null DEFAULT 9.9, -f39 decimal (0) unsigned not null DEFAULT 9.9, -f40 decimal (64) unsigned not null DEFAULT 9.9, -f41 decimal (0) zerofill not null DEFAULT 9.9, -f42 decimal (64) zerofill not null DEFAULT 9.9, -f43 decimal (0) unsigned zerofill not null DEFAULT 9.9, -f44 decimal (64) unsigned zerofill not null DEFAULT 9.9, -f45 decimal (0,0) not null DEFAULT 9.9, -f46 decimal (63,30) not null DEFAULT 9.9, -f47 decimal (0,0) unsigned not null DEFAULT 9.9, -f48 decimal (63,30) unsigned not null DEFAULT 9.9, -f49 decimal (0,0) zerofill not null DEFAULT 9.9, -f50 decimal (63,30) zerofill not null DEFAULT 9.9, -f51 decimal (0,0) unsigned zerofill not null DEFAULT 9.9, -f52 decimal (63,30) unsigned zerofill not null DEFAULT 9.9, -f53 numeric not null DEFAULT 99, -f54 numeric unsigned not null DEFAULT 99, -f55 numeric zerofill not null DEFAULT 99, -f56 numeric unsigned zerofill not null DEFAULT 99, -f57 numeric (0) not null DEFAULT 99, +f10 mediumblob, +f11 longblob, +f12 binary, +f13 tinyint, +f14 tinyint unsigned, +f15 tinyint zerofill, +f16 tinyint unsigned zerofill, +f17 smallint, +f18 smallint unsigned, +f19 smallint zerofill, +f20 smallint unsigned zerofill, +f21 mediumint, +f22 mediumint unsigned, +f23 mediumint zerofill, +f24 mediumint unsigned zerofill, +f25 int, +f26 int unsigned, +f27 int zerofill, +f28 int unsigned zerofill, +f29 bigint, +f30 bigint unsigned, +f31 bigint zerofill, +f32 bigint unsigned zerofill, +f33 decimal not null DEFAULT 9.9, +f34 decimal unsigned not null DEFAULT 9.9, +f35 decimal zerofill not null DEFAULT 9.9, +f36 decimal unsigned zerofill not null DEFAULT 9.9, +f37 decimal (0) not null DEFAULT 9.9, +f38 decimal (64) not null DEFAULT 9.9, +f39 decimal (0) unsigned not null DEFAULT 9.9, +f40 decimal (64) unsigned not null DEFAULT 9.9, +f41 decimal (0) zerofill not null DEFAULT 9.9, +f42 decimal (64) zerofill not null DEFAULT 9.9, +f43 decimal (0) unsigned zerofill not null DEFAULT 9.9, +f44 decimal (64) unsigned zerofill not null DEFAULT 9.9, +f45 decimal (0,0) not null DEFAULT 9.9, +f46 decimal (63,30) not null DEFAULT 9.9, +f47 decimal (0,0) unsigned not null DEFAULT 9.9, +f48 decimal (63,30) unsigned not null DEFAULT 9.9, +f49 decimal (0,0) zerofill not null DEFAULT 9.9, +f50 decimal (63,30) zerofill not null DEFAULT 9.9, +f51 decimal (0,0) unsigned zerofill not null DEFAULT 9.9, +f52 decimal (63,30) unsigned zerofill not null DEFAULT 9.9, +f53 numeric not null DEFAULT 99, +f54 numeric unsigned not null DEFAULT 99, +f55 numeric zerofill not null DEFAULT 99, +f56 numeric unsigned zerofill not null DEFAULT 99, +f57 numeric (0) not null DEFAULT 99, f58 numeric (64) not null DEFAULT 99 ) engine = myisam; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval load data infile '$MYSQL_TEST_DIR/suite/funcs_1/data/myisam_tb1.txt' into table tb1 ; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +load data infile '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/myisam_tb1.txt' +into table tb1; diff --git a/mysql-test/suite/funcs_1/include/myisam_tb2.inc b/mysql-test/suite/funcs_1/include/myisam_tb2.inc index 528031700cb..c878b1853f0 100644 --- a/mysql-test/suite/funcs_1/include/myisam_tb2.inc +++ b/mysql-test/suite/funcs_1/include/myisam_tb2.inc @@ -4,77 +4,79 @@ drop table if exists tb2 ; --enable_warnings create table tb2 ( -f59 numeric (0) unsigned, -f60 numeric (64) unsigned, -f61 numeric (0) zerofill, -f62 numeric (64) zerofill, -f63 numeric (0) unsigned zerofill, -f64 numeric (64) unsigned zerofill, -f65 numeric (0,0), -f66 numeric (63,30), -f67 numeric (0,0) unsigned, -f68 numeric (63,30) unsigned, -f69 numeric (0,0) zerofill, -f70 numeric (63,30) zerofill, -f71 numeric (0,0) unsigned zerofill, -f72 numeric (63,30) unsigned zerofill, -f73 real, -f74 real unsigned, -f75 real zerofill, -f76 real unsigned zerofill, -f77 double default 7.7, -f78 double unsigned default 7.7, -f79 double zerofill default 7.7, -f80 double unsigned zerofill default 8.8, -f81 float not null default 8.8, -f82 float unsigned not null default 8.8, -f83 float zerofill not null default 8.8, -f84 float unsigned zerofill not null default 8.8, -f85 float(0) not null default 8.8, -f86 float(23) not null default 8.8, -f87 float(0) unsigned not null default 8.8, -f88 float(23) unsigned not null default 8.8, -f89 float(0) zerofill not null default 8.8, -f90 float(23) zerofill not null default 8.8, -f91 float(0) unsigned zerofill not null default 8.8, -f92 float(23) unsigned zerofill not null default 8.8, -f93 float(24) not null default 8.8, -f94 float(53) not null default 8.8, -f95 float(24) unsigned not null default 8.8, -f96 float(53) unsigned not null default 8.8, -f97 float(24) zerofill not null default 8.8, -f98 float(53) zerofill not null default 8.8, -f99 float(24) unsigned zerofill not null default 8.8, -f100 float(53) unsigned zerofill not null default 8.8, -f101 date not null default '2000-01-01', -f102 time not null default 20, -f103 datetime not null default '2/2/2', -f104 timestamp not null default 20001231235959, -f105 year not null default 2000, -f106 year(3) not null default 2000, -f107 year(4) not null default 2000, -f108 enum("1enum","2enum") not null default "1enum", +f59 numeric (0) unsigned, +f60 numeric (64) unsigned, +f61 numeric (0) zerofill, +f62 numeric (64) zerofill, +f63 numeric (0) unsigned zerofill, +f64 numeric (64) unsigned zerofill, +f65 numeric (0,0), +f66 numeric (63,30), +f67 numeric (0,0) unsigned, +f68 numeric (63,30) unsigned, +f69 numeric (0,0) zerofill, +f70 numeric (63,30) zerofill, +f71 numeric (0,0) unsigned zerofill, +f72 numeric (63,30) unsigned zerofill, +f73 real, +f74 real unsigned, +f75 real zerofill, +f76 real unsigned zerofill, +f77 double default 7.7, +f78 double unsigned default 7.7, +f79 double zerofill default 7.7, +f80 double unsigned zerofill default 8.8, +f81 float not null default 8.8, +f82 float unsigned not null default 8.8, +f83 float zerofill not null default 8.8, +f84 float unsigned zerofill not null default 8.8, +f85 float(0) not null default 8.8, +f86 float(23) not null default 8.8, +f87 float(0) unsigned not null default 8.8, +f88 float(23) unsigned not null default 8.8, +f89 float(0) zerofill not null default 8.8, +f90 float(23) zerofill not null default 8.8, +f91 float(0) unsigned zerofill not null default 8.8, +f92 float(23) unsigned zerofill not null default 8.8, +f93 float(24) not null default 8.8, +f94 float(53) not null default 8.8, +f95 float(24) unsigned not null default 8.8, +f96 float(53) unsigned not null default 8.8, +f97 float(24) zerofill not null default 8.8, +f98 float(53) zerofill not null default 8.8, +f99 float(24) unsigned zerofill not null default 8.8, +f100 float(53) unsigned zerofill not null default 8.8, +f101 date not null default '2000-01-01', +f102 time not null default 20, +f103 datetime not null default '2/2/2', +f104 timestamp not null default 20001231235959, +f105 year not null default 2000, +f106 year(3) not null default 2000, +f107 year(4) not null default 2000, +f108 enum("1enum","2enum") not null default "1enum", f109 set("1set","2set") not null default "1set", -f110 VARBINARY(64) null, -f111 VARBINARY(27) null , -f112 VARBINARY(64) null , -f113 VARBINARY(192) null , -f114 VARBINARY(192) , -f115 VARBINARY(27) null , -f116 VARBINARY(64) null, -f117 VARBINARY(192) null +f110 VARBINARY(64) null, +f111 VARBINARY(27) null , +f112 VARBINARY(64) null , +f113 VARBINARY(192) null , +f114 VARBINARY(192) , +f115 VARBINARY(27) null , +f116 VARBINARY(64) null, +f117 VARBINARY(192) null ) engine = myisam; # The original columns. They are replaced by varbinary, because the funcs_1 tests should # not depend on the optional availability of the geometry feature. -# f110 geometry null, -# f111 point null , -# f112 linestring null , -# f113 polygon null , -# f114 geometrycollection , -# f115 multipoint null , -# f116 multilinestring null, -# f117 multipolygon null +# f110 geometry null, +# f111 point null , +# f112 linestring null , +# f113 polygon null , +# f114 geometrycollection , +# f115 multipoint null , +# f116 multilinestring null, +# f117 multipolygon null ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval load data infile '$MYSQL_TEST_DIR/suite/funcs_1/data/myisam_tb2.txt' into table tb2 ; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +load data infile '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/myisam_tb2.txt' +into table tb2; diff --git a/mysql-test/suite/funcs_1/include/myisam_tb3.inc b/mysql-test/suite/funcs_1/include/myisam_tb3.inc index aca35c0e11b..209c2e13fbf 100644 --- a/mysql-test/suite/funcs_1/include/myisam_tb3.inc +++ b/mysql-test/suite/funcs_1/include/myisam_tb3.inc @@ -4,65 +4,67 @@ drop table if exists tb3 ; --enable_warnings 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) +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, +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 = myisam; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval load data infile '$MYSQL_TEST_DIR/suite/funcs_1/data/myisam_tb3.txt' into table tb3 ; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +load data infile '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/myisam_tb3.txt' +into table tb3; diff --git a/mysql-test/suite/funcs_1/include/myisam_tb4.inc b/mysql-test/suite/funcs_1/include/myisam_tb4.inc index d9051847c45..d7e3a966579 100644 --- a/mysql-test/suite/funcs_1/include/myisam_tb4.inc +++ b/mysql-test/suite/funcs_1/include/myisam_tb4.inc @@ -4,85 +4,87 @@ drop table if exists tb4 ; --enable_warnings create table tb4 ( -f176 numeric (0) unsigned not null DEFAULT 9, -f177 numeric (64) unsigned not null DEFAULT 9, -f178 numeric (0) zerofill not null DEFAULT 9, -f179 numeric (64) zerofill not null DEFAULT 9, -f180 numeric (0) unsigned zerofill not null DEFAULT 9, -f181 numeric (64) unsigned zerofill not null DEFAULT 9, -f182 numeric (0,0) not null DEFAULT 9, -f183 numeric (63,30) not null DEFAULT 9, -f184 numeric (0,0) unsigned not null DEFAULT 9, -f185 numeric (63,30) unsigned not null DEFAULT 9, -f186 numeric (0,0) zerofill not null DEFAULT 9, -f187 numeric (63,30) zerofill not null DEFAULT 9, -f188 numeric (0,0) unsigned zerofill not null DEFAULT 9, -f189 numeric (63,30) unsigned zerofill not null DEFAULT 9, -f190 real not null DEFAULT 88.8, -f191 real unsigned not null DEFAULT 88.8, -f192 real zerofill not null DEFAULT 88.8, -f193 real unsigned zerofill not null DEFAULT 88.8, -f194 double not null DEFAULT 55.5, -f195 double unsigned not null DEFAULT 55.5, -f196 double zerofill not null DEFAULT 55.5, -f197 double unsigned zerofill not null DEFAULT 55.5, -f198 float, -f199 float unsigned, -f200 float zerofill, -f201 float unsigned zerofill, -f202 float(0), -f203 float(23), -f204 float(0) unsigned, -f205 float(23) unsigned, -f206 float(0) zerofill, -f207 float(23) zerofill, -f208 float(0) unsigned zerofill, -f209 float(23) unsigned zerofill, -f210 float(24), -f211 float(53), -f212 float(24) unsigned, -f213 float(53) unsigned, -f214 float(24) zerofill, -f215 float(53) zerofill, -f216 float(24) unsigned zerofill, -f217 float(53) unsigned zerofill, -f218 date, -f219 time, -f220 datetime, -f221 timestamp, -f222 year, -f223 year(3), -f224 year(4), -f225 enum("1enum","2enum"), -f226 set("1set","2set"), -f227 VARBINARY(64), -f228 VARBINARY(27), -f229 VARBINARY(64), -f230 VARBINARY(192), -f231 VARBINARY(192), -f232 VARBINARY(27), -f233 VARBINARY(64), +f176 numeric (0) unsigned not null DEFAULT 9, +f177 numeric (64) unsigned not null DEFAULT 9, +f178 numeric (0) zerofill not null DEFAULT 9, +f179 numeric (64) zerofill not null DEFAULT 9, +f180 numeric (0) unsigned zerofill not null DEFAULT 9, +f181 numeric (64) unsigned zerofill not null DEFAULT 9, +f182 numeric (0,0) not null DEFAULT 9, +f183 numeric (63,30) not null DEFAULT 9, +f184 numeric (0,0) unsigned not null DEFAULT 9, +f185 numeric (63,30) unsigned not null DEFAULT 9, +f186 numeric (0,0) zerofill not null DEFAULT 9, +f187 numeric (63,30) zerofill not null DEFAULT 9, +f188 numeric (0,0) unsigned zerofill not null DEFAULT 9, +f189 numeric (63,30) unsigned zerofill not null DEFAULT 9, +f190 real not null DEFAULT 88.8, +f191 real unsigned not null DEFAULT 88.8, +f192 real zerofill not null DEFAULT 88.8, +f193 real unsigned zerofill not null DEFAULT 88.8, +f194 double not null DEFAULT 55.5, +f195 double unsigned not null DEFAULT 55.5, +f196 double zerofill not null DEFAULT 55.5, +f197 double unsigned zerofill not null DEFAULT 55.5, +f198 float, +f199 float unsigned, +f200 float zerofill, +f201 float unsigned zerofill, +f202 float(0), +f203 float(23), +f204 float(0) unsigned, +f205 float(23) unsigned, +f206 float(0) zerofill, +f207 float(23) zerofill, +f208 float(0) unsigned zerofill, +f209 float(23) unsigned zerofill, +f210 float(24), +f211 float(53), +f212 float(24) unsigned, +f213 float(53) unsigned, +f214 float(24) zerofill, +f215 float(53) zerofill, +f216 float(24) unsigned zerofill, +f217 float(53) unsigned zerofill, +f218 date, +f219 time, +f220 datetime, +f221 timestamp, +f222 year, +f223 year(3), +f224 year(4), +f225 enum("1enum","2enum"), +f226 set("1set","2set"), +f227 VARBINARY(64), +f228 VARBINARY(27), +f229 VARBINARY(64), +f230 VARBINARY(192), +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; # The original columns. They are replaced by varbinary, because the funcs_1 tests should # not depend on the optional availability of the geometry feature. -# f227 geometry, -# f228 point, -# f229 linestring, -# f230 polygon, -# f231 geometrycollection, -# f232 multipoint, -# f233 multilinestring, +# f227 geometry, +# f228 point, +# f229 linestring, +# f230 polygon, +# f231 geometrycollection, +# f232 multipoint, +# f233 multilinestring, # f234 multipolygon, ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval load data infile '$MYSQL_TEST_DIR/suite/funcs_1/data/myisam_tb4.txt' into table tb4 ; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +load data infile '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/myisam_tb4.txt' +into table tb4; diff --git a/mysql-test/suite/funcs_1/include/sp_tb.inc b/mysql-test/suite/funcs_1/include/sp_tb.inc index b37f2cc7ffe..ae1114fb5f1 100644 --- a/mysql-test/suite/funcs_1/include/sp_tb.inc +++ b/mysql-test/suite/funcs_1/include/sp_tb.inc @@ -5,29 +5,46 @@ USE test; --disable_warnings DROP TABLE IF EXISTS t1, t2, t4, t10, t11; --enable_warnings -eval CREATE TABLE t1 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = $engine_type; -eval CREATE TABLE t2 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = $engine_type; -eval CREATE TABLE t4 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = $engine_type; -eval CREATE TABLE t10 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = $engine_type; -eval CREATE TABLE t11 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = $engine_type; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval LOAD DATA INFILE '$MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t1; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval LOAD DATA INFILE '$MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t2; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval LOAD DATA INFILE '$MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t4; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval LOAD DATA INFILE '$MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t10; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval LOAD DATA INFILE '$MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t11; +eval +CREATE TABLE t1 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +ENGINE = $engine_type; +eval +CREATE TABLE t2 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +ENGINE = $engine_type; +eval +CREATE TABLE t4 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +ENGINE = $engine_type; +eval +CREATE TABLE t10 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +ENGINE = $engine_type; +eval +CREATE TABLE t11 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +ENGINE = $engine_type; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/t4.txt' INTO TABLE t1; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/t4.txt' INTO TABLE t2; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/t4.txt' INTO TABLE t4; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/t4.txt' INTO TABLE t10; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/t4.txt' INTO TABLE t11; --disable_warnings drop TABLE if exists t3; --enable_warnings -eval CREATE TABLE t3 (f1 char(20), f2 char(20), f3 integer) ENGINE = $engine_type; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval LOAD DATA INFILE '$MYSQL_TEST_DIR/suite/funcs_1/data/t3.txt' INTO TABLE t3; +eval +CREATE TABLE t3 (f1 char(20), f2 char(20), f3 integer) ENGINE = $engine_type; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/t3.txt' INTO TABLE t3; #--------------------------- @@ -37,9 +54,12 @@ drop database if exists test4; CREATE database test4; use test4; -eval CREATE TABLE t6 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = $engine_type; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval LOAD DATA INFILE '$MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t6; +eval +CREATE TABLE t6 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) +ENGINE = $engine_type; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/t4.txt' INTO TABLE t6; #--------------------------- use test; @@ -47,18 +67,23 @@ use test; --disable_warnings drop TABLE if exists t7, t8; --enable_warnings -eval CREATE TABLE t7 (f1 char(20), f2 char(25), f3 date, f4 int) ENGINE = $engine_type; -eval CREATE TABLE t8 (f1 char(20), f2 char(25), f3 date, f4 int) ENGINE = $engine_type; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval LOAD DATA INFILE '$MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' INTO TABLE t7; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval LOAD DATA INFILE '$MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' INTO TABLE t8; +eval +CREATE TABLE t7 (f1 char(20),f2 char(25),f3 date,f4 int) ENGINE = $engine_type; +eval +CREATE TABLE t8 (f1 char(20),f2 char(25),f3 date,f4 int) ENGINE = $engine_type; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/t7.txt' INTO TABLE t7; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/t7.txt' INTO TABLE t8; --disable_warnings drop TABLE if exists t9; --enable_warnings eval CREATE TABLE t9 (f1 int, f2 char(25), f3 int) ENGINE = $engine_type; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval LOAD DATA INFILE '$MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' INTO TABLE t9; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/t9.txt' INTO TABLE t9; diff --git a/mysql-test/suite/funcs_1/include/tb3.inc b/mysql-test/suite/funcs_1/include/tb3.inc new file mode 100644 index 00000000000..5e7dc369ddb --- /dev/null +++ b/mysql-test/suite/funcs_1/include/tb3.inc @@ -0,0 +1,66 @@ +##### suite/funcs_1/include/tb3.inc +# +# This auxiliary script is used in several Trigger tests. +# +# If the table need data than the file std_data_ln/funcs_1/memory_tb3.txt +# could be used. +# + +--disable_warnings +drop table if exists tb3; +--enable_warnings +--replace_result $engine_type <engine_to_be_used> +eval 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 char(50), +f122 char(50), +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 = $engine_type; diff --git a/mysql-test/suite/funcs_1/r/innodb_func_view.result b/mysql-test/suite/funcs_1/r/innodb_func_view.result index f901bcf8246..c2689a36801 100644 --- a/mysql-test/suite/funcs_1/r/innodb_func_view.result +++ b/mysql-test/suite/funcs_1/r/innodb_func_view.result @@ -1,7 +1,3 @@ - -! Attention: The file with the expected results suffers from -Bug#10713: mysqldump includes database in create view and referenced tables --------------------------------------------------------------------------------- DROP TABLE IF EXISTS t1_selects, t1_modes, t1_values; DROP VIEW IF EXISTS v1; CREATE TABLE t1_values @@ -9,7 +5,7 @@ CREATE TABLE t1_values id BIGINT AUTO_INCREMENT, select_id BIGINT, PRIMARY KEY(id) -) ENGINE = 'InnoDB' ; +) ENGINE = <engine_to_be_tested>; ALTER TABLE t1_values ADD my_char_30 CHAR(30); ALTER TABLE t1_values ADD my_varchar_1000 VARCHAR(1000); ALTER TABLE t1_values ADD my_binary_30 BINARY(30); @@ -39,10 +35,10 @@ my_bigint = -9223372036854775808, my_decimal = -9999999999999999999999999999999999.999999999999999999999999999999 , my_double = -1.7976931348623E+308; INSERT INTO t1_values SET -my_char_30 = '<--------30 characters------->', +my_char_30 = '<--------30 characters------->', my_varchar_1000 = CONCAT('<---------1000 characters', RPAD('',965,'-'),'--------->'), -my_binary_30 = '<--------30 characters------->', +my_binary_30 = '<--------30 characters------->', my_varbinary_1000 = CONCAT('<---------1000 characters', RPAD('',965,'-'),'--------->'), my_datetime = '9999-12-31 23:59:59', @@ -54,23 +50,23 @@ my_bigint = 9223372036854775807, my_decimal = +9999999999999999999999999999999999.999999999999999999999999999999 , my_double = 1.7976931348623E+308; INSERT INTO t1_values SET -my_char_30 = ' ---äÖüß@µ*$-- ', -my_varchar_1000 = ' ---äÖüß@µ*$-- ', -my_binary_30 = ' ---äÖüß@µ*$-- ', -my_varbinary_1000 = ' ---äÖüß@µ*$-- ', +my_char_30 = ' ---äÖüß@µ*$-- ', +my_varchar_1000 = ' ---äÖüß@µ*$-- ', +my_binary_30 = ' ---äÖüß@µ*$-- ', +my_varbinary_1000 = ' ---äÖüß@µ*$-- ', my_datetime = '2004-02-29 23:59:59', my_date = '2004-02-29', my_timestamp = '2004-02-29 23:59:59', my_time = '13:00:00', my_year = 2000, -my_bigint = 0, +my_bigint = 0, my_decimal = 0.0, my_double = 0; INSERT INTO t1_values SET -my_char_30 = '-1', -my_varchar_1000 = '-1', -my_binary_30 = '-1', -my_varbinary_1000 = '-1', +my_char_30 = '-1', +my_varchar_1000 = '-1', +my_binary_30 = '-1', +my_varbinary_1000 = '-1', my_datetime = '2005-06-28 10:00:00', my_date = '2005-06-28', my_timestamp = '2005-06-28 10:00:00', @@ -89,6 +85,9 @@ INSERT INTO t1_values SET select_id = @select_id, my_bigint = 4; INSERT INTO t1_values SET select_id = @select_id, my_bigint = -25; +##### 1.1.1. CAST --> BINARY +##### 1.1.2. CAST --> CHAR +##### 1.1.3. CAST --> DATE INSERT INTO t1_values SET select_id = @select_id, my_char_30 = '2005-06-27'; INSERT INTO t1_values SET select_id = @select_id, @@ -101,6 +100,7 @@ INSERT INTO t1_values SET select_id = @select_id, my_bigint = 20050627; INSERT INTO t1_values SET select_id = @select_id, my_double = +20.050627E+6; +##### 1.1.4. CAST --> DATETIME INSERT INTO t1_values SET select_id = @select_id, my_char_30 = '2005-06-27 17:58'; INSERT INTO t1_values SET select_id = @select_id, @@ -113,6 +113,7 @@ INSERT INTO t1_values SET select_id = @select_id, my_bigint = 200506271758; INSERT INTO t1_values SET select_id = @select_id, my_double = +0.0200506271758E+13; +##### 1.1.5. CAST --> TIME INSERT INTO t1_values SET select_id = @select_id, my_char_30 = '1 17:58'; INSERT INTO t1_values SET select_id = @select_id, @@ -123,10 +124,9 @@ INSERT INTO t1_values SET select_id = @select_id, my_varbinary_1000 = '1 17:58'; INSERT INTO t1_values SET select_id = @select_id, my_bigint = 1758; - -some statements disabled because of -Bug#12440: CAST(data type DOUBLE AS TIME) strange results --------------------------------------------------------------------------------- +INSERT INTO t1_values SET select_id = @select_id, +my_double = +1.758E+3; +##### 1.1.6. CAST --> DECIMAL INSERT INTO t1_values SET select_id = @select_id, my_char_30 = '-3333.3333'; INSERT INTO t1_values SET select_id = @select_id, @@ -135,51 +135,39 @@ INSERT INTO t1_values SET select_id = @select_id, my_binary_30 = '-3333.3333'; INSERT INTO t1_values SET select_id = @select_id, my_varbinary_1000 = '-3333.3333'; - -some statements disabled because of -Bug#13349: CAST(1.0E+300 TO DECIMAL) returns wrong result + diff little/big endian --------------------------------------------------------------------------------- +INSERT INTO t1_values SET select_id = @select_id, +my_double = -0.33333333E+4; +##### 1.1.7. CAST --> SIGNED INTEGER "Attention: CAST --> SIGNED INTEGER - The file with expected results suffers from - Bug#5083 Big integer values are inserted as negative into - decimal/string columns Bug#5913 Traditional mode: BIGINT range not correctly delimited - Both have the status: To be fixed later" --------------------------------------------------------------------------------- - -some statements disabled because of -Bug #13344: CAST(1E+300 TO signed int) on little endian CPU, wrong result + Status: To be fixed later" -------------------------------------------------------------------------------- +##### 1.1.8. CAST --> UNSIGNED INTEGER "Attention: CAST --> UNSIGNED INTEGER - The file with expected results suffers from Bug 5083 5913 9809" + The file with expected results suffers from Bug 5913" -------------------------------------------------------------------------------- some statements disabled because of -Bugs#8663: cant use bgint unsigned as input to cast +Bug#5913 Traditional mode: BIGINT range not correctly delimited -------------------------------------------------------------------------------- -SET @my_select = 'SELECT CONVERT(my_char_30 USING utf8), +SET @my_select = 'SELECT CONVERT(my_char_30 USING utf8), my_char_30, id FROM t1_values'; -SET @my_select = 'SELECT CONVERT(my_varchar_1000 USING utf8), +SET @my_select = 'SELECT CONVERT(my_varchar_1000 USING utf8), my_varchar_1000, id FROM t1_values'; -SET @my_select = 'SELECT CONVERT(my_binary_30 USING utf8), +SET @my_select = 'SELECT CONVERT(my_binary_30 USING utf8), my_binary_30, id FROM t1_values'; -SET @my_select = 'SELECT CONVERT(my_varbinary_1000 USING utf8), +SET @my_select = 'SELECT CONVERT(my_varbinary_1000 USING utf8), my_varbinary_1000, id FROM t1_values'; -SET @my_select = 'SELECT CONVERT(my_char_30 USING koi8r), +SET @my_select = 'SELECT CONVERT(my_char_30 USING koi8r), my_char_30, id FROM t1_values'; -SET @my_select = 'SELECT CONVERT(my_varchar_1000 USING koi8r), +SET @my_select = 'SELECT CONVERT(my_varchar_1000 USING koi8r), my_varchar_1000, id FROM t1_values'; -SET @my_select = 'SELECT CONVERT(my_binary_30 USING koi8r), +SET @my_select = 'SELECT CONVERT(my_binary_30 USING koi8r), my_binary_30, id FROM t1_values'; -SET @my_select = 'SELECT CONVERT(my_varbinary_1000 USING koi8r), +SET @my_select = 'SELECT CONVERT(my_varbinary_1000 USING koi8r), my_varbinary_1000, id FROM t1_values'; - -"Attention: IF(my_year IS NULL, ... - The file with expected results suffers from - Bug#11689. successful CREATE VIEW but SELECT on view fails." --------------------------------------------------------------------------------- SET @my_select = 'SELECT BIT_LENGTH(my_char_30), my_char_30, id FROM t1_values'; SET @my_select = 'SELECT BIT_LENGTH(my_varchar_1000), @@ -192,22 +180,20 @@ SET @my_select = 'SELECT INSTR(my_char_30, ''char''), my_char_30, id FROM t1_values'; SET @my_select = 'SELECT LCASE(my_varchar_1000), my_varchar_1000, id FROM t1_values'; -SET @my_select = +SET @my_select = 'SELECT LEFT(my_char_30, 2), my_char_30, id FROM t1_values'; -SET @my_select = +SET @my_select = 'SELECT LEFT(my_varchar_1000, 2), my_varchar_1000, id FROM t1_values'; -SET @my_select = +SET @my_select = 'SELECT LEFT(my_binary_30, 2), my_binary_30, id FROM t1_values'; -SET @my_select = +SET @my_select = 'SELECT LEFT(my_varbinary_1000, 2), my_varbinary_1000, id FROM t1_values'; - -"Attention: LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', <numeric column>) - The file with expected results suffers from Bug 10963 11728" - and the testcases with length = BIGINT or DOUBLE column are deactivated, -because there are 32/64 Bit differences --------------------------------------------------------------------------------- +SET @my_select = +'SELECT LEFT(''AaBbCcDdEeFfGgHhIiJjÄäÜüÖö'', my_bigint), my_bigint, id FROM t1_values'; SET @my_select = 'SELECT LEFT(''AaBbCcDdEeFfGgHhIiJjÄäÜüÖö'', my_decimal), my_decimal, id FROM t1_values'; +SET @my_select = +'SELECT LEFT(''AaBbCcDdEeFfGgHhIiJjÄäÜüÖö'', my_double), my_double, id FROM t1_values'; SET @my_select = 'SELECT LENGTH(my_char_30), my_char_30, id FROM t1_values'; SET @my_select = 'SELECT LENGTH(my_varchar_1000), @@ -216,8 +202,10 @@ SET @my_select = 'SELECT LENGTH(my_binary_30), my_binary_30, id FROM t1_values'; SET @my_select = 'SELECT LENGTH(my_varbinary_1000), my_varbinary_1000, id FROM t1_values'; -SET @my_select = -'SELECT LOAD_FILE(''../log/current_test''), id FROM t1_values'; +SET @my_select = +'SELECT LOAD_FILE(''<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/load_file.txt'') + AS my_col, + id FROM t1_values'; SET @my_select = 'SELECT LOCATE(''char'', my_char_30), my_char_30, id FROM t1_values'; SET @my_select = 'SELECT LOCATE(''char'', my_varchar_1000), @@ -299,19 +287,19 @@ SET sql_mode = ''; -------------------------------------------------------------------------------- CREATE VIEW v1 AS SELECT my_char_30, id FROM t1_values; SELECT my_char_30, id FROM t1_values -WHERE select_id = 187 OR select_id IS NULL; +WHERE select_id = 193 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 187 OR select_id IS NULL); +WHERE select_id = 193 OR select_id IS NULL) order by id; DROP VIEW v1; CREATE VIEW v1 AS SELECT CONCAT('A',my_char_30), my_char_30, id FROM t1_values; SELECT CONCAT('A',my_char_30), my_char_30, id FROM t1_values -WHERE select_id = 186 OR select_id IS NULL; +WHERE select_id = 192 OR select_id IS NULL order by id; CONCAT('A',my_char_30) my_char_30 id NULL NULL 1 A 2 @@ -323,7 +311,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select concat(_latin1'A',`t1_values`.`my_char_30`) AS `CONCAT('A',my_char_30)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 186 OR select_id IS NULL); +WHERE select_id = 192 OR select_id IS NULL) order by id; CONCAT('A',my_char_30) my_char_30 id NULL NULL 1 A 2 @@ -337,13 +325,13 @@ CREATE VIEW v1 AS SELECT LTRIM(my_varbinary_1000), my_varbinary_1000, id FROM t1_values; SELECT LTRIM(my_varbinary_1000), my_varbinary_1000, id FROM t1_values -WHERE select_id = 185 OR select_id IS NULL; +WHERE select_id = 191 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ltrim(`t1_values`.`my_varbinary_1000`) AS `LTRIM(my_varbinary_1000)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 185 OR select_id IS NULL); +WHERE select_id = 191 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -351,13 +339,13 @@ CREATE VIEW v1 AS SELECT LTRIM(my_binary_30), my_binary_30, id FROM t1_values; SELECT LTRIM(my_binary_30), my_binary_30, id FROM t1_values -WHERE select_id = 184 OR select_id IS NULL; +WHERE select_id = 190 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ltrim(`t1_values`.`my_binary_30`) AS `LTRIM(my_binary_30)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 184 OR select_id IS NULL); +WHERE select_id = 190 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -365,13 +353,13 @@ CREATE VIEW v1 AS SELECT LTRIM(my_varchar_1000), my_varchar_1000, id FROM t1_values; SELECT LTRIM(my_varchar_1000), my_varchar_1000, id FROM t1_values -WHERE select_id = 183 OR select_id IS NULL; +WHERE select_id = 189 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ltrim(`t1_values`.`my_varchar_1000`) AS `LTRIM(my_varchar_1000)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 183 OR select_id IS NULL); +WHERE select_id = 189 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -379,13 +367,13 @@ CREATE VIEW v1 AS SELECT LTRIM(my_char_30), my_char_30, id FROM t1_values; SELECT LTRIM(my_char_30), my_char_30, id FROM t1_values -WHERE select_id = 182 OR select_id IS NULL; +WHERE select_id = 188 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ltrim(`t1_values`.`my_char_30`) AS `LTRIM(my_char_30)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 182 OR select_id IS NULL); +WHERE select_id = 188 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -393,13 +381,13 @@ CREATE VIEW v1 AS SELECT LOWER(my_varbinary_1000), my_varbinary_1000, id FROM t1_values; SELECT LOWER(my_varbinary_1000), my_varbinary_1000, id FROM t1_values -WHERE select_id = 181 OR select_id IS NULL; +WHERE select_id = 187 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select lcase(`t1_values`.`my_varbinary_1000`) AS `LOWER(my_varbinary_1000)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 181 OR select_id IS NULL); +WHERE select_id = 187 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -407,13 +395,13 @@ CREATE VIEW v1 AS SELECT LOWER(my_binary_30), my_binary_30, id FROM t1_values; SELECT LOWER(my_binary_30), my_binary_30, id FROM t1_values -WHERE select_id = 180 OR select_id IS NULL; +WHERE select_id = 186 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select lcase(`t1_values`.`my_binary_30`) AS `LOWER(my_binary_30)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 180 OR select_id IS NULL); +WHERE select_id = 186 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -421,13 +409,13 @@ CREATE VIEW v1 AS SELECT LOWER(my_varchar_1000), my_varchar_1000, id FROM t1_values; SELECT LOWER(my_varchar_1000), my_varchar_1000, id FROM t1_values -WHERE select_id = 179 OR select_id IS NULL; +WHERE select_id = 185 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select lcase(`t1_values`.`my_varchar_1000`) AS `LOWER(my_varchar_1000)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 179 OR select_id IS NULL); +WHERE select_id = 185 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -435,13 +423,13 @@ CREATE VIEW v1 AS SELECT LOWER(my_char_30), my_char_30, id FROM t1_values; SELECT LOWER(my_char_30), my_char_30, id FROM t1_values -WHERE select_id = 178 OR select_id IS NULL; +WHERE select_id = 184 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select lcase(`t1_values`.`my_char_30`) AS `LOWER(my_char_30)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 178 OR select_id IS NULL); +WHERE select_id = 184 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -449,13 +437,13 @@ CREATE VIEW v1 AS SELECT LOCATE('-', ' - -ABC', my_decimal), my_decimal, id FROM t1_values; SELECT LOCATE('-', ' - -ABC', my_decimal), my_decimal, id FROM t1_values -WHERE select_id = 177 OR select_id IS NULL; +WHERE select_id = 183 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'-',_latin1' - -ABC',`t1_values`.`my_decimal`) AS `LOCATE('-', ' - -ABC', my_decimal)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 177 OR select_id IS NULL); +WHERE select_id = 183 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -463,13 +451,13 @@ CREATE VIEW v1 AS SELECT LOCATE('-', ' - -ABC', my_double), my_double, id FROM t1_values; SELECT LOCATE('-', ' - -ABC', my_double), my_double, id FROM t1_values -WHERE select_id = 176 OR select_id IS NULL; +WHERE select_id = 182 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'-',_latin1' - -ABC',`t1_values`.`my_double`) AS `LOCATE('-', ' - -ABC', my_double)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 176 OR select_id IS NULL); +WHERE select_id = 182 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -477,13 +465,13 @@ CREATE VIEW v1 AS SELECT LOCATE('-', ' - -ABC', my_bigint), my_bigint, id FROM t1_values; SELECT LOCATE('-', ' - -ABC', my_bigint), my_bigint, id FROM t1_values -WHERE select_id = 175 OR select_id IS NULL; +WHERE select_id = 181 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'-',_latin1' - -ABC',`t1_values`.`my_bigint`) AS `LOCATE('-', ' - -ABC', my_bigint)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 175 OR select_id IS NULL); +WHERE select_id = 181 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -491,13 +479,13 @@ CREATE VIEW v1 AS SELECT LOCATE('-', my_varbinary_1000, 3), my_varbinary_1000, id FROM t1_values; SELECT LOCATE('-', my_varbinary_1000, 3), my_varbinary_1000, id FROM t1_values -WHERE select_id = 174 OR select_id IS NULL; +WHERE select_id = 180 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'-',`t1_values`.`my_varbinary_1000`,3) AS `LOCATE('-', my_varbinary_1000, 3)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 174 OR select_id IS NULL); +WHERE select_id = 180 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -505,13 +493,13 @@ CREATE VIEW v1 AS SELECT LOCATE('-', my_binary_30, 3), my_binary_30, id FROM t1_values; SELECT LOCATE('-', my_binary_30, 3), my_binary_30, id FROM t1_values -WHERE select_id = 173 OR select_id IS NULL; +WHERE select_id = 179 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'-',`t1_values`.`my_binary_30`,3) AS `LOCATE('-', my_binary_30, 3)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 173 OR select_id IS NULL); +WHERE select_id = 179 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -519,13 +507,13 @@ CREATE VIEW v1 AS SELECT LOCATE('-', my_varchar_1000, 3), my_varchar_1000, id FROM t1_values; SELECT LOCATE('-', my_varchar_1000, 3), my_varchar_1000, id FROM t1_values -WHERE select_id = 172 OR select_id IS NULL; +WHERE select_id = 178 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'-',`t1_values`.`my_varchar_1000`,3) AS `LOCATE('-', my_varchar_1000, 3)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 172 OR select_id IS NULL); +WHERE select_id = 178 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -533,13 +521,13 @@ CREATE VIEW v1 AS SELECT LOCATE('-', my_char_30, 3), my_char_30, id FROM t1_values; SELECT LOCATE('-', my_char_30, 3), my_char_30, id FROM t1_values -WHERE select_id = 171 OR select_id IS NULL; +WHERE select_id = 177 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'-',`t1_values`.`my_char_30`,3) AS `LOCATE('-', my_char_30, 3)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 171 OR select_id IS NULL); +WHERE select_id = 177 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -547,13 +535,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_varbinary_1000, my_binary_30 ), my_varbinary_1000, my_binary_30 id FROM t1_values; SELECT LOCATE(my_varbinary_1000, my_binary_30 ), my_varbinary_1000, my_binary_30 id FROM t1_values -WHERE select_id = 170 OR select_id IS NULL; +WHERE select_id = 176 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_varbinary_1000`,`t1_values`.`my_binary_30`) AS `LOCATE(my_varbinary_1000, my_binary_30 )`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`my_binary_30` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 170 OR select_id IS NULL); +WHERE select_id = 176 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -561,13 +549,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_varbinary_1000, my_varchar_1000 ), my_varbinary_1000, my_varchar_1000 id FROM t1_values; SELECT LOCATE(my_varbinary_1000, my_varchar_1000 ), my_varbinary_1000, my_varchar_1000 id FROM t1_values -WHERE select_id = 169 OR select_id IS NULL; +WHERE select_id = 175 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_varbinary_1000`,`t1_values`.`my_varchar_1000`) AS `LOCATE(my_varbinary_1000, my_varchar_1000 )`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`my_varchar_1000` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 169 OR select_id IS NULL); +WHERE select_id = 175 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -575,13 +563,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_varbinary_1000, my_char_30 ), my_varbinary_1000, my_char_30 id FROM t1_values; SELECT LOCATE(my_varbinary_1000, my_char_30 ), my_varbinary_1000, my_char_30 id FROM t1_values -WHERE select_id = 168 OR select_id IS NULL; +WHERE select_id = 174 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_varbinary_1000`,`t1_values`.`my_char_30`) AS `LOCATE(my_varbinary_1000, my_char_30 )`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`my_char_30` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 168 OR select_id IS NULL); +WHERE select_id = 174 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -589,13 +577,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_varbinary_1000, my_varbinary_1000 ), my_varbinary_1000, id FROM t1_values; SELECT LOCATE(my_varbinary_1000, my_varbinary_1000 ), my_varbinary_1000, id FROM t1_values -WHERE select_id = 167 OR select_id IS NULL; +WHERE select_id = 173 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_varbinary_1000`,`t1_values`.`my_varbinary_1000`) AS `LOCATE(my_varbinary_1000, my_varbinary_1000 )`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 167 OR select_id IS NULL); +WHERE select_id = 173 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -603,13 +591,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_binary_30, my_varbinary_1000 ), my_binary_30, my_varbinary_1000 id FROM t1_values; SELECT LOCATE(my_binary_30, my_varbinary_1000 ), my_binary_30, my_varbinary_1000 id FROM t1_values -WHERE select_id = 166 OR select_id IS NULL; +WHERE select_id = 172 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_binary_30`,`t1_values`.`my_varbinary_1000`) AS `LOCATE(my_binary_30, my_varbinary_1000 )`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`my_varbinary_1000` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 166 OR select_id IS NULL); +WHERE select_id = 172 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -617,13 +605,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_binary_30, my_varchar_1000 ), my_binary_30, my_varchar_1000 id FROM t1_values; SELECT LOCATE(my_binary_30, my_varchar_1000 ), my_binary_30, my_varchar_1000 id FROM t1_values -WHERE select_id = 165 OR select_id IS NULL; +WHERE select_id = 171 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_binary_30`,`t1_values`.`my_varchar_1000`) AS `LOCATE(my_binary_30, my_varchar_1000 )`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`my_varchar_1000` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 165 OR select_id IS NULL); +WHERE select_id = 171 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -631,13 +619,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_binary_30, my_char_30 ), my_binary_30, my_char_30 id FROM t1_values; SELECT LOCATE(my_binary_30, my_char_30 ), my_binary_30, my_char_30 id FROM t1_values -WHERE select_id = 164 OR select_id IS NULL; +WHERE select_id = 170 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_binary_30`,`t1_values`.`my_char_30`) AS `LOCATE(my_binary_30, my_char_30 )`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`my_char_30` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 164 OR select_id IS NULL); +WHERE select_id = 170 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -645,13 +633,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_binary_30, my_binary_30 ), my_binary_30, id FROM t1_values; SELECT LOCATE(my_binary_30, my_binary_30 ), my_binary_30, id FROM t1_values -WHERE select_id = 163 OR select_id IS NULL; +WHERE select_id = 169 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_binary_30`,`t1_values`.`my_binary_30`) AS `LOCATE(my_binary_30, my_binary_30 )`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 163 OR select_id IS NULL); +WHERE select_id = 169 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -659,13 +647,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_varchar_1000, my_varbinary_1000 ), my_varchar_1000, my_varbinary_1000 id FROM t1_values; SELECT LOCATE(my_varchar_1000, my_varbinary_1000 ), my_varchar_1000, my_varbinary_1000 id FROM t1_values -WHERE select_id = 162 OR select_id IS NULL; +WHERE select_id = 168 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_varchar_1000`,`t1_values`.`my_varbinary_1000`) AS `LOCATE(my_varchar_1000, my_varbinary_1000 )`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`my_varbinary_1000` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 162 OR select_id IS NULL); +WHERE select_id = 168 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -673,13 +661,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_varchar_1000, my_binary_30 ), my_varchar_1000, my_binary_30 id FROM t1_values; SELECT LOCATE(my_varchar_1000, my_binary_30 ), my_varchar_1000, my_binary_30 id FROM t1_values -WHERE select_id = 161 OR select_id IS NULL; +WHERE select_id = 167 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_varchar_1000`,`t1_values`.`my_binary_30`) AS `LOCATE(my_varchar_1000, my_binary_30 )`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`my_binary_30` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 161 OR select_id IS NULL); +WHERE select_id = 167 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -687,13 +675,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_varchar_1000, my_char_30 ), my_varchar_1000, my_char_30 id FROM t1_values; SELECT LOCATE(my_varchar_1000, my_char_30 ), my_varchar_1000, my_char_30 id FROM t1_values -WHERE select_id = 160 OR select_id IS NULL; +WHERE select_id = 166 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_varchar_1000`,`t1_values`.`my_char_30`) AS `LOCATE(my_varchar_1000, my_char_30 )`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`my_char_30` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 160 OR select_id IS NULL); +WHERE select_id = 166 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -701,13 +689,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_varchar_1000, my_varchar_1000 ), my_varchar_1000, id FROM t1_values; SELECT LOCATE(my_varchar_1000, my_varchar_1000 ), my_varchar_1000, id FROM t1_values -WHERE select_id = 159 OR select_id IS NULL; +WHERE select_id = 165 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_varchar_1000`,`t1_values`.`my_varchar_1000`) AS `LOCATE(my_varchar_1000, my_varchar_1000 )`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 159 OR select_id IS NULL); +WHERE select_id = 165 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -715,13 +703,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_char_30, my_varbinary_1000 ), my_char_30, my_varbinary_1000 id FROM t1_values; SELECT LOCATE(my_char_30, my_varbinary_1000 ), my_char_30, my_varbinary_1000 id FROM t1_values -WHERE select_id = 158 OR select_id IS NULL; +WHERE select_id = 164 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_char_30`,`t1_values`.`my_varbinary_1000`) AS `LOCATE(my_char_30, my_varbinary_1000 )`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`my_varbinary_1000` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 158 OR select_id IS NULL); +WHERE select_id = 164 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -729,13 +717,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_char_30, my_binary_30 ), my_char_30, my_binary_30 id FROM t1_values; SELECT LOCATE(my_char_30, my_binary_30 ), my_char_30, my_binary_30 id FROM t1_values -WHERE select_id = 157 OR select_id IS NULL; +WHERE select_id = 163 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_char_30`,`t1_values`.`my_binary_30`) AS `LOCATE(my_char_30, my_binary_30 )`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`my_binary_30` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 157 OR select_id IS NULL); +WHERE select_id = 163 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -743,13 +731,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_char_30, my_varchar_1000 ), my_char_30, my_varchar_1000 id FROM t1_values; SELECT LOCATE(my_char_30, my_varchar_1000 ), my_char_30, my_varchar_1000 id FROM t1_values -WHERE select_id = 156 OR select_id IS NULL; +WHERE select_id = 162 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_char_30`,`t1_values`.`my_varchar_1000`) AS `LOCATE(my_char_30, my_varchar_1000 )`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`my_varchar_1000` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 156 OR select_id IS NULL); +WHERE select_id = 162 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -757,13 +745,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_char_30, my_char_30 ), my_char_30, id FROM t1_values; SELECT LOCATE(my_char_30, my_char_30 ), my_char_30, id FROM t1_values -WHERE select_id = 155 OR select_id IS NULL; +WHERE select_id = 161 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_char_30`,`t1_values`.`my_char_30`) AS `LOCATE(my_char_30, my_char_30 )`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 155 OR select_id IS NULL); +WHERE select_id = 161 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -771,13 +759,13 @@ CREATE VIEW v1 AS SELECT LOCATE('char', my_varbinary_1000), my_varbinary_1000, id FROM t1_values; SELECT LOCATE('char', my_varbinary_1000), my_varbinary_1000, id FROM t1_values -WHERE select_id = 154 OR select_id IS NULL; +WHERE select_id = 160 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'char',`t1_values`.`my_varbinary_1000`) AS `LOCATE('char', my_varbinary_1000)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 154 OR select_id IS NULL); +WHERE select_id = 160 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -785,13 +773,13 @@ CREATE VIEW v1 AS SELECT LOCATE('char', my_binary_30), my_binary_30, id FROM t1_values; SELECT LOCATE('char', my_binary_30), my_binary_30, id FROM t1_values -WHERE select_id = 153 OR select_id IS NULL; +WHERE select_id = 159 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'char',`t1_values`.`my_binary_30`) AS `LOCATE('char', my_binary_30)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 153 OR select_id IS NULL); +WHERE select_id = 159 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -799,13 +787,13 @@ CREATE VIEW v1 AS SELECT LOCATE('char', my_varchar_1000), my_varchar_1000, id FROM t1_values; SELECT LOCATE('char', my_varchar_1000), my_varchar_1000, id FROM t1_values -WHERE select_id = 152 OR select_id IS NULL; +WHERE select_id = 158 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'char',`t1_values`.`my_varchar_1000`) AS `LOCATE('char', my_varchar_1000)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 152 OR select_id IS NULL); +WHERE select_id = 158 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -813,46 +801,50 @@ CREATE VIEW v1 AS SELECT LOCATE('char', my_char_30), my_char_30, id FROM t1_values; SELECT LOCATE('char', my_char_30), my_char_30, id FROM t1_values -WHERE select_id = 151 OR select_id IS NULL; +WHERE select_id = 157 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'char',`t1_values`.`my_char_30`) AS `LOCATE('char', my_char_30)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 151 OR select_id IS NULL); +WHERE select_id = 157 OR select_id IS NULL) order by id; DROP VIEW v1; -CREATE VIEW v1 AS SELECT LOAD_FILE('../log/current_test'), id FROM t1_values; -SELECT LOAD_FILE('../log/current_test'), id FROM t1_values -WHERE select_id = 150 OR select_id IS NULL; -LOAD_FILE('../log/current_test') id -CURRENT_TEST: innodb_func_view +CREATE VIEW v1 AS SELECT LOAD_FILE('<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/load_file.txt') + AS my_col, + id FROM t1_values; +SELECT LOAD_FILE('<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/load_file.txt') + AS my_col, + id FROM t1_values +WHERE select_id = 156 OR select_id IS NULL order by id; +my_col id +Here is content from load_file 1 -CURRENT_TEST: innodb_func_view +Here is content from load_file 2 -CURRENT_TEST: innodb_func_view +Here is content from load_file 3 -CURRENT_TEST: innodb_func_view +Here is content from load_file 4 -CURRENT_TEST: innodb_func_view +Here is content from load_file 5 SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select load_file(_latin1'../log/current_test') AS `LOAD_FILE('../log/current_test')`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select load_file(_latin1'<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/load_file.txt') AS `my_col`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 150 OR select_id IS NULL); -LOAD_FILE('../log/current_test') id -CURRENT_TEST: innodb_func_view +WHERE select_id = 156 OR select_id IS NULL) order by id; +my_col id +Here is content from load_file 1 -CURRENT_TEST: innodb_func_view +Here is content from load_file 2 -CURRENT_TEST: innodb_func_view +Here is content from load_file 3 -CURRENT_TEST: innodb_func_view +Here is content from load_file 4 -CURRENT_TEST: innodb_func_view +Here is content from load_file 5 DROP VIEW v1; @@ -861,13 +853,13 @@ CREATE VIEW v1 AS SELECT LENGTH(my_varbinary_1000), my_varbinary_1000, id FROM t1_values; SELECT LENGTH(my_varbinary_1000), my_varbinary_1000, id FROM t1_values -WHERE select_id = 149 OR select_id IS NULL; +WHERE select_id = 155 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select length(`t1_values`.`my_varbinary_1000`) AS `LENGTH(my_varbinary_1000)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 149 OR select_id IS NULL); +WHERE select_id = 155 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -875,13 +867,13 @@ CREATE VIEW v1 AS SELECT LENGTH(my_binary_30), my_binary_30, id FROM t1_values; SELECT LENGTH(my_binary_30), my_binary_30, id FROM t1_values -WHERE select_id = 148 OR select_id IS NULL; +WHERE select_id = 154 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select length(`t1_values`.`my_binary_30`) AS `LENGTH(my_binary_30)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 148 OR select_id IS NULL); +WHERE select_id = 154 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -889,13 +881,13 @@ CREATE VIEW v1 AS SELECT LENGTH(my_varchar_1000), my_varchar_1000, id FROM t1_values; SELECT LENGTH(my_varchar_1000), my_varchar_1000, id FROM t1_values -WHERE select_id = 147 OR select_id IS NULL; +WHERE select_id = 153 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select length(`t1_values`.`my_varchar_1000`) AS `LENGTH(my_varchar_1000)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 147 OR select_id IS NULL); +WHERE select_id = 153 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -903,19 +895,49 @@ CREATE VIEW v1 AS SELECT LENGTH(my_char_30), my_char_30, id FROM t1_values; SELECT LENGTH(my_char_30), my_char_30, id FROM t1_values -WHERE select_id = 146 OR select_id IS NULL; +WHERE select_id = 152 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select length(`t1_values`.`my_char_30`) AS `LENGTH(my_char_30)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 146 OR select_id IS NULL); +WHERE select_id = 152 OR select_id IS NULL) order by id; +DROP VIEW v1; + + +CREATE VIEW v1 AS SELECT LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_double), my_double, id FROM t1_values; +SELECT LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_double), my_double, id FROM t1_values +WHERE select_id = 151 OR select_id IS NULL order by id; +LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_double) my_double id +NULL NULL 1 + -1.7976931348623e+308 2 +AaBbCcDdEeFfGgHhIiJjÄäÜüÖö 1.7976931348623e+308 3 + 0 4 + -1 5 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '-1.7976931348623e+308' +Warning 1292 Truncated incorrect INTEGER value: '1.7976931348623e+308' +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select left(_latin1'AaBbCcDdEeFfGgHhIiJjÄäÜüÖö',`t1_values`.`my_double`) AS `LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_double)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` +SELECT v1.* FROM v1 +WHERE v1.id IN (SELECT id FROM t1_values +WHERE select_id = 151 OR select_id IS NULL) order by id; +LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_double) my_double id +NULL NULL 1 + -1.7976931348623e+308 2 +AaBbCcDdEeFfGgHhIiJjÄäÜüÖö 1.7976931348623e+308 3 + 0 4 + -1 5 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '-1.7976931348623e+308' +Warning 1292 Truncated incorrect INTEGER value: '1.7976931348623e+308' DROP VIEW v1; CREATE VIEW v1 AS SELECT LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_decimal), my_decimal, id FROM t1_values; SELECT LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_decimal), my_decimal, id FROM t1_values -WHERE select_id = 145 OR select_id IS NULL; +WHERE select_id = 150 OR select_id IS NULL order by id; LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_decimal) my_decimal id NULL NULL 1 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -930,7 +952,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select left(_latin1'AaBbCcDdEeFfGgHhIiJjÄäÜüÖö',`t1_values`.`my_decimal`) AS `LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_decimal)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 145 OR select_id IS NULL); +WHERE select_id = 150 OR select_id IS NULL) order by id; LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_decimal) my_decimal id NULL NULL 1 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -943,9 +965,33 @@ Error 1292 Truncated incorrect DECIMAL value: '' DROP VIEW v1; +CREATE VIEW v1 AS SELECT LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_bigint), my_bigint, id FROM t1_values; +SELECT LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_bigint), my_bigint, id FROM t1_values +WHERE select_id = 149 OR select_id IS NULL order by id; +LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_bigint) my_bigint id +NULL NULL 1 + -9223372036854775808 2 +AaBbCcDdEeFfGgHhIiJjÄäÜüÖö 9223372036854775807 3 + 0 4 + -1 5 +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select left(_latin1'AaBbCcDdEeFfGgHhIiJjÄäÜüÖö',`t1_values`.`my_bigint`) AS `LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_bigint)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` +SELECT v1.* FROM v1 +WHERE v1.id IN (SELECT id FROM t1_values +WHERE select_id = 149 OR select_id IS NULL) order by id; +LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_bigint) my_bigint id +NULL NULL 1 + -9223372036854775808 2 +AaBbCcDdEeFfGgHhIiJjÄäÜüÖö 9223372036854775807 3 + 0 4 + -1 5 +DROP VIEW v1; + + CREATE VIEW v1 AS SELECT LEFT(my_varbinary_1000, 2), my_varbinary_1000, id FROM t1_values; SELECT LEFT(my_varbinary_1000, 2), my_varbinary_1000, id FROM t1_values -WHERE select_id = 144 OR select_id IS NULL; +WHERE select_id = 148 OR select_id IS NULL order by id; LEFT(my_varbinary_1000, 2) my_varbinary_1000 id NULL NULL 1 2 @@ -957,7 +1003,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select left(`t1_values`.`my_varbinary_1000`,2) AS `LEFT(my_varbinary_1000, 2)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 144 OR select_id IS NULL); +WHERE select_id = 148 OR select_id IS NULL) order by id; LEFT(my_varbinary_1000, 2) my_varbinary_1000 id NULL NULL 1 2 @@ -969,19 +1015,19 @@ DROP VIEW v1; CREATE VIEW v1 AS SELECT LEFT(my_binary_30, 2), my_binary_30, id FROM t1_values; SELECT LEFT(my_binary_30, 2), my_binary_30, id FROM t1_values -WHERE select_id = 143 OR select_id IS NULL; +WHERE select_id = 147 OR select_id IS NULL order by id; LEFT(my_binary_30, 2) my_binary_30 id NULL NULL 1 - + 2 <- <--------30 characters-------> 3 - - ---äÖüß@µ*$-- --1 -1 + - ---äÖüß@µ*$-- 4 +-1 -1 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select left(`t1_values`.`my_binary_30`,2) AS `LEFT(my_binary_30, 2)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 143 OR select_id IS NULL); +WHERE select_id = 147 OR select_id IS NULL) order by id; LEFT(my_binary_30, 2) my_binary_30 id NULL NULL 1 @@ -993,7 +1039,7 @@ DROP VIEW v1; CREATE VIEW v1 AS SELECT LEFT(my_varchar_1000, 2), my_varchar_1000, id FROM t1_values; SELECT LEFT(my_varchar_1000, 2), my_varchar_1000, id FROM t1_values -WHERE select_id = 142 OR select_id IS NULL; +WHERE select_id = 146 OR select_id IS NULL order by id; LEFT(my_varchar_1000, 2) my_varchar_1000 id NULL NULL 1 2 @@ -1005,7 +1051,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select left(`t1_values`.`my_varchar_1000`,2) AS `LEFT(my_varchar_1000, 2)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 142 OR select_id IS NULL); +WHERE select_id = 146 OR select_id IS NULL) order by id; LEFT(my_varchar_1000, 2) my_varchar_1000 id NULL NULL 1 2 @@ -1017,7 +1063,7 @@ DROP VIEW v1; CREATE VIEW v1 AS SELECT LEFT(my_char_30, 2), my_char_30, id FROM t1_values; SELECT LEFT(my_char_30, 2), my_char_30, id FROM t1_values -WHERE select_id = 141 OR select_id IS NULL; +WHERE select_id = 145 OR select_id IS NULL order by id; LEFT(my_char_30, 2) my_char_30 id NULL NULL 1 2 @@ -1029,7 +1075,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select left(`t1_values`.`my_char_30`,2) AS `LEFT(my_char_30, 2)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 141 OR select_id IS NULL); +WHERE select_id = 145 OR select_id IS NULL) order by id; LEFT(my_char_30, 2) my_char_30 id NULL NULL 1 2 @@ -1043,13 +1089,13 @@ CREATE VIEW v1 AS SELECT LCASE(my_varchar_1000), my_varchar_1000, id FROM t1_values; SELECT LCASE(my_varchar_1000), my_varchar_1000, id FROM t1_values -WHERE select_id = 140 OR select_id IS NULL; +WHERE select_id = 144 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select lcase(`t1_values`.`my_varchar_1000`) AS `LCASE(my_varchar_1000)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 140 OR select_id IS NULL); +WHERE select_id = 144 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -1057,13 +1103,13 @@ CREATE VIEW v1 AS SELECT INSTR(my_char_30, 'char'), my_char_30, id FROM t1_values; SELECT INSTR(my_char_30, 'char'), my_char_30, id FROM t1_values -WHERE select_id = 139 OR select_id IS NULL; +WHERE select_id = 143 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'char',`t1_values`.`my_char_30`) AS `INSTR(my_char_30, 'char')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 139 OR select_id IS NULL); +WHERE select_id = 143 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -1071,7 +1117,7 @@ CREATE VIEW v1 AS SELECT BIT_LENGTH(my_varbinary_1000), my_varbinary_1000, id FROM t1_values; SELECT BIT_LENGTH(my_varbinary_1000), my_varbinary_1000, id FROM t1_values -WHERE select_id = 138 OR select_id IS NULL; +WHERE select_id = 142 OR select_id IS NULL order by id; BIT_LENGTH(my_varbinary_1000) my_varbinary_1000 id NULL NULL 1 0 2 @@ -1083,7 +1129,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select bit_length(`t1_values`.`my_varbinary_1000`) AS `BIT_LENGTH(my_varbinary_1000)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 138 OR select_id IS NULL); +WHERE select_id = 142 OR select_id IS NULL) order by id; BIT_LENGTH(my_varbinary_1000) my_varbinary_1000 id NULL NULL 1 0 2 @@ -1097,19 +1143,19 @@ CREATE VIEW v1 AS SELECT BIT_LENGTH(my_binary_30), my_binary_30, id FROM t1_values; SELECT BIT_LENGTH(my_binary_30), my_binary_30, id FROM t1_values -WHERE select_id = 137 OR select_id IS NULL; +WHERE select_id = 141 OR select_id IS NULL order by id; BIT_LENGTH(my_binary_30) my_binary_30 id NULL NULL 1 -240 +240 2 240 <--------30 characters-------> 3 -240 ---äÖüß@µ*$-- -240 -1 +240 ---äÖüß@µ*$-- 4 +240 -1 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select bit_length(`t1_values`.`my_binary_30`) AS `BIT_LENGTH(my_binary_30)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 137 OR select_id IS NULL); +WHERE select_id = 141 OR select_id IS NULL) order by id; BIT_LENGTH(my_binary_30) my_binary_30 id NULL NULL 1 240 @@ -1123,7 +1169,7 @@ CREATE VIEW v1 AS SELECT BIT_LENGTH(my_varchar_1000), my_varchar_1000, id FROM t1_values; SELECT BIT_LENGTH(my_varchar_1000), my_varchar_1000, id FROM t1_values -WHERE select_id = 136 OR select_id IS NULL; +WHERE select_id = 140 OR select_id IS NULL order by id; BIT_LENGTH(my_varchar_1000) my_varchar_1000 id NULL NULL 1 0 2 @@ -1135,7 +1181,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select bit_length(`t1_values`.`my_varchar_1000`) AS `BIT_LENGTH(my_varchar_1000)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 136 OR select_id IS NULL); +WHERE select_id = 140 OR select_id IS NULL) order by id; BIT_LENGTH(my_varchar_1000) my_varchar_1000 id NULL NULL 1 0 2 @@ -1149,7 +1195,7 @@ CREATE VIEW v1 AS SELECT BIT_LENGTH(my_char_30), my_char_30, id FROM t1_values; SELECT BIT_LENGTH(my_char_30), my_char_30, id FROM t1_values -WHERE select_id = 135 OR select_id IS NULL; +WHERE select_id = 139 OR select_id IS NULL order by id; BIT_LENGTH(my_char_30) my_char_30 id NULL NULL 1 0 2 @@ -1161,7 +1207,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select bit_length(`t1_values`.`my_char_30`) AS `BIT_LENGTH(my_char_30)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 135 OR select_id IS NULL); +WHERE select_id = 139 OR select_id IS NULL) order by id; BIT_LENGTH(my_char_30) my_char_30 id NULL NULL 1 0 2 @@ -1175,7 +1221,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_year,'IS_NULL'), my_year, id FROM t1_values; SELECT IFNULL(my_year,'IS_NULL'), my_year, id FROM t1_values -WHERE select_id = 134 OR select_id IS NULL; +WHERE select_id = 138 OR select_id IS NULL order by id; IFNULL(my_year,'IS_NULL') my_year id IS_NULL NULL 1 1901 1901 2 @@ -1187,7 +1233,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_year`,_latin1'IS_NULL') AS `IFNULL(my_year,'IS_NULL')`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 134 OR select_id IS NULL); +WHERE select_id = 138 OR select_id IS NULL) order by id; IFNULL(my_year,'IS_NULL') my_year id IS_NULL NULL 1 1901 1901 2 @@ -1201,7 +1247,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_time,'IS_NULL'), my_time, id FROM t1_values; SELECT IFNULL(my_time,'IS_NULL'), my_time, id FROM t1_values -WHERE select_id = 133 OR select_id IS NULL; +WHERE select_id = 137 OR select_id IS NULL order by id; IFNULL(my_time,'IS_NULL') my_time id IS_NULL NULL 1 -838:59:59 -838:59:59 2 @@ -1213,7 +1259,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_time`,_latin1'IS_NULL') AS `IFNULL(my_time,'IS_NULL')`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 133 OR select_id IS NULL); +WHERE select_id = 137 OR select_id IS NULL) order by id; IFNULL(my_time,'IS_NULL') my_time id IS_NULL NULL 1 -838:59:59 -838:59:59 2 @@ -1227,7 +1273,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_timestamp,'IS_NULL'), my_timestamp, id FROM t1_values; SELECT IFNULL(my_timestamp,'IS_NULL'), my_timestamp, id FROM t1_values -WHERE select_id = 132 OR select_id IS NULL; +WHERE select_id = 136 OR select_id IS NULL order by id; IFNULL(my_timestamp,'IS_NULL') my_timestamp id 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1970-01-01 03:00:01 1970-01-01 03:00:01 2 @@ -1239,7 +1285,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_timestamp`,_latin1'IS_NULL') AS `IFNULL(my_timestamp,'IS_NULL')`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 132 OR select_id IS NULL); +WHERE select_id = 136 OR select_id IS NULL) order by id; IFNULL(my_timestamp,'IS_NULL') my_timestamp id 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1970-01-01 03:00:01 1970-01-01 03:00:01 2 @@ -1253,7 +1299,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_date,'IS_NULL'), my_date, id FROM t1_values; SELECT IFNULL(my_date,'IS_NULL'), my_date, id FROM t1_values -WHERE select_id = 131 OR select_id IS NULL; +WHERE select_id = 135 OR select_id IS NULL order by id; IFNULL(my_date,'IS_NULL') my_date id IS_NULL NULL 1 0001-01-01 0001-01-01 2 @@ -1265,7 +1311,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_date`,_latin1'IS_NULL') AS `IFNULL(my_date,'IS_NULL')`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 131 OR select_id IS NULL); +WHERE select_id = 135 OR select_id IS NULL) order by id; IFNULL(my_date,'IS_NULL') my_date id IS_NULL NULL 1 0001-01-01 0001-01-01 2 @@ -1279,7 +1325,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_datetime,'IS_NULL'), my_datetime, id FROM t1_values; SELECT IFNULL(my_datetime,'IS_NULL'), my_datetime, id FROM t1_values -WHERE select_id = 130 OR select_id IS NULL; +WHERE select_id = 134 OR select_id IS NULL order by id; IFNULL(my_datetime,'IS_NULL') my_datetime id IS_NULL NULL 1 0001-01-01 00:00:00 0001-01-01 00:00:00 2 @@ -1291,7 +1337,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_datetime`,_latin1'IS_NULL') AS `IFNULL(my_datetime,'IS_NULL')`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 130 OR select_id IS NULL); +WHERE select_id = 134 OR select_id IS NULL) order by id; IFNULL(my_datetime,'IS_NULL') my_datetime id IS_NULL NULL 1 0001-01-01 00:00:00 0001-01-01 00:00:00 2 @@ -1305,7 +1351,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_double,'IS_NULL'), my_double, id FROM t1_values; SELECT IFNULL(my_double,'IS_NULL'), my_double, id FROM t1_values -WHERE select_id = 129 OR select_id IS NULL; +WHERE select_id = 133 OR select_id IS NULL order by id; IFNULL(my_double,'IS_NULL') my_double id IS_NULL NULL 1 -1.7976931348623e+308 -1.7976931348623e+308 2 @@ -1317,7 +1363,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_double`,_latin1'IS_NULL') AS `IFNULL(my_double,'IS_NULL')`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 129 OR select_id IS NULL); +WHERE select_id = 133 OR select_id IS NULL) order by id; IFNULL(my_double,'IS_NULL') my_double id IS_NULL NULL 1 -1.7976931348623e+308 -1.7976931348623e+308 2 @@ -1331,7 +1377,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_decimal,'IS_NULL'), my_decimal, id FROM t1_values; SELECT IFNULL(my_decimal,'IS_NULL'), my_decimal, id FROM t1_values -WHERE select_id = 128 OR select_id IS NULL; +WHERE select_id = 132 OR select_id IS NULL order by id; IFNULL(my_decimal,'IS_NULL') my_decimal id IS_NULL NULL 1 -9999999999999999999999999999999999.999999999999999999999999999999 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -1343,7 +1389,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_decimal`,_latin1'IS_NULL') AS `IFNULL(my_decimal,'IS_NULL')`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 128 OR select_id IS NULL); +WHERE select_id = 132 OR select_id IS NULL) order by id; IFNULL(my_decimal,'IS_NULL') my_decimal id IS_NULL NULL 1 -9999999999999999999999999999999999.999999999999999999999999999999 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -1357,7 +1403,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_bigint,'IS_NULL'), my_bigint, id FROM t1_values; SELECT IFNULL(my_bigint,'IS_NULL'), my_bigint, id FROM t1_values -WHERE select_id = 127 OR select_id IS NULL; +WHERE select_id = 131 OR select_id IS NULL order by id; IFNULL(my_bigint,'IS_NULL') my_bigint id IS_NULL NULL 1 -9223372036854775808 -9223372036854775808 2 @@ -1369,7 +1415,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_bigint`,_latin1'IS_NULL') AS `IFNULL(my_bigint,'IS_NULL')`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 127 OR select_id IS NULL); +WHERE select_id = 131 OR select_id IS NULL) order by id; IFNULL(my_bigint,'IS_NULL') my_bigint id IS_NULL NULL 1 -9223372036854775808 -9223372036854775808 2 @@ -1383,7 +1429,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_varbinary_1000,'IS_NULL'), my_varbinary_1000, id FROM t1_values; SELECT IFNULL(my_varbinary_1000,'IS_NULL'), my_varbinary_1000, id FROM t1_values -WHERE select_id = 126 OR select_id IS NULL; +WHERE select_id = 130 OR select_id IS NULL order by id; IFNULL(my_varbinary_1000,'IS_NULL') my_varbinary_1000 id IS_NULL NULL 1 2 @@ -1395,7 +1441,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_varbinary_1000`,_latin1'IS_NULL') AS `IFNULL(my_varbinary_1000,'IS_NULL')`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 126 OR select_id IS NULL); +WHERE select_id = 130 OR select_id IS NULL) order by id; IFNULL(my_varbinary_1000,'IS_NULL') my_varbinary_1000 id IS_NULL NULL 1 2 @@ -1409,19 +1455,19 @@ CREATE VIEW v1 AS SELECT IFNULL(my_binary_30,'IS_NULL'), my_binary_30, id FROM t1_values; SELECT IFNULL(my_binary_30,'IS_NULL'), my_binary_30, id FROM t1_values -WHERE select_id = 125 OR select_id IS NULL; +WHERE select_id = 129 OR select_id IS NULL order by id; IFNULL(my_binary_30,'IS_NULL') my_binary_30 id IS_NULL NULL 1 - + 2 <--------30 characters-------> <--------30 characters-------> 3 - ---äÖüß@µ*$-- --1 + ---äÖüß@µ*$-- ---äÖüß@µ*$-- 4 +-1 -1 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_binary_30`,_latin1'IS_NULL') AS `IFNULL(my_binary_30,'IS_NULL')`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 125 OR select_id IS NULL); +WHERE select_id = 129 OR select_id IS NULL) order by id; IFNULL(my_binary_30,'IS_NULL') my_binary_30 id IS_NULL NULL 1 @@ -1435,7 +1481,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_varchar_1000,'IS_NULL'), my_varchar_1000, id FROM t1_values; SELECT IFNULL(my_varchar_1000,'IS_NULL'), my_varchar_1000, id FROM t1_values -WHERE select_id = 124 OR select_id IS NULL; +WHERE select_id = 128 OR select_id IS NULL order by id; IFNULL(my_varchar_1000,'IS_NULL') my_varchar_1000 id IS_NULL NULL 1 2 @@ -1447,7 +1493,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_varchar_1000`,_latin1'IS_NULL') AS `IFNULL(my_varchar_1000,'IS_NULL')`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 124 OR select_id IS NULL); +WHERE select_id = 128 OR select_id IS NULL) order by id; IFNULL(my_varchar_1000,'IS_NULL') my_varchar_1000 id IS_NULL NULL 1 2 @@ -1461,7 +1507,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_char_30,'IS_NULL'), my_char_30, id FROM t1_values; SELECT IFNULL(my_char_30,'IS_NULL'), my_char_30, id FROM t1_values -WHERE select_id = 123 OR select_id IS NULL; +WHERE select_id = 127 OR select_id IS NULL order by id; IFNULL(my_char_30,'IS_NULL') my_char_30 id IS_NULL NULL 1 2 @@ -1473,7 +1519,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_char_30`,_latin1'IS_NULL') AS `IFNULL(my_char_30,'IS_NULL')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 123 OR select_id IS NULL); +WHERE select_id = 127 OR select_id IS NULL) order by id; IFNULL(my_char_30,'IS_NULL') my_char_30 id IS_NULL NULL 1 2 @@ -1487,7 +1533,7 @@ CREATE VIEW v1 AS SELECT IF(my_year IS NULL, 'IS NULL', 'IS NOT NULL'), my_year, id FROM t1_values; SELECT IF(my_year IS NULL, 'IS NULL', 'IS NOT NULL'), my_year, id FROM t1_values -WHERE select_id = 122 OR select_id IS NULL; +WHERE select_id = 126 OR select_id IS NULL order by id; IF(my_year IS NULL, 'IS NULL', 'IS NOT NULL') my_year id IS NULL NULL 1 @@ -1501,7 +1547,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 122 OR select_id IS NULL); +WHERE select_id = 126 OR select_id IS NULL) order by id; IF(my_year IS NULL, 'IS NULL', 'IS NOT NULL') my_year id IS NULL NULL 1 @@ -1516,7 +1562,7 @@ CREATE VIEW v1 AS SELECT IF(my_time IS NULL, 'IS NULL', 'IS NOT NULL'), my_time, id FROM t1_values; SELECT IF(my_time IS NULL, 'IS NULL', 'IS NOT NULL'), my_time, id FROM t1_values -WHERE select_id = 121 OR select_id IS NULL; +WHERE select_id = 125 OR select_id IS NULL order by id; IF(my_time IS NULL, 'IS NULL', 'IS NOT NULL') my_time id IS NULL NULL 1 @@ -1530,7 +1576,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 121 OR select_id IS NULL); +WHERE select_id = 125 OR select_id IS NULL) order by id; IF(my_time IS NULL, 'IS NULL', 'IS NOT NULL') my_time id IS NULL NULL 1 @@ -1545,7 +1591,7 @@ CREATE VIEW v1 AS SELECT IF(my_timestamp IS NULL, 'IS NULL', 'IS NOT NULL'), my_timestamp, id FROM t1_values; SELECT IF(my_timestamp IS NULL, 'IS NULL', 'IS NOT NULL'), my_timestamp, id FROM t1_values -WHERE select_id = 120 OR select_id IS NULL; +WHERE select_id = 124 OR select_id IS NULL order by id; IF(my_timestamp IS NULL, 'IS NULL', 'IS NOT NULL') my_timestamp id IS NOT NULL 0000-00-00 00:00:00 1 @@ -1559,7 +1605,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 120 OR select_id IS NULL); +WHERE select_id = 124 OR select_id IS NULL) order by id; IF(my_timestamp IS NULL, 'IS NULL', 'IS NOT NULL') my_timestamp id IS NOT NULL 0000-00-00 00:00:00 1 @@ -1574,7 +1620,7 @@ CREATE VIEW v1 AS SELECT IF(my_date IS NULL, 'IS NULL', 'IS NOT NULL'), my_date, id FROM t1_values; SELECT IF(my_date IS NULL, 'IS NULL', 'IS NOT NULL'), my_date, id FROM t1_values -WHERE select_id = 119 OR select_id IS NULL; +WHERE select_id = 123 OR select_id IS NULL order by id; IF(my_date IS NULL, 'IS NULL', 'IS NOT NULL') my_date id IS NULL NULL 1 @@ -1588,7 +1634,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 119 OR select_id IS NULL); +WHERE select_id = 123 OR select_id IS NULL) order by id; IF(my_date IS NULL, 'IS NULL', 'IS NOT NULL') my_date id IS NULL NULL 1 @@ -1603,7 +1649,7 @@ CREATE VIEW v1 AS SELECT IF(my_datetime IS NULL, 'IS NULL', 'IS NOT NULL'), my_datetime, id FROM t1_values; SELECT IF(my_datetime IS NULL, 'IS NULL', 'IS NOT NULL'), my_datetime, id FROM t1_values -WHERE select_id = 118 OR select_id IS NULL; +WHERE select_id = 122 OR select_id IS NULL order by id; IF(my_datetime IS NULL, 'IS NULL', 'IS NOT NULL') my_datetime id IS NULL NULL 1 @@ -1617,7 +1663,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 118 OR select_id IS NULL); +WHERE select_id = 122 OR select_id IS NULL) order by id; IF(my_datetime IS NULL, 'IS NULL', 'IS NOT NULL') my_datetime id IS NULL NULL 1 @@ -1632,7 +1678,7 @@ CREATE VIEW v1 AS SELECT IF(my_double IS NULL, 'IS NULL', 'IS NOT NULL'), my_double, id FROM t1_values; SELECT IF(my_double IS NULL, 'IS NULL', 'IS NOT NULL'), my_double, id FROM t1_values -WHERE select_id = 117 OR select_id IS NULL; +WHERE select_id = 121 OR select_id IS NULL order by id; IF(my_double IS NULL, 'IS NULL', 'IS NOT NULL') my_double id IS NULL NULL 1 @@ -1646,7 +1692,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 117 OR select_id IS NULL); +WHERE select_id = 121 OR select_id IS NULL) order by id; IF(my_double IS NULL, 'IS NULL', 'IS NOT NULL') my_double id IS NULL NULL 1 @@ -1661,7 +1707,7 @@ CREATE VIEW v1 AS SELECT IF(my_decimal IS NULL, 'IS NULL', 'IS NOT NULL'), my_decimal, id FROM t1_values; SELECT IF(my_decimal IS NULL, 'IS NULL', 'IS NOT NULL'), my_decimal, id FROM t1_values -WHERE select_id = 116 OR select_id IS NULL; +WHERE select_id = 120 OR select_id IS NULL order by id; IF(my_decimal IS NULL, 'IS NULL', 'IS NOT NULL') my_decimal id IS NULL NULL 1 @@ -1675,7 +1721,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 116 OR select_id IS NULL); +WHERE select_id = 120 OR select_id IS NULL) order by id; IF(my_decimal IS NULL, 'IS NULL', 'IS NOT NULL') my_decimal id IS NULL NULL 1 @@ -1690,7 +1736,7 @@ CREATE VIEW v1 AS SELECT IF(my_bigint IS NULL, 'IS NULL', 'IS NOT NULL'), my_bigint, id FROM t1_values; SELECT IF(my_bigint IS NULL, 'IS NULL', 'IS NOT NULL'), my_bigint, id FROM t1_values -WHERE select_id = 115 OR select_id IS NULL; +WHERE select_id = 119 OR select_id IS NULL order by id; IF(my_bigint IS NULL, 'IS NULL', 'IS NOT NULL') my_bigint id IS NULL NULL 1 @@ -1704,7 +1750,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 115 OR select_id IS NULL); +WHERE select_id = 119 OR select_id IS NULL) order by id; IF(my_bigint IS NULL, 'IS NULL', 'IS NOT NULL') my_bigint id IS NULL NULL 1 @@ -1719,7 +1765,7 @@ CREATE VIEW v1 AS SELECT IF(my_varbinary_1000 IS NULL, 'IS NULL', 'IS NOT NULL'), my_varbinary_1000, id FROM t1_values; SELECT IF(my_varbinary_1000 IS NULL, 'IS NULL', 'IS NOT NULL'), my_varbinary_1000, id FROM t1_values -WHERE select_id = 114 OR select_id IS NULL; +WHERE select_id = 118 OR select_id IS NULL order by id; IF(my_varbinary_1000 IS NULL, 'IS NULL', 'IS NOT NULL') my_varbinary_1000 id IS NULL NULL 1 @@ -1733,7 +1779,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 114 OR select_id IS NULL); +WHERE select_id = 118 OR select_id IS NULL) order by id; IF(my_varbinary_1000 IS NULL, 'IS NULL', 'IS NOT NULL') my_varbinary_1000 id IS NULL NULL 1 @@ -1748,21 +1794,21 @@ CREATE VIEW v1 AS SELECT IF(my_binary_30 IS NULL, 'IS NULL', 'IS NOT NULL'), my_binary_30, id FROM t1_values; SELECT IF(my_binary_30 IS NULL, 'IS NULL', 'IS NOT NULL'), my_binary_30, id FROM t1_values -WHERE select_id = 113 OR select_id IS NULL; +WHERE select_id = 117 OR select_id IS NULL order by id; IF(my_binary_30 IS NULL, 'IS NULL', 'IS NOT NULL') my_binary_30 id IS NULL NULL 1 -IS NOT NULL +IS NOT NULL 2 IS NOT NULL <--------30 characters-------> 3 -IS NOT NULL ---äÖüß@µ*$-- -IS NOT NULL -1 +IS NOT NULL ---äÖüß@µ*$-- 4 +IS NOT NULL -1 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_binary_30`),_latin1'IS NULL',_latin1'IS NOT NULL') AS `IF(my_binary_30 IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 113 OR select_id IS NULL); +WHERE select_id = 117 OR select_id IS NULL) order by id; IF(my_binary_30 IS NULL, 'IS NULL', 'IS NOT NULL') my_binary_30 id IS NULL NULL 1 @@ -1777,7 +1823,7 @@ CREATE VIEW v1 AS SELECT IF(my_varchar_1000 IS NULL, 'IS NULL', 'IS NOT NULL'), my_varchar_1000, id FROM t1_values; SELECT IF(my_varchar_1000 IS NULL, 'IS NULL', 'IS NOT NULL'), my_varchar_1000, id FROM t1_values -WHERE select_id = 112 OR select_id IS NULL; +WHERE select_id = 116 OR select_id IS NULL order by id; IF(my_varchar_1000 IS NULL, 'IS NULL', 'IS NOT NULL') my_varchar_1000 id IS NULL NULL 1 @@ -1791,7 +1837,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 112 OR select_id IS NULL); +WHERE select_id = 116 OR select_id IS NULL) order by id; IF(my_varchar_1000 IS NULL, 'IS NULL', 'IS NOT NULL') my_varchar_1000 id IS NULL NULL 1 @@ -1806,7 +1852,7 @@ CREATE VIEW v1 AS SELECT IF(my_char_30 IS NULL, 'IS NULL', 'IS NOT NULL'), my_char_30, id FROM t1_values; SELECT IF(my_char_30 IS NULL, 'IS NULL', 'IS NOT NULL'), my_char_30, id FROM t1_values -WHERE select_id = 111 OR select_id IS NULL; +WHERE select_id = 115 OR select_id IS NULL order by id; IF(my_char_30 IS NULL, 'IS NULL', 'IS NOT NULL') my_char_30 id IS NULL NULL 1 @@ -1820,7 +1866,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 111 OR select_id IS NULL); +WHERE select_id = 115 OR select_id IS NULL) order by id; IF(my_char_30 IS NULL, 'IS NULL', 'IS NOT NULL') my_char_30 id IS NULL NULL 1 @@ -1835,7 +1881,7 @@ CREATE VIEW v1 AS SELECT IF(my_year, 'IS TRUE', 'IS NOT TRUE'), my_year, id FROM t1_values; SELECT IF(my_year, 'IS TRUE', 'IS NOT TRUE'), my_year, id FROM t1_values -WHERE select_id = 110 OR select_id IS NULL; +WHERE select_id = 114 OR select_id IS NULL order by id; IF(my_year, 'IS TRUE', 'IS NOT TRUE') my_year id IS NOT TRUE NULL 1 IS TRUE 1901 2 @@ -1847,7 +1893,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_year`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_year, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 110 OR select_id IS NULL); +WHERE select_id = 114 OR select_id IS NULL) order by id; IF(my_year, 'IS TRUE', 'IS NOT TRUE') my_year id IS NOT TRUE NULL 1 IS TRUE 1901 2 @@ -1861,7 +1907,7 @@ CREATE VIEW v1 AS SELECT IF(my_time, 'IS TRUE', 'IS NOT TRUE'), my_time, id FROM t1_values; SELECT IF(my_time, 'IS TRUE', 'IS NOT TRUE'), my_time, id FROM t1_values -WHERE select_id = 109 OR select_id IS NULL; +WHERE select_id = 113 OR select_id IS NULL order by id; IF(my_time, 'IS TRUE', 'IS NOT TRUE') my_time id IS NOT TRUE NULL 1 IS TRUE -838:59:59 2 @@ -1873,7 +1919,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_time`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_time, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 109 OR select_id IS NULL); +WHERE select_id = 113 OR select_id IS NULL) order by id; IF(my_time, 'IS TRUE', 'IS NOT TRUE') my_time id IS NOT TRUE NULL 1 IS TRUE -838:59:59 2 @@ -1887,7 +1933,7 @@ CREATE VIEW v1 AS SELECT IF(my_timestamp, 'IS TRUE', 'IS NOT TRUE'), my_timestamp, id FROM t1_values; SELECT IF(my_timestamp, 'IS TRUE', 'IS NOT TRUE'), my_timestamp, id FROM t1_values -WHERE select_id = 108 OR select_id IS NULL; +WHERE select_id = 112 OR select_id IS NULL order by id; IF(my_timestamp, 'IS TRUE', 'IS NOT TRUE') my_timestamp id IS NOT TRUE 0000-00-00 00:00:00 1 IS TRUE 1970-01-01 03:00:01 2 @@ -1899,7 +1945,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_timestamp`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_timestamp, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 108 OR select_id IS NULL); +WHERE select_id = 112 OR select_id IS NULL) order by id; IF(my_timestamp, 'IS TRUE', 'IS NOT TRUE') my_timestamp id IS NOT TRUE 0000-00-00 00:00:00 1 IS TRUE 1970-01-01 03:00:01 2 @@ -1913,7 +1959,7 @@ CREATE VIEW v1 AS SELECT IF(my_date, 'IS TRUE', 'IS NOT TRUE'), my_date, id FROM t1_values; SELECT IF(my_date, 'IS TRUE', 'IS NOT TRUE'), my_date, id FROM t1_values -WHERE select_id = 107 OR select_id IS NULL; +WHERE select_id = 111 OR select_id IS NULL order by id; IF(my_date, 'IS TRUE', 'IS NOT TRUE') my_date id IS NOT TRUE NULL 1 IS TRUE 0001-01-01 2 @@ -1925,7 +1971,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_date`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_date, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 107 OR select_id IS NULL); +WHERE select_id = 111 OR select_id IS NULL) order by id; IF(my_date, 'IS TRUE', 'IS NOT TRUE') my_date id IS NOT TRUE NULL 1 IS TRUE 0001-01-01 2 @@ -1939,7 +1985,7 @@ CREATE VIEW v1 AS SELECT IF(my_datetime, 'IS TRUE', 'IS NOT TRUE'), my_datetime, id FROM t1_values; SELECT IF(my_datetime, 'IS TRUE', 'IS NOT TRUE'), my_datetime, id FROM t1_values -WHERE select_id = 106 OR select_id IS NULL; +WHERE select_id = 110 OR select_id IS NULL order by id; IF(my_datetime, 'IS TRUE', 'IS NOT TRUE') my_datetime id IS NOT TRUE NULL 1 IS TRUE 0001-01-01 00:00:00 2 @@ -1951,7 +1997,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_datetime`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_datetime, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 106 OR select_id IS NULL); +WHERE select_id = 110 OR select_id IS NULL) order by id; IF(my_datetime, 'IS TRUE', 'IS NOT TRUE') my_datetime id IS NOT TRUE NULL 1 IS TRUE 0001-01-01 00:00:00 2 @@ -1965,7 +2011,7 @@ CREATE VIEW v1 AS SELECT IF(my_double, 'IS TRUE', 'IS NOT TRUE'), my_double, id FROM t1_values; SELECT IF(my_double, 'IS TRUE', 'IS NOT TRUE'), my_double, id FROM t1_values -WHERE select_id = 105 OR select_id IS NULL; +WHERE select_id = 109 OR select_id IS NULL order by id; IF(my_double, 'IS TRUE', 'IS NOT TRUE') my_double id IS NOT TRUE NULL 1 IS TRUE -1.7976931348623e+308 2 @@ -1977,7 +2023,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_double`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_double, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 105 OR select_id IS NULL); +WHERE select_id = 109 OR select_id IS NULL) order by id; IF(my_double, 'IS TRUE', 'IS NOT TRUE') my_double id IS NOT TRUE NULL 1 IS TRUE -1.7976931348623e+308 2 @@ -1991,7 +2037,7 @@ CREATE VIEW v1 AS SELECT IF(my_decimal, 'IS TRUE', 'IS NOT TRUE'), my_decimal, id FROM t1_values; SELECT IF(my_decimal, 'IS TRUE', 'IS NOT TRUE'), my_decimal, id FROM t1_values -WHERE select_id = 104 OR select_id IS NULL; +WHERE select_id = 108 OR select_id IS NULL order by id; IF(my_decimal, 'IS TRUE', 'IS NOT TRUE') my_decimal id IS NOT TRUE NULL 1 IS TRUE -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -2003,7 +2049,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_decimal`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_decimal, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 104 OR select_id IS NULL); +WHERE select_id = 108 OR select_id IS NULL) order by id; IF(my_decimal, 'IS TRUE', 'IS NOT TRUE') my_decimal id IS NOT TRUE NULL 1 IS TRUE -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -2017,7 +2063,7 @@ CREATE VIEW v1 AS SELECT IF(my_bigint, 'IS TRUE', 'IS NOT TRUE'), my_bigint, id FROM t1_values; SELECT IF(my_bigint, 'IS TRUE', 'IS NOT TRUE'), my_bigint, id FROM t1_values -WHERE select_id = 103 OR select_id IS NULL; +WHERE select_id = 107 OR select_id IS NULL order by id; IF(my_bigint, 'IS TRUE', 'IS NOT TRUE') my_bigint id IS NOT TRUE NULL 1 IS TRUE -9223372036854775808 2 @@ -2029,7 +2075,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_bigint`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_bigint, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 103 OR select_id IS NULL); +WHERE select_id = 107 OR select_id IS NULL) order by id; IF(my_bigint, 'IS TRUE', 'IS NOT TRUE') my_bigint id IS NOT TRUE NULL 1 IS TRUE -9223372036854775808 2 @@ -2043,7 +2089,7 @@ CREATE VIEW v1 AS SELECT IF(my_varbinary_1000, 'IS TRUE', 'IS NOT TRUE'), my_varbinary_1000, id FROM t1_values; SELECT IF(my_varbinary_1000, 'IS TRUE', 'IS NOT TRUE'), my_varbinary_1000, id FROM t1_values -WHERE select_id = 102 OR select_id IS NULL; +WHERE select_id = 106 OR select_id IS NULL order by id; IF(my_varbinary_1000, 'IS TRUE', 'IS NOT TRUE') my_varbinary_1000 id IS NOT TRUE NULL 1 IS NOT TRUE 2 @@ -2055,7 +2101,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varbinary_1000`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_varbinary_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 102 OR select_id IS NULL); +WHERE select_id = 106 OR select_id IS NULL) order by id; IF(my_varbinary_1000, 'IS TRUE', 'IS NOT TRUE') my_varbinary_1000 id IS NOT TRUE NULL 1 IS NOT TRUE 2 @@ -2069,13 +2115,13 @@ CREATE VIEW v1 AS SELECT IF(my_binary_30, 'IS TRUE', 'IS NOT TRUE'), my_binary_30, id FROM t1_values; SELECT IF(my_binary_30, 'IS TRUE', 'IS NOT TRUE'), my_binary_30, id FROM t1_values -WHERE select_id = 101 OR select_id IS NULL; +WHERE select_id = 105 OR select_id IS NULL order by id; IF(my_binary_30, 'IS TRUE', 'IS NOT TRUE') my_binary_30 id IS NOT TRUE NULL 1 -IS NOT TRUE +IS NOT TRUE 2 IS NOT TRUE <--------30 characters-------> 3 -IS NOT TRUE ---äÖüß@µ*$-- -IS TRUE -1 +IS NOT TRUE ---äÖüß@µ*$-- 4 +IS TRUE -1 5 Warnings: Warning 1292 Truncated incorrect DOUBLE value: '' Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' @@ -2086,7 +2132,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_binary_30`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_binary_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 101 OR select_id IS NULL); +WHERE select_id = 105 OR select_id IS NULL) order by id; IF(my_binary_30, 'IS TRUE', 'IS NOT TRUE') my_binary_30 id IS NOT TRUE NULL 1 IS NOT TRUE @@ -2105,7 +2151,7 @@ CREATE VIEW v1 AS SELECT IF(my_varchar_1000, 'IS TRUE', 'IS NOT TRUE'), my_varchar_1000, id FROM t1_values; SELECT IF(my_varchar_1000, 'IS TRUE', 'IS NOT TRUE'), my_varchar_1000, id FROM t1_values -WHERE select_id = 100 OR select_id IS NULL; +WHERE select_id = 104 OR select_id IS NULL order by id; IF(my_varchar_1000, 'IS TRUE', 'IS NOT TRUE') my_varchar_1000 id IS NOT TRUE NULL 1 IS NOT TRUE 2 @@ -2117,7 +2163,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varchar_1000`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_varchar_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 100 OR select_id IS NULL); +WHERE select_id = 104 OR select_id IS NULL) order by id; IF(my_varchar_1000, 'IS TRUE', 'IS NOT TRUE') my_varchar_1000 id IS NOT TRUE NULL 1 IS NOT TRUE 2 @@ -2131,7 +2177,7 @@ CREATE VIEW v1 AS SELECT IF(my_char_30, 'IS TRUE', 'IS NOT TRUE'), my_char_30, id FROM t1_values; SELECT IF(my_char_30, 'IS TRUE', 'IS NOT TRUE'), my_char_30, id FROM t1_values -WHERE select_id = 99 OR select_id IS NULL; +WHERE select_id = 103 OR select_id IS NULL order by id; IF(my_char_30, 'IS TRUE', 'IS NOT TRUE') my_char_30 id IS NOT TRUE NULL 1 IS NOT TRUE 2 @@ -2146,7 +2192,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_char_30`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_char_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 99 OR select_id IS NULL); +WHERE select_id = 103 OR select_id IS NULL) order by id; IF(my_char_30, 'IS TRUE', 'IS NOT TRUE') my_char_30 id IS NOT TRUE NULL 1 IS NOT TRUE 2 @@ -2159,11 +2205,11 @@ Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' DROP VIEW v1; -CREATE VIEW v1 AS SELECT CONVERT(my_varbinary_1000 USING koi8r), +CREATE VIEW v1 AS SELECT CONVERT(my_varbinary_1000 USING koi8r), my_varbinary_1000, id FROM t1_values; -SELECT CONVERT(my_varbinary_1000 USING koi8r), +SELECT CONVERT(my_varbinary_1000 USING koi8r), my_varbinary_1000, id FROM t1_values -WHERE select_id = 98 OR select_id IS NULL; +WHERE select_id = 102 OR select_id IS NULL order by id; CONVERT(my_varbinary_1000 USING koi8r) my_varbinary_1000 id NULL NULL 1 2 @@ -2175,7 +2221,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select convert(`t1_values`.`my_varbinary_1000` using koi8r) AS `CONVERT(my_varbinary_1000 USING koi8r)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 98 OR select_id IS NULL); +WHERE select_id = 102 OR select_id IS NULL) order by id; CONVERT(my_varbinary_1000 USING koi8r) my_varbinary_1000 id NULL NULL 1 2 @@ -2185,23 +2231,23 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CONVERT(my_binary_30 USING koi8r), +CREATE VIEW v1 AS SELECT CONVERT(my_binary_30 USING koi8r), my_binary_30, id FROM t1_values; -SELECT CONVERT(my_binary_30 USING koi8r), +SELECT CONVERT(my_binary_30 USING koi8r), my_binary_30, id FROM t1_values -WHERE select_id = 97 OR select_id IS NULL; +WHERE select_id = 101 OR select_id IS NULL order by id; CONVERT(my_binary_30 USING koi8r) my_binary_30 id NULL NULL 1 - + 2 <--------30 characters-------> <--------30 characters-------> 3 - ---???????÷@??*$-- --1 + ---???????÷@??*$-- ---äÖüß@µ*$-- 4 +-1 -1 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select convert(`t1_values`.`my_binary_30` using koi8r) AS `CONVERT(my_binary_30 USING koi8r)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 97 OR select_id IS NULL); +WHERE select_id = 101 OR select_id IS NULL) order by id; CONVERT(my_binary_30 USING koi8r) my_binary_30 id NULL NULL 1 @@ -2211,11 +2257,11 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CONVERT(my_varchar_1000 USING koi8r), +CREATE VIEW v1 AS SELECT CONVERT(my_varchar_1000 USING koi8r), my_varchar_1000, id FROM t1_values; -SELECT CONVERT(my_varchar_1000 USING koi8r), +SELECT CONVERT(my_varchar_1000 USING koi8r), my_varchar_1000, id FROM t1_values -WHERE select_id = 96 OR select_id IS NULL; +WHERE select_id = 100 OR select_id IS NULL order by id; CONVERT(my_varchar_1000 USING koi8r) my_varchar_1000 id NULL NULL 1 2 @@ -2227,7 +2273,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select convert(`t1_values`.`my_varchar_1000` using koi8r) AS `CONVERT(my_varchar_1000 USING koi8r)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 96 OR select_id IS NULL); +WHERE select_id = 100 OR select_id IS NULL) order by id; CONVERT(my_varchar_1000 USING koi8r) my_varchar_1000 id NULL NULL 1 2 @@ -2237,11 +2283,11 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CONVERT(my_char_30 USING koi8r), +CREATE VIEW v1 AS SELECT CONVERT(my_char_30 USING koi8r), my_char_30, id FROM t1_values; -SELECT CONVERT(my_char_30 USING koi8r), +SELECT CONVERT(my_char_30 USING koi8r), my_char_30, id FROM t1_values -WHERE select_id = 95 OR select_id IS NULL; +WHERE select_id = 99 OR select_id IS NULL order by id; CONVERT(my_char_30 USING koi8r) my_char_30 id NULL NULL 1 2 @@ -2253,7 +2299,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select convert(`t1_values`.`my_char_30` using koi8r) AS `CONVERT(my_char_30 USING koi8r)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 95 OR select_id IS NULL); +WHERE select_id = 99 OR select_id IS NULL) order by id; CONVERT(my_char_30 USING koi8r) my_char_30 id NULL NULL 1 2 @@ -2263,11 +2309,11 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CONVERT(my_varbinary_1000 USING utf8), +CREATE VIEW v1 AS SELECT CONVERT(my_varbinary_1000 USING utf8), my_varbinary_1000, id FROM t1_values; -SELECT CONVERT(my_varbinary_1000 USING utf8), +SELECT CONVERT(my_varbinary_1000 USING utf8), my_varbinary_1000, id FROM t1_values -WHERE select_id = 94 OR select_id IS NULL; +WHERE select_id = 98 OR select_id IS NULL order by id; CONVERT(my_varbinary_1000 USING utf8) my_varbinary_1000 id NULL NULL 1 2 @@ -2279,7 +2325,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select convert(`t1_values`.`my_varbinary_1000` using utf8) AS `CONVERT(my_varbinary_1000 USING utf8)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 94 OR select_id IS NULL); +WHERE select_id = 98 OR select_id IS NULL) order by id; CONVERT(my_varbinary_1000 USING utf8) my_varbinary_1000 id NULL NULL 1 2 @@ -2289,23 +2335,23 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CONVERT(my_binary_30 USING utf8), +CREATE VIEW v1 AS SELECT CONVERT(my_binary_30 USING utf8), my_binary_30, id FROM t1_values; -SELECT CONVERT(my_binary_30 USING utf8), +SELECT CONVERT(my_binary_30 USING utf8), my_binary_30, id FROM t1_values -WHERE select_id = 93 OR select_id IS NULL; +WHERE select_id = 97 OR select_id IS NULL order by id; CONVERT(my_binary_30 USING utf8) my_binary_30 id NULL NULL 1 - + 2 <--------30 characters-------> <--------30 characters-------> 3 - ---äÖüß@µ*$-- --1 + ---äÖüß@µ*$-- ---äÖüß@µ*$-- 4 +-1 -1 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select convert(`t1_values`.`my_binary_30` using utf8) AS `CONVERT(my_binary_30 USING utf8)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 93 OR select_id IS NULL); +WHERE select_id = 97 OR select_id IS NULL) order by id; CONVERT(my_binary_30 USING utf8) my_binary_30 id NULL NULL 1 @@ -2315,11 +2361,11 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CONVERT(my_varchar_1000 USING utf8), +CREATE VIEW v1 AS SELECT CONVERT(my_varchar_1000 USING utf8), my_varchar_1000, id FROM t1_values; -SELECT CONVERT(my_varchar_1000 USING utf8), +SELECT CONVERT(my_varchar_1000 USING utf8), my_varchar_1000, id FROM t1_values -WHERE select_id = 92 OR select_id IS NULL; +WHERE select_id = 96 OR select_id IS NULL order by id; CONVERT(my_varchar_1000 USING utf8) my_varchar_1000 id NULL NULL 1 2 @@ -2331,7 +2377,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select convert(`t1_values`.`my_varchar_1000` using utf8) AS `CONVERT(my_varchar_1000 USING utf8)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 92 OR select_id IS NULL); +WHERE select_id = 96 OR select_id IS NULL) order by id; CONVERT(my_varchar_1000 USING utf8) my_varchar_1000 id NULL NULL 1 2 @@ -2341,11 +2387,11 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CONVERT(my_char_30 USING utf8), +CREATE VIEW v1 AS SELECT CONVERT(my_char_30 USING utf8), my_char_30, id FROM t1_values; -SELECT CONVERT(my_char_30 USING utf8), +SELECT CONVERT(my_char_30 USING utf8), my_char_30, id FROM t1_values -WHERE select_id = 91 OR select_id IS NULL; +WHERE select_id = 95 OR select_id IS NULL order by id; CONVERT(my_char_30 USING utf8) my_char_30 id NULL NULL 1 2 @@ -2357,7 +2403,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select convert(`t1_values`.`my_char_30` using utf8) AS `CONVERT(my_char_30 USING utf8)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 91 OR select_id IS NULL); +WHERE select_id = 95 OR select_id IS NULL) order by id; CONVERT(my_char_30 USING utf8) my_char_30 id NULL NULL 1 2 @@ -2371,7 +2417,7 @@ CREATE VIEW v1 AS SELECT CAST(my_year AS UNSIGNED INTEGER), my_year, id FROM t1_values; SELECT CAST(my_year AS UNSIGNED INTEGER), my_year, id FROM t1_values -WHERE select_id = 90 OR select_id IS NULL; +WHERE select_id = 94 OR select_id IS NULL order by id; CAST(my_year AS UNSIGNED INTEGER) my_year id NULL NULL 1 1901 1901 2 @@ -2383,7 +2429,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as unsigned) AS `CAST(my_year AS UNSIGNED INTEGER)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 90 OR select_id IS NULL); +WHERE select_id = 94 OR select_id IS NULL) order by id; CAST(my_year AS UNSIGNED INTEGER) my_year id NULL NULL 1 1901 1901 2 @@ -2397,7 +2443,7 @@ CREATE VIEW v1 AS SELECT CAST(my_time AS UNSIGNED INTEGER), my_time, id FROM t1_values; SELECT CAST(my_time AS UNSIGNED INTEGER), my_time, id FROM t1_values -WHERE select_id = 89 OR select_id IS NULL; +WHERE select_id = 93 OR select_id IS NULL order by id; CAST(my_time AS UNSIGNED INTEGER) my_time id NULL NULL 1 18446744073701165657 -838:59:59 2 @@ -2409,7 +2455,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as unsigned) AS `CAST(my_time AS UNSIGNED INTEGER)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 89 OR select_id IS NULL); +WHERE select_id = 93 OR select_id IS NULL) order by id; CAST(my_time AS UNSIGNED INTEGER) my_time id NULL NULL 1 18446744073701165657 -838:59:59 2 @@ -2423,7 +2469,7 @@ CREATE VIEW v1 AS SELECT CAST(my_timestamp AS UNSIGNED INTEGER), my_timestamp, id FROM t1_values; SELECT CAST(my_timestamp AS UNSIGNED INTEGER), my_timestamp, id FROM t1_values -WHERE select_id = 88 OR select_id IS NULL; +WHERE select_id = 92 OR select_id IS NULL order by id; CAST(my_timestamp AS UNSIGNED INTEGER) my_timestamp id 0 0000-00-00 00:00:00 1 19700101030001 1970-01-01 03:00:01 2 @@ -2435,7 +2481,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as unsigned) AS `CAST(my_timestamp AS UNSIGNED INTEGER)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 88 OR select_id IS NULL); +WHERE select_id = 92 OR select_id IS NULL) order by id; CAST(my_timestamp AS UNSIGNED INTEGER) my_timestamp id 0 0000-00-00 00:00:00 1 19700101030001 1970-01-01 03:00:01 2 @@ -2449,7 +2495,7 @@ CREATE VIEW v1 AS SELECT CAST(my_date AS UNSIGNED INTEGER), my_date, id FROM t1_values; SELECT CAST(my_date AS UNSIGNED INTEGER), my_date, id FROM t1_values -WHERE select_id = 87 OR select_id IS NULL; +WHERE select_id = 91 OR select_id IS NULL order by id; CAST(my_date AS UNSIGNED INTEGER) my_date id NULL NULL 1 10101 0001-01-01 2 @@ -2461,7 +2507,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as unsigned) AS `CAST(my_date AS UNSIGNED INTEGER)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 87 OR select_id IS NULL); +WHERE select_id = 91 OR select_id IS NULL) order by id; CAST(my_date AS UNSIGNED INTEGER) my_date id NULL NULL 1 10101 0001-01-01 2 @@ -2475,7 +2521,7 @@ CREATE VIEW v1 AS SELECT CAST(my_datetime AS UNSIGNED INTEGER), my_datetime, id FROM t1_values; SELECT CAST(my_datetime AS UNSIGNED INTEGER), my_datetime, id FROM t1_values -WHERE select_id = 86 OR select_id IS NULL; +WHERE select_id = 90 OR select_id IS NULL order by id; CAST(my_datetime AS UNSIGNED INTEGER) my_datetime id NULL NULL 1 10101000000 0001-01-01 00:00:00 2 @@ -2487,7 +2533,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as unsigned) AS `CAST(my_datetime AS UNSIGNED INTEGER)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 86 OR select_id IS NULL); +WHERE select_id = 90 OR select_id IS NULL) order by id; CAST(my_datetime AS UNSIGNED INTEGER) my_datetime id NULL NULL 1 10101000000 0001-01-01 00:00:00 2 @@ -2497,11 +2543,43 @@ NULL NULL 1 DROP VIEW v1; +CREATE VIEW v1 AS SELECT CAST(my_double AS UNSIGNED INTEGER), +my_double, id FROM t1_values; +SELECT CAST(my_double AS UNSIGNED INTEGER), +my_double, id FROM t1_values +WHERE select_id = 89 OR select_id IS NULL order by id; +CAST(my_double AS UNSIGNED INTEGER) my_double id +NULL NULL 1 +9223372036854775808 -1.7976931348623e+308 2 +9223372036854775807 1.7976931348623e+308 3 +0 0 4 +18446744073709551615 -1 5 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '-1.7976931348623e+308' +Warning 1292 Truncated incorrect INTEGER value: '1.7976931348623e+308' +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as unsigned) AS `CAST(my_double AS UNSIGNED INTEGER)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` +SELECT v1.* FROM v1 +WHERE v1.id IN (SELECT id FROM t1_values +WHERE select_id = 89 OR select_id IS NULL) order by id; +CAST(my_double AS UNSIGNED INTEGER) my_double id +NULL NULL 1 +9223372036854775808 -1.7976931348623e+308 2 +9223372036854775807 1.7976931348623e+308 3 +0 0 4 +18446744073709551615 -1 5 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '-1.7976931348623e+308' +Warning 1292 Truncated incorrect INTEGER value: '1.7976931348623e+308' +DROP VIEW v1; + + CREATE VIEW v1 AS SELECT CAST(my_decimal AS UNSIGNED INTEGER), my_decimal, id FROM t1_values; SELECT CAST(my_decimal AS UNSIGNED INTEGER), my_decimal, id FROM t1_values -WHERE select_id = 85 OR select_id IS NULL; +WHERE select_id = 88 OR select_id IS NULL order by id; CAST(my_decimal AS UNSIGNED INTEGER) my_decimal id NULL NULL 1 0 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -2517,7 +2595,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as unsigned) AS `CAST(my_decimal AS UNSIGNED INTEGER)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 85 OR select_id IS NULL); +WHERE select_id = 88 OR select_id IS NULL) order by id; CAST(my_decimal AS UNSIGNED INTEGER) my_decimal id NULL NULL 1 0 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -2535,7 +2613,7 @@ CREATE VIEW v1 AS SELECT CAST(my_bigint AS UNSIGNED INTEGER), my_bigint, id FROM t1_values; SELECT CAST(my_bigint AS UNSIGNED INTEGER), my_bigint, id FROM t1_values -WHERE select_id = 84 OR select_id IS NULL; +WHERE select_id = 87 OR select_id IS NULL order by id; CAST(my_bigint AS UNSIGNED INTEGER) my_bigint id NULL NULL 1 9223372036854775808 -9223372036854775808 2 @@ -2547,7 +2625,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as unsigned) AS `CAST(my_bigint AS UNSIGNED INTEGER)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 84 OR select_id IS NULL); +WHERE select_id = 87 OR select_id IS NULL) order by id; CAST(my_bigint AS UNSIGNED INTEGER) my_bigint id NULL NULL 1 9223372036854775808 -9223372036854775808 2 @@ -2561,7 +2639,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS UNSIGNED INTEGER), my_varbinary_1000, id FROM t1_values; SELECT CAST(my_varbinary_1000 AS UNSIGNED INTEGER), my_varbinary_1000, id FROM t1_values -WHERE select_id = 83 OR select_id IS NULL; +WHERE select_id = 86 OR select_id IS NULL order by id; CAST(my_varbinary_1000 AS UNSIGNED INTEGER) my_varbinary_1000 id NULL NULL 1 0 2 @@ -2578,7 +2656,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as unsigned) AS `CAST(my_varbinary_1000 AS UNSIGNED INTEGER)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 83 OR select_id IS NULL); +WHERE select_id = 86 OR select_id IS NULL) order by id; CAST(my_varbinary_1000 AS UNSIGNED INTEGER) my_varbinary_1000 id NULL NULL 1 0 2 @@ -2597,13 +2675,13 @@ CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS UNSIGNED INTEGER), my_binary_30, id FROM t1_values; SELECT CAST(my_binary_30 AS UNSIGNED INTEGER), my_binary_30, id FROM t1_values -WHERE select_id = 82 OR select_id IS NULL; +WHERE select_id = 85 OR select_id IS NULL order by id; CAST(my_binary_30 AS UNSIGNED INTEGER) my_binary_30 id NULL NULL 1 -0 +0 2 0 <--------30 characters-------> 3 -0 ---äÖüß@µ*$-- -18446744073709551615 -1 +0 ---äÖüß@µ*$-- 4 +18446744073709551615 -1 5 Warnings: Warning 1292 Truncated incorrect INTEGER value: '' Warning 1292 Truncated incorrect INTEGER value: '<--------30 characters------->' @@ -2615,7 +2693,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as unsigned) AS `CAST(my_binary_30 AS UNSIGNED INTEGER)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 82 OR select_id IS NULL); +WHERE select_id = 85 OR select_id IS NULL) order by id; CAST(my_binary_30 AS UNSIGNED INTEGER) my_binary_30 id NULL NULL 1 0 @@ -2635,7 +2713,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS UNSIGNED INTEGER), my_varchar_1000, id FROM t1_values; SELECT CAST(my_varchar_1000 AS UNSIGNED INTEGER), my_varchar_1000, id FROM t1_values -WHERE select_id = 81 OR select_id IS NULL; +WHERE select_id = 84 OR select_id IS NULL order by id; CAST(my_varchar_1000 AS UNSIGNED INTEGER) my_varchar_1000 id NULL NULL 1 0 2 @@ -2652,7 +2730,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as unsigned) AS `CAST(my_varchar_1000 AS UNSIGNED INTEGER)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 81 OR select_id IS NULL); +WHERE select_id = 84 OR select_id IS NULL) order by id; CAST(my_varchar_1000 AS UNSIGNED INTEGER) my_varchar_1000 id NULL NULL 1 0 2 @@ -2671,7 +2749,7 @@ CREATE VIEW v1 AS SELECT CAST(my_char_30 AS UNSIGNED INTEGER), my_char_30, id FROM t1_values; SELECT CAST(my_char_30 AS UNSIGNED INTEGER), my_char_30, id FROM t1_values -WHERE select_id = 80 OR select_id IS NULL; +WHERE select_id = 83 OR select_id IS NULL order by id; CAST(my_char_30 AS UNSIGNED INTEGER) my_char_30 id NULL NULL 1 0 2 @@ -2688,7 +2766,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as unsigned) AS `CAST(my_char_30 AS UNSIGNED INTEGER)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 80 OR select_id IS NULL); +WHERE select_id = 83 OR select_id IS NULL) order by id; CAST(my_char_30 AS UNSIGNED INTEGER) my_char_30 id NULL NULL 1 0 2 @@ -2707,7 +2785,7 @@ CREATE VIEW v1 AS SELECT CAST(my_year AS SIGNED INTEGER), my_year, id FROM t1_values; SELECT CAST(my_year AS SIGNED INTEGER), my_year, id FROM t1_values -WHERE select_id = 79 OR select_id IS NULL; +WHERE select_id = 82 OR select_id IS NULL order by id; CAST(my_year AS SIGNED INTEGER) my_year id NULL NULL 1 1901 1901 2 @@ -2719,7 +2797,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as signed) AS `CAST(my_year AS SIGNED INTEGER)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 79 OR select_id IS NULL); +WHERE select_id = 82 OR select_id IS NULL) order by id; CAST(my_year AS SIGNED INTEGER) my_year id NULL NULL 1 1901 1901 2 @@ -2733,7 +2811,7 @@ CREATE VIEW v1 AS SELECT CAST(my_time AS SIGNED INTEGER), my_time, id FROM t1_values; SELECT CAST(my_time AS SIGNED INTEGER), my_time, id FROM t1_values -WHERE select_id = 78 OR select_id IS NULL; +WHERE select_id = 81 OR select_id IS NULL order by id; CAST(my_time AS SIGNED INTEGER) my_time id NULL NULL 1 -8385959 -838:59:59 2 @@ -2745,7 +2823,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as signed) AS `CAST(my_time AS SIGNED INTEGER)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 78 OR select_id IS NULL); +WHERE select_id = 81 OR select_id IS NULL) order by id; CAST(my_time AS SIGNED INTEGER) my_time id NULL NULL 1 -8385959 -838:59:59 2 @@ -2759,7 +2837,7 @@ CREATE VIEW v1 AS SELECT CAST(my_timestamp AS SIGNED INTEGER), my_timestamp, id FROM t1_values; SELECT CAST(my_timestamp AS SIGNED INTEGER), my_timestamp, id FROM t1_values -WHERE select_id = 77 OR select_id IS NULL; +WHERE select_id = 80 OR select_id IS NULL order by id; CAST(my_timestamp AS SIGNED INTEGER) my_timestamp id 0 0000-00-00 00:00:00 1 19700101030001 1970-01-01 03:00:01 2 @@ -2771,7 +2849,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as signed) AS `CAST(my_timestamp AS SIGNED INTEGER)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 77 OR select_id IS NULL); +WHERE select_id = 80 OR select_id IS NULL) order by id; CAST(my_timestamp AS SIGNED INTEGER) my_timestamp id 0 0000-00-00 00:00:00 1 19700101030001 1970-01-01 03:00:01 2 @@ -2785,7 +2863,7 @@ CREATE VIEW v1 AS SELECT CAST(my_date AS SIGNED INTEGER), my_date, id FROM t1_values; SELECT CAST(my_date AS SIGNED INTEGER), my_date, id FROM t1_values -WHERE select_id = 76 OR select_id IS NULL; +WHERE select_id = 79 OR select_id IS NULL order by id; CAST(my_date AS SIGNED INTEGER) my_date id NULL NULL 1 10101 0001-01-01 2 @@ -2797,7 +2875,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as signed) AS `CAST(my_date AS SIGNED INTEGER)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 76 OR select_id IS NULL); +WHERE select_id = 79 OR select_id IS NULL) order by id; CAST(my_date AS SIGNED INTEGER) my_date id NULL NULL 1 10101 0001-01-01 2 @@ -2811,7 +2889,7 @@ CREATE VIEW v1 AS SELECT CAST(my_datetime AS SIGNED INTEGER), my_datetime, id FROM t1_values; SELECT CAST(my_datetime AS SIGNED INTEGER), my_datetime, id FROM t1_values -WHERE select_id = 75 OR select_id IS NULL; +WHERE select_id = 78 OR select_id IS NULL order by id; CAST(my_datetime AS SIGNED INTEGER) my_datetime id NULL NULL 1 10101000000 0001-01-01 00:00:00 2 @@ -2823,7 +2901,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as signed) AS `CAST(my_datetime AS SIGNED INTEGER)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 75 OR select_id IS NULL); +WHERE select_id = 78 OR select_id IS NULL) order by id; CAST(my_datetime AS SIGNED INTEGER) my_datetime id NULL NULL 1 10101000000 0001-01-01 00:00:00 2 @@ -2833,11 +2911,43 @@ NULL NULL 1 DROP VIEW v1; +CREATE VIEW v1 AS SELECT CAST(my_double AS SIGNED INTEGER), +my_double, id FROM t1_values; +SELECT CAST(my_double AS SIGNED INTEGER), +my_double, id FROM t1_values +WHERE select_id = 77 OR select_id IS NULL order by id; +CAST(my_double AS SIGNED INTEGER) my_double id +NULL NULL 1 +-9223372036854775808 -1.7976931348623e+308 2 +9223372036854775807 1.7976931348623e+308 3 +0 0 4 +-1 -1 5 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '-1.7976931348623e+308' +Warning 1292 Truncated incorrect INTEGER value: '1.7976931348623e+308' +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as signed) AS `CAST(my_double AS SIGNED INTEGER)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` +SELECT v1.* FROM v1 +WHERE v1.id IN (SELECT id FROM t1_values +WHERE select_id = 77 OR select_id IS NULL) order by id; +CAST(my_double AS SIGNED INTEGER) my_double id +NULL NULL 1 +-9223372036854775808 -1.7976931348623e+308 2 +9223372036854775807 1.7976931348623e+308 3 +0 0 4 +-1 -1 5 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '-1.7976931348623e+308' +Warning 1292 Truncated incorrect INTEGER value: '1.7976931348623e+308' +DROP VIEW v1; + + CREATE VIEW v1 AS SELECT CAST(my_decimal AS SIGNED INTEGER), my_decimal, id FROM t1_values; SELECT CAST(my_decimal AS SIGNED INTEGER), my_decimal, id FROM t1_values -WHERE select_id = 74 OR select_id IS NULL; +WHERE select_id = 76 OR select_id IS NULL order by id; CAST(my_decimal AS SIGNED INTEGER) my_decimal id NULL NULL 1 -9223372036854775808 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -2852,7 +2962,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as signed) AS `CAST(my_decimal AS SIGNED INTEGER)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 74 OR select_id IS NULL); +WHERE select_id = 76 OR select_id IS NULL) order by id; CAST(my_decimal AS SIGNED INTEGER) my_decimal id NULL NULL 1 -9223372036854775808 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -2869,7 +2979,7 @@ CREATE VIEW v1 AS SELECT CAST(my_bigint AS SIGNED INTEGER), my_bigint, id FROM t1_values; SELECT CAST(my_bigint AS SIGNED INTEGER), my_bigint, id FROM t1_values -WHERE select_id = 73 OR select_id IS NULL; +WHERE select_id = 75 OR select_id IS NULL order by id; CAST(my_bigint AS SIGNED INTEGER) my_bigint id NULL NULL 1 -9223372036854775808 -9223372036854775808 2 @@ -2881,7 +2991,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as signed) AS `CAST(my_bigint AS SIGNED INTEGER)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 73 OR select_id IS NULL); +WHERE select_id = 75 OR select_id IS NULL) order by id; CAST(my_bigint AS SIGNED INTEGER) my_bigint id NULL NULL 1 -9223372036854775808 -9223372036854775808 2 @@ -2895,7 +3005,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS SIGNED INTEGER), my_varbinary_1000, id FROM t1_values; SELECT CAST(my_varbinary_1000 AS SIGNED INTEGER), my_varbinary_1000, id FROM t1_values -WHERE select_id = 72 OR select_id IS NULL; +WHERE select_id = 74 OR select_id IS NULL order by id; CAST(my_varbinary_1000 AS SIGNED INTEGER) my_varbinary_1000 id NULL NULL 1 0 2 @@ -2911,7 +3021,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as signed) AS `CAST(my_varbinary_1000 AS SIGNED INTEGER)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 72 OR select_id IS NULL); +WHERE select_id = 74 OR select_id IS NULL) order by id; CAST(my_varbinary_1000 AS SIGNED INTEGER) my_varbinary_1000 id NULL NULL 1 0 2 @@ -2929,13 +3039,13 @@ CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS SIGNED INTEGER), my_binary_30, id FROM t1_values; SELECT CAST(my_binary_30 AS SIGNED INTEGER), my_binary_30, id FROM t1_values -WHERE select_id = 71 OR select_id IS NULL; +WHERE select_id = 73 OR select_id IS NULL order by id; CAST(my_binary_30 AS SIGNED INTEGER) my_binary_30 id NULL NULL 1 -0 +0 2 0 <--------30 characters-------> 3 -0 ---äÖüß@µ*$-- --1 -1 +0 ---äÖüß@µ*$-- 4 +-1 -1 5 Warnings: Warning 1292 Truncated incorrect INTEGER value: '' Warning 1292 Truncated incorrect INTEGER value: '<--------30 characters------->' @@ -2946,7 +3056,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as signed) AS `CAST(my_binary_30 AS SIGNED INTEGER)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 71 OR select_id IS NULL); +WHERE select_id = 73 OR select_id IS NULL) order by id; CAST(my_binary_30 AS SIGNED INTEGER) my_binary_30 id NULL NULL 1 0 @@ -2965,7 +3075,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS SIGNED INTEGER), my_varchar_1000, id FROM t1_values; SELECT CAST(my_varchar_1000 AS SIGNED INTEGER), my_varchar_1000, id FROM t1_values -WHERE select_id = 70 OR select_id IS NULL; +WHERE select_id = 72 OR select_id IS NULL order by id; CAST(my_varchar_1000 AS SIGNED INTEGER) my_varchar_1000 id NULL NULL 1 0 2 @@ -2981,7 +3091,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as signed) AS `CAST(my_varchar_1000 AS SIGNED INTEGER)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 70 OR select_id IS NULL); +WHERE select_id = 72 OR select_id IS NULL) order by id; CAST(my_varchar_1000 AS SIGNED INTEGER) my_varchar_1000 id NULL NULL 1 0 2 @@ -2999,7 +3109,7 @@ CREATE VIEW v1 AS SELECT CAST(my_char_30 AS SIGNED INTEGER), my_char_30, id FROM t1_values; SELECT CAST(my_char_30 AS SIGNED INTEGER), my_char_30, id FROM t1_values -WHERE select_id = 69 OR select_id IS NULL; +WHERE select_id = 71 OR select_id IS NULL order by id; CAST(my_char_30 AS SIGNED INTEGER) my_char_30 id NULL NULL 1 0 2 @@ -3015,7 +3125,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as signed) AS `CAST(my_char_30 AS SIGNED INTEGER)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 69 OR select_id IS NULL); +WHERE select_id = 71 OR select_id IS NULL) order by id; CAST(my_char_30 AS SIGNED INTEGER) my_char_30 id NULL NULL 1 0 2 @@ -3033,7 +3143,7 @@ CREATE VIEW v1 AS SELECT CAST(my_year AS DECIMAL(37,2)), my_year, id FROM t1_values; SELECT CAST(my_year AS DECIMAL(37,2)), my_year, id FROM t1_values -WHERE select_id = 68 OR select_id IS NULL; +WHERE select_id = 70 OR select_id IS NULL order by id; CAST(my_year AS DECIMAL(37,2)) my_year id NULL NULL 1 1901.00 1901 2 @@ -3045,7 +3155,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as decimal(37,2)) AS `CAST(my_year AS DECIMAL(37,2))`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 68 OR select_id IS NULL); +WHERE select_id = 70 OR select_id IS NULL) order by id; CAST(my_year AS DECIMAL(37,2)) my_year id NULL NULL 1 1901.00 1901 2 @@ -3059,7 +3169,7 @@ CREATE VIEW v1 AS SELECT CAST(my_time AS DECIMAL(37,2)), my_time, id FROM t1_values; SELECT CAST(my_time AS DECIMAL(37,2)), my_time, id FROM t1_values -WHERE select_id = 67 OR select_id IS NULL; +WHERE select_id = 69 OR select_id IS NULL order by id; CAST(my_time AS DECIMAL(37,2)) my_time id NULL NULL 1 -8385959.00 -838:59:59 2 @@ -3071,7 +3181,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as decimal(37,2)) AS `CAST(my_time AS DECIMAL(37,2))`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 67 OR select_id IS NULL); +WHERE select_id = 69 OR select_id IS NULL) order by id; CAST(my_time AS DECIMAL(37,2)) my_time id NULL NULL 1 -8385959.00 -838:59:59 2 @@ -3085,7 +3195,7 @@ CREATE VIEW v1 AS SELECT CAST(my_timestamp AS DECIMAL(37,2)), my_timestamp, id FROM t1_values; SELECT CAST(my_timestamp AS DECIMAL(37,2)), my_timestamp, id FROM t1_values -WHERE select_id = 66 OR select_id IS NULL; +WHERE select_id = 68 OR select_id IS NULL order by id; CAST(my_timestamp AS DECIMAL(37,2)) my_timestamp id 0.00 0000-00-00 00:00:00 1 19700101030001.00 1970-01-01 03:00:01 2 @@ -3097,7 +3207,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as decimal(37,2)) AS `CAST(my_timestamp AS DECIMAL(37,2))`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 66 OR select_id IS NULL); +WHERE select_id = 68 OR select_id IS NULL) order by id; CAST(my_timestamp AS DECIMAL(37,2)) my_timestamp id 0.00 0000-00-00 00:00:00 1 19700101030001.00 1970-01-01 03:00:01 2 @@ -3111,7 +3221,7 @@ CREATE VIEW v1 AS SELECT CAST(my_date AS DECIMAL(37,2)), my_date, id FROM t1_values; SELECT CAST(my_date AS DECIMAL(37,2)), my_date, id FROM t1_values -WHERE select_id = 65 OR select_id IS NULL; +WHERE select_id = 67 OR select_id IS NULL order by id; CAST(my_date AS DECIMAL(37,2)) my_date id NULL NULL 1 10101.00 0001-01-01 2 @@ -3123,7 +3233,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as decimal(37,2)) AS `CAST(my_date AS DECIMAL(37,2))`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 65 OR select_id IS NULL); +WHERE select_id = 67 OR select_id IS NULL) order by id; CAST(my_date AS DECIMAL(37,2)) my_date id NULL NULL 1 10101.00 0001-01-01 2 @@ -3137,7 +3247,7 @@ CREATE VIEW v1 AS SELECT CAST(my_datetime AS DECIMAL(37,2)), my_datetime, id FROM t1_values; SELECT CAST(my_datetime AS DECIMAL(37,2)), my_datetime, id FROM t1_values -WHERE select_id = 64 OR select_id IS NULL; +WHERE select_id = 66 OR select_id IS NULL order by id; CAST(my_datetime AS DECIMAL(37,2)) my_datetime id NULL NULL 1 10101000000.00 0001-01-01 00:00:00 2 @@ -3149,7 +3259,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as decimal(37,2)) AS `CAST(my_datetime AS DECIMAL(37,2))`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 64 OR select_id IS NULL); +WHERE select_id = 66 OR select_id IS NULL) order by id; CAST(my_datetime AS DECIMAL(37,2)) my_datetime id NULL NULL 1 10101000000.00 0001-01-01 00:00:00 2 @@ -3159,11 +3269,49 @@ NULL NULL 1 DROP VIEW v1; +CREATE VIEW v1 AS SELECT CAST(my_double AS DECIMAL(37,2)), +my_double, id FROM t1_values; +SELECT CAST(my_double AS DECIMAL(37,2)), +my_double, id FROM t1_values +WHERE select_id = 65 OR select_id IS NULL order by id; +CAST(my_double AS DECIMAL(37,2)) my_double id +NULL NULL 1 +-99999999999999999999999999999999999.99 -1.7976931348623e+308 2 +99999999999999999999999999999999999.99 1.7976931348623e+308 3 +0.00 0 4 +-1.00 -1 5 +-3333.33 -3333.3333 30 +Warnings: +Error 1292 Truncated incorrect DECIMAL value: '' +Error 1264 Out of range value adjusted for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 +Error 1292 Truncated incorrect DECIMAL value: '' +Error 1264 Out of range value adjusted for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as decimal(37,2)) AS `CAST(my_double AS DECIMAL(37,2))`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` +SELECT v1.* FROM v1 +WHERE v1.id IN (SELECT id FROM t1_values +WHERE select_id = 65 OR select_id IS NULL) order by id; +CAST(my_double AS DECIMAL(37,2)) my_double id +NULL NULL 1 +-99999999999999999999999999999999999.99 -1.7976931348623e+308 2 +99999999999999999999999999999999999.99 1.7976931348623e+308 3 +0.00 0 4 +-1.00 -1 5 +-3333.33 -3333.3333 30 +Warnings: +Error 1292 Truncated incorrect DECIMAL value: '' +Error 1264 Out of range value adjusted for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 +Error 1292 Truncated incorrect DECIMAL value: '' +Error 1264 Out of range value adjusted for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 +DROP VIEW v1; + + CREATE VIEW v1 AS SELECT CAST(my_decimal AS DECIMAL(37,2)), my_decimal, id FROM t1_values; SELECT CAST(my_decimal AS DECIMAL(37,2)), my_decimal, id FROM t1_values -WHERE select_id = 63 OR select_id IS NULL; +WHERE select_id = 64 OR select_id IS NULL order by id; CAST(my_decimal AS DECIMAL(37,2)) my_decimal id NULL NULL 1 -10000000000000000000000000000000000.00 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -3175,7 +3323,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as decimal(37,2)) AS `CAST(my_decimal AS DECIMAL(37,2))`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 63 OR select_id IS NULL); +WHERE select_id = 64 OR select_id IS NULL) order by id; CAST(my_decimal AS DECIMAL(37,2)) my_decimal id NULL NULL 1 -10000000000000000000000000000000000.00 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -3189,7 +3337,7 @@ CREATE VIEW v1 AS SELECT CAST(my_bigint AS DECIMAL(37,2)), my_bigint, id FROM t1_values; SELECT CAST(my_bigint AS DECIMAL(37,2)), my_bigint, id FROM t1_values -WHERE select_id = 62 OR select_id IS NULL; +WHERE select_id = 63 OR select_id IS NULL order by id; CAST(my_bigint AS DECIMAL(37,2)) my_bigint id NULL NULL 1 -9223372036854775808.00 -9223372036854775808 2 @@ -3201,7 +3349,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as decimal(37,2)) AS `CAST(my_bigint AS DECIMAL(37,2))`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 62 OR select_id IS NULL); +WHERE select_id = 63 OR select_id IS NULL) order by id; CAST(my_bigint AS DECIMAL(37,2)) my_bigint id NULL NULL 1 -9223372036854775808.00 -9223372036854775808 2 @@ -3215,14 +3363,14 @@ CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS DECIMAL(37,2)), my_varbinary_1000, id FROM t1_values; SELECT CAST(my_varbinary_1000 AS DECIMAL(37,2)), my_varbinary_1000, id FROM t1_values -WHERE select_id = 61 OR select_id IS NULL; +WHERE select_id = 62 OR select_id IS NULL order by id; CAST(my_varbinary_1000 AS DECIMAL(37,2)) my_varbinary_1000 id NULL NULL 1 0.00 2 0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 0.00 ---äÖüß@µ*$-- 4 -1.00 -1 5 --3333.33 -3333.3333 28 +-3333.33 -3333.3333 29 Warnings: Error 1366 Incorrect decimal value: '' for column '' at row -1 Error 1366 Incorrect decimal value: '' for column '' at row -1 @@ -3232,14 +3380,14 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 61 OR select_id IS NULL); +WHERE select_id = 62 OR select_id IS NULL) order by id; CAST(my_varbinary_1000 AS DECIMAL(37,2)) my_varbinary_1000 id NULL NULL 1 0.00 2 0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 0.00 ---äÖüß@µ*$-- 4 -1.00 -1 5 --3333.33 -3333.3333 28 +-3333.33 -3333.3333 29 Warnings: Error 1366 Incorrect decimal value: '' for column '' at row -1 Error 1366 Incorrect decimal value: '' for column '' at row -1 @@ -3251,14 +3399,14 @@ CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS DECIMAL(37,2)), my_binary_30, id FROM t1_values; SELECT CAST(my_binary_30 AS DECIMAL(37,2)), my_binary_30, id FROM t1_values -WHERE select_id = 60 OR select_id IS NULL; +WHERE select_id = 61 OR select_id IS NULL order by id; CAST(my_binary_30 AS DECIMAL(37,2)) my_binary_30 id NULL NULL 1 -0.00 +0.00 2 0.00 <--------30 characters-------> 3 -0.00 ---äÖüß@µ*$-- --1.00 -1 --3333.33 -3333.3333 +0.00 ---äÖüß@µ*$-- 4 +-1.00 -1 5 +-3333.33 -3333.3333 28 Warnings: Error 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: '' @@ -3273,14 +3421,14 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as decimal(37,2)) AS `CAST(my_binary_30 AS DECIMAL(37,2))`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 60 OR select_id IS NULL); +WHERE select_id = 61 OR select_id IS NULL) order by id; CAST(my_binary_30 AS DECIMAL(37,2)) my_binary_30 id NULL NULL 1 0.00 0.00 <--------30 characters-------> 3 0.00 ---äÖüß@µ*$-- -1.00 -1 --3333.33 -3333.3333 +-3333.33 -3333.3333 Warnings: Error 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: '' @@ -3297,14 +3445,14 @@ CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS DECIMAL(37,2)), my_varchar_1000, id FROM t1_values; SELECT CAST(my_varchar_1000 AS DECIMAL(37,2)), my_varchar_1000, id FROM t1_values -WHERE select_id = 59 OR select_id IS NULL; +WHERE select_id = 60 OR select_id IS NULL order by id; CAST(my_varchar_1000 AS DECIMAL(37,2)) my_varchar_1000 id NULL NULL 1 0.00 2 0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 0.00 ---äÖüß@µ*$-- 4 -1.00 -1 5 --3333.33 -3333.3333 26 +-3333.33 -3333.3333 27 Warnings: Error 1366 Incorrect decimal value: '' for column '' at row -1 Error 1366 Incorrect decimal value: '' for column '' at row -1 @@ -3314,14 +3462,14 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 59 OR select_id IS NULL); +WHERE select_id = 60 OR select_id IS NULL) order by id; CAST(my_varchar_1000 AS DECIMAL(37,2)) my_varchar_1000 id NULL NULL 1 0.00 2 0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 0.00 ---äÖüß@µ*$-- 4 -1.00 -1 5 --3333.33 -3333.3333 26 +-3333.33 -3333.3333 27 Warnings: Error 1366 Incorrect decimal value: '' for column '' at row -1 Error 1366 Incorrect decimal value: '' for column '' at row -1 @@ -3333,14 +3481,14 @@ CREATE VIEW v1 AS SELECT CAST(my_char_30 AS DECIMAL(37,2)), my_char_30, id FROM t1_values; SELECT CAST(my_char_30 AS DECIMAL(37,2)), my_char_30, id FROM t1_values -WHERE select_id = 58 OR select_id IS NULL; +WHERE select_id = 59 OR select_id IS NULL order by id; CAST(my_char_30 AS DECIMAL(37,2)) my_char_30 id NULL NULL 1 0.00 2 0.00 <--------30 characters-------> 3 0.00 ---äÖüß@µ*$-- 4 -1.00 -1 5 --3333.33 -3333.3333 25 +-3333.33 -3333.3333 26 Warnings: Error 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ' @@ -3353,14 +3501,14 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal(37,2)) AS `CAST(my_char_30 AS DECIMAL(37,2))`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 58 OR select_id IS NULL); +WHERE select_id = 59 OR select_id IS NULL) order by id; CAST(my_char_30 AS DECIMAL(37,2)) my_char_30 id NULL NULL 1 0.00 2 0.00 <--------30 characters-------> 3 0.00 ---äÖüß@µ*$-- 4 -1.00 -1 5 --3333.33 -3333.3333 25 +-3333.33 -3333.3333 26 Warnings: Error 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ' @@ -3375,7 +3523,7 @@ CREATE VIEW v1 AS SELECT CAST(my_year AS TIME), my_year, id FROM t1_values; SELECT CAST(my_year AS TIME), my_year, id FROM t1_values -WHERE select_id = 57 OR select_id IS NULL; +WHERE select_id = 58 OR select_id IS NULL order by id; CAST(my_year AS TIME) my_year id NULL NULL 1 00:19:01 1901 2 @@ -3387,7 +3535,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as time) AS `CAST(my_year AS TIME)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 57 OR select_id IS NULL); +WHERE select_id = 58 OR select_id IS NULL) order by id; CAST(my_year AS TIME) my_year id NULL NULL 1 00:19:01 1901 2 @@ -3401,7 +3549,7 @@ CREATE VIEW v1 AS SELECT CAST(my_time AS TIME), my_time, id FROM t1_values; SELECT CAST(my_time AS TIME), my_time, id FROM t1_values -WHERE select_id = 56 OR select_id IS NULL; +WHERE select_id = 57 OR select_id IS NULL order by id; CAST(my_time AS TIME) my_time id NULL NULL 1 -838:59:59 -838:59:59 2 @@ -3413,7 +3561,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as time) AS `CAST(my_time AS TIME)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 56 OR select_id IS NULL); +WHERE select_id = 57 OR select_id IS NULL) order by id; CAST(my_time AS TIME) my_time id NULL NULL 1 -838:59:59 -838:59:59 2 @@ -3427,7 +3575,7 @@ CREATE VIEW v1 AS SELECT CAST(my_timestamp AS TIME), my_timestamp, id FROM t1_values; SELECT CAST(my_timestamp AS TIME), my_timestamp, id FROM t1_values -WHERE select_id = 55 OR select_id IS NULL; +WHERE select_id = 56 OR select_id IS NULL order by id; CAST(my_timestamp AS TIME) my_timestamp id 00:00:00 0000-00-00 00:00:00 1 03:00:01 1970-01-01 03:00:01 2 @@ -3439,7 +3587,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as time) AS `CAST(my_timestamp AS TIME)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 55 OR select_id IS NULL); +WHERE select_id = 56 OR select_id IS NULL) order by id; CAST(my_timestamp AS TIME) my_timestamp id 00:00:00 0000-00-00 00:00:00 1 03:00:01 1970-01-01 03:00:01 2 @@ -3453,7 +3601,7 @@ CREATE VIEW v1 AS SELECT CAST(my_date AS TIME), my_date, id FROM t1_values; SELECT CAST(my_date AS TIME), my_date, id FROM t1_values -WHERE select_id = 54 OR select_id IS NULL; +WHERE select_id = 55 OR select_id IS NULL order by id; CAST(my_date AS TIME) my_date id NULL NULL 1 00:00:00 0001-01-01 2 @@ -3465,7 +3613,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as time) AS `CAST(my_date AS TIME)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 54 OR select_id IS NULL); +WHERE select_id = 55 OR select_id IS NULL) order by id; CAST(my_date AS TIME) my_date id NULL NULL 1 00:00:00 0001-01-01 2 @@ -3479,7 +3627,7 @@ CREATE VIEW v1 AS SELECT CAST(my_datetime AS TIME), my_datetime, id FROM t1_values; SELECT CAST(my_datetime AS TIME), my_datetime, id FROM t1_values -WHERE select_id = 53 OR select_id IS NULL; +WHERE select_id = 54 OR select_id IS NULL order by id; CAST(my_datetime AS TIME) my_datetime id NULL NULL 1 00:00:00 0001-01-01 00:00:00 2 @@ -3491,7 +3639,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as time) AS `CAST(my_datetime AS TIME)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 53 OR select_id IS NULL); +WHERE select_id = 54 OR select_id IS NULL) order by id; CAST(my_datetime AS TIME) my_datetime id NULL NULL 1 00:00:00 0001-01-01 00:00:00 2 @@ -3501,11 +3649,45 @@ NULL NULL 1 DROP VIEW v1; +CREATE VIEW v1 AS SELECT CAST(my_double AS TIME), +my_double, id FROM t1_values; +SELECT CAST(my_double AS TIME), +my_double, id FROM t1_values +WHERE select_id = 53 OR select_id IS NULL order by id; +CAST(my_double AS TIME) my_double id +NULL NULL 1 +NULL -1.7976931348623e+308 2 +NULL 1.7976931348623e+308 3 +00:00:00 0 4 +-00:00:01 -1 5 +00:17:58 1758 25 +Warnings: +Warning 1292 Truncated incorrect time value: '-1.7976931348623e+308' +Warning 1292 Truncated incorrect time value: '1.7976931348623e+308' +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as time) AS `CAST(my_double AS TIME)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` +SELECT v1.* FROM v1 +WHERE v1.id IN (SELECT id FROM t1_values +WHERE select_id = 53 OR select_id IS NULL) order by id; +CAST(my_double AS TIME) my_double id +NULL NULL 1 +NULL -1.7976931348623e+308 2 +NULL 1.7976931348623e+308 3 +00:00:00 0 4 +-00:00:01 -1 5 +00:17:58 1758 25 +Warnings: +Warning 1292 Truncated incorrect time value: '-1.7976931348623e+308' +Warning 1292 Truncated incorrect time value: '1.7976931348623e+308' +DROP VIEW v1; + + CREATE VIEW v1 AS SELECT CAST(my_bigint AS TIME), my_bigint, id FROM t1_values; SELECT CAST(my_bigint AS TIME), my_bigint, id FROM t1_values -WHERE select_id = 52 OR select_id IS NULL; +WHERE select_id = 52 OR select_id IS NULL order by id; CAST(my_bigint AS TIME) my_bigint id NULL NULL 1 NULL -9223372036854775808 2 @@ -3521,7 +3703,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as time) AS `CAST(my_bigint AS TIME)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 52 OR select_id IS NULL); +WHERE select_id = 52 OR select_id IS NULL) order by id; CAST(my_bigint AS TIME) my_bigint id NULL NULL 1 NULL -9223372036854775808 2 @@ -3539,7 +3721,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS TIME), my_varbinary_1000, id FROM t1_values; SELECT CAST(my_varbinary_1000 AS TIME), my_varbinary_1000, id FROM t1_values -WHERE select_id = 51 OR select_id IS NULL; +WHERE select_id = 51 OR select_id IS NULL order by id; CAST(my_varbinary_1000 AS TIME) my_varbinary_1000 id NULL NULL 1 NULL 2 @@ -3556,7 +3738,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as time) AS `CAST(my_varbinary_1000 AS TIME)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 51 OR select_id IS NULL); +WHERE select_id = 51 OR select_id IS NULL) order by id; CAST(my_varbinary_1000 AS TIME) my_varbinary_1000 id NULL NULL 1 NULL 2 @@ -3575,14 +3757,14 @@ CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS TIME), my_binary_30, id FROM t1_values; SELECT CAST(my_binary_30 AS TIME), my_binary_30, id FROM t1_values -WHERE select_id = 50 OR select_id IS NULL; +WHERE select_id = 50 OR select_id IS NULL order by id; CAST(my_binary_30 AS TIME) my_binary_30 id NULL NULL 1 -00:00:00 +00:00:00 2 00:00:00 <--------30 characters-------> 3 --00:00:00 ---äÖüß@µ*$-- -NULL -1 -41:58:00 1 17:58 +-00:00:00 ---äÖüß@µ*$-- 4 +NULL -1 5 +41:58:00 1 17:58 22 Warnings: Warning 1292 Truncated incorrect time value: '' Warning 1292 Truncated incorrect time value: '<--------30 characters------->' @@ -3594,7 +3776,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as time) AS `CAST(my_binary_30 AS TIME)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 50 OR select_id IS NULL); +WHERE select_id = 50 OR select_id IS NULL) order by id; CAST(my_binary_30 AS TIME) my_binary_30 id NULL NULL 1 00:00:00 @@ -3615,7 +3797,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS TIME), my_varchar_1000, id FROM t1_values; SELECT CAST(my_varchar_1000 AS TIME), my_varchar_1000, id FROM t1_values -WHERE select_id = 49 OR select_id IS NULL; +WHERE select_id = 49 OR select_id IS NULL order by id; CAST(my_varchar_1000 AS TIME) my_varchar_1000 id NULL NULL 1 NULL 2 @@ -3632,7 +3814,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as time) AS `CAST(my_varchar_1000 AS TIME)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 49 OR select_id IS NULL); +WHERE select_id = 49 OR select_id IS NULL) order by id; CAST(my_varchar_1000 AS TIME) my_varchar_1000 id NULL NULL 1 NULL 2 @@ -3651,7 +3833,7 @@ CREATE VIEW v1 AS SELECT CAST(my_char_30 AS TIME), my_char_30, id FROM t1_values; SELECT CAST(my_char_30 AS TIME), my_char_30, id FROM t1_values -WHERE select_id = 48 OR select_id IS NULL; +WHERE select_id = 48 OR select_id IS NULL order by id; CAST(my_char_30 AS TIME) my_char_30 id NULL NULL 1 NULL 2 @@ -3668,7 +3850,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as time) AS `CAST(my_char_30 AS TIME)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 48 OR select_id IS NULL); +WHERE select_id = 48 OR select_id IS NULL) order by id; CAST(my_char_30 AS TIME) my_char_30 id NULL NULL 1 NULL 2 @@ -3687,7 +3869,7 @@ CREATE VIEW v1 AS SELECT CAST(my_year AS DATETIME), my_year, id FROM t1_values; SELECT CAST(my_year AS DATETIME), my_year, id FROM t1_values -WHERE select_id = 47 OR select_id IS NULL; +WHERE select_id = 47 OR select_id IS NULL order by id; CAST(my_year AS DATETIME) my_year id NULL NULL 1 NULL 1901 2 @@ -3704,7 +3886,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as datetime) AS `CAST(my_year AS DATETIME)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 47 OR select_id IS NULL); +WHERE select_id = 47 OR select_id IS NULL) order by id; CAST(my_year AS DATETIME) my_year id NULL NULL 1 NULL 1901 2 @@ -3723,7 +3905,7 @@ CREATE VIEW v1 AS SELECT CAST(my_time AS DATETIME), my_time, id FROM t1_values; SELECT CAST(my_time AS DATETIME), my_time, id FROM t1_values -WHERE select_id = 46 OR select_id IS NULL; +WHERE select_id = 46 OR select_id IS NULL order by id; CAST(my_time AS DATETIME) my_time id NULL NULL 1 0000-00-00 00:00:00 -838:59:59 2 @@ -3738,7 +3920,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as datetime) AS `CAST(my_time AS DATETIME)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 46 OR select_id IS NULL); +WHERE select_id = 46 OR select_id IS NULL) order by id; CAST(my_time AS DATETIME) my_time id NULL NULL 1 0000-00-00 00:00:00 -838:59:59 2 @@ -3755,7 +3937,7 @@ CREATE VIEW v1 AS SELECT CAST(my_timestamp AS DATETIME), my_timestamp, id FROM t1_values; SELECT CAST(my_timestamp AS DATETIME), my_timestamp, id FROM t1_values -WHERE select_id = 45 OR select_id IS NULL; +WHERE select_id = 45 OR select_id IS NULL order by id; CAST(my_timestamp AS DATETIME) my_timestamp id 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1970-01-01 03:00:01 1970-01-01 03:00:01 2 @@ -3767,7 +3949,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as datetime) AS `CAST(my_timestamp AS DATETIME)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 45 OR select_id IS NULL); +WHERE select_id = 45 OR select_id IS NULL) order by id; CAST(my_timestamp AS DATETIME) my_timestamp id 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1970-01-01 03:00:01 1970-01-01 03:00:01 2 @@ -3781,7 +3963,7 @@ CREATE VIEW v1 AS SELECT CAST(my_date AS DATETIME), my_date, id FROM t1_values; SELECT CAST(my_date AS DATETIME), my_date, id FROM t1_values -WHERE select_id = 44 OR select_id IS NULL; +WHERE select_id = 44 OR select_id IS NULL order by id; CAST(my_date AS DATETIME) my_date id NULL NULL 1 0001-01-01 00:00:00 0001-01-01 2 @@ -3793,7 +3975,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as datetime) AS `CAST(my_date AS DATETIME)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 44 OR select_id IS NULL); +WHERE select_id = 44 OR select_id IS NULL) order by id; CAST(my_date AS DATETIME) my_date id NULL NULL 1 0001-01-01 00:00:00 0001-01-01 2 @@ -3807,7 +3989,7 @@ CREATE VIEW v1 AS SELECT CAST(my_datetime AS DATETIME), my_datetime, id FROM t1_values; SELECT CAST(my_datetime AS DATETIME), my_datetime, id FROM t1_values -WHERE select_id = 43 OR select_id IS NULL; +WHERE select_id = 43 OR select_id IS NULL order by id; CAST(my_datetime AS DATETIME) my_datetime id NULL NULL 1 0001-01-01 00:00:00 0001-01-01 00:00:00 2 @@ -3819,7 +4001,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as datetime) AS `CAST(my_datetime AS DATETIME)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 43 OR select_id IS NULL); +WHERE select_id = 43 OR select_id IS NULL) order by id; CAST(my_datetime AS DATETIME) my_datetime id NULL NULL 1 0001-01-01 00:00:00 0001-01-01 00:00:00 2 @@ -3833,7 +4015,7 @@ CREATE VIEW v1 AS SELECT CAST(my_double AS DATETIME), my_double, id FROM t1_values; SELECT CAST(my_double AS DATETIME), my_double, id FROM t1_values -WHERE select_id = 42 OR select_id IS NULL; +WHERE select_id = 42 OR select_id IS NULL order by id; CAST(my_double AS DATETIME) my_double id NULL NULL 1 NULL -1.7976931348623e+308 2 @@ -3852,7 +4034,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as datetime) AS `CAST(my_double AS DATETIME)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 42 OR select_id IS NULL); +WHERE select_id = 42 OR select_id IS NULL) order by id; CAST(my_double AS DATETIME) my_double id NULL NULL 1 NULL -1.7976931348623e+308 2 @@ -3873,7 +4055,7 @@ CREATE VIEW v1 AS SELECT CAST(my_bigint AS DATETIME), my_bigint, id FROM t1_values; SELECT CAST(my_bigint AS DATETIME), my_bigint, id FROM t1_values -WHERE select_id = 41 OR select_id IS NULL; +WHERE select_id = 41 OR select_id IS NULL order by id; CAST(my_bigint AS DATETIME) my_bigint id NULL NULL 1 NULL -9223372036854775808 2 @@ -3892,7 +4074,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as datetime) AS `CAST(my_bigint AS DATETIME)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 41 OR select_id IS NULL); +WHERE select_id = 41 OR select_id IS NULL) order by id; CAST(my_bigint AS DATETIME) my_bigint id NULL NULL 1 NULL -9223372036854775808 2 @@ -3913,7 +4095,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS DATETIME), my_varbinary_1000, id FROM t1_values; SELECT CAST(my_varbinary_1000 AS DATETIME), my_varbinary_1000, id FROM t1_values -WHERE select_id = 40 OR select_id IS NULL; +WHERE select_id = 40 OR select_id IS NULL order by id; CAST(my_varbinary_1000 AS DATETIME) my_varbinary_1000 id NULL NULL 1 NULL 2 @@ -3931,7 +4113,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as datetime) AS `CAST(my_varbinary_1000 AS DATETIME)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 40 OR select_id IS NULL); +WHERE select_id = 40 OR select_id IS NULL) order by id; CAST(my_varbinary_1000 AS DATETIME) my_varbinary_1000 id NULL NULL 1 NULL 2 @@ -3951,14 +4133,14 @@ CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS DATETIME), my_binary_30, id FROM t1_values; SELECT CAST(my_binary_30 AS DATETIME), my_binary_30, id FROM t1_values -WHERE select_id = 39 OR select_id IS NULL; +WHERE select_id = 39 OR select_id IS NULL order by id; CAST(my_binary_30 AS DATETIME) my_binary_30 id NULL NULL 1 -NULL +NULL 2 NULL <--------30 characters-------> 3 -NULL ---äÖüß@µ*$-- -NULL -1 -2005-06-27 17:58:00 2005-06-27 17:58 +NULL ---äÖüß@µ*$-- 4 +NULL -1 5 +2005-06-27 17:58:00 2005-06-27 17:58 16 Warnings: Warning 1292 Truncated incorrect datetime value: '' Warning 1292 Truncated incorrect datetime value: '<--------30 characters------->' @@ -3970,7 +4152,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as datetime) AS `CAST(my_binary_30 AS DATETIME)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 39 OR select_id IS NULL); +WHERE select_id = 39 OR select_id IS NULL) order by id; CAST(my_binary_30 AS DATETIME) my_binary_30 id NULL NULL 1 NULL @@ -3991,7 +4173,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS DATETIME), my_varchar_1000, id FROM t1_values; SELECT CAST(my_varchar_1000 AS DATETIME), my_varchar_1000, id FROM t1_values -WHERE select_id = 38 OR select_id IS NULL; +WHERE select_id = 38 OR select_id IS NULL order by id; CAST(my_varchar_1000 AS DATETIME) my_varchar_1000 id NULL NULL 1 NULL 2 @@ -4009,7 +4191,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as datetime) AS `CAST(my_varchar_1000 AS DATETIME)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 38 OR select_id IS NULL); +WHERE select_id = 38 OR select_id IS NULL) order by id; CAST(my_varchar_1000 AS DATETIME) my_varchar_1000 id NULL NULL 1 NULL 2 @@ -4029,7 +4211,7 @@ CREATE VIEW v1 AS SELECT CAST(my_char_30 AS DATETIME), my_char_30, id FROM t1_values; SELECT CAST(my_char_30 AS DATETIME), my_char_30, id FROM t1_values -WHERE select_id = 37 OR select_id IS NULL; +WHERE select_id = 37 OR select_id IS NULL order by id; CAST(my_char_30 AS DATETIME) my_char_30 id NULL NULL 1 NULL 2 @@ -4047,7 +4229,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as datetime) AS `CAST(my_char_30 AS DATETIME)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 37 OR select_id IS NULL); +WHERE select_id = 37 OR select_id IS NULL) order by id; CAST(my_char_30 AS DATETIME) my_char_30 id NULL NULL 1 NULL 2 @@ -4067,7 +4249,7 @@ CREATE VIEW v1 AS SELECT CAST(my_year AS DATE), my_year, id FROM t1_values; SELECT CAST(my_year AS DATE), my_year, id FROM t1_values -WHERE select_id = 36 OR select_id IS NULL; +WHERE select_id = 36 OR select_id IS NULL order by id; CAST(my_year AS DATE) my_year id NULL NULL 1 NULL 1901 2 @@ -4084,7 +4266,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as date) AS `CAST(my_year AS DATE)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 36 OR select_id IS NULL); +WHERE select_id = 36 OR select_id IS NULL) order by id; CAST(my_year AS DATE) my_year id NULL NULL 1 NULL 1901 2 @@ -4103,7 +4285,7 @@ CREATE VIEW v1 AS SELECT CAST(my_time AS DATE), my_time, id FROM t1_values; SELECT CAST(my_time AS DATE), my_time, id FROM t1_values -WHERE select_id = 35 OR select_id IS NULL; +WHERE select_id = 35 OR select_id IS NULL order by id; CAST(my_time AS DATE) my_time id NULL NULL 1 0000-00-00 -838:59:59 2 @@ -4115,7 +4297,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as date) AS `CAST(my_time AS DATE)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 35 OR select_id IS NULL); +WHERE select_id = 35 OR select_id IS NULL) order by id; CAST(my_time AS DATE) my_time id NULL NULL 1 0000-00-00 -838:59:59 2 @@ -4129,7 +4311,7 @@ CREATE VIEW v1 AS SELECT CAST(my_timestamp AS DATE), my_timestamp, id FROM t1_values; SELECT CAST(my_timestamp AS DATE), my_timestamp, id FROM t1_values -WHERE select_id = 34 OR select_id IS NULL; +WHERE select_id = 34 OR select_id IS NULL order by id; CAST(my_timestamp AS DATE) my_timestamp id 0000-00-00 0000-00-00 00:00:00 1 1970-01-01 1970-01-01 03:00:01 2 @@ -4141,7 +4323,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as date) AS `CAST(my_timestamp AS DATE)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 34 OR select_id IS NULL); +WHERE select_id = 34 OR select_id IS NULL) order by id; CAST(my_timestamp AS DATE) my_timestamp id 0000-00-00 0000-00-00 00:00:00 1 1970-01-01 1970-01-01 03:00:01 2 @@ -4155,7 +4337,7 @@ CREATE VIEW v1 AS SELECT CAST(my_date AS DATE), my_date, id FROM t1_values; SELECT CAST(my_date AS DATE), my_date, id FROM t1_values -WHERE select_id = 33 OR select_id IS NULL; +WHERE select_id = 33 OR select_id IS NULL order by id; CAST(my_date AS DATE) my_date id NULL NULL 1 0001-01-01 0001-01-01 2 @@ -4167,7 +4349,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as date) AS `CAST(my_date AS DATE)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 33 OR select_id IS NULL); +WHERE select_id = 33 OR select_id IS NULL) order by id; CAST(my_date AS DATE) my_date id NULL NULL 1 0001-01-01 0001-01-01 2 @@ -4181,7 +4363,7 @@ CREATE VIEW v1 AS SELECT CAST(my_datetime AS DATE), my_datetime, id FROM t1_values; SELECT CAST(my_datetime AS DATE), my_datetime, id FROM t1_values -WHERE select_id = 32 OR select_id IS NULL; +WHERE select_id = 32 OR select_id IS NULL order by id; CAST(my_datetime AS DATE) my_datetime id NULL NULL 1 0001-01-01 0001-01-01 00:00:00 2 @@ -4193,7 +4375,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as date) AS `CAST(my_datetime AS DATE)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 32 OR select_id IS NULL); +WHERE select_id = 32 OR select_id IS NULL) order by id; CAST(my_datetime AS DATE) my_datetime id NULL NULL 1 0001-01-01 0001-01-01 00:00:00 2 @@ -4207,7 +4389,7 @@ CREATE VIEW v1 AS SELECT CAST(my_double AS DATE), my_double, id FROM t1_values; SELECT CAST(my_double AS DATE), my_double, id FROM t1_values -WHERE select_id = 31 OR select_id IS NULL; +WHERE select_id = 31 OR select_id IS NULL order by id; CAST(my_double AS DATE) my_double id NULL NULL 1 NULL -1.7976931348623e+308 2 @@ -4225,7 +4407,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as date) AS `CAST(my_double AS DATE)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 31 OR select_id IS NULL); +WHERE select_id = 31 OR select_id IS NULL) order by id; CAST(my_double AS DATE) my_double id NULL NULL 1 NULL -1.7976931348623e+308 2 @@ -4245,7 +4427,7 @@ CREATE VIEW v1 AS SELECT CAST(my_bigint AS DATE), my_bigint, id FROM t1_values; SELECT CAST(my_bigint AS DATE), my_bigint, id FROM t1_values -WHERE select_id = 30 OR select_id IS NULL; +WHERE select_id = 30 OR select_id IS NULL order by id; CAST(my_bigint AS DATE) my_bigint id NULL NULL 1 NULL -9223372036854775808 2 @@ -4263,7 +4445,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as date) AS `CAST(my_bigint AS DATE)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 30 OR select_id IS NULL); +WHERE select_id = 30 OR select_id IS NULL) order by id; CAST(my_bigint AS DATE) my_bigint id NULL NULL 1 NULL -9223372036854775808 2 @@ -4283,7 +4465,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS DATE), my_varbinary_1000, id FROM t1_values; SELECT CAST(my_varbinary_1000 AS DATE), my_varbinary_1000, id FROM t1_values -WHERE select_id = 29 OR select_id IS NULL; +WHERE select_id = 29 OR select_id IS NULL order by id; CAST(my_varbinary_1000 AS DATE) my_varbinary_1000 id NULL NULL 1 NULL 2 @@ -4301,7 +4483,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as date) AS `CAST(my_varbinary_1000 AS DATE)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 29 OR select_id IS NULL); +WHERE select_id = 29 OR select_id IS NULL) order by id; CAST(my_varbinary_1000 AS DATE) my_varbinary_1000 id NULL NULL 1 NULL 2 @@ -4321,14 +4503,14 @@ CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS DATE), my_binary_30, id FROM t1_values; SELECT CAST(my_binary_30 AS DATE), my_binary_30, id FROM t1_values -WHERE select_id = 28 OR select_id IS NULL; +WHERE select_id = 28 OR select_id IS NULL order by id; CAST(my_binary_30 AS DATE) my_binary_30 id NULL NULL 1 -NULL +NULL 2 NULL <--------30 characters-------> 3 -NULL ---äÖüß@µ*$-- -NULL -1 -2005-06-27 2005-06-27 +NULL ---äÖüß@µ*$-- 4 +NULL -1 5 +2005-06-27 2005-06-27 10 Warnings: Warning 1292 Truncated incorrect datetime value: '' Warning 1292 Truncated incorrect datetime value: '<--------30 characters------->' @@ -4340,7 +4522,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as date) AS `CAST(my_binary_30 AS DATE)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 28 OR select_id IS NULL); +WHERE select_id = 28 OR select_id IS NULL) order by id; CAST(my_binary_30 AS DATE) my_binary_30 id NULL NULL 1 NULL @@ -4361,7 +4543,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS DATE), my_varchar_1000, id FROM t1_values; SELECT CAST(my_varchar_1000 AS DATE), my_varchar_1000, id FROM t1_values -WHERE select_id = 27 OR select_id IS NULL; +WHERE select_id = 27 OR select_id IS NULL order by id; CAST(my_varchar_1000 AS DATE) my_varchar_1000 id NULL NULL 1 NULL 2 @@ -4379,7 +4561,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as date) AS `CAST(my_varchar_1000 AS DATE)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 27 OR select_id IS NULL); +WHERE select_id = 27 OR select_id IS NULL) order by id; CAST(my_varchar_1000 AS DATE) my_varchar_1000 id NULL NULL 1 NULL 2 @@ -4399,7 +4581,7 @@ CREATE VIEW v1 AS SELECT CAST(my_char_30 AS DATE), my_char_30, id FROM t1_values; SELECT CAST(my_char_30 AS DATE), my_char_30, id FROM t1_values -WHERE select_id = 26 OR select_id IS NULL; +WHERE select_id = 26 OR select_id IS NULL order by id; CAST(my_char_30 AS DATE) my_char_30 id NULL NULL 1 NULL 2 @@ -4417,7 +4599,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as date) AS `CAST(my_char_30 AS DATE)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 26 OR select_id IS NULL); +WHERE select_id = 26 OR select_id IS NULL) order by id; CAST(my_char_30 AS DATE) my_char_30 id NULL NULL 1 NULL 2 @@ -4437,7 +4619,7 @@ CREATE VIEW v1 AS SELECT CAST(my_year AS CHAR), my_year, id FROM t1_values; SELECT CAST(my_year AS CHAR), my_year, id FROM t1_values -WHERE select_id = 25 OR select_id IS NULL; +WHERE select_id = 25 OR select_id IS NULL order by id; CAST(my_year AS CHAR) my_year id NULL NULL 1 1901 1901 2 @@ -4449,7 +4631,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as char charset latin1) AS `CAST(my_year AS CHAR)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 25 OR select_id IS NULL); +WHERE select_id = 25 OR select_id IS NULL) order by id; CAST(my_year AS CHAR) my_year id NULL NULL 1 1901 1901 2 @@ -4463,7 +4645,7 @@ CREATE VIEW v1 AS SELECT CAST(my_time AS CHAR), my_time, id FROM t1_values; SELECT CAST(my_time AS CHAR), my_time, id FROM t1_values -WHERE select_id = 24 OR select_id IS NULL; +WHERE select_id = 24 OR select_id IS NULL order by id; CAST(my_time AS CHAR) my_time id NULL NULL 1 -838:59:59 -838:59:59 2 @@ -4475,7 +4657,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as char charset latin1) AS `CAST(my_time AS CHAR)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 24 OR select_id IS NULL); +WHERE select_id = 24 OR select_id IS NULL) order by id; CAST(my_time AS CHAR) my_time id NULL NULL 1 -838:59:59 -838:59:59 2 @@ -4489,7 +4671,7 @@ CREATE VIEW v1 AS SELECT CAST(my_timestamp AS CHAR), my_timestamp, id FROM t1_values; SELECT CAST(my_timestamp AS CHAR), my_timestamp, id FROM t1_values -WHERE select_id = 23 OR select_id IS NULL; +WHERE select_id = 23 OR select_id IS NULL order by id; CAST(my_timestamp AS CHAR) my_timestamp id 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1970-01-01 03:00:01 1970-01-01 03:00:01 2 @@ -4501,7 +4683,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as char charset latin1) AS `CAST(my_timestamp AS CHAR)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 23 OR select_id IS NULL); +WHERE select_id = 23 OR select_id IS NULL) order by id; CAST(my_timestamp AS CHAR) my_timestamp id 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1970-01-01 03:00:01 1970-01-01 03:00:01 2 @@ -4515,7 +4697,7 @@ CREATE VIEW v1 AS SELECT CAST(my_date AS CHAR), my_date, id FROM t1_values; SELECT CAST(my_date AS CHAR), my_date, id FROM t1_values -WHERE select_id = 22 OR select_id IS NULL; +WHERE select_id = 22 OR select_id IS NULL order by id; CAST(my_date AS CHAR) my_date id NULL NULL 1 0001-01-01 0001-01-01 2 @@ -4527,7 +4709,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as char charset latin1) AS `CAST(my_date AS CHAR)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 22 OR select_id IS NULL); +WHERE select_id = 22 OR select_id IS NULL) order by id; CAST(my_date AS CHAR) my_date id NULL NULL 1 0001-01-01 0001-01-01 2 @@ -4541,7 +4723,7 @@ CREATE VIEW v1 AS SELECT CAST(my_datetime AS CHAR), my_datetime, id FROM t1_values; SELECT CAST(my_datetime AS CHAR), my_datetime, id FROM t1_values -WHERE select_id = 21 OR select_id IS NULL; +WHERE select_id = 21 OR select_id IS NULL order by id; CAST(my_datetime AS CHAR) my_datetime id NULL NULL 1 0001-01-01 00:00:00 0001-01-01 00:00:00 2 @@ -4553,7 +4735,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as char charset latin1) AS `CAST(my_datetime AS CHAR)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 21 OR select_id IS NULL); +WHERE select_id = 21 OR select_id IS NULL) order by id; CAST(my_datetime AS CHAR) my_datetime id NULL NULL 1 0001-01-01 00:00:00 0001-01-01 00:00:00 2 @@ -4567,7 +4749,7 @@ CREATE VIEW v1 AS SELECT CAST(my_double AS CHAR), my_double, id FROM t1_values; SELECT CAST(my_double AS CHAR), my_double, id FROM t1_values -WHERE select_id = 20 OR select_id IS NULL; +WHERE select_id = 20 OR select_id IS NULL order by id; CAST(my_double AS CHAR) my_double id NULL NULL 1 -1.7976931348623e+308 -1.7976931348623e+308 2 @@ -4579,7 +4761,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as char charset latin1) AS `CAST(my_double AS CHAR)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 20 OR select_id IS NULL); +WHERE select_id = 20 OR select_id IS NULL) order by id; CAST(my_double AS CHAR) my_double id NULL NULL 1 -1.7976931348623e+308 -1.7976931348623e+308 2 @@ -4593,7 +4775,7 @@ CREATE VIEW v1 AS SELECT CAST(my_decimal AS CHAR), my_decimal, id FROM t1_values; SELECT CAST(my_decimal AS CHAR), my_decimal, id FROM t1_values -WHERE select_id = 19 OR select_id IS NULL; +WHERE select_id = 19 OR select_id IS NULL order by id; CAST(my_decimal AS CHAR) my_decimal id NULL NULL 1 -9999999999999999999999999999999999.999999999999999999999999999999 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -4605,7 +4787,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as char charset latin1) AS `CAST(my_decimal AS CHAR)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 19 OR select_id IS NULL); +WHERE select_id = 19 OR select_id IS NULL) order by id; CAST(my_decimal AS CHAR) my_decimal id NULL NULL 1 -9999999999999999999999999999999999.999999999999999999999999999999 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -4619,7 +4801,7 @@ CREATE VIEW v1 AS SELECT CAST(my_bigint AS CHAR), my_bigint, id FROM t1_values; SELECT CAST(my_bigint AS CHAR), my_bigint, id FROM t1_values -WHERE select_id = 18 OR select_id IS NULL; +WHERE select_id = 18 OR select_id IS NULL order by id; CAST(my_bigint AS CHAR) my_bigint id NULL NULL 1 -9223372036854775808 -9223372036854775808 2 @@ -4631,7 +4813,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as char charset latin1) AS `CAST(my_bigint AS CHAR)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 18 OR select_id IS NULL); +WHERE select_id = 18 OR select_id IS NULL) order by id; CAST(my_bigint AS CHAR) my_bigint id NULL NULL 1 -9223372036854775808 -9223372036854775808 2 @@ -4645,7 +4827,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS CHAR), my_varbinary_1000, id FROM t1_values; SELECT CAST(my_varbinary_1000 AS CHAR), my_varbinary_1000, id FROM t1_values -WHERE select_id = 17 OR select_id IS NULL; +WHERE select_id = 17 OR select_id IS NULL order by id; CAST(my_varbinary_1000 AS CHAR) my_varbinary_1000 id NULL NULL 1 2 @@ -4657,7 +4839,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as char charset latin1) AS `CAST(my_varbinary_1000 AS CHAR)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 17 OR select_id IS NULL); +WHERE select_id = 17 OR select_id IS NULL) order by id; CAST(my_varbinary_1000 AS CHAR) my_varbinary_1000 id NULL NULL 1 2 @@ -4671,19 +4853,19 @@ CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS CHAR), my_binary_30, id FROM t1_values; SELECT CAST(my_binary_30 AS CHAR), my_binary_30, id FROM t1_values -WHERE select_id = 16 OR select_id IS NULL; +WHERE select_id = 16 OR select_id IS NULL order by id; CAST(my_binary_30 AS CHAR) my_binary_30 id NULL NULL 1 - + 2 <--------30 characters-------> <--------30 characters-------> 3 - ---äÖüß@µ*$-- --1 + ---äÖüß@µ*$-- ---äÖüß@µ*$-- 4 +-1 -1 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as char charset latin1) AS `CAST(my_binary_30 AS CHAR)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 16 OR select_id IS NULL); +WHERE select_id = 16 OR select_id IS NULL) order by id; CAST(my_binary_30 AS CHAR) my_binary_30 id NULL NULL 1 @@ -4697,7 +4879,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS CHAR), my_varchar_1000, id FROM t1_values; SELECT CAST(my_varchar_1000 AS CHAR), my_varchar_1000, id FROM t1_values -WHERE select_id = 15 OR select_id IS NULL; +WHERE select_id = 15 OR select_id IS NULL order by id; CAST(my_varchar_1000 AS CHAR) my_varchar_1000 id NULL NULL 1 2 @@ -4709,7 +4891,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as char charset latin1) AS `CAST(my_varchar_1000 AS CHAR)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 15 OR select_id IS NULL); +WHERE select_id = 15 OR select_id IS NULL) order by id; CAST(my_varchar_1000 AS CHAR) my_varchar_1000 id NULL NULL 1 2 @@ -4723,7 +4905,7 @@ CREATE VIEW v1 AS SELECT CAST(my_char_30 AS CHAR), my_char_30, id FROM t1_values; SELECT CAST(my_char_30 AS CHAR), my_char_30, id FROM t1_values -WHERE select_id = 14 OR select_id IS NULL; +WHERE select_id = 14 OR select_id IS NULL order by id; CAST(my_char_30 AS CHAR) my_char_30 id NULL NULL 1 2 @@ -4735,7 +4917,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as char charset latin1) AS `CAST(my_char_30 AS CHAR)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 14 OR select_id IS NULL); +WHERE select_id = 14 OR select_id IS NULL) order by id; CAST(my_char_30 AS CHAR) my_char_30 id NULL NULL 1 2 @@ -4749,7 +4931,7 @@ CREATE VIEW v1 AS SELECT CAST(my_year AS BINARY), my_year, id FROM t1_values; SELECT CAST(my_year AS BINARY), my_year, id FROM t1_values -WHERE select_id = 13 OR select_id IS NULL; +WHERE select_id = 13 OR select_id IS NULL order by id; CAST(my_year AS BINARY) my_year id NULL NULL 1 1901 1901 2 @@ -4761,7 +4943,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as char charset binary) AS `CAST(my_year AS BINARY)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 13 OR select_id IS NULL); +WHERE select_id = 13 OR select_id IS NULL) order by id; CAST(my_year AS BINARY) my_year id NULL NULL 1 1901 1901 2 @@ -4775,7 +4957,7 @@ CREATE VIEW v1 AS SELECT CAST(my_time AS BINARY), my_time, id FROM t1_values; SELECT CAST(my_time AS BINARY), my_time, id FROM t1_values -WHERE select_id = 12 OR select_id IS NULL; +WHERE select_id = 12 OR select_id IS NULL order by id; CAST(my_time AS BINARY) my_time id NULL NULL 1 -838:59:59 -838:59:59 2 @@ -4787,7 +4969,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as char charset binary) AS `CAST(my_time AS BINARY)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 12 OR select_id IS NULL); +WHERE select_id = 12 OR select_id IS NULL) order by id; CAST(my_time AS BINARY) my_time id NULL NULL 1 -838:59:59 -838:59:59 2 @@ -4801,7 +4983,7 @@ CREATE VIEW v1 AS SELECT CAST(my_timestamp AS BINARY), my_timestamp, id FROM t1_values; SELECT CAST(my_timestamp AS BINARY), my_timestamp, id FROM t1_values -WHERE select_id = 11 OR select_id IS NULL; +WHERE select_id = 11 OR select_id IS NULL order by id; CAST(my_timestamp AS BINARY) my_timestamp id 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1970-01-01 03:00:01 1970-01-01 03:00:01 2 @@ -4813,7 +4995,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as char charset binary) AS `CAST(my_timestamp AS BINARY)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 11 OR select_id IS NULL); +WHERE select_id = 11 OR select_id IS NULL) order by id; CAST(my_timestamp AS BINARY) my_timestamp id 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1970-01-01 03:00:01 1970-01-01 03:00:01 2 @@ -4827,7 +5009,7 @@ CREATE VIEW v1 AS SELECT CAST(my_date AS BINARY), my_date, id FROM t1_values; SELECT CAST(my_date AS BINARY), my_date, id FROM t1_values -WHERE select_id = 10 OR select_id IS NULL; +WHERE select_id = 10 OR select_id IS NULL order by id; CAST(my_date AS BINARY) my_date id NULL NULL 1 0001-01-01 0001-01-01 2 @@ -4839,7 +5021,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as char charset binary) AS `CAST(my_date AS BINARY)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 10 OR select_id IS NULL); +WHERE select_id = 10 OR select_id IS NULL) order by id; CAST(my_date AS BINARY) my_date id NULL NULL 1 0001-01-01 0001-01-01 2 @@ -4853,7 +5035,7 @@ CREATE VIEW v1 AS SELECT CAST(my_datetime AS BINARY), my_datetime, id FROM t1_values; SELECT CAST(my_datetime AS BINARY), my_datetime, id FROM t1_values -WHERE select_id = 9 OR select_id IS NULL; +WHERE select_id = 9 OR select_id IS NULL order by id; CAST(my_datetime AS BINARY) my_datetime id NULL NULL 1 0001-01-01 00:00:00 0001-01-01 00:00:00 2 @@ -4865,7 +5047,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as char charset binary) AS `CAST(my_datetime AS BINARY)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 9 OR select_id IS NULL); +WHERE select_id = 9 OR select_id IS NULL) order by id; CAST(my_datetime AS BINARY) my_datetime id NULL NULL 1 0001-01-01 00:00:00 0001-01-01 00:00:00 2 @@ -4879,7 +5061,7 @@ CREATE VIEW v1 AS SELECT CAST(my_double AS BINARY), my_double, id FROM t1_values; SELECT CAST(my_double AS BINARY), my_double, id FROM t1_values -WHERE select_id = 8 OR select_id IS NULL; +WHERE select_id = 8 OR select_id IS NULL order by id; CAST(my_double AS BINARY) my_double id NULL NULL 1 -1.7976931348623e+308 -1.7976931348623e+308 2 @@ -4891,7 +5073,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as char charset binary) AS `CAST(my_double AS BINARY)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 8 OR select_id IS NULL); +WHERE select_id = 8 OR select_id IS NULL) order by id; CAST(my_double AS BINARY) my_double id NULL NULL 1 -1.7976931348623e+308 -1.7976931348623e+308 2 @@ -4905,7 +5087,7 @@ CREATE VIEW v1 AS SELECT CAST(my_decimal AS BINARY), my_decimal, id FROM t1_values; SELECT CAST(my_decimal AS BINARY), my_decimal, id FROM t1_values -WHERE select_id = 7 OR select_id IS NULL; +WHERE select_id = 7 OR select_id IS NULL order by id; CAST(my_decimal AS BINARY) my_decimal id NULL NULL 1 -9999999999999999999999999999999999.999999999999999999999999999999 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -4917,7 +5099,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as char charset binary) AS `CAST(my_decimal AS BINARY)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 7 OR select_id IS NULL); +WHERE select_id = 7 OR select_id IS NULL) order by id; CAST(my_decimal AS BINARY) my_decimal id NULL NULL 1 -9999999999999999999999999999999999.999999999999999999999999999999 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -4931,7 +5113,7 @@ CREATE VIEW v1 AS SELECT CAST(my_bigint AS BINARY), my_bigint, id FROM t1_values; SELECT CAST(my_bigint AS BINARY), my_bigint, id FROM t1_values -WHERE select_id = 6 OR select_id IS NULL; +WHERE select_id = 6 OR select_id IS NULL order by id; CAST(my_bigint AS BINARY) my_bigint id NULL NULL 1 -9223372036854775808 -9223372036854775808 2 @@ -4943,7 +5125,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as char charset binary) AS `CAST(my_bigint AS BINARY)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 6 OR select_id IS NULL); +WHERE select_id = 6 OR select_id IS NULL) order by id; CAST(my_bigint AS BINARY) my_bigint id NULL NULL 1 -9223372036854775808 -9223372036854775808 2 @@ -4957,7 +5139,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS BINARY), my_varbinary_1000, id FROM t1_values; SELECT CAST(my_varbinary_1000 AS BINARY), my_varbinary_1000, id FROM t1_values -WHERE select_id = 5 OR select_id IS NULL; +WHERE select_id = 5 OR select_id IS NULL order by id; CAST(my_varbinary_1000 AS BINARY) my_varbinary_1000 id NULL NULL 1 2 @@ -4969,7 +5151,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as char charset binary) AS `CAST(my_varbinary_1000 AS BINARY)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 5 OR select_id IS NULL); +WHERE select_id = 5 OR select_id IS NULL) order by id; CAST(my_varbinary_1000 AS BINARY) my_varbinary_1000 id NULL NULL 1 2 @@ -4983,19 +5165,19 @@ CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS BINARY), my_binary_30, id FROM t1_values; SELECT CAST(my_binary_30 AS BINARY), my_binary_30, id FROM t1_values -WHERE select_id = 4 OR select_id IS NULL; +WHERE select_id = 4 OR select_id IS NULL order by id; CAST(my_binary_30 AS BINARY) my_binary_30 id NULL NULL 1 - + 2 <--------30 characters-------> <--------30 characters-------> 3 - ---äÖüß@µ*$-- --1 + ---äÖüß@µ*$-- ---äÖüß@µ*$-- 4 +-1 -1 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as char charset binary) AS `CAST(my_binary_30 AS BINARY)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 4 OR select_id IS NULL); +WHERE select_id = 4 OR select_id IS NULL) order by id; CAST(my_binary_30 AS BINARY) my_binary_30 id NULL NULL 1 @@ -5009,7 +5191,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS BINARY), my_varchar_1000, id FROM t1_values; SELECT CAST(my_varchar_1000 AS BINARY), my_varchar_1000, id FROM t1_values -WHERE select_id = 3 OR select_id IS NULL; +WHERE select_id = 3 OR select_id IS NULL order by id; CAST(my_varchar_1000 AS BINARY) my_varchar_1000 id NULL NULL 1 2 @@ -5021,7 +5203,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as char charset binary) AS `CAST(my_varchar_1000 AS BINARY)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 3 OR select_id IS NULL); +WHERE select_id = 3 OR select_id IS NULL) order by id; CAST(my_varchar_1000 AS BINARY) my_varchar_1000 id NULL NULL 1 2 @@ -5035,7 +5217,7 @@ CREATE VIEW v1 AS SELECT CAST(my_char_30 AS BINARY), my_char_30, id FROM t1_values; SELECT CAST(my_char_30 AS BINARY), my_char_30, id FROM t1_values -WHERE select_id = 2 OR select_id IS NULL; +WHERE select_id = 2 OR select_id IS NULL order by id; CAST(my_char_30 AS BINARY) my_char_30 id NULL NULL 1 2 @@ -5047,7 +5229,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as char charset binary) AS `CAST(my_char_30 AS BINARY)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 2 OR select_id IS NULL); +WHERE select_id = 2 OR select_id IS NULL) order by id; CAST(my_char_30 AS BINARY) my_char_30 id NULL NULL 1 2 @@ -5059,7 +5241,7 @@ DROP VIEW v1; CREATE VIEW v1 AS SELECT sqrt(my_bigint), my_bigint, id FROM t1_values; SELECT sqrt(my_bigint), my_bigint, id FROM t1_values -WHERE select_id = 1 OR select_id IS NULL; +WHERE select_id = 1 OR select_id IS NULL order by id; sqrt(my_bigint) my_bigint id NULL NULL 1 NULL -9223372036854775808 2 @@ -5073,7 +5255,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sqrt(`t1_values`.`my_bigint`) AS `sqrt(my_bigint)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 1 OR select_id IS NULL); +WHERE select_id = 1 OR select_id IS NULL) order by id; sqrt(my_bigint) my_bigint id NULL NULL 1 NULL -9223372036854775808 2 diff --git a/mysql-test/suite/funcs_1/r/innodb_storedproc_02.result b/mysql-test/suite/funcs_1/r/innodb_storedproc_02.result index 9081c6da3f7..6ba95c9fa63 100644 --- a/mysql-test/suite/funcs_1/r/innodb_storedproc_02.result +++ b/mysql-test/suite/funcs_1/r/innodb_storedproc_02.result @@ -9,20 +9,25 @@ DROP DATABASE IF EXISTS db_storedproc_1; CREATE DATABASE db_storedproc; CREATE DATABASE db_storedproc_1; USE db_storedproc; -create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t1; -create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t2; -create table t3(f1 char(20),f2 char(20),f3 integer) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t3.txt' into table t3; -create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t4; +create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t1; +create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t2; +create table t3(f1 char(20),f2 char(20),f3 integer) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t3.txt' into table t3; +create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t4; USE db_storedproc_1; -create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t6; +create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t6; USE db_storedproc; -create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t7; +create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t7; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -34,8 +39,9 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t8; +create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t8; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -47,12 +53,14 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t9(f1 int, f2 char(25), f3 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' into table t9; -create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t10; -create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t11; +create table t9(f1 int, f2 char(25), f3 int) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t9.txt' into table t9; +create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t10; +create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t11; Section 3.1.2 - Syntax checks for the stored procedure-specific programming statements BEGIN/END, DECLARE, SET, SELECT/INTO, OPEN, FETCH, CLOSE: @@ -164,7 +172,7 @@ declare y integer default 1; set @x = x; set @y = y; set @z = 234; -SELECT f1, f2 into @x, @y from t2 limit 1; +SELECT f1, f2 into @x, @y from t2 where f1='a`' and f2='a`' limit 1; SELECT @x, @y, @z, invar; BEGIN set @x = 2; @@ -207,7 +215,7 @@ BEGIN declare x integer; declare y integer; set @x=x; set @y=y; -SELECT f4, f3 into @x, @y from t2 limit 1; +SELECT f4, f3 into @x, @y from t2 where f4=-5000 and f3='1000-01-01' limit 1; SELECT @x, @y; END// CALL sp1(); @@ -695,7 +703,7 @@ Testcase 3.1.2.54: ------------------ Ensure that a handler with a condition defined with an SQLSTATE that begins with -“01“ is always exactly equivalent in action to a handler with an SQLWARNING +“01“ is always exactly equivalent in action to a handler with an SQLWARNING condition. -------------------------------------------------------------------------------- DROP PROCEDURE IF EXISTS sp0; @@ -794,7 +802,7 @@ Testcase 3.1.2.56: ------------------ Ensure that a handler with a condition defined with an SQLSTATE that begins with -“02“ is always exactly equivalent in action to a handler with a NOT FOUND +“02“ is always exactly equivalent in action to a handler with a NOT FOUND condition. -------------------------------------------------------------------------------- DROP PROCEDURE IF EXISTS sp0; @@ -902,7 +910,7 @@ Testcase 3.1.2.58: ------------------ Ensure that a handler with a condition defined with an SQLSTATE that begins with -anything other that “01“ or “02“ is always exactly equivalent in action to a +anything other that “01“ or “02“ is always exactly equivalent in action to a handler with an SQLEXCEPTION condition. -------------------------------------------------------------------------------- DROP PROCEDURE IF EXISTS sp0; @@ -1082,7 +1090,8 @@ declare f2_value char(20); declare f5_value char(20); declare f4_value integer; declare f6_value integer; -declare cur1 cursor for SELECT f1, f2, f4, f5, f6 from t2 limit 3; +declare cur1 cursor for SELECT f1, f2, f4, f5, f6 from t2 +where f4 >=-5000 order by f4 limit 3; open cur1; while proceed do SELECT count AS 'loop'; @@ -1165,7 +1174,7 @@ of a compound statement ends. DROP TABLE IF EXISTS temp1; DROP PROCEDURE IF EXISTS sp1; create table temp1( f0 char(20), f1 char(20), f2 char(20), f3 int, f4 char(20) ); -SELECT f1, f2, f4, f5 from t2; +SELECT f1, f2, f4, f5 from t2 order by f4; f1 f2 f4 f5 a` a` -5000 a` aaa aaa -4999 aaa @@ -1185,8 +1194,8 @@ declare newf1 char(20); declare newf2 char(20); declare newf5 char(20); declare newf4 integer; -declare cur1 cursor for SELECT f1, f2, f4, f5 from t2 limit 5; -declare cur2 cursor for SELECT f1, f2, f4, f5 from t2 limit 5; +declare cur1 cursor for SELECT f1, f2, f4, f5 from t2 where f4 >= -5000 order by f4 limit 5; +declare cur2 cursor for SELECT f1, f2, f4, f5 from t2 where f4 >= -5000 order by f4 limit 5; open cur1; open cur2; BEGIN @@ -1268,8 +1277,10 @@ declare i_newf11 char(20); declare i_newf12 char(20); declare i_newf13 date; declare i_newf14 integer; -declare cur1 cursor for SELECT f1, f2, f3, f4 from t2 limit 4; -declare cur2 cursor for SELECT f1, f2, f3, f4 from t2 limit 3; +declare cur1 cursor for SELECT f1, f2, f3, f4 from t2 +where f4>=-5000 order by f4 limit 4; +declare cur2 cursor for SELECT f1, f2, f3, f4 from t2 +where f4>=-5000 order by f4 limit 3; declare continue handler for sqlstate '02000' set proceed=0; open cur1; open cur2; @@ -1300,8 +1311,10 @@ DECLARE o_newf11 CHAR(20); DECLARE o_newf12 CHAR(20); DECLARE o_newf13 DATE; DECLARE o_newf14 INTEGER; -DECLARE cur1 CURSOR FOR SELECT f1, f2, f3, f4 FROM t2 LIMIT 5; -DECLARE cur2 CURSOR FOR SELECT f1, f2, f3, f4 FROM t2 LIMIT 5; +DECLARE cur1 CURSOR FOR SELECT f1, f2, f3, f4 FROM t2 +WHERE f4>=-5000 ORDER BY f4 LIMIT 5; +DECLARE cur2 CURSOR FOR SELECT f1, f2, f3, f4 FROM t2 +WHERE f4>=-5000 ORDER BY f4 LIMIT 5; DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET proceed=0; OPEN cur1; OPEN cur2; diff --git a/mysql-test/suite/funcs_1/r/innodb_storedproc_03.result b/mysql-test/suite/funcs_1/r/innodb_storedproc_03.result index faf598b090b..53e25441e2e 100644 --- a/mysql-test/suite/funcs_1/r/innodb_storedproc_03.result +++ b/mysql-test/suite/funcs_1/r/innodb_storedproc_03.result @@ -9,20 +9,25 @@ DROP DATABASE IF EXISTS db_storedproc_1; CREATE DATABASE db_storedproc; CREATE DATABASE db_storedproc_1; USE db_storedproc; -create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t1; -create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t2; -create table t3(f1 char(20),f2 char(20),f3 integer) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t3.txt' into table t3; -create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t4; +create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t1; +create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t2; +create table t3(f1 char(20),f2 char(20),f3 integer) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t3.txt' into table t3; +create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t4; USE db_storedproc_1; -create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t6; +create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t6; USE db_storedproc; -create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t7; +create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t7; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -34,8 +39,9 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t8; +create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t8; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -47,12 +53,14 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t9(f1 int, f2 char(25), f3 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' into table t9; -create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t10; -create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t11; +create table t9(f1 int, f2 char(25), f3 int) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t9.txt' into table t9; +create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t10; +create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t11; Section 3.1.3 - Syntax checks for the stored procedure-specific flow control statements IF, CASE, LOOP, LEAVE, ITERATE, REPEAT, WHILE: diff --git a/mysql-test/suite/funcs_1/r/innodb_storedproc_06.result b/mysql-test/suite/funcs_1/r/innodb_storedproc_06.result index 639e8cdb48b..88bddf68e24 100644 --- a/mysql-test/suite/funcs_1/r/innodb_storedproc_06.result +++ b/mysql-test/suite/funcs_1/r/innodb_storedproc_06.result @@ -9,20 +9,25 @@ DROP DATABASE IF EXISTS db_storedproc_1; CREATE DATABASE db_storedproc; CREATE DATABASE db_storedproc_1; USE db_storedproc; -create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t1; -create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t2; -create table t3(f1 char(20),f2 char(20),f3 integer) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t3.txt' into table t3; -create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t4; +create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t1; +create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t2; +create table t3(f1 char(20),f2 char(20),f3 integer) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t3.txt' into table t3; +create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t4; USE db_storedproc_1; -create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t6; +create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t6; USE db_storedproc; -create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t7; +create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t7; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -34,8 +39,9 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t8; +create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t8; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -47,12 +53,14 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t9(f1 int, f2 char(25), f3 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' into table t9; -create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t10; -create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t11; +create table t9(f1 int, f2 char(25), f3 int) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t9.txt' into table t9; +create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t10; +create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t11; Section 3.1.6 - Privilege Checks: -------------------------------------------------------------------------------- @@ -79,6 +87,7 @@ BEGIN SELECT * from db_storedproc_1.t6 where t6.f2= 'xyz'; END// ERROR 42000: Access denied for user 'user_1'@'localhost' to database 'db_storedproc_1' +USE db_storedproc_1; root@localhost db_storedproc_1 GRANT CREATE ROUTINE ON db_storedproc_1.* TO 'user_1'@'localhost'; @@ -90,6 +99,7 @@ CREATE PROCEDURE sp1(v1 char(20)) BEGIN SELECT * from db_storedproc_1.t6 where t6.f2= 'xyz'; END// +USE db_storedproc_1; root@localhost db_storedproc_1 DROP USER 'user_1'@'localhost'; @@ -115,6 +125,7 @@ CREATE FUNCTION fn1(v1 int) returns int BEGIN return v1; END// +USE db_storedproc_1; root@localhost db_storedproc_1 drop user 'user_1'@'localhost'; diff --git a/mysql-test/suite/funcs_1/r/innodb_storedproc_07.result b/mysql-test/suite/funcs_1/r/innodb_storedproc_07.result index d0b9d8ae806..cbe0a18435a 100644 --- a/mysql-test/suite/funcs_1/r/innodb_storedproc_07.result +++ b/mysql-test/suite/funcs_1/r/innodb_storedproc_07.result @@ -9,20 +9,25 @@ DROP DATABASE IF EXISTS db_storedproc_1; CREATE DATABASE db_storedproc; CREATE DATABASE db_storedproc_1; USE db_storedproc; -create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t1; -create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t2; -create table t3(f1 char(20),f2 char(20),f3 integer) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t3.txt' into table t3; -create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t4; +create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t1; +create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t2; +create table t3(f1 char(20),f2 char(20),f3 integer) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t3.txt' into table t3; +create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t4; USE db_storedproc_1; -create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t6; +create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t6; USE db_storedproc; -create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t7; +create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t7; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -34,8 +39,9 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t8; +create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t8; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -47,12 +53,14 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t9(f1 int, f2 char(25), f3 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' into table t9; -create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t10; -create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t11; +create table t9(f1 int, f2 char(25), f3 int) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t9.txt' into table t9; +create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t10; +create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t11; Section 3.1.7 - SQL mode checks: -------------------------------------------------------------------------------- diff --git a/mysql-test/suite/funcs_1/r/innodb_storedproc_08.result b/mysql-test/suite/funcs_1/r/innodb_storedproc_08.result index 68e32626425..40ebc1e51e4 100644 --- a/mysql-test/suite/funcs_1/r/innodb_storedproc_08.result +++ b/mysql-test/suite/funcs_1/r/innodb_storedproc_08.result @@ -9,20 +9,25 @@ DROP DATABASE IF EXISTS db_storedproc_1; CREATE DATABASE db_storedproc; CREATE DATABASE db_storedproc_1; USE db_storedproc; -create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t1; -create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t2; -create table t3(f1 char(20),f2 char(20),f3 integer) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t3.txt' into table t3; -create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t4; +create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t1; +create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t2; +create table t3(f1 char(20),f2 char(20),f3 integer) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t3.txt' into table t3; +create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t4; USE db_storedproc_1; -create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t6; +create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t6; USE db_storedproc; -create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t7; +create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t7; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -34,8 +39,9 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t8; +create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t8; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -47,12 +53,14 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t9(f1 int, f2 char(25), f3 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' into table t9; -create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t10; -create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t11; +create table t9(f1 int, f2 char(25), f3 int) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t9.txt' into table t9; +create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t10; +create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t11; Section 3.1.8 - SHOW statement checks: -------------------------------------------------------------------------------- diff --git a/mysql-test/suite/funcs_1/r/innodb_storedproc_10.result b/mysql-test/suite/funcs_1/r/innodb_storedproc_10.result index f2c47342019..163bae36bed 100644 --- a/mysql-test/suite/funcs_1/r/innodb_storedproc_10.result +++ b/mysql-test/suite/funcs_1/r/innodb_storedproc_10.result @@ -9,20 +9,25 @@ DROP DATABASE IF EXISTS db_storedproc_1; CREATE DATABASE db_storedproc; CREATE DATABASE db_storedproc_1; USE db_storedproc; -create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t1; -create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t2; -create table t3(f1 char(20),f2 char(20),f3 integer) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t3.txt' into table t3; -create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t4; +create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t1; +create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t2; +create table t3(f1 char(20),f2 char(20),f3 integer) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t3.txt' into table t3; +create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t4; USE db_storedproc_1; -create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t6; +create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t6; USE db_storedproc; -create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t7; +create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t7; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -34,8 +39,9 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t8; +create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t8; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -47,12 +53,14 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t9(f1 int, f2 char(25), f3 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' into table t9; -create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t10; -create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t11; +create table t9(f1 int, f2 char(25), f3 int) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t9.txt' into table t9; +create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t10; +create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t11; Section 3.1.10 - CALL checks: -------------------------------------------------------------------------------- @@ -78,7 +86,7 @@ connect(localhost,user_1,,db_storedproc,MYSQL_PORT,MYSQL_SOCK); user_1@localhost db_storedproc CREATE PROCEDURE sp31102 () SQL SECURITY INVOKER BEGIN -SELECT * FROM db_storedproc.t1 LIMIT 1; +SELECT * FROM db_storedproc.t1 WHERE f4=-5000 LIMIT 1; END// CREATE FUNCTION fn31105(n INT) RETURNS INT BEGIN @@ -93,6 +101,8 @@ CALL sp31102(); ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc.sp31102' SELECT fn31105( 9 ); ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc.fn31105' +connection default; +USE db_storedproc; root@localhost db_storedproc CALL sp31102(); @@ -112,6 +122,8 @@ a` a` 1000-01-01 -5000 a` -5000 SELECT fn31105( 9 ); fn31105( 9 ) 81 +connection default; +USE db_storedproc; root@localhost db_storedproc REVOKE EXECUTE ON db_storedproc.* FROM 'user_2'@'localhost'; @@ -129,6 +141,7 @@ CALL sp31102(); ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc.sp31102' SELECT fn31105( 9 ); ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc.fn31105' +USE db_storedproc; root@localhost db_storedproc DROP PROCEDURE sp31102; @@ -176,6 +189,8 @@ DROP PROCEDURE IF EXISTS sp_ins_1; DROP PROCEDURE IF EXISTS sp_ins_3; DROP PROCEDURE IF EXISTS sp_upd; DROP PROCEDURE IF EXISTS sp_ins_upd; +DROP PROCEDURE IF EXISTS sp_del; +DROP PROCEDURE IF EXISTS sp_with_rowcount; CREATE TABLE temp(f1 CHAR(20),f2 CHAR(25),f3 DATE,f4 INT,f5 CHAR(25),f6 INT); INSERT INTO temp SELECT * FROM t10; CREATE PROCEDURE sp_ins_1() @@ -203,49 +218,72 @@ END; SELECT COUNT( f1 ), f1 FROM temp GROUP BY f1; UPDATE temp SET temp.f1 = 'updated_2' WHERE temp.f1 ='qwe' AND temp.f2 = 'abc'; END// +CREATE PROCEDURE sp_del() +BEGIN +DELETE FROM temp WHERE temp.f1 ='qwe' OR temp.f1 = 'updated_2'; +END// +CREATE PROCEDURE sp_with_rowcount() +BEGIN +BEGIN +INSERT INTO temp VALUES ('qwe', 'abc', '1989-11-09', 100, 'uvw', 1000), +('qwe', 'xyz', '1998-03-26', 100, 'uvw', 1000), +('qwe', 'abc', '2000-11-09', 100, 'uvw', 1000), +('qwe', 'xyz', '2005-11-07', 100, 'uvw', 1000); +END; +SELECT row_count() AS 'row_count() after insert'; +SELECT row_count() AS 'row_count() after select row_count()'; +SELECT f1,f2,f3 FROM temp ORDER BY f1,f2,f3; +UPDATE temp SET temp.f1 = 'updated_2' WHERE temp.f2 = 'abc'; +SELECT row_count() AS 'row_count() after update'; +SELECT f1,f2,f3 FROM temp ORDER BY f1,f2,f3; +DELETE FROM temp WHERE temp.f1 = 'updated_2'; +SELECT row_count() AS 'row_count() after delete'; +END// CALL sp_ins_1(); SELECT row_count(); row_count() 1 SELECT * FROM temp; f1 f2 f3 f4 f5 f6 +a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 +a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991 a` a` 1000-01-01 -5000 a` -5000 aaa aaa 1000-01-02 -4999 aaa -4999 abaa abaa 1000-01-03 -4998 abaa -4998 +abc abc 2005-10-03 100 uvw 1000 acaaa acaaa 1000-01-04 -4997 acaaa -4997 adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996 aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995 afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994 agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993 -a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 -a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991 -abc abc 2005-10-03 100 uvw 1000 CALL sp_ins_3(); SELECT row_count(); row_count() 1 SELECT * FROM temp; f1 f2 f3 f4 f5 f6 +a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 +a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991 a` a` 1000-01-01 -5000 a` -5000 aaa aaa 1000-01-02 -4999 aaa -4999 abaa abaa 1000-01-03 -4998 abaa -4998 +abc abc 2005-10-03 100 uvw 1000 +abc xyz 1949-05-23 100 uvw 1000 +abc xyz 1989-11-09 100 uvw 1000 +abc xyz 2005-10-24 100 uvw 1000 acaaa acaaa 1000-01-04 -4997 acaaa -4997 adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996 aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995 afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994 agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993 -a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 -a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991 -abc abc 2005-10-03 100 uvw 1000 -abc xyz 1949-05-23 100 uvw 1000 -abc xyz 1989-11-09 100 uvw 1000 -abc xyz 2005-10-24 100 uvw 1000 CALL sp_upd(); SELECT row_count(); row_count() 4 SELECT * FROM temp; f1 f2 f3 f4 f5 f6 +a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 +a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991 a` a` 1000-01-01 -5000 a` -5000 aaa aaa 1000-01-02 -4999 aaa -4999 abaa abaa 1000-01-03 -4998 abaa -4998 @@ -254,8 +292,6 @@ adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996 aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995 afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994 agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993 -a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 -a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991 updated abc 2005-10-03 100 uvw 1000 updated xyz 1949-05-23 100 uvw 1000 updated xyz 1989-11-09 100 uvw 1000 @@ -279,6 +315,8 @@ row_count() 3 SELECT * FROM temp; f1 f2 f3 f4 f5 f6 +a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 +a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991 a` a` 1000-01-01 -5000 a` -5000 aaa aaa 1000-01-02 -4999 aaa -4999 abaa abaa 1000-01-03 -4998 abaa -4998 @@ -287,26 +325,73 @@ adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996 aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995 afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994 agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993 -a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 -a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991 +qwe xyz 1998-03-26 100 uvw 1000 updated abc 2005-10-03 100 uvw 1000 updated xyz 1949-05-23 100 uvw 1000 updated xyz 1989-11-09 100 uvw 1000 updated xyz 2005-10-24 100 uvw 1000 updated_2 abc 1989-11-09 100 uvw 1000 -qwe xyz 1998-03-26 100 uvw 1000 updated_2 abc 2000-11-09 100 uvw 1000 updated_2 abc 2005-11-07 100 uvw 1000 +CALL sp_del(); +SELECT row_count(); +row_count() +4 +SELECT * FROM temp; +f1 f2 f3 f4 f5 f6 +a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 +a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991 +a` a` 1000-01-01 -5000 a` -5000 +aaa aaa 1000-01-02 -4999 aaa -4999 +abaa abaa 1000-01-03 -4998 abaa -4998 +acaaa acaaa 1000-01-04 -4997 acaaa -4997 +adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996 +aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995 +afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994 +agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993 +updated abc 2005-10-03 100 uvw 1000 +updated xyz 1949-05-23 100 uvw 1000 +updated xyz 1989-11-09 100 uvw 1000 +updated xyz 2005-10-24 100 uvw 1000 +DELETE FROM temp; +CALL sp_with_rowcount(); +row_count() after insert +4 +row_count() after select row_count() +-1 +f1 f2 f3 +qwe abc 1989-11-09 +qwe abc 2000-11-09 +qwe xyz 1998-03-26 +qwe xyz 2005-11-07 +row_count() after update +2 +f1 f2 f3 +qwe xyz 1998-03-26 +qwe xyz 2005-11-07 +updated_2 abc 1989-11-09 +updated_2 abc 2000-11-09 +row_count() after delete +2 +SELECT row_count(); +row_count() +-1 +SELECT * FROM temp; +f1 f2 f3 f4 f5 f6 +qwe xyz 1998-03-26 100 uvw 1000 +qwe xyz 2005-11-07 100 uvw 1000 DROP PROCEDURE sp_ins_1; DROP PROCEDURE sp_ins_3; DROP PROCEDURE sp_upd; DROP PROCEDURE sp_ins_upd; +DROP PROCEDURE sp_del; +DROP PROCEDURE sp_with_rowcount; DROP TABLE temp; Testcase 3.1.10.8: ------------------ -Ensure that the mysql_affected_rows() C API function always returns the correct +Ensure that the mysql_affected_rows() C API function always returns the correct number of rows affected by the execution of a stored procedure. -------------------------------------------------------------------------------- diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_0102.result b/mysql-test/suite/funcs_1/r/innodb_trig_0102.result index 9c2c2a38a4d..1ada907f9e6 100644 --- a/mysql-test/suite/funcs_1/r/innodb_trig_0102.result +++ b/mysql-test/suite/funcs_1/r/innodb_trig_0102.result @@ -1,96 +1,89 @@ USE test; -drop table if exists tb3 ; +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; +f118 char not null DEFAULT 'a', +f119 char binary not null DEFAULT b'101', +f120 char ascii not null DEFAULT b'101', +f121 char(50), +f122 char(50), +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 = <engine_to_be_used>; 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 'MYSQL_TEST_DIR/suite/funcs_1/data/innodb_tb3.txt' into table tb3 ; Testcase: 3.5.1.1: ------------------ use test; -Create trigger trg1_1 BEFORE INSERT +Create trigger trg1_1 BEFORE INSERT on tb3 for each row set @test_before = 2, new.f142 = @test_before; -Create trigger trg1_2 AFTER INSERT +Create trigger trg1_2 AFTER INSERT on tb3 for each row set @test_after = 6; -Create trigger trg1_4 BEFORE UPDATE -on tb3 for each row set @test_before = 27, -new.f142 = @test_before, +Create trigger trg1_4 BEFORE UPDATE +on tb3 for each row set @test_before = 27, +new.f142 = @test_before, new.f122 = 'Before Update Trigger'; -Create trigger trg1_3 AFTER UPDATE +Create trigger trg1_3 AFTER UPDATE on tb3 for each row set @test_after = '15'; -Create trigger trg1_5 BEFORE DELETE on tb3 for each row -select count(*) into @test_before from tb3 as tr_tb3 +Create trigger trg1_5 BEFORE DELETE on tb3 for each row +select count(*) into @test_before from tb3 as tr_tb3 where f121 = 'Test 3.5.1.1'; -Create trigger trg1_6 AFTER DELETE on tb3 for each row -select count(*) into @test_after from tb3 as tr_tb3 +Create trigger trg1_6 AFTER DELETE on tb3 for each row +select count(*) into @test_after from tb3 as tr_tb3 where f121 = 'Test 3.5.1.1'; set @test_before = 1; set @test_after = 5; select @test_before, @test_after; @test_before @test_after 1 5 -Insert into tb3 (f121, f122, f142, f144, f134) +Insert into tb3 (f121, f122, f142, f144, f134) values ('Test 3.5.1.1', 'First Row', @test_before, @test_after, 1); select f121, f122, f142, f144, f134 from tb3 where f121 = 'Test 3.5.1.1'; f121 f122 f142 f144 f134 @@ -103,9 +96,9 @@ set @test_after = 8; select @test_before, @test_after; @test_before @test_after 18 8 -Update tb3 set tb3.f122 = 'Update', -tb3.f142 = @test_before, -tb3.f144 = @test_after +Update tb3 set tb3.f122 = 'Update', +tb3.f142 = @test_before, +tb3.f144 = @test_after where tb3.f121 = 'Test 3.5.1.1'; select f121, f122, f142, f144, f134 from tb3 where f121 = 'Test 3.5.1.1'; f121 f122 f142 f144 f134 @@ -113,7 +106,7 @@ Test 3.5.1.1 Before Update Trigger 27 0000000008 1 select @test_before, @test_after; @test_before @test_after 27 15 -Insert into tb3 (f121, f122, f142, f144, f134) +Insert into tb3 (f121, f122, f142, f144, f134) values ('Test 3.5.1.1', 'Second Row', 5, 6, 2); set @test_before = 0; set @test_after = 0; @@ -141,7 +134,7 @@ delete from tb3 where f121='Test 3.5.1.1'; Testcase: 3.5.1.2: ------------------ -Create trigger trg_1 after insert +Create trigger trg_1 after insert on tb3 for each statement set @x= 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 'statement set @x= 1' at line 2 drop trigger trg_1; @@ -193,8 +186,8 @@ Testcase 3.5.1.7: - need to fix drop table if exists t1; Warnings: Note 1051 Unknown table 't1' -create table t1 (f1 int, f2 char(25),f3 int) engine=innodb; -CREATE TRIGGER trg5_1 BEFORE INSERT on test.t1 +create table t1 (f1 int, f2 char(25),f3 int) engine = <engine_to_be_used>; +CREATE TRIGGER trg5_1 BEFORE INSERT on test.t1 for each row set new.f3 = '14'; CREATE TRIGGER trg_abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ BEFORE UPDATE on test.t1 for each row set new.f3 = '42'; @@ -206,7 +199,7 @@ update t1 set f2='update 3.5.1.7'; select * from t1; f1 f2 f3 NULL update 3.5.1.7 42 -select trigger_name from information_schema.triggers; +select trigger_name from information_schema.triggers order by trigger_name; trigger_name trg5_1 trg_abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWX @@ -226,19 +219,19 @@ CREATE TRIGGER @@view before insert on tb3 for each row set new.f120 = 't'; 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 '@@view before insert on tb3 for each row set new.f120 = 't'' at line 1 CREATE TRIGGER @name before insert on tb3 for each row set new.f120 = 't'; 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 '@name before insert on tb3 for each row set new.f120 = 't'' at line 1 -CREATE TRIGGER tb3.trg6_1 BEFORE INSERT on test.tb3 +CREATE TRIGGER tb3.trg6_1 BEFORE INSERT on test.tb3 for each row set new.f120 ='X'; ERROR HY000: Trigger in wrong schema drop database if exists trig_db; create database trig_db; use trig_db; -create table t1 (f1 integer) engine = innodb; +create table t1 (f1 integer) engine = <engine_to_be_used>; use test; -CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3 +CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3 for each row set @ret_trg6_2 = 5; ERROR 42S02: Table 'trig_db.tb3' doesn't exist use trig_db; -CREATE TRIGGER trg6_3 AFTER INSERT on test.tb3 +CREATE TRIGGER trg6_3 AFTER INSERT on test.tb3 for each row set @ret_trg6_3 = 18; ERROR HY000: Trigger in wrong schema use test; @@ -260,11 +253,11 @@ Testcase 3.5.1.?: ----------------- drop table if exists t1; drop table if exists t2; -create table t1 (f1 char(50), f2 integer) engine = innodb; -create table t2 (f1 char(50), f2 integer) engine = innodb; -create trigger trig before insert on t1 +create table t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>; +create table t2 (f1 char(50), f2 integer) engine = <engine_to_be_used>; +create trigger trig before insert on t1 for each row set new.f1 ='trig t1'; -create trigger trig before update on t2 +create trigger trig before update on t2 for each row set new.f1 ='trig t2'; ERROR HY000: Trigger already exists insert into t1 value ('insert to t1',1); @@ -293,16 +286,16 @@ create database trig_db1; create database trig_db2; create database trig_db3; use trig_db1; -create table t1 (f1 char(50), f2 integer) engine = innodb; -create trigger trig before insert on t1 +create table t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>; +create trigger trig before insert on t1 for each row set new.f1 ='trig1', @test_var1='trig1'; use trig_db2; -create table t2 (f1 char(50), f2 integer) engine = innodb; -create trigger trig before insert on t2 +create table t2 (f1 char(50), f2 integer) engine = <engine_to_be_used>; +create trigger trig before insert on t2 for each row set new.f1 ='trig2', @test_var2='trig2'; use trig_db3; -create table t1 (f1 char(50), f2 integer) engine = innodb; -create trigger trig before insert on t1 +create table t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>; +create trigger trig before insert on t1 for each row set new.f1 ='trig3', @test_var3='trig3'; set @test_var1= '', @test_var2= '', @test_var3= ''; use trig_db1; @@ -313,7 +306,7 @@ insert into trig_db3.t1 (f1,f2) values ('insert to db3 t1 from db1',4); select @test_var1, @test_var2, @test_var3; @test_var1 @test_var2 @test_var3 trig1 trig2 trig3 -select * from t1; +select * from t1 order by f2; f1 f2 trig1 1 trig1 2 @@ -323,7 +316,7 @@ trig2 3 select * from trig_db3.t1; f1 f2 trig3 4 -select * from t1; +select * from t1 order by f2; f1 f2 trig1 1 trig1 2 @@ -339,19 +332,19 @@ drop database if exists trig_db2; create database trig_db1; create database trig_db2; use trig_db1; -create table t1 (f1 char(50), f2 integer) engine = innodb; -create table trig_db2.t1 (f1 char(50), f2 integer) engine = innodb; -create trigger trig1_b before insert on t1 +create table t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>; +create table trig_db2.t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>; +create trigger trig1_b before insert on t1 for each row set @test_var1='trig1_b'; -create trigger trig_db1.trig1_a after insert on t1 +create trigger trig_db1.trig1_a after insert on t1 for each row set @test_var2='trig1_a'; -create trigger trig_db2.trig2 before insert on trig_db2.t1 +create trigger trig_db2.trig2 before insert on trig_db2.t1 for each row set @test_var3='trig2'; select trigger_schema, trigger_name, event_object_table -from information_schema.triggers; +from information_schema.triggers order by trigger_name; trigger_schema trigger_name event_object_table -trig_db1 trig1_b t1 trig_db1 trig1_a t1 +trig_db1 trig1_b t1 trig_db2 trig2 t1 set @test_var1= '', @test_var2= '', @test_var3= ''; insert into t1 (f1,f2) values ('insert to db1 t1 from db1',352); diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_03.result b/mysql-test/suite/funcs_1/r/innodb_trig_03.result index 4e6b4523f1d..0d29724fcb7 100644 --- a/mysql-test/suite/funcs_1/r/innodb_trig_03.result +++ b/mysql-test/suite/funcs_1/r/innodb_trig_03.result @@ -1,77 +1,70 @@ USE test; -drop table if exists tb3 ; +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; +f118 char not null DEFAULT 'a', +f119 char binary not null DEFAULT b'101', +f120 char ascii not null DEFAULT b'101', +f121 char(50), +f122 char(50), +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 = <engine_to_be_used>; 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 'MYSQL_TEST_DIR/suite/funcs_1/data/innodb_tb3.txt' into table tb3 ; Testcase 3.5.3: --------------- drop database if exists priv_db; create database priv_db; use priv_db; -create table t1 (f1 char(20)) engine= innodb; +create table t1 (f1 char(20)) engine= <engine_to_be_used>; create User test_noprivs@localhost; set password for test_noprivs@localhost = password('PWD'); create User test_yesprivs@localhost; @@ -106,7 +99,7 @@ set new.f1 = 'trig 3.5.3.2_1-no'; ERROR 42000: Access denied; you need the SUPER privilege for this operation use priv_db; insert into t1 (f1) values ('insert 3.5.3.2-no'); -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no select current_user; @@ -121,15 +114,12 @@ root@localhost use priv_db; insert into t1 (f1) values ('insert 3.5.3.2-yes'); ERROR 42000: UPDATE command denied to user 'test_yesprivs'@'localhost' for column 'f1' in table 't1' -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no grant UPDATE on priv_db.t1 to test_yesprivs@localhost; - -note: once 15166 is fixed a similar case for SELECT needs to be added ---------------------------------------------------------------------- insert into t1 (f1) values ('insert 3.5.3.2-yes'); -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no trig 3.5.3.2_2-yes @@ -141,7 +131,7 @@ drop trigger trg1_2; ERROR 42000: Access denied; you need the SUPER privilege for this operation use priv_db; insert into t1 (f1) values ('insert 3.5.3.6-yes'); -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no trig 3.5.3.2_2-yes @@ -150,12 +140,12 @@ use priv_db; drop trigger trg1_2; use priv_db; insert into t1 (f1) values ('insert 3.5.3.6-no'); -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no drop trigger trg1_2; Testcase 3.5.3.7a: @@ -180,23 +170,22 @@ use priv_db; show grants; Grants for test_noprivs@localhost GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no - -Trigger create disabled - should fail - Bug 8884 ------------------------------------------------- +create trigger trg4a_1 before INSERT on t1 for each row +set new.f1 = 'trig 3.5.3.7-1a'; insert into t1 (f1) values ('insert 3.5.3.7-1a'); -select f1 from t1; +ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no -insert 3.5.3.7-1a drop trigger trg4a_1; use priv_db; select current_user; @@ -207,18 +196,13 @@ Grants for test_yesprivs@localhost GRANT UPDATE, SUPER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' create trigger trg4a_2 before INSERT on t1 for each row set new.f1 = 'trig 3.5.3.7-2a'; - -SELECT priv added to bypass bug 15166 -------------------------------------- -grant SELECT on *.* to test_yesprivs@localhost; insert into t1 (f1) values ('insert 3.5.3.7-2b'); -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no -insert 3.5.3.7-1a trig 3.5.3.7-2a drop trigger trg4a_2; @@ -245,30 +229,29 @@ Grants for test_noprivs@localhost GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE ON `priv_db`.* TO 'test_noprivs'@'localhost' use priv_db; - -Trigger create disabled - should fail - Bug 8884 ------------------------------------------------- +create trigger trg4b_1 before UPDATE on t1 for each row +set new.f1 = 'trig 3.5.3.7-1b'; +ERROR 42000: Access denied; you need the SUPER privilege for this operation insert into t1 (f1) values ('insert 3.5.3.7-1b'); -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no +insert 3.5.3.7-1b trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no -insert 3.5.3.7-1a trig 3.5.3.7-2a -insert 3.5.3.7-1b update t1 set f1 = 'update 3.5.3.7-1b' where f1 = 'insert 3.5.3.7-1b'; -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no -insert 3.5.3.7-1a trig 3.5.3.7-2a update 3.5.3.7-1b drop trigger trg4b_1; +ERROR HY000: Trigger does not exist show grants; Grants for test_yesprivs@localhost GRANT SUPER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' @@ -276,32 +259,26 @@ GRANT UPDATE ON `priv_db`.* TO 'test_yesprivs'@'localhost' use priv_db; create trigger trg4b_2 before UPDATE on t1 for each row set new.f1 = 'trig 3.5.3.7-2b'; - -SELECT priv added to bypass bug 15166 -------------------------------------- -grant SELECT on priv_db.* to test_yesprivs@localhost; insert into t1 (f1) values ('insert 3.5.3.7-2b'); -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no +insert 3.5.3.7-2b trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no -insert 3.5.3.7-1a trig 3.5.3.7-2a update 3.5.3.7-1b -insert 3.5.3.7-2b update t1 set f1 = 'update 3.5.3.7-2b' where f1 = 'insert 3.5.3.7-2b'; -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no -insert 3.5.3.7-1a trig 3.5.3.7-2a -update 3.5.3.7-1b trig 3.5.3.7-2b +update 3.5.3.7-1b drop trigger trg4b_2; Testcase 3.5.3.7c @@ -327,21 +304,19 @@ Grants for test_noprivs@localhost GRANT SUPER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW ON `priv_db`.`t1` TO 'test_noprivs'@'localhost' use priv_db; - -Trigger create disabled - should fail - Bug 8884 ------------------------------------------------- +create trigger trg4c_1 before INSERT on t1 for each row +set new.f1 = 'trig 3.5.3.7-1c'; insert into t1 (f1) values ('insert 3.5.3.7-1c'); -select f1 from t1; +ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no -insert 3.5.3.7-1a trig 3.5.3.7-2a -update 3.5.3.7-1b trig 3.5.3.7-2b -insert 3.5.3.7-1c +update 3.5.3.7-1b drop trigger trg4c_1; show grants; Grants for test_yesprivs@localhost @@ -350,23 +325,17 @@ GRANT UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' use priv_db; create trigger trg4c_2 before INSERT on t1 for each row set new.f1 = 'trig 3.5.3.7-2c'; - -SELECT priv added to bypass bug 15166 -------------------------------------- -grant SELECT on priv_db.t1 to test_yesprivs@localhost; insert into t1 (f1) values ('insert 3.5.3.7-2c'); -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no -insert 3.5.3.7-1a trig 3.5.3.7-2a -update 3.5.3.7-1b trig 3.5.3.7-2b -insert 3.5.3.7-1c trig 3.5.3.7-2c +update 3.5.3.7-1b drop trigger trg4c_2; Testcase 3.5.3.7d: @@ -390,23 +359,20 @@ Grants for test_noprivs@localhost GRANT SUPER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT SELECT (f1), INSERT (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost' use priv_db; - -Trigger create disabled - should fail - Bug 8884 ------------------------------------------------- +create trigger trg4d_1 before INSERT on t1 for each row +set new.f1 = 'trig 3.5.3.7-1d'; insert into t1 (f1) values ('insert 3.5.3.7-1d'); -select f1 from t1; +ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no -insert 3.5.3.7-1a trig 3.5.3.7-2a -update 3.5.3.7-1b trig 3.5.3.7-2b -insert 3.5.3.7-1c trig 3.5.3.7-2c -insert 3.5.3.7-1d +update 3.5.3.7-1b drop trigger trg4d_1; show grants; Grants for test_yesprivs@localhost @@ -415,25 +381,18 @@ GRANT UPDATE (f1) ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' use priv_db; create trigger trg4d_2 before INSERT on t1 for each row set new.f1 = 'trig 3.5.3.7-2d'; - -SELECT priv added to bypass bug 15166 -------------------------------------- -grant SELECT (f1) on priv_db.t1 to test_yesprivs@localhost; insert into t1 (f1) values ('insert 3.5.3.7-2d'); -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no -insert 3.5.3.7-1a trig 3.5.3.7-2a -update 3.5.3.7-1b trig 3.5.3.7-2b -insert 3.5.3.7-1c trig 3.5.3.7-2c -insert 3.5.3.7-1d trig 3.5.3.7-2d +update 3.5.3.7-1b drop trigger trg4d_2; Testcase 3.5.3.8a: @@ -458,14 +417,14 @@ use priv_db; show grants; Grants for test_noprivs@localhost GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' - -Trigger create disabled - should fail - Bug 8887 ------------------------------------------------- +create trigger trg5a_1 before INSERT on t1 for each row +set @test_var = new.f1; set @test_var = 'before trig 3.5.3.8-1a'; select @test_var; @test_var before trig 3.5.3.8-1a insert into t1 (f1) values ('insert 3.5.3.8-1a'); +ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' select @test_var; @test_var before trig 3.5.3.8-1a @@ -483,10 +442,6 @@ set @test_var= 'before trig 3.5.3.8-2a'; select @test_var; @test_var before trig 3.5.3.8-2a - -UPDATE priv added to bypass bug 15166 -------------------------------------- -grant UPDATE on *.* to test_yesprivs@localhost; insert into t1 (f1) values ('insert 3.5.3.8-2a'); select @test_var; @test_var @@ -517,15 +472,15 @@ Grants for test_noprivs@localhost GRANT SUPER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE ON `priv_db`.* TO 'test_noprivs'@'localhost' use priv_db; - -Trigger create disabled - should fail - Bug 8887 ------------------------------------------------- +create trigger trg5b_1 before UPDATE on t1 for each row +set @test_var= new.f1; set @test_var= 'before trig 3.5.3.8-1b'; insert into t1 (f1) values ('insert 3.5.3.8-1b'); select @test_var; @test_var before trig 3.5.3.8-1b update t1 set f1= 'update 3.5.3.8-1b' where f1 = 'insert 3.5.3.8-1b'; +ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' select @test_var; @test_var before trig 3.5.3.8-1b @@ -542,10 +497,6 @@ insert into t1 (f1) values ('insert 3.5.3.8-2b'); select @test_var; @test_var before trig 3.5.3.8-2b - -UPDATE priv added to bypass bug 15166 -------------------------------------- -grant UPDATE on priv_db.* to test_yesprivs@localhost; update t1 set f1= 'update 3.5.3.8-2b' where f1 = 'insert 3.5.3.8-2b'; select @test_var; @test_var @@ -576,11 +527,11 @@ Grants for test_noprivs@localhost GRANT SUPER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW ON `priv_db`.`t1` TO 'test_noprivs'@'localhost' use priv_db; - -Trigger create disabled - should fail - Bug 8887 ------------------------------------------------- +create trigger trg5c_1 before INSERT on t1 for each row +set @test_var= new.f1; set @test_var= 'before trig 3.5.3.8-1c'; insert into t1 (f1) values ('insert 3.5.3.8-1c'); +ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' select @test_var; @test_var before trig 3.5.3.8-1c @@ -593,10 +544,6 @@ use priv_db; create trigger trg5c_2 before INSERT on t1 for each row set @test_var= new.f1; set @test_var='before trig 3.5.3.8-2c'; - -UPDATE priv added to bypass bug 15166 -------------------------------------- -grant UPDATE on priv_db.t1 to test_yesprivs@localhost; insert into t1 (f1) values ('insert 3.5.3.8-2c'); select @test_var; @test_var @@ -626,11 +573,11 @@ Grants for test_noprivs@localhost GRANT SUPER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost' use priv_db; - -Trigger create disabled - should fail - Bug 8887 ------------------------------------------------- +create trigger trg5d_1 before INSERT on t1 for each row +set @test_var= new.f1; set @test_var='before trig 3.5.3.8-1d'; insert into t1 (f1) values ('insert 3.5.3.8-1d'); +ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' select @test_var; @test_var before trig 3.5.3.8-1d @@ -643,10 +590,6 @@ use priv_db; create trigger trg5d_2 before INSERT on t1 for each row set @test_var= new.f1; set @test_var='before trig 3.5.3.8-2d'; - -UPDATE priv added to bypass bug 15166 -------------------------------------- -grant UPDATE (f1) on priv_db.t1 to test_yesprivs@localhost; insert into t1 (f1) values ('insert 3.5.3.8-2d'); select @test_var; @test_var @@ -658,8 +601,8 @@ Testcase: 3.5.3.x: use priv_db; drop table if exists t1; drop table if exists t2; -create table t1 (f1 int) engine= innodb; -create table t2 (f2 int) engine= innodb; +create table t1 (f1 int) engine= <engine_to_be_used>; +create table t2 (f2 int) engine= <engine_to_be_used>; revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; grant SUPER on *.* to test_yesprivs@localhost; grant SELECT, UPDATE on priv_db.t1 to test_yesprivs@localhost; @@ -682,10 +625,10 @@ ERROR 42000: INSERT command denied to user 'test_yesprivs'@'localhost' for table revoke SELECT on priv_db.t2 from test_yesprivs@localhost; grant INSERT on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (4); -select f1 from t1; +select f1 from t1 order by f1; f1 4 -select f2 from t2; +select f2 from t2 order by f2; f2 4 use priv_db; @@ -698,11 +641,11 @@ ERROR 42000: UPDATE command denied to user 'test_yesprivs'@'localhost' for table revoke INSERT on priv_db.t2 from test_yesprivs@localhost; grant UPDATE on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (2); -select f1 from t1; +select f1 from t1 order by f1; f1 -4 2 -select f2 from t2; +4 +select f2 from t2 order by f2; f2 1 use priv_db; @@ -715,12 +658,12 @@ ERROR 42000: SELECT command denied to user 'test_yesprivs'@'localhost' for table revoke UPDATE on priv_db.t2 from test_yesprivs@localhost; grant SELECT on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (1); -select f1 from t1; +select f1 from t1 order by f1; f1 -4 -2 1 -select f2 from t2; +2 +4 +select f2 from t2 order by f2; f2 1 select @aaa; @@ -736,16 +679,17 @@ ERROR 42000: DELETE command denied to user 'test_yesprivs'@'localhost' for table revoke SELECT on priv_db.t2 from test_yesprivs@localhost; grant DELETE on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (1); -select f1 from t1; +select f1 from t1 order by f1; f1 -4 -2 1 1 -select f2 from t2; +2 +4 +select f2 from t2 order by f2; f2 drop database if exists priv_db; drop user test_yesprivs@localhost; drop user test_noprivs@localhost; drop user test_noprivs; -DROP TABLE test.tb3; +use test; +drop table tb3; diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_0407.result b/mysql-test/suite/funcs_1/r/innodb_trig_0407.result index e7f2b374845..a4871065c04 100644 --- a/mysql-test/suite/funcs_1/r/innodb_trig_0407.result +++ b/mysql-test/suite/funcs_1/r/innodb_trig_0407.result @@ -1,70 +1,63 @@ USE test; -drop table if exists tb3 ; +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; +f118 char not null DEFAULT 'a', +f119 char binary not null DEFAULT b'101', +f120 char ascii not null DEFAULT b'101', +f121 char(50), +f122 char(50), +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 = <engine_to_be_used>; 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 'MYSQL_TEST_DIR/suite/funcs_1/data/innodb_tb3.txt' into table tb3 ; Testcase: 3.5: -------------- @@ -85,25 +78,25 @@ Testcase 3.5.4.1: ----------------- create database db_drop; Use db_drop; -create table t1 (f1 char(30)) engine=innodb; +create table t1 (f1 char(30)) engine = <engine_to_be_used>; grant INSERT, SELECT on db_drop.t1 to test_general; Use db_drop; -Create trigger trg1 BEFORE INSERT on t1 +Create trigger trg1 BEFORE INSERT on t1 for each row set new.f1='Trigger 3.5.4.1'; Use db_drop; Insert into t1 values ('Insert error 3.5.4.1'); -Select * from t1; +Select * from t1 order by f1; f1 Trigger 3.5.4.1 drop trigger trg1; select trigger_schema, trigger_name, event_object_table -from information_schema.triggers; +from information_schema.triggers order by trigger_name; trigger_schema trigger_name event_object_table Insert into t1 values ('Insert no trigger 3.5.4.1'); -Select * from t1; +Select * from t1 order by f1; f1 -Trigger 3.5.4.1 Insert no trigger 3.5.4.1 +Trigger 3.5.4.1 drop trigger trg1; drop database if exists db_drop; revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost'; @@ -113,7 +106,7 @@ Testcase 3.5.4.2: create database db_drop2; Use db_drop2; drop table if exists t1_432 ; -create table t1_432 (f1 char (30)) engine=innodb; +create table t1_432 (f1 char (30)) engine = <engine_to_be_used>; Drop trigger tr_does_not_exit; ERROR HY000: Trigger does not exist drop table if exists t1_432 ; @@ -125,9 +118,9 @@ create database db_drop3; Use db_drop3; drop table if exists t1_433 ; drop table if exists t1_433a ; -create table t1_433 (f1 char (30)) engine=innodb; -create table t1_433a (f1a char (5)) engine=innodb; -CREATE TRIGGER trg3 BEFORE INSERT on t1_433 for each row +create table t1_433 (f1 char (30)) engine = <engine_to_be_used>; +create table t1_433a (f1a char (5)) engine = <engine_to_be_used>; +CREATE TRIGGER trg3 BEFORE INSERT on t1_433 for each row set new.f1 = 'Trigger 3.5.4.3'; Drop trigger t1.433.trg3; 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 '.trg3' at line 1 @@ -146,9 +139,9 @@ Testcase 3.5.4.4: ----------------- create database db_drop4; Use db_drop4; -create table t1 (f1 char(30)) engine=innodb; +create table t1 (f1 char(30)) engine = <engine_to_be_used>; grant INSERT, SELECT on db_drop4.t1 to test_general; -Create trigger trg4 BEFORE INSERT on t1 +Create trigger trg4 BEFORE INSERT on t1 for each row set new.f1='Trigger 3.5.4.4'; Use db_drop4; Insert into t1 values ('Insert 3.5.4.4'); @@ -167,7 +160,7 @@ where information_schema.triggers.trigger_name='trg4'; trigger_schema trigger_name event_object_table create database db_drop4; Use db_drop4; -create table t1 (f1 char(30)) engine=innodb; +create table t1 (f1 char(30)) engine = <engine_to_be_used>; grant INSERT, SELECT on db_drop4.t1 to test_general; Insert into t1 values ('2nd Insert 3.5.4.4'); Select * from t1; @@ -182,9 +175,9 @@ Testcase 3.5.4.5: ----------------- create database db_drop5; Use db_drop5; -create table t1 (f1 char(50)) engine=innodb; +create table t1 (f1 char(50)) engine = <engine_to_be_used>; grant INSERT, SELECT on t1 to test_general; -Create trigger trg5 BEFORE INSERT on t1 +Create trigger trg5 BEFORE INSERT on t1 for each row set new.f1='Trigger 3.5.4.5'; Use db_drop5; Insert into t1 values ('Insert 3.5.4.5'); @@ -198,7 +191,7 @@ select trigger_schema, trigger_name, event_object_table from information_schema.triggers where information_schema.triggers.trigger_name='trg5'; trigger_schema trigger_name event_object_table -create table t1 (f1 char(50)) engine=innodb; +create table t1 (f1 char(50)) engine = <engine_to_be_used>; grant INSERT, SELECT on t1 to test_general; Insert into t1 values ('2nd Insert 3.5.4.5'); Select * from t1; @@ -221,7 +214,7 @@ ERROR 42S02: Table 'test.t100' doesn't exist Testcase 3.5.5.2: ----------------- Create temporary table t1_temp (f1 bigint signed, f2 bigint unsigned); -Create trigger trg2 before INSERT +Create trigger trg2 before INSERT on t1_temp for each row set new.f2=9999; ERROR HY000: Trigger's 't1_temp' is view or temporary table drop table t1_temp; @@ -229,7 +222,7 @@ drop table t1_temp; Testcase 3.5.5.3: ----------------- Create view vw3 as select f118 from tb3; -Create trigger trg3 before INSERT +Create trigger trg3 before INSERT on vw3 for each row set new.f118='s'; ERROR HY000: 'test.vw3' is not BASE TABLE drop view vw3; @@ -239,7 +232,7 @@ Testcase 3.5.5.4: create database dbtest_one; create database dbtest_two; use dbtest_two; -create table t2 (f1 char(15)) engine=innodb; +create table t2 (f1 char(15)) engine = <engine_to_be_used>; use dbtest_one; create trigger trg4 before INSERT on dbtest_two.t2 for each row set new.f1='trig 3.5.5.4'; @@ -257,7 +250,7 @@ use dbtest_one; Insert into dbtest_two.t2 values ('2nd Insert 3.5.5.4'); Warnings: Warning 1265 Data truncated for column 'f1' at row 1 -Select * from dbtest_two.t2; +Select * from dbtest_two.t2 order by f1; f1 1st Insert 3.5. 2nd Insert 3.5. @@ -310,9 +303,9 @@ drop trigger tb3.trg4_2; Testcase 3.5.7.5 / 3.5.7.6: --------------------------- -Create trigger trg5_1 BEFORE INSERT +Create trigger trg5_1 BEFORE INSERT on tb3 for each row set new.f122='Trigger1 3.5.7.5/6'; -Create trigger trg5_2 BEFORE INSERT +Create trigger trg5_2 BEFORE INSERT on tb3 for each row set new.f122='Trigger2 3.5.7.5'; ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table' Insert into tb3 (f121,f122) values ('Test 3.5.7.5/6','Insert 3.5.7.5'); @@ -330,9 +323,9 @@ delete from tb3 where f121='Test 3.5.7.5/6'; Testcase 3.5.7.7 / 3.5.7.8: --------------------------- set @test_var='Before trig 3.5.7.7'; -Create trigger trg6_1 AFTER INSERT +Create trigger trg6_1 AFTER INSERT on tb3 for each row set @test_var='Trigger1 3.5.7.7/8'; -Create trigger trg6_2 AFTER INSERT +Create trigger trg6_2 AFTER INSERT on tb3 for each row set @test_var='Trigger2 3.5.7.7'; ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table' select @test_var; @@ -358,9 +351,9 @@ delete from tb3 where f121='Test 3.5.7.7/8'; Testcase 3.5.7.9/10: -------------------- -Create trigger trg7_1 BEFORE UPDATE +Create trigger trg7_1 BEFORE UPDATE on tb3 for each row set new.f122='Trigger1 3.5.7.9/10'; -Create trigger trg7_2 BEFORE UPDATE +Create trigger trg7_2 BEFORE UPDATE on tb3 for each row set new.f122='Trigger2 3.5.7.9'; ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table' Insert into tb3 (f121,f122) values ('Test 3.5.7.9/10','Insert 3.5.7.9'); @@ -378,9 +371,9 @@ delete from tb3 where f121='Test 3.5.7.9/10'; Testcase 3.5.7.11/12: --------------------- set @test_var='Before trig 3.5.7.11'; -Create trigger trg8_1 AFTER UPDATE +Create trigger trg8_1 AFTER UPDATE on tb3 for each row set @test_var='Trigger 3.5.7.11/12'; -Create trigger trg8_2 AFTER UPDATE +Create trigger trg8_2 AFTER UPDATE on tb3 for each row set @test_var='Trigger2 3.5.7.11'; ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table' select @test_var; @@ -408,9 +401,9 @@ delete from tb3 where f121='Test 3.5.7.11/12'; Testcase 3.5.7.13/14: --------------------- set @test_var=1; -Create trigger trg9_1 BEFORE DELETE +Create trigger trg9_1 BEFORE DELETE on tb3 for each row set @test_var=@test_var+1; -Create trigger trg9_2 BEFORE DELETE +Create trigger trg9_2 BEFORE DELETE on tb3 for each row set @test_var=@test_var+10; ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table' select @test_var; @@ -440,12 +433,12 @@ delete from tb3 where f121='Test 3.5.7.13/14'; Testcase 3.5.7.15/16: --------------------- set @test_var=1; -Create trigger trg_3_406010_1 AFTER DELETE +Create trigger trg_3_406010_1 AFTER DELETE on tb3 for each row set @test_var=@test_var+5; -Create trigger trg_3_406010_2 AFTER DELETE +Create trigger trg_3_406010_2 AFTER DELETE on tb3 for each row set @test_var=@test_var+50; ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table' -Create trigger trg_3_406010_1 AFTER INSERT +Create trigger trg_3_406010_1 AFTER INSERT on tb3 for each row set @test_var=@test_var+1; ERROR HY000: Trigger already exists select @test_var; diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_08.result b/mysql-test/suite/funcs_1/r/innodb_trig_08.result index a13116df9b4..6ced07cef73 100644 --- a/mysql-test/suite/funcs_1/r/innodb_trig_08.result +++ b/mysql-test/suite/funcs_1/r/innodb_trig_08.result @@ -1,70 +1,63 @@ USE test; -drop table if exists tb3 ; +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; +f118 char not null DEFAULT 'a', +f119 char binary not null DEFAULT b'101', +f120 char ascii not null DEFAULT b'101', +f121 char(50), +f122 char(50), +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 = <engine_to_be_used>; 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 'MYSQL_TEST_DIR/suite/funcs_1/data/innodb_tb3.txt' into table tb3 ; Testcase: 3.5: -------------- @@ -89,21 +82,21 @@ create database db_test; grant SELECT, INSERT, UPDATE, DELETE on db_test.* to test_general; grant LOCK TABLES on db_test.* to test_general; Use db_test; -create table t1_i ( +create table t1_i ( i120 char ascii not null DEFAULT b'101', i136 smallint zerofill not null DEFAULT 999, i144 int zerofill not null DEFAULT 99999, -i163 decimal (63,30)) engine=innodb; -create table t1_u ( +i163 decimal (63,30)) engine=<engine_to_be_used>; +create table t1_u ( u120 char ascii not null DEFAULT b'101', u136 smallint zerofill not null DEFAULT 999, u144 int zerofill not null DEFAULT 99999, -u163 decimal (63,30)) engine=innodb; -create table t1_d ( +u163 decimal (63,30)) engine=<engine_to_be_used>; +create table t1_d ( d120 char ascii not null DEFAULT b'101', d136 smallint zerofill not null DEFAULT 999, d144 int zerofill not null DEFAULT 99999, -d163 decimal (63,30)) engine=innodb; +d163 decimal (63,30)) engine=<engine_to_be_used>; Insert into t1_u values ('a',111,99999,999.99); Insert into t1_u values ('b',222,99999,999.99); Insert into t1_u values ('c',333,99999,999.99); @@ -122,18 +115,18 @@ Insert into t1_d values ('f',222,99999,999.99); use test; Create trigger trg1 AFTER INSERT on tb3 for each row BEGIN -insert into db_test.t1_i +insert into db_test.t1_i values (new.f120, new.f136, new.f144, new.f163); -update db_test.t1_u +update db_test.t1_u set u144=new.f144, u163=new.f163 -where u136=new.f136; +where u136=new.f136; delete from db_test.t1_d where d136= new.f136; -select sum(db_test.t1_u.u163) into @test_var from db_test.t1_u -where u136= new.f136; +select sum(db_test.t1_u.u163) into @test_var from db_test.t1_u +where u136= new.f136; END// Use test; set @test_var=0; -Insert into tb3 (f120, f122, f136, f144, f163) +Insert into tb3 (f120, f122, f136, f144, f163) values ('1', 'Test 3.5.8.4', 222, 23456, 1.05); Select f120, f122, f136, f144, f163 from tb3 where f122= 'Test 3.5.8.4'; f120 f122 f136 f144 f163 @@ -161,14 +154,22 @@ select @test_var; 3.5.8.4 - single SQL - insert ----------------------------- Create trigger trg2 BEFORE UPDATE on tb3 for each row -insert into db_test.t1_i +BEGIN +insert into db_test.t1_i values (new.f120, new.f136, new.f144, new.f163); +END// +Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; +f120 f122 f136 f144 f163 +1 Test 3.5.8.4 00222 0000023456 1.050000000000000000000000000000 +select * from db_test.t1_i order by i120; +i120 i136 i144 i163 +1 00222 0000023456 1.050000000000000000000000000000 update tb3 set f120='I', f122='Test 3.5.8.4-Single Insert' where f122='Test 3.5.8.4'; Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; f120 f122 f136 f144 f163 I Test 3.5.8.4-Single Insert 00222 0000023456 1.050000000000000000000000000000 -select * from db_test.t1_i; +select * from db_test.t1_i order by i120; i120 i136 i144 i163 1 00222 0000023456 1.050000000000000000000000000000 I 00222 0000023456 1.050000000000000000000000000000 @@ -177,7 +178,7 @@ I 00222 0000023456 1.050000000000000000000000000000 ----------------------------- drop trigger trg2; Create trigger trg3 BEFORE UPDATE on tb3 for each row -update db_test.t1_u +update db_test.t1_u set u120=new.f120 where u136=new.f136; update tb3 set f120='U', f122='Test 3.5.8.4-Single Update' @@ -185,27 +186,27 @@ update tb3 set f120='U', f122='Test 3.5.8.4-Single Update' Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; f120 f122 f136 f144 f163 U Test 3.5.8.4-Single Update 00222 0000023456 1.050000000000000000000000000000 -select * from db_test.t1_u; +select * from db_test.t1_u order by u120; u120 u136 u144 u163 a 00111 0000099999 999.990000000000000000000000000000 -U 00222 0000023456 1.050000000000000000000000000000 c 00333 0000099999 999.990000000000000000000000000000 +f 00333 0000099999 999.990000000000000000000000000000 +U 00222 0000023456 1.050000000000000000000000000000 U 00222 0000023456 1.050000000000000000000000000000 U 00222 0000023456 1.050000000000000000000000000000 -f 00333 0000099999 999.990000000000000000000000000000 3.5.8.3/4 - single SQL - delete ------------------------------- drop trigger trg3; Create trigger trg4 AFTER UPDATE on tb3 for each row delete from db_test.t1_d where d136= new.f136; -update tb3 set f120='D', f136=444, +update tb3 set f120='D', f136=444, f122='Test 3.5.8.4-Single Delete' where f122='Test 3.5.8.4-Single Update'; Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; f120 f122 f136 f144 f163 D Test 3.5.8.4-Single Delete 00444 0000023456 1.050000000000000000000000000000 -select * from db_test.t1_d; +select * from db_test.t1_d order by d120; d120 d136 d144 d163 a 00111 0000099999 999.990000000000000000000000000000 c 00333 0000099999 999.990000000000000000000000000000 @@ -214,10 +215,10 @@ c 00333 0000099999 999.990000000000000000000000000000 ------------------------------- drop trigger trg4; Create trigger trg5 AFTER UPDATE on tb3 for each row -select sum(db_test.t1_u.u163) into @test_var from db_test.t1_u +select sum(db_test.t1_u.u163) into @test_var from db_test.t1_u where u136= new.f136; set @test_var=0; -update tb3 set f120='S', f136=111, +update tb3 set f120='S', f136=111, f122='Test 3.5.8.4-Single Select' where f122='Test 3.5.8.4-Single Delete'; Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; @@ -245,36 +246,36 @@ set @test_var='three', new.f120='4'; END IF; IF (new.f120='4') and (new.f136=10) then set @test_var2='2nd if', new.f120='d'; -ELSE +ELSE set @test_var2='2nd else', new.f120='D'; END IF; END// set @test_var='Empty', @test_var2=0; Insert into tb3 (f120, f122, f136) values ('1', 'Test 3.5.8.5-if', 101); -select f120, f122, f136, @test_var, @test_var2 -from tb3 where f122 = 'Test 3.5.8.5-if'; +select f120, f122, f136, @test_var, @test_var2 +from tb3 where f122 = 'Test 3.5.8.5-if' order by f136; f120 f122 f136 @test_var @test_var2 D Test 3.5.8.5-if 00101 one 2nd else Insert into tb3 (f120, f122, f136) values ('2', 'Test 3.5.8.5-if', 102); -select f120, f122, f136, @test_var, @test_var2 -from tb3 where f122 = 'Test 3.5.8.5-if'; +select f120, f122, f136, @test_var, @test_var2 +from tb3 where f122 = 'Test 3.5.8.5-if' order by f136; f120 f122 f136 @test_var @test_var2 D Test 3.5.8.5-if 00101 two 2nd else D Test 3.5.8.5-if 00102 two 2nd else Insert into tb3 (f120, f122, f136) values ('3', 'Test 3.5.8.5-if', 10); -select f120, f122, f136, @test_var, @test_var2 -from tb3 where f122 = 'Test 3.5.8.5-if'; +select f120, f122, f136, @test_var, @test_var2 +from tb3 where f122 = 'Test 3.5.8.5-if' order by f136; f120 f122 f136 @test_var @test_var2 +d Test 3.5.8.5-if 00010 three 2nd if D Test 3.5.8.5-if 00101 three 2nd if D Test 3.5.8.5-if 00102 three 2nd if -d Test 3.5.8.5-if 00010 three 2nd if Insert into tb3 (f120, f122, f136) values ('3', 'Test 3.5.8.5-if', 103); -select f120, f122, f136, @test_var, @test_var2 -from tb3 where f122 = 'Test 3.5.8.5-if'; +select f120, f122, f136, @test_var, @test_var2 +from tb3 where f122 = 'Test 3.5.8.5-if' order by f136; f120 f122 f136 @test_var @test_var2 +d Test 3.5.8.5-if 00010 three 2nd else D Test 3.5.8.5-if 00101 three 2nd else D Test 3.5.8.5-if 00102 three 2nd else -d Test 3.5.8.5-if 00010 three 2nd else D Test 3.5.8.5-if 00103 three 2nd else create trigger trg3 before update on tb3 for each row BEGIN @@ -289,7 +290,7 @@ create trigger trg4 before update on tb3 for each row BEGIN IF (new.f120='4') and (new.f136=10) then set @test_var2='2nd if', new.f120='d'; -ELSE +ELSE set @test_var2='2nd else', new.f120='D'; 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 '' at line 7 @@ -331,60 +332,60 @@ ELSE set @test_var=CONCAT(new.f120, '*', new.f144); END case; END// set @test_var='Empty'; -Insert into tb3 (f120, f122, f136, f144) +Insert into tb3 (f120, f122, f136, f144) values ('a', 'Test 3.5.8.5-case', 5, 7); -select f120, f122, f136, f144, @test_var -from tb3 where f122 = 'Test 3.5.8.5-case'; +select f120, f122, f136, f144, @test_var +from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136; f120 f122 f136 f144 @test_var A Test 3.5.8.5-case 00125 0000000007 A*seven -Insert into tb3 (f120, f122, f136, f144) +Insert into tb3 (f120, f122, f136, f144) values ('b', 'Test 3.5.8.5-case', 71,16); -select f120, f122, f136, f144, @test_var -from tb3 where f122 = 'Test 3.5.8.5-case'; +select f120, f122, f136, f144, @test_var +from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136; f120 f122 f136 f144 @test_var A Test 3.5.8.5-case 00125 0000000007 B*0000000016 B Test 3.5.8.5-case 00191 0000000016 B*0000000016 -Insert into tb3 (f120, f122, f136, f144) +Insert into tb3 (f120, f122, f136, f144) values ('c', 'Test 3.5.8.5-case', 80,1); -select f120, f122, f136, f144, @test_var -from tb3 where f122 = 'Test 3.5.8.5-case'; +select f120, f122, f136, f144, @test_var +from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136; f120 f122 f136 f144 @test_var A Test 3.5.8.5-case 00125 0000000007 C=one B Test 3.5.8.5-case 00191 0000000016 C=one C Test 3.5.8.5-case 00200 0000000001 C=one -Insert into tb3 (f120, f122, f136) +Insert into tb3 (f120, f122, f136) values ('d', 'Test 3.5.8.5-case', 152); Warnings: Warning 1265 Data truncated for column 'f120' at row 1 -select f120, f122, f136, f144, @test_var -from tb3 where f122 = 'Test 3.5.8.5-case'; +select f120, f122, f136, f144, @test_var +from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136; f120 f122 f136 f144 @test_var +1 Test 3.5.8.5-case 00152 0000099999 1*0000099999 A Test 3.5.8.5-case 00125 0000000007 1*0000099999 B Test 3.5.8.5-case 00191 0000000016 1*0000099999 C Test 3.5.8.5-case 00200 0000000001 1*0000099999 -1 Test 3.5.8.5-case 00152 0000099999 1*0000099999 -Insert into tb3 (f120, f122, f136, f144) +Insert into tb3 (f120, f122, f136, f144) values ('e', 'Test 3.5.8.5-case', 200, 8); Warnings: Warning 1265 Data truncated for column 'f120' at row 1 -select f120, f122, f136, f144, @test_var -from tb3 where f122 = 'Test 3.5.8.5-case'; +select f120, f122, f136, f144, @test_var +from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136; f120 f122 f136 f144 @test_var +1 Test 3.5.8.5-case 00152 0000099999 1=eight +1 Test 3.5.8.5-case 00200 0000000008 1=eight A Test 3.5.8.5-case 00125 0000000007 1=eight B Test 3.5.8.5-case 00191 0000000016 1=eight C Test 3.5.8.5-case 00200 0000000001 1=eight -1 Test 3.5.8.5-case 00152 0000099999 1=eight -1 Test 3.5.8.5-case 00200 0000000008 1=eight -Insert into tb3 (f120, f122, f136, f144) +Insert into tb3 (f120, f122, f136, f144) values ('f', 'Test 3.5.8.5-case', 100, 8); -select f120, f122, f136, f144, @test_var -from tb3 where f122 = 'Test 3.5.8.5-case'; +select f120, f122, f136, f144, @test_var +from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136; f120 f122 f136 f144 @test_var +1 Test 3.5.8.5-case 00152 0000099999 1=eight +1 Test 3.5.8.5-case 00200 0000000008 1=eight A Test 3.5.8.5-case 00125 0000000007 1=eight B Test 3.5.8.5-case 00191 0000000016 1=eight C Test 3.5.8.5-case 00200 0000000001 1=eight -1 Test 3.5.8.5-case 00152 0000099999 1=eight -1 Test 3.5.8.5-case 00200 0000000008 1=eight create trigger trg3a before update on tb3 for each row BEGIN CASE @@ -398,40 +399,40 @@ delete from tb3 where f121='Test 3.5.8.5-case'; Testcase 3.5.8.5-loop/leave: ---------------------------- Create trigger trg4 after insert on tb3 for each row -BEGIN +BEGIN set @counter=0, @flag='Initial'; -Label1: loop +Label1: loop if new.f136<new.f144 then set @counter='Nothing to loop'; -leave Label1; +leave Label1; else set @counter=@counter+1; if new.f136=new.f144+@counter then set @counter=concat(@counter, ' loops'); leave Label1; -end if; -end if; -iterate label1; +end if; +end if; +iterate label1; set @flag='Final'; -END loop Label1; +END loop Label1; END// -Insert into tb3 (f122, f136, f144) +Insert into tb3 (f122, f136, f144) values ('Test 3.5.8.5-loop', 2, 8); select @counter, @flag; @counter @flag Nothing to loop Initial -Insert into tb3 (f122, f136, f144) +Insert into tb3 (f122, f136, f144) values ('Test 3.5.8.5-loop', 11, 8); select @counter, @flag; @counter @flag 3 loops Initial Create trigger trg4_2 after update on tb3 for each row -BEGIN -Label1: loop +BEGIN +Label1: loop set @counter=@counter+1; -END; +END; 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 '; +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 '; END' at line 5 drop trigger trg4_2; drop trigger trg4; @@ -441,23 +442,23 @@ Testcase 3.5.8.5-repeat: ------------------------ Create trigger trg6 after insert on tb3 for each row BEGIN -rp_label: REPEAT -SET @counter1 = @counter1 + 1; +rp_label: REPEAT +SET @counter1 = @counter1 + 1; IF (@counter1 MOD 2 = 0) THEN ITERATE rp_label; END IF; -SET @counter2 = @counter2 + 1; +SET @counter2 = @counter2 + 1; UNTIL @counter1> new.f136 END REPEAT rp_label; END// set @counter1= 0, @counter2= 0; -Insert into tb3 (f122, f136) +Insert into tb3 (f122, f136) values ('Test 3.5.8.5-repeat', 13); select @counter1, @counter2; @counter1 @counter2 15 8 Create trigger trg6_2 after update on tb3 for each row BEGIN -REPEAT -SET @counter2 = @counter2 + 1; +REPEAT +SET @counter2 = @counter2 + 1; 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 'END' at line 5 drop trigger trg6; @@ -466,33 +467,62 @@ delete from tb3 where f122='Test 3.5.8.5-repeat'; Testcase 3.5.8.5-while: ----------------------- Create trigger trg7 after insert on tb3 for each row -wl_label: WHILE @counter1 < new.f136 DO -SET @counter1 = @counter1 + 1; +wl_label: WHILE @counter1 < new.f136 DO +SET @counter1 = @counter1 + 1; IF (@counter1 MOD 2 = 0) THEN ITERATE wl_label; END IF; -SET @counter2 = @counter2 + 1; +SET @counter2 = @counter2 + 1; END WHILE wl_label// set @counter1= 0, @counter2= 0; -Insert into tb3 (f122, f136) +Insert into tb3 (f122, f136) values ('Test 3.5.8.5-while', 7); select @counter1, @counter2; @counter1 @counter2 7 4 Create trigger trg7_2 after update on tb3 for each row BEGIN -WHILE @counter1 < new.f136 -SET @counter1 = @counter1 + 1; +WHILE @counter1 < new.f136 +SET @counter1 = @counter1 + 1; 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 @counter1 = @counter1 + 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 'SET @counter1 = @counter1 + 1; END' at line 4 delete from tb3 where f122='Test 3.5.8.5-while'; drop trigger trg7; Testcase 3.5.8.6: (requirement void) ------------------------------------ +CREATE PROCEDURE sp_01 () BEGIN set @v1=1; END// +CREATE TRIGGER trg8_1 BEFORE UPDATE ON tb3 FOR EACH ROW +BEGIN +CALL sp_01 (); +END// +Insert into tb3 (f120, f122, f136) values ('6', 'Test 3.5.8.6-insert', 101); +update tb3 set f120='S', f136=111, +f122='Test 3.5.8.6-tr8_1' + where f122='Test 3.5.8.6-insert'; +select f120, f122 +from tb3 where f122 like 'Test 3.5.8.6%' order by f120; +f120 f122 +S Test 3.5.8.6-tr8_1 +DROP TRIGGER trg8_1; +DROP PROCEDURE sp_01; -Testcase 3.5.8.7: (Disabled as a result of bug _____) ------------------------------------------------------ +Testcase 3.5.8.7 +---------------- +Create trigger trg9_1 before update on tb3 for each row +BEGIN +Start transaction; +Set new.f120='U'; +Commit; +END// +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +Create trigger trg9_2 before delete on tb3 for each row +BEGIN +Start transaction; +Set @var2=old.f120; +Rollback; +END// +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. drop user test_general@localhost; drop user test_general; drop user test_super@localhost; diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_09.result b/mysql-test/suite/funcs_1/r/innodb_trig_09.result index 34a430ba052..b84f4f60583 100644 --- a/mysql-test/suite/funcs_1/r/innodb_trig_09.result +++ b/mysql-test/suite/funcs_1/r/innodb_trig_09.result @@ -1,94 +1,89 @@ USE test; -drop table if exists tb3 ; +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; +f118 char not null DEFAULT 'a', +f119 char binary not null DEFAULT b'101', +f120 char ascii not null DEFAULT b'101', +f121 char(50), +f122 char(50), +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 = <engine_to_be_used>; 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 'MYSQL_TEST_DIR/suite/funcs_1/data/innodb_tb3.txt' into table tb3 ; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/memory_tb3.txt' +into table tb3; Testcase 3.5.9.1/2: ------------------- -Create trigger trg1 BEFORE UPDATE on tb3 for each row +Create trigger trg1 BEFORE UPDATE on tb3 for each row set new.f142 = 94087, @counter=@counter+1; TotalRows 10 Affected -8 +9 NotAffected -2 +1 NewValuew 0 set @counter=0; Update tb3 Set f142='1' where f130<100; -select count(*) as ExpectedChanged, @counter as TrigCounter +select count(*) as ExpectedChanged, @counter as TrigCounter from tb3 where f142=94087; ExpectedChanged TrigCounter -8 8 -select count(*) as ExpectedNotChange from tb3 +9 9 +select count(*) as ExpectedNotChange from tb3 where f130<100 and f142<>94087; ExpectedNotChange 0 -select count(*) as NonExpectedChanged from tb3 +select count(*) as NonExpectedChanged from tb3 where f130>=130 and f142=94087; NonExpectedChanged 0 @@ -116,17 +111,17 @@ set @tr_var_af_118=old.f118, @tr_var_af_121=old.f121, 0 0 0 0 0 @tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_163 0 0 0 0 0 -Insert into tb3 (f122, f136, f163) +Insert into tb3 (f122, f136, f163) values ('Test 3.5.9.3', 7, 123.17); Update tb3 Set f136=8 where f122='Test 3.5.9.3'; -select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3'; +select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3' order by f136; f118 f121 f122 f136 f163 a NULL Test 3.5.9.3 00008 123.170000000000000000000000000000 -select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, +select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_163; @tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_163 a NULL Test 3.5.9.3 7 123.170000000000000000000000000000 -select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, +select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_163; @tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_163 a NULL Test 3.5.9.3 7 123.170000000000000000000000000000 @@ -135,13 +130,13 @@ a NULL Test 3.5.9.3 7 123.170000000000000000000000000000 @tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_163 0 0 0 0 0 delete from tb3 where f122='Test 3.5.9.3'; -select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3'; +select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3' order by f136; f118 f121 f122 f136 f163 -select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, +select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_163; @tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_163 a NULL Test 3.5.9.3 8 123.170000000000000000000000000000 -select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, +select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_163; @tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_163 a NULL Test 3.5.9.3 8 123.170000000000000000000000000000 @@ -172,17 +167,17 @@ set @tr_var_af_118=new.f118, @tr_var_af_121=new.f121, 0 0 0 0 0 0 @tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_151 @tr_var_af_163 0 0 0 0 0 0 -Insert into tb3 (f122, f136, f151, f163) +Insert into tb3 (f122, f136, f151, f163) values ('Test 3.5.9.4', 7, DEFAULT, 995.24); -select f118, f121, f122, f136, f151, f163 from tb3 -where f122 like 'Test 3.5.9.4%'; +select f118, f121, f122, f136, f151, f163 from tb3 +where f122 like 'Test 3.5.9.4%' order by f163; f118 f121 f122 f136 f151 f163 a NULL Test 3.5.9.4 00007 999 995.240000000000000000000000000000 -select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, +select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_151, @tr_var_b4_163; @tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_151 @tr_var_b4_163 a NULL Test 3.5.9.4 7 999 995.240000000000000000000000000000 -select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, +select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_151, @tr_var_af_163; @tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_151 @tr_var_af_163 a NULL Test 3.5.9.4 7 999 995.240000000000000000000000000000 @@ -194,15 +189,15 @@ Update tb3 Set f122='Test 3.5.9.4-trig', f136=NULL, f151=DEFAULT, f163=NULL where f122='Test 3.5.9.4'; Warnings: Warning 1048 Column 'f136' cannot be null -select f118, f121, f122, f136, f151, f163 from tb3 -where f122 like 'Test 3.5.9.4-trig'; +select f118, f121, f122, f136, f151, f163 from tb3 +where f122 like 'Test 3.5.9.4-trig' order by f163; f118 f121 f122 f136 f151 f163 a NULL Test 3.5.9.4-trig 00000 999 NULL -select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, +select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_151, @tr_var_b4_163; @tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_151 @tr_var_b4_163 a NULL Test 3.5.9.4-trig 0 999 NULL -select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, +select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_151, @tr_var_af_163; @tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_151 @tr_var_af_163 a NULL Test 3.5.9.4-trig 0 999 NULL @@ -240,6 +235,7 @@ ERROR HY000: There is no NEW row in on DELETE trigger create trigger trg5b after DELETE on tb3 for each row set new.f122='test'; ERROR HY000: There is no NEW row in on DELETE trigger +drop trigger trg5a; drop trigger trg5b; Testcase 3.5.9.10: (implied in previous tests) diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_1011ext.result b/mysql-test/suite/funcs_1/r/innodb_trig_1011ext.result index 8976787420d..5c5db60e622 100644 --- a/mysql-test/suite/funcs_1/r/innodb_trig_1011ext.result +++ b/mysql-test/suite/funcs_1/r/innodb_trig_1011ext.result @@ -1,70 +1,65 @@ USE test; -drop table if exists tb3 ; +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; +f118 char not null DEFAULT 'a', +f119 char binary not null DEFAULT b'101', +f120 char ascii not null DEFAULT b'101', +f121 char(50), +f122 char(50), +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 = <engine_to_be_used>; 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 'MYSQL_TEST_DIR/suite/funcs_1/data/innodb_tb3.txt' into table tb3 ; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/memory_tb3.txt' +into table tb3; Testcase 3.5.10.1/2/3: ---------------------- @@ -86,7 +81,7 @@ Insert into vw11 (f122, f151) values ('Test 3.5.10.1/2/3', 1); Insert into vw11 (f122, f151) values ('Test 3.5.10.1/2/3', 2); Insert into vw11 (f122, f151) values ('Not in View', 3); select f121, f122, f151, f163 -from tb3 where f122 like 'Test 3.5.10.1/2/3%'; +from tb3 where f122 like 'Test 3.5.10.1/2/3%' order by f151; f121 f122 f151 f163 NULL Test 3.5.10.1/2/3 1 111.110000000000000000000000000000 NULL Test 3.5.10.1/2/3 2 111.110000000000000000000000000000 @@ -100,7 +95,7 @@ f121 f122 f151 f163 NULL Not in View 3 111.110000000000000000000000000000 Update vw11 set f163=1; select f121, f122, f151, f163 from tb3 -where f122 like 'Test 3.5.10.1/2/3%'; +where f122 like 'Test 3.5.10.1/2/3%' order by f151; f121 f122 f151 f163 Y Test 3.5.10.1/2/3-Update 1 1.000000000000000000000000000000 Y Test 3.5.10.1/2/3-Update 2 1.000000000000000000000000000000 @@ -114,7 +109,7 @@ before delete 0 delete from vw11 where f151=1; select f121, f122, f151, f163 from tb3 -where f122 like 'Test 3.5.10.1/2/3%'; +where f122 like 'Test 3.5.10.1/2/3%' order by f151; f121 f122 f151 f163 Y Test 3.5.10.1/2/3-Update 2 1.000000000000000000000000000000 select f121, f122, f151, f163 from vw11; @@ -134,18 +129,18 @@ delete from tb3 where f122 like 'Test 3.5.10.1/2/3%'; Testcase 3.5.10.4: ------------------ -create table tb_load (f1 int, f2 char(25),f3 int) engine=innodb; +create table tb_load (f1 int, f2 char(25),f3 int) engine = <engine_to_be_used>; Create trigger trg4 before insert on tb_load for each row set new.f3=-(new.f1 div 5), @counter= @counter+1; set @counter= 0; select @counter as 'Rows Loaded Before'; Rows Loaded Before 0 -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' into table tb_load; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t9.txt' into table tb_load; select @counter as 'Rows Loaded After'; Rows Loaded After 10 -Select * from tb_load limit 10; +Select * from tb_load order by f1 limit 10; f1 f2 f3 -5000 a` 1000 -4999 aaa 999 @@ -168,7 +163,7 @@ Testcase 3.5.10.6: (implemented in trig_frkey.test) Testcase 3.5.10.extra: ---------------------- -create table t1_sp (var136 tinyint, var151 decimal) engine=innodb; +create table t1_sp (var136 tinyint, var151 decimal) engine = <engine_to_be_used>; create trigger trg before insert on t1_sp for each row set @counter=@counter+1; create procedure trig_sp() @@ -217,12 +212,12 @@ drop table if exists t2_2; drop table if exists t2_3; drop table if exists t2_4; drop table if exists t3; -create table t1 (f1 integer) engine=innodb; -create table t2_1 (f1 integer) engine=innodb; -create table t2_2 (f1 integer) engine=innodb; -create table t2_3 (f1 integer) engine=innodb; -create table t2_4 (f1 integer) engine=innodb; -create table t3 (f1 integer) engine=innodb; +create table t1 (f1 integer) engine = <engine_to_be_used>; +create table t2_1 (f1 integer) engine = <engine_to_be_used>; +create table t2_2 (f1 integer) engine = <engine_to_be_used>; +create table t2_3 (f1 integer) engine = <engine_to_be_used>; +create table t2_4 (f1 integer) engine = <engine_to_be_used>; +create table t3 (f1 integer) engine = <engine_to_be_used>; insert into t1 values (1); create trigger tr1 after insert on t1 for each row BEGIN @@ -240,7 +235,7 @@ insert into t3 (f1) values (new.f1+1000); create trigger tr2_4 after insert on t2_4 for each row insert into t3 (f1) values (new.f1+10000); insert into t1 values (1); -select * from t3; +select * from t3 order by f1; f1 12 102 @@ -260,10 +255,10 @@ drop table if exists t1; drop table if exists t2; drop table if exists t3; drop table if exists t4; -create table t1 (f1 integer) engine = innodb; -create table t2 (f2 integer) engine = innodb; -create table t3 (f3 integer) engine = innodb; -create table t4 (f4 integer) engine = innodb; +create table t1 (f1 integer) engine = <engine_to_be_used>; +create table t2 (f2 integer) engine = <engine_to_be_used>; +create table t3 (f3 integer) engine = <engine_to_be_used>; +create table t4 (f4 integer) engine = <engine_to_be_used>; insert into t1 values (0); create trigger tr1 after insert on t1 for each row insert into t2 (f2) values (new.f1+1); @@ -275,14 +270,14 @@ create trigger tr4 after insert on t4 for each row insert into t1 (f1) values (new.f4+1); insert into t1 values (1); ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger. -select * from t1; +select * from t1 order by f1; f1 0 -select * from t2; +select * from t2 order by f2; f2 -select * from t3; +select * from t3 order by f3; f3 -select * from t4; +select * from t4 order by f4; f4 drop trigger tr1; drop trigger tr2; @@ -293,13 +288,13 @@ drop table t2; drop table t3; drop table t4; -Testcase y.y.y.4: Recursive trigger/SP references (disabled bug 11889) ----------------------------------------------------------------------- +Testcase y.y.y.4: Recursive trigger/SP references +------------------------------------------------- set @sql_mode='traditional'; create table t1_sp ( count integer, var136 tinyint, -var151 decimal) engine=innodb; +var151 decimal) engine = <engine_to_be_used>; create procedure trig_sp() begin declare done int default 0; @@ -353,7 +348,7 @@ drop procedure trig_sp; drop trigger trg; drop table t1_sp; -Testcase y.y.y.5: Roleback of nested trigger references +Testcase y.y.y.5: Rollback of nested trigger references ------------------------------------------------------- set @@sql_mode='traditional'; use test; @@ -361,10 +356,10 @@ drop table if exists t1; drop table if exists t2; drop table if exists t3; drop table if exists t4; -create table t1 (f1 integer) engine = innodb; -create table t2 (f2 integer) engine = innodb; -create table t3 (f3 integer) engine = innodb; -create table t4 (f4 tinyint) engine = innodb; +create table t1 (f1 integer) engine = <engine_to_be_used>; +create table t2 (f2 integer) engine = <engine_to_be_used>; +create table t3 (f3 integer) engine = <engine_to_be_used>; +create table t4 (f4 tinyint) engine = <engine_to_be_used>; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -382,12 +377,12 @@ start transaction; insert into t1 values (1); ERROR 22003: Out of range value adjusted for column 'f4' at row 1 commit; -select * from t1; +select * from t1 order by f1; f1 1 -select * from t2; +select * from t2 order by f2; f2 -select * from t3; +select * from t3 order by f3; f3 drop trigger tr1; drop trigger tr2; diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_frkey.result b/mysql-test/suite/funcs_1/r/innodb_trig_frkey.result index debbec1dde3..019a76b951c 100644 --- a/mysql-test/suite/funcs_1/r/innodb_trig_frkey.result +++ b/mysql-test/suite/funcs_1/r/innodb_trig_frkey.result @@ -1,140 +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 'MYSQL_TEST_DIR/suite/funcs_1/data/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; diff --git a/mysql-test/suite/funcs_1/r/innodb_views.result b/mysql-test/suite/funcs_1/r/innodb_views.result index 20d8c0ba2f3..d29e38925f6 100644 --- a/mysql-test/suite/funcs_1/r/innodb_views.result +++ b/mysql-test/suite/funcs_1/r/innodb_views.result @@ -1,117 +1,119 @@ USE test; drop table if exists tb2 ; create table tb2 ( -f59 numeric (0) unsigned, -f60 numeric (64) unsigned, -f61 numeric (0) zerofill, -f62 numeric (64) zerofill, -f63 numeric (0) unsigned zerofill, -f64 numeric (64) unsigned zerofill, -f65 numeric (0,0), -f66 numeric (63,30), -f67 numeric (0,0) unsigned, -f68 numeric (63,30) unsigned, -f69 numeric (0,0) zerofill, -f70 numeric (63,30) zerofill, -f71 numeric (0,0) unsigned zerofill, -f72 numeric (63,30) unsigned zerofill, -f73 real, -f74 real unsigned, -f75 real zerofill, -f76 real unsigned zerofill, -f77 double default 7.7, -f78 double unsigned default 7.7, -f79 double zerofill default 7.7, -f80 double unsigned zerofill default 8.8, -f81 float not null default 8.8, -f82 float unsigned not null default 8.8, -f83 float zerofill not null default 8.8, -f84 float unsigned zerofill not null default 8.8, -f85 float(0) not null default 8.8, -f86 float(23) not null default 8.8, -f87 float(0) unsigned not null default 8.8, -f88 float(23) unsigned not null default 8.8, -f89 float(0) zerofill not null default 8.8, -f90 float(23) zerofill not null default 8.8, -f91 float(0) unsigned zerofill not null default 8.8, -f92 float(23) unsigned zerofill not null default 8.8, -f93 float(24) not null default 8.8, -f94 float(53) not null default 8.8, -f95 float(24) unsigned not null default 8.8, -f96 float(53) unsigned not null default 8.8, -f97 float(24) zerofill not null default 8.8, -f98 float(53) zerofill not null default 8.8, -f99 float(24) unsigned zerofill not null default 8.8, -f100 float(53) unsigned zerofill not null default 8.8, -f101 date not null default '2000-01-01', -f102 time not null default 20, -f103 datetime not null default '2/2/2', -f104 timestamp not null default 20001231235959, -f105 year not null default 2000, -f106 year(3) not null default 2000, -f107 year(4) not null default 2000, -f108 enum("1enum","2enum") not null default "1enum", +f59 numeric (0) unsigned, +f60 numeric (64) unsigned, +f61 numeric (0) zerofill, +f62 numeric (64) zerofill, +f63 numeric (0) unsigned zerofill, +f64 numeric (64) unsigned zerofill, +f65 numeric (0,0), +f66 numeric (63,30), +f67 numeric (0,0) unsigned, +f68 numeric (63,30) unsigned, +f69 numeric (0,0) zerofill, +f70 numeric (63,30) zerofill, +f71 numeric (0,0) unsigned zerofill, +f72 numeric (63,30) unsigned zerofill, +f73 real, +f74 real unsigned, +f75 real zerofill, +f76 real unsigned zerofill, +f77 double default 7.7, +f78 double unsigned default 7.7, +f79 double zerofill default 7.7, +f80 double unsigned zerofill default 8.8, +f81 float not null default 8.8, +f82 float unsigned not null default 8.8, +f83 float zerofill not null default 8.8, +f84 float unsigned zerofill not null default 8.8, +f85 float(0) not null default 8.8, +f86 float(23) not null default 8.8, +f87 float(0) unsigned not null default 8.8, +f88 float(23) unsigned not null default 8.8, +f89 float(0) zerofill not null default 8.8, +f90 float(23) zerofill not null default 8.8, +f91 float(0) unsigned zerofill not null default 8.8, +f92 float(23) unsigned zerofill not null default 8.8, +f93 float(24) not null default 8.8, +f94 float(53) not null default 8.8, +f95 float(24) unsigned not null default 8.8, +f96 float(53) unsigned not null default 8.8, +f97 float(24) zerofill not null default 8.8, +f98 float(53) zerofill not null default 8.8, +f99 float(24) unsigned zerofill not null default 8.8, +f100 float(53) unsigned zerofill not null default 8.8, +f101 date not null default '2000-01-01', +f102 time not null default 20, +f103 datetime not null default '2/2/2', +f104 timestamp not null default 20001231235959, +f105 year not null default 2000, +f106 year(3) not null default 2000, +f107 year(4) not null default 2000, +f108 enum("1enum","2enum") not null default "1enum", f109 set("1set","2set") not null default "1set" ) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/innodb_tb2.txt' into table tb2 ; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/innodb_tb2.txt' +into table tb2; DROP DATABASE IF EXISTS test1; CREATE DATABASE test1; USE test1; drop table if exists tb2 ; create table tb2 ( -f59 numeric (0) unsigned, -f60 numeric (64) unsigned, -f61 numeric (0) zerofill, -f62 numeric (64) zerofill, -f63 numeric (0) unsigned zerofill, -f64 numeric (64) unsigned zerofill, -f65 numeric (0,0), -f66 numeric (63,30), -f67 numeric (0,0) unsigned, -f68 numeric (63,30) unsigned, -f69 numeric (0,0) zerofill, -f70 numeric (63,30) zerofill, -f71 numeric (0,0) unsigned zerofill, -f72 numeric (63,30) unsigned zerofill, -f73 real, -f74 real unsigned, -f75 real zerofill, -f76 real unsigned zerofill, -f77 double default 7.7, -f78 double unsigned default 7.7, -f79 double zerofill default 7.7, -f80 double unsigned zerofill default 8.8, -f81 float not null default 8.8, -f82 float unsigned not null default 8.8, -f83 float zerofill not null default 8.8, -f84 float unsigned zerofill not null default 8.8, -f85 float(0) not null default 8.8, -f86 float(23) not null default 8.8, -f87 float(0) unsigned not null default 8.8, -f88 float(23) unsigned not null default 8.8, -f89 float(0) zerofill not null default 8.8, -f90 float(23) zerofill not null default 8.8, -f91 float(0) unsigned zerofill not null default 8.8, -f92 float(23) unsigned zerofill not null default 8.8, -f93 float(24) not null default 8.8, -f94 float(53) not null default 8.8, -f95 float(24) unsigned not null default 8.8, -f96 float(53) unsigned not null default 8.8, -f97 float(24) zerofill not null default 8.8, -f98 float(53) zerofill not null default 8.8, -f99 float(24) unsigned zerofill not null default 8.8, -f100 float(53) unsigned zerofill not null default 8.8, -f101 date not null default '2000-01-01', -f102 time not null default 20, -f103 datetime not null default '2/2/2', -f104 timestamp not null default 20001231235959, -f105 year not null default 2000, -f106 year(3) not null default 2000, -f107 year(4) not null default 2000, -f108 enum("1enum","2enum") not null default "1enum", +f59 numeric (0) unsigned, +f60 numeric (64) unsigned, +f61 numeric (0) zerofill, +f62 numeric (64) zerofill, +f63 numeric (0) unsigned zerofill, +f64 numeric (64) unsigned zerofill, +f65 numeric (0,0), +f66 numeric (63,30), +f67 numeric (0,0) unsigned, +f68 numeric (63,30) unsigned, +f69 numeric (0,0) zerofill, +f70 numeric (63,30) zerofill, +f71 numeric (0,0) unsigned zerofill, +f72 numeric (63,30) unsigned zerofill, +f73 real, +f74 real unsigned, +f75 real zerofill, +f76 real unsigned zerofill, +f77 double default 7.7, +f78 double unsigned default 7.7, +f79 double zerofill default 7.7, +f80 double unsigned zerofill default 8.8, +f81 float not null default 8.8, +f82 float unsigned not null default 8.8, +f83 float zerofill not null default 8.8, +f84 float unsigned zerofill not null default 8.8, +f85 float(0) not null default 8.8, +f86 float(23) not null default 8.8, +f87 float(0) unsigned not null default 8.8, +f88 float(23) unsigned not null default 8.8, +f89 float(0) zerofill not null default 8.8, +f90 float(23) zerofill not null default 8.8, +f91 float(0) unsigned zerofill not null default 8.8, +f92 float(23) unsigned zerofill not null default 8.8, +f93 float(24) not null default 8.8, +f94 float(53) not null default 8.8, +f95 float(24) unsigned not null default 8.8, +f96 float(53) unsigned not null default 8.8, +f97 float(24) zerofill not null default 8.8, +f98 float(53) zerofill not null default 8.8, +f99 float(24) unsigned zerofill not null default 8.8, +f100 float(53) unsigned zerofill not null default 8.8, +f101 date not null default '2000-01-01', +f102 time not null default 20, +f103 datetime not null default '2/2/2', +f104 timestamp not null default 20001231235959, +f105 year not null default 2000, +f106 year(3) not null default 2000, +f107 year(4) not null default 2000, +f108 enum("1enum","2enum") not null default "1enum", f109 set("1set","2set") not null default "1set" ) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/innodb_tb2.txt' into table tb2 ; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/innodb_tb2.txt' +into table tb2; USE test; ! Attention: The file with the expected results is not diff --git a/mysql-test/suite/funcs_1/r/is_cml_innodb.result b/mysql-test/suite/funcs_1/r/is_cml_innodb.result new file mode 100644 index 00000000000..7c214cb770f --- /dev/null +++ b/mysql-test/suite/funcs_1/r/is_cml_innodb.result @@ -0,0 +1,97 @@ +USE test; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 +( +f1 CHAR UNICODE, +f2 CHAR(0) UNICODE, +f3 CHAR(10) UNICODE, +f5 VARCHAR(0) UNICODE, +f6 VARCHAR(255) UNICODE, +f7 VARCHAR(260) UNICODE, +f8 TEXT UNICODE, +f9 TINYTEXT UNICODE, +f10 MEDIUMTEXT UNICODE, +f11 LONGTEXT UNICODE +) ENGINE = InnoDB; +SELECT * FROM information_schema.columns +WHERE table_schema LIKE 'test%' +ORDER BY table_schema, table_name, column_name; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT +NULL test t1 f1 1 NULL YES char 1 2 NULL NULL ucs2 ucs2_general_ci char(1) select,insert,update,references +NULL test t1 f10 9 NULL YES mediumtext 8388607 16777215 NULL NULL ucs2 ucs2_general_ci mediumtext select,insert,update,references +NULL test t1 f11 10 NULL YES longtext 2147483647 4294967295 NULL NULL ucs2 ucs2_general_ci longtext select,insert,update,references +NULL test t1 f2 2 NULL YES char 0 0 NULL NULL ucs2 ucs2_general_ci char(0) select,insert,update,references +NULL test t1 f3 3 NULL YES char 10 20 NULL NULL ucs2 ucs2_general_ci char(10) select,insert,update,references +NULL test t1 f5 4 NULL YES varchar 0 0 NULL NULL ucs2 ucs2_general_ci varchar(0) select,insert,update,references +NULL test t1 f6 5 NULL YES varchar 255 510 NULL NULL ucs2 ucs2_general_ci varchar(255) select,insert,update,references +NULL test t1 f7 6 NULL YES varchar 260 520 NULL NULL ucs2 ucs2_general_ci varchar(260) select,insert,update,references +NULL test t1 f8 7 NULL YES text 32767 65535 NULL NULL ucs2 ucs2_general_ci text select,insert,update,references +NULL test t1 f9 8 NULL YES tinytext 127 255 NULL NULL ucs2 ucs2_general_ci tinytext select,insert,update,references +########################################################################## +# Show the quotient of CHARACTER_OCTET_LENGTH and CHARACTER_MAXIMUM_LENGTH +########################################################################## +SELECT DISTINCT +CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, +DATA_TYPE, +CHARACTER_SET_NAME, +COLLATION_NAME +FROM information_schema.columns +WHERE table_schema LIKE 'test%' +AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH = 1 +ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML; +COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME +SELECT DISTINCT +CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, +DATA_TYPE, +CHARACTER_SET_NAME, +COLLATION_NAME +FROM information_schema.columns +WHERE table_schema LIKE 'test%' +AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH <> 1 +ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML; +COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME +2.0000 char ucs2 ucs2_general_ci +2.0000 longtext ucs2 ucs2_general_ci +2.0000 mediumtext ucs2 ucs2_general_ci +2.0000 text ucs2 ucs2_general_ci +2.0000 varchar ucs2 ucs2_general_ci +2.0079 tinytext ucs2 ucs2_general_ci +SELECT DISTINCT +CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, +DATA_TYPE, +CHARACTER_SET_NAME, +COLLATION_NAME +FROM information_schema.columns +WHERE table_schema LIKE 'test%' +AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH IS NULL +ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML; +COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME +NULL char ucs2 ucs2_general_ci +NULL varchar ucs2 ucs2_general_ci +--> CHAR(0) is allowed (see manual), and here both CHARACHTER_* values +--> are 0, which is intended behavior, and the result of 0 / 0 IS NULL +SELECT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, +TABLE_SCHEMA, +TABLE_NAME, +COLUMN_NAME, +DATA_TYPE, +CHARACTER_MAXIMUM_LENGTH, +CHARACTER_OCTET_LENGTH, +CHARACTER_SET_NAME, +COLLATION_NAME, +COLUMN_TYPE +FROM information_schema.columns +WHERE table_schema LIKE 'test%' +ORDER BY TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION; +COL_CML TABLE_SCHEMA TABLE_NAME COLUMN_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE +2.0000 test t1 f1 char 1 2 ucs2 ucs2_general_ci char(1) +NULL test t1 f2 char 0 0 ucs2 ucs2_general_ci char(0) +2.0000 test t1 f3 char 10 20 ucs2 ucs2_general_ci char(10) +NULL test t1 f5 varchar 0 0 ucs2 ucs2_general_ci varchar(0) +2.0000 test t1 f6 varchar 255 510 ucs2 ucs2_general_ci varchar(255) +2.0000 test t1 f7 varchar 260 520 ucs2 ucs2_general_ci varchar(260) +2.0000 test t1 f8 text 32767 65535 ucs2 ucs2_general_ci text +2.0079 test t1 f9 tinytext 127 255 ucs2 ucs2_general_ci tinytext +2.0000 test t1 f10 mediumtext 8388607 16777215 ucs2 ucs2_general_ci mediumtext +2.0000 test t1 f11 longtext 2147483647 4294967295 ucs2 ucs2_general_ci longtext +DROP TABLE t1; diff --git a/mysql-test/suite/funcs_1/r/is_cml_memory.result b/mysql-test/suite/funcs_1/r/is_cml_memory.result new file mode 100644 index 00000000000..fe4b018cec3 --- /dev/null +++ b/mysql-test/suite/funcs_1/r/is_cml_memory.result @@ -0,0 +1,82 @@ +SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION'; +USE test; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 +( +f1 CHAR UNICODE, +f2 CHAR(0) UNICODE, +f3 CHAR(10) UNICODE, +f5 VARCHAR(0) UNICODE, +f6 VARCHAR(255) UNICODE, +f7 VARCHAR(260) UNICODE +) ENGINE = MEMORY; +SELECT * FROM information_schema.columns +WHERE table_schema LIKE 'test%' +ORDER BY table_schema, table_name, column_name; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT +NULL test t1 f1 1 NULL YES char 1 2 NULL NULL ucs2 ucs2_general_ci char(1) select,insert,update,references +NULL test t1 f2 2 NULL YES char 0 0 NULL NULL ucs2 ucs2_general_ci char(0) select,insert,update,references +NULL test t1 f3 3 NULL YES char 10 20 NULL NULL ucs2 ucs2_general_ci char(10) select,insert,update,references +NULL test t1 f5 4 NULL YES varchar 0 0 NULL NULL ucs2 ucs2_general_ci varchar(0) select,insert,update,references +NULL test t1 f6 5 NULL YES varchar 255 510 NULL NULL ucs2 ucs2_general_ci varchar(255) select,insert,update,references +NULL test t1 f7 6 NULL YES varchar 260 520 NULL NULL ucs2 ucs2_general_ci varchar(260) select,insert,update,references +########################################################################## +# Show the quotient of CHARACTER_OCTET_LENGTH and CHARACTER_MAXIMUM_LENGTH +########################################################################## +SELECT DISTINCT +CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, +DATA_TYPE, +CHARACTER_SET_NAME, +COLLATION_NAME +FROM information_schema.columns +WHERE table_schema LIKE 'test%' +AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH = 1 +ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML; +COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME +SELECT DISTINCT +CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, +DATA_TYPE, +CHARACTER_SET_NAME, +COLLATION_NAME +FROM information_schema.columns +WHERE table_schema LIKE 'test%' +AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH <> 1 +ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML; +COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME +2.0000 char ucs2 ucs2_general_ci +2.0000 varchar ucs2 ucs2_general_ci +SELECT DISTINCT +CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, +DATA_TYPE, +CHARACTER_SET_NAME, +COLLATION_NAME +FROM information_schema.columns +WHERE table_schema LIKE 'test%' +AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH IS NULL +ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML; +COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME +NULL char ucs2 ucs2_general_ci +NULL varchar ucs2 ucs2_general_ci +--> CHAR(0) is allowed (see manual), and here both CHARACHTER_* values +--> are 0, which is intended behavior, and the result of 0 / 0 IS NULL +SELECT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, +TABLE_SCHEMA, +TABLE_NAME, +COLUMN_NAME, +DATA_TYPE, +CHARACTER_MAXIMUM_LENGTH, +CHARACTER_OCTET_LENGTH, +CHARACTER_SET_NAME, +COLLATION_NAME, +COLUMN_TYPE +FROM information_schema.columns +WHERE table_schema LIKE 'test%' +ORDER BY TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION; +COL_CML TABLE_SCHEMA TABLE_NAME COLUMN_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE +2.0000 test t1 f1 char 1 2 ucs2 ucs2_general_ci char(1) +NULL test t1 f2 char 0 0 ucs2 ucs2_general_ci char(0) +2.0000 test t1 f3 char 10 20 ucs2 ucs2_general_ci char(10) +NULL test t1 f5 varchar 0 0 ucs2 ucs2_general_ci varchar(0) +2.0000 test t1 f6 varchar 255 510 ucs2 ucs2_general_ci varchar(255) +2.0000 test t1 f7 varchar 260 520 ucs2 ucs2_general_ci varchar(260) +DROP TABLE t1; diff --git a/mysql-test/suite/funcs_1/r/is_cml_myisam.result b/mysql-test/suite/funcs_1/r/is_cml_myisam.result new file mode 100644 index 00000000000..9808b1c1793 --- /dev/null +++ b/mysql-test/suite/funcs_1/r/is_cml_myisam.result @@ -0,0 +1,98 @@ +SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION'; +USE test; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 +( +f1 CHAR UNICODE, +f2 CHAR(0) UNICODE, +f3 CHAR(10) UNICODE, +f5 VARCHAR(0) UNICODE, +f6 VARCHAR(255) UNICODE, +f7 VARCHAR(260) UNICODE, +f8 TEXT UNICODE, +f9 TINYTEXT UNICODE, +f10 MEDIUMTEXT UNICODE, +f11 LONGTEXT UNICODE +) ENGINE = MyISAM; +SELECT * FROM information_schema.columns +WHERE table_schema LIKE 'test%' +ORDER BY table_schema, table_name, column_name; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT +NULL test t1 f1 1 NULL YES char 1 2 NULL NULL ucs2 ucs2_general_ci char(1) select,insert,update,references +NULL test t1 f10 9 NULL YES mediumtext 8388607 16777215 NULL NULL ucs2 ucs2_general_ci mediumtext select,insert,update,references +NULL test t1 f11 10 NULL YES longtext 2147483647 4294967295 NULL NULL ucs2 ucs2_general_ci longtext select,insert,update,references +NULL test t1 f2 2 NULL YES char 0 0 NULL NULL ucs2 ucs2_general_ci char(0) select,insert,update,references +NULL test t1 f3 3 NULL YES char 10 20 NULL NULL ucs2 ucs2_general_ci char(10) select,insert,update,references +NULL test t1 f5 4 NULL YES varchar 0 0 NULL NULL ucs2 ucs2_general_ci varchar(0) select,insert,update,references +NULL test t1 f6 5 NULL YES varchar 255 510 NULL NULL ucs2 ucs2_general_ci varchar(255) select,insert,update,references +NULL test t1 f7 6 NULL YES varchar 260 520 NULL NULL ucs2 ucs2_general_ci varchar(260) select,insert,update,references +NULL test t1 f8 7 NULL YES text 32767 65535 NULL NULL ucs2 ucs2_general_ci text select,insert,update,references +NULL test t1 f9 8 NULL YES tinytext 127 255 NULL NULL ucs2 ucs2_general_ci tinytext select,insert,update,references +########################################################################## +# Show the quotient of CHARACTER_OCTET_LENGTH and CHARACTER_MAXIMUM_LENGTH +########################################################################## +SELECT DISTINCT +CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, +DATA_TYPE, +CHARACTER_SET_NAME, +COLLATION_NAME +FROM information_schema.columns +WHERE table_schema LIKE 'test%' +AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH = 1 +ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML; +COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME +SELECT DISTINCT +CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, +DATA_TYPE, +CHARACTER_SET_NAME, +COLLATION_NAME +FROM information_schema.columns +WHERE table_schema LIKE 'test%' +AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH <> 1 +ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML; +COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME +2.0000 char ucs2 ucs2_general_ci +2.0000 longtext ucs2 ucs2_general_ci +2.0000 mediumtext ucs2 ucs2_general_ci +2.0000 text ucs2 ucs2_general_ci +2.0000 varchar ucs2 ucs2_general_ci +2.0079 tinytext ucs2 ucs2_general_ci +SELECT DISTINCT +CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, +DATA_TYPE, +CHARACTER_SET_NAME, +COLLATION_NAME +FROM information_schema.columns +WHERE table_schema LIKE 'test%' +AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH IS NULL +ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML; +COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME +NULL char ucs2 ucs2_general_ci +NULL varchar ucs2 ucs2_general_ci +--> CHAR(0) is allowed (see manual), and here both CHARACHTER_* values +--> are 0, which is intended behavior, and the result of 0 / 0 IS NULL +SELECT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, +TABLE_SCHEMA, +TABLE_NAME, +COLUMN_NAME, +DATA_TYPE, +CHARACTER_MAXIMUM_LENGTH, +CHARACTER_OCTET_LENGTH, +CHARACTER_SET_NAME, +COLLATION_NAME, +COLUMN_TYPE +FROM information_schema.columns +WHERE table_schema LIKE 'test%' +ORDER BY TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION; +COL_CML TABLE_SCHEMA TABLE_NAME COLUMN_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE +2.0000 test t1 f1 char 1 2 ucs2 ucs2_general_ci char(1) +NULL test t1 f2 char 0 0 ucs2 ucs2_general_ci char(0) +2.0000 test t1 f3 char 10 20 ucs2 ucs2_general_ci char(10) +NULL test t1 f5 varchar 0 0 ucs2 ucs2_general_ci varchar(0) +2.0000 test t1 f6 varchar 255 510 ucs2 ucs2_general_ci varchar(255) +2.0000 test t1 f7 varchar 260 520 ucs2 ucs2_general_ci varchar(260) +2.0000 test t1 f8 text 32767 65535 ucs2 ucs2_general_ci text +2.0079 test t1 f9 tinytext 127 255 ucs2 ucs2_general_ci tinytext +2.0000 test t1 f10 mediumtext 8388607 16777215 ucs2 ucs2_general_ci mediumtext +2.0000 test t1 f11 longtext 2147483647 4294967295 ucs2 ucs2_general_ci longtext +DROP TABLE t1; diff --git a/mysql-test/suite/funcs_1/r/is_cml_ndb.result b/mysql-test/suite/funcs_1/r/is_cml_ndb.result new file mode 100644 index 00000000000..ba6a0589ae0 --- /dev/null +++ b/mysql-test/suite/funcs_1/r/is_cml_ndb.result @@ -0,0 +1,97 @@ +USE test; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 +( +f1 CHAR UNICODE, +f2 CHAR(0) UNICODE, +f3 CHAR(10) UNICODE, +f5 VARCHAR(0) UNICODE, +f6 VARCHAR(255) UNICODE, +f7 VARCHAR(260) UNICODE, +f8 TEXT UNICODE, +f9 TINYTEXT UNICODE, +f10 MEDIUMTEXT UNICODE, +f11 LONGTEXT UNICODE +) ENGINE = NDB; +SELECT * FROM information_schema.columns +WHERE table_schema LIKE 'test%' +ORDER BY table_schema, table_name, column_name; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT +NULL test t1 f1 1 NULL YES char 1 2 NULL NULL ucs2 ucs2_general_ci char(1) select,insert,update,references +NULL test t1 f10 9 NULL YES mediumtext 8388607 16777215 NULL NULL ucs2 ucs2_general_ci mediumtext select,insert,update,references +NULL test t1 f11 10 NULL YES longtext 2147483647 4294967295 NULL NULL ucs2 ucs2_general_ci longtext select,insert,update,references +NULL test t1 f2 2 NULL YES char 0 0 NULL NULL ucs2 ucs2_general_ci char(0) select,insert,update,references +NULL test t1 f3 3 NULL YES char 10 20 NULL NULL ucs2 ucs2_general_ci char(10) select,insert,update,references +NULL test t1 f5 4 NULL YES varchar 0 0 NULL NULL ucs2 ucs2_general_ci varchar(0) select,insert,update,references +NULL test t1 f6 5 NULL YES varchar 255 510 NULL NULL ucs2 ucs2_general_ci varchar(255) select,insert,update,references +NULL test t1 f7 6 NULL YES varchar 260 520 NULL NULL ucs2 ucs2_general_ci varchar(260) select,insert,update,references +NULL test t1 f8 7 NULL YES text 32767 65535 NULL NULL ucs2 ucs2_general_ci text select,insert,update,references +NULL test t1 f9 8 NULL YES tinytext 127 255 NULL NULL ucs2 ucs2_general_ci tinytext select,insert,update,references +########################################################################## +# Show the quotient of CHARACTER_OCTET_LENGTH and CHARACTER_MAXIMUM_LENGTH +########################################################################## +SELECT DISTINCT +CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, +DATA_TYPE, +CHARACTER_SET_NAME, +COLLATION_NAME +FROM information_schema.columns +WHERE table_schema LIKE 'test%' +AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH = 1 +ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML; +COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME +SELECT DISTINCT +CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, +DATA_TYPE, +CHARACTER_SET_NAME, +COLLATION_NAME +FROM information_schema.columns +WHERE table_schema LIKE 'test%' +AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH <> 1 +ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML; +COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME +2.0000 char ucs2 ucs2_general_ci +2.0000 longtext ucs2 ucs2_general_ci +2.0000 mediumtext ucs2 ucs2_general_ci +2.0000 text ucs2 ucs2_general_ci +2.0000 varchar ucs2 ucs2_general_ci +2.0079 tinytext ucs2 ucs2_general_ci +SELECT DISTINCT +CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, +DATA_TYPE, +CHARACTER_SET_NAME, +COLLATION_NAME +FROM information_schema.columns +WHERE table_schema LIKE 'test%' +AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH IS NULL +ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML; +COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME +NULL char ucs2 ucs2_general_ci +NULL varchar ucs2 ucs2_general_ci +--> CHAR(0) is allowed (see manual), and here both CHARACHTER_* values +--> are 0, which is intended behavior, and the result of 0 / 0 IS NULL +SELECT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, +TABLE_SCHEMA, +TABLE_NAME, +COLUMN_NAME, +DATA_TYPE, +CHARACTER_MAXIMUM_LENGTH, +CHARACTER_OCTET_LENGTH, +CHARACTER_SET_NAME, +COLLATION_NAME, +COLUMN_TYPE +FROM information_schema.columns +WHERE table_schema LIKE 'test%' +ORDER BY TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION; +COL_CML TABLE_SCHEMA TABLE_NAME COLUMN_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE +2.0000 test t1 f1 char 1 2 ucs2 ucs2_general_ci char(1) +NULL test t1 f2 char 0 0 ucs2 ucs2_general_ci char(0) +2.0000 test t1 f3 char 10 20 ucs2 ucs2_general_ci char(10) +NULL test t1 f5 varchar 0 0 ucs2 ucs2_general_ci varchar(0) +2.0000 test t1 f6 varchar 255 510 ucs2 ucs2_general_ci varchar(255) +2.0000 test t1 f7 varchar 260 520 ucs2 ucs2_general_ci varchar(260) +2.0000 test t1 f8 text 32767 65535 ucs2 ucs2_general_ci text +2.0079 test t1 f9 tinytext 127 255 ucs2 ucs2_general_ci tinytext +2.0000 test t1 f10 mediumtext 8388607 16777215 ucs2 ucs2_general_ci mediumtext +2.0000 test t1 f11 longtext 2147483647 4294967295 ucs2 ucs2_general_ci longtext +DROP TABLE t1; diff --git a/mysql-test/suite/funcs_1/r/is_columns_innodb.result b/mysql-test/suite/funcs_1/r/is_columns_innodb.result index 101e7140645..aaeb58a3475 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_innodb.result +++ b/mysql-test/suite/funcs_1/r/is_columns_innodb.result @@ -3,63 +3,63 @@ CREATE DATABASE test1; USE test; drop table if exists tb1 ; create table tb1 ( -f1 char(0), -f2 char(0) binary, -f3 char(0) ascii, -f4 tinytext unicode, -f5 text, -f6 mediumtext, -f7 longtext, -f8 tinyblob, +f1 char(0), +f2 char(0) binary, +f3 char(0) ascii, +f4 tinytext, +f5 text, +f6 mediumtext, +f7 longtext, +f8 tinyblob, f9 blob, -f10 mediumblob, -f11 longblob, -f12 binary, -f13 tinyint, -f14 tinyint unsigned, -f15 tinyint zerofill, -f16 tinyint unsigned zerofill, -f17 smallint, -f18 smallint unsigned, -f19 smallint zerofill, -f20 smallint unsigned zerofill, -f21 mediumint, -f22 mediumint unsigned, -f23 mediumint zerofill, -f24 mediumint unsigned zerofill, -f25 int, -f26 int unsigned, -f27 int zerofill, -f28 int unsigned zerofill, -f29 bigint, -f30 bigint unsigned, -f31 bigint zerofill, -f32 bigint unsigned zerofill, -f33 decimal, -f34 decimal unsigned, -f35 decimal zerofill, -f36 decimal unsigned zerofill not null DEFAULT 9.9, -f37 decimal (0) not null DEFAULT 9.9, -f38 decimal (64) not null DEFAULT 9.9, -f39 decimal (0) unsigned not null DEFAULT 9.9, -f40 decimal (64) unsigned not null DEFAULT 9.9, -f41 decimal (0) zerofill not null DEFAULT 9.9, -f42 decimal (64) zerofill not null DEFAULT 9.9, -f43 decimal (0) unsigned zerofill not null DEFAULT 9.9, -f44 decimal (64) unsigned zerofill not null DEFAULT 9.9, -f45 decimal (0,0) not null DEFAULT 9.9, -f46 decimal (63,30) not null DEFAULT 9.9, -f47 decimal (0,0) unsigned not null DEFAULT 9.9, -f48 decimal (63,30) unsigned not null DEFAULT 9.9, -f49 decimal (0,0) zerofill not null DEFAULT 9.9, -f50 decimal (63,30) zerofill not null DEFAULT 9.9, -f51 decimal (0,0) unsigned zerofill not null DEFAULT 9.9, -f52 decimal (63,30) unsigned zerofill not null DEFAULT 9.9, -f53 numeric not null DEFAULT 99, -f54 numeric unsigned not null DEFAULT 99, -f55 numeric zerofill not null DEFAULT 99, -f56 numeric unsigned zerofill not null DEFAULT 99, -f57 numeric (0) not null DEFAULT 99, +f10 mediumblob, +f11 longblob, +f12 binary, +f13 tinyint, +f14 tinyint unsigned, +f15 tinyint zerofill, +f16 tinyint unsigned zerofill, +f17 smallint, +f18 smallint unsigned, +f19 smallint zerofill, +f20 smallint unsigned zerofill, +f21 mediumint, +f22 mediumint unsigned, +f23 mediumint zerofill, +f24 mediumint unsigned zerofill, +f25 int, +f26 int unsigned, +f27 int zerofill, +f28 int unsigned zerofill, +f29 bigint, +f30 bigint unsigned, +f31 bigint zerofill, +f32 bigint unsigned zerofill, +f33 decimal, +f34 decimal unsigned, +f35 decimal zerofill, +f36 decimal unsigned zerofill not null DEFAULT 9.9, +f37 decimal (0) not null DEFAULT 9.9, +f38 decimal (64) not null DEFAULT 9.9, +f39 decimal (0) unsigned not null DEFAULT 9.9, +f40 decimal (64) unsigned not null DEFAULT 9.9, +f41 decimal (0) zerofill not null DEFAULT 9.9, +f42 decimal (64) zerofill not null DEFAULT 9.9, +f43 decimal (0) unsigned zerofill not null DEFAULT 9.9, +f44 decimal (64) unsigned zerofill not null DEFAULT 9.9, +f45 decimal (0,0) not null DEFAULT 9.9, +f46 decimal (63,30) not null DEFAULT 9.9, +f47 decimal (0,0) unsigned not null DEFAULT 9.9, +f48 decimal (63,30) unsigned not null DEFAULT 9.9, +f49 decimal (0,0) zerofill not null DEFAULT 9.9, +f50 decimal (63,30) zerofill not null DEFAULT 9.9, +f51 decimal (0,0) unsigned zerofill not null DEFAULT 9.9, +f52 decimal (63,30) unsigned zerofill not null DEFAULT 9.9, +f53 numeric not null DEFAULT 99, +f54 numeric unsigned not null DEFAULT 99, +f55 numeric zerofill not null DEFAULT 99, +f56 numeric unsigned zerofill not null DEFAULT 99, +f57 numeric (0) not null DEFAULT 99, f58 numeric (64) not null DEFAULT 99 ) engine = innodb; Warnings: @@ -76,272 +76,283 @@ Note 1265 Data truncated for column 'f45' at row 1 Note 1265 Data truncated for column 'f47' at row 1 Note 1265 Data truncated for column 'f49' at row 1 Note 1265 Data truncated for column 'f51' at row 1 -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/innodb_tb1.txt' into table tb1 ; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/innodb_tb1.txt' +into table tb1; drop table if exists tb2 ; create table tb2 ( -f59 numeric (0) unsigned, -f60 numeric (64) unsigned, -f61 numeric (0) zerofill, -f62 numeric (64) zerofill, -f63 numeric (0) unsigned zerofill, -f64 numeric (64) unsigned zerofill, -f65 numeric (0,0), -f66 numeric (63,30), -f67 numeric (0,0) unsigned, -f68 numeric (63,30) unsigned, -f69 numeric (0,0) zerofill, -f70 numeric (63,30) zerofill, -f71 numeric (0,0) unsigned zerofill, -f72 numeric (63,30) unsigned zerofill, -f73 real, -f74 real unsigned, -f75 real zerofill, -f76 real unsigned zerofill, -f77 double default 7.7, -f78 double unsigned default 7.7, -f79 double zerofill default 7.7, -f80 double unsigned zerofill default 8.8, -f81 float not null default 8.8, -f82 float unsigned not null default 8.8, -f83 float zerofill not null default 8.8, -f84 float unsigned zerofill not null default 8.8, -f85 float(0) not null default 8.8, -f86 float(23) not null default 8.8, -f87 float(0) unsigned not null default 8.8, -f88 float(23) unsigned not null default 8.8, -f89 float(0) zerofill not null default 8.8, -f90 float(23) zerofill not null default 8.8, -f91 float(0) unsigned zerofill not null default 8.8, -f92 float(23) unsigned zerofill not null default 8.8, -f93 float(24) not null default 8.8, -f94 float(53) not null default 8.8, -f95 float(24) unsigned not null default 8.8, -f96 float(53) unsigned not null default 8.8, -f97 float(24) zerofill not null default 8.8, -f98 float(53) zerofill not null default 8.8, -f99 float(24) unsigned zerofill not null default 8.8, -f100 float(53) unsigned zerofill not null default 8.8, -f101 date not null default '2000-01-01', -f102 time not null default 20, -f103 datetime not null default '2/2/2', -f104 timestamp not null default 20001231235959, -f105 year not null default 2000, -f106 year(3) not null default 2000, -f107 year(4) not null default 2000, -f108 enum("1enum","2enum") not null default "1enum", +f59 numeric (0) unsigned, +f60 numeric (64) unsigned, +f61 numeric (0) zerofill, +f62 numeric (64) zerofill, +f63 numeric (0) unsigned zerofill, +f64 numeric (64) unsigned zerofill, +f65 numeric (0,0), +f66 numeric (63,30), +f67 numeric (0,0) unsigned, +f68 numeric (63,30) unsigned, +f69 numeric (0,0) zerofill, +f70 numeric (63,30) zerofill, +f71 numeric (0,0) unsigned zerofill, +f72 numeric (63,30) unsigned zerofill, +f73 real, +f74 real unsigned, +f75 real zerofill, +f76 real unsigned zerofill, +f77 double default 7.7, +f78 double unsigned default 7.7, +f79 double zerofill default 7.7, +f80 double unsigned zerofill default 8.8, +f81 float not null default 8.8, +f82 float unsigned not null default 8.8, +f83 float zerofill not null default 8.8, +f84 float unsigned zerofill not null default 8.8, +f85 float(0) not null default 8.8, +f86 float(23) not null default 8.8, +f87 float(0) unsigned not null default 8.8, +f88 float(23) unsigned not null default 8.8, +f89 float(0) zerofill not null default 8.8, +f90 float(23) zerofill not null default 8.8, +f91 float(0) unsigned zerofill not null default 8.8, +f92 float(23) unsigned zerofill not null default 8.8, +f93 float(24) not null default 8.8, +f94 float(53) not null default 8.8, +f95 float(24) unsigned not null default 8.8, +f96 float(53) unsigned not null default 8.8, +f97 float(24) zerofill not null default 8.8, +f98 float(53) zerofill not null default 8.8, +f99 float(24) unsigned zerofill not null default 8.8, +f100 float(53) unsigned zerofill not null default 8.8, +f101 date not null default '2000-01-01', +f102 time not null default 20, +f103 datetime not null default '2/2/2', +f104 timestamp not null default 20001231235959, +f105 year not null default 2000, +f106 year(3) not null default 2000, +f107 year(4) not null default 2000, +f108 enum("1enum","2enum") not null default "1enum", f109 set("1set","2set") not null default "1set" ) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/innodb_tb2.txt' into table tb2 ; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/innodb_tb2.txt' +into table tb2; 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) +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, +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 'MYSQL_TEST_DIR/suite/funcs_1/data/innodb_tb3.txt' into table tb3 ; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/innodb_tb3.txt' +into table tb3; drop table if exists tb4; create table tb4 ( -f176 numeric (0) unsigned not null DEFAULT 9, -f177 numeric (64) unsigned not null DEFAULT 9, -f178 numeric (0) zerofill not null DEFAULT 9, -f179 numeric (64) zerofill not null DEFAULT 9, -f180 numeric (0) unsigned zerofill not null DEFAULT 9, -f181 numeric (64) unsigned zerofill not null DEFAULT 9, -f182 numeric (0,0) not null DEFAULT 9, -f183 numeric (63,30) not null DEFAULT 9, -f184 numeric (0,0) unsigned not null DEFAULT 9, -f185 numeric (63,30) unsigned not null DEFAULT 9, -f186 numeric (0,0) zerofill not null DEFAULT 9, -f187 numeric (63,30) zerofill not null DEFAULT 9, -f188 numeric (0,0) unsigned zerofill not null DEFAULT 9, -f189 numeric (63,30) unsigned zerofill not null DEFAULT 9, -f190 real not null DEFAULT 88.8, -f191 real unsigned not null DEFAULT 88.8, -f192 real zerofill not null DEFAULT 88.8, -f193 real unsigned zerofill not null DEFAULT 88.8, -f194 double not null DEFAULT 55.5, -f195 double unsigned not null DEFAULT 55.5, -f196 double zerofill not null DEFAULT 55.5, -f197 double unsigned zerofill not null DEFAULT 55.5, -f198 float, -f199 float unsigned, -f200 float zerofill, -f201 float unsigned zerofill, -f202 float(0), -f203 float(23), -f204 float(0) unsigned, -f205 float(23) unsigned, -f206 float(0) zerofill, -f207 float(23) zerofill, -f208 float(0) unsigned zerofill, -f209 float(23) unsigned zerofill, -f210 float(24), -f211 float(53), -f212 float(24) unsigned, -f213 float(53) unsigned, -f214 float(24) zerofill, -f215 float(53) zerofill, -f216 float(24) unsigned zerofill, -f217 float(53) unsigned zerofill, -f218 date, -f219 time, -f220 datetime, -f221 timestamp, -f222 year, -f223 year(3), -f224 year(4), -f225 enum("1enum","2enum"), +f176 numeric (0) unsigned not null DEFAULT 9, +f177 numeric (64) unsigned not null DEFAULT 9, +f178 numeric (0) zerofill not null DEFAULT 9, +f179 numeric (64) zerofill not null DEFAULT 9, +f180 numeric (0) unsigned zerofill not null DEFAULT 9, +f181 numeric (64) unsigned zerofill not null DEFAULT 9, +f182 numeric (0,0) not null DEFAULT 9, +f183 numeric (63,30) not null DEFAULT 9, +f184 numeric (0,0) unsigned not null DEFAULT 9, +f185 numeric (63,30) unsigned not null DEFAULT 9, +f186 numeric (0,0) zerofill not null DEFAULT 9, +f187 numeric (63,30) zerofill not null DEFAULT 9, +f188 numeric (0,0) unsigned zerofill not null DEFAULT 9, +f189 numeric (63,30) unsigned zerofill not null DEFAULT 9, +f190 real not null DEFAULT 88.8, +f191 real unsigned not null DEFAULT 88.8, +f192 real zerofill not null DEFAULT 88.8, +f193 real unsigned zerofill not null DEFAULT 88.8, +f194 double not null DEFAULT 55.5, +f195 double unsigned not null DEFAULT 55.5, +f196 double zerofill not null DEFAULT 55.5, +f197 double unsigned zerofill not null DEFAULT 55.5, +f198 float, +f199 float unsigned, +f200 float zerofill, +f201 float unsigned zerofill, +f202 float(0), +f203 float(23), +f204 float(0) unsigned, +f205 float(23) unsigned, +f206 float(0) zerofill, +f207 float(23) zerofill, +f208 float(0) unsigned zerofill, +f209 float(23) unsigned zerofill, +f210 float(24), +f211 float(53), +f212 float(24) unsigned, +f213 float(53) unsigned, +f214 float(24) zerofill, +f215 float(53) zerofill, +f216 float(24) unsigned zerofill, +f217 float(53) unsigned zerofill, +f218 date, +f219 time, +f220 datetime, +f221 timestamp, +f222 year, +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; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/innodb_tb4.txt' into table tb4 ; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/innodb_tb4.txt' +into table tb4; USE test1; drop table if exists tb2 ; create table tb2 ( -f59 numeric (0) unsigned, -f60 numeric (64) unsigned, -f61 numeric (0) zerofill, -f62 numeric (64) zerofill, -f63 numeric (0) unsigned zerofill, -f64 numeric (64) unsigned zerofill, -f65 numeric (0,0), -f66 numeric (63,30), -f67 numeric (0,0) unsigned, -f68 numeric (63,30) unsigned, -f69 numeric (0,0) zerofill, -f70 numeric (63,30) zerofill, -f71 numeric (0,0) unsigned zerofill, -f72 numeric (63,30) unsigned zerofill, -f73 real, -f74 real unsigned, -f75 real zerofill, -f76 real unsigned zerofill, -f77 double default 7.7, -f78 double unsigned default 7.7, -f79 double zerofill default 7.7, -f80 double unsigned zerofill default 8.8, -f81 float not null default 8.8, -f82 float unsigned not null default 8.8, -f83 float zerofill not null default 8.8, -f84 float unsigned zerofill not null default 8.8, -f85 float(0) not null default 8.8, -f86 float(23) not null default 8.8, -f87 float(0) unsigned not null default 8.8, -f88 float(23) unsigned not null default 8.8, -f89 float(0) zerofill not null default 8.8, -f90 float(23) zerofill not null default 8.8, -f91 float(0) unsigned zerofill not null default 8.8, -f92 float(23) unsigned zerofill not null default 8.8, -f93 float(24) not null default 8.8, -f94 float(53) not null default 8.8, -f95 float(24) unsigned not null default 8.8, -f96 float(53) unsigned not null default 8.8, -f97 float(24) zerofill not null default 8.8, -f98 float(53) zerofill not null default 8.8, -f99 float(24) unsigned zerofill not null default 8.8, -f100 float(53) unsigned zerofill not null default 8.8, -f101 date not null default '2000-01-01', -f102 time not null default 20, -f103 datetime not null default '2/2/2', -f104 timestamp not null default 20001231235959, -f105 year not null default 2000, -f106 year(3) not null default 2000, -f107 year(4) not null default 2000, -f108 enum("1enum","2enum") not null default "1enum", +f59 numeric (0) unsigned, +f60 numeric (64) unsigned, +f61 numeric (0) zerofill, +f62 numeric (64) zerofill, +f63 numeric (0) unsigned zerofill, +f64 numeric (64) unsigned zerofill, +f65 numeric (0,0), +f66 numeric (63,30), +f67 numeric (0,0) unsigned, +f68 numeric (63,30) unsigned, +f69 numeric (0,0) zerofill, +f70 numeric (63,30) zerofill, +f71 numeric (0,0) unsigned zerofill, +f72 numeric (63,30) unsigned zerofill, +f73 real, +f74 real unsigned, +f75 real zerofill, +f76 real unsigned zerofill, +f77 double default 7.7, +f78 double unsigned default 7.7, +f79 double zerofill default 7.7, +f80 double unsigned zerofill default 8.8, +f81 float not null default 8.8, +f82 float unsigned not null default 8.8, +f83 float zerofill not null default 8.8, +f84 float unsigned zerofill not null default 8.8, +f85 float(0) not null default 8.8, +f86 float(23) not null default 8.8, +f87 float(0) unsigned not null default 8.8, +f88 float(23) unsigned not null default 8.8, +f89 float(0) zerofill not null default 8.8, +f90 float(23) zerofill not null default 8.8, +f91 float(0) unsigned zerofill not null default 8.8, +f92 float(23) unsigned zerofill not null default 8.8, +f93 float(24) not null default 8.8, +f94 float(53) not null default 8.8, +f95 float(24) unsigned not null default 8.8, +f96 float(53) unsigned not null default 8.8, +f97 float(24) zerofill not null default 8.8, +f98 float(53) zerofill not null default 8.8, +f99 float(24) unsigned zerofill not null default 8.8, +f100 float(53) unsigned zerofill not null default 8.8, +f101 date not null default '2000-01-01', +f102 time not null default 20, +f103 datetime not null default '2/2/2', +f104 timestamp not null default 20001231235959, +f105 year not null default 2000, +f106 year(3) not null default 2000, +f107 year(4) not null default 2000, +f108 enum("1enum","2enum") not null default "1enum", f109 set("1set","2set") not null default "1set" ) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/innodb_tb2.txt' into table tb2 ; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/innodb_tb2.txt' +into table tb2; USE test; USE test; DROP TABLE IF EXISTS t1, t2, t4, t10, t11; -CREATE TABLE t1 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = InnoDB; -CREATE TABLE t2 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = InnoDB; -CREATE TABLE t4 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = InnoDB; -CREATE TABLE t10 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = InnoDB; -CREATE TABLE t11 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = InnoDB; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t1; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t2; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t4; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t10; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t11; +CREATE TABLE t1 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +ENGINE = InnoDB; +CREATE TABLE t2 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +ENGINE = InnoDB; +CREATE TABLE t4 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +ENGINE = InnoDB; +CREATE TABLE t10 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +ENGINE = InnoDB; +CREATE TABLE t11 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +ENGINE = InnoDB; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' INTO TABLE t1; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' INTO TABLE t2; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' INTO TABLE t4; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' INTO TABLE t10; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' INTO TABLE t11; drop TABLE if exists t3; CREATE TABLE t3 (f1 char(20), f2 char(20), f3 integer) ENGINE = InnoDB; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t3.txt' INTO TABLE t3; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t3.txt' INTO TABLE t3; drop database if exists test4; CREATE database test4; use test4; -CREATE TABLE t6 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = InnoDB; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t6; +CREATE TABLE t6 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) +ENGINE = InnoDB; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' INTO TABLE t6; use test; drop TABLE if exists t7, t8; -CREATE TABLE t7 (f1 char(20), f2 char(25), f3 date, f4 int) ENGINE = InnoDB; -CREATE TABLE t8 (f1 char(20), f2 char(25), f3 date, f4 int) ENGINE = InnoDB; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' INTO TABLE t7; +CREATE TABLE t7 (f1 char(20),f2 char(25),f3 date,f4 int) ENGINE = InnoDB; +CREATE TABLE t8 (f1 char(20),f2 char(25),f3 date,f4 int) ENGINE = InnoDB; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' INTO TABLE t7; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -353,7 +364,7 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' INTO TABLE t8; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' INTO TABLE t8; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -367,7 +378,7 @@ Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 drop TABLE if exists t9; CREATE TABLE t9 (f1 int, f2 char(25), f3 int) ENGINE = InnoDB; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' INTO TABLE t9; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t9.txt' INTO TABLE t9; SELECT * FROM information_schema.columns WHERE table_schema LIKE 'test%' ORDER BY table_schema, table_name, column_name; @@ -449,7 +460,7 @@ NULL test tb1 f36 36 0000000010 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0 NULL test tb1 f37 37 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references NULL test tb1 f38 38 10 NO decimal NULL NULL 64 0 NULL NULL decimal(64,0) select,insert,update,references NULL test tb1 f39 39 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references -NULL test tb1 f4 4 NULL YES tinytext 127 255 NULL NULL ucs2 ucs2_general_ci tinytext select,insert,update,references +NULL test tb1 f4 4 NULL YES tinytext 255 255 NULL NULL latin1 latin1_swedish_ci tinytext select,insert,update,references NULL test tb1 f40 40 10 NO decimal NULL NULL 64 0 NULL NULL decimal(64,0) unsigned select,insert,update,references NULL test tb1 f41 41 0000000010 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references NULL test tb1 f42 42 0000000000000000000000000000000000000000000000000000000000000010 NO decimal NULL NULL 64 0 NULL NULL decimal(64,0) unsigned zerofill select,insert,update,references @@ -531,7 +542,7 @@ NULL test tb3 f120 3 NO char 1 1 NULL NULL latin1 latin1_swedish_ci char(1) NULL test tb3 f121 4 NULL YES tinytext 255 255 NULL NULL latin1 latin1_swedish_ci tinytext select,insert,update,references NULL test tb3 f122 5 NULL YES text 65535 65535 NULL NULL latin1 latin1_swedish_ci text select,insert,update,references NULL test tb3 f123 6 NULL YES mediumtext 16777215 16777215 NULL NULL latin1 latin1_swedish_ci mediumtext select,insert,update,references -NULL test tb3 f124 7 NULL YES longtext 2147483647 4294967295 NULL NULL ucs2 ucs2_general_ci longtext select,insert,update,references +NULL test tb3 f124 7 NULL YES longtext 4294967295 4294967295 NULL NULL latin1 latin1_swedish_ci longtext select,insert,update,references NULL test tb3 f125 8 NULL YES tinyblob 255 255 NULL NULL NULL NULL tinyblob select,insert,update,references NULL test tb3 f126 9 NULL YES blob 65535 65535 NULL NULL NULL NULL blob select,insert,update,references NULL test tb3 f127 10 NULL YES mediumblob 16777215 16777215 NULL NULL NULL NULL mediumblob select,insert,update,references @@ -634,13 +645,13 @@ NULL test tb4 f223 48 NULL YES year NULL NULL NULL NULL NULL NULL year(4) sele NULL test tb4 f224 49 NULL YES year NULL NULL NULL NULL NULL NULL year(4) select,insert,update,references NULL test tb4 f225 50 NULL YES enum 5 5 NULL NULL latin1 latin1_swedish_ci enum('1enum','2enum') select,insert,update,references NULL test tb4 f226 51 NULL YES set 9 9 NULL NULL latin1 latin1_swedish_ci set('1set','2set') select,insert,update,references -NULL test tb4 f235 52 NULL YES char 0 0 NULL NULL ucs2 ucs2_general_ci char(0) select,insert,update,references +NULL test tb4 f235 52 NULL YES char 0 0 NULL NULL latin1 latin1_swedish_ci char(0) select,insert,update,references NULL test tb4 f236 53 NULL YES char 90 90 NULL NULL latin1 latin1_swedish_ci char(90) select,insert,update,references NULL test tb4 f237 54 NULL YES char 255 255 NULL NULL latin1 latin1_swedish_ci char(255) select,insert,update,references NULL test tb4 f238 55 NULL YES varchar 0 0 NULL NULL latin1 latin1_swedish_ci varchar(0) select,insert,update,references NULL test tb4 f239 56 NULL YES varchar 20000 20000 NULL NULL latin1 latin1_bin varchar(20000) select,insert,update,references -NULL test tb4 f240 57 NULL YES varchar 2000 4000 NULL NULL ucs2 ucs2_general_ci varchar(2000) select,insert,update,references -NULL test tb4 f241 58 NULL YES char 100 200 NULL NULL ucs2 ucs2_general_ci char(100) select,insert,update,references +NULL test tb4 f240 57 NULL YES varchar 2000 2000 NULL NULL latin1 latin1_swedish_ci varchar(2000) select,insert,update,references +NULL test tb4 f241 58 NULL YES char 100 100 NULL NULL latin1 latin1_swedish_ci char(100) select,insert,update,references NULL test1 tb2 f100 42 00000000000000000008.8 NO double unsigned zerofill NULL NULL 22 NULL NULL NULL double unsigned zerofill select,insert,update,references NULL test1 tb2 f101 43 2000-01-01 NO date NULL NULL NULL NULL NULL NULL date select,insert,update,references NULL test1 tb2 f102 44 00:00:20 NO time NULL NULL NULL NULL NULL NULL time select,insert,update,references @@ -725,6 +736,7 @@ COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME 1.0000 set latin1 latin1_swedish_ci 1.0000 text latin1 latin1_swedish_ci 1.0000 tinytext latin1 latin1_swedish_ci +1.0000 varchar latin1 latin1_swedish_ci SELECT DISTINCT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, DATA_TYPE, @@ -735,10 +747,6 @@ WHERE table_schema LIKE 'test%' AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH <> 1 ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML; COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME -2.0000 char ucs2 ucs2_general_ci -2.0000 longtext ucs2 ucs2_general_ci -2.0000 varchar ucs2 ucs2_general_ci -2.0079 tinytext ucs2 ucs2_general_ci SELECT DISTINCT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, DATA_TYPE, @@ -769,7 +777,6 @@ NULL year NULL NULL NULL char latin1 latin1_bin NULL char latin1 latin1_swedish_ci NULL varchar latin1 latin1_swedish_ci -NULL char ucs2 ucs2_general_ci --> CHAR(0) is allowed (see manual), and here both CHARACHTER_* values --> are 0, which is intended behavior, and the result of 0 / 0 IS NULL SELECT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, @@ -833,7 +840,7 @@ NULL test t9 f3 int NULL NULL NULL NULL int(11) NULL test tb1 f1 char 0 0 latin1 latin1_swedish_ci char(0) NULL test tb1 f2 char 0 0 latin1 latin1_bin char(0) NULL test tb1 f3 char 0 0 latin1 latin1_swedish_ci char(0) -2.0079 test tb1 f4 tinytext 127 255 ucs2 ucs2_general_ci tinytext +1.0000 test tb1 f4 tinytext 255 255 latin1 latin1_swedish_ci tinytext 1.0000 test tb1 f5 text 65535 65535 latin1 latin1_swedish_ci text 1.0000 test tb1 f6 mediumtext 16777215 16777215 latin1 latin1_swedish_ci mediumtext 1.0000 test tb1 f7 longtext 4294967295 4294967295 latin1 latin1_swedish_ci longtext @@ -945,7 +952,7 @@ NULL test tb2 f107 year NULL NULL NULL NULL year(4) 1.0000 test tb3 f121 tinytext 255 255 latin1 latin1_swedish_ci tinytext 1.0000 test tb3 f122 text 65535 65535 latin1 latin1_swedish_ci text 1.0000 test tb3 f123 mediumtext 16777215 16777215 latin1 latin1_swedish_ci mediumtext -2.0000 test tb3 f124 longtext 2147483647 4294967295 ucs2 ucs2_general_ci longtext +1.0000 test tb3 f124 longtext 4294967295 4294967295 latin1 latin1_swedish_ci longtext 1.0000 test tb3 f125 tinyblob 255 255 NULL NULL tinyblob 1.0000 test tb3 f126 blob 65535 65535 NULL NULL blob 1.0000 test tb3 f127 mediumblob 16777215 16777215 NULL NULL mediumblob @@ -1048,13 +1055,13 @@ NULL test tb4 f223 year NULL NULL NULL NULL year(4) NULL test tb4 f224 year NULL NULL NULL NULL year(4) 1.0000 test tb4 f225 enum 5 5 latin1 latin1_swedish_ci enum('1enum','2enum') 1.0000 test tb4 f226 set 9 9 latin1 latin1_swedish_ci set('1set','2set') -NULL test tb4 f235 char 0 0 ucs2 ucs2_general_ci char(0) +NULL test tb4 f235 char 0 0 latin1 latin1_swedish_ci char(0) 1.0000 test tb4 f236 char 90 90 latin1 latin1_swedish_ci char(90) 1.0000 test tb4 f237 char 255 255 latin1 latin1_swedish_ci char(255) NULL test tb4 f238 varchar 0 0 latin1 latin1_swedish_ci varchar(0) 1.0000 test tb4 f239 varchar 20000 20000 latin1 latin1_bin varchar(20000) -2.0000 test tb4 f240 varchar 2000 4000 ucs2 ucs2_general_ci varchar(2000) -2.0000 test tb4 f241 char 100 200 ucs2 ucs2_general_ci char(100) +1.0000 test tb4 f240 varchar 2000 2000 latin1 latin1_swedish_ci varchar(2000) +1.0000 test tb4 f241 char 100 100 latin1 latin1_swedish_ci char(100) NULL test1 tb2 f59 decimal NULL NULL NULL NULL decimal(10,0) unsigned NULL test1 tb2 f60 decimal NULL NULL NULL NULL decimal(64,0) unsigned NULL test1 tb2 f61 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill diff --git a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result new file mode 100644 index 00000000000..6ad08c11c19 --- /dev/null +++ b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result @@ -0,0 +1,380 @@ +SELECT * FROM information_schema.columns +WHERE table_schema = 'information_schema' +AND table_name <> 'profiling' +ORDER BY table_schema, table_name, column_name; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT +NULL information_schema CHARACTER_SETS CHARACTER_SET_NAME 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema CHARACTER_SETS DEFAULT_COLLATE_NAME 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema CHARACTER_SETS DESCRIPTION 3 NO varchar 60 180 NULL NULL utf8 utf8_general_ci varchar(60) +NULL information_schema CHARACTER_SETS MAXLEN 4 0 NO bigint NULL NULL 19 0 NULL NULL bigint(3) +NULL information_schema COLLATIONS CHARACTER_SET_NAME 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema COLLATIONS COLLATION_NAME 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema COLLATIONS ID 3 0 NO bigint NULL NULL 19 0 NULL NULL bigint(11) +NULL information_schema COLLATIONS IS_COMPILED 5 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) +NULL information_schema COLLATIONS IS_DEFAULT 4 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) +NULL information_schema COLLATIONS SORTLEN 6 0 NO bigint NULL NULL 19 0 NULL NULL bigint(3) +NULL information_schema COLLATION_CHARACTER_SET_APPLICABILITY CHARACTER_SET_NAME 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema COLUMNS CHARACTER_MAXIMUM_LENGTH 9 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) +NULL information_schema COLUMNS CHARACTER_OCTET_LENGTH 10 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) +NULL information_schema COLUMNS CHARACTER_SET_NAME 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema COLUMNS COLLATION_NAME 14 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema COLUMNS COLUMN_COMMENT 19 NO varchar 255 765 NULL NULL utf8 utf8_general_ci varchar(255) +NULL information_schema COLUMNS COLUMN_DEFAULT 6 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext +NULL information_schema COLUMNS COLUMN_KEY 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) +NULL information_schema COLUMNS COLUMN_NAME 4 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema COLUMNS COLUMN_TYPE 15 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext +NULL information_schema COLUMNS DATA_TYPE 8 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema COLUMNS EXTRA 17 NO varchar 20 60 NULL NULL utf8 utf8_general_ci varchar(20) +NULL information_schema COLUMNS IS_NULLABLE 7 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) +NULL information_schema COLUMNS NUMERIC_PRECISION 11 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) +NULL information_schema COLUMNS NUMERIC_SCALE 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) +NULL information_schema COLUMNS ORDINAL_POSITION 5 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) +NULL information_schema COLUMNS PRIVILEGES 18 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) +NULL information_schema COLUMNS TABLE_CATALOG 1 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) +NULL information_schema COLUMNS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema COLUMNS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema COLUMN_PRIVILEGES COLUMN_NAME 5 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema COLUMN_PRIVILEGES GRANTEE 1 NO varchar 81 243 NULL NULL utf8 utf8_general_ci varchar(81) +NULL information_schema COLUMN_PRIVILEGES IS_GRANTABLE 7 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) +NULL information_schema COLUMN_PRIVILEGES PRIVILEGE_TYPE 6 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema COLUMN_PRIVILEGES TABLE_CATALOG 2 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) +NULL information_schema COLUMN_PRIVILEGES TABLE_NAME 4 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema COLUMN_PRIVILEGES TABLE_SCHEMA 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema KEY_COLUMN_USAGE COLUMN_NAME 7 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema KEY_COLUMN_USAGE CONSTRAINT_CATALOG 1 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) +NULL information_schema KEY_COLUMN_USAGE CONSTRAINT_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema KEY_COLUMN_USAGE CONSTRAINT_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema KEY_COLUMN_USAGE ORDINAL_POSITION 8 0 NO bigint NULL NULL 19 0 NULL NULL bigint(10) +NULL information_schema KEY_COLUMN_USAGE POSITION_IN_UNIQUE_CONSTRAINT 9 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(10) +NULL information_schema KEY_COLUMN_USAGE REFERENCED_COLUMN_NAME 12 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema KEY_COLUMN_USAGE REFERENCED_TABLE_NAME 11 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema KEY_COLUMN_USAGE REFERENCED_TABLE_SCHEMA 10 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema KEY_COLUMN_USAGE TABLE_CATALOG 4 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) +NULL information_schema KEY_COLUMN_USAGE TABLE_NAME 6 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema KEY_COLUMN_USAGE TABLE_SCHEMA 5 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema ROUTINES CREATED 16 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime +NULL information_schema ROUTINES DEFINER 20 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) +NULL information_schema ROUTINES DTD_IDENTIFIER 6 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema ROUTINES EXTERNAL_LANGUAGE 10 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema ROUTINES EXTERNAL_NAME 9 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema ROUTINES IS_DETERMINISTIC 12 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) +NULL information_schema ROUTINES LAST_ALTERED 17 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime +NULL information_schema ROUTINES PARAMETER_STYLE 11 NO varchar 8 24 NULL NULL utf8 utf8_general_ci varchar(8) +NULL information_schema ROUTINES ROUTINE_BODY 7 NO varchar 8 24 NULL NULL utf8 utf8_general_ci varchar(8) +NULL information_schema ROUTINES ROUTINE_CATALOG 2 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) +NULL information_schema ROUTINES ROUTINE_COMMENT 19 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema ROUTINES ROUTINE_DEFINITION 8 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext +NULL information_schema ROUTINES ROUTINE_NAME 4 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema ROUTINES ROUTINE_SCHEMA 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema ROUTINES ROUTINE_TYPE 5 NO varchar 9 27 NULL NULL utf8 utf8_general_ci varchar(9) +NULL information_schema ROUTINES SECURITY_TYPE 15 NO varchar 7 21 NULL NULL utf8 utf8_general_ci varchar(7) +NULL information_schema ROUTINES SPECIFIC_NAME 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema ROUTINES SQL_DATA_ACCESS 13 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema ROUTINES SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext +NULL information_schema ROUTINES SQL_PATH 14 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema SCHEMATA CATALOG_NAME 1 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) +NULL information_schema SCHEMATA DEFAULT_CHARACTER_SET_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema SCHEMATA DEFAULT_COLLATION_NAME 4 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema SCHEMATA SCHEMA_NAME 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema SCHEMATA SQL_PATH 5 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) +NULL information_schema SCHEMA_PRIVILEGES GRANTEE 1 NO varchar 81 243 NULL NULL utf8 utf8_general_ci varchar(81) +NULL information_schema SCHEMA_PRIVILEGES IS_GRANTABLE 5 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) +NULL information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE 4 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema SCHEMA_PRIVILEGES TABLE_CATALOG 2 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) +NULL information_schema SCHEMA_PRIVILEGES TABLE_SCHEMA 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema STATISTICS CARDINALITY 10 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) +NULL information_schema STATISTICS COLLATION 9 NULL YES varchar 1 3 NULL NULL utf8 utf8_general_ci varchar(1) +NULL information_schema STATISTICS COLUMN_NAME 8 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema STATISTICS COMMENT 15 NULL YES varchar 16 48 NULL NULL utf8 utf8_general_ci varchar(16) +NULL information_schema STATISTICS INDEX_NAME 6 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema STATISTICS INDEX_SCHEMA 5 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema STATISTICS INDEX_TYPE 14 NO varchar 16 48 NULL NULL utf8 utf8_general_ci varchar(16) +NULL information_schema STATISTICS NON_UNIQUE 4 0 NO bigint NULL NULL 19 0 NULL NULL bigint(1) +NULL information_schema STATISTICS NULLABLE 13 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) +NULL information_schema STATISTICS PACKED 12 NULL YES varchar 10 30 NULL NULL utf8 utf8_general_ci varchar(10) +NULL information_schema STATISTICS SEQ_IN_INDEX 7 0 NO bigint NULL NULL 19 0 NULL NULL bigint(2) +NULL information_schema STATISTICS SUB_PART 11 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(3) +NULL information_schema STATISTICS TABLE_CATALOG 1 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) +NULL information_schema STATISTICS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema STATISTICS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema TABLES AUTO_INCREMENT 14 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) +NULL information_schema TABLES AVG_ROW_LENGTH 9 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) +NULL information_schema TABLES CHECKSUM 19 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) +NULL information_schema TABLES CHECK_TIME 17 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime +NULL information_schema TABLES CREATE_OPTIONS 20 NULL YES varchar 255 765 NULL NULL utf8 utf8_general_ci varchar(255) +NULL information_schema TABLES CREATE_TIME 15 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime +NULL information_schema TABLES DATA_FREE 13 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) +NULL information_schema TABLES DATA_LENGTH 10 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) +NULL information_schema TABLES ENGINE 5 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema TABLES INDEX_LENGTH 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) +NULL information_schema TABLES MAX_DATA_LENGTH 11 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) +NULL information_schema TABLES ROW_FORMAT 7 NULL YES varchar 10 30 NULL NULL utf8 utf8_general_ci varchar(10) +NULL information_schema TABLES TABLE_CATALOG 1 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) +NULL information_schema TABLES TABLE_COLLATION 18 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema TABLES TABLE_COMMENT 21 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) +NULL information_schema TABLES TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema TABLES TABLE_ROWS 8 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) +NULL information_schema TABLES TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema TABLES TABLE_TYPE 4 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema TABLES UPDATE_TIME 16 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime +NULL information_schema TABLES VERSION 6 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) +NULL information_schema TABLE_CONSTRAINTS CONSTRAINT_CATALOG 1 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) +NULL information_schema TABLE_CONSTRAINTS CONSTRAINT_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema TABLE_CONSTRAINTS CONSTRAINT_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema TABLE_CONSTRAINTS CONSTRAINT_TYPE 6 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema TABLE_CONSTRAINTS TABLE_NAME 5 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema TABLE_CONSTRAINTS TABLE_SCHEMA 4 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema TABLE_PRIVILEGES GRANTEE 1 NO varchar 81 243 NULL NULL utf8 utf8_general_ci varchar(81) +NULL information_schema TABLE_PRIVILEGES IS_GRANTABLE 6 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) +NULL information_schema TABLE_PRIVILEGES PRIVILEGE_TYPE 5 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema TABLE_PRIVILEGES TABLE_CATALOG 2 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) +NULL information_schema TABLE_PRIVILEGES TABLE_NAME 4 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema TABLE_PRIVILEGES TABLE_SCHEMA 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema TRIGGERS ACTION_CONDITION 9 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext +NULL information_schema TRIGGERS ACTION_ORDER 8 0 NO bigint NULL NULL 19 0 NULL NULL bigint(4) +NULL information_schema TRIGGERS ACTION_ORIENTATION 11 NO varchar 9 27 NULL NULL utf8 utf8_general_ci varchar(9) +NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_ROW 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) +NULL information_schema TRIGGERS ACTION_REFERENCE_NEW_TABLE 14 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_ROW 15 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) +NULL information_schema TRIGGERS ACTION_REFERENCE_OLD_TABLE 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema TRIGGERS ACTION_STATEMENT 10 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext +NULL information_schema TRIGGERS ACTION_TIMING 12 NO varchar 6 18 NULL NULL utf8 utf8_general_ci varchar(6) +NULL information_schema TRIGGERS CREATED 17 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime +NULL information_schema TRIGGERS DEFINER 19 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext +NULL information_schema TRIGGERS EVENT_MANIPULATION 4 NO varchar 6 18 NULL NULL utf8 utf8_general_ci varchar(6) +NULL information_schema TRIGGERS EVENT_OBJECT_CATALOG 5 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) +NULL information_schema TRIGGERS EVENT_OBJECT_SCHEMA 6 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema TRIGGERS EVENT_OBJECT_TABLE 7 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema TRIGGERS SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext +NULL information_schema TRIGGERS TRIGGER_CATALOG 1 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) +NULL information_schema TRIGGERS TRIGGER_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema TRIGGERS TRIGGER_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema USER_PRIVILEGES GRANTEE 1 NO varchar 81 243 NULL NULL utf8 utf8_general_ci varchar(81) +NULL information_schema USER_PRIVILEGES IS_GRANTABLE 4 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) +NULL information_schema USER_PRIVILEGES PRIVILEGE_TYPE 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema USER_PRIVILEGES TABLE_CATALOG 2 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) +NULL information_schema VIEWS CHECK_OPTION 5 NO varchar 8 24 NULL NULL utf8 utf8_general_ci varchar(8) +NULL information_schema VIEWS DEFINER 7 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) +NULL information_schema VIEWS IS_UPDATABLE 6 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) +NULL information_schema VIEWS SECURITY_TYPE 8 NO varchar 7 21 NULL NULL utf8 utf8_general_ci varchar(7) +NULL information_schema VIEWS TABLE_CATALOG 1 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) +NULL information_schema VIEWS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema VIEWS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) +NULL information_schema VIEWS VIEW_DEFINITION 4 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext +########################################################################## +# Show the quotient of CHARACTER_OCTET_LENGTH and CHARACTER_MAXIMUM_LENGTH +########################################################################## +SELECT DISTINCT +CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, +DATA_TYPE, +CHARACTER_SET_NAME, +COLLATION_NAME +FROM information_schema.columns +WHERE table_schema = 'information_schema' +AND table_name <> 'profiling' +AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH = 1 +ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML; +COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME +1.0000 longtext utf8 utf8_general_ci +SELECT DISTINCT +CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, +DATA_TYPE, +CHARACTER_SET_NAME, +COLLATION_NAME +FROM information_schema.columns +WHERE table_schema = 'information_schema' +AND table_name <> 'profiling' +AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH <> 1 +ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML; +COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME +3.0000 varchar utf8 utf8_general_ci +SELECT DISTINCT +CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, +DATA_TYPE, +CHARACTER_SET_NAME, +COLLATION_NAME +FROM information_schema.columns +WHERE table_schema = 'information_schema' +AND table_name <> 'profiling' +AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH IS NULL +ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML; +COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME +NULL bigint NULL NULL +NULL datetime NULL NULL +--> CHAR(0) is allowed (see manual), and here both CHARACHTER_* values +--> are 0, which is intended behavior, and the result of 0 / 0 IS NULL +SELECT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, +TABLE_SCHEMA, +TABLE_NAME, +COLUMN_NAME, +DATA_TYPE, +CHARACTER_MAXIMUM_LENGTH, +CHARACTER_OCTET_LENGTH, +CHARACTER_SET_NAME, +COLLATION_NAME, +COLUMN_TYPE +FROM information_schema.columns +WHERE table_schema = 'information_schema' +AND table_name <> 'profiling' +ORDER BY TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION; +COL_CML TABLE_SCHEMA TABLE_NAME COLUMN_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE +3.0000 information_schema CHARACTER_SETS CHARACTER_SET_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema CHARACTER_SETS DEFAULT_COLLATE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema CHARACTER_SETS DESCRIPTION varchar 60 180 utf8 utf8_general_ci varchar(60) +NULL information_schema CHARACTER_SETS MAXLEN bigint NULL NULL NULL NULL bigint(3) +3.0000 information_schema COLLATIONS COLLATION_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema COLLATIONS CHARACTER_SET_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +NULL information_schema COLLATIONS ID bigint NULL NULL NULL NULL bigint(11) +3.0000 information_schema COLLATIONS IS_DEFAULT varchar 3 9 utf8 utf8_general_ci varchar(3) +3.0000 information_schema COLLATIONS IS_COMPILED varchar 3 9 utf8 utf8_general_ci varchar(3) +NULL information_schema COLLATIONS SORTLEN bigint NULL NULL NULL NULL bigint(3) +3.0000 information_schema COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema COLLATION_CHARACTER_SET_APPLICABILITY CHARACTER_SET_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema COLUMNS TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) +3.0000 information_schema COLUMNS TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema COLUMNS TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema COLUMNS COLUMN_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +NULL information_schema COLUMNS ORDINAL_POSITION bigint NULL NULL NULL NULL bigint(21) +1.0000 information_schema COLUMNS COLUMN_DEFAULT longtext 4294967295 4294967295 utf8 utf8_general_ci longtext +3.0000 information_schema COLUMNS IS_NULLABLE varchar 3 9 utf8 utf8_general_ci varchar(3) +3.0000 information_schema COLUMNS DATA_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64) +NULL information_schema COLUMNS CHARACTER_MAXIMUM_LENGTH bigint NULL NULL NULL NULL bigint(21) +NULL information_schema COLUMNS CHARACTER_OCTET_LENGTH bigint NULL NULL NULL NULL bigint(21) +NULL information_schema COLUMNS NUMERIC_PRECISION bigint NULL NULL NULL NULL bigint(21) +NULL information_schema COLUMNS NUMERIC_SCALE bigint NULL NULL NULL NULL bigint(21) +3.0000 information_schema COLUMNS CHARACTER_SET_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema COLUMNS COLLATION_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +1.0000 information_schema COLUMNS COLUMN_TYPE longtext 4294967295 4294967295 utf8 utf8_general_ci longtext +3.0000 information_schema COLUMNS COLUMN_KEY varchar 3 9 utf8 utf8_general_ci varchar(3) +3.0000 information_schema COLUMNS EXTRA varchar 20 60 utf8 utf8_general_ci varchar(20) +3.0000 information_schema COLUMNS PRIVILEGES varchar 80 240 utf8 utf8_general_ci varchar(80) +3.0000 information_schema COLUMNS COLUMN_COMMENT varchar 255 765 utf8 utf8_general_ci varchar(255) +3.0000 information_schema COLUMN_PRIVILEGES GRANTEE varchar 81 243 utf8 utf8_general_ci varchar(81) +3.0000 information_schema COLUMN_PRIVILEGES TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) +3.0000 information_schema COLUMN_PRIVILEGES TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema COLUMN_PRIVILEGES TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema COLUMN_PRIVILEGES COLUMN_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema COLUMN_PRIVILEGES PRIVILEGE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema COLUMN_PRIVILEGES IS_GRANTABLE varchar 3 9 utf8 utf8_general_ci varchar(3) +3.0000 information_schema KEY_COLUMN_USAGE CONSTRAINT_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) +3.0000 information_schema KEY_COLUMN_USAGE CONSTRAINT_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema KEY_COLUMN_USAGE CONSTRAINT_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema KEY_COLUMN_USAGE TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) +3.0000 information_schema KEY_COLUMN_USAGE TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema KEY_COLUMN_USAGE TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema KEY_COLUMN_USAGE COLUMN_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +NULL information_schema KEY_COLUMN_USAGE ORDINAL_POSITION bigint NULL NULL NULL NULL bigint(10) +NULL information_schema KEY_COLUMN_USAGE POSITION_IN_UNIQUE_CONSTRAINT bigint NULL NULL NULL NULL bigint(10) +3.0000 information_schema KEY_COLUMN_USAGE REFERENCED_TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema KEY_COLUMN_USAGE REFERENCED_TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema KEY_COLUMN_USAGE REFERENCED_COLUMN_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema ROUTINES SPECIFIC_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema ROUTINES ROUTINE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) +3.0000 information_schema ROUTINES ROUTINE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema ROUTINES ROUTINE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema ROUTINES ROUTINE_TYPE varchar 9 27 utf8 utf8_general_ci varchar(9) +3.0000 information_schema ROUTINES DTD_IDENTIFIER varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema ROUTINES ROUTINE_BODY varchar 8 24 utf8 utf8_general_ci varchar(8) +1.0000 information_schema ROUTINES ROUTINE_DEFINITION longtext 4294967295 4294967295 utf8 utf8_general_ci longtext +3.0000 information_schema ROUTINES EXTERNAL_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema ROUTINES EXTERNAL_LANGUAGE varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema ROUTINES PARAMETER_STYLE varchar 8 24 utf8 utf8_general_ci varchar(8) +3.0000 information_schema ROUTINES IS_DETERMINISTIC varchar 3 9 utf8 utf8_general_ci varchar(3) +3.0000 information_schema ROUTINES SQL_DATA_ACCESS varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema ROUTINES SQL_PATH varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema ROUTINES SECURITY_TYPE varchar 7 21 utf8 utf8_general_ci varchar(7) +NULL information_schema ROUTINES CREATED datetime NULL NULL NULL NULL datetime +NULL information_schema ROUTINES LAST_ALTERED datetime NULL NULL NULL NULL datetime +1.0000 information_schema ROUTINES SQL_MODE longtext 4294967295 4294967295 utf8 utf8_general_ci longtext +3.0000 information_schema ROUTINES ROUTINE_COMMENT varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema ROUTINES DEFINER varchar 77 231 utf8 utf8_general_ci varchar(77) +3.0000 information_schema SCHEMATA CATALOG_NAME varchar 512 1536 utf8 utf8_general_ci varchar(512) +3.0000 information_schema SCHEMATA SCHEMA_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema SCHEMATA DEFAULT_CHARACTER_SET_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema SCHEMATA DEFAULT_COLLATION_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema SCHEMATA SQL_PATH varchar 512 1536 utf8 utf8_general_ci varchar(512) +3.0000 information_schema SCHEMA_PRIVILEGES GRANTEE varchar 81 243 utf8 utf8_general_ci varchar(81) +3.0000 information_schema SCHEMA_PRIVILEGES TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) +3.0000 information_schema SCHEMA_PRIVILEGES TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema SCHEMA_PRIVILEGES IS_GRANTABLE varchar 3 9 utf8 utf8_general_ci varchar(3) +3.0000 information_schema STATISTICS TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) +3.0000 information_schema STATISTICS TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema STATISTICS TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +NULL information_schema STATISTICS NON_UNIQUE bigint NULL NULL NULL NULL bigint(1) +3.0000 information_schema STATISTICS INDEX_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema STATISTICS INDEX_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +NULL information_schema STATISTICS SEQ_IN_INDEX bigint NULL NULL NULL NULL bigint(2) +3.0000 information_schema STATISTICS COLUMN_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema STATISTICS COLLATION varchar 1 3 utf8 utf8_general_ci varchar(1) +NULL information_schema STATISTICS CARDINALITY bigint NULL NULL NULL NULL bigint(21) +NULL information_schema STATISTICS SUB_PART bigint NULL NULL NULL NULL bigint(3) +3.0000 information_schema STATISTICS PACKED varchar 10 30 utf8 utf8_general_ci varchar(10) +3.0000 information_schema STATISTICS NULLABLE varchar 3 9 utf8 utf8_general_ci varchar(3) +3.0000 information_schema STATISTICS INDEX_TYPE varchar 16 48 utf8 utf8_general_ci varchar(16) +3.0000 information_schema STATISTICS COMMENT varchar 16 48 utf8 utf8_general_ci varchar(16) +3.0000 information_schema TABLES TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) +3.0000 information_schema TABLES TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema TABLES TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema TABLES TABLE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema TABLES ENGINE varchar 64 192 utf8 utf8_general_ci varchar(64) +NULL information_schema TABLES VERSION bigint NULL NULL NULL NULL bigint(21) +3.0000 information_schema TABLES ROW_FORMAT varchar 10 30 utf8 utf8_general_ci varchar(10) +NULL information_schema TABLES TABLE_ROWS bigint NULL NULL NULL NULL bigint(21) +NULL information_schema TABLES AVG_ROW_LENGTH bigint NULL NULL NULL NULL bigint(21) +NULL information_schema TABLES DATA_LENGTH bigint NULL NULL NULL NULL bigint(21) +NULL information_schema TABLES MAX_DATA_LENGTH bigint NULL NULL NULL NULL bigint(21) +NULL information_schema TABLES INDEX_LENGTH bigint NULL NULL NULL NULL bigint(21) +NULL information_schema TABLES DATA_FREE bigint NULL NULL NULL NULL bigint(21) +NULL information_schema TABLES AUTO_INCREMENT bigint NULL NULL NULL NULL bigint(21) +NULL information_schema TABLES CREATE_TIME datetime NULL NULL NULL NULL datetime +NULL information_schema TABLES UPDATE_TIME datetime NULL NULL NULL NULL datetime +NULL information_schema TABLES CHECK_TIME datetime NULL NULL NULL NULL datetime +3.0000 information_schema TABLES TABLE_COLLATION varchar 64 192 utf8 utf8_general_ci varchar(64) +NULL information_schema TABLES CHECKSUM bigint NULL NULL NULL NULL bigint(21) +3.0000 information_schema TABLES CREATE_OPTIONS varchar 255 765 utf8 utf8_general_ci varchar(255) +3.0000 information_schema TABLES TABLE_COMMENT varchar 80 240 utf8 utf8_general_ci varchar(80) +3.0000 information_schema TABLE_CONSTRAINTS CONSTRAINT_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) +3.0000 information_schema TABLE_CONSTRAINTS CONSTRAINT_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema TABLE_CONSTRAINTS CONSTRAINT_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema TABLE_CONSTRAINTS TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema TABLE_CONSTRAINTS TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema TABLE_CONSTRAINTS CONSTRAINT_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema TABLE_PRIVILEGES GRANTEE varchar 81 243 utf8 utf8_general_ci varchar(81) +3.0000 information_schema TABLE_PRIVILEGES TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) +3.0000 information_schema TABLE_PRIVILEGES TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema TABLE_PRIVILEGES TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema TABLE_PRIVILEGES PRIVILEGE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema TABLE_PRIVILEGES IS_GRANTABLE varchar 3 9 utf8 utf8_general_ci varchar(3) +3.0000 information_schema TRIGGERS TRIGGER_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) +3.0000 information_schema TRIGGERS TRIGGER_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema TRIGGERS TRIGGER_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema TRIGGERS EVENT_MANIPULATION varchar 6 18 utf8 utf8_general_ci varchar(6) +3.0000 information_schema TRIGGERS EVENT_OBJECT_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) +3.0000 information_schema TRIGGERS EVENT_OBJECT_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema TRIGGERS EVENT_OBJECT_TABLE varchar 64 192 utf8 utf8_general_ci varchar(64) +NULL information_schema TRIGGERS ACTION_ORDER bigint NULL NULL NULL NULL bigint(4) +1.0000 information_schema TRIGGERS ACTION_CONDITION longtext 4294967295 4294967295 utf8 utf8_general_ci longtext +1.0000 information_schema TRIGGERS ACTION_STATEMENT longtext 4294967295 4294967295 utf8 utf8_general_ci longtext +3.0000 information_schema TRIGGERS ACTION_ORIENTATION varchar 9 27 utf8 utf8_general_ci varchar(9) +3.0000 information_schema TRIGGERS ACTION_TIMING varchar 6 18 utf8 utf8_general_ci varchar(6) +3.0000 information_schema TRIGGERS ACTION_REFERENCE_OLD_TABLE varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema TRIGGERS ACTION_REFERENCE_NEW_TABLE varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema TRIGGERS ACTION_REFERENCE_OLD_ROW varchar 3 9 utf8 utf8_general_ci varchar(3) +3.0000 information_schema TRIGGERS ACTION_REFERENCE_NEW_ROW varchar 3 9 utf8 utf8_general_ci varchar(3) +NULL information_schema TRIGGERS CREATED datetime NULL NULL NULL NULL datetime +1.0000 information_schema TRIGGERS SQL_MODE longtext 4294967295 4294967295 utf8 utf8_general_ci longtext +1.0000 information_schema TRIGGERS DEFINER longtext 4294967295 4294967295 utf8 utf8_general_ci longtext +3.0000 information_schema USER_PRIVILEGES GRANTEE varchar 81 243 utf8 utf8_general_ci varchar(81) +3.0000 information_schema USER_PRIVILEGES TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) +3.0000 information_schema USER_PRIVILEGES PRIVILEGE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema USER_PRIVILEGES IS_GRANTABLE varchar 3 9 utf8 utf8_general_ci varchar(3) +3.0000 information_schema VIEWS TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) +3.0000 information_schema VIEWS TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema VIEWS TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +1.0000 information_schema VIEWS VIEW_DEFINITION longtext 4294967295 4294967295 utf8 utf8_general_ci longtext +3.0000 information_schema VIEWS CHECK_OPTION varchar 8 24 utf8 utf8_general_ci varchar(8) +3.0000 information_schema VIEWS IS_UPDATABLE varchar 3 9 utf8 utf8_general_ci varchar(3) +3.0000 information_schema VIEWS DEFINER varchar 77 231 utf8 utf8_general_ci varchar(77) +3.0000 information_schema VIEWS SECURITY_TYPE varchar 7 21 utf8 utf8_general_ci varchar(7) diff --git a/mysql-test/suite/funcs_1/r/is_columns_memory.result b/mysql-test/suite/funcs_1/r/is_columns_memory.result index 7f49fcb97d0..2a715439e54 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_memory.result +++ b/mysql-test/suite/funcs_1/r/is_columns_memory.result @@ -4,55 +4,55 @@ CREATE DATABASE test1; USE test; drop table if exists tb1 ; create table tb1 ( -f1 char, -f2 char binary, -f3 char ascii, -f12 binary, -f13 tinyint, -f14 tinyint unsigned, -f15 tinyint zerofill, -f16 tinyint unsigned zerofill, -f17 smallint, -f18 smallint unsigned, -f19 smallint zerofill, -f20 smallint unsigned zerofill, -f21 mediumint, -f22 mediumint unsigned, -f23 mediumint zerofill, -f24 mediumint unsigned zerofill, -f25 int, -f26 int unsigned, -f27 int zerofill, -f28 int unsigned zerofill, -f29 bigint, -f30 bigint unsigned, -f31 bigint zerofill, -f32 bigint unsigned zerofill, -f33 decimal not null DEFAULT 9.9, -f34 decimal unsigned not null DEFAULT 9.9, -f35 decimal zerofill not null DEFAULT 9.9, -f36 decimal unsigned zerofill not null DEFAULT 9.9, -f37 decimal (0) not null DEFAULT 9.9, -f38 decimal (64) not null DEFAULT 9.9, -f39 decimal (0) unsigned not null DEFAULT 9.9, -f40 decimal (64) unsigned not null DEFAULT 9.9, -f41 decimal (0) zerofill not null DEFAULT 9.9, -f42 decimal (64) zerofill not null DEFAULT 9.9, -f43 decimal (0) unsigned zerofill not null DEFAULT 9.9, -f44 decimal (64) unsigned zerofill not null DEFAULT 9.9, -f45 decimal (0,0) not null DEFAULT 9.9, -f46 decimal (63,30) not null DEFAULT 9.9, -f47 decimal (0,0) unsigned not null DEFAULT 9.9, -f48 decimal (63,30) unsigned not null DEFAULT 9.9, -f49 decimal (0,0) zerofill not null DEFAULT 9.9, -f50 decimal (63,30) zerofill not null DEFAULT 9.9, -f51 decimal (0,0) unsigned zerofill not null DEFAULT 9.9, -f52 decimal (63,30) unsigned zerofill not null DEFAULT 9.9, -f53 numeric not null DEFAULT 99, -f54 numeric unsigned not null DEFAULT 99, -f55 numeric zerofill not null DEFAULT 99, -f56 numeric unsigned zerofill not null DEFAULT 99, -f57 numeric (0) not null DEFAULT 99, +f1 char, +f2 char binary, +f3 char ascii, +f12 binary, +f13 tinyint, +f14 tinyint unsigned, +f15 tinyint zerofill, +f16 tinyint unsigned zerofill, +f17 smallint, +f18 smallint unsigned, +f19 smallint zerofill, +f20 smallint unsigned zerofill, +f21 mediumint, +f22 mediumint unsigned, +f23 mediumint zerofill, +f24 mediumint unsigned zerofill, +f25 int, +f26 int unsigned, +f27 int zerofill, +f28 int unsigned zerofill, +f29 bigint, +f30 bigint unsigned, +f31 bigint zerofill, +f32 bigint unsigned zerofill, +f33 decimal not null DEFAULT 9.9, +f34 decimal unsigned not null DEFAULT 9.9, +f35 decimal zerofill not null DEFAULT 9.9, +f36 decimal unsigned zerofill not null DEFAULT 9.9, +f37 decimal (0) not null DEFAULT 9.9, +f38 decimal (64) not null DEFAULT 9.9, +f39 decimal (0) unsigned not null DEFAULT 9.9, +f40 decimal (64) unsigned not null DEFAULT 9.9, +f41 decimal (0) zerofill not null DEFAULT 9.9, +f42 decimal (64) zerofill not null DEFAULT 9.9, +f43 decimal (0) unsigned zerofill not null DEFAULT 9.9, +f44 decimal (64) unsigned zerofill not null DEFAULT 9.9, +f45 decimal (0,0) not null DEFAULT 9.9, +f46 decimal (63,30) not null DEFAULT 9.9, +f47 decimal (0,0) unsigned not null DEFAULT 9.9, +f48 decimal (63,30) unsigned not null DEFAULT 9.9, +f49 decimal (0,0) zerofill not null DEFAULT 9.9, +f50 decimal (63,30) zerofill not null DEFAULT 9.9, +f51 decimal (0,0) unsigned zerofill not null DEFAULT 9.9, +f52 decimal (63,30) unsigned zerofill not null DEFAULT 9.9, +f53 numeric not null DEFAULT 99, +f54 numeric unsigned not null DEFAULT 99, +f55 numeric zerofill not null DEFAULT 99, +f56 numeric unsigned zerofill not null DEFAULT 99, +f57 numeric (0) not null DEFAULT 99, f58 numeric (64) not null DEFAULT 99 ) engine = memory; Warnings: @@ -72,265 +72,276 @@ Note 1265 Data truncated for column 'f45' at row 1 Note 1265 Data truncated for column 'f47' at row 1 Note 1265 Data truncated for column 'f49' at row 1 Note 1265 Data truncated for column 'f51' at row 1 -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/memory_tb1.txt' into table tb1 ; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/memory_tb1.txt' +into table tb1; drop table if exists tb2 ; create table tb2 ( -f59 numeric (0) unsigned, -f60 numeric (64) unsigned, -f61 numeric (0) zerofill, -f62 numeric (64) zerofill, -f63 numeric (0) unsigned zerofill, -f64 numeric (64) unsigned zerofill, -f65 numeric (0,0), -f66 numeric (63,30), -f67 numeric (0,0) unsigned, -f68 numeric (63,30) unsigned, -f69 numeric (0,0) zerofill, -f70 numeric (63,30) zerofill, -f71 numeric (0,0) unsigned zerofill, -f72 numeric (63,30) unsigned zerofill, -f73 real, -f74 real unsigned, -f75 real zerofill, -f76 real unsigned zerofill, -f77 double default 7.7, -f78 double unsigned default 7.7, -f79 double zerofill default 7.7, -f80 double unsigned zerofill default 8.8, -f81 float not null default 8.8, -f82 float unsigned not null default 8.8, -f83 float zerofill not null default 8.8, -f84 float unsigned zerofill not null default 8.8, -f85 float(0) not null default 8.8, -f86 float(23) not null default 8.8, -f87 float(0) unsigned not null default 8.8, -f88 float(23) unsigned not null default 8.8, -f89 float(0) zerofill not null default 8.8, -f90 float(23) zerofill not null default 8.8, -f91 float(0) unsigned zerofill not null default 8.8, -f92 float(23) unsigned zerofill not null default 8.8, -f93 float(24) not null default 8.8, -f94 float(53) not null default 8.8, -f95 float(24) unsigned not null default 8.8, -f96 float(53) unsigned not null default 8.8, -f97 float(24) zerofill not null default 8.8, -f98 float(53) zerofill not null default 8.8, -f99 float(24) unsigned zerofill not null default 8.8, -f100 float(53) unsigned zerofill not null default 8.8, -f101 date not null default '2000-01-01', -f102 time not null default 20, -f103 datetime not null default '2/2/2', -f104 timestamp not null default 20001231235959, -f105 year not null default 2000, -f106 year(3) not null default 2000, -f107 year(4) not null default 2000, -f108 enum("1enum","2enum") not null default "1enum", +f59 numeric (0) unsigned, +f60 numeric (64) unsigned, +f61 numeric (0) zerofill, +f62 numeric (64) zerofill, +f63 numeric (0) unsigned zerofill, +f64 numeric (64) unsigned zerofill, +f65 numeric (0,0), +f66 numeric (63,30), +f67 numeric (0,0) unsigned, +f68 numeric (63,30) unsigned, +f69 numeric (0,0) zerofill, +f70 numeric (63,30) zerofill, +f71 numeric (0,0) unsigned zerofill, +f72 numeric (63,30) unsigned zerofill, +f73 real, +f74 real unsigned, +f75 real zerofill, +f76 real unsigned zerofill, +f77 double default 7.7, +f78 double unsigned default 7.7, +f79 double zerofill default 7.7, +f80 double unsigned zerofill default 8.8, +f81 float not null default 8.8, +f82 float unsigned not null default 8.8, +f83 float zerofill not null default 8.8, +f84 float unsigned zerofill not null default 8.8, +f85 float(0) not null default 8.8, +f86 float(23) not null default 8.8, +f87 float(0) unsigned not null default 8.8, +f88 float(23) unsigned not null default 8.8, +f89 float(0) zerofill not null default 8.8, +f90 float(23) zerofill not null default 8.8, +f91 float(0) unsigned zerofill not null default 8.8, +f92 float(23) unsigned zerofill not null default 8.8, +f93 float(24) not null default 8.8, +f94 float(53) not null default 8.8, +f95 float(24) unsigned not null default 8.8, +f96 float(53) unsigned not null default 8.8, +f97 float(24) zerofill not null default 8.8, +f98 float(53) zerofill not null default 8.8, +f99 float(24) unsigned zerofill not null default 8.8, +f100 float(53) unsigned zerofill not null default 8.8, +f101 date not null default '2000-01-01', +f102 time not null default 20, +f103 datetime not null default '2/2/2', +f104 timestamp not null default 20001231235959, +f105 year not null default 2000, +f106 year(3) not null default 2000, +f107 year(4) not null default 2000, +f108 enum("1enum","2enum") not null default "1enum", f109 set("1set","2set") not null default "1set" ) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/memory_tb2.txt' into table tb2 ; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/memory_tb2.txt' +into table tb2 ; 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 char(50), -f122 char(50), -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) +f118 char not null DEFAULT 'a', +f119 char binary not null DEFAULT b'101', +f120 char ascii not null DEFAULT b'101', +f121 char(50), +f122 char(50), +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 = memory; 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 'MYSQL_TEST_DIR/suite/funcs_1/data/memory_tb3.txt' into table tb3 ; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/memory_tb3.txt' +into table tb3; drop table if exists tb4 ; create table tb4 ( -f176 numeric (0) unsigned not null DEFAULT 9, -f177 numeric (64) unsigned not null DEFAULT 9, -f178 numeric (0) zerofill not null DEFAULT 9, -f179 numeric (64) zerofill not null DEFAULT 9, -f180 numeric (0) unsigned zerofill not null DEFAULT 9, -f181 numeric (64) unsigned zerofill not null DEFAULT 9, -f182 numeric (0,0) not null DEFAULT 9, -f183 numeric (63,30) not null DEFAULT 9, -f184 numeric (0,0) unsigned not null DEFAULT 9, -f185 numeric (63,30) unsigned not null DEFAULT 9, -f186 numeric (0,0) zerofill not null DEFAULT 9, -f187 numeric (63,30) zerofill not null DEFAULT 9, -f188 numeric (0,0) unsigned zerofill not null DEFAULT 9, -f189 numeric (63,30) unsigned zerofill not null DEFAULT 9, -f190 real not null DEFAULT 88.8, -f191 real unsigned not null DEFAULT 88.8, -f192 real zerofill not null DEFAULT 88.8, -f193 real unsigned zerofill not null DEFAULT 88.8, -f194 double not null DEFAULT 55.5, -f195 double unsigned not null DEFAULT 55.5, -f196 double zerofill not null DEFAULT 55.5, -f197 double unsigned zerofill not null DEFAULT 55.5, -f198 float, -f199 float unsigned, -f200 float zerofill, -f201 float unsigned zerofill, -f202 float(0), -f203 float(23), -f204 float(0) unsigned, -f205 float(23) unsigned, -f206 float(0) zerofill, -f207 float(23) zerofill, -f208 float(0) unsigned zerofill, -f209 float(23) unsigned zerofill, -f210 float(24), -f211 float(53), -f212 float(24) unsigned, -f213 float(53) unsigned, -f214 float(24) zerofill, -f215 float(53) zerofill, -f216 float(24) unsigned zerofill, -f217 float(53) unsigned zerofill, -f218 date, -f219 time, -f220 datetime, -f221 timestamp, -f222 year, -f223 year(3), -f224 year(4), -f225 enum("1enum","2enum"), +f176 numeric (0) unsigned not null DEFAULT 9, +f177 numeric (64) unsigned not null DEFAULT 9, +f178 numeric (0) zerofill not null DEFAULT 9, +f179 numeric (64) zerofill not null DEFAULT 9, +f180 numeric (0) unsigned zerofill not null DEFAULT 9, +f181 numeric (64) unsigned zerofill not null DEFAULT 9, +f182 numeric (0,0) not null DEFAULT 9, +f183 numeric (63,30) not null DEFAULT 9, +f184 numeric (0,0) unsigned not null DEFAULT 9, +f185 numeric (63,30) unsigned not null DEFAULT 9, +f186 numeric (0,0) zerofill not null DEFAULT 9, +f187 numeric (63,30) zerofill not null DEFAULT 9, +f188 numeric (0,0) unsigned zerofill not null DEFAULT 9, +f189 numeric (63,30) unsigned zerofill not null DEFAULT 9, +f190 real not null DEFAULT 88.8, +f191 real unsigned not null DEFAULT 88.8, +f192 real zerofill not null DEFAULT 88.8, +f193 real unsigned zerofill not null DEFAULT 88.8, +f194 double not null DEFAULT 55.5, +f195 double unsigned not null DEFAULT 55.5, +f196 double zerofill not null DEFAULT 55.5, +f197 double unsigned zerofill not null DEFAULT 55.5, +f198 float, +f199 float unsigned, +f200 float zerofill, +f201 float unsigned zerofill, +f202 float(0), +f203 float(23), +f204 float(0) unsigned, +f205 float(23) unsigned, +f206 float(0) zerofill, +f207 float(23) zerofill, +f208 float(0) unsigned zerofill, +f209 float(23) unsigned zerofill, +f210 float(24), +f211 float(53), +f212 float(24) unsigned, +f213 float(53) unsigned, +f214 float(24) zerofill, +f215 float(53) zerofill, +f216 float(24) unsigned zerofill, +f217 float(53) unsigned zerofill, +f218 date, +f219 time, +f220 datetime, +f221 timestamp, +f222 year, +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; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/memory_tb4.txt' into table tb4 ; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/memory_tb4.txt' +into table tb4; USE test1; drop table if exists tb2 ; create table tb2 ( -f59 numeric (0) unsigned, -f60 numeric (64) unsigned, -f61 numeric (0) zerofill, -f62 numeric (64) zerofill, -f63 numeric (0) unsigned zerofill, -f64 numeric (64) unsigned zerofill, -f65 numeric (0,0), -f66 numeric (63,30), -f67 numeric (0,0) unsigned, -f68 numeric (63,30) unsigned, -f69 numeric (0,0) zerofill, -f70 numeric (63,30) zerofill, -f71 numeric (0,0) unsigned zerofill, -f72 numeric (63,30) unsigned zerofill, -f73 real, -f74 real unsigned, -f75 real zerofill, -f76 real unsigned zerofill, -f77 double default 7.7, -f78 double unsigned default 7.7, -f79 double zerofill default 7.7, -f80 double unsigned zerofill default 8.8, -f81 float not null default 8.8, -f82 float unsigned not null default 8.8, -f83 float zerofill not null default 8.8, -f84 float unsigned zerofill not null default 8.8, -f85 float(0) not null default 8.8, -f86 float(23) not null default 8.8, -f87 float(0) unsigned not null default 8.8, -f88 float(23) unsigned not null default 8.8, -f89 float(0) zerofill not null default 8.8, -f90 float(23) zerofill not null default 8.8, -f91 float(0) unsigned zerofill not null default 8.8, -f92 float(23) unsigned zerofill not null default 8.8, -f93 float(24) not null default 8.8, -f94 float(53) not null default 8.8, -f95 float(24) unsigned not null default 8.8, -f96 float(53) unsigned not null default 8.8, -f97 float(24) zerofill not null default 8.8, -f98 float(53) zerofill not null default 8.8, -f99 float(24) unsigned zerofill not null default 8.8, -f100 float(53) unsigned zerofill not null default 8.8, -f101 date not null default '2000-01-01', -f102 time not null default 20, -f103 datetime not null default '2/2/2', -f104 timestamp not null default 20001231235959, -f105 year not null default 2000, -f106 year(3) not null default 2000, -f107 year(4) not null default 2000, -f108 enum("1enum","2enum") not null default "1enum", +f59 numeric (0) unsigned, +f60 numeric (64) unsigned, +f61 numeric (0) zerofill, +f62 numeric (64) zerofill, +f63 numeric (0) unsigned zerofill, +f64 numeric (64) unsigned zerofill, +f65 numeric (0,0), +f66 numeric (63,30), +f67 numeric (0,0) unsigned, +f68 numeric (63,30) unsigned, +f69 numeric (0,0) zerofill, +f70 numeric (63,30) zerofill, +f71 numeric (0,0) unsigned zerofill, +f72 numeric (63,30) unsigned zerofill, +f73 real, +f74 real unsigned, +f75 real zerofill, +f76 real unsigned zerofill, +f77 double default 7.7, +f78 double unsigned default 7.7, +f79 double zerofill default 7.7, +f80 double unsigned zerofill default 8.8, +f81 float not null default 8.8, +f82 float unsigned not null default 8.8, +f83 float zerofill not null default 8.8, +f84 float unsigned zerofill not null default 8.8, +f85 float(0) not null default 8.8, +f86 float(23) not null default 8.8, +f87 float(0) unsigned not null default 8.8, +f88 float(23) unsigned not null default 8.8, +f89 float(0) zerofill not null default 8.8, +f90 float(23) zerofill not null default 8.8, +f91 float(0) unsigned zerofill not null default 8.8, +f92 float(23) unsigned zerofill not null default 8.8, +f93 float(24) not null default 8.8, +f94 float(53) not null default 8.8, +f95 float(24) unsigned not null default 8.8, +f96 float(53) unsigned not null default 8.8, +f97 float(24) zerofill not null default 8.8, +f98 float(53) zerofill not null default 8.8, +f99 float(24) unsigned zerofill not null default 8.8, +f100 float(53) unsigned zerofill not null default 8.8, +f101 date not null default '2000-01-01', +f102 time not null default 20, +f103 datetime not null default '2/2/2', +f104 timestamp not null default 20001231235959, +f105 year not null default 2000, +f106 year(3) not null default 2000, +f107 year(4) not null default 2000, +f108 enum("1enum","2enum") not null default "1enum", f109 set("1set","2set") not null default "1set" ) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/memory_tb2.txt' into table tb2 ; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/memory_tb2.txt' +into table tb2 ; USE test; USE test; DROP TABLE IF EXISTS t1, t2, t4, t10, t11; -CREATE TABLE t1 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = MEMORY; -CREATE TABLE t2 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = MEMORY; -CREATE TABLE t4 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = MEMORY; -CREATE TABLE t10 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = MEMORY; -CREATE TABLE t11 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = MEMORY; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t1; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t2; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t4; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t10; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t11; +CREATE TABLE t1 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +ENGINE = MEMORY; +CREATE TABLE t2 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +ENGINE = MEMORY; +CREATE TABLE t4 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +ENGINE = MEMORY; +CREATE TABLE t10 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +ENGINE = MEMORY; +CREATE TABLE t11 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +ENGINE = MEMORY; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' INTO TABLE t1; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' INTO TABLE t2; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' INTO TABLE t4; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' INTO TABLE t10; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' INTO TABLE t11; drop TABLE if exists t3; CREATE TABLE t3 (f1 char(20), f2 char(20), f3 integer) ENGINE = MEMORY; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t3.txt' INTO TABLE t3; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t3.txt' INTO TABLE t3; drop database if exists test4; CREATE database test4; use test4; -CREATE TABLE t6 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = MEMORY; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t6; +CREATE TABLE t6 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) +ENGINE = MEMORY; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' INTO TABLE t6; use test; drop TABLE if exists t7, t8; -CREATE TABLE t7 (f1 char(20), f2 char(25), f3 date, f4 int) ENGINE = MEMORY; -CREATE TABLE t8 (f1 char(20), f2 char(25), f3 date, f4 int) ENGINE = MEMORY; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' INTO TABLE t7; +CREATE TABLE t7 (f1 char(20),f2 char(25),f3 date,f4 int) ENGINE = MEMORY; +CREATE TABLE t8 (f1 char(20),f2 char(25),f3 date,f4 int) ENGINE = MEMORY; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' INTO TABLE t7; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -342,7 +353,7 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' INTO TABLE t8; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' INTO TABLE t8; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -356,7 +367,7 @@ Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 drop TABLE if exists t9; CREATE TABLE t9 (f1 int, f2 char(25), f3 int) ENGINE = MEMORY; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' INTO TABLE t9; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t9.txt' INTO TABLE t9; SELECT * FROM information_schema.columns WHERE table_schema LIKE 'test%' ORDER BY table_schema, table_name, column_name; @@ -609,12 +620,12 @@ NULL test tb4 f223 48 NULL YES year NULL NULL NULL NULL NULL NULL year(4) sele NULL test tb4 f224 49 NULL YES year NULL NULL NULL NULL NULL NULL year(4) select,insert,update,references NULL test tb4 f225 50 NULL YES enum 5 5 NULL NULL latin1 latin1_swedish_ci enum('1enum','2enum') select,insert,update,references NULL test tb4 f226 51 NULL YES set 9 9 NULL NULL latin1 latin1_swedish_ci set('1set','2set') select,insert,update,references -NULL test tb4 f236 52 NULL YES char 95 190 NULL NULL ucs2 ucs2_general_ci char(95) select,insert,update,references +NULL test tb4 f236 52 NULL YES char 95 95 NULL NULL latin1 latin1_swedish_ci char(95) select,insert,update,references NULL test tb4 f237 54 NULL YES char 130 130 NULL NULL latin1 latin1_bin char(130) select,insert,update,references NULL test tb4 f238 55 NULL YES varchar 25000 25000 NULL NULL latin1 latin1_bin varchar(25000) select,insert,update,references NULL test tb4 f239 56 NULL YES varbinary 0 0 NULL NULL NULL NULL varbinary(0) select,insert,update,references -NULL test tb4 f240 57 NULL YES varchar 1200 2400 NULL NULL ucs2 ucs2_general_ci varchar(1200) select,insert,update,references -NULL test tb4 f241 53 NULL YES char 255 510 NULL NULL ucs2 ucs2_general_ci char(255) select,insert,update,references +NULL test tb4 f240 57 NULL YES varchar 1200 1200 NULL NULL latin1 latin1_swedish_ci varchar(1200) select,insert,update,references +NULL test tb4 f241 53 NULL YES char 255 255 NULL NULL latin1 latin1_swedish_ci char(255) select,insert,update,references NULL test1 tb2 f100 42 00000000000000000008.8 NO double unsigned zerofill NULL NULL 22 NULL NULL NULL double unsigned zerofill select,insert,update,references NULL test1 tb2 f101 43 2000-01-01 NO date NULL NULL NULL NULL NULL NULL date select,insert,update,references NULL test1 tb2 f102 44 00:00:20 NO time NULL NULL NULL NULL NULL NULL time select,insert,update,references @@ -691,6 +702,7 @@ COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME 1.0000 char latin1 latin1_swedish_ci 1.0000 enum latin1 latin1_swedish_ci 1.0000 set latin1 latin1_swedish_ci +1.0000 varchar latin1 latin1_swedish_ci SELECT DISTINCT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, DATA_TYPE, @@ -701,8 +713,6 @@ WHERE table_schema LIKE 'test%' AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH <> 1 ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML; COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME -2.0000 char ucs2 ucs2_general_ci -2.0000 varchar ucs2 ucs2_general_ci SELECT DISTINCT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, DATA_TYPE, @@ -995,12 +1005,12 @@ NULL test tb4 f223 year NULL NULL NULL NULL year(4) NULL test tb4 f224 year NULL NULL NULL NULL year(4) 1.0000 test tb4 f225 enum 5 5 latin1 latin1_swedish_ci enum('1enum','2enum') 1.0000 test tb4 f226 set 9 9 latin1 latin1_swedish_ci set('1set','2set') -2.0000 test tb4 f236 char 95 190 ucs2 ucs2_general_ci char(95) -2.0000 test tb4 f241 char 255 510 ucs2 ucs2_general_ci char(255) +1.0000 test tb4 f236 char 95 95 latin1 latin1_swedish_ci char(95) +1.0000 test tb4 f241 char 255 255 latin1 latin1_swedish_ci char(255) 1.0000 test tb4 f237 char 130 130 latin1 latin1_bin char(130) 1.0000 test tb4 f238 varchar 25000 25000 latin1 latin1_bin varchar(25000) NULL test tb4 f239 varbinary 0 0 NULL NULL varbinary(0) -2.0000 test tb4 f240 varchar 1200 2400 ucs2 ucs2_general_ci varchar(1200) +1.0000 test tb4 f240 varchar 1200 1200 latin1 latin1_swedish_ci varchar(1200) NULL test1 tb2 f59 decimal NULL NULL NULL NULL decimal(10,0) unsigned NULL test1 tb2 f60 decimal NULL NULL NULL NULL decimal(64,0) unsigned NULL test1 tb2 f61 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill diff --git a/mysql-test/suite/funcs_1/r/is_columns_myisam.result b/mysql-test/suite/funcs_1/r/is_columns_myisam.result index a30acc64a8d..9393d1638bd 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_myisam.result +++ b/mysql-test/suite/funcs_1/r/is_columns_myisam.result @@ -4,63 +4,63 @@ CREATE DATABASE test1; USE test; drop table if exists tb1 ; create table tb1 ( -f1 char, -f2 char binary, -f3 char ascii, -f4 tinytext unicode, -f5 text, -f6 mediumtext, -f7 longtext, -f8 tinyblob, +f1 char, +f2 char binary, +f3 char ascii, +f4 tinytext, +f5 text, +f6 mediumtext, +f7 longtext, +f8 tinyblob, f9 blob, -f10 mediumblob, -f11 longblob, -f12 binary, -f13 tinyint, -f14 tinyint unsigned, -f15 tinyint zerofill, -f16 tinyint unsigned zerofill, -f17 smallint, -f18 smallint unsigned, -f19 smallint zerofill, -f20 smallint unsigned zerofill, -f21 mediumint, -f22 mediumint unsigned, -f23 mediumint zerofill, -f24 mediumint unsigned zerofill, -f25 int, -f26 int unsigned, -f27 int zerofill, -f28 int unsigned zerofill, -f29 bigint, -f30 bigint unsigned, -f31 bigint zerofill, -f32 bigint unsigned zerofill, -f33 decimal not null DEFAULT 9.9, -f34 decimal unsigned not null DEFAULT 9.9, -f35 decimal zerofill not null DEFAULT 9.9, -f36 decimal unsigned zerofill not null DEFAULT 9.9, -f37 decimal (0) not null DEFAULT 9.9, -f38 decimal (64) not null DEFAULT 9.9, -f39 decimal (0) unsigned not null DEFAULT 9.9, -f40 decimal (64) unsigned not null DEFAULT 9.9, -f41 decimal (0) zerofill not null DEFAULT 9.9, -f42 decimal (64) zerofill not null DEFAULT 9.9, -f43 decimal (0) unsigned zerofill not null DEFAULT 9.9, -f44 decimal (64) unsigned zerofill not null DEFAULT 9.9, -f45 decimal (0,0) not null DEFAULT 9.9, -f46 decimal (63,30) not null DEFAULT 9.9, -f47 decimal (0,0) unsigned not null DEFAULT 9.9, -f48 decimal (63,30) unsigned not null DEFAULT 9.9, -f49 decimal (0,0) zerofill not null DEFAULT 9.9, -f50 decimal (63,30) zerofill not null DEFAULT 9.9, -f51 decimal (0,0) unsigned zerofill not null DEFAULT 9.9, -f52 decimal (63,30) unsigned zerofill not null DEFAULT 9.9, -f53 numeric not null DEFAULT 99, -f54 numeric unsigned not null DEFAULT 99, -f55 numeric zerofill not null DEFAULT 99, -f56 numeric unsigned zerofill not null DEFAULT 99, -f57 numeric (0) not null DEFAULT 99, +f10 mediumblob, +f11 longblob, +f12 binary, +f13 tinyint, +f14 tinyint unsigned, +f15 tinyint zerofill, +f16 tinyint unsigned zerofill, +f17 smallint, +f18 smallint unsigned, +f19 smallint zerofill, +f20 smallint unsigned zerofill, +f21 mediumint, +f22 mediumint unsigned, +f23 mediumint zerofill, +f24 mediumint unsigned zerofill, +f25 int, +f26 int unsigned, +f27 int zerofill, +f28 int unsigned zerofill, +f29 bigint, +f30 bigint unsigned, +f31 bigint zerofill, +f32 bigint unsigned zerofill, +f33 decimal not null DEFAULT 9.9, +f34 decimal unsigned not null DEFAULT 9.9, +f35 decimal zerofill not null DEFAULT 9.9, +f36 decimal unsigned zerofill not null DEFAULT 9.9, +f37 decimal (0) not null DEFAULT 9.9, +f38 decimal (64) not null DEFAULT 9.9, +f39 decimal (0) unsigned not null DEFAULT 9.9, +f40 decimal (64) unsigned not null DEFAULT 9.9, +f41 decimal (0) zerofill not null DEFAULT 9.9, +f42 decimal (64) zerofill not null DEFAULT 9.9, +f43 decimal (0) unsigned zerofill not null DEFAULT 9.9, +f44 decimal (64) unsigned zerofill not null DEFAULT 9.9, +f45 decimal (0,0) not null DEFAULT 9.9, +f46 decimal (63,30) not null DEFAULT 9.9, +f47 decimal (0,0) unsigned not null DEFAULT 9.9, +f48 decimal (63,30) unsigned not null DEFAULT 9.9, +f49 decimal (0,0) zerofill not null DEFAULT 9.9, +f50 decimal (63,30) zerofill not null DEFAULT 9.9, +f51 decimal (0,0) unsigned zerofill not null DEFAULT 9.9, +f52 decimal (63,30) unsigned zerofill not null DEFAULT 9.9, +f53 numeric not null DEFAULT 99, +f54 numeric unsigned not null DEFAULT 99, +f55 numeric zerofill not null DEFAULT 99, +f56 numeric unsigned zerofill not null DEFAULT 99, +f57 numeric (0) not null DEFAULT 99, f58 numeric (64) not null DEFAULT 99 ) engine = myisam; Warnings: @@ -80,297 +80,308 @@ Note 1265 Data truncated for column 'f45' at row 1 Note 1265 Data truncated for column 'f47' at row 1 Note 1265 Data truncated for column 'f49' at row 1 Note 1265 Data truncated for column 'f51' at row 1 -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/myisam_tb1.txt' into table tb1 ; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/myisam_tb1.txt' +into table tb1; drop table if exists tb2 ; create table tb2 ( -f59 numeric (0) unsigned, -f60 numeric (64) unsigned, -f61 numeric (0) zerofill, -f62 numeric (64) zerofill, -f63 numeric (0) unsigned zerofill, -f64 numeric (64) unsigned zerofill, -f65 numeric (0,0), -f66 numeric (63,30), -f67 numeric (0,0) unsigned, -f68 numeric (63,30) unsigned, -f69 numeric (0,0) zerofill, -f70 numeric (63,30) zerofill, -f71 numeric (0,0) unsigned zerofill, -f72 numeric (63,30) unsigned zerofill, -f73 real, -f74 real unsigned, -f75 real zerofill, -f76 real unsigned zerofill, -f77 double default 7.7, -f78 double unsigned default 7.7, -f79 double zerofill default 7.7, -f80 double unsigned zerofill default 8.8, -f81 float not null default 8.8, -f82 float unsigned not null default 8.8, -f83 float zerofill not null default 8.8, -f84 float unsigned zerofill not null default 8.8, -f85 float(0) not null default 8.8, -f86 float(23) not null default 8.8, -f87 float(0) unsigned not null default 8.8, -f88 float(23) unsigned not null default 8.8, -f89 float(0) zerofill not null default 8.8, -f90 float(23) zerofill not null default 8.8, -f91 float(0) unsigned zerofill not null default 8.8, -f92 float(23) unsigned zerofill not null default 8.8, -f93 float(24) not null default 8.8, -f94 float(53) not null default 8.8, -f95 float(24) unsigned not null default 8.8, -f96 float(53) unsigned not null default 8.8, -f97 float(24) zerofill not null default 8.8, -f98 float(53) zerofill not null default 8.8, -f99 float(24) unsigned zerofill not null default 8.8, -f100 float(53) unsigned zerofill not null default 8.8, -f101 date not null default '2000-01-01', -f102 time not null default 20, -f103 datetime not null default '2/2/2', -f104 timestamp not null default 20001231235959, -f105 year not null default 2000, -f106 year(3) not null default 2000, -f107 year(4) not null default 2000, -f108 enum("1enum","2enum") not null default "1enum", +f59 numeric (0) unsigned, +f60 numeric (64) unsigned, +f61 numeric (0) zerofill, +f62 numeric (64) zerofill, +f63 numeric (0) unsigned zerofill, +f64 numeric (64) unsigned zerofill, +f65 numeric (0,0), +f66 numeric (63,30), +f67 numeric (0,0) unsigned, +f68 numeric (63,30) unsigned, +f69 numeric (0,0) zerofill, +f70 numeric (63,30) zerofill, +f71 numeric (0,0) unsigned zerofill, +f72 numeric (63,30) unsigned zerofill, +f73 real, +f74 real unsigned, +f75 real zerofill, +f76 real unsigned zerofill, +f77 double default 7.7, +f78 double unsigned default 7.7, +f79 double zerofill default 7.7, +f80 double unsigned zerofill default 8.8, +f81 float not null default 8.8, +f82 float unsigned not null default 8.8, +f83 float zerofill not null default 8.8, +f84 float unsigned zerofill not null default 8.8, +f85 float(0) not null default 8.8, +f86 float(23) not null default 8.8, +f87 float(0) unsigned not null default 8.8, +f88 float(23) unsigned not null default 8.8, +f89 float(0) zerofill not null default 8.8, +f90 float(23) zerofill not null default 8.8, +f91 float(0) unsigned zerofill not null default 8.8, +f92 float(23) unsigned zerofill not null default 8.8, +f93 float(24) not null default 8.8, +f94 float(53) not null default 8.8, +f95 float(24) unsigned not null default 8.8, +f96 float(53) unsigned not null default 8.8, +f97 float(24) zerofill not null default 8.8, +f98 float(53) zerofill not null default 8.8, +f99 float(24) unsigned zerofill not null default 8.8, +f100 float(53) unsigned zerofill not null default 8.8, +f101 date not null default '2000-01-01', +f102 time not null default 20, +f103 datetime not null default '2/2/2', +f104 timestamp not null default 20001231235959, +f105 year not null default 2000, +f106 year(3) not null default 2000, +f107 year(4) not null default 2000, +f108 enum("1enum","2enum") not null default "1enum", f109 set("1set","2set") not null default "1set", -f110 VARBINARY(64) null, -f111 VARBINARY(27) null , -f112 VARBINARY(64) null , -f113 VARBINARY(192) null , -f114 VARBINARY(192) , -f115 VARBINARY(27) null , -f116 VARBINARY(64) null, -f117 VARBINARY(192) null +f110 VARBINARY(64) null, +f111 VARBINARY(27) null , +f112 VARBINARY(64) null , +f113 VARBINARY(192) null , +f114 VARBINARY(192) , +f115 VARBINARY(27) null , +f116 VARBINARY(64) null, +f117 VARBINARY(192) null ) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/myisam_tb2.txt' into table tb2 ; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/myisam_tb2.txt' +into table tb2; 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) +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, +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 = myisam; 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 'MYSQL_TEST_DIR/suite/funcs_1/data/myisam_tb3.txt' into table tb3 ; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/myisam_tb3.txt' +into table tb3; drop table if exists tb4 ; create table tb4 ( -f176 numeric (0) unsigned not null DEFAULT 9, -f177 numeric (64) unsigned not null DEFAULT 9, -f178 numeric (0) zerofill not null DEFAULT 9, -f179 numeric (64) zerofill not null DEFAULT 9, -f180 numeric (0) unsigned zerofill not null DEFAULT 9, -f181 numeric (64) unsigned zerofill not null DEFAULT 9, -f182 numeric (0,0) not null DEFAULT 9, -f183 numeric (63,30) not null DEFAULT 9, -f184 numeric (0,0) unsigned not null DEFAULT 9, -f185 numeric (63,30) unsigned not null DEFAULT 9, -f186 numeric (0,0) zerofill not null DEFAULT 9, -f187 numeric (63,30) zerofill not null DEFAULT 9, -f188 numeric (0,0) unsigned zerofill not null DEFAULT 9, -f189 numeric (63,30) unsigned zerofill not null DEFAULT 9, -f190 real not null DEFAULT 88.8, -f191 real unsigned not null DEFAULT 88.8, -f192 real zerofill not null DEFAULT 88.8, -f193 real unsigned zerofill not null DEFAULT 88.8, -f194 double not null DEFAULT 55.5, -f195 double unsigned not null DEFAULT 55.5, -f196 double zerofill not null DEFAULT 55.5, -f197 double unsigned zerofill not null DEFAULT 55.5, -f198 float, -f199 float unsigned, -f200 float zerofill, -f201 float unsigned zerofill, -f202 float(0), -f203 float(23), -f204 float(0) unsigned, -f205 float(23) unsigned, -f206 float(0) zerofill, -f207 float(23) zerofill, -f208 float(0) unsigned zerofill, -f209 float(23) unsigned zerofill, -f210 float(24), -f211 float(53), -f212 float(24) unsigned, -f213 float(53) unsigned, -f214 float(24) zerofill, -f215 float(53) zerofill, -f216 float(24) unsigned zerofill, -f217 float(53) unsigned zerofill, -f218 date, -f219 time, -f220 datetime, -f221 timestamp, -f222 year, -f223 year(3), -f224 year(4), -f225 enum("1enum","2enum"), -f226 set("1set","2set"), -f227 VARBINARY(64), -f228 VARBINARY(27), -f229 VARBINARY(64), -f230 VARBINARY(192), -f231 VARBINARY(192), -f232 VARBINARY(27), -f233 VARBINARY(64), +f176 numeric (0) unsigned not null DEFAULT 9, +f177 numeric (64) unsigned not null DEFAULT 9, +f178 numeric (0) zerofill not null DEFAULT 9, +f179 numeric (64) zerofill not null DEFAULT 9, +f180 numeric (0) unsigned zerofill not null DEFAULT 9, +f181 numeric (64) unsigned zerofill not null DEFAULT 9, +f182 numeric (0,0) not null DEFAULT 9, +f183 numeric (63,30) not null DEFAULT 9, +f184 numeric (0,0) unsigned not null DEFAULT 9, +f185 numeric (63,30) unsigned not null DEFAULT 9, +f186 numeric (0,0) zerofill not null DEFAULT 9, +f187 numeric (63,30) zerofill not null DEFAULT 9, +f188 numeric (0,0) unsigned zerofill not null DEFAULT 9, +f189 numeric (63,30) unsigned zerofill not null DEFAULT 9, +f190 real not null DEFAULT 88.8, +f191 real unsigned not null DEFAULT 88.8, +f192 real zerofill not null DEFAULT 88.8, +f193 real unsigned zerofill not null DEFAULT 88.8, +f194 double not null DEFAULT 55.5, +f195 double unsigned not null DEFAULT 55.5, +f196 double zerofill not null DEFAULT 55.5, +f197 double unsigned zerofill not null DEFAULT 55.5, +f198 float, +f199 float unsigned, +f200 float zerofill, +f201 float unsigned zerofill, +f202 float(0), +f203 float(23), +f204 float(0) unsigned, +f205 float(23) unsigned, +f206 float(0) zerofill, +f207 float(23) zerofill, +f208 float(0) unsigned zerofill, +f209 float(23) unsigned zerofill, +f210 float(24), +f211 float(53), +f212 float(24) unsigned, +f213 float(53) unsigned, +f214 float(24) zerofill, +f215 float(53) zerofill, +f216 float(24) unsigned zerofill, +f217 float(53) unsigned zerofill, +f218 date, +f219 time, +f220 datetime, +f221 timestamp, +f222 year, +f223 year(3), +f224 year(4), +f225 enum("1enum","2enum"), +f226 set("1set","2set"), +f227 VARBINARY(64), +f228 VARBINARY(27), +f229 VARBINARY(64), +f230 VARBINARY(192), +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; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/myisam_tb4.txt' into table tb4 ; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/myisam_tb4.txt' +into table tb4; USE test1; drop table if exists tb2 ; create table tb2 ( -f59 numeric (0) unsigned, -f60 numeric (64) unsigned, -f61 numeric (0) zerofill, -f62 numeric (64) zerofill, -f63 numeric (0) unsigned zerofill, -f64 numeric (64) unsigned zerofill, -f65 numeric (0,0), -f66 numeric (63,30), -f67 numeric (0,0) unsigned, -f68 numeric (63,30) unsigned, -f69 numeric (0,0) zerofill, -f70 numeric (63,30) zerofill, -f71 numeric (0,0) unsigned zerofill, -f72 numeric (63,30) unsigned zerofill, -f73 real, -f74 real unsigned, -f75 real zerofill, -f76 real unsigned zerofill, -f77 double default 7.7, -f78 double unsigned default 7.7, -f79 double zerofill default 7.7, -f80 double unsigned zerofill default 8.8, -f81 float not null default 8.8, -f82 float unsigned not null default 8.8, -f83 float zerofill not null default 8.8, -f84 float unsigned zerofill not null default 8.8, -f85 float(0) not null default 8.8, -f86 float(23) not null default 8.8, -f87 float(0) unsigned not null default 8.8, -f88 float(23) unsigned not null default 8.8, -f89 float(0) zerofill not null default 8.8, -f90 float(23) zerofill not null default 8.8, -f91 float(0) unsigned zerofill not null default 8.8, -f92 float(23) unsigned zerofill not null default 8.8, -f93 float(24) not null default 8.8, -f94 float(53) not null default 8.8, -f95 float(24) unsigned not null default 8.8, -f96 float(53) unsigned not null default 8.8, -f97 float(24) zerofill not null default 8.8, -f98 float(53) zerofill not null default 8.8, -f99 float(24) unsigned zerofill not null default 8.8, -f100 float(53) unsigned zerofill not null default 8.8, -f101 date not null default '2000-01-01', -f102 time not null default 20, -f103 datetime not null default '2/2/2', -f104 timestamp not null default 20001231235959, -f105 year not null default 2000, -f106 year(3) not null default 2000, -f107 year(4) not null default 2000, -f108 enum("1enum","2enum") not null default "1enum", +f59 numeric (0) unsigned, +f60 numeric (64) unsigned, +f61 numeric (0) zerofill, +f62 numeric (64) zerofill, +f63 numeric (0) unsigned zerofill, +f64 numeric (64) unsigned zerofill, +f65 numeric (0,0), +f66 numeric (63,30), +f67 numeric (0,0) unsigned, +f68 numeric (63,30) unsigned, +f69 numeric (0,0) zerofill, +f70 numeric (63,30) zerofill, +f71 numeric (0,0) unsigned zerofill, +f72 numeric (63,30) unsigned zerofill, +f73 real, +f74 real unsigned, +f75 real zerofill, +f76 real unsigned zerofill, +f77 double default 7.7, +f78 double unsigned default 7.7, +f79 double zerofill default 7.7, +f80 double unsigned zerofill default 8.8, +f81 float not null default 8.8, +f82 float unsigned not null default 8.8, +f83 float zerofill not null default 8.8, +f84 float unsigned zerofill not null default 8.8, +f85 float(0) not null default 8.8, +f86 float(23) not null default 8.8, +f87 float(0) unsigned not null default 8.8, +f88 float(23) unsigned not null default 8.8, +f89 float(0) zerofill not null default 8.8, +f90 float(23) zerofill not null default 8.8, +f91 float(0) unsigned zerofill not null default 8.8, +f92 float(23) unsigned zerofill not null default 8.8, +f93 float(24) not null default 8.8, +f94 float(53) not null default 8.8, +f95 float(24) unsigned not null default 8.8, +f96 float(53) unsigned not null default 8.8, +f97 float(24) zerofill not null default 8.8, +f98 float(53) zerofill not null default 8.8, +f99 float(24) unsigned zerofill not null default 8.8, +f100 float(53) unsigned zerofill not null default 8.8, +f101 date not null default '2000-01-01', +f102 time not null default 20, +f103 datetime not null default '2/2/2', +f104 timestamp not null default 20001231235959, +f105 year not null default 2000, +f106 year(3) not null default 2000, +f107 year(4) not null default 2000, +f108 enum("1enum","2enum") not null default "1enum", f109 set("1set","2set") not null default "1set", -f110 VARBINARY(64) null, -f111 VARBINARY(27) null , -f112 VARBINARY(64) null , -f113 VARBINARY(192) null , -f114 VARBINARY(192) , -f115 VARBINARY(27) null , -f116 VARBINARY(64) null, -f117 VARBINARY(192) null +f110 VARBINARY(64) null, +f111 VARBINARY(27) null , +f112 VARBINARY(64) null , +f113 VARBINARY(192) null , +f114 VARBINARY(192) , +f115 VARBINARY(27) null , +f116 VARBINARY(64) null, +f117 VARBINARY(192) null ) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/myisam_tb2.txt' into table tb2 ; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/myisam_tb2.txt' +into table tb2; USE test; USE test; DROP TABLE IF EXISTS t1, t2, t4, t10, t11; -CREATE TABLE t1 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = MyISAM; -CREATE TABLE t2 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = MyISAM; -CREATE TABLE t4 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = MyISAM; -CREATE TABLE t10 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = MyISAM; -CREATE TABLE t11 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = MyISAM; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t1; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t2; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t4; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t10; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t11; +CREATE TABLE t1 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +ENGINE = MyISAM; +CREATE TABLE t2 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +ENGINE = MyISAM; +CREATE TABLE t4 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +ENGINE = MyISAM; +CREATE TABLE t10 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +ENGINE = MyISAM; +CREATE TABLE t11 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +ENGINE = MyISAM; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' INTO TABLE t1; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' INTO TABLE t2; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' INTO TABLE t4; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' INTO TABLE t10; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' INTO TABLE t11; drop TABLE if exists t3; CREATE TABLE t3 (f1 char(20), f2 char(20), f3 integer) ENGINE = MyISAM; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t3.txt' INTO TABLE t3; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t3.txt' INTO TABLE t3; drop database if exists test4; CREATE database test4; use test4; -CREATE TABLE t6 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = MyISAM; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t6; +CREATE TABLE t6 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) +ENGINE = MyISAM; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' INTO TABLE t6; use test; drop TABLE if exists t7, t8; -CREATE TABLE t7 (f1 char(20), f2 char(25), f3 date, f4 int) ENGINE = MyISAM; -CREATE TABLE t8 (f1 char(20), f2 char(25), f3 date, f4 int) ENGINE = MyISAM; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' INTO TABLE t7; +CREATE TABLE t7 (f1 char(20),f2 char(25),f3 date,f4 int) ENGINE = MyISAM; +CREATE TABLE t8 (f1 char(20),f2 char(25),f3 date,f4 int) ENGINE = MyISAM; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' INTO TABLE t7; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -382,7 +393,7 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' INTO TABLE t8; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' INTO TABLE t8; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -396,7 +407,7 @@ Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 drop TABLE if exists t9; CREATE TABLE t9 (f1 int, f2 char(25), f3 int) ENGINE = MyISAM; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' INTO TABLE t9; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t9.txt' INTO TABLE t9; SELECT * FROM information_schema.columns WHERE table_schema LIKE 'test%' ORDER BY table_schema, table_name, column_name; @@ -478,7 +489,7 @@ NULL test tb1 f36 36 0000000010 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0 NULL test tb1 f37 37 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references NULL test tb1 f38 38 10 NO decimal NULL NULL 64 0 NULL NULL decimal(64,0) select,insert,update,references NULL test tb1 f39 39 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references -NULL test tb1 f4 4 NULL YES tinytext 127 255 NULL NULL ucs2 ucs2_general_ci tinytext select,insert,update,references +NULL test tb1 f4 4 NULL YES tinytext 255 255 NULL NULL latin1 latin1_swedish_ci tinytext select,insert,update,references NULL test tb1 f40 40 10 NO decimal NULL NULL 64 0 NULL NULL decimal(64,0) unsigned select,insert,update,references NULL test tb1 f41 41 0000000010 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references NULL test tb1 f42 42 0000000000000000000000000000000000000000000000000000000000000010 NO decimal NULL NULL 64 0 NULL NULL decimal(64,0) unsigned zerofill select,insert,update,references @@ -568,7 +579,7 @@ NULL test tb3 f120 3 NO char 1 1 NULL NULL latin1 latin1_swedish_ci char(1) NULL test tb3 f121 4 NULL YES tinytext 255 255 NULL NULL latin1 latin1_swedish_ci tinytext select,insert,update,references NULL test tb3 f122 5 NULL YES text 65535 65535 NULL NULL latin1 latin1_swedish_ci text select,insert,update,references NULL test tb3 f123 6 NULL YES mediumtext 16777215 16777215 NULL NULL latin1 latin1_swedish_ci mediumtext select,insert,update,references -NULL test tb3 f124 7 NULL YES longtext 2147483647 4294967295 NULL NULL ucs2 ucs2_general_ci longtext select,insert,update,references +NULL test tb3 f124 7 NULL YES longtext 4294967295 4294967295 NULL NULL latin1 latin1_swedish_ci longtext select,insert,update,references NULL test tb3 f125 8 NULL YES tinyblob 255 255 NULL NULL NULL NULL tinyblob select,insert,update,references NULL test tb3 f126 9 NULL YES blob 65535 65535 NULL NULL NULL NULL blob select,insert,update,references NULL test tb3 f127 10 NULL YES mediumblob 16777215 16777215 NULL NULL NULL NULL mediumblob select,insert,update,references @@ -679,13 +690,13 @@ NULL test tb4 f231 56 NULL YES varbinary 192 192 NULL NULL NULL NULL varbinary(1 NULL test tb4 f232 57 NULL YES varbinary 27 27 NULL NULL NULL NULL varbinary(27) select,insert,update,references NULL test tb4 f233 58 NULL YES varbinary 64 64 NULL NULL NULL NULL varbinary(64) select,insert,update,references NULL test tb4 f234 59 NULL YES varbinary 192 192 NULL NULL NULL NULL varbinary(192) select,insert,update,references -NULL test tb4 f235 60 NULL YES char 255 510 NULL NULL ucs2 ucs2_general_ci char(255) select,insert,update,references +NULL test tb4 f235 60 NULL YES char 255 255 NULL NULL latin1 latin1_swedish_ci char(255) select,insert,update,references NULL test tb4 f236 61 NULL YES char 60 60 NULL NULL latin1 latin1_swedish_ci char(60) select,insert,update,references NULL test tb4 f237 62 NULL YES char 255 255 NULL NULL latin1 latin1_bin char(255) select,insert,update,references NULL test tb4 f238 63 NULL YES varchar 0 0 NULL NULL latin1 latin1_bin varchar(0) select,insert,update,references NULL test tb4 f239 64 NULL YES varbinary 1000 1000 NULL NULL NULL NULL varbinary(1000) select,insert,update,references -NULL test tb4 f240 65 NULL YES varchar 120 240 NULL NULL ucs2 ucs2_general_ci varchar(120) select,insert,update,references -NULL test tb4 f241 66 NULL YES char 100 200 NULL NULL ucs2 ucs2_general_ci char(100) select,insert,update,references +NULL test tb4 f240 65 NULL YES varchar 120 120 NULL NULL latin1 latin1_swedish_ci varchar(120) select,insert,update,references +NULL test tb4 f241 66 NULL YES char 100 100 NULL NULL latin1 latin1_swedish_ci char(100) select,insert,update,references NULL test tb4 f242 67 NULL YES bit NULL NULL 30 NULL NULL NULL bit(30) select,insert,update,references NULL test1 tb2 f100 42 00000000000000000008.8 NO double unsigned zerofill NULL NULL 22 NULL NULL NULL double unsigned zerofill select,insert,update,references NULL test1 tb2 f101 43 2000-01-01 NO date NULL NULL NULL NULL NULL NULL date select,insert,update,references @@ -779,6 +790,7 @@ COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME 1.0000 set latin1 latin1_swedish_ci 1.0000 text latin1 latin1_swedish_ci 1.0000 tinytext latin1 latin1_swedish_ci +1.0000 varchar latin1 latin1_swedish_ci SELECT DISTINCT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, DATA_TYPE, @@ -789,10 +801,6 @@ WHERE table_schema LIKE 'test%' AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH <> 1 ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML; COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME -2.0000 char ucs2 ucs2_general_ci -2.0000 longtext ucs2 ucs2_general_ci -2.0000 varchar ucs2 ucs2_general_ci -2.0079 tinytext ucs2 ucs2_general_ci SELECT DISTINCT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, DATA_TYPE, @@ -885,7 +893,7 @@ NULL test t9 f3 int NULL NULL NULL NULL int(11) 1.0000 test tb1 f1 char 1 1 latin1 latin1_swedish_ci char(1) 1.0000 test tb1 f2 char 1 1 latin1 latin1_bin char(1) 1.0000 test tb1 f3 char 1 1 latin1 latin1_swedish_ci char(1) -2.0079 test tb1 f4 tinytext 127 255 ucs2 ucs2_general_ci tinytext +1.0000 test tb1 f4 tinytext 255 255 latin1 latin1_swedish_ci tinytext 1.0000 test tb1 f5 text 65535 65535 latin1 latin1_swedish_ci text 1.0000 test tb1 f6 mediumtext 16777215 16777215 latin1 latin1_swedish_ci mediumtext 1.0000 test tb1 f7 longtext 4294967295 4294967295 latin1 latin1_swedish_ci longtext @@ -1005,7 +1013,7 @@ NULL test tb2 f107 year NULL NULL NULL NULL year(4) 1.0000 test tb3 f121 tinytext 255 255 latin1 latin1_swedish_ci tinytext 1.0000 test tb3 f122 text 65535 65535 latin1 latin1_swedish_ci text 1.0000 test tb3 f123 mediumtext 16777215 16777215 latin1 latin1_swedish_ci mediumtext -2.0000 test tb3 f124 longtext 2147483647 4294967295 ucs2 ucs2_general_ci longtext +1.0000 test tb3 f124 longtext 4294967295 4294967295 latin1 latin1_swedish_ci longtext 1.0000 test tb3 f125 tinyblob 255 255 NULL NULL tinyblob 1.0000 test tb3 f126 blob 65535 65535 NULL NULL blob 1.0000 test tb3 f127 mediumblob 16777215 16777215 NULL NULL mediumblob @@ -1116,13 +1124,13 @@ NULL test tb4 f224 year NULL NULL NULL NULL year(4) 1.0000 test tb4 f232 varbinary 27 27 NULL NULL varbinary(27) 1.0000 test tb4 f233 varbinary 64 64 NULL NULL varbinary(64) 1.0000 test tb4 f234 varbinary 192 192 NULL NULL varbinary(192) -2.0000 test tb4 f235 char 255 510 ucs2 ucs2_general_ci char(255) +1.0000 test tb4 f235 char 255 255 latin1 latin1_swedish_ci char(255) 1.0000 test tb4 f236 char 60 60 latin1 latin1_swedish_ci char(60) 1.0000 test tb4 f237 char 255 255 latin1 latin1_bin char(255) NULL test tb4 f238 varchar 0 0 latin1 latin1_bin varchar(0) 1.0000 test tb4 f239 varbinary 1000 1000 NULL NULL varbinary(1000) -2.0000 test tb4 f240 varchar 120 240 ucs2 ucs2_general_ci varchar(120) -2.0000 test tb4 f241 char 100 200 ucs2 ucs2_general_ci char(100) +1.0000 test tb4 f240 varchar 120 120 latin1 latin1_swedish_ci varchar(120) +1.0000 test tb4 f241 char 100 100 latin1 latin1_swedish_ci char(100) NULL test tb4 f242 bit NULL NULL NULL NULL bit(30) NULL test1 tb2 f59 decimal NULL NULL NULL NULL decimal(10,0) unsigned NULL test1 tb2 f60 decimal NULL NULL NULL NULL decimal(64,0) unsigned diff --git a/mysql-test/suite/funcs_1/r/is_columns_myisam_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_myisam_embedded.result new file mode 100644 index 00000000000..ffc6683b099 --- /dev/null +++ b/mysql-test/suite/funcs_1/r/is_columns_myisam_embedded.result @@ -0,0 +1,1214 @@ +SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION'; +DROP DATABASE IF EXISTS test1; +CREATE DATABASE test1; +USE test; +drop table if exists tb1 ; +create table tb1 ( +f1 char, +f2 char binary, +f3 char ascii, +f4 tinytext, +f5 text, +f6 mediumtext, +f7 longtext, +f8 tinyblob, +f9 blob, +f10 mediumblob, +f11 longblob, +f12 binary, +f13 tinyint, +f14 tinyint unsigned, +f15 tinyint zerofill, +f16 tinyint unsigned zerofill, +f17 smallint, +f18 smallint unsigned, +f19 smallint zerofill, +f20 smallint unsigned zerofill, +f21 mediumint, +f22 mediumint unsigned, +f23 mediumint zerofill, +f24 mediumint unsigned zerofill, +f25 int, +f26 int unsigned, +f27 int zerofill, +f28 int unsigned zerofill, +f29 bigint, +f30 bigint unsigned, +f31 bigint zerofill, +f32 bigint unsigned zerofill, +f33 decimal not null DEFAULT 9.9, +f34 decimal unsigned not null DEFAULT 9.9, +f35 decimal zerofill not null DEFAULT 9.9, +f36 decimal unsigned zerofill not null DEFAULT 9.9, +f37 decimal (0) not null DEFAULT 9.9, +f38 decimal (64) not null DEFAULT 9.9, +f39 decimal (0) unsigned not null DEFAULT 9.9, +f40 decimal (64) unsigned not null DEFAULT 9.9, +f41 decimal (0) zerofill not null DEFAULT 9.9, +f42 decimal (64) zerofill not null DEFAULT 9.9, +f43 decimal (0) unsigned zerofill not null DEFAULT 9.9, +f44 decimal (64) unsigned zerofill not null DEFAULT 9.9, +f45 decimal (0,0) not null DEFAULT 9.9, +f46 decimal (63,30) not null DEFAULT 9.9, +f47 decimal (0,0) unsigned not null DEFAULT 9.9, +f48 decimal (63,30) unsigned not null DEFAULT 9.9, +f49 decimal (0,0) zerofill not null DEFAULT 9.9, +f50 decimal (63,30) zerofill not null DEFAULT 9.9, +f51 decimal (0,0) unsigned zerofill not null DEFAULT 9.9, +f52 decimal (63,30) unsigned zerofill not null DEFAULT 9.9, +f53 numeric not null DEFAULT 99, +f54 numeric unsigned not null DEFAULT 99, +f55 numeric zerofill not null DEFAULT 99, +f56 numeric unsigned zerofill not null DEFAULT 99, +f57 numeric (0) not null DEFAULT 99, +f58 numeric (64) not null DEFAULT 99 +) engine = myisam; +Warnings: +Note 1265 Data truncated for column 'f33' at row 1 +Note 1265 Data truncated for column 'f34' at row 1 +Note 1265 Data truncated for column 'f35' at row 1 +Note 1265 Data truncated for column 'f36' at row 1 +Note 1265 Data truncated for column 'f37' at row 1 +Note 1265 Data truncated for column 'f38' at row 1 +Note 1265 Data truncated for column 'f39' at row 1 +Note 1265 Data truncated for column 'f40' at row 1 +Note 1265 Data truncated for column 'f41' at row 1 +Note 1265 Data truncated for column 'f42' at row 1 +Note 1265 Data truncated for column 'f43' at row 1 +Note 1265 Data truncated for column 'f44' at row 1 +Note 1265 Data truncated for column 'f45' at row 1 +Note 1265 Data truncated for column 'f47' at row 1 +Note 1265 Data truncated for column 'f49' at row 1 +Note 1265 Data truncated for column 'f51' at row 1 +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/myisam_tb1.txt' +into table tb1; +drop table if exists tb2 ; +create table tb2 ( +f59 numeric (0) unsigned, +f60 numeric (64) unsigned, +f61 numeric (0) zerofill, +f62 numeric (64) zerofill, +f63 numeric (0) unsigned zerofill, +f64 numeric (64) unsigned zerofill, +f65 numeric (0,0), +f66 numeric (63,30), +f67 numeric (0,0) unsigned, +f68 numeric (63,30) unsigned, +f69 numeric (0,0) zerofill, +f70 numeric (63,30) zerofill, +f71 numeric (0,0) unsigned zerofill, +f72 numeric (63,30) unsigned zerofill, +f73 real, +f74 real unsigned, +f75 real zerofill, +f76 real unsigned zerofill, +f77 double default 7.7, +f78 double unsigned default 7.7, +f79 double zerofill default 7.7, +f80 double unsigned zerofill default 8.8, +f81 float not null default 8.8, +f82 float unsigned not null default 8.8, +f83 float zerofill not null default 8.8, +f84 float unsigned zerofill not null default 8.8, +f85 float(0) not null default 8.8, +f86 float(23) not null default 8.8, +f87 float(0) unsigned not null default 8.8, +f88 float(23) unsigned not null default 8.8, +f89 float(0) zerofill not null default 8.8, +f90 float(23) zerofill not null default 8.8, +f91 float(0) unsigned zerofill not null default 8.8, +f92 float(23) unsigned zerofill not null default 8.8, +f93 float(24) not null default 8.8, +f94 float(53) not null default 8.8, +f95 float(24) unsigned not null default 8.8, +f96 float(53) unsigned not null default 8.8, +f97 float(24) zerofill not null default 8.8, +f98 float(53) zerofill not null default 8.8, +f99 float(24) unsigned zerofill not null default 8.8, +f100 float(53) unsigned zerofill not null default 8.8, +f101 date not null default '2000-01-01', +f102 time not null default 20, +f103 datetime not null default '2/2/2', +f104 timestamp not null default 20001231235959, +f105 year not null default 2000, +f106 year(3) not null default 2000, +f107 year(4) not null default 2000, +f108 enum("1enum","2enum") not null default "1enum", +f109 set("1set","2set") not null default "1set", +f110 VARBINARY(64) null, +f111 VARBINARY(27) null , +f112 VARBINARY(64) null , +f113 VARBINARY(192) null , +f114 VARBINARY(192) , +f115 VARBINARY(27) null , +f116 VARBINARY(64) null, +f117 VARBINARY(192) null +) engine = myisam; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/myisam_tb2.txt' +into table tb2; +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, +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 = myisam; +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/myisam_tb3.txt' +into table tb3; +drop table if exists tb4 ; +create table tb4 ( +f176 numeric (0) unsigned not null DEFAULT 9, +f177 numeric (64) unsigned not null DEFAULT 9, +f178 numeric (0) zerofill not null DEFAULT 9, +f179 numeric (64) zerofill not null DEFAULT 9, +f180 numeric (0) unsigned zerofill not null DEFAULT 9, +f181 numeric (64) unsigned zerofill not null DEFAULT 9, +f182 numeric (0,0) not null DEFAULT 9, +f183 numeric (63,30) not null DEFAULT 9, +f184 numeric (0,0) unsigned not null DEFAULT 9, +f185 numeric (63,30) unsigned not null DEFAULT 9, +f186 numeric (0,0) zerofill not null DEFAULT 9, +f187 numeric (63,30) zerofill not null DEFAULT 9, +f188 numeric (0,0) unsigned zerofill not null DEFAULT 9, +f189 numeric (63,30) unsigned zerofill not null DEFAULT 9, +f190 real not null DEFAULT 88.8, +f191 real unsigned not null DEFAULT 88.8, +f192 real zerofill not null DEFAULT 88.8, +f193 real unsigned zerofill not null DEFAULT 88.8, +f194 double not null DEFAULT 55.5, +f195 double unsigned not null DEFAULT 55.5, +f196 double zerofill not null DEFAULT 55.5, +f197 double unsigned zerofill not null DEFAULT 55.5, +f198 float, +f199 float unsigned, +f200 float zerofill, +f201 float unsigned zerofill, +f202 float(0), +f203 float(23), +f204 float(0) unsigned, +f205 float(23) unsigned, +f206 float(0) zerofill, +f207 float(23) zerofill, +f208 float(0) unsigned zerofill, +f209 float(23) unsigned zerofill, +f210 float(24), +f211 float(53), +f212 float(24) unsigned, +f213 float(53) unsigned, +f214 float(24) zerofill, +f215 float(53) zerofill, +f216 float(24) unsigned zerofill, +f217 float(53) unsigned zerofill, +f218 date, +f219 time, +f220 datetime, +f221 timestamp, +f222 year, +f223 year(3), +f224 year(4), +f225 enum("1enum","2enum"), +f226 set("1set","2set"), +f227 VARBINARY(64), +f228 VARBINARY(27), +f229 VARBINARY(64), +f230 VARBINARY(192), +f231 VARBINARY(192), +f232 VARBINARY(27), +f233 VARBINARY(64), +f234 VARBINARY(192), +f235 char(255), +f236 char(60) ascii, +f237 char(255) binary, +f238 varchar(0) binary, +f239 varbinary(1000), +f240 varchar(120), +f241 char(100), +f242 bit(30) +) engine = myisam; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/myisam_tb4.txt' +into table tb4; +USE test1; +drop table if exists tb2 ; +create table tb2 ( +f59 numeric (0) unsigned, +f60 numeric (64) unsigned, +f61 numeric (0) zerofill, +f62 numeric (64) zerofill, +f63 numeric (0) unsigned zerofill, +f64 numeric (64) unsigned zerofill, +f65 numeric (0,0), +f66 numeric (63,30), +f67 numeric (0,0) unsigned, +f68 numeric (63,30) unsigned, +f69 numeric (0,0) zerofill, +f70 numeric (63,30) zerofill, +f71 numeric (0,0) unsigned zerofill, +f72 numeric (63,30) unsigned zerofill, +f73 real, +f74 real unsigned, +f75 real zerofill, +f76 real unsigned zerofill, +f77 double default 7.7, +f78 double unsigned default 7.7, +f79 double zerofill default 7.7, +f80 double unsigned zerofill default 8.8, +f81 float not null default 8.8, +f82 float unsigned not null default 8.8, +f83 float zerofill not null default 8.8, +f84 float unsigned zerofill not null default 8.8, +f85 float(0) not null default 8.8, +f86 float(23) not null default 8.8, +f87 float(0) unsigned not null default 8.8, +f88 float(23) unsigned not null default 8.8, +f89 float(0) zerofill not null default 8.8, +f90 float(23) zerofill not null default 8.8, +f91 float(0) unsigned zerofill not null default 8.8, +f92 float(23) unsigned zerofill not null default 8.8, +f93 float(24) not null default 8.8, +f94 float(53) not null default 8.8, +f95 float(24) unsigned not null default 8.8, +f96 float(53) unsigned not null default 8.8, +f97 float(24) zerofill not null default 8.8, +f98 float(53) zerofill not null default 8.8, +f99 float(24) unsigned zerofill not null default 8.8, +f100 float(53) unsigned zerofill not null default 8.8, +f101 date not null default '2000-01-01', +f102 time not null default 20, +f103 datetime not null default '2/2/2', +f104 timestamp not null default 20001231235959, +f105 year not null default 2000, +f106 year(3) not null default 2000, +f107 year(4) not null default 2000, +f108 enum("1enum","2enum") not null default "1enum", +f109 set("1set","2set") not null default "1set", +f110 VARBINARY(64) null, +f111 VARBINARY(27) null , +f112 VARBINARY(64) null , +f113 VARBINARY(192) null , +f114 VARBINARY(192) , +f115 VARBINARY(27) null , +f116 VARBINARY(64) null, +f117 VARBINARY(192) null +) engine = myisam; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/myisam_tb2.txt' +into table tb2; +USE test; +USE test; +DROP TABLE IF EXISTS t1, t2, t4, t10, t11; +CREATE TABLE t1 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +ENGINE = MyISAM; +CREATE TABLE t2 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +ENGINE = MyISAM; +CREATE TABLE t4 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +ENGINE = MyISAM; +CREATE TABLE t10 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +ENGINE = MyISAM; +CREATE TABLE t11 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +ENGINE = MyISAM; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' INTO TABLE t1; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' INTO TABLE t2; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' INTO TABLE t4; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' INTO TABLE t10; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' INTO TABLE t11; +drop TABLE if exists t3; +CREATE TABLE t3 (f1 char(20), f2 char(20), f3 integer) ENGINE = MyISAM; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t3.txt' INTO TABLE t3; +drop database if exists test4; +CREATE database test4; +use test4; +CREATE TABLE t6 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) +ENGINE = MyISAM; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' INTO TABLE t6; +use test; +drop TABLE if exists t7, t8; +CREATE TABLE t7 (f1 char(20),f2 char(25),f3 date,f4 int) ENGINE = MyISAM; +CREATE TABLE t8 (f1 char(20),f2 char(25),f3 date,f4 int) ENGINE = MyISAM; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' INTO TABLE t7; +Warnings: +Warning 1265 Data truncated for column 'f3' at row 1 +Warning 1265 Data truncated for column 'f3' at row 2 +Warning 1265 Data truncated for column 'f3' at row 3 +Warning 1265 Data truncated for column 'f3' at row 4 +Warning 1265 Data truncated for column 'f3' at row 5 +Warning 1265 Data truncated for column 'f3' at row 6 +Warning 1265 Data truncated for column 'f3' at row 7 +Warning 1265 Data truncated for column 'f3' at row 8 +Warning 1265 Data truncated for column 'f3' at row 9 +Warning 1265 Data truncated for column 'f3' at row 10 +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' INTO TABLE t8; +Warnings: +Warning 1265 Data truncated for column 'f3' at row 1 +Warning 1265 Data truncated for column 'f3' at row 2 +Warning 1265 Data truncated for column 'f3' at row 3 +Warning 1265 Data truncated for column 'f3' at row 4 +Warning 1265 Data truncated for column 'f3' at row 5 +Warning 1265 Data truncated for column 'f3' at row 6 +Warning 1265 Data truncated for column 'f3' at row 7 +Warning 1265 Data truncated for column 'f3' at row 8 +Warning 1265 Data truncated for column 'f3' at row 9 +Warning 1265 Data truncated for column 'f3' at row 10 +drop TABLE if exists t9; +CREATE TABLE t9 (f1 int, f2 char(25), f3 int) ENGINE = MyISAM; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t9.txt' INTO TABLE t9; +SELECT * FROM information_schema.columns +WHERE table_schema LIKE 'test%' +ORDER BY table_schema, table_name, column_name; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT +NULL test t1 f1 1 NULL YES char 20 20 NULL NULL latin1 latin1_swedish_ci char(20) +NULL test t1 f2 2 NULL YES char 25 25 NULL NULL latin1 latin1_swedish_ci char(25) +NULL test t1 f3 3 NULL YES date NULL NULL NULL NULL NULL NULL date +NULL test t1 f4 4 NULL YES int NULL NULL 10 0 NULL NULL int(11) +NULL test t1 f5 5 NULL YES char 25 25 NULL NULL latin1 latin1_swedish_ci char(25) +NULL test t1 f6 6 NULL YES int NULL NULL 10 0 NULL NULL int(11) +NULL test t10 f1 1 NULL YES char 20 20 NULL NULL latin1 latin1_swedish_ci char(20) +NULL test t10 f2 2 NULL YES char 25 25 NULL NULL latin1 latin1_swedish_ci char(25) +NULL test t10 f3 3 NULL YES date NULL NULL NULL NULL NULL NULL date +NULL test t10 f4 4 NULL YES int NULL NULL 10 0 NULL NULL int(11) +NULL test t10 f5 5 NULL YES char 25 25 NULL NULL latin1 latin1_swedish_ci char(25) +NULL test t10 f6 6 NULL YES int NULL NULL 10 0 NULL NULL int(11) +NULL test t11 f1 1 NULL YES char 20 20 NULL NULL latin1 latin1_swedish_ci char(20) +NULL test t11 f2 2 NULL YES char 25 25 NULL NULL latin1 latin1_swedish_ci char(25) +NULL test t11 f3 3 NULL YES date NULL NULL NULL NULL NULL NULL date +NULL test t11 f4 4 NULL YES int NULL NULL 10 0 NULL NULL int(11) +NULL test t11 f5 5 NULL YES char 25 25 NULL NULL latin1 latin1_swedish_ci char(25) +NULL test t11 f6 6 NULL YES int NULL NULL 10 0 NULL NULL int(11) +NULL test t2 f1 1 NULL YES char 20 20 NULL NULL latin1 latin1_swedish_ci char(20) +NULL test t2 f2 2 NULL YES char 25 25 NULL NULL latin1 latin1_swedish_ci char(25) +NULL test t2 f3 3 NULL YES date NULL NULL NULL NULL NULL NULL date +NULL test t2 f4 4 NULL YES int NULL NULL 10 0 NULL NULL int(11) +NULL test t2 f5 5 NULL YES char 25 25 NULL NULL latin1 latin1_swedish_ci char(25) +NULL test t2 f6 6 NULL YES int NULL NULL 10 0 NULL NULL int(11) +NULL test t3 f1 1 NULL YES char 20 20 NULL NULL latin1 latin1_swedish_ci char(20) +NULL test t3 f2 2 NULL YES char 20 20 NULL NULL latin1 latin1_swedish_ci char(20) +NULL test t3 f3 3 NULL YES int NULL NULL 10 0 NULL NULL int(11) +NULL test t4 f1 1 NULL YES char 20 20 NULL NULL latin1 latin1_swedish_ci char(20) +NULL test t4 f2 2 NULL YES char 25 25 NULL NULL latin1 latin1_swedish_ci char(25) +NULL test t4 f3 3 NULL YES date NULL NULL NULL NULL NULL NULL date +NULL test t4 f4 4 NULL YES int NULL NULL 10 0 NULL NULL int(11) +NULL test t4 f5 5 NULL YES char 25 25 NULL NULL latin1 latin1_swedish_ci char(25) +NULL test t4 f6 6 NULL YES int NULL NULL 10 0 NULL NULL int(11) +NULL test t7 f1 1 NULL YES char 20 20 NULL NULL latin1 latin1_swedish_ci char(20) +NULL test t7 f2 2 NULL YES char 25 25 NULL NULL latin1 latin1_swedish_ci char(25) +NULL test t7 f3 3 NULL YES date NULL NULL NULL NULL NULL NULL date +NULL test t7 f4 4 NULL YES int NULL NULL 10 0 NULL NULL int(11) +NULL test t8 f1 1 NULL YES char 20 20 NULL NULL latin1 latin1_swedish_ci char(20) +NULL test t8 f2 2 NULL YES char 25 25 NULL NULL latin1 latin1_swedish_ci char(25) +NULL test t8 f3 3 NULL YES date NULL NULL NULL NULL NULL NULL date +NULL test t8 f4 4 NULL YES int NULL NULL 10 0 NULL NULL int(11) +NULL test t9 f1 1 NULL YES int NULL NULL 10 0 NULL NULL int(11) +NULL test t9 f2 2 NULL YES char 25 25 NULL NULL latin1 latin1_swedish_ci char(25) +NULL test t9 f3 3 NULL YES int NULL NULL 10 0 NULL NULL int(11) +NULL test tb1 f1 1 NULL YES char 1 1 NULL NULL latin1 latin1_swedish_ci char(1) +NULL test tb1 f10 10 NULL YES mediumblob 16777215 16777215 NULL NULL NULL NULL mediumblob +NULL test tb1 f11 11 NULL YES longblob 4294967295 4294967295 NULL NULL NULL NULL longblob +NULL test tb1 f12 12 NULL YES binary 1 1 NULL NULL NULL NULL binary(1) +NULL test tb1 f13 13 NULL YES tinyint NULL NULL 3 0 NULL NULL tinyint(4) +NULL test tb1 f14 14 NULL YES tinyint NULL NULL 3 0 NULL NULL tinyint(3) unsigned +NULL test tb1 f15 15 NULL YES tinyint NULL NULL 3 0 NULL NULL tinyint(3) unsigned zerofill +NULL test tb1 f16 16 NULL YES tinyint NULL NULL 3 0 NULL NULL tinyint(3) unsigned zerofill +NULL test tb1 f17 17 NULL YES smallint NULL NULL 5 0 NULL NULL smallint(6) +NULL test tb1 f18 18 NULL YES smallint NULL NULL 5 0 NULL NULL smallint(5) unsigned +NULL test tb1 f19 19 NULL YES smallint NULL NULL 5 0 NULL NULL smallint(5) unsigned zerofill +NULL test tb1 f2 2 NULL YES char 1 1 NULL NULL latin1 latin1_bin char(1) +NULL test tb1 f20 20 NULL YES smallint NULL NULL 5 0 NULL NULL smallint(5) unsigned zerofill +NULL test tb1 f21 21 NULL YES mediumint NULL NULL 7 0 NULL NULL mediumint(9) +NULL test tb1 f22 22 NULL YES mediumint NULL NULL 7 0 NULL NULL mediumint(8) unsigned +NULL test tb1 f23 23 NULL YES mediumint NULL NULL 7 0 NULL NULL mediumint(8) unsigned zerofill +NULL test tb1 f24 24 NULL YES mediumint NULL NULL 7 0 NULL NULL mediumint(8) unsigned zerofill +NULL test tb1 f25 25 NULL YES int NULL NULL 10 0 NULL NULL int(11) +NULL test tb1 f26 26 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned +NULL test tb1 f27 27 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill +NULL test tb1 f28 28 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill +NULL test tb1 f29 29 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) +NULL test tb1 f3 3 NULL YES char 1 1 NULL NULL latin1 latin1_swedish_ci char(1) +NULL test tb1 f30 30 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned +NULL test tb1 f31 31 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill +NULL test tb1 f32 32 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill +NULL test tb1 f33 33 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) +NULL test tb1 f34 34 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned +NULL test tb1 f35 35 0000000010 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill +NULL test tb1 f36 36 0000000010 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill +NULL test tb1 f37 37 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) +NULL test tb1 f38 38 10 NO decimal NULL NULL 64 0 NULL NULL decimal(64,0) +NULL test tb1 f39 39 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned +NULL test tb1 f4 4 NULL YES tinytext 255 255 NULL NULL latin1 latin1_swedish_ci tinytext +NULL test tb1 f40 40 10 NO decimal NULL NULL 64 0 NULL NULL decimal(64,0) unsigned +NULL test tb1 f41 41 0000000010 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill +NULL test tb1 f42 42 0000000000000000000000000000000000000000000000000000000000000010 NO decimal NULL NULL 64 0 NULL NULL decimal(64,0) unsigned zerofill +NULL test tb1 f43 43 0000000010 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill +NULL test tb1 f44 44 0000000000000000000000000000000000000000000000000000000000000010 NO decimal NULL NULL 64 0 NULL NULL decimal(64,0) unsigned zerofill +NULL test tb1 f45 45 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) +NULL test tb1 f46 46 9.900000000000000000000000000000 NO decimal NULL NULL 63 30 NULL NULL decimal(63,30) +NULL test tb1 f47 47 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned +NULL test tb1 f48 48 9.900000000000000000000000000000 NO decimal NULL NULL 63 30 NULL NULL decimal(63,30) unsigned +NULL test tb1 f49 49 0000000010 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill +NULL test tb1 f5 5 NULL YES text 65535 65535 NULL NULL latin1 latin1_swedish_ci text +NULL test tb1 f50 50 000000000000000000000000000000009.900000000000000000000000000000 NO decimal NULL NULL 63 30 NULL NULL decimal(63,30) unsigned zerofill +NULL test tb1 f51 51 0000000010 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill +NULL test tb1 f52 52 000000000000000000000000000000009.900000000000000000000000000000 NO decimal NULL NULL 63 30 NULL NULL decimal(63,30) unsigned zerofill +NULL test tb1 f53 53 99 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) +NULL test tb1 f54 54 99 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned +NULL test tb1 f55 55 0000000099 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill +NULL test tb1 f56 56 0000000099 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill +NULL test tb1 f57 57 99 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) +NULL test tb1 f58 58 99 NO decimal NULL NULL 64 0 NULL NULL decimal(64,0) +NULL test tb1 f6 6 NULL YES mediumtext 16777215 16777215 NULL NULL latin1 latin1_swedish_ci mediumtext +NULL test tb1 f7 7 NULL YES longtext 4294967295 4294967295 NULL NULL latin1 latin1_swedish_ci longtext +NULL test tb1 f8 8 NULL YES tinyblob 255 255 NULL NULL NULL NULL tinyblob +NULL test tb1 f9 9 NULL YES blob 65535 65535 NULL NULL NULL NULL blob +NULL test tb2 f100 42 00000000000000000008.8 NO double unsigned zerofill NULL NULL 22 NULL NULL NULL double unsigned zerofill +NULL test tb2 f101 43 2000-01-01 NO date NULL NULL NULL NULL NULL NULL date +NULL test tb2 f102 44 00:00:20 NO time NULL NULL NULL NULL NULL NULL time +NULL test tb2 f103 45 0002-02-02 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime +NULL test tb2 f104 46 2000-12-31 23:59:59 NO timestamp NULL NULL NULL NULL NULL NULL timestamp +NULL test tb2 f105 47 2000 NO year NULL NULL NULL NULL NULL NULL year(4) +NULL test tb2 f106 48 2000 NO year NULL NULL NULL NULL NULL NULL year(4) +NULL test tb2 f107 49 2000 NO year NULL NULL NULL NULL NULL NULL year(4) +NULL test tb2 f108 50 1enum NO enum 5 5 NULL NULL latin1 latin1_swedish_ci enum('1enum','2enum') +NULL test tb2 f109 51 1set NO set 9 9 NULL NULL latin1 latin1_swedish_ci set('1set','2set') +NULL test tb2 f110 52 NULL YES varbinary 64 64 NULL NULL NULL NULL varbinary(64) +NULL test tb2 f111 53 NULL YES varbinary 27 27 NULL NULL NULL NULL varbinary(27) +NULL test tb2 f112 54 NULL YES varbinary 64 64 NULL NULL NULL NULL varbinary(64) +NULL test tb2 f113 55 NULL YES varbinary 192 192 NULL NULL NULL NULL varbinary(192) +NULL test tb2 f114 56 NULL YES varbinary 192 192 NULL NULL NULL NULL varbinary(192) +NULL test tb2 f115 57 NULL YES varbinary 27 27 NULL NULL NULL NULL varbinary(27) +NULL test tb2 f116 58 NULL YES varbinary 64 64 NULL NULL NULL NULL varbinary(64) +NULL test tb2 f117 59 NULL YES varbinary 192 192 NULL NULL NULL NULL varbinary(192) +NULL test tb2 f59 1 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned +NULL test tb2 f60 2 NULL YES decimal NULL NULL 64 0 NULL NULL decimal(64,0) unsigned +NULL test tb2 f61 3 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill +NULL test tb2 f62 4 NULL YES decimal NULL NULL 64 0 NULL NULL decimal(64,0) unsigned zerofill +NULL test tb2 f63 5 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill +NULL test tb2 f64 6 NULL YES decimal NULL NULL 64 0 NULL NULL decimal(64,0) unsigned zerofill +NULL test tb2 f65 7 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) +NULL test tb2 f66 8 NULL YES decimal NULL NULL 63 30 NULL NULL decimal(63,30) +NULL test tb2 f67 9 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned +NULL test tb2 f68 10 NULL YES decimal NULL NULL 63 30 NULL NULL decimal(63,30) unsigned +NULL test tb2 f69 11 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill +NULL test tb2 f70 12 NULL YES decimal NULL NULL 63 30 NULL NULL decimal(63,30) unsigned zerofill +NULL test tb2 f71 13 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill +NULL test tb2 f72 14 NULL YES decimal NULL NULL 63 30 NULL NULL decimal(63,30) unsigned zerofill +NULL test tb2 f73 15 NULL YES double NULL NULL 22 NULL NULL NULL double +NULL test tb2 f74 16 NULL YES double unsigned NULL NULL 22 NULL NULL NULL double unsigned +NULL test tb2 f75 17 NULL YES double unsigned zerofill NULL NULL 22 NULL NULL NULL double unsigned zerofill +NULL test tb2 f76 18 NULL YES double unsigned zerofill NULL NULL 22 NULL NULL NULL double unsigned zerofill +NULL test tb2 f77 19 7.7 YES double NULL NULL 22 NULL NULL NULL double +NULL test tb2 f78 20 7.7 YES double unsigned NULL NULL 22 NULL NULL NULL double unsigned +NULL test tb2 f79 21 00000000000000000007.7 YES double unsigned zerofill NULL NULL 22 NULL NULL NULL double unsigned zerofill +NULL test tb2 f80 22 00000000000000000008.8 YES double unsigned zerofill NULL NULL 22 NULL NULL NULL double unsigned zerofill +NULL test tb2 f81 23 8.8 NO float NULL NULL 12 NULL NULL NULL float +NULL test tb2 f82 24 8.8 NO float unsigned NULL NULL 12 NULL NULL NULL float unsigned +NULL test tb2 f83 25 0000000008.8 NO float unsigned zerofill NULL NULL 12 NULL NULL NULL float unsigned zerofill +NULL test tb2 f84 26 0000000008.8 NO float unsigned zerofill NULL NULL 12 NULL NULL NULL float unsigned zerofill +NULL test tb2 f85 27 8.8 NO float NULL NULL 12 NULL NULL NULL float +NULL test tb2 f86 28 8.8 NO float NULL NULL 12 NULL NULL NULL float +NULL test tb2 f87 29 8.8 NO float unsigned NULL NULL 12 NULL NULL NULL float unsigned +NULL test tb2 f88 30 8.8 NO float unsigned NULL NULL 12 NULL NULL NULL float unsigned +NULL test tb2 f89 31 0000000008.8 NO float unsigned zerofill NULL NULL 12 NULL NULL NULL float unsigned zerofill +NULL test tb2 f90 32 0000000008.8 NO float unsigned zerofill NULL NULL 12 NULL NULL NULL float unsigned zerofill +NULL test tb2 f91 33 0000000008.8 NO float unsigned zerofill NULL NULL 12 NULL NULL NULL float unsigned zerofill +NULL test tb2 f92 34 0000000008.8 NO float unsigned zerofill NULL NULL 12 NULL NULL NULL float unsigned zerofill +NULL test tb2 f93 35 8.8 NO float NULL NULL 12 NULL NULL NULL float +NULL test tb2 f94 36 8.8 NO double NULL NULL 22 NULL NULL NULL double +NULL test tb2 f95 37 8.8 NO float unsigned NULL NULL 12 NULL NULL NULL float unsigned +NULL test tb2 f96 38 8.8 NO double unsigned NULL NULL 22 NULL NULL NULL double unsigned +NULL test tb2 f97 39 0000000008.8 NO float unsigned zerofill NULL NULL 12 NULL NULL NULL float unsigned zerofill +NULL test tb2 f98 40 00000000000000000008.8 NO double unsigned zerofill NULL NULL 22 NULL NULL NULL double unsigned zerofill +NULL test tb2 f99 41 0000000008.8 NO float unsigned zerofill NULL NULL 12 NULL NULL NULL float unsigned zerofill +NULL test tb3 f118 1 a NO char 1 1 NULL NULL latin1 latin1_swedish_ci char(1) +NULL test tb3 f119 2 NO char 1 1 NULL NULL latin1 latin1_bin char(1) +NULL test tb3 f120 3 NO char 1 1 NULL NULL latin1 latin1_swedish_ci char(1) +NULL test tb3 f121 4 NULL YES tinytext 255 255 NULL NULL latin1 latin1_swedish_ci tinytext +NULL test tb3 f122 5 NULL YES text 65535 65535 NULL NULL latin1 latin1_swedish_ci text +NULL test tb3 f123 6 NULL YES mediumtext 16777215 16777215 NULL NULL latin1 latin1_swedish_ci mediumtext +NULL test tb3 f124 7 NULL YES longtext 4294967295 4294967295 NULL NULL latin1 latin1_swedish_ci longtext +NULL test tb3 f125 8 NULL YES tinyblob 255 255 NULL NULL NULL NULL tinyblob +NULL test tb3 f126 9 NULL YES blob 65535 65535 NULL NULL NULL NULL blob +NULL test tb3 f127 10 NULL YES mediumblob 16777215 16777215 NULL NULL NULL NULL mediumblob +NULL test tb3 f128 11 NULL YES longblob 4294967295 4294967295 NULL NULL NULL NULL longblob +NULL test tb3 f129 12 NO binary 1 1 NULL NULL NULL NULL binary(1) +NULL test tb3 f130 13 99 NO tinyint NULL NULL 3 0 NULL NULL tinyint(4) +NULL test tb3 f131 14 99 NO tinyint NULL NULL 3 0 NULL NULL tinyint(3) unsigned +NULL test tb3 f132 15 099 NO tinyint NULL NULL 3 0 NULL NULL tinyint(3) unsigned zerofill +NULL test tb3 f133 16 099 NO tinyint NULL NULL 3 0 NULL NULL tinyint(3) unsigned zerofill +NULL test tb3 f134 17 999 NO smallint NULL NULL 5 0 NULL NULL smallint(6) +NULL test tb3 f135 18 999 NO smallint NULL NULL 5 0 NULL NULL smallint(5) unsigned +NULL test tb3 f136 19 00999 NO smallint NULL NULL 5 0 NULL NULL smallint(5) unsigned zerofill +NULL test tb3 f137 20 00999 NO smallint NULL NULL 5 0 NULL NULL smallint(5) unsigned zerofill +NULL test tb3 f138 21 9999 NO mediumint NULL NULL 7 0 NULL NULL mediumint(9) +NULL test tb3 f139 22 9999 NO mediumint NULL NULL 7 0 NULL NULL mediumint(8) unsigned +NULL test tb3 f140 23 00009999 NO mediumint NULL NULL 7 0 NULL NULL mediumint(8) unsigned zerofill +NULL test tb3 f141 24 00009999 NO mediumint NULL NULL 7 0 NULL NULL mediumint(8) unsigned zerofill +NULL test tb3 f142 25 99999 NO int NULL NULL 10 0 NULL NULL int(11) +NULL test tb3 f143 26 99999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned +NULL test tb3 f144 27 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill +NULL test tb3 f145 28 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill +NULL test tb3 f146 29 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) +NULL test tb3 f147 30 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned +NULL test tb3 f148 31 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill +NULL test tb3 f149 32 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill +NULL test tb3 f150 33 1000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) +NULL test tb3 f151 34 999 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned +NULL test tb3 f152 35 0000001000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill +NULL test tb3 f153 36 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill +NULL test tb3 f154 37 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) +NULL test tb3 f155 38 NULL YES decimal NULL NULL 64 0 NULL NULL decimal(64,0) +NULL test tb3 f156 39 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned +NULL test tb3 f157 40 NULL YES decimal NULL NULL 64 0 NULL NULL decimal(64,0) unsigned +NULL test tb3 f158 41 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill +NULL test tb3 f159 42 NULL YES decimal NULL NULL 64 0 NULL NULL decimal(64,0) unsigned zerofill +NULL test tb3 f160 43 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill +NULL test tb3 f161 44 NULL YES decimal NULL NULL 64 0 NULL NULL decimal(64,0) unsigned zerofill +NULL test tb3 f162 45 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) +NULL test tb3 f163 46 NULL YES decimal NULL NULL 63 30 NULL NULL decimal(63,30) +NULL test tb3 f164 47 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned +NULL test tb3 f165 48 NULL YES decimal NULL NULL 63 30 NULL NULL decimal(63,30) unsigned +NULL test tb3 f166 49 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill +NULL test tb3 f167 50 NULL YES decimal NULL NULL 63 30 NULL NULL decimal(63,30) unsigned zerofill +NULL test tb3 f168 51 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill +NULL test tb3 f169 52 NULL YES decimal NULL NULL 63 30 NULL NULL decimal(63,30) unsigned zerofill +NULL test tb3 f170 53 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) +NULL test tb3 f171 54 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned +NULL test tb3 f172 55 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill +NULL test tb3 f173 56 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill +NULL test tb3 f174 57 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) +NULL test tb3 f175 58 NULL YES decimal NULL NULL 64 0 NULL NULL decimal(64,0) +NULL test tb4 f176 1 9 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned +NULL test tb4 f177 2 9 NO decimal NULL NULL 64 0 NULL NULL decimal(64,0) unsigned +NULL test tb4 f178 3 0000000009 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill +NULL test tb4 f179 4 0000000000000000000000000000000000000000000000000000000000000009 NO decimal NULL NULL 64 0 NULL NULL decimal(64,0) unsigned zerofill +NULL test tb4 f180 5 0000000009 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill +NULL test tb4 f181 6 0000000000000000000000000000000000000000000000000000000000000009 NO decimal NULL NULL 64 0 NULL NULL decimal(64,0) unsigned zerofill +NULL test tb4 f182 7 9 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) +NULL test tb4 f183 8 9.000000000000000000000000000000 NO decimal NULL NULL 63 30 NULL NULL decimal(63,30) +NULL test tb4 f184 9 9 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned +NULL test tb4 f185 10 9.000000000000000000000000000000 NO decimal NULL NULL 63 30 NULL NULL decimal(63,30) unsigned +NULL test tb4 f186 11 0000000009 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill +NULL test tb4 f187 12 000000000000000000000000000000009.000000000000000000000000000000 NO decimal NULL NULL 63 30 NULL NULL decimal(63,30) unsigned zerofill +NULL test tb4 f188 13 0000000009 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill +NULL test tb4 f189 14 000000000000000000000000000000009.000000000000000000000000000000 NO decimal NULL NULL 63 30 NULL NULL decimal(63,30) unsigned zerofill +NULL test tb4 f190 15 88.8 NO double NULL NULL 22 NULL NULL NULL double +NULL test tb4 f191 16 88.8 NO double unsigned NULL NULL 22 NULL NULL NULL double unsigned +NULL test tb4 f192 17 00000000000000000088.8 NO double unsigned zerofill NULL NULL 22 NULL NULL NULL double unsigned zerofill +NULL test tb4 f193 18 00000000000000000088.8 NO double unsigned zerofill NULL NULL 22 NULL NULL NULL double unsigned zerofill +NULL test tb4 f194 19 55.5 NO double NULL NULL 22 NULL NULL NULL double +NULL test tb4 f195 20 55.5 NO double unsigned NULL NULL 22 NULL NULL NULL double unsigned +NULL test tb4 f196 21 00000000000000000055.5 NO double unsigned zerofill NULL NULL 22 NULL NULL NULL double unsigned zerofill +NULL test tb4 f197 22 00000000000000000055.5 NO double unsigned zerofill NULL NULL 22 NULL NULL NULL double unsigned zerofill +NULL test tb4 f198 23 NULL YES float NULL NULL 12 NULL NULL NULL float +NULL test tb4 f199 24 NULL YES float unsigned NULL NULL 12 NULL NULL NULL float unsigned +NULL test tb4 f200 25 NULL YES float unsigned zerofill NULL NULL 12 NULL NULL NULL float unsigned zerofill +NULL test tb4 f201 26 NULL YES float unsigned zerofill NULL NULL 12 NULL NULL NULL float unsigned zerofill +NULL test tb4 f202 27 NULL YES float NULL NULL 12 NULL NULL NULL float +NULL test tb4 f203 28 NULL YES float NULL NULL 12 NULL NULL NULL float +NULL test tb4 f204 29 NULL YES float unsigned NULL NULL 12 NULL NULL NULL float unsigned +NULL test tb4 f205 30 NULL YES float unsigned NULL NULL 12 NULL NULL NULL float unsigned +NULL test tb4 f206 31 NULL YES float unsigned zerofill NULL NULL 12 NULL NULL NULL float unsigned zerofill +NULL test tb4 f207 32 NULL YES float unsigned zerofill NULL NULL 12 NULL NULL NULL float unsigned zerofill +NULL test tb4 f208 33 NULL YES float unsigned zerofill NULL NULL 12 NULL NULL NULL float unsigned zerofill +NULL test tb4 f209 34 NULL YES float unsigned zerofill NULL NULL 12 NULL NULL NULL float unsigned zerofill +NULL test tb4 f210 35 NULL YES float NULL NULL 12 NULL NULL NULL float +NULL test tb4 f211 36 NULL YES double NULL NULL 22 NULL NULL NULL double +NULL test tb4 f212 37 NULL YES float unsigned NULL NULL 12 NULL NULL NULL float unsigned +NULL test tb4 f213 38 NULL YES double unsigned NULL NULL 22 NULL NULL NULL double unsigned +NULL test tb4 f214 39 NULL YES float unsigned zerofill NULL NULL 12 NULL NULL NULL float unsigned zerofill +NULL test tb4 f215 40 NULL YES double unsigned zerofill NULL NULL 22 NULL NULL NULL double unsigned zerofill +NULL test tb4 f216 41 NULL YES float unsigned zerofill NULL NULL 12 NULL NULL NULL float unsigned zerofill +NULL test tb4 f217 42 NULL YES double unsigned zerofill NULL NULL 22 NULL NULL NULL double unsigned zerofill +NULL test tb4 f218 43 NULL YES date NULL NULL NULL NULL NULL NULL date +NULL test tb4 f219 44 NULL YES time NULL NULL NULL NULL NULL NULL time +NULL test tb4 f220 45 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime +NULL test tb4 f221 46 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL NULL NULL timestamp +NULL test tb4 f222 47 NULL YES year NULL NULL NULL NULL NULL NULL year(4) +NULL test tb4 f223 48 NULL YES year NULL NULL NULL NULL NULL NULL year(4) +NULL test tb4 f224 49 NULL YES year NULL NULL NULL NULL NULL NULL year(4) +NULL test tb4 f225 50 NULL YES enum 5 5 NULL NULL latin1 latin1_swedish_ci enum('1enum','2enum') +NULL test tb4 f226 51 NULL YES set 9 9 NULL NULL latin1 latin1_swedish_ci set('1set','2set') +NULL test tb4 f227 52 NULL YES varbinary 64 64 NULL NULL NULL NULL varbinary(64) +NULL test tb4 f228 53 NULL YES varbinary 27 27 NULL NULL NULL NULL varbinary(27) +NULL test tb4 f229 54 NULL YES varbinary 64 64 NULL NULL NULL NULL varbinary(64) +NULL test tb4 f230 55 NULL YES varbinary 192 192 NULL NULL NULL NULL varbinary(192) +NULL test tb4 f231 56 NULL YES varbinary 192 192 NULL NULL NULL NULL varbinary(192) +NULL test tb4 f232 57 NULL YES varbinary 27 27 NULL NULL NULL NULL varbinary(27) +NULL test tb4 f233 58 NULL YES varbinary 64 64 NULL NULL NULL NULL varbinary(64) +NULL test tb4 f234 59 NULL YES varbinary 192 192 NULL NULL NULL NULL varbinary(192) +NULL test tb4 f235 60 NULL YES char 255 255 NULL NULL latin1 latin1_swedish_ci char(255) +NULL test tb4 f236 61 NULL YES char 60 60 NULL NULL latin1 latin1_swedish_ci char(60) +NULL test tb4 f237 62 NULL YES char 255 255 NULL NULL latin1 latin1_bin char(255) +NULL test tb4 f238 63 NULL YES varchar 0 0 NULL NULL latin1 latin1_bin varchar(0) +NULL test tb4 f239 64 NULL YES varbinary 1000 1000 NULL NULL NULL NULL varbinary(1000) +NULL test tb4 f240 65 NULL YES varchar 120 120 NULL NULL latin1 latin1_swedish_ci varchar(120) +NULL test tb4 f241 66 NULL YES char 100 100 NULL NULL latin1 latin1_swedish_ci char(100) +NULL test tb4 f242 67 NULL YES bit NULL NULL 30 NULL NULL NULL bit(30) +NULL test1 tb2 f100 42 00000000000000000008.8 NO double unsigned zerofill NULL NULL 22 NULL NULL NULL double unsigned zerofill +NULL test1 tb2 f101 43 2000-01-01 NO date NULL NULL NULL NULL NULL NULL date +NULL test1 tb2 f102 44 00:00:20 NO time NULL NULL NULL NULL NULL NULL time +NULL test1 tb2 f103 45 0002-02-02 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime +NULL test1 tb2 f104 46 2000-12-31 23:59:59 NO timestamp NULL NULL NULL NULL NULL NULL timestamp +NULL test1 tb2 f105 47 2000 NO year NULL NULL NULL NULL NULL NULL year(4) +NULL test1 tb2 f106 48 2000 NO year NULL NULL NULL NULL NULL NULL year(4) +NULL test1 tb2 f107 49 2000 NO year NULL NULL NULL NULL NULL NULL year(4) +NULL test1 tb2 f108 50 1enum NO enum 5 5 NULL NULL latin1 latin1_swedish_ci enum('1enum','2enum') +NULL test1 tb2 f109 51 1set NO set 9 9 NULL NULL latin1 latin1_swedish_ci set('1set','2set') +NULL test1 tb2 f110 52 NULL YES varbinary 64 64 NULL NULL NULL NULL varbinary(64) +NULL test1 tb2 f111 53 NULL YES varbinary 27 27 NULL NULL NULL NULL varbinary(27) +NULL test1 tb2 f112 54 NULL YES varbinary 64 64 NULL NULL NULL NULL varbinary(64) +NULL test1 tb2 f113 55 NULL YES varbinary 192 192 NULL NULL NULL NULL varbinary(192) +NULL test1 tb2 f114 56 NULL YES varbinary 192 192 NULL NULL NULL NULL varbinary(192) +NULL test1 tb2 f115 57 NULL YES varbinary 27 27 NULL NULL NULL NULL varbinary(27) +NULL test1 tb2 f116 58 NULL YES varbinary 64 64 NULL NULL NULL NULL varbinary(64) +NULL test1 tb2 f117 59 NULL YES varbinary 192 192 NULL NULL NULL NULL varbinary(192) +NULL test1 tb2 f59 1 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned +NULL test1 tb2 f60 2 NULL YES decimal NULL NULL 64 0 NULL NULL decimal(64,0) unsigned +NULL test1 tb2 f61 3 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill +NULL test1 tb2 f62 4 NULL YES decimal NULL NULL 64 0 NULL NULL decimal(64,0) unsigned zerofill +NULL test1 tb2 f63 5 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill +NULL test1 tb2 f64 6 NULL YES decimal NULL NULL 64 0 NULL NULL decimal(64,0) unsigned zerofill +NULL test1 tb2 f65 7 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) +NULL test1 tb2 f66 8 NULL YES decimal NULL NULL 63 30 NULL NULL decimal(63,30) +NULL test1 tb2 f67 9 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned +NULL test1 tb2 f68 10 NULL YES decimal NULL NULL 63 30 NULL NULL decimal(63,30) unsigned +NULL test1 tb2 f69 11 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill +NULL test1 tb2 f70 12 NULL YES decimal NULL NULL 63 30 NULL NULL decimal(63,30) unsigned zerofill +NULL test1 tb2 f71 13 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill +NULL test1 tb2 f72 14 NULL YES decimal NULL NULL 63 30 NULL NULL decimal(63,30) unsigned zerofill +NULL test1 tb2 f73 15 NULL YES double NULL NULL 22 NULL NULL NULL double +NULL test1 tb2 f74 16 NULL YES double unsigned NULL NULL 22 NULL NULL NULL double unsigned +NULL test1 tb2 f75 17 NULL YES double unsigned zerofill NULL NULL 22 NULL NULL NULL double unsigned zerofill +NULL test1 tb2 f76 18 NULL YES double unsigned zerofill NULL NULL 22 NULL NULL NULL double unsigned zerofill +NULL test1 tb2 f77 19 7.7 YES double NULL NULL 22 NULL NULL NULL double +NULL test1 tb2 f78 20 7.7 YES double unsigned NULL NULL 22 NULL NULL NULL double unsigned +NULL test1 tb2 f79 21 00000000000000000007.7 YES double unsigned zerofill NULL NULL 22 NULL NULL NULL double unsigned zerofill +NULL test1 tb2 f80 22 00000000000000000008.8 YES double unsigned zerofill NULL NULL 22 NULL NULL NULL double unsigned zerofill +NULL test1 tb2 f81 23 8.8 NO float NULL NULL 12 NULL NULL NULL float +NULL test1 tb2 f82 24 8.8 NO float unsigned NULL NULL 12 NULL NULL NULL float unsigned +NULL test1 tb2 f83 25 0000000008.8 NO float unsigned zerofill NULL NULL 12 NULL NULL NULL float unsigned zerofill +NULL test1 tb2 f84 26 0000000008.8 NO float unsigned zerofill NULL NULL 12 NULL NULL NULL float unsigned zerofill +NULL test1 tb2 f85 27 8.8 NO float NULL NULL 12 NULL NULL NULL float +NULL test1 tb2 f86 28 8.8 NO float NULL NULL 12 NULL NULL NULL float +NULL test1 tb2 f87 29 8.8 NO float unsigned NULL NULL 12 NULL NULL NULL float unsigned +NULL test1 tb2 f88 30 8.8 NO float unsigned NULL NULL 12 NULL NULL NULL float unsigned +NULL test1 tb2 f89 31 0000000008.8 NO float unsigned zerofill NULL NULL 12 NULL NULL NULL float unsigned zerofill +NULL test1 tb2 f90 32 0000000008.8 NO float unsigned zerofill NULL NULL 12 NULL NULL NULL float unsigned zerofill +NULL test1 tb2 f91 33 0000000008.8 NO float unsigned zerofill NULL NULL 12 NULL NULL NULL float unsigned zerofill +NULL test1 tb2 f92 34 0000000008.8 NO float unsigned zerofill NULL NULL 12 NULL NULL NULL float unsigned zerofill +NULL test1 tb2 f93 35 8.8 NO float NULL NULL 12 NULL NULL NULL float +NULL test1 tb2 f94 36 8.8 NO double NULL NULL 22 NULL NULL NULL double +NULL test1 tb2 f95 37 8.8 NO float unsigned NULL NULL 12 NULL NULL NULL float unsigned +NULL test1 tb2 f96 38 8.8 NO double unsigned NULL NULL 22 NULL NULL NULL double unsigned +NULL test1 tb2 f97 39 0000000008.8 NO float unsigned zerofill NULL NULL 12 NULL NULL NULL float unsigned zerofill +NULL test1 tb2 f98 40 00000000000000000008.8 NO double unsigned zerofill NULL NULL 22 NULL NULL NULL double unsigned zerofill +NULL test1 tb2 f99 41 0000000008.8 NO float unsigned zerofill NULL NULL 12 NULL NULL NULL float unsigned zerofill +NULL test4 t6 f1 1 NULL YES char 20 20 NULL NULL latin1 latin1_swedish_ci char(20) +NULL test4 t6 f2 2 NULL YES char 25 25 NULL NULL latin1 latin1_swedish_ci char(25) +NULL test4 t6 f3 3 NULL YES date NULL NULL NULL NULL NULL NULL date +NULL test4 t6 f4 4 NULL YES int NULL NULL 10 0 NULL NULL int(11) +NULL test4 t6 f5 5 NULL YES char 25 25 NULL NULL latin1 latin1_swedish_ci char(25) +NULL test4 t6 f6 6 NULL YES int NULL NULL 10 0 NULL NULL int(11) +########################################################################## +# Show the quotient of CHARACTER_OCTET_LENGTH and CHARACTER_MAXIMUM_LENGTH +########################################################################## +SELECT DISTINCT +CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, +DATA_TYPE, +CHARACTER_SET_NAME, +COLLATION_NAME +FROM information_schema.columns +WHERE table_schema LIKE 'test%' +AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH = 1 +ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML; +COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME +1.0000 binary NULL NULL +1.0000 blob NULL NULL +1.0000 longblob NULL NULL +1.0000 mediumblob NULL NULL +1.0000 tinyblob NULL NULL +1.0000 varbinary NULL NULL +1.0000 char latin1 latin1_bin +1.0000 char latin1 latin1_swedish_ci +1.0000 enum latin1 latin1_swedish_ci +1.0000 longtext latin1 latin1_swedish_ci +1.0000 mediumtext latin1 latin1_swedish_ci +1.0000 set latin1 latin1_swedish_ci +1.0000 text latin1 latin1_swedish_ci +1.0000 tinytext latin1 latin1_swedish_ci +1.0000 varchar latin1 latin1_swedish_ci +SELECT DISTINCT +CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, +DATA_TYPE, +CHARACTER_SET_NAME, +COLLATION_NAME +FROM information_schema.columns +WHERE table_schema LIKE 'test%' +AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH <> 1 +ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML; +COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME +SELECT DISTINCT +CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, +DATA_TYPE, +CHARACTER_SET_NAME, +COLLATION_NAME +FROM information_schema.columns +WHERE table_schema LIKE 'test%' +AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH IS NULL +ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML; +COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME +NULL bigint NULL NULL +NULL bit NULL NULL +NULL date NULL NULL +NULL datetime NULL NULL +NULL decimal NULL NULL +NULL double NULL NULL +NULL double unsigned NULL NULL +NULL double unsigned zerofill NULL NULL +NULL float NULL NULL +NULL float unsigned NULL NULL +NULL float unsigned zerofill NULL NULL +NULL int NULL NULL +NULL mediumint NULL NULL +NULL smallint NULL NULL +NULL time NULL NULL +NULL timestamp NULL NULL +NULL tinyint NULL NULL +NULL year NULL NULL +NULL varchar latin1 latin1_bin +--> CHAR(0) is allowed (see manual), and here both CHARACHTER_* values +--> are 0, which is intended behavior, and the result of 0 / 0 IS NULL +SELECT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, +TABLE_SCHEMA, +TABLE_NAME, +COLUMN_NAME, +DATA_TYPE, +CHARACTER_MAXIMUM_LENGTH, +CHARACTER_OCTET_LENGTH, +CHARACTER_SET_NAME, +COLLATION_NAME, +COLUMN_TYPE +FROM information_schema.columns +WHERE table_schema LIKE 'test%' +ORDER BY TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION; +COL_CML TABLE_SCHEMA TABLE_NAME COLUMN_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE +1.0000 test t1 f1 char 20 20 latin1 latin1_swedish_ci char(20) +1.0000 test t1 f2 char 25 25 latin1 latin1_swedish_ci char(25) +NULL test t1 f3 date NULL NULL NULL NULL date +NULL test t1 f4 int NULL NULL NULL NULL int(11) +1.0000 test t1 f5 char 25 25 latin1 latin1_swedish_ci char(25) +NULL test t1 f6 int NULL NULL NULL NULL int(11) +1.0000 test t10 f1 char 20 20 latin1 latin1_swedish_ci char(20) +1.0000 test t10 f2 char 25 25 latin1 latin1_swedish_ci char(25) +NULL test t10 f3 date NULL NULL NULL NULL date +NULL test t10 f4 int NULL NULL NULL NULL int(11) +1.0000 test t10 f5 char 25 25 latin1 latin1_swedish_ci char(25) +NULL test t10 f6 int NULL NULL NULL NULL int(11) +1.0000 test t11 f1 char 20 20 latin1 latin1_swedish_ci char(20) +1.0000 test t11 f2 char 25 25 latin1 latin1_swedish_ci char(25) +NULL test t11 f3 date NULL NULL NULL NULL date +NULL test t11 f4 int NULL NULL NULL NULL int(11) +1.0000 test t11 f5 char 25 25 latin1 latin1_swedish_ci char(25) +NULL test t11 f6 int NULL NULL NULL NULL int(11) +1.0000 test t2 f1 char 20 20 latin1 latin1_swedish_ci char(20) +1.0000 test t2 f2 char 25 25 latin1 latin1_swedish_ci char(25) +NULL test t2 f3 date NULL NULL NULL NULL date +NULL test t2 f4 int NULL NULL NULL NULL int(11) +1.0000 test t2 f5 char 25 25 latin1 latin1_swedish_ci char(25) +NULL test t2 f6 int NULL NULL NULL NULL int(11) +1.0000 test t3 f1 char 20 20 latin1 latin1_swedish_ci char(20) +1.0000 test t3 f2 char 20 20 latin1 latin1_swedish_ci char(20) +NULL test t3 f3 int NULL NULL NULL NULL int(11) +1.0000 test t4 f1 char 20 20 latin1 latin1_swedish_ci char(20) +1.0000 test t4 f2 char 25 25 latin1 latin1_swedish_ci char(25) +NULL test t4 f3 date NULL NULL NULL NULL date +NULL test t4 f4 int NULL NULL NULL NULL int(11) +1.0000 test t4 f5 char 25 25 latin1 latin1_swedish_ci char(25) +NULL test t4 f6 int NULL NULL NULL NULL int(11) +1.0000 test t7 f1 char 20 20 latin1 latin1_swedish_ci char(20) +1.0000 test t7 f2 char 25 25 latin1 latin1_swedish_ci char(25) +NULL test t7 f3 date NULL NULL NULL NULL date +NULL test t7 f4 int NULL NULL NULL NULL int(11) +1.0000 test t8 f1 char 20 20 latin1 latin1_swedish_ci char(20) +1.0000 test t8 f2 char 25 25 latin1 latin1_swedish_ci char(25) +NULL test t8 f3 date NULL NULL NULL NULL date +NULL test t8 f4 int NULL NULL NULL NULL int(11) +NULL test t9 f1 int NULL NULL NULL NULL int(11) +1.0000 test t9 f2 char 25 25 latin1 latin1_swedish_ci char(25) +NULL test t9 f3 int NULL NULL NULL NULL int(11) +1.0000 test tb1 f1 char 1 1 latin1 latin1_swedish_ci char(1) +1.0000 test tb1 f2 char 1 1 latin1 latin1_bin char(1) +1.0000 test tb1 f3 char 1 1 latin1 latin1_swedish_ci char(1) +1.0000 test tb1 f4 tinytext 255 255 latin1 latin1_swedish_ci tinytext +1.0000 test tb1 f5 text 65535 65535 latin1 latin1_swedish_ci text +1.0000 test tb1 f6 mediumtext 16777215 16777215 latin1 latin1_swedish_ci mediumtext +1.0000 test tb1 f7 longtext 4294967295 4294967295 latin1 latin1_swedish_ci longtext +1.0000 test tb1 f8 tinyblob 255 255 NULL NULL tinyblob +1.0000 test tb1 f9 blob 65535 65535 NULL NULL blob +1.0000 test tb1 f10 mediumblob 16777215 16777215 NULL NULL mediumblob +1.0000 test tb1 f11 longblob 4294967295 4294967295 NULL NULL longblob +1.0000 test tb1 f12 binary 1 1 NULL NULL binary(1) +NULL test tb1 f13 tinyint NULL NULL NULL NULL tinyint(4) +NULL test tb1 f14 tinyint NULL NULL NULL NULL tinyint(3) unsigned +NULL test tb1 f15 tinyint NULL NULL NULL NULL tinyint(3) unsigned zerofill +NULL test tb1 f16 tinyint NULL NULL NULL NULL tinyint(3) unsigned zerofill +NULL test tb1 f17 smallint NULL NULL NULL NULL smallint(6) +NULL test tb1 f18 smallint NULL NULL NULL NULL smallint(5) unsigned +NULL test tb1 f19 smallint NULL NULL NULL NULL smallint(5) unsigned zerofill +NULL test tb1 f20 smallint NULL NULL NULL NULL smallint(5) unsigned zerofill +NULL test tb1 f21 mediumint NULL NULL NULL NULL mediumint(9) +NULL test tb1 f22 mediumint NULL NULL NULL NULL mediumint(8) unsigned +NULL test tb1 f23 mediumint NULL NULL NULL NULL mediumint(8) unsigned zerofill +NULL test tb1 f24 mediumint NULL NULL NULL NULL mediumint(8) unsigned zerofill +NULL test tb1 f25 int NULL NULL NULL NULL int(11) +NULL test tb1 f26 int NULL NULL NULL NULL int(10) unsigned +NULL test tb1 f27 int NULL NULL NULL NULL int(10) unsigned zerofill +NULL test tb1 f28 int NULL NULL NULL NULL int(10) unsigned zerofill +NULL test tb1 f29 bigint NULL NULL NULL NULL bigint(20) +NULL test tb1 f30 bigint NULL NULL NULL NULL bigint(20) unsigned +NULL test tb1 f31 bigint NULL NULL NULL NULL bigint(20) unsigned zerofill +NULL test tb1 f32 bigint NULL NULL NULL NULL bigint(20) unsigned zerofill +NULL test tb1 f33 decimal NULL NULL NULL NULL decimal(10,0) +NULL test tb1 f34 decimal NULL NULL NULL NULL decimal(10,0) unsigned +NULL test tb1 f35 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill +NULL test tb1 f36 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill +NULL test tb1 f37 decimal NULL NULL NULL NULL decimal(10,0) +NULL test tb1 f38 decimal NULL NULL NULL NULL decimal(64,0) +NULL test tb1 f39 decimal NULL NULL NULL NULL decimal(10,0) unsigned +NULL test tb1 f40 decimal NULL NULL NULL NULL decimal(64,0) unsigned +NULL test tb1 f41 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill +NULL test tb1 f42 decimal NULL NULL NULL NULL decimal(64,0) unsigned zerofill +NULL test tb1 f43 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill +NULL test tb1 f44 decimal NULL NULL NULL NULL decimal(64,0) unsigned zerofill +NULL test tb1 f45 decimal NULL NULL NULL NULL decimal(10,0) +NULL test tb1 f46 decimal NULL NULL NULL NULL decimal(63,30) +NULL test tb1 f47 decimal NULL NULL NULL NULL decimal(10,0) unsigned +NULL test tb1 f48 decimal NULL NULL NULL NULL decimal(63,30) unsigned +NULL test tb1 f49 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill +NULL test tb1 f50 decimal NULL NULL NULL NULL decimal(63,30) unsigned zerofill +NULL test tb1 f51 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill +NULL test tb1 f52 decimal NULL NULL NULL NULL decimal(63,30) unsigned zerofill +NULL test tb1 f53 decimal NULL NULL NULL NULL decimal(10,0) +NULL test tb1 f54 decimal NULL NULL NULL NULL decimal(10,0) unsigned +NULL test tb1 f55 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill +NULL test tb1 f56 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill +NULL test tb1 f57 decimal NULL NULL NULL NULL decimal(10,0) +NULL test tb1 f58 decimal NULL NULL NULL NULL decimal(64,0) +NULL test tb2 f59 decimal NULL NULL NULL NULL decimal(10,0) unsigned +NULL test tb2 f60 decimal NULL NULL NULL NULL decimal(64,0) unsigned +NULL test tb2 f61 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill +NULL test tb2 f62 decimal NULL NULL NULL NULL decimal(64,0) unsigned zerofill +NULL test tb2 f63 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill +NULL test tb2 f64 decimal NULL NULL NULL NULL decimal(64,0) unsigned zerofill +NULL test tb2 f65 decimal NULL NULL NULL NULL decimal(10,0) +NULL test tb2 f66 decimal NULL NULL NULL NULL decimal(63,30) +NULL test tb2 f67 decimal NULL NULL NULL NULL decimal(10,0) unsigned +NULL test tb2 f68 decimal NULL NULL NULL NULL decimal(63,30) unsigned +NULL test tb2 f69 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill +NULL test tb2 f70 decimal NULL NULL NULL NULL decimal(63,30) unsigned zerofill +NULL test tb2 f71 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill +NULL test tb2 f72 decimal NULL NULL NULL NULL decimal(63,30) unsigned zerofill +NULL test tb2 f73 double NULL NULL NULL NULL double +NULL test tb2 f74 double unsigned NULL NULL NULL NULL double unsigned +NULL test tb2 f75 double unsigned zerofill NULL NULL NULL NULL double unsigned zerofill +NULL test tb2 f76 double unsigned zerofill NULL NULL NULL NULL double unsigned zerofill +NULL test tb2 f77 double NULL NULL NULL NULL double +NULL test tb2 f78 double unsigned NULL NULL NULL NULL double unsigned +NULL test tb2 f79 double unsigned zerofill NULL NULL NULL NULL double unsigned zerofill +NULL test tb2 f80 double unsigned zerofill NULL NULL NULL NULL double unsigned zerofill +NULL test tb2 f81 float NULL NULL NULL NULL float +NULL test tb2 f82 float unsigned NULL NULL NULL NULL float unsigned +NULL test tb2 f83 float unsigned zerofill NULL NULL NULL NULL float unsigned zerofill +NULL test tb2 f84 float unsigned zerofill NULL NULL NULL NULL float unsigned zerofill +NULL test tb2 f85 float NULL NULL NULL NULL float +NULL test tb2 f86 float NULL NULL NULL NULL float +NULL test tb2 f87 float unsigned NULL NULL NULL NULL float unsigned +NULL test tb2 f88 float unsigned NULL NULL NULL NULL float unsigned +NULL test tb2 f89 float unsigned zerofill NULL NULL NULL NULL float unsigned zerofill +NULL test tb2 f90 float unsigned zerofill NULL NULL NULL NULL float unsigned zerofill +NULL test tb2 f91 float unsigned zerofill NULL NULL NULL NULL float unsigned zerofill +NULL test tb2 f92 float unsigned zerofill NULL NULL NULL NULL float unsigned zerofill +NULL test tb2 f93 float NULL NULL NULL NULL float +NULL test tb2 f94 double NULL NULL NULL NULL double +NULL test tb2 f95 float unsigned NULL NULL NULL NULL float unsigned +NULL test tb2 f96 double unsigned NULL NULL NULL NULL double unsigned +NULL test tb2 f97 float unsigned zerofill NULL NULL NULL NULL float unsigned zerofill +NULL test tb2 f98 double unsigned zerofill NULL NULL NULL NULL double unsigned zerofill +NULL test tb2 f99 float unsigned zerofill NULL NULL NULL NULL float unsigned zerofill +NULL test tb2 f100 double unsigned zerofill NULL NULL NULL NULL double unsigned zerofill +NULL test tb2 f101 date NULL NULL NULL NULL date +NULL test tb2 f102 time NULL NULL NULL NULL time +NULL test tb2 f103 datetime NULL NULL NULL NULL datetime +NULL test tb2 f104 timestamp NULL NULL NULL NULL timestamp +NULL test tb2 f105 year NULL NULL NULL NULL year(4) +NULL test tb2 f106 year NULL NULL NULL NULL year(4) +NULL test tb2 f107 year NULL NULL NULL NULL year(4) +1.0000 test tb2 f108 enum 5 5 latin1 latin1_swedish_ci enum('1enum','2enum') +1.0000 test tb2 f109 set 9 9 latin1 latin1_swedish_ci set('1set','2set') +1.0000 test tb2 f110 varbinary 64 64 NULL NULL varbinary(64) +1.0000 test tb2 f111 varbinary 27 27 NULL NULL varbinary(27) +1.0000 test tb2 f112 varbinary 64 64 NULL NULL varbinary(64) +1.0000 test tb2 f113 varbinary 192 192 NULL NULL varbinary(192) +1.0000 test tb2 f114 varbinary 192 192 NULL NULL varbinary(192) +1.0000 test tb2 f115 varbinary 27 27 NULL NULL varbinary(27) +1.0000 test tb2 f116 varbinary 64 64 NULL NULL varbinary(64) +1.0000 test tb2 f117 varbinary 192 192 NULL NULL varbinary(192) +1.0000 test tb3 f118 char 1 1 latin1 latin1_swedish_ci char(1) +1.0000 test tb3 f119 char 1 1 latin1 latin1_bin char(1) +1.0000 test tb3 f120 char 1 1 latin1 latin1_swedish_ci char(1) +1.0000 test tb3 f121 tinytext 255 255 latin1 latin1_swedish_ci tinytext +1.0000 test tb3 f122 text 65535 65535 latin1 latin1_swedish_ci text +1.0000 test tb3 f123 mediumtext 16777215 16777215 latin1 latin1_swedish_ci mediumtext +1.0000 test tb3 f124 longtext 4294967295 4294967295 latin1 latin1_swedish_ci longtext +1.0000 test tb3 f125 tinyblob 255 255 NULL NULL tinyblob +1.0000 test tb3 f126 blob 65535 65535 NULL NULL blob +1.0000 test tb3 f127 mediumblob 16777215 16777215 NULL NULL mediumblob +1.0000 test tb3 f128 longblob 4294967295 4294967295 NULL NULL longblob +1.0000 test tb3 f129 binary 1 1 NULL NULL binary(1) +NULL test tb3 f130 tinyint NULL NULL NULL NULL tinyint(4) +NULL test tb3 f131 tinyint NULL NULL NULL NULL tinyint(3) unsigned +NULL test tb3 f132 tinyint NULL NULL NULL NULL tinyint(3) unsigned zerofill +NULL test tb3 f133 tinyint NULL NULL NULL NULL tinyint(3) unsigned zerofill +NULL test tb3 f134 smallint NULL NULL NULL NULL smallint(6) +NULL test tb3 f135 smallint NULL NULL NULL NULL smallint(5) unsigned +NULL test tb3 f136 smallint NULL NULL NULL NULL smallint(5) unsigned zerofill +NULL test tb3 f137 smallint NULL NULL NULL NULL smallint(5) unsigned zerofill +NULL test tb3 f138 mediumint NULL NULL NULL NULL mediumint(9) +NULL test tb3 f139 mediumint NULL NULL NULL NULL mediumint(8) unsigned +NULL test tb3 f140 mediumint NULL NULL NULL NULL mediumint(8) unsigned zerofill +NULL test tb3 f141 mediumint NULL NULL NULL NULL mediumint(8) unsigned zerofill +NULL test tb3 f142 int NULL NULL NULL NULL int(11) +NULL test tb3 f143 int NULL NULL NULL NULL int(10) unsigned +NULL test tb3 f144 int NULL NULL NULL NULL int(10) unsigned zerofill +NULL test tb3 f145 int NULL NULL NULL NULL int(10) unsigned zerofill +NULL test tb3 f146 bigint NULL NULL NULL NULL bigint(20) +NULL test tb3 f147 bigint NULL NULL NULL NULL bigint(20) unsigned +NULL test tb3 f148 bigint NULL NULL NULL NULL bigint(20) unsigned zerofill +NULL test tb3 f149 bigint NULL NULL NULL NULL bigint(20) unsigned zerofill +NULL test tb3 f150 decimal NULL NULL NULL NULL decimal(10,0) +NULL test tb3 f151 decimal NULL NULL NULL NULL decimal(10,0) unsigned +NULL test tb3 f152 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill +NULL test tb3 f153 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill +NULL test tb3 f154 decimal NULL NULL NULL NULL decimal(10,0) +NULL test tb3 f155 decimal NULL NULL NULL NULL decimal(64,0) +NULL test tb3 f156 decimal NULL NULL NULL NULL decimal(10,0) unsigned +NULL test tb3 f157 decimal NULL NULL NULL NULL decimal(64,0) unsigned +NULL test tb3 f158 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill +NULL test tb3 f159 decimal NULL NULL NULL NULL decimal(64,0) unsigned zerofill +NULL test tb3 f160 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill +NULL test tb3 f161 decimal NULL NULL NULL NULL decimal(64,0) unsigned zerofill +NULL test tb3 f162 decimal NULL NULL NULL NULL decimal(10,0) +NULL test tb3 f163 decimal NULL NULL NULL NULL decimal(63,30) +NULL test tb3 f164 decimal NULL NULL NULL NULL decimal(10,0) unsigned +NULL test tb3 f165 decimal NULL NULL NULL NULL decimal(63,30) unsigned +NULL test tb3 f166 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill +NULL test tb3 f167 decimal NULL NULL NULL NULL decimal(63,30) unsigned zerofill +NULL test tb3 f168 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill +NULL test tb3 f169 decimal NULL NULL NULL NULL decimal(63,30) unsigned zerofill +NULL test tb3 f170 decimal NULL NULL NULL NULL decimal(10,0) +NULL test tb3 f171 decimal NULL NULL NULL NULL decimal(10,0) unsigned +NULL test tb3 f172 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill +NULL test tb3 f173 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill +NULL test tb3 f174 decimal NULL NULL NULL NULL decimal(10,0) +NULL test tb3 f175 decimal NULL NULL NULL NULL decimal(64,0) +NULL test tb4 f176 decimal NULL NULL NULL NULL decimal(10,0) unsigned +NULL test tb4 f177 decimal NULL NULL NULL NULL decimal(64,0) unsigned +NULL test tb4 f178 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill +NULL test tb4 f179 decimal NULL NULL NULL NULL decimal(64,0) unsigned zerofill +NULL test tb4 f180 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill +NULL test tb4 f181 decimal NULL NULL NULL NULL decimal(64,0) unsigned zerofill +NULL test tb4 f182 decimal NULL NULL NULL NULL decimal(10,0) +NULL test tb4 f183 decimal NULL NULL NULL NULL decimal(63,30) +NULL test tb4 f184 decimal NULL NULL NULL NULL decimal(10,0) unsigned +NULL test tb4 f185 decimal NULL NULL NULL NULL decimal(63,30) unsigned +NULL test tb4 f186 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill +NULL test tb4 f187 decimal NULL NULL NULL NULL decimal(63,30) unsigned zerofill +NULL test tb4 f188 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill +NULL test tb4 f189 decimal NULL NULL NULL NULL decimal(63,30) unsigned zerofill +NULL test tb4 f190 double NULL NULL NULL NULL double +NULL test tb4 f191 double unsigned NULL NULL NULL NULL double unsigned +NULL test tb4 f192 double unsigned zerofill NULL NULL NULL NULL double unsigned zerofill +NULL test tb4 f193 double unsigned zerofill NULL NULL NULL NULL double unsigned zerofill +NULL test tb4 f194 double NULL NULL NULL NULL double +NULL test tb4 f195 double unsigned NULL NULL NULL NULL double unsigned +NULL test tb4 f196 double unsigned zerofill NULL NULL NULL NULL double unsigned zerofill +NULL test tb4 f197 double unsigned zerofill NULL NULL NULL NULL double unsigned zerofill +NULL test tb4 f198 float NULL NULL NULL NULL float +NULL test tb4 f199 float unsigned NULL NULL NULL NULL float unsigned +NULL test tb4 f200 float unsigned zerofill NULL NULL NULL NULL float unsigned zerofill +NULL test tb4 f201 float unsigned zerofill NULL NULL NULL NULL float unsigned zerofill +NULL test tb4 f202 float NULL NULL NULL NULL float +NULL test tb4 f203 float NULL NULL NULL NULL float +NULL test tb4 f204 float unsigned NULL NULL NULL NULL float unsigned +NULL test tb4 f205 float unsigned NULL NULL NULL NULL float unsigned +NULL test tb4 f206 float unsigned zerofill NULL NULL NULL NULL float unsigned zerofill +NULL test tb4 f207 float unsigned zerofill NULL NULL NULL NULL float unsigned zerofill +NULL test tb4 f208 float unsigned zerofill NULL NULL NULL NULL float unsigned zerofill +NULL test tb4 f209 float unsigned zerofill NULL NULL NULL NULL float unsigned zerofill +NULL test tb4 f210 float NULL NULL NULL NULL float +NULL test tb4 f211 double NULL NULL NULL NULL double +NULL test tb4 f212 float unsigned NULL NULL NULL NULL float unsigned +NULL test tb4 f213 double unsigned NULL NULL NULL NULL double unsigned +NULL test tb4 f214 float unsigned zerofill NULL NULL NULL NULL float unsigned zerofill +NULL test tb4 f215 double unsigned zerofill NULL NULL NULL NULL double unsigned zerofill +NULL test tb4 f216 float unsigned zerofill NULL NULL NULL NULL float unsigned zerofill +NULL test tb4 f217 double unsigned zerofill NULL NULL NULL NULL double unsigned zerofill +NULL test tb4 f218 date NULL NULL NULL NULL date +NULL test tb4 f219 time NULL NULL NULL NULL time +NULL test tb4 f220 datetime NULL NULL NULL NULL datetime +NULL test tb4 f221 timestamp NULL NULL NULL NULL timestamp +NULL test tb4 f222 year NULL NULL NULL NULL year(4) +NULL test tb4 f223 year NULL NULL NULL NULL year(4) +NULL test tb4 f224 year NULL NULL NULL NULL year(4) +1.0000 test tb4 f225 enum 5 5 latin1 latin1_swedish_ci enum('1enum','2enum') +1.0000 test tb4 f226 set 9 9 latin1 latin1_swedish_ci set('1set','2set') +1.0000 test tb4 f227 varbinary 64 64 NULL NULL varbinary(64) +1.0000 test tb4 f228 varbinary 27 27 NULL NULL varbinary(27) +1.0000 test tb4 f229 varbinary 64 64 NULL NULL varbinary(64) +1.0000 test tb4 f230 varbinary 192 192 NULL NULL varbinary(192) +1.0000 test tb4 f231 varbinary 192 192 NULL NULL varbinary(192) +1.0000 test tb4 f232 varbinary 27 27 NULL NULL varbinary(27) +1.0000 test tb4 f233 varbinary 64 64 NULL NULL varbinary(64) +1.0000 test tb4 f234 varbinary 192 192 NULL NULL varbinary(192) +1.0000 test tb4 f235 char 255 255 latin1 latin1_swedish_ci char(255) +1.0000 test tb4 f236 char 60 60 latin1 latin1_swedish_ci char(60) +1.0000 test tb4 f237 char 255 255 latin1 latin1_bin char(255) +NULL test tb4 f238 varchar 0 0 latin1 latin1_bin varchar(0) +1.0000 test tb4 f239 varbinary 1000 1000 NULL NULL varbinary(1000) +1.0000 test tb4 f240 varchar 120 120 latin1 latin1_swedish_ci varchar(120) +1.0000 test tb4 f241 char 100 100 latin1 latin1_swedish_ci char(100) +NULL test tb4 f242 bit NULL NULL NULL NULL bit(30) +NULL test1 tb2 f59 decimal NULL NULL NULL NULL decimal(10,0) unsigned +NULL test1 tb2 f60 decimal NULL NULL NULL NULL decimal(64,0) unsigned +NULL test1 tb2 f61 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill +NULL test1 tb2 f62 decimal NULL NULL NULL NULL decimal(64,0) unsigned zerofill +NULL test1 tb2 f63 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill +NULL test1 tb2 f64 decimal NULL NULL NULL NULL decimal(64,0) unsigned zerofill +NULL test1 tb2 f65 decimal NULL NULL NULL NULL decimal(10,0) +NULL test1 tb2 f66 decimal NULL NULL NULL NULL decimal(63,30) +NULL test1 tb2 f67 decimal NULL NULL NULL NULL decimal(10,0) unsigned +NULL test1 tb2 f68 decimal NULL NULL NULL NULL decimal(63,30) unsigned +NULL test1 tb2 f69 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill +NULL test1 tb2 f70 decimal NULL NULL NULL NULL decimal(63,30) unsigned zerofill +NULL test1 tb2 f71 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill +NULL test1 tb2 f72 decimal NULL NULL NULL NULL decimal(63,30) unsigned zerofill +NULL test1 tb2 f73 double NULL NULL NULL NULL double +NULL test1 tb2 f74 double unsigned NULL NULL NULL NULL double unsigned +NULL test1 tb2 f75 double unsigned zerofill NULL NULL NULL NULL double unsigned zerofill +NULL test1 tb2 f76 double unsigned zerofill NULL NULL NULL NULL double unsigned zerofill +NULL test1 tb2 f77 double NULL NULL NULL NULL double +NULL test1 tb2 f78 double unsigned NULL NULL NULL NULL double unsigned +NULL test1 tb2 f79 double unsigned zerofill NULL NULL NULL NULL double unsigned zerofill +NULL test1 tb2 f80 double unsigned zerofill NULL NULL NULL NULL double unsigned zerofill +NULL test1 tb2 f81 float NULL NULL NULL NULL float +NULL test1 tb2 f82 float unsigned NULL NULL NULL NULL float unsigned +NULL test1 tb2 f83 float unsigned zerofill NULL NULL NULL NULL float unsigned zerofill +NULL test1 tb2 f84 float unsigned zerofill NULL NULL NULL NULL float unsigned zerofill +NULL test1 tb2 f85 float NULL NULL NULL NULL float +NULL test1 tb2 f86 float NULL NULL NULL NULL float +NULL test1 tb2 f87 float unsigned NULL NULL NULL NULL float unsigned +NULL test1 tb2 f88 float unsigned NULL NULL NULL NULL float unsigned +NULL test1 tb2 f89 float unsigned zerofill NULL NULL NULL NULL float unsigned zerofill +NULL test1 tb2 f90 float unsigned zerofill NULL NULL NULL NULL float unsigned zerofill +NULL test1 tb2 f91 float unsigned zerofill NULL NULL NULL NULL float unsigned zerofill +NULL test1 tb2 f92 float unsigned zerofill NULL NULL NULL NULL float unsigned zerofill +NULL test1 tb2 f93 float NULL NULL NULL NULL float +NULL test1 tb2 f94 double NULL NULL NULL NULL double +NULL test1 tb2 f95 float unsigned NULL NULL NULL NULL float unsigned +NULL test1 tb2 f96 double unsigned NULL NULL NULL NULL double unsigned +NULL test1 tb2 f97 float unsigned zerofill NULL NULL NULL NULL float unsigned zerofill +NULL test1 tb2 f98 double unsigned zerofill NULL NULL NULL NULL double unsigned zerofill +NULL test1 tb2 f99 float unsigned zerofill NULL NULL NULL NULL float unsigned zerofill +NULL test1 tb2 f100 double unsigned zerofill NULL NULL NULL NULL double unsigned zerofill +NULL test1 tb2 f101 date NULL NULL NULL NULL date +NULL test1 tb2 f102 time NULL NULL NULL NULL time +NULL test1 tb2 f103 datetime NULL NULL NULL NULL datetime +NULL test1 tb2 f104 timestamp NULL NULL NULL NULL timestamp +NULL test1 tb2 f105 year NULL NULL NULL NULL year(4) +NULL test1 tb2 f106 year NULL NULL NULL NULL year(4) +NULL test1 tb2 f107 year NULL NULL NULL NULL year(4) +1.0000 test1 tb2 f108 enum 5 5 latin1 latin1_swedish_ci enum('1enum','2enum') +1.0000 test1 tb2 f109 set 9 9 latin1 latin1_swedish_ci set('1set','2set') +1.0000 test1 tb2 f110 varbinary 64 64 NULL NULL varbinary(64) +1.0000 test1 tb2 f111 varbinary 27 27 NULL NULL varbinary(27) +1.0000 test1 tb2 f112 varbinary 64 64 NULL NULL varbinary(64) +1.0000 test1 tb2 f113 varbinary 192 192 NULL NULL varbinary(192) +1.0000 test1 tb2 f114 varbinary 192 192 NULL NULL varbinary(192) +1.0000 test1 tb2 f115 varbinary 27 27 NULL NULL varbinary(27) +1.0000 test1 tb2 f116 varbinary 64 64 NULL NULL varbinary(64) +1.0000 test1 tb2 f117 varbinary 192 192 NULL NULL varbinary(192) +1.0000 test4 t6 f1 char 20 20 latin1 latin1_swedish_ci char(20) +1.0000 test4 t6 f2 char 25 25 latin1 latin1_swedish_ci char(25) +NULL test4 t6 f3 date NULL NULL NULL NULL date +NULL test4 t6 f4 int NULL NULL NULL NULL int(11) +1.0000 test4 t6 f5 char 25 25 latin1 latin1_swedish_ci char(25) +NULL test4 t6 f6 int NULL NULL NULL NULL int(11) +DROP DATABASE test1; +DROP DATABASE test4; +DROP TABLE test.t1; +DROP TABLE test.t2; +DROP TABLE test.t3; +DROP TABLE test.t4; +DROP TABLE test.t7; +DROP TABLE test.t8; +DROP TABLE test.t9; +DROP TABLE test.t10; +DROP TABLE test.t11; +DROP TABLE test.tb1; +DROP TABLE test.tb2; +DROP TABLE test.tb3; +DROP TABLE test.tb4; diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result new file mode 100644 index 00000000000..34a357d5811 --- /dev/null +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result @@ -0,0 +1,361 @@ +SELECT * FROM information_schema.columns +WHERE table_schema = 'mysql' +ORDER BY table_schema, table_name, column_name; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT +NULL mysql columns_priv Column_name 5 NO char 64 192 NULL NULL utf8 utf8_bin char(64) PRI +NULL mysql columns_priv Column_priv 7 NO set 31 93 NULL NULL utf8 utf8_general_ci set('Select','Insert','Update','References') +NULL mysql columns_priv Db 2 NO char 64 192 NULL NULL utf8 utf8_bin char(64) PRI +NULL mysql columns_priv Host 1 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI +NULL mysql columns_priv Table_name 4 NO char 64 192 NULL NULL utf8 utf8_bin char(64) PRI +NULL mysql columns_priv Timestamp 6 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL NULL NULL timestamp +NULL mysql columns_priv User 3 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI +NULL mysql db Alter_priv 13 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql db Alter_routine_priv 19 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql db Create_priv 8 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql db Create_routine_priv 18 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql db Create_tmp_table_priv 14 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql db Create_view_priv 16 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql db Db 2 NO char 64 192 NULL NULL utf8 utf8_bin char(64) PRI +NULL mysql db Delete_priv 7 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql db Drop_priv 9 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql db Execute_priv 20 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql db Grant_priv 10 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql db Host 1 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI +NULL mysql db Index_priv 12 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql db Insert_priv 5 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql db Lock_tables_priv 15 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql db References_priv 11 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql db Select_priv 4 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql db Show_view_priv 17 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql db Update_priv 6 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql db User 3 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI +NULL mysql func dl 3 NO char 128 384 NULL NULL utf8 utf8_bin char(128) +NULL mysql func name 1 NO char 64 192 NULL NULL utf8 utf8_bin char(64) PRI +NULL mysql func ret 2 0 NO tinyint NULL NULL 3 0 NULL NULL tinyint(1) +NULL mysql func type 4 NULL NO enum 9 27 NULL NULL utf8 utf8_general_ci enum('function','aggregate') +NULL mysql help_category help_category_id 1 NULL NO smallint NULL NULL 5 0 NULL NULL smallint(5) unsigned PRI +NULL mysql help_category name 2 NULL NO char 64 192 NULL NULL utf8 utf8_general_ci char(64) UNI +NULL mysql help_category parent_category_id 3 NULL YES smallint NULL NULL 5 0 NULL NULL smallint(5) unsigned +NULL mysql help_category url 4 NULL NO char 128 384 NULL NULL utf8 utf8_general_ci char(128) +NULL mysql help_keyword help_keyword_id 1 NULL NO int NULL NULL 10 0 NULL NULL int(10) unsigned PRI +NULL mysql help_keyword name 2 NULL NO char 64 192 NULL NULL utf8 utf8_general_ci char(64) UNI +NULL mysql help_relation help_keyword_id 2 NULL NO int NULL NULL 10 0 NULL NULL int(10) unsigned PRI +NULL mysql help_relation help_topic_id 1 NULL NO int NULL NULL 10 0 NULL NULL int(10) unsigned PRI +NULL mysql help_topic description 4 NULL NO text 65535 65535 NULL NULL utf8 utf8_general_ci text +NULL mysql help_topic example 5 NULL NO text 65535 65535 NULL NULL utf8 utf8_general_ci text +NULL mysql help_topic help_category_id 3 NULL NO smallint NULL NULL 5 0 NULL NULL smallint(5) unsigned +NULL mysql help_topic help_topic_id 1 NULL NO int NULL NULL 10 0 NULL NULL int(10) unsigned PRI +NULL mysql help_topic name 2 NULL NO char 64 192 NULL NULL utf8 utf8_general_ci char(64) UNI +NULL mysql help_topic url 6 NULL NO char 128 384 NULL NULL utf8 utf8_general_ci char(128) +NULL mysql host Alter_priv 12 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql host Alter_routine_priv 18 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql host Create_priv 7 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql host Create_routine_priv 17 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql host Create_tmp_table_priv 13 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql host Create_view_priv 15 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql host Db 2 NO char 64 192 NULL NULL utf8 utf8_bin char(64) PRI +NULL mysql host Delete_priv 6 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql host Drop_priv 8 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql host Execute_priv 19 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql host Grant_priv 9 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql host Host 1 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI +NULL mysql host Index_priv 11 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql host Insert_priv 4 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql host Lock_tables_priv 14 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql host References_priv 10 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql host Select_priv 3 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql host Show_view_priv 16 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql host Update_priv 5 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql proc body 11 NULL NO longblob 4294967295 4294967295 NULL NULL NULL NULL longblob +NULL mysql proc comment 16 NO char 64 192 NULL NULL utf8 utf8_bin char(64) +NULL mysql proc created 13 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL NULL NULL timestamp +NULL mysql proc db 1 NO char 64 192 NULL NULL utf8 utf8_bin char(64) PRI +NULL mysql proc definer 12 NO char 77 231 NULL NULL utf8 utf8_bin char(77) +NULL mysql proc is_deterministic 7 NO NO enum 3 9 NULL NULL utf8 utf8_general_ci enum('YES','NO') +NULL mysql proc language 5 SQL NO enum 3 9 NULL NULL utf8 utf8_general_ci enum('SQL') +NULL mysql proc modified 14 0000-00-00 00:00:00 NO timestamp NULL NULL NULL NULL NULL NULL timestamp +NULL mysql proc name 2 NO char 64 192 NULL NULL utf8 utf8_general_ci char(64) PRI +NULL mysql proc param_list 9 NULL NO blob 65535 65535 NULL NULL NULL NULL blob +NULL mysql proc returns 10 NO char 64 192 NULL NULL utf8 utf8_general_ci char(64) +NULL mysql proc security_type 8 DEFINER NO enum 7 21 NULL NULL utf8 utf8_general_ci enum('INVOKER','DEFINER') +NULL mysql proc specific_name 4 NO char 64 192 NULL NULL utf8 utf8_general_ci char(64) +NULL mysql proc sql_data_access 6 CONTAINS_SQL NO enum 17 51 NULL NULL utf8 utf8_general_ci enum('CONTAINS_SQL','NO_SQL','READS_SQL_DATA','MODIFIES_SQL_DATA') +NULL mysql proc sql_mode 15 NO set 431 1293 NULL NULL utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE') +NULL mysql proc type 3 NULL NO enum 9 27 NULL NULL utf8 utf8_general_ci enum('FUNCTION','PROCEDURE') PRI +NULL mysql procs_priv Db 2 NO char 64 192 NULL NULL utf8 utf8_bin char(64) PRI +NULL mysql procs_priv Grantor 6 NO char 77 231 NULL NULL utf8 utf8_bin char(77) MUL +NULL mysql procs_priv Host 1 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI +NULL mysql procs_priv Proc_priv 7 NO set 27 81 NULL NULL utf8 utf8_general_ci set('Execute','Alter Routine','Grant') +NULL mysql procs_priv Routine_name 4 NO char 64 192 NULL NULL utf8 utf8_bin char(64) PRI +NULL mysql procs_priv Routine_type 5 NULL NO enum 9 27 NULL NULL utf8 utf8_bin enum('FUNCTION','PROCEDURE') PRI +NULL mysql procs_priv Timestamp 8 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL NULL NULL timestamp +NULL mysql procs_priv User 3 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI +NULL mysql tables_priv Column_priv 8 NO set 31 93 NULL NULL utf8 utf8_general_ci set('Select','Insert','Update','References') +NULL mysql tables_priv Db 2 NO char 64 192 NULL NULL utf8 utf8_bin char(64) PRI +NULL mysql tables_priv Grantor 5 NO char 77 231 NULL NULL utf8 utf8_bin char(77) MUL +NULL mysql tables_priv Host 1 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI +NULL mysql tables_priv Table_name 4 NO char 64 192 NULL NULL utf8 utf8_bin char(64) PRI +NULL mysql tables_priv Table_priv 7 NO set 90 270 NULL NULL utf8 utf8_general_ci set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view') +NULL mysql tables_priv Timestamp 6 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL NULL NULL timestamp +NULL mysql tables_priv User 3 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI +NULL mysql time_zone Time_zone_id 1 NULL NO int NULL NULL 10 0 NULL NULL int(10) unsigned PRI auto_increment +NULL mysql time_zone Use_leap_seconds 2 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('Y','N') +NULL mysql time_zone_leap_second Correction 2 NULL NO int NULL NULL 10 0 NULL NULL int(11) +NULL mysql time_zone_leap_second Transition_time 1 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) PRI +NULL mysql time_zone_name Name 1 NULL NO char 64 192 NULL NULL utf8 utf8_general_ci char(64) PRI +NULL mysql time_zone_name Time_zone_id 2 NULL NO int NULL NULL 10 0 NULL NULL int(10) unsigned +NULL mysql time_zone_transition Time_zone_id 1 NULL NO int NULL NULL 10 0 NULL NULL int(10) unsigned PRI +NULL mysql time_zone_transition Transition_time 2 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) PRI +NULL mysql time_zone_transition Transition_type_id 3 NULL NO int NULL NULL 10 0 NULL NULL int(10) unsigned +NULL mysql time_zone_transition_type Abbreviation 5 NO char 8 24 NULL NULL utf8 utf8_general_ci char(8) +NULL mysql time_zone_transition_type Is_DST 4 0 NO tinyint NULL NULL 3 0 NULL NULL tinyint(3) unsigned +NULL mysql time_zone_transition_type Offset 3 0 NO int NULL NULL 10 0 NULL NULL int(11) +NULL mysql time_zone_transition_type Time_zone_id 1 NULL NO int NULL NULL 10 0 NULL NULL int(10) unsigned PRI +NULL mysql time_zone_transition_type Transition_type_id 2 NULL NO int NULL NULL 10 0 NULL NULL int(10) unsigned PRI +NULL mysql user Alter_priv 17 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql user Alter_routine_priv 28 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql user Create_priv 8 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql user Create_routine_priv 27 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql user Create_tmp_table_priv 20 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql user Create_user_priv 29 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql user Create_view_priv 25 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql user Delete_priv 7 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql user Drop_priv 9 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql user Execute_priv 22 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql user File_priv 13 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql user Grant_priv 14 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql user Host 1 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI +NULL mysql user Index_priv 16 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql user Insert_priv 5 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql user Lock_tables_priv 21 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql user max_connections 36 0 NO int NULL NULL 10 0 NULL NULL int(11) unsigned +NULL mysql user max_questions 34 0 NO int NULL NULL 10 0 NULL NULL int(11) unsigned +NULL mysql user max_updates 35 0 NO int NULL NULL 10 0 NULL NULL int(11) unsigned +NULL mysql user max_user_connections 37 0 NO int NULL NULL 10 0 NULL NULL int(11) unsigned +NULL mysql user Password 3 NO char 41 41 NULL NULL latin1 latin1_bin char(41) +NULL mysql user Process_priv 12 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql user References_priv 15 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql user Reload_priv 10 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql user Repl_client_priv 24 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql user Repl_slave_priv 23 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql user Select_priv 4 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql user Show_db_priv 18 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql user Show_view_priv 26 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql user Shutdown_priv 11 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql user ssl_cipher 31 NULL NO blob 65535 65535 NULL NULL NULL NULL blob +NULL mysql user ssl_type 30 NO enum 9 27 NULL NULL utf8 utf8_general_ci enum('','ANY','X509','SPECIFIED') +NULL mysql user Super_priv 19 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql user Update_priv 6 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') +NULL mysql user User 2 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI +NULL mysql user x509_issuer 32 NULL NO blob 65535 65535 NULL NULL NULL NULL blob +NULL mysql user x509_subject 33 NULL NO blob 65535 65535 NULL NULL NULL NULL blob +########################################################################## +# Show the quotient of CHARACTER_OCTET_LENGTH and CHARACTER_MAXIMUM_LENGTH +########################################################################## +SELECT DISTINCT +CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, +DATA_TYPE, +CHARACTER_SET_NAME, +COLLATION_NAME +FROM information_schema.columns +WHERE table_schema = 'mysql' +AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH = 1 +ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML; +COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME +1.0000 blob NULL NULL +1.0000 longblob NULL NULL +1.0000 char latin1 latin1_bin +1.0000 text utf8 utf8_general_ci +SELECT DISTINCT +CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, +DATA_TYPE, +CHARACTER_SET_NAME, +COLLATION_NAME +FROM information_schema.columns +WHERE table_schema = 'mysql' +AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH <> 1 +ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML; +COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME +3.0000 char utf8 utf8_bin +3.0000 enum utf8 utf8_bin +3.0000 char utf8 utf8_general_ci +3.0000 enum utf8 utf8_general_ci +3.0000 set utf8 utf8_general_ci +SELECT DISTINCT +CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, +DATA_TYPE, +CHARACTER_SET_NAME, +COLLATION_NAME +FROM information_schema.columns +WHERE table_schema = 'mysql' +AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH IS NULL +ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML; +COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME +NULL bigint NULL NULL +NULL int NULL NULL +NULL smallint NULL NULL +NULL timestamp NULL NULL +NULL tinyint NULL NULL +--> CHAR(0) is allowed (see manual), and here both CHARACHTER_* values +--> are 0, which is intended behavior, and the result of 0 / 0 IS NULL +SELECT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, +TABLE_SCHEMA, +TABLE_NAME, +COLUMN_NAME, +DATA_TYPE, +CHARACTER_MAXIMUM_LENGTH, +CHARACTER_OCTET_LENGTH, +CHARACTER_SET_NAME, +COLLATION_NAME, +COLUMN_TYPE +FROM information_schema.columns +WHERE table_schema = 'mysql' +ORDER BY TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION; +COL_CML TABLE_SCHEMA TABLE_NAME COLUMN_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE +3.0000 mysql columns_priv Host char 60 180 utf8 utf8_bin char(60) +3.0000 mysql columns_priv Db char 64 192 utf8 utf8_bin char(64) +3.0000 mysql columns_priv User char 16 48 utf8 utf8_bin char(16) +3.0000 mysql columns_priv Table_name char 64 192 utf8 utf8_bin char(64) +3.0000 mysql columns_priv Column_name char 64 192 utf8 utf8_bin char(64) +NULL mysql columns_priv Timestamp timestamp NULL NULL NULL NULL timestamp +3.0000 mysql columns_priv Column_priv set 31 93 utf8 utf8_general_ci set('Select','Insert','Update','References') +3.0000 mysql db Host char 60 180 utf8 utf8_bin char(60) +3.0000 mysql db Db char 64 192 utf8 utf8_bin char(64) +3.0000 mysql db User char 16 48 utf8 utf8_bin char(16) +3.0000 mysql db Select_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql db Insert_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql db Update_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql db Delete_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql db Create_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql db Drop_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql db Grant_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql db References_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql db Index_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql db Alter_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql db Create_tmp_table_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql db Lock_tables_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql db Create_view_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql db Show_view_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql db Create_routine_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql db Alter_routine_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql db Execute_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql func name char 64 192 utf8 utf8_bin char(64) +NULL mysql func ret tinyint NULL NULL NULL NULL tinyint(1) +3.0000 mysql func dl char 128 384 utf8 utf8_bin char(128) +3.0000 mysql func type enum 9 27 utf8 utf8_general_ci enum('function','aggregate') +NULL mysql help_category help_category_id smallint NULL NULL NULL NULL smallint(5) unsigned +3.0000 mysql help_category name char 64 192 utf8 utf8_general_ci char(64) +NULL mysql help_category parent_category_id smallint NULL NULL NULL NULL smallint(5) unsigned +3.0000 mysql help_category url char 128 384 utf8 utf8_general_ci char(128) +NULL mysql help_keyword help_keyword_id int NULL NULL NULL NULL int(10) unsigned +3.0000 mysql help_keyword name char 64 192 utf8 utf8_general_ci char(64) +NULL mysql help_relation help_topic_id int NULL NULL NULL NULL int(10) unsigned +NULL mysql help_relation help_keyword_id int NULL NULL NULL NULL int(10) unsigned +NULL mysql help_topic help_topic_id int NULL NULL NULL NULL int(10) unsigned +3.0000 mysql help_topic name char 64 192 utf8 utf8_general_ci char(64) +NULL mysql help_topic help_category_id smallint NULL NULL NULL NULL smallint(5) unsigned +1.0000 mysql help_topic description text 65535 65535 utf8 utf8_general_ci text +1.0000 mysql help_topic example text 65535 65535 utf8 utf8_general_ci text +3.0000 mysql help_topic url char 128 384 utf8 utf8_general_ci char(128) +3.0000 mysql host Host char 60 180 utf8 utf8_bin char(60) +3.0000 mysql host Db char 64 192 utf8 utf8_bin char(64) +3.0000 mysql host Select_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql host Insert_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql host Update_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql host Delete_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql host Create_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql host Drop_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql host Grant_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql host References_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql host Index_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql host Alter_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql host Create_tmp_table_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql host Lock_tables_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql host Create_view_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql host Show_view_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql host Create_routine_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql host Alter_routine_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql host Execute_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql proc db char 64 192 utf8 utf8_bin char(64) +3.0000 mysql proc name char 64 192 utf8 utf8_general_ci char(64) +3.0000 mysql proc type enum 9 27 utf8 utf8_general_ci enum('FUNCTION','PROCEDURE') +3.0000 mysql proc specific_name char 64 192 utf8 utf8_general_ci char(64) +3.0000 mysql proc language enum 3 9 utf8 utf8_general_ci enum('SQL') +3.0000 mysql proc sql_data_access enum 17 51 utf8 utf8_general_ci enum('CONTAINS_SQL','NO_SQL','READS_SQL_DATA','MODIFIES_SQL_DATA') +3.0000 mysql proc is_deterministic enum 3 9 utf8 utf8_general_ci enum('YES','NO') +3.0000 mysql proc security_type enum 7 21 utf8 utf8_general_ci enum('INVOKER','DEFINER') +1.0000 mysql proc param_list blob 65535 65535 NULL NULL blob +3.0000 mysql proc returns char 64 192 utf8 utf8_general_ci char(64) +1.0000 mysql proc body longblob 4294967295 4294967295 NULL NULL longblob +3.0000 mysql proc definer char 77 231 utf8 utf8_bin char(77) +NULL mysql proc created timestamp NULL NULL NULL NULL timestamp +NULL mysql proc modified timestamp NULL NULL NULL NULL timestamp +3.0000 mysql proc sql_mode set 431 1293 utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE') +3.0000 mysql proc comment char 64 192 utf8 utf8_bin char(64) +3.0000 mysql procs_priv Host char 60 180 utf8 utf8_bin char(60) +3.0000 mysql procs_priv Db char 64 192 utf8 utf8_bin char(64) +3.0000 mysql procs_priv User char 16 48 utf8 utf8_bin char(16) +3.0000 mysql procs_priv Routine_name char 64 192 utf8 utf8_bin char(64) +3.0000 mysql procs_priv Routine_type enum 9 27 utf8 utf8_bin enum('FUNCTION','PROCEDURE') +3.0000 mysql procs_priv Grantor char 77 231 utf8 utf8_bin char(77) +3.0000 mysql procs_priv Proc_priv set 27 81 utf8 utf8_general_ci set('Execute','Alter Routine','Grant') +NULL mysql procs_priv Timestamp timestamp NULL NULL NULL NULL timestamp +3.0000 mysql tables_priv Host char 60 180 utf8 utf8_bin char(60) +3.0000 mysql tables_priv Db char 64 192 utf8 utf8_bin char(64) +3.0000 mysql tables_priv User char 16 48 utf8 utf8_bin char(16) +3.0000 mysql tables_priv Table_name char 64 192 utf8 utf8_bin char(64) +3.0000 mysql tables_priv Grantor char 77 231 utf8 utf8_bin char(77) +NULL mysql tables_priv Timestamp timestamp NULL NULL NULL NULL timestamp +3.0000 mysql tables_priv Table_priv set 90 270 utf8 utf8_general_ci set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view') +3.0000 mysql tables_priv Column_priv set 31 93 utf8 utf8_general_ci set('Select','Insert','Update','References') +NULL mysql time_zone Time_zone_id int NULL NULL NULL NULL int(10) unsigned +3.0000 mysql time_zone Use_leap_seconds enum 1 3 utf8 utf8_general_ci enum('Y','N') +NULL mysql time_zone_leap_second Transition_time bigint NULL NULL NULL NULL bigint(20) +NULL mysql time_zone_leap_second Correction int NULL NULL NULL NULL int(11) +3.0000 mysql time_zone_name Name char 64 192 utf8 utf8_general_ci char(64) +NULL mysql time_zone_name Time_zone_id int NULL NULL NULL NULL int(10) unsigned +NULL mysql time_zone_transition Time_zone_id int NULL NULL NULL NULL int(10) unsigned +NULL mysql time_zone_transition Transition_time bigint NULL NULL NULL NULL bigint(20) +NULL mysql time_zone_transition Transition_type_id int NULL NULL NULL NULL int(10) unsigned +NULL mysql time_zone_transition_type Time_zone_id int NULL NULL NULL NULL int(10) unsigned +NULL mysql time_zone_transition_type Transition_type_id int NULL NULL NULL NULL int(10) unsigned +NULL mysql time_zone_transition_type Offset int NULL NULL NULL NULL int(11) +NULL mysql time_zone_transition_type Is_DST tinyint NULL NULL NULL NULL tinyint(3) unsigned +3.0000 mysql time_zone_transition_type Abbreviation char 8 24 utf8 utf8_general_ci char(8) +3.0000 mysql user Host char 60 180 utf8 utf8_bin char(60) +3.0000 mysql user User char 16 48 utf8 utf8_bin char(16) +1.0000 mysql user Password char 41 41 latin1 latin1_bin char(41) +3.0000 mysql user Select_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql user Insert_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql user Update_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql user Delete_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql user Create_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql user Drop_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql user Reload_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql user Shutdown_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql user Process_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql user File_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql user Grant_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql user References_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql user Index_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql user Alter_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql user Show_db_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql user Super_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql user Create_tmp_table_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql user Lock_tables_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql user Execute_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql user Repl_slave_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql user Repl_client_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql user Create_view_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql user Show_view_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql user Create_routine_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql user Alter_routine_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql user Create_user_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql user ssl_type enum 9 27 utf8 utf8_general_ci enum('','ANY','X509','SPECIFIED') +1.0000 mysql user ssl_cipher blob 65535 65535 NULL NULL blob +1.0000 mysql user x509_issuer blob 65535 65535 NULL NULL blob +1.0000 mysql user x509_subject blob 65535 65535 NULL NULL blob +NULL mysql user max_questions int NULL NULL NULL NULL int(11) unsigned +NULL mysql user max_updates int NULL NULL NULL NULL int(11) unsigned +NULL mysql user max_connections int NULL NULL NULL NULL int(11) unsigned +NULL mysql user max_user_connections int NULL NULL NULL NULL int(11) unsigned diff --git a/mysql-test/suite/funcs_1/r/is_columns_ndb.result b/mysql-test/suite/funcs_1/r/is_columns_ndb.result index 4ae1723140e..444c62eb010 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_ndb.result +++ b/mysql-test/suite/funcs_1/r/is_columns_ndb.result @@ -4,29 +4,35 @@ USE test; USE test; USE test; DROP TABLE IF EXISTS t1, t2, t4, t10, t11; -CREATE TABLE t1 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = ndb; -CREATE TABLE t2 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = ndb; -CREATE TABLE t4 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = ndb; -CREATE TABLE t10 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = ndb; -CREATE TABLE t11 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = ndb; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t1; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t2; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t4; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t10; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t11; +CREATE TABLE t1 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +ENGINE = ndb; +CREATE TABLE t2 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +ENGINE = ndb; +CREATE TABLE t4 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +ENGINE = ndb; +CREATE TABLE t10 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +ENGINE = ndb; +CREATE TABLE t11 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +ENGINE = ndb; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' INTO TABLE t1; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' INTO TABLE t2; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' INTO TABLE t4; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' INTO TABLE t10; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' INTO TABLE t11; drop TABLE if exists t3; CREATE TABLE t3 (f1 char(20), f2 char(20), f3 integer) ENGINE = ndb; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t3.txt' INTO TABLE t3; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t3.txt' INTO TABLE t3; drop database if exists test4; CREATE database test4; use test4; -CREATE TABLE t6 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = ndb; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t6; +CREATE TABLE t6 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) +ENGINE = ndb; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' INTO TABLE t6; use test; drop TABLE if exists t7, t8; -CREATE TABLE t7 (f1 char(20), f2 char(25), f3 date, f4 int) ENGINE = ndb; -CREATE TABLE t8 (f1 char(20), f2 char(25), f3 date, f4 int) ENGINE = ndb; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' INTO TABLE t7; +CREATE TABLE t7 (f1 char(20),f2 char(25),f3 date,f4 int) ENGINE = ndb; +CREATE TABLE t8 (f1 char(20),f2 char(25),f3 date,f4 int) ENGINE = ndb; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' INTO TABLE t7; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -38,7 +44,7 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' INTO TABLE t8; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' INTO TABLE t8; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -52,7 +58,7 @@ Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 drop TABLE if exists t9; CREATE TABLE t9 (f1 int, f2 char(25), f3 int) ENGINE = ndb; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' INTO TABLE t9; +LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t9.txt' INTO TABLE t9; SELECT * FROM information_schema.columns WHERE table_schema LIKE 'test%' ORDER BY table_schema, table_name, column_name; diff --git a/mysql-test/suite/funcs_1/r/is_key_column_usage_embedded.result b/mysql-test/suite/funcs_1/r/is_key_column_usage_embedded.result new file mode 100644 index 00000000000..17b5708643b --- /dev/null +++ b/mysql-test/suite/funcs_1/r/is_key_column_usage_embedded.result @@ -0,0 +1,372 @@ +SHOW TABLES FROM information_schema LIKE 'KEY_COLUMN_USAGE'; +Tables_in_information_schema (KEY_COLUMN_USAGE) +KEY_COLUMN_USAGE +####################################################################### +# Testcase 3.2.1.1: INFORMATION_SCHEMA tables can be queried via SELECT +####################################################################### +DROP VIEW IF EXISTS test.v1; +DROP PROCEDURE IF EXISTS test.p1; +DROP FUNCTION IF EXISTS test.f1; +CREATE VIEW test.v1 AS SELECT * FROM information_schema.KEY_COLUMN_USAGE; +CREATE PROCEDURE test.p1() SELECT * FROM information_schema.KEY_COLUMN_USAGE; +CREATE FUNCTION test.f1() returns BIGINT +BEGIN +DECLARE counter BIGINT DEFAULT NULL; +SELECT COUNT(*) INTO counter FROM information_schema.KEY_COLUMN_USAGE; +RETURN counter; +END// +# Attention: The printing of the next result sets is disabled. +SELECT * FROM information_schema.KEY_COLUMN_USAGE; +SELECT * FROM test.v1; +CALL test.p1; +SELECT test.f1(); +DROP VIEW test.v1; +DROP PROCEDURE test.p1; +DROP FUNCTION test.f1; +######################################################################### +# Testcase 3.2.7.1: INFORMATION_SCHEMA.KEY_COLUMN_USAGE layout +######################################################################### +DESCRIBE information_schema.KEY_COLUMN_USAGE; +Field Type Null Key Default Extra +CONSTRAINT_CATALOG varchar(512) YES NULL +CONSTRAINT_SCHEMA varchar(64) NO +CONSTRAINT_NAME varchar(64) NO +TABLE_CATALOG varchar(512) YES NULL +TABLE_SCHEMA varchar(64) NO +TABLE_NAME varchar(64) NO +COLUMN_NAME varchar(64) NO +ORDINAL_POSITION bigint(10) NO 0 +POSITION_IN_UNIQUE_CONSTRAINT bigint(10) YES NULL +REFERENCED_TABLE_SCHEMA varchar(64) YES NULL +REFERENCED_TABLE_NAME varchar(64) YES NULL +REFERENCED_COLUMN_NAME varchar(64) YES NULL +SHOW CREATE TABLE information_schema.KEY_COLUMN_USAGE; +Table Create Table +KEY_COLUMN_USAGE CREATE TEMPORARY TABLE `KEY_COLUMN_USAGE` ( + `CONSTRAINT_CATALOG` varchar(512) default NULL, + `CONSTRAINT_SCHEMA` varchar(64) NOT NULL default '', + `CONSTRAINT_NAME` varchar(64) NOT NULL default '', + `TABLE_CATALOG` varchar(512) default NULL, + `TABLE_SCHEMA` varchar(64) NOT NULL default '', + `TABLE_NAME` varchar(64) NOT NULL default '', + `COLUMN_NAME` varchar(64) NOT NULL default '', + `ORDINAL_POSITION` bigint(10) NOT NULL default '0', + `POSITION_IN_UNIQUE_CONSTRAINT` bigint(10) default NULL, + `REFERENCED_TABLE_SCHEMA` varchar(64) default NULL, + `REFERENCED_TABLE_NAME` varchar(64) default NULL, + `REFERENCED_COLUMN_NAME` varchar(64) default NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8 +SHOW COLUMNS FROM information_schema.KEY_COLUMN_USAGE; +Field Type Null Key Default Extra +CONSTRAINT_CATALOG varchar(512) YES NULL +CONSTRAINT_SCHEMA varchar(64) NO +CONSTRAINT_NAME varchar(64) NO +TABLE_CATALOG varchar(512) YES NULL +TABLE_SCHEMA varchar(64) NO +TABLE_NAME varchar(64) NO +COLUMN_NAME varchar(64) NO +ORDINAL_POSITION bigint(10) NO 0 +POSITION_IN_UNIQUE_CONSTRAINT bigint(10) YES NULL +REFERENCED_TABLE_SCHEMA varchar(64) YES NULL +REFERENCED_TABLE_NAME varchar(64) YES NULL +REFERENCED_COLUMN_NAME varchar(64) YES 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; +constraint_catalog constraint_schema constraint_name table_catalog table_schema table_name column_name +######################################################################################## +# Testcase 3.2.7.2 + 3.2.7.3: INFORMATION_SCHEMA.KEY_COLUMN_USAGE accessible information +######################################################################################## +DROP DATABASE IF EXISTS db_datadict; +CREATE DATABASE db_datadict; +DROP USER 'testuser1'@'localhost'; +CREATE USER 'testuser1'@'localhost'; +DROP USER 'testuser2'@'localhost'; +CREATE USER 'testuser2'@'localhost'; +USE db_datadict; +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'; +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'; +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; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME +NULL db_datadict PRIMARY NULL db_datadict t1_1 f1 1 NULL NULL NULL NULL +NULL db_datadict PRIMARY NULL db_datadict t1_2 f1 1 NULL NULL NULL NULL +# Establish connection testuser1 (user=testuser1) +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; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME +NULL db_datadict PRIMARY NULL db_datadict t1_1 f1 1 NULL NULL NULL NULL +NULL db_datadict PRIMARY NULL db_datadict t1_2 f1 1 NULL NULL NULL NULL +# Establish connection testuser2 (user=testuser2) +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; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME +NULL db_datadict PRIMARY NULL db_datadict t1_1 f1 1 NULL NULL NULL NULL +NULL db_datadict PRIMARY NULL db_datadict t1_2 f1 1 NULL NULL NULL NULL +# Switch to connection default and close connections testuser1, testuser2 +DROP USER 'testuser1'@'localhost'; +DROP USER 'testuser2'@'localhost'; +DROP TABLE t1_1; +DROP TABLE t1_2; +DROP DATABASE IF EXISTS db_datadict; +######################################################################################## +# Testcase 3.2.1.13+3.2.1.14+3.2.1.15: INFORMATION_SCHEMA.KEY_COLUMN_USAGE modifications +######################################################################################## +DROP DATABASE IF EXISTS db_datadict; +DROP TABLE IF EXISTS test.t1_my_table; +CREATE DATABASE db_datadict; +SELECT table_name FROM information_schema.key_column_usage +WHERE table_name LIKE 't1_my_table%'; +table_name +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>; +SELECT * FROM information_schema.key_column_usage +WHERE table_name = 't1_my_table'; +CONSTRAINT_CATALOG NULL +CONSTRAINT_SCHEMA test +CONSTRAINT_NAME PRIMARY +TABLE_CATALOG NULL +TABLE_SCHEMA test +TABLE_NAME t1_my_table +COLUMN_NAME f1 +ORDINAL_POSITION 1 +POSITION_IN_UNIQUE_CONSTRAINT NULL +REFERENCED_TABLE_SCHEMA NULL +REFERENCED_TABLE_NAME NULL +REFERENCED_COLUMN_NAME NULL +CONSTRAINT_CATALOG NULL +CONSTRAINT_SCHEMA test +CONSTRAINT_NAME PRIMARY +TABLE_CATALOG NULL +TABLE_SCHEMA test +TABLE_NAME t1_my_table +COLUMN_NAME f2 +ORDINAL_POSITION 2 +POSITION_IN_UNIQUE_CONSTRAINT NULL +REFERENCED_TABLE_SCHEMA NULL +REFERENCED_TABLE_NAME NULL +REFERENCED_COLUMN_NAME NULL +SELECT DISTINCT table_name FROM information_schema.key_column_usage +WHERE table_name LIKE 't1_my_table%'; +table_name +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%'; +table_name +t1_my_tablex +SELECT DISTINCT table_schema,table_name FROM information_schema.key_column_usage +WHERE table_name = 't1_my_tablex'; +table_schema table_name +test 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'; +table_schema table_name +db_datadict t1_my_tablex +SELECT DISTINCT table_name, column_name FROM information_schema.key_column_usage +WHERE table_name = 't1_my_tablex' +ORDER BY table_name, column_name; +table_name column_name +t1_my_tablex f1 +t1_my_tablex f2 +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; +table_name column_name +t1_my_tablex f2 +t1_my_tablex first_col +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; +constraint_schema constraint_name table_schema table_name column_name ordinal_position +db_datadict PRIMARY db_datadict t1_my_tablex first_col 1 +db_datadict PRIMARY db_datadict t1_my_tablex f2 2 +CREATE INDEX f2 ON db_datadict.t1_my_tablex(f2); +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; +constraint_schema constraint_name table_schema table_name column_name ordinal_position +db_datadict PRIMARY db_datadict t1_my_tablex first_col 1 +db_datadict PRIMARY db_datadict t1_my_tablex f2 2 +DROP INDEX f2 ON db_datadict.t1_my_tablex; +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; +constraint_schema constraint_name table_schema table_name column_name ordinal_position +db_datadict PRIMARY db_datadict t1_my_tablex first_col 1 +db_datadict PRIMARY db_datadict t1_my_tablex f2 2 +ALTER TABLE db_datadict.t1_my_tablex ADD UNIQUE (f2); +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; +constraint_schema constraint_name table_schema table_name column_name ordinal_position +db_datadict f2 db_datadict t1_my_tablex f2 1 +db_datadict PRIMARY db_datadict t1_my_tablex first_col 1 +db_datadict PRIMARY db_datadict t1_my_tablex f2 2 +DROP INDEX f2 ON db_datadict.t1_my_tablex; +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; +constraint_schema constraint_name table_schema table_name column_name ordinal_position +db_datadict PRIMARY db_datadict t1_my_tablex first_col 1 +db_datadict PRIMARY db_datadict t1_my_tablex f2 2 +ALTER TABLE db_datadict.t1_my_tablex ADD UNIQUE my_idx (f2); +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; +constraint_schema constraint_name table_schema table_name column_name ordinal_position +db_datadict my_idx db_datadict t1_my_tablex f2 1 +db_datadict PRIMARY db_datadict t1_my_tablex first_col 1 +db_datadict PRIMARY db_datadict t1_my_tablex f2 2 +DROP INDEX my_idx ON db_datadict.t1_my_tablex; +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; +constraint_schema constraint_name table_schema table_name column_name ordinal_position +db_datadict PRIMARY db_datadict t1_my_tablex first_col 1 +db_datadict PRIMARY db_datadict t1_my_tablex f2 2 +ALTER TABLE db_datadict.t1_my_tablex ADD UNIQUE my_idx (f4,first_col); +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; +constraint_schema constraint_name table_schema table_name column_name ordinal_position +db_datadict my_idx db_datadict t1_my_tablex f4 1 +db_datadict my_idx db_datadict t1_my_tablex first_col 2 +db_datadict PRIMARY db_datadict t1_my_tablex first_col 1 +db_datadict PRIMARY db_datadict t1_my_tablex f2 2 +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; +constraint_schema constraint_name table_schema table_name column_name ordinal_position +db_datadict my_idx db_datadict t1_my_tablex f4 1 +db_datadict my_idx db_datadict t1_my_tablex first_col 2 +db_datadict PRIMARY db_datadict t1_my_tablex first_col 1 +db_datadict PRIMARY db_datadict t1_my_tablex f2 2 +ALTER TABLE db_datadict.t1_my_tablex +DROP COLUMN first_col; +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; +constraint_schema constraint_name table_schema table_name column_name ordinal_position +db_datadict my_idx db_datadict t1_my_tablex f4 1 +db_datadict PRIMARY db_datadict t1_my_tablex f2 1 +SELECT table_name, column_name +FROM information_schema.key_column_usage +WHERE table_name = 't1_my_tablex' +ORDER BY table_name, column_name; +table_name column_name +t1_my_tablex f2 +t1_my_tablex f4 +DROP TABLE db_datadict.t1_my_tablex; +SELECT table_name, column_name +FROM information_schema.key_column_usage +WHERE table_name = 't1_my_tablex'; +table_name column_name +SELECT table_name FROM information_schema.key_column_usage +WHERE table_name = 't1_my_tablex'; +table_name +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'; +table_name +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'; +table_name +t1_my_tablex +SELECT table_name FROM information_schema.key_column_usage +WHERE table_name = 't1_my_tablex'; +table_name +t1_my_tablex +DROP DATABASE db_datadict; +SELECT table_name FROM information_schema.key_column_usage +WHERE table_name = 't1_my_tablex'; +table_name +######################################################################## +# Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and +# DDL on INFORMATION_SCHEMA table are not supported +######################################################################## +DROP DATABASE IF EXISTS db_datadict; +DROP TABLE IF EXISTS db_datadict.t1; +CREATE DATABASE db_datadict; +CREATE TABLE db_datadict.t1 (f1 BIGINT) +ENGINE = <engine_type>; +INSERT INTO information_schema.key_column_usage +(constraint_schema, constraint_name, table_name) +VALUES ( 'mysql', 'primary', 'db'); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +INSERT INTO information_schema.key_column_usage +SELECT * FROM information_schema.key_column_usage; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +UPDATE information_schema.key_column_usage +SET table_name = 'db1' WHERE constraint_name = 'primary'; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +DELETE FROM information_schema.key_column_usage WHERE table_name = 't1'; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +TRUNCATE information_schema.key_column_usage; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +CREATE INDEX i3 ON information_schema.key_column_usage(table_name); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +ALTER TABLE information_schema.key_column_usage ADD f1 INT; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +DROP TABLE information_schema.key_column_usage; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +ALTER TABLE information_schema.key_column_usage +RENAME db_datadict.key_column_usage; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +ALTER TABLE information_schema.key_column_usage +RENAME information_schema.xkey_column_usage; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +DROP TABLE db_datadict.t1; +DROP DATABASE db_datadict; diff --git a/mysql-test/suite/funcs_1/r/is_routines_embedded.result b/mysql-test/suite/funcs_1/r/is_routines_embedded.result new file mode 100644 index 00000000000..2e5dbf84402 --- /dev/null +++ b/mysql-test/suite/funcs_1/r/is_routines_embedded.result @@ -0,0 +1,620 @@ +SHOW TABLES FROM information_schema LIKE 'ROUTINES'; +Tables_in_information_schema (ROUTINES) +ROUTINES +####################################################################### +# Testcase 3.2.1.1: INFORMATION_SCHEMA tables can be queried via SELECT +####################################################################### +DROP VIEW IF EXISTS test.v1; +DROP PROCEDURE IF EXISTS test.p1; +DROP FUNCTION IF EXISTS test.f1; +CREATE VIEW test.v1 AS SELECT * FROM information_schema.ROUTINES; +CREATE PROCEDURE test.p1() SELECT * FROM information_schema.ROUTINES; +CREATE FUNCTION test.f1() returns BIGINT +BEGIN +DECLARE counter BIGINT DEFAULT NULL; +SELECT COUNT(*) INTO counter FROM information_schema.ROUTINES; +RETURN counter; +END// +# Attention: The printing of the next result sets is disabled. +SELECT * FROM information_schema.ROUTINES; +SELECT * FROM test.v1; +CALL test.p1; +SELECT test.f1(); +DROP VIEW test.v1; +DROP PROCEDURE test.p1; +DROP FUNCTION test.f1; +######################################################################### +# Testcase 3.2.8.1: INFORMATION_SCHEMA.ROUTINES layout +######################################################################### +DESCRIBE information_schema.ROUTINES; +Field Type Null Key Default Extra +SPECIFIC_NAME varchar(64) NO +ROUTINE_CATALOG varchar(512) YES NULL +ROUTINE_SCHEMA varchar(64) NO +ROUTINE_NAME varchar(64) NO +ROUTINE_TYPE varchar(9) NO +DTD_IDENTIFIER varchar(64) YES NULL +ROUTINE_BODY varchar(8) NO +ROUTINE_DEFINITION longtext YES NULL +EXTERNAL_NAME varchar(64) YES NULL +EXTERNAL_LANGUAGE varchar(64) YES NULL +PARAMETER_STYLE varchar(8) NO +IS_DETERMINISTIC varchar(3) NO +SQL_DATA_ACCESS varchar(64) NO +SQL_PATH varchar(64) YES NULL +SECURITY_TYPE varchar(7) NO +CREATED datetime NO 0000-00-00 00:00:00 +LAST_ALTERED datetime NO 0000-00-00 00:00:00 +SQL_MODE longtext NO NULL +ROUTINE_COMMENT varchar(64) NO +DEFINER varchar(77) NO +SHOW CREATE TABLE information_schema.ROUTINES; +Table Create Table +ROUTINES CREATE TEMPORARY TABLE `ROUTINES` ( + `SPECIFIC_NAME` varchar(64) NOT NULL default '', + `ROUTINE_CATALOG` varchar(512) default NULL, + `ROUTINE_SCHEMA` varchar(64) NOT NULL default '', + `ROUTINE_NAME` varchar(64) NOT NULL default '', + `ROUTINE_TYPE` varchar(9) NOT NULL default '', + `DTD_IDENTIFIER` varchar(64) default NULL, + `ROUTINE_BODY` varchar(8) NOT NULL default '', + `ROUTINE_DEFINITION` longtext, + `EXTERNAL_NAME` varchar(64) default NULL, + `EXTERNAL_LANGUAGE` varchar(64) default NULL, + `PARAMETER_STYLE` varchar(8) NOT NULL default '', + `IS_DETERMINISTIC` varchar(3) NOT NULL default '', + `SQL_DATA_ACCESS` varchar(64) NOT NULL default '', + `SQL_PATH` varchar(64) default NULL, + `SECURITY_TYPE` varchar(7) NOT NULL default '', + `CREATED` datetime NOT NULL default '0000-00-00 00:00:00', + `LAST_ALTERED` datetime NOT NULL default '0000-00-00 00:00:00', + `SQL_MODE` longtext NOT NULL, + `ROUTINE_COMMENT` varchar(64) NOT NULL default '', + `DEFINER` varchar(77) NOT NULL default '' +) ENGINE=MyISAM DEFAULT CHARSET=utf8 +SHOW COLUMNS FROM information_schema.ROUTINES; +Field Type Null Key Default Extra +SPECIFIC_NAME varchar(64) NO +ROUTINE_CATALOG varchar(512) YES NULL +ROUTINE_SCHEMA varchar(64) NO +ROUTINE_NAME varchar(64) NO +ROUTINE_TYPE varchar(9) NO +DTD_IDENTIFIER varchar(64) YES NULL +ROUTINE_BODY varchar(8) NO +ROUTINE_DEFINITION longtext YES NULL +EXTERNAL_NAME varchar(64) YES NULL +EXTERNAL_LANGUAGE varchar(64) YES NULL +PARAMETER_STYLE varchar(8) NO +IS_DETERMINISTIC varchar(3) NO +SQL_DATA_ACCESS varchar(64) NO +SQL_PATH varchar(64) YES NULL +SECURITY_TYPE varchar(7) NO +CREATED datetime NO 0000-00-00 00:00:00 +LAST_ALTERED datetime NO 0000-00-00 00:00:00 +SQL_MODE longtext NO NULL +ROUTINE_COMMENT varchar(64) NO +DEFINER varchar(77) NO +USE test; +DROP PROCEDURE IF EXISTS sp_for_routines; +DROP FUNCTION IF EXISTS function_for_routines; +CREATE PROCEDURE sp_for_routines() SELECT 'db_datadict'; +CREATE FUNCTION function_for_routines() RETURNS INT RETURN 0; +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; +specific_name routine_catalog routine_schema routine_name routine_type routine_body external_name external_language parameter_style sql_path +DROP PROCEDURE sp_for_routines; +DROP FUNCTION function_for_routines; +################################################################################ +# Testcase 3.2.8.2 + 3.2.8.3: INFORMATION_SCHEMA.ROUTINES accessible information +################################################################################ +DROP DATABASE IF EXISTS db_datadict; +DROP DATABASE IF EXISTS db_datadict_2; +CREATE DATABASE db_datadict; +USE db_datadict; +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); +DROP PROCEDURE IF EXISTS sp_6_408002_1; +CREATE PROCEDURE sp_6_408002_1() +BEGIN +SELECT * FROM db_datadict.res_6_408002_1; +END// +CREATE DATABASE db_datadict_2; +USE db_datadict_2; +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); +DROP PROCEDURE IF EXISTS sp_6_408002_2; +CREATE PROCEDURE sp_6_408002_2() +BEGIN +SELECT * FROM db_datadict_2.res_6_408002_2; +END// +DROP USER 'testuser1'@'localhost'; +CREATE USER 'testuser1'@'localhost'; +DROP USER 'testuser2'@'localhost'; +CREATE USER 'testuser2'@'localhost'; +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; +# Establish connection testuser1 (user=testuser1) +SELECT * FROM information_schema.routines; +SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER +sp_6_408002_1 NULL db_datadict sp_6_408002_1 PROCEDURE NULL SQL BEGIN +SELECT * FROM db_datadict.res_6_408002_1; +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost +sp_6_408002_2 NULL db_datadict_2 sp_6_408002_2 PROCEDURE NULL SQL BEGIN +SELECT * FROM db_datadict_2.res_6_408002_2; +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost +# Establish connection testuser2 (user=testuser2) +SELECT * FROM information_schema.routines; +SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER +sp_6_408002_1 NULL db_datadict sp_6_408002_1 PROCEDURE NULL SQL BEGIN +SELECT * FROM db_datadict.res_6_408002_1; +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost +sp_6_408002_2 NULL db_datadict_2 sp_6_408002_2 PROCEDURE NULL SQL BEGIN +SELECT * FROM db_datadict_2.res_6_408002_2; +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost +# Establish connection testuser3 (user=testuser3) +SELECT * FROM information_schema.routines; +SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER +sp_6_408002_1 NULL db_datadict sp_6_408002_1 PROCEDURE NULL SQL BEGIN +SELECT * FROM db_datadict.res_6_408002_1; +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost +sp_6_408002_2 NULL db_datadict_2 sp_6_408002_2 PROCEDURE NULL SQL BEGIN +SELECT * FROM db_datadict_2.res_6_408002_2; +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost +# Switch to connection default and close connections testuser1,testuser2,testuser3 +DROP USER 'testuser1'@'localhost'; +DROP USER 'testuser2'@'localhost'; +DROP USER 'testuser3'@'localhost'; +USE test; +DROP DATABASE db_datadict; +DROP DATABASE db_datadict_2; +######################################################################### +# 3.2.1.13+3.2.1.14+3.2.1.15: INFORMATION_SCHEMA.ROUTINES modifications +######################################################################### +DROP DATABASE IF EXISTS db_datadict; +CREATE DATABASE db_datadict; +SELECT * FROM information_schema.routines WHERE routine_schema = 'db_datadict'; +SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER +USE db_datadict; +CREATE PROCEDURE sp_for_routines() SELECT 'db_datadict'; +CREATE FUNCTION function_for_routines() RETURNS INT RETURN 0; +SELECT * FROM information_schema.routines WHERE routine_schema = 'db_datadict' +ORDER BY routine_name; +SPECIFIC_NAME function_for_routines +ROUTINE_CATALOG NULL +ROUTINE_SCHEMA db_datadict +ROUTINE_NAME function_for_routines +ROUTINE_TYPE FUNCTION +DTD_IDENTIFIER int(11) +ROUTINE_BODY SQL +ROUTINE_DEFINITION RETURN 0 +EXTERNAL_NAME NULL +EXTERNAL_LANGUAGE NULL +PARAMETER_STYLE SQL +IS_DETERMINISTIC NO +SQL_DATA_ACCESS CONTAINS SQL +SQL_PATH NULL +SECURITY_TYPE DEFINER +CREATED <created> +LAST_ALTERED <modified> +SQL_MODE +ROUTINE_COMMENT +DEFINER root@localhost +SPECIFIC_NAME sp_for_routines +ROUTINE_CATALOG NULL +ROUTINE_SCHEMA db_datadict +ROUTINE_NAME sp_for_routines +ROUTINE_TYPE PROCEDURE +DTD_IDENTIFIER NULL +ROUTINE_BODY SQL +ROUTINE_DEFINITION SELECT 'db_datadict' +EXTERNAL_NAME NULL +EXTERNAL_LANGUAGE NULL +PARAMETER_STYLE SQL +IS_DETERMINISTIC NO +SQL_DATA_ACCESS CONTAINS SQL +SQL_PATH NULL +SECURITY_TYPE DEFINER +CREATED <created> +LAST_ALTERED <modified> +SQL_MODE +ROUTINE_COMMENT +DEFINER root@localhost +ALTER PROCEDURE sp_for_routines SQL SECURITY INVOKER; +ALTER FUNCTION function_for_routines COMMENT 'updated comments'; +SELECT * FROM information_schema.routines WHERE routine_schema = 'db_datadict' +ORDER BY routine_name; +SPECIFIC_NAME function_for_routines +ROUTINE_CATALOG NULL +ROUTINE_SCHEMA db_datadict +ROUTINE_NAME function_for_routines +ROUTINE_TYPE FUNCTION +DTD_IDENTIFIER int(11) +ROUTINE_BODY SQL +ROUTINE_DEFINITION RETURN 0 +EXTERNAL_NAME NULL +EXTERNAL_LANGUAGE NULL +PARAMETER_STYLE SQL +IS_DETERMINISTIC NO +SQL_DATA_ACCESS CONTAINS SQL +SQL_PATH NULL +SECURITY_TYPE DEFINER +CREATED <created> +LAST_ALTERED <modified> +SQL_MODE +ROUTINE_COMMENT updated comments +DEFINER root@localhost +SPECIFIC_NAME sp_for_routines +ROUTINE_CATALOG NULL +ROUTINE_SCHEMA db_datadict +ROUTINE_NAME sp_for_routines +ROUTINE_TYPE PROCEDURE +DTD_IDENTIFIER NULL +ROUTINE_BODY SQL +ROUTINE_DEFINITION SELECT 'db_datadict' +EXTERNAL_NAME NULL +EXTERNAL_LANGUAGE NULL +PARAMETER_STYLE SQL +IS_DETERMINISTIC NO +SQL_DATA_ACCESS CONTAINS SQL +SQL_PATH NULL +SECURITY_TYPE INVOKER +CREATED <created> +LAST_ALTERED <modified> +SQL_MODE +ROUTINE_COMMENT +DEFINER root@localhost +DROP PROCEDURE sp_for_routines; +DROP FUNCTION function_for_routines; +SELECT * FROM information_schema.routines WHERE routine_schema = 'db_datadict'; +SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER +CREATE PROCEDURE sp_for_routines() SELECT 'db_datadict'; +CREATE FUNCTION function_for_routines() RETURNS INT RETURN 0; +SELECT * FROM information_schema.routines WHERE routine_schema = 'db_datadict' +ORDER BY routine_name; +SPECIFIC_NAME function_for_routines +ROUTINE_CATALOG NULL +ROUTINE_SCHEMA db_datadict +ROUTINE_NAME function_for_routines +ROUTINE_TYPE FUNCTION +DTD_IDENTIFIER int(11) +ROUTINE_BODY SQL +ROUTINE_DEFINITION RETURN 0 +EXTERNAL_NAME NULL +EXTERNAL_LANGUAGE NULL +PARAMETER_STYLE SQL +IS_DETERMINISTIC NO +SQL_DATA_ACCESS CONTAINS SQL +SQL_PATH NULL +SECURITY_TYPE DEFINER +CREATED <created> +LAST_ALTERED <modified> +SQL_MODE +ROUTINE_COMMENT +DEFINER root@localhost +SPECIFIC_NAME sp_for_routines +ROUTINE_CATALOG NULL +ROUTINE_SCHEMA db_datadict +ROUTINE_NAME sp_for_routines +ROUTINE_TYPE PROCEDURE +DTD_IDENTIFIER NULL +ROUTINE_BODY SQL +ROUTINE_DEFINITION SELECT 'db_datadict' +EXTERNAL_NAME NULL +EXTERNAL_LANGUAGE NULL +PARAMETER_STYLE SQL +IS_DETERMINISTIC NO +SQL_DATA_ACCESS CONTAINS SQL +SQL_PATH NULL +SECURITY_TYPE DEFINER +CREATED <created> +LAST_ALTERED <modified> +SQL_MODE +ROUTINE_COMMENT +DEFINER root@localhost +use test; +DROP DATABASE db_datadict; +SELECT * FROM information_schema.routines WHERE routine_schema = 'db_datadict'; +SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER +######################################################################### +# 3.2.8.4: INFORMATION_SCHEMA.ROUTINES routine body too big for +# ROUTINE_DEFINITION column +######################################################################### +DROP DATABASE IF EXISTS db_datadict; +CREATE DATABASE db_datadict; +USE db_datadict; +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); +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); +# Checking the max. possible length of (currently) 4 GByte is not +# in this environment here. +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// +CALL db_datadict.sp_6_408004 (); +@a +test row +@a +test row +@a +test row +@a +test row +@a +test row +@a +test row +SELECT * FROM db_datadict.res_6_408004_2; +f1 f2 f3 f4 f5 +abc 98765 99999999 98765 2010 +abc 98765 99999999 98765 2010 +abc 98765 99999999 98765 2010 +abc 98765 99999999 98765 2010 +abc 98765 99999999 98765 2010 +abc 98765 99999999 98765 2010 +SELECT *, LENGTH(routine_definition) FROM information_schema.routines +WHERE routine_schema = 'db_datadict'; +SPECIFIC_NAME sp_6_408004 +ROUTINE_CATALOG NULL +ROUTINE_SCHEMA db_datadict +ROUTINE_NAME sp_6_408004 +ROUTINE_TYPE PROCEDURE +DTD_IDENTIFIER NULL +ROUTINE_BODY SQL +ROUTINE_DEFINITION 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 +EXTERNAL_NAME NULL +EXTERNAL_LANGUAGE NULL +PARAMETER_STYLE SQL +IS_DETERMINISTIC NO +SQL_DATA_ACCESS CONTAINS SQL +SQL_PATH NULL +SECURITY_TYPE DEFINER +CREATED YYYY-MM-DD hh:mm:ss +LAST_ALTERED YYYY-MM-DD hh:mm:ss +SQL_MODE +ROUTINE_COMMENT +DEFINER root@localhost +LENGTH(routine_definition) 2549 +DROP DATABASE db_datadict; +######################################################################## +# Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and +# DDL on INFORMATION_SCHEMA table are not supported +######################################################################## +DROP DATABASE IF EXISTS db_datadict; +CREATE DATABASE db_datadict; +USE db_datadict; +CREATE PROCEDURE sp_for_routines() SELECT 'db_datadict'; +USE test; +INSERT INTO information_schema.routines (routine_name, routine_type ) +VALUES ('p2', 'procedure'); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +UPDATE information_schema.routines SET routine_name = 'p2' +WHERE routine_body = 'sql'; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +DELETE FROM information_schema.routines ; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +TRUNCATE information_schema.routines ; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +CREATE INDEX i7 ON information_schema.routines (routine_name); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +ALTER TABLE information_schema.routines ADD f1 INT; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +ALTER TABLE information_schema.routines DISCARD TABLESPACE; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +DROP TABLE information_schema.routines ; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +ALTER TABLE information_schema.routines RENAME db_datadict.routines; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +ALTER TABLE information_schema.routines RENAME information_schema.xroutines; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +DROP DATABASE db_datadict; diff --git a/mysql-test/suite/funcs_1/r/is_schemata_embedded.result b/mysql-test/suite/funcs_1/r/is_schemata_embedded.result new file mode 100644 index 00000000000..0dbbeaaa468 --- /dev/null +++ b/mysql-test/suite/funcs_1/r/is_schemata_embedded.result @@ -0,0 +1,187 @@ +SHOW TABLES FROM information_schema LIKE 'SCHEMATA'; +Tables_in_information_schema (SCHEMATA) +SCHEMATA +####################################################################### +# Testcase 3.2.1.1: INFORMATION_SCHEMA tables can be queried via SELECT +####################################################################### +DROP VIEW IF EXISTS test.v1; +DROP PROCEDURE IF EXISTS test.p1; +DROP FUNCTION IF EXISTS test.f1; +CREATE VIEW test.v1 AS SELECT * FROM information_schema.SCHEMATA; +CREATE PROCEDURE test.p1() SELECT * FROM information_schema.SCHEMATA; +CREATE FUNCTION test.f1() returns BIGINT +BEGIN +DECLARE counter BIGINT DEFAULT NULL; +SELECT COUNT(*) INTO counter FROM information_schema.SCHEMATA; +RETURN counter; +END// +# Attention: The printing of the next result sets is disabled. +SELECT * FROM information_schema.SCHEMATA; +SELECT * FROM test.v1; +CALL test.p1; +SELECT test.f1(); +DROP VIEW test.v1; +DROP PROCEDURE test.p1; +DROP FUNCTION test.f1; +######################################################################### +# Testcase 3.2.9.1: INFORMATION_SCHEMA.SCHEMATA layout; +######################################################################### +DESCRIBE information_schema.SCHEMATA; +Field Type Null Key Default Extra +CATALOG_NAME varchar(512) YES NULL +SCHEMA_NAME varchar(64) NO +DEFAULT_CHARACTER_SET_NAME varchar(64) NO +DEFAULT_COLLATION_NAME varchar(64) NO +SQL_PATH varchar(512) YES NULL +SHOW CREATE TABLE information_schema.SCHEMATA; +Table Create Table +SCHEMATA CREATE TEMPORARY TABLE `SCHEMATA` ( + `CATALOG_NAME` varchar(512) default NULL, + `SCHEMA_NAME` varchar(64) NOT NULL default '', + `DEFAULT_CHARACTER_SET_NAME` varchar(64) NOT NULL default '', + `DEFAULT_COLLATION_NAME` varchar(64) NOT NULL default '', + `SQL_PATH` varchar(512) default NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8 +SHOW COLUMNS FROM information_schema.SCHEMATA; +Field Type Null Key Default Extra +CATALOG_NAME varchar(512) YES NULL +SCHEMA_NAME varchar(64) NO +DEFAULT_CHARACTER_SET_NAME varchar(64) NO +DEFAULT_COLLATION_NAME varchar(64) NO +SQL_PATH varchar(512) YES NULL +SELECT catalog_name, schema_name, sql_path +FROM information_schema.schemata +WHERE catalog_name IS NOT NULL or sql_path IS NOT NULL; +catalog_name schema_name sql_path +############################################################################### +# Testcases 3.2.9.2+3.2.9.3: INFORMATION_SCHEMA.SCHEMATA accessible information +############################################################################### +DROP DATABASE IF EXISTS db_datadict_1; +DROP DATABASE IF EXISTS db_datadict_2; +CREATE DATABASE db_datadict_1; +CREATE DATABASE db_datadict_2; +DROP USER 'testuser1'@'localhost'; +CREATE USER 'testuser1'@'localhost'; +DROP USER 'testuser2'@'localhost'; +CREATE USER 'testuser2'@'localhost'; +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'; +SELECT * FROM information_schema.schemata +WHERE schema_name LIKE 'db_datadict_%' ORDER BY schema_name; +CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH +NULL db_datadict_1 latin1 latin1_swedish_ci NULL +NULL db_datadict_2 latin1 latin1_swedish_ci NULL +SHOW DATABASES LIKE 'db_datadict_%'; +Database (db_datadict_%) +db_datadict_1 +db_datadict_2 +# Establish connection testuser1 (user=testuser1) +SELECT * FROM information_schema.schemata +WHERE schema_name LIKE 'db_datadict_%' ORDER BY schema_name; +CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH +NULL db_datadict_1 latin1 latin1_swedish_ci NULL +NULL db_datadict_2 latin1 latin1_swedish_ci NULL +SHOW DATABASES LIKE 'db_datadict_%'; +Database (db_datadict_%) +db_datadict_1 +db_datadict_2 +# Establish connection testuser2 (user=testuser2) +SELECT * FROM information_schema.schemata +WHERE schema_name LIKE 'db_datadict_%' ORDER BY schema_name; +CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH +NULL db_datadict_1 latin1 latin1_swedish_ci NULL +NULL db_datadict_2 latin1 latin1_swedish_ci NULL +SHOW DATABASES LIKE 'db_datadict_%'; +Database (db_datadict_%) +db_datadict_1 +db_datadict_2 +# Establish connection testuser3 (user=testuser3) +SELECT * FROM information_schema.schemata +WHERE schema_name LIKE 'db_datadict_%' ORDER BY schema_name; +CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH +NULL db_datadict_1 latin1 latin1_swedish_ci NULL +NULL db_datadict_2 latin1 latin1_swedish_ci NULL +SHOW DATABASES LIKE 'db_datadict_%'; +Database (db_datadict_%) +db_datadict_1 +db_datadict_2 +# Switch to connection default and close connections testuser1,testuser2,testuser3 +DROP USER 'testuser1'@'localhost'; +DROP USER 'testuser2'@'localhost'; +DROP USER 'testuser3'@'localhost'; +DROP DATABASE db_datadict_1; +DROP DATABASE db_datadict_2; +################################################################################# +# Testcases 3.2.1.13+3.2.1.14+3.2.1.15: INFORMATION_SCHEMA.SCHEMATA modifications +################################################################################# +DROP DATABASE IF EXISTS db_datadict; +SELECT * FROM information_schema.schemata WHERE schema_name = 'db_datadict'; +CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH +CREATE DATABASE db_datadict CHARACTER SET 'latin1' COLLATE 'latin1_swedish_ci'; +SELECT * FROM information_schema.schemata WHERE schema_name = 'db_datadict'; +CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH +NULL db_datadict latin1 latin1_swedish_ci NULL +SELECT schema_name, default_character_set_name +FROM information_schema.schemata WHERE schema_name = 'db_datadict'; +schema_name default_character_set_name +db_datadict latin1 +ALTER SCHEMA db_datadict CHARACTER SET 'utf8'; +SELECT schema_name, default_character_set_name +FROM information_schema.schemata WHERE schema_name = 'db_datadict'; +schema_name default_character_set_name +db_datadict utf8 +ALTER SCHEMA db_datadict CHARACTER SET 'latin1'; +SELECT schema_name, default_collation_name FROM information_schema.schemata +WHERE schema_name = 'db_datadict'; +schema_name default_collation_name +db_datadict latin1_swedish_ci +ALTER SCHEMA db_datadict COLLATE 'latin1_general_cs'; +SELECT schema_name, default_collation_name FROM information_schema.schemata +WHERE schema_name = 'db_datadict'; +schema_name default_collation_name +db_datadict latin1_general_cs +SELECT schema_name +FROM information_schema.schemata WHERE schema_name = 'db_datadict'; +schema_name +db_datadict +DROP DATABASE db_datadict; +SELECT schema_name +FROM information_schema.schemata WHERE schema_name = 'db_datadict'; +schema_name +######################################################################## +# Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and +# DDL on INFORMATION_SCHEMA tables are not supported +######################################################################## +DROP DATABASE IF EXISTS db_datadict; +CREATE DATABASE db_datadict CHARACTER SET 'latin1' COLLATE 'latin1_swedish_ci'; +INSERT INTO information_schema.schemata +(catalog_name, schema_name, default_character_set_name, sql_path) +VALUES (NULL, 'db1', 'latin1', NULL); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +INSERT INTO information_schema.schemata +SELECT * FROM information_schema.schemata; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +UPDATE information_schema.schemata +SET default_character_set_name = 'utf8' +WHERE schema_name = 'db_datadict'; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +UPDATE information_schema.schemata SET catalog_name = 't_4711'; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +DELETE FROM information_schema.schemata WHERE schema_name = 'db_datadict'; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +TRUNCATE information_schema.schemata; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +CREATE INDEX i1 ON information_schema.schemata(schema_name); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +ALTER TABLE information_schema.schemata ADD f1 INT; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +DROP TABLE information_schema.schemata; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +ALTER TABLE information_schema.schemata RENAME db_datadict.schemata; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +ALTER TABLE information_schema.schemata RENAME information_schema.xschemata; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +DROP DATABASE db_datadict; diff --git a/mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result new file mode 100644 index 00000000000..7602e71f7bf --- /dev/null +++ b/mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result @@ -0,0 +1,103 @@ +DROP DATABASE IF EXISTS db_datadict; +CREATE DATABASE db_datadict; +DROP USER testuser1@localhost; +CREATE USER testuser1@localhost; +GRANT SELECT ON db_datadict.* TO testuser1@localhost; +SELECT * FROM information_schema.statistics +WHERE table_schema = 'mysql' +ORDER BY table_schema, table_name, index_name, seq_in_index, column_name; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT +NULL mysql columns_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE +NULL mysql columns_priv 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE +NULL mysql columns_priv 0 mysql PRIMARY 3 User A #CARD# NULL NULL BTREE +NULL mysql columns_priv 0 mysql PRIMARY 4 Table_name A #CARD# NULL NULL BTREE +NULL mysql columns_priv 0 mysql PRIMARY 5 Column_name A #CARD# NULL NULL BTREE +NULL mysql db 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE +NULL mysql db 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE +NULL mysql db 0 mysql PRIMARY 3 User A #CARD# NULL NULL BTREE +NULL mysql db 1 mysql User 1 User A #CARD# NULL NULL BTREE +NULL mysql func 0 mysql PRIMARY 1 name A #CARD# NULL NULL BTREE +NULL mysql help_category 0 mysql name 1 name A #CARD# NULL NULL BTREE +NULL mysql help_category 0 mysql PRIMARY 1 help_category_id A #CARD# NULL NULL BTREE +NULL mysql help_keyword 0 mysql name 1 name A #CARD# NULL NULL BTREE +NULL mysql help_keyword 0 mysql PRIMARY 1 help_keyword_id A #CARD# NULL NULL BTREE +NULL mysql help_relation 0 mysql PRIMARY 1 help_keyword_id A #CARD# NULL NULL BTREE +NULL mysql help_relation 0 mysql PRIMARY 2 help_topic_id A #CARD# NULL NULL BTREE +NULL mysql help_topic 0 mysql name 1 name A #CARD# NULL NULL BTREE +NULL mysql help_topic 0 mysql PRIMARY 1 help_topic_id A #CARD# NULL NULL BTREE +NULL mysql host 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE +NULL mysql host 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE +NULL mysql proc 0 mysql PRIMARY 1 db A #CARD# NULL NULL BTREE +NULL mysql proc 0 mysql PRIMARY 2 name A #CARD# NULL NULL BTREE +NULL mysql proc 0 mysql PRIMARY 3 type A #CARD# NULL NULL BTREE +NULL mysql procs_priv 1 mysql Grantor 1 Grantor A #CARD# NULL NULL BTREE +NULL mysql procs_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE +NULL mysql procs_priv 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE +NULL mysql procs_priv 0 mysql PRIMARY 3 User A #CARD# NULL NULL BTREE +NULL mysql procs_priv 0 mysql PRIMARY 4 Routine_name A #CARD# NULL NULL BTREE +NULL mysql procs_priv 0 mysql PRIMARY 5 Routine_type A #CARD# NULL NULL BTREE +NULL mysql tables_priv 1 mysql Grantor 1 Grantor A #CARD# NULL NULL BTREE +NULL mysql tables_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE +NULL mysql tables_priv 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE +NULL mysql tables_priv 0 mysql PRIMARY 3 User A #CARD# NULL NULL BTREE +NULL mysql tables_priv 0 mysql PRIMARY 4 Table_name A #CARD# NULL NULL BTREE +NULL mysql time_zone 0 mysql PRIMARY 1 Time_zone_id A #CARD# NULL NULL BTREE +NULL mysql time_zone_leap_second 0 mysql PRIMARY 1 Transition_time A #CARD# NULL NULL BTREE +NULL mysql time_zone_name 0 mysql PRIMARY 1 Name A #CARD# NULL NULL BTREE +NULL mysql time_zone_transition 0 mysql PRIMARY 1 Time_zone_id A #CARD# NULL NULL BTREE +NULL mysql time_zone_transition 0 mysql PRIMARY 2 Transition_time A #CARD# NULL NULL BTREE +NULL mysql time_zone_transition_type 0 mysql PRIMARY 1 Time_zone_id A #CARD# NULL NULL BTREE +NULL mysql time_zone_transition_type 0 mysql PRIMARY 2 Transition_type_id A #CARD# NULL NULL BTREE +NULL mysql user 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE +NULL mysql user 0 mysql PRIMARY 2 User A #CARD# NULL NULL BTREE +# Establish connection testuser1 (user=testuser1) +SELECT * FROM information_schema.statistics +WHERE table_schema = 'mysql' +ORDER BY table_schema, table_name, index_name, seq_in_index, column_name; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT +NULL mysql columns_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE +NULL mysql columns_priv 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE +NULL mysql columns_priv 0 mysql PRIMARY 3 User A #CARD# NULL NULL BTREE +NULL mysql columns_priv 0 mysql PRIMARY 4 Table_name A #CARD# NULL NULL BTREE +NULL mysql columns_priv 0 mysql PRIMARY 5 Column_name A #CARD# NULL NULL BTREE +NULL mysql db 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE +NULL mysql db 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE +NULL mysql db 0 mysql PRIMARY 3 User A #CARD# NULL NULL BTREE +NULL mysql db 1 mysql User 1 User A #CARD# NULL NULL BTREE +NULL mysql func 0 mysql PRIMARY 1 name A #CARD# NULL NULL BTREE +NULL mysql help_category 0 mysql name 1 name A #CARD# NULL NULL BTREE +NULL mysql help_category 0 mysql PRIMARY 1 help_category_id A #CARD# NULL NULL BTREE +NULL mysql help_keyword 0 mysql name 1 name A #CARD# NULL NULL BTREE +NULL mysql help_keyword 0 mysql PRIMARY 1 help_keyword_id A #CARD# NULL NULL BTREE +NULL mysql help_relation 0 mysql PRIMARY 1 help_keyword_id A #CARD# NULL NULL BTREE +NULL mysql help_relation 0 mysql PRIMARY 2 help_topic_id A #CARD# NULL NULL BTREE +NULL mysql help_topic 0 mysql name 1 name A #CARD# NULL NULL BTREE +NULL mysql help_topic 0 mysql PRIMARY 1 help_topic_id A #CARD# NULL NULL BTREE +NULL mysql host 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE +NULL mysql host 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE +NULL mysql proc 0 mysql PRIMARY 1 db A #CARD# NULL NULL BTREE +NULL mysql proc 0 mysql PRIMARY 2 name A #CARD# NULL NULL BTREE +NULL mysql proc 0 mysql PRIMARY 3 type A #CARD# NULL NULL BTREE +NULL mysql procs_priv 1 mysql Grantor 1 Grantor A #CARD# NULL NULL BTREE +NULL mysql procs_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE +NULL mysql procs_priv 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE +NULL mysql procs_priv 0 mysql PRIMARY 3 User A #CARD# NULL NULL BTREE +NULL mysql procs_priv 0 mysql PRIMARY 4 Routine_name A #CARD# NULL NULL BTREE +NULL mysql procs_priv 0 mysql PRIMARY 5 Routine_type A #CARD# NULL NULL BTREE +NULL mysql tables_priv 1 mysql Grantor 1 Grantor A #CARD# NULL NULL BTREE +NULL mysql tables_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE +NULL mysql tables_priv 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE +NULL mysql tables_priv 0 mysql PRIMARY 3 User A #CARD# NULL NULL BTREE +NULL mysql tables_priv 0 mysql PRIMARY 4 Table_name A #CARD# NULL NULL BTREE +NULL mysql time_zone 0 mysql PRIMARY 1 Time_zone_id A #CARD# NULL NULL BTREE +NULL mysql time_zone_leap_second 0 mysql PRIMARY 1 Transition_time A #CARD# NULL NULL BTREE +NULL mysql time_zone_name 0 mysql PRIMARY 1 Name A #CARD# NULL NULL BTREE +NULL mysql time_zone_transition 0 mysql PRIMARY 1 Time_zone_id A #CARD# NULL NULL BTREE +NULL mysql time_zone_transition 0 mysql PRIMARY 2 Transition_time A #CARD# NULL NULL BTREE +NULL mysql time_zone_transition_type 0 mysql PRIMARY 1 Time_zone_id A #CARD# NULL NULL BTREE +NULL mysql time_zone_transition_type 0 mysql PRIMARY 2 Transition_type_id A #CARD# NULL NULL BTREE +NULL mysql user 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE +NULL mysql user 0 mysql PRIMARY 2 User A #CARD# NULL NULL BTREE +# Switch to connection default and close connection testuser1 +DROP USER testuser1@localhost; +DROP DATABASE db_datadict; diff --git a/mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result new file mode 100644 index 00000000000..0ab31365eb5 --- /dev/null +++ b/mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result @@ -0,0 +1,57 @@ +DROP DATABASE IF EXISTS db_datadict; +CREATE DATABASE db_datadict; +DROP USER testuser1@localhost; +CREATE USER testuser1@localhost; +GRANT SELECT ON db_datadict.* TO testuser1@localhost; +SELECT * FROM information_schema.table_constraints +WHERE table_schema = 'mysql' +ORDER BY table_schema,table_name,constraint_name; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME CONSTRAINT_TYPE +NULL mysql PRIMARY mysql columns_priv PRIMARY KEY +NULL mysql PRIMARY mysql db PRIMARY KEY +NULL mysql PRIMARY mysql func PRIMARY KEY +NULL mysql name mysql help_category UNIQUE +NULL mysql PRIMARY mysql help_category PRIMARY KEY +NULL mysql name mysql help_keyword UNIQUE +NULL mysql PRIMARY mysql help_keyword PRIMARY KEY +NULL mysql PRIMARY mysql help_relation PRIMARY KEY +NULL mysql name mysql help_topic UNIQUE +NULL mysql PRIMARY mysql help_topic PRIMARY KEY +NULL mysql PRIMARY mysql host PRIMARY KEY +NULL mysql PRIMARY mysql proc PRIMARY KEY +NULL mysql PRIMARY mysql procs_priv PRIMARY KEY +NULL mysql PRIMARY mysql tables_priv PRIMARY KEY +NULL mysql PRIMARY mysql time_zone PRIMARY KEY +NULL mysql PRIMARY mysql time_zone_leap_second PRIMARY KEY +NULL mysql PRIMARY mysql time_zone_name PRIMARY KEY +NULL mysql PRIMARY mysql time_zone_transition PRIMARY KEY +NULL mysql PRIMARY mysql time_zone_transition_type PRIMARY KEY +NULL mysql PRIMARY mysql user PRIMARY KEY +# Establish connection testuser1 (user=testuser1) +SELECT * FROM information_schema.table_constraints +WHERE table_schema = 'mysql' +ORDER BY table_schema,table_name,constraint_name; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME CONSTRAINT_TYPE +NULL mysql PRIMARY mysql columns_priv PRIMARY KEY +NULL mysql PRIMARY mysql db PRIMARY KEY +NULL mysql PRIMARY mysql func PRIMARY KEY +NULL mysql name mysql help_category UNIQUE +NULL mysql PRIMARY mysql help_category PRIMARY KEY +NULL mysql name mysql help_keyword UNIQUE +NULL mysql PRIMARY mysql help_keyword PRIMARY KEY +NULL mysql PRIMARY mysql help_relation PRIMARY KEY +NULL mysql name mysql help_topic UNIQUE +NULL mysql PRIMARY mysql help_topic PRIMARY KEY +NULL mysql PRIMARY mysql host PRIMARY KEY +NULL mysql PRIMARY mysql proc PRIMARY KEY +NULL mysql PRIMARY mysql procs_priv PRIMARY KEY +NULL mysql PRIMARY mysql tables_priv PRIMARY KEY +NULL mysql PRIMARY mysql time_zone PRIMARY KEY +NULL mysql PRIMARY mysql time_zone_leap_second PRIMARY KEY +NULL mysql PRIMARY mysql time_zone_name PRIMARY KEY +NULL mysql PRIMARY mysql time_zone_transition PRIMARY KEY +NULL mysql PRIMARY mysql time_zone_transition_type PRIMARY KEY +NULL mysql PRIMARY mysql user PRIMARY KEY +# Switch to connection default and close connection testuser1 +DROP USER testuser1@localhost; +DROP DATABASE db_datadict; diff --git a/mysql-test/suite/funcs_1/r/is_tables_embedded.result b/mysql-test/suite/funcs_1/r/is_tables_embedded.result new file mode 100644 index 00000000000..13ee6277bad --- /dev/null +++ b/mysql-test/suite/funcs_1/r/is_tables_embedded.result @@ -0,0 +1,427 @@ +SHOW TABLES FROM information_schema LIKE 'TABLES'; +Tables_in_information_schema (TABLES) +TABLES +####################################################################### +# Testcase 3.2.1.1: INFORMATION_SCHEMA tables can be queried via SELECT +####################################################################### +DROP VIEW IF EXISTS test.v1; +DROP PROCEDURE IF EXISTS test.p1; +DROP FUNCTION IF EXISTS test.f1; +CREATE VIEW test.v1 AS SELECT * FROM information_schema.TABLES; +CREATE PROCEDURE test.p1() SELECT * FROM information_schema.TABLES; +CREATE FUNCTION test.f1() returns BIGINT +BEGIN +DECLARE counter BIGINT DEFAULT NULL; +SELECT COUNT(*) INTO counter FROM information_schema.TABLES; +RETURN counter; +END// +# Attention: The printing of the next result sets is disabled. +SELECT * FROM information_schema.TABLES; +SELECT * FROM test.v1; +CALL test.p1; +SELECT test.f1(); +DROP VIEW test.v1; +DROP PROCEDURE test.p1; +DROP FUNCTION test.f1; +######################################################################### +# Testcase 3.2.12.1: INFORMATION_SCHEMA.TABLES layout +######################################################################### +DESCRIBE information_schema.TABLES; +Field Type Null Key Default Extra +TABLE_CATALOG varchar(512) YES NULL +TABLE_SCHEMA varchar(64) NO +TABLE_NAME varchar(64) NO +TABLE_TYPE varchar(64) NO +ENGINE varchar(64) YES NULL +VERSION bigint(21) YES NULL +ROW_FORMAT varchar(10) YES NULL +TABLE_ROWS bigint(21) YES NULL +AVG_ROW_LENGTH bigint(21) YES NULL +DATA_LENGTH bigint(21) YES NULL +MAX_DATA_LENGTH bigint(21) YES NULL +INDEX_LENGTH bigint(21) YES NULL +DATA_FREE bigint(21) YES NULL +AUTO_INCREMENT bigint(21) YES NULL +CREATE_TIME datetime YES NULL +UPDATE_TIME datetime YES NULL +CHECK_TIME datetime YES NULL +TABLE_COLLATION varchar(64) YES NULL +CHECKSUM bigint(21) YES NULL +CREATE_OPTIONS varchar(255) YES NULL +TABLE_COMMENT varchar(80) NO +SHOW CREATE TABLE information_schema.TABLES; +Table Create Table +TABLES CREATE TEMPORARY TABLE `TABLES` ( + `TABLE_CATALOG` varchar(512) default NULL, + `TABLE_SCHEMA` varchar(64) NOT NULL default '', + `TABLE_NAME` varchar(64) NOT NULL default '', + `TABLE_TYPE` varchar(64) NOT NULL default '', + `ENGINE` varchar(64) default NULL, + `VERSION` bigint(21) default NULL, + `ROW_FORMAT` varchar(10) default NULL, + `TABLE_ROWS` bigint(21) default NULL, + `AVG_ROW_LENGTH` bigint(21) default NULL, + `DATA_LENGTH` bigint(21) default NULL, + `MAX_DATA_LENGTH` bigint(21) default NULL, + `INDEX_LENGTH` bigint(21) default NULL, + `DATA_FREE` bigint(21) default NULL, + `AUTO_INCREMENT` bigint(21) default NULL, + `CREATE_TIME` datetime default NULL, + `UPDATE_TIME` datetime default NULL, + `CHECK_TIME` datetime default NULL, + `TABLE_COLLATION` varchar(64) default NULL, + `CHECKSUM` bigint(21) default NULL, + `CREATE_OPTIONS` varchar(255) default NULL, + `TABLE_COMMENT` varchar(80) NOT NULL default '' +) ENGINE=MEMORY DEFAULT CHARSET=utf8 +SHOW COLUMNS FROM information_schema.TABLES; +Field Type Null Key Default Extra +TABLE_CATALOG varchar(512) YES NULL +TABLE_SCHEMA varchar(64) NO +TABLE_NAME varchar(64) NO +TABLE_TYPE varchar(64) NO +ENGINE varchar(64) YES NULL +VERSION bigint(21) YES NULL +ROW_FORMAT varchar(10) YES NULL +TABLE_ROWS bigint(21) YES NULL +AVG_ROW_LENGTH bigint(21) YES NULL +DATA_LENGTH bigint(21) YES NULL +MAX_DATA_LENGTH bigint(21) YES NULL +INDEX_LENGTH bigint(21) YES NULL +DATA_FREE bigint(21) YES NULL +AUTO_INCREMENT bigint(21) YES NULL +CREATE_TIME datetime YES NULL +UPDATE_TIME datetime YES NULL +CHECK_TIME datetime YES NULL +TABLE_COLLATION varchar(64) YES NULL +CHECKSUM bigint(21) YES NULL +CREATE_OPTIONS varchar(255) YES NULL +TABLE_COMMENT varchar(80) NO +SELECT table_catalog, table_schema, table_name +FROM information_schema.tables WHERE table_catalog IS NOT NULL; +table_catalog table_schema table_name +################################################################################ +# Testcase 3.2.12.2 + 3.2.12.3: INFORMATION_SCHEMA.TABLES accessible information +################################################################################ +DROP DATABASE IF EXISTS db_datadict; +CREATE DATABASE db_datadict; +DROP USER 'testuser1'@'localhost'; +CREATE USER 'testuser1'@'localhost'; +GRANT CREATE, CREATE VIEW, INSERT, SELECT ON db_datadict.* +TO 'testuser1'@'localhost' WITH GRANT OPTION; +DROP USER 'testuser2'@'localhost'; +CREATE USER 'testuser2'@'localhost'; +DROP USER 'testuser3'@'localhost'; +CREATE USER 'testuser3'@'localhost'; +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; +# Establish connection testuser1 (user=testuser1) +CREATE TABLE tb2 (f1 DECIMAL) +ENGINE = <engine_type>; +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'; +SELECT * FROM information_schema.tables +WHERE table_schema = 'db_datadict' ORDER BY table_name; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT +NULL db_datadict tb1 BASE TABLE #ENG# 10 #RF# 0 #ARL# #DL# #MDL# #IL# #DF# NULL #CRT #UT# #CT# latin1_swedish_ci #CS# +NULL db_datadict tb2 BASE TABLE #ENG# 10 #RF# 0 #ARL# #DL# #MDL# #IL# #DF# NULL #CRT #UT# #CT# latin1_swedish_ci #CS# +NULL db_datadict tb3 BASE TABLE #ENG# 10 #RF# 0 #ARL# #DL# #MDL# #IL# #DF# NULL #CRT #UT# #CT# latin1_swedish_ci #CS# +NULL db_datadict v3 VIEW #ENG# NULL #RF# NULL #ARL# #DL# #MDL# #IL# #DF# NULL #CRT #UT# #CT# NULL #CS# NULL VIEW +SHOW TABLES FROM db_datadict; +Tables_in_db_datadict +tb1 +tb2 +tb3 +v3 +# Establish connection testuser2 (user=testuser2) +SELECT * FROM information_schema.tables +WHERE table_schema = 'db_datadict' ORDER BY table_name; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT +NULL db_datadict tb1 BASE TABLE #ENG# 10 #RF# 0 #ARL# #DL# #MDL# #IL# #DF# NULL #CRT #UT# #CT# latin1_swedish_ci #CS# +NULL db_datadict tb2 BASE TABLE #ENG# 10 #RF# 0 #ARL# #DL# #MDL# #IL# #DF# NULL #CRT #UT# #CT# latin1_swedish_ci #CS# +NULL db_datadict tb3 BASE TABLE #ENG# 10 #RF# 0 #ARL# #DL# #MDL# #IL# #DF# NULL #CRT #UT# #CT# latin1_swedish_ci #CS# +NULL db_datadict v3 VIEW #ENG# NULL #RF# NULL #ARL# #DL# #MDL# #IL# #DF# NULL #CRT #UT# #CT# NULL #CS# NULL VIEW +SHOW TABLES FROM db_datadict; +Tables_in_db_datadict +tb1 +tb2 +tb3 +v3 +# Establish connection testuser3 (user=testuser3) +SELECT * FROM information_schema.tables +WHERE table_schema = 'db_datadict' ORDER BY table_name; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT +NULL db_datadict tb1 BASE TABLE #ENG# 10 #RF# 0 #ARL# #DL# #MDL# #IL# #DF# NULL #CRT #UT# #CT# latin1_swedish_ci #CS# +NULL db_datadict tb2 BASE TABLE #ENG# 10 #RF# 0 #ARL# #DL# #MDL# #IL# #DF# NULL #CRT #UT# #CT# latin1_swedish_ci #CS# +NULL db_datadict tb3 BASE TABLE #ENG# 10 #RF# 0 #ARL# #DL# #MDL# #IL# #DF# NULL #CRT #UT# #CT# latin1_swedish_ci #CS# +NULL db_datadict v3 VIEW #ENG# NULL #RF# NULL #ARL# #DL# #MDL# #IL# #DF# NULL #CRT #UT# #CT# NULL #CS# NULL VIEW +SHOW TABLES FROM db_datadict; +Tables_in_db_datadict +tb1 +tb2 +tb3 +v3 +# Switch to connection default (user=root) +SELECT * FROM information_schema.tables +WHERE table_schema = 'db_datadict' ORDER BY table_name; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT +NULL db_datadict tb1 BASE TABLE #ENG# 10 #RF# 0 #ARL# #DL# #MDL# #IL# #DF# NULL #CRT #UT# #CT# latin1_swedish_ci #CS# +NULL db_datadict tb2 BASE TABLE #ENG# 10 #RF# 0 #ARL# #DL# #MDL# #IL# #DF# NULL #CRT #UT# #CT# latin1_swedish_ci #CS# +NULL db_datadict tb3 BASE TABLE #ENG# 10 #RF# 0 #ARL# #DL# #MDL# #IL# #DF# NULL #CRT #UT# #CT# latin1_swedish_ci #CS# +NULL db_datadict v3 VIEW #ENG# NULL #RF# NULL #ARL# #DL# #MDL# #IL# #DF# NULL #CRT #UT# #CT# NULL #CS# NULL VIEW +SHOW TABLES FROM db_datadict; +Tables_in_db_datadict +tb1 +tb2 +tb3 +v3 +# Close connection testuser1, testuser2, testuser3 +DROP USER 'testuser1'@'localhost'; +DROP USER 'testuser2'@'localhost'; +DROP USER 'testuser3'@'localhost'; +DROP DATABASE db_datadict; +######################################################################### +# 3.2.1.13+3.2.1.14+3.2.1.15: INFORMATION_SCHEMA.TABLES modifications +######################################################################### +DROP TABLE IF EXISTS test.t1_my_table; +DROP DATABASE IF EXISTS db_datadict; +CREATE DATABASE db_datadict; +SELECT table_name FROM information_schema.tables +WHERE table_name LIKE 't1_my_table%'; +table_name +CREATE TABLE test.t1_my_table (f1 BIGINT) +DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci +COMMENT = 'Initial Comment' ENGINE = <engine_type>; +SELECT * FROM information_schema.tables +WHERE table_name = 't1_my_table'; +TABLE_CATALOG NULL +TABLE_SCHEMA test +TABLE_NAME t1_my_table +TABLE_TYPE BASE TABLE +ENGINE #ENG# +VERSION 10 +ROW_FORMAT #RF# +TABLE_ROWS 0 +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION latin1_swedish_ci +CHECKSUM #CS# +CREATE_OPTIONS +TABLE_COMMENT Initial Comment +SELECT table_name FROM information_schema.tables +WHERE table_name LIKE 't1_my_table%'; +table_name +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%'; +table_name +t1_my_tablex +SELECT table_schema,table_name FROM information_schema.tables +WHERE table_name = 't1_my_tablex'; +table_schema table_name +test 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'; +table_schema table_name +db_datadict t1_my_tablex +SELECT table_name, engine FROM information_schema.tables +WHERE table_name = 't1_my_tablex'; +table_name engine +t1_my_tablex <engine_type> +ALTER TABLE db_datadict.t1_my_tablex +ENGINE = <other_engine_type>; +SELECT table_name, engine FROM information_schema.tables +WHERE table_name = 't1_my_tablex'; +table_name engine +t1_my_tablex <other_engine_type> +SELECT table_name, table_rows FROM information_schema.tables +WHERE table_name = 't1_my_tablex'; +table_name table_rows +t1_my_tablex 0 +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'; +table_name table_rows +t1_my_tablex 2 +SELECT table_name, table_collation FROM information_schema.tables +WHERE table_name = 't1_my_tablex'; +table_name table_collation +t1_my_tablex latin1_swedish_ci +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'; +table_name table_collation +t1_my_tablex utf8_general_ci +SELECT table_name, table_collation FROM information_schema.tables +WHERE table_name = 't1_my_tablex'; +table_name table_collation +t1_my_tablex utf8_general_ci +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'; +table_name table_collation +t1_my_tablex latin1_german1_ci +SELECT table_name, TABLE_COMMENT FROM information_schema.tables +WHERE table_name = 't1_my_tablex'; +table_name TABLE_COMMENT +t1_my_tablex Initial Comment +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'; +table_name TABLE_COMMENT +t1_my_tablex Changed Comment +SELECT table_name, AUTO_INCREMENT FROM information_schema.tables +WHERE table_name = 't1_my_tablex'; +table_name AUTO_INCREMENT +t1_my_tablex NULL +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'; +table_name AUTO_INCREMENT +t1_my_tablex 3 +SELECT table_name, ROW_FORMAT FROM information_schema.tables +WHERE table_name = 't1_my_tablex'; +table_name ROW_FORMAT +t1_my_tablex Fixed +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'; +table_name ROW_FORMAT +t1_my_tablex Dynamic +SELECT table_name, checksum FROM information_schema.tables +WHERE table_name = 't1_my_tablex'; +table_name checksum +t1_my_tablex NULL +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'; +table_name checksum IS NOT NULL +t1_my_tablex 1 +SELECT UPDATE_TIME, checksum INTO @UPDATE_TIME, @checksum +FROM information_schema.tables +WHERE table_name = 't1_my_tablex'; +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'; +Is current UPDATE_TIME bigger than before last INSERT? +1 +SELECT checksum <> @checksum +AS "Is current CHECKSUM different than before last INSERT?" +FROM information_schema.tables +WHERE table_name = 't1_my_tablex'; +Is current CHECKSUM different than before last INSERT? +1 +SELECT CREATE_TIME INTO @CREATE_TIME FROM information_schema.tables +WHERE table_name = 't1_my_tablex'; +SELECT table_name FROM information_schema.tables +WHERE table_name LIKE 't1_my_table%'; +table_name +t1_my_tablex +DROP TABLE db_datadict.t1_my_tablex; +SELECT table_name FROM information_schema.tables +WHERE table_name LIKE 't1_my_table%'; +table_name +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'; +Is current CREATE_TIME bigger than for the old dropped table? +1 +DROP TABLE test.t1_my_tablex; +CREATE VIEW test.t1_my_tablex AS SELECT 1; +SELECT * FROM information_schema.tables +WHERE table_name = 't1_my_tablex'; +TABLE_CATALOG NULL +TABLE_SCHEMA test +TABLE_NAME t1_my_tablex +TABLE_TYPE VIEW +ENGINE NULL +VERSION NULL +ROW_FORMAT NULL +TABLE_ROWS NULL +AVG_ROW_LENGTH NULL +DATA_LENGTH NULL +MAX_DATA_LENGTH NULL +INDEX_LENGTH NULL +DATA_FREE NULL +AUTO_INCREMENT NULL +CREATE_TIME NULL +UPDATE_TIME NULL +CHECK_TIME NULL +TABLE_COLLATION NULL +CHECKSUM NULL +CREATE_OPTIONS NULL +TABLE_COMMENT VIEW +DROP VIEW test.t1_my_tablex; +SELECT table_name FROM information_schema.tables +WHERE table_name = 't1_my_tablex'; +table_name +CREATE TEMPORARY TABLE test.t1_my_tablex +ENGINE = <other_engine_type> +AS SELECT 1; +SELECT table_name, table_type FROM information_schema.tables +WHERE table_name = 't1_my_tablex'; +DROP TEMPORARY TABLE test.t1_my_tablex; +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'; +table_name +t1_my_tablex +DROP DATABASE db_datadict; +SELECT table_name FROM information_schema.tables +WHERE table_name = 't1_my_tablex'; +table_name +######################################################################## +# Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and +# DDL on INFORMATION_SCHEMA tables are not supported +######################################################################## +DROP DATABASE IF EXISTS db_datadict; +CREATE DATABASE db_datadict; +CREATE TABLE db_datadict.t1 (f1 BIGINT) +ENGINE = <engine_type>; +INSERT INTO information_schema.tables +SELECT * FROM information_schema.tables; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +UPDATE information_schema.tables SET table_schema = 'test' +WHERE table_name = 't1'; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +DELETE FROM information_schema.tables WHERE table_name = 't1'; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +TRUNCATE information_schema.tables; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +CREATE INDEX my_idx_on_tables ON information_schema.tables(table_schema); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +ALTER TABLE information_schema.tables DROP PRIMARY KEY; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +ALTER TABLE information_schema.tables ADD f1 INT; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +DROP TABLE information_schema.tables; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +ALTER TABLE information_schema.tables RENAME db_datadict.tables; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +ALTER TABLE information_schema.tables RENAME information_schema.xtables; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +DROP DATABASE db_datadict; diff --git a/mysql-test/suite/funcs_1/r/is_tables_innodb.result b/mysql-test/suite/funcs_1/r/is_tables_innodb.result index c160ac7f749..f2d2e0a912a 100644 --- a/mysql-test/suite/funcs_1/r/is_tables_innodb.result +++ b/mysql-test/suite/funcs_1/r/is_tables_innodb.result @@ -1,375 +1,10 @@ DROP DATABASE IF EXISTS test1; +DROP DATABASE IF EXISTS test2; CREATE DATABASE test1; -USE test; -drop table if exists tb1 ; -create table tb1 ( -f1 char(0), -f2 char(0) binary, -f3 char(0) ascii, -f4 tinytext unicode, -f5 text, -f6 mediumtext, -f7 longtext, -f8 tinyblob, -f9 blob, -f10 mediumblob, -f11 longblob, -f12 binary, -f13 tinyint, -f14 tinyint unsigned, -f15 tinyint zerofill, -f16 tinyint unsigned zerofill, -f17 smallint, -f18 smallint unsigned, -f19 smallint zerofill, -f20 smallint unsigned zerofill, -f21 mediumint, -f22 mediumint unsigned, -f23 mediumint zerofill, -f24 mediumint unsigned zerofill, -f25 int, -f26 int unsigned, -f27 int zerofill, -f28 int unsigned zerofill, -f29 bigint, -f30 bigint unsigned, -f31 bigint zerofill, -f32 bigint unsigned zerofill, -f33 decimal, -f34 decimal unsigned, -f35 decimal zerofill, -f36 decimal unsigned zerofill not null DEFAULT 9.9, -f37 decimal (0) not null DEFAULT 9.9, -f38 decimal (64) not null DEFAULT 9.9, -f39 decimal (0) unsigned not null DEFAULT 9.9, -f40 decimal (64) unsigned not null DEFAULT 9.9, -f41 decimal (0) zerofill not null DEFAULT 9.9, -f42 decimal (64) zerofill not null DEFAULT 9.9, -f43 decimal (0) unsigned zerofill not null DEFAULT 9.9, -f44 decimal (64) unsigned zerofill not null DEFAULT 9.9, -f45 decimal (0,0) not null DEFAULT 9.9, -f46 decimal (63,30) not null DEFAULT 9.9, -f47 decimal (0,0) unsigned not null DEFAULT 9.9, -f48 decimal (63,30) unsigned not null DEFAULT 9.9, -f49 decimal (0,0) zerofill not null DEFAULT 9.9, -f50 decimal (63,30) zerofill not null DEFAULT 9.9, -f51 decimal (0,0) unsigned zerofill not null DEFAULT 9.9, -f52 decimal (63,30) unsigned zerofill not null DEFAULT 9.9, -f53 numeric not null DEFAULT 99, -f54 numeric unsigned not null DEFAULT 99, -f55 numeric zerofill not null DEFAULT 99, -f56 numeric unsigned zerofill not null DEFAULT 99, -f57 numeric (0) not null DEFAULT 99, -f58 numeric (64) not null DEFAULT 99 -) engine = innodb; -Warnings: -Note 1265 Data truncated for column 'f36' at row 1 -Note 1265 Data truncated for column 'f37' at row 1 -Note 1265 Data truncated for column 'f38' at row 1 -Note 1265 Data truncated for column 'f39' at row 1 -Note 1265 Data truncated for column 'f40' at row 1 -Note 1265 Data truncated for column 'f41' at row 1 -Note 1265 Data truncated for column 'f42' at row 1 -Note 1265 Data truncated for column 'f43' at row 1 -Note 1265 Data truncated for column 'f44' at row 1 -Note 1265 Data truncated for column 'f45' at row 1 -Note 1265 Data truncated for column 'f47' at row 1 -Note 1265 Data truncated for column 'f49' at row 1 -Note 1265 Data truncated for column 'f51' at row 1 -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/innodb_tb1.txt' into table tb1 ; -drop table if exists tb2 ; -create table tb2 ( -f59 numeric (0) unsigned, -f60 numeric (64) unsigned, -f61 numeric (0) zerofill, -f62 numeric (64) zerofill, -f63 numeric (0) unsigned zerofill, -f64 numeric (64) unsigned zerofill, -f65 numeric (0,0), -f66 numeric (63,30), -f67 numeric (0,0) unsigned, -f68 numeric (63,30) unsigned, -f69 numeric (0,0) zerofill, -f70 numeric (63,30) zerofill, -f71 numeric (0,0) unsigned zerofill, -f72 numeric (63,30) unsigned zerofill, -f73 real, -f74 real unsigned, -f75 real zerofill, -f76 real unsigned zerofill, -f77 double default 7.7, -f78 double unsigned default 7.7, -f79 double zerofill default 7.7, -f80 double unsigned zerofill default 8.8, -f81 float not null default 8.8, -f82 float unsigned not null default 8.8, -f83 float zerofill not null default 8.8, -f84 float unsigned zerofill not null default 8.8, -f85 float(0) not null default 8.8, -f86 float(23) not null default 8.8, -f87 float(0) unsigned not null default 8.8, -f88 float(23) unsigned not null default 8.8, -f89 float(0) zerofill not null default 8.8, -f90 float(23) zerofill not null default 8.8, -f91 float(0) unsigned zerofill not null default 8.8, -f92 float(23) unsigned zerofill not null default 8.8, -f93 float(24) not null default 8.8, -f94 float(53) not null default 8.8, -f95 float(24) unsigned not null default 8.8, -f96 float(53) unsigned not null default 8.8, -f97 float(24) zerofill not null default 8.8, -f98 float(53) zerofill not null default 8.8, -f99 float(24) unsigned zerofill not null default 8.8, -f100 float(53) unsigned zerofill not null default 8.8, -f101 date not null default '2000-01-01', -f102 time not null default 20, -f103 datetime not null default '2/2/2', -f104 timestamp not null default 20001231235959, -f105 year not null default 2000, -f106 year(3) not null default 2000, -f107 year(4) not null default 2000, -f108 enum("1enum","2enum") not null default "1enum", -f109 set("1set","2set") not null default "1set" -) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/innodb_tb2.txt' into table tb2 ; -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 'MYSQL_TEST_DIR/suite/funcs_1/data/innodb_tb3.txt' into table tb3 ; -drop table if exists tb4; -create table tb4 ( -f176 numeric (0) unsigned not null DEFAULT 9, -f177 numeric (64) unsigned not null DEFAULT 9, -f178 numeric (0) zerofill not null DEFAULT 9, -f179 numeric (64) zerofill not null DEFAULT 9, -f180 numeric (0) unsigned zerofill not null DEFAULT 9, -f181 numeric (64) unsigned zerofill not null DEFAULT 9, -f182 numeric (0,0) not null DEFAULT 9, -f183 numeric (63,30) not null DEFAULT 9, -f184 numeric (0,0) unsigned not null DEFAULT 9, -f185 numeric (63,30) unsigned not null DEFAULT 9, -f186 numeric (0,0) zerofill not null DEFAULT 9, -f187 numeric (63,30) zerofill not null DEFAULT 9, -f188 numeric (0,0) unsigned zerofill not null DEFAULT 9, -f189 numeric (63,30) unsigned zerofill not null DEFAULT 9, -f190 real not null DEFAULT 88.8, -f191 real unsigned not null DEFAULT 88.8, -f192 real zerofill not null DEFAULT 88.8, -f193 real unsigned zerofill not null DEFAULT 88.8, -f194 double not null DEFAULT 55.5, -f195 double unsigned not null DEFAULT 55.5, -f196 double zerofill not null DEFAULT 55.5, -f197 double unsigned zerofill not null DEFAULT 55.5, -f198 float, -f199 float unsigned, -f200 float zerofill, -f201 float unsigned zerofill, -f202 float(0), -f203 float(23), -f204 float(0) unsigned, -f205 float(23) unsigned, -f206 float(0) zerofill, -f207 float(23) zerofill, -f208 float(0) unsigned zerofill, -f209 float(23) unsigned zerofill, -f210 float(24), -f211 float(53), -f212 float(24) unsigned, -f213 float(53) unsigned, -f214 float(24) zerofill, -f215 float(53) zerofill, -f216 float(24) unsigned zerofill, -f217 float(53) unsigned zerofill, -f218 date, -f219 time, -f220 datetime, -f221 timestamp, -f222 year, -f223 year(3), -f224 year(4), -f225 enum("1enum","2enum"), -f226 set("1set","2set"), -f235 char(0) unicode, -f236 char(90), -f237 char(255) ascii, -f238 varchar(0), -f239 varchar(20000) binary, -f240 varchar(2000) unicode, -f241 char(100) unicode -) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/innodb_tb4.txt' into table tb4 ; -USE test1; -drop table if exists tb2 ; -create table tb2 ( -f59 numeric (0) unsigned, -f60 numeric (64) unsigned, -f61 numeric (0) zerofill, -f62 numeric (64) zerofill, -f63 numeric (0) unsigned zerofill, -f64 numeric (64) unsigned zerofill, -f65 numeric (0,0), -f66 numeric (63,30), -f67 numeric (0,0) unsigned, -f68 numeric (63,30) unsigned, -f69 numeric (0,0) zerofill, -f70 numeric (63,30) zerofill, -f71 numeric (0,0) unsigned zerofill, -f72 numeric (63,30) unsigned zerofill, -f73 real, -f74 real unsigned, -f75 real zerofill, -f76 real unsigned zerofill, -f77 double default 7.7, -f78 double unsigned default 7.7, -f79 double zerofill default 7.7, -f80 double unsigned zerofill default 8.8, -f81 float not null default 8.8, -f82 float unsigned not null default 8.8, -f83 float zerofill not null default 8.8, -f84 float unsigned zerofill not null default 8.8, -f85 float(0) not null default 8.8, -f86 float(23) not null default 8.8, -f87 float(0) unsigned not null default 8.8, -f88 float(23) unsigned not null default 8.8, -f89 float(0) zerofill not null default 8.8, -f90 float(23) zerofill not null default 8.8, -f91 float(0) unsigned zerofill not null default 8.8, -f92 float(23) unsigned zerofill not null default 8.8, -f93 float(24) not null default 8.8, -f94 float(53) not null default 8.8, -f95 float(24) unsigned not null default 8.8, -f96 float(53) unsigned not null default 8.8, -f97 float(24) zerofill not null default 8.8, -f98 float(53) zerofill not null default 8.8, -f99 float(24) unsigned zerofill not null default 8.8, -f100 float(53) unsigned zerofill not null default 8.8, -f101 date not null default '2000-01-01', -f102 time not null default 20, -f103 datetime not null default '2/2/2', -f104 timestamp not null default 20001231235959, -f105 year not null default 2000, -f106 year(3) not null default 2000, -f107 year(4) not null default 2000, -f108 enum("1enum","2enum") not null default "1enum", -f109 set("1set","2set") not null default "1set" -) engine = innodb; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/innodb_tb2.txt' into table tb2 ; -USE test; -USE test; -DROP TABLE IF EXISTS t1, t2, t4, t10, t11; -CREATE TABLE t1 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = InnoDB; -CREATE TABLE t2 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = InnoDB; -CREATE TABLE t4 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = InnoDB; -CREATE TABLE t10 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = InnoDB; -CREATE TABLE t11 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = InnoDB; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t1; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t2; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t4; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t10; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t11; -drop TABLE if exists t3; -CREATE TABLE t3 (f1 char(20), f2 char(20), f3 integer) ENGINE = InnoDB; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t3.txt' INTO TABLE t3; -drop database if exists test4; -CREATE database test4; -use test4; -CREATE TABLE t6 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = InnoDB; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t6; -use test; -drop TABLE if exists t7, t8; -CREATE TABLE t7 (f1 char(20), f2 char(25), f3 date, f4 int) ENGINE = InnoDB; -CREATE TABLE t8 (f1 char(20), f2 char(25), f3 date, f4 int) ENGINE = InnoDB; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' INTO TABLE t7; -Warnings: -Warning 1265 Data truncated for column 'f3' at row 1 -Warning 1265 Data truncated for column 'f3' at row 2 -Warning 1265 Data truncated for column 'f3' at row 3 -Warning 1265 Data truncated for column 'f3' at row 4 -Warning 1265 Data truncated for column 'f3' at row 5 -Warning 1265 Data truncated for column 'f3' at row 6 -Warning 1265 Data truncated for column 'f3' at row 7 -Warning 1265 Data truncated for column 'f3' at row 8 -Warning 1265 Data truncated for column 'f3' at row 9 -Warning 1265 Data truncated for column 'f3' at row 10 -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' INTO TABLE t8; -Warnings: -Warning 1265 Data truncated for column 'f3' at row 1 -Warning 1265 Data truncated for column 'f3' at row 2 -Warning 1265 Data truncated for column 'f3' at row 3 -Warning 1265 Data truncated for column 'f3' at row 4 -Warning 1265 Data truncated for column 'f3' at row 5 -Warning 1265 Data truncated for column 'f3' at row 6 -Warning 1265 Data truncated for column 'f3' at row 7 -Warning 1265 Data truncated for column 'f3' at row 8 -Warning 1265 Data truncated for column 'f3' at row 9 -Warning 1265 Data truncated for column 'f3' at row 10 -drop TABLE if exists t9; -CREATE TABLE t9 (f1 int, f2 char(25), f3 int) ENGINE = InnoDB; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' INTO TABLE t9; -DROP DATABASE IF EXISTS db_datadict; -CREATE DATABASE db_datadict; +CREATE DATABASE test2; +CREATE TABLE test1.t1 (f1 VARCHAR(20)) ENGINE = <engine_to_be_used>; +CREATE TABLE test1.t2 (f1 VARCHAR(20)) ENGINE = <engine_to_be_used>; +CREATE TABLE test2.t1 (f1 VARCHAR(20)) ENGINE = <engine_to_be_used>; SELECT *, LEFT( table_comment, IF(INSTR(table_comment,'InnoDB free') = 0 @@ -383,7 +18,7 @@ FROM information_schema.tables WHERE table_schema LIKE 'test%' AND table_type = 'BASE TABLE' ORDER BY table_schema,table_name; TABLE_CATALOG NULL -TABLE_SCHEMA test +TABLE_SCHEMA test1 TABLE_NAME t1 TABLE_TYPE BASE TABLE ENGINE InnoDB @@ -406,284 +41,8 @@ TABLE_COMMENT #TC# user_comment Separator ----------------------------------------------------- TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t10 -TABLE_TYPE BASE TABLE -ENGINE InnoDB -VERSION 10 -ROW_FORMAT Compact -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t11 -TABLE_TYPE BASE TABLE -ENGINE InnoDB -VERSION 10 -ROW_FORMAT Compact -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t2 -TABLE_TYPE BASE TABLE -ENGINE InnoDB -VERSION 10 -ROW_FORMAT Compact -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t3 -TABLE_TYPE BASE TABLE -ENGINE InnoDB -VERSION 10 -ROW_FORMAT Compact -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t4 -TABLE_TYPE BASE TABLE -ENGINE InnoDB -VERSION 10 -ROW_FORMAT Compact -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t7 -TABLE_TYPE BASE TABLE -ENGINE InnoDB -VERSION 10 -ROW_FORMAT Compact -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t8 -TABLE_TYPE BASE TABLE -ENGINE InnoDB -VERSION 10 -ROW_FORMAT Compact -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t9 -TABLE_TYPE BASE TABLE -ENGINE InnoDB -VERSION 10 -ROW_FORMAT Compact -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME tb1 -TABLE_TYPE BASE TABLE -ENGINE InnoDB -VERSION 10 -ROW_FORMAT Compact -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME tb2 -TABLE_TYPE BASE TABLE -ENGINE InnoDB -VERSION 10 -ROW_FORMAT Compact -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME tb3 -TABLE_TYPE BASE TABLE -ENGINE InnoDB -VERSION 10 -ROW_FORMAT Compact -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME tb4 -TABLE_TYPE BASE TABLE -ENGINE InnoDB -VERSION 10 -ROW_FORMAT Compact -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL TABLE_SCHEMA test1 -TABLE_NAME tb2 +TABLE_NAME t2 TABLE_TYPE BASE TABLE ENGINE InnoDB VERSION 10 @@ -705,8 +64,8 @@ TABLE_COMMENT #TC# user_comment Separator ----------------------------------------------------- TABLE_CATALOG NULL -TABLE_SCHEMA test4 -TABLE_NAME t6 +TABLE_SCHEMA test2 +TABLE_NAME t1 TABLE_TYPE BASE TABLE ENGINE InnoDB VERSION 10 @@ -727,9 +86,16 @@ CREATE_OPTIONS #CO# TABLE_COMMENT #TC# user_comment Separator ----------------------------------------------------- +SHOW TABLES FROM test1; +Tables_in_test1 +t1 +t2 +SHOW TABLES FROM test2; +Tables_in_test2 +t1 DROP USER testuser1@localhost; CREATE USER testuser1@localhost; -GRANT SELECT ON db_datadict.* TO testuser1@localhost; +GRANT SELECT ON test1.* TO testuser1@localhost; # Establish connection testuser1 (user=testuser1) SELECT *, LEFT( table_comment, @@ -744,7 +110,7 @@ FROM information_schema.tables WHERE table_schema LIKE 'test%' AND table_type = 'BASE TABLE' ORDER BY table_schema,table_name; TABLE_CATALOG NULL -TABLE_SCHEMA test +TABLE_SCHEMA test1 TABLE_NAME t1 TABLE_TYPE BASE TABLE ENGINE InnoDB @@ -767,53 +133,7 @@ TABLE_COMMENT #TC# user_comment Separator ----------------------------------------------------- TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t10 -TABLE_TYPE BASE TABLE -ENGINE InnoDB -VERSION 10 -ROW_FORMAT Compact -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t11 -TABLE_TYPE BASE TABLE -ENGINE InnoDB -VERSION 10 -ROW_FORMAT Compact -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test +TABLE_SCHEMA test1 TABLE_NAME t2 TABLE_TYPE BASE TABLE ENGINE InnoDB @@ -835,228 +155,13 @@ CREATE_OPTIONS #CO# TABLE_COMMENT #TC# user_comment Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t3 -TABLE_TYPE BASE TABLE -ENGINE InnoDB -VERSION 10 -ROW_FORMAT Compact -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t4 -TABLE_TYPE BASE TABLE -ENGINE InnoDB -VERSION 10 -ROW_FORMAT Compact -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t7 -TABLE_TYPE BASE TABLE -ENGINE InnoDB -VERSION 10 -ROW_FORMAT Compact -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t8 -TABLE_TYPE BASE TABLE -ENGINE InnoDB -VERSION 10 -ROW_FORMAT Compact -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t9 -TABLE_TYPE BASE TABLE -ENGINE InnoDB -VERSION 10 -ROW_FORMAT Compact -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME tb1 -TABLE_TYPE BASE TABLE -ENGINE InnoDB -VERSION 10 -ROW_FORMAT Compact -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME tb2 -TABLE_TYPE BASE TABLE -ENGINE InnoDB -VERSION 10 -ROW_FORMAT Compact -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME tb3 -TABLE_TYPE BASE TABLE -ENGINE InnoDB -VERSION 10 -ROW_FORMAT Compact -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME tb4 -TABLE_TYPE BASE TABLE -ENGINE InnoDB -VERSION 10 -ROW_FORMAT Compact -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- +SHOW TABLES FROM test1; +Tables_in_test1 +t1 +t2 +SHOW TABLES FROM test2; +ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'test2' # Switch to connection default and close connection testuser1 DROP USER testuser1@localhost; -DROP DATABASE db_datadict; DROP DATABASE test1; -DROP DATABASE test4; -DROP TABLE test.t1; -DROP TABLE test.t2; -DROP TABLE test.t3; -DROP TABLE test.t4; -DROP TABLE test.t7; -DROP TABLE test.t8; -DROP TABLE test.t9; -DROP TABLE test.t10; -DROP TABLE test.t11; -DROP TABLE test.tb1; -DROP TABLE test.tb2; -DROP TABLE test.tb3; -DROP TABLE test.tb4; +DROP DATABASE test2; diff --git a/mysql-test/suite/funcs_1/r/is_tables_is.result b/mysql-test/suite/funcs_1/r/is_tables_is.result index 78193155e22..e651047e540 100644 --- a/mysql-test/suite/funcs_1/r/is_tables_is.result +++ b/mysql-test/suite/funcs_1/r/is_tables_is.result @@ -1,5 +1,5 @@ -DROP DATABASE IF EXISTS db_datadict; -CREATE DATABASE db_datadict; +DROP DATABASE IF EXISTS test1; +CREATE DATABASE test1; SELECT *, LEFT( table_comment, IF(INSTR(table_comment,'InnoDB free') = 0 @@ -383,7 +383,7 @@ user_comment Separator ----------------------------------------------------- DROP USER testuser1@localhost; CREATE USER testuser1@localhost; -GRANT SELECT ON db_datadict.* TO testuser1@localhost; +GRANT SELECT ON test1.* TO testuser1@localhost; # Establish connection testuser1 (user=testuser1) SELECT *, LEFT( table_comment, @@ -768,4 +768,4 @@ user_comment Separator ----------------------------------------------------- # Switch to connection default and close connection testuser1 DROP USER testuser1@localhost; -DROP DATABASE db_datadict; +DROP DATABASE test1; diff --git a/mysql-test/suite/funcs_1/r/is_tables_memory.result b/mysql-test/suite/funcs_1/r/is_tables_memory.result index c1dfc42e1db..561bf6e569f 100644 --- a/mysql-test/suite/funcs_1/r/is_tables_memory.result +++ b/mysql-test/suite/funcs_1/r/is_tables_memory.result @@ -1,364 +1,11 @@ SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION'; DROP DATABASE IF EXISTS test1; +DROP DATABASE IF EXISTS test2; CREATE DATABASE test1; -USE test; -drop table if exists tb1 ; -create table tb1 ( -f1 char, -f2 char binary, -f3 char ascii, -f12 binary, -f13 tinyint, -f14 tinyint unsigned, -f15 tinyint zerofill, -f16 tinyint unsigned zerofill, -f17 smallint, -f18 smallint unsigned, -f19 smallint zerofill, -f20 smallint unsigned zerofill, -f21 mediumint, -f22 mediumint unsigned, -f23 mediumint zerofill, -f24 mediumint unsigned zerofill, -f25 int, -f26 int unsigned, -f27 int zerofill, -f28 int unsigned zerofill, -f29 bigint, -f30 bigint unsigned, -f31 bigint zerofill, -f32 bigint unsigned zerofill, -f33 decimal not null DEFAULT 9.9, -f34 decimal unsigned not null DEFAULT 9.9, -f35 decimal zerofill not null DEFAULT 9.9, -f36 decimal unsigned zerofill not null DEFAULT 9.9, -f37 decimal (0) not null DEFAULT 9.9, -f38 decimal (64) not null DEFAULT 9.9, -f39 decimal (0) unsigned not null DEFAULT 9.9, -f40 decimal (64) unsigned not null DEFAULT 9.9, -f41 decimal (0) zerofill not null DEFAULT 9.9, -f42 decimal (64) zerofill not null DEFAULT 9.9, -f43 decimal (0) unsigned zerofill not null DEFAULT 9.9, -f44 decimal (64) unsigned zerofill not null DEFAULT 9.9, -f45 decimal (0,0) not null DEFAULT 9.9, -f46 decimal (63,30) not null DEFAULT 9.9, -f47 decimal (0,0) unsigned not null DEFAULT 9.9, -f48 decimal (63,30) unsigned not null DEFAULT 9.9, -f49 decimal (0,0) zerofill not null DEFAULT 9.9, -f50 decimal (63,30) zerofill not null DEFAULT 9.9, -f51 decimal (0,0) unsigned zerofill not null DEFAULT 9.9, -f52 decimal (63,30) unsigned zerofill not null DEFAULT 9.9, -f53 numeric not null DEFAULT 99, -f54 numeric unsigned not null DEFAULT 99, -f55 numeric zerofill not null DEFAULT 99, -f56 numeric unsigned zerofill not null DEFAULT 99, -f57 numeric (0) not null DEFAULT 99, -f58 numeric (64) not null DEFAULT 99 -) engine = memory; -Warnings: -Note 1265 Data truncated for column 'f33' at row 1 -Note 1265 Data truncated for column 'f34' at row 1 -Note 1265 Data truncated for column 'f35' at row 1 -Note 1265 Data truncated for column 'f36' at row 1 -Note 1265 Data truncated for column 'f37' at row 1 -Note 1265 Data truncated for column 'f38' at row 1 -Note 1265 Data truncated for column 'f39' at row 1 -Note 1265 Data truncated for column 'f40' at row 1 -Note 1265 Data truncated for column 'f41' at row 1 -Note 1265 Data truncated for column 'f42' at row 1 -Note 1265 Data truncated for column 'f43' at row 1 -Note 1265 Data truncated for column 'f44' at row 1 -Note 1265 Data truncated for column 'f45' at row 1 -Note 1265 Data truncated for column 'f47' at row 1 -Note 1265 Data truncated for column 'f49' at row 1 -Note 1265 Data truncated for column 'f51' at row 1 -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/memory_tb1.txt' into table tb1 ; -drop table if exists tb2 ; -create table tb2 ( -f59 numeric (0) unsigned, -f60 numeric (64) unsigned, -f61 numeric (0) zerofill, -f62 numeric (64) zerofill, -f63 numeric (0) unsigned zerofill, -f64 numeric (64) unsigned zerofill, -f65 numeric (0,0), -f66 numeric (63,30), -f67 numeric (0,0) unsigned, -f68 numeric (63,30) unsigned, -f69 numeric (0,0) zerofill, -f70 numeric (63,30) zerofill, -f71 numeric (0,0) unsigned zerofill, -f72 numeric (63,30) unsigned zerofill, -f73 real, -f74 real unsigned, -f75 real zerofill, -f76 real unsigned zerofill, -f77 double default 7.7, -f78 double unsigned default 7.7, -f79 double zerofill default 7.7, -f80 double unsigned zerofill default 8.8, -f81 float not null default 8.8, -f82 float unsigned not null default 8.8, -f83 float zerofill not null default 8.8, -f84 float unsigned zerofill not null default 8.8, -f85 float(0) not null default 8.8, -f86 float(23) not null default 8.8, -f87 float(0) unsigned not null default 8.8, -f88 float(23) unsigned not null default 8.8, -f89 float(0) zerofill not null default 8.8, -f90 float(23) zerofill not null default 8.8, -f91 float(0) unsigned zerofill not null default 8.8, -f92 float(23) unsigned zerofill not null default 8.8, -f93 float(24) not null default 8.8, -f94 float(53) not null default 8.8, -f95 float(24) unsigned not null default 8.8, -f96 float(53) unsigned not null default 8.8, -f97 float(24) zerofill not null default 8.8, -f98 float(53) zerofill not null default 8.8, -f99 float(24) unsigned zerofill not null default 8.8, -f100 float(53) unsigned zerofill not null default 8.8, -f101 date not null default '2000-01-01', -f102 time not null default 20, -f103 datetime not null default '2/2/2', -f104 timestamp not null default 20001231235959, -f105 year not null default 2000, -f106 year(3) not null default 2000, -f107 year(4) not null default 2000, -f108 enum("1enum","2enum") not null default "1enum", -f109 set("1set","2set") not null default "1set" -) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/memory_tb2.txt' into table tb2 ; -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 char(50), -f122 char(50), -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 = memory; -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 'MYSQL_TEST_DIR/suite/funcs_1/data/memory_tb3.txt' into table tb3 ; -drop table if exists tb4 ; -create table tb4 ( -f176 numeric (0) unsigned not null DEFAULT 9, -f177 numeric (64) unsigned not null DEFAULT 9, -f178 numeric (0) zerofill not null DEFAULT 9, -f179 numeric (64) zerofill not null DEFAULT 9, -f180 numeric (0) unsigned zerofill not null DEFAULT 9, -f181 numeric (64) unsigned zerofill not null DEFAULT 9, -f182 numeric (0,0) not null DEFAULT 9, -f183 numeric (63,30) not null DEFAULT 9, -f184 numeric (0,0) unsigned not null DEFAULT 9, -f185 numeric (63,30) unsigned not null DEFAULT 9, -f186 numeric (0,0) zerofill not null DEFAULT 9, -f187 numeric (63,30) zerofill not null DEFAULT 9, -f188 numeric (0,0) unsigned zerofill not null DEFAULT 9, -f189 numeric (63,30) unsigned zerofill not null DEFAULT 9, -f190 real not null DEFAULT 88.8, -f191 real unsigned not null DEFAULT 88.8, -f192 real zerofill not null DEFAULT 88.8, -f193 real unsigned zerofill not null DEFAULT 88.8, -f194 double not null DEFAULT 55.5, -f195 double unsigned not null DEFAULT 55.5, -f196 double zerofill not null DEFAULT 55.5, -f197 double unsigned zerofill not null DEFAULT 55.5, -f198 float, -f199 float unsigned, -f200 float zerofill, -f201 float unsigned zerofill, -f202 float(0), -f203 float(23), -f204 float(0) unsigned, -f205 float(23) unsigned, -f206 float(0) zerofill, -f207 float(23) zerofill, -f208 float(0) unsigned zerofill, -f209 float(23) unsigned zerofill, -f210 float(24), -f211 float(53), -f212 float(24) unsigned, -f213 float(53) unsigned, -f214 float(24) zerofill, -f215 float(53) zerofill, -f216 float(24) unsigned zerofill, -f217 float(53) unsigned zerofill, -f218 date, -f219 time, -f220 datetime, -f221 timestamp, -f222 year, -f223 year(3), -f224 year(4), -f225 enum("1enum","2enum"), -f226 set("1set","2set"), -f236 char(95) unicode, -f241 char(255) unicode, -f237 char(130) binary, -f238 varchar(25000) binary, -f239 varbinary(0), -f240 varchar(1200) unicode -) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/memory_tb4.txt' into table tb4 ; -USE test1; -drop table if exists tb2 ; -create table tb2 ( -f59 numeric (0) unsigned, -f60 numeric (64) unsigned, -f61 numeric (0) zerofill, -f62 numeric (64) zerofill, -f63 numeric (0) unsigned zerofill, -f64 numeric (64) unsigned zerofill, -f65 numeric (0,0), -f66 numeric (63,30), -f67 numeric (0,0) unsigned, -f68 numeric (63,30) unsigned, -f69 numeric (0,0) zerofill, -f70 numeric (63,30) zerofill, -f71 numeric (0,0) unsigned zerofill, -f72 numeric (63,30) unsigned zerofill, -f73 real, -f74 real unsigned, -f75 real zerofill, -f76 real unsigned zerofill, -f77 double default 7.7, -f78 double unsigned default 7.7, -f79 double zerofill default 7.7, -f80 double unsigned zerofill default 8.8, -f81 float not null default 8.8, -f82 float unsigned not null default 8.8, -f83 float zerofill not null default 8.8, -f84 float unsigned zerofill not null default 8.8, -f85 float(0) not null default 8.8, -f86 float(23) not null default 8.8, -f87 float(0) unsigned not null default 8.8, -f88 float(23) unsigned not null default 8.8, -f89 float(0) zerofill not null default 8.8, -f90 float(23) zerofill not null default 8.8, -f91 float(0) unsigned zerofill not null default 8.8, -f92 float(23) unsigned zerofill not null default 8.8, -f93 float(24) not null default 8.8, -f94 float(53) not null default 8.8, -f95 float(24) unsigned not null default 8.8, -f96 float(53) unsigned not null default 8.8, -f97 float(24) zerofill not null default 8.8, -f98 float(53) zerofill not null default 8.8, -f99 float(24) unsigned zerofill not null default 8.8, -f100 float(53) unsigned zerofill not null default 8.8, -f101 date not null default '2000-01-01', -f102 time not null default 20, -f103 datetime not null default '2/2/2', -f104 timestamp not null default 20001231235959, -f105 year not null default 2000, -f106 year(3) not null default 2000, -f107 year(4) not null default 2000, -f108 enum("1enum","2enum") not null default "1enum", -f109 set("1set","2set") not null default "1set" -) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/memory_tb2.txt' into table tb2 ; -USE test; -USE test; -DROP TABLE IF EXISTS t1, t2, t4, t10, t11; -CREATE TABLE t1 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = MEMORY; -CREATE TABLE t2 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = MEMORY; -CREATE TABLE t4 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = MEMORY; -CREATE TABLE t10 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = MEMORY; -CREATE TABLE t11 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = MEMORY; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t1; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t2; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t4; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t10; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t11; -drop TABLE if exists t3; -CREATE TABLE t3 (f1 char(20), f2 char(20), f3 integer) ENGINE = MEMORY; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t3.txt' INTO TABLE t3; -drop database if exists test4; -CREATE database test4; -use test4; -CREATE TABLE t6 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = MEMORY; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t6; -use test; -drop TABLE if exists t7, t8; -CREATE TABLE t7 (f1 char(20), f2 char(25), f3 date, f4 int) ENGINE = MEMORY; -CREATE TABLE t8 (f1 char(20), f2 char(25), f3 date, f4 int) ENGINE = MEMORY; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' INTO TABLE t7; -Warnings: -Warning 1265 Data truncated for column 'f3' at row 1 -Warning 1265 Data truncated for column 'f3' at row 2 -Warning 1265 Data truncated for column 'f3' at row 3 -Warning 1265 Data truncated for column 'f3' at row 4 -Warning 1265 Data truncated for column 'f3' at row 5 -Warning 1265 Data truncated for column 'f3' at row 6 -Warning 1265 Data truncated for column 'f3' at row 7 -Warning 1265 Data truncated for column 'f3' at row 8 -Warning 1265 Data truncated for column 'f3' at row 9 -Warning 1265 Data truncated for column 'f3' at row 10 -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' INTO TABLE t8; -Warnings: -Warning 1265 Data truncated for column 'f3' at row 1 -Warning 1265 Data truncated for column 'f3' at row 2 -Warning 1265 Data truncated for column 'f3' at row 3 -Warning 1265 Data truncated for column 'f3' at row 4 -Warning 1265 Data truncated for column 'f3' at row 5 -Warning 1265 Data truncated for column 'f3' at row 6 -Warning 1265 Data truncated for column 'f3' at row 7 -Warning 1265 Data truncated for column 'f3' at row 8 -Warning 1265 Data truncated for column 'f3' at row 9 -Warning 1265 Data truncated for column 'f3' at row 10 -drop TABLE if exists t9; -CREATE TABLE t9 (f1 int, f2 char(25), f3 int) ENGINE = MEMORY; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' INTO TABLE t9; -DROP DATABASE IF EXISTS db_datadict; -CREATE DATABASE db_datadict; +CREATE DATABASE test2; +CREATE TABLE test1.t1 (f1 VARCHAR(20)) ENGINE = <engine_to_be_used>; +CREATE TABLE test1.t2 (f1 VARCHAR(20)) ENGINE = <engine_to_be_used>; +CREATE TABLE test2.t1 (f1 VARCHAR(20)) ENGINE = <engine_to_be_used>; SELECT *, LEFT( table_comment, IF(INSTR(table_comment,'InnoDB free') = 0 @@ -372,7 +19,7 @@ FROM information_schema.tables WHERE table_schema LIKE 'test%' AND table_type = 'BASE TABLE' ORDER BY table_schema,table_name; TABLE_CATALOG NULL -TABLE_SCHEMA test +TABLE_SCHEMA test1 TABLE_NAME t1 TABLE_TYPE BASE TABLE ENGINE MEMORY @@ -395,284 +42,8 @@ TABLE_COMMENT #TC# user_comment Separator ----------------------------------------------------- TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t10 -TABLE_TYPE BASE TABLE -ENGINE MEMORY -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t11 -TABLE_TYPE BASE TABLE -ENGINE MEMORY -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t2 -TABLE_TYPE BASE TABLE -ENGINE MEMORY -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t3 -TABLE_TYPE BASE TABLE -ENGINE MEMORY -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t4 -TABLE_TYPE BASE TABLE -ENGINE MEMORY -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t7 -TABLE_TYPE BASE TABLE -ENGINE MEMORY -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t8 -TABLE_TYPE BASE TABLE -ENGINE MEMORY -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t9 -TABLE_TYPE BASE TABLE -ENGINE MEMORY -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME tb1 -TABLE_TYPE BASE TABLE -ENGINE MEMORY -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME tb2 -TABLE_TYPE BASE TABLE -ENGINE MEMORY -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME tb3 -TABLE_TYPE BASE TABLE -ENGINE MEMORY -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME tb4 -TABLE_TYPE BASE TABLE -ENGINE MEMORY -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL TABLE_SCHEMA test1 -TABLE_NAME tb2 +TABLE_NAME t2 TABLE_TYPE BASE TABLE ENGINE MEMORY VERSION 10 @@ -694,8 +65,8 @@ TABLE_COMMENT #TC# user_comment Separator ----------------------------------------------------- TABLE_CATALOG NULL -TABLE_SCHEMA test4 -TABLE_NAME t6 +TABLE_SCHEMA test2 +TABLE_NAME t1 TABLE_TYPE BASE TABLE ENGINE MEMORY VERSION 10 @@ -716,9 +87,16 @@ CREATE_OPTIONS #CO# TABLE_COMMENT #TC# user_comment Separator ----------------------------------------------------- +SHOW TABLES FROM test1; +Tables_in_test1 +t1 +t2 +SHOW TABLES FROM test2; +Tables_in_test2 +t1 DROP USER testuser1@localhost; CREATE USER testuser1@localhost; -GRANT SELECT ON db_datadict.* TO testuser1@localhost; +GRANT SELECT ON test1.* TO testuser1@localhost; # Establish connection testuser1 (user=testuser1) SELECT *, LEFT( table_comment, @@ -733,7 +111,7 @@ FROM information_schema.tables WHERE table_schema LIKE 'test%' AND table_type = 'BASE TABLE' ORDER BY table_schema,table_name; TABLE_CATALOG NULL -TABLE_SCHEMA test +TABLE_SCHEMA test1 TABLE_NAME t1 TABLE_TYPE BASE TABLE ENGINE MEMORY @@ -756,53 +134,7 @@ TABLE_COMMENT #TC# user_comment Separator ----------------------------------------------------- TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t10 -TABLE_TYPE BASE TABLE -ENGINE MEMORY -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t11 -TABLE_TYPE BASE TABLE -ENGINE MEMORY -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test +TABLE_SCHEMA test1 TABLE_NAME t2 TABLE_TYPE BASE TABLE ENGINE MEMORY @@ -824,228 +156,13 @@ CREATE_OPTIONS #CO# TABLE_COMMENT #TC# user_comment Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t3 -TABLE_TYPE BASE TABLE -ENGINE MEMORY -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t4 -TABLE_TYPE BASE TABLE -ENGINE MEMORY -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t7 -TABLE_TYPE BASE TABLE -ENGINE MEMORY -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t8 -TABLE_TYPE BASE TABLE -ENGINE MEMORY -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t9 -TABLE_TYPE BASE TABLE -ENGINE MEMORY -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME tb1 -TABLE_TYPE BASE TABLE -ENGINE MEMORY -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME tb2 -TABLE_TYPE BASE TABLE -ENGINE MEMORY -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME tb3 -TABLE_TYPE BASE TABLE -ENGINE MEMORY -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME tb4 -TABLE_TYPE BASE TABLE -ENGINE MEMORY -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- +SHOW TABLES FROM test1; +Tables_in_test1 +t1 +t2 +SHOW TABLES FROM test2; +ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'test2' # Switch to connection default and close connection testuser1 DROP USER testuser1@localhost; -DROP DATABASE db_datadict; DROP DATABASE test1; -DROP DATABASE test4; -DROP TABLE test.t1; -DROP TABLE test.t2; -DROP TABLE test.t3; -DROP TABLE test.t4; -DROP TABLE test.t7; -DROP TABLE test.t8; -DROP TABLE test.t9; -DROP TABLE test.t10; -DROP TABLE test.t11; -DROP TABLE test.tb1; -DROP TABLE test.tb2; -DROP TABLE test.tb3; -DROP TABLE test.tb4; +DROP DATABASE test2; diff --git a/mysql-test/suite/funcs_1/r/is_tables_myisam.result b/mysql-test/suite/funcs_1/r/is_tables_myisam.result index f48128f6794..0f476309303 100644 --- a/mysql-test/suite/funcs_1/r/is_tables_myisam.result +++ b/mysql-test/suite/funcs_1/r/is_tables_myisam.result @@ -1,404 +1,11 @@ SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION'; DROP DATABASE IF EXISTS test1; +DROP DATABASE IF EXISTS test2; CREATE DATABASE test1; -USE test; -drop table if exists tb1 ; -create table tb1 ( -f1 char, -f2 char binary, -f3 char ascii, -f4 tinytext unicode, -f5 text, -f6 mediumtext, -f7 longtext, -f8 tinyblob, -f9 blob, -f10 mediumblob, -f11 longblob, -f12 binary, -f13 tinyint, -f14 tinyint unsigned, -f15 tinyint zerofill, -f16 tinyint unsigned zerofill, -f17 smallint, -f18 smallint unsigned, -f19 smallint zerofill, -f20 smallint unsigned zerofill, -f21 mediumint, -f22 mediumint unsigned, -f23 mediumint zerofill, -f24 mediumint unsigned zerofill, -f25 int, -f26 int unsigned, -f27 int zerofill, -f28 int unsigned zerofill, -f29 bigint, -f30 bigint unsigned, -f31 bigint zerofill, -f32 bigint unsigned zerofill, -f33 decimal not null DEFAULT 9.9, -f34 decimal unsigned not null DEFAULT 9.9, -f35 decimal zerofill not null DEFAULT 9.9, -f36 decimal unsigned zerofill not null DEFAULT 9.9, -f37 decimal (0) not null DEFAULT 9.9, -f38 decimal (64) not null DEFAULT 9.9, -f39 decimal (0) unsigned not null DEFAULT 9.9, -f40 decimal (64) unsigned not null DEFAULT 9.9, -f41 decimal (0) zerofill not null DEFAULT 9.9, -f42 decimal (64) zerofill not null DEFAULT 9.9, -f43 decimal (0) unsigned zerofill not null DEFAULT 9.9, -f44 decimal (64) unsigned zerofill not null DEFAULT 9.9, -f45 decimal (0,0) not null DEFAULT 9.9, -f46 decimal (63,30) not null DEFAULT 9.9, -f47 decimal (0,0) unsigned not null DEFAULT 9.9, -f48 decimal (63,30) unsigned not null DEFAULT 9.9, -f49 decimal (0,0) zerofill not null DEFAULT 9.9, -f50 decimal (63,30) zerofill not null DEFAULT 9.9, -f51 decimal (0,0) unsigned zerofill not null DEFAULT 9.9, -f52 decimal (63,30) unsigned zerofill not null DEFAULT 9.9, -f53 numeric not null DEFAULT 99, -f54 numeric unsigned not null DEFAULT 99, -f55 numeric zerofill not null DEFAULT 99, -f56 numeric unsigned zerofill not null DEFAULT 99, -f57 numeric (0) not null DEFAULT 99, -f58 numeric (64) not null DEFAULT 99 -) engine = myisam; -Warnings: -Note 1265 Data truncated for column 'f33' at row 1 -Note 1265 Data truncated for column 'f34' at row 1 -Note 1265 Data truncated for column 'f35' at row 1 -Note 1265 Data truncated for column 'f36' at row 1 -Note 1265 Data truncated for column 'f37' at row 1 -Note 1265 Data truncated for column 'f38' at row 1 -Note 1265 Data truncated for column 'f39' at row 1 -Note 1265 Data truncated for column 'f40' at row 1 -Note 1265 Data truncated for column 'f41' at row 1 -Note 1265 Data truncated for column 'f42' at row 1 -Note 1265 Data truncated for column 'f43' at row 1 -Note 1265 Data truncated for column 'f44' at row 1 -Note 1265 Data truncated for column 'f45' at row 1 -Note 1265 Data truncated for column 'f47' at row 1 -Note 1265 Data truncated for column 'f49' at row 1 -Note 1265 Data truncated for column 'f51' at row 1 -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/myisam_tb1.txt' into table tb1 ; -drop table if exists tb2 ; -create table tb2 ( -f59 numeric (0) unsigned, -f60 numeric (64) unsigned, -f61 numeric (0) zerofill, -f62 numeric (64) zerofill, -f63 numeric (0) unsigned zerofill, -f64 numeric (64) unsigned zerofill, -f65 numeric (0,0), -f66 numeric (63,30), -f67 numeric (0,0) unsigned, -f68 numeric (63,30) unsigned, -f69 numeric (0,0) zerofill, -f70 numeric (63,30) zerofill, -f71 numeric (0,0) unsigned zerofill, -f72 numeric (63,30) unsigned zerofill, -f73 real, -f74 real unsigned, -f75 real zerofill, -f76 real unsigned zerofill, -f77 double default 7.7, -f78 double unsigned default 7.7, -f79 double zerofill default 7.7, -f80 double unsigned zerofill default 8.8, -f81 float not null default 8.8, -f82 float unsigned not null default 8.8, -f83 float zerofill not null default 8.8, -f84 float unsigned zerofill not null default 8.8, -f85 float(0) not null default 8.8, -f86 float(23) not null default 8.8, -f87 float(0) unsigned not null default 8.8, -f88 float(23) unsigned not null default 8.8, -f89 float(0) zerofill not null default 8.8, -f90 float(23) zerofill not null default 8.8, -f91 float(0) unsigned zerofill not null default 8.8, -f92 float(23) unsigned zerofill not null default 8.8, -f93 float(24) not null default 8.8, -f94 float(53) not null default 8.8, -f95 float(24) unsigned not null default 8.8, -f96 float(53) unsigned not null default 8.8, -f97 float(24) zerofill not null default 8.8, -f98 float(53) zerofill not null default 8.8, -f99 float(24) unsigned zerofill not null default 8.8, -f100 float(53) unsigned zerofill not null default 8.8, -f101 date not null default '2000-01-01', -f102 time not null default 20, -f103 datetime not null default '2/2/2', -f104 timestamp not null default 20001231235959, -f105 year not null default 2000, -f106 year(3) not null default 2000, -f107 year(4) not null default 2000, -f108 enum("1enum","2enum") not null default "1enum", -f109 set("1set","2set") not null default "1set", -f110 VARBINARY(64) null, -f111 VARBINARY(27) null , -f112 VARBINARY(64) null , -f113 VARBINARY(192) null , -f114 VARBINARY(192) , -f115 VARBINARY(27) null , -f116 VARBINARY(64) null, -f117 VARBINARY(192) null -) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/myisam_tb2.txt' into table tb2 ; -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 = myisam; -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 'MYSQL_TEST_DIR/suite/funcs_1/data/myisam_tb3.txt' into table tb3 ; -drop table if exists tb4 ; -create table tb4 ( -f176 numeric (0) unsigned not null DEFAULT 9, -f177 numeric (64) unsigned not null DEFAULT 9, -f178 numeric (0) zerofill not null DEFAULT 9, -f179 numeric (64) zerofill not null DEFAULT 9, -f180 numeric (0) unsigned zerofill not null DEFAULT 9, -f181 numeric (64) unsigned zerofill not null DEFAULT 9, -f182 numeric (0,0) not null DEFAULT 9, -f183 numeric (63,30) not null DEFAULT 9, -f184 numeric (0,0) unsigned not null DEFAULT 9, -f185 numeric (63,30) unsigned not null DEFAULT 9, -f186 numeric (0,0) zerofill not null DEFAULT 9, -f187 numeric (63,30) zerofill not null DEFAULT 9, -f188 numeric (0,0) unsigned zerofill not null DEFAULT 9, -f189 numeric (63,30) unsigned zerofill not null DEFAULT 9, -f190 real not null DEFAULT 88.8, -f191 real unsigned not null DEFAULT 88.8, -f192 real zerofill not null DEFAULT 88.8, -f193 real unsigned zerofill not null DEFAULT 88.8, -f194 double not null DEFAULT 55.5, -f195 double unsigned not null DEFAULT 55.5, -f196 double zerofill not null DEFAULT 55.5, -f197 double unsigned zerofill not null DEFAULT 55.5, -f198 float, -f199 float unsigned, -f200 float zerofill, -f201 float unsigned zerofill, -f202 float(0), -f203 float(23), -f204 float(0) unsigned, -f205 float(23) unsigned, -f206 float(0) zerofill, -f207 float(23) zerofill, -f208 float(0) unsigned zerofill, -f209 float(23) unsigned zerofill, -f210 float(24), -f211 float(53), -f212 float(24) unsigned, -f213 float(53) unsigned, -f214 float(24) zerofill, -f215 float(53) zerofill, -f216 float(24) unsigned zerofill, -f217 float(53) unsigned zerofill, -f218 date, -f219 time, -f220 datetime, -f221 timestamp, -f222 year, -f223 year(3), -f224 year(4), -f225 enum("1enum","2enum"), -f226 set("1set","2set"), -f227 VARBINARY(64), -f228 VARBINARY(27), -f229 VARBINARY(64), -f230 VARBINARY(192), -f231 VARBINARY(192), -f232 VARBINARY(27), -f233 VARBINARY(64), -f234 VARBINARY(192), -f235 char(255) unicode, -f236 char(60) ascii, -f237 char(255) binary, -f238 varchar(0) binary, -f239 varbinary(1000), -f240 varchar(120) unicode, -f241 char(100) unicode, -f242 bit(30) -) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/myisam_tb4.txt' into table tb4 ; -USE test1; -drop table if exists tb2 ; -create table tb2 ( -f59 numeric (0) unsigned, -f60 numeric (64) unsigned, -f61 numeric (0) zerofill, -f62 numeric (64) zerofill, -f63 numeric (0) unsigned zerofill, -f64 numeric (64) unsigned zerofill, -f65 numeric (0,0), -f66 numeric (63,30), -f67 numeric (0,0) unsigned, -f68 numeric (63,30) unsigned, -f69 numeric (0,0) zerofill, -f70 numeric (63,30) zerofill, -f71 numeric (0,0) unsigned zerofill, -f72 numeric (63,30) unsigned zerofill, -f73 real, -f74 real unsigned, -f75 real zerofill, -f76 real unsigned zerofill, -f77 double default 7.7, -f78 double unsigned default 7.7, -f79 double zerofill default 7.7, -f80 double unsigned zerofill default 8.8, -f81 float not null default 8.8, -f82 float unsigned not null default 8.8, -f83 float zerofill not null default 8.8, -f84 float unsigned zerofill not null default 8.8, -f85 float(0) not null default 8.8, -f86 float(23) not null default 8.8, -f87 float(0) unsigned not null default 8.8, -f88 float(23) unsigned not null default 8.8, -f89 float(0) zerofill not null default 8.8, -f90 float(23) zerofill not null default 8.8, -f91 float(0) unsigned zerofill not null default 8.8, -f92 float(23) unsigned zerofill not null default 8.8, -f93 float(24) not null default 8.8, -f94 float(53) not null default 8.8, -f95 float(24) unsigned not null default 8.8, -f96 float(53) unsigned not null default 8.8, -f97 float(24) zerofill not null default 8.8, -f98 float(53) zerofill not null default 8.8, -f99 float(24) unsigned zerofill not null default 8.8, -f100 float(53) unsigned zerofill not null default 8.8, -f101 date not null default '2000-01-01', -f102 time not null default 20, -f103 datetime not null default '2/2/2', -f104 timestamp not null default 20001231235959, -f105 year not null default 2000, -f106 year(3) not null default 2000, -f107 year(4) not null default 2000, -f108 enum("1enum","2enum") not null default "1enum", -f109 set("1set","2set") not null default "1set", -f110 VARBINARY(64) null, -f111 VARBINARY(27) null , -f112 VARBINARY(64) null , -f113 VARBINARY(192) null , -f114 VARBINARY(192) , -f115 VARBINARY(27) null , -f116 VARBINARY(64) null, -f117 VARBINARY(192) null -) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/myisam_tb2.txt' into table tb2 ; -USE test; -USE test; -DROP TABLE IF EXISTS t1, t2, t4, t10, t11; -CREATE TABLE t1 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = MyISAM; -CREATE TABLE t2 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = MyISAM; -CREATE TABLE t4 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = MyISAM; -CREATE TABLE t10 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = MyISAM; -CREATE TABLE t11 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = MyISAM; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t1; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t2; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t4; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t10; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t11; -drop TABLE if exists t3; -CREATE TABLE t3 (f1 char(20), f2 char(20), f3 integer) ENGINE = MyISAM; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t3.txt' INTO TABLE t3; -drop database if exists test4; -CREATE database test4; -use test4; -CREATE TABLE t6 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = MyISAM; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t6; -use test; -drop TABLE if exists t7, t8; -CREATE TABLE t7 (f1 char(20), f2 char(25), f3 date, f4 int) ENGINE = MyISAM; -CREATE TABLE t8 (f1 char(20), f2 char(25), f3 date, f4 int) ENGINE = MyISAM; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' INTO TABLE t7; -Warnings: -Warning 1265 Data truncated for column 'f3' at row 1 -Warning 1265 Data truncated for column 'f3' at row 2 -Warning 1265 Data truncated for column 'f3' at row 3 -Warning 1265 Data truncated for column 'f3' at row 4 -Warning 1265 Data truncated for column 'f3' at row 5 -Warning 1265 Data truncated for column 'f3' at row 6 -Warning 1265 Data truncated for column 'f3' at row 7 -Warning 1265 Data truncated for column 'f3' at row 8 -Warning 1265 Data truncated for column 'f3' at row 9 -Warning 1265 Data truncated for column 'f3' at row 10 -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' INTO TABLE t8; -Warnings: -Warning 1265 Data truncated for column 'f3' at row 1 -Warning 1265 Data truncated for column 'f3' at row 2 -Warning 1265 Data truncated for column 'f3' at row 3 -Warning 1265 Data truncated for column 'f3' at row 4 -Warning 1265 Data truncated for column 'f3' at row 5 -Warning 1265 Data truncated for column 'f3' at row 6 -Warning 1265 Data truncated for column 'f3' at row 7 -Warning 1265 Data truncated for column 'f3' at row 8 -Warning 1265 Data truncated for column 'f3' at row 9 -Warning 1265 Data truncated for column 'f3' at row 10 -drop TABLE if exists t9; -CREATE TABLE t9 (f1 int, f2 char(25), f3 int) ENGINE = MyISAM; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' INTO TABLE t9; -DROP DATABASE IF EXISTS db_datadict; -CREATE DATABASE db_datadict; +CREATE DATABASE test2; +CREATE TABLE test1.t1 (f1 VARCHAR(20)) ENGINE = <engine_to_be_used>; +CREATE TABLE test1.t2 (f1 VARCHAR(20)) ENGINE = <engine_to_be_used>; +CREATE TABLE test2.t1 (f1 VARCHAR(20)) ENGINE = <engine_to_be_used>; SELECT *, LEFT( table_comment, IF(INSTR(table_comment,'InnoDB free') = 0 @@ -412,287 +19,11 @@ FROM information_schema.tables WHERE table_schema LIKE 'test%' AND table_type = 'BASE TABLE' ORDER BY table_schema,table_name; TABLE_CATALOG NULL -TABLE_SCHEMA test +TABLE_SCHEMA test1 TABLE_NAME t1 TABLE_TYPE BASE TABLE ENGINE MyISAM VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t10 -TABLE_TYPE BASE TABLE -ENGINE MyISAM -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t11 -TABLE_TYPE BASE TABLE -ENGINE MyISAM -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t2 -TABLE_TYPE BASE TABLE -ENGINE MyISAM -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t3 -TABLE_TYPE BASE TABLE -ENGINE MyISAM -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t4 -TABLE_TYPE BASE TABLE -ENGINE MyISAM -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t7 -TABLE_TYPE BASE TABLE -ENGINE MyISAM -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t8 -TABLE_TYPE BASE TABLE -ENGINE MyISAM -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t9 -TABLE_TYPE BASE TABLE -ENGINE MyISAM -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME tb1 -TABLE_TYPE BASE TABLE -ENGINE MyISAM -VERSION 10 -ROW_FORMAT Dynamic -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME tb2 -TABLE_TYPE BASE TABLE -ENGINE MyISAM -VERSION 10 -ROW_FORMAT Dynamic -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME tb3 -TABLE_TYPE BASE TABLE -ENGINE MyISAM -VERSION 10 -ROW_FORMAT Dynamic -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME tb4 -TABLE_TYPE BASE TABLE -ENGINE MyISAM -VERSION 10 ROW_FORMAT Dynamic TABLE_ROWS #TBLR# AVG_ROW_LENGTH #ARL# @@ -712,7 +43,7 @@ user_comment Separator ----------------------------------------------------- TABLE_CATALOG NULL TABLE_SCHEMA test1 -TABLE_NAME tb2 +TABLE_NAME t2 TABLE_TYPE BASE TABLE ENGINE MyISAM VERSION 10 @@ -734,12 +65,12 @@ TABLE_COMMENT #TC# user_comment Separator ----------------------------------------------------- TABLE_CATALOG NULL -TABLE_SCHEMA test4 -TABLE_NAME t6 +TABLE_SCHEMA test2 +TABLE_NAME t1 TABLE_TYPE BASE TABLE ENGINE MyISAM VERSION 10 -ROW_FORMAT Fixed +ROW_FORMAT Dynamic TABLE_ROWS #TBLR# AVG_ROW_LENGTH #ARL# DATA_LENGTH #DL# @@ -756,9 +87,16 @@ CREATE_OPTIONS #CO# TABLE_COMMENT #TC# user_comment Separator ----------------------------------------------------- +SHOW TABLES FROM test1; +Tables_in_test1 +t1 +t2 +SHOW TABLES FROM test2; +Tables_in_test2 +t1 DROP USER testuser1@localhost; CREATE USER testuser1@localhost; -GRANT SELECT ON db_datadict.* TO testuser1@localhost; +GRANT SELECT ON test1.* TO testuser1@localhost; # Establish connection testuser1 (user=testuser1) SELECT *, LEFT( table_comment, @@ -773,218 +111,11 @@ FROM information_schema.tables WHERE table_schema LIKE 'test%' AND table_type = 'BASE TABLE' ORDER BY table_schema,table_name; TABLE_CATALOG NULL -TABLE_SCHEMA test +TABLE_SCHEMA test1 TABLE_NAME t1 TABLE_TYPE BASE TABLE ENGINE MyISAM VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t10 -TABLE_TYPE BASE TABLE -ENGINE MyISAM -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t11 -TABLE_TYPE BASE TABLE -ENGINE MyISAM -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t2 -TABLE_TYPE BASE TABLE -ENGINE MyISAM -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t3 -TABLE_TYPE BASE TABLE -ENGINE MyISAM -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t4 -TABLE_TYPE BASE TABLE -ENGINE MyISAM -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t7 -TABLE_TYPE BASE TABLE -ENGINE MyISAM -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t8 -TABLE_TYPE BASE TABLE -ENGINE MyISAM -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t9 -TABLE_TYPE BASE TABLE -ENGINE MyISAM -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME tb1 -TABLE_TYPE BASE TABLE -ENGINE MyISAM -VERSION 10 ROW_FORMAT Dynamic TABLE_ROWS #TBLR# AVG_ROW_LENGTH #ARL# @@ -1003,54 +134,8 @@ TABLE_COMMENT #TC# user_comment Separator ----------------------------------------------------- TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME tb2 -TABLE_TYPE BASE TABLE -ENGINE MyISAM -VERSION 10 -ROW_FORMAT Dynamic -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME tb3 -TABLE_TYPE BASE TABLE -ENGINE MyISAM -VERSION 10 -ROW_FORMAT Dynamic -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME tb4 +TABLE_SCHEMA test1 +TABLE_NAME t2 TABLE_TYPE BASE TABLE ENGINE MyISAM VERSION 10 @@ -1071,21 +156,13 @@ CREATE_OPTIONS #CO# TABLE_COMMENT #TC# user_comment Separator ----------------------------------------------------- +SHOW TABLES FROM test1; +Tables_in_test1 +t1 +t2 +SHOW TABLES FROM test2; +ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'test2' # Switch to connection default and close connection testuser1 DROP USER testuser1@localhost; -DROP DATABASE db_datadict; DROP DATABASE test1; -DROP DATABASE test4; -DROP TABLE test.t1; -DROP TABLE test.t2; -DROP TABLE test.t3; -DROP TABLE test.t4; -DROP TABLE test.t7; -DROP TABLE test.t8; -DROP TABLE test.t9; -DROP TABLE test.t10; -DROP TABLE test.t11; -DROP TABLE test.tb1; -DROP TABLE test.tb2; -DROP TABLE test.tb3; -DROP TABLE test.tb4; +DROP DATABASE test2; diff --git a/mysql-test/suite/funcs_1/r/is_tables_myisam_embedded.result b/mysql-test/suite/funcs_1/r/is_tables_myisam_embedded.result new file mode 100644 index 00000000000..25c482bb73c --- /dev/null +++ b/mysql-test/suite/funcs_1/r/is_tables_myisam_embedded.result @@ -0,0 +1,192 @@ +SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION'; +DROP DATABASE IF EXISTS test1; +DROP DATABASE IF EXISTS test2; +CREATE DATABASE test1; +CREATE DATABASE test2; +CREATE TABLE test1.t1 (f1 VARCHAR(20)) ENGINE = <engine_to_be_used>; +CREATE TABLE test1.t2 (f1 VARCHAR(20)) ENGINE = <engine_to_be_used>; +CREATE TABLE test2.t1 (f1 VARCHAR(20)) ENGINE = <engine_to_be_used>; +SELECT *, +LEFT( table_comment, +IF(INSTR(table_comment,'InnoDB free') = 0 +AND INSTR(table_comment,'number_of_replicas') = 0, +LENGTH(table_comment), +INSTR(table_comment,'InnoDB free') ++ INSTR(table_comment,'number_of_replicas') - 1)) +AS "user_comment", +'-----------------------------------------------------' AS "Separator" +FROM information_schema.tables +WHERE table_schema LIKE 'test%' AND table_type = 'BASE TABLE' +ORDER BY table_schema,table_name; +TABLE_CATALOG NULL +TABLE_SCHEMA test1 +TABLE_NAME t1 +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Dynamic +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION latin1_swedish_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA test1 +TABLE_NAME t2 +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Dynamic +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION latin1_swedish_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA test2 +TABLE_NAME t1 +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Dynamic +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION latin1_swedish_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment +Separator ----------------------------------------------------- +SHOW TABLES FROM test1; +Tables_in_test1 +t1 +t2 +SHOW TABLES FROM test2; +Tables_in_test2 +t1 +DROP USER testuser1@localhost; +CREATE USER testuser1@localhost; +GRANT SELECT ON test1.* TO testuser1@localhost; +# Establish connection testuser1 (user=testuser1) +SELECT *, +LEFT( table_comment, +IF(INSTR(table_comment,'InnoDB free') = 0 +AND INSTR(table_comment,'number_of_replicas') = 0, +LENGTH(table_comment), +INSTR(table_comment,'InnoDB free') ++ INSTR(table_comment,'number_of_replicas') - 1)) +AS "user_comment", +'-----------------------------------------------------' AS "Separator" +FROM information_schema.tables +WHERE table_schema LIKE 'test%' AND table_type = 'BASE TABLE' +ORDER BY table_schema,table_name; +TABLE_CATALOG NULL +TABLE_SCHEMA test1 +TABLE_NAME t1 +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Dynamic +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION latin1_swedish_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA test1 +TABLE_NAME t2 +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Dynamic +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION latin1_swedish_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA test2 +TABLE_NAME t1 +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Dynamic +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION latin1_swedish_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment +Separator ----------------------------------------------------- +SHOW TABLES FROM test1; +Tables_in_test1 +t1 +t2 +SHOW TABLES FROM test2; +Tables_in_test2 +t1 +# Switch to connection default and close connection testuser1 +DROP USER testuser1@localhost; +DROP DATABASE test1; +DROP DATABASE test2; diff --git a/mysql-test/suite/funcs_1/r/is_tables_mysql.result b/mysql-test/suite/funcs_1/r/is_tables_mysql.result index d407f224b7d..49a4267d170 100644 --- a/mysql-test/suite/funcs_1/r/is_tables_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_tables_mysql.result @@ -1,5 +1,5 @@ -DROP DATABASE IF EXISTS db_datadict; -CREATE DATABASE db_datadict; +DROP DATABASE IF EXISTS test1; +CREATE DATABASE test1; SELECT *, LEFT( table_comment, IF(INSTR(table_comment,'InnoDB free') = 0 @@ -405,7 +405,7 @@ user_comment Users and global privileges Separator ----------------------------------------------------- DROP USER testuser1@localhost; CREATE USER testuser1@localhost; -GRANT SELECT ON db_datadict.* TO testuser1@localhost; +GRANT SELECT ON test1.* TO testuser1@localhost; # Establish connection testuser1 (user=testuser1) SELECT *, LEFT( table_comment, @@ -421,4 +421,4 @@ WHERE table_schema = 'mysql' ORDER BY table_schema,table_name; # Switch to connection default and close connection testuser1 DROP USER testuser1@localhost; -DROP DATABASE db_datadict; +DROP DATABASE test1; diff --git a/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result new file mode 100644 index 00000000000..e5416555189 --- /dev/null +++ b/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result @@ -0,0 +1,815 @@ +DROP DATABASE IF EXISTS test1; +CREATE DATABASE test1; +SELECT *, +LEFT( table_comment, +IF(INSTR(table_comment,'InnoDB free') = 0 +AND INSTR(table_comment,'number_of_replicas') = 0, +LENGTH(table_comment), +INSTR(table_comment,'InnoDB free') ++ INSTR(table_comment,'number_of_replicas') - 1)) +AS "user_comment", +'-----------------------------------------------------' AS "Separator" +FROM information_schema.tables +WHERE table_schema = 'mysql' +ORDER BY table_schema,table_name; +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME columns_priv +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_bin +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment Column privileges +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME db +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_bin +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment Database privileges +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME func +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_bin +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment User defined functions +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME help_category +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment help categories +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME help_keyword +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment help keywords +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME help_relation +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment keyword-topic relation +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME help_topic +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Dynamic +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment help topics +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME host +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_bin +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment Host privileges; Merged with database privileges +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME proc +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Dynamic +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment Stored Procedures +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME procs_priv +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_bin +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment Procedure privileges +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME tables_priv +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_bin +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment Table privileges +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME time_zone +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT 6 +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment Time zones +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME time_zone_leap_second +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment Leap seconds information for time zones +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME time_zone_name +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment Time zone names +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME time_zone_transition +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment Time zone transitions +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME time_zone_transition_type +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment Time zone transition types +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME user +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Dynamic +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_bin +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment Users and global privileges +Separator ----------------------------------------------------- +DROP USER testuser1@localhost; +CREATE USER testuser1@localhost; +GRANT SELECT ON test1.* TO testuser1@localhost; +# Establish connection testuser1 (user=testuser1) +SELECT *, +LEFT( table_comment, +IF(INSTR(table_comment,'InnoDB free') = 0 +AND INSTR(table_comment,'number_of_replicas') = 0, +LENGTH(table_comment), +INSTR(table_comment,'InnoDB free') ++ INSTR(table_comment,'number_of_replicas') - 1)) +AS "user_comment", +'-----------------------------------------------------' AS "Separator" +FROM information_schema.tables +WHERE table_schema = 'mysql' +ORDER BY table_schema,table_name; +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME columns_priv +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_bin +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment Column privileges +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME db +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_bin +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment Database privileges +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME func +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_bin +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment User defined functions +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME help_category +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment help categories +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME help_keyword +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment help keywords +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME help_relation +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment keyword-topic relation +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME help_topic +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Dynamic +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment help topics +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME host +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_bin +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment Host privileges; Merged with database privileges +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME proc +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Dynamic +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment Stored Procedures +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME procs_priv +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_bin +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment Procedure privileges +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME tables_priv +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_bin +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment Table privileges +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME time_zone +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT 6 +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment Time zones +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME time_zone_leap_second +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment Leap seconds information for time zones +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME time_zone_name +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment Time zone names +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME time_zone_transition +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment Time zone transitions +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME time_zone_transition_type +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment Time zone transition types +Separator ----------------------------------------------------- +TABLE_CATALOG NULL +TABLE_SCHEMA mysql +TABLE_NAME user +TABLE_TYPE BASE TABLE +ENGINE MyISAM +VERSION 10 +ROW_FORMAT Dynamic +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_bin +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment Users and global privileges +Separator ----------------------------------------------------- +# Switch to connection default and close connection testuser1 +DROP USER testuser1@localhost; +DROP DATABASE test1; diff --git a/mysql-test/suite/funcs_1/r/is_tables_ndb.result b/mysql-test/suite/funcs_1/r/is_tables_ndb.result index 189f7f3464a..4ce150353c1 100644 --- a/mysql-test/suite/funcs_1/r/is_tables_ndb.result +++ b/mysql-test/suite/funcs_1/r/is_tables_ndb.result @@ -1,60 +1,10 @@ DROP DATABASE IF EXISTS test1; +DROP DATABASE IF EXISTS test2; CREATE DATABASE test1; -USE test; -USE test; -USE test; -DROP TABLE IF EXISTS t1, t2, t4, t10, t11; -CREATE TABLE t1 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = NDB; -CREATE TABLE t2 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = NDB; -CREATE TABLE t4 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = NDB; -CREATE TABLE t10 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = NDB; -CREATE TABLE t11 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = NDB; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t1; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t2; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t4; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t10; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t11; -drop TABLE if exists t3; -CREATE TABLE t3 (f1 char(20), f2 char(20), f3 integer) ENGINE = NDB; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t3.txt' INTO TABLE t3; -drop database if exists test4; -CREATE database test4; -use test4; -CREATE TABLE t6 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int) ENGINE = NDB; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' INTO TABLE t6; -use test; -drop TABLE if exists t7, t8; -CREATE TABLE t7 (f1 char(20), f2 char(25), f3 date, f4 int) ENGINE = NDB; -CREATE TABLE t8 (f1 char(20), f2 char(25), f3 date, f4 int) ENGINE = NDB; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' INTO TABLE t7; -Warnings: -Warning 1265 Data truncated for column 'f3' at row 1 -Warning 1265 Data truncated for column 'f3' at row 2 -Warning 1265 Data truncated for column 'f3' at row 3 -Warning 1265 Data truncated for column 'f3' at row 4 -Warning 1265 Data truncated for column 'f3' at row 5 -Warning 1265 Data truncated for column 'f3' at row 6 -Warning 1265 Data truncated for column 'f3' at row 7 -Warning 1265 Data truncated for column 'f3' at row 8 -Warning 1265 Data truncated for column 'f3' at row 9 -Warning 1265 Data truncated for column 'f3' at row 10 -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' INTO TABLE t8; -Warnings: -Warning 1265 Data truncated for column 'f3' at row 1 -Warning 1265 Data truncated for column 'f3' at row 2 -Warning 1265 Data truncated for column 'f3' at row 3 -Warning 1265 Data truncated for column 'f3' at row 4 -Warning 1265 Data truncated for column 'f3' at row 5 -Warning 1265 Data truncated for column 'f3' at row 6 -Warning 1265 Data truncated for column 'f3' at row 7 -Warning 1265 Data truncated for column 'f3' at row 8 -Warning 1265 Data truncated for column 'f3' at row 9 -Warning 1265 Data truncated for column 'f3' at row 10 -drop TABLE if exists t9; -CREATE TABLE t9 (f1 int, f2 char(25), f3 int) ENGINE = NDB; -LOAD DATA INFILE 'MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' INTO TABLE t9; -DROP DATABASE IF EXISTS db_datadict; -CREATE DATABASE db_datadict; +CREATE DATABASE test2; +CREATE TABLE test1.t1 (f1 VARCHAR(20)) ENGINE = <engine_to_be_used>; +CREATE TABLE test1.t2 (f1 VARCHAR(20)) ENGINE = <engine_to_be_used>; +CREATE TABLE test2.t1 (f1 VARCHAR(20)) ENGINE = <engine_to_be_used>; SELECT *, LEFT( table_comment, IF(INSTR(table_comment,'InnoDB free') = 0 @@ -68,12 +18,12 @@ FROM information_schema.tables WHERE table_schema LIKE 'test%' AND table_type = 'BASE TABLE' ORDER BY table_schema,table_name; TABLE_CATALOG NULL -TABLE_SCHEMA test +TABLE_SCHEMA test1 TABLE_NAME t1 TABLE_TYPE BASE TABLE ENGINE ndbcluster VERSION 10 -ROW_FORMAT Fixed +ROW_FORMAT Dynamic TABLE_ROWS #TBLR# AVG_ROW_LENGTH #ARL# DATA_LENGTH #DL# @@ -91,81 +41,12 @@ TABLE_COMMENT #TC# user_comment Separator ----------------------------------------------------- TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t10 -TABLE_TYPE BASE TABLE -ENGINE ndbcluster -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t11 -TABLE_TYPE BASE TABLE -ENGINE ndbcluster -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test +TABLE_SCHEMA test1 TABLE_NAME t2 TABLE_TYPE BASE TABLE ENGINE ndbcluster VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t3 -TABLE_TYPE BASE TABLE -ENGINE ndbcluster -VERSION 10 -ROW_FORMAT Fixed +ROW_FORMAT Dynamic TABLE_ROWS #TBLR# AVG_ROW_LENGTH #ARL# DATA_LENGTH #DL# @@ -183,104 +64,12 @@ TABLE_COMMENT #TC# user_comment Separator ----------------------------------------------------- TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t4 -TABLE_TYPE BASE TABLE -ENGINE ndbcluster -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t7 -TABLE_TYPE BASE TABLE -ENGINE ndbcluster -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t8 -TABLE_TYPE BASE TABLE -ENGINE ndbcluster -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t9 -TABLE_TYPE BASE TABLE -ENGINE ndbcluster -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test4 -TABLE_NAME t6 +TABLE_SCHEMA test2 +TABLE_NAME t1 TABLE_TYPE BASE TABLE ENGINE ndbcluster VERSION 10 -ROW_FORMAT Fixed +ROW_FORMAT Dynamic TABLE_ROWS #TBLR# AVG_ROW_LENGTH #ARL# DATA_LENGTH #DL# @@ -297,9 +86,16 @@ CREATE_OPTIONS #CO# TABLE_COMMENT #TC# user_comment Separator ----------------------------------------------------- +SHOW TABLES FROM test1; +Tables_in_test1 +t1 +t2 +SHOW TABLES FROM test2; +Tables_in_test2 +t1 DROP USER testuser1@localhost; CREATE USER testuser1@localhost; -GRANT SELECT ON db_datadict.* TO testuser1@localhost; +GRANT SELECT ON test1.* TO testuser1@localhost; # Establish connection testuser1 (user=testuser1) SELECT *, LEFT( table_comment, @@ -314,12 +110,12 @@ FROM information_schema.tables WHERE table_schema LIKE 'test%' AND table_type = 'BASE TABLE' ORDER BY table_schema,table_name; TABLE_CATALOG NULL -TABLE_SCHEMA test +TABLE_SCHEMA test1 TABLE_NAME t1 TABLE_TYPE BASE TABLE ENGINE ndbcluster VERSION 10 -ROW_FORMAT Fixed +ROW_FORMAT Dynamic TABLE_ROWS #TBLR# AVG_ROW_LENGTH #ARL# DATA_LENGTH #DL# @@ -337,196 +133,12 @@ TABLE_COMMENT #TC# user_comment Separator ----------------------------------------------------- TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t10 -TABLE_TYPE BASE TABLE -ENGINE ndbcluster -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t11 -TABLE_TYPE BASE TABLE -ENGINE ndbcluster -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test +TABLE_SCHEMA test1 TABLE_NAME t2 TABLE_TYPE BASE TABLE ENGINE ndbcluster VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t3 -TABLE_TYPE BASE TABLE -ENGINE ndbcluster -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t4 -TABLE_TYPE BASE TABLE -ENGINE ndbcluster -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t7 -TABLE_TYPE BASE TABLE -ENGINE ndbcluster -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t8 -TABLE_TYPE BASE TABLE -ENGINE ndbcluster -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test -TABLE_NAME t9 -TABLE_TYPE BASE TABLE -ENGINE ndbcluster -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment -Separator ----------------------------------------------------- -TABLE_CATALOG NULL -TABLE_SCHEMA test4 -TABLE_NAME t6 -TABLE_TYPE BASE TABLE -ENGINE ndbcluster -VERSION 10 -ROW_FORMAT Fixed +ROW_FORMAT Dynamic TABLE_ROWS #TBLR# AVG_ROW_LENGTH #ARL# DATA_LENGTH #DL# @@ -543,17 +155,13 @@ CREATE_OPTIONS #CO# TABLE_COMMENT #TC# user_comment Separator ----------------------------------------------------- +SHOW TABLES FROM test1; +Tables_in_test1 +t1 +t2 +SHOW TABLES FROM test2; +ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'test2' # Switch to connection default and close connection testuser1 DROP USER testuser1@localhost; -DROP DATABASE db_datadict; DROP DATABASE test1; -DROP DATABASE test4; -DROP TABLE test.t1; -DROP TABLE test.t2; -DROP TABLE test.t3; -DROP TABLE test.t4; -DROP TABLE test.t7; -DROP TABLE test.t8; -DROP TABLE test.t9; -DROP TABLE test.t10; -DROP TABLE test.t11; +DROP DATABASE test2; diff --git a/mysql-test/suite/funcs_1/r/is_triggers_embedded.result b/mysql-test/suite/funcs_1/r/is_triggers_embedded.result new file mode 100644 index 00000000000..5e0c7601da7 --- /dev/null +++ b/mysql-test/suite/funcs_1/r/is_triggers_embedded.result @@ -0,0 +1,208 @@ +SHOW TABLES FROM information_schema LIKE 'TRIGGERS'; +Tables_in_information_schema (TRIGGERS) +TRIGGERS +####################################################################### +# Testcase 3.2.1.1: INFORMATION_SCHEMA tables can be queried via SELECT +####################################################################### +DROP VIEW IF EXISTS test.v1; +DROP PROCEDURE IF EXISTS test.p1; +DROP FUNCTION IF EXISTS test.f1; +CREATE VIEW test.v1 AS SELECT * FROM information_schema.TRIGGERS; +CREATE PROCEDURE test.p1() SELECT * FROM information_schema.TRIGGERS; +CREATE FUNCTION test.f1() returns BIGINT +BEGIN +DECLARE counter BIGINT DEFAULT NULL; +SELECT COUNT(*) INTO counter FROM information_schema.TRIGGERS; +RETURN counter; +END// +# Attention: The printing of the next result sets is disabled. +SELECT * FROM information_schema.TRIGGERS; +SELECT * FROM test.v1; +CALL test.p1; +SELECT test.f1(); +DROP VIEW test.v1; +DROP PROCEDURE test.p1; +DROP FUNCTION test.f1; +######################################################################### +# Testcase 3.2.12.1: INFORMATION_SCHEMA.TRIGGERS layout +######################################################################### +DESCRIBE information_schema.TRIGGERS; +Field Type Null Key Default Extra +TRIGGER_CATALOG varchar(512) YES NULL +TRIGGER_SCHEMA varchar(64) NO +TRIGGER_NAME varchar(64) NO +EVENT_MANIPULATION varchar(6) NO +EVENT_OBJECT_CATALOG varchar(512) YES NULL +EVENT_OBJECT_SCHEMA varchar(64) NO +EVENT_OBJECT_TABLE varchar(64) NO +ACTION_ORDER bigint(4) NO 0 +ACTION_CONDITION longtext YES NULL +ACTION_STATEMENT longtext NO NULL +ACTION_ORIENTATION varchar(9) NO +ACTION_TIMING varchar(6) NO +ACTION_REFERENCE_OLD_TABLE varchar(64) YES NULL +ACTION_REFERENCE_NEW_TABLE varchar(64) YES NULL +ACTION_REFERENCE_OLD_ROW varchar(3) NO +ACTION_REFERENCE_NEW_ROW varchar(3) NO +CREATED datetime YES NULL +SQL_MODE longtext NO NULL +DEFINER longtext NO NULL +SHOW CREATE TABLE information_schema.TRIGGERS; +Table Create Table +TRIGGERS CREATE TEMPORARY TABLE `TRIGGERS` ( + `TRIGGER_CATALOG` varchar(512) default NULL, + `TRIGGER_SCHEMA` varchar(64) NOT NULL default '', + `TRIGGER_NAME` varchar(64) NOT NULL default '', + `EVENT_MANIPULATION` varchar(6) NOT NULL default '', + `EVENT_OBJECT_CATALOG` varchar(512) default NULL, + `EVENT_OBJECT_SCHEMA` varchar(64) NOT NULL default '', + `EVENT_OBJECT_TABLE` varchar(64) NOT NULL default '', + `ACTION_ORDER` bigint(4) NOT NULL default '0', + `ACTION_CONDITION` longtext, + `ACTION_STATEMENT` longtext NOT NULL, + `ACTION_ORIENTATION` varchar(9) NOT NULL default '', + `ACTION_TIMING` varchar(6) NOT NULL default '', + `ACTION_REFERENCE_OLD_TABLE` varchar(64) default NULL, + `ACTION_REFERENCE_NEW_TABLE` varchar(64) default NULL, + `ACTION_REFERENCE_OLD_ROW` varchar(3) NOT NULL default '', + `ACTION_REFERENCE_NEW_ROW` varchar(3) NOT NULL default '', + `CREATED` datetime default NULL, + `SQL_MODE` longtext NOT NULL, + `DEFINER` longtext NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 +SHOW COLUMNS FROM information_schema.TRIGGERS; +Field Type Null Key Default Extra +TRIGGER_CATALOG varchar(512) YES NULL +TRIGGER_SCHEMA varchar(64) NO +TRIGGER_NAME varchar(64) NO +EVENT_MANIPULATION varchar(6) NO +EVENT_OBJECT_CATALOG varchar(512) YES NULL +EVENT_OBJECT_SCHEMA varchar(64) NO +EVENT_OBJECT_TABLE varchar(64) NO +ACTION_ORDER bigint(4) NO 0 +ACTION_CONDITION longtext YES NULL +ACTION_STATEMENT longtext NO NULL +ACTION_ORIENTATION varchar(9) NO +ACTION_TIMING varchar(6) NO +ACTION_REFERENCE_OLD_TABLE varchar(64) YES NULL +ACTION_REFERENCE_NEW_TABLE varchar(64) YES NULL +ACTION_REFERENCE_OLD_ROW varchar(3) NO +ACTION_REFERENCE_NEW_ROW varchar(3) NO +CREATED datetime YES NULL +SQL_MODE longtext NO NULL +DEFINER longtext NO 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; +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER +################################################################################## +# Testcase 3.2.18.2 + 3.2.18.3: INFORMATION_SCHEMA.TRIGGERS accessible information +################################################################################## +DROP DATABASE IF EXISTS db_datadict; +CREATE DATABASE db_datadict; +DROP USER 'testuser1'@'localhost'; +CREATE USER 'testuser1'@'localhost'; +DROP USER 'testuser2'@'localhost'; +CREATE USER 'testuser2'@'localhost'; +DROP USER 'testuser3'@'localhost'; +CREATE USER 'testuser3'@'localhost'; +DROP USER 'testuser4'@'localhost'; +CREATE USER 'testuser4'@'localhost'; +GRANT SUPER ON *.* TO 'testuser1'@'localhost'; +GRANT SUPER ON *.* TO 'testuser3'@'localhost'; +GRANT SUPER ON *.* TO 'testuser4'@'localhost'; +GRANT ALL ON db_datadict.* TO 'testuser1'@'localhost' WITH GRANT OPTION; +# Establish connection testuser1 (user=testuser1) +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'; +GRANT SELECT ON db_datadict.t1 TO 'testuser3'@'localhost'; +SELECT * FROM information_schema.triggers +WHERE trigger_name = 'trg1'; +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER +NULL db_datadict trg1 INSERT NULL db_datadict t1 0 NULL SET @test_before = 2, new.f1 = @test_before ROW BEFORE NULL NULL OLD NEW NULL testuser1@localhost +SHOW TRIGGERS FROM db_datadict; +Trigger Event Table Statement Timing Created sql_mode Definer +trg1 INSERT t1 SET @test_before = 2, new.f1 = @test_before BEFORE NULL testuser1@localhost +# Establish connection testuser2 (user=testuser2) +SHOW GRANTS FOR 'testuser2'@'localhost'; +# No SUPER Privilege --> no result for query +SELECT * FROM information_schema.triggers +WHERE trigger_name = 'trg1'; +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER +NULL db_datadict trg1 INSERT NULL db_datadict t1 0 NULL SET @test_before = 2, new.f1 = @test_before ROW BEFORE NULL NULL OLD NEW NULL testuser1@localhost +SHOW TRIGGERS FROM db_datadict; +Trigger Event Table Statement Timing Created sql_mode Definer +trg1 INSERT t1 SET @test_before = 2, new.f1 = @test_before BEFORE NULL testuser1@localhost +# Establish connection testuser3 (user=testuser3) +SHOW GRANTS FOR 'testuser3'@'localhost'; +# SUPER Privilege + SELECT Privilege on t1 --> result for query +SELECT * FROM information_schema.triggers +WHERE trigger_name = 'trg1'; +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER +NULL db_datadict trg1 INSERT NULL db_datadict t1 0 NULL SET @test_before = 2, new.f1 = @test_before ROW BEFORE NULL NULL OLD NEW NULL testuser1@localhost +SHOW TRIGGERS FROM db_datadict; +Trigger Event Table Statement Timing Created sql_mode Definer +trg1 INSERT t1 SET @test_before = 2, new.f1 = @test_before BEFORE NULL testuser1@localhost +# Establish connection testuser4 (user=testuser4) +SHOW GRANTS FOR 'testuser4'@'localhost'; +# SUPER Privilege + no SELECT Privilege on t1 --> no result for query +SELECT * FROM information_schema.triggers +WHERE trigger_name = 'trg1'; +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER +NULL db_datadict trg1 INSERT NULL db_datadict t1 0 NULL SET @test_before = 2, new.f1 = @test_before ROW BEFORE NULL NULL OLD NEW NULL testuser1@localhost +SHOW TRIGGERS FROM db_datadict; +Trigger Event Table Statement Timing Created sql_mode Definer +trg1 INSERT t1 SET @test_before = 2, new.f1 = @test_before BEFORE NULL testuser1@localhost +# Switch to connection default and close connections testuser1 - testuser4 +SELECT * FROM information_schema.triggers +WHERE trigger_name = 'trg1'; +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER +NULL db_datadict trg1 INSERT NULL db_datadict t1 0 NULL SET @test_before = 2, new.f1 = @test_before ROW BEFORE NULL NULL OLD NEW NULL testuser1@localhost +SHOW TRIGGERS FROM db_datadict; +Trigger Event Table Statement Timing Created sql_mode Definer +trg1 INSERT t1 SET @test_before = 2, new.f1 = @test_before BEFORE NULL testuser1@localhost +DROP USER 'testuser1'@'localhost'; +DROP USER 'testuser2'@'localhost'; +DROP USER 'testuser3'@'localhost'; +DROP USER 'testuser4'@'localhost'; +DROP DATABASE db_datadict; +######################################################################### +# 3.2.1.13+3.2.1.14+3.2.1.15: INFORMATION_SCHEMA.TRIGGERS modifications +######################################################################### +######################################################################## +# Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and +# DDL on INFORMATION_SCHEMA tables are not supported +######################################################################## +DROP DATABASE IF EXISTS db_datadict; +CREATE DATABASE db_datadict; +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; +INSERT INTO information_schema.triggers +SELECT * FROM information_schema.triggers; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +UPDATE information_schema.triggers SET trigger_schema = 'test' +WHERE table_name = 't1'; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +DELETE FROM information_schema.triggers WHERE trigger_name = 't1'; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +TRUNCATE information_schema.triggers; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +CREATE INDEX my_idx_on_triggers ON information_schema.triggers(trigger_schema); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +ALTER TABLE information_schema.triggers DROP PRIMARY KEY; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +ALTER TABLE information_schema.triggers ADD f1 INT; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +DROP TABLE information_schema.triggers; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +ALTER TABLE information_schema.triggers RENAME db_datadict.triggers; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +ALTER TABLE information_schema.triggers RENAME information_schema.xtriggers; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +DROP DATABASE db_datadict; diff --git a/mysql-test/suite/funcs_1/r/is_views_embedded.result b/mysql-test/suite/funcs_1/r/is_views_embedded.result new file mode 100644 index 00000000000..21f799fca79 --- /dev/null +++ b/mysql-test/suite/funcs_1/r/is_views_embedded.result @@ -0,0 +1,241 @@ +SHOW TABLES FROM information_schema LIKE 'VIEWS'; +Tables_in_information_schema (VIEWS) +VIEWS +####################################################################### +# Testcase 3.2.1.1: INFORMATION_SCHEMA tables can be queried via SELECT +####################################################################### +DROP VIEW IF EXISTS test.v1; +DROP PROCEDURE IF EXISTS test.p1; +DROP FUNCTION IF EXISTS test.f1; +CREATE VIEW test.v1 AS SELECT * FROM information_schema.VIEWS; +CREATE PROCEDURE test.p1() SELECT * FROM information_schema.VIEWS; +CREATE FUNCTION test.f1() returns BIGINT +BEGIN +DECLARE counter BIGINT DEFAULT NULL; +SELECT COUNT(*) INTO counter FROM information_schema.VIEWS; +RETURN counter; +END// +# Attention: The printing of the next result sets is disabled. +SELECT * FROM information_schema.VIEWS; +SELECT * FROM test.v1; +CALL test.p1; +SELECT test.f1(); +DROP VIEW test.v1; +DROP PROCEDURE test.p1; +DROP FUNCTION test.f1; +######################################################################### +# Testcase 3.2.13.1: INFORMATION_SCHEMA.VIEWS layout +######################################################################### +DESCRIBE information_schema.VIEWS; +Field Type Null Key Default Extra +TABLE_CATALOG varchar(512) YES NULL +TABLE_SCHEMA varchar(64) NO +TABLE_NAME varchar(64) NO +VIEW_DEFINITION longtext NO NULL +CHECK_OPTION varchar(8) NO +IS_UPDATABLE varchar(3) NO +DEFINER varchar(77) NO +SECURITY_TYPE varchar(7) NO +SHOW CREATE TABLE information_schema.VIEWS; +Table Create Table +VIEWS CREATE TEMPORARY TABLE `VIEWS` ( + `TABLE_CATALOG` varchar(512) default NULL, + `TABLE_SCHEMA` varchar(64) NOT NULL default '', + `TABLE_NAME` varchar(64) NOT NULL default '', + `VIEW_DEFINITION` longtext NOT NULL, + `CHECK_OPTION` varchar(8) NOT NULL default '', + `IS_UPDATABLE` varchar(3) NOT NULL default '', + `DEFINER` varchar(77) NOT NULL default '', + `SECURITY_TYPE` varchar(7) NOT NULL default '' +) ENGINE=MyISAM DEFAULT CHARSET=utf8 +SHOW COLUMNS FROM information_schema.VIEWS; +Field Type Null Key Default Extra +TABLE_CATALOG varchar(512) YES NULL +TABLE_SCHEMA varchar(64) NO +TABLE_NAME varchar(64) NO +VIEW_DEFINITION longtext NO NULL +CHECK_OPTION varchar(8) NO +IS_UPDATABLE varchar(3) NO +DEFINER varchar(77) NO +SECURITY_TYPE varchar(7) NO +SELECT table_catalog, table_schema, table_name +FROM information_schema.views WHERE table_catalog IS NOT NULL; +table_catalog table_schema table_name +################################################################################ +# Testcase 3.2.13.2 + 3.2.13.3: INFORMATION_SCHEMA.VIEWS accessible information +################################################################################ +DROP DATABASE IF EXISTS db_datadict; +CREATE DATABASE db_datadict; +DROP USER 'testuser1'@'localhost'; +CREATE USER 'testuser1'@'localhost'; +DROP USER 'testuser2'@'localhost'; +CREATE USER 'testuser2'@'localhost'; +DROP USER 'test_no_views'@'localhost'; +CREATE USER 'test_no_views'@'localhost'; +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'; +SELECT * FROM information_schema.views +WHERE table_schema = 'db_datadict' ORDER BY table_name; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE +NULL db_datadict v_granted_glob /* ALGORITHM=UNDEFINED */ select `db_datadict`.`t1`.`f2` AS `f2`,`db_datadict`.`t1`.`f3` AS `f3` from `db_datadict`.`t1` NONE YES root@localhost DEFINER +NULL db_datadict v_granted_to_1 /* ALGORITHM=UNDEFINED */ select `db_datadict`.`t1`.`f1` AS `f1`,`db_datadict`.`t1`.`f2` AS `f2`,`db_datadict`.`t1`.`f3` AS `f3` from `db_datadict`.`t1` NONE YES root@localhost DEFINER +# Establish connection testuser1 (user=testuser1) +SELECT * FROM information_schema.views +WHERE table_schema = 'db_datadict' ORDER BY table_name; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE +NULL db_datadict v_granted_glob NONE YES root@localhost DEFINER +NULL db_datadict v_granted_to_1 NONE YES root@localhost DEFINER +# Establish connection testuser2 (user=testuser2) +SELECT * FROM information_schema.views +WHERE table_schema = 'db_datadict' ORDER BY table_name; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE +NULL db_datadict v_granted_glob NONE YES root@localhost DEFINER +NULL db_datadict v_granted_to_1 NONE YES root@localhost DEFINER +# Establish connection test_no_views (user=test_no_views) +SELECT * FROM information_schema.views +WHERE table_schema = 'db_datadict' ORDER BY table_name; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE +NULL db_datadict v_granted_glob NONE YES root@localhost DEFINER +NULL db_datadict v_granted_to_1 NONE YES root@localhost DEFINER +# Switch to connection default and close all other connections +DROP USER 'testuser1'@'localhost'; +DROP USER 'testuser2'@'localhost'; +DROP USER 'test_no_views'@'localhost'; +DROP DATABASE db_datadict; +######################################################################### +# 3.2.1.13+3.2.1.14+3.2.1.15: INFORMATION_SCHEMA.VIEWS modifications +######################################################################### +DROP TABLE IF EXISTS test.t1_my_table; +DROP DATABASE IF EXISTS db_datadict; +CREATE DATABASE db_datadict; +CREATE TABLE test.t1_table (f1 BIGINT, f2 CHAR(10)) +DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci +ENGINE = <engine_type>; +DROP USER 'testuser1'@'localhost'; +CREATE USER 'testuser1'@'localhost'; +SELECT * FROM information_schema.views +WHERE table_name LIKE 't1_%'; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE +CREATE VIEW test.t1_view AS SELECT DISTINCT f1 FROM test.t1_table; +SELECT * FROM information_schema.views +WHERE table_name LIKE 't1_%'; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE +NULL test t1_view /* ALGORITHM=UNDEFINED */ select distinct `test`.`t1_table`.`f1` AS `f1` from `test`.`t1_table` NONE NO root@localhost DEFINER +SELECT table_name,definer FROM information_schema.views +WHERE table_name = 't1_view'; +table_name definer +t1_view root@localhost +ALTER DEFINER = 'testuser1'@'localhost' VIEW test.t1_view AS +SELECT DISTINCT f1 FROM test.t1_table; +SELECT table_name,definer,security_type FROM information_schema.views +WHERE table_name LIKE 't1_%'; +table_name definer security_type +t1_view testuser1@localhost DEFINER +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_%'; +table_name definer security_type +t1_view root@localhost INVOKER +SELECT table_schema,table_name FROM information_schema.views +WHERE table_name LIKE 't1_%' +ORDER BY table_schema,table_name; +table_schema table_name +test t1_view +RENAME TABLE test.t1_view TO db_datadict.t1_view; +ERROR HY000: Changing schema from 'test' to 'db_datadict' is not allowed. +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; +table_schema table_name +db_datadict t1_view +SELECT table_name FROM information_schema.views +WHERE table_name LIKE 't1_%' +ORDER BY table_name; +table_name +t1_view +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; +table_name +t1_viewx +SELECT table_name FROM information_schema.views +WHERE table_name LIKE 't1_%' +ORDER BY table_name; +table_name +t1_viewx +DROP VIEW db_datadict.t1_viewx; +SELECT table_name FROM information_schema.views +WHERE table_name LIKE 't1_%' +ORDER BY table_name; +table_name +CREATE VIEW db_datadict.t1_view AS SELECT * FROM test.t1_table; +SELECT table_name FROM information_schema.views +WHERE table_name LIKE 't1_%' +ORDER BY table_name; +table_name +t1_view +DROP TABLE test.t1_table; +SELECT table_name FROM information_schema.views +WHERE table_name LIKE 't1_%' +ORDER BY table_name; +table_name +t1_view +Warnings: +Warning 1356 View 'db_datadict.t1_view' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +CREATE TABLE test.t1_table (f1 BIGINT, f2 CHAR(10)) +DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci COMMENT = 'Initial Comment' +ENGINE = <engine_type>; +SELECT table_name FROM information_schema.views +WHERE table_name LIKE 't1_%' +ORDER BY table_name; +table_name +t1_view +DROP DATABASE db_datadict; +SELECT table_name FROM information_schema.views +WHERE table_name LIKE 't1_%' +ORDER BY table_name; +table_name +DROP USER 'testuser1'@'localhost'; +DROP TABLE test.t1_table; +######################################################################## +# Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and +# DDL on INFORMATION_SCHEMA table are not supported +######################################################################## +DROP DATABASE IF EXISTS db_datadict; +CREATE DATABASE db_datadict; +CREATE VIEW db_datadict.v1 AS SELECT 1; +INSERT INTO information_schema.views +SELECT * FROM information_schema.views; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +INSERT INTO information_schema.views(table_schema, table_name) +VALUES ('db2', 'v2'); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +UPDATE information_schema.views SET table_schema = 'test' +WHERE table_name = 't1'; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +DELETE FROM information_schema.views WHERE table_name = 't1'; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +TRUNCATE information_schema.views; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +CREATE INDEX my_idx_on_views ON information_schema.views(table_schema); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +ALTER TABLE information_schema.views DROP PRIMARY KEY; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +ALTER TABLE information_schema.views ADD f1 INT; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +DROP TABLE information_schema.views; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +ALTER TABLE information_schema.views RENAME db_datadict.views; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +ALTER TABLE information_schema.views RENAME information_schema.xviews; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +DROP DATABASE db_datadict; diff --git a/mysql-test/suite/funcs_1/r/memory_func_view.result b/mysql-test/suite/funcs_1/r/memory_func_view.result index 552b549a1a0..c2689a36801 100644 --- a/mysql-test/suite/funcs_1/r/memory_func_view.result +++ b/mysql-test/suite/funcs_1/r/memory_func_view.result @@ -1,7 +1,3 @@ - -! Attention: The file with the expected results suffers from -Bug#10713: mysqldump includes database in create view and referenced tables --------------------------------------------------------------------------------- DROP TABLE IF EXISTS t1_selects, t1_modes, t1_values; DROP VIEW IF EXISTS v1; CREATE TABLE t1_values @@ -9,7 +5,7 @@ CREATE TABLE t1_values id BIGINT AUTO_INCREMENT, select_id BIGINT, PRIMARY KEY(id) -) ENGINE = 'MEMORY' ; +) ENGINE = <engine_to_be_tested>; ALTER TABLE t1_values ADD my_char_30 CHAR(30); ALTER TABLE t1_values ADD my_varchar_1000 VARCHAR(1000); ALTER TABLE t1_values ADD my_binary_30 BINARY(30); @@ -39,10 +35,10 @@ my_bigint = -9223372036854775808, my_decimal = -9999999999999999999999999999999999.999999999999999999999999999999 , my_double = -1.7976931348623E+308; INSERT INTO t1_values SET -my_char_30 = '<--------30 characters------->', +my_char_30 = '<--------30 characters------->', my_varchar_1000 = CONCAT('<---------1000 characters', RPAD('',965,'-'),'--------->'), -my_binary_30 = '<--------30 characters------->', +my_binary_30 = '<--------30 characters------->', my_varbinary_1000 = CONCAT('<---------1000 characters', RPAD('',965,'-'),'--------->'), my_datetime = '9999-12-31 23:59:59', @@ -54,23 +50,23 @@ my_bigint = 9223372036854775807, my_decimal = +9999999999999999999999999999999999.999999999999999999999999999999 , my_double = 1.7976931348623E+308; INSERT INTO t1_values SET -my_char_30 = ' ---äÖüß@µ*$-- ', -my_varchar_1000 = ' ---äÖüß@µ*$-- ', -my_binary_30 = ' ---äÖüß@µ*$-- ', -my_varbinary_1000 = ' ---äÖüß@µ*$-- ', +my_char_30 = ' ---äÖüß@µ*$-- ', +my_varchar_1000 = ' ---äÖüß@µ*$-- ', +my_binary_30 = ' ---äÖüß@µ*$-- ', +my_varbinary_1000 = ' ---äÖüß@µ*$-- ', my_datetime = '2004-02-29 23:59:59', my_date = '2004-02-29', my_timestamp = '2004-02-29 23:59:59', my_time = '13:00:00', my_year = 2000, -my_bigint = 0, +my_bigint = 0, my_decimal = 0.0, my_double = 0; INSERT INTO t1_values SET -my_char_30 = '-1', -my_varchar_1000 = '-1', -my_binary_30 = '-1', -my_varbinary_1000 = '-1', +my_char_30 = '-1', +my_varchar_1000 = '-1', +my_binary_30 = '-1', +my_varbinary_1000 = '-1', my_datetime = '2005-06-28 10:00:00', my_date = '2005-06-28', my_timestamp = '2005-06-28 10:00:00', @@ -89,6 +85,9 @@ INSERT INTO t1_values SET select_id = @select_id, my_bigint = 4; INSERT INTO t1_values SET select_id = @select_id, my_bigint = -25; +##### 1.1.1. CAST --> BINARY +##### 1.1.2. CAST --> CHAR +##### 1.1.3. CAST --> DATE INSERT INTO t1_values SET select_id = @select_id, my_char_30 = '2005-06-27'; INSERT INTO t1_values SET select_id = @select_id, @@ -101,6 +100,7 @@ INSERT INTO t1_values SET select_id = @select_id, my_bigint = 20050627; INSERT INTO t1_values SET select_id = @select_id, my_double = +20.050627E+6; +##### 1.1.4. CAST --> DATETIME INSERT INTO t1_values SET select_id = @select_id, my_char_30 = '2005-06-27 17:58'; INSERT INTO t1_values SET select_id = @select_id, @@ -113,6 +113,7 @@ INSERT INTO t1_values SET select_id = @select_id, my_bigint = 200506271758; INSERT INTO t1_values SET select_id = @select_id, my_double = +0.0200506271758E+13; +##### 1.1.5. CAST --> TIME INSERT INTO t1_values SET select_id = @select_id, my_char_30 = '1 17:58'; INSERT INTO t1_values SET select_id = @select_id, @@ -123,10 +124,9 @@ INSERT INTO t1_values SET select_id = @select_id, my_varbinary_1000 = '1 17:58'; INSERT INTO t1_values SET select_id = @select_id, my_bigint = 1758; - -some statements disabled because of -Bug#12440: CAST(data type DOUBLE AS TIME) strange results --------------------------------------------------------------------------------- +INSERT INTO t1_values SET select_id = @select_id, +my_double = +1.758E+3; +##### 1.1.6. CAST --> DECIMAL INSERT INTO t1_values SET select_id = @select_id, my_char_30 = '-3333.3333'; INSERT INTO t1_values SET select_id = @select_id, @@ -135,51 +135,39 @@ INSERT INTO t1_values SET select_id = @select_id, my_binary_30 = '-3333.3333'; INSERT INTO t1_values SET select_id = @select_id, my_varbinary_1000 = '-3333.3333'; - -some statements disabled because of -Bug#13349: CAST(1.0E+300 TO DECIMAL) returns wrong result + diff little/big endian --------------------------------------------------------------------------------- +INSERT INTO t1_values SET select_id = @select_id, +my_double = -0.33333333E+4; +##### 1.1.7. CAST --> SIGNED INTEGER "Attention: CAST --> SIGNED INTEGER - The file with expected results suffers from - Bug#5083 Big integer values are inserted as negative into - decimal/string columns Bug#5913 Traditional mode: BIGINT range not correctly delimited - Both have the status: To be fixed later" --------------------------------------------------------------------------------- - -some statements disabled because of -Bug #13344: CAST(1E+300 TO signed int) on little endian CPU, wrong result + Status: To be fixed later" -------------------------------------------------------------------------------- +##### 1.1.8. CAST --> UNSIGNED INTEGER "Attention: CAST --> UNSIGNED INTEGER - The file with expected results suffers from Bug 5083 5913 9809" + The file with expected results suffers from Bug 5913" -------------------------------------------------------------------------------- some statements disabled because of -Bugs#8663: cant use bgint unsigned as input to cast +Bug#5913 Traditional mode: BIGINT range not correctly delimited -------------------------------------------------------------------------------- -SET @my_select = 'SELECT CONVERT(my_char_30 USING utf8), +SET @my_select = 'SELECT CONVERT(my_char_30 USING utf8), my_char_30, id FROM t1_values'; -SET @my_select = 'SELECT CONVERT(my_varchar_1000 USING utf8), +SET @my_select = 'SELECT CONVERT(my_varchar_1000 USING utf8), my_varchar_1000, id FROM t1_values'; -SET @my_select = 'SELECT CONVERT(my_binary_30 USING utf8), +SET @my_select = 'SELECT CONVERT(my_binary_30 USING utf8), my_binary_30, id FROM t1_values'; -SET @my_select = 'SELECT CONVERT(my_varbinary_1000 USING utf8), +SET @my_select = 'SELECT CONVERT(my_varbinary_1000 USING utf8), my_varbinary_1000, id FROM t1_values'; -SET @my_select = 'SELECT CONVERT(my_char_30 USING koi8r), +SET @my_select = 'SELECT CONVERT(my_char_30 USING koi8r), my_char_30, id FROM t1_values'; -SET @my_select = 'SELECT CONVERT(my_varchar_1000 USING koi8r), +SET @my_select = 'SELECT CONVERT(my_varchar_1000 USING koi8r), my_varchar_1000, id FROM t1_values'; -SET @my_select = 'SELECT CONVERT(my_binary_30 USING koi8r), +SET @my_select = 'SELECT CONVERT(my_binary_30 USING koi8r), my_binary_30, id FROM t1_values'; -SET @my_select = 'SELECT CONVERT(my_varbinary_1000 USING koi8r), +SET @my_select = 'SELECT CONVERT(my_varbinary_1000 USING koi8r), my_varbinary_1000, id FROM t1_values'; - -"Attention: IF(my_year IS NULL, ... - The file with expected results suffers from - Bug#11689. successful CREATE VIEW but SELECT on view fails." --------------------------------------------------------------------------------- SET @my_select = 'SELECT BIT_LENGTH(my_char_30), my_char_30, id FROM t1_values'; SET @my_select = 'SELECT BIT_LENGTH(my_varchar_1000), @@ -192,22 +180,20 @@ SET @my_select = 'SELECT INSTR(my_char_30, ''char''), my_char_30, id FROM t1_values'; SET @my_select = 'SELECT LCASE(my_varchar_1000), my_varchar_1000, id FROM t1_values'; -SET @my_select = +SET @my_select = 'SELECT LEFT(my_char_30, 2), my_char_30, id FROM t1_values'; -SET @my_select = +SET @my_select = 'SELECT LEFT(my_varchar_1000, 2), my_varchar_1000, id FROM t1_values'; -SET @my_select = +SET @my_select = 'SELECT LEFT(my_binary_30, 2), my_binary_30, id FROM t1_values'; -SET @my_select = +SET @my_select = 'SELECT LEFT(my_varbinary_1000, 2), my_varbinary_1000, id FROM t1_values'; - -"Attention: LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', <numeric column>) - The file with expected results suffers from Bug 10963 11728" - and the testcases with length = BIGINT or DOUBLE column are deactivated, -because there are 32/64 Bit differences --------------------------------------------------------------------------------- +SET @my_select = +'SELECT LEFT(''AaBbCcDdEeFfGgHhIiJjÄäÜüÖö'', my_bigint), my_bigint, id FROM t1_values'; SET @my_select = 'SELECT LEFT(''AaBbCcDdEeFfGgHhIiJjÄäÜüÖö'', my_decimal), my_decimal, id FROM t1_values'; +SET @my_select = +'SELECT LEFT(''AaBbCcDdEeFfGgHhIiJjÄäÜüÖö'', my_double), my_double, id FROM t1_values'; SET @my_select = 'SELECT LENGTH(my_char_30), my_char_30, id FROM t1_values'; SET @my_select = 'SELECT LENGTH(my_varchar_1000), @@ -216,8 +202,10 @@ SET @my_select = 'SELECT LENGTH(my_binary_30), my_binary_30, id FROM t1_values'; SET @my_select = 'SELECT LENGTH(my_varbinary_1000), my_varbinary_1000, id FROM t1_values'; -SET @my_select = -'SELECT LOAD_FILE(''../log/current_test''), id FROM t1_values'; +SET @my_select = +'SELECT LOAD_FILE(''<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/load_file.txt'') + AS my_col, + id FROM t1_values'; SET @my_select = 'SELECT LOCATE(''char'', my_char_30), my_char_30, id FROM t1_values'; SET @my_select = 'SELECT LOCATE(''char'', my_varchar_1000), @@ -299,19 +287,19 @@ SET sql_mode = ''; -------------------------------------------------------------------------------- CREATE VIEW v1 AS SELECT my_char_30, id FROM t1_values; SELECT my_char_30, id FROM t1_values -WHERE select_id = 187 OR select_id IS NULL; +WHERE select_id = 193 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 187 OR select_id IS NULL); +WHERE select_id = 193 OR select_id IS NULL) order by id; DROP VIEW v1; CREATE VIEW v1 AS SELECT CONCAT('A',my_char_30), my_char_30, id FROM t1_values; SELECT CONCAT('A',my_char_30), my_char_30, id FROM t1_values -WHERE select_id = 186 OR select_id IS NULL; +WHERE select_id = 192 OR select_id IS NULL order by id; CONCAT('A',my_char_30) my_char_30 id NULL NULL 1 A 2 @@ -323,7 +311,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select concat(_latin1'A',`t1_values`.`my_char_30`) AS `CONCAT('A',my_char_30)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 186 OR select_id IS NULL); +WHERE select_id = 192 OR select_id IS NULL) order by id; CONCAT('A',my_char_30) my_char_30 id NULL NULL 1 A 2 @@ -337,13 +325,13 @@ CREATE VIEW v1 AS SELECT LTRIM(my_varbinary_1000), my_varbinary_1000, id FROM t1_values; SELECT LTRIM(my_varbinary_1000), my_varbinary_1000, id FROM t1_values -WHERE select_id = 185 OR select_id IS NULL; +WHERE select_id = 191 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ltrim(`t1_values`.`my_varbinary_1000`) AS `LTRIM(my_varbinary_1000)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 185 OR select_id IS NULL); +WHERE select_id = 191 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -351,13 +339,13 @@ CREATE VIEW v1 AS SELECT LTRIM(my_binary_30), my_binary_30, id FROM t1_values; SELECT LTRIM(my_binary_30), my_binary_30, id FROM t1_values -WHERE select_id = 184 OR select_id IS NULL; +WHERE select_id = 190 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ltrim(`t1_values`.`my_binary_30`) AS `LTRIM(my_binary_30)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 184 OR select_id IS NULL); +WHERE select_id = 190 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -365,13 +353,13 @@ CREATE VIEW v1 AS SELECT LTRIM(my_varchar_1000), my_varchar_1000, id FROM t1_values; SELECT LTRIM(my_varchar_1000), my_varchar_1000, id FROM t1_values -WHERE select_id = 183 OR select_id IS NULL; +WHERE select_id = 189 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ltrim(`t1_values`.`my_varchar_1000`) AS `LTRIM(my_varchar_1000)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 183 OR select_id IS NULL); +WHERE select_id = 189 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -379,13 +367,13 @@ CREATE VIEW v1 AS SELECT LTRIM(my_char_30), my_char_30, id FROM t1_values; SELECT LTRIM(my_char_30), my_char_30, id FROM t1_values -WHERE select_id = 182 OR select_id IS NULL; +WHERE select_id = 188 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ltrim(`t1_values`.`my_char_30`) AS `LTRIM(my_char_30)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 182 OR select_id IS NULL); +WHERE select_id = 188 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -393,13 +381,13 @@ CREATE VIEW v1 AS SELECT LOWER(my_varbinary_1000), my_varbinary_1000, id FROM t1_values; SELECT LOWER(my_varbinary_1000), my_varbinary_1000, id FROM t1_values -WHERE select_id = 181 OR select_id IS NULL; +WHERE select_id = 187 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select lcase(`t1_values`.`my_varbinary_1000`) AS `LOWER(my_varbinary_1000)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 181 OR select_id IS NULL); +WHERE select_id = 187 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -407,13 +395,13 @@ CREATE VIEW v1 AS SELECT LOWER(my_binary_30), my_binary_30, id FROM t1_values; SELECT LOWER(my_binary_30), my_binary_30, id FROM t1_values -WHERE select_id = 180 OR select_id IS NULL; +WHERE select_id = 186 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select lcase(`t1_values`.`my_binary_30`) AS `LOWER(my_binary_30)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 180 OR select_id IS NULL); +WHERE select_id = 186 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -421,13 +409,13 @@ CREATE VIEW v1 AS SELECT LOWER(my_varchar_1000), my_varchar_1000, id FROM t1_values; SELECT LOWER(my_varchar_1000), my_varchar_1000, id FROM t1_values -WHERE select_id = 179 OR select_id IS NULL; +WHERE select_id = 185 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select lcase(`t1_values`.`my_varchar_1000`) AS `LOWER(my_varchar_1000)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 179 OR select_id IS NULL); +WHERE select_id = 185 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -435,13 +423,13 @@ CREATE VIEW v1 AS SELECT LOWER(my_char_30), my_char_30, id FROM t1_values; SELECT LOWER(my_char_30), my_char_30, id FROM t1_values -WHERE select_id = 178 OR select_id IS NULL; +WHERE select_id = 184 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select lcase(`t1_values`.`my_char_30`) AS `LOWER(my_char_30)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 178 OR select_id IS NULL); +WHERE select_id = 184 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -449,13 +437,13 @@ CREATE VIEW v1 AS SELECT LOCATE('-', ' - -ABC', my_decimal), my_decimal, id FROM t1_values; SELECT LOCATE('-', ' - -ABC', my_decimal), my_decimal, id FROM t1_values -WHERE select_id = 177 OR select_id IS NULL; +WHERE select_id = 183 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'-',_latin1' - -ABC',`t1_values`.`my_decimal`) AS `LOCATE('-', ' - -ABC', my_decimal)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 177 OR select_id IS NULL); +WHERE select_id = 183 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -463,13 +451,13 @@ CREATE VIEW v1 AS SELECT LOCATE('-', ' - -ABC', my_double), my_double, id FROM t1_values; SELECT LOCATE('-', ' - -ABC', my_double), my_double, id FROM t1_values -WHERE select_id = 176 OR select_id IS NULL; +WHERE select_id = 182 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'-',_latin1' - -ABC',`t1_values`.`my_double`) AS `LOCATE('-', ' - -ABC', my_double)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 176 OR select_id IS NULL); +WHERE select_id = 182 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -477,13 +465,13 @@ CREATE VIEW v1 AS SELECT LOCATE('-', ' - -ABC', my_bigint), my_bigint, id FROM t1_values; SELECT LOCATE('-', ' - -ABC', my_bigint), my_bigint, id FROM t1_values -WHERE select_id = 175 OR select_id IS NULL; +WHERE select_id = 181 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'-',_latin1' - -ABC',`t1_values`.`my_bigint`) AS `LOCATE('-', ' - -ABC', my_bigint)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 175 OR select_id IS NULL); +WHERE select_id = 181 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -491,13 +479,13 @@ CREATE VIEW v1 AS SELECT LOCATE('-', my_varbinary_1000, 3), my_varbinary_1000, id FROM t1_values; SELECT LOCATE('-', my_varbinary_1000, 3), my_varbinary_1000, id FROM t1_values -WHERE select_id = 174 OR select_id IS NULL; +WHERE select_id = 180 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'-',`t1_values`.`my_varbinary_1000`,3) AS `LOCATE('-', my_varbinary_1000, 3)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 174 OR select_id IS NULL); +WHERE select_id = 180 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -505,13 +493,13 @@ CREATE VIEW v1 AS SELECT LOCATE('-', my_binary_30, 3), my_binary_30, id FROM t1_values; SELECT LOCATE('-', my_binary_30, 3), my_binary_30, id FROM t1_values -WHERE select_id = 173 OR select_id IS NULL; +WHERE select_id = 179 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'-',`t1_values`.`my_binary_30`,3) AS `LOCATE('-', my_binary_30, 3)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 173 OR select_id IS NULL); +WHERE select_id = 179 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -519,13 +507,13 @@ CREATE VIEW v1 AS SELECT LOCATE('-', my_varchar_1000, 3), my_varchar_1000, id FROM t1_values; SELECT LOCATE('-', my_varchar_1000, 3), my_varchar_1000, id FROM t1_values -WHERE select_id = 172 OR select_id IS NULL; +WHERE select_id = 178 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'-',`t1_values`.`my_varchar_1000`,3) AS `LOCATE('-', my_varchar_1000, 3)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 172 OR select_id IS NULL); +WHERE select_id = 178 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -533,13 +521,13 @@ CREATE VIEW v1 AS SELECT LOCATE('-', my_char_30, 3), my_char_30, id FROM t1_values; SELECT LOCATE('-', my_char_30, 3), my_char_30, id FROM t1_values -WHERE select_id = 171 OR select_id IS NULL; +WHERE select_id = 177 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'-',`t1_values`.`my_char_30`,3) AS `LOCATE('-', my_char_30, 3)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 171 OR select_id IS NULL); +WHERE select_id = 177 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -547,13 +535,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_varbinary_1000, my_binary_30 ), my_varbinary_1000, my_binary_30 id FROM t1_values; SELECT LOCATE(my_varbinary_1000, my_binary_30 ), my_varbinary_1000, my_binary_30 id FROM t1_values -WHERE select_id = 170 OR select_id IS NULL; +WHERE select_id = 176 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_varbinary_1000`,`t1_values`.`my_binary_30`) AS `LOCATE(my_varbinary_1000, my_binary_30 )`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`my_binary_30` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 170 OR select_id IS NULL); +WHERE select_id = 176 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -561,13 +549,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_varbinary_1000, my_varchar_1000 ), my_varbinary_1000, my_varchar_1000 id FROM t1_values; SELECT LOCATE(my_varbinary_1000, my_varchar_1000 ), my_varbinary_1000, my_varchar_1000 id FROM t1_values -WHERE select_id = 169 OR select_id IS NULL; +WHERE select_id = 175 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_varbinary_1000`,`t1_values`.`my_varchar_1000`) AS `LOCATE(my_varbinary_1000, my_varchar_1000 )`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`my_varchar_1000` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 169 OR select_id IS NULL); +WHERE select_id = 175 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -575,13 +563,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_varbinary_1000, my_char_30 ), my_varbinary_1000, my_char_30 id FROM t1_values; SELECT LOCATE(my_varbinary_1000, my_char_30 ), my_varbinary_1000, my_char_30 id FROM t1_values -WHERE select_id = 168 OR select_id IS NULL; +WHERE select_id = 174 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_varbinary_1000`,`t1_values`.`my_char_30`) AS `LOCATE(my_varbinary_1000, my_char_30 )`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`my_char_30` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 168 OR select_id IS NULL); +WHERE select_id = 174 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -589,13 +577,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_varbinary_1000, my_varbinary_1000 ), my_varbinary_1000, id FROM t1_values; SELECT LOCATE(my_varbinary_1000, my_varbinary_1000 ), my_varbinary_1000, id FROM t1_values -WHERE select_id = 167 OR select_id IS NULL; +WHERE select_id = 173 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_varbinary_1000`,`t1_values`.`my_varbinary_1000`) AS `LOCATE(my_varbinary_1000, my_varbinary_1000 )`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 167 OR select_id IS NULL); +WHERE select_id = 173 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -603,13 +591,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_binary_30, my_varbinary_1000 ), my_binary_30, my_varbinary_1000 id FROM t1_values; SELECT LOCATE(my_binary_30, my_varbinary_1000 ), my_binary_30, my_varbinary_1000 id FROM t1_values -WHERE select_id = 166 OR select_id IS NULL; +WHERE select_id = 172 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_binary_30`,`t1_values`.`my_varbinary_1000`) AS `LOCATE(my_binary_30, my_varbinary_1000 )`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`my_varbinary_1000` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 166 OR select_id IS NULL); +WHERE select_id = 172 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -617,13 +605,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_binary_30, my_varchar_1000 ), my_binary_30, my_varchar_1000 id FROM t1_values; SELECT LOCATE(my_binary_30, my_varchar_1000 ), my_binary_30, my_varchar_1000 id FROM t1_values -WHERE select_id = 165 OR select_id IS NULL; +WHERE select_id = 171 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_binary_30`,`t1_values`.`my_varchar_1000`) AS `LOCATE(my_binary_30, my_varchar_1000 )`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`my_varchar_1000` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 165 OR select_id IS NULL); +WHERE select_id = 171 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -631,13 +619,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_binary_30, my_char_30 ), my_binary_30, my_char_30 id FROM t1_values; SELECT LOCATE(my_binary_30, my_char_30 ), my_binary_30, my_char_30 id FROM t1_values -WHERE select_id = 164 OR select_id IS NULL; +WHERE select_id = 170 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_binary_30`,`t1_values`.`my_char_30`) AS `LOCATE(my_binary_30, my_char_30 )`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`my_char_30` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 164 OR select_id IS NULL); +WHERE select_id = 170 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -645,13 +633,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_binary_30, my_binary_30 ), my_binary_30, id FROM t1_values; SELECT LOCATE(my_binary_30, my_binary_30 ), my_binary_30, id FROM t1_values -WHERE select_id = 163 OR select_id IS NULL; +WHERE select_id = 169 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_binary_30`,`t1_values`.`my_binary_30`) AS `LOCATE(my_binary_30, my_binary_30 )`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 163 OR select_id IS NULL); +WHERE select_id = 169 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -659,13 +647,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_varchar_1000, my_varbinary_1000 ), my_varchar_1000, my_varbinary_1000 id FROM t1_values; SELECT LOCATE(my_varchar_1000, my_varbinary_1000 ), my_varchar_1000, my_varbinary_1000 id FROM t1_values -WHERE select_id = 162 OR select_id IS NULL; +WHERE select_id = 168 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_varchar_1000`,`t1_values`.`my_varbinary_1000`) AS `LOCATE(my_varchar_1000, my_varbinary_1000 )`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`my_varbinary_1000` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 162 OR select_id IS NULL); +WHERE select_id = 168 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -673,13 +661,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_varchar_1000, my_binary_30 ), my_varchar_1000, my_binary_30 id FROM t1_values; SELECT LOCATE(my_varchar_1000, my_binary_30 ), my_varchar_1000, my_binary_30 id FROM t1_values -WHERE select_id = 161 OR select_id IS NULL; +WHERE select_id = 167 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_varchar_1000`,`t1_values`.`my_binary_30`) AS `LOCATE(my_varchar_1000, my_binary_30 )`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`my_binary_30` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 161 OR select_id IS NULL); +WHERE select_id = 167 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -687,13 +675,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_varchar_1000, my_char_30 ), my_varchar_1000, my_char_30 id FROM t1_values; SELECT LOCATE(my_varchar_1000, my_char_30 ), my_varchar_1000, my_char_30 id FROM t1_values -WHERE select_id = 160 OR select_id IS NULL; +WHERE select_id = 166 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_varchar_1000`,`t1_values`.`my_char_30`) AS `LOCATE(my_varchar_1000, my_char_30 )`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`my_char_30` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 160 OR select_id IS NULL); +WHERE select_id = 166 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -701,13 +689,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_varchar_1000, my_varchar_1000 ), my_varchar_1000, id FROM t1_values; SELECT LOCATE(my_varchar_1000, my_varchar_1000 ), my_varchar_1000, id FROM t1_values -WHERE select_id = 159 OR select_id IS NULL; +WHERE select_id = 165 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_varchar_1000`,`t1_values`.`my_varchar_1000`) AS `LOCATE(my_varchar_1000, my_varchar_1000 )`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 159 OR select_id IS NULL); +WHERE select_id = 165 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -715,13 +703,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_char_30, my_varbinary_1000 ), my_char_30, my_varbinary_1000 id FROM t1_values; SELECT LOCATE(my_char_30, my_varbinary_1000 ), my_char_30, my_varbinary_1000 id FROM t1_values -WHERE select_id = 158 OR select_id IS NULL; +WHERE select_id = 164 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_char_30`,`t1_values`.`my_varbinary_1000`) AS `LOCATE(my_char_30, my_varbinary_1000 )`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`my_varbinary_1000` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 158 OR select_id IS NULL); +WHERE select_id = 164 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -729,13 +717,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_char_30, my_binary_30 ), my_char_30, my_binary_30 id FROM t1_values; SELECT LOCATE(my_char_30, my_binary_30 ), my_char_30, my_binary_30 id FROM t1_values -WHERE select_id = 157 OR select_id IS NULL; +WHERE select_id = 163 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_char_30`,`t1_values`.`my_binary_30`) AS `LOCATE(my_char_30, my_binary_30 )`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`my_binary_30` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 157 OR select_id IS NULL); +WHERE select_id = 163 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -743,13 +731,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_char_30, my_varchar_1000 ), my_char_30, my_varchar_1000 id FROM t1_values; SELECT LOCATE(my_char_30, my_varchar_1000 ), my_char_30, my_varchar_1000 id FROM t1_values -WHERE select_id = 156 OR select_id IS NULL; +WHERE select_id = 162 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_char_30`,`t1_values`.`my_varchar_1000`) AS `LOCATE(my_char_30, my_varchar_1000 )`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`my_varchar_1000` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 156 OR select_id IS NULL); +WHERE select_id = 162 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -757,13 +745,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_char_30, my_char_30 ), my_char_30, id FROM t1_values; SELECT LOCATE(my_char_30, my_char_30 ), my_char_30, id FROM t1_values -WHERE select_id = 155 OR select_id IS NULL; +WHERE select_id = 161 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_char_30`,`t1_values`.`my_char_30`) AS `LOCATE(my_char_30, my_char_30 )`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 155 OR select_id IS NULL); +WHERE select_id = 161 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -771,13 +759,13 @@ CREATE VIEW v1 AS SELECT LOCATE('char', my_varbinary_1000), my_varbinary_1000, id FROM t1_values; SELECT LOCATE('char', my_varbinary_1000), my_varbinary_1000, id FROM t1_values -WHERE select_id = 154 OR select_id IS NULL; +WHERE select_id = 160 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'char',`t1_values`.`my_varbinary_1000`) AS `LOCATE('char', my_varbinary_1000)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 154 OR select_id IS NULL); +WHERE select_id = 160 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -785,13 +773,13 @@ CREATE VIEW v1 AS SELECT LOCATE('char', my_binary_30), my_binary_30, id FROM t1_values; SELECT LOCATE('char', my_binary_30), my_binary_30, id FROM t1_values -WHERE select_id = 153 OR select_id IS NULL; +WHERE select_id = 159 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'char',`t1_values`.`my_binary_30`) AS `LOCATE('char', my_binary_30)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 153 OR select_id IS NULL); +WHERE select_id = 159 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -799,13 +787,13 @@ CREATE VIEW v1 AS SELECT LOCATE('char', my_varchar_1000), my_varchar_1000, id FROM t1_values; SELECT LOCATE('char', my_varchar_1000), my_varchar_1000, id FROM t1_values -WHERE select_id = 152 OR select_id IS NULL; +WHERE select_id = 158 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'char',`t1_values`.`my_varchar_1000`) AS `LOCATE('char', my_varchar_1000)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 152 OR select_id IS NULL); +WHERE select_id = 158 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -813,46 +801,50 @@ CREATE VIEW v1 AS SELECT LOCATE('char', my_char_30), my_char_30, id FROM t1_values; SELECT LOCATE('char', my_char_30), my_char_30, id FROM t1_values -WHERE select_id = 151 OR select_id IS NULL; +WHERE select_id = 157 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'char',`t1_values`.`my_char_30`) AS `LOCATE('char', my_char_30)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 151 OR select_id IS NULL); +WHERE select_id = 157 OR select_id IS NULL) order by id; DROP VIEW v1; -CREATE VIEW v1 AS SELECT LOAD_FILE('../log/current_test'), id FROM t1_values; -SELECT LOAD_FILE('../log/current_test'), id FROM t1_values -WHERE select_id = 150 OR select_id IS NULL; -LOAD_FILE('../log/current_test') id -CURRENT_TEST: memory_func_view +CREATE VIEW v1 AS SELECT LOAD_FILE('<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/load_file.txt') + AS my_col, + id FROM t1_values; +SELECT LOAD_FILE('<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/load_file.txt') + AS my_col, + id FROM t1_values +WHERE select_id = 156 OR select_id IS NULL order by id; +my_col id +Here is content from load_file 1 -CURRENT_TEST: memory_func_view +Here is content from load_file 2 -CURRENT_TEST: memory_func_view +Here is content from load_file 3 -CURRENT_TEST: memory_func_view +Here is content from load_file 4 -CURRENT_TEST: memory_func_view +Here is content from load_file 5 SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select load_file(_latin1'../log/current_test') AS `LOAD_FILE('../log/current_test')`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select load_file(_latin1'<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/load_file.txt') AS `my_col`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 150 OR select_id IS NULL); -LOAD_FILE('../log/current_test') id -CURRENT_TEST: memory_func_view +WHERE select_id = 156 OR select_id IS NULL) order by id; +my_col id +Here is content from load_file 1 -CURRENT_TEST: memory_func_view +Here is content from load_file 2 -CURRENT_TEST: memory_func_view +Here is content from load_file 3 -CURRENT_TEST: memory_func_view +Here is content from load_file 4 -CURRENT_TEST: memory_func_view +Here is content from load_file 5 DROP VIEW v1; @@ -861,13 +853,13 @@ CREATE VIEW v1 AS SELECT LENGTH(my_varbinary_1000), my_varbinary_1000, id FROM t1_values; SELECT LENGTH(my_varbinary_1000), my_varbinary_1000, id FROM t1_values -WHERE select_id = 149 OR select_id IS NULL; +WHERE select_id = 155 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select length(`t1_values`.`my_varbinary_1000`) AS `LENGTH(my_varbinary_1000)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 149 OR select_id IS NULL); +WHERE select_id = 155 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -875,13 +867,13 @@ CREATE VIEW v1 AS SELECT LENGTH(my_binary_30), my_binary_30, id FROM t1_values; SELECT LENGTH(my_binary_30), my_binary_30, id FROM t1_values -WHERE select_id = 148 OR select_id IS NULL; +WHERE select_id = 154 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select length(`t1_values`.`my_binary_30`) AS `LENGTH(my_binary_30)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 148 OR select_id IS NULL); +WHERE select_id = 154 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -889,13 +881,13 @@ CREATE VIEW v1 AS SELECT LENGTH(my_varchar_1000), my_varchar_1000, id FROM t1_values; SELECT LENGTH(my_varchar_1000), my_varchar_1000, id FROM t1_values -WHERE select_id = 147 OR select_id IS NULL; +WHERE select_id = 153 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select length(`t1_values`.`my_varchar_1000`) AS `LENGTH(my_varchar_1000)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 147 OR select_id IS NULL); +WHERE select_id = 153 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -903,19 +895,49 @@ CREATE VIEW v1 AS SELECT LENGTH(my_char_30), my_char_30, id FROM t1_values; SELECT LENGTH(my_char_30), my_char_30, id FROM t1_values -WHERE select_id = 146 OR select_id IS NULL; +WHERE select_id = 152 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select length(`t1_values`.`my_char_30`) AS `LENGTH(my_char_30)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 146 OR select_id IS NULL); +WHERE select_id = 152 OR select_id IS NULL) order by id; +DROP VIEW v1; + + +CREATE VIEW v1 AS SELECT LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_double), my_double, id FROM t1_values; +SELECT LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_double), my_double, id FROM t1_values +WHERE select_id = 151 OR select_id IS NULL order by id; +LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_double) my_double id +NULL NULL 1 + -1.7976931348623e+308 2 +AaBbCcDdEeFfGgHhIiJjÄäÜüÖö 1.7976931348623e+308 3 + 0 4 + -1 5 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '-1.7976931348623e+308' +Warning 1292 Truncated incorrect INTEGER value: '1.7976931348623e+308' +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select left(_latin1'AaBbCcDdEeFfGgHhIiJjÄäÜüÖö',`t1_values`.`my_double`) AS `LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_double)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` +SELECT v1.* FROM v1 +WHERE v1.id IN (SELECT id FROM t1_values +WHERE select_id = 151 OR select_id IS NULL) order by id; +LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_double) my_double id +NULL NULL 1 + -1.7976931348623e+308 2 +AaBbCcDdEeFfGgHhIiJjÄäÜüÖö 1.7976931348623e+308 3 + 0 4 + -1 5 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '-1.7976931348623e+308' +Warning 1292 Truncated incorrect INTEGER value: '1.7976931348623e+308' DROP VIEW v1; CREATE VIEW v1 AS SELECT LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_decimal), my_decimal, id FROM t1_values; SELECT LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_decimal), my_decimal, id FROM t1_values -WHERE select_id = 145 OR select_id IS NULL; +WHERE select_id = 150 OR select_id IS NULL order by id; LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_decimal) my_decimal id NULL NULL 1 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -930,7 +952,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select left(_latin1'AaBbCcDdEeFfGgHhIiJjÄäÜüÖö',`t1_values`.`my_decimal`) AS `LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_decimal)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 145 OR select_id IS NULL); +WHERE select_id = 150 OR select_id IS NULL) order by id; LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_decimal) my_decimal id NULL NULL 1 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -943,9 +965,33 @@ Error 1292 Truncated incorrect DECIMAL value: '' DROP VIEW v1; +CREATE VIEW v1 AS SELECT LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_bigint), my_bigint, id FROM t1_values; +SELECT LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_bigint), my_bigint, id FROM t1_values +WHERE select_id = 149 OR select_id IS NULL order by id; +LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_bigint) my_bigint id +NULL NULL 1 + -9223372036854775808 2 +AaBbCcDdEeFfGgHhIiJjÄäÜüÖö 9223372036854775807 3 + 0 4 + -1 5 +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select left(_latin1'AaBbCcDdEeFfGgHhIiJjÄäÜüÖö',`t1_values`.`my_bigint`) AS `LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_bigint)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` +SELECT v1.* FROM v1 +WHERE v1.id IN (SELECT id FROM t1_values +WHERE select_id = 149 OR select_id IS NULL) order by id; +LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_bigint) my_bigint id +NULL NULL 1 + -9223372036854775808 2 +AaBbCcDdEeFfGgHhIiJjÄäÜüÖö 9223372036854775807 3 + 0 4 + -1 5 +DROP VIEW v1; + + CREATE VIEW v1 AS SELECT LEFT(my_varbinary_1000, 2), my_varbinary_1000, id FROM t1_values; SELECT LEFT(my_varbinary_1000, 2), my_varbinary_1000, id FROM t1_values -WHERE select_id = 144 OR select_id IS NULL; +WHERE select_id = 148 OR select_id IS NULL order by id; LEFT(my_varbinary_1000, 2) my_varbinary_1000 id NULL NULL 1 2 @@ -957,7 +1003,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select left(`t1_values`.`my_varbinary_1000`,2) AS `LEFT(my_varbinary_1000, 2)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 144 OR select_id IS NULL); +WHERE select_id = 148 OR select_id IS NULL) order by id; LEFT(my_varbinary_1000, 2) my_varbinary_1000 id NULL NULL 1 2 @@ -969,19 +1015,19 @@ DROP VIEW v1; CREATE VIEW v1 AS SELECT LEFT(my_binary_30, 2), my_binary_30, id FROM t1_values; SELECT LEFT(my_binary_30, 2), my_binary_30, id FROM t1_values -WHERE select_id = 143 OR select_id IS NULL; +WHERE select_id = 147 OR select_id IS NULL order by id; LEFT(my_binary_30, 2) my_binary_30 id NULL NULL 1 - + 2 <- <--------30 characters-------> 3 - - ---äÖüß@µ*$-- --1 -1 + - ---äÖüß@µ*$-- 4 +-1 -1 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select left(`t1_values`.`my_binary_30`,2) AS `LEFT(my_binary_30, 2)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 143 OR select_id IS NULL); +WHERE select_id = 147 OR select_id IS NULL) order by id; LEFT(my_binary_30, 2) my_binary_30 id NULL NULL 1 @@ -993,7 +1039,7 @@ DROP VIEW v1; CREATE VIEW v1 AS SELECT LEFT(my_varchar_1000, 2), my_varchar_1000, id FROM t1_values; SELECT LEFT(my_varchar_1000, 2), my_varchar_1000, id FROM t1_values -WHERE select_id = 142 OR select_id IS NULL; +WHERE select_id = 146 OR select_id IS NULL order by id; LEFT(my_varchar_1000, 2) my_varchar_1000 id NULL NULL 1 2 @@ -1005,7 +1051,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select left(`t1_values`.`my_varchar_1000`,2) AS `LEFT(my_varchar_1000, 2)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 142 OR select_id IS NULL); +WHERE select_id = 146 OR select_id IS NULL) order by id; LEFT(my_varchar_1000, 2) my_varchar_1000 id NULL NULL 1 2 @@ -1017,7 +1063,7 @@ DROP VIEW v1; CREATE VIEW v1 AS SELECT LEFT(my_char_30, 2), my_char_30, id FROM t1_values; SELECT LEFT(my_char_30, 2), my_char_30, id FROM t1_values -WHERE select_id = 141 OR select_id IS NULL; +WHERE select_id = 145 OR select_id IS NULL order by id; LEFT(my_char_30, 2) my_char_30 id NULL NULL 1 2 @@ -1029,7 +1075,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select left(`t1_values`.`my_char_30`,2) AS `LEFT(my_char_30, 2)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 141 OR select_id IS NULL); +WHERE select_id = 145 OR select_id IS NULL) order by id; LEFT(my_char_30, 2) my_char_30 id NULL NULL 1 2 @@ -1043,13 +1089,13 @@ CREATE VIEW v1 AS SELECT LCASE(my_varchar_1000), my_varchar_1000, id FROM t1_values; SELECT LCASE(my_varchar_1000), my_varchar_1000, id FROM t1_values -WHERE select_id = 140 OR select_id IS NULL; +WHERE select_id = 144 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select lcase(`t1_values`.`my_varchar_1000`) AS `LCASE(my_varchar_1000)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 140 OR select_id IS NULL); +WHERE select_id = 144 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -1057,13 +1103,13 @@ CREATE VIEW v1 AS SELECT INSTR(my_char_30, 'char'), my_char_30, id FROM t1_values; SELECT INSTR(my_char_30, 'char'), my_char_30, id FROM t1_values -WHERE select_id = 139 OR select_id IS NULL; +WHERE select_id = 143 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'char',`t1_values`.`my_char_30`) AS `INSTR(my_char_30, 'char')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 139 OR select_id IS NULL); +WHERE select_id = 143 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -1071,7 +1117,7 @@ CREATE VIEW v1 AS SELECT BIT_LENGTH(my_varbinary_1000), my_varbinary_1000, id FROM t1_values; SELECT BIT_LENGTH(my_varbinary_1000), my_varbinary_1000, id FROM t1_values -WHERE select_id = 138 OR select_id IS NULL; +WHERE select_id = 142 OR select_id IS NULL order by id; BIT_LENGTH(my_varbinary_1000) my_varbinary_1000 id NULL NULL 1 0 2 @@ -1083,7 +1129,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select bit_length(`t1_values`.`my_varbinary_1000`) AS `BIT_LENGTH(my_varbinary_1000)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 138 OR select_id IS NULL); +WHERE select_id = 142 OR select_id IS NULL) order by id; BIT_LENGTH(my_varbinary_1000) my_varbinary_1000 id NULL NULL 1 0 2 @@ -1097,19 +1143,19 @@ CREATE VIEW v1 AS SELECT BIT_LENGTH(my_binary_30), my_binary_30, id FROM t1_values; SELECT BIT_LENGTH(my_binary_30), my_binary_30, id FROM t1_values -WHERE select_id = 137 OR select_id IS NULL; +WHERE select_id = 141 OR select_id IS NULL order by id; BIT_LENGTH(my_binary_30) my_binary_30 id NULL NULL 1 -240 +240 2 240 <--------30 characters-------> 3 -240 ---äÖüß@µ*$-- -240 -1 +240 ---äÖüß@µ*$-- 4 +240 -1 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select bit_length(`t1_values`.`my_binary_30`) AS `BIT_LENGTH(my_binary_30)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 137 OR select_id IS NULL); +WHERE select_id = 141 OR select_id IS NULL) order by id; BIT_LENGTH(my_binary_30) my_binary_30 id NULL NULL 1 240 @@ -1123,7 +1169,7 @@ CREATE VIEW v1 AS SELECT BIT_LENGTH(my_varchar_1000), my_varchar_1000, id FROM t1_values; SELECT BIT_LENGTH(my_varchar_1000), my_varchar_1000, id FROM t1_values -WHERE select_id = 136 OR select_id IS NULL; +WHERE select_id = 140 OR select_id IS NULL order by id; BIT_LENGTH(my_varchar_1000) my_varchar_1000 id NULL NULL 1 0 2 @@ -1135,7 +1181,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select bit_length(`t1_values`.`my_varchar_1000`) AS `BIT_LENGTH(my_varchar_1000)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 136 OR select_id IS NULL); +WHERE select_id = 140 OR select_id IS NULL) order by id; BIT_LENGTH(my_varchar_1000) my_varchar_1000 id NULL NULL 1 0 2 @@ -1149,7 +1195,7 @@ CREATE VIEW v1 AS SELECT BIT_LENGTH(my_char_30), my_char_30, id FROM t1_values; SELECT BIT_LENGTH(my_char_30), my_char_30, id FROM t1_values -WHERE select_id = 135 OR select_id IS NULL; +WHERE select_id = 139 OR select_id IS NULL order by id; BIT_LENGTH(my_char_30) my_char_30 id NULL NULL 1 0 2 @@ -1161,7 +1207,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select bit_length(`t1_values`.`my_char_30`) AS `BIT_LENGTH(my_char_30)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 135 OR select_id IS NULL); +WHERE select_id = 139 OR select_id IS NULL) order by id; BIT_LENGTH(my_char_30) my_char_30 id NULL NULL 1 0 2 @@ -1175,7 +1221,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_year,'IS_NULL'), my_year, id FROM t1_values; SELECT IFNULL(my_year,'IS_NULL'), my_year, id FROM t1_values -WHERE select_id = 134 OR select_id IS NULL; +WHERE select_id = 138 OR select_id IS NULL order by id; IFNULL(my_year,'IS_NULL') my_year id IS_NULL NULL 1 1901 1901 2 @@ -1187,7 +1233,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_year`,_latin1'IS_NULL') AS `IFNULL(my_year,'IS_NULL')`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 134 OR select_id IS NULL); +WHERE select_id = 138 OR select_id IS NULL) order by id; IFNULL(my_year,'IS_NULL') my_year id IS_NULL NULL 1 1901 1901 2 @@ -1201,7 +1247,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_time,'IS_NULL'), my_time, id FROM t1_values; SELECT IFNULL(my_time,'IS_NULL'), my_time, id FROM t1_values -WHERE select_id = 133 OR select_id IS NULL; +WHERE select_id = 137 OR select_id IS NULL order by id; IFNULL(my_time,'IS_NULL') my_time id IS_NULL NULL 1 -838:59:59 -838:59:59 2 @@ -1213,7 +1259,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_time`,_latin1'IS_NULL') AS `IFNULL(my_time,'IS_NULL')`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 133 OR select_id IS NULL); +WHERE select_id = 137 OR select_id IS NULL) order by id; IFNULL(my_time,'IS_NULL') my_time id IS_NULL NULL 1 -838:59:59 -838:59:59 2 @@ -1227,7 +1273,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_timestamp,'IS_NULL'), my_timestamp, id FROM t1_values; SELECT IFNULL(my_timestamp,'IS_NULL'), my_timestamp, id FROM t1_values -WHERE select_id = 132 OR select_id IS NULL; +WHERE select_id = 136 OR select_id IS NULL order by id; IFNULL(my_timestamp,'IS_NULL') my_timestamp id 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1970-01-01 03:00:01 1970-01-01 03:00:01 2 @@ -1239,7 +1285,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_timestamp`,_latin1'IS_NULL') AS `IFNULL(my_timestamp,'IS_NULL')`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 132 OR select_id IS NULL); +WHERE select_id = 136 OR select_id IS NULL) order by id; IFNULL(my_timestamp,'IS_NULL') my_timestamp id 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1970-01-01 03:00:01 1970-01-01 03:00:01 2 @@ -1253,7 +1299,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_date,'IS_NULL'), my_date, id FROM t1_values; SELECT IFNULL(my_date,'IS_NULL'), my_date, id FROM t1_values -WHERE select_id = 131 OR select_id IS NULL; +WHERE select_id = 135 OR select_id IS NULL order by id; IFNULL(my_date,'IS_NULL') my_date id IS_NULL NULL 1 0001-01-01 0001-01-01 2 @@ -1265,7 +1311,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_date`,_latin1'IS_NULL') AS `IFNULL(my_date,'IS_NULL')`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 131 OR select_id IS NULL); +WHERE select_id = 135 OR select_id IS NULL) order by id; IFNULL(my_date,'IS_NULL') my_date id IS_NULL NULL 1 0001-01-01 0001-01-01 2 @@ -1279,7 +1325,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_datetime,'IS_NULL'), my_datetime, id FROM t1_values; SELECT IFNULL(my_datetime,'IS_NULL'), my_datetime, id FROM t1_values -WHERE select_id = 130 OR select_id IS NULL; +WHERE select_id = 134 OR select_id IS NULL order by id; IFNULL(my_datetime,'IS_NULL') my_datetime id IS_NULL NULL 1 0001-01-01 00:00:00 0001-01-01 00:00:00 2 @@ -1291,7 +1337,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_datetime`,_latin1'IS_NULL') AS `IFNULL(my_datetime,'IS_NULL')`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 130 OR select_id IS NULL); +WHERE select_id = 134 OR select_id IS NULL) order by id; IFNULL(my_datetime,'IS_NULL') my_datetime id IS_NULL NULL 1 0001-01-01 00:00:00 0001-01-01 00:00:00 2 @@ -1305,7 +1351,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_double,'IS_NULL'), my_double, id FROM t1_values; SELECT IFNULL(my_double,'IS_NULL'), my_double, id FROM t1_values -WHERE select_id = 129 OR select_id IS NULL; +WHERE select_id = 133 OR select_id IS NULL order by id; IFNULL(my_double,'IS_NULL') my_double id IS_NULL NULL 1 -1.7976931348623e+308 -1.7976931348623e+308 2 @@ -1317,7 +1363,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_double`,_latin1'IS_NULL') AS `IFNULL(my_double,'IS_NULL')`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 129 OR select_id IS NULL); +WHERE select_id = 133 OR select_id IS NULL) order by id; IFNULL(my_double,'IS_NULL') my_double id IS_NULL NULL 1 -1.7976931348623e+308 -1.7976931348623e+308 2 @@ -1331,7 +1377,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_decimal,'IS_NULL'), my_decimal, id FROM t1_values; SELECT IFNULL(my_decimal,'IS_NULL'), my_decimal, id FROM t1_values -WHERE select_id = 128 OR select_id IS NULL; +WHERE select_id = 132 OR select_id IS NULL order by id; IFNULL(my_decimal,'IS_NULL') my_decimal id IS_NULL NULL 1 -9999999999999999999999999999999999.999999999999999999999999999999 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -1343,7 +1389,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_decimal`,_latin1'IS_NULL') AS `IFNULL(my_decimal,'IS_NULL')`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 128 OR select_id IS NULL); +WHERE select_id = 132 OR select_id IS NULL) order by id; IFNULL(my_decimal,'IS_NULL') my_decimal id IS_NULL NULL 1 -9999999999999999999999999999999999.999999999999999999999999999999 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -1357,7 +1403,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_bigint,'IS_NULL'), my_bigint, id FROM t1_values; SELECT IFNULL(my_bigint,'IS_NULL'), my_bigint, id FROM t1_values -WHERE select_id = 127 OR select_id IS NULL; +WHERE select_id = 131 OR select_id IS NULL order by id; IFNULL(my_bigint,'IS_NULL') my_bigint id IS_NULL NULL 1 -9223372036854775808 -9223372036854775808 2 @@ -1369,7 +1415,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_bigint`,_latin1'IS_NULL') AS `IFNULL(my_bigint,'IS_NULL')`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 127 OR select_id IS NULL); +WHERE select_id = 131 OR select_id IS NULL) order by id; IFNULL(my_bigint,'IS_NULL') my_bigint id IS_NULL NULL 1 -9223372036854775808 -9223372036854775808 2 @@ -1383,7 +1429,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_varbinary_1000,'IS_NULL'), my_varbinary_1000, id FROM t1_values; SELECT IFNULL(my_varbinary_1000,'IS_NULL'), my_varbinary_1000, id FROM t1_values -WHERE select_id = 126 OR select_id IS NULL; +WHERE select_id = 130 OR select_id IS NULL order by id; IFNULL(my_varbinary_1000,'IS_NULL') my_varbinary_1000 id IS_NULL NULL 1 2 @@ -1395,7 +1441,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_varbinary_1000`,_latin1'IS_NULL') AS `IFNULL(my_varbinary_1000,'IS_NULL')`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 126 OR select_id IS NULL); +WHERE select_id = 130 OR select_id IS NULL) order by id; IFNULL(my_varbinary_1000,'IS_NULL') my_varbinary_1000 id IS_NULL NULL 1 2 @@ -1409,19 +1455,19 @@ CREATE VIEW v1 AS SELECT IFNULL(my_binary_30,'IS_NULL'), my_binary_30, id FROM t1_values; SELECT IFNULL(my_binary_30,'IS_NULL'), my_binary_30, id FROM t1_values -WHERE select_id = 125 OR select_id IS NULL; +WHERE select_id = 129 OR select_id IS NULL order by id; IFNULL(my_binary_30,'IS_NULL') my_binary_30 id IS_NULL NULL 1 - + 2 <--------30 characters-------> <--------30 characters-------> 3 - ---äÖüß@µ*$-- --1 + ---äÖüß@µ*$-- ---äÖüß@µ*$-- 4 +-1 -1 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_binary_30`,_latin1'IS_NULL') AS `IFNULL(my_binary_30,'IS_NULL')`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 125 OR select_id IS NULL); +WHERE select_id = 129 OR select_id IS NULL) order by id; IFNULL(my_binary_30,'IS_NULL') my_binary_30 id IS_NULL NULL 1 @@ -1435,7 +1481,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_varchar_1000,'IS_NULL'), my_varchar_1000, id FROM t1_values; SELECT IFNULL(my_varchar_1000,'IS_NULL'), my_varchar_1000, id FROM t1_values -WHERE select_id = 124 OR select_id IS NULL; +WHERE select_id = 128 OR select_id IS NULL order by id; IFNULL(my_varchar_1000,'IS_NULL') my_varchar_1000 id IS_NULL NULL 1 2 @@ -1447,7 +1493,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_varchar_1000`,_latin1'IS_NULL') AS `IFNULL(my_varchar_1000,'IS_NULL')`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 124 OR select_id IS NULL); +WHERE select_id = 128 OR select_id IS NULL) order by id; IFNULL(my_varchar_1000,'IS_NULL') my_varchar_1000 id IS_NULL NULL 1 2 @@ -1461,7 +1507,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_char_30,'IS_NULL'), my_char_30, id FROM t1_values; SELECT IFNULL(my_char_30,'IS_NULL'), my_char_30, id FROM t1_values -WHERE select_id = 123 OR select_id IS NULL; +WHERE select_id = 127 OR select_id IS NULL order by id; IFNULL(my_char_30,'IS_NULL') my_char_30 id IS_NULL NULL 1 2 @@ -1473,7 +1519,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_char_30`,_latin1'IS_NULL') AS `IFNULL(my_char_30,'IS_NULL')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 123 OR select_id IS NULL); +WHERE select_id = 127 OR select_id IS NULL) order by id; IFNULL(my_char_30,'IS_NULL') my_char_30 id IS_NULL NULL 1 2 @@ -1487,7 +1533,7 @@ CREATE VIEW v1 AS SELECT IF(my_year IS NULL, 'IS NULL', 'IS NOT NULL'), my_year, id FROM t1_values; SELECT IF(my_year IS NULL, 'IS NULL', 'IS NOT NULL'), my_year, id FROM t1_values -WHERE select_id = 122 OR select_id IS NULL; +WHERE select_id = 126 OR select_id IS NULL order by id; IF(my_year IS NULL, 'IS NULL', 'IS NOT NULL') my_year id IS NULL NULL 1 @@ -1501,7 +1547,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 122 OR select_id IS NULL); +WHERE select_id = 126 OR select_id IS NULL) order by id; IF(my_year IS NULL, 'IS NULL', 'IS NOT NULL') my_year id IS NULL NULL 1 @@ -1516,7 +1562,7 @@ CREATE VIEW v1 AS SELECT IF(my_time IS NULL, 'IS NULL', 'IS NOT NULL'), my_time, id FROM t1_values; SELECT IF(my_time IS NULL, 'IS NULL', 'IS NOT NULL'), my_time, id FROM t1_values -WHERE select_id = 121 OR select_id IS NULL; +WHERE select_id = 125 OR select_id IS NULL order by id; IF(my_time IS NULL, 'IS NULL', 'IS NOT NULL') my_time id IS NULL NULL 1 @@ -1530,7 +1576,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 121 OR select_id IS NULL); +WHERE select_id = 125 OR select_id IS NULL) order by id; IF(my_time IS NULL, 'IS NULL', 'IS NOT NULL') my_time id IS NULL NULL 1 @@ -1545,7 +1591,7 @@ CREATE VIEW v1 AS SELECT IF(my_timestamp IS NULL, 'IS NULL', 'IS NOT NULL'), my_timestamp, id FROM t1_values; SELECT IF(my_timestamp IS NULL, 'IS NULL', 'IS NOT NULL'), my_timestamp, id FROM t1_values -WHERE select_id = 120 OR select_id IS NULL; +WHERE select_id = 124 OR select_id IS NULL order by id; IF(my_timestamp IS NULL, 'IS NULL', 'IS NOT NULL') my_timestamp id IS NOT NULL 0000-00-00 00:00:00 1 @@ -1559,7 +1605,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 120 OR select_id IS NULL); +WHERE select_id = 124 OR select_id IS NULL) order by id; IF(my_timestamp IS NULL, 'IS NULL', 'IS NOT NULL') my_timestamp id IS NOT NULL 0000-00-00 00:00:00 1 @@ -1574,7 +1620,7 @@ CREATE VIEW v1 AS SELECT IF(my_date IS NULL, 'IS NULL', 'IS NOT NULL'), my_date, id FROM t1_values; SELECT IF(my_date IS NULL, 'IS NULL', 'IS NOT NULL'), my_date, id FROM t1_values -WHERE select_id = 119 OR select_id IS NULL; +WHERE select_id = 123 OR select_id IS NULL order by id; IF(my_date IS NULL, 'IS NULL', 'IS NOT NULL') my_date id IS NULL NULL 1 @@ -1588,7 +1634,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 119 OR select_id IS NULL); +WHERE select_id = 123 OR select_id IS NULL) order by id; IF(my_date IS NULL, 'IS NULL', 'IS NOT NULL') my_date id IS NULL NULL 1 @@ -1603,7 +1649,7 @@ CREATE VIEW v1 AS SELECT IF(my_datetime IS NULL, 'IS NULL', 'IS NOT NULL'), my_datetime, id FROM t1_values; SELECT IF(my_datetime IS NULL, 'IS NULL', 'IS NOT NULL'), my_datetime, id FROM t1_values -WHERE select_id = 118 OR select_id IS NULL; +WHERE select_id = 122 OR select_id IS NULL order by id; IF(my_datetime IS NULL, 'IS NULL', 'IS NOT NULL') my_datetime id IS NULL NULL 1 @@ -1617,7 +1663,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 118 OR select_id IS NULL); +WHERE select_id = 122 OR select_id IS NULL) order by id; IF(my_datetime IS NULL, 'IS NULL', 'IS NOT NULL') my_datetime id IS NULL NULL 1 @@ -1632,7 +1678,7 @@ CREATE VIEW v1 AS SELECT IF(my_double IS NULL, 'IS NULL', 'IS NOT NULL'), my_double, id FROM t1_values; SELECT IF(my_double IS NULL, 'IS NULL', 'IS NOT NULL'), my_double, id FROM t1_values -WHERE select_id = 117 OR select_id IS NULL; +WHERE select_id = 121 OR select_id IS NULL order by id; IF(my_double IS NULL, 'IS NULL', 'IS NOT NULL') my_double id IS NULL NULL 1 @@ -1646,7 +1692,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 117 OR select_id IS NULL); +WHERE select_id = 121 OR select_id IS NULL) order by id; IF(my_double IS NULL, 'IS NULL', 'IS NOT NULL') my_double id IS NULL NULL 1 @@ -1661,7 +1707,7 @@ CREATE VIEW v1 AS SELECT IF(my_decimal IS NULL, 'IS NULL', 'IS NOT NULL'), my_decimal, id FROM t1_values; SELECT IF(my_decimal IS NULL, 'IS NULL', 'IS NOT NULL'), my_decimal, id FROM t1_values -WHERE select_id = 116 OR select_id IS NULL; +WHERE select_id = 120 OR select_id IS NULL order by id; IF(my_decimal IS NULL, 'IS NULL', 'IS NOT NULL') my_decimal id IS NULL NULL 1 @@ -1675,7 +1721,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 116 OR select_id IS NULL); +WHERE select_id = 120 OR select_id IS NULL) order by id; IF(my_decimal IS NULL, 'IS NULL', 'IS NOT NULL') my_decimal id IS NULL NULL 1 @@ -1690,7 +1736,7 @@ CREATE VIEW v1 AS SELECT IF(my_bigint IS NULL, 'IS NULL', 'IS NOT NULL'), my_bigint, id FROM t1_values; SELECT IF(my_bigint IS NULL, 'IS NULL', 'IS NOT NULL'), my_bigint, id FROM t1_values -WHERE select_id = 115 OR select_id IS NULL; +WHERE select_id = 119 OR select_id IS NULL order by id; IF(my_bigint IS NULL, 'IS NULL', 'IS NOT NULL') my_bigint id IS NULL NULL 1 @@ -1704,7 +1750,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 115 OR select_id IS NULL); +WHERE select_id = 119 OR select_id IS NULL) order by id; IF(my_bigint IS NULL, 'IS NULL', 'IS NOT NULL') my_bigint id IS NULL NULL 1 @@ -1719,7 +1765,7 @@ CREATE VIEW v1 AS SELECT IF(my_varbinary_1000 IS NULL, 'IS NULL', 'IS NOT NULL'), my_varbinary_1000, id FROM t1_values; SELECT IF(my_varbinary_1000 IS NULL, 'IS NULL', 'IS NOT NULL'), my_varbinary_1000, id FROM t1_values -WHERE select_id = 114 OR select_id IS NULL; +WHERE select_id = 118 OR select_id IS NULL order by id; IF(my_varbinary_1000 IS NULL, 'IS NULL', 'IS NOT NULL') my_varbinary_1000 id IS NULL NULL 1 @@ -1733,7 +1779,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 114 OR select_id IS NULL); +WHERE select_id = 118 OR select_id IS NULL) order by id; IF(my_varbinary_1000 IS NULL, 'IS NULL', 'IS NOT NULL') my_varbinary_1000 id IS NULL NULL 1 @@ -1748,21 +1794,21 @@ CREATE VIEW v1 AS SELECT IF(my_binary_30 IS NULL, 'IS NULL', 'IS NOT NULL'), my_binary_30, id FROM t1_values; SELECT IF(my_binary_30 IS NULL, 'IS NULL', 'IS NOT NULL'), my_binary_30, id FROM t1_values -WHERE select_id = 113 OR select_id IS NULL; +WHERE select_id = 117 OR select_id IS NULL order by id; IF(my_binary_30 IS NULL, 'IS NULL', 'IS NOT NULL') my_binary_30 id IS NULL NULL 1 -IS NOT NULL +IS NOT NULL 2 IS NOT NULL <--------30 characters-------> 3 -IS NOT NULL ---äÖüß@µ*$-- -IS NOT NULL -1 +IS NOT NULL ---äÖüß@µ*$-- 4 +IS NOT NULL -1 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_binary_30`),_latin1'IS NULL',_latin1'IS NOT NULL') AS `IF(my_binary_30 IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 113 OR select_id IS NULL); +WHERE select_id = 117 OR select_id IS NULL) order by id; IF(my_binary_30 IS NULL, 'IS NULL', 'IS NOT NULL') my_binary_30 id IS NULL NULL 1 @@ -1777,7 +1823,7 @@ CREATE VIEW v1 AS SELECT IF(my_varchar_1000 IS NULL, 'IS NULL', 'IS NOT NULL'), my_varchar_1000, id FROM t1_values; SELECT IF(my_varchar_1000 IS NULL, 'IS NULL', 'IS NOT NULL'), my_varchar_1000, id FROM t1_values -WHERE select_id = 112 OR select_id IS NULL; +WHERE select_id = 116 OR select_id IS NULL order by id; IF(my_varchar_1000 IS NULL, 'IS NULL', 'IS NOT NULL') my_varchar_1000 id IS NULL NULL 1 @@ -1791,7 +1837,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 112 OR select_id IS NULL); +WHERE select_id = 116 OR select_id IS NULL) order by id; IF(my_varchar_1000 IS NULL, 'IS NULL', 'IS NOT NULL') my_varchar_1000 id IS NULL NULL 1 @@ -1806,7 +1852,7 @@ CREATE VIEW v1 AS SELECT IF(my_char_30 IS NULL, 'IS NULL', 'IS NOT NULL'), my_char_30, id FROM t1_values; SELECT IF(my_char_30 IS NULL, 'IS NULL', 'IS NOT NULL'), my_char_30, id FROM t1_values -WHERE select_id = 111 OR select_id IS NULL; +WHERE select_id = 115 OR select_id IS NULL order by id; IF(my_char_30 IS NULL, 'IS NULL', 'IS NOT NULL') my_char_30 id IS NULL NULL 1 @@ -1820,7 +1866,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 111 OR select_id IS NULL); +WHERE select_id = 115 OR select_id IS NULL) order by id; IF(my_char_30 IS NULL, 'IS NULL', 'IS NOT NULL') my_char_30 id IS NULL NULL 1 @@ -1835,7 +1881,7 @@ CREATE VIEW v1 AS SELECT IF(my_year, 'IS TRUE', 'IS NOT TRUE'), my_year, id FROM t1_values; SELECT IF(my_year, 'IS TRUE', 'IS NOT TRUE'), my_year, id FROM t1_values -WHERE select_id = 110 OR select_id IS NULL; +WHERE select_id = 114 OR select_id IS NULL order by id; IF(my_year, 'IS TRUE', 'IS NOT TRUE') my_year id IS NOT TRUE NULL 1 IS TRUE 1901 2 @@ -1847,7 +1893,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_year`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_year, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 110 OR select_id IS NULL); +WHERE select_id = 114 OR select_id IS NULL) order by id; IF(my_year, 'IS TRUE', 'IS NOT TRUE') my_year id IS NOT TRUE NULL 1 IS TRUE 1901 2 @@ -1861,7 +1907,7 @@ CREATE VIEW v1 AS SELECT IF(my_time, 'IS TRUE', 'IS NOT TRUE'), my_time, id FROM t1_values; SELECT IF(my_time, 'IS TRUE', 'IS NOT TRUE'), my_time, id FROM t1_values -WHERE select_id = 109 OR select_id IS NULL; +WHERE select_id = 113 OR select_id IS NULL order by id; IF(my_time, 'IS TRUE', 'IS NOT TRUE') my_time id IS NOT TRUE NULL 1 IS TRUE -838:59:59 2 @@ -1873,7 +1919,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_time`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_time, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 109 OR select_id IS NULL); +WHERE select_id = 113 OR select_id IS NULL) order by id; IF(my_time, 'IS TRUE', 'IS NOT TRUE') my_time id IS NOT TRUE NULL 1 IS TRUE -838:59:59 2 @@ -1887,7 +1933,7 @@ CREATE VIEW v1 AS SELECT IF(my_timestamp, 'IS TRUE', 'IS NOT TRUE'), my_timestamp, id FROM t1_values; SELECT IF(my_timestamp, 'IS TRUE', 'IS NOT TRUE'), my_timestamp, id FROM t1_values -WHERE select_id = 108 OR select_id IS NULL; +WHERE select_id = 112 OR select_id IS NULL order by id; IF(my_timestamp, 'IS TRUE', 'IS NOT TRUE') my_timestamp id IS NOT TRUE 0000-00-00 00:00:00 1 IS TRUE 1970-01-01 03:00:01 2 @@ -1899,7 +1945,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_timestamp`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_timestamp, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 108 OR select_id IS NULL); +WHERE select_id = 112 OR select_id IS NULL) order by id; IF(my_timestamp, 'IS TRUE', 'IS NOT TRUE') my_timestamp id IS NOT TRUE 0000-00-00 00:00:00 1 IS TRUE 1970-01-01 03:00:01 2 @@ -1913,7 +1959,7 @@ CREATE VIEW v1 AS SELECT IF(my_date, 'IS TRUE', 'IS NOT TRUE'), my_date, id FROM t1_values; SELECT IF(my_date, 'IS TRUE', 'IS NOT TRUE'), my_date, id FROM t1_values -WHERE select_id = 107 OR select_id IS NULL; +WHERE select_id = 111 OR select_id IS NULL order by id; IF(my_date, 'IS TRUE', 'IS NOT TRUE') my_date id IS NOT TRUE NULL 1 IS TRUE 0001-01-01 2 @@ -1925,7 +1971,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_date`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_date, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 107 OR select_id IS NULL); +WHERE select_id = 111 OR select_id IS NULL) order by id; IF(my_date, 'IS TRUE', 'IS NOT TRUE') my_date id IS NOT TRUE NULL 1 IS TRUE 0001-01-01 2 @@ -1939,7 +1985,7 @@ CREATE VIEW v1 AS SELECT IF(my_datetime, 'IS TRUE', 'IS NOT TRUE'), my_datetime, id FROM t1_values; SELECT IF(my_datetime, 'IS TRUE', 'IS NOT TRUE'), my_datetime, id FROM t1_values -WHERE select_id = 106 OR select_id IS NULL; +WHERE select_id = 110 OR select_id IS NULL order by id; IF(my_datetime, 'IS TRUE', 'IS NOT TRUE') my_datetime id IS NOT TRUE NULL 1 IS TRUE 0001-01-01 00:00:00 2 @@ -1951,7 +1997,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_datetime`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_datetime, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 106 OR select_id IS NULL); +WHERE select_id = 110 OR select_id IS NULL) order by id; IF(my_datetime, 'IS TRUE', 'IS NOT TRUE') my_datetime id IS NOT TRUE NULL 1 IS TRUE 0001-01-01 00:00:00 2 @@ -1965,7 +2011,7 @@ CREATE VIEW v1 AS SELECT IF(my_double, 'IS TRUE', 'IS NOT TRUE'), my_double, id FROM t1_values; SELECT IF(my_double, 'IS TRUE', 'IS NOT TRUE'), my_double, id FROM t1_values -WHERE select_id = 105 OR select_id IS NULL; +WHERE select_id = 109 OR select_id IS NULL order by id; IF(my_double, 'IS TRUE', 'IS NOT TRUE') my_double id IS NOT TRUE NULL 1 IS TRUE -1.7976931348623e+308 2 @@ -1977,7 +2023,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_double`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_double, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 105 OR select_id IS NULL); +WHERE select_id = 109 OR select_id IS NULL) order by id; IF(my_double, 'IS TRUE', 'IS NOT TRUE') my_double id IS NOT TRUE NULL 1 IS TRUE -1.7976931348623e+308 2 @@ -1991,7 +2037,7 @@ CREATE VIEW v1 AS SELECT IF(my_decimal, 'IS TRUE', 'IS NOT TRUE'), my_decimal, id FROM t1_values; SELECT IF(my_decimal, 'IS TRUE', 'IS NOT TRUE'), my_decimal, id FROM t1_values -WHERE select_id = 104 OR select_id IS NULL; +WHERE select_id = 108 OR select_id IS NULL order by id; IF(my_decimal, 'IS TRUE', 'IS NOT TRUE') my_decimal id IS NOT TRUE NULL 1 IS TRUE -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -2003,7 +2049,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_decimal`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_decimal, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 104 OR select_id IS NULL); +WHERE select_id = 108 OR select_id IS NULL) order by id; IF(my_decimal, 'IS TRUE', 'IS NOT TRUE') my_decimal id IS NOT TRUE NULL 1 IS TRUE -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -2017,7 +2063,7 @@ CREATE VIEW v1 AS SELECT IF(my_bigint, 'IS TRUE', 'IS NOT TRUE'), my_bigint, id FROM t1_values; SELECT IF(my_bigint, 'IS TRUE', 'IS NOT TRUE'), my_bigint, id FROM t1_values -WHERE select_id = 103 OR select_id IS NULL; +WHERE select_id = 107 OR select_id IS NULL order by id; IF(my_bigint, 'IS TRUE', 'IS NOT TRUE') my_bigint id IS NOT TRUE NULL 1 IS TRUE -9223372036854775808 2 @@ -2029,7 +2075,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_bigint`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_bigint, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 103 OR select_id IS NULL); +WHERE select_id = 107 OR select_id IS NULL) order by id; IF(my_bigint, 'IS TRUE', 'IS NOT TRUE') my_bigint id IS NOT TRUE NULL 1 IS TRUE -9223372036854775808 2 @@ -2043,7 +2089,7 @@ CREATE VIEW v1 AS SELECT IF(my_varbinary_1000, 'IS TRUE', 'IS NOT TRUE'), my_varbinary_1000, id FROM t1_values; SELECT IF(my_varbinary_1000, 'IS TRUE', 'IS NOT TRUE'), my_varbinary_1000, id FROM t1_values -WHERE select_id = 102 OR select_id IS NULL; +WHERE select_id = 106 OR select_id IS NULL order by id; IF(my_varbinary_1000, 'IS TRUE', 'IS NOT TRUE') my_varbinary_1000 id IS NOT TRUE NULL 1 IS NOT TRUE 2 @@ -2055,7 +2101,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varbinary_1000`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_varbinary_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 102 OR select_id IS NULL); +WHERE select_id = 106 OR select_id IS NULL) order by id; IF(my_varbinary_1000, 'IS TRUE', 'IS NOT TRUE') my_varbinary_1000 id IS NOT TRUE NULL 1 IS NOT TRUE 2 @@ -2069,13 +2115,13 @@ CREATE VIEW v1 AS SELECT IF(my_binary_30, 'IS TRUE', 'IS NOT TRUE'), my_binary_30, id FROM t1_values; SELECT IF(my_binary_30, 'IS TRUE', 'IS NOT TRUE'), my_binary_30, id FROM t1_values -WHERE select_id = 101 OR select_id IS NULL; +WHERE select_id = 105 OR select_id IS NULL order by id; IF(my_binary_30, 'IS TRUE', 'IS NOT TRUE') my_binary_30 id IS NOT TRUE NULL 1 -IS NOT TRUE +IS NOT TRUE 2 IS NOT TRUE <--------30 characters-------> 3 -IS NOT TRUE ---äÖüß@µ*$-- -IS TRUE -1 +IS NOT TRUE ---äÖüß@µ*$-- 4 +IS TRUE -1 5 Warnings: Warning 1292 Truncated incorrect DOUBLE value: '' Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' @@ -2086,7 +2132,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_binary_30`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_binary_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 101 OR select_id IS NULL); +WHERE select_id = 105 OR select_id IS NULL) order by id; IF(my_binary_30, 'IS TRUE', 'IS NOT TRUE') my_binary_30 id IS NOT TRUE NULL 1 IS NOT TRUE @@ -2105,7 +2151,7 @@ CREATE VIEW v1 AS SELECT IF(my_varchar_1000, 'IS TRUE', 'IS NOT TRUE'), my_varchar_1000, id FROM t1_values; SELECT IF(my_varchar_1000, 'IS TRUE', 'IS NOT TRUE'), my_varchar_1000, id FROM t1_values -WHERE select_id = 100 OR select_id IS NULL; +WHERE select_id = 104 OR select_id IS NULL order by id; IF(my_varchar_1000, 'IS TRUE', 'IS NOT TRUE') my_varchar_1000 id IS NOT TRUE NULL 1 IS NOT TRUE 2 @@ -2117,7 +2163,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varchar_1000`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_varchar_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 100 OR select_id IS NULL); +WHERE select_id = 104 OR select_id IS NULL) order by id; IF(my_varchar_1000, 'IS TRUE', 'IS NOT TRUE') my_varchar_1000 id IS NOT TRUE NULL 1 IS NOT TRUE 2 @@ -2131,7 +2177,7 @@ CREATE VIEW v1 AS SELECT IF(my_char_30, 'IS TRUE', 'IS NOT TRUE'), my_char_30, id FROM t1_values; SELECT IF(my_char_30, 'IS TRUE', 'IS NOT TRUE'), my_char_30, id FROM t1_values -WHERE select_id = 99 OR select_id IS NULL; +WHERE select_id = 103 OR select_id IS NULL order by id; IF(my_char_30, 'IS TRUE', 'IS NOT TRUE') my_char_30 id IS NOT TRUE NULL 1 IS NOT TRUE 2 @@ -2146,7 +2192,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_char_30`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_char_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 99 OR select_id IS NULL); +WHERE select_id = 103 OR select_id IS NULL) order by id; IF(my_char_30, 'IS TRUE', 'IS NOT TRUE') my_char_30 id IS NOT TRUE NULL 1 IS NOT TRUE 2 @@ -2159,11 +2205,11 @@ Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' DROP VIEW v1; -CREATE VIEW v1 AS SELECT CONVERT(my_varbinary_1000 USING koi8r), +CREATE VIEW v1 AS SELECT CONVERT(my_varbinary_1000 USING koi8r), my_varbinary_1000, id FROM t1_values; -SELECT CONVERT(my_varbinary_1000 USING koi8r), +SELECT CONVERT(my_varbinary_1000 USING koi8r), my_varbinary_1000, id FROM t1_values -WHERE select_id = 98 OR select_id IS NULL; +WHERE select_id = 102 OR select_id IS NULL order by id; CONVERT(my_varbinary_1000 USING koi8r) my_varbinary_1000 id NULL NULL 1 2 @@ -2175,7 +2221,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select convert(`t1_values`.`my_varbinary_1000` using koi8r) AS `CONVERT(my_varbinary_1000 USING koi8r)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 98 OR select_id IS NULL); +WHERE select_id = 102 OR select_id IS NULL) order by id; CONVERT(my_varbinary_1000 USING koi8r) my_varbinary_1000 id NULL NULL 1 2 @@ -2185,23 +2231,23 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CONVERT(my_binary_30 USING koi8r), +CREATE VIEW v1 AS SELECT CONVERT(my_binary_30 USING koi8r), my_binary_30, id FROM t1_values; -SELECT CONVERT(my_binary_30 USING koi8r), +SELECT CONVERT(my_binary_30 USING koi8r), my_binary_30, id FROM t1_values -WHERE select_id = 97 OR select_id IS NULL; +WHERE select_id = 101 OR select_id IS NULL order by id; CONVERT(my_binary_30 USING koi8r) my_binary_30 id NULL NULL 1 - + 2 <--------30 characters-------> <--------30 characters-------> 3 - ---???????÷@??*$-- --1 + ---???????÷@??*$-- ---äÖüß@µ*$-- 4 +-1 -1 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select convert(`t1_values`.`my_binary_30` using koi8r) AS `CONVERT(my_binary_30 USING koi8r)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 97 OR select_id IS NULL); +WHERE select_id = 101 OR select_id IS NULL) order by id; CONVERT(my_binary_30 USING koi8r) my_binary_30 id NULL NULL 1 @@ -2211,11 +2257,11 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CONVERT(my_varchar_1000 USING koi8r), +CREATE VIEW v1 AS SELECT CONVERT(my_varchar_1000 USING koi8r), my_varchar_1000, id FROM t1_values; -SELECT CONVERT(my_varchar_1000 USING koi8r), +SELECT CONVERT(my_varchar_1000 USING koi8r), my_varchar_1000, id FROM t1_values -WHERE select_id = 96 OR select_id IS NULL; +WHERE select_id = 100 OR select_id IS NULL order by id; CONVERT(my_varchar_1000 USING koi8r) my_varchar_1000 id NULL NULL 1 2 @@ -2227,7 +2273,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select convert(`t1_values`.`my_varchar_1000` using koi8r) AS `CONVERT(my_varchar_1000 USING koi8r)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 96 OR select_id IS NULL); +WHERE select_id = 100 OR select_id IS NULL) order by id; CONVERT(my_varchar_1000 USING koi8r) my_varchar_1000 id NULL NULL 1 2 @@ -2237,11 +2283,11 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CONVERT(my_char_30 USING koi8r), +CREATE VIEW v1 AS SELECT CONVERT(my_char_30 USING koi8r), my_char_30, id FROM t1_values; -SELECT CONVERT(my_char_30 USING koi8r), +SELECT CONVERT(my_char_30 USING koi8r), my_char_30, id FROM t1_values -WHERE select_id = 95 OR select_id IS NULL; +WHERE select_id = 99 OR select_id IS NULL order by id; CONVERT(my_char_30 USING koi8r) my_char_30 id NULL NULL 1 2 @@ -2253,7 +2299,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select convert(`t1_values`.`my_char_30` using koi8r) AS `CONVERT(my_char_30 USING koi8r)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 95 OR select_id IS NULL); +WHERE select_id = 99 OR select_id IS NULL) order by id; CONVERT(my_char_30 USING koi8r) my_char_30 id NULL NULL 1 2 @@ -2263,11 +2309,11 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CONVERT(my_varbinary_1000 USING utf8), +CREATE VIEW v1 AS SELECT CONVERT(my_varbinary_1000 USING utf8), my_varbinary_1000, id FROM t1_values; -SELECT CONVERT(my_varbinary_1000 USING utf8), +SELECT CONVERT(my_varbinary_1000 USING utf8), my_varbinary_1000, id FROM t1_values -WHERE select_id = 94 OR select_id IS NULL; +WHERE select_id = 98 OR select_id IS NULL order by id; CONVERT(my_varbinary_1000 USING utf8) my_varbinary_1000 id NULL NULL 1 2 @@ -2279,7 +2325,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select convert(`t1_values`.`my_varbinary_1000` using utf8) AS `CONVERT(my_varbinary_1000 USING utf8)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 94 OR select_id IS NULL); +WHERE select_id = 98 OR select_id IS NULL) order by id; CONVERT(my_varbinary_1000 USING utf8) my_varbinary_1000 id NULL NULL 1 2 @@ -2289,23 +2335,23 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CONVERT(my_binary_30 USING utf8), +CREATE VIEW v1 AS SELECT CONVERT(my_binary_30 USING utf8), my_binary_30, id FROM t1_values; -SELECT CONVERT(my_binary_30 USING utf8), +SELECT CONVERT(my_binary_30 USING utf8), my_binary_30, id FROM t1_values -WHERE select_id = 93 OR select_id IS NULL; +WHERE select_id = 97 OR select_id IS NULL order by id; CONVERT(my_binary_30 USING utf8) my_binary_30 id NULL NULL 1 - + 2 <--------30 characters-------> <--------30 characters-------> 3 - ---äÖüß@µ*$-- --1 + ---äÖüß@µ*$-- ---äÖüß@µ*$-- 4 +-1 -1 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select convert(`t1_values`.`my_binary_30` using utf8) AS `CONVERT(my_binary_30 USING utf8)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 93 OR select_id IS NULL); +WHERE select_id = 97 OR select_id IS NULL) order by id; CONVERT(my_binary_30 USING utf8) my_binary_30 id NULL NULL 1 @@ -2315,11 +2361,11 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CONVERT(my_varchar_1000 USING utf8), +CREATE VIEW v1 AS SELECT CONVERT(my_varchar_1000 USING utf8), my_varchar_1000, id FROM t1_values; -SELECT CONVERT(my_varchar_1000 USING utf8), +SELECT CONVERT(my_varchar_1000 USING utf8), my_varchar_1000, id FROM t1_values -WHERE select_id = 92 OR select_id IS NULL; +WHERE select_id = 96 OR select_id IS NULL order by id; CONVERT(my_varchar_1000 USING utf8) my_varchar_1000 id NULL NULL 1 2 @@ -2331,7 +2377,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select convert(`t1_values`.`my_varchar_1000` using utf8) AS `CONVERT(my_varchar_1000 USING utf8)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 92 OR select_id IS NULL); +WHERE select_id = 96 OR select_id IS NULL) order by id; CONVERT(my_varchar_1000 USING utf8) my_varchar_1000 id NULL NULL 1 2 @@ -2341,11 +2387,11 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CONVERT(my_char_30 USING utf8), +CREATE VIEW v1 AS SELECT CONVERT(my_char_30 USING utf8), my_char_30, id FROM t1_values; -SELECT CONVERT(my_char_30 USING utf8), +SELECT CONVERT(my_char_30 USING utf8), my_char_30, id FROM t1_values -WHERE select_id = 91 OR select_id IS NULL; +WHERE select_id = 95 OR select_id IS NULL order by id; CONVERT(my_char_30 USING utf8) my_char_30 id NULL NULL 1 2 @@ -2357,7 +2403,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select convert(`t1_values`.`my_char_30` using utf8) AS `CONVERT(my_char_30 USING utf8)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 91 OR select_id IS NULL); +WHERE select_id = 95 OR select_id IS NULL) order by id; CONVERT(my_char_30 USING utf8) my_char_30 id NULL NULL 1 2 @@ -2371,7 +2417,7 @@ CREATE VIEW v1 AS SELECT CAST(my_year AS UNSIGNED INTEGER), my_year, id FROM t1_values; SELECT CAST(my_year AS UNSIGNED INTEGER), my_year, id FROM t1_values -WHERE select_id = 90 OR select_id IS NULL; +WHERE select_id = 94 OR select_id IS NULL order by id; CAST(my_year AS UNSIGNED INTEGER) my_year id NULL NULL 1 1901 1901 2 @@ -2383,7 +2429,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as unsigned) AS `CAST(my_year AS UNSIGNED INTEGER)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 90 OR select_id IS NULL); +WHERE select_id = 94 OR select_id IS NULL) order by id; CAST(my_year AS UNSIGNED INTEGER) my_year id NULL NULL 1 1901 1901 2 @@ -2397,7 +2443,7 @@ CREATE VIEW v1 AS SELECT CAST(my_time AS UNSIGNED INTEGER), my_time, id FROM t1_values; SELECT CAST(my_time AS UNSIGNED INTEGER), my_time, id FROM t1_values -WHERE select_id = 89 OR select_id IS NULL; +WHERE select_id = 93 OR select_id IS NULL order by id; CAST(my_time AS UNSIGNED INTEGER) my_time id NULL NULL 1 18446744073701165657 -838:59:59 2 @@ -2409,7 +2455,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as unsigned) AS `CAST(my_time AS UNSIGNED INTEGER)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 89 OR select_id IS NULL); +WHERE select_id = 93 OR select_id IS NULL) order by id; CAST(my_time AS UNSIGNED INTEGER) my_time id NULL NULL 1 18446744073701165657 -838:59:59 2 @@ -2423,7 +2469,7 @@ CREATE VIEW v1 AS SELECT CAST(my_timestamp AS UNSIGNED INTEGER), my_timestamp, id FROM t1_values; SELECT CAST(my_timestamp AS UNSIGNED INTEGER), my_timestamp, id FROM t1_values -WHERE select_id = 88 OR select_id IS NULL; +WHERE select_id = 92 OR select_id IS NULL order by id; CAST(my_timestamp AS UNSIGNED INTEGER) my_timestamp id 0 0000-00-00 00:00:00 1 19700101030001 1970-01-01 03:00:01 2 @@ -2435,7 +2481,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as unsigned) AS `CAST(my_timestamp AS UNSIGNED INTEGER)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 88 OR select_id IS NULL); +WHERE select_id = 92 OR select_id IS NULL) order by id; CAST(my_timestamp AS UNSIGNED INTEGER) my_timestamp id 0 0000-00-00 00:00:00 1 19700101030001 1970-01-01 03:00:01 2 @@ -2449,7 +2495,7 @@ CREATE VIEW v1 AS SELECT CAST(my_date AS UNSIGNED INTEGER), my_date, id FROM t1_values; SELECT CAST(my_date AS UNSIGNED INTEGER), my_date, id FROM t1_values -WHERE select_id = 87 OR select_id IS NULL; +WHERE select_id = 91 OR select_id IS NULL order by id; CAST(my_date AS UNSIGNED INTEGER) my_date id NULL NULL 1 10101 0001-01-01 2 @@ -2461,7 +2507,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as unsigned) AS `CAST(my_date AS UNSIGNED INTEGER)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 87 OR select_id IS NULL); +WHERE select_id = 91 OR select_id IS NULL) order by id; CAST(my_date AS UNSIGNED INTEGER) my_date id NULL NULL 1 10101 0001-01-01 2 @@ -2475,7 +2521,7 @@ CREATE VIEW v1 AS SELECT CAST(my_datetime AS UNSIGNED INTEGER), my_datetime, id FROM t1_values; SELECT CAST(my_datetime AS UNSIGNED INTEGER), my_datetime, id FROM t1_values -WHERE select_id = 86 OR select_id IS NULL; +WHERE select_id = 90 OR select_id IS NULL order by id; CAST(my_datetime AS UNSIGNED INTEGER) my_datetime id NULL NULL 1 10101000000 0001-01-01 00:00:00 2 @@ -2487,7 +2533,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as unsigned) AS `CAST(my_datetime AS UNSIGNED INTEGER)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 86 OR select_id IS NULL); +WHERE select_id = 90 OR select_id IS NULL) order by id; CAST(my_datetime AS UNSIGNED INTEGER) my_datetime id NULL NULL 1 10101000000 0001-01-01 00:00:00 2 @@ -2497,11 +2543,43 @@ NULL NULL 1 DROP VIEW v1; +CREATE VIEW v1 AS SELECT CAST(my_double AS UNSIGNED INTEGER), +my_double, id FROM t1_values; +SELECT CAST(my_double AS UNSIGNED INTEGER), +my_double, id FROM t1_values +WHERE select_id = 89 OR select_id IS NULL order by id; +CAST(my_double AS UNSIGNED INTEGER) my_double id +NULL NULL 1 +9223372036854775808 -1.7976931348623e+308 2 +9223372036854775807 1.7976931348623e+308 3 +0 0 4 +18446744073709551615 -1 5 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '-1.7976931348623e+308' +Warning 1292 Truncated incorrect INTEGER value: '1.7976931348623e+308' +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as unsigned) AS `CAST(my_double AS UNSIGNED INTEGER)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` +SELECT v1.* FROM v1 +WHERE v1.id IN (SELECT id FROM t1_values +WHERE select_id = 89 OR select_id IS NULL) order by id; +CAST(my_double AS UNSIGNED INTEGER) my_double id +NULL NULL 1 +9223372036854775808 -1.7976931348623e+308 2 +9223372036854775807 1.7976931348623e+308 3 +0 0 4 +18446744073709551615 -1 5 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '-1.7976931348623e+308' +Warning 1292 Truncated incorrect INTEGER value: '1.7976931348623e+308' +DROP VIEW v1; + + CREATE VIEW v1 AS SELECT CAST(my_decimal AS UNSIGNED INTEGER), my_decimal, id FROM t1_values; SELECT CAST(my_decimal AS UNSIGNED INTEGER), my_decimal, id FROM t1_values -WHERE select_id = 85 OR select_id IS NULL; +WHERE select_id = 88 OR select_id IS NULL order by id; CAST(my_decimal AS UNSIGNED INTEGER) my_decimal id NULL NULL 1 0 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -2517,7 +2595,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as unsigned) AS `CAST(my_decimal AS UNSIGNED INTEGER)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 85 OR select_id IS NULL); +WHERE select_id = 88 OR select_id IS NULL) order by id; CAST(my_decimal AS UNSIGNED INTEGER) my_decimal id NULL NULL 1 0 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -2535,7 +2613,7 @@ CREATE VIEW v1 AS SELECT CAST(my_bigint AS UNSIGNED INTEGER), my_bigint, id FROM t1_values; SELECT CAST(my_bigint AS UNSIGNED INTEGER), my_bigint, id FROM t1_values -WHERE select_id = 84 OR select_id IS NULL; +WHERE select_id = 87 OR select_id IS NULL order by id; CAST(my_bigint AS UNSIGNED INTEGER) my_bigint id NULL NULL 1 9223372036854775808 -9223372036854775808 2 @@ -2547,7 +2625,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as unsigned) AS `CAST(my_bigint AS UNSIGNED INTEGER)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 84 OR select_id IS NULL); +WHERE select_id = 87 OR select_id IS NULL) order by id; CAST(my_bigint AS UNSIGNED INTEGER) my_bigint id NULL NULL 1 9223372036854775808 -9223372036854775808 2 @@ -2561,7 +2639,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS UNSIGNED INTEGER), my_varbinary_1000, id FROM t1_values; SELECT CAST(my_varbinary_1000 AS UNSIGNED INTEGER), my_varbinary_1000, id FROM t1_values -WHERE select_id = 83 OR select_id IS NULL; +WHERE select_id = 86 OR select_id IS NULL order by id; CAST(my_varbinary_1000 AS UNSIGNED INTEGER) my_varbinary_1000 id NULL NULL 1 0 2 @@ -2578,7 +2656,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as unsigned) AS `CAST(my_varbinary_1000 AS UNSIGNED INTEGER)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 83 OR select_id IS NULL); +WHERE select_id = 86 OR select_id IS NULL) order by id; CAST(my_varbinary_1000 AS UNSIGNED INTEGER) my_varbinary_1000 id NULL NULL 1 0 2 @@ -2597,13 +2675,13 @@ CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS UNSIGNED INTEGER), my_binary_30, id FROM t1_values; SELECT CAST(my_binary_30 AS UNSIGNED INTEGER), my_binary_30, id FROM t1_values -WHERE select_id = 82 OR select_id IS NULL; +WHERE select_id = 85 OR select_id IS NULL order by id; CAST(my_binary_30 AS UNSIGNED INTEGER) my_binary_30 id NULL NULL 1 -0 +0 2 0 <--------30 characters-------> 3 -0 ---äÖüß@µ*$-- -18446744073709551615 -1 +0 ---äÖüß@µ*$-- 4 +18446744073709551615 -1 5 Warnings: Warning 1292 Truncated incorrect INTEGER value: '' Warning 1292 Truncated incorrect INTEGER value: '<--------30 characters------->' @@ -2615,7 +2693,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as unsigned) AS `CAST(my_binary_30 AS UNSIGNED INTEGER)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 82 OR select_id IS NULL); +WHERE select_id = 85 OR select_id IS NULL) order by id; CAST(my_binary_30 AS UNSIGNED INTEGER) my_binary_30 id NULL NULL 1 0 @@ -2635,7 +2713,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS UNSIGNED INTEGER), my_varchar_1000, id FROM t1_values; SELECT CAST(my_varchar_1000 AS UNSIGNED INTEGER), my_varchar_1000, id FROM t1_values -WHERE select_id = 81 OR select_id IS NULL; +WHERE select_id = 84 OR select_id IS NULL order by id; CAST(my_varchar_1000 AS UNSIGNED INTEGER) my_varchar_1000 id NULL NULL 1 0 2 @@ -2652,7 +2730,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as unsigned) AS `CAST(my_varchar_1000 AS UNSIGNED INTEGER)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 81 OR select_id IS NULL); +WHERE select_id = 84 OR select_id IS NULL) order by id; CAST(my_varchar_1000 AS UNSIGNED INTEGER) my_varchar_1000 id NULL NULL 1 0 2 @@ -2671,7 +2749,7 @@ CREATE VIEW v1 AS SELECT CAST(my_char_30 AS UNSIGNED INTEGER), my_char_30, id FROM t1_values; SELECT CAST(my_char_30 AS UNSIGNED INTEGER), my_char_30, id FROM t1_values -WHERE select_id = 80 OR select_id IS NULL; +WHERE select_id = 83 OR select_id IS NULL order by id; CAST(my_char_30 AS UNSIGNED INTEGER) my_char_30 id NULL NULL 1 0 2 @@ -2688,7 +2766,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as unsigned) AS `CAST(my_char_30 AS UNSIGNED INTEGER)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 80 OR select_id IS NULL); +WHERE select_id = 83 OR select_id IS NULL) order by id; CAST(my_char_30 AS UNSIGNED INTEGER) my_char_30 id NULL NULL 1 0 2 @@ -2707,7 +2785,7 @@ CREATE VIEW v1 AS SELECT CAST(my_year AS SIGNED INTEGER), my_year, id FROM t1_values; SELECT CAST(my_year AS SIGNED INTEGER), my_year, id FROM t1_values -WHERE select_id = 79 OR select_id IS NULL; +WHERE select_id = 82 OR select_id IS NULL order by id; CAST(my_year AS SIGNED INTEGER) my_year id NULL NULL 1 1901 1901 2 @@ -2719,7 +2797,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as signed) AS `CAST(my_year AS SIGNED INTEGER)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 79 OR select_id IS NULL); +WHERE select_id = 82 OR select_id IS NULL) order by id; CAST(my_year AS SIGNED INTEGER) my_year id NULL NULL 1 1901 1901 2 @@ -2733,7 +2811,7 @@ CREATE VIEW v1 AS SELECT CAST(my_time AS SIGNED INTEGER), my_time, id FROM t1_values; SELECT CAST(my_time AS SIGNED INTEGER), my_time, id FROM t1_values -WHERE select_id = 78 OR select_id IS NULL; +WHERE select_id = 81 OR select_id IS NULL order by id; CAST(my_time AS SIGNED INTEGER) my_time id NULL NULL 1 -8385959 -838:59:59 2 @@ -2745,7 +2823,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as signed) AS `CAST(my_time AS SIGNED INTEGER)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 78 OR select_id IS NULL); +WHERE select_id = 81 OR select_id IS NULL) order by id; CAST(my_time AS SIGNED INTEGER) my_time id NULL NULL 1 -8385959 -838:59:59 2 @@ -2759,7 +2837,7 @@ CREATE VIEW v1 AS SELECT CAST(my_timestamp AS SIGNED INTEGER), my_timestamp, id FROM t1_values; SELECT CAST(my_timestamp AS SIGNED INTEGER), my_timestamp, id FROM t1_values -WHERE select_id = 77 OR select_id IS NULL; +WHERE select_id = 80 OR select_id IS NULL order by id; CAST(my_timestamp AS SIGNED INTEGER) my_timestamp id 0 0000-00-00 00:00:00 1 19700101030001 1970-01-01 03:00:01 2 @@ -2771,7 +2849,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as signed) AS `CAST(my_timestamp AS SIGNED INTEGER)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 77 OR select_id IS NULL); +WHERE select_id = 80 OR select_id IS NULL) order by id; CAST(my_timestamp AS SIGNED INTEGER) my_timestamp id 0 0000-00-00 00:00:00 1 19700101030001 1970-01-01 03:00:01 2 @@ -2785,7 +2863,7 @@ CREATE VIEW v1 AS SELECT CAST(my_date AS SIGNED INTEGER), my_date, id FROM t1_values; SELECT CAST(my_date AS SIGNED INTEGER), my_date, id FROM t1_values -WHERE select_id = 76 OR select_id IS NULL; +WHERE select_id = 79 OR select_id IS NULL order by id; CAST(my_date AS SIGNED INTEGER) my_date id NULL NULL 1 10101 0001-01-01 2 @@ -2797,7 +2875,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as signed) AS `CAST(my_date AS SIGNED INTEGER)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 76 OR select_id IS NULL); +WHERE select_id = 79 OR select_id IS NULL) order by id; CAST(my_date AS SIGNED INTEGER) my_date id NULL NULL 1 10101 0001-01-01 2 @@ -2811,7 +2889,7 @@ CREATE VIEW v1 AS SELECT CAST(my_datetime AS SIGNED INTEGER), my_datetime, id FROM t1_values; SELECT CAST(my_datetime AS SIGNED INTEGER), my_datetime, id FROM t1_values -WHERE select_id = 75 OR select_id IS NULL; +WHERE select_id = 78 OR select_id IS NULL order by id; CAST(my_datetime AS SIGNED INTEGER) my_datetime id NULL NULL 1 10101000000 0001-01-01 00:00:00 2 @@ -2823,7 +2901,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as signed) AS `CAST(my_datetime AS SIGNED INTEGER)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 75 OR select_id IS NULL); +WHERE select_id = 78 OR select_id IS NULL) order by id; CAST(my_datetime AS SIGNED INTEGER) my_datetime id NULL NULL 1 10101000000 0001-01-01 00:00:00 2 @@ -2833,11 +2911,43 @@ NULL NULL 1 DROP VIEW v1; +CREATE VIEW v1 AS SELECT CAST(my_double AS SIGNED INTEGER), +my_double, id FROM t1_values; +SELECT CAST(my_double AS SIGNED INTEGER), +my_double, id FROM t1_values +WHERE select_id = 77 OR select_id IS NULL order by id; +CAST(my_double AS SIGNED INTEGER) my_double id +NULL NULL 1 +-9223372036854775808 -1.7976931348623e+308 2 +9223372036854775807 1.7976931348623e+308 3 +0 0 4 +-1 -1 5 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '-1.7976931348623e+308' +Warning 1292 Truncated incorrect INTEGER value: '1.7976931348623e+308' +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as signed) AS `CAST(my_double AS SIGNED INTEGER)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` +SELECT v1.* FROM v1 +WHERE v1.id IN (SELECT id FROM t1_values +WHERE select_id = 77 OR select_id IS NULL) order by id; +CAST(my_double AS SIGNED INTEGER) my_double id +NULL NULL 1 +-9223372036854775808 -1.7976931348623e+308 2 +9223372036854775807 1.7976931348623e+308 3 +0 0 4 +-1 -1 5 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '-1.7976931348623e+308' +Warning 1292 Truncated incorrect INTEGER value: '1.7976931348623e+308' +DROP VIEW v1; + + CREATE VIEW v1 AS SELECT CAST(my_decimal AS SIGNED INTEGER), my_decimal, id FROM t1_values; SELECT CAST(my_decimal AS SIGNED INTEGER), my_decimal, id FROM t1_values -WHERE select_id = 74 OR select_id IS NULL; +WHERE select_id = 76 OR select_id IS NULL order by id; CAST(my_decimal AS SIGNED INTEGER) my_decimal id NULL NULL 1 -9223372036854775808 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -2852,7 +2962,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as signed) AS `CAST(my_decimal AS SIGNED INTEGER)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 74 OR select_id IS NULL); +WHERE select_id = 76 OR select_id IS NULL) order by id; CAST(my_decimal AS SIGNED INTEGER) my_decimal id NULL NULL 1 -9223372036854775808 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -2869,7 +2979,7 @@ CREATE VIEW v1 AS SELECT CAST(my_bigint AS SIGNED INTEGER), my_bigint, id FROM t1_values; SELECT CAST(my_bigint AS SIGNED INTEGER), my_bigint, id FROM t1_values -WHERE select_id = 73 OR select_id IS NULL; +WHERE select_id = 75 OR select_id IS NULL order by id; CAST(my_bigint AS SIGNED INTEGER) my_bigint id NULL NULL 1 -9223372036854775808 -9223372036854775808 2 @@ -2881,7 +2991,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as signed) AS `CAST(my_bigint AS SIGNED INTEGER)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 73 OR select_id IS NULL); +WHERE select_id = 75 OR select_id IS NULL) order by id; CAST(my_bigint AS SIGNED INTEGER) my_bigint id NULL NULL 1 -9223372036854775808 -9223372036854775808 2 @@ -2895,7 +3005,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS SIGNED INTEGER), my_varbinary_1000, id FROM t1_values; SELECT CAST(my_varbinary_1000 AS SIGNED INTEGER), my_varbinary_1000, id FROM t1_values -WHERE select_id = 72 OR select_id IS NULL; +WHERE select_id = 74 OR select_id IS NULL order by id; CAST(my_varbinary_1000 AS SIGNED INTEGER) my_varbinary_1000 id NULL NULL 1 0 2 @@ -2911,7 +3021,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as signed) AS `CAST(my_varbinary_1000 AS SIGNED INTEGER)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 72 OR select_id IS NULL); +WHERE select_id = 74 OR select_id IS NULL) order by id; CAST(my_varbinary_1000 AS SIGNED INTEGER) my_varbinary_1000 id NULL NULL 1 0 2 @@ -2929,13 +3039,13 @@ CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS SIGNED INTEGER), my_binary_30, id FROM t1_values; SELECT CAST(my_binary_30 AS SIGNED INTEGER), my_binary_30, id FROM t1_values -WHERE select_id = 71 OR select_id IS NULL; +WHERE select_id = 73 OR select_id IS NULL order by id; CAST(my_binary_30 AS SIGNED INTEGER) my_binary_30 id NULL NULL 1 -0 +0 2 0 <--------30 characters-------> 3 -0 ---äÖüß@µ*$-- --1 -1 +0 ---äÖüß@µ*$-- 4 +-1 -1 5 Warnings: Warning 1292 Truncated incorrect INTEGER value: '' Warning 1292 Truncated incorrect INTEGER value: '<--------30 characters------->' @@ -2946,7 +3056,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as signed) AS `CAST(my_binary_30 AS SIGNED INTEGER)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 71 OR select_id IS NULL); +WHERE select_id = 73 OR select_id IS NULL) order by id; CAST(my_binary_30 AS SIGNED INTEGER) my_binary_30 id NULL NULL 1 0 @@ -2965,7 +3075,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS SIGNED INTEGER), my_varchar_1000, id FROM t1_values; SELECT CAST(my_varchar_1000 AS SIGNED INTEGER), my_varchar_1000, id FROM t1_values -WHERE select_id = 70 OR select_id IS NULL; +WHERE select_id = 72 OR select_id IS NULL order by id; CAST(my_varchar_1000 AS SIGNED INTEGER) my_varchar_1000 id NULL NULL 1 0 2 @@ -2981,7 +3091,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as signed) AS `CAST(my_varchar_1000 AS SIGNED INTEGER)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 70 OR select_id IS NULL); +WHERE select_id = 72 OR select_id IS NULL) order by id; CAST(my_varchar_1000 AS SIGNED INTEGER) my_varchar_1000 id NULL NULL 1 0 2 @@ -2999,7 +3109,7 @@ CREATE VIEW v1 AS SELECT CAST(my_char_30 AS SIGNED INTEGER), my_char_30, id FROM t1_values; SELECT CAST(my_char_30 AS SIGNED INTEGER), my_char_30, id FROM t1_values -WHERE select_id = 69 OR select_id IS NULL; +WHERE select_id = 71 OR select_id IS NULL order by id; CAST(my_char_30 AS SIGNED INTEGER) my_char_30 id NULL NULL 1 0 2 @@ -3015,7 +3125,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as signed) AS `CAST(my_char_30 AS SIGNED INTEGER)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 69 OR select_id IS NULL); +WHERE select_id = 71 OR select_id IS NULL) order by id; CAST(my_char_30 AS SIGNED INTEGER) my_char_30 id NULL NULL 1 0 2 @@ -3033,7 +3143,7 @@ CREATE VIEW v1 AS SELECT CAST(my_year AS DECIMAL(37,2)), my_year, id FROM t1_values; SELECT CAST(my_year AS DECIMAL(37,2)), my_year, id FROM t1_values -WHERE select_id = 68 OR select_id IS NULL; +WHERE select_id = 70 OR select_id IS NULL order by id; CAST(my_year AS DECIMAL(37,2)) my_year id NULL NULL 1 1901.00 1901 2 @@ -3045,7 +3155,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as decimal(37,2)) AS `CAST(my_year AS DECIMAL(37,2))`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 68 OR select_id IS NULL); +WHERE select_id = 70 OR select_id IS NULL) order by id; CAST(my_year AS DECIMAL(37,2)) my_year id NULL NULL 1 1901.00 1901 2 @@ -3059,7 +3169,7 @@ CREATE VIEW v1 AS SELECT CAST(my_time AS DECIMAL(37,2)), my_time, id FROM t1_values; SELECT CAST(my_time AS DECIMAL(37,2)), my_time, id FROM t1_values -WHERE select_id = 67 OR select_id IS NULL; +WHERE select_id = 69 OR select_id IS NULL order by id; CAST(my_time AS DECIMAL(37,2)) my_time id NULL NULL 1 -8385959.00 -838:59:59 2 @@ -3071,7 +3181,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as decimal(37,2)) AS `CAST(my_time AS DECIMAL(37,2))`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 67 OR select_id IS NULL); +WHERE select_id = 69 OR select_id IS NULL) order by id; CAST(my_time AS DECIMAL(37,2)) my_time id NULL NULL 1 -8385959.00 -838:59:59 2 @@ -3085,7 +3195,7 @@ CREATE VIEW v1 AS SELECT CAST(my_timestamp AS DECIMAL(37,2)), my_timestamp, id FROM t1_values; SELECT CAST(my_timestamp AS DECIMAL(37,2)), my_timestamp, id FROM t1_values -WHERE select_id = 66 OR select_id IS NULL; +WHERE select_id = 68 OR select_id IS NULL order by id; CAST(my_timestamp AS DECIMAL(37,2)) my_timestamp id 0.00 0000-00-00 00:00:00 1 19700101030001.00 1970-01-01 03:00:01 2 @@ -3097,7 +3207,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as decimal(37,2)) AS `CAST(my_timestamp AS DECIMAL(37,2))`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 66 OR select_id IS NULL); +WHERE select_id = 68 OR select_id IS NULL) order by id; CAST(my_timestamp AS DECIMAL(37,2)) my_timestamp id 0.00 0000-00-00 00:00:00 1 19700101030001.00 1970-01-01 03:00:01 2 @@ -3111,7 +3221,7 @@ CREATE VIEW v1 AS SELECT CAST(my_date AS DECIMAL(37,2)), my_date, id FROM t1_values; SELECT CAST(my_date AS DECIMAL(37,2)), my_date, id FROM t1_values -WHERE select_id = 65 OR select_id IS NULL; +WHERE select_id = 67 OR select_id IS NULL order by id; CAST(my_date AS DECIMAL(37,2)) my_date id NULL NULL 1 10101.00 0001-01-01 2 @@ -3123,7 +3233,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as decimal(37,2)) AS `CAST(my_date AS DECIMAL(37,2))`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 65 OR select_id IS NULL); +WHERE select_id = 67 OR select_id IS NULL) order by id; CAST(my_date AS DECIMAL(37,2)) my_date id NULL NULL 1 10101.00 0001-01-01 2 @@ -3137,7 +3247,7 @@ CREATE VIEW v1 AS SELECT CAST(my_datetime AS DECIMAL(37,2)), my_datetime, id FROM t1_values; SELECT CAST(my_datetime AS DECIMAL(37,2)), my_datetime, id FROM t1_values -WHERE select_id = 64 OR select_id IS NULL; +WHERE select_id = 66 OR select_id IS NULL order by id; CAST(my_datetime AS DECIMAL(37,2)) my_datetime id NULL NULL 1 10101000000.00 0001-01-01 00:00:00 2 @@ -3149,7 +3259,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as decimal(37,2)) AS `CAST(my_datetime AS DECIMAL(37,2))`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 64 OR select_id IS NULL); +WHERE select_id = 66 OR select_id IS NULL) order by id; CAST(my_datetime AS DECIMAL(37,2)) my_datetime id NULL NULL 1 10101000000.00 0001-01-01 00:00:00 2 @@ -3159,11 +3269,49 @@ NULL NULL 1 DROP VIEW v1; +CREATE VIEW v1 AS SELECT CAST(my_double AS DECIMAL(37,2)), +my_double, id FROM t1_values; +SELECT CAST(my_double AS DECIMAL(37,2)), +my_double, id FROM t1_values +WHERE select_id = 65 OR select_id IS NULL order by id; +CAST(my_double AS DECIMAL(37,2)) my_double id +NULL NULL 1 +-99999999999999999999999999999999999.99 -1.7976931348623e+308 2 +99999999999999999999999999999999999.99 1.7976931348623e+308 3 +0.00 0 4 +-1.00 -1 5 +-3333.33 -3333.3333 30 +Warnings: +Error 1292 Truncated incorrect DECIMAL value: '' +Error 1264 Out of range value adjusted for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 +Error 1292 Truncated incorrect DECIMAL value: '' +Error 1264 Out of range value adjusted for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as decimal(37,2)) AS `CAST(my_double AS DECIMAL(37,2))`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` +SELECT v1.* FROM v1 +WHERE v1.id IN (SELECT id FROM t1_values +WHERE select_id = 65 OR select_id IS NULL) order by id; +CAST(my_double AS DECIMAL(37,2)) my_double id +NULL NULL 1 +-99999999999999999999999999999999999.99 -1.7976931348623e+308 2 +99999999999999999999999999999999999.99 1.7976931348623e+308 3 +0.00 0 4 +-1.00 -1 5 +-3333.33 -3333.3333 30 +Warnings: +Error 1292 Truncated incorrect DECIMAL value: '' +Error 1264 Out of range value adjusted for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 +Error 1292 Truncated incorrect DECIMAL value: '' +Error 1264 Out of range value adjusted for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 +DROP VIEW v1; + + CREATE VIEW v1 AS SELECT CAST(my_decimal AS DECIMAL(37,2)), my_decimal, id FROM t1_values; SELECT CAST(my_decimal AS DECIMAL(37,2)), my_decimal, id FROM t1_values -WHERE select_id = 63 OR select_id IS NULL; +WHERE select_id = 64 OR select_id IS NULL order by id; CAST(my_decimal AS DECIMAL(37,2)) my_decimal id NULL NULL 1 -10000000000000000000000000000000000.00 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -3175,7 +3323,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as decimal(37,2)) AS `CAST(my_decimal AS DECIMAL(37,2))`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 63 OR select_id IS NULL); +WHERE select_id = 64 OR select_id IS NULL) order by id; CAST(my_decimal AS DECIMAL(37,2)) my_decimal id NULL NULL 1 -10000000000000000000000000000000000.00 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -3189,7 +3337,7 @@ CREATE VIEW v1 AS SELECT CAST(my_bigint AS DECIMAL(37,2)), my_bigint, id FROM t1_values; SELECT CAST(my_bigint AS DECIMAL(37,2)), my_bigint, id FROM t1_values -WHERE select_id = 62 OR select_id IS NULL; +WHERE select_id = 63 OR select_id IS NULL order by id; CAST(my_bigint AS DECIMAL(37,2)) my_bigint id NULL NULL 1 -9223372036854775808.00 -9223372036854775808 2 @@ -3201,7 +3349,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as decimal(37,2)) AS `CAST(my_bigint AS DECIMAL(37,2))`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 62 OR select_id IS NULL); +WHERE select_id = 63 OR select_id IS NULL) order by id; CAST(my_bigint AS DECIMAL(37,2)) my_bigint id NULL NULL 1 -9223372036854775808.00 -9223372036854775808 2 @@ -3215,14 +3363,14 @@ CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS DECIMAL(37,2)), my_varbinary_1000, id FROM t1_values; SELECT CAST(my_varbinary_1000 AS DECIMAL(37,2)), my_varbinary_1000, id FROM t1_values -WHERE select_id = 61 OR select_id IS NULL; +WHERE select_id = 62 OR select_id IS NULL order by id; CAST(my_varbinary_1000 AS DECIMAL(37,2)) my_varbinary_1000 id NULL NULL 1 0.00 2 0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 0.00 ---äÖüß@µ*$-- 4 -1.00 -1 5 --3333.33 -3333.3333 28 +-3333.33 -3333.3333 29 Warnings: Error 1366 Incorrect decimal value: '' for column '' at row -1 Error 1366 Incorrect decimal value: '' for column '' at row -1 @@ -3232,14 +3380,14 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 61 OR select_id IS NULL); +WHERE select_id = 62 OR select_id IS NULL) order by id; CAST(my_varbinary_1000 AS DECIMAL(37,2)) my_varbinary_1000 id NULL NULL 1 0.00 2 0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 0.00 ---äÖüß@µ*$-- 4 -1.00 -1 5 --3333.33 -3333.3333 28 +-3333.33 -3333.3333 29 Warnings: Error 1366 Incorrect decimal value: '' for column '' at row -1 Error 1366 Incorrect decimal value: '' for column '' at row -1 @@ -3251,14 +3399,14 @@ CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS DECIMAL(37,2)), my_binary_30, id FROM t1_values; SELECT CAST(my_binary_30 AS DECIMAL(37,2)), my_binary_30, id FROM t1_values -WHERE select_id = 60 OR select_id IS NULL; +WHERE select_id = 61 OR select_id IS NULL order by id; CAST(my_binary_30 AS DECIMAL(37,2)) my_binary_30 id NULL NULL 1 -0.00 +0.00 2 0.00 <--------30 characters-------> 3 -0.00 ---äÖüß@µ*$-- --1.00 -1 --3333.33 -3333.3333 +0.00 ---äÖüß@µ*$-- 4 +-1.00 -1 5 +-3333.33 -3333.3333 28 Warnings: Error 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: '' @@ -3273,14 +3421,14 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as decimal(37,2)) AS `CAST(my_binary_30 AS DECIMAL(37,2))`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 60 OR select_id IS NULL); +WHERE select_id = 61 OR select_id IS NULL) order by id; CAST(my_binary_30 AS DECIMAL(37,2)) my_binary_30 id NULL NULL 1 0.00 0.00 <--------30 characters-------> 3 0.00 ---äÖüß@µ*$-- -1.00 -1 --3333.33 -3333.3333 +-3333.33 -3333.3333 Warnings: Error 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: '' @@ -3297,14 +3445,14 @@ CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS DECIMAL(37,2)), my_varchar_1000, id FROM t1_values; SELECT CAST(my_varchar_1000 AS DECIMAL(37,2)), my_varchar_1000, id FROM t1_values -WHERE select_id = 59 OR select_id IS NULL; +WHERE select_id = 60 OR select_id IS NULL order by id; CAST(my_varchar_1000 AS DECIMAL(37,2)) my_varchar_1000 id NULL NULL 1 0.00 2 0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 0.00 ---äÖüß@µ*$-- 4 -1.00 -1 5 --3333.33 -3333.3333 26 +-3333.33 -3333.3333 27 Warnings: Error 1366 Incorrect decimal value: '' for column '' at row -1 Error 1366 Incorrect decimal value: '' for column '' at row -1 @@ -3314,14 +3462,14 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 59 OR select_id IS NULL); +WHERE select_id = 60 OR select_id IS NULL) order by id; CAST(my_varchar_1000 AS DECIMAL(37,2)) my_varchar_1000 id NULL NULL 1 0.00 2 0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 0.00 ---äÖüß@µ*$-- 4 -1.00 -1 5 --3333.33 -3333.3333 26 +-3333.33 -3333.3333 27 Warnings: Error 1366 Incorrect decimal value: '' for column '' at row -1 Error 1366 Incorrect decimal value: '' for column '' at row -1 @@ -3333,14 +3481,14 @@ CREATE VIEW v1 AS SELECT CAST(my_char_30 AS DECIMAL(37,2)), my_char_30, id FROM t1_values; SELECT CAST(my_char_30 AS DECIMAL(37,2)), my_char_30, id FROM t1_values -WHERE select_id = 58 OR select_id IS NULL; +WHERE select_id = 59 OR select_id IS NULL order by id; CAST(my_char_30 AS DECIMAL(37,2)) my_char_30 id NULL NULL 1 0.00 2 0.00 <--------30 characters-------> 3 0.00 ---äÖüß@µ*$-- 4 -1.00 -1 5 --3333.33 -3333.3333 25 +-3333.33 -3333.3333 26 Warnings: Error 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ' @@ -3353,14 +3501,14 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal(37,2)) AS `CAST(my_char_30 AS DECIMAL(37,2))`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 58 OR select_id IS NULL); +WHERE select_id = 59 OR select_id IS NULL) order by id; CAST(my_char_30 AS DECIMAL(37,2)) my_char_30 id NULL NULL 1 0.00 2 0.00 <--------30 characters-------> 3 0.00 ---äÖüß@µ*$-- 4 -1.00 -1 5 --3333.33 -3333.3333 25 +-3333.33 -3333.3333 26 Warnings: Error 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ' @@ -3375,7 +3523,7 @@ CREATE VIEW v1 AS SELECT CAST(my_year AS TIME), my_year, id FROM t1_values; SELECT CAST(my_year AS TIME), my_year, id FROM t1_values -WHERE select_id = 57 OR select_id IS NULL; +WHERE select_id = 58 OR select_id IS NULL order by id; CAST(my_year AS TIME) my_year id NULL NULL 1 00:19:01 1901 2 @@ -3387,7 +3535,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as time) AS `CAST(my_year AS TIME)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 57 OR select_id IS NULL); +WHERE select_id = 58 OR select_id IS NULL) order by id; CAST(my_year AS TIME) my_year id NULL NULL 1 00:19:01 1901 2 @@ -3401,7 +3549,7 @@ CREATE VIEW v1 AS SELECT CAST(my_time AS TIME), my_time, id FROM t1_values; SELECT CAST(my_time AS TIME), my_time, id FROM t1_values -WHERE select_id = 56 OR select_id IS NULL; +WHERE select_id = 57 OR select_id IS NULL order by id; CAST(my_time AS TIME) my_time id NULL NULL 1 -838:59:59 -838:59:59 2 @@ -3413,7 +3561,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as time) AS `CAST(my_time AS TIME)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 56 OR select_id IS NULL); +WHERE select_id = 57 OR select_id IS NULL) order by id; CAST(my_time AS TIME) my_time id NULL NULL 1 -838:59:59 -838:59:59 2 @@ -3427,7 +3575,7 @@ CREATE VIEW v1 AS SELECT CAST(my_timestamp AS TIME), my_timestamp, id FROM t1_values; SELECT CAST(my_timestamp AS TIME), my_timestamp, id FROM t1_values -WHERE select_id = 55 OR select_id IS NULL; +WHERE select_id = 56 OR select_id IS NULL order by id; CAST(my_timestamp AS TIME) my_timestamp id 00:00:00 0000-00-00 00:00:00 1 03:00:01 1970-01-01 03:00:01 2 @@ -3439,7 +3587,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as time) AS `CAST(my_timestamp AS TIME)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 55 OR select_id IS NULL); +WHERE select_id = 56 OR select_id IS NULL) order by id; CAST(my_timestamp AS TIME) my_timestamp id 00:00:00 0000-00-00 00:00:00 1 03:00:01 1970-01-01 03:00:01 2 @@ -3453,7 +3601,7 @@ CREATE VIEW v1 AS SELECT CAST(my_date AS TIME), my_date, id FROM t1_values; SELECT CAST(my_date AS TIME), my_date, id FROM t1_values -WHERE select_id = 54 OR select_id IS NULL; +WHERE select_id = 55 OR select_id IS NULL order by id; CAST(my_date AS TIME) my_date id NULL NULL 1 00:00:00 0001-01-01 2 @@ -3465,7 +3613,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as time) AS `CAST(my_date AS TIME)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 54 OR select_id IS NULL); +WHERE select_id = 55 OR select_id IS NULL) order by id; CAST(my_date AS TIME) my_date id NULL NULL 1 00:00:00 0001-01-01 2 @@ -3479,7 +3627,7 @@ CREATE VIEW v1 AS SELECT CAST(my_datetime AS TIME), my_datetime, id FROM t1_values; SELECT CAST(my_datetime AS TIME), my_datetime, id FROM t1_values -WHERE select_id = 53 OR select_id IS NULL; +WHERE select_id = 54 OR select_id IS NULL order by id; CAST(my_datetime AS TIME) my_datetime id NULL NULL 1 00:00:00 0001-01-01 00:00:00 2 @@ -3491,7 +3639,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as time) AS `CAST(my_datetime AS TIME)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 53 OR select_id IS NULL); +WHERE select_id = 54 OR select_id IS NULL) order by id; CAST(my_datetime AS TIME) my_datetime id NULL NULL 1 00:00:00 0001-01-01 00:00:00 2 @@ -3501,11 +3649,45 @@ NULL NULL 1 DROP VIEW v1; +CREATE VIEW v1 AS SELECT CAST(my_double AS TIME), +my_double, id FROM t1_values; +SELECT CAST(my_double AS TIME), +my_double, id FROM t1_values +WHERE select_id = 53 OR select_id IS NULL order by id; +CAST(my_double AS TIME) my_double id +NULL NULL 1 +NULL -1.7976931348623e+308 2 +NULL 1.7976931348623e+308 3 +00:00:00 0 4 +-00:00:01 -1 5 +00:17:58 1758 25 +Warnings: +Warning 1292 Truncated incorrect time value: '-1.7976931348623e+308' +Warning 1292 Truncated incorrect time value: '1.7976931348623e+308' +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as time) AS `CAST(my_double AS TIME)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` +SELECT v1.* FROM v1 +WHERE v1.id IN (SELECT id FROM t1_values +WHERE select_id = 53 OR select_id IS NULL) order by id; +CAST(my_double AS TIME) my_double id +NULL NULL 1 +NULL -1.7976931348623e+308 2 +NULL 1.7976931348623e+308 3 +00:00:00 0 4 +-00:00:01 -1 5 +00:17:58 1758 25 +Warnings: +Warning 1292 Truncated incorrect time value: '-1.7976931348623e+308' +Warning 1292 Truncated incorrect time value: '1.7976931348623e+308' +DROP VIEW v1; + + CREATE VIEW v1 AS SELECT CAST(my_bigint AS TIME), my_bigint, id FROM t1_values; SELECT CAST(my_bigint AS TIME), my_bigint, id FROM t1_values -WHERE select_id = 52 OR select_id IS NULL; +WHERE select_id = 52 OR select_id IS NULL order by id; CAST(my_bigint AS TIME) my_bigint id NULL NULL 1 NULL -9223372036854775808 2 @@ -3521,7 +3703,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as time) AS `CAST(my_bigint AS TIME)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 52 OR select_id IS NULL); +WHERE select_id = 52 OR select_id IS NULL) order by id; CAST(my_bigint AS TIME) my_bigint id NULL NULL 1 NULL -9223372036854775808 2 @@ -3539,7 +3721,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS TIME), my_varbinary_1000, id FROM t1_values; SELECT CAST(my_varbinary_1000 AS TIME), my_varbinary_1000, id FROM t1_values -WHERE select_id = 51 OR select_id IS NULL; +WHERE select_id = 51 OR select_id IS NULL order by id; CAST(my_varbinary_1000 AS TIME) my_varbinary_1000 id NULL NULL 1 NULL 2 @@ -3556,7 +3738,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as time) AS `CAST(my_varbinary_1000 AS TIME)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 51 OR select_id IS NULL); +WHERE select_id = 51 OR select_id IS NULL) order by id; CAST(my_varbinary_1000 AS TIME) my_varbinary_1000 id NULL NULL 1 NULL 2 @@ -3575,14 +3757,14 @@ CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS TIME), my_binary_30, id FROM t1_values; SELECT CAST(my_binary_30 AS TIME), my_binary_30, id FROM t1_values -WHERE select_id = 50 OR select_id IS NULL; +WHERE select_id = 50 OR select_id IS NULL order by id; CAST(my_binary_30 AS TIME) my_binary_30 id NULL NULL 1 -00:00:00 +00:00:00 2 00:00:00 <--------30 characters-------> 3 --00:00:00 ---äÖüß@µ*$-- -NULL -1 -41:58:00 1 17:58 +-00:00:00 ---äÖüß@µ*$-- 4 +NULL -1 5 +41:58:00 1 17:58 22 Warnings: Warning 1292 Truncated incorrect time value: '' Warning 1292 Truncated incorrect time value: '<--------30 characters------->' @@ -3594,7 +3776,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as time) AS `CAST(my_binary_30 AS TIME)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 50 OR select_id IS NULL); +WHERE select_id = 50 OR select_id IS NULL) order by id; CAST(my_binary_30 AS TIME) my_binary_30 id NULL NULL 1 00:00:00 @@ -3615,7 +3797,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS TIME), my_varchar_1000, id FROM t1_values; SELECT CAST(my_varchar_1000 AS TIME), my_varchar_1000, id FROM t1_values -WHERE select_id = 49 OR select_id IS NULL; +WHERE select_id = 49 OR select_id IS NULL order by id; CAST(my_varchar_1000 AS TIME) my_varchar_1000 id NULL NULL 1 NULL 2 @@ -3632,7 +3814,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as time) AS `CAST(my_varchar_1000 AS TIME)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 49 OR select_id IS NULL); +WHERE select_id = 49 OR select_id IS NULL) order by id; CAST(my_varchar_1000 AS TIME) my_varchar_1000 id NULL NULL 1 NULL 2 @@ -3651,7 +3833,7 @@ CREATE VIEW v1 AS SELECT CAST(my_char_30 AS TIME), my_char_30, id FROM t1_values; SELECT CAST(my_char_30 AS TIME), my_char_30, id FROM t1_values -WHERE select_id = 48 OR select_id IS NULL; +WHERE select_id = 48 OR select_id IS NULL order by id; CAST(my_char_30 AS TIME) my_char_30 id NULL NULL 1 NULL 2 @@ -3668,7 +3850,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as time) AS `CAST(my_char_30 AS TIME)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 48 OR select_id IS NULL); +WHERE select_id = 48 OR select_id IS NULL) order by id; CAST(my_char_30 AS TIME) my_char_30 id NULL NULL 1 NULL 2 @@ -3687,7 +3869,7 @@ CREATE VIEW v1 AS SELECT CAST(my_year AS DATETIME), my_year, id FROM t1_values; SELECT CAST(my_year AS DATETIME), my_year, id FROM t1_values -WHERE select_id = 47 OR select_id IS NULL; +WHERE select_id = 47 OR select_id IS NULL order by id; CAST(my_year AS DATETIME) my_year id NULL NULL 1 NULL 1901 2 @@ -3704,7 +3886,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as datetime) AS `CAST(my_year AS DATETIME)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 47 OR select_id IS NULL); +WHERE select_id = 47 OR select_id IS NULL) order by id; CAST(my_year AS DATETIME) my_year id NULL NULL 1 NULL 1901 2 @@ -3723,7 +3905,7 @@ CREATE VIEW v1 AS SELECT CAST(my_time AS DATETIME), my_time, id FROM t1_values; SELECT CAST(my_time AS DATETIME), my_time, id FROM t1_values -WHERE select_id = 46 OR select_id IS NULL; +WHERE select_id = 46 OR select_id IS NULL order by id; CAST(my_time AS DATETIME) my_time id NULL NULL 1 0000-00-00 00:00:00 -838:59:59 2 @@ -3738,7 +3920,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as datetime) AS `CAST(my_time AS DATETIME)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 46 OR select_id IS NULL); +WHERE select_id = 46 OR select_id IS NULL) order by id; CAST(my_time AS DATETIME) my_time id NULL NULL 1 0000-00-00 00:00:00 -838:59:59 2 @@ -3755,7 +3937,7 @@ CREATE VIEW v1 AS SELECT CAST(my_timestamp AS DATETIME), my_timestamp, id FROM t1_values; SELECT CAST(my_timestamp AS DATETIME), my_timestamp, id FROM t1_values -WHERE select_id = 45 OR select_id IS NULL; +WHERE select_id = 45 OR select_id IS NULL order by id; CAST(my_timestamp AS DATETIME) my_timestamp id 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1970-01-01 03:00:01 1970-01-01 03:00:01 2 @@ -3767,7 +3949,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as datetime) AS `CAST(my_timestamp AS DATETIME)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 45 OR select_id IS NULL); +WHERE select_id = 45 OR select_id IS NULL) order by id; CAST(my_timestamp AS DATETIME) my_timestamp id 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1970-01-01 03:00:01 1970-01-01 03:00:01 2 @@ -3781,7 +3963,7 @@ CREATE VIEW v1 AS SELECT CAST(my_date AS DATETIME), my_date, id FROM t1_values; SELECT CAST(my_date AS DATETIME), my_date, id FROM t1_values -WHERE select_id = 44 OR select_id IS NULL; +WHERE select_id = 44 OR select_id IS NULL order by id; CAST(my_date AS DATETIME) my_date id NULL NULL 1 0001-01-01 00:00:00 0001-01-01 2 @@ -3793,7 +3975,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as datetime) AS `CAST(my_date AS DATETIME)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 44 OR select_id IS NULL); +WHERE select_id = 44 OR select_id IS NULL) order by id; CAST(my_date AS DATETIME) my_date id NULL NULL 1 0001-01-01 00:00:00 0001-01-01 2 @@ -3807,7 +3989,7 @@ CREATE VIEW v1 AS SELECT CAST(my_datetime AS DATETIME), my_datetime, id FROM t1_values; SELECT CAST(my_datetime AS DATETIME), my_datetime, id FROM t1_values -WHERE select_id = 43 OR select_id IS NULL; +WHERE select_id = 43 OR select_id IS NULL order by id; CAST(my_datetime AS DATETIME) my_datetime id NULL NULL 1 0001-01-01 00:00:00 0001-01-01 00:00:00 2 @@ -3819,7 +4001,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as datetime) AS `CAST(my_datetime AS DATETIME)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 43 OR select_id IS NULL); +WHERE select_id = 43 OR select_id IS NULL) order by id; CAST(my_datetime AS DATETIME) my_datetime id NULL NULL 1 0001-01-01 00:00:00 0001-01-01 00:00:00 2 @@ -3833,7 +4015,7 @@ CREATE VIEW v1 AS SELECT CAST(my_double AS DATETIME), my_double, id FROM t1_values; SELECT CAST(my_double AS DATETIME), my_double, id FROM t1_values -WHERE select_id = 42 OR select_id IS NULL; +WHERE select_id = 42 OR select_id IS NULL order by id; CAST(my_double AS DATETIME) my_double id NULL NULL 1 NULL -1.7976931348623e+308 2 @@ -3852,7 +4034,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as datetime) AS `CAST(my_double AS DATETIME)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 42 OR select_id IS NULL); +WHERE select_id = 42 OR select_id IS NULL) order by id; CAST(my_double AS DATETIME) my_double id NULL NULL 1 NULL -1.7976931348623e+308 2 @@ -3873,7 +4055,7 @@ CREATE VIEW v1 AS SELECT CAST(my_bigint AS DATETIME), my_bigint, id FROM t1_values; SELECT CAST(my_bigint AS DATETIME), my_bigint, id FROM t1_values -WHERE select_id = 41 OR select_id IS NULL; +WHERE select_id = 41 OR select_id IS NULL order by id; CAST(my_bigint AS DATETIME) my_bigint id NULL NULL 1 NULL -9223372036854775808 2 @@ -3892,7 +4074,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as datetime) AS `CAST(my_bigint AS DATETIME)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 41 OR select_id IS NULL); +WHERE select_id = 41 OR select_id IS NULL) order by id; CAST(my_bigint AS DATETIME) my_bigint id NULL NULL 1 NULL -9223372036854775808 2 @@ -3913,7 +4095,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS DATETIME), my_varbinary_1000, id FROM t1_values; SELECT CAST(my_varbinary_1000 AS DATETIME), my_varbinary_1000, id FROM t1_values -WHERE select_id = 40 OR select_id IS NULL; +WHERE select_id = 40 OR select_id IS NULL order by id; CAST(my_varbinary_1000 AS DATETIME) my_varbinary_1000 id NULL NULL 1 NULL 2 @@ -3931,7 +4113,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as datetime) AS `CAST(my_varbinary_1000 AS DATETIME)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 40 OR select_id IS NULL); +WHERE select_id = 40 OR select_id IS NULL) order by id; CAST(my_varbinary_1000 AS DATETIME) my_varbinary_1000 id NULL NULL 1 NULL 2 @@ -3951,14 +4133,14 @@ CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS DATETIME), my_binary_30, id FROM t1_values; SELECT CAST(my_binary_30 AS DATETIME), my_binary_30, id FROM t1_values -WHERE select_id = 39 OR select_id IS NULL; +WHERE select_id = 39 OR select_id IS NULL order by id; CAST(my_binary_30 AS DATETIME) my_binary_30 id NULL NULL 1 -NULL +NULL 2 NULL <--------30 characters-------> 3 -NULL ---äÖüß@µ*$-- -NULL -1 -2005-06-27 17:58:00 2005-06-27 17:58 +NULL ---äÖüß@µ*$-- 4 +NULL -1 5 +2005-06-27 17:58:00 2005-06-27 17:58 16 Warnings: Warning 1292 Truncated incorrect datetime value: '' Warning 1292 Truncated incorrect datetime value: '<--------30 characters------->' @@ -3970,7 +4152,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as datetime) AS `CAST(my_binary_30 AS DATETIME)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 39 OR select_id IS NULL); +WHERE select_id = 39 OR select_id IS NULL) order by id; CAST(my_binary_30 AS DATETIME) my_binary_30 id NULL NULL 1 NULL @@ -3991,7 +4173,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS DATETIME), my_varchar_1000, id FROM t1_values; SELECT CAST(my_varchar_1000 AS DATETIME), my_varchar_1000, id FROM t1_values -WHERE select_id = 38 OR select_id IS NULL; +WHERE select_id = 38 OR select_id IS NULL order by id; CAST(my_varchar_1000 AS DATETIME) my_varchar_1000 id NULL NULL 1 NULL 2 @@ -4009,7 +4191,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as datetime) AS `CAST(my_varchar_1000 AS DATETIME)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 38 OR select_id IS NULL); +WHERE select_id = 38 OR select_id IS NULL) order by id; CAST(my_varchar_1000 AS DATETIME) my_varchar_1000 id NULL NULL 1 NULL 2 @@ -4029,7 +4211,7 @@ CREATE VIEW v1 AS SELECT CAST(my_char_30 AS DATETIME), my_char_30, id FROM t1_values; SELECT CAST(my_char_30 AS DATETIME), my_char_30, id FROM t1_values -WHERE select_id = 37 OR select_id IS NULL; +WHERE select_id = 37 OR select_id IS NULL order by id; CAST(my_char_30 AS DATETIME) my_char_30 id NULL NULL 1 NULL 2 @@ -4047,7 +4229,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as datetime) AS `CAST(my_char_30 AS DATETIME)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 37 OR select_id IS NULL); +WHERE select_id = 37 OR select_id IS NULL) order by id; CAST(my_char_30 AS DATETIME) my_char_30 id NULL NULL 1 NULL 2 @@ -4067,7 +4249,7 @@ CREATE VIEW v1 AS SELECT CAST(my_year AS DATE), my_year, id FROM t1_values; SELECT CAST(my_year AS DATE), my_year, id FROM t1_values -WHERE select_id = 36 OR select_id IS NULL; +WHERE select_id = 36 OR select_id IS NULL order by id; CAST(my_year AS DATE) my_year id NULL NULL 1 NULL 1901 2 @@ -4084,7 +4266,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as date) AS `CAST(my_year AS DATE)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 36 OR select_id IS NULL); +WHERE select_id = 36 OR select_id IS NULL) order by id; CAST(my_year AS DATE) my_year id NULL NULL 1 NULL 1901 2 @@ -4103,7 +4285,7 @@ CREATE VIEW v1 AS SELECT CAST(my_time AS DATE), my_time, id FROM t1_values; SELECT CAST(my_time AS DATE), my_time, id FROM t1_values -WHERE select_id = 35 OR select_id IS NULL; +WHERE select_id = 35 OR select_id IS NULL order by id; CAST(my_time AS DATE) my_time id NULL NULL 1 0000-00-00 -838:59:59 2 @@ -4115,7 +4297,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as date) AS `CAST(my_time AS DATE)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 35 OR select_id IS NULL); +WHERE select_id = 35 OR select_id IS NULL) order by id; CAST(my_time AS DATE) my_time id NULL NULL 1 0000-00-00 -838:59:59 2 @@ -4129,7 +4311,7 @@ CREATE VIEW v1 AS SELECT CAST(my_timestamp AS DATE), my_timestamp, id FROM t1_values; SELECT CAST(my_timestamp AS DATE), my_timestamp, id FROM t1_values -WHERE select_id = 34 OR select_id IS NULL; +WHERE select_id = 34 OR select_id IS NULL order by id; CAST(my_timestamp AS DATE) my_timestamp id 0000-00-00 0000-00-00 00:00:00 1 1970-01-01 1970-01-01 03:00:01 2 @@ -4141,7 +4323,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as date) AS `CAST(my_timestamp AS DATE)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 34 OR select_id IS NULL); +WHERE select_id = 34 OR select_id IS NULL) order by id; CAST(my_timestamp AS DATE) my_timestamp id 0000-00-00 0000-00-00 00:00:00 1 1970-01-01 1970-01-01 03:00:01 2 @@ -4155,7 +4337,7 @@ CREATE VIEW v1 AS SELECT CAST(my_date AS DATE), my_date, id FROM t1_values; SELECT CAST(my_date AS DATE), my_date, id FROM t1_values -WHERE select_id = 33 OR select_id IS NULL; +WHERE select_id = 33 OR select_id IS NULL order by id; CAST(my_date AS DATE) my_date id NULL NULL 1 0001-01-01 0001-01-01 2 @@ -4167,7 +4349,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as date) AS `CAST(my_date AS DATE)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 33 OR select_id IS NULL); +WHERE select_id = 33 OR select_id IS NULL) order by id; CAST(my_date AS DATE) my_date id NULL NULL 1 0001-01-01 0001-01-01 2 @@ -4181,7 +4363,7 @@ CREATE VIEW v1 AS SELECT CAST(my_datetime AS DATE), my_datetime, id FROM t1_values; SELECT CAST(my_datetime AS DATE), my_datetime, id FROM t1_values -WHERE select_id = 32 OR select_id IS NULL; +WHERE select_id = 32 OR select_id IS NULL order by id; CAST(my_datetime AS DATE) my_datetime id NULL NULL 1 0001-01-01 0001-01-01 00:00:00 2 @@ -4193,7 +4375,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as date) AS `CAST(my_datetime AS DATE)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 32 OR select_id IS NULL); +WHERE select_id = 32 OR select_id IS NULL) order by id; CAST(my_datetime AS DATE) my_datetime id NULL NULL 1 0001-01-01 0001-01-01 00:00:00 2 @@ -4207,7 +4389,7 @@ CREATE VIEW v1 AS SELECT CAST(my_double AS DATE), my_double, id FROM t1_values; SELECT CAST(my_double AS DATE), my_double, id FROM t1_values -WHERE select_id = 31 OR select_id IS NULL; +WHERE select_id = 31 OR select_id IS NULL order by id; CAST(my_double AS DATE) my_double id NULL NULL 1 NULL -1.7976931348623e+308 2 @@ -4225,7 +4407,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as date) AS `CAST(my_double AS DATE)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 31 OR select_id IS NULL); +WHERE select_id = 31 OR select_id IS NULL) order by id; CAST(my_double AS DATE) my_double id NULL NULL 1 NULL -1.7976931348623e+308 2 @@ -4245,7 +4427,7 @@ CREATE VIEW v1 AS SELECT CAST(my_bigint AS DATE), my_bigint, id FROM t1_values; SELECT CAST(my_bigint AS DATE), my_bigint, id FROM t1_values -WHERE select_id = 30 OR select_id IS NULL; +WHERE select_id = 30 OR select_id IS NULL order by id; CAST(my_bigint AS DATE) my_bigint id NULL NULL 1 NULL -9223372036854775808 2 @@ -4263,7 +4445,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as date) AS `CAST(my_bigint AS DATE)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 30 OR select_id IS NULL); +WHERE select_id = 30 OR select_id IS NULL) order by id; CAST(my_bigint AS DATE) my_bigint id NULL NULL 1 NULL -9223372036854775808 2 @@ -4283,7 +4465,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS DATE), my_varbinary_1000, id FROM t1_values; SELECT CAST(my_varbinary_1000 AS DATE), my_varbinary_1000, id FROM t1_values -WHERE select_id = 29 OR select_id IS NULL; +WHERE select_id = 29 OR select_id IS NULL order by id; CAST(my_varbinary_1000 AS DATE) my_varbinary_1000 id NULL NULL 1 NULL 2 @@ -4301,7 +4483,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as date) AS `CAST(my_varbinary_1000 AS DATE)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 29 OR select_id IS NULL); +WHERE select_id = 29 OR select_id IS NULL) order by id; CAST(my_varbinary_1000 AS DATE) my_varbinary_1000 id NULL NULL 1 NULL 2 @@ -4321,14 +4503,14 @@ CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS DATE), my_binary_30, id FROM t1_values; SELECT CAST(my_binary_30 AS DATE), my_binary_30, id FROM t1_values -WHERE select_id = 28 OR select_id IS NULL; +WHERE select_id = 28 OR select_id IS NULL order by id; CAST(my_binary_30 AS DATE) my_binary_30 id NULL NULL 1 -NULL +NULL 2 NULL <--------30 characters-------> 3 -NULL ---äÖüß@µ*$-- -NULL -1 -2005-06-27 2005-06-27 +NULL ---äÖüß@µ*$-- 4 +NULL -1 5 +2005-06-27 2005-06-27 10 Warnings: Warning 1292 Truncated incorrect datetime value: '' Warning 1292 Truncated incorrect datetime value: '<--------30 characters------->' @@ -4340,7 +4522,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as date) AS `CAST(my_binary_30 AS DATE)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 28 OR select_id IS NULL); +WHERE select_id = 28 OR select_id IS NULL) order by id; CAST(my_binary_30 AS DATE) my_binary_30 id NULL NULL 1 NULL @@ -4361,7 +4543,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS DATE), my_varchar_1000, id FROM t1_values; SELECT CAST(my_varchar_1000 AS DATE), my_varchar_1000, id FROM t1_values -WHERE select_id = 27 OR select_id IS NULL; +WHERE select_id = 27 OR select_id IS NULL order by id; CAST(my_varchar_1000 AS DATE) my_varchar_1000 id NULL NULL 1 NULL 2 @@ -4379,7 +4561,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as date) AS `CAST(my_varchar_1000 AS DATE)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 27 OR select_id IS NULL); +WHERE select_id = 27 OR select_id IS NULL) order by id; CAST(my_varchar_1000 AS DATE) my_varchar_1000 id NULL NULL 1 NULL 2 @@ -4399,7 +4581,7 @@ CREATE VIEW v1 AS SELECT CAST(my_char_30 AS DATE), my_char_30, id FROM t1_values; SELECT CAST(my_char_30 AS DATE), my_char_30, id FROM t1_values -WHERE select_id = 26 OR select_id IS NULL; +WHERE select_id = 26 OR select_id IS NULL order by id; CAST(my_char_30 AS DATE) my_char_30 id NULL NULL 1 NULL 2 @@ -4417,7 +4599,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as date) AS `CAST(my_char_30 AS DATE)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 26 OR select_id IS NULL); +WHERE select_id = 26 OR select_id IS NULL) order by id; CAST(my_char_30 AS DATE) my_char_30 id NULL NULL 1 NULL 2 @@ -4437,7 +4619,7 @@ CREATE VIEW v1 AS SELECT CAST(my_year AS CHAR), my_year, id FROM t1_values; SELECT CAST(my_year AS CHAR), my_year, id FROM t1_values -WHERE select_id = 25 OR select_id IS NULL; +WHERE select_id = 25 OR select_id IS NULL order by id; CAST(my_year AS CHAR) my_year id NULL NULL 1 1901 1901 2 @@ -4449,7 +4631,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as char charset latin1) AS `CAST(my_year AS CHAR)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 25 OR select_id IS NULL); +WHERE select_id = 25 OR select_id IS NULL) order by id; CAST(my_year AS CHAR) my_year id NULL NULL 1 1901 1901 2 @@ -4463,7 +4645,7 @@ CREATE VIEW v1 AS SELECT CAST(my_time AS CHAR), my_time, id FROM t1_values; SELECT CAST(my_time AS CHAR), my_time, id FROM t1_values -WHERE select_id = 24 OR select_id IS NULL; +WHERE select_id = 24 OR select_id IS NULL order by id; CAST(my_time AS CHAR) my_time id NULL NULL 1 -838:59:59 -838:59:59 2 @@ -4475,7 +4657,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as char charset latin1) AS `CAST(my_time AS CHAR)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 24 OR select_id IS NULL); +WHERE select_id = 24 OR select_id IS NULL) order by id; CAST(my_time AS CHAR) my_time id NULL NULL 1 -838:59:59 -838:59:59 2 @@ -4489,7 +4671,7 @@ CREATE VIEW v1 AS SELECT CAST(my_timestamp AS CHAR), my_timestamp, id FROM t1_values; SELECT CAST(my_timestamp AS CHAR), my_timestamp, id FROM t1_values -WHERE select_id = 23 OR select_id IS NULL; +WHERE select_id = 23 OR select_id IS NULL order by id; CAST(my_timestamp AS CHAR) my_timestamp id 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1970-01-01 03:00:01 1970-01-01 03:00:01 2 @@ -4501,7 +4683,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as char charset latin1) AS `CAST(my_timestamp AS CHAR)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 23 OR select_id IS NULL); +WHERE select_id = 23 OR select_id IS NULL) order by id; CAST(my_timestamp AS CHAR) my_timestamp id 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1970-01-01 03:00:01 1970-01-01 03:00:01 2 @@ -4515,7 +4697,7 @@ CREATE VIEW v1 AS SELECT CAST(my_date AS CHAR), my_date, id FROM t1_values; SELECT CAST(my_date AS CHAR), my_date, id FROM t1_values -WHERE select_id = 22 OR select_id IS NULL; +WHERE select_id = 22 OR select_id IS NULL order by id; CAST(my_date AS CHAR) my_date id NULL NULL 1 0001-01-01 0001-01-01 2 @@ -4527,7 +4709,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as char charset latin1) AS `CAST(my_date AS CHAR)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 22 OR select_id IS NULL); +WHERE select_id = 22 OR select_id IS NULL) order by id; CAST(my_date AS CHAR) my_date id NULL NULL 1 0001-01-01 0001-01-01 2 @@ -4541,7 +4723,7 @@ CREATE VIEW v1 AS SELECT CAST(my_datetime AS CHAR), my_datetime, id FROM t1_values; SELECT CAST(my_datetime AS CHAR), my_datetime, id FROM t1_values -WHERE select_id = 21 OR select_id IS NULL; +WHERE select_id = 21 OR select_id IS NULL order by id; CAST(my_datetime AS CHAR) my_datetime id NULL NULL 1 0001-01-01 00:00:00 0001-01-01 00:00:00 2 @@ -4553,7 +4735,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as char charset latin1) AS `CAST(my_datetime AS CHAR)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 21 OR select_id IS NULL); +WHERE select_id = 21 OR select_id IS NULL) order by id; CAST(my_datetime AS CHAR) my_datetime id NULL NULL 1 0001-01-01 00:00:00 0001-01-01 00:00:00 2 @@ -4567,7 +4749,7 @@ CREATE VIEW v1 AS SELECT CAST(my_double AS CHAR), my_double, id FROM t1_values; SELECT CAST(my_double AS CHAR), my_double, id FROM t1_values -WHERE select_id = 20 OR select_id IS NULL; +WHERE select_id = 20 OR select_id IS NULL order by id; CAST(my_double AS CHAR) my_double id NULL NULL 1 -1.7976931348623e+308 -1.7976931348623e+308 2 @@ -4579,7 +4761,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as char charset latin1) AS `CAST(my_double AS CHAR)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 20 OR select_id IS NULL); +WHERE select_id = 20 OR select_id IS NULL) order by id; CAST(my_double AS CHAR) my_double id NULL NULL 1 -1.7976931348623e+308 -1.7976931348623e+308 2 @@ -4593,7 +4775,7 @@ CREATE VIEW v1 AS SELECT CAST(my_decimal AS CHAR), my_decimal, id FROM t1_values; SELECT CAST(my_decimal AS CHAR), my_decimal, id FROM t1_values -WHERE select_id = 19 OR select_id IS NULL; +WHERE select_id = 19 OR select_id IS NULL order by id; CAST(my_decimal AS CHAR) my_decimal id NULL NULL 1 -9999999999999999999999999999999999.999999999999999999999999999999 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -4605,7 +4787,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as char charset latin1) AS `CAST(my_decimal AS CHAR)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 19 OR select_id IS NULL); +WHERE select_id = 19 OR select_id IS NULL) order by id; CAST(my_decimal AS CHAR) my_decimal id NULL NULL 1 -9999999999999999999999999999999999.999999999999999999999999999999 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -4619,7 +4801,7 @@ CREATE VIEW v1 AS SELECT CAST(my_bigint AS CHAR), my_bigint, id FROM t1_values; SELECT CAST(my_bigint AS CHAR), my_bigint, id FROM t1_values -WHERE select_id = 18 OR select_id IS NULL; +WHERE select_id = 18 OR select_id IS NULL order by id; CAST(my_bigint AS CHAR) my_bigint id NULL NULL 1 -9223372036854775808 -9223372036854775808 2 @@ -4631,7 +4813,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as char charset latin1) AS `CAST(my_bigint AS CHAR)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 18 OR select_id IS NULL); +WHERE select_id = 18 OR select_id IS NULL) order by id; CAST(my_bigint AS CHAR) my_bigint id NULL NULL 1 -9223372036854775808 -9223372036854775808 2 @@ -4645,7 +4827,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS CHAR), my_varbinary_1000, id FROM t1_values; SELECT CAST(my_varbinary_1000 AS CHAR), my_varbinary_1000, id FROM t1_values -WHERE select_id = 17 OR select_id IS NULL; +WHERE select_id = 17 OR select_id IS NULL order by id; CAST(my_varbinary_1000 AS CHAR) my_varbinary_1000 id NULL NULL 1 2 @@ -4657,7 +4839,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as char charset latin1) AS `CAST(my_varbinary_1000 AS CHAR)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 17 OR select_id IS NULL); +WHERE select_id = 17 OR select_id IS NULL) order by id; CAST(my_varbinary_1000 AS CHAR) my_varbinary_1000 id NULL NULL 1 2 @@ -4671,19 +4853,19 @@ CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS CHAR), my_binary_30, id FROM t1_values; SELECT CAST(my_binary_30 AS CHAR), my_binary_30, id FROM t1_values -WHERE select_id = 16 OR select_id IS NULL; +WHERE select_id = 16 OR select_id IS NULL order by id; CAST(my_binary_30 AS CHAR) my_binary_30 id NULL NULL 1 - + 2 <--------30 characters-------> <--------30 characters-------> 3 - ---äÖüß@µ*$-- --1 + ---äÖüß@µ*$-- ---äÖüß@µ*$-- 4 +-1 -1 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as char charset latin1) AS `CAST(my_binary_30 AS CHAR)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 16 OR select_id IS NULL); +WHERE select_id = 16 OR select_id IS NULL) order by id; CAST(my_binary_30 AS CHAR) my_binary_30 id NULL NULL 1 @@ -4697,7 +4879,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS CHAR), my_varchar_1000, id FROM t1_values; SELECT CAST(my_varchar_1000 AS CHAR), my_varchar_1000, id FROM t1_values -WHERE select_id = 15 OR select_id IS NULL; +WHERE select_id = 15 OR select_id IS NULL order by id; CAST(my_varchar_1000 AS CHAR) my_varchar_1000 id NULL NULL 1 2 @@ -4709,7 +4891,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as char charset latin1) AS `CAST(my_varchar_1000 AS CHAR)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 15 OR select_id IS NULL); +WHERE select_id = 15 OR select_id IS NULL) order by id; CAST(my_varchar_1000 AS CHAR) my_varchar_1000 id NULL NULL 1 2 @@ -4723,7 +4905,7 @@ CREATE VIEW v1 AS SELECT CAST(my_char_30 AS CHAR), my_char_30, id FROM t1_values; SELECT CAST(my_char_30 AS CHAR), my_char_30, id FROM t1_values -WHERE select_id = 14 OR select_id IS NULL; +WHERE select_id = 14 OR select_id IS NULL order by id; CAST(my_char_30 AS CHAR) my_char_30 id NULL NULL 1 2 @@ -4735,7 +4917,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as char charset latin1) AS `CAST(my_char_30 AS CHAR)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 14 OR select_id IS NULL); +WHERE select_id = 14 OR select_id IS NULL) order by id; CAST(my_char_30 AS CHAR) my_char_30 id NULL NULL 1 2 @@ -4749,7 +4931,7 @@ CREATE VIEW v1 AS SELECT CAST(my_year AS BINARY), my_year, id FROM t1_values; SELECT CAST(my_year AS BINARY), my_year, id FROM t1_values -WHERE select_id = 13 OR select_id IS NULL; +WHERE select_id = 13 OR select_id IS NULL order by id; CAST(my_year AS BINARY) my_year id NULL NULL 1 1901 1901 2 @@ -4761,7 +4943,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as char charset binary) AS `CAST(my_year AS BINARY)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 13 OR select_id IS NULL); +WHERE select_id = 13 OR select_id IS NULL) order by id; CAST(my_year AS BINARY) my_year id NULL NULL 1 1901 1901 2 @@ -4775,7 +4957,7 @@ CREATE VIEW v1 AS SELECT CAST(my_time AS BINARY), my_time, id FROM t1_values; SELECT CAST(my_time AS BINARY), my_time, id FROM t1_values -WHERE select_id = 12 OR select_id IS NULL; +WHERE select_id = 12 OR select_id IS NULL order by id; CAST(my_time AS BINARY) my_time id NULL NULL 1 -838:59:59 -838:59:59 2 @@ -4787,7 +4969,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as char charset binary) AS `CAST(my_time AS BINARY)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 12 OR select_id IS NULL); +WHERE select_id = 12 OR select_id IS NULL) order by id; CAST(my_time AS BINARY) my_time id NULL NULL 1 -838:59:59 -838:59:59 2 @@ -4801,7 +4983,7 @@ CREATE VIEW v1 AS SELECT CAST(my_timestamp AS BINARY), my_timestamp, id FROM t1_values; SELECT CAST(my_timestamp AS BINARY), my_timestamp, id FROM t1_values -WHERE select_id = 11 OR select_id IS NULL; +WHERE select_id = 11 OR select_id IS NULL order by id; CAST(my_timestamp AS BINARY) my_timestamp id 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1970-01-01 03:00:01 1970-01-01 03:00:01 2 @@ -4813,7 +4995,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as char charset binary) AS `CAST(my_timestamp AS BINARY)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 11 OR select_id IS NULL); +WHERE select_id = 11 OR select_id IS NULL) order by id; CAST(my_timestamp AS BINARY) my_timestamp id 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1970-01-01 03:00:01 1970-01-01 03:00:01 2 @@ -4827,7 +5009,7 @@ CREATE VIEW v1 AS SELECT CAST(my_date AS BINARY), my_date, id FROM t1_values; SELECT CAST(my_date AS BINARY), my_date, id FROM t1_values -WHERE select_id = 10 OR select_id IS NULL; +WHERE select_id = 10 OR select_id IS NULL order by id; CAST(my_date AS BINARY) my_date id NULL NULL 1 0001-01-01 0001-01-01 2 @@ -4839,7 +5021,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as char charset binary) AS `CAST(my_date AS BINARY)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 10 OR select_id IS NULL); +WHERE select_id = 10 OR select_id IS NULL) order by id; CAST(my_date AS BINARY) my_date id NULL NULL 1 0001-01-01 0001-01-01 2 @@ -4853,7 +5035,7 @@ CREATE VIEW v1 AS SELECT CAST(my_datetime AS BINARY), my_datetime, id FROM t1_values; SELECT CAST(my_datetime AS BINARY), my_datetime, id FROM t1_values -WHERE select_id = 9 OR select_id IS NULL; +WHERE select_id = 9 OR select_id IS NULL order by id; CAST(my_datetime AS BINARY) my_datetime id NULL NULL 1 0001-01-01 00:00:00 0001-01-01 00:00:00 2 @@ -4865,7 +5047,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as char charset binary) AS `CAST(my_datetime AS BINARY)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 9 OR select_id IS NULL); +WHERE select_id = 9 OR select_id IS NULL) order by id; CAST(my_datetime AS BINARY) my_datetime id NULL NULL 1 0001-01-01 00:00:00 0001-01-01 00:00:00 2 @@ -4879,7 +5061,7 @@ CREATE VIEW v1 AS SELECT CAST(my_double AS BINARY), my_double, id FROM t1_values; SELECT CAST(my_double AS BINARY), my_double, id FROM t1_values -WHERE select_id = 8 OR select_id IS NULL; +WHERE select_id = 8 OR select_id IS NULL order by id; CAST(my_double AS BINARY) my_double id NULL NULL 1 -1.7976931348623e+308 -1.7976931348623e+308 2 @@ -4891,7 +5073,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as char charset binary) AS `CAST(my_double AS BINARY)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 8 OR select_id IS NULL); +WHERE select_id = 8 OR select_id IS NULL) order by id; CAST(my_double AS BINARY) my_double id NULL NULL 1 -1.7976931348623e+308 -1.7976931348623e+308 2 @@ -4905,7 +5087,7 @@ CREATE VIEW v1 AS SELECT CAST(my_decimal AS BINARY), my_decimal, id FROM t1_values; SELECT CAST(my_decimal AS BINARY), my_decimal, id FROM t1_values -WHERE select_id = 7 OR select_id IS NULL; +WHERE select_id = 7 OR select_id IS NULL order by id; CAST(my_decimal AS BINARY) my_decimal id NULL NULL 1 -9999999999999999999999999999999999.999999999999999999999999999999 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -4917,7 +5099,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as char charset binary) AS `CAST(my_decimal AS BINARY)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 7 OR select_id IS NULL); +WHERE select_id = 7 OR select_id IS NULL) order by id; CAST(my_decimal AS BINARY) my_decimal id NULL NULL 1 -9999999999999999999999999999999999.999999999999999999999999999999 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -4931,7 +5113,7 @@ CREATE VIEW v1 AS SELECT CAST(my_bigint AS BINARY), my_bigint, id FROM t1_values; SELECT CAST(my_bigint AS BINARY), my_bigint, id FROM t1_values -WHERE select_id = 6 OR select_id IS NULL; +WHERE select_id = 6 OR select_id IS NULL order by id; CAST(my_bigint AS BINARY) my_bigint id NULL NULL 1 -9223372036854775808 -9223372036854775808 2 @@ -4943,7 +5125,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as char charset binary) AS `CAST(my_bigint AS BINARY)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 6 OR select_id IS NULL); +WHERE select_id = 6 OR select_id IS NULL) order by id; CAST(my_bigint AS BINARY) my_bigint id NULL NULL 1 -9223372036854775808 -9223372036854775808 2 @@ -4957,7 +5139,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS BINARY), my_varbinary_1000, id FROM t1_values; SELECT CAST(my_varbinary_1000 AS BINARY), my_varbinary_1000, id FROM t1_values -WHERE select_id = 5 OR select_id IS NULL; +WHERE select_id = 5 OR select_id IS NULL order by id; CAST(my_varbinary_1000 AS BINARY) my_varbinary_1000 id NULL NULL 1 2 @@ -4969,7 +5151,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as char charset binary) AS `CAST(my_varbinary_1000 AS BINARY)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 5 OR select_id IS NULL); +WHERE select_id = 5 OR select_id IS NULL) order by id; CAST(my_varbinary_1000 AS BINARY) my_varbinary_1000 id NULL NULL 1 2 @@ -4983,19 +5165,19 @@ CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS BINARY), my_binary_30, id FROM t1_values; SELECT CAST(my_binary_30 AS BINARY), my_binary_30, id FROM t1_values -WHERE select_id = 4 OR select_id IS NULL; +WHERE select_id = 4 OR select_id IS NULL order by id; CAST(my_binary_30 AS BINARY) my_binary_30 id NULL NULL 1 - + 2 <--------30 characters-------> <--------30 characters-------> 3 - ---äÖüß@µ*$-- --1 + ---äÖüß@µ*$-- ---äÖüß@µ*$-- 4 +-1 -1 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as char charset binary) AS `CAST(my_binary_30 AS BINARY)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 4 OR select_id IS NULL); +WHERE select_id = 4 OR select_id IS NULL) order by id; CAST(my_binary_30 AS BINARY) my_binary_30 id NULL NULL 1 @@ -5009,7 +5191,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS BINARY), my_varchar_1000, id FROM t1_values; SELECT CAST(my_varchar_1000 AS BINARY), my_varchar_1000, id FROM t1_values -WHERE select_id = 3 OR select_id IS NULL; +WHERE select_id = 3 OR select_id IS NULL order by id; CAST(my_varchar_1000 AS BINARY) my_varchar_1000 id NULL NULL 1 2 @@ -5021,7 +5203,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as char charset binary) AS `CAST(my_varchar_1000 AS BINARY)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 3 OR select_id IS NULL); +WHERE select_id = 3 OR select_id IS NULL) order by id; CAST(my_varchar_1000 AS BINARY) my_varchar_1000 id NULL NULL 1 2 @@ -5035,7 +5217,7 @@ CREATE VIEW v1 AS SELECT CAST(my_char_30 AS BINARY), my_char_30, id FROM t1_values; SELECT CAST(my_char_30 AS BINARY), my_char_30, id FROM t1_values -WHERE select_id = 2 OR select_id IS NULL; +WHERE select_id = 2 OR select_id IS NULL order by id; CAST(my_char_30 AS BINARY) my_char_30 id NULL NULL 1 2 @@ -5047,7 +5229,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as char charset binary) AS `CAST(my_char_30 AS BINARY)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 2 OR select_id IS NULL); +WHERE select_id = 2 OR select_id IS NULL) order by id; CAST(my_char_30 AS BINARY) my_char_30 id NULL NULL 1 2 @@ -5059,7 +5241,7 @@ DROP VIEW v1; CREATE VIEW v1 AS SELECT sqrt(my_bigint), my_bigint, id FROM t1_values; SELECT sqrt(my_bigint), my_bigint, id FROM t1_values -WHERE select_id = 1 OR select_id IS NULL; +WHERE select_id = 1 OR select_id IS NULL order by id; sqrt(my_bigint) my_bigint id NULL NULL 1 NULL -9223372036854775808 2 @@ -5073,7 +5255,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sqrt(`t1_values`.`my_bigint`) AS `sqrt(my_bigint)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 1 OR select_id IS NULL); +WHERE select_id = 1 OR select_id IS NULL) order by id; sqrt(my_bigint) my_bigint id NULL NULL 1 NULL -9223372036854775808 2 diff --git a/mysql-test/suite/funcs_1/r/memory_storedproc_02.result b/mysql-test/suite/funcs_1/r/memory_storedproc_02.result index fd31aa76ab9..6ba95c9fa63 100644 --- a/mysql-test/suite/funcs_1/r/memory_storedproc_02.result +++ b/mysql-test/suite/funcs_1/r/memory_storedproc_02.result @@ -9,20 +9,25 @@ DROP DATABASE IF EXISTS db_storedproc_1; CREATE DATABASE db_storedproc; CREATE DATABASE db_storedproc_1; USE db_storedproc; -create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t1; -create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t2; -create table t3(f1 char(20),f2 char(20),f3 integer) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t3.txt' into table t3; -create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t4; +create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t1; +create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t2; +create table t3(f1 char(20),f2 char(20),f3 integer) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t3.txt' into table t3; +create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t4; USE db_storedproc_1; -create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t6; +create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t6; USE db_storedproc; -create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t7; +create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t7; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -34,8 +39,9 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t8; +create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t8; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -47,12 +53,14 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t9(f1 int, f2 char(25), f3 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' into table t9; -create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t10; -create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t11; +create table t9(f1 int, f2 char(25), f3 int) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t9.txt' into table t9; +create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t10; +create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t11; Section 3.1.2 - Syntax checks for the stored procedure-specific programming statements BEGIN/END, DECLARE, SET, SELECT/INTO, OPEN, FETCH, CLOSE: @@ -164,7 +172,7 @@ declare y integer default 1; set @x = x; set @y = y; set @z = 234; -SELECT f1, f2 into @x, @y from t2 limit 1; +SELECT f1, f2 into @x, @y from t2 where f1='a`' and f2='a`' limit 1; SELECT @x, @y, @z, invar; BEGIN set @x = 2; @@ -207,7 +215,7 @@ BEGIN declare x integer; declare y integer; set @x=x; set @y=y; -SELECT f4, f3 into @x, @y from t2 limit 1; +SELECT f4, f3 into @x, @y from t2 where f4=-5000 and f3='1000-01-01' limit 1; SELECT @x, @y; END// CALL sp1(); @@ -695,7 +703,7 @@ Testcase 3.1.2.54: ------------------ Ensure that a handler with a condition defined with an SQLSTATE that begins with -“01“ is always exactly equivalent in action to a handler with an SQLWARNING +“01“ is always exactly equivalent in action to a handler with an SQLWARNING condition. -------------------------------------------------------------------------------- DROP PROCEDURE IF EXISTS sp0; @@ -794,7 +802,7 @@ Testcase 3.1.2.56: ------------------ Ensure that a handler with a condition defined with an SQLSTATE that begins with -“02“ is always exactly equivalent in action to a handler with a NOT FOUND +“02“ is always exactly equivalent in action to a handler with a NOT FOUND condition. -------------------------------------------------------------------------------- DROP PROCEDURE IF EXISTS sp0; @@ -902,7 +910,7 @@ Testcase 3.1.2.58: ------------------ Ensure that a handler with a condition defined with an SQLSTATE that begins with -anything other that “01“ or “02“ is always exactly equivalent in action to a +anything other that “01“ or “02“ is always exactly equivalent in action to a handler with an SQLEXCEPTION condition. -------------------------------------------------------------------------------- DROP PROCEDURE IF EXISTS sp0; @@ -1082,7 +1090,8 @@ declare f2_value char(20); declare f5_value char(20); declare f4_value integer; declare f6_value integer; -declare cur1 cursor for SELECT f1, f2, f4, f5, f6 from t2 limit 3; +declare cur1 cursor for SELECT f1, f2, f4, f5, f6 from t2 +where f4 >=-5000 order by f4 limit 3; open cur1; while proceed do SELECT count AS 'loop'; @@ -1165,7 +1174,7 @@ of a compound statement ends. DROP TABLE IF EXISTS temp1; DROP PROCEDURE IF EXISTS sp1; create table temp1( f0 char(20), f1 char(20), f2 char(20), f3 int, f4 char(20) ); -SELECT f1, f2, f4, f5 from t2; +SELECT f1, f2, f4, f5 from t2 order by f4; f1 f2 f4 f5 a` a` -5000 a` aaa aaa -4999 aaa @@ -1185,8 +1194,8 @@ declare newf1 char(20); declare newf2 char(20); declare newf5 char(20); declare newf4 integer; -declare cur1 cursor for SELECT f1, f2, f4, f5 from t2 limit 5; -declare cur2 cursor for SELECT f1, f2, f4, f5 from t2 limit 5; +declare cur1 cursor for SELECT f1, f2, f4, f5 from t2 where f4 >= -5000 order by f4 limit 5; +declare cur2 cursor for SELECT f1, f2, f4, f5 from t2 where f4 >= -5000 order by f4 limit 5; open cur1; open cur2; BEGIN @@ -1268,8 +1277,10 @@ declare i_newf11 char(20); declare i_newf12 char(20); declare i_newf13 date; declare i_newf14 integer; -declare cur1 cursor for SELECT f1, f2, f3, f4 from t2 limit 4; -declare cur2 cursor for SELECT f1, f2, f3, f4 from t2 limit 3; +declare cur1 cursor for SELECT f1, f2, f3, f4 from t2 +where f4>=-5000 order by f4 limit 4; +declare cur2 cursor for SELECT f1, f2, f3, f4 from t2 +where f4>=-5000 order by f4 limit 3; declare continue handler for sqlstate '02000' set proceed=0; open cur1; open cur2; @@ -1300,8 +1311,10 @@ DECLARE o_newf11 CHAR(20); DECLARE o_newf12 CHAR(20); DECLARE o_newf13 DATE; DECLARE o_newf14 INTEGER; -DECLARE cur1 CURSOR FOR SELECT f1, f2, f3, f4 FROM t2 LIMIT 5; -DECLARE cur2 CURSOR FOR SELECT f1, f2, f3, f4 FROM t2 LIMIT 5; +DECLARE cur1 CURSOR FOR SELECT f1, f2, f3, f4 FROM t2 +WHERE f4>=-5000 ORDER BY f4 LIMIT 5; +DECLARE cur2 CURSOR FOR SELECT f1, f2, f3, f4 FROM t2 +WHERE f4>=-5000 ORDER BY f4 LIMIT 5; DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET proceed=0; OPEN cur1; OPEN cur2; diff --git a/mysql-test/suite/funcs_1/r/memory_storedproc_03.result b/mysql-test/suite/funcs_1/r/memory_storedproc_03.result index c982691daad..53e25441e2e 100644 --- a/mysql-test/suite/funcs_1/r/memory_storedproc_03.result +++ b/mysql-test/suite/funcs_1/r/memory_storedproc_03.result @@ -9,20 +9,25 @@ DROP DATABASE IF EXISTS db_storedproc_1; CREATE DATABASE db_storedproc; CREATE DATABASE db_storedproc_1; USE db_storedproc; -create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t1; -create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t2; -create table t3(f1 char(20),f2 char(20),f3 integer) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t3.txt' into table t3; -create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t4; +create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t1; +create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t2; +create table t3(f1 char(20),f2 char(20),f3 integer) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t3.txt' into table t3; +create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t4; USE db_storedproc_1; -create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t6; +create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t6; USE db_storedproc; -create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t7; +create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t7; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -34,8 +39,9 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t8; +create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t8; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -47,12 +53,14 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t9(f1 int, f2 char(25), f3 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' into table t9; -create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t10; -create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t11; +create table t9(f1 int, f2 char(25), f3 int) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t9.txt' into table t9; +create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t10; +create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t11; Section 3.1.3 - Syntax checks for the stored procedure-specific flow control statements IF, CASE, LOOP, LEAVE, ITERATE, REPEAT, WHILE: diff --git a/mysql-test/suite/funcs_1/r/memory_storedproc_06.result b/mysql-test/suite/funcs_1/r/memory_storedproc_06.result index 890498e1966..88bddf68e24 100644 --- a/mysql-test/suite/funcs_1/r/memory_storedproc_06.result +++ b/mysql-test/suite/funcs_1/r/memory_storedproc_06.result @@ -9,20 +9,25 @@ DROP DATABASE IF EXISTS db_storedproc_1; CREATE DATABASE db_storedproc; CREATE DATABASE db_storedproc_1; USE db_storedproc; -create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t1; -create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t2; -create table t3(f1 char(20),f2 char(20),f3 integer) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t3.txt' into table t3; -create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t4; +create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t1; +create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t2; +create table t3(f1 char(20),f2 char(20),f3 integer) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t3.txt' into table t3; +create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t4; USE db_storedproc_1; -create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t6; +create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t6; USE db_storedproc; -create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t7; +create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t7; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -34,8 +39,9 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t8; +create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t8; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -47,12 +53,14 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t9(f1 int, f2 char(25), f3 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' into table t9; -create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t10; -create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t11; +create table t9(f1 int, f2 char(25), f3 int) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t9.txt' into table t9; +create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t10; +create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t11; Section 3.1.6 - Privilege Checks: -------------------------------------------------------------------------------- @@ -79,6 +87,7 @@ BEGIN SELECT * from db_storedproc_1.t6 where t6.f2= 'xyz'; END// ERROR 42000: Access denied for user 'user_1'@'localhost' to database 'db_storedproc_1' +USE db_storedproc_1; root@localhost db_storedproc_1 GRANT CREATE ROUTINE ON db_storedproc_1.* TO 'user_1'@'localhost'; @@ -90,6 +99,7 @@ CREATE PROCEDURE sp1(v1 char(20)) BEGIN SELECT * from db_storedproc_1.t6 where t6.f2= 'xyz'; END// +USE db_storedproc_1; root@localhost db_storedproc_1 DROP USER 'user_1'@'localhost'; @@ -115,6 +125,7 @@ CREATE FUNCTION fn1(v1 int) returns int BEGIN return v1; END// +USE db_storedproc_1; root@localhost db_storedproc_1 drop user 'user_1'@'localhost'; diff --git a/mysql-test/suite/funcs_1/r/memory_storedproc_07.result b/mysql-test/suite/funcs_1/r/memory_storedproc_07.result index 0980ca84a8c..cbe0a18435a 100644 --- a/mysql-test/suite/funcs_1/r/memory_storedproc_07.result +++ b/mysql-test/suite/funcs_1/r/memory_storedproc_07.result @@ -9,20 +9,25 @@ DROP DATABASE IF EXISTS db_storedproc_1; CREATE DATABASE db_storedproc; CREATE DATABASE db_storedproc_1; USE db_storedproc; -create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t1; -create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t2; -create table t3(f1 char(20),f2 char(20),f3 integer) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t3.txt' into table t3; -create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t4; +create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t1; +create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t2; +create table t3(f1 char(20),f2 char(20),f3 integer) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t3.txt' into table t3; +create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t4; USE db_storedproc_1; -create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t6; +create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t6; USE db_storedproc; -create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t7; +create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t7; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -34,8 +39,9 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t8; +create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t8; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -47,12 +53,14 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t9(f1 int, f2 char(25), f3 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' into table t9; -create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t10; -create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t11; +create table t9(f1 int, f2 char(25), f3 int) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t9.txt' into table t9; +create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t10; +create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t11; Section 3.1.7 - SQL mode checks: -------------------------------------------------------------------------------- diff --git a/mysql-test/suite/funcs_1/r/memory_storedproc_08.result b/mysql-test/suite/funcs_1/r/memory_storedproc_08.result index e3f9556a082..40ebc1e51e4 100644 --- a/mysql-test/suite/funcs_1/r/memory_storedproc_08.result +++ b/mysql-test/suite/funcs_1/r/memory_storedproc_08.result @@ -9,20 +9,25 @@ DROP DATABASE IF EXISTS db_storedproc_1; CREATE DATABASE db_storedproc; CREATE DATABASE db_storedproc_1; USE db_storedproc; -create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t1; -create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t2; -create table t3(f1 char(20),f2 char(20),f3 integer) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t3.txt' into table t3; -create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t4; +create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t1; +create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t2; +create table t3(f1 char(20),f2 char(20),f3 integer) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t3.txt' into table t3; +create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t4; USE db_storedproc_1; -create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t6; +create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t6; USE db_storedproc; -create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t7; +create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t7; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -34,8 +39,9 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t8; +create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t8; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -47,12 +53,14 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t9(f1 int, f2 char(25), f3 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' into table t9; -create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t10; -create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t11; +create table t9(f1 int, f2 char(25), f3 int) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t9.txt' into table t9; +create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t10; +create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t11; Section 3.1.8 - SHOW statement checks: -------------------------------------------------------------------------------- diff --git a/mysql-test/suite/funcs_1/r/memory_storedproc_10.result b/mysql-test/suite/funcs_1/r/memory_storedproc_10.result index 7f9946218e9..163bae36bed 100644 --- a/mysql-test/suite/funcs_1/r/memory_storedproc_10.result +++ b/mysql-test/suite/funcs_1/r/memory_storedproc_10.result @@ -9,20 +9,25 @@ DROP DATABASE IF EXISTS db_storedproc_1; CREATE DATABASE db_storedproc; CREATE DATABASE db_storedproc_1; USE db_storedproc; -create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t1; -create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t2; -create table t3(f1 char(20),f2 char(20),f3 integer) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t3.txt' into table t3; -create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t4; +create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t1; +create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t2; +create table t3(f1 char(20),f2 char(20),f3 integer) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t3.txt' into table t3; +create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t4; USE db_storedproc_1; -create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t6; +create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t6; USE db_storedproc; -create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t7; +create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t7; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -34,8 +39,9 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t8; +create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t8; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -47,12 +53,14 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t9(f1 int, f2 char(25), f3 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' into table t9; -create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t10; -create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t11; +create table t9(f1 int, f2 char(25), f3 int) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t9.txt' into table t9; +create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t10; +create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t11; Section 3.1.10 - CALL checks: -------------------------------------------------------------------------------- @@ -78,7 +86,7 @@ connect(localhost,user_1,,db_storedproc,MYSQL_PORT,MYSQL_SOCK); user_1@localhost db_storedproc CREATE PROCEDURE sp31102 () SQL SECURITY INVOKER BEGIN -SELECT * FROM db_storedproc.t1 LIMIT 1; +SELECT * FROM db_storedproc.t1 WHERE f4=-5000 LIMIT 1; END// CREATE FUNCTION fn31105(n INT) RETURNS INT BEGIN @@ -93,6 +101,8 @@ CALL sp31102(); ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc.sp31102' SELECT fn31105( 9 ); ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc.fn31105' +connection default; +USE db_storedproc; root@localhost db_storedproc CALL sp31102(); @@ -112,6 +122,8 @@ a` a` 1000-01-01 -5000 a` -5000 SELECT fn31105( 9 ); fn31105( 9 ) 81 +connection default; +USE db_storedproc; root@localhost db_storedproc REVOKE EXECUTE ON db_storedproc.* FROM 'user_2'@'localhost'; @@ -129,6 +141,7 @@ CALL sp31102(); ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc.sp31102' SELECT fn31105( 9 ); ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc.fn31105' +USE db_storedproc; root@localhost db_storedproc DROP PROCEDURE sp31102; @@ -176,6 +189,8 @@ DROP PROCEDURE IF EXISTS sp_ins_1; DROP PROCEDURE IF EXISTS sp_ins_3; DROP PROCEDURE IF EXISTS sp_upd; DROP PROCEDURE IF EXISTS sp_ins_upd; +DROP PROCEDURE IF EXISTS sp_del; +DROP PROCEDURE IF EXISTS sp_with_rowcount; CREATE TABLE temp(f1 CHAR(20),f2 CHAR(25),f3 DATE,f4 INT,f5 CHAR(25),f6 INT); INSERT INTO temp SELECT * FROM t10; CREATE PROCEDURE sp_ins_1() @@ -203,49 +218,72 @@ END; SELECT COUNT( f1 ), f1 FROM temp GROUP BY f1; UPDATE temp SET temp.f1 = 'updated_2' WHERE temp.f1 ='qwe' AND temp.f2 = 'abc'; END// +CREATE PROCEDURE sp_del() +BEGIN +DELETE FROM temp WHERE temp.f1 ='qwe' OR temp.f1 = 'updated_2'; +END// +CREATE PROCEDURE sp_with_rowcount() +BEGIN +BEGIN +INSERT INTO temp VALUES ('qwe', 'abc', '1989-11-09', 100, 'uvw', 1000), +('qwe', 'xyz', '1998-03-26', 100, 'uvw', 1000), +('qwe', 'abc', '2000-11-09', 100, 'uvw', 1000), +('qwe', 'xyz', '2005-11-07', 100, 'uvw', 1000); +END; +SELECT row_count() AS 'row_count() after insert'; +SELECT row_count() AS 'row_count() after select row_count()'; +SELECT f1,f2,f3 FROM temp ORDER BY f1,f2,f3; +UPDATE temp SET temp.f1 = 'updated_2' WHERE temp.f2 = 'abc'; +SELECT row_count() AS 'row_count() after update'; +SELECT f1,f2,f3 FROM temp ORDER BY f1,f2,f3; +DELETE FROM temp WHERE temp.f1 = 'updated_2'; +SELECT row_count() AS 'row_count() after delete'; +END// CALL sp_ins_1(); SELECT row_count(); row_count() 1 SELECT * FROM temp; f1 f2 f3 f4 f5 f6 +a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 +a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991 a` a` 1000-01-01 -5000 a` -5000 aaa aaa 1000-01-02 -4999 aaa -4999 abaa abaa 1000-01-03 -4998 abaa -4998 +abc abc 2005-10-03 100 uvw 1000 acaaa acaaa 1000-01-04 -4997 acaaa -4997 adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996 aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995 afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994 agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993 -a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 -a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991 -abc abc 2005-10-03 100 uvw 1000 CALL sp_ins_3(); SELECT row_count(); row_count() 1 SELECT * FROM temp; f1 f2 f3 f4 f5 f6 +a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 +a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991 a` a` 1000-01-01 -5000 a` -5000 aaa aaa 1000-01-02 -4999 aaa -4999 abaa abaa 1000-01-03 -4998 abaa -4998 +abc abc 2005-10-03 100 uvw 1000 +abc xyz 1949-05-23 100 uvw 1000 +abc xyz 1989-11-09 100 uvw 1000 +abc xyz 2005-10-24 100 uvw 1000 acaaa acaaa 1000-01-04 -4997 acaaa -4997 adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996 aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995 afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994 agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993 -a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 -a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991 -abc abc 2005-10-03 100 uvw 1000 -abc xyz 1949-05-23 100 uvw 1000 -abc xyz 1989-11-09 100 uvw 1000 -abc xyz 2005-10-24 100 uvw 1000 CALL sp_upd(); SELECT row_count(); row_count() 4 SELECT * FROM temp; f1 f2 f3 f4 f5 f6 +a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 +a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991 a` a` 1000-01-01 -5000 a` -5000 aaa aaa 1000-01-02 -4999 aaa -4999 abaa abaa 1000-01-03 -4998 abaa -4998 @@ -254,8 +292,6 @@ adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996 aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995 afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994 agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993 -a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 -a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991 updated abc 2005-10-03 100 uvw 1000 updated xyz 1949-05-23 100 uvw 1000 updated xyz 1989-11-09 100 uvw 1000 @@ -279,6 +315,8 @@ row_count() 3 SELECT * FROM temp; f1 f2 f3 f4 f5 f6 +a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 +a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991 a` a` 1000-01-01 -5000 a` -5000 aaa aaa 1000-01-02 -4999 aaa -4999 abaa abaa 1000-01-03 -4998 abaa -4998 @@ -287,26 +325,73 @@ adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996 aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995 afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994 agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993 -a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 -a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991 +qwe xyz 1998-03-26 100 uvw 1000 updated abc 2005-10-03 100 uvw 1000 updated xyz 1949-05-23 100 uvw 1000 updated xyz 1989-11-09 100 uvw 1000 updated xyz 2005-10-24 100 uvw 1000 updated_2 abc 1989-11-09 100 uvw 1000 -qwe xyz 1998-03-26 100 uvw 1000 updated_2 abc 2000-11-09 100 uvw 1000 updated_2 abc 2005-11-07 100 uvw 1000 +CALL sp_del(); +SELECT row_count(); +row_count() +4 +SELECT * FROM temp; +f1 f2 f3 f4 f5 f6 +a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 +a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991 +a` a` 1000-01-01 -5000 a` -5000 +aaa aaa 1000-01-02 -4999 aaa -4999 +abaa abaa 1000-01-03 -4998 abaa -4998 +acaaa acaaa 1000-01-04 -4997 acaaa -4997 +adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996 +aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995 +afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994 +agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993 +updated abc 2005-10-03 100 uvw 1000 +updated xyz 1949-05-23 100 uvw 1000 +updated xyz 1989-11-09 100 uvw 1000 +updated xyz 2005-10-24 100 uvw 1000 +DELETE FROM temp; +CALL sp_with_rowcount(); +row_count() after insert +4 +row_count() after select row_count() +-1 +f1 f2 f3 +qwe abc 1989-11-09 +qwe abc 2000-11-09 +qwe xyz 1998-03-26 +qwe xyz 2005-11-07 +row_count() after update +2 +f1 f2 f3 +qwe xyz 1998-03-26 +qwe xyz 2005-11-07 +updated_2 abc 1989-11-09 +updated_2 abc 2000-11-09 +row_count() after delete +2 +SELECT row_count(); +row_count() +-1 +SELECT * FROM temp; +f1 f2 f3 f4 f5 f6 +qwe xyz 1998-03-26 100 uvw 1000 +qwe xyz 2005-11-07 100 uvw 1000 DROP PROCEDURE sp_ins_1; DROP PROCEDURE sp_ins_3; DROP PROCEDURE sp_upd; DROP PROCEDURE sp_ins_upd; +DROP PROCEDURE sp_del; +DROP PROCEDURE sp_with_rowcount; DROP TABLE temp; Testcase 3.1.10.8: ------------------ -Ensure that the mysql_affected_rows() C API function always returns the correct +Ensure that the mysql_affected_rows() C API function always returns the correct number of rows affected by the execution of a stored procedure. -------------------------------------------------------------------------------- diff --git a/mysql-test/suite/funcs_1/r/memory_trig_0102.result b/mysql-test/suite/funcs_1/r/memory_trig_0102.result index a9477604425..1ada907f9e6 100644 --- a/mysql-test/suite/funcs_1/r/memory_trig_0102.result +++ b/mysql-test/suite/funcs_1/r/memory_trig_0102.result @@ -1,90 +1,89 @@ 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 char(50), -f122 char(50), -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 = memory; +f118 char not null DEFAULT 'a', +f119 char binary not null DEFAULT b'101', +f120 char ascii not null DEFAULT b'101', +f121 char(50), +f122 char(50), +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 = <engine_to_be_used>; 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 'MYSQL_TEST_DIR/suite/funcs_1/data/memory_tb3.txt' into table tb3 ; Testcase: 3.5.1.1: ------------------ use test; -Create trigger trg1_1 BEFORE INSERT +Create trigger trg1_1 BEFORE INSERT on tb3 for each row set @test_before = 2, new.f142 = @test_before; -Create trigger trg1_2 AFTER INSERT +Create trigger trg1_2 AFTER INSERT on tb3 for each row set @test_after = 6; -Create trigger trg1_4 BEFORE UPDATE -on tb3 for each row set @test_before = 27, -new.f142 = @test_before, +Create trigger trg1_4 BEFORE UPDATE +on tb3 for each row set @test_before = 27, +new.f142 = @test_before, new.f122 = 'Before Update Trigger'; -Create trigger trg1_3 AFTER UPDATE +Create trigger trg1_3 AFTER UPDATE on tb3 for each row set @test_after = '15'; -Create trigger trg1_5 BEFORE DELETE on tb3 for each row -select count(*) into @test_before from tb3 as tr_tb3 +Create trigger trg1_5 BEFORE DELETE on tb3 for each row +select count(*) into @test_before from tb3 as tr_tb3 where f121 = 'Test 3.5.1.1'; -Create trigger trg1_6 AFTER DELETE on tb3 for each row -select count(*) into @test_after from tb3 as tr_tb3 +Create trigger trg1_6 AFTER DELETE on tb3 for each row +select count(*) into @test_after from tb3 as tr_tb3 where f121 = 'Test 3.5.1.1'; set @test_before = 1; set @test_after = 5; select @test_before, @test_after; @test_before @test_after 1 5 -Insert into tb3 (f121, f122, f142, f144, f134) +Insert into tb3 (f121, f122, f142, f144, f134) values ('Test 3.5.1.1', 'First Row', @test_before, @test_after, 1); select f121, f122, f142, f144, f134 from tb3 where f121 = 'Test 3.5.1.1'; f121 f122 f142 f144 f134 @@ -97,9 +96,9 @@ set @test_after = 8; select @test_before, @test_after; @test_before @test_after 18 8 -Update tb3 set tb3.f122 = 'Update', -tb3.f142 = @test_before, -tb3.f144 = @test_after +Update tb3 set tb3.f122 = 'Update', +tb3.f142 = @test_before, +tb3.f144 = @test_after where tb3.f121 = 'Test 3.5.1.1'; select f121, f122, f142, f144, f134 from tb3 where f121 = 'Test 3.5.1.1'; f121 f122 f142 f144 f134 @@ -107,7 +106,7 @@ Test 3.5.1.1 Before Update Trigger 27 0000000008 1 select @test_before, @test_after; @test_before @test_after 27 15 -Insert into tb3 (f121, f122, f142, f144, f134) +Insert into tb3 (f121, f122, f142, f144, f134) values ('Test 3.5.1.1', 'Second Row', 5, 6, 2); set @test_before = 0; set @test_after = 0; @@ -135,7 +134,7 @@ delete from tb3 where f121='Test 3.5.1.1'; Testcase: 3.5.1.2: ------------------ -Create trigger trg_1 after insert +Create trigger trg_1 after insert on tb3 for each statement set @x= 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 'statement set @x= 1' at line 2 drop trigger trg_1; @@ -187,8 +186,8 @@ Testcase 3.5.1.7: - need to fix drop table if exists t1; Warnings: Note 1051 Unknown table 't1' -create table t1 (f1 int, f2 char(25),f3 int) engine=memory; -CREATE TRIGGER trg5_1 BEFORE INSERT on test.t1 +create table t1 (f1 int, f2 char(25),f3 int) engine = <engine_to_be_used>; +CREATE TRIGGER trg5_1 BEFORE INSERT on test.t1 for each row set new.f3 = '14'; CREATE TRIGGER trg_abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ BEFORE UPDATE on test.t1 for each row set new.f3 = '42'; @@ -200,7 +199,7 @@ update t1 set f2='update 3.5.1.7'; select * from t1; f1 f2 f3 NULL update 3.5.1.7 42 -select trigger_name from information_schema.triggers; +select trigger_name from information_schema.triggers order by trigger_name; trigger_name trg5_1 trg_abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWX @@ -220,19 +219,19 @@ CREATE TRIGGER @@view before insert on tb3 for each row set new.f120 = 't'; 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 '@@view before insert on tb3 for each row set new.f120 = 't'' at line 1 CREATE TRIGGER @name before insert on tb3 for each row set new.f120 = 't'; 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 '@name before insert on tb3 for each row set new.f120 = 't'' at line 1 -CREATE TRIGGER tb3.trg6_1 BEFORE INSERT on test.tb3 +CREATE TRIGGER tb3.trg6_1 BEFORE INSERT on test.tb3 for each row set new.f120 ='X'; ERROR HY000: Trigger in wrong schema drop database if exists trig_db; create database trig_db; use trig_db; -create table t1 (f1 integer) engine = memory; +create table t1 (f1 integer) engine = <engine_to_be_used>; use test; -CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3 +CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3 for each row set @ret_trg6_2 = 5; ERROR 42S02: Table 'trig_db.tb3' doesn't exist use trig_db; -CREATE TRIGGER trg6_3 AFTER INSERT on test.tb3 +CREATE TRIGGER trg6_3 AFTER INSERT on test.tb3 for each row set @ret_trg6_3 = 18; ERROR HY000: Trigger in wrong schema use test; @@ -254,11 +253,11 @@ Testcase 3.5.1.?: ----------------- drop table if exists t1; drop table if exists t2; -create table t1 (f1 char(50), f2 integer) engine = memory; -create table t2 (f1 char(50), f2 integer) engine = memory; -create trigger trig before insert on t1 +create table t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>; +create table t2 (f1 char(50), f2 integer) engine = <engine_to_be_used>; +create trigger trig before insert on t1 for each row set new.f1 ='trig t1'; -create trigger trig before update on t2 +create trigger trig before update on t2 for each row set new.f1 ='trig t2'; ERROR HY000: Trigger already exists insert into t1 value ('insert to t1',1); @@ -287,16 +286,16 @@ create database trig_db1; create database trig_db2; create database trig_db3; use trig_db1; -create table t1 (f1 char(50), f2 integer) engine = memory; -create trigger trig before insert on t1 +create table t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>; +create trigger trig before insert on t1 for each row set new.f1 ='trig1', @test_var1='trig1'; use trig_db2; -create table t2 (f1 char(50), f2 integer) engine = memory; -create trigger trig before insert on t2 +create table t2 (f1 char(50), f2 integer) engine = <engine_to_be_used>; +create trigger trig before insert on t2 for each row set new.f1 ='trig2', @test_var2='trig2'; use trig_db3; -create table t1 (f1 char(50), f2 integer) engine = memory; -create trigger trig before insert on t1 +create table t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>; +create trigger trig before insert on t1 for each row set new.f1 ='trig3', @test_var3='trig3'; set @test_var1= '', @test_var2= '', @test_var3= ''; use trig_db1; @@ -307,7 +306,7 @@ insert into trig_db3.t1 (f1,f2) values ('insert to db3 t1 from db1',4); select @test_var1, @test_var2, @test_var3; @test_var1 @test_var2 @test_var3 trig1 trig2 trig3 -select * from t1; +select * from t1 order by f2; f1 f2 trig1 1 trig1 2 @@ -317,7 +316,7 @@ trig2 3 select * from trig_db3.t1; f1 f2 trig3 4 -select * from t1; +select * from t1 order by f2; f1 f2 trig1 1 trig1 2 @@ -333,19 +332,19 @@ drop database if exists trig_db2; create database trig_db1; create database trig_db2; use trig_db1; -create table t1 (f1 char(50), f2 integer) engine = memory; -create table trig_db2.t1 (f1 char(50), f2 integer) engine = memory; -create trigger trig1_b before insert on t1 +create table t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>; +create table trig_db2.t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>; +create trigger trig1_b before insert on t1 for each row set @test_var1='trig1_b'; -create trigger trig_db1.trig1_a after insert on t1 +create trigger trig_db1.trig1_a after insert on t1 for each row set @test_var2='trig1_a'; -create trigger trig_db2.trig2 before insert on trig_db2.t1 +create trigger trig_db2.trig2 before insert on trig_db2.t1 for each row set @test_var3='trig2'; select trigger_schema, trigger_name, event_object_table -from information_schema.triggers; +from information_schema.triggers order by trigger_name; trigger_schema trigger_name event_object_table -trig_db1 trig1_b t1 trig_db1 trig1_a t1 +trig_db1 trig1_b t1 trig_db2 trig2 t1 set @test_var1= '', @test_var2= '', @test_var3= ''; insert into t1 (f1,f2) values ('insert to db1 t1 from db1',352); diff --git a/mysql-test/suite/funcs_1/r/memory_trig_03.result b/mysql-test/suite/funcs_1/r/memory_trig_03.result index e5813236213..0d29724fcb7 100644 --- a/mysql-test/suite/funcs_1/r/memory_trig_03.result +++ b/mysql-test/suite/funcs_1/r/memory_trig_03.result @@ -1,71 +1,70 @@ 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 char(50), -f122 char(50), -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 = memory; +f118 char not null DEFAULT 'a', +f119 char binary not null DEFAULT b'101', +f120 char ascii not null DEFAULT b'101', +f121 char(50), +f122 char(50), +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 = <engine_to_be_used>; 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 'MYSQL_TEST_DIR/suite/funcs_1/data/memory_tb3.txt' into table tb3 ; Testcase 3.5.3: --------------- drop database if exists priv_db; create database priv_db; use priv_db; -create table t1 (f1 char(20)) engine= memory; +create table t1 (f1 char(20)) engine= <engine_to_be_used>; create User test_noprivs@localhost; set password for test_noprivs@localhost = password('PWD'); create User test_yesprivs@localhost; @@ -100,7 +99,7 @@ set new.f1 = 'trig 3.5.3.2_1-no'; ERROR 42000: Access denied; you need the SUPER privilege for this operation use priv_db; insert into t1 (f1) values ('insert 3.5.3.2-no'); -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no select current_user; @@ -115,15 +114,12 @@ root@localhost use priv_db; insert into t1 (f1) values ('insert 3.5.3.2-yes'); ERROR 42000: UPDATE command denied to user 'test_yesprivs'@'localhost' for column 'f1' in table 't1' -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no grant UPDATE on priv_db.t1 to test_yesprivs@localhost; - -note: once 15166 is fixed a similar case for SELECT needs to be added ---------------------------------------------------------------------- insert into t1 (f1) values ('insert 3.5.3.2-yes'); -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no trig 3.5.3.2_2-yes @@ -135,7 +131,7 @@ drop trigger trg1_2; ERROR 42000: Access denied; you need the SUPER privilege for this operation use priv_db; insert into t1 (f1) values ('insert 3.5.3.6-yes'); -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no trig 3.5.3.2_2-yes @@ -144,12 +140,12 @@ use priv_db; drop trigger trg1_2; use priv_db; insert into t1 (f1) values ('insert 3.5.3.6-no'); -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no drop trigger trg1_2; Testcase 3.5.3.7a: @@ -174,23 +170,22 @@ use priv_db; show grants; Grants for test_noprivs@localhost GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no - -Trigger create disabled - should fail - Bug 8884 ------------------------------------------------- +create trigger trg4a_1 before INSERT on t1 for each row +set new.f1 = 'trig 3.5.3.7-1a'; insert into t1 (f1) values ('insert 3.5.3.7-1a'); -select f1 from t1; +ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no -insert 3.5.3.7-1a drop trigger trg4a_1; use priv_db; select current_user; @@ -201,18 +196,13 @@ Grants for test_yesprivs@localhost GRANT UPDATE, SUPER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' create trigger trg4a_2 before INSERT on t1 for each row set new.f1 = 'trig 3.5.3.7-2a'; - -SELECT priv added to bypass bug 15166 -------------------------------------- -grant SELECT on *.* to test_yesprivs@localhost; insert into t1 (f1) values ('insert 3.5.3.7-2b'); -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no -insert 3.5.3.7-1a trig 3.5.3.7-2a drop trigger trg4a_2; @@ -239,30 +229,29 @@ Grants for test_noprivs@localhost GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE ON `priv_db`.* TO 'test_noprivs'@'localhost' use priv_db; - -Trigger create disabled - should fail - Bug 8884 ------------------------------------------------- +create trigger trg4b_1 before UPDATE on t1 for each row +set new.f1 = 'trig 3.5.3.7-1b'; +ERROR 42000: Access denied; you need the SUPER privilege for this operation insert into t1 (f1) values ('insert 3.5.3.7-1b'); -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no +insert 3.5.3.7-1b trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no -insert 3.5.3.7-1a trig 3.5.3.7-2a -insert 3.5.3.7-1b update t1 set f1 = 'update 3.5.3.7-1b' where f1 = 'insert 3.5.3.7-1b'; -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no -insert 3.5.3.7-1a trig 3.5.3.7-2a update 3.5.3.7-1b drop trigger trg4b_1; +ERROR HY000: Trigger does not exist show grants; Grants for test_yesprivs@localhost GRANT SUPER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' @@ -270,32 +259,26 @@ GRANT UPDATE ON `priv_db`.* TO 'test_yesprivs'@'localhost' use priv_db; create trigger trg4b_2 before UPDATE on t1 for each row set new.f1 = 'trig 3.5.3.7-2b'; - -SELECT priv added to bypass bug 15166 -------------------------------------- -grant SELECT on priv_db.* to test_yesprivs@localhost; insert into t1 (f1) values ('insert 3.5.3.7-2b'); -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no +insert 3.5.3.7-2b trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no -insert 3.5.3.7-1a trig 3.5.3.7-2a update 3.5.3.7-1b -insert 3.5.3.7-2b update t1 set f1 = 'update 3.5.3.7-2b' where f1 = 'insert 3.5.3.7-2b'; -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no -insert 3.5.3.7-1a trig 3.5.3.7-2a -update 3.5.3.7-1b trig 3.5.3.7-2b +update 3.5.3.7-1b drop trigger trg4b_2; Testcase 3.5.3.7c @@ -321,21 +304,19 @@ Grants for test_noprivs@localhost GRANT SUPER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW ON `priv_db`.`t1` TO 'test_noprivs'@'localhost' use priv_db; - -Trigger create disabled - should fail - Bug 8884 ------------------------------------------------- +create trigger trg4c_1 before INSERT on t1 for each row +set new.f1 = 'trig 3.5.3.7-1c'; insert into t1 (f1) values ('insert 3.5.3.7-1c'); -select f1 from t1; +ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no -insert 3.5.3.7-1a trig 3.5.3.7-2a -update 3.5.3.7-1b trig 3.5.3.7-2b -insert 3.5.3.7-1c +update 3.5.3.7-1b drop trigger trg4c_1; show grants; Grants for test_yesprivs@localhost @@ -344,23 +325,17 @@ GRANT UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' use priv_db; create trigger trg4c_2 before INSERT on t1 for each row set new.f1 = 'trig 3.5.3.7-2c'; - -SELECT priv added to bypass bug 15166 -------------------------------------- -grant SELECT on priv_db.t1 to test_yesprivs@localhost; insert into t1 (f1) values ('insert 3.5.3.7-2c'); -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no -insert 3.5.3.7-1a trig 3.5.3.7-2a -update 3.5.3.7-1b trig 3.5.3.7-2b -insert 3.5.3.7-1c trig 3.5.3.7-2c +update 3.5.3.7-1b drop trigger trg4c_2; Testcase 3.5.3.7d: @@ -384,23 +359,20 @@ Grants for test_noprivs@localhost GRANT SUPER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT SELECT (f1), INSERT (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost' use priv_db; - -Trigger create disabled - should fail - Bug 8884 ------------------------------------------------- +create trigger trg4d_1 before INSERT on t1 for each row +set new.f1 = 'trig 3.5.3.7-1d'; insert into t1 (f1) values ('insert 3.5.3.7-1d'); -select f1 from t1; +ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no -insert 3.5.3.7-1a trig 3.5.3.7-2a -update 3.5.3.7-1b trig 3.5.3.7-2b -insert 3.5.3.7-1c trig 3.5.3.7-2c -insert 3.5.3.7-1d +update 3.5.3.7-1b drop trigger trg4d_1; show grants; Grants for test_yesprivs@localhost @@ -409,25 +381,18 @@ GRANT UPDATE (f1) ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' use priv_db; create trigger trg4d_2 before INSERT on t1 for each row set new.f1 = 'trig 3.5.3.7-2d'; - -SELECT priv added to bypass bug 15166 -------------------------------------- -grant SELECT (f1) on priv_db.t1 to test_yesprivs@localhost; insert into t1 (f1) values ('insert 3.5.3.7-2d'); -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no -insert 3.5.3.7-1a trig 3.5.3.7-2a -update 3.5.3.7-1b trig 3.5.3.7-2b -insert 3.5.3.7-1c trig 3.5.3.7-2c -insert 3.5.3.7-1d trig 3.5.3.7-2d +update 3.5.3.7-1b drop trigger trg4d_2; Testcase 3.5.3.8a: @@ -452,14 +417,14 @@ use priv_db; show grants; Grants for test_noprivs@localhost GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' - -Trigger create disabled - should fail - Bug 8887 ------------------------------------------------- +create trigger trg5a_1 before INSERT on t1 for each row +set @test_var = new.f1; set @test_var = 'before trig 3.5.3.8-1a'; select @test_var; @test_var before trig 3.5.3.8-1a insert into t1 (f1) values ('insert 3.5.3.8-1a'); +ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' select @test_var; @test_var before trig 3.5.3.8-1a @@ -477,10 +442,6 @@ set @test_var= 'before trig 3.5.3.8-2a'; select @test_var; @test_var before trig 3.5.3.8-2a - -UPDATE priv added to bypass bug 15166 -------------------------------------- -grant UPDATE on *.* to test_yesprivs@localhost; insert into t1 (f1) values ('insert 3.5.3.8-2a'); select @test_var; @test_var @@ -511,15 +472,15 @@ Grants for test_noprivs@localhost GRANT SUPER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE ON `priv_db`.* TO 'test_noprivs'@'localhost' use priv_db; - -Trigger create disabled - should fail - Bug 8887 ------------------------------------------------- +create trigger trg5b_1 before UPDATE on t1 for each row +set @test_var= new.f1; set @test_var= 'before trig 3.5.3.8-1b'; insert into t1 (f1) values ('insert 3.5.3.8-1b'); select @test_var; @test_var before trig 3.5.3.8-1b update t1 set f1= 'update 3.5.3.8-1b' where f1 = 'insert 3.5.3.8-1b'; +ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' select @test_var; @test_var before trig 3.5.3.8-1b @@ -536,10 +497,6 @@ insert into t1 (f1) values ('insert 3.5.3.8-2b'); select @test_var; @test_var before trig 3.5.3.8-2b - -UPDATE priv added to bypass bug 15166 -------------------------------------- -grant UPDATE on priv_db.* to test_yesprivs@localhost; update t1 set f1= 'update 3.5.3.8-2b' where f1 = 'insert 3.5.3.8-2b'; select @test_var; @test_var @@ -570,11 +527,11 @@ Grants for test_noprivs@localhost GRANT SUPER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW ON `priv_db`.`t1` TO 'test_noprivs'@'localhost' use priv_db; - -Trigger create disabled - should fail - Bug 8887 ------------------------------------------------- +create trigger trg5c_1 before INSERT on t1 for each row +set @test_var= new.f1; set @test_var= 'before trig 3.5.3.8-1c'; insert into t1 (f1) values ('insert 3.5.3.8-1c'); +ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' select @test_var; @test_var before trig 3.5.3.8-1c @@ -587,10 +544,6 @@ use priv_db; create trigger trg5c_2 before INSERT on t1 for each row set @test_var= new.f1; set @test_var='before trig 3.5.3.8-2c'; - -UPDATE priv added to bypass bug 15166 -------------------------------------- -grant UPDATE on priv_db.t1 to test_yesprivs@localhost; insert into t1 (f1) values ('insert 3.5.3.8-2c'); select @test_var; @test_var @@ -620,11 +573,11 @@ Grants for test_noprivs@localhost GRANT SUPER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost' use priv_db; - -Trigger create disabled - should fail - Bug 8887 ------------------------------------------------- +create trigger trg5d_1 before INSERT on t1 for each row +set @test_var= new.f1; set @test_var='before trig 3.5.3.8-1d'; insert into t1 (f1) values ('insert 3.5.3.8-1d'); +ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' select @test_var; @test_var before trig 3.5.3.8-1d @@ -637,10 +590,6 @@ use priv_db; create trigger trg5d_2 before INSERT on t1 for each row set @test_var= new.f1; set @test_var='before trig 3.5.3.8-2d'; - -UPDATE priv added to bypass bug 15166 -------------------------------------- -grant UPDATE (f1) on priv_db.t1 to test_yesprivs@localhost; insert into t1 (f1) values ('insert 3.5.3.8-2d'); select @test_var; @test_var @@ -652,8 +601,8 @@ Testcase: 3.5.3.x: use priv_db; drop table if exists t1; drop table if exists t2; -create table t1 (f1 int) engine= memory; -create table t2 (f2 int) engine= memory; +create table t1 (f1 int) engine= <engine_to_be_used>; +create table t2 (f2 int) engine= <engine_to_be_used>; revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; grant SUPER on *.* to test_yesprivs@localhost; grant SELECT, UPDATE on priv_db.t1 to test_yesprivs@localhost; @@ -676,10 +625,10 @@ ERROR 42000: INSERT command denied to user 'test_yesprivs'@'localhost' for table revoke SELECT on priv_db.t2 from test_yesprivs@localhost; grant INSERT on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (4); -select f1 from t1; +select f1 from t1 order by f1; f1 4 -select f2 from t2; +select f2 from t2 order by f2; f2 4 use priv_db; @@ -692,11 +641,11 @@ ERROR 42000: UPDATE command denied to user 'test_yesprivs'@'localhost' for table revoke INSERT on priv_db.t2 from test_yesprivs@localhost; grant UPDATE on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (2); -select f1 from t1; +select f1 from t1 order by f1; f1 -4 2 -select f2 from t2; +4 +select f2 from t2 order by f2; f2 1 use priv_db; @@ -709,12 +658,12 @@ ERROR 42000: SELECT command denied to user 'test_yesprivs'@'localhost' for table revoke UPDATE on priv_db.t2 from test_yesprivs@localhost; grant SELECT on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (1); -select f1 from t1; +select f1 from t1 order by f1; f1 -4 -2 1 -select f2 from t2; +2 +4 +select f2 from t2 order by f2; f2 1 select @aaa; @@ -730,16 +679,17 @@ ERROR 42000: DELETE command denied to user 'test_yesprivs'@'localhost' for table revoke SELECT on priv_db.t2 from test_yesprivs@localhost; grant DELETE on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (1); -select f1 from t1; +select f1 from t1 order by f1; f1 -4 -2 1 1 -select f2 from t2; +2 +4 +select f2 from t2 order by f2; f2 drop database if exists priv_db; drop user test_yesprivs@localhost; drop user test_noprivs@localhost; drop user test_noprivs; -DROP TABLE test.tb3; +use test; +drop table tb3; diff --git a/mysql-test/suite/funcs_1/r/memory_trig_0407.result b/mysql-test/suite/funcs_1/r/memory_trig_0407.result index 14974428ecf..a4871065c04 100644 --- a/mysql-test/suite/funcs_1/r/memory_trig_0407.result +++ b/mysql-test/suite/funcs_1/r/memory_trig_0407.result @@ -1,64 +1,63 @@ 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 char(50), -f122 char(50), -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 = memory; +f118 char not null DEFAULT 'a', +f119 char binary not null DEFAULT b'101', +f120 char ascii not null DEFAULT b'101', +f121 char(50), +f122 char(50), +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 = <engine_to_be_used>; 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 'MYSQL_TEST_DIR/suite/funcs_1/data/memory_tb3.txt' into table tb3 ; Testcase: 3.5: -------------- @@ -79,25 +78,25 @@ Testcase 3.5.4.1: ----------------- create database db_drop; Use db_drop; -create table t1 (f1 char(30)) engine=memory; +create table t1 (f1 char(30)) engine = <engine_to_be_used>; grant INSERT, SELECT on db_drop.t1 to test_general; Use db_drop; -Create trigger trg1 BEFORE INSERT on t1 +Create trigger trg1 BEFORE INSERT on t1 for each row set new.f1='Trigger 3.5.4.1'; Use db_drop; Insert into t1 values ('Insert error 3.5.4.1'); -Select * from t1; +Select * from t1 order by f1; f1 Trigger 3.5.4.1 drop trigger trg1; select trigger_schema, trigger_name, event_object_table -from information_schema.triggers; +from information_schema.triggers order by trigger_name; trigger_schema trigger_name event_object_table Insert into t1 values ('Insert no trigger 3.5.4.1'); -Select * from t1; +Select * from t1 order by f1; f1 -Trigger 3.5.4.1 Insert no trigger 3.5.4.1 +Trigger 3.5.4.1 drop trigger trg1; drop database if exists db_drop; revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost'; @@ -107,7 +106,7 @@ Testcase 3.5.4.2: create database db_drop2; Use db_drop2; drop table if exists t1_432 ; -create table t1_432 (f1 char (30)) engine=memory; +create table t1_432 (f1 char (30)) engine = <engine_to_be_used>; Drop trigger tr_does_not_exit; ERROR HY000: Trigger does not exist drop table if exists t1_432 ; @@ -119,9 +118,9 @@ create database db_drop3; Use db_drop3; drop table if exists t1_433 ; drop table if exists t1_433a ; -create table t1_433 (f1 char (30)) engine=memory; -create table t1_433a (f1a char (5)) engine=memory; -CREATE TRIGGER trg3 BEFORE INSERT on t1_433 for each row +create table t1_433 (f1 char (30)) engine = <engine_to_be_used>; +create table t1_433a (f1a char (5)) engine = <engine_to_be_used>; +CREATE TRIGGER trg3 BEFORE INSERT on t1_433 for each row set new.f1 = 'Trigger 3.5.4.3'; Drop trigger t1.433.trg3; 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 '.trg3' at line 1 @@ -140,9 +139,9 @@ Testcase 3.5.4.4: ----------------- create database db_drop4; Use db_drop4; -create table t1 (f1 char(30)) engine=memory; +create table t1 (f1 char(30)) engine = <engine_to_be_used>; grant INSERT, SELECT on db_drop4.t1 to test_general; -Create trigger trg4 BEFORE INSERT on t1 +Create trigger trg4 BEFORE INSERT on t1 for each row set new.f1='Trigger 3.5.4.4'; Use db_drop4; Insert into t1 values ('Insert 3.5.4.4'); @@ -161,7 +160,7 @@ where information_schema.triggers.trigger_name='trg4'; trigger_schema trigger_name event_object_table create database db_drop4; Use db_drop4; -create table t1 (f1 char(30)) engine=memory; +create table t1 (f1 char(30)) engine = <engine_to_be_used>; grant INSERT, SELECT on db_drop4.t1 to test_general; Insert into t1 values ('2nd Insert 3.5.4.4'); Select * from t1; @@ -176,9 +175,9 @@ Testcase 3.5.4.5: ----------------- create database db_drop5; Use db_drop5; -create table t1 (f1 char(50)) engine=memory; +create table t1 (f1 char(50)) engine = <engine_to_be_used>; grant INSERT, SELECT on t1 to test_general; -Create trigger trg5 BEFORE INSERT on t1 +Create trigger trg5 BEFORE INSERT on t1 for each row set new.f1='Trigger 3.5.4.5'; Use db_drop5; Insert into t1 values ('Insert 3.5.4.5'); @@ -192,7 +191,7 @@ select trigger_schema, trigger_name, event_object_table from information_schema.triggers where information_schema.triggers.trigger_name='trg5'; trigger_schema trigger_name event_object_table -create table t1 (f1 char(50)) engine=memory; +create table t1 (f1 char(50)) engine = <engine_to_be_used>; grant INSERT, SELECT on t1 to test_general; Insert into t1 values ('2nd Insert 3.5.4.5'); Select * from t1; @@ -215,7 +214,7 @@ ERROR 42S02: Table 'test.t100' doesn't exist Testcase 3.5.5.2: ----------------- Create temporary table t1_temp (f1 bigint signed, f2 bigint unsigned); -Create trigger trg2 before INSERT +Create trigger trg2 before INSERT on t1_temp for each row set new.f2=9999; ERROR HY000: Trigger's 't1_temp' is view or temporary table drop table t1_temp; @@ -223,7 +222,7 @@ drop table t1_temp; Testcase 3.5.5.3: ----------------- Create view vw3 as select f118 from tb3; -Create trigger trg3 before INSERT +Create trigger trg3 before INSERT on vw3 for each row set new.f118='s'; ERROR HY000: 'test.vw3' is not BASE TABLE drop view vw3; @@ -233,7 +232,7 @@ Testcase 3.5.5.4: create database dbtest_one; create database dbtest_two; use dbtest_two; -create table t2 (f1 char(15)) engine=memory; +create table t2 (f1 char(15)) engine = <engine_to_be_used>; use dbtest_one; create trigger trg4 before INSERT on dbtest_two.t2 for each row set new.f1='trig 3.5.5.4'; @@ -251,7 +250,7 @@ use dbtest_one; Insert into dbtest_two.t2 values ('2nd Insert 3.5.5.4'); Warnings: Warning 1265 Data truncated for column 'f1' at row 1 -Select * from dbtest_two.t2; +Select * from dbtest_two.t2 order by f1; f1 1st Insert 3.5. 2nd Insert 3.5. @@ -304,9 +303,9 @@ drop trigger tb3.trg4_2; Testcase 3.5.7.5 / 3.5.7.6: --------------------------- -Create trigger trg5_1 BEFORE INSERT +Create trigger trg5_1 BEFORE INSERT on tb3 for each row set new.f122='Trigger1 3.5.7.5/6'; -Create trigger trg5_2 BEFORE INSERT +Create trigger trg5_2 BEFORE INSERT on tb3 for each row set new.f122='Trigger2 3.5.7.5'; ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table' Insert into tb3 (f121,f122) values ('Test 3.5.7.5/6','Insert 3.5.7.5'); @@ -324,9 +323,9 @@ delete from tb3 where f121='Test 3.5.7.5/6'; Testcase 3.5.7.7 / 3.5.7.8: --------------------------- set @test_var='Before trig 3.5.7.7'; -Create trigger trg6_1 AFTER INSERT +Create trigger trg6_1 AFTER INSERT on tb3 for each row set @test_var='Trigger1 3.5.7.7/8'; -Create trigger trg6_2 AFTER INSERT +Create trigger trg6_2 AFTER INSERT on tb3 for each row set @test_var='Trigger2 3.5.7.7'; ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table' select @test_var; @@ -352,9 +351,9 @@ delete from tb3 where f121='Test 3.5.7.7/8'; Testcase 3.5.7.9/10: -------------------- -Create trigger trg7_1 BEFORE UPDATE +Create trigger trg7_1 BEFORE UPDATE on tb3 for each row set new.f122='Trigger1 3.5.7.9/10'; -Create trigger trg7_2 BEFORE UPDATE +Create trigger trg7_2 BEFORE UPDATE on tb3 for each row set new.f122='Trigger2 3.5.7.9'; ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table' Insert into tb3 (f121,f122) values ('Test 3.5.7.9/10','Insert 3.5.7.9'); @@ -372,9 +371,9 @@ delete from tb3 where f121='Test 3.5.7.9/10'; Testcase 3.5.7.11/12: --------------------- set @test_var='Before trig 3.5.7.11'; -Create trigger trg8_1 AFTER UPDATE +Create trigger trg8_1 AFTER UPDATE on tb3 for each row set @test_var='Trigger 3.5.7.11/12'; -Create trigger trg8_2 AFTER UPDATE +Create trigger trg8_2 AFTER UPDATE on tb3 for each row set @test_var='Trigger2 3.5.7.11'; ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table' select @test_var; @@ -402,9 +401,9 @@ delete from tb3 where f121='Test 3.5.7.11/12'; Testcase 3.5.7.13/14: --------------------- set @test_var=1; -Create trigger trg9_1 BEFORE DELETE +Create trigger trg9_1 BEFORE DELETE on tb3 for each row set @test_var=@test_var+1; -Create trigger trg9_2 BEFORE DELETE +Create trigger trg9_2 BEFORE DELETE on tb3 for each row set @test_var=@test_var+10; ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table' select @test_var; @@ -434,12 +433,12 @@ delete from tb3 where f121='Test 3.5.7.13/14'; Testcase 3.5.7.15/16: --------------------- set @test_var=1; -Create trigger trg_3_406010_1 AFTER DELETE +Create trigger trg_3_406010_1 AFTER DELETE on tb3 for each row set @test_var=@test_var+5; -Create trigger trg_3_406010_2 AFTER DELETE +Create trigger trg_3_406010_2 AFTER DELETE on tb3 for each row set @test_var=@test_var+50; ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table' -Create trigger trg_3_406010_1 AFTER INSERT +Create trigger trg_3_406010_1 AFTER INSERT on tb3 for each row set @test_var=@test_var+1; ERROR HY000: Trigger already exists select @test_var; diff --git a/mysql-test/suite/funcs_1/r/memory_trig_08.result b/mysql-test/suite/funcs_1/r/memory_trig_08.result index a703de751c2..6ced07cef73 100644 --- a/mysql-test/suite/funcs_1/r/memory_trig_08.result +++ b/mysql-test/suite/funcs_1/r/memory_trig_08.result @@ -1,64 +1,63 @@ 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 char(50), -f122 char(50), -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 = memory; +f118 char not null DEFAULT 'a', +f119 char binary not null DEFAULT b'101', +f120 char ascii not null DEFAULT b'101', +f121 char(50), +f122 char(50), +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 = <engine_to_be_used>; 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 'MYSQL_TEST_DIR/suite/funcs_1/data/memory_tb3.txt' into table tb3 ; Testcase: 3.5: -------------- @@ -83,21 +82,21 @@ create database db_test; grant SELECT, INSERT, UPDATE, DELETE on db_test.* to test_general; grant LOCK TABLES on db_test.* to test_general; Use db_test; -create table t1_i ( +create table t1_i ( i120 char ascii not null DEFAULT b'101', i136 smallint zerofill not null DEFAULT 999, i144 int zerofill not null DEFAULT 99999, -i163 decimal (63,30)) engine=memory; -create table t1_u ( +i163 decimal (63,30)) engine=<engine_to_be_used>; +create table t1_u ( u120 char ascii not null DEFAULT b'101', u136 smallint zerofill not null DEFAULT 999, u144 int zerofill not null DEFAULT 99999, -u163 decimal (63,30)) engine=memory; -create table t1_d ( +u163 decimal (63,30)) engine=<engine_to_be_used>; +create table t1_d ( d120 char ascii not null DEFAULT b'101', d136 smallint zerofill not null DEFAULT 999, d144 int zerofill not null DEFAULT 99999, -d163 decimal (63,30)) engine=memory; +d163 decimal (63,30)) engine=<engine_to_be_used>; Insert into t1_u values ('a',111,99999,999.99); Insert into t1_u values ('b',222,99999,999.99); Insert into t1_u values ('c',333,99999,999.99); @@ -116,18 +115,18 @@ Insert into t1_d values ('f',222,99999,999.99); use test; Create trigger trg1 AFTER INSERT on tb3 for each row BEGIN -insert into db_test.t1_i +insert into db_test.t1_i values (new.f120, new.f136, new.f144, new.f163); -update db_test.t1_u +update db_test.t1_u set u144=new.f144, u163=new.f163 -where u136=new.f136; +where u136=new.f136; delete from db_test.t1_d where d136= new.f136; -select sum(db_test.t1_u.u163) into @test_var from db_test.t1_u -where u136= new.f136; +select sum(db_test.t1_u.u163) into @test_var from db_test.t1_u +where u136= new.f136; END// Use test; set @test_var=0; -Insert into tb3 (f120, f122, f136, f144, f163) +Insert into tb3 (f120, f122, f136, f144, f163) values ('1', 'Test 3.5.8.4', 222, 23456, 1.05); Select f120, f122, f136, f144, f163 from tb3 where f122= 'Test 3.5.8.4'; f120 f122 f136 f144 f163 @@ -155,14 +154,22 @@ select @test_var; 3.5.8.4 - single SQL - insert ----------------------------- Create trigger trg2 BEFORE UPDATE on tb3 for each row -insert into db_test.t1_i +BEGIN +insert into db_test.t1_i values (new.f120, new.f136, new.f144, new.f163); +END// +Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; +f120 f122 f136 f144 f163 +1 Test 3.5.8.4 00222 0000023456 1.050000000000000000000000000000 +select * from db_test.t1_i order by i120; +i120 i136 i144 i163 +1 00222 0000023456 1.050000000000000000000000000000 update tb3 set f120='I', f122='Test 3.5.8.4-Single Insert' where f122='Test 3.5.8.4'; Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; f120 f122 f136 f144 f163 I Test 3.5.8.4-Single Insert 00222 0000023456 1.050000000000000000000000000000 -select * from db_test.t1_i; +select * from db_test.t1_i order by i120; i120 i136 i144 i163 1 00222 0000023456 1.050000000000000000000000000000 I 00222 0000023456 1.050000000000000000000000000000 @@ -171,7 +178,7 @@ I 00222 0000023456 1.050000000000000000000000000000 ----------------------------- drop trigger trg2; Create trigger trg3 BEFORE UPDATE on tb3 for each row -update db_test.t1_u +update db_test.t1_u set u120=new.f120 where u136=new.f136; update tb3 set f120='U', f122='Test 3.5.8.4-Single Update' @@ -179,27 +186,27 @@ update tb3 set f120='U', f122='Test 3.5.8.4-Single Update' Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; f120 f122 f136 f144 f163 U Test 3.5.8.4-Single Update 00222 0000023456 1.050000000000000000000000000000 -select * from db_test.t1_u; +select * from db_test.t1_u order by u120; u120 u136 u144 u163 a 00111 0000099999 999.990000000000000000000000000000 -U 00222 0000023456 1.050000000000000000000000000000 c 00333 0000099999 999.990000000000000000000000000000 +f 00333 0000099999 999.990000000000000000000000000000 +U 00222 0000023456 1.050000000000000000000000000000 U 00222 0000023456 1.050000000000000000000000000000 U 00222 0000023456 1.050000000000000000000000000000 -f 00333 0000099999 999.990000000000000000000000000000 3.5.8.3/4 - single SQL - delete ------------------------------- drop trigger trg3; Create trigger trg4 AFTER UPDATE on tb3 for each row delete from db_test.t1_d where d136= new.f136; -update tb3 set f120='D', f136=444, +update tb3 set f120='D', f136=444, f122='Test 3.5.8.4-Single Delete' where f122='Test 3.5.8.4-Single Update'; Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; f120 f122 f136 f144 f163 D Test 3.5.8.4-Single Delete 00444 0000023456 1.050000000000000000000000000000 -select * from db_test.t1_d; +select * from db_test.t1_d order by d120; d120 d136 d144 d163 a 00111 0000099999 999.990000000000000000000000000000 c 00333 0000099999 999.990000000000000000000000000000 @@ -208,10 +215,10 @@ c 00333 0000099999 999.990000000000000000000000000000 ------------------------------- drop trigger trg4; Create trigger trg5 AFTER UPDATE on tb3 for each row -select sum(db_test.t1_u.u163) into @test_var from db_test.t1_u +select sum(db_test.t1_u.u163) into @test_var from db_test.t1_u where u136= new.f136; set @test_var=0; -update tb3 set f120='S', f136=111, +update tb3 set f120='S', f136=111, f122='Test 3.5.8.4-Single Select' where f122='Test 3.5.8.4-Single Delete'; Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; @@ -239,36 +246,36 @@ set @test_var='three', new.f120='4'; END IF; IF (new.f120='4') and (new.f136=10) then set @test_var2='2nd if', new.f120='d'; -ELSE +ELSE set @test_var2='2nd else', new.f120='D'; END IF; END// set @test_var='Empty', @test_var2=0; Insert into tb3 (f120, f122, f136) values ('1', 'Test 3.5.8.5-if', 101); -select f120, f122, f136, @test_var, @test_var2 -from tb3 where f122 = 'Test 3.5.8.5-if'; +select f120, f122, f136, @test_var, @test_var2 +from tb3 where f122 = 'Test 3.5.8.5-if' order by f136; f120 f122 f136 @test_var @test_var2 D Test 3.5.8.5-if 00101 one 2nd else Insert into tb3 (f120, f122, f136) values ('2', 'Test 3.5.8.5-if', 102); -select f120, f122, f136, @test_var, @test_var2 -from tb3 where f122 = 'Test 3.5.8.5-if'; +select f120, f122, f136, @test_var, @test_var2 +from tb3 where f122 = 'Test 3.5.8.5-if' order by f136; f120 f122 f136 @test_var @test_var2 D Test 3.5.8.5-if 00101 two 2nd else D Test 3.5.8.5-if 00102 two 2nd else Insert into tb3 (f120, f122, f136) values ('3', 'Test 3.5.8.5-if', 10); -select f120, f122, f136, @test_var, @test_var2 -from tb3 where f122 = 'Test 3.5.8.5-if'; +select f120, f122, f136, @test_var, @test_var2 +from tb3 where f122 = 'Test 3.5.8.5-if' order by f136; f120 f122 f136 @test_var @test_var2 +d Test 3.5.8.5-if 00010 three 2nd if D Test 3.5.8.5-if 00101 three 2nd if D Test 3.5.8.5-if 00102 three 2nd if -d Test 3.5.8.5-if 00010 three 2nd if Insert into tb3 (f120, f122, f136) values ('3', 'Test 3.5.8.5-if', 103); -select f120, f122, f136, @test_var, @test_var2 -from tb3 where f122 = 'Test 3.5.8.5-if'; +select f120, f122, f136, @test_var, @test_var2 +from tb3 where f122 = 'Test 3.5.8.5-if' order by f136; f120 f122 f136 @test_var @test_var2 +d Test 3.5.8.5-if 00010 three 2nd else D Test 3.5.8.5-if 00101 three 2nd else D Test 3.5.8.5-if 00102 three 2nd else -d Test 3.5.8.5-if 00010 three 2nd else D Test 3.5.8.5-if 00103 three 2nd else create trigger trg3 before update on tb3 for each row BEGIN @@ -283,7 +290,7 @@ create trigger trg4 before update on tb3 for each row BEGIN IF (new.f120='4') and (new.f136=10) then set @test_var2='2nd if', new.f120='d'; -ELSE +ELSE set @test_var2='2nd else', new.f120='D'; 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 '' at line 7 @@ -325,60 +332,60 @@ ELSE set @test_var=CONCAT(new.f120, '*', new.f144); END case; END// set @test_var='Empty'; -Insert into tb3 (f120, f122, f136, f144) +Insert into tb3 (f120, f122, f136, f144) values ('a', 'Test 3.5.8.5-case', 5, 7); -select f120, f122, f136, f144, @test_var -from tb3 where f122 = 'Test 3.5.8.5-case'; +select f120, f122, f136, f144, @test_var +from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136; f120 f122 f136 f144 @test_var A Test 3.5.8.5-case 00125 0000000007 A*seven -Insert into tb3 (f120, f122, f136, f144) +Insert into tb3 (f120, f122, f136, f144) values ('b', 'Test 3.5.8.5-case', 71,16); -select f120, f122, f136, f144, @test_var -from tb3 where f122 = 'Test 3.5.8.5-case'; +select f120, f122, f136, f144, @test_var +from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136; f120 f122 f136 f144 @test_var A Test 3.5.8.5-case 00125 0000000007 B*0000000016 B Test 3.5.8.5-case 00191 0000000016 B*0000000016 -Insert into tb3 (f120, f122, f136, f144) +Insert into tb3 (f120, f122, f136, f144) values ('c', 'Test 3.5.8.5-case', 80,1); -select f120, f122, f136, f144, @test_var -from tb3 where f122 = 'Test 3.5.8.5-case'; +select f120, f122, f136, f144, @test_var +from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136; f120 f122 f136 f144 @test_var A Test 3.5.8.5-case 00125 0000000007 C=one B Test 3.5.8.5-case 00191 0000000016 C=one C Test 3.5.8.5-case 00200 0000000001 C=one -Insert into tb3 (f120, f122, f136) +Insert into tb3 (f120, f122, f136) values ('d', 'Test 3.5.8.5-case', 152); Warnings: Warning 1265 Data truncated for column 'f120' at row 1 -select f120, f122, f136, f144, @test_var -from tb3 where f122 = 'Test 3.5.8.5-case'; +select f120, f122, f136, f144, @test_var +from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136; f120 f122 f136 f144 @test_var +1 Test 3.5.8.5-case 00152 0000099999 1*0000099999 A Test 3.5.8.5-case 00125 0000000007 1*0000099999 B Test 3.5.8.5-case 00191 0000000016 1*0000099999 C Test 3.5.8.5-case 00200 0000000001 1*0000099999 -1 Test 3.5.8.5-case 00152 0000099999 1*0000099999 -Insert into tb3 (f120, f122, f136, f144) +Insert into tb3 (f120, f122, f136, f144) values ('e', 'Test 3.5.8.5-case', 200, 8); Warnings: Warning 1265 Data truncated for column 'f120' at row 1 -select f120, f122, f136, f144, @test_var -from tb3 where f122 = 'Test 3.5.8.5-case'; +select f120, f122, f136, f144, @test_var +from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136; f120 f122 f136 f144 @test_var +1 Test 3.5.8.5-case 00152 0000099999 1=eight +1 Test 3.5.8.5-case 00200 0000000008 1=eight A Test 3.5.8.5-case 00125 0000000007 1=eight B Test 3.5.8.5-case 00191 0000000016 1=eight C Test 3.5.8.5-case 00200 0000000001 1=eight -1 Test 3.5.8.5-case 00152 0000099999 1=eight -1 Test 3.5.8.5-case 00200 0000000008 1=eight -Insert into tb3 (f120, f122, f136, f144) +Insert into tb3 (f120, f122, f136, f144) values ('f', 'Test 3.5.8.5-case', 100, 8); -select f120, f122, f136, f144, @test_var -from tb3 where f122 = 'Test 3.5.8.5-case'; +select f120, f122, f136, f144, @test_var +from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136; f120 f122 f136 f144 @test_var +1 Test 3.5.8.5-case 00152 0000099999 1=eight +1 Test 3.5.8.5-case 00200 0000000008 1=eight A Test 3.5.8.5-case 00125 0000000007 1=eight B Test 3.5.8.5-case 00191 0000000016 1=eight C Test 3.5.8.5-case 00200 0000000001 1=eight -1 Test 3.5.8.5-case 00152 0000099999 1=eight -1 Test 3.5.8.5-case 00200 0000000008 1=eight create trigger trg3a before update on tb3 for each row BEGIN CASE @@ -392,40 +399,40 @@ delete from tb3 where f121='Test 3.5.8.5-case'; Testcase 3.5.8.5-loop/leave: ---------------------------- Create trigger trg4 after insert on tb3 for each row -BEGIN +BEGIN set @counter=0, @flag='Initial'; -Label1: loop +Label1: loop if new.f136<new.f144 then set @counter='Nothing to loop'; -leave Label1; +leave Label1; else set @counter=@counter+1; if new.f136=new.f144+@counter then set @counter=concat(@counter, ' loops'); leave Label1; -end if; -end if; -iterate label1; +end if; +end if; +iterate label1; set @flag='Final'; -END loop Label1; +END loop Label1; END// -Insert into tb3 (f122, f136, f144) +Insert into tb3 (f122, f136, f144) values ('Test 3.5.8.5-loop', 2, 8); select @counter, @flag; @counter @flag Nothing to loop Initial -Insert into tb3 (f122, f136, f144) +Insert into tb3 (f122, f136, f144) values ('Test 3.5.8.5-loop', 11, 8); select @counter, @flag; @counter @flag 3 loops Initial Create trigger trg4_2 after update on tb3 for each row -BEGIN -Label1: loop +BEGIN +Label1: loop set @counter=@counter+1; -END; +END; 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 '; +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 '; END' at line 5 drop trigger trg4_2; drop trigger trg4; @@ -435,23 +442,23 @@ Testcase 3.5.8.5-repeat: ------------------------ Create trigger trg6 after insert on tb3 for each row BEGIN -rp_label: REPEAT -SET @counter1 = @counter1 + 1; +rp_label: REPEAT +SET @counter1 = @counter1 + 1; IF (@counter1 MOD 2 = 0) THEN ITERATE rp_label; END IF; -SET @counter2 = @counter2 + 1; +SET @counter2 = @counter2 + 1; UNTIL @counter1> new.f136 END REPEAT rp_label; END// set @counter1= 0, @counter2= 0; -Insert into tb3 (f122, f136) +Insert into tb3 (f122, f136) values ('Test 3.5.8.5-repeat', 13); select @counter1, @counter2; @counter1 @counter2 15 8 Create trigger trg6_2 after update on tb3 for each row BEGIN -REPEAT -SET @counter2 = @counter2 + 1; +REPEAT +SET @counter2 = @counter2 + 1; 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 'END' at line 5 drop trigger trg6; @@ -460,33 +467,62 @@ delete from tb3 where f122='Test 3.5.8.5-repeat'; Testcase 3.5.8.5-while: ----------------------- Create trigger trg7 after insert on tb3 for each row -wl_label: WHILE @counter1 < new.f136 DO -SET @counter1 = @counter1 + 1; +wl_label: WHILE @counter1 < new.f136 DO +SET @counter1 = @counter1 + 1; IF (@counter1 MOD 2 = 0) THEN ITERATE wl_label; END IF; -SET @counter2 = @counter2 + 1; +SET @counter2 = @counter2 + 1; END WHILE wl_label// set @counter1= 0, @counter2= 0; -Insert into tb3 (f122, f136) +Insert into tb3 (f122, f136) values ('Test 3.5.8.5-while', 7); select @counter1, @counter2; @counter1 @counter2 7 4 Create trigger trg7_2 after update on tb3 for each row BEGIN -WHILE @counter1 < new.f136 -SET @counter1 = @counter1 + 1; +WHILE @counter1 < new.f136 +SET @counter1 = @counter1 + 1; 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 @counter1 = @counter1 + 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 'SET @counter1 = @counter1 + 1; END' at line 4 delete from tb3 where f122='Test 3.5.8.5-while'; drop trigger trg7; Testcase 3.5.8.6: (requirement void) ------------------------------------ +CREATE PROCEDURE sp_01 () BEGIN set @v1=1; END// +CREATE TRIGGER trg8_1 BEFORE UPDATE ON tb3 FOR EACH ROW +BEGIN +CALL sp_01 (); +END// +Insert into tb3 (f120, f122, f136) values ('6', 'Test 3.5.8.6-insert', 101); +update tb3 set f120='S', f136=111, +f122='Test 3.5.8.6-tr8_1' + where f122='Test 3.5.8.6-insert'; +select f120, f122 +from tb3 where f122 like 'Test 3.5.8.6%' order by f120; +f120 f122 +S Test 3.5.8.6-tr8_1 +DROP TRIGGER trg8_1; +DROP PROCEDURE sp_01; -Testcase 3.5.8.7: (Disabled as a result of bug _____) ------------------------------------------------------ +Testcase 3.5.8.7 +---------------- +Create trigger trg9_1 before update on tb3 for each row +BEGIN +Start transaction; +Set new.f120='U'; +Commit; +END// +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +Create trigger trg9_2 before delete on tb3 for each row +BEGIN +Start transaction; +Set @var2=old.f120; +Rollback; +END// +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. drop user test_general@localhost; drop user test_general; drop user test_super@localhost; diff --git a/mysql-test/suite/funcs_1/r/memory_trig_09.result b/mysql-test/suite/funcs_1/r/memory_trig_09.result index da8b15901d9..b84f4f60583 100644 --- a/mysql-test/suite/funcs_1/r/memory_trig_09.result +++ b/mysql-test/suite/funcs_1/r/memory_trig_09.result @@ -1,68 +1,69 @@ 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 char(50), -f122 char(50), -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 = memory; +f118 char not null DEFAULT 'a', +f119 char binary not null DEFAULT b'101', +f120 char ascii not null DEFAULT b'101', +f121 char(50), +f122 char(50), +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 = <engine_to_be_used>; 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 'MYSQL_TEST_DIR/suite/funcs_1/data/memory_tb3.txt' into table tb3 ; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/memory_tb3.txt' +into table tb3; Testcase 3.5.9.1/2: ------------------- -Create trigger trg1 BEFORE UPDATE on tb3 for each row +Create trigger trg1 BEFORE UPDATE on tb3 for each row set new.f142 = 94087, @counter=@counter+1; TotalRows 10 @@ -74,15 +75,15 @@ NewValuew 0 set @counter=0; Update tb3 Set f142='1' where f130<100; -select count(*) as ExpectedChanged, @counter as TrigCounter +select count(*) as ExpectedChanged, @counter as TrigCounter from tb3 where f142=94087; ExpectedChanged TrigCounter 9 9 -select count(*) as ExpectedNotChange from tb3 +select count(*) as ExpectedNotChange from tb3 where f130<100 and f142<>94087; ExpectedNotChange 0 -select count(*) as NonExpectedChanged from tb3 +select count(*) as NonExpectedChanged from tb3 where f130>=130 and f142=94087; NonExpectedChanged 0 @@ -110,17 +111,17 @@ set @tr_var_af_118=old.f118, @tr_var_af_121=old.f121, 0 0 0 0 0 @tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_163 0 0 0 0 0 -Insert into tb3 (f122, f136, f163) +Insert into tb3 (f122, f136, f163) values ('Test 3.5.9.3', 7, 123.17); Update tb3 Set f136=8 where f122='Test 3.5.9.3'; -select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3'; +select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3' order by f136; f118 f121 f122 f136 f163 a NULL Test 3.5.9.3 00008 123.170000000000000000000000000000 -select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, +select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_163; @tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_163 a NULL Test 3.5.9.3 7 123.170000000000000000000000000000 -select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, +select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_163; @tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_163 a NULL Test 3.5.9.3 7 123.170000000000000000000000000000 @@ -129,13 +130,13 @@ a NULL Test 3.5.9.3 7 123.170000000000000000000000000000 @tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_163 0 0 0 0 0 delete from tb3 where f122='Test 3.5.9.3'; -select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3'; +select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3' order by f136; f118 f121 f122 f136 f163 -select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, +select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_163; @tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_163 a NULL Test 3.5.9.3 8 123.170000000000000000000000000000 -select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, +select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_163; @tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_163 a NULL Test 3.5.9.3 8 123.170000000000000000000000000000 @@ -166,17 +167,17 @@ set @tr_var_af_118=new.f118, @tr_var_af_121=new.f121, 0 0 0 0 0 0 @tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_151 @tr_var_af_163 0 0 0 0 0 0 -Insert into tb3 (f122, f136, f151, f163) +Insert into tb3 (f122, f136, f151, f163) values ('Test 3.5.9.4', 7, DEFAULT, 995.24); -select f118, f121, f122, f136, f151, f163 from tb3 -where f122 like 'Test 3.5.9.4%'; +select f118, f121, f122, f136, f151, f163 from tb3 +where f122 like 'Test 3.5.9.4%' order by f163; f118 f121 f122 f136 f151 f163 a NULL Test 3.5.9.4 00007 999 995.240000000000000000000000000000 -select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, +select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_151, @tr_var_b4_163; @tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_151 @tr_var_b4_163 a NULL Test 3.5.9.4 7 999 995.240000000000000000000000000000 -select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, +select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_151, @tr_var_af_163; @tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_151 @tr_var_af_163 a NULL Test 3.5.9.4 7 999 995.240000000000000000000000000000 @@ -188,15 +189,15 @@ Update tb3 Set f122='Test 3.5.9.4-trig', f136=NULL, f151=DEFAULT, f163=NULL where f122='Test 3.5.9.4'; Warnings: Warning 1048 Column 'f136' cannot be null -select f118, f121, f122, f136, f151, f163 from tb3 -where f122 like 'Test 3.5.9.4-trig'; +select f118, f121, f122, f136, f151, f163 from tb3 +where f122 like 'Test 3.5.9.4-trig' order by f163; f118 f121 f122 f136 f151 f163 a NULL Test 3.5.9.4-trig 00000 999 NULL -select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, +select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_151, @tr_var_b4_163; @tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_151 @tr_var_b4_163 a NULL Test 3.5.9.4-trig 0 999 NULL -select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, +select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_151, @tr_var_af_163; @tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_151 @tr_var_af_163 a NULL Test 3.5.9.4-trig 0 999 NULL @@ -234,6 +235,7 @@ ERROR HY000: There is no NEW row in on DELETE trigger create trigger trg5b after DELETE on tb3 for each row set new.f122='test'; ERROR HY000: There is no NEW row in on DELETE trigger +drop trigger trg5a; drop trigger trg5b; Testcase 3.5.9.10: (implied in previous tests) diff --git a/mysql-test/suite/funcs_1/r/memory_trig_1011ext.result b/mysql-test/suite/funcs_1/r/memory_trig_1011ext.result index 8fc9178f494..97f1eb22476 100644 --- a/mysql-test/suite/funcs_1/r/memory_trig_1011ext.result +++ b/mysql-test/suite/funcs_1/r/memory_trig_1011ext.result @@ -1,64 +1,65 @@ 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 char(50), -f122 char(50), -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 = memory; +f118 char not null DEFAULT 'a', +f119 char binary not null DEFAULT b'101', +f120 char ascii not null DEFAULT b'101', +f121 char(50), +f122 char(50), +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 = <engine_to_be_used>; 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 'MYSQL_TEST_DIR/suite/funcs_1/data/memory_tb3.txt' into table tb3 ; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/memory_tb3.txt' +into table tb3; Testcase 3.5.10.1/2/3: ---------------------- @@ -80,7 +81,7 @@ Insert into vw11 (f122, f151) values ('Test 3.5.10.1/2/3', 1); Insert into vw11 (f122, f151) values ('Test 3.5.10.1/2/3', 2); Insert into vw11 (f122, f151) values ('Not in View', 3); select f121, f122, f151, f163 -from tb3 where f122 like 'Test 3.5.10.1/2/3%'; +from tb3 where f122 like 'Test 3.5.10.1/2/3%' order by f151; f121 f122 f151 f163 NULL Test 3.5.10.1/2/3 1 111.110000000000000000000000000000 NULL Test 3.5.10.1/2/3 2 111.110000000000000000000000000000 @@ -94,7 +95,7 @@ f121 f122 f151 f163 NULL Not in View 3 111.110000000000000000000000000000 Update vw11 set f163=1; select f121, f122, f151, f163 from tb3 -where f122 like 'Test 3.5.10.1/2/3%'; +where f122 like 'Test 3.5.10.1/2/3%' order by f151; f121 f122 f151 f163 Y Test 3.5.10.1/2/3-Update 1 1.000000000000000000000000000000 Y Test 3.5.10.1/2/3-Update 2 1.000000000000000000000000000000 @@ -108,7 +109,7 @@ before delete 0 delete from vw11 where f151=1; select f121, f122, f151, f163 from tb3 -where f122 like 'Test 3.5.10.1/2/3%'; +where f122 like 'Test 3.5.10.1/2/3%' order by f151; f121 f122 f151 f163 Y Test 3.5.10.1/2/3-Update 2 1.000000000000000000000000000000 select f121, f122, f151, f163 from vw11; @@ -128,18 +129,18 @@ delete from tb3 where f122 like 'Test 3.5.10.1/2/3%'; Testcase 3.5.10.4: ------------------ -create table tb_load (f1 int, f2 char(25),f3 int) engine=memory; +create table tb_load (f1 int, f2 char(25),f3 int) engine = <engine_to_be_used>; Create trigger trg4 before insert on tb_load for each row set new.f3=-(new.f1 div 5), @counter= @counter+1; set @counter= 0; select @counter as 'Rows Loaded Before'; Rows Loaded Before 0 -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' into table tb_load; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t9.txt' into table tb_load; select @counter as 'Rows Loaded After'; Rows Loaded After 10 -Select * from tb_load limit 10; +Select * from tb_load order by f1 limit 10; f1 f2 f3 -5000 a` 1000 -4999 aaa 999 @@ -162,7 +163,7 @@ Testcase 3.5.10.6: (implemented in trig_frkey.test) Testcase 3.5.10.extra: ---------------------- -create table t1_sp (var136 tinyint, var151 decimal) engine=memory; +create table t1_sp (var136 tinyint, var151 decimal) engine = <engine_to_be_used>; create trigger trg before insert on t1_sp for each row set @counter=@counter+1; create procedure trig_sp() @@ -211,12 +212,12 @@ drop table if exists t2_2; drop table if exists t2_3; drop table if exists t2_4; drop table if exists t3; -create table t1 (f1 integer) engine=memory; -create table t2_1 (f1 integer) engine=memory; -create table t2_2 (f1 integer) engine=memory; -create table t2_3 (f1 integer) engine=memory; -create table t2_4 (f1 integer) engine=memory; -create table t3 (f1 integer) engine=memory; +create table t1 (f1 integer) engine = <engine_to_be_used>; +create table t2_1 (f1 integer) engine = <engine_to_be_used>; +create table t2_2 (f1 integer) engine = <engine_to_be_used>; +create table t2_3 (f1 integer) engine = <engine_to_be_used>; +create table t2_4 (f1 integer) engine = <engine_to_be_used>; +create table t3 (f1 integer) engine = <engine_to_be_used>; insert into t1 values (1); create trigger tr1 after insert on t1 for each row BEGIN @@ -234,7 +235,7 @@ insert into t3 (f1) values (new.f1+1000); create trigger tr2_4 after insert on t2_4 for each row insert into t3 (f1) values (new.f1+10000); insert into t1 values (1); -select * from t3; +select * from t3 order by f1; f1 12 102 @@ -254,10 +255,10 @@ drop table if exists t1; drop table if exists t2; drop table if exists t3; drop table if exists t4; -create table t1 (f1 integer) engine = memory; -create table t2 (f2 integer) engine = memory; -create table t3 (f3 integer) engine = memory; -create table t4 (f4 integer) engine = memory; +create table t1 (f1 integer) engine = <engine_to_be_used>; +create table t2 (f2 integer) engine = <engine_to_be_used>; +create table t3 (f3 integer) engine = <engine_to_be_used>; +create table t4 (f4 integer) engine = <engine_to_be_used>; insert into t1 values (0); create trigger tr1 after insert on t1 for each row insert into t2 (f2) values (new.f1+1); @@ -269,17 +270,17 @@ create trigger tr4 after insert on t4 for each row insert into t1 (f1) values (new.f4+1); insert into t1 values (1); ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger. -select * from t1; +select * from t1 order by f1; f1 0 1 -select * from t2; +select * from t2 order by f2; f2 2 -select * from t3; +select * from t3 order by f3; f3 3 -select * from t4; +select * from t4 order by f4; f4 4 drop trigger tr1; @@ -291,13 +292,13 @@ drop table t2; drop table t3; drop table t4; -Testcase y.y.y.4: Recursive trigger/SP references (disabled bug 11889) ----------------------------------------------------------------------- +Testcase y.y.y.4: Recursive trigger/SP references +------------------------------------------------- set @sql_mode='traditional'; create table t1_sp ( count integer, var136 tinyint, -var151 decimal) engine=memory; +var151 decimal) engine = <engine_to_be_used>; create procedure trig_sp() begin declare done int default 0; @@ -351,7 +352,7 @@ drop procedure trig_sp; drop trigger trg; drop table t1_sp; -Testcase y.y.y.5: Roleback of nested trigger references +Testcase y.y.y.5: Rollback of nested trigger references ------------------------------------------------------- set @@sql_mode='traditional'; use test; @@ -359,10 +360,10 @@ drop table if exists t1; drop table if exists t2; drop table if exists t3; drop table if exists t4; -create table t1 (f1 integer) engine = memory; -create table t2 (f2 integer) engine = memory; -create table t3 (f3 integer) engine = memory; -create table t4 (f4 tinyint) engine = memory; +create table t1 (f1 integer) engine = <engine_to_be_used>; +create table t2 (f2 integer) engine = <engine_to_be_used>; +create table t3 (f3 integer) engine = <engine_to_be_used>; +create table t4 (f4 tinyint) engine = <engine_to_be_used>; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -380,14 +381,14 @@ start transaction; insert into t1 values (1); ERROR 22003: Out of range value adjusted for column 'f4' at row 1 commit; -select * from t1; +select * from t1 order by f1; f1 1 1 -select * from t2; +select * from t2 order by f2; f2 2 -select * from t3; +select * from t3 order by f3; f3 3 drop trigger tr1; diff --git a/mysql-test/suite/funcs_1/r/memory_views.result b/mysql-test/suite/funcs_1/r/memory_views.result index cc50c8219f0..7bd674b8d76 100644 --- a/mysql-test/suite/funcs_1/r/memory_views.result +++ b/mysql-test/suite/funcs_1/r/memory_views.result @@ -1,117 +1,119 @@ USE test; drop table if exists tb2 ; create table tb2 ( -f59 numeric (0) unsigned, -f60 numeric (64) unsigned, -f61 numeric (0) zerofill, -f62 numeric (64) zerofill, -f63 numeric (0) unsigned zerofill, -f64 numeric (64) unsigned zerofill, -f65 numeric (0,0), -f66 numeric (63,30), -f67 numeric (0,0) unsigned, -f68 numeric (63,30) unsigned, -f69 numeric (0,0) zerofill, -f70 numeric (63,30) zerofill, -f71 numeric (0,0) unsigned zerofill, -f72 numeric (63,30) unsigned zerofill, -f73 real, -f74 real unsigned, -f75 real zerofill, -f76 real unsigned zerofill, -f77 double default 7.7, -f78 double unsigned default 7.7, -f79 double zerofill default 7.7, -f80 double unsigned zerofill default 8.8, -f81 float not null default 8.8, -f82 float unsigned not null default 8.8, -f83 float zerofill not null default 8.8, -f84 float unsigned zerofill not null default 8.8, -f85 float(0) not null default 8.8, -f86 float(23) not null default 8.8, -f87 float(0) unsigned not null default 8.8, -f88 float(23) unsigned not null default 8.8, -f89 float(0) zerofill not null default 8.8, -f90 float(23) zerofill not null default 8.8, -f91 float(0) unsigned zerofill not null default 8.8, -f92 float(23) unsigned zerofill not null default 8.8, -f93 float(24) not null default 8.8, -f94 float(53) not null default 8.8, -f95 float(24) unsigned not null default 8.8, -f96 float(53) unsigned not null default 8.8, -f97 float(24) zerofill not null default 8.8, -f98 float(53) zerofill not null default 8.8, -f99 float(24) unsigned zerofill not null default 8.8, -f100 float(53) unsigned zerofill not null default 8.8, -f101 date not null default '2000-01-01', -f102 time not null default 20, -f103 datetime not null default '2/2/2', -f104 timestamp not null default 20001231235959, -f105 year not null default 2000, -f106 year(3) not null default 2000, -f107 year(4) not null default 2000, -f108 enum("1enum","2enum") not null default "1enum", +f59 numeric (0) unsigned, +f60 numeric (64) unsigned, +f61 numeric (0) zerofill, +f62 numeric (64) zerofill, +f63 numeric (0) unsigned zerofill, +f64 numeric (64) unsigned zerofill, +f65 numeric (0,0), +f66 numeric (63,30), +f67 numeric (0,0) unsigned, +f68 numeric (63,30) unsigned, +f69 numeric (0,0) zerofill, +f70 numeric (63,30) zerofill, +f71 numeric (0,0) unsigned zerofill, +f72 numeric (63,30) unsigned zerofill, +f73 real, +f74 real unsigned, +f75 real zerofill, +f76 real unsigned zerofill, +f77 double default 7.7, +f78 double unsigned default 7.7, +f79 double zerofill default 7.7, +f80 double unsigned zerofill default 8.8, +f81 float not null default 8.8, +f82 float unsigned not null default 8.8, +f83 float zerofill not null default 8.8, +f84 float unsigned zerofill not null default 8.8, +f85 float(0) not null default 8.8, +f86 float(23) not null default 8.8, +f87 float(0) unsigned not null default 8.8, +f88 float(23) unsigned not null default 8.8, +f89 float(0) zerofill not null default 8.8, +f90 float(23) zerofill not null default 8.8, +f91 float(0) unsigned zerofill not null default 8.8, +f92 float(23) unsigned zerofill not null default 8.8, +f93 float(24) not null default 8.8, +f94 float(53) not null default 8.8, +f95 float(24) unsigned not null default 8.8, +f96 float(53) unsigned not null default 8.8, +f97 float(24) zerofill not null default 8.8, +f98 float(53) zerofill not null default 8.8, +f99 float(24) unsigned zerofill not null default 8.8, +f100 float(53) unsigned zerofill not null default 8.8, +f101 date not null default '2000-01-01', +f102 time not null default 20, +f103 datetime not null default '2/2/2', +f104 timestamp not null default 20001231235959, +f105 year not null default 2000, +f106 year(3) not null default 2000, +f107 year(4) not null default 2000, +f108 enum("1enum","2enum") not null default "1enum", f109 set("1set","2set") not null default "1set" ) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/memory_tb2.txt' into table tb2 ; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/memory_tb2.txt' +into table tb2 ; DROP DATABASE IF EXISTS test1; CREATE DATABASE test1; USE test1; drop table if exists tb2 ; create table tb2 ( -f59 numeric (0) unsigned, -f60 numeric (64) unsigned, -f61 numeric (0) zerofill, -f62 numeric (64) zerofill, -f63 numeric (0) unsigned zerofill, -f64 numeric (64) unsigned zerofill, -f65 numeric (0,0), -f66 numeric (63,30), -f67 numeric (0,0) unsigned, -f68 numeric (63,30) unsigned, -f69 numeric (0,0) zerofill, -f70 numeric (63,30) zerofill, -f71 numeric (0,0) unsigned zerofill, -f72 numeric (63,30) unsigned zerofill, -f73 real, -f74 real unsigned, -f75 real zerofill, -f76 real unsigned zerofill, -f77 double default 7.7, -f78 double unsigned default 7.7, -f79 double zerofill default 7.7, -f80 double unsigned zerofill default 8.8, -f81 float not null default 8.8, -f82 float unsigned not null default 8.8, -f83 float zerofill not null default 8.8, -f84 float unsigned zerofill not null default 8.8, -f85 float(0) not null default 8.8, -f86 float(23) not null default 8.8, -f87 float(0) unsigned not null default 8.8, -f88 float(23) unsigned not null default 8.8, -f89 float(0) zerofill not null default 8.8, -f90 float(23) zerofill not null default 8.8, -f91 float(0) unsigned zerofill not null default 8.8, -f92 float(23) unsigned zerofill not null default 8.8, -f93 float(24) not null default 8.8, -f94 float(53) not null default 8.8, -f95 float(24) unsigned not null default 8.8, -f96 float(53) unsigned not null default 8.8, -f97 float(24) zerofill not null default 8.8, -f98 float(53) zerofill not null default 8.8, -f99 float(24) unsigned zerofill not null default 8.8, -f100 float(53) unsigned zerofill not null default 8.8, -f101 date not null default '2000-01-01', -f102 time not null default 20, -f103 datetime not null default '2/2/2', -f104 timestamp not null default 20001231235959, -f105 year not null default 2000, -f106 year(3) not null default 2000, -f107 year(4) not null default 2000, -f108 enum("1enum","2enum") not null default "1enum", +f59 numeric (0) unsigned, +f60 numeric (64) unsigned, +f61 numeric (0) zerofill, +f62 numeric (64) zerofill, +f63 numeric (0) unsigned zerofill, +f64 numeric (64) unsigned zerofill, +f65 numeric (0,0), +f66 numeric (63,30), +f67 numeric (0,0) unsigned, +f68 numeric (63,30) unsigned, +f69 numeric (0,0) zerofill, +f70 numeric (63,30) zerofill, +f71 numeric (0,0) unsigned zerofill, +f72 numeric (63,30) unsigned zerofill, +f73 real, +f74 real unsigned, +f75 real zerofill, +f76 real unsigned zerofill, +f77 double default 7.7, +f78 double unsigned default 7.7, +f79 double zerofill default 7.7, +f80 double unsigned zerofill default 8.8, +f81 float not null default 8.8, +f82 float unsigned not null default 8.8, +f83 float zerofill not null default 8.8, +f84 float unsigned zerofill not null default 8.8, +f85 float(0) not null default 8.8, +f86 float(23) not null default 8.8, +f87 float(0) unsigned not null default 8.8, +f88 float(23) unsigned not null default 8.8, +f89 float(0) zerofill not null default 8.8, +f90 float(23) zerofill not null default 8.8, +f91 float(0) unsigned zerofill not null default 8.8, +f92 float(23) unsigned zerofill not null default 8.8, +f93 float(24) not null default 8.8, +f94 float(53) not null default 8.8, +f95 float(24) unsigned not null default 8.8, +f96 float(53) unsigned not null default 8.8, +f97 float(24) zerofill not null default 8.8, +f98 float(53) zerofill not null default 8.8, +f99 float(24) unsigned zerofill not null default 8.8, +f100 float(53) unsigned zerofill not null default 8.8, +f101 date not null default '2000-01-01', +f102 time not null default 20, +f103 datetime not null default '2/2/2', +f104 timestamp not null default 20001231235959, +f105 year not null default 2000, +f106 year(3) not null default 2000, +f107 year(4) not null default 2000, +f108 enum("1enum","2enum") not null default "1enum", f109 set("1set","2set") not null default "1set" ) engine = memory; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/memory_tb2.txt' into table tb2 ; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/memory_tb2.txt' +into table tb2 ; USE test; ! Attention: The file with the expected results is not diff --git a/mysql-test/suite/funcs_1/r/myisam_func_view.result b/mysql-test/suite/funcs_1/r/myisam_func_view.result index 94cba9796a2..c2689a36801 100644 --- a/mysql-test/suite/funcs_1/r/myisam_func_view.result +++ b/mysql-test/suite/funcs_1/r/myisam_func_view.result @@ -1,7 +1,3 @@ - -! Attention: The file with the expected results suffers from -Bug#10713: mysqldump includes database in create view and referenced tables --------------------------------------------------------------------------------- DROP TABLE IF EXISTS t1_selects, t1_modes, t1_values; DROP VIEW IF EXISTS v1; CREATE TABLE t1_values @@ -9,7 +5,7 @@ CREATE TABLE t1_values id BIGINT AUTO_INCREMENT, select_id BIGINT, PRIMARY KEY(id) -) ENGINE = 'MYISAM' ; +) ENGINE = <engine_to_be_tested>; ALTER TABLE t1_values ADD my_char_30 CHAR(30); ALTER TABLE t1_values ADD my_varchar_1000 VARCHAR(1000); ALTER TABLE t1_values ADD my_binary_30 BINARY(30); @@ -39,10 +35,10 @@ my_bigint = -9223372036854775808, my_decimal = -9999999999999999999999999999999999.999999999999999999999999999999 , my_double = -1.7976931348623E+308; INSERT INTO t1_values SET -my_char_30 = '<--------30 characters------->', +my_char_30 = '<--------30 characters------->', my_varchar_1000 = CONCAT('<---------1000 characters', RPAD('',965,'-'),'--------->'), -my_binary_30 = '<--------30 characters------->', +my_binary_30 = '<--------30 characters------->', my_varbinary_1000 = CONCAT('<---------1000 characters', RPAD('',965,'-'),'--------->'), my_datetime = '9999-12-31 23:59:59', @@ -54,23 +50,23 @@ my_bigint = 9223372036854775807, my_decimal = +9999999999999999999999999999999999.999999999999999999999999999999 , my_double = 1.7976931348623E+308; INSERT INTO t1_values SET -my_char_30 = ' ---äÖüß@µ*$-- ', -my_varchar_1000 = ' ---äÖüß@µ*$-- ', -my_binary_30 = ' ---äÖüß@µ*$-- ', -my_varbinary_1000 = ' ---äÖüß@µ*$-- ', +my_char_30 = ' ---äÖüß@µ*$-- ', +my_varchar_1000 = ' ---äÖüß@µ*$-- ', +my_binary_30 = ' ---äÖüß@µ*$-- ', +my_varbinary_1000 = ' ---äÖüß@µ*$-- ', my_datetime = '2004-02-29 23:59:59', my_date = '2004-02-29', my_timestamp = '2004-02-29 23:59:59', my_time = '13:00:00', my_year = 2000, -my_bigint = 0, +my_bigint = 0, my_decimal = 0.0, my_double = 0; INSERT INTO t1_values SET -my_char_30 = '-1', -my_varchar_1000 = '-1', -my_binary_30 = '-1', -my_varbinary_1000 = '-1', +my_char_30 = '-1', +my_varchar_1000 = '-1', +my_binary_30 = '-1', +my_varbinary_1000 = '-1', my_datetime = '2005-06-28 10:00:00', my_date = '2005-06-28', my_timestamp = '2005-06-28 10:00:00', @@ -89,6 +85,9 @@ INSERT INTO t1_values SET select_id = @select_id, my_bigint = 4; INSERT INTO t1_values SET select_id = @select_id, my_bigint = -25; +##### 1.1.1. CAST --> BINARY +##### 1.1.2. CAST --> CHAR +##### 1.1.3. CAST --> DATE INSERT INTO t1_values SET select_id = @select_id, my_char_30 = '2005-06-27'; INSERT INTO t1_values SET select_id = @select_id, @@ -101,6 +100,7 @@ INSERT INTO t1_values SET select_id = @select_id, my_bigint = 20050627; INSERT INTO t1_values SET select_id = @select_id, my_double = +20.050627E+6; +##### 1.1.4. CAST --> DATETIME INSERT INTO t1_values SET select_id = @select_id, my_char_30 = '2005-06-27 17:58'; INSERT INTO t1_values SET select_id = @select_id, @@ -113,6 +113,7 @@ INSERT INTO t1_values SET select_id = @select_id, my_bigint = 200506271758; INSERT INTO t1_values SET select_id = @select_id, my_double = +0.0200506271758E+13; +##### 1.1.5. CAST --> TIME INSERT INTO t1_values SET select_id = @select_id, my_char_30 = '1 17:58'; INSERT INTO t1_values SET select_id = @select_id, @@ -123,10 +124,9 @@ INSERT INTO t1_values SET select_id = @select_id, my_varbinary_1000 = '1 17:58'; INSERT INTO t1_values SET select_id = @select_id, my_bigint = 1758; - -some statements disabled because of -Bug#12440: CAST(data type DOUBLE AS TIME) strange results --------------------------------------------------------------------------------- +INSERT INTO t1_values SET select_id = @select_id, +my_double = +1.758E+3; +##### 1.1.6. CAST --> DECIMAL INSERT INTO t1_values SET select_id = @select_id, my_char_30 = '-3333.3333'; INSERT INTO t1_values SET select_id = @select_id, @@ -135,51 +135,39 @@ INSERT INTO t1_values SET select_id = @select_id, my_binary_30 = '-3333.3333'; INSERT INTO t1_values SET select_id = @select_id, my_varbinary_1000 = '-3333.3333'; - -some statements disabled because of -Bug#13349: CAST(1.0E+300 TO DECIMAL) returns wrong result + diff little/big endian --------------------------------------------------------------------------------- +INSERT INTO t1_values SET select_id = @select_id, +my_double = -0.33333333E+4; +##### 1.1.7. CAST --> SIGNED INTEGER "Attention: CAST --> SIGNED INTEGER - The file with expected results suffers from - Bug#5083 Big integer values are inserted as negative into - decimal/string columns Bug#5913 Traditional mode: BIGINT range not correctly delimited - Both have the status: To be fixed later" --------------------------------------------------------------------------------- - -some statements disabled because of -Bug #13344: CAST(1E+300 TO signed int) on little endian CPU, wrong result + Status: To be fixed later" -------------------------------------------------------------------------------- +##### 1.1.8. CAST --> UNSIGNED INTEGER "Attention: CAST --> UNSIGNED INTEGER - The file with expected results suffers from Bug 5083 5913 9809" + The file with expected results suffers from Bug 5913" -------------------------------------------------------------------------------- some statements disabled because of -Bugs#8663: cant use bgint unsigned as input to cast +Bug#5913 Traditional mode: BIGINT range not correctly delimited -------------------------------------------------------------------------------- -SET @my_select = 'SELECT CONVERT(my_char_30 USING utf8), +SET @my_select = 'SELECT CONVERT(my_char_30 USING utf8), my_char_30, id FROM t1_values'; -SET @my_select = 'SELECT CONVERT(my_varchar_1000 USING utf8), +SET @my_select = 'SELECT CONVERT(my_varchar_1000 USING utf8), my_varchar_1000, id FROM t1_values'; -SET @my_select = 'SELECT CONVERT(my_binary_30 USING utf8), +SET @my_select = 'SELECT CONVERT(my_binary_30 USING utf8), my_binary_30, id FROM t1_values'; -SET @my_select = 'SELECT CONVERT(my_varbinary_1000 USING utf8), +SET @my_select = 'SELECT CONVERT(my_varbinary_1000 USING utf8), my_varbinary_1000, id FROM t1_values'; -SET @my_select = 'SELECT CONVERT(my_char_30 USING koi8r), +SET @my_select = 'SELECT CONVERT(my_char_30 USING koi8r), my_char_30, id FROM t1_values'; -SET @my_select = 'SELECT CONVERT(my_varchar_1000 USING koi8r), +SET @my_select = 'SELECT CONVERT(my_varchar_1000 USING koi8r), my_varchar_1000, id FROM t1_values'; -SET @my_select = 'SELECT CONVERT(my_binary_30 USING koi8r), +SET @my_select = 'SELECT CONVERT(my_binary_30 USING koi8r), my_binary_30, id FROM t1_values'; -SET @my_select = 'SELECT CONVERT(my_varbinary_1000 USING koi8r), +SET @my_select = 'SELECT CONVERT(my_varbinary_1000 USING koi8r), my_varbinary_1000, id FROM t1_values'; - -"Attention: IF(my_year IS NULL, ... - The file with expected results suffers from - Bug#11689. successful CREATE VIEW but SELECT on view fails." --------------------------------------------------------------------------------- SET @my_select = 'SELECT BIT_LENGTH(my_char_30), my_char_30, id FROM t1_values'; SET @my_select = 'SELECT BIT_LENGTH(my_varchar_1000), @@ -192,22 +180,20 @@ SET @my_select = 'SELECT INSTR(my_char_30, ''char''), my_char_30, id FROM t1_values'; SET @my_select = 'SELECT LCASE(my_varchar_1000), my_varchar_1000, id FROM t1_values'; -SET @my_select = +SET @my_select = 'SELECT LEFT(my_char_30, 2), my_char_30, id FROM t1_values'; -SET @my_select = +SET @my_select = 'SELECT LEFT(my_varchar_1000, 2), my_varchar_1000, id FROM t1_values'; -SET @my_select = +SET @my_select = 'SELECT LEFT(my_binary_30, 2), my_binary_30, id FROM t1_values'; -SET @my_select = +SET @my_select = 'SELECT LEFT(my_varbinary_1000, 2), my_varbinary_1000, id FROM t1_values'; - -"Attention: LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', <numeric column>) - The file with expected results suffers from Bug 10963 11728" - and the testcases with length = BIGINT or DOUBLE column are deactivated, -because there are 32/64 Bit differences --------------------------------------------------------------------------------- +SET @my_select = +'SELECT LEFT(''AaBbCcDdEeFfGgHhIiJjÄäÜüÖö'', my_bigint), my_bigint, id FROM t1_values'; SET @my_select = 'SELECT LEFT(''AaBbCcDdEeFfGgHhIiJjÄäÜüÖö'', my_decimal), my_decimal, id FROM t1_values'; +SET @my_select = +'SELECT LEFT(''AaBbCcDdEeFfGgHhIiJjÄäÜüÖö'', my_double), my_double, id FROM t1_values'; SET @my_select = 'SELECT LENGTH(my_char_30), my_char_30, id FROM t1_values'; SET @my_select = 'SELECT LENGTH(my_varchar_1000), @@ -216,8 +202,10 @@ SET @my_select = 'SELECT LENGTH(my_binary_30), my_binary_30, id FROM t1_values'; SET @my_select = 'SELECT LENGTH(my_varbinary_1000), my_varbinary_1000, id FROM t1_values'; -SET @my_select = -'SELECT LOAD_FILE(''../log/current_test''), id FROM t1_values'; +SET @my_select = +'SELECT LOAD_FILE(''<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/load_file.txt'') + AS my_col, + id FROM t1_values'; SET @my_select = 'SELECT LOCATE(''char'', my_char_30), my_char_30, id FROM t1_values'; SET @my_select = 'SELECT LOCATE(''char'', my_varchar_1000), @@ -299,19 +287,19 @@ SET sql_mode = ''; -------------------------------------------------------------------------------- CREATE VIEW v1 AS SELECT my_char_30, id FROM t1_values; SELECT my_char_30, id FROM t1_values -WHERE select_id = 187 OR select_id IS NULL; +WHERE select_id = 193 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 187 OR select_id IS NULL); +WHERE select_id = 193 OR select_id IS NULL) order by id; DROP VIEW v1; CREATE VIEW v1 AS SELECT CONCAT('A',my_char_30), my_char_30, id FROM t1_values; SELECT CONCAT('A',my_char_30), my_char_30, id FROM t1_values -WHERE select_id = 186 OR select_id IS NULL; +WHERE select_id = 192 OR select_id IS NULL order by id; CONCAT('A',my_char_30) my_char_30 id NULL NULL 1 A 2 @@ -323,7 +311,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select concat(_latin1'A',`t1_values`.`my_char_30`) AS `CONCAT('A',my_char_30)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 186 OR select_id IS NULL); +WHERE select_id = 192 OR select_id IS NULL) order by id; CONCAT('A',my_char_30) my_char_30 id NULL NULL 1 A 2 @@ -337,13 +325,13 @@ CREATE VIEW v1 AS SELECT LTRIM(my_varbinary_1000), my_varbinary_1000, id FROM t1_values; SELECT LTRIM(my_varbinary_1000), my_varbinary_1000, id FROM t1_values -WHERE select_id = 185 OR select_id IS NULL; +WHERE select_id = 191 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ltrim(`t1_values`.`my_varbinary_1000`) AS `LTRIM(my_varbinary_1000)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 185 OR select_id IS NULL); +WHERE select_id = 191 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -351,13 +339,13 @@ CREATE VIEW v1 AS SELECT LTRIM(my_binary_30), my_binary_30, id FROM t1_values; SELECT LTRIM(my_binary_30), my_binary_30, id FROM t1_values -WHERE select_id = 184 OR select_id IS NULL; +WHERE select_id = 190 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ltrim(`t1_values`.`my_binary_30`) AS `LTRIM(my_binary_30)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 184 OR select_id IS NULL); +WHERE select_id = 190 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -365,13 +353,13 @@ CREATE VIEW v1 AS SELECT LTRIM(my_varchar_1000), my_varchar_1000, id FROM t1_values; SELECT LTRIM(my_varchar_1000), my_varchar_1000, id FROM t1_values -WHERE select_id = 183 OR select_id IS NULL; +WHERE select_id = 189 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ltrim(`t1_values`.`my_varchar_1000`) AS `LTRIM(my_varchar_1000)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 183 OR select_id IS NULL); +WHERE select_id = 189 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -379,13 +367,13 @@ CREATE VIEW v1 AS SELECT LTRIM(my_char_30), my_char_30, id FROM t1_values; SELECT LTRIM(my_char_30), my_char_30, id FROM t1_values -WHERE select_id = 182 OR select_id IS NULL; +WHERE select_id = 188 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ltrim(`t1_values`.`my_char_30`) AS `LTRIM(my_char_30)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 182 OR select_id IS NULL); +WHERE select_id = 188 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -393,13 +381,13 @@ CREATE VIEW v1 AS SELECT LOWER(my_varbinary_1000), my_varbinary_1000, id FROM t1_values; SELECT LOWER(my_varbinary_1000), my_varbinary_1000, id FROM t1_values -WHERE select_id = 181 OR select_id IS NULL; +WHERE select_id = 187 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select lcase(`t1_values`.`my_varbinary_1000`) AS `LOWER(my_varbinary_1000)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 181 OR select_id IS NULL); +WHERE select_id = 187 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -407,13 +395,13 @@ CREATE VIEW v1 AS SELECT LOWER(my_binary_30), my_binary_30, id FROM t1_values; SELECT LOWER(my_binary_30), my_binary_30, id FROM t1_values -WHERE select_id = 180 OR select_id IS NULL; +WHERE select_id = 186 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select lcase(`t1_values`.`my_binary_30`) AS `LOWER(my_binary_30)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 180 OR select_id IS NULL); +WHERE select_id = 186 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -421,13 +409,13 @@ CREATE VIEW v1 AS SELECT LOWER(my_varchar_1000), my_varchar_1000, id FROM t1_values; SELECT LOWER(my_varchar_1000), my_varchar_1000, id FROM t1_values -WHERE select_id = 179 OR select_id IS NULL; +WHERE select_id = 185 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select lcase(`t1_values`.`my_varchar_1000`) AS `LOWER(my_varchar_1000)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 179 OR select_id IS NULL); +WHERE select_id = 185 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -435,13 +423,13 @@ CREATE VIEW v1 AS SELECT LOWER(my_char_30), my_char_30, id FROM t1_values; SELECT LOWER(my_char_30), my_char_30, id FROM t1_values -WHERE select_id = 178 OR select_id IS NULL; +WHERE select_id = 184 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select lcase(`t1_values`.`my_char_30`) AS `LOWER(my_char_30)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 178 OR select_id IS NULL); +WHERE select_id = 184 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -449,13 +437,13 @@ CREATE VIEW v1 AS SELECT LOCATE('-', ' - -ABC', my_decimal), my_decimal, id FROM t1_values; SELECT LOCATE('-', ' - -ABC', my_decimal), my_decimal, id FROM t1_values -WHERE select_id = 177 OR select_id IS NULL; +WHERE select_id = 183 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'-',_latin1' - -ABC',`t1_values`.`my_decimal`) AS `LOCATE('-', ' - -ABC', my_decimal)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 177 OR select_id IS NULL); +WHERE select_id = 183 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -463,13 +451,13 @@ CREATE VIEW v1 AS SELECT LOCATE('-', ' - -ABC', my_double), my_double, id FROM t1_values; SELECT LOCATE('-', ' - -ABC', my_double), my_double, id FROM t1_values -WHERE select_id = 176 OR select_id IS NULL; +WHERE select_id = 182 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'-',_latin1' - -ABC',`t1_values`.`my_double`) AS `LOCATE('-', ' - -ABC', my_double)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 176 OR select_id IS NULL); +WHERE select_id = 182 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -477,13 +465,13 @@ CREATE VIEW v1 AS SELECT LOCATE('-', ' - -ABC', my_bigint), my_bigint, id FROM t1_values; SELECT LOCATE('-', ' - -ABC', my_bigint), my_bigint, id FROM t1_values -WHERE select_id = 175 OR select_id IS NULL; +WHERE select_id = 181 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'-',_latin1' - -ABC',`t1_values`.`my_bigint`) AS `LOCATE('-', ' - -ABC', my_bigint)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 175 OR select_id IS NULL); +WHERE select_id = 181 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -491,13 +479,13 @@ CREATE VIEW v1 AS SELECT LOCATE('-', my_varbinary_1000, 3), my_varbinary_1000, id FROM t1_values; SELECT LOCATE('-', my_varbinary_1000, 3), my_varbinary_1000, id FROM t1_values -WHERE select_id = 174 OR select_id IS NULL; +WHERE select_id = 180 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'-',`t1_values`.`my_varbinary_1000`,3) AS `LOCATE('-', my_varbinary_1000, 3)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 174 OR select_id IS NULL); +WHERE select_id = 180 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -505,13 +493,13 @@ CREATE VIEW v1 AS SELECT LOCATE('-', my_binary_30, 3), my_binary_30, id FROM t1_values; SELECT LOCATE('-', my_binary_30, 3), my_binary_30, id FROM t1_values -WHERE select_id = 173 OR select_id IS NULL; +WHERE select_id = 179 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'-',`t1_values`.`my_binary_30`,3) AS `LOCATE('-', my_binary_30, 3)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 173 OR select_id IS NULL); +WHERE select_id = 179 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -519,13 +507,13 @@ CREATE VIEW v1 AS SELECT LOCATE('-', my_varchar_1000, 3), my_varchar_1000, id FROM t1_values; SELECT LOCATE('-', my_varchar_1000, 3), my_varchar_1000, id FROM t1_values -WHERE select_id = 172 OR select_id IS NULL; +WHERE select_id = 178 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'-',`t1_values`.`my_varchar_1000`,3) AS `LOCATE('-', my_varchar_1000, 3)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 172 OR select_id IS NULL); +WHERE select_id = 178 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -533,13 +521,13 @@ CREATE VIEW v1 AS SELECT LOCATE('-', my_char_30, 3), my_char_30, id FROM t1_values; SELECT LOCATE('-', my_char_30, 3), my_char_30, id FROM t1_values -WHERE select_id = 171 OR select_id IS NULL; +WHERE select_id = 177 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'-',`t1_values`.`my_char_30`,3) AS `LOCATE('-', my_char_30, 3)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 171 OR select_id IS NULL); +WHERE select_id = 177 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -547,13 +535,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_varbinary_1000, my_binary_30 ), my_varbinary_1000, my_binary_30 id FROM t1_values; SELECT LOCATE(my_varbinary_1000, my_binary_30 ), my_varbinary_1000, my_binary_30 id FROM t1_values -WHERE select_id = 170 OR select_id IS NULL; +WHERE select_id = 176 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_varbinary_1000`,`t1_values`.`my_binary_30`) AS `LOCATE(my_varbinary_1000, my_binary_30 )`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`my_binary_30` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 170 OR select_id IS NULL); +WHERE select_id = 176 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -561,13 +549,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_varbinary_1000, my_varchar_1000 ), my_varbinary_1000, my_varchar_1000 id FROM t1_values; SELECT LOCATE(my_varbinary_1000, my_varchar_1000 ), my_varbinary_1000, my_varchar_1000 id FROM t1_values -WHERE select_id = 169 OR select_id IS NULL; +WHERE select_id = 175 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_varbinary_1000`,`t1_values`.`my_varchar_1000`) AS `LOCATE(my_varbinary_1000, my_varchar_1000 )`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`my_varchar_1000` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 169 OR select_id IS NULL); +WHERE select_id = 175 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -575,13 +563,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_varbinary_1000, my_char_30 ), my_varbinary_1000, my_char_30 id FROM t1_values; SELECT LOCATE(my_varbinary_1000, my_char_30 ), my_varbinary_1000, my_char_30 id FROM t1_values -WHERE select_id = 168 OR select_id IS NULL; +WHERE select_id = 174 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_varbinary_1000`,`t1_values`.`my_char_30`) AS `LOCATE(my_varbinary_1000, my_char_30 )`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`my_char_30` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 168 OR select_id IS NULL); +WHERE select_id = 174 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -589,13 +577,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_varbinary_1000, my_varbinary_1000 ), my_varbinary_1000, id FROM t1_values; SELECT LOCATE(my_varbinary_1000, my_varbinary_1000 ), my_varbinary_1000, id FROM t1_values -WHERE select_id = 167 OR select_id IS NULL; +WHERE select_id = 173 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_varbinary_1000`,`t1_values`.`my_varbinary_1000`) AS `LOCATE(my_varbinary_1000, my_varbinary_1000 )`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 167 OR select_id IS NULL); +WHERE select_id = 173 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -603,13 +591,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_binary_30, my_varbinary_1000 ), my_binary_30, my_varbinary_1000 id FROM t1_values; SELECT LOCATE(my_binary_30, my_varbinary_1000 ), my_binary_30, my_varbinary_1000 id FROM t1_values -WHERE select_id = 166 OR select_id IS NULL; +WHERE select_id = 172 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_binary_30`,`t1_values`.`my_varbinary_1000`) AS `LOCATE(my_binary_30, my_varbinary_1000 )`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`my_varbinary_1000` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 166 OR select_id IS NULL); +WHERE select_id = 172 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -617,13 +605,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_binary_30, my_varchar_1000 ), my_binary_30, my_varchar_1000 id FROM t1_values; SELECT LOCATE(my_binary_30, my_varchar_1000 ), my_binary_30, my_varchar_1000 id FROM t1_values -WHERE select_id = 165 OR select_id IS NULL; +WHERE select_id = 171 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_binary_30`,`t1_values`.`my_varchar_1000`) AS `LOCATE(my_binary_30, my_varchar_1000 )`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`my_varchar_1000` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 165 OR select_id IS NULL); +WHERE select_id = 171 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -631,13 +619,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_binary_30, my_char_30 ), my_binary_30, my_char_30 id FROM t1_values; SELECT LOCATE(my_binary_30, my_char_30 ), my_binary_30, my_char_30 id FROM t1_values -WHERE select_id = 164 OR select_id IS NULL; +WHERE select_id = 170 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_binary_30`,`t1_values`.`my_char_30`) AS `LOCATE(my_binary_30, my_char_30 )`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`my_char_30` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 164 OR select_id IS NULL); +WHERE select_id = 170 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -645,13 +633,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_binary_30, my_binary_30 ), my_binary_30, id FROM t1_values; SELECT LOCATE(my_binary_30, my_binary_30 ), my_binary_30, id FROM t1_values -WHERE select_id = 163 OR select_id IS NULL; +WHERE select_id = 169 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_binary_30`,`t1_values`.`my_binary_30`) AS `LOCATE(my_binary_30, my_binary_30 )`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 163 OR select_id IS NULL); +WHERE select_id = 169 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -659,13 +647,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_varchar_1000, my_varbinary_1000 ), my_varchar_1000, my_varbinary_1000 id FROM t1_values; SELECT LOCATE(my_varchar_1000, my_varbinary_1000 ), my_varchar_1000, my_varbinary_1000 id FROM t1_values -WHERE select_id = 162 OR select_id IS NULL; +WHERE select_id = 168 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_varchar_1000`,`t1_values`.`my_varbinary_1000`) AS `LOCATE(my_varchar_1000, my_varbinary_1000 )`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`my_varbinary_1000` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 162 OR select_id IS NULL); +WHERE select_id = 168 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -673,13 +661,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_varchar_1000, my_binary_30 ), my_varchar_1000, my_binary_30 id FROM t1_values; SELECT LOCATE(my_varchar_1000, my_binary_30 ), my_varchar_1000, my_binary_30 id FROM t1_values -WHERE select_id = 161 OR select_id IS NULL; +WHERE select_id = 167 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_varchar_1000`,`t1_values`.`my_binary_30`) AS `LOCATE(my_varchar_1000, my_binary_30 )`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`my_binary_30` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 161 OR select_id IS NULL); +WHERE select_id = 167 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -687,13 +675,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_varchar_1000, my_char_30 ), my_varchar_1000, my_char_30 id FROM t1_values; SELECT LOCATE(my_varchar_1000, my_char_30 ), my_varchar_1000, my_char_30 id FROM t1_values -WHERE select_id = 160 OR select_id IS NULL; +WHERE select_id = 166 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_varchar_1000`,`t1_values`.`my_char_30`) AS `LOCATE(my_varchar_1000, my_char_30 )`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`my_char_30` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 160 OR select_id IS NULL); +WHERE select_id = 166 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -701,13 +689,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_varchar_1000, my_varchar_1000 ), my_varchar_1000, id FROM t1_values; SELECT LOCATE(my_varchar_1000, my_varchar_1000 ), my_varchar_1000, id FROM t1_values -WHERE select_id = 159 OR select_id IS NULL; +WHERE select_id = 165 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_varchar_1000`,`t1_values`.`my_varchar_1000`) AS `LOCATE(my_varchar_1000, my_varchar_1000 )`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 159 OR select_id IS NULL); +WHERE select_id = 165 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -715,13 +703,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_char_30, my_varbinary_1000 ), my_char_30, my_varbinary_1000 id FROM t1_values; SELECT LOCATE(my_char_30, my_varbinary_1000 ), my_char_30, my_varbinary_1000 id FROM t1_values -WHERE select_id = 158 OR select_id IS NULL; +WHERE select_id = 164 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_char_30`,`t1_values`.`my_varbinary_1000`) AS `LOCATE(my_char_30, my_varbinary_1000 )`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`my_varbinary_1000` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 158 OR select_id IS NULL); +WHERE select_id = 164 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -729,13 +717,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_char_30, my_binary_30 ), my_char_30, my_binary_30 id FROM t1_values; SELECT LOCATE(my_char_30, my_binary_30 ), my_char_30, my_binary_30 id FROM t1_values -WHERE select_id = 157 OR select_id IS NULL; +WHERE select_id = 163 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_char_30`,`t1_values`.`my_binary_30`) AS `LOCATE(my_char_30, my_binary_30 )`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`my_binary_30` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 157 OR select_id IS NULL); +WHERE select_id = 163 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -743,13 +731,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_char_30, my_varchar_1000 ), my_char_30, my_varchar_1000 id FROM t1_values; SELECT LOCATE(my_char_30, my_varchar_1000 ), my_char_30, my_varchar_1000 id FROM t1_values -WHERE select_id = 156 OR select_id IS NULL; +WHERE select_id = 162 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_char_30`,`t1_values`.`my_varchar_1000`) AS `LOCATE(my_char_30, my_varchar_1000 )`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`my_varchar_1000` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 156 OR select_id IS NULL); +WHERE select_id = 162 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -757,13 +745,13 @@ CREATE VIEW v1 AS SELECT LOCATE(my_char_30, my_char_30 ), my_char_30, id FROM t1_values; SELECT LOCATE(my_char_30, my_char_30 ), my_char_30, id FROM t1_values -WHERE select_id = 155 OR select_id IS NULL; +WHERE select_id = 161 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(`t1_values`.`my_char_30`,`t1_values`.`my_char_30`) AS `LOCATE(my_char_30, my_char_30 )`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 155 OR select_id IS NULL); +WHERE select_id = 161 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -771,13 +759,13 @@ CREATE VIEW v1 AS SELECT LOCATE('char', my_varbinary_1000), my_varbinary_1000, id FROM t1_values; SELECT LOCATE('char', my_varbinary_1000), my_varbinary_1000, id FROM t1_values -WHERE select_id = 154 OR select_id IS NULL; +WHERE select_id = 160 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'char',`t1_values`.`my_varbinary_1000`) AS `LOCATE('char', my_varbinary_1000)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 154 OR select_id IS NULL); +WHERE select_id = 160 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -785,13 +773,13 @@ CREATE VIEW v1 AS SELECT LOCATE('char', my_binary_30), my_binary_30, id FROM t1_values; SELECT LOCATE('char', my_binary_30), my_binary_30, id FROM t1_values -WHERE select_id = 153 OR select_id IS NULL; +WHERE select_id = 159 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'char',`t1_values`.`my_binary_30`) AS `LOCATE('char', my_binary_30)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 153 OR select_id IS NULL); +WHERE select_id = 159 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -799,13 +787,13 @@ CREATE VIEW v1 AS SELECT LOCATE('char', my_varchar_1000), my_varchar_1000, id FROM t1_values; SELECT LOCATE('char', my_varchar_1000), my_varchar_1000, id FROM t1_values -WHERE select_id = 152 OR select_id IS NULL; +WHERE select_id = 158 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'char',`t1_values`.`my_varchar_1000`) AS `LOCATE('char', my_varchar_1000)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 152 OR select_id IS NULL); +WHERE select_id = 158 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -813,46 +801,50 @@ CREATE VIEW v1 AS SELECT LOCATE('char', my_char_30), my_char_30, id FROM t1_values; SELECT LOCATE('char', my_char_30), my_char_30, id FROM t1_values -WHERE select_id = 151 OR select_id IS NULL; +WHERE select_id = 157 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'char',`t1_values`.`my_char_30`) AS `LOCATE('char', my_char_30)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 151 OR select_id IS NULL); +WHERE select_id = 157 OR select_id IS NULL) order by id; DROP VIEW v1; -CREATE VIEW v1 AS SELECT LOAD_FILE('../log/current_test'), id FROM t1_values; -SELECT LOAD_FILE('../log/current_test'), id FROM t1_values -WHERE select_id = 150 OR select_id IS NULL; -LOAD_FILE('../log/current_test') id -CURRENT_TEST: myisam_func_view +CREATE VIEW v1 AS SELECT LOAD_FILE('<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/load_file.txt') + AS my_col, + id FROM t1_values; +SELECT LOAD_FILE('<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/load_file.txt') + AS my_col, + id FROM t1_values +WHERE select_id = 156 OR select_id IS NULL order by id; +my_col id +Here is content from load_file 1 -CURRENT_TEST: myisam_func_view +Here is content from load_file 2 -CURRENT_TEST: myisam_func_view +Here is content from load_file 3 -CURRENT_TEST: myisam_func_view +Here is content from load_file 4 -CURRENT_TEST: myisam_func_view +Here is content from load_file 5 SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select load_file(_latin1'../log/current_test') AS `LOAD_FILE('../log/current_test')`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select load_file(_latin1'<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/load_file.txt') AS `my_col`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 150 OR select_id IS NULL); -LOAD_FILE('../log/current_test') id -CURRENT_TEST: myisam_func_view +WHERE select_id = 156 OR select_id IS NULL) order by id; +my_col id +Here is content from load_file 1 -CURRENT_TEST: myisam_func_view +Here is content from load_file 2 -CURRENT_TEST: myisam_func_view +Here is content from load_file 3 -CURRENT_TEST: myisam_func_view +Here is content from load_file 4 -CURRENT_TEST: myisam_func_view +Here is content from load_file 5 DROP VIEW v1; @@ -861,13 +853,13 @@ CREATE VIEW v1 AS SELECT LENGTH(my_varbinary_1000), my_varbinary_1000, id FROM t1_values; SELECT LENGTH(my_varbinary_1000), my_varbinary_1000, id FROM t1_values -WHERE select_id = 149 OR select_id IS NULL; +WHERE select_id = 155 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select length(`t1_values`.`my_varbinary_1000`) AS `LENGTH(my_varbinary_1000)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 149 OR select_id IS NULL); +WHERE select_id = 155 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -875,13 +867,13 @@ CREATE VIEW v1 AS SELECT LENGTH(my_binary_30), my_binary_30, id FROM t1_values; SELECT LENGTH(my_binary_30), my_binary_30, id FROM t1_values -WHERE select_id = 148 OR select_id IS NULL; +WHERE select_id = 154 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select length(`t1_values`.`my_binary_30`) AS `LENGTH(my_binary_30)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 148 OR select_id IS NULL); +WHERE select_id = 154 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -889,13 +881,13 @@ CREATE VIEW v1 AS SELECT LENGTH(my_varchar_1000), my_varchar_1000, id FROM t1_values; SELECT LENGTH(my_varchar_1000), my_varchar_1000, id FROM t1_values -WHERE select_id = 147 OR select_id IS NULL; +WHERE select_id = 153 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select length(`t1_values`.`my_varchar_1000`) AS `LENGTH(my_varchar_1000)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 147 OR select_id IS NULL); +WHERE select_id = 153 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -903,19 +895,49 @@ CREATE VIEW v1 AS SELECT LENGTH(my_char_30), my_char_30, id FROM t1_values; SELECT LENGTH(my_char_30), my_char_30, id FROM t1_values -WHERE select_id = 146 OR select_id IS NULL; +WHERE select_id = 152 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select length(`t1_values`.`my_char_30`) AS `LENGTH(my_char_30)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 146 OR select_id IS NULL); +WHERE select_id = 152 OR select_id IS NULL) order by id; +DROP VIEW v1; + + +CREATE VIEW v1 AS SELECT LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_double), my_double, id FROM t1_values; +SELECT LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_double), my_double, id FROM t1_values +WHERE select_id = 151 OR select_id IS NULL order by id; +LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_double) my_double id +NULL NULL 1 + -1.7976931348623e+308 2 +AaBbCcDdEeFfGgHhIiJjÄäÜüÖö 1.7976931348623e+308 3 + 0 4 + -1 5 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '-1.7976931348623e+308' +Warning 1292 Truncated incorrect INTEGER value: '1.7976931348623e+308' +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select left(_latin1'AaBbCcDdEeFfGgHhIiJjÄäÜüÖö',`t1_values`.`my_double`) AS `LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_double)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` +SELECT v1.* FROM v1 +WHERE v1.id IN (SELECT id FROM t1_values +WHERE select_id = 151 OR select_id IS NULL) order by id; +LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_double) my_double id +NULL NULL 1 + -1.7976931348623e+308 2 +AaBbCcDdEeFfGgHhIiJjÄäÜüÖö 1.7976931348623e+308 3 + 0 4 + -1 5 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '-1.7976931348623e+308' +Warning 1292 Truncated incorrect INTEGER value: '1.7976931348623e+308' DROP VIEW v1; CREATE VIEW v1 AS SELECT LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_decimal), my_decimal, id FROM t1_values; SELECT LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_decimal), my_decimal, id FROM t1_values -WHERE select_id = 145 OR select_id IS NULL; +WHERE select_id = 150 OR select_id IS NULL order by id; LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_decimal) my_decimal id NULL NULL 1 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -930,7 +952,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select left(_latin1'AaBbCcDdEeFfGgHhIiJjÄäÜüÖö',`t1_values`.`my_decimal`) AS `LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_decimal)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 145 OR select_id IS NULL); +WHERE select_id = 150 OR select_id IS NULL) order by id; LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_decimal) my_decimal id NULL NULL 1 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -943,9 +965,33 @@ Error 1292 Truncated incorrect DECIMAL value: '' DROP VIEW v1; +CREATE VIEW v1 AS SELECT LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_bigint), my_bigint, id FROM t1_values; +SELECT LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_bigint), my_bigint, id FROM t1_values +WHERE select_id = 149 OR select_id IS NULL order by id; +LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_bigint) my_bigint id +NULL NULL 1 + -9223372036854775808 2 +AaBbCcDdEeFfGgHhIiJjÄäÜüÖö 9223372036854775807 3 + 0 4 + -1 5 +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select left(_latin1'AaBbCcDdEeFfGgHhIiJjÄäÜüÖö',`t1_values`.`my_bigint`) AS `LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_bigint)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` +SELECT v1.* FROM v1 +WHERE v1.id IN (SELECT id FROM t1_values +WHERE select_id = 149 OR select_id IS NULL) order by id; +LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_bigint) my_bigint id +NULL NULL 1 + -9223372036854775808 2 +AaBbCcDdEeFfGgHhIiJjÄäÜüÖö 9223372036854775807 3 + 0 4 + -1 5 +DROP VIEW v1; + + CREATE VIEW v1 AS SELECT LEFT(my_varbinary_1000, 2), my_varbinary_1000, id FROM t1_values; SELECT LEFT(my_varbinary_1000, 2), my_varbinary_1000, id FROM t1_values -WHERE select_id = 144 OR select_id IS NULL; +WHERE select_id = 148 OR select_id IS NULL order by id; LEFT(my_varbinary_1000, 2) my_varbinary_1000 id NULL NULL 1 2 @@ -957,7 +1003,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select left(`t1_values`.`my_varbinary_1000`,2) AS `LEFT(my_varbinary_1000, 2)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 144 OR select_id IS NULL); +WHERE select_id = 148 OR select_id IS NULL) order by id; LEFT(my_varbinary_1000, 2) my_varbinary_1000 id NULL NULL 1 2 @@ -969,19 +1015,19 @@ DROP VIEW v1; CREATE VIEW v1 AS SELECT LEFT(my_binary_30, 2), my_binary_30, id FROM t1_values; SELECT LEFT(my_binary_30, 2), my_binary_30, id FROM t1_values -WHERE select_id = 143 OR select_id IS NULL; +WHERE select_id = 147 OR select_id IS NULL order by id; LEFT(my_binary_30, 2) my_binary_30 id NULL NULL 1 - + 2 <- <--------30 characters-------> 3 - - ---äÖüß@µ*$-- --1 -1 + - ---äÖüß@µ*$-- 4 +-1 -1 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select left(`t1_values`.`my_binary_30`,2) AS `LEFT(my_binary_30, 2)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 143 OR select_id IS NULL); +WHERE select_id = 147 OR select_id IS NULL) order by id; LEFT(my_binary_30, 2) my_binary_30 id NULL NULL 1 @@ -993,7 +1039,7 @@ DROP VIEW v1; CREATE VIEW v1 AS SELECT LEFT(my_varchar_1000, 2), my_varchar_1000, id FROM t1_values; SELECT LEFT(my_varchar_1000, 2), my_varchar_1000, id FROM t1_values -WHERE select_id = 142 OR select_id IS NULL; +WHERE select_id = 146 OR select_id IS NULL order by id; LEFT(my_varchar_1000, 2) my_varchar_1000 id NULL NULL 1 2 @@ -1005,7 +1051,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select left(`t1_values`.`my_varchar_1000`,2) AS `LEFT(my_varchar_1000, 2)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 142 OR select_id IS NULL); +WHERE select_id = 146 OR select_id IS NULL) order by id; LEFT(my_varchar_1000, 2) my_varchar_1000 id NULL NULL 1 2 @@ -1017,7 +1063,7 @@ DROP VIEW v1; CREATE VIEW v1 AS SELECT LEFT(my_char_30, 2), my_char_30, id FROM t1_values; SELECT LEFT(my_char_30, 2), my_char_30, id FROM t1_values -WHERE select_id = 141 OR select_id IS NULL; +WHERE select_id = 145 OR select_id IS NULL order by id; LEFT(my_char_30, 2) my_char_30 id NULL NULL 1 2 @@ -1029,7 +1075,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select left(`t1_values`.`my_char_30`,2) AS `LEFT(my_char_30, 2)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 141 OR select_id IS NULL); +WHERE select_id = 145 OR select_id IS NULL) order by id; LEFT(my_char_30, 2) my_char_30 id NULL NULL 1 2 @@ -1043,13 +1089,13 @@ CREATE VIEW v1 AS SELECT LCASE(my_varchar_1000), my_varchar_1000, id FROM t1_values; SELECT LCASE(my_varchar_1000), my_varchar_1000, id FROM t1_values -WHERE select_id = 140 OR select_id IS NULL; +WHERE select_id = 144 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select lcase(`t1_values`.`my_varchar_1000`) AS `LCASE(my_varchar_1000)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 140 OR select_id IS NULL); +WHERE select_id = 144 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -1057,13 +1103,13 @@ CREATE VIEW v1 AS SELECT INSTR(my_char_30, 'char'), my_char_30, id FROM t1_values; SELECT INSTR(my_char_30, 'char'), my_char_30, id FROM t1_values -WHERE select_id = 139 OR select_id IS NULL; +WHERE select_id = 143 OR select_id IS NULL order by id; SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select locate(_latin1'char',`t1_values`.`my_char_30`) AS `INSTR(my_char_30, 'char')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 139 OR select_id IS NULL); +WHERE select_id = 143 OR select_id IS NULL) order by id; DROP VIEW v1; @@ -1071,7 +1117,7 @@ CREATE VIEW v1 AS SELECT BIT_LENGTH(my_varbinary_1000), my_varbinary_1000, id FROM t1_values; SELECT BIT_LENGTH(my_varbinary_1000), my_varbinary_1000, id FROM t1_values -WHERE select_id = 138 OR select_id IS NULL; +WHERE select_id = 142 OR select_id IS NULL order by id; BIT_LENGTH(my_varbinary_1000) my_varbinary_1000 id NULL NULL 1 0 2 @@ -1083,7 +1129,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select bit_length(`t1_values`.`my_varbinary_1000`) AS `BIT_LENGTH(my_varbinary_1000)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 138 OR select_id IS NULL); +WHERE select_id = 142 OR select_id IS NULL) order by id; BIT_LENGTH(my_varbinary_1000) my_varbinary_1000 id NULL NULL 1 0 2 @@ -1097,19 +1143,19 @@ CREATE VIEW v1 AS SELECT BIT_LENGTH(my_binary_30), my_binary_30, id FROM t1_values; SELECT BIT_LENGTH(my_binary_30), my_binary_30, id FROM t1_values -WHERE select_id = 137 OR select_id IS NULL; +WHERE select_id = 141 OR select_id IS NULL order by id; BIT_LENGTH(my_binary_30) my_binary_30 id NULL NULL 1 -240 +240 2 240 <--------30 characters-------> 3 -240 ---äÖüß@µ*$-- -240 -1 +240 ---äÖüß@µ*$-- 4 +240 -1 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select bit_length(`t1_values`.`my_binary_30`) AS `BIT_LENGTH(my_binary_30)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 137 OR select_id IS NULL); +WHERE select_id = 141 OR select_id IS NULL) order by id; BIT_LENGTH(my_binary_30) my_binary_30 id NULL NULL 1 240 @@ -1123,7 +1169,7 @@ CREATE VIEW v1 AS SELECT BIT_LENGTH(my_varchar_1000), my_varchar_1000, id FROM t1_values; SELECT BIT_LENGTH(my_varchar_1000), my_varchar_1000, id FROM t1_values -WHERE select_id = 136 OR select_id IS NULL; +WHERE select_id = 140 OR select_id IS NULL order by id; BIT_LENGTH(my_varchar_1000) my_varchar_1000 id NULL NULL 1 0 2 @@ -1135,7 +1181,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select bit_length(`t1_values`.`my_varchar_1000`) AS `BIT_LENGTH(my_varchar_1000)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 136 OR select_id IS NULL); +WHERE select_id = 140 OR select_id IS NULL) order by id; BIT_LENGTH(my_varchar_1000) my_varchar_1000 id NULL NULL 1 0 2 @@ -1149,7 +1195,7 @@ CREATE VIEW v1 AS SELECT BIT_LENGTH(my_char_30), my_char_30, id FROM t1_values; SELECT BIT_LENGTH(my_char_30), my_char_30, id FROM t1_values -WHERE select_id = 135 OR select_id IS NULL; +WHERE select_id = 139 OR select_id IS NULL order by id; BIT_LENGTH(my_char_30) my_char_30 id NULL NULL 1 0 2 @@ -1161,7 +1207,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select bit_length(`t1_values`.`my_char_30`) AS `BIT_LENGTH(my_char_30)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 135 OR select_id IS NULL); +WHERE select_id = 139 OR select_id IS NULL) order by id; BIT_LENGTH(my_char_30) my_char_30 id NULL NULL 1 0 2 @@ -1175,7 +1221,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_year,'IS_NULL'), my_year, id FROM t1_values; SELECT IFNULL(my_year,'IS_NULL'), my_year, id FROM t1_values -WHERE select_id = 134 OR select_id IS NULL; +WHERE select_id = 138 OR select_id IS NULL order by id; IFNULL(my_year,'IS_NULL') my_year id IS_NULL NULL 1 1901 1901 2 @@ -1187,7 +1233,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_year`,_latin1'IS_NULL') AS `IFNULL(my_year,'IS_NULL')`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 134 OR select_id IS NULL); +WHERE select_id = 138 OR select_id IS NULL) order by id; IFNULL(my_year,'IS_NULL') my_year id IS_NULL NULL 1 1901 1901 2 @@ -1201,7 +1247,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_time,'IS_NULL'), my_time, id FROM t1_values; SELECT IFNULL(my_time,'IS_NULL'), my_time, id FROM t1_values -WHERE select_id = 133 OR select_id IS NULL; +WHERE select_id = 137 OR select_id IS NULL order by id; IFNULL(my_time,'IS_NULL') my_time id IS_NULL NULL 1 -838:59:59 -838:59:59 2 @@ -1213,7 +1259,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_time`,_latin1'IS_NULL') AS `IFNULL(my_time,'IS_NULL')`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 133 OR select_id IS NULL); +WHERE select_id = 137 OR select_id IS NULL) order by id; IFNULL(my_time,'IS_NULL') my_time id IS_NULL NULL 1 -838:59:59 -838:59:59 2 @@ -1227,7 +1273,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_timestamp,'IS_NULL'), my_timestamp, id FROM t1_values; SELECT IFNULL(my_timestamp,'IS_NULL'), my_timestamp, id FROM t1_values -WHERE select_id = 132 OR select_id IS NULL; +WHERE select_id = 136 OR select_id IS NULL order by id; IFNULL(my_timestamp,'IS_NULL') my_timestamp id 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1970-01-01 03:00:01 1970-01-01 03:00:01 2 @@ -1239,7 +1285,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_timestamp`,_latin1'IS_NULL') AS `IFNULL(my_timestamp,'IS_NULL')`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 132 OR select_id IS NULL); +WHERE select_id = 136 OR select_id IS NULL) order by id; IFNULL(my_timestamp,'IS_NULL') my_timestamp id 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1970-01-01 03:00:01 1970-01-01 03:00:01 2 @@ -1253,7 +1299,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_date,'IS_NULL'), my_date, id FROM t1_values; SELECT IFNULL(my_date,'IS_NULL'), my_date, id FROM t1_values -WHERE select_id = 131 OR select_id IS NULL; +WHERE select_id = 135 OR select_id IS NULL order by id; IFNULL(my_date,'IS_NULL') my_date id IS_NULL NULL 1 0001-01-01 0001-01-01 2 @@ -1265,7 +1311,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_date`,_latin1'IS_NULL') AS `IFNULL(my_date,'IS_NULL')`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 131 OR select_id IS NULL); +WHERE select_id = 135 OR select_id IS NULL) order by id; IFNULL(my_date,'IS_NULL') my_date id IS_NULL NULL 1 0001-01-01 0001-01-01 2 @@ -1279,7 +1325,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_datetime,'IS_NULL'), my_datetime, id FROM t1_values; SELECT IFNULL(my_datetime,'IS_NULL'), my_datetime, id FROM t1_values -WHERE select_id = 130 OR select_id IS NULL; +WHERE select_id = 134 OR select_id IS NULL order by id; IFNULL(my_datetime,'IS_NULL') my_datetime id IS_NULL NULL 1 0001-01-01 00:00:00 0001-01-01 00:00:00 2 @@ -1291,7 +1337,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_datetime`,_latin1'IS_NULL') AS `IFNULL(my_datetime,'IS_NULL')`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 130 OR select_id IS NULL); +WHERE select_id = 134 OR select_id IS NULL) order by id; IFNULL(my_datetime,'IS_NULL') my_datetime id IS_NULL NULL 1 0001-01-01 00:00:00 0001-01-01 00:00:00 2 @@ -1305,7 +1351,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_double,'IS_NULL'), my_double, id FROM t1_values; SELECT IFNULL(my_double,'IS_NULL'), my_double, id FROM t1_values -WHERE select_id = 129 OR select_id IS NULL; +WHERE select_id = 133 OR select_id IS NULL order by id; IFNULL(my_double,'IS_NULL') my_double id IS_NULL NULL 1 -1.7976931348623e+308 -1.7976931348623e+308 2 @@ -1317,7 +1363,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_double`,_latin1'IS_NULL') AS `IFNULL(my_double,'IS_NULL')`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 129 OR select_id IS NULL); +WHERE select_id = 133 OR select_id IS NULL) order by id; IFNULL(my_double,'IS_NULL') my_double id IS_NULL NULL 1 -1.7976931348623e+308 -1.7976931348623e+308 2 @@ -1331,7 +1377,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_decimal,'IS_NULL'), my_decimal, id FROM t1_values; SELECT IFNULL(my_decimal,'IS_NULL'), my_decimal, id FROM t1_values -WHERE select_id = 128 OR select_id IS NULL; +WHERE select_id = 132 OR select_id IS NULL order by id; IFNULL(my_decimal,'IS_NULL') my_decimal id IS_NULL NULL 1 -9999999999999999999999999999999999.999999999999999999999999999999 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -1343,7 +1389,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_decimal`,_latin1'IS_NULL') AS `IFNULL(my_decimal,'IS_NULL')`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 128 OR select_id IS NULL); +WHERE select_id = 132 OR select_id IS NULL) order by id; IFNULL(my_decimal,'IS_NULL') my_decimal id IS_NULL NULL 1 -9999999999999999999999999999999999.999999999999999999999999999999 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -1357,7 +1403,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_bigint,'IS_NULL'), my_bigint, id FROM t1_values; SELECT IFNULL(my_bigint,'IS_NULL'), my_bigint, id FROM t1_values -WHERE select_id = 127 OR select_id IS NULL; +WHERE select_id = 131 OR select_id IS NULL order by id; IFNULL(my_bigint,'IS_NULL') my_bigint id IS_NULL NULL 1 -9223372036854775808 -9223372036854775808 2 @@ -1369,7 +1415,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_bigint`,_latin1'IS_NULL') AS `IFNULL(my_bigint,'IS_NULL')`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 127 OR select_id IS NULL); +WHERE select_id = 131 OR select_id IS NULL) order by id; IFNULL(my_bigint,'IS_NULL') my_bigint id IS_NULL NULL 1 -9223372036854775808 -9223372036854775808 2 @@ -1383,7 +1429,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_varbinary_1000,'IS_NULL'), my_varbinary_1000, id FROM t1_values; SELECT IFNULL(my_varbinary_1000,'IS_NULL'), my_varbinary_1000, id FROM t1_values -WHERE select_id = 126 OR select_id IS NULL; +WHERE select_id = 130 OR select_id IS NULL order by id; IFNULL(my_varbinary_1000,'IS_NULL') my_varbinary_1000 id IS_NULL NULL 1 2 @@ -1395,7 +1441,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_varbinary_1000`,_latin1'IS_NULL') AS `IFNULL(my_varbinary_1000,'IS_NULL')`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 126 OR select_id IS NULL); +WHERE select_id = 130 OR select_id IS NULL) order by id; IFNULL(my_varbinary_1000,'IS_NULL') my_varbinary_1000 id IS_NULL NULL 1 2 @@ -1409,19 +1455,19 @@ CREATE VIEW v1 AS SELECT IFNULL(my_binary_30,'IS_NULL'), my_binary_30, id FROM t1_values; SELECT IFNULL(my_binary_30,'IS_NULL'), my_binary_30, id FROM t1_values -WHERE select_id = 125 OR select_id IS NULL; +WHERE select_id = 129 OR select_id IS NULL order by id; IFNULL(my_binary_30,'IS_NULL') my_binary_30 id IS_NULL NULL 1 - + 2 <--------30 characters-------> <--------30 characters-------> 3 - ---äÖüß@µ*$-- --1 + ---äÖüß@µ*$-- ---äÖüß@µ*$-- 4 +-1 -1 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_binary_30`,_latin1'IS_NULL') AS `IFNULL(my_binary_30,'IS_NULL')`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 125 OR select_id IS NULL); +WHERE select_id = 129 OR select_id IS NULL) order by id; IFNULL(my_binary_30,'IS_NULL') my_binary_30 id IS_NULL NULL 1 @@ -1435,7 +1481,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_varchar_1000,'IS_NULL'), my_varchar_1000, id FROM t1_values; SELECT IFNULL(my_varchar_1000,'IS_NULL'), my_varchar_1000, id FROM t1_values -WHERE select_id = 124 OR select_id IS NULL; +WHERE select_id = 128 OR select_id IS NULL order by id; IFNULL(my_varchar_1000,'IS_NULL') my_varchar_1000 id IS_NULL NULL 1 2 @@ -1447,7 +1493,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_varchar_1000`,_latin1'IS_NULL') AS `IFNULL(my_varchar_1000,'IS_NULL')`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 124 OR select_id IS NULL); +WHERE select_id = 128 OR select_id IS NULL) order by id; IFNULL(my_varchar_1000,'IS_NULL') my_varchar_1000 id IS_NULL NULL 1 2 @@ -1461,7 +1507,7 @@ CREATE VIEW v1 AS SELECT IFNULL(my_char_30,'IS_NULL'), my_char_30, id FROM t1_values; SELECT IFNULL(my_char_30,'IS_NULL'), my_char_30, id FROM t1_values -WHERE select_id = 123 OR select_id IS NULL; +WHERE select_id = 127 OR select_id IS NULL order by id; IFNULL(my_char_30,'IS_NULL') my_char_30 id IS_NULL NULL 1 2 @@ -1473,7 +1519,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ifnull(`t1_values`.`my_char_30`,_latin1'IS_NULL') AS `IFNULL(my_char_30,'IS_NULL')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 123 OR select_id IS NULL); +WHERE select_id = 127 OR select_id IS NULL) order by id; IFNULL(my_char_30,'IS_NULL') my_char_30 id IS_NULL NULL 1 2 @@ -1487,7 +1533,7 @@ CREATE VIEW v1 AS SELECT IF(my_year IS NULL, 'IS NULL', 'IS NOT NULL'), my_year, id FROM t1_values; SELECT IF(my_year IS NULL, 'IS NULL', 'IS NOT NULL'), my_year, id FROM t1_values -WHERE select_id = 122 OR select_id IS NULL; +WHERE select_id = 126 OR select_id IS NULL order by id; IF(my_year IS NULL, 'IS NULL', 'IS NOT NULL') my_year id IS NULL NULL 1 @@ -1501,7 +1547,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 122 OR select_id IS NULL); +WHERE select_id = 126 OR select_id IS NULL) order by id; IF(my_year IS NULL, 'IS NULL', 'IS NOT NULL') my_year id IS NULL NULL 1 @@ -1516,7 +1562,7 @@ CREATE VIEW v1 AS SELECT IF(my_time IS NULL, 'IS NULL', 'IS NOT NULL'), my_time, id FROM t1_values; SELECT IF(my_time IS NULL, 'IS NULL', 'IS NOT NULL'), my_time, id FROM t1_values -WHERE select_id = 121 OR select_id IS NULL; +WHERE select_id = 125 OR select_id IS NULL order by id; IF(my_time IS NULL, 'IS NULL', 'IS NOT NULL') my_time id IS NULL NULL 1 @@ -1530,7 +1576,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 121 OR select_id IS NULL); +WHERE select_id = 125 OR select_id IS NULL) order by id; IF(my_time IS NULL, 'IS NULL', 'IS NOT NULL') my_time id IS NULL NULL 1 @@ -1545,7 +1591,7 @@ CREATE VIEW v1 AS SELECT IF(my_timestamp IS NULL, 'IS NULL', 'IS NOT NULL'), my_timestamp, id FROM t1_values; SELECT IF(my_timestamp IS NULL, 'IS NULL', 'IS NOT NULL'), my_timestamp, id FROM t1_values -WHERE select_id = 120 OR select_id IS NULL; +WHERE select_id = 124 OR select_id IS NULL order by id; IF(my_timestamp IS NULL, 'IS NULL', 'IS NOT NULL') my_timestamp id IS NOT NULL 0000-00-00 00:00:00 1 @@ -1559,7 +1605,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 120 OR select_id IS NULL); +WHERE select_id = 124 OR select_id IS NULL) order by id; IF(my_timestamp IS NULL, 'IS NULL', 'IS NOT NULL') my_timestamp id IS NOT NULL 0000-00-00 00:00:00 1 @@ -1574,7 +1620,7 @@ CREATE VIEW v1 AS SELECT IF(my_date IS NULL, 'IS NULL', 'IS NOT NULL'), my_date, id FROM t1_values; SELECT IF(my_date IS NULL, 'IS NULL', 'IS NOT NULL'), my_date, id FROM t1_values -WHERE select_id = 119 OR select_id IS NULL; +WHERE select_id = 123 OR select_id IS NULL order by id; IF(my_date IS NULL, 'IS NULL', 'IS NOT NULL') my_date id IS NULL NULL 1 @@ -1588,7 +1634,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 119 OR select_id IS NULL); +WHERE select_id = 123 OR select_id IS NULL) order by id; IF(my_date IS NULL, 'IS NULL', 'IS NOT NULL') my_date id IS NULL NULL 1 @@ -1603,7 +1649,7 @@ CREATE VIEW v1 AS SELECT IF(my_datetime IS NULL, 'IS NULL', 'IS NOT NULL'), my_datetime, id FROM t1_values; SELECT IF(my_datetime IS NULL, 'IS NULL', 'IS NOT NULL'), my_datetime, id FROM t1_values -WHERE select_id = 118 OR select_id IS NULL; +WHERE select_id = 122 OR select_id IS NULL order by id; IF(my_datetime IS NULL, 'IS NULL', 'IS NOT NULL') my_datetime id IS NULL NULL 1 @@ -1617,7 +1663,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 118 OR select_id IS NULL); +WHERE select_id = 122 OR select_id IS NULL) order by id; IF(my_datetime IS NULL, 'IS NULL', 'IS NOT NULL') my_datetime id IS NULL NULL 1 @@ -1632,7 +1678,7 @@ CREATE VIEW v1 AS SELECT IF(my_double IS NULL, 'IS NULL', 'IS NOT NULL'), my_double, id FROM t1_values; SELECT IF(my_double IS NULL, 'IS NULL', 'IS NOT NULL'), my_double, id FROM t1_values -WHERE select_id = 117 OR select_id IS NULL; +WHERE select_id = 121 OR select_id IS NULL order by id; IF(my_double IS NULL, 'IS NULL', 'IS NOT NULL') my_double id IS NULL NULL 1 @@ -1646,7 +1692,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 117 OR select_id IS NULL); +WHERE select_id = 121 OR select_id IS NULL) order by id; IF(my_double IS NULL, 'IS NULL', 'IS NOT NULL') my_double id IS NULL NULL 1 @@ -1661,7 +1707,7 @@ CREATE VIEW v1 AS SELECT IF(my_decimal IS NULL, 'IS NULL', 'IS NOT NULL'), my_decimal, id FROM t1_values; SELECT IF(my_decimal IS NULL, 'IS NULL', 'IS NOT NULL'), my_decimal, id FROM t1_values -WHERE select_id = 116 OR select_id IS NULL; +WHERE select_id = 120 OR select_id IS NULL order by id; IF(my_decimal IS NULL, 'IS NULL', 'IS NOT NULL') my_decimal id IS NULL NULL 1 @@ -1675,7 +1721,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 116 OR select_id IS NULL); +WHERE select_id = 120 OR select_id IS NULL) order by id; IF(my_decimal IS NULL, 'IS NULL', 'IS NOT NULL') my_decimal id IS NULL NULL 1 @@ -1690,7 +1736,7 @@ CREATE VIEW v1 AS SELECT IF(my_bigint IS NULL, 'IS NULL', 'IS NOT NULL'), my_bigint, id FROM t1_values; SELECT IF(my_bigint IS NULL, 'IS NULL', 'IS NOT NULL'), my_bigint, id FROM t1_values -WHERE select_id = 115 OR select_id IS NULL; +WHERE select_id = 119 OR select_id IS NULL order by id; IF(my_bigint IS NULL, 'IS NULL', 'IS NOT NULL') my_bigint id IS NULL NULL 1 @@ -1704,7 +1750,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 115 OR select_id IS NULL); +WHERE select_id = 119 OR select_id IS NULL) order by id; IF(my_bigint IS NULL, 'IS NULL', 'IS NOT NULL') my_bigint id IS NULL NULL 1 @@ -1719,7 +1765,7 @@ CREATE VIEW v1 AS SELECT IF(my_varbinary_1000 IS NULL, 'IS NULL', 'IS NOT NULL'), my_varbinary_1000, id FROM t1_values; SELECT IF(my_varbinary_1000 IS NULL, 'IS NULL', 'IS NOT NULL'), my_varbinary_1000, id FROM t1_values -WHERE select_id = 114 OR select_id IS NULL; +WHERE select_id = 118 OR select_id IS NULL order by id; IF(my_varbinary_1000 IS NULL, 'IS NULL', 'IS NOT NULL') my_varbinary_1000 id IS NULL NULL 1 @@ -1733,7 +1779,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 114 OR select_id IS NULL); +WHERE select_id = 118 OR select_id IS NULL) order by id; IF(my_varbinary_1000 IS NULL, 'IS NULL', 'IS NOT NULL') my_varbinary_1000 id IS NULL NULL 1 @@ -1748,21 +1794,21 @@ CREATE VIEW v1 AS SELECT IF(my_binary_30 IS NULL, 'IS NULL', 'IS NOT NULL'), my_binary_30, id FROM t1_values; SELECT IF(my_binary_30 IS NULL, 'IS NULL', 'IS NOT NULL'), my_binary_30, id FROM t1_values -WHERE select_id = 113 OR select_id IS NULL; +WHERE select_id = 117 OR select_id IS NULL order by id; IF(my_binary_30 IS NULL, 'IS NULL', 'IS NOT NULL') my_binary_30 id IS NULL NULL 1 -IS NOT NULL +IS NOT NULL 2 IS NOT NULL <--------30 characters-------> 3 -IS NOT NULL ---äÖüß@µ*$-- -IS NOT NULL -1 +IS NOT NULL ---äÖüß@µ*$-- 4 +IS NOT NULL -1 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(isnull(`t1_values`.`my_binary_30`),_latin1'IS NULL',_latin1'IS NOT NULL') AS `IF(my_binary_30 IS NULL, 'IS NULL', 'IS NOT NULL')`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 113 OR select_id IS NULL); +WHERE select_id = 117 OR select_id IS NULL) order by id; IF(my_binary_30 IS NULL, 'IS NULL', 'IS NOT NULL') my_binary_30 id IS NULL NULL 1 @@ -1777,7 +1823,7 @@ CREATE VIEW v1 AS SELECT IF(my_varchar_1000 IS NULL, 'IS NULL', 'IS NOT NULL'), my_varchar_1000, id FROM t1_values; SELECT IF(my_varchar_1000 IS NULL, 'IS NULL', 'IS NOT NULL'), my_varchar_1000, id FROM t1_values -WHERE select_id = 112 OR select_id IS NULL; +WHERE select_id = 116 OR select_id IS NULL order by id; IF(my_varchar_1000 IS NULL, 'IS NULL', 'IS NOT NULL') my_varchar_1000 id IS NULL NULL 1 @@ -1791,7 +1837,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 112 OR select_id IS NULL); +WHERE select_id = 116 OR select_id IS NULL) order by id; IF(my_varchar_1000 IS NULL, 'IS NULL', 'IS NOT NULL') my_varchar_1000 id IS NULL NULL 1 @@ -1806,7 +1852,7 @@ CREATE VIEW v1 AS SELECT IF(my_char_30 IS NULL, 'IS NULL', 'IS NOT NULL'), my_char_30, id FROM t1_values; SELECT IF(my_char_30 IS NULL, 'IS NULL', 'IS NOT NULL'), my_char_30, id FROM t1_values -WHERE select_id = 111 OR select_id IS NULL; +WHERE select_id = 115 OR select_id IS NULL order by id; IF(my_char_30 IS NULL, 'IS NULL', 'IS NOT NULL') my_char_30 id IS NULL NULL 1 @@ -1820,7 +1866,7 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI 'IS NOT NULL')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 111 OR select_id IS NULL); +WHERE select_id = 115 OR select_id IS NULL) order by id; IF(my_char_30 IS NULL, 'IS NULL', 'IS NOT NULL') my_char_30 id IS NULL NULL 1 @@ -1835,7 +1881,7 @@ CREATE VIEW v1 AS SELECT IF(my_year, 'IS TRUE', 'IS NOT TRUE'), my_year, id FROM t1_values; SELECT IF(my_year, 'IS TRUE', 'IS NOT TRUE'), my_year, id FROM t1_values -WHERE select_id = 110 OR select_id IS NULL; +WHERE select_id = 114 OR select_id IS NULL order by id; IF(my_year, 'IS TRUE', 'IS NOT TRUE') my_year id IS NOT TRUE NULL 1 IS TRUE 1901 2 @@ -1847,7 +1893,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_year`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_year, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 110 OR select_id IS NULL); +WHERE select_id = 114 OR select_id IS NULL) order by id; IF(my_year, 'IS TRUE', 'IS NOT TRUE') my_year id IS NOT TRUE NULL 1 IS TRUE 1901 2 @@ -1861,7 +1907,7 @@ CREATE VIEW v1 AS SELECT IF(my_time, 'IS TRUE', 'IS NOT TRUE'), my_time, id FROM t1_values; SELECT IF(my_time, 'IS TRUE', 'IS NOT TRUE'), my_time, id FROM t1_values -WHERE select_id = 109 OR select_id IS NULL; +WHERE select_id = 113 OR select_id IS NULL order by id; IF(my_time, 'IS TRUE', 'IS NOT TRUE') my_time id IS NOT TRUE NULL 1 IS TRUE -838:59:59 2 @@ -1873,7 +1919,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_time`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_time, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 109 OR select_id IS NULL); +WHERE select_id = 113 OR select_id IS NULL) order by id; IF(my_time, 'IS TRUE', 'IS NOT TRUE') my_time id IS NOT TRUE NULL 1 IS TRUE -838:59:59 2 @@ -1887,7 +1933,7 @@ CREATE VIEW v1 AS SELECT IF(my_timestamp, 'IS TRUE', 'IS NOT TRUE'), my_timestamp, id FROM t1_values; SELECT IF(my_timestamp, 'IS TRUE', 'IS NOT TRUE'), my_timestamp, id FROM t1_values -WHERE select_id = 108 OR select_id IS NULL; +WHERE select_id = 112 OR select_id IS NULL order by id; IF(my_timestamp, 'IS TRUE', 'IS NOT TRUE') my_timestamp id IS NOT TRUE 0000-00-00 00:00:00 1 IS TRUE 1970-01-01 03:00:01 2 @@ -1899,7 +1945,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_timestamp`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_timestamp, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 108 OR select_id IS NULL); +WHERE select_id = 112 OR select_id IS NULL) order by id; IF(my_timestamp, 'IS TRUE', 'IS NOT TRUE') my_timestamp id IS NOT TRUE 0000-00-00 00:00:00 1 IS TRUE 1970-01-01 03:00:01 2 @@ -1913,7 +1959,7 @@ CREATE VIEW v1 AS SELECT IF(my_date, 'IS TRUE', 'IS NOT TRUE'), my_date, id FROM t1_values; SELECT IF(my_date, 'IS TRUE', 'IS NOT TRUE'), my_date, id FROM t1_values -WHERE select_id = 107 OR select_id IS NULL; +WHERE select_id = 111 OR select_id IS NULL order by id; IF(my_date, 'IS TRUE', 'IS NOT TRUE') my_date id IS NOT TRUE NULL 1 IS TRUE 0001-01-01 2 @@ -1925,7 +1971,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_date`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_date, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 107 OR select_id IS NULL); +WHERE select_id = 111 OR select_id IS NULL) order by id; IF(my_date, 'IS TRUE', 'IS NOT TRUE') my_date id IS NOT TRUE NULL 1 IS TRUE 0001-01-01 2 @@ -1939,7 +1985,7 @@ CREATE VIEW v1 AS SELECT IF(my_datetime, 'IS TRUE', 'IS NOT TRUE'), my_datetime, id FROM t1_values; SELECT IF(my_datetime, 'IS TRUE', 'IS NOT TRUE'), my_datetime, id FROM t1_values -WHERE select_id = 106 OR select_id IS NULL; +WHERE select_id = 110 OR select_id IS NULL order by id; IF(my_datetime, 'IS TRUE', 'IS NOT TRUE') my_datetime id IS NOT TRUE NULL 1 IS TRUE 0001-01-01 00:00:00 2 @@ -1951,7 +1997,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_datetime`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_datetime, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 106 OR select_id IS NULL); +WHERE select_id = 110 OR select_id IS NULL) order by id; IF(my_datetime, 'IS TRUE', 'IS NOT TRUE') my_datetime id IS NOT TRUE NULL 1 IS TRUE 0001-01-01 00:00:00 2 @@ -1965,7 +2011,7 @@ CREATE VIEW v1 AS SELECT IF(my_double, 'IS TRUE', 'IS NOT TRUE'), my_double, id FROM t1_values; SELECT IF(my_double, 'IS TRUE', 'IS NOT TRUE'), my_double, id FROM t1_values -WHERE select_id = 105 OR select_id IS NULL; +WHERE select_id = 109 OR select_id IS NULL order by id; IF(my_double, 'IS TRUE', 'IS NOT TRUE') my_double id IS NOT TRUE NULL 1 IS TRUE -1.7976931348623e+308 2 @@ -1977,7 +2023,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_double`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_double, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 105 OR select_id IS NULL); +WHERE select_id = 109 OR select_id IS NULL) order by id; IF(my_double, 'IS TRUE', 'IS NOT TRUE') my_double id IS NOT TRUE NULL 1 IS TRUE -1.7976931348623e+308 2 @@ -1991,7 +2037,7 @@ CREATE VIEW v1 AS SELECT IF(my_decimal, 'IS TRUE', 'IS NOT TRUE'), my_decimal, id FROM t1_values; SELECT IF(my_decimal, 'IS TRUE', 'IS NOT TRUE'), my_decimal, id FROM t1_values -WHERE select_id = 104 OR select_id IS NULL; +WHERE select_id = 108 OR select_id IS NULL order by id; IF(my_decimal, 'IS TRUE', 'IS NOT TRUE') my_decimal id IS NOT TRUE NULL 1 IS TRUE -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -2003,7 +2049,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_decimal`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_decimal, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 104 OR select_id IS NULL); +WHERE select_id = 108 OR select_id IS NULL) order by id; IF(my_decimal, 'IS TRUE', 'IS NOT TRUE') my_decimal id IS NOT TRUE NULL 1 IS TRUE -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -2017,7 +2063,7 @@ CREATE VIEW v1 AS SELECT IF(my_bigint, 'IS TRUE', 'IS NOT TRUE'), my_bigint, id FROM t1_values; SELECT IF(my_bigint, 'IS TRUE', 'IS NOT TRUE'), my_bigint, id FROM t1_values -WHERE select_id = 103 OR select_id IS NULL; +WHERE select_id = 107 OR select_id IS NULL order by id; IF(my_bigint, 'IS TRUE', 'IS NOT TRUE') my_bigint id IS NOT TRUE NULL 1 IS TRUE -9223372036854775808 2 @@ -2029,7 +2075,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_bigint`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_bigint, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 103 OR select_id IS NULL); +WHERE select_id = 107 OR select_id IS NULL) order by id; IF(my_bigint, 'IS TRUE', 'IS NOT TRUE') my_bigint id IS NOT TRUE NULL 1 IS TRUE -9223372036854775808 2 @@ -2043,7 +2089,7 @@ CREATE VIEW v1 AS SELECT IF(my_varbinary_1000, 'IS TRUE', 'IS NOT TRUE'), my_varbinary_1000, id FROM t1_values; SELECT IF(my_varbinary_1000, 'IS TRUE', 'IS NOT TRUE'), my_varbinary_1000, id FROM t1_values -WHERE select_id = 102 OR select_id IS NULL; +WHERE select_id = 106 OR select_id IS NULL order by id; IF(my_varbinary_1000, 'IS TRUE', 'IS NOT TRUE') my_varbinary_1000 id IS NOT TRUE NULL 1 IS NOT TRUE 2 @@ -2055,7 +2101,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varbinary_1000`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_varbinary_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 102 OR select_id IS NULL); +WHERE select_id = 106 OR select_id IS NULL) order by id; IF(my_varbinary_1000, 'IS TRUE', 'IS NOT TRUE') my_varbinary_1000 id IS NOT TRUE NULL 1 IS NOT TRUE 2 @@ -2069,13 +2115,13 @@ CREATE VIEW v1 AS SELECT IF(my_binary_30, 'IS TRUE', 'IS NOT TRUE'), my_binary_30, id FROM t1_values; SELECT IF(my_binary_30, 'IS TRUE', 'IS NOT TRUE'), my_binary_30, id FROM t1_values -WHERE select_id = 101 OR select_id IS NULL; +WHERE select_id = 105 OR select_id IS NULL order by id; IF(my_binary_30, 'IS TRUE', 'IS NOT TRUE') my_binary_30 id IS NOT TRUE NULL 1 -IS NOT TRUE +IS NOT TRUE 2 IS NOT TRUE <--------30 characters-------> 3 -IS NOT TRUE ---äÖüß@µ*$-- -IS TRUE -1 +IS NOT TRUE ---äÖüß@µ*$-- 4 +IS TRUE -1 5 Warnings: Warning 1292 Truncated incorrect DOUBLE value: '' Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' @@ -2086,7 +2132,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_binary_30`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_binary_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 101 OR select_id IS NULL); +WHERE select_id = 105 OR select_id IS NULL) order by id; IF(my_binary_30, 'IS TRUE', 'IS NOT TRUE') my_binary_30 id IS NOT TRUE NULL 1 IS NOT TRUE @@ -2105,7 +2151,7 @@ CREATE VIEW v1 AS SELECT IF(my_varchar_1000, 'IS TRUE', 'IS NOT TRUE'), my_varchar_1000, id FROM t1_values; SELECT IF(my_varchar_1000, 'IS TRUE', 'IS NOT TRUE'), my_varchar_1000, id FROM t1_values -WHERE select_id = 100 OR select_id IS NULL; +WHERE select_id = 104 OR select_id IS NULL order by id; IF(my_varchar_1000, 'IS TRUE', 'IS NOT TRUE') my_varchar_1000 id IS NOT TRUE NULL 1 IS NOT TRUE 2 @@ -2117,7 +2163,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varchar_1000`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_varchar_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 100 OR select_id IS NULL); +WHERE select_id = 104 OR select_id IS NULL) order by id; IF(my_varchar_1000, 'IS TRUE', 'IS NOT TRUE') my_varchar_1000 id IS NOT TRUE NULL 1 IS NOT TRUE 2 @@ -2131,7 +2177,7 @@ CREATE VIEW v1 AS SELECT IF(my_char_30, 'IS TRUE', 'IS NOT TRUE'), my_char_30, id FROM t1_values; SELECT IF(my_char_30, 'IS TRUE', 'IS NOT TRUE'), my_char_30, id FROM t1_values -WHERE select_id = 99 OR select_id IS NULL; +WHERE select_id = 103 OR select_id IS NULL order by id; IF(my_char_30, 'IS TRUE', 'IS NOT TRUE') my_char_30 id IS NOT TRUE NULL 1 IS NOT TRUE 2 @@ -2146,7 +2192,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_char_30`,_latin1'IS TRUE',_latin1'IS NOT TRUE') AS `IF(my_char_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 99 OR select_id IS NULL); +WHERE select_id = 103 OR select_id IS NULL) order by id; IF(my_char_30, 'IS TRUE', 'IS NOT TRUE') my_char_30 id IS NOT TRUE NULL 1 IS NOT TRUE 2 @@ -2159,11 +2205,11 @@ Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' DROP VIEW v1; -CREATE VIEW v1 AS SELECT CONVERT(my_varbinary_1000 USING koi8r), +CREATE VIEW v1 AS SELECT CONVERT(my_varbinary_1000 USING koi8r), my_varbinary_1000, id FROM t1_values; -SELECT CONVERT(my_varbinary_1000 USING koi8r), +SELECT CONVERT(my_varbinary_1000 USING koi8r), my_varbinary_1000, id FROM t1_values -WHERE select_id = 98 OR select_id IS NULL; +WHERE select_id = 102 OR select_id IS NULL order by id; CONVERT(my_varbinary_1000 USING koi8r) my_varbinary_1000 id NULL NULL 1 2 @@ -2175,7 +2221,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select convert(`t1_values`.`my_varbinary_1000` using koi8r) AS `CONVERT(my_varbinary_1000 USING koi8r)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 98 OR select_id IS NULL); +WHERE select_id = 102 OR select_id IS NULL) order by id; CONVERT(my_varbinary_1000 USING koi8r) my_varbinary_1000 id NULL NULL 1 2 @@ -2185,23 +2231,23 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CONVERT(my_binary_30 USING koi8r), +CREATE VIEW v1 AS SELECT CONVERT(my_binary_30 USING koi8r), my_binary_30, id FROM t1_values; -SELECT CONVERT(my_binary_30 USING koi8r), +SELECT CONVERT(my_binary_30 USING koi8r), my_binary_30, id FROM t1_values -WHERE select_id = 97 OR select_id IS NULL; +WHERE select_id = 101 OR select_id IS NULL order by id; CONVERT(my_binary_30 USING koi8r) my_binary_30 id NULL NULL 1 - + 2 <--------30 characters-------> <--------30 characters-------> 3 - ---???????÷@??*$-- --1 + ---???????÷@??*$-- ---äÖüß@µ*$-- 4 +-1 -1 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select convert(`t1_values`.`my_binary_30` using koi8r) AS `CONVERT(my_binary_30 USING koi8r)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 97 OR select_id IS NULL); +WHERE select_id = 101 OR select_id IS NULL) order by id; CONVERT(my_binary_30 USING koi8r) my_binary_30 id NULL NULL 1 @@ -2211,11 +2257,11 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CONVERT(my_varchar_1000 USING koi8r), +CREATE VIEW v1 AS SELECT CONVERT(my_varchar_1000 USING koi8r), my_varchar_1000, id FROM t1_values; -SELECT CONVERT(my_varchar_1000 USING koi8r), +SELECT CONVERT(my_varchar_1000 USING koi8r), my_varchar_1000, id FROM t1_values -WHERE select_id = 96 OR select_id IS NULL; +WHERE select_id = 100 OR select_id IS NULL order by id; CONVERT(my_varchar_1000 USING koi8r) my_varchar_1000 id NULL NULL 1 2 @@ -2227,7 +2273,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select convert(`t1_values`.`my_varchar_1000` using koi8r) AS `CONVERT(my_varchar_1000 USING koi8r)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 96 OR select_id IS NULL); +WHERE select_id = 100 OR select_id IS NULL) order by id; CONVERT(my_varchar_1000 USING koi8r) my_varchar_1000 id NULL NULL 1 2 @@ -2237,11 +2283,11 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CONVERT(my_char_30 USING koi8r), +CREATE VIEW v1 AS SELECT CONVERT(my_char_30 USING koi8r), my_char_30, id FROM t1_values; -SELECT CONVERT(my_char_30 USING koi8r), +SELECT CONVERT(my_char_30 USING koi8r), my_char_30, id FROM t1_values -WHERE select_id = 95 OR select_id IS NULL; +WHERE select_id = 99 OR select_id IS NULL order by id; CONVERT(my_char_30 USING koi8r) my_char_30 id NULL NULL 1 2 @@ -2253,7 +2299,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select convert(`t1_values`.`my_char_30` using koi8r) AS `CONVERT(my_char_30 USING koi8r)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 95 OR select_id IS NULL); +WHERE select_id = 99 OR select_id IS NULL) order by id; CONVERT(my_char_30 USING koi8r) my_char_30 id NULL NULL 1 2 @@ -2263,11 +2309,11 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CONVERT(my_varbinary_1000 USING utf8), +CREATE VIEW v1 AS SELECT CONVERT(my_varbinary_1000 USING utf8), my_varbinary_1000, id FROM t1_values; -SELECT CONVERT(my_varbinary_1000 USING utf8), +SELECT CONVERT(my_varbinary_1000 USING utf8), my_varbinary_1000, id FROM t1_values -WHERE select_id = 94 OR select_id IS NULL; +WHERE select_id = 98 OR select_id IS NULL order by id; CONVERT(my_varbinary_1000 USING utf8) my_varbinary_1000 id NULL NULL 1 2 @@ -2279,7 +2325,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select convert(`t1_values`.`my_varbinary_1000` using utf8) AS `CONVERT(my_varbinary_1000 USING utf8)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 94 OR select_id IS NULL); +WHERE select_id = 98 OR select_id IS NULL) order by id; CONVERT(my_varbinary_1000 USING utf8) my_varbinary_1000 id NULL NULL 1 2 @@ -2289,23 +2335,23 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CONVERT(my_binary_30 USING utf8), +CREATE VIEW v1 AS SELECT CONVERT(my_binary_30 USING utf8), my_binary_30, id FROM t1_values; -SELECT CONVERT(my_binary_30 USING utf8), +SELECT CONVERT(my_binary_30 USING utf8), my_binary_30, id FROM t1_values -WHERE select_id = 93 OR select_id IS NULL; +WHERE select_id = 97 OR select_id IS NULL order by id; CONVERT(my_binary_30 USING utf8) my_binary_30 id NULL NULL 1 - + 2 <--------30 characters-------> <--------30 characters-------> 3 - ---äÖüß@µ*$-- --1 + ---äÖüß@µ*$-- ---äÖüß@µ*$-- 4 +-1 -1 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select convert(`t1_values`.`my_binary_30` using utf8) AS `CONVERT(my_binary_30 USING utf8)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 93 OR select_id IS NULL); +WHERE select_id = 97 OR select_id IS NULL) order by id; CONVERT(my_binary_30 USING utf8) my_binary_30 id NULL NULL 1 @@ -2315,11 +2361,11 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CONVERT(my_varchar_1000 USING utf8), +CREATE VIEW v1 AS SELECT CONVERT(my_varchar_1000 USING utf8), my_varchar_1000, id FROM t1_values; -SELECT CONVERT(my_varchar_1000 USING utf8), +SELECT CONVERT(my_varchar_1000 USING utf8), my_varchar_1000, id FROM t1_values -WHERE select_id = 92 OR select_id IS NULL; +WHERE select_id = 96 OR select_id IS NULL order by id; CONVERT(my_varchar_1000 USING utf8) my_varchar_1000 id NULL NULL 1 2 @@ -2331,7 +2377,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select convert(`t1_values`.`my_varchar_1000` using utf8) AS `CONVERT(my_varchar_1000 USING utf8)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 92 OR select_id IS NULL); +WHERE select_id = 96 OR select_id IS NULL) order by id; CONVERT(my_varchar_1000 USING utf8) my_varchar_1000 id NULL NULL 1 2 @@ -2341,11 +2387,11 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CONVERT(my_char_30 USING utf8), +CREATE VIEW v1 AS SELECT CONVERT(my_char_30 USING utf8), my_char_30, id FROM t1_values; -SELECT CONVERT(my_char_30 USING utf8), +SELECT CONVERT(my_char_30 USING utf8), my_char_30, id FROM t1_values -WHERE select_id = 91 OR select_id IS NULL; +WHERE select_id = 95 OR select_id IS NULL order by id; CONVERT(my_char_30 USING utf8) my_char_30 id NULL NULL 1 2 @@ -2357,7 +2403,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select convert(`t1_values`.`my_char_30` using utf8) AS `CONVERT(my_char_30 USING utf8)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 91 OR select_id IS NULL); +WHERE select_id = 95 OR select_id IS NULL) order by id; CONVERT(my_char_30 USING utf8) my_char_30 id NULL NULL 1 2 @@ -2371,7 +2417,7 @@ CREATE VIEW v1 AS SELECT CAST(my_year AS UNSIGNED INTEGER), my_year, id FROM t1_values; SELECT CAST(my_year AS UNSIGNED INTEGER), my_year, id FROM t1_values -WHERE select_id = 90 OR select_id IS NULL; +WHERE select_id = 94 OR select_id IS NULL order by id; CAST(my_year AS UNSIGNED INTEGER) my_year id NULL NULL 1 1901 1901 2 @@ -2383,7 +2429,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as unsigned) AS `CAST(my_year AS UNSIGNED INTEGER)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 90 OR select_id IS NULL); +WHERE select_id = 94 OR select_id IS NULL) order by id; CAST(my_year AS UNSIGNED INTEGER) my_year id NULL NULL 1 1901 1901 2 @@ -2397,7 +2443,7 @@ CREATE VIEW v1 AS SELECT CAST(my_time AS UNSIGNED INTEGER), my_time, id FROM t1_values; SELECT CAST(my_time AS UNSIGNED INTEGER), my_time, id FROM t1_values -WHERE select_id = 89 OR select_id IS NULL; +WHERE select_id = 93 OR select_id IS NULL order by id; CAST(my_time AS UNSIGNED INTEGER) my_time id NULL NULL 1 18446744073701165657 -838:59:59 2 @@ -2409,7 +2455,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as unsigned) AS `CAST(my_time AS UNSIGNED INTEGER)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 89 OR select_id IS NULL); +WHERE select_id = 93 OR select_id IS NULL) order by id; CAST(my_time AS UNSIGNED INTEGER) my_time id NULL NULL 1 18446744073701165657 -838:59:59 2 @@ -2423,7 +2469,7 @@ CREATE VIEW v1 AS SELECT CAST(my_timestamp AS UNSIGNED INTEGER), my_timestamp, id FROM t1_values; SELECT CAST(my_timestamp AS UNSIGNED INTEGER), my_timestamp, id FROM t1_values -WHERE select_id = 88 OR select_id IS NULL; +WHERE select_id = 92 OR select_id IS NULL order by id; CAST(my_timestamp AS UNSIGNED INTEGER) my_timestamp id 0 0000-00-00 00:00:00 1 19700101030001 1970-01-01 03:00:01 2 @@ -2435,7 +2481,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as unsigned) AS `CAST(my_timestamp AS UNSIGNED INTEGER)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 88 OR select_id IS NULL); +WHERE select_id = 92 OR select_id IS NULL) order by id; CAST(my_timestamp AS UNSIGNED INTEGER) my_timestamp id 0 0000-00-00 00:00:00 1 19700101030001 1970-01-01 03:00:01 2 @@ -2449,7 +2495,7 @@ CREATE VIEW v1 AS SELECT CAST(my_date AS UNSIGNED INTEGER), my_date, id FROM t1_values; SELECT CAST(my_date AS UNSIGNED INTEGER), my_date, id FROM t1_values -WHERE select_id = 87 OR select_id IS NULL; +WHERE select_id = 91 OR select_id IS NULL order by id; CAST(my_date AS UNSIGNED INTEGER) my_date id NULL NULL 1 10101 0001-01-01 2 @@ -2461,7 +2507,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as unsigned) AS `CAST(my_date AS UNSIGNED INTEGER)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 87 OR select_id IS NULL); +WHERE select_id = 91 OR select_id IS NULL) order by id; CAST(my_date AS UNSIGNED INTEGER) my_date id NULL NULL 1 10101 0001-01-01 2 @@ -2475,7 +2521,7 @@ CREATE VIEW v1 AS SELECT CAST(my_datetime AS UNSIGNED INTEGER), my_datetime, id FROM t1_values; SELECT CAST(my_datetime AS UNSIGNED INTEGER), my_datetime, id FROM t1_values -WHERE select_id = 86 OR select_id IS NULL; +WHERE select_id = 90 OR select_id IS NULL order by id; CAST(my_datetime AS UNSIGNED INTEGER) my_datetime id NULL NULL 1 10101000000 0001-01-01 00:00:00 2 @@ -2487,7 +2533,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as unsigned) AS `CAST(my_datetime AS UNSIGNED INTEGER)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 86 OR select_id IS NULL); +WHERE select_id = 90 OR select_id IS NULL) order by id; CAST(my_datetime AS UNSIGNED INTEGER) my_datetime id NULL NULL 1 10101000000 0001-01-01 00:00:00 2 @@ -2497,11 +2543,43 @@ NULL NULL 1 DROP VIEW v1; +CREATE VIEW v1 AS SELECT CAST(my_double AS UNSIGNED INTEGER), +my_double, id FROM t1_values; +SELECT CAST(my_double AS UNSIGNED INTEGER), +my_double, id FROM t1_values +WHERE select_id = 89 OR select_id IS NULL order by id; +CAST(my_double AS UNSIGNED INTEGER) my_double id +NULL NULL 1 +9223372036854775808 -1.7976931348623e+308 2 +9223372036854775807 1.7976931348623e+308 3 +0 0 4 +18446744073709551615 -1 5 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '-1.7976931348623e+308' +Warning 1292 Truncated incorrect INTEGER value: '1.7976931348623e+308' +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as unsigned) AS `CAST(my_double AS UNSIGNED INTEGER)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` +SELECT v1.* FROM v1 +WHERE v1.id IN (SELECT id FROM t1_values +WHERE select_id = 89 OR select_id IS NULL) order by id; +CAST(my_double AS UNSIGNED INTEGER) my_double id +NULL NULL 1 +9223372036854775808 -1.7976931348623e+308 2 +9223372036854775807 1.7976931348623e+308 3 +0 0 4 +18446744073709551615 -1 5 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '-1.7976931348623e+308' +Warning 1292 Truncated incorrect INTEGER value: '1.7976931348623e+308' +DROP VIEW v1; + + CREATE VIEW v1 AS SELECT CAST(my_decimal AS UNSIGNED INTEGER), my_decimal, id FROM t1_values; SELECT CAST(my_decimal AS UNSIGNED INTEGER), my_decimal, id FROM t1_values -WHERE select_id = 85 OR select_id IS NULL; +WHERE select_id = 88 OR select_id IS NULL order by id; CAST(my_decimal AS UNSIGNED INTEGER) my_decimal id NULL NULL 1 0 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -2517,7 +2595,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as unsigned) AS `CAST(my_decimal AS UNSIGNED INTEGER)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 85 OR select_id IS NULL); +WHERE select_id = 88 OR select_id IS NULL) order by id; CAST(my_decimal AS UNSIGNED INTEGER) my_decimal id NULL NULL 1 0 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -2535,7 +2613,7 @@ CREATE VIEW v1 AS SELECT CAST(my_bigint AS UNSIGNED INTEGER), my_bigint, id FROM t1_values; SELECT CAST(my_bigint AS UNSIGNED INTEGER), my_bigint, id FROM t1_values -WHERE select_id = 84 OR select_id IS NULL; +WHERE select_id = 87 OR select_id IS NULL order by id; CAST(my_bigint AS UNSIGNED INTEGER) my_bigint id NULL NULL 1 9223372036854775808 -9223372036854775808 2 @@ -2547,7 +2625,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as unsigned) AS `CAST(my_bigint AS UNSIGNED INTEGER)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 84 OR select_id IS NULL); +WHERE select_id = 87 OR select_id IS NULL) order by id; CAST(my_bigint AS UNSIGNED INTEGER) my_bigint id NULL NULL 1 9223372036854775808 -9223372036854775808 2 @@ -2561,7 +2639,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS UNSIGNED INTEGER), my_varbinary_1000, id FROM t1_values; SELECT CAST(my_varbinary_1000 AS UNSIGNED INTEGER), my_varbinary_1000, id FROM t1_values -WHERE select_id = 83 OR select_id IS NULL; +WHERE select_id = 86 OR select_id IS NULL order by id; CAST(my_varbinary_1000 AS UNSIGNED INTEGER) my_varbinary_1000 id NULL NULL 1 0 2 @@ -2578,7 +2656,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as unsigned) AS `CAST(my_varbinary_1000 AS UNSIGNED INTEGER)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 83 OR select_id IS NULL); +WHERE select_id = 86 OR select_id IS NULL) order by id; CAST(my_varbinary_1000 AS UNSIGNED INTEGER) my_varbinary_1000 id NULL NULL 1 0 2 @@ -2597,13 +2675,13 @@ CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS UNSIGNED INTEGER), my_binary_30, id FROM t1_values; SELECT CAST(my_binary_30 AS UNSIGNED INTEGER), my_binary_30, id FROM t1_values -WHERE select_id = 82 OR select_id IS NULL; +WHERE select_id = 85 OR select_id IS NULL order by id; CAST(my_binary_30 AS UNSIGNED INTEGER) my_binary_30 id NULL NULL 1 -0 +0 2 0 <--------30 characters-------> 3 -0 ---äÖüß@µ*$-- -18446744073709551615 -1 +0 ---äÖüß@µ*$-- 4 +18446744073709551615 -1 5 Warnings: Warning 1292 Truncated incorrect INTEGER value: '' Warning 1292 Truncated incorrect INTEGER value: '<--------30 characters------->' @@ -2615,7 +2693,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as unsigned) AS `CAST(my_binary_30 AS UNSIGNED INTEGER)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 82 OR select_id IS NULL); +WHERE select_id = 85 OR select_id IS NULL) order by id; CAST(my_binary_30 AS UNSIGNED INTEGER) my_binary_30 id NULL NULL 1 0 @@ -2635,7 +2713,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS UNSIGNED INTEGER), my_varchar_1000, id FROM t1_values; SELECT CAST(my_varchar_1000 AS UNSIGNED INTEGER), my_varchar_1000, id FROM t1_values -WHERE select_id = 81 OR select_id IS NULL; +WHERE select_id = 84 OR select_id IS NULL order by id; CAST(my_varchar_1000 AS UNSIGNED INTEGER) my_varchar_1000 id NULL NULL 1 0 2 @@ -2652,7 +2730,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as unsigned) AS `CAST(my_varchar_1000 AS UNSIGNED INTEGER)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 81 OR select_id IS NULL); +WHERE select_id = 84 OR select_id IS NULL) order by id; CAST(my_varchar_1000 AS UNSIGNED INTEGER) my_varchar_1000 id NULL NULL 1 0 2 @@ -2671,7 +2749,7 @@ CREATE VIEW v1 AS SELECT CAST(my_char_30 AS UNSIGNED INTEGER), my_char_30, id FROM t1_values; SELECT CAST(my_char_30 AS UNSIGNED INTEGER), my_char_30, id FROM t1_values -WHERE select_id = 80 OR select_id IS NULL; +WHERE select_id = 83 OR select_id IS NULL order by id; CAST(my_char_30 AS UNSIGNED INTEGER) my_char_30 id NULL NULL 1 0 2 @@ -2688,7 +2766,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as unsigned) AS `CAST(my_char_30 AS UNSIGNED INTEGER)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 80 OR select_id IS NULL); +WHERE select_id = 83 OR select_id IS NULL) order by id; CAST(my_char_30 AS UNSIGNED INTEGER) my_char_30 id NULL NULL 1 0 2 @@ -2707,7 +2785,7 @@ CREATE VIEW v1 AS SELECT CAST(my_year AS SIGNED INTEGER), my_year, id FROM t1_values; SELECT CAST(my_year AS SIGNED INTEGER), my_year, id FROM t1_values -WHERE select_id = 79 OR select_id IS NULL; +WHERE select_id = 82 OR select_id IS NULL order by id; CAST(my_year AS SIGNED INTEGER) my_year id NULL NULL 1 1901 1901 2 @@ -2719,7 +2797,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as signed) AS `CAST(my_year AS SIGNED INTEGER)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 79 OR select_id IS NULL); +WHERE select_id = 82 OR select_id IS NULL) order by id; CAST(my_year AS SIGNED INTEGER) my_year id NULL NULL 1 1901 1901 2 @@ -2733,7 +2811,7 @@ CREATE VIEW v1 AS SELECT CAST(my_time AS SIGNED INTEGER), my_time, id FROM t1_values; SELECT CAST(my_time AS SIGNED INTEGER), my_time, id FROM t1_values -WHERE select_id = 78 OR select_id IS NULL; +WHERE select_id = 81 OR select_id IS NULL order by id; CAST(my_time AS SIGNED INTEGER) my_time id NULL NULL 1 -8385959 -838:59:59 2 @@ -2745,7 +2823,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as signed) AS `CAST(my_time AS SIGNED INTEGER)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 78 OR select_id IS NULL); +WHERE select_id = 81 OR select_id IS NULL) order by id; CAST(my_time AS SIGNED INTEGER) my_time id NULL NULL 1 -8385959 -838:59:59 2 @@ -2759,7 +2837,7 @@ CREATE VIEW v1 AS SELECT CAST(my_timestamp AS SIGNED INTEGER), my_timestamp, id FROM t1_values; SELECT CAST(my_timestamp AS SIGNED INTEGER), my_timestamp, id FROM t1_values -WHERE select_id = 77 OR select_id IS NULL; +WHERE select_id = 80 OR select_id IS NULL order by id; CAST(my_timestamp AS SIGNED INTEGER) my_timestamp id 0 0000-00-00 00:00:00 1 19700101030001 1970-01-01 03:00:01 2 @@ -2771,7 +2849,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as signed) AS `CAST(my_timestamp AS SIGNED INTEGER)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 77 OR select_id IS NULL); +WHERE select_id = 80 OR select_id IS NULL) order by id; CAST(my_timestamp AS SIGNED INTEGER) my_timestamp id 0 0000-00-00 00:00:00 1 19700101030001 1970-01-01 03:00:01 2 @@ -2785,7 +2863,7 @@ CREATE VIEW v1 AS SELECT CAST(my_date AS SIGNED INTEGER), my_date, id FROM t1_values; SELECT CAST(my_date AS SIGNED INTEGER), my_date, id FROM t1_values -WHERE select_id = 76 OR select_id IS NULL; +WHERE select_id = 79 OR select_id IS NULL order by id; CAST(my_date AS SIGNED INTEGER) my_date id NULL NULL 1 10101 0001-01-01 2 @@ -2797,7 +2875,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as signed) AS `CAST(my_date AS SIGNED INTEGER)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 76 OR select_id IS NULL); +WHERE select_id = 79 OR select_id IS NULL) order by id; CAST(my_date AS SIGNED INTEGER) my_date id NULL NULL 1 10101 0001-01-01 2 @@ -2811,7 +2889,7 @@ CREATE VIEW v1 AS SELECT CAST(my_datetime AS SIGNED INTEGER), my_datetime, id FROM t1_values; SELECT CAST(my_datetime AS SIGNED INTEGER), my_datetime, id FROM t1_values -WHERE select_id = 75 OR select_id IS NULL; +WHERE select_id = 78 OR select_id IS NULL order by id; CAST(my_datetime AS SIGNED INTEGER) my_datetime id NULL NULL 1 10101000000 0001-01-01 00:00:00 2 @@ -2823,7 +2901,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as signed) AS `CAST(my_datetime AS SIGNED INTEGER)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 75 OR select_id IS NULL); +WHERE select_id = 78 OR select_id IS NULL) order by id; CAST(my_datetime AS SIGNED INTEGER) my_datetime id NULL NULL 1 10101000000 0001-01-01 00:00:00 2 @@ -2833,11 +2911,43 @@ NULL NULL 1 DROP VIEW v1; +CREATE VIEW v1 AS SELECT CAST(my_double AS SIGNED INTEGER), +my_double, id FROM t1_values; +SELECT CAST(my_double AS SIGNED INTEGER), +my_double, id FROM t1_values +WHERE select_id = 77 OR select_id IS NULL order by id; +CAST(my_double AS SIGNED INTEGER) my_double id +NULL NULL 1 +-9223372036854775808 -1.7976931348623e+308 2 +9223372036854775807 1.7976931348623e+308 3 +0 0 4 +-1 -1 5 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '-1.7976931348623e+308' +Warning 1292 Truncated incorrect INTEGER value: '1.7976931348623e+308' +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as signed) AS `CAST(my_double AS SIGNED INTEGER)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` +SELECT v1.* FROM v1 +WHERE v1.id IN (SELECT id FROM t1_values +WHERE select_id = 77 OR select_id IS NULL) order by id; +CAST(my_double AS SIGNED INTEGER) my_double id +NULL NULL 1 +-9223372036854775808 -1.7976931348623e+308 2 +9223372036854775807 1.7976931348623e+308 3 +0 0 4 +-1 -1 5 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '-1.7976931348623e+308' +Warning 1292 Truncated incorrect INTEGER value: '1.7976931348623e+308' +DROP VIEW v1; + + CREATE VIEW v1 AS SELECT CAST(my_decimal AS SIGNED INTEGER), my_decimal, id FROM t1_values; SELECT CAST(my_decimal AS SIGNED INTEGER), my_decimal, id FROM t1_values -WHERE select_id = 74 OR select_id IS NULL; +WHERE select_id = 76 OR select_id IS NULL order by id; CAST(my_decimal AS SIGNED INTEGER) my_decimal id NULL NULL 1 -9223372036854775808 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -2852,7 +2962,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as signed) AS `CAST(my_decimal AS SIGNED INTEGER)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 74 OR select_id IS NULL); +WHERE select_id = 76 OR select_id IS NULL) order by id; CAST(my_decimal AS SIGNED INTEGER) my_decimal id NULL NULL 1 -9223372036854775808 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -2869,7 +2979,7 @@ CREATE VIEW v1 AS SELECT CAST(my_bigint AS SIGNED INTEGER), my_bigint, id FROM t1_values; SELECT CAST(my_bigint AS SIGNED INTEGER), my_bigint, id FROM t1_values -WHERE select_id = 73 OR select_id IS NULL; +WHERE select_id = 75 OR select_id IS NULL order by id; CAST(my_bigint AS SIGNED INTEGER) my_bigint id NULL NULL 1 -9223372036854775808 -9223372036854775808 2 @@ -2881,7 +2991,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as signed) AS `CAST(my_bigint AS SIGNED INTEGER)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 73 OR select_id IS NULL); +WHERE select_id = 75 OR select_id IS NULL) order by id; CAST(my_bigint AS SIGNED INTEGER) my_bigint id NULL NULL 1 -9223372036854775808 -9223372036854775808 2 @@ -2895,7 +3005,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS SIGNED INTEGER), my_varbinary_1000, id FROM t1_values; SELECT CAST(my_varbinary_1000 AS SIGNED INTEGER), my_varbinary_1000, id FROM t1_values -WHERE select_id = 72 OR select_id IS NULL; +WHERE select_id = 74 OR select_id IS NULL order by id; CAST(my_varbinary_1000 AS SIGNED INTEGER) my_varbinary_1000 id NULL NULL 1 0 2 @@ -2911,7 +3021,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as signed) AS `CAST(my_varbinary_1000 AS SIGNED INTEGER)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 72 OR select_id IS NULL); +WHERE select_id = 74 OR select_id IS NULL) order by id; CAST(my_varbinary_1000 AS SIGNED INTEGER) my_varbinary_1000 id NULL NULL 1 0 2 @@ -2929,13 +3039,13 @@ CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS SIGNED INTEGER), my_binary_30, id FROM t1_values; SELECT CAST(my_binary_30 AS SIGNED INTEGER), my_binary_30, id FROM t1_values -WHERE select_id = 71 OR select_id IS NULL; +WHERE select_id = 73 OR select_id IS NULL order by id; CAST(my_binary_30 AS SIGNED INTEGER) my_binary_30 id NULL NULL 1 -0 +0 2 0 <--------30 characters-------> 3 -0 ---äÖüß@µ*$-- --1 -1 +0 ---äÖüß@µ*$-- 4 +-1 -1 5 Warnings: Warning 1292 Truncated incorrect INTEGER value: '' Warning 1292 Truncated incorrect INTEGER value: '<--------30 characters------->' @@ -2946,7 +3056,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as signed) AS `CAST(my_binary_30 AS SIGNED INTEGER)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 71 OR select_id IS NULL); +WHERE select_id = 73 OR select_id IS NULL) order by id; CAST(my_binary_30 AS SIGNED INTEGER) my_binary_30 id NULL NULL 1 0 @@ -2965,7 +3075,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS SIGNED INTEGER), my_varchar_1000, id FROM t1_values; SELECT CAST(my_varchar_1000 AS SIGNED INTEGER), my_varchar_1000, id FROM t1_values -WHERE select_id = 70 OR select_id IS NULL; +WHERE select_id = 72 OR select_id IS NULL order by id; CAST(my_varchar_1000 AS SIGNED INTEGER) my_varchar_1000 id NULL NULL 1 0 2 @@ -2981,7 +3091,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as signed) AS `CAST(my_varchar_1000 AS SIGNED INTEGER)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 70 OR select_id IS NULL); +WHERE select_id = 72 OR select_id IS NULL) order by id; CAST(my_varchar_1000 AS SIGNED INTEGER) my_varchar_1000 id NULL NULL 1 0 2 @@ -2999,7 +3109,7 @@ CREATE VIEW v1 AS SELECT CAST(my_char_30 AS SIGNED INTEGER), my_char_30, id FROM t1_values; SELECT CAST(my_char_30 AS SIGNED INTEGER), my_char_30, id FROM t1_values -WHERE select_id = 69 OR select_id IS NULL; +WHERE select_id = 71 OR select_id IS NULL order by id; CAST(my_char_30 AS SIGNED INTEGER) my_char_30 id NULL NULL 1 0 2 @@ -3015,7 +3125,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as signed) AS `CAST(my_char_30 AS SIGNED INTEGER)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 69 OR select_id IS NULL); +WHERE select_id = 71 OR select_id IS NULL) order by id; CAST(my_char_30 AS SIGNED INTEGER) my_char_30 id NULL NULL 1 0 2 @@ -3033,7 +3143,7 @@ CREATE VIEW v1 AS SELECT CAST(my_year AS DECIMAL(37,2)), my_year, id FROM t1_values; SELECT CAST(my_year AS DECIMAL(37,2)), my_year, id FROM t1_values -WHERE select_id = 68 OR select_id IS NULL; +WHERE select_id = 70 OR select_id IS NULL order by id; CAST(my_year AS DECIMAL(37,2)) my_year id NULL NULL 1 1901.00 1901 2 @@ -3045,7 +3155,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as decimal(37,2)) AS `CAST(my_year AS DECIMAL(37,2))`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 68 OR select_id IS NULL); +WHERE select_id = 70 OR select_id IS NULL) order by id; CAST(my_year AS DECIMAL(37,2)) my_year id NULL NULL 1 1901.00 1901 2 @@ -3059,7 +3169,7 @@ CREATE VIEW v1 AS SELECT CAST(my_time AS DECIMAL(37,2)), my_time, id FROM t1_values; SELECT CAST(my_time AS DECIMAL(37,2)), my_time, id FROM t1_values -WHERE select_id = 67 OR select_id IS NULL; +WHERE select_id = 69 OR select_id IS NULL order by id; CAST(my_time AS DECIMAL(37,2)) my_time id NULL NULL 1 -8385959.00 -838:59:59 2 @@ -3071,7 +3181,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as decimal(37,2)) AS `CAST(my_time AS DECIMAL(37,2))`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 67 OR select_id IS NULL); +WHERE select_id = 69 OR select_id IS NULL) order by id; CAST(my_time AS DECIMAL(37,2)) my_time id NULL NULL 1 -8385959.00 -838:59:59 2 @@ -3085,7 +3195,7 @@ CREATE VIEW v1 AS SELECT CAST(my_timestamp AS DECIMAL(37,2)), my_timestamp, id FROM t1_values; SELECT CAST(my_timestamp AS DECIMAL(37,2)), my_timestamp, id FROM t1_values -WHERE select_id = 66 OR select_id IS NULL; +WHERE select_id = 68 OR select_id IS NULL order by id; CAST(my_timestamp AS DECIMAL(37,2)) my_timestamp id 0.00 0000-00-00 00:00:00 1 19700101030001.00 1970-01-01 03:00:01 2 @@ -3097,7 +3207,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as decimal(37,2)) AS `CAST(my_timestamp AS DECIMAL(37,2))`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 66 OR select_id IS NULL); +WHERE select_id = 68 OR select_id IS NULL) order by id; CAST(my_timestamp AS DECIMAL(37,2)) my_timestamp id 0.00 0000-00-00 00:00:00 1 19700101030001.00 1970-01-01 03:00:01 2 @@ -3111,7 +3221,7 @@ CREATE VIEW v1 AS SELECT CAST(my_date AS DECIMAL(37,2)), my_date, id FROM t1_values; SELECT CAST(my_date AS DECIMAL(37,2)), my_date, id FROM t1_values -WHERE select_id = 65 OR select_id IS NULL; +WHERE select_id = 67 OR select_id IS NULL order by id; CAST(my_date AS DECIMAL(37,2)) my_date id NULL NULL 1 10101.00 0001-01-01 2 @@ -3123,7 +3233,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as decimal(37,2)) AS `CAST(my_date AS DECIMAL(37,2))`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 65 OR select_id IS NULL); +WHERE select_id = 67 OR select_id IS NULL) order by id; CAST(my_date AS DECIMAL(37,2)) my_date id NULL NULL 1 10101.00 0001-01-01 2 @@ -3137,7 +3247,7 @@ CREATE VIEW v1 AS SELECT CAST(my_datetime AS DECIMAL(37,2)), my_datetime, id FROM t1_values; SELECT CAST(my_datetime AS DECIMAL(37,2)), my_datetime, id FROM t1_values -WHERE select_id = 64 OR select_id IS NULL; +WHERE select_id = 66 OR select_id IS NULL order by id; CAST(my_datetime AS DECIMAL(37,2)) my_datetime id NULL NULL 1 10101000000.00 0001-01-01 00:00:00 2 @@ -3149,7 +3259,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as decimal(37,2)) AS `CAST(my_datetime AS DECIMAL(37,2))`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 64 OR select_id IS NULL); +WHERE select_id = 66 OR select_id IS NULL) order by id; CAST(my_datetime AS DECIMAL(37,2)) my_datetime id NULL NULL 1 10101000000.00 0001-01-01 00:00:00 2 @@ -3159,11 +3269,49 @@ NULL NULL 1 DROP VIEW v1; +CREATE VIEW v1 AS SELECT CAST(my_double AS DECIMAL(37,2)), +my_double, id FROM t1_values; +SELECT CAST(my_double AS DECIMAL(37,2)), +my_double, id FROM t1_values +WHERE select_id = 65 OR select_id IS NULL order by id; +CAST(my_double AS DECIMAL(37,2)) my_double id +NULL NULL 1 +-99999999999999999999999999999999999.99 -1.7976931348623e+308 2 +99999999999999999999999999999999999.99 1.7976931348623e+308 3 +0.00 0 4 +-1.00 -1 5 +-3333.33 -3333.3333 30 +Warnings: +Error 1292 Truncated incorrect DECIMAL value: '' +Error 1264 Out of range value adjusted for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 +Error 1292 Truncated incorrect DECIMAL value: '' +Error 1264 Out of range value adjusted for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as decimal(37,2)) AS `CAST(my_double AS DECIMAL(37,2))`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` +SELECT v1.* FROM v1 +WHERE v1.id IN (SELECT id FROM t1_values +WHERE select_id = 65 OR select_id IS NULL) order by id; +CAST(my_double AS DECIMAL(37,2)) my_double id +NULL NULL 1 +-99999999999999999999999999999999999.99 -1.7976931348623e+308 2 +99999999999999999999999999999999999.99 1.7976931348623e+308 3 +0.00 0 4 +-1.00 -1 5 +-3333.33 -3333.3333 30 +Warnings: +Error 1292 Truncated incorrect DECIMAL value: '' +Error 1264 Out of range value adjusted for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 +Error 1292 Truncated incorrect DECIMAL value: '' +Error 1264 Out of range value adjusted for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 +DROP VIEW v1; + + CREATE VIEW v1 AS SELECT CAST(my_decimal AS DECIMAL(37,2)), my_decimal, id FROM t1_values; SELECT CAST(my_decimal AS DECIMAL(37,2)), my_decimal, id FROM t1_values -WHERE select_id = 63 OR select_id IS NULL; +WHERE select_id = 64 OR select_id IS NULL order by id; CAST(my_decimal AS DECIMAL(37,2)) my_decimal id NULL NULL 1 -10000000000000000000000000000000000.00 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -3175,7 +3323,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as decimal(37,2)) AS `CAST(my_decimal AS DECIMAL(37,2))`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 63 OR select_id IS NULL); +WHERE select_id = 64 OR select_id IS NULL) order by id; CAST(my_decimal AS DECIMAL(37,2)) my_decimal id NULL NULL 1 -10000000000000000000000000000000000.00 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -3189,7 +3337,7 @@ CREATE VIEW v1 AS SELECT CAST(my_bigint AS DECIMAL(37,2)), my_bigint, id FROM t1_values; SELECT CAST(my_bigint AS DECIMAL(37,2)), my_bigint, id FROM t1_values -WHERE select_id = 62 OR select_id IS NULL; +WHERE select_id = 63 OR select_id IS NULL order by id; CAST(my_bigint AS DECIMAL(37,2)) my_bigint id NULL NULL 1 -9223372036854775808.00 -9223372036854775808 2 @@ -3201,7 +3349,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as decimal(37,2)) AS `CAST(my_bigint AS DECIMAL(37,2))`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 62 OR select_id IS NULL); +WHERE select_id = 63 OR select_id IS NULL) order by id; CAST(my_bigint AS DECIMAL(37,2)) my_bigint id NULL NULL 1 -9223372036854775808.00 -9223372036854775808 2 @@ -3215,14 +3363,14 @@ CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS DECIMAL(37,2)), my_varbinary_1000, id FROM t1_values; SELECT CAST(my_varbinary_1000 AS DECIMAL(37,2)), my_varbinary_1000, id FROM t1_values -WHERE select_id = 61 OR select_id IS NULL; +WHERE select_id = 62 OR select_id IS NULL order by id; CAST(my_varbinary_1000 AS DECIMAL(37,2)) my_varbinary_1000 id NULL NULL 1 0.00 2 0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 0.00 ---äÖüß@µ*$-- 4 -1.00 -1 5 --3333.33 -3333.3333 28 +-3333.33 -3333.3333 29 Warnings: Error 1366 Incorrect decimal value: '' for column '' at row -1 Error 1366 Incorrect decimal value: '' for column '' at row -1 @@ -3232,14 +3380,14 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 61 OR select_id IS NULL); +WHERE select_id = 62 OR select_id IS NULL) order by id; CAST(my_varbinary_1000 AS DECIMAL(37,2)) my_varbinary_1000 id NULL NULL 1 0.00 2 0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 0.00 ---äÖüß@µ*$-- 4 -1.00 -1 5 --3333.33 -3333.3333 28 +-3333.33 -3333.3333 29 Warnings: Error 1366 Incorrect decimal value: '' for column '' at row -1 Error 1366 Incorrect decimal value: '' for column '' at row -1 @@ -3251,14 +3399,14 @@ CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS DECIMAL(37,2)), my_binary_30, id FROM t1_values; SELECT CAST(my_binary_30 AS DECIMAL(37,2)), my_binary_30, id FROM t1_values -WHERE select_id = 60 OR select_id IS NULL; +WHERE select_id = 61 OR select_id IS NULL order by id; CAST(my_binary_30 AS DECIMAL(37,2)) my_binary_30 id NULL NULL 1 -0.00 +0.00 2 0.00 <--------30 characters-------> 3 -0.00 ---äÖüß@µ*$-- --1.00 -1 --3333.33 -3333.3333 +0.00 ---äÖüß@µ*$-- 4 +-1.00 -1 5 +-3333.33 -3333.3333 28 Warnings: Error 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: '' @@ -3273,14 +3421,14 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as decimal(37,2)) AS `CAST(my_binary_30 AS DECIMAL(37,2))`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 60 OR select_id IS NULL); +WHERE select_id = 61 OR select_id IS NULL) order by id; CAST(my_binary_30 AS DECIMAL(37,2)) my_binary_30 id NULL NULL 1 0.00 0.00 <--------30 characters-------> 3 0.00 ---äÖüß@µ*$-- -1.00 -1 --3333.33 -3333.3333 +-3333.33 -3333.3333 Warnings: Error 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: '' @@ -3297,14 +3445,14 @@ CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS DECIMAL(37,2)), my_varchar_1000, id FROM t1_values; SELECT CAST(my_varchar_1000 AS DECIMAL(37,2)), my_varchar_1000, id FROM t1_values -WHERE select_id = 59 OR select_id IS NULL; +WHERE select_id = 60 OR select_id IS NULL order by id; CAST(my_varchar_1000 AS DECIMAL(37,2)) my_varchar_1000 id NULL NULL 1 0.00 2 0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 0.00 ---äÖüß@µ*$-- 4 -1.00 -1 5 --3333.33 -3333.3333 26 +-3333.33 -3333.3333 27 Warnings: Error 1366 Incorrect decimal value: '' for column '' at row -1 Error 1366 Incorrect decimal value: '' for column '' at row -1 @@ -3314,14 +3462,14 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 59 OR select_id IS NULL); +WHERE select_id = 60 OR select_id IS NULL) order by id; CAST(my_varchar_1000 AS DECIMAL(37,2)) my_varchar_1000 id NULL NULL 1 0.00 2 0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 0.00 ---äÖüß@µ*$-- 4 -1.00 -1 5 --3333.33 -3333.3333 26 +-3333.33 -3333.3333 27 Warnings: Error 1366 Incorrect decimal value: '' for column '' at row -1 Error 1366 Incorrect decimal value: '' for column '' at row -1 @@ -3333,14 +3481,14 @@ CREATE VIEW v1 AS SELECT CAST(my_char_30 AS DECIMAL(37,2)), my_char_30, id FROM t1_values; SELECT CAST(my_char_30 AS DECIMAL(37,2)), my_char_30, id FROM t1_values -WHERE select_id = 58 OR select_id IS NULL; +WHERE select_id = 59 OR select_id IS NULL order by id; CAST(my_char_30 AS DECIMAL(37,2)) my_char_30 id NULL NULL 1 0.00 2 0.00 <--------30 characters-------> 3 0.00 ---äÖüß@µ*$-- 4 -1.00 -1 5 --3333.33 -3333.3333 25 +-3333.33 -3333.3333 26 Warnings: Error 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ' @@ -3353,14 +3501,14 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal(37,2)) AS `CAST(my_char_30 AS DECIMAL(37,2))`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 58 OR select_id IS NULL); +WHERE select_id = 59 OR select_id IS NULL) order by id; CAST(my_char_30 AS DECIMAL(37,2)) my_char_30 id NULL NULL 1 0.00 2 0.00 <--------30 characters-------> 3 0.00 ---äÖüß@µ*$-- 4 -1.00 -1 5 --3333.33 -3333.3333 25 +-3333.33 -3333.3333 26 Warnings: Error 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ' @@ -3375,7 +3523,7 @@ CREATE VIEW v1 AS SELECT CAST(my_year AS TIME), my_year, id FROM t1_values; SELECT CAST(my_year AS TIME), my_year, id FROM t1_values -WHERE select_id = 57 OR select_id IS NULL; +WHERE select_id = 58 OR select_id IS NULL order by id; CAST(my_year AS TIME) my_year id NULL NULL 1 00:19:01 1901 2 @@ -3387,7 +3535,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as time) AS `CAST(my_year AS TIME)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 57 OR select_id IS NULL); +WHERE select_id = 58 OR select_id IS NULL) order by id; CAST(my_year AS TIME) my_year id NULL NULL 1 00:19:01 1901 2 @@ -3401,7 +3549,7 @@ CREATE VIEW v1 AS SELECT CAST(my_time AS TIME), my_time, id FROM t1_values; SELECT CAST(my_time AS TIME), my_time, id FROM t1_values -WHERE select_id = 56 OR select_id IS NULL; +WHERE select_id = 57 OR select_id IS NULL order by id; CAST(my_time AS TIME) my_time id NULL NULL 1 -838:59:59 -838:59:59 2 @@ -3413,7 +3561,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as time) AS `CAST(my_time AS TIME)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 56 OR select_id IS NULL); +WHERE select_id = 57 OR select_id IS NULL) order by id; CAST(my_time AS TIME) my_time id NULL NULL 1 -838:59:59 -838:59:59 2 @@ -3427,7 +3575,7 @@ CREATE VIEW v1 AS SELECT CAST(my_timestamp AS TIME), my_timestamp, id FROM t1_values; SELECT CAST(my_timestamp AS TIME), my_timestamp, id FROM t1_values -WHERE select_id = 55 OR select_id IS NULL; +WHERE select_id = 56 OR select_id IS NULL order by id; CAST(my_timestamp AS TIME) my_timestamp id 00:00:00 0000-00-00 00:00:00 1 03:00:01 1970-01-01 03:00:01 2 @@ -3439,7 +3587,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as time) AS `CAST(my_timestamp AS TIME)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 55 OR select_id IS NULL); +WHERE select_id = 56 OR select_id IS NULL) order by id; CAST(my_timestamp AS TIME) my_timestamp id 00:00:00 0000-00-00 00:00:00 1 03:00:01 1970-01-01 03:00:01 2 @@ -3453,7 +3601,7 @@ CREATE VIEW v1 AS SELECT CAST(my_date AS TIME), my_date, id FROM t1_values; SELECT CAST(my_date AS TIME), my_date, id FROM t1_values -WHERE select_id = 54 OR select_id IS NULL; +WHERE select_id = 55 OR select_id IS NULL order by id; CAST(my_date AS TIME) my_date id NULL NULL 1 00:00:00 0001-01-01 2 @@ -3465,7 +3613,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as time) AS `CAST(my_date AS TIME)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 54 OR select_id IS NULL); +WHERE select_id = 55 OR select_id IS NULL) order by id; CAST(my_date AS TIME) my_date id NULL NULL 1 00:00:00 0001-01-01 2 @@ -3479,7 +3627,7 @@ CREATE VIEW v1 AS SELECT CAST(my_datetime AS TIME), my_datetime, id FROM t1_values; SELECT CAST(my_datetime AS TIME), my_datetime, id FROM t1_values -WHERE select_id = 53 OR select_id IS NULL; +WHERE select_id = 54 OR select_id IS NULL order by id; CAST(my_datetime AS TIME) my_datetime id NULL NULL 1 00:00:00 0001-01-01 00:00:00 2 @@ -3491,7 +3639,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as time) AS `CAST(my_datetime AS TIME)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 53 OR select_id IS NULL); +WHERE select_id = 54 OR select_id IS NULL) order by id; CAST(my_datetime AS TIME) my_datetime id NULL NULL 1 00:00:00 0001-01-01 00:00:00 2 @@ -3501,11 +3649,45 @@ NULL NULL 1 DROP VIEW v1; +CREATE VIEW v1 AS SELECT CAST(my_double AS TIME), +my_double, id FROM t1_values; +SELECT CAST(my_double AS TIME), +my_double, id FROM t1_values +WHERE select_id = 53 OR select_id IS NULL order by id; +CAST(my_double AS TIME) my_double id +NULL NULL 1 +NULL -1.7976931348623e+308 2 +NULL 1.7976931348623e+308 3 +00:00:00 0 4 +-00:00:01 -1 5 +00:17:58 1758 25 +Warnings: +Warning 1292 Truncated incorrect time value: '-1.7976931348623e+308' +Warning 1292 Truncated incorrect time value: '1.7976931348623e+308' +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as time) AS `CAST(my_double AS TIME)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` +SELECT v1.* FROM v1 +WHERE v1.id IN (SELECT id FROM t1_values +WHERE select_id = 53 OR select_id IS NULL) order by id; +CAST(my_double AS TIME) my_double id +NULL NULL 1 +NULL -1.7976931348623e+308 2 +NULL 1.7976931348623e+308 3 +00:00:00 0 4 +-00:00:01 -1 5 +00:17:58 1758 25 +Warnings: +Warning 1292 Truncated incorrect time value: '-1.7976931348623e+308' +Warning 1292 Truncated incorrect time value: '1.7976931348623e+308' +DROP VIEW v1; + + CREATE VIEW v1 AS SELECT CAST(my_bigint AS TIME), my_bigint, id FROM t1_values; SELECT CAST(my_bigint AS TIME), my_bigint, id FROM t1_values -WHERE select_id = 52 OR select_id IS NULL; +WHERE select_id = 52 OR select_id IS NULL order by id; CAST(my_bigint AS TIME) my_bigint id NULL NULL 1 NULL -9223372036854775808 2 @@ -3521,7 +3703,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as time) AS `CAST(my_bigint AS TIME)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 52 OR select_id IS NULL); +WHERE select_id = 52 OR select_id IS NULL) order by id; CAST(my_bigint AS TIME) my_bigint id NULL NULL 1 NULL -9223372036854775808 2 @@ -3539,7 +3721,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS TIME), my_varbinary_1000, id FROM t1_values; SELECT CAST(my_varbinary_1000 AS TIME), my_varbinary_1000, id FROM t1_values -WHERE select_id = 51 OR select_id IS NULL; +WHERE select_id = 51 OR select_id IS NULL order by id; CAST(my_varbinary_1000 AS TIME) my_varbinary_1000 id NULL NULL 1 NULL 2 @@ -3556,7 +3738,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as time) AS `CAST(my_varbinary_1000 AS TIME)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 51 OR select_id IS NULL); +WHERE select_id = 51 OR select_id IS NULL) order by id; CAST(my_varbinary_1000 AS TIME) my_varbinary_1000 id NULL NULL 1 NULL 2 @@ -3575,14 +3757,14 @@ CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS TIME), my_binary_30, id FROM t1_values; SELECT CAST(my_binary_30 AS TIME), my_binary_30, id FROM t1_values -WHERE select_id = 50 OR select_id IS NULL; +WHERE select_id = 50 OR select_id IS NULL order by id; CAST(my_binary_30 AS TIME) my_binary_30 id NULL NULL 1 -00:00:00 +00:00:00 2 00:00:00 <--------30 characters-------> 3 --00:00:00 ---äÖüß@µ*$-- -NULL -1 -41:58:00 1 17:58 +-00:00:00 ---äÖüß@µ*$-- 4 +NULL -1 5 +41:58:00 1 17:58 22 Warnings: Warning 1292 Truncated incorrect time value: '' Warning 1292 Truncated incorrect time value: '<--------30 characters------->' @@ -3594,7 +3776,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as time) AS `CAST(my_binary_30 AS TIME)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 50 OR select_id IS NULL); +WHERE select_id = 50 OR select_id IS NULL) order by id; CAST(my_binary_30 AS TIME) my_binary_30 id NULL NULL 1 00:00:00 @@ -3615,7 +3797,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS TIME), my_varchar_1000, id FROM t1_values; SELECT CAST(my_varchar_1000 AS TIME), my_varchar_1000, id FROM t1_values -WHERE select_id = 49 OR select_id IS NULL; +WHERE select_id = 49 OR select_id IS NULL order by id; CAST(my_varchar_1000 AS TIME) my_varchar_1000 id NULL NULL 1 NULL 2 @@ -3632,7 +3814,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as time) AS `CAST(my_varchar_1000 AS TIME)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 49 OR select_id IS NULL); +WHERE select_id = 49 OR select_id IS NULL) order by id; CAST(my_varchar_1000 AS TIME) my_varchar_1000 id NULL NULL 1 NULL 2 @@ -3651,7 +3833,7 @@ CREATE VIEW v1 AS SELECT CAST(my_char_30 AS TIME), my_char_30, id FROM t1_values; SELECT CAST(my_char_30 AS TIME), my_char_30, id FROM t1_values -WHERE select_id = 48 OR select_id IS NULL; +WHERE select_id = 48 OR select_id IS NULL order by id; CAST(my_char_30 AS TIME) my_char_30 id NULL NULL 1 NULL 2 @@ -3668,7 +3850,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as time) AS `CAST(my_char_30 AS TIME)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 48 OR select_id IS NULL); +WHERE select_id = 48 OR select_id IS NULL) order by id; CAST(my_char_30 AS TIME) my_char_30 id NULL NULL 1 NULL 2 @@ -3687,7 +3869,7 @@ CREATE VIEW v1 AS SELECT CAST(my_year AS DATETIME), my_year, id FROM t1_values; SELECT CAST(my_year AS DATETIME), my_year, id FROM t1_values -WHERE select_id = 47 OR select_id IS NULL; +WHERE select_id = 47 OR select_id IS NULL order by id; CAST(my_year AS DATETIME) my_year id NULL NULL 1 NULL 1901 2 @@ -3704,7 +3886,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as datetime) AS `CAST(my_year AS DATETIME)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 47 OR select_id IS NULL); +WHERE select_id = 47 OR select_id IS NULL) order by id; CAST(my_year AS DATETIME) my_year id NULL NULL 1 NULL 1901 2 @@ -3723,7 +3905,7 @@ CREATE VIEW v1 AS SELECT CAST(my_time AS DATETIME), my_time, id FROM t1_values; SELECT CAST(my_time AS DATETIME), my_time, id FROM t1_values -WHERE select_id = 46 OR select_id IS NULL; +WHERE select_id = 46 OR select_id IS NULL order by id; CAST(my_time AS DATETIME) my_time id NULL NULL 1 0000-00-00 00:00:00 -838:59:59 2 @@ -3738,7 +3920,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as datetime) AS `CAST(my_time AS DATETIME)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 46 OR select_id IS NULL); +WHERE select_id = 46 OR select_id IS NULL) order by id; CAST(my_time AS DATETIME) my_time id NULL NULL 1 0000-00-00 00:00:00 -838:59:59 2 @@ -3755,7 +3937,7 @@ CREATE VIEW v1 AS SELECT CAST(my_timestamp AS DATETIME), my_timestamp, id FROM t1_values; SELECT CAST(my_timestamp AS DATETIME), my_timestamp, id FROM t1_values -WHERE select_id = 45 OR select_id IS NULL; +WHERE select_id = 45 OR select_id IS NULL order by id; CAST(my_timestamp AS DATETIME) my_timestamp id 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1970-01-01 03:00:01 1970-01-01 03:00:01 2 @@ -3767,7 +3949,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as datetime) AS `CAST(my_timestamp AS DATETIME)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 45 OR select_id IS NULL); +WHERE select_id = 45 OR select_id IS NULL) order by id; CAST(my_timestamp AS DATETIME) my_timestamp id 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1970-01-01 03:00:01 1970-01-01 03:00:01 2 @@ -3781,7 +3963,7 @@ CREATE VIEW v1 AS SELECT CAST(my_date AS DATETIME), my_date, id FROM t1_values; SELECT CAST(my_date AS DATETIME), my_date, id FROM t1_values -WHERE select_id = 44 OR select_id IS NULL; +WHERE select_id = 44 OR select_id IS NULL order by id; CAST(my_date AS DATETIME) my_date id NULL NULL 1 0001-01-01 00:00:00 0001-01-01 2 @@ -3793,7 +3975,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as datetime) AS `CAST(my_date AS DATETIME)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 44 OR select_id IS NULL); +WHERE select_id = 44 OR select_id IS NULL) order by id; CAST(my_date AS DATETIME) my_date id NULL NULL 1 0001-01-01 00:00:00 0001-01-01 2 @@ -3807,7 +3989,7 @@ CREATE VIEW v1 AS SELECT CAST(my_datetime AS DATETIME), my_datetime, id FROM t1_values; SELECT CAST(my_datetime AS DATETIME), my_datetime, id FROM t1_values -WHERE select_id = 43 OR select_id IS NULL; +WHERE select_id = 43 OR select_id IS NULL order by id; CAST(my_datetime AS DATETIME) my_datetime id NULL NULL 1 0001-01-01 00:00:00 0001-01-01 00:00:00 2 @@ -3819,7 +4001,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as datetime) AS `CAST(my_datetime AS DATETIME)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 43 OR select_id IS NULL); +WHERE select_id = 43 OR select_id IS NULL) order by id; CAST(my_datetime AS DATETIME) my_datetime id NULL NULL 1 0001-01-01 00:00:00 0001-01-01 00:00:00 2 @@ -3833,7 +4015,7 @@ CREATE VIEW v1 AS SELECT CAST(my_double AS DATETIME), my_double, id FROM t1_values; SELECT CAST(my_double AS DATETIME), my_double, id FROM t1_values -WHERE select_id = 42 OR select_id IS NULL; +WHERE select_id = 42 OR select_id IS NULL order by id; CAST(my_double AS DATETIME) my_double id NULL NULL 1 NULL -1.7976931348623e+308 2 @@ -3852,7 +4034,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as datetime) AS `CAST(my_double AS DATETIME)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 42 OR select_id IS NULL); +WHERE select_id = 42 OR select_id IS NULL) order by id; CAST(my_double AS DATETIME) my_double id NULL NULL 1 NULL -1.7976931348623e+308 2 @@ -3873,7 +4055,7 @@ CREATE VIEW v1 AS SELECT CAST(my_bigint AS DATETIME), my_bigint, id FROM t1_values; SELECT CAST(my_bigint AS DATETIME), my_bigint, id FROM t1_values -WHERE select_id = 41 OR select_id IS NULL; +WHERE select_id = 41 OR select_id IS NULL order by id; CAST(my_bigint AS DATETIME) my_bigint id NULL NULL 1 NULL -9223372036854775808 2 @@ -3892,7 +4074,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as datetime) AS `CAST(my_bigint AS DATETIME)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 41 OR select_id IS NULL); +WHERE select_id = 41 OR select_id IS NULL) order by id; CAST(my_bigint AS DATETIME) my_bigint id NULL NULL 1 NULL -9223372036854775808 2 @@ -3913,7 +4095,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS DATETIME), my_varbinary_1000, id FROM t1_values; SELECT CAST(my_varbinary_1000 AS DATETIME), my_varbinary_1000, id FROM t1_values -WHERE select_id = 40 OR select_id IS NULL; +WHERE select_id = 40 OR select_id IS NULL order by id; CAST(my_varbinary_1000 AS DATETIME) my_varbinary_1000 id NULL NULL 1 NULL 2 @@ -3931,7 +4113,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as datetime) AS `CAST(my_varbinary_1000 AS DATETIME)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 40 OR select_id IS NULL); +WHERE select_id = 40 OR select_id IS NULL) order by id; CAST(my_varbinary_1000 AS DATETIME) my_varbinary_1000 id NULL NULL 1 NULL 2 @@ -3951,14 +4133,14 @@ CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS DATETIME), my_binary_30, id FROM t1_values; SELECT CAST(my_binary_30 AS DATETIME), my_binary_30, id FROM t1_values -WHERE select_id = 39 OR select_id IS NULL; +WHERE select_id = 39 OR select_id IS NULL order by id; CAST(my_binary_30 AS DATETIME) my_binary_30 id NULL NULL 1 -NULL +NULL 2 NULL <--------30 characters-------> 3 -NULL ---äÖüß@µ*$-- -NULL -1 -2005-06-27 17:58:00 2005-06-27 17:58 +NULL ---äÖüß@µ*$-- 4 +NULL -1 5 +2005-06-27 17:58:00 2005-06-27 17:58 16 Warnings: Warning 1292 Truncated incorrect datetime value: '' Warning 1292 Truncated incorrect datetime value: '<--------30 characters------->' @@ -3970,7 +4152,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as datetime) AS `CAST(my_binary_30 AS DATETIME)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 39 OR select_id IS NULL); +WHERE select_id = 39 OR select_id IS NULL) order by id; CAST(my_binary_30 AS DATETIME) my_binary_30 id NULL NULL 1 NULL @@ -3991,7 +4173,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS DATETIME), my_varchar_1000, id FROM t1_values; SELECT CAST(my_varchar_1000 AS DATETIME), my_varchar_1000, id FROM t1_values -WHERE select_id = 38 OR select_id IS NULL; +WHERE select_id = 38 OR select_id IS NULL order by id; CAST(my_varchar_1000 AS DATETIME) my_varchar_1000 id NULL NULL 1 NULL 2 @@ -4009,7 +4191,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as datetime) AS `CAST(my_varchar_1000 AS DATETIME)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 38 OR select_id IS NULL); +WHERE select_id = 38 OR select_id IS NULL) order by id; CAST(my_varchar_1000 AS DATETIME) my_varchar_1000 id NULL NULL 1 NULL 2 @@ -4029,7 +4211,7 @@ CREATE VIEW v1 AS SELECT CAST(my_char_30 AS DATETIME), my_char_30, id FROM t1_values; SELECT CAST(my_char_30 AS DATETIME), my_char_30, id FROM t1_values -WHERE select_id = 37 OR select_id IS NULL; +WHERE select_id = 37 OR select_id IS NULL order by id; CAST(my_char_30 AS DATETIME) my_char_30 id NULL NULL 1 NULL 2 @@ -4047,7 +4229,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as datetime) AS `CAST(my_char_30 AS DATETIME)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 37 OR select_id IS NULL); +WHERE select_id = 37 OR select_id IS NULL) order by id; CAST(my_char_30 AS DATETIME) my_char_30 id NULL NULL 1 NULL 2 @@ -4067,7 +4249,7 @@ CREATE VIEW v1 AS SELECT CAST(my_year AS DATE), my_year, id FROM t1_values; SELECT CAST(my_year AS DATE), my_year, id FROM t1_values -WHERE select_id = 36 OR select_id IS NULL; +WHERE select_id = 36 OR select_id IS NULL order by id; CAST(my_year AS DATE) my_year id NULL NULL 1 NULL 1901 2 @@ -4084,7 +4266,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as date) AS `CAST(my_year AS DATE)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 36 OR select_id IS NULL); +WHERE select_id = 36 OR select_id IS NULL) order by id; CAST(my_year AS DATE) my_year id NULL NULL 1 NULL 1901 2 @@ -4103,7 +4285,7 @@ CREATE VIEW v1 AS SELECT CAST(my_time AS DATE), my_time, id FROM t1_values; SELECT CAST(my_time AS DATE), my_time, id FROM t1_values -WHERE select_id = 35 OR select_id IS NULL; +WHERE select_id = 35 OR select_id IS NULL order by id; CAST(my_time AS DATE) my_time id NULL NULL 1 0000-00-00 -838:59:59 2 @@ -4115,7 +4297,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as date) AS `CAST(my_time AS DATE)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 35 OR select_id IS NULL); +WHERE select_id = 35 OR select_id IS NULL) order by id; CAST(my_time AS DATE) my_time id NULL NULL 1 0000-00-00 -838:59:59 2 @@ -4129,7 +4311,7 @@ CREATE VIEW v1 AS SELECT CAST(my_timestamp AS DATE), my_timestamp, id FROM t1_values; SELECT CAST(my_timestamp AS DATE), my_timestamp, id FROM t1_values -WHERE select_id = 34 OR select_id IS NULL; +WHERE select_id = 34 OR select_id IS NULL order by id; CAST(my_timestamp AS DATE) my_timestamp id 0000-00-00 0000-00-00 00:00:00 1 1970-01-01 1970-01-01 03:00:01 2 @@ -4141,7 +4323,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as date) AS `CAST(my_timestamp AS DATE)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 34 OR select_id IS NULL); +WHERE select_id = 34 OR select_id IS NULL) order by id; CAST(my_timestamp AS DATE) my_timestamp id 0000-00-00 0000-00-00 00:00:00 1 1970-01-01 1970-01-01 03:00:01 2 @@ -4155,7 +4337,7 @@ CREATE VIEW v1 AS SELECT CAST(my_date AS DATE), my_date, id FROM t1_values; SELECT CAST(my_date AS DATE), my_date, id FROM t1_values -WHERE select_id = 33 OR select_id IS NULL; +WHERE select_id = 33 OR select_id IS NULL order by id; CAST(my_date AS DATE) my_date id NULL NULL 1 0001-01-01 0001-01-01 2 @@ -4167,7 +4349,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as date) AS `CAST(my_date AS DATE)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 33 OR select_id IS NULL); +WHERE select_id = 33 OR select_id IS NULL) order by id; CAST(my_date AS DATE) my_date id NULL NULL 1 0001-01-01 0001-01-01 2 @@ -4181,7 +4363,7 @@ CREATE VIEW v1 AS SELECT CAST(my_datetime AS DATE), my_datetime, id FROM t1_values; SELECT CAST(my_datetime AS DATE), my_datetime, id FROM t1_values -WHERE select_id = 32 OR select_id IS NULL; +WHERE select_id = 32 OR select_id IS NULL order by id; CAST(my_datetime AS DATE) my_datetime id NULL NULL 1 0001-01-01 0001-01-01 00:00:00 2 @@ -4193,7 +4375,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as date) AS `CAST(my_datetime AS DATE)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 32 OR select_id IS NULL); +WHERE select_id = 32 OR select_id IS NULL) order by id; CAST(my_datetime AS DATE) my_datetime id NULL NULL 1 0001-01-01 0001-01-01 00:00:00 2 @@ -4207,7 +4389,7 @@ CREATE VIEW v1 AS SELECT CAST(my_double AS DATE), my_double, id FROM t1_values; SELECT CAST(my_double AS DATE), my_double, id FROM t1_values -WHERE select_id = 31 OR select_id IS NULL; +WHERE select_id = 31 OR select_id IS NULL order by id; CAST(my_double AS DATE) my_double id NULL NULL 1 NULL -1.7976931348623e+308 2 @@ -4225,7 +4407,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as date) AS `CAST(my_double AS DATE)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 31 OR select_id IS NULL); +WHERE select_id = 31 OR select_id IS NULL) order by id; CAST(my_double AS DATE) my_double id NULL NULL 1 NULL -1.7976931348623e+308 2 @@ -4245,7 +4427,7 @@ CREATE VIEW v1 AS SELECT CAST(my_bigint AS DATE), my_bigint, id FROM t1_values; SELECT CAST(my_bigint AS DATE), my_bigint, id FROM t1_values -WHERE select_id = 30 OR select_id IS NULL; +WHERE select_id = 30 OR select_id IS NULL order by id; CAST(my_bigint AS DATE) my_bigint id NULL NULL 1 NULL -9223372036854775808 2 @@ -4263,7 +4445,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as date) AS `CAST(my_bigint AS DATE)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 30 OR select_id IS NULL); +WHERE select_id = 30 OR select_id IS NULL) order by id; CAST(my_bigint AS DATE) my_bigint id NULL NULL 1 NULL -9223372036854775808 2 @@ -4283,7 +4465,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS DATE), my_varbinary_1000, id FROM t1_values; SELECT CAST(my_varbinary_1000 AS DATE), my_varbinary_1000, id FROM t1_values -WHERE select_id = 29 OR select_id IS NULL; +WHERE select_id = 29 OR select_id IS NULL order by id; CAST(my_varbinary_1000 AS DATE) my_varbinary_1000 id NULL NULL 1 NULL 2 @@ -4301,7 +4483,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as date) AS `CAST(my_varbinary_1000 AS DATE)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 29 OR select_id IS NULL); +WHERE select_id = 29 OR select_id IS NULL) order by id; CAST(my_varbinary_1000 AS DATE) my_varbinary_1000 id NULL NULL 1 NULL 2 @@ -4321,14 +4503,14 @@ CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS DATE), my_binary_30, id FROM t1_values; SELECT CAST(my_binary_30 AS DATE), my_binary_30, id FROM t1_values -WHERE select_id = 28 OR select_id IS NULL; +WHERE select_id = 28 OR select_id IS NULL order by id; CAST(my_binary_30 AS DATE) my_binary_30 id NULL NULL 1 -NULL +NULL 2 NULL <--------30 characters-------> 3 -NULL ---äÖüß@µ*$-- -NULL -1 -2005-06-27 2005-06-27 +NULL ---äÖüß@µ*$-- 4 +NULL -1 5 +2005-06-27 2005-06-27 10 Warnings: Warning 1292 Truncated incorrect datetime value: '' Warning 1292 Truncated incorrect datetime value: '<--------30 characters------->' @@ -4340,7 +4522,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as date) AS `CAST(my_binary_30 AS DATE)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 28 OR select_id IS NULL); +WHERE select_id = 28 OR select_id IS NULL) order by id; CAST(my_binary_30 AS DATE) my_binary_30 id NULL NULL 1 NULL @@ -4361,7 +4543,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS DATE), my_varchar_1000, id FROM t1_values; SELECT CAST(my_varchar_1000 AS DATE), my_varchar_1000, id FROM t1_values -WHERE select_id = 27 OR select_id IS NULL; +WHERE select_id = 27 OR select_id IS NULL order by id; CAST(my_varchar_1000 AS DATE) my_varchar_1000 id NULL NULL 1 NULL 2 @@ -4379,7 +4561,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as date) AS `CAST(my_varchar_1000 AS DATE)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 27 OR select_id IS NULL); +WHERE select_id = 27 OR select_id IS NULL) order by id; CAST(my_varchar_1000 AS DATE) my_varchar_1000 id NULL NULL 1 NULL 2 @@ -4399,7 +4581,7 @@ CREATE VIEW v1 AS SELECT CAST(my_char_30 AS DATE), my_char_30, id FROM t1_values; SELECT CAST(my_char_30 AS DATE), my_char_30, id FROM t1_values -WHERE select_id = 26 OR select_id IS NULL; +WHERE select_id = 26 OR select_id IS NULL order by id; CAST(my_char_30 AS DATE) my_char_30 id NULL NULL 1 NULL 2 @@ -4417,7 +4599,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as date) AS `CAST(my_char_30 AS DATE)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 26 OR select_id IS NULL); +WHERE select_id = 26 OR select_id IS NULL) order by id; CAST(my_char_30 AS DATE) my_char_30 id NULL NULL 1 NULL 2 @@ -4437,7 +4619,7 @@ CREATE VIEW v1 AS SELECT CAST(my_year AS CHAR), my_year, id FROM t1_values; SELECT CAST(my_year AS CHAR), my_year, id FROM t1_values -WHERE select_id = 25 OR select_id IS NULL; +WHERE select_id = 25 OR select_id IS NULL order by id; CAST(my_year AS CHAR) my_year id NULL NULL 1 1901 1901 2 @@ -4449,7 +4631,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as char charset latin1) AS `CAST(my_year AS CHAR)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 25 OR select_id IS NULL); +WHERE select_id = 25 OR select_id IS NULL) order by id; CAST(my_year AS CHAR) my_year id NULL NULL 1 1901 1901 2 @@ -4463,7 +4645,7 @@ CREATE VIEW v1 AS SELECT CAST(my_time AS CHAR), my_time, id FROM t1_values; SELECT CAST(my_time AS CHAR), my_time, id FROM t1_values -WHERE select_id = 24 OR select_id IS NULL; +WHERE select_id = 24 OR select_id IS NULL order by id; CAST(my_time AS CHAR) my_time id NULL NULL 1 -838:59:59 -838:59:59 2 @@ -4475,7 +4657,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as char charset latin1) AS `CAST(my_time AS CHAR)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 24 OR select_id IS NULL); +WHERE select_id = 24 OR select_id IS NULL) order by id; CAST(my_time AS CHAR) my_time id NULL NULL 1 -838:59:59 -838:59:59 2 @@ -4489,7 +4671,7 @@ CREATE VIEW v1 AS SELECT CAST(my_timestamp AS CHAR), my_timestamp, id FROM t1_values; SELECT CAST(my_timestamp AS CHAR), my_timestamp, id FROM t1_values -WHERE select_id = 23 OR select_id IS NULL; +WHERE select_id = 23 OR select_id IS NULL order by id; CAST(my_timestamp AS CHAR) my_timestamp id 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1970-01-01 03:00:01 1970-01-01 03:00:01 2 @@ -4501,7 +4683,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as char charset latin1) AS `CAST(my_timestamp AS CHAR)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 23 OR select_id IS NULL); +WHERE select_id = 23 OR select_id IS NULL) order by id; CAST(my_timestamp AS CHAR) my_timestamp id 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1970-01-01 03:00:01 1970-01-01 03:00:01 2 @@ -4515,7 +4697,7 @@ CREATE VIEW v1 AS SELECT CAST(my_date AS CHAR), my_date, id FROM t1_values; SELECT CAST(my_date AS CHAR), my_date, id FROM t1_values -WHERE select_id = 22 OR select_id IS NULL; +WHERE select_id = 22 OR select_id IS NULL order by id; CAST(my_date AS CHAR) my_date id NULL NULL 1 0001-01-01 0001-01-01 2 @@ -4527,7 +4709,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as char charset latin1) AS `CAST(my_date AS CHAR)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 22 OR select_id IS NULL); +WHERE select_id = 22 OR select_id IS NULL) order by id; CAST(my_date AS CHAR) my_date id NULL NULL 1 0001-01-01 0001-01-01 2 @@ -4541,7 +4723,7 @@ CREATE VIEW v1 AS SELECT CAST(my_datetime AS CHAR), my_datetime, id FROM t1_values; SELECT CAST(my_datetime AS CHAR), my_datetime, id FROM t1_values -WHERE select_id = 21 OR select_id IS NULL; +WHERE select_id = 21 OR select_id IS NULL order by id; CAST(my_datetime AS CHAR) my_datetime id NULL NULL 1 0001-01-01 00:00:00 0001-01-01 00:00:00 2 @@ -4553,7 +4735,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as char charset latin1) AS `CAST(my_datetime AS CHAR)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 21 OR select_id IS NULL); +WHERE select_id = 21 OR select_id IS NULL) order by id; CAST(my_datetime AS CHAR) my_datetime id NULL NULL 1 0001-01-01 00:00:00 0001-01-01 00:00:00 2 @@ -4567,7 +4749,7 @@ CREATE VIEW v1 AS SELECT CAST(my_double AS CHAR), my_double, id FROM t1_values; SELECT CAST(my_double AS CHAR), my_double, id FROM t1_values -WHERE select_id = 20 OR select_id IS NULL; +WHERE select_id = 20 OR select_id IS NULL order by id; CAST(my_double AS CHAR) my_double id NULL NULL 1 -1.7976931348623e+308 -1.7976931348623e+308 2 @@ -4579,7 +4761,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as char charset latin1) AS `CAST(my_double AS CHAR)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 20 OR select_id IS NULL); +WHERE select_id = 20 OR select_id IS NULL) order by id; CAST(my_double AS CHAR) my_double id NULL NULL 1 -1.7976931348623e+308 -1.7976931348623e+308 2 @@ -4593,7 +4775,7 @@ CREATE VIEW v1 AS SELECT CAST(my_decimal AS CHAR), my_decimal, id FROM t1_values; SELECT CAST(my_decimal AS CHAR), my_decimal, id FROM t1_values -WHERE select_id = 19 OR select_id IS NULL; +WHERE select_id = 19 OR select_id IS NULL order by id; CAST(my_decimal AS CHAR) my_decimal id NULL NULL 1 -9999999999999999999999999999999999.999999999999999999999999999999 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -4605,7 +4787,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as char charset latin1) AS `CAST(my_decimal AS CHAR)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 19 OR select_id IS NULL); +WHERE select_id = 19 OR select_id IS NULL) order by id; CAST(my_decimal AS CHAR) my_decimal id NULL NULL 1 -9999999999999999999999999999999999.999999999999999999999999999999 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -4619,7 +4801,7 @@ CREATE VIEW v1 AS SELECT CAST(my_bigint AS CHAR), my_bigint, id FROM t1_values; SELECT CAST(my_bigint AS CHAR), my_bigint, id FROM t1_values -WHERE select_id = 18 OR select_id IS NULL; +WHERE select_id = 18 OR select_id IS NULL order by id; CAST(my_bigint AS CHAR) my_bigint id NULL NULL 1 -9223372036854775808 -9223372036854775808 2 @@ -4631,7 +4813,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as char charset latin1) AS `CAST(my_bigint AS CHAR)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 18 OR select_id IS NULL); +WHERE select_id = 18 OR select_id IS NULL) order by id; CAST(my_bigint AS CHAR) my_bigint id NULL NULL 1 -9223372036854775808 -9223372036854775808 2 @@ -4645,7 +4827,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS CHAR), my_varbinary_1000, id FROM t1_values; SELECT CAST(my_varbinary_1000 AS CHAR), my_varbinary_1000, id FROM t1_values -WHERE select_id = 17 OR select_id IS NULL; +WHERE select_id = 17 OR select_id IS NULL order by id; CAST(my_varbinary_1000 AS CHAR) my_varbinary_1000 id NULL NULL 1 2 @@ -4657,7 +4839,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as char charset latin1) AS `CAST(my_varbinary_1000 AS CHAR)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 17 OR select_id IS NULL); +WHERE select_id = 17 OR select_id IS NULL) order by id; CAST(my_varbinary_1000 AS CHAR) my_varbinary_1000 id NULL NULL 1 2 @@ -4671,19 +4853,19 @@ CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS CHAR), my_binary_30, id FROM t1_values; SELECT CAST(my_binary_30 AS CHAR), my_binary_30, id FROM t1_values -WHERE select_id = 16 OR select_id IS NULL; +WHERE select_id = 16 OR select_id IS NULL order by id; CAST(my_binary_30 AS CHAR) my_binary_30 id NULL NULL 1 - + 2 <--------30 characters-------> <--------30 characters-------> 3 - ---äÖüß@µ*$-- --1 + ---äÖüß@µ*$-- ---äÖüß@µ*$-- 4 +-1 -1 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as char charset latin1) AS `CAST(my_binary_30 AS CHAR)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 16 OR select_id IS NULL); +WHERE select_id = 16 OR select_id IS NULL) order by id; CAST(my_binary_30 AS CHAR) my_binary_30 id NULL NULL 1 @@ -4697,7 +4879,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS CHAR), my_varchar_1000, id FROM t1_values; SELECT CAST(my_varchar_1000 AS CHAR), my_varchar_1000, id FROM t1_values -WHERE select_id = 15 OR select_id IS NULL; +WHERE select_id = 15 OR select_id IS NULL order by id; CAST(my_varchar_1000 AS CHAR) my_varchar_1000 id NULL NULL 1 2 @@ -4709,7 +4891,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as char charset latin1) AS `CAST(my_varchar_1000 AS CHAR)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 15 OR select_id IS NULL); +WHERE select_id = 15 OR select_id IS NULL) order by id; CAST(my_varchar_1000 AS CHAR) my_varchar_1000 id NULL NULL 1 2 @@ -4723,7 +4905,7 @@ CREATE VIEW v1 AS SELECT CAST(my_char_30 AS CHAR), my_char_30, id FROM t1_values; SELECT CAST(my_char_30 AS CHAR), my_char_30, id FROM t1_values -WHERE select_id = 14 OR select_id IS NULL; +WHERE select_id = 14 OR select_id IS NULL order by id; CAST(my_char_30 AS CHAR) my_char_30 id NULL NULL 1 2 @@ -4735,7 +4917,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as char charset latin1) AS `CAST(my_char_30 AS CHAR)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 14 OR select_id IS NULL); +WHERE select_id = 14 OR select_id IS NULL) order by id; CAST(my_char_30 AS CHAR) my_char_30 id NULL NULL 1 2 @@ -4749,7 +4931,7 @@ CREATE VIEW v1 AS SELECT CAST(my_year AS BINARY), my_year, id FROM t1_values; SELECT CAST(my_year AS BINARY), my_year, id FROM t1_values -WHERE select_id = 13 OR select_id IS NULL; +WHERE select_id = 13 OR select_id IS NULL order by id; CAST(my_year AS BINARY) my_year id NULL NULL 1 1901 1901 2 @@ -4761,7 +4943,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as char charset binary) AS `CAST(my_year AS BINARY)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 13 OR select_id IS NULL); +WHERE select_id = 13 OR select_id IS NULL) order by id; CAST(my_year AS BINARY) my_year id NULL NULL 1 1901 1901 2 @@ -4775,7 +4957,7 @@ CREATE VIEW v1 AS SELECT CAST(my_time AS BINARY), my_time, id FROM t1_values; SELECT CAST(my_time AS BINARY), my_time, id FROM t1_values -WHERE select_id = 12 OR select_id IS NULL; +WHERE select_id = 12 OR select_id IS NULL order by id; CAST(my_time AS BINARY) my_time id NULL NULL 1 -838:59:59 -838:59:59 2 @@ -4787,7 +4969,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as char charset binary) AS `CAST(my_time AS BINARY)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 12 OR select_id IS NULL); +WHERE select_id = 12 OR select_id IS NULL) order by id; CAST(my_time AS BINARY) my_time id NULL NULL 1 -838:59:59 -838:59:59 2 @@ -4801,7 +4983,7 @@ CREATE VIEW v1 AS SELECT CAST(my_timestamp AS BINARY), my_timestamp, id FROM t1_values; SELECT CAST(my_timestamp AS BINARY), my_timestamp, id FROM t1_values -WHERE select_id = 11 OR select_id IS NULL; +WHERE select_id = 11 OR select_id IS NULL order by id; CAST(my_timestamp AS BINARY) my_timestamp id 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1970-01-01 03:00:01 1970-01-01 03:00:01 2 @@ -4813,7 +4995,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as char charset binary) AS `CAST(my_timestamp AS BINARY)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 11 OR select_id IS NULL); +WHERE select_id = 11 OR select_id IS NULL) order by id; CAST(my_timestamp AS BINARY) my_timestamp id 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1970-01-01 03:00:01 1970-01-01 03:00:01 2 @@ -4827,7 +5009,7 @@ CREATE VIEW v1 AS SELECT CAST(my_date AS BINARY), my_date, id FROM t1_values; SELECT CAST(my_date AS BINARY), my_date, id FROM t1_values -WHERE select_id = 10 OR select_id IS NULL; +WHERE select_id = 10 OR select_id IS NULL order by id; CAST(my_date AS BINARY) my_date id NULL NULL 1 0001-01-01 0001-01-01 2 @@ -4839,7 +5021,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as char charset binary) AS `CAST(my_date AS BINARY)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 10 OR select_id IS NULL); +WHERE select_id = 10 OR select_id IS NULL) order by id; CAST(my_date AS BINARY) my_date id NULL NULL 1 0001-01-01 0001-01-01 2 @@ -4853,7 +5035,7 @@ CREATE VIEW v1 AS SELECT CAST(my_datetime AS BINARY), my_datetime, id FROM t1_values; SELECT CAST(my_datetime AS BINARY), my_datetime, id FROM t1_values -WHERE select_id = 9 OR select_id IS NULL; +WHERE select_id = 9 OR select_id IS NULL order by id; CAST(my_datetime AS BINARY) my_datetime id NULL NULL 1 0001-01-01 00:00:00 0001-01-01 00:00:00 2 @@ -4865,7 +5047,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as char charset binary) AS `CAST(my_datetime AS BINARY)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 9 OR select_id IS NULL); +WHERE select_id = 9 OR select_id IS NULL) order by id; CAST(my_datetime AS BINARY) my_datetime id NULL NULL 1 0001-01-01 00:00:00 0001-01-01 00:00:00 2 @@ -4879,7 +5061,7 @@ CREATE VIEW v1 AS SELECT CAST(my_double AS BINARY), my_double, id FROM t1_values; SELECT CAST(my_double AS BINARY), my_double, id FROM t1_values -WHERE select_id = 8 OR select_id IS NULL; +WHERE select_id = 8 OR select_id IS NULL order by id; CAST(my_double AS BINARY) my_double id NULL NULL 1 -1.7976931348623e+308 -1.7976931348623e+308 2 @@ -4891,7 +5073,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as char charset binary) AS `CAST(my_double AS BINARY)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 8 OR select_id IS NULL); +WHERE select_id = 8 OR select_id IS NULL) order by id; CAST(my_double AS BINARY) my_double id NULL NULL 1 -1.7976931348623e+308 -1.7976931348623e+308 2 @@ -4905,7 +5087,7 @@ CREATE VIEW v1 AS SELECT CAST(my_decimal AS BINARY), my_decimal, id FROM t1_values; SELECT CAST(my_decimal AS BINARY), my_decimal, id FROM t1_values -WHERE select_id = 7 OR select_id IS NULL; +WHERE select_id = 7 OR select_id IS NULL order by id; CAST(my_decimal AS BINARY) my_decimal id NULL NULL 1 -9999999999999999999999999999999999.999999999999999999999999999999 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -4917,7 +5099,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as char charset binary) AS `CAST(my_decimal AS BINARY)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 7 OR select_id IS NULL); +WHERE select_id = 7 OR select_id IS NULL) order by id; CAST(my_decimal AS BINARY) my_decimal id NULL NULL 1 -9999999999999999999999999999999999.999999999999999999999999999999 -9999999999999999999999999999999999.999999999999999999999999999999 2 @@ -4931,7 +5113,7 @@ CREATE VIEW v1 AS SELECT CAST(my_bigint AS BINARY), my_bigint, id FROM t1_values; SELECT CAST(my_bigint AS BINARY), my_bigint, id FROM t1_values -WHERE select_id = 6 OR select_id IS NULL; +WHERE select_id = 6 OR select_id IS NULL order by id; CAST(my_bigint AS BINARY) my_bigint id NULL NULL 1 -9223372036854775808 -9223372036854775808 2 @@ -4943,7 +5125,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as char charset binary) AS `CAST(my_bigint AS BINARY)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 6 OR select_id IS NULL); +WHERE select_id = 6 OR select_id IS NULL) order by id; CAST(my_bigint AS BINARY) my_bigint id NULL NULL 1 -9223372036854775808 -9223372036854775808 2 @@ -4957,7 +5139,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS BINARY), my_varbinary_1000, id FROM t1_values; SELECT CAST(my_varbinary_1000 AS BINARY), my_varbinary_1000, id FROM t1_values -WHERE select_id = 5 OR select_id IS NULL; +WHERE select_id = 5 OR select_id IS NULL order by id; CAST(my_varbinary_1000 AS BINARY) my_varbinary_1000 id NULL NULL 1 2 @@ -4969,7 +5151,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as char charset binary) AS `CAST(my_varbinary_1000 AS BINARY)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 5 OR select_id IS NULL); +WHERE select_id = 5 OR select_id IS NULL) order by id; CAST(my_varbinary_1000 AS BINARY) my_varbinary_1000 id NULL NULL 1 2 @@ -4983,19 +5165,19 @@ CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS BINARY), my_binary_30, id FROM t1_values; SELECT CAST(my_binary_30 AS BINARY), my_binary_30, id FROM t1_values -WHERE select_id = 4 OR select_id IS NULL; +WHERE select_id = 4 OR select_id IS NULL order by id; CAST(my_binary_30 AS BINARY) my_binary_30 id NULL NULL 1 - + 2 <--------30 characters-------> <--------30 characters-------> 3 - ---äÖüß@µ*$-- --1 + ---äÖüß@µ*$-- ---äÖüß@µ*$-- 4 +-1 -1 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as char charset binary) AS `CAST(my_binary_30 AS BINARY)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 4 OR select_id IS NULL); +WHERE select_id = 4 OR select_id IS NULL) order by id; CAST(my_binary_30 AS BINARY) my_binary_30 id NULL NULL 1 @@ -5009,7 +5191,7 @@ CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS BINARY), my_varchar_1000, id FROM t1_values; SELECT CAST(my_varchar_1000 AS BINARY), my_varchar_1000, id FROM t1_values -WHERE select_id = 3 OR select_id IS NULL; +WHERE select_id = 3 OR select_id IS NULL order by id; CAST(my_varchar_1000 AS BINARY) my_varchar_1000 id NULL NULL 1 2 @@ -5021,7 +5203,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as char charset binary) AS `CAST(my_varchar_1000 AS BINARY)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 3 OR select_id IS NULL); +WHERE select_id = 3 OR select_id IS NULL) order by id; CAST(my_varchar_1000 AS BINARY) my_varchar_1000 id NULL NULL 1 2 @@ -5035,7 +5217,7 @@ CREATE VIEW v1 AS SELECT CAST(my_char_30 AS BINARY), my_char_30, id FROM t1_values; SELECT CAST(my_char_30 AS BINARY), my_char_30, id FROM t1_values -WHERE select_id = 2 OR select_id IS NULL; +WHERE select_id = 2 OR select_id IS NULL order by id; CAST(my_char_30 AS BINARY) my_char_30 id NULL NULL 1 2 @@ -5047,7 +5229,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as char charset binary) AS `CAST(my_char_30 AS BINARY)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 2 OR select_id IS NULL); +WHERE select_id = 2 OR select_id IS NULL) order by id; CAST(my_char_30 AS BINARY) my_char_30 id NULL NULL 1 2 @@ -5059,7 +5241,7 @@ DROP VIEW v1; CREATE VIEW v1 AS SELECT sqrt(my_bigint), my_bigint, id FROM t1_values; SELECT sqrt(my_bigint), my_bigint, id FROM t1_values -WHERE select_id = 1 OR select_id IS NULL; +WHERE select_id = 1 OR select_id IS NULL order by id; sqrt(my_bigint) my_bigint id NULL NULL 1 NULL -9223372036854775808 2 @@ -5073,7 +5255,7 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sqrt(`t1_values`.`my_bigint`) AS `sqrt(my_bigint)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values -WHERE select_id = 1 OR select_id IS NULL); +WHERE select_id = 1 OR select_id IS NULL) order by id; sqrt(my_bigint) my_bigint id NULL NULL 1 NULL -9223372036854775808 2 diff --git a/mysql-test/suite/funcs_1/r/myisam_storedproc_02.result b/mysql-test/suite/funcs_1/r/myisam_storedproc_02.result index aff27fbabc4..6ba95c9fa63 100644 --- a/mysql-test/suite/funcs_1/r/myisam_storedproc_02.result +++ b/mysql-test/suite/funcs_1/r/myisam_storedproc_02.result @@ -9,20 +9,25 @@ DROP DATABASE IF EXISTS db_storedproc_1; CREATE DATABASE db_storedproc; CREATE DATABASE db_storedproc_1; USE db_storedproc; -create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t1; -create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t2; -create table t3(f1 char(20),f2 char(20),f3 integer) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t3.txt' into table t3; -create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t4; +create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t1; +create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t2; +create table t3(f1 char(20),f2 char(20),f3 integer) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t3.txt' into table t3; +create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t4; USE db_storedproc_1; -create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t6; +create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t6; USE db_storedproc; -create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t7; +create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t7; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -34,8 +39,9 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t8; +create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t8; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -47,12 +53,14 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t9(f1 int, f2 char(25), f3 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' into table t9; -create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t10; -create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t11; +create table t9(f1 int, f2 char(25), f3 int) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t9.txt' into table t9; +create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t10; +create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t11; Section 3.1.2 - Syntax checks for the stored procedure-specific programming statements BEGIN/END, DECLARE, SET, SELECT/INTO, OPEN, FETCH, CLOSE: @@ -164,7 +172,7 @@ declare y integer default 1; set @x = x; set @y = y; set @z = 234; -SELECT f1, f2 into @x, @y from t2 limit 1; +SELECT f1, f2 into @x, @y from t2 where f1='a`' and f2='a`' limit 1; SELECT @x, @y, @z, invar; BEGIN set @x = 2; @@ -207,7 +215,7 @@ BEGIN declare x integer; declare y integer; set @x=x; set @y=y; -SELECT f4, f3 into @x, @y from t2 limit 1; +SELECT f4, f3 into @x, @y from t2 where f4=-5000 and f3='1000-01-01' limit 1; SELECT @x, @y; END// CALL sp1(); @@ -695,7 +703,7 @@ Testcase 3.1.2.54: ------------------ Ensure that a handler with a condition defined with an SQLSTATE that begins with -“01“ is always exactly equivalent in action to a handler with an SQLWARNING +“01“ is always exactly equivalent in action to a handler with an SQLWARNING condition. -------------------------------------------------------------------------------- DROP PROCEDURE IF EXISTS sp0; @@ -794,7 +802,7 @@ Testcase 3.1.2.56: ------------------ Ensure that a handler with a condition defined with an SQLSTATE that begins with -“02“ is always exactly equivalent in action to a handler with a NOT FOUND +“02“ is always exactly equivalent in action to a handler with a NOT FOUND condition. -------------------------------------------------------------------------------- DROP PROCEDURE IF EXISTS sp0; @@ -902,7 +910,7 @@ Testcase 3.1.2.58: ------------------ Ensure that a handler with a condition defined with an SQLSTATE that begins with -anything other that “01“ or “02“ is always exactly equivalent in action to a +anything other that “01“ or “02“ is always exactly equivalent in action to a handler with an SQLEXCEPTION condition. -------------------------------------------------------------------------------- DROP PROCEDURE IF EXISTS sp0; @@ -1082,7 +1090,8 @@ declare f2_value char(20); declare f5_value char(20); declare f4_value integer; declare f6_value integer; -declare cur1 cursor for SELECT f1, f2, f4, f5, f6 from t2 limit 3; +declare cur1 cursor for SELECT f1, f2, f4, f5, f6 from t2 +where f4 >=-5000 order by f4 limit 3; open cur1; while proceed do SELECT count AS 'loop'; @@ -1165,7 +1174,7 @@ of a compound statement ends. DROP TABLE IF EXISTS temp1; DROP PROCEDURE IF EXISTS sp1; create table temp1( f0 char(20), f1 char(20), f2 char(20), f3 int, f4 char(20) ); -SELECT f1, f2, f4, f5 from t2; +SELECT f1, f2, f4, f5 from t2 order by f4; f1 f2 f4 f5 a` a` -5000 a` aaa aaa -4999 aaa @@ -1185,8 +1194,8 @@ declare newf1 char(20); declare newf2 char(20); declare newf5 char(20); declare newf4 integer; -declare cur1 cursor for SELECT f1, f2, f4, f5 from t2 limit 5; -declare cur2 cursor for SELECT f1, f2, f4, f5 from t2 limit 5; +declare cur1 cursor for SELECT f1, f2, f4, f5 from t2 where f4 >= -5000 order by f4 limit 5; +declare cur2 cursor for SELECT f1, f2, f4, f5 from t2 where f4 >= -5000 order by f4 limit 5; open cur1; open cur2; BEGIN @@ -1268,8 +1277,10 @@ declare i_newf11 char(20); declare i_newf12 char(20); declare i_newf13 date; declare i_newf14 integer; -declare cur1 cursor for SELECT f1, f2, f3, f4 from t2 limit 4; -declare cur2 cursor for SELECT f1, f2, f3, f4 from t2 limit 3; +declare cur1 cursor for SELECT f1, f2, f3, f4 from t2 +where f4>=-5000 order by f4 limit 4; +declare cur2 cursor for SELECT f1, f2, f3, f4 from t2 +where f4>=-5000 order by f4 limit 3; declare continue handler for sqlstate '02000' set proceed=0; open cur1; open cur2; @@ -1300,8 +1311,10 @@ DECLARE o_newf11 CHAR(20); DECLARE o_newf12 CHAR(20); DECLARE o_newf13 DATE; DECLARE o_newf14 INTEGER; -DECLARE cur1 CURSOR FOR SELECT f1, f2, f3, f4 FROM t2 LIMIT 5; -DECLARE cur2 CURSOR FOR SELECT f1, f2, f3, f4 FROM t2 LIMIT 5; +DECLARE cur1 CURSOR FOR SELECT f1, f2, f3, f4 FROM t2 +WHERE f4>=-5000 ORDER BY f4 LIMIT 5; +DECLARE cur2 CURSOR FOR SELECT f1, f2, f3, f4 FROM t2 +WHERE f4>=-5000 ORDER BY f4 LIMIT 5; DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET proceed=0; OPEN cur1; OPEN cur2; diff --git a/mysql-test/suite/funcs_1/r/myisam_storedproc_03.result b/mysql-test/suite/funcs_1/r/myisam_storedproc_03.result index 0057b7ef229..53e25441e2e 100644 --- a/mysql-test/suite/funcs_1/r/myisam_storedproc_03.result +++ b/mysql-test/suite/funcs_1/r/myisam_storedproc_03.result @@ -9,20 +9,25 @@ DROP DATABASE IF EXISTS db_storedproc_1; CREATE DATABASE db_storedproc; CREATE DATABASE db_storedproc_1; USE db_storedproc; -create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t1; -create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t2; -create table t3(f1 char(20),f2 char(20),f3 integer) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t3.txt' into table t3; -create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t4; +create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t1; +create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t2; +create table t3(f1 char(20),f2 char(20),f3 integer) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t3.txt' into table t3; +create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t4; USE db_storedproc_1; -create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t6; +create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t6; USE db_storedproc; -create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t7; +create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t7; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -34,8 +39,9 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t8; +create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t8; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -47,12 +53,14 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t9(f1 int, f2 char(25), f3 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' into table t9; -create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t10; -create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t11; +create table t9(f1 int, f2 char(25), f3 int) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t9.txt' into table t9; +create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t10; +create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t11; Section 3.1.3 - Syntax checks for the stored procedure-specific flow control statements IF, CASE, LOOP, LEAVE, ITERATE, REPEAT, WHILE: diff --git a/mysql-test/suite/funcs_1/r/myisam_storedproc_06.result b/mysql-test/suite/funcs_1/r/myisam_storedproc_06.result index a85c4347962..88bddf68e24 100644 --- a/mysql-test/suite/funcs_1/r/myisam_storedproc_06.result +++ b/mysql-test/suite/funcs_1/r/myisam_storedproc_06.result @@ -9,20 +9,25 @@ DROP DATABASE IF EXISTS db_storedproc_1; CREATE DATABASE db_storedproc; CREATE DATABASE db_storedproc_1; USE db_storedproc; -create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t1; -create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t2; -create table t3(f1 char(20),f2 char(20),f3 integer) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t3.txt' into table t3; -create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t4; +create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t1; +create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t2; +create table t3(f1 char(20),f2 char(20),f3 integer) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t3.txt' into table t3; +create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t4; USE db_storedproc_1; -create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t6; +create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t6; USE db_storedproc; -create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t7; +create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t7; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -34,8 +39,9 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t8; +create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t8; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -47,12 +53,14 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t9(f1 int, f2 char(25), f3 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' into table t9; -create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t10; -create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t11; +create table t9(f1 int, f2 char(25), f3 int) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t9.txt' into table t9; +create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t10; +create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t11; Section 3.1.6 - Privilege Checks: -------------------------------------------------------------------------------- @@ -79,6 +87,7 @@ BEGIN SELECT * from db_storedproc_1.t6 where t6.f2= 'xyz'; END// ERROR 42000: Access denied for user 'user_1'@'localhost' to database 'db_storedproc_1' +USE db_storedproc_1; root@localhost db_storedproc_1 GRANT CREATE ROUTINE ON db_storedproc_1.* TO 'user_1'@'localhost'; @@ -90,6 +99,7 @@ CREATE PROCEDURE sp1(v1 char(20)) BEGIN SELECT * from db_storedproc_1.t6 where t6.f2= 'xyz'; END// +USE db_storedproc_1; root@localhost db_storedproc_1 DROP USER 'user_1'@'localhost'; @@ -115,6 +125,7 @@ CREATE FUNCTION fn1(v1 int) returns int BEGIN return v1; END// +USE db_storedproc_1; root@localhost db_storedproc_1 drop user 'user_1'@'localhost'; diff --git a/mysql-test/suite/funcs_1/r/myisam_storedproc_07.result b/mysql-test/suite/funcs_1/r/myisam_storedproc_07.result index 0865d77e4f0..cbe0a18435a 100644 --- a/mysql-test/suite/funcs_1/r/myisam_storedproc_07.result +++ b/mysql-test/suite/funcs_1/r/myisam_storedproc_07.result @@ -9,20 +9,25 @@ DROP DATABASE IF EXISTS db_storedproc_1; CREATE DATABASE db_storedproc; CREATE DATABASE db_storedproc_1; USE db_storedproc; -create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t1; -create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t2; -create table t3(f1 char(20),f2 char(20),f3 integer) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t3.txt' into table t3; -create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t4; +create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t1; +create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t2; +create table t3(f1 char(20),f2 char(20),f3 integer) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t3.txt' into table t3; +create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t4; USE db_storedproc_1; -create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t6; +create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t6; USE db_storedproc; -create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t7; +create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t7; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -34,8 +39,9 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t8; +create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t8; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -47,12 +53,14 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t9(f1 int, f2 char(25), f3 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' into table t9; -create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t10; -create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t11; +create table t9(f1 int, f2 char(25), f3 int) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t9.txt' into table t9; +create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t10; +create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t11; Section 3.1.7 - SQL mode checks: -------------------------------------------------------------------------------- diff --git a/mysql-test/suite/funcs_1/r/myisam_storedproc_08.result b/mysql-test/suite/funcs_1/r/myisam_storedproc_08.result index 3e612817200..40ebc1e51e4 100644 --- a/mysql-test/suite/funcs_1/r/myisam_storedproc_08.result +++ b/mysql-test/suite/funcs_1/r/myisam_storedproc_08.result @@ -9,20 +9,25 @@ DROP DATABASE IF EXISTS db_storedproc_1; CREATE DATABASE db_storedproc; CREATE DATABASE db_storedproc_1; USE db_storedproc; -create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t1; -create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t2; -create table t3(f1 char(20),f2 char(20),f3 integer) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t3.txt' into table t3; -create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t4; +create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t1; +create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t2; +create table t3(f1 char(20),f2 char(20),f3 integer) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t3.txt' into table t3; +create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t4; USE db_storedproc_1; -create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t6; +create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t6; USE db_storedproc; -create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t7; +create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t7; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -34,8 +39,9 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t8; +create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t8; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -47,12 +53,14 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t9(f1 int, f2 char(25), f3 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' into table t9; -create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t10; -create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t11; +create table t9(f1 int, f2 char(25), f3 int) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t9.txt' into table t9; +create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t10; +create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t11; Section 3.1.8 - SHOW statement checks: -------------------------------------------------------------------------------- diff --git a/mysql-test/suite/funcs_1/r/myisam_storedproc_10.result b/mysql-test/suite/funcs_1/r/myisam_storedproc_10.result index b24e222fc4b..163bae36bed 100644 --- a/mysql-test/suite/funcs_1/r/myisam_storedproc_10.result +++ b/mysql-test/suite/funcs_1/r/myisam_storedproc_10.result @@ -9,20 +9,25 @@ DROP DATABASE IF EXISTS db_storedproc_1; CREATE DATABASE db_storedproc; CREATE DATABASE db_storedproc_1; USE db_storedproc; -create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t1; -create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t2; -create table t3(f1 char(20),f2 char(20),f3 integer) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t3.txt' into table t3; -create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t4; +create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t1; +create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t2; +create table t3(f1 char(20),f2 char(20),f3 integer) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t3.txt' into table t3; +create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t4; USE db_storedproc_1; -create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t6; +create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t6; USE db_storedproc; -create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t7; +create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t7; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -34,8 +39,9 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t8; +create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t7.txt' into table t8; Warnings: Warning 1265 Data truncated for column 'f3' at row 1 Warning 1265 Data truncated for column 'f3' at row 2 @@ -47,12 +53,14 @@ Warning 1265 Data truncated for column 'f3' at row 7 Warning 1265 Data truncated for column 'f3' at row 8 Warning 1265 Data truncated for column 'f3' at row 9 Warning 1265 Data truncated for column 'f3' at row 10 -create table t9(f1 int, f2 char(25), f3 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' into table t9; -create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t10; -create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t11; +create table t9(f1 int, f2 char(25), f3 int) engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t9.txt' into table t9; +create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t10; +create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = <engine_to_be_tested>; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t4.txt' into table t11; Section 3.1.10 - CALL checks: -------------------------------------------------------------------------------- @@ -78,7 +86,7 @@ connect(localhost,user_1,,db_storedproc,MYSQL_PORT,MYSQL_SOCK); user_1@localhost db_storedproc CREATE PROCEDURE sp31102 () SQL SECURITY INVOKER BEGIN -SELECT * FROM db_storedproc.t1 LIMIT 1; +SELECT * FROM db_storedproc.t1 WHERE f4=-5000 LIMIT 1; END// CREATE FUNCTION fn31105(n INT) RETURNS INT BEGIN @@ -93,6 +101,8 @@ CALL sp31102(); ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc.sp31102' SELECT fn31105( 9 ); ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc.fn31105' +connection default; +USE db_storedproc; root@localhost db_storedproc CALL sp31102(); @@ -112,6 +122,8 @@ a` a` 1000-01-01 -5000 a` -5000 SELECT fn31105( 9 ); fn31105( 9 ) 81 +connection default; +USE db_storedproc; root@localhost db_storedproc REVOKE EXECUTE ON db_storedproc.* FROM 'user_2'@'localhost'; @@ -129,6 +141,7 @@ CALL sp31102(); ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc.sp31102' SELECT fn31105( 9 ); ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc.fn31105' +USE db_storedproc; root@localhost db_storedproc DROP PROCEDURE sp31102; @@ -176,6 +189,8 @@ DROP PROCEDURE IF EXISTS sp_ins_1; DROP PROCEDURE IF EXISTS sp_ins_3; DROP PROCEDURE IF EXISTS sp_upd; DROP PROCEDURE IF EXISTS sp_ins_upd; +DROP PROCEDURE IF EXISTS sp_del; +DROP PROCEDURE IF EXISTS sp_with_rowcount; CREATE TABLE temp(f1 CHAR(20),f2 CHAR(25),f3 DATE,f4 INT,f5 CHAR(25),f6 INT); INSERT INTO temp SELECT * FROM t10; CREATE PROCEDURE sp_ins_1() @@ -203,49 +218,72 @@ END; SELECT COUNT( f1 ), f1 FROM temp GROUP BY f1; UPDATE temp SET temp.f1 = 'updated_2' WHERE temp.f1 ='qwe' AND temp.f2 = 'abc'; END// +CREATE PROCEDURE sp_del() +BEGIN +DELETE FROM temp WHERE temp.f1 ='qwe' OR temp.f1 = 'updated_2'; +END// +CREATE PROCEDURE sp_with_rowcount() +BEGIN +BEGIN +INSERT INTO temp VALUES ('qwe', 'abc', '1989-11-09', 100, 'uvw', 1000), +('qwe', 'xyz', '1998-03-26', 100, 'uvw', 1000), +('qwe', 'abc', '2000-11-09', 100, 'uvw', 1000), +('qwe', 'xyz', '2005-11-07', 100, 'uvw', 1000); +END; +SELECT row_count() AS 'row_count() after insert'; +SELECT row_count() AS 'row_count() after select row_count()'; +SELECT f1,f2,f3 FROM temp ORDER BY f1,f2,f3; +UPDATE temp SET temp.f1 = 'updated_2' WHERE temp.f2 = 'abc'; +SELECT row_count() AS 'row_count() after update'; +SELECT f1,f2,f3 FROM temp ORDER BY f1,f2,f3; +DELETE FROM temp WHERE temp.f1 = 'updated_2'; +SELECT row_count() AS 'row_count() after delete'; +END// CALL sp_ins_1(); SELECT row_count(); row_count() 1 SELECT * FROM temp; f1 f2 f3 f4 f5 f6 +a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 +a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991 a` a` 1000-01-01 -5000 a` -5000 aaa aaa 1000-01-02 -4999 aaa -4999 abaa abaa 1000-01-03 -4998 abaa -4998 +abc abc 2005-10-03 100 uvw 1000 acaaa acaaa 1000-01-04 -4997 acaaa -4997 adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996 aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995 afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994 agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993 -a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 -a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991 -abc abc 2005-10-03 100 uvw 1000 CALL sp_ins_3(); SELECT row_count(); row_count() 1 SELECT * FROM temp; f1 f2 f3 f4 f5 f6 +a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 +a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991 a` a` 1000-01-01 -5000 a` -5000 aaa aaa 1000-01-02 -4999 aaa -4999 abaa abaa 1000-01-03 -4998 abaa -4998 +abc abc 2005-10-03 100 uvw 1000 +abc xyz 1949-05-23 100 uvw 1000 +abc xyz 1989-11-09 100 uvw 1000 +abc xyz 2005-10-24 100 uvw 1000 acaaa acaaa 1000-01-04 -4997 acaaa -4997 adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996 aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995 afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994 agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993 -a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 -a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991 -abc abc 2005-10-03 100 uvw 1000 -abc xyz 1949-05-23 100 uvw 1000 -abc xyz 1989-11-09 100 uvw 1000 -abc xyz 2005-10-24 100 uvw 1000 CALL sp_upd(); SELECT row_count(); row_count() 4 SELECT * FROM temp; f1 f2 f3 f4 f5 f6 +a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 +a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991 a` a` 1000-01-01 -5000 a` -5000 aaa aaa 1000-01-02 -4999 aaa -4999 abaa abaa 1000-01-03 -4998 abaa -4998 @@ -254,8 +292,6 @@ adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996 aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995 afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994 agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993 -a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 -a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991 updated abc 2005-10-03 100 uvw 1000 updated xyz 1949-05-23 100 uvw 1000 updated xyz 1989-11-09 100 uvw 1000 @@ -279,6 +315,8 @@ row_count() 3 SELECT * FROM temp; f1 f2 f3 f4 f5 f6 +a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 +a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991 a` a` 1000-01-01 -5000 a` -5000 aaa aaa 1000-01-02 -4999 aaa -4999 abaa abaa 1000-01-03 -4998 abaa -4998 @@ -287,26 +325,73 @@ adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996 aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995 afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994 agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993 -a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 -a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991 +qwe xyz 1998-03-26 100 uvw 1000 updated abc 2005-10-03 100 uvw 1000 updated xyz 1949-05-23 100 uvw 1000 updated xyz 1989-11-09 100 uvw 1000 updated xyz 2005-10-24 100 uvw 1000 updated_2 abc 1989-11-09 100 uvw 1000 -qwe xyz 1998-03-26 100 uvw 1000 updated_2 abc 2000-11-09 100 uvw 1000 updated_2 abc 2005-11-07 100 uvw 1000 +CALL sp_del(); +SELECT row_count(); +row_count() +4 +SELECT * FROM temp; +f1 f2 f3 f4 f5 f6 +a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 +a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991 +a` a` 1000-01-01 -5000 a` -5000 +aaa aaa 1000-01-02 -4999 aaa -4999 +abaa abaa 1000-01-03 -4998 abaa -4998 +acaaa acaaa 1000-01-04 -4997 acaaa -4997 +adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996 +aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995 +afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994 +agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993 +updated abc 2005-10-03 100 uvw 1000 +updated xyz 1949-05-23 100 uvw 1000 +updated xyz 1989-11-09 100 uvw 1000 +updated xyz 2005-10-24 100 uvw 1000 +DELETE FROM temp; +CALL sp_with_rowcount(); +row_count() after insert +4 +row_count() after select row_count() +-1 +f1 f2 f3 +qwe abc 1989-11-09 +qwe abc 2000-11-09 +qwe xyz 1998-03-26 +qwe xyz 2005-11-07 +row_count() after update +2 +f1 f2 f3 +qwe xyz 1998-03-26 +qwe xyz 2005-11-07 +updated_2 abc 1989-11-09 +updated_2 abc 2000-11-09 +row_count() after delete +2 +SELECT row_count(); +row_count() +-1 +SELECT * FROM temp; +f1 f2 f3 f4 f5 f6 +qwe xyz 1998-03-26 100 uvw 1000 +qwe xyz 2005-11-07 100 uvw 1000 DROP PROCEDURE sp_ins_1; DROP PROCEDURE sp_ins_3; DROP PROCEDURE sp_upd; DROP PROCEDURE sp_ins_upd; +DROP PROCEDURE sp_del; +DROP PROCEDURE sp_with_rowcount; DROP TABLE temp; Testcase 3.1.10.8: ------------------ -Ensure that the mysql_affected_rows() C API function always returns the correct +Ensure that the mysql_affected_rows() C API function always returns the correct number of rows affected by the execution of a stored procedure. -------------------------------------------------------------------------------- diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_0102.result b/mysql-test/suite/funcs_1/r/myisam_trig_0102.result index 08ad956b167..1ada907f9e6 100644 --- a/mysql-test/suite/funcs_1/r/myisam_trig_0102.result +++ b/mysql-test/suite/funcs_1/r/myisam_trig_0102.result @@ -1,96 +1,89 @@ USE test; -drop table if exists tb3 ; +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 = myisam; +f118 char not null DEFAULT 'a', +f119 char binary not null DEFAULT b'101', +f120 char ascii not null DEFAULT b'101', +f121 char(50), +f122 char(50), +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 = <engine_to_be_used>; 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 'MYSQL_TEST_DIR/suite/funcs_1/data/myisam_tb3.txt' into table tb3 ; Testcase: 3.5.1.1: ------------------ use test; -Create trigger trg1_1 BEFORE INSERT +Create trigger trg1_1 BEFORE INSERT on tb3 for each row set @test_before = 2, new.f142 = @test_before; -Create trigger trg1_2 AFTER INSERT +Create trigger trg1_2 AFTER INSERT on tb3 for each row set @test_after = 6; -Create trigger trg1_4 BEFORE UPDATE -on tb3 for each row set @test_before = 27, -new.f142 = @test_before, +Create trigger trg1_4 BEFORE UPDATE +on tb3 for each row set @test_before = 27, +new.f142 = @test_before, new.f122 = 'Before Update Trigger'; -Create trigger trg1_3 AFTER UPDATE +Create trigger trg1_3 AFTER UPDATE on tb3 for each row set @test_after = '15'; -Create trigger trg1_5 BEFORE DELETE on tb3 for each row -select count(*) into @test_before from tb3 as tr_tb3 +Create trigger trg1_5 BEFORE DELETE on tb3 for each row +select count(*) into @test_before from tb3 as tr_tb3 where f121 = 'Test 3.5.1.1'; -Create trigger trg1_6 AFTER DELETE on tb3 for each row -select count(*) into @test_after from tb3 as tr_tb3 +Create trigger trg1_6 AFTER DELETE on tb3 for each row +select count(*) into @test_after from tb3 as tr_tb3 where f121 = 'Test 3.5.1.1'; set @test_before = 1; set @test_after = 5; select @test_before, @test_after; @test_before @test_after 1 5 -Insert into tb3 (f121, f122, f142, f144, f134) +Insert into tb3 (f121, f122, f142, f144, f134) values ('Test 3.5.1.1', 'First Row', @test_before, @test_after, 1); select f121, f122, f142, f144, f134 from tb3 where f121 = 'Test 3.5.1.1'; f121 f122 f142 f144 f134 @@ -103,9 +96,9 @@ set @test_after = 8; select @test_before, @test_after; @test_before @test_after 18 8 -Update tb3 set tb3.f122 = 'Update', -tb3.f142 = @test_before, -tb3.f144 = @test_after +Update tb3 set tb3.f122 = 'Update', +tb3.f142 = @test_before, +tb3.f144 = @test_after where tb3.f121 = 'Test 3.5.1.1'; select f121, f122, f142, f144, f134 from tb3 where f121 = 'Test 3.5.1.1'; f121 f122 f142 f144 f134 @@ -113,7 +106,7 @@ Test 3.5.1.1 Before Update Trigger 27 0000000008 1 select @test_before, @test_after; @test_before @test_after 27 15 -Insert into tb3 (f121, f122, f142, f144, f134) +Insert into tb3 (f121, f122, f142, f144, f134) values ('Test 3.5.1.1', 'Second Row', 5, 6, 2); set @test_before = 0; set @test_after = 0; @@ -141,7 +134,7 @@ delete from tb3 where f121='Test 3.5.1.1'; Testcase: 3.5.1.2: ------------------ -Create trigger trg_1 after insert +Create trigger trg_1 after insert on tb3 for each statement set @x= 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 'statement set @x= 1' at line 2 drop trigger trg_1; @@ -193,8 +186,8 @@ Testcase 3.5.1.7: - need to fix drop table if exists t1; Warnings: Note 1051 Unknown table 't1' -create table t1 (f1 int, f2 char(25),f3 int) engine=myisam; -CREATE TRIGGER trg5_1 BEFORE INSERT on test.t1 +create table t1 (f1 int, f2 char(25),f3 int) engine = <engine_to_be_used>; +CREATE TRIGGER trg5_1 BEFORE INSERT on test.t1 for each row set new.f3 = '14'; CREATE TRIGGER trg_abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ BEFORE UPDATE on test.t1 for each row set new.f3 = '42'; @@ -206,7 +199,7 @@ update t1 set f2='update 3.5.1.7'; select * from t1; f1 f2 f3 NULL update 3.5.1.7 42 -select trigger_name from information_schema.triggers; +select trigger_name from information_schema.triggers order by trigger_name; trigger_name trg5_1 trg_abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWX @@ -226,19 +219,19 @@ CREATE TRIGGER @@view before insert on tb3 for each row set new.f120 = 't'; 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 '@@view before insert on tb3 for each row set new.f120 = 't'' at line 1 CREATE TRIGGER @name before insert on tb3 for each row set new.f120 = 't'; 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 '@name before insert on tb3 for each row set new.f120 = 't'' at line 1 -CREATE TRIGGER tb3.trg6_1 BEFORE INSERT on test.tb3 +CREATE TRIGGER tb3.trg6_1 BEFORE INSERT on test.tb3 for each row set new.f120 ='X'; ERROR HY000: Trigger in wrong schema drop database if exists trig_db; create database trig_db; use trig_db; -create table t1 (f1 integer) engine = myisam; +create table t1 (f1 integer) engine = <engine_to_be_used>; use test; -CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3 +CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3 for each row set @ret_trg6_2 = 5; ERROR 42S02: Table 'trig_db.tb3' doesn't exist use trig_db; -CREATE TRIGGER trg6_3 AFTER INSERT on test.tb3 +CREATE TRIGGER trg6_3 AFTER INSERT on test.tb3 for each row set @ret_trg6_3 = 18; ERROR HY000: Trigger in wrong schema use test; @@ -260,11 +253,11 @@ Testcase 3.5.1.?: ----------------- drop table if exists t1; drop table if exists t2; -create table t1 (f1 char(50), f2 integer) engine = myisam; -create table t2 (f1 char(50), f2 integer) engine = myisam; -create trigger trig before insert on t1 +create table t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>; +create table t2 (f1 char(50), f2 integer) engine = <engine_to_be_used>; +create trigger trig before insert on t1 for each row set new.f1 ='trig t1'; -create trigger trig before update on t2 +create trigger trig before update on t2 for each row set new.f1 ='trig t2'; ERROR HY000: Trigger already exists insert into t1 value ('insert to t1',1); @@ -293,16 +286,16 @@ create database trig_db1; create database trig_db2; create database trig_db3; use trig_db1; -create table t1 (f1 char(50), f2 integer) engine = myisam; -create trigger trig before insert on t1 +create table t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>; +create trigger trig before insert on t1 for each row set new.f1 ='trig1', @test_var1='trig1'; use trig_db2; -create table t2 (f1 char(50), f2 integer) engine = myisam; -create trigger trig before insert on t2 +create table t2 (f1 char(50), f2 integer) engine = <engine_to_be_used>; +create trigger trig before insert on t2 for each row set new.f1 ='trig2', @test_var2='trig2'; use trig_db3; -create table t1 (f1 char(50), f2 integer) engine = myisam; -create trigger trig before insert on t1 +create table t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>; +create trigger trig before insert on t1 for each row set new.f1 ='trig3', @test_var3='trig3'; set @test_var1= '', @test_var2= '', @test_var3= ''; use trig_db1; @@ -313,7 +306,7 @@ insert into trig_db3.t1 (f1,f2) values ('insert to db3 t1 from db1',4); select @test_var1, @test_var2, @test_var3; @test_var1 @test_var2 @test_var3 trig1 trig2 trig3 -select * from t1; +select * from t1 order by f2; f1 f2 trig1 1 trig1 2 @@ -323,7 +316,7 @@ trig2 3 select * from trig_db3.t1; f1 f2 trig3 4 -select * from t1; +select * from t1 order by f2; f1 f2 trig1 1 trig1 2 @@ -339,19 +332,19 @@ drop database if exists trig_db2; create database trig_db1; create database trig_db2; use trig_db1; -create table t1 (f1 char(50), f2 integer) engine = myisam; -create table trig_db2.t1 (f1 char(50), f2 integer) engine = myisam; -create trigger trig1_b before insert on t1 +create table t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>; +create table trig_db2.t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>; +create trigger trig1_b before insert on t1 for each row set @test_var1='trig1_b'; -create trigger trig_db1.trig1_a after insert on t1 +create trigger trig_db1.trig1_a after insert on t1 for each row set @test_var2='trig1_a'; -create trigger trig_db2.trig2 before insert on trig_db2.t1 +create trigger trig_db2.trig2 before insert on trig_db2.t1 for each row set @test_var3='trig2'; select trigger_schema, trigger_name, event_object_table -from information_schema.triggers; +from information_schema.triggers order by trigger_name; trigger_schema trigger_name event_object_table -trig_db1 trig1_b t1 trig_db1 trig1_a t1 +trig_db1 trig1_b t1 trig_db2 trig2 t1 set @test_var1= '', @test_var2= '', @test_var3= ''; insert into t1 (f1,f2) values ('insert to db1 t1 from db1',352); diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_03.result b/mysql-test/suite/funcs_1/r/myisam_trig_03.result index 42e984245e3..0d29724fcb7 100644 --- a/mysql-test/suite/funcs_1/r/myisam_trig_03.result +++ b/mysql-test/suite/funcs_1/r/myisam_trig_03.result @@ -1,77 +1,70 @@ USE test; -drop table if exists tb3 ; +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 = myisam; +f118 char not null DEFAULT 'a', +f119 char binary not null DEFAULT b'101', +f120 char ascii not null DEFAULT b'101', +f121 char(50), +f122 char(50), +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 = <engine_to_be_used>; 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 'MYSQL_TEST_DIR/suite/funcs_1/data/myisam_tb3.txt' into table tb3 ; Testcase 3.5.3: --------------- drop database if exists priv_db; create database priv_db; use priv_db; -create table t1 (f1 char(20)) engine= myisam; +create table t1 (f1 char(20)) engine= <engine_to_be_used>; create User test_noprivs@localhost; set password for test_noprivs@localhost = password('PWD'); create User test_yesprivs@localhost; @@ -106,7 +99,7 @@ set new.f1 = 'trig 3.5.3.2_1-no'; ERROR 42000: Access denied; you need the SUPER privilege for this operation use priv_db; insert into t1 (f1) values ('insert 3.5.3.2-no'); -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no select current_user; @@ -121,15 +114,12 @@ root@localhost use priv_db; insert into t1 (f1) values ('insert 3.5.3.2-yes'); ERROR 42000: UPDATE command denied to user 'test_yesprivs'@'localhost' for column 'f1' in table 't1' -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no grant UPDATE on priv_db.t1 to test_yesprivs@localhost; - -note: once 15166 is fixed a similar case for SELECT needs to be added ---------------------------------------------------------------------- insert into t1 (f1) values ('insert 3.5.3.2-yes'); -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no trig 3.5.3.2_2-yes @@ -141,7 +131,7 @@ drop trigger trg1_2; ERROR 42000: Access denied; you need the SUPER privilege for this operation use priv_db; insert into t1 (f1) values ('insert 3.5.3.6-yes'); -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no trig 3.5.3.2_2-yes @@ -150,12 +140,12 @@ use priv_db; drop trigger trg1_2; use priv_db; insert into t1 (f1) values ('insert 3.5.3.6-no'); -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no drop trigger trg1_2; Testcase 3.5.3.7a: @@ -180,23 +170,22 @@ use priv_db; show grants; Grants for test_noprivs@localhost GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no - -Trigger create disabled - should fail - Bug 8884 ------------------------------------------------- +create trigger trg4a_1 before INSERT on t1 for each row +set new.f1 = 'trig 3.5.3.7-1a'; insert into t1 (f1) values ('insert 3.5.3.7-1a'); -select f1 from t1; +ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no -insert 3.5.3.7-1a drop trigger trg4a_1; use priv_db; select current_user; @@ -207,18 +196,13 @@ Grants for test_yesprivs@localhost GRANT UPDATE, SUPER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' create trigger trg4a_2 before INSERT on t1 for each row set new.f1 = 'trig 3.5.3.7-2a'; - -SELECT priv added to bypass bug 15166 -------------------------------------- -grant SELECT on *.* to test_yesprivs@localhost; insert into t1 (f1) values ('insert 3.5.3.7-2b'); -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no -insert 3.5.3.7-1a trig 3.5.3.7-2a drop trigger trg4a_2; @@ -245,30 +229,29 @@ Grants for test_noprivs@localhost GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE ON `priv_db`.* TO 'test_noprivs'@'localhost' use priv_db; - -Trigger create disabled - should fail - Bug 8884 ------------------------------------------------- +create trigger trg4b_1 before UPDATE on t1 for each row +set new.f1 = 'trig 3.5.3.7-1b'; +ERROR 42000: Access denied; you need the SUPER privilege for this operation insert into t1 (f1) values ('insert 3.5.3.7-1b'); -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no +insert 3.5.3.7-1b trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no -insert 3.5.3.7-1a trig 3.5.3.7-2a -insert 3.5.3.7-1b update t1 set f1 = 'update 3.5.3.7-1b' where f1 = 'insert 3.5.3.7-1b'; -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no -insert 3.5.3.7-1a trig 3.5.3.7-2a update 3.5.3.7-1b drop trigger trg4b_1; +ERROR HY000: Trigger does not exist show grants; Grants for test_yesprivs@localhost GRANT SUPER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' @@ -276,32 +259,26 @@ GRANT UPDATE ON `priv_db`.* TO 'test_yesprivs'@'localhost' use priv_db; create trigger trg4b_2 before UPDATE on t1 for each row set new.f1 = 'trig 3.5.3.7-2b'; - -SELECT priv added to bypass bug 15166 -------------------------------------- -grant SELECT on priv_db.* to test_yesprivs@localhost; insert into t1 (f1) values ('insert 3.5.3.7-2b'); -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no +insert 3.5.3.7-2b trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no -insert 3.5.3.7-1a trig 3.5.3.7-2a update 3.5.3.7-1b -insert 3.5.3.7-2b update t1 set f1 = 'update 3.5.3.7-2b' where f1 = 'insert 3.5.3.7-2b'; -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no -insert 3.5.3.7-1a trig 3.5.3.7-2a -update 3.5.3.7-1b trig 3.5.3.7-2b +update 3.5.3.7-1b drop trigger trg4b_2; Testcase 3.5.3.7c @@ -327,21 +304,19 @@ Grants for test_noprivs@localhost GRANT SUPER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW ON `priv_db`.`t1` TO 'test_noprivs'@'localhost' use priv_db; - -Trigger create disabled - should fail - Bug 8884 ------------------------------------------------- +create trigger trg4c_1 before INSERT on t1 for each row +set new.f1 = 'trig 3.5.3.7-1c'; insert into t1 (f1) values ('insert 3.5.3.7-1c'); -select f1 from t1; +ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no -insert 3.5.3.7-1a trig 3.5.3.7-2a -update 3.5.3.7-1b trig 3.5.3.7-2b -insert 3.5.3.7-1c +update 3.5.3.7-1b drop trigger trg4c_1; show grants; Grants for test_yesprivs@localhost @@ -350,23 +325,17 @@ GRANT UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' use priv_db; create trigger trg4c_2 before INSERT on t1 for each row set new.f1 = 'trig 3.5.3.7-2c'; - -SELECT priv added to bypass bug 15166 -------------------------------------- -grant SELECT on priv_db.t1 to test_yesprivs@localhost; insert into t1 (f1) values ('insert 3.5.3.7-2c'); -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no -insert 3.5.3.7-1a trig 3.5.3.7-2a -update 3.5.3.7-1b trig 3.5.3.7-2b -insert 3.5.3.7-1c trig 3.5.3.7-2c +update 3.5.3.7-1b drop trigger trg4c_2; Testcase 3.5.3.7d: @@ -390,23 +359,20 @@ Grants for test_noprivs@localhost GRANT SUPER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT SELECT (f1), INSERT (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost' use priv_db; - -Trigger create disabled - should fail - Bug 8884 ------------------------------------------------- +create trigger trg4d_1 before INSERT on t1 for each row +set new.f1 = 'trig 3.5.3.7-1d'; insert into t1 (f1) values ('insert 3.5.3.7-1d'); -select f1 from t1; +ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no -insert 3.5.3.7-1a trig 3.5.3.7-2a -update 3.5.3.7-1b trig 3.5.3.7-2b -insert 3.5.3.7-1c trig 3.5.3.7-2c -insert 3.5.3.7-1d +update 3.5.3.7-1b drop trigger trg4d_1; show grants; Grants for test_yesprivs@localhost @@ -415,25 +381,18 @@ GRANT UPDATE (f1) ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' use priv_db; create trigger trg4d_2 before INSERT on t1 for each row set new.f1 = 'trig 3.5.3.7-2d'; - -SELECT priv added to bypass bug 15166 -------------------------------------- -grant SELECT (f1) on priv_db.t1 to test_yesprivs@localhost; insert into t1 (f1) values ('insert 3.5.3.7-2d'); -select f1 from t1; +select f1 from t1 order by f1; f1 insert 3.5.3.2-no +insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes -insert 3.5.3.6-no -insert 3.5.3.7-1a trig 3.5.3.7-2a -update 3.5.3.7-1b trig 3.5.3.7-2b -insert 3.5.3.7-1c trig 3.5.3.7-2c -insert 3.5.3.7-1d trig 3.5.3.7-2d +update 3.5.3.7-1b drop trigger trg4d_2; Testcase 3.5.3.8a: @@ -458,14 +417,14 @@ use priv_db; show grants; Grants for test_noprivs@localhost GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' - -Trigger create disabled - should fail - Bug 8887 ------------------------------------------------- +create trigger trg5a_1 before INSERT on t1 for each row +set @test_var = new.f1; set @test_var = 'before trig 3.5.3.8-1a'; select @test_var; @test_var before trig 3.5.3.8-1a insert into t1 (f1) values ('insert 3.5.3.8-1a'); +ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' select @test_var; @test_var before trig 3.5.3.8-1a @@ -483,10 +442,6 @@ set @test_var= 'before trig 3.5.3.8-2a'; select @test_var; @test_var before trig 3.5.3.8-2a - -UPDATE priv added to bypass bug 15166 -------------------------------------- -grant UPDATE on *.* to test_yesprivs@localhost; insert into t1 (f1) values ('insert 3.5.3.8-2a'); select @test_var; @test_var @@ -517,15 +472,15 @@ Grants for test_noprivs@localhost GRANT SUPER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE ON `priv_db`.* TO 'test_noprivs'@'localhost' use priv_db; - -Trigger create disabled - should fail - Bug 8887 ------------------------------------------------- +create trigger trg5b_1 before UPDATE on t1 for each row +set @test_var= new.f1; set @test_var= 'before trig 3.5.3.8-1b'; insert into t1 (f1) values ('insert 3.5.3.8-1b'); select @test_var; @test_var before trig 3.5.3.8-1b update t1 set f1= 'update 3.5.3.8-1b' where f1 = 'insert 3.5.3.8-1b'; +ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' select @test_var; @test_var before trig 3.5.3.8-1b @@ -542,10 +497,6 @@ insert into t1 (f1) values ('insert 3.5.3.8-2b'); select @test_var; @test_var before trig 3.5.3.8-2b - -UPDATE priv added to bypass bug 15166 -------------------------------------- -grant UPDATE on priv_db.* to test_yesprivs@localhost; update t1 set f1= 'update 3.5.3.8-2b' where f1 = 'insert 3.5.3.8-2b'; select @test_var; @test_var @@ -576,11 +527,11 @@ Grants for test_noprivs@localhost GRANT SUPER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW ON `priv_db`.`t1` TO 'test_noprivs'@'localhost' use priv_db; - -Trigger create disabled - should fail - Bug 8887 ------------------------------------------------- +create trigger trg5c_1 before INSERT on t1 for each row +set @test_var= new.f1; set @test_var= 'before trig 3.5.3.8-1c'; insert into t1 (f1) values ('insert 3.5.3.8-1c'); +ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' select @test_var; @test_var before trig 3.5.3.8-1c @@ -593,10 +544,6 @@ use priv_db; create trigger trg5c_2 before INSERT on t1 for each row set @test_var= new.f1; set @test_var='before trig 3.5.3.8-2c'; - -UPDATE priv added to bypass bug 15166 -------------------------------------- -grant UPDATE on priv_db.t1 to test_yesprivs@localhost; insert into t1 (f1) values ('insert 3.5.3.8-2c'); select @test_var; @test_var @@ -626,11 +573,11 @@ Grants for test_noprivs@localhost GRANT SUPER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost' use priv_db; - -Trigger create disabled - should fail - Bug 8887 ------------------------------------------------- +create trigger trg5d_1 before INSERT on t1 for each row +set @test_var= new.f1; set @test_var='before trig 3.5.3.8-1d'; insert into t1 (f1) values ('insert 3.5.3.8-1d'); +ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' select @test_var; @test_var before trig 3.5.3.8-1d @@ -643,10 +590,6 @@ use priv_db; create trigger trg5d_2 before INSERT on t1 for each row set @test_var= new.f1; set @test_var='before trig 3.5.3.8-2d'; - -UPDATE priv added to bypass bug 15166 -------------------------------------- -grant UPDATE (f1) on priv_db.t1 to test_yesprivs@localhost; insert into t1 (f1) values ('insert 3.5.3.8-2d'); select @test_var; @test_var @@ -658,8 +601,8 @@ Testcase: 3.5.3.x: use priv_db; drop table if exists t1; drop table if exists t2; -create table t1 (f1 int) engine= myisam; -create table t2 (f2 int) engine= myisam; +create table t1 (f1 int) engine= <engine_to_be_used>; +create table t2 (f2 int) engine= <engine_to_be_used>; revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; grant SUPER on *.* to test_yesprivs@localhost; grant SELECT, UPDATE on priv_db.t1 to test_yesprivs@localhost; @@ -682,10 +625,10 @@ ERROR 42000: INSERT command denied to user 'test_yesprivs'@'localhost' for table revoke SELECT on priv_db.t2 from test_yesprivs@localhost; grant INSERT on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (4); -select f1 from t1; +select f1 from t1 order by f1; f1 4 -select f2 from t2; +select f2 from t2 order by f2; f2 4 use priv_db; @@ -698,11 +641,11 @@ ERROR 42000: UPDATE command denied to user 'test_yesprivs'@'localhost' for table revoke INSERT on priv_db.t2 from test_yesprivs@localhost; grant UPDATE on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (2); -select f1 from t1; +select f1 from t1 order by f1; f1 -4 2 -select f2 from t2; +4 +select f2 from t2 order by f2; f2 1 use priv_db; @@ -715,12 +658,12 @@ ERROR 42000: SELECT command denied to user 'test_yesprivs'@'localhost' for table revoke UPDATE on priv_db.t2 from test_yesprivs@localhost; grant SELECT on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (1); -select f1 from t1; +select f1 from t1 order by f1; f1 -4 -2 1 -select f2 from t2; +2 +4 +select f2 from t2 order by f2; f2 1 select @aaa; @@ -736,16 +679,17 @@ ERROR 42000: DELETE command denied to user 'test_yesprivs'@'localhost' for table revoke SELECT on priv_db.t2 from test_yesprivs@localhost; grant DELETE on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (1); -select f1 from t1; +select f1 from t1 order by f1; f1 -4 -2 1 1 -select f2 from t2; +2 +4 +select f2 from t2 order by f2; f2 drop database if exists priv_db; drop user test_yesprivs@localhost; drop user test_noprivs@localhost; drop user test_noprivs; -DROP TABLE test.tb3; +use test; +drop table tb3; diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_0407.result b/mysql-test/suite/funcs_1/r/myisam_trig_0407.result index 4e578888fe5..a4871065c04 100644 --- a/mysql-test/suite/funcs_1/r/myisam_trig_0407.result +++ b/mysql-test/suite/funcs_1/r/myisam_trig_0407.result @@ -1,70 +1,63 @@ USE test; -drop table if exists tb3 ; +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 = myisam; +f118 char not null DEFAULT 'a', +f119 char binary not null DEFAULT b'101', +f120 char ascii not null DEFAULT b'101', +f121 char(50), +f122 char(50), +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 = <engine_to_be_used>; 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 'MYSQL_TEST_DIR/suite/funcs_1/data/myisam_tb3.txt' into table tb3 ; Testcase: 3.5: -------------- @@ -85,25 +78,25 @@ Testcase 3.5.4.1: ----------------- create database db_drop; Use db_drop; -create table t1 (f1 char(30)) engine=myisam; +create table t1 (f1 char(30)) engine = <engine_to_be_used>; grant INSERT, SELECT on db_drop.t1 to test_general; Use db_drop; -Create trigger trg1 BEFORE INSERT on t1 +Create trigger trg1 BEFORE INSERT on t1 for each row set new.f1='Trigger 3.5.4.1'; Use db_drop; Insert into t1 values ('Insert error 3.5.4.1'); -Select * from t1; +Select * from t1 order by f1; f1 Trigger 3.5.4.1 drop trigger trg1; select trigger_schema, trigger_name, event_object_table -from information_schema.triggers; +from information_schema.triggers order by trigger_name; trigger_schema trigger_name event_object_table Insert into t1 values ('Insert no trigger 3.5.4.1'); -Select * from t1; +Select * from t1 order by f1; f1 -Trigger 3.5.4.1 Insert no trigger 3.5.4.1 +Trigger 3.5.4.1 drop trigger trg1; drop database if exists db_drop; revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost'; @@ -113,7 +106,7 @@ Testcase 3.5.4.2: create database db_drop2; Use db_drop2; drop table if exists t1_432 ; -create table t1_432 (f1 char (30)) engine=myisam; +create table t1_432 (f1 char (30)) engine = <engine_to_be_used>; Drop trigger tr_does_not_exit; ERROR HY000: Trigger does not exist drop table if exists t1_432 ; @@ -125,9 +118,9 @@ create database db_drop3; Use db_drop3; drop table if exists t1_433 ; drop table if exists t1_433a ; -create table t1_433 (f1 char (30)) engine=myisam; -create table t1_433a (f1a char (5)) engine=myisam; -CREATE TRIGGER trg3 BEFORE INSERT on t1_433 for each row +create table t1_433 (f1 char (30)) engine = <engine_to_be_used>; +create table t1_433a (f1a char (5)) engine = <engine_to_be_used>; +CREATE TRIGGER trg3 BEFORE INSERT on t1_433 for each row set new.f1 = 'Trigger 3.5.4.3'; Drop trigger t1.433.trg3; 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 '.trg3' at line 1 @@ -146,9 +139,9 @@ Testcase 3.5.4.4: ----------------- create database db_drop4; Use db_drop4; -create table t1 (f1 char(30)) engine=myisam; +create table t1 (f1 char(30)) engine = <engine_to_be_used>; grant INSERT, SELECT on db_drop4.t1 to test_general; -Create trigger trg4 BEFORE INSERT on t1 +Create trigger trg4 BEFORE INSERT on t1 for each row set new.f1='Trigger 3.5.4.4'; Use db_drop4; Insert into t1 values ('Insert 3.5.4.4'); @@ -167,7 +160,7 @@ where information_schema.triggers.trigger_name='trg4'; trigger_schema trigger_name event_object_table create database db_drop4; Use db_drop4; -create table t1 (f1 char(30)) engine=myisam; +create table t1 (f1 char(30)) engine = <engine_to_be_used>; grant INSERT, SELECT on db_drop4.t1 to test_general; Insert into t1 values ('2nd Insert 3.5.4.4'); Select * from t1; @@ -182,9 +175,9 @@ Testcase 3.5.4.5: ----------------- create database db_drop5; Use db_drop5; -create table t1 (f1 char(50)) engine=myisam; +create table t1 (f1 char(50)) engine = <engine_to_be_used>; grant INSERT, SELECT on t1 to test_general; -Create trigger trg5 BEFORE INSERT on t1 +Create trigger trg5 BEFORE INSERT on t1 for each row set new.f1='Trigger 3.5.4.5'; Use db_drop5; Insert into t1 values ('Insert 3.5.4.5'); @@ -198,7 +191,7 @@ select trigger_schema, trigger_name, event_object_table from information_schema.triggers where information_schema.triggers.trigger_name='trg5'; trigger_schema trigger_name event_object_table -create table t1 (f1 char(50)) engine=myisam; +create table t1 (f1 char(50)) engine = <engine_to_be_used>; grant INSERT, SELECT on t1 to test_general; Insert into t1 values ('2nd Insert 3.5.4.5'); Select * from t1; @@ -221,7 +214,7 @@ ERROR 42S02: Table 'test.t100' doesn't exist Testcase 3.5.5.2: ----------------- Create temporary table t1_temp (f1 bigint signed, f2 bigint unsigned); -Create trigger trg2 before INSERT +Create trigger trg2 before INSERT on t1_temp for each row set new.f2=9999; ERROR HY000: Trigger's 't1_temp' is view or temporary table drop table t1_temp; @@ -229,7 +222,7 @@ drop table t1_temp; Testcase 3.5.5.3: ----------------- Create view vw3 as select f118 from tb3; -Create trigger trg3 before INSERT +Create trigger trg3 before INSERT on vw3 for each row set new.f118='s'; ERROR HY000: 'test.vw3' is not BASE TABLE drop view vw3; @@ -239,7 +232,7 @@ Testcase 3.5.5.4: create database dbtest_one; create database dbtest_two; use dbtest_two; -create table t2 (f1 char(15)) engine=myisam; +create table t2 (f1 char(15)) engine = <engine_to_be_used>; use dbtest_one; create trigger trg4 before INSERT on dbtest_two.t2 for each row set new.f1='trig 3.5.5.4'; @@ -257,7 +250,7 @@ use dbtest_one; Insert into dbtest_two.t2 values ('2nd Insert 3.5.5.4'); Warnings: Warning 1265 Data truncated for column 'f1' at row 1 -Select * from dbtest_two.t2; +Select * from dbtest_two.t2 order by f1; f1 1st Insert 3.5. 2nd Insert 3.5. @@ -310,9 +303,9 @@ drop trigger tb3.trg4_2; Testcase 3.5.7.5 / 3.5.7.6: --------------------------- -Create trigger trg5_1 BEFORE INSERT +Create trigger trg5_1 BEFORE INSERT on tb3 for each row set new.f122='Trigger1 3.5.7.5/6'; -Create trigger trg5_2 BEFORE INSERT +Create trigger trg5_2 BEFORE INSERT on tb3 for each row set new.f122='Trigger2 3.5.7.5'; ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table' Insert into tb3 (f121,f122) values ('Test 3.5.7.5/6','Insert 3.5.7.5'); @@ -330,9 +323,9 @@ delete from tb3 where f121='Test 3.5.7.5/6'; Testcase 3.5.7.7 / 3.5.7.8: --------------------------- set @test_var='Before trig 3.5.7.7'; -Create trigger trg6_1 AFTER INSERT +Create trigger trg6_1 AFTER INSERT on tb3 for each row set @test_var='Trigger1 3.5.7.7/8'; -Create trigger trg6_2 AFTER INSERT +Create trigger trg6_2 AFTER INSERT on tb3 for each row set @test_var='Trigger2 3.5.7.7'; ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table' select @test_var; @@ -358,9 +351,9 @@ delete from tb3 where f121='Test 3.5.7.7/8'; Testcase 3.5.7.9/10: -------------------- -Create trigger trg7_1 BEFORE UPDATE +Create trigger trg7_1 BEFORE UPDATE on tb3 for each row set new.f122='Trigger1 3.5.7.9/10'; -Create trigger trg7_2 BEFORE UPDATE +Create trigger trg7_2 BEFORE UPDATE on tb3 for each row set new.f122='Trigger2 3.5.7.9'; ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table' Insert into tb3 (f121,f122) values ('Test 3.5.7.9/10','Insert 3.5.7.9'); @@ -378,9 +371,9 @@ delete from tb3 where f121='Test 3.5.7.9/10'; Testcase 3.5.7.11/12: --------------------- set @test_var='Before trig 3.5.7.11'; -Create trigger trg8_1 AFTER UPDATE +Create trigger trg8_1 AFTER UPDATE on tb3 for each row set @test_var='Trigger 3.5.7.11/12'; -Create trigger trg8_2 AFTER UPDATE +Create trigger trg8_2 AFTER UPDATE on tb3 for each row set @test_var='Trigger2 3.5.7.11'; ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table' select @test_var; @@ -408,9 +401,9 @@ delete from tb3 where f121='Test 3.5.7.11/12'; Testcase 3.5.7.13/14: --------------------- set @test_var=1; -Create trigger trg9_1 BEFORE DELETE +Create trigger trg9_1 BEFORE DELETE on tb3 for each row set @test_var=@test_var+1; -Create trigger trg9_2 BEFORE DELETE +Create trigger trg9_2 BEFORE DELETE on tb3 for each row set @test_var=@test_var+10; ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table' select @test_var; @@ -440,12 +433,12 @@ delete from tb3 where f121='Test 3.5.7.13/14'; Testcase 3.5.7.15/16: --------------------- set @test_var=1; -Create trigger trg_3_406010_1 AFTER DELETE +Create trigger trg_3_406010_1 AFTER DELETE on tb3 for each row set @test_var=@test_var+5; -Create trigger trg_3_406010_2 AFTER DELETE +Create trigger trg_3_406010_2 AFTER DELETE on tb3 for each row set @test_var=@test_var+50; ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table' -Create trigger trg_3_406010_1 AFTER INSERT +Create trigger trg_3_406010_1 AFTER INSERT on tb3 for each row set @test_var=@test_var+1; ERROR HY000: Trigger already exists select @test_var; diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_08.result b/mysql-test/suite/funcs_1/r/myisam_trig_08.result index bab8d0f2ddd..6ced07cef73 100644 --- a/mysql-test/suite/funcs_1/r/myisam_trig_08.result +++ b/mysql-test/suite/funcs_1/r/myisam_trig_08.result @@ -1,70 +1,63 @@ USE test; -drop table if exists tb3 ; +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 = myisam; +f118 char not null DEFAULT 'a', +f119 char binary not null DEFAULT b'101', +f120 char ascii not null DEFAULT b'101', +f121 char(50), +f122 char(50), +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 = <engine_to_be_used>; 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 'MYSQL_TEST_DIR/suite/funcs_1/data/myisam_tb3.txt' into table tb3 ; Testcase: 3.5: -------------- @@ -89,21 +82,21 @@ create database db_test; grant SELECT, INSERT, UPDATE, DELETE on db_test.* to test_general; grant LOCK TABLES on db_test.* to test_general; Use db_test; -create table t1_i ( +create table t1_i ( i120 char ascii not null DEFAULT b'101', i136 smallint zerofill not null DEFAULT 999, i144 int zerofill not null DEFAULT 99999, -i163 decimal (63,30)) engine=myisam; -create table t1_u ( +i163 decimal (63,30)) engine=<engine_to_be_used>; +create table t1_u ( u120 char ascii not null DEFAULT b'101', u136 smallint zerofill not null DEFAULT 999, u144 int zerofill not null DEFAULT 99999, -u163 decimal (63,30)) engine=myisam; -create table t1_d ( +u163 decimal (63,30)) engine=<engine_to_be_used>; +create table t1_d ( d120 char ascii not null DEFAULT b'101', d136 smallint zerofill not null DEFAULT 999, d144 int zerofill not null DEFAULT 99999, -d163 decimal (63,30)) engine=myisam; +d163 decimal (63,30)) engine=<engine_to_be_used>; Insert into t1_u values ('a',111,99999,999.99); Insert into t1_u values ('b',222,99999,999.99); Insert into t1_u values ('c',333,99999,999.99); @@ -122,18 +115,18 @@ Insert into t1_d values ('f',222,99999,999.99); use test; Create trigger trg1 AFTER INSERT on tb3 for each row BEGIN -insert into db_test.t1_i +insert into db_test.t1_i values (new.f120, new.f136, new.f144, new.f163); -update db_test.t1_u +update db_test.t1_u set u144=new.f144, u163=new.f163 -where u136=new.f136; +where u136=new.f136; delete from db_test.t1_d where d136= new.f136; -select sum(db_test.t1_u.u163) into @test_var from db_test.t1_u -where u136= new.f136; +select sum(db_test.t1_u.u163) into @test_var from db_test.t1_u +where u136= new.f136; END// Use test; set @test_var=0; -Insert into tb3 (f120, f122, f136, f144, f163) +Insert into tb3 (f120, f122, f136, f144, f163) values ('1', 'Test 3.5.8.4', 222, 23456, 1.05); Select f120, f122, f136, f144, f163 from tb3 where f122= 'Test 3.5.8.4'; f120 f122 f136 f144 f163 @@ -161,14 +154,22 @@ select @test_var; 3.5.8.4 - single SQL - insert ----------------------------- Create trigger trg2 BEFORE UPDATE on tb3 for each row -insert into db_test.t1_i +BEGIN +insert into db_test.t1_i values (new.f120, new.f136, new.f144, new.f163); +END// +Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; +f120 f122 f136 f144 f163 +1 Test 3.5.8.4 00222 0000023456 1.050000000000000000000000000000 +select * from db_test.t1_i order by i120; +i120 i136 i144 i163 +1 00222 0000023456 1.050000000000000000000000000000 update tb3 set f120='I', f122='Test 3.5.8.4-Single Insert' where f122='Test 3.5.8.4'; Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; f120 f122 f136 f144 f163 I Test 3.5.8.4-Single Insert 00222 0000023456 1.050000000000000000000000000000 -select * from db_test.t1_i; +select * from db_test.t1_i order by i120; i120 i136 i144 i163 1 00222 0000023456 1.050000000000000000000000000000 I 00222 0000023456 1.050000000000000000000000000000 @@ -177,7 +178,7 @@ I 00222 0000023456 1.050000000000000000000000000000 ----------------------------- drop trigger trg2; Create trigger trg3 BEFORE UPDATE on tb3 for each row -update db_test.t1_u +update db_test.t1_u set u120=new.f120 where u136=new.f136; update tb3 set f120='U', f122='Test 3.5.8.4-Single Update' @@ -185,27 +186,27 @@ update tb3 set f120='U', f122='Test 3.5.8.4-Single Update' Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; f120 f122 f136 f144 f163 U Test 3.5.8.4-Single Update 00222 0000023456 1.050000000000000000000000000000 -select * from db_test.t1_u; +select * from db_test.t1_u order by u120; u120 u136 u144 u163 a 00111 0000099999 999.990000000000000000000000000000 -U 00222 0000023456 1.050000000000000000000000000000 c 00333 0000099999 999.990000000000000000000000000000 +f 00333 0000099999 999.990000000000000000000000000000 +U 00222 0000023456 1.050000000000000000000000000000 U 00222 0000023456 1.050000000000000000000000000000 U 00222 0000023456 1.050000000000000000000000000000 -f 00333 0000099999 999.990000000000000000000000000000 3.5.8.3/4 - single SQL - delete ------------------------------- drop trigger trg3; Create trigger trg4 AFTER UPDATE on tb3 for each row delete from db_test.t1_d where d136= new.f136; -update tb3 set f120='D', f136=444, +update tb3 set f120='D', f136=444, f122='Test 3.5.8.4-Single Delete' where f122='Test 3.5.8.4-Single Update'; Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; f120 f122 f136 f144 f163 D Test 3.5.8.4-Single Delete 00444 0000023456 1.050000000000000000000000000000 -select * from db_test.t1_d; +select * from db_test.t1_d order by d120; d120 d136 d144 d163 a 00111 0000099999 999.990000000000000000000000000000 c 00333 0000099999 999.990000000000000000000000000000 @@ -214,10 +215,10 @@ c 00333 0000099999 999.990000000000000000000000000000 ------------------------------- drop trigger trg4; Create trigger trg5 AFTER UPDATE on tb3 for each row -select sum(db_test.t1_u.u163) into @test_var from db_test.t1_u +select sum(db_test.t1_u.u163) into @test_var from db_test.t1_u where u136= new.f136; set @test_var=0; -update tb3 set f120='S', f136=111, +update tb3 set f120='S', f136=111, f122='Test 3.5.8.4-Single Select' where f122='Test 3.5.8.4-Single Delete'; Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; @@ -245,36 +246,36 @@ set @test_var='three', new.f120='4'; END IF; IF (new.f120='4') and (new.f136=10) then set @test_var2='2nd if', new.f120='d'; -ELSE +ELSE set @test_var2='2nd else', new.f120='D'; END IF; END// set @test_var='Empty', @test_var2=0; Insert into tb3 (f120, f122, f136) values ('1', 'Test 3.5.8.5-if', 101); -select f120, f122, f136, @test_var, @test_var2 -from tb3 where f122 = 'Test 3.5.8.5-if'; +select f120, f122, f136, @test_var, @test_var2 +from tb3 where f122 = 'Test 3.5.8.5-if' order by f136; f120 f122 f136 @test_var @test_var2 D Test 3.5.8.5-if 00101 one 2nd else Insert into tb3 (f120, f122, f136) values ('2', 'Test 3.5.8.5-if', 102); -select f120, f122, f136, @test_var, @test_var2 -from tb3 where f122 = 'Test 3.5.8.5-if'; +select f120, f122, f136, @test_var, @test_var2 +from tb3 where f122 = 'Test 3.5.8.5-if' order by f136; f120 f122 f136 @test_var @test_var2 D Test 3.5.8.5-if 00101 two 2nd else D Test 3.5.8.5-if 00102 two 2nd else Insert into tb3 (f120, f122, f136) values ('3', 'Test 3.5.8.5-if', 10); -select f120, f122, f136, @test_var, @test_var2 -from tb3 where f122 = 'Test 3.5.8.5-if'; +select f120, f122, f136, @test_var, @test_var2 +from tb3 where f122 = 'Test 3.5.8.5-if' order by f136; f120 f122 f136 @test_var @test_var2 +d Test 3.5.8.5-if 00010 three 2nd if D Test 3.5.8.5-if 00101 three 2nd if D Test 3.5.8.5-if 00102 three 2nd if -d Test 3.5.8.5-if 00010 three 2nd if Insert into tb3 (f120, f122, f136) values ('3', 'Test 3.5.8.5-if', 103); -select f120, f122, f136, @test_var, @test_var2 -from tb3 where f122 = 'Test 3.5.8.5-if'; +select f120, f122, f136, @test_var, @test_var2 +from tb3 where f122 = 'Test 3.5.8.5-if' order by f136; f120 f122 f136 @test_var @test_var2 +d Test 3.5.8.5-if 00010 three 2nd else D Test 3.5.8.5-if 00101 three 2nd else D Test 3.5.8.5-if 00102 three 2nd else -d Test 3.5.8.5-if 00010 three 2nd else D Test 3.5.8.5-if 00103 three 2nd else create trigger trg3 before update on tb3 for each row BEGIN @@ -289,7 +290,7 @@ create trigger trg4 before update on tb3 for each row BEGIN IF (new.f120='4') and (new.f136=10) then set @test_var2='2nd if', new.f120='d'; -ELSE +ELSE set @test_var2='2nd else', new.f120='D'; 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 '' at line 7 @@ -331,60 +332,60 @@ ELSE set @test_var=CONCAT(new.f120, '*', new.f144); END case; END// set @test_var='Empty'; -Insert into tb3 (f120, f122, f136, f144) +Insert into tb3 (f120, f122, f136, f144) values ('a', 'Test 3.5.8.5-case', 5, 7); -select f120, f122, f136, f144, @test_var -from tb3 where f122 = 'Test 3.5.8.5-case'; +select f120, f122, f136, f144, @test_var +from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136; f120 f122 f136 f144 @test_var A Test 3.5.8.5-case 00125 0000000007 A*seven -Insert into tb3 (f120, f122, f136, f144) +Insert into tb3 (f120, f122, f136, f144) values ('b', 'Test 3.5.8.5-case', 71,16); -select f120, f122, f136, f144, @test_var -from tb3 where f122 = 'Test 3.5.8.5-case'; +select f120, f122, f136, f144, @test_var +from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136; f120 f122 f136 f144 @test_var A Test 3.5.8.5-case 00125 0000000007 B*0000000016 B Test 3.5.8.5-case 00191 0000000016 B*0000000016 -Insert into tb3 (f120, f122, f136, f144) +Insert into tb3 (f120, f122, f136, f144) values ('c', 'Test 3.5.8.5-case', 80,1); -select f120, f122, f136, f144, @test_var -from tb3 where f122 = 'Test 3.5.8.5-case'; +select f120, f122, f136, f144, @test_var +from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136; f120 f122 f136 f144 @test_var A Test 3.5.8.5-case 00125 0000000007 C=one B Test 3.5.8.5-case 00191 0000000016 C=one C Test 3.5.8.5-case 00200 0000000001 C=one -Insert into tb3 (f120, f122, f136) +Insert into tb3 (f120, f122, f136) values ('d', 'Test 3.5.8.5-case', 152); Warnings: Warning 1265 Data truncated for column 'f120' at row 1 -select f120, f122, f136, f144, @test_var -from tb3 where f122 = 'Test 3.5.8.5-case'; +select f120, f122, f136, f144, @test_var +from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136; f120 f122 f136 f144 @test_var +1 Test 3.5.8.5-case 00152 0000099999 1*0000099999 A Test 3.5.8.5-case 00125 0000000007 1*0000099999 B Test 3.5.8.5-case 00191 0000000016 1*0000099999 C Test 3.5.8.5-case 00200 0000000001 1*0000099999 -1 Test 3.5.8.5-case 00152 0000099999 1*0000099999 -Insert into tb3 (f120, f122, f136, f144) +Insert into tb3 (f120, f122, f136, f144) values ('e', 'Test 3.5.8.5-case', 200, 8); Warnings: Warning 1265 Data truncated for column 'f120' at row 1 -select f120, f122, f136, f144, @test_var -from tb3 where f122 = 'Test 3.5.8.5-case'; +select f120, f122, f136, f144, @test_var +from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136; f120 f122 f136 f144 @test_var +1 Test 3.5.8.5-case 00152 0000099999 1=eight +1 Test 3.5.8.5-case 00200 0000000008 1=eight A Test 3.5.8.5-case 00125 0000000007 1=eight B Test 3.5.8.5-case 00191 0000000016 1=eight C Test 3.5.8.5-case 00200 0000000001 1=eight -1 Test 3.5.8.5-case 00152 0000099999 1=eight -1 Test 3.5.8.5-case 00200 0000000008 1=eight -Insert into tb3 (f120, f122, f136, f144) +Insert into tb3 (f120, f122, f136, f144) values ('f', 'Test 3.5.8.5-case', 100, 8); -select f120, f122, f136, f144, @test_var -from tb3 where f122 = 'Test 3.5.8.5-case'; +select f120, f122, f136, f144, @test_var +from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136; f120 f122 f136 f144 @test_var +1 Test 3.5.8.5-case 00152 0000099999 1=eight +1 Test 3.5.8.5-case 00200 0000000008 1=eight A Test 3.5.8.5-case 00125 0000000007 1=eight B Test 3.5.8.5-case 00191 0000000016 1=eight C Test 3.5.8.5-case 00200 0000000001 1=eight -1 Test 3.5.8.5-case 00152 0000099999 1=eight -1 Test 3.5.8.5-case 00200 0000000008 1=eight create trigger trg3a before update on tb3 for each row BEGIN CASE @@ -398,40 +399,40 @@ delete from tb3 where f121='Test 3.5.8.5-case'; Testcase 3.5.8.5-loop/leave: ---------------------------- Create trigger trg4 after insert on tb3 for each row -BEGIN +BEGIN set @counter=0, @flag='Initial'; -Label1: loop +Label1: loop if new.f136<new.f144 then set @counter='Nothing to loop'; -leave Label1; +leave Label1; else set @counter=@counter+1; if new.f136=new.f144+@counter then set @counter=concat(@counter, ' loops'); leave Label1; -end if; -end if; -iterate label1; +end if; +end if; +iterate label1; set @flag='Final'; -END loop Label1; +END loop Label1; END// -Insert into tb3 (f122, f136, f144) +Insert into tb3 (f122, f136, f144) values ('Test 3.5.8.5-loop', 2, 8); select @counter, @flag; @counter @flag Nothing to loop Initial -Insert into tb3 (f122, f136, f144) +Insert into tb3 (f122, f136, f144) values ('Test 3.5.8.5-loop', 11, 8); select @counter, @flag; @counter @flag 3 loops Initial Create trigger trg4_2 after update on tb3 for each row -BEGIN -Label1: loop +BEGIN +Label1: loop set @counter=@counter+1; -END; +END; 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 '; +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 '; END' at line 5 drop trigger trg4_2; drop trigger trg4; @@ -441,23 +442,23 @@ Testcase 3.5.8.5-repeat: ------------------------ Create trigger trg6 after insert on tb3 for each row BEGIN -rp_label: REPEAT -SET @counter1 = @counter1 + 1; +rp_label: REPEAT +SET @counter1 = @counter1 + 1; IF (@counter1 MOD 2 = 0) THEN ITERATE rp_label; END IF; -SET @counter2 = @counter2 + 1; +SET @counter2 = @counter2 + 1; UNTIL @counter1> new.f136 END REPEAT rp_label; END// set @counter1= 0, @counter2= 0; -Insert into tb3 (f122, f136) +Insert into tb3 (f122, f136) values ('Test 3.5.8.5-repeat', 13); select @counter1, @counter2; @counter1 @counter2 15 8 Create trigger trg6_2 after update on tb3 for each row BEGIN -REPEAT -SET @counter2 = @counter2 + 1; +REPEAT +SET @counter2 = @counter2 + 1; 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 'END' at line 5 drop trigger trg6; @@ -466,33 +467,62 @@ delete from tb3 where f122='Test 3.5.8.5-repeat'; Testcase 3.5.8.5-while: ----------------------- Create trigger trg7 after insert on tb3 for each row -wl_label: WHILE @counter1 < new.f136 DO -SET @counter1 = @counter1 + 1; +wl_label: WHILE @counter1 < new.f136 DO +SET @counter1 = @counter1 + 1; IF (@counter1 MOD 2 = 0) THEN ITERATE wl_label; END IF; -SET @counter2 = @counter2 + 1; +SET @counter2 = @counter2 + 1; END WHILE wl_label// set @counter1= 0, @counter2= 0; -Insert into tb3 (f122, f136) +Insert into tb3 (f122, f136) values ('Test 3.5.8.5-while', 7); select @counter1, @counter2; @counter1 @counter2 7 4 Create trigger trg7_2 after update on tb3 for each row BEGIN -WHILE @counter1 < new.f136 -SET @counter1 = @counter1 + 1; +WHILE @counter1 < new.f136 +SET @counter1 = @counter1 + 1; 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 @counter1 = @counter1 + 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 'SET @counter1 = @counter1 + 1; END' at line 4 delete from tb3 where f122='Test 3.5.8.5-while'; drop trigger trg7; Testcase 3.5.8.6: (requirement void) ------------------------------------ +CREATE PROCEDURE sp_01 () BEGIN set @v1=1; END// +CREATE TRIGGER trg8_1 BEFORE UPDATE ON tb3 FOR EACH ROW +BEGIN +CALL sp_01 (); +END// +Insert into tb3 (f120, f122, f136) values ('6', 'Test 3.5.8.6-insert', 101); +update tb3 set f120='S', f136=111, +f122='Test 3.5.8.6-tr8_1' + where f122='Test 3.5.8.6-insert'; +select f120, f122 +from tb3 where f122 like 'Test 3.5.8.6%' order by f120; +f120 f122 +S Test 3.5.8.6-tr8_1 +DROP TRIGGER trg8_1; +DROP PROCEDURE sp_01; -Testcase 3.5.8.7: (Disabled as a result of bug _____) ------------------------------------------------------ +Testcase 3.5.8.7 +---------------- +Create trigger trg9_1 before update on tb3 for each row +BEGIN +Start transaction; +Set new.f120='U'; +Commit; +END// +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +Create trigger trg9_2 before delete on tb3 for each row +BEGIN +Start transaction; +Set @var2=old.f120; +Rollback; +END// +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. drop user test_general@localhost; drop user test_general; drop user test_super@localhost; diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_09.result b/mysql-test/suite/funcs_1/r/myisam_trig_09.result index 7cbcd8a6862..b84f4f60583 100644 --- a/mysql-test/suite/funcs_1/r/myisam_trig_09.result +++ b/mysql-test/suite/funcs_1/r/myisam_trig_09.result @@ -1,94 +1,89 @@ USE test; -drop table if exists tb3 ; +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 = myisam; +f118 char not null DEFAULT 'a', +f119 char binary not null DEFAULT b'101', +f120 char ascii not null DEFAULT b'101', +f121 char(50), +f122 char(50), +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 = <engine_to_be_used>; 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 'MYSQL_TEST_DIR/suite/funcs_1/data/myisam_tb3.txt' into table tb3 ; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/memory_tb3.txt' +into table tb3; Testcase 3.5.9.1/2: ------------------- -Create trigger trg1 BEFORE UPDATE on tb3 for each row +Create trigger trg1 BEFORE UPDATE on tb3 for each row set new.f142 = 94087, @counter=@counter+1; TotalRows 10 Affected -8 +9 NotAffected -2 +1 NewValuew 0 set @counter=0; Update tb3 Set f142='1' where f130<100; -select count(*) as ExpectedChanged, @counter as TrigCounter +select count(*) as ExpectedChanged, @counter as TrigCounter from tb3 where f142=94087; ExpectedChanged TrigCounter -8 8 -select count(*) as ExpectedNotChange from tb3 +9 9 +select count(*) as ExpectedNotChange from tb3 where f130<100 and f142<>94087; ExpectedNotChange 0 -select count(*) as NonExpectedChanged from tb3 +select count(*) as NonExpectedChanged from tb3 where f130>=130 and f142=94087; NonExpectedChanged 0 @@ -116,17 +111,17 @@ set @tr_var_af_118=old.f118, @tr_var_af_121=old.f121, 0 0 0 0 0 @tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_163 0 0 0 0 0 -Insert into tb3 (f122, f136, f163) +Insert into tb3 (f122, f136, f163) values ('Test 3.5.9.3', 7, 123.17); Update tb3 Set f136=8 where f122='Test 3.5.9.3'; -select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3'; +select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3' order by f136; f118 f121 f122 f136 f163 a NULL Test 3.5.9.3 00008 123.170000000000000000000000000000 -select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, +select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_163; @tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_163 a NULL Test 3.5.9.3 7 123.170000000000000000000000000000 -select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, +select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_163; @tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_163 a NULL Test 3.5.9.3 7 123.170000000000000000000000000000 @@ -135,13 +130,13 @@ a NULL Test 3.5.9.3 7 123.170000000000000000000000000000 @tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_163 0 0 0 0 0 delete from tb3 where f122='Test 3.5.9.3'; -select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3'; +select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3' order by f136; f118 f121 f122 f136 f163 -select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, +select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_163; @tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_163 a NULL Test 3.5.9.3 8 123.170000000000000000000000000000 -select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, +select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_163; @tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_163 a NULL Test 3.5.9.3 8 123.170000000000000000000000000000 @@ -172,17 +167,17 @@ set @tr_var_af_118=new.f118, @tr_var_af_121=new.f121, 0 0 0 0 0 0 @tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_151 @tr_var_af_163 0 0 0 0 0 0 -Insert into tb3 (f122, f136, f151, f163) +Insert into tb3 (f122, f136, f151, f163) values ('Test 3.5.9.4', 7, DEFAULT, 995.24); -select f118, f121, f122, f136, f151, f163 from tb3 -where f122 like 'Test 3.5.9.4%'; +select f118, f121, f122, f136, f151, f163 from tb3 +where f122 like 'Test 3.5.9.4%' order by f163; f118 f121 f122 f136 f151 f163 a NULL Test 3.5.9.4 00007 999 995.240000000000000000000000000000 -select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, +select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_151, @tr_var_b4_163; @tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_151 @tr_var_b4_163 a NULL Test 3.5.9.4 7 999 995.240000000000000000000000000000 -select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, +select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_151, @tr_var_af_163; @tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_151 @tr_var_af_163 a NULL Test 3.5.9.4 7 999 995.240000000000000000000000000000 @@ -194,15 +189,15 @@ Update tb3 Set f122='Test 3.5.9.4-trig', f136=NULL, f151=DEFAULT, f163=NULL where f122='Test 3.5.9.4'; Warnings: Warning 1048 Column 'f136' cannot be null -select f118, f121, f122, f136, f151, f163 from tb3 -where f122 like 'Test 3.5.9.4-trig'; +select f118, f121, f122, f136, f151, f163 from tb3 +where f122 like 'Test 3.5.9.4-trig' order by f163; f118 f121 f122 f136 f151 f163 a NULL Test 3.5.9.4-trig 00000 999 NULL -select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, +select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_151, @tr_var_b4_163; @tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_151 @tr_var_b4_163 a NULL Test 3.5.9.4-trig 0 999 NULL -select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, +select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_151, @tr_var_af_163; @tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_151 @tr_var_af_163 a NULL Test 3.5.9.4-trig 0 999 NULL @@ -240,6 +235,7 @@ ERROR HY000: There is no NEW row in on DELETE trigger create trigger trg5b after DELETE on tb3 for each row set new.f122='test'; ERROR HY000: There is no NEW row in on DELETE trigger +drop trigger trg5a; drop trigger trg5b; Testcase 3.5.9.10: (implied in previous tests) diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_1011ext.result b/mysql-test/suite/funcs_1/r/myisam_trig_1011ext.result index c991fb67ec1..57cf86f9657 100644 --- a/mysql-test/suite/funcs_1/r/myisam_trig_1011ext.result +++ b/mysql-test/suite/funcs_1/r/myisam_trig_1011ext.result @@ -1,70 +1,65 @@ USE test; -drop table if exists tb3 ; +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 = myisam; +f118 char not null DEFAULT 'a', +f119 char binary not null DEFAULT b'101', +f120 char ascii not null DEFAULT b'101', +f121 char(50), +f122 char(50), +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 = <engine_to_be_used>; 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 'MYSQL_TEST_DIR/suite/funcs_1/data/myisam_tb3.txt' into table tb3 ; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/memory_tb3.txt' +into table tb3; Testcase 3.5.10.1/2/3: ---------------------- @@ -86,7 +81,7 @@ Insert into vw11 (f122, f151) values ('Test 3.5.10.1/2/3', 1); Insert into vw11 (f122, f151) values ('Test 3.5.10.1/2/3', 2); Insert into vw11 (f122, f151) values ('Not in View', 3); select f121, f122, f151, f163 -from tb3 where f122 like 'Test 3.5.10.1/2/3%'; +from tb3 where f122 like 'Test 3.5.10.1/2/3%' order by f151; f121 f122 f151 f163 NULL Test 3.5.10.1/2/3 1 111.110000000000000000000000000000 NULL Test 3.5.10.1/2/3 2 111.110000000000000000000000000000 @@ -100,7 +95,7 @@ f121 f122 f151 f163 NULL Not in View 3 111.110000000000000000000000000000 Update vw11 set f163=1; select f121, f122, f151, f163 from tb3 -where f122 like 'Test 3.5.10.1/2/3%'; +where f122 like 'Test 3.5.10.1/2/3%' order by f151; f121 f122 f151 f163 Y Test 3.5.10.1/2/3-Update 1 1.000000000000000000000000000000 Y Test 3.5.10.1/2/3-Update 2 1.000000000000000000000000000000 @@ -114,7 +109,7 @@ before delete 0 delete from vw11 where f151=1; select f121, f122, f151, f163 from tb3 -where f122 like 'Test 3.5.10.1/2/3%'; +where f122 like 'Test 3.5.10.1/2/3%' order by f151; f121 f122 f151 f163 Y Test 3.5.10.1/2/3-Update 2 1.000000000000000000000000000000 select f121, f122, f151, f163 from vw11; @@ -134,18 +129,18 @@ delete from tb3 where f122 like 'Test 3.5.10.1/2/3%'; Testcase 3.5.10.4: ------------------ -create table tb_load (f1 int, f2 char(25),f3 int) engine=myisam; +create table tb_load (f1 int, f2 char(25),f3 int) engine = <engine_to_be_used>; Create trigger trg4 before insert on tb_load for each row set new.f3=-(new.f1 div 5), @counter= @counter+1; set @counter= 0; select @counter as 'Rows Loaded Before'; Rows Loaded Before 0 -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' into table tb_load; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t9.txt' into table tb_load; select @counter as 'Rows Loaded After'; Rows Loaded After 10 -Select * from tb_load limit 10; +Select * from tb_load order by f1 limit 10; f1 f2 f3 -5000 a` 1000 -4999 aaa 999 @@ -168,7 +163,7 @@ Testcase 3.5.10.6: (implemented in trig_frkey.test) Testcase 3.5.10.extra: ---------------------- -create table t1_sp (var136 tinyint, var151 decimal) engine=myisam; +create table t1_sp (var136 tinyint, var151 decimal) engine = <engine_to_be_used>; create trigger trg before insert on t1_sp for each row set @counter=@counter+1; create procedure trig_sp() @@ -217,12 +212,12 @@ drop table if exists t2_2; drop table if exists t2_3; drop table if exists t2_4; drop table if exists t3; -create table t1 (f1 integer) engine=myisam; -create table t2_1 (f1 integer) engine=myisam; -create table t2_2 (f1 integer) engine=myisam; -create table t2_3 (f1 integer) engine=myisam; -create table t2_4 (f1 integer) engine=myisam; -create table t3 (f1 integer) engine=myisam; +create table t1 (f1 integer) engine = <engine_to_be_used>; +create table t2_1 (f1 integer) engine = <engine_to_be_used>; +create table t2_2 (f1 integer) engine = <engine_to_be_used>; +create table t2_3 (f1 integer) engine = <engine_to_be_used>; +create table t2_4 (f1 integer) engine = <engine_to_be_used>; +create table t3 (f1 integer) engine = <engine_to_be_used>; insert into t1 values (1); create trigger tr1 after insert on t1 for each row BEGIN @@ -240,7 +235,7 @@ insert into t3 (f1) values (new.f1+1000); create trigger tr2_4 after insert on t2_4 for each row insert into t3 (f1) values (new.f1+10000); insert into t1 values (1); -select * from t3; +select * from t3 order by f1; f1 12 102 @@ -260,10 +255,10 @@ drop table if exists t1; drop table if exists t2; drop table if exists t3; drop table if exists t4; -create table t1 (f1 integer) engine = myisam; -create table t2 (f2 integer) engine = myisam; -create table t3 (f3 integer) engine = myisam; -create table t4 (f4 integer) engine = myisam; +create table t1 (f1 integer) engine = <engine_to_be_used>; +create table t2 (f2 integer) engine = <engine_to_be_used>; +create table t3 (f3 integer) engine = <engine_to_be_used>; +create table t4 (f4 integer) engine = <engine_to_be_used>; insert into t1 values (0); create trigger tr1 after insert on t1 for each row insert into t2 (f2) values (new.f1+1); @@ -275,17 +270,17 @@ create trigger tr4 after insert on t4 for each row insert into t1 (f1) values (new.f4+1); insert into t1 values (1); ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger. -select * from t1; +select * from t1 order by f1; f1 0 1 -select * from t2; +select * from t2 order by f2; f2 2 -select * from t3; +select * from t3 order by f3; f3 3 -select * from t4; +select * from t4 order by f4; f4 4 drop trigger tr1; @@ -297,13 +292,13 @@ drop table t2; drop table t3; drop table t4; -Testcase y.y.y.4: Recursive trigger/SP references (disabled bug 11889) ----------------------------------------------------------------------- +Testcase y.y.y.4: Recursive trigger/SP references +------------------------------------------------- set @sql_mode='traditional'; create table t1_sp ( count integer, var136 tinyint, -var151 decimal) engine=myisam; +var151 decimal) engine = <engine_to_be_used>; create procedure trig_sp() begin declare done int default 0; @@ -357,7 +352,7 @@ drop procedure trig_sp; drop trigger trg; drop table t1_sp; -Testcase y.y.y.5: Roleback of nested trigger references +Testcase y.y.y.5: Rollback of nested trigger references ------------------------------------------------------- set @@sql_mode='traditional'; use test; @@ -365,10 +360,10 @@ drop table if exists t1; drop table if exists t2; drop table if exists t3; drop table if exists t4; -create table t1 (f1 integer) engine = myisam; -create table t2 (f2 integer) engine = myisam; -create table t3 (f3 integer) engine = myisam; -create table t4 (f4 tinyint) engine = myisam; +create table t1 (f1 integer) engine = <engine_to_be_used>; +create table t2 (f2 integer) engine = <engine_to_be_used>; +create table t3 (f3 integer) engine = <engine_to_be_used>; +create table t4 (f4 tinyint) engine = <engine_to_be_used>; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -386,14 +381,14 @@ start transaction; insert into t1 values (1); ERROR 22003: Out of range value adjusted for column 'f4' at row 1 commit; -select * from t1; +select * from t1 order by f1; f1 1 1 -select * from t2; +select * from t2 order by f2; f2 2 -select * from t3; +select * from t3 order by f3; f3 3 drop trigger tr1; diff --git a/mysql-test/suite/funcs_1/r/myisam_views.result b/mysql-test/suite/funcs_1/r/myisam_views.result index a9c4d4c7f43..bde591c13bf 100644 --- a/mysql-test/suite/funcs_1/r/myisam_views.result +++ b/mysql-test/suite/funcs_1/r/myisam_views.result @@ -1,133 +1,135 @@ USE test; drop table if exists tb2 ; create table tb2 ( -f59 numeric (0) unsigned, -f60 numeric (64) unsigned, -f61 numeric (0) zerofill, -f62 numeric (64) zerofill, -f63 numeric (0) unsigned zerofill, -f64 numeric (64) unsigned zerofill, -f65 numeric (0,0), -f66 numeric (63,30), -f67 numeric (0,0) unsigned, -f68 numeric (63,30) unsigned, -f69 numeric (0,0) zerofill, -f70 numeric (63,30) zerofill, -f71 numeric (0,0) unsigned zerofill, -f72 numeric (63,30) unsigned zerofill, -f73 real, -f74 real unsigned, -f75 real zerofill, -f76 real unsigned zerofill, -f77 double default 7.7, -f78 double unsigned default 7.7, -f79 double zerofill default 7.7, -f80 double unsigned zerofill default 8.8, -f81 float not null default 8.8, -f82 float unsigned not null default 8.8, -f83 float zerofill not null default 8.8, -f84 float unsigned zerofill not null default 8.8, -f85 float(0) not null default 8.8, -f86 float(23) not null default 8.8, -f87 float(0) unsigned not null default 8.8, -f88 float(23) unsigned not null default 8.8, -f89 float(0) zerofill not null default 8.8, -f90 float(23) zerofill not null default 8.8, -f91 float(0) unsigned zerofill not null default 8.8, -f92 float(23) unsigned zerofill not null default 8.8, -f93 float(24) not null default 8.8, -f94 float(53) not null default 8.8, -f95 float(24) unsigned not null default 8.8, -f96 float(53) unsigned not null default 8.8, -f97 float(24) zerofill not null default 8.8, -f98 float(53) zerofill not null default 8.8, -f99 float(24) unsigned zerofill not null default 8.8, -f100 float(53) unsigned zerofill not null default 8.8, -f101 date not null default '2000-01-01', -f102 time not null default 20, -f103 datetime not null default '2/2/2', -f104 timestamp not null default 20001231235959, -f105 year not null default 2000, -f106 year(3) not null default 2000, -f107 year(4) not null default 2000, -f108 enum("1enum","2enum") not null default "1enum", +f59 numeric (0) unsigned, +f60 numeric (64) unsigned, +f61 numeric (0) zerofill, +f62 numeric (64) zerofill, +f63 numeric (0) unsigned zerofill, +f64 numeric (64) unsigned zerofill, +f65 numeric (0,0), +f66 numeric (63,30), +f67 numeric (0,0) unsigned, +f68 numeric (63,30) unsigned, +f69 numeric (0,0) zerofill, +f70 numeric (63,30) zerofill, +f71 numeric (0,0) unsigned zerofill, +f72 numeric (63,30) unsigned zerofill, +f73 real, +f74 real unsigned, +f75 real zerofill, +f76 real unsigned zerofill, +f77 double default 7.7, +f78 double unsigned default 7.7, +f79 double zerofill default 7.7, +f80 double unsigned zerofill default 8.8, +f81 float not null default 8.8, +f82 float unsigned not null default 8.8, +f83 float zerofill not null default 8.8, +f84 float unsigned zerofill not null default 8.8, +f85 float(0) not null default 8.8, +f86 float(23) not null default 8.8, +f87 float(0) unsigned not null default 8.8, +f88 float(23) unsigned not null default 8.8, +f89 float(0) zerofill not null default 8.8, +f90 float(23) zerofill not null default 8.8, +f91 float(0) unsigned zerofill not null default 8.8, +f92 float(23) unsigned zerofill not null default 8.8, +f93 float(24) not null default 8.8, +f94 float(53) not null default 8.8, +f95 float(24) unsigned not null default 8.8, +f96 float(53) unsigned not null default 8.8, +f97 float(24) zerofill not null default 8.8, +f98 float(53) zerofill not null default 8.8, +f99 float(24) unsigned zerofill not null default 8.8, +f100 float(53) unsigned zerofill not null default 8.8, +f101 date not null default '2000-01-01', +f102 time not null default 20, +f103 datetime not null default '2/2/2', +f104 timestamp not null default 20001231235959, +f105 year not null default 2000, +f106 year(3) not null default 2000, +f107 year(4) not null default 2000, +f108 enum("1enum","2enum") not null default "1enum", f109 set("1set","2set") not null default "1set", -f110 VARBINARY(64) null, -f111 VARBINARY(27) null , -f112 VARBINARY(64) null , -f113 VARBINARY(192) null , -f114 VARBINARY(192) , -f115 VARBINARY(27) null , -f116 VARBINARY(64) null, -f117 VARBINARY(192) null +f110 VARBINARY(64) null, +f111 VARBINARY(27) null , +f112 VARBINARY(64) null , +f113 VARBINARY(192) null , +f114 VARBINARY(192) , +f115 VARBINARY(27) null , +f116 VARBINARY(64) null, +f117 VARBINARY(192) null ) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/myisam_tb2.txt' into table tb2 ; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/myisam_tb2.txt' +into table tb2; DROP DATABASE IF EXISTS test1; CREATE DATABASE test1; USE test1; drop table if exists tb2 ; create table tb2 ( -f59 numeric (0) unsigned, -f60 numeric (64) unsigned, -f61 numeric (0) zerofill, -f62 numeric (64) zerofill, -f63 numeric (0) unsigned zerofill, -f64 numeric (64) unsigned zerofill, -f65 numeric (0,0), -f66 numeric (63,30), -f67 numeric (0,0) unsigned, -f68 numeric (63,30) unsigned, -f69 numeric (0,0) zerofill, -f70 numeric (63,30) zerofill, -f71 numeric (0,0) unsigned zerofill, -f72 numeric (63,30) unsigned zerofill, -f73 real, -f74 real unsigned, -f75 real zerofill, -f76 real unsigned zerofill, -f77 double default 7.7, -f78 double unsigned default 7.7, -f79 double zerofill default 7.7, -f80 double unsigned zerofill default 8.8, -f81 float not null default 8.8, -f82 float unsigned not null default 8.8, -f83 float zerofill not null default 8.8, -f84 float unsigned zerofill not null default 8.8, -f85 float(0) not null default 8.8, -f86 float(23) not null default 8.8, -f87 float(0) unsigned not null default 8.8, -f88 float(23) unsigned not null default 8.8, -f89 float(0) zerofill not null default 8.8, -f90 float(23) zerofill not null default 8.8, -f91 float(0) unsigned zerofill not null default 8.8, -f92 float(23) unsigned zerofill not null default 8.8, -f93 float(24) not null default 8.8, -f94 float(53) not null default 8.8, -f95 float(24) unsigned not null default 8.8, -f96 float(53) unsigned not null default 8.8, -f97 float(24) zerofill not null default 8.8, -f98 float(53) zerofill not null default 8.8, -f99 float(24) unsigned zerofill not null default 8.8, -f100 float(53) unsigned zerofill not null default 8.8, -f101 date not null default '2000-01-01', -f102 time not null default 20, -f103 datetime not null default '2/2/2', -f104 timestamp not null default 20001231235959, -f105 year not null default 2000, -f106 year(3) not null default 2000, -f107 year(4) not null default 2000, -f108 enum("1enum","2enum") not null default "1enum", +f59 numeric (0) unsigned, +f60 numeric (64) unsigned, +f61 numeric (0) zerofill, +f62 numeric (64) zerofill, +f63 numeric (0) unsigned zerofill, +f64 numeric (64) unsigned zerofill, +f65 numeric (0,0), +f66 numeric (63,30), +f67 numeric (0,0) unsigned, +f68 numeric (63,30) unsigned, +f69 numeric (0,0) zerofill, +f70 numeric (63,30) zerofill, +f71 numeric (0,0) unsigned zerofill, +f72 numeric (63,30) unsigned zerofill, +f73 real, +f74 real unsigned, +f75 real zerofill, +f76 real unsigned zerofill, +f77 double default 7.7, +f78 double unsigned default 7.7, +f79 double zerofill default 7.7, +f80 double unsigned zerofill default 8.8, +f81 float not null default 8.8, +f82 float unsigned not null default 8.8, +f83 float zerofill not null default 8.8, +f84 float unsigned zerofill not null default 8.8, +f85 float(0) not null default 8.8, +f86 float(23) not null default 8.8, +f87 float(0) unsigned not null default 8.8, +f88 float(23) unsigned not null default 8.8, +f89 float(0) zerofill not null default 8.8, +f90 float(23) zerofill not null default 8.8, +f91 float(0) unsigned zerofill not null default 8.8, +f92 float(23) unsigned zerofill not null default 8.8, +f93 float(24) not null default 8.8, +f94 float(53) not null default 8.8, +f95 float(24) unsigned not null default 8.8, +f96 float(53) unsigned not null default 8.8, +f97 float(24) zerofill not null default 8.8, +f98 float(53) zerofill not null default 8.8, +f99 float(24) unsigned zerofill not null default 8.8, +f100 float(53) unsigned zerofill not null default 8.8, +f101 date not null default '2000-01-01', +f102 time not null default 20, +f103 datetime not null default '2/2/2', +f104 timestamp not null default 20001231235959, +f105 year not null default 2000, +f106 year(3) not null default 2000, +f107 year(4) not null default 2000, +f108 enum("1enum","2enum") not null default "1enum", f109 set("1set","2set") not null default "1set", -f110 VARBINARY(64) null, -f111 VARBINARY(27) null , -f112 VARBINARY(64) null , -f113 VARBINARY(192) null , -f114 VARBINARY(192) , -f115 VARBINARY(27) null , -f116 VARBINARY(64) null, -f117 VARBINARY(192) null +f110 VARBINARY(64) null, +f111 VARBINARY(27) null , +f112 VARBINARY(64) null , +f113 VARBINARY(192) null , +f114 VARBINARY(192) , +f115 VARBINARY(27) null , +f116 VARBINARY(64) null, +f117 VARBINARY(192) null ) engine = myisam; -load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/myisam_tb2.txt' into table tb2 ; +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/myisam_tb2.txt' +into table tb2; USE test; Attention: The nesting level @max_level in Testcase 3.3.1.A6 diff --git a/mysql-test/suite/funcs_1/r/ndb_trig_0102.result b/mysql-test/suite/funcs_1/r/ndb_trig_0102.result new file mode 100644 index 00000000000..1ada907f9e6 --- /dev/null +++ b/mysql-test/suite/funcs_1/r/ndb_trig_0102.result @@ -0,0 +1,357 @@ +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 char(50), +f122 char(50), +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 = <engine_to_be_used>; +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 + +Testcase: 3.5.1.1: +------------------ +use test; +Create trigger trg1_1 BEFORE INSERT +on tb3 for each row set @test_before = 2, new.f142 = @test_before; +Create trigger trg1_2 AFTER INSERT +on tb3 for each row set @test_after = 6; +Create trigger trg1_4 BEFORE UPDATE +on tb3 for each row set @test_before = 27, +new.f142 = @test_before, +new.f122 = 'Before Update Trigger'; +Create trigger trg1_3 AFTER UPDATE +on tb3 for each row set @test_after = '15'; +Create trigger trg1_5 BEFORE DELETE on tb3 for each row +select count(*) into @test_before from tb3 as tr_tb3 +where f121 = 'Test 3.5.1.1'; +Create trigger trg1_6 AFTER DELETE on tb3 for each row +select count(*) into @test_after from tb3 as tr_tb3 +where f121 = 'Test 3.5.1.1'; +set @test_before = 1; +set @test_after = 5; +select @test_before, @test_after; +@test_before @test_after +1 5 +Insert into tb3 (f121, f122, f142, f144, f134) +values ('Test 3.5.1.1', 'First Row', @test_before, @test_after, 1); +select f121, f122, f142, f144, f134 from tb3 where f121 = 'Test 3.5.1.1'; +f121 f122 f142 f144 f134 +Test 3.5.1.1 First Row 2 0000000005 1 +select @test_before, @test_after; +@test_before @test_after +2 6 +set @test_before = 18; +set @test_after = 8; +select @test_before, @test_after; +@test_before @test_after +18 8 +Update tb3 set tb3.f122 = 'Update', +tb3.f142 = @test_before, +tb3.f144 = @test_after +where tb3.f121 = 'Test 3.5.1.1'; +select f121, f122, f142, f144, f134 from tb3 where f121 = 'Test 3.5.1.1'; +f121 f122 f142 f144 f134 +Test 3.5.1.1 Before Update Trigger 27 0000000008 1 +select @test_before, @test_after; +@test_before @test_after +27 15 +Insert into tb3 (f121, f122, f142, f144, f134) +values ('Test 3.5.1.1', 'Second Row', 5, 6, 2); +set @test_before = 0; +set @test_after = 0; +select f121, f122, f142, f144, f134 from tb3 where f121 = 'Test 3.5.1.1'; +f121 f122 f142 f144 f134 +Test 3.5.1.1 Before Update Trigger 27 0000000008 1 +Test 3.5.1.1 Second Row 2 0000000006 2 +select @test_before, @test_after; +@test_before @test_after +0 0 +Delete from tb3 where f121 = 'Test 3.5.1.1' and f134 = 2; +select f121, f122, f142, f144, f134 from tb3 where f121 = 'Test 3.5.1.1'; +f121 f122 f142 f144 f134 +Test 3.5.1.1 Before Update Trigger 27 0000000008 1 +select @test_before, @test_after; +@test_before @test_after +2 1 +drop trigger trg1_1; +drop trigger trg1_2; +drop trigger trg1_3; +drop trigger trg1_4; +drop trigger trg1_5; +drop trigger trg1_6; +delete from tb3 where f121='Test 3.5.1.1'; + +Testcase: 3.5.1.2: +------------------ +Create trigger trg_1 after insert +on tb3 for each statement set @x= 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 'statement set @x= 1' at line 2 +drop trigger trg_1; + +Testcase 3.5.1.3: +----------------- +CREATE TRIGGER trg3_1 on tb3 BEFORE INSERT for each row set new.f120 = 't'; +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 'on tb3 BEFORE INSERT for each row set new.f120 = 't'' at line 1 +CREATE trg3_2 TRIGGER AFTER INSERT on tb3 for each row set new.f120 = 's'; +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 'trg3_2 TRIGGER AFTER INSERT on tb3 for each row set new.f120 = 's'' at line 1 +CREATE TRIGGER trg3_3 Before DELETE on tb3 set @ret1 = 'test' for each row; +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 @ret1 = 'test' for each row' at line 1 +CREATE TRIGGER trg3_4 DELETE AFTER on tb3 set @ret1 = 'test' for each row; +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 'DELETE AFTER on tb3 set @ret1 = 'test' for each row' at line 1 +CREATE for each row TRIGGER trg3_5 AFTER UPDATE on tb3 set @ret1 = 'test'; +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 'for each row TRIGGER trg3_5 AFTER UPDATE on tb3 set @ret1 = 'test'' at line 1 +drop trigger trg3_1; +drop trigger trg3_2; +drop trigger trg3_3; +drop trigger trg3_4; +drop trigger trg3_5; + +Testcase: 3.5.1.5: +------------------ +CREATE TRIGGER trg4_1 AFTER on tb3 for each row set new.f120 = 'e'; +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 'on tb3 for each row set new.f120 = 'e'' at line 1 +CREATE TRIGGER trg4_2 INSERT on tb3 for each set row new.f120 = 'f'; +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 'INSERT on tb3 for each set row new.f120 = 'f'' at line 1 +CREATE TRIGGER trg4_3 BEFORE INSERT tb3 for each row set new.f120 = 'g'; +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 'tb3 for each row set new.f120 = 'g'' at line 1 +CREATE TRIGGER trg4_4 AFTER UPDATE on tb3 for each set new.f120 = 'g'; +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 new.f120 = 'g'' at line 1 +CREATE trg4_5 AFTER DELETE on tb3 for each set new.f120 = 'g'; +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 'trg4_5 AFTER DELETE on tb3 for each set new.f120 = 'g'' at line 1 +CREATE TRIGGER trg4_6 BEFORE DELETE for each row set new.f120 = 'g'; +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 'for each row set new.f120 = 'g'' at line 1 +drop trigger trg4_1; +drop trigger trg4_2; +drop trigger trg4_3; +drop trigger trg4_4; +drop trigger trg4_5; +drop trigger trg4_6; + +Testcase 3.5.1.6: - Need to fix +------------------------------- + +Testcase 3.5.1.7: - need to fix +------------------------------- +drop table if exists t1; +Warnings: +Note 1051 Unknown table 't1' +create table t1 (f1 int, f2 char(25),f3 int) engine = <engine_to_be_used>; +CREATE TRIGGER trg5_1 BEFORE INSERT on test.t1 +for each row set new.f3 = '14'; +CREATE TRIGGER trg_abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ +BEFORE UPDATE on test.t1 for each row set new.f3 = '42'; +insert into t1 (f2) values ('insert 3.5.1.7'); +select * from t1; +f1 f2 f3 +NULL insert 3.5.1.7 14 +update t1 set f2='update 3.5.1.7'; +select * from t1; +f1 f2 f3 +NULL update 3.5.1.7 42 +select trigger_name from information_schema.triggers order by trigger_name; +trigger_name +trg5_1 +trg_abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWX +drop trigger trg5_1; +drop trigger trg_abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ; +drop table t1; + +Testcase 3.5.1.8: +----------------- +CREATE TRIGGER trg12* before insert on tb3 for each row set new.f120 = 't'; +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 '* before insert on tb3 for each row set new.f120 = 't'' at line 1 +CREATE TRIGGER trigger before insert on tb3 for each row set new.f120 = 't'; +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 'trigger before insert on tb3 for each row set new.f120 = 't'' at line 1 +CREATE TRIGGER 100 before insert on tb3 for each row set new.f120 = 't'; +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 '100 before insert on tb3 for each row set new.f120 = 't'' at line 1 +CREATE TRIGGER @@view before insert on tb3 for each row set new.f120 = 't'; +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 '@@view before insert on tb3 for each row set new.f120 = 't'' at line 1 +CREATE TRIGGER @name before insert on tb3 for each row set new.f120 = 't'; +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 '@name before insert on tb3 for each row set new.f120 = 't'' at line 1 +CREATE TRIGGER tb3.trg6_1 BEFORE INSERT on test.tb3 +for each row set new.f120 ='X'; +ERROR HY000: Trigger in wrong schema +drop database if exists trig_db; +create database trig_db; +use trig_db; +create table t1 (f1 integer) engine = <engine_to_be_used>; +use test; +CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3 +for each row set @ret_trg6_2 = 5; +ERROR 42S02: Table 'trig_db.tb3' doesn't exist +use trig_db; +CREATE TRIGGER trg6_3 AFTER INSERT on test.tb3 +for each row set @ret_trg6_3 = 18; +ERROR HY000: Trigger in wrong schema +use test; +drop database trig_db; +drop trigger trg6_1; +drop trigger trg6_3; + +Testcase 3.5.1.9:(cannot be inplemented at this point) +------------------------------------------------------ + +Testcase 3.5.1.10: +------------------ +CREATE TRIGGER trg7_1 BEFORE UPDATE on tb3 for each row set new.f120 ='X'; +CREATE TRIGGER trg7_1 AFTER INSERT on tb3 for each row set @x ='Y'; +ERROR HY000: Trigger already exists +drop trigger trg7_1; + +Testcase 3.5.1.?: +----------------- +drop table if exists t1; +drop table if exists t2; +create table t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>; +create table t2 (f1 char(50), f2 integer) engine = <engine_to_be_used>; +create trigger trig before insert on t1 +for each row set new.f1 ='trig t1'; +create trigger trig before update on t2 +for each row set new.f1 ='trig t2'; +ERROR HY000: Trigger already exists +insert into t1 value ('insert to t1',1); +select * from t1; +f1 f2 +trig t1 1 +update t1 set f1='update to t1'; +select * from t1; +f1 f2 +update to t1 1 +insert into t2 value ('insert to t2',2); +update t2 set f1='update to t1'; +select * from t2; +f1 f2 +update to t1 2 +drop table t1; +drop table t2; +drop trigger trig; + +Testcase 3.5.1.11: +------------------ +drop database if exists trig_db1; +drop database if exists trig_db2; +drop database if exists trig_db3; +create database trig_db1; +create database trig_db2; +create database trig_db3; +use trig_db1; +create table t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>; +create trigger trig before insert on t1 +for each row set new.f1 ='trig1', @test_var1='trig1'; +use trig_db2; +create table t2 (f1 char(50), f2 integer) engine = <engine_to_be_used>; +create trigger trig before insert on t2 +for each row set new.f1 ='trig2', @test_var2='trig2'; +use trig_db3; +create table t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>; +create trigger trig before insert on t1 +for each row set new.f1 ='trig3', @test_var3='trig3'; +set @test_var1= '', @test_var2= '', @test_var3= ''; +use trig_db1; +insert into t1 (f1,f2) values ('insert to db1 t1',1); +insert into trig_db1.t1 (f1,f2) values ('insert to db1 t1 from db1',2); +insert into trig_db2.t2 (f1,f2) values ('insert to db2 t2 from db1',3); +insert into trig_db3.t1 (f1,f2) values ('insert to db3 t1 from db1',4); +select @test_var1, @test_var2, @test_var3; +@test_var1 @test_var2 @test_var3 +trig1 trig2 trig3 +select * from t1 order by f2; +f1 f2 +trig1 1 +trig1 2 +select * from trig_db2.t2; +f1 f2 +trig2 3 +select * from trig_db3.t1; +f1 f2 +trig3 4 +select * from t1 order by f2; +f1 f2 +trig1 1 +trig1 2 +use test; +drop database trig_db1; +drop database trig_db2; +drop database trig_db3; + +Testcase 3.5.2.1/2/3: +--------------------- +drop database if exists trig_db1; +drop database if exists trig_db2; +create database trig_db1; +create database trig_db2; +use trig_db1; +create table t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>; +create table trig_db2.t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>; +create trigger trig1_b before insert on t1 +for each row set @test_var1='trig1_b'; +create trigger trig_db1.trig1_a after insert on t1 +for each row set @test_var2='trig1_a'; +create trigger trig_db2.trig2 before insert on trig_db2.t1 +for each row set @test_var3='trig2'; +select trigger_schema, trigger_name, event_object_table +from information_schema.triggers order by trigger_name; +trigger_schema trigger_name event_object_table +trig_db1 trig1_a t1 +trig_db1 trig1_b t1 +trig_db2 trig2 t1 +set @test_var1= '', @test_var2= '', @test_var3= ''; +insert into t1 (f1,f2) values ('insert to db1 t1 from db1',352); +insert into trig_db2.t1 (f1,f2) values ('insert to db2 t1 from db1',352); +select @test_var1, @test_var2, @test_var3; +@test_var1 @test_var2 @test_var3 +trig1_b trig1_a trig2 +drop database trig_db1; +drop database trig_db2; +DROP TABLE test.tb3; diff --git a/mysql-test/suite/funcs_1/r/ndb_trig_03.result b/mysql-test/suite/funcs_1/r/ndb_trig_03.result new file mode 100644 index 00000000000..0d29724fcb7 --- /dev/null +++ b/mysql-test/suite/funcs_1/r/ndb_trig_03.result @@ -0,0 +1,695 @@ +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 char(50), +f122 char(50), +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 = <engine_to_be_used>; +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 + +Testcase 3.5.3: +--------------- +drop database if exists priv_db; +create database priv_db; +use priv_db; +create table t1 (f1 char(20)) engine= <engine_to_be_used>; +create User test_noprivs@localhost; +set password for test_noprivs@localhost = password('PWD'); +create User test_yesprivs@localhost; +set password for test_yesprivs@localhost = password('PWD'); + +Testcase 3.5.3.2/6: +------------------- +revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost; +grant ALL on *.* to test_noprivs@localhost; +revoke SUPER on *.* from test_noprivs@localhost; +show grants for test_noprivs@localhost; +Grants for test_noprivs@localhost +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; +grant SUPER on *.* to test_yesprivs@localhost; +grant SELECT on priv_db.t1 to test_yesprivs@localhost; +show grants for test_yesprivs@localhost; +Grants for test_yesprivs@localhost +GRANT SUPER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT SELECT ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' +connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK); +connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK); + +Testcase 3.5.3.2: +----------------- +select current_user; +current_user +test_noprivs@localhost +use priv_db; +create trigger trg1_1 before INSERT on t1 for each row +set new.f1 = 'trig 3.5.3.2_1-no'; +ERROR 42000: Access denied; you need the SUPER privilege for this operation +use priv_db; +insert into t1 (f1) values ('insert 3.5.3.2-no'); +select f1 from t1 order by f1; +f1 +insert 3.5.3.2-no +select current_user; +current_user +test_yesprivs@localhost +use priv_db; +create trigger trg1_2 before INSERT on t1 for each row +set new.f1 = 'trig 3.5.3.2_2-yes'; +select current_user; +current_user +root@localhost +use priv_db; +insert into t1 (f1) values ('insert 3.5.3.2-yes'); +ERROR 42000: UPDATE command denied to user 'test_yesprivs'@'localhost' for column 'f1' in table 't1' +select f1 from t1 order by f1; +f1 +insert 3.5.3.2-no +grant UPDATE on priv_db.t1 to test_yesprivs@localhost; +insert into t1 (f1) values ('insert 3.5.3.2-yes'); +select f1 from t1 order by f1; +f1 +insert 3.5.3.2-no +trig 3.5.3.2_2-yes + +Testcase 3.5.3.6: +----------------- +use priv_db; +drop trigger trg1_2; +ERROR 42000: Access denied; you need the SUPER privilege for this operation +use priv_db; +insert into t1 (f1) values ('insert 3.5.3.6-yes'); +select f1 from t1 order by f1; +f1 +insert 3.5.3.2-no +trig 3.5.3.2_2-yes +trig 3.5.3.2_2-yes +use priv_db; +drop trigger trg1_2; +use priv_db; +insert into t1 (f1) values ('insert 3.5.3.6-no'); +select f1 from t1 order by f1; +f1 +insert 3.5.3.2-no +insert 3.5.3.6-no +trig 3.5.3.2_2-yes +trig 3.5.3.2_2-yes +drop trigger trg1_2; + +Testcase 3.5.3.7a: +------------------ +revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost; +grant ALL on *.* to test_noprivs@localhost; +revoke UPDATE on *.* from test_noprivs@localhost; +show grants for test_noprivs@localhost; +Grants for test_noprivs@localhost +GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; +grant SUPER, UPDATE on *.* to test_yesprivs@localhost; +show grants for test_yesprivs@localhost; +Grants for test_yesprivs@localhost +GRANT UPDATE, SUPER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK); +connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK); +select current_user; +current_user +test_noprivs@localhost +use priv_db; +show grants; +Grants for test_noprivs@localhost +GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +select f1 from t1 order by f1; +f1 +insert 3.5.3.2-no +insert 3.5.3.6-no +trig 3.5.3.2_2-yes +trig 3.5.3.2_2-yes +create trigger trg4a_1 before INSERT on t1 for each row +set new.f1 = 'trig 3.5.3.7-1a'; +insert into t1 (f1) values ('insert 3.5.3.7-1a'); +ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' +select f1 from t1 order by f1; +f1 +insert 3.5.3.2-no +insert 3.5.3.6-no +trig 3.5.3.2_2-yes +trig 3.5.3.2_2-yes +drop trigger trg4a_1; +use priv_db; +select current_user; +current_user +test_yesprivs@localhost +show grants; +Grants for test_yesprivs@localhost +GRANT UPDATE, SUPER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +create trigger trg4a_2 before INSERT on t1 for each row +set new.f1 = 'trig 3.5.3.7-2a'; +insert into t1 (f1) values ('insert 3.5.3.7-2b'); +select f1 from t1 order by f1; +f1 +insert 3.5.3.2-no +insert 3.5.3.6-no +trig 3.5.3.2_2-yes +trig 3.5.3.2_2-yes +trig 3.5.3.7-2a +drop trigger trg4a_2; + +Testcase 3.5.3.7b: +------------------ +revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost; +grant SUPER on *.* to test_noprivs; +grant ALL on priv_db.* to test_noprivs@localhost; +revoke UPDATE on priv_db.* from test_noprivs@localhost; +show grants for test_noprivs; +Grants for test_noprivs@% +GRANT SUPER ON *.* TO 'test_noprivs'@'%' +revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; +grant SUPER on *.* to test_yesprivs@localhost; +grant UPDATE on priv_db.* to test_yesprivs@localhost; +show grants for test_yesprivs@localhost; +Grants for test_yesprivs@localhost +GRANT SUPER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT UPDATE ON `priv_db`.* TO 'test_yesprivs'@'localhost' +connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK); +connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK); +show grants; +Grants for test_noprivs@localhost +GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE ON `priv_db`.* TO 'test_noprivs'@'localhost' +use priv_db; +create trigger trg4b_1 before UPDATE on t1 for each row +set new.f1 = 'trig 3.5.3.7-1b'; +ERROR 42000: Access denied; you need the SUPER privilege for this operation +insert into t1 (f1) values ('insert 3.5.3.7-1b'); +select f1 from t1 order by f1; +f1 +insert 3.5.3.2-no +insert 3.5.3.6-no +insert 3.5.3.7-1b +trig 3.5.3.2_2-yes +trig 3.5.3.2_2-yes +trig 3.5.3.7-2a +update t1 set f1 = 'update 3.5.3.7-1b' where f1 = 'insert 3.5.3.7-1b'; +select f1 from t1 order by f1; +f1 +insert 3.5.3.2-no +insert 3.5.3.6-no +trig 3.5.3.2_2-yes +trig 3.5.3.2_2-yes +trig 3.5.3.7-2a +update 3.5.3.7-1b +drop trigger trg4b_1; +ERROR HY000: Trigger does not exist +show grants; +Grants for test_yesprivs@localhost +GRANT SUPER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT UPDATE ON `priv_db`.* TO 'test_yesprivs'@'localhost' +use priv_db; +create trigger trg4b_2 before UPDATE on t1 for each row +set new.f1 = 'trig 3.5.3.7-2b'; +insert into t1 (f1) values ('insert 3.5.3.7-2b'); +select f1 from t1 order by f1; +f1 +insert 3.5.3.2-no +insert 3.5.3.6-no +insert 3.5.3.7-2b +trig 3.5.3.2_2-yes +trig 3.5.3.2_2-yes +trig 3.5.3.7-2a +update 3.5.3.7-1b +update t1 set f1 = 'update 3.5.3.7-2b' where f1 = 'insert 3.5.3.7-2b'; +select f1 from t1 order by f1; +f1 +insert 3.5.3.2-no +insert 3.5.3.6-no +trig 3.5.3.2_2-yes +trig 3.5.3.2_2-yes +trig 3.5.3.7-2a +trig 3.5.3.7-2b +update 3.5.3.7-1b +drop trigger trg4b_2; + +Testcase 3.5.3.7c +----------------- +revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost; +grant SUPER on *.* to test_noprivs@localhost; +grant ALL on priv_db.t1 to test_noprivs@localhost; +revoke UPDATE on priv_db.t1 from test_noprivs@localhost; +show grants for test_noprivs; +Grants for test_noprivs@% +GRANT SUPER ON *.* TO 'test_noprivs'@'%' +revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; +grant SUPER on *.* to test_yesprivs@localhost; +grant UPDATE on priv_db.t1 to test_yesprivs@localhost; +show grants for test_yesprivs@localhost; +Grants for test_yesprivs@localhost +GRANT SUPER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' +connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK); +connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK); +show grants; +Grants for test_noprivs@localhost +GRANT SUPER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW ON `priv_db`.`t1` TO 'test_noprivs'@'localhost' +use priv_db; +create trigger trg4c_1 before INSERT on t1 for each row +set new.f1 = 'trig 3.5.3.7-1c'; +insert into t1 (f1) values ('insert 3.5.3.7-1c'); +ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' +select f1 from t1 order by f1; +f1 +insert 3.5.3.2-no +insert 3.5.3.6-no +trig 3.5.3.2_2-yes +trig 3.5.3.2_2-yes +trig 3.5.3.7-2a +trig 3.5.3.7-2b +update 3.5.3.7-1b +drop trigger trg4c_1; +show grants; +Grants for test_yesprivs@localhost +GRANT SUPER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' +use priv_db; +create trigger trg4c_2 before INSERT on t1 for each row +set new.f1 = 'trig 3.5.3.7-2c'; +insert into t1 (f1) values ('insert 3.5.3.7-2c'); +select f1 from t1 order by f1; +f1 +insert 3.5.3.2-no +insert 3.5.3.6-no +trig 3.5.3.2_2-yes +trig 3.5.3.2_2-yes +trig 3.5.3.7-2a +trig 3.5.3.7-2b +trig 3.5.3.7-2c +update 3.5.3.7-1b +drop trigger trg4c_2; + +Testcase 3.5.3.7d: +------------------ +revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost; +grant SUPER on *.* to test_noprivs@localhost; +grant SELECT (f1), INSERT (f1) on priv_db.t1 to test_noprivs@localhost; +show grants for test_noprivs; +Grants for test_noprivs@% +GRANT SUPER ON *.* TO 'test_noprivs'@'%' +revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; +grant SUPER on *.* to test_yesprivs@localhost; +grant UPDATE (f1) on priv_db.t1 to test_yesprivs@localhost; +show grants for test_noprivs; +Grants for test_noprivs@% +GRANT SUPER ON *.* TO 'test_noprivs'@'%' +connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK); +connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK); +show grants; +Grants for test_noprivs@localhost +GRANT SUPER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT SELECT (f1), INSERT (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost' +use priv_db; +create trigger trg4d_1 before INSERT on t1 for each row +set new.f1 = 'trig 3.5.3.7-1d'; +insert into t1 (f1) values ('insert 3.5.3.7-1d'); +ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' +select f1 from t1 order by f1; +f1 +insert 3.5.3.2-no +insert 3.5.3.6-no +trig 3.5.3.2_2-yes +trig 3.5.3.2_2-yes +trig 3.5.3.7-2a +trig 3.5.3.7-2b +trig 3.5.3.7-2c +update 3.5.3.7-1b +drop trigger trg4d_1; +show grants; +Grants for test_yesprivs@localhost +GRANT SUPER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT UPDATE (f1) ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' +use priv_db; +create trigger trg4d_2 before INSERT on t1 for each row +set new.f1 = 'trig 3.5.3.7-2d'; +insert into t1 (f1) values ('insert 3.5.3.7-2d'); +select f1 from t1 order by f1; +f1 +insert 3.5.3.2-no +insert 3.5.3.6-no +trig 3.5.3.2_2-yes +trig 3.5.3.2_2-yes +trig 3.5.3.7-2a +trig 3.5.3.7-2b +trig 3.5.3.7-2c +trig 3.5.3.7-2d +update 3.5.3.7-1b +drop trigger trg4d_2; + +Testcase 3.5.3.8a: +------------------ +revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost; +grant ALL on *.* to test_noprivs@localhost; +revoke SELECT on *.* from test_noprivs@localhost; +show grants for test_noprivs@localhost; +Grants for test_noprivs@localhost +GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; +grant SUPER, SELECT on *.* to test_yesprivs@localhost; +show grants for test_yesprivs@localhost; +Grants for test_yesprivs@localhost +GRANT SELECT, SUPER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK); +connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK); +select current_user; +current_user +test_noprivs@localhost +use priv_db; +show grants; +Grants for test_noprivs@localhost +GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +create trigger trg5a_1 before INSERT on t1 for each row +set @test_var = new.f1; +set @test_var = 'before trig 3.5.3.8-1a'; +select @test_var; +@test_var +before trig 3.5.3.8-1a +insert into t1 (f1) values ('insert 3.5.3.8-1a'); +ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' +select @test_var; +@test_var +before trig 3.5.3.8-1a +drop trigger trg5a_1; +use priv_db; +select current_user; +current_user +test_yesprivs@localhost +show grants; +Grants for test_yesprivs@localhost +GRANT SELECT, SUPER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +create trigger trg5a_2 before INSERT on t1 for each row +set @test_var= new.f1; +set @test_var= 'before trig 3.5.3.8-2a'; +select @test_var; +@test_var +before trig 3.5.3.8-2a +insert into t1 (f1) values ('insert 3.5.3.8-2a'); +select @test_var; +@test_var +insert 3.5.3.8-2a +drop trigger trg5a_2; + +Testcase: 3.5.3.8b +------------------ +revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost; +grant SUPER on *.* to test_noprivs@localhost; +grant ALL on priv_db.* to test_noprivs@localhost; +revoke SELECT on priv_db.* from test_noprivs@localhost; +show grants for test_noprivs@localhost; +Grants for test_noprivs@localhost +GRANT SUPER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE ON `priv_db`.* TO 'test_noprivs'@'localhost' +revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; +grant SUPER on *.* to test_yesprivs@localhost; +grant SELECT on priv_db.* to test_yesprivs@localhost; +show grants for test_yesprivs@localhost; +Grants for test_yesprivs@localhost +GRANT SUPER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT SELECT ON `priv_db`.* TO 'test_yesprivs'@'localhost' +connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK); +connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK); +show grants; +Grants for test_noprivs@localhost +GRANT SUPER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE ON `priv_db`.* TO 'test_noprivs'@'localhost' +use priv_db; +create trigger trg5b_1 before UPDATE on t1 for each row +set @test_var= new.f1; +set @test_var= 'before trig 3.5.3.8-1b'; +insert into t1 (f1) values ('insert 3.5.3.8-1b'); +select @test_var; +@test_var +before trig 3.5.3.8-1b +update t1 set f1= 'update 3.5.3.8-1b' where f1 = 'insert 3.5.3.8-1b'; +ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' +select @test_var; +@test_var +before trig 3.5.3.8-1b +drop trigger trg5b_1; +show grants; +Grants for test_yesprivs@localhost +GRANT SUPER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT SELECT ON `priv_db`.* TO 'test_yesprivs'@'localhost' +use priv_db; +create trigger trg5b_2 before UPDATE on t1 for each row +set @test_var= new.f1; +set @test_var= 'before trig 3.5.3.8-2b'; +insert into t1 (f1) values ('insert 3.5.3.8-2b'); +select @test_var; +@test_var +before trig 3.5.3.8-2b +update t1 set f1= 'update 3.5.3.8-2b' where f1 = 'insert 3.5.3.8-2b'; +select @test_var; +@test_var +update 3.5.3.8-2b +drop trigger trg5b_2; + +Testcase 3.5.3.8c: +------------------ +revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost; +grant SUPER on *.* to test_noprivs@localhost; +grant ALL on priv_db.t1 to test_noprivs@localhost; +revoke SELECT on priv_db.t1 from test_noprivs@localhost; +show grants for test_noprivs@localhost; +Grants for test_noprivs@localhost +GRANT SUPER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW ON `priv_db`.`t1` TO 'test_noprivs'@'localhost' +revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; +grant SUPER on *.* to test_yesprivs@localhost; +grant SELECT on priv_db.t1 to test_yesprivs@localhost; +show grants for test_yesprivs@localhost; +Grants for test_yesprivs@localhost +GRANT SUPER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT SELECT ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' +connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK); +connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK); +show grants; +Grants for test_noprivs@localhost +GRANT SUPER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW ON `priv_db`.`t1` TO 'test_noprivs'@'localhost' +use priv_db; +create trigger trg5c_1 before INSERT on t1 for each row +set @test_var= new.f1; +set @test_var= 'before trig 3.5.3.8-1c'; +insert into t1 (f1) values ('insert 3.5.3.8-1c'); +ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' +select @test_var; +@test_var +before trig 3.5.3.8-1c +drop trigger trg5c_1; +show grants; +Grants for test_yesprivs@localhost +GRANT SUPER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT SELECT ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' +use priv_db; +create trigger trg5c_2 before INSERT on t1 for each row +set @test_var= new.f1; +set @test_var='before trig 3.5.3.8-2c'; +insert into t1 (f1) values ('insert 3.5.3.8-2c'); +select @test_var; +@test_var +insert 3.5.3.8-2c +drop trigger trg5c_2; + +Testcase: 3.5.3.8d: +------------------- +revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost; +grant SUPER on *.* to test_noprivs@localhost; +grant UPDATE (f1), INSERT (f1) on priv_db.t1 to test_noprivs@localhost; +show grants for test_noprivs@localhost; +Grants for test_noprivs@localhost +GRANT SUPER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost' +revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; +grant SUPER on *.* to test_yesprivs@localhost; +grant SELECT (f1) on priv_db.t1 to test_yesprivs@localhost; +show grants for test_noprivs@localhost; +Grants for test_noprivs@localhost +GRANT SUPER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost' +connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK); +connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK); +show grants; +Grants for test_noprivs@localhost +GRANT SUPER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost' +use priv_db; +create trigger trg5d_1 before INSERT on t1 for each row +set @test_var= new.f1; +set @test_var='before trig 3.5.3.8-1d'; +insert into t1 (f1) values ('insert 3.5.3.8-1d'); +ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' +select @test_var; +@test_var +before trig 3.5.3.8-1d +drop trigger trg5d_1; +show grants; +Grants for test_yesprivs@localhost +GRANT SUPER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT SELECT (f1) ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' +use priv_db; +create trigger trg5d_2 before INSERT on t1 for each row +set @test_var= new.f1; +set @test_var='before trig 3.5.3.8-2d'; +insert into t1 (f1) values ('insert 3.5.3.8-2d'); +select @test_var; +@test_var +insert 3.5.3.8-2d +drop trigger trg5d_2; + +Testcase: 3.5.3.x: +------------------ +use priv_db; +drop table if exists t1; +drop table if exists t2; +create table t1 (f1 int) engine= <engine_to_be_used>; +create table t2 (f2 int) engine= <engine_to_be_used>; +revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; +grant SUPER on *.* to test_yesprivs@localhost; +grant SELECT, UPDATE on priv_db.t1 to test_yesprivs@localhost; +grant SELECT on priv_db.t2 to test_yesprivs@localhost; +show grants for test_yesprivs@localhost; +Grants for test_yesprivs@localhost +GRANT SUPER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT SELECT ON `priv_db`.`t2` TO 'test_yesprivs'@'localhost' +GRANT SELECT, UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' +connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK); +select current_user; +current_user +test_yesprivs@localhost +use priv_db; +create trigger trg1 before insert on t1 for each row +insert into t2 values (new.f1); +use priv_db; +insert into t1 (f1) values (4); +ERROR 42000: INSERT command denied to user 'test_yesprivs'@'localhost' for table 't2' +revoke SELECT on priv_db.t2 from test_yesprivs@localhost; +grant INSERT on priv_db.t2 to test_yesprivs@localhost; +insert into t1 (f1) values (4); +select f1 from t1 order by f1; +f1 +4 +select f2 from t2 order by f2; +f2 +4 +use priv_db; +drop trigger trg1; +create trigger trg2 before insert on t1 for each row +update t2 set f2=new.f1-1; +use priv_db; +insert into t1 (f1) values (2); +ERROR 42000: UPDATE command denied to user 'test_yesprivs'@'localhost' for table 't2' +revoke INSERT on priv_db.t2 from test_yesprivs@localhost; +grant UPDATE on priv_db.t2 to test_yesprivs@localhost; +insert into t1 (f1) values (2); +select f1 from t1 order by f1; +f1 +2 +4 +select f2 from t2 order by f2; +f2 +1 +use priv_db; +drop trigger trg2; +create trigger trg3 before insert on t1 for each row +select f2 into @aaa from t2 where f2=new.f1; +use priv_db; +insert into t1 (f1) values (1); +ERROR 42000: SELECT command denied to user 'test_yesprivs'@'localhost' for table 't2' +revoke UPDATE on priv_db.t2 from test_yesprivs@localhost; +grant SELECT on priv_db.t2 to test_yesprivs@localhost; +insert into t1 (f1) values (1); +select f1 from t1 order by f1; +f1 +1 +2 +4 +select f2 from t2 order by f2; +f2 +1 +select @aaa; +@aaa +1 +use priv_db; +drop trigger trg3; +create trigger trg4 before insert on t1 for each row +delete from t2; +use priv_db; +insert into t1 (f1) values (1); +ERROR 42000: DELETE command denied to user 'test_yesprivs'@'localhost' for table 't2' +revoke SELECT on priv_db.t2 from test_yesprivs@localhost; +grant DELETE on priv_db.t2 to test_yesprivs@localhost; +insert into t1 (f1) values (1); +select f1 from t1 order by f1; +f1 +1 +1 +2 +4 +select f2 from t2 order by f2; +f2 +drop database if exists priv_db; +drop user test_yesprivs@localhost; +drop user test_noprivs@localhost; +drop user test_noprivs; +use test; +drop table tb3; diff --git a/mysql-test/suite/funcs_1/r/ndb_trig_0407.result b/mysql-test/suite/funcs_1/r/ndb_trig_0407.result new file mode 100644 index 00000000000..a4871065c04 --- /dev/null +++ b/mysql-test/suite/funcs_1/r/ndb_trig_0407.result @@ -0,0 +1,473 @@ +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 char(50), +f122 char(50), +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 = <engine_to_be_used>; +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 + +Testcase: 3.5: +-------------- +create User test_general@localhost; +set password for test_general@localhost = password('PWD'); +revoke ALL PRIVILEGES, GRANT OPTION FROM test_general@localhost; +create User test_super@localhost; +set password for test_super@localhost = password('PWD'); +grant ALL on *.* to test_super@localhost with grant OPTION; +connect(localhost,test_general,PWD,test,MASTER_MYPORT,MASTER_MYSOCK); +connect(localhost,test_super,PWD,test,MASTER_MYPORT,MASTER_MYSOCK); + +Testcase 3.5.4: +--------------- +use test; + +Testcase 3.5.4.1: +----------------- +create database db_drop; +Use db_drop; +create table t1 (f1 char(30)) engine = <engine_to_be_used>; +grant INSERT, SELECT on db_drop.t1 to test_general; +Use db_drop; +Create trigger trg1 BEFORE INSERT on t1 +for each row set new.f1='Trigger 3.5.4.1'; +Use db_drop; +Insert into t1 values ('Insert error 3.5.4.1'); +Select * from t1 order by f1; +f1 +Trigger 3.5.4.1 +drop trigger trg1; +select trigger_schema, trigger_name, event_object_table +from information_schema.triggers order by trigger_name; +trigger_schema trigger_name event_object_table +Insert into t1 values ('Insert no trigger 3.5.4.1'); +Select * from t1 order by f1; +f1 +Insert no trigger 3.5.4.1 +Trigger 3.5.4.1 +drop trigger trg1; +drop database if exists db_drop; +revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost'; + +Testcase 3.5.4.2: +----------------- +create database db_drop2; +Use db_drop2; +drop table if exists t1_432 ; +create table t1_432 (f1 char (30)) engine = <engine_to_be_used>; +Drop trigger tr_does_not_exit; +ERROR HY000: Trigger does not exist +drop table if exists t1_432 ; +drop database if exists db_drop2; + +Testcase 3.5.4.3: +----------------- +create database db_drop3; +Use db_drop3; +drop table if exists t1_433 ; +drop table if exists t1_433a ; +create table t1_433 (f1 char (30)) engine = <engine_to_be_used>; +create table t1_433a (f1a char (5)) engine = <engine_to_be_used>; +CREATE TRIGGER trg3 BEFORE INSERT on t1_433 for each row +set new.f1 = 'Trigger 3.5.4.3'; +Drop trigger t1.433.trg3; +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 '.trg3' at line 1 +Drop trigger db_drop3.t1.433.trg3; +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 '.433.trg3' at line 1 +Drop trigger mysql.trg3; +ERROR HY000: Trigger does not exist +Drop trigger tbx.trg3; +ERROR HY000: Trigger does not exist +Drop trigger db_drop3.trg3; +drop table if exists t1_433; +drop table if exists t1_433a; +drop database if exists db_drop3; + +Testcase 3.5.4.4: +----------------- +create database db_drop4; +Use db_drop4; +create table t1 (f1 char(30)) engine = <engine_to_be_used>; +grant INSERT, SELECT on db_drop4.t1 to test_general; +Create trigger trg4 BEFORE INSERT on t1 +for each row set new.f1='Trigger 3.5.4.4'; +Use db_drop4; +Insert into t1 values ('Insert 3.5.4.4'); +Select * from t1; +f1 +Trigger 3.5.4.4 +Drop database db_drop4; +Show databases; +Database +information_schema +mysql +test +select trigger_schema, trigger_name, event_object_table +from information_schema.triggers +where information_schema.triggers.trigger_name='trg4'; +trigger_schema trigger_name event_object_table +create database db_drop4; +Use db_drop4; +create table t1 (f1 char(30)) engine = <engine_to_be_used>; +grant INSERT, SELECT on db_drop4.t1 to test_general; +Insert into t1 values ('2nd Insert 3.5.4.4'); +Select * from t1; +f1 +2nd Insert 3.5.4.4 +drop trigger trg4; +ERROR HY000: Trigger does not exist +drop database if exists db_drop4; +revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost'; + +Testcase 3.5.4.5: +----------------- +create database db_drop5; +Use db_drop5; +create table t1 (f1 char(50)) engine = <engine_to_be_used>; +grant INSERT, SELECT on t1 to test_general; +Create trigger trg5 BEFORE INSERT on t1 +for each row set new.f1='Trigger 3.5.4.5'; +Use db_drop5; +Insert into t1 values ('Insert 3.5.4.5'); +Select * from t1; +f1 +Trigger 3.5.4.5 +Drop table t1; +Show tables; +Tables_in_db_drop5 +select trigger_schema, trigger_name, event_object_table +from information_schema.triggers +where information_schema.triggers.trigger_name='trg5'; +trigger_schema trigger_name event_object_table +create table t1 (f1 char(50)) engine = <engine_to_be_used>; +grant INSERT, SELECT on t1 to test_general; +Insert into t1 values ('2nd Insert 3.5.4.5'); +Select * from t1; +f1 +2nd Insert 3.5.4.5 +drop trigger trg5; +ERROR HY000: Trigger does not exist +drop database if exists db_drop5; +revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost'; + +Testcase 3.5.5: +--------------- +use test; + +Testcase 3.5.5.1: +----------------- +Create trigger trg1 before INSERT on t100 for each row set new.f2=1000; +ERROR 42S02: Table 'test.t100' doesn't exist + +Testcase 3.5.5.2: +----------------- +Create temporary table t1_temp (f1 bigint signed, f2 bigint unsigned); +Create trigger trg2 before INSERT +on t1_temp for each row set new.f2=9999; +ERROR HY000: Trigger's 't1_temp' is view or temporary table +drop table t1_temp; + +Testcase 3.5.5.3: +----------------- +Create view vw3 as select f118 from tb3; +Create trigger trg3 before INSERT +on vw3 for each row set new.f118='s'; +ERROR HY000: 'test.vw3' is not BASE TABLE +drop view vw3; + +Testcase 3.5.5.4: +----------------- +create database dbtest_one; +create database dbtest_two; +use dbtest_two; +create table t2 (f1 char(15)) engine = <engine_to_be_used>; +use dbtest_one; +create trigger trg4 before INSERT +on dbtest_two.t2 for each row set new.f1='trig 3.5.5.4'; +ERROR HY000: Trigger in wrong schema +grant INSERT, SELECT on dbtest_two.t2 to test_general; +grant SELECT on dbtest_one.* to test_general; +use dbtest_two; +Insert into t2 values ('1st Insert 3.5.5.4'); +Warnings: +Warning 1265 Data truncated for column 'f1' at row 1 +Select * from t2; +f1 +1st Insert 3.5. +use dbtest_one; +Insert into dbtest_two.t2 values ('2nd Insert 3.5.5.4'); +Warnings: +Warning 1265 Data truncated for column 'f1' at row 1 +Select * from dbtest_two.t2 order by f1; +f1 +1st Insert 3.5. +2nd Insert 3.5. +revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost'; +DROP DATABASE if exists dbtest_one; +drop database if EXISTS dbtest_two; + +Testcase 3.5.6: +--------------- +use test; + +Testcase 3.5.6.1 (see Testcase 3.5.1.1) +--------------------------------------- + +Testcase 3.5.6.2 (see Testcase 3.5.1.1) +--------------------------------------- + +Testcase 3.5.6.3: +----------------- +Create trigger trg3_1 DURING UPDATE on tb3 for each row set new.f132=25; +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 'DURING UPDATE on tb3 for each row set new.f132=25' at line 1 +Create trigger trg3_2 TIME INSERT on tb3 for each row set new.f132=15; +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 'TIME INSERT on tb3 for each row set new.f132=15' at line 1 +drop trigger tb3.trg3_1; +drop trigger tb3.trg3_2; + +Testcase 3.5.6.4 (see Testcase 3.5.1.1) +--------------------------------------- + +Testcase 3.5.6.5 (see Testcase 3.5.1.1) +--------------------------------------- + +Testcase 3.5.7.1 (see Testcase 3.5.1.1) +--------------------------------------- + +Testcase 3.5.7.2 (see Testcase 3.5.1.1) +--------------------------------------- + +Testcase 3.5.7.3 (see Testcase 3.5.1.1) +--------------------------------------- + +Testcase 3.5.7.4: +----------------- +Create trigger trg4_1 BEFORE SELECT on tb3 for each row set new.f132=5; +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 'SELECT on tb3 for each row set new.f132=5' at line 1 +Create trigger trg4_2 AFTER VALUE on tb3 for each row set new.f132=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 'VALUE on tb3 for each row set new.f132=1' at line 1 +drop trigger tb3.trg4_1; +drop trigger tb3.trg4_2; + +Testcase 3.5.7.5 / 3.5.7.6: +--------------------------- +Create trigger trg5_1 BEFORE INSERT +on tb3 for each row set new.f122='Trigger1 3.5.7.5/6'; +Create trigger trg5_2 BEFORE INSERT +on tb3 for each row set new.f122='Trigger2 3.5.7.5'; +ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table' +Insert into tb3 (f121,f122) values ('Test 3.5.7.5/6','Insert 3.5.7.5'); +Select f121,f122 from tb3 where f121='Test 3.5.7.5/6'; +f121 f122 +Test 3.5.7.5/6 Trigger1 3.5.7.5/6 +update tb3 set f122='Update 3.5.7.6' where f121= 'Test 3.5.7.5/6'; +Select f121,f122 from tb3 where f121='Test 3.5.7.5/6'; +f121 f122 +Test 3.5.7.5/6 Update 3.5.7.6 +drop trigger trg5_1; +drop trigger trg5_2; +delete from tb3 where f121='Test 3.5.7.5/6'; + +Testcase 3.5.7.7 / 3.5.7.8: +--------------------------- +set @test_var='Before trig 3.5.7.7'; +Create trigger trg6_1 AFTER INSERT +on tb3 for each row set @test_var='Trigger1 3.5.7.7/8'; +Create trigger trg6_2 AFTER INSERT +on tb3 for each row set @test_var='Trigger2 3.5.7.7'; +ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table' +select @test_var; +@test_var +Before trig 3.5.7.7 +Insert into tb3 (f121,f122) values ('Test 3.5.7.7/8','Insert 3.5.7.7'); +Select f121,f122 from tb3 where f121='Test 3.5.7.7/8'; +f121 f122 +Test 3.5.7.7/8 Insert 3.5.7.7 +select @test_var; +@test_var +Trigger1 3.5.7.7/8 +update tb3 set f122='Update 3.5.7.8' where f121= 'Test 3.5.7.7/8'; +Select f121,f122 from tb3 where f121='Test 3.5.7.7/8'; +f121 f122 +Test 3.5.7.7/8 Update 3.5.7.8 +select @test_var; +@test_var +Trigger1 3.5.7.7/8 +drop trigger trg6_1; +drop trigger trg6_2; +delete from tb3 where f121='Test 3.5.7.7/8'; + +Testcase 3.5.7.9/10: +-------------------- +Create trigger trg7_1 BEFORE UPDATE +on tb3 for each row set new.f122='Trigger1 3.5.7.9/10'; +Create trigger trg7_2 BEFORE UPDATE +on tb3 for each row set new.f122='Trigger2 3.5.7.9'; +ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table' +Insert into tb3 (f121,f122) values ('Test 3.5.7.9/10','Insert 3.5.7.9'); +Select f121,f122 from tb3 where f121='Test 3.5.7.9/10'; +f121 f122 +Test 3.5.7.9/10 Insert 3.5.7.9 +update tb3 set f122='update 3.5.7.10' where f121='Test 3.5.7.9/10'; +Select f121,f122 from tb3 where f121='Test 3.5.7.9/10'; +f121 f122 +Test 3.5.7.9/10 Trigger1 3.5.7.9/10 +drop trigger trg7_1; +drop trigger trg7_2; +delete from tb3 where f121='Test 3.5.7.9/10'; + +Testcase 3.5.7.11/12: +--------------------- +set @test_var='Before trig 3.5.7.11'; +Create trigger trg8_1 AFTER UPDATE +on tb3 for each row set @test_var='Trigger 3.5.7.11/12'; +Create trigger trg8_2 AFTER UPDATE +on tb3 for each row set @test_var='Trigger2 3.5.7.11'; +ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table' +select @test_var; +@test_var +Before trig 3.5.7.11 +Insert into tb3 (f121,f122) values ('Test 3.5.7.11/12','Insert 3.5.7.11/12'); +select @test_var; +@test_var +Before trig 3.5.7.11 +Select f121,f122 from tb3 where f121='Test 3.5.7.11/12'; +f121 f122 +Test 3.5.7.11/12 Insert 3.5.7.11/12 +update tb3 set f122='update 3.5.7.12' where f121='Test 3.5.7.11/12'; +Select f121,f122 from tb3 where f121='Test 3.5.7.11/12'; +f121 f122 +Test 3.5.7.11/12 update 3.5.7.12 +select @test_var; +@test_var +Trigger 3.5.7.11/12 +delete from tb3 where f121='Test 3.5.7.11/12'; +drop trigger trg8_1; +drop trigger trg8_2; +delete from tb3 where f121='Test 3.5.7.11/12'; + +Testcase 3.5.7.13/14: +--------------------- +set @test_var=1; +Create trigger trg9_1 BEFORE DELETE +on tb3 for each row set @test_var=@test_var+1; +Create trigger trg9_2 BEFORE DELETE +on tb3 for each row set @test_var=@test_var+10; +ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table' +select @test_var; +@test_var +1 +Insert into tb3 (f121,f122) values ('Test 3.5.7.13/14','Insert 3.5.7.13'); +Select f121,f122 from tb3 where f121='Test 3.5.7.13/14'; +f121 f122 +Test 3.5.7.13/14 Insert 3.5.7.13 +select @test_var; +@test_var +1 +delete from tb3 where f121='Test 3.5.7.13/14'; +Select f121,f122 from tb3 where f121='Test 3.5.7.13/14'; +f121 f122 +select @test_var; +@test_var +2 +delete from tb3 where f121='Test 3.5.7.13/14'; +select @test_var; +@test_var +2 +drop trigger trg9_1; +drop trigger trg9_2; +delete from tb3 where f121='Test 3.5.7.13/14'; + +Testcase 3.5.7.15/16: +--------------------- +set @test_var=1; +Create trigger trg_3_406010_1 AFTER DELETE +on tb3 for each row set @test_var=@test_var+5; +Create trigger trg_3_406010_2 AFTER DELETE +on tb3 for each row set @test_var=@test_var+50; +ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table' +Create trigger trg_3_406010_1 AFTER INSERT +on tb3 for each row set @test_var=@test_var+1; +ERROR HY000: Trigger already exists +select @test_var; +@test_var +1 +Insert into tb3 (f121,f122) values ('Test 3.5.7.15/16','Insert 3.5.7.15/16'); +Select f121,f122 from tb3 where f121='Test 3.5.7.15/16'; +f121 f122 +Test 3.5.7.15/16 Insert 3.5.7.15/16 +select @test_var; +@test_var +1 +delete from tb3 where f121='Test 3.5.7.15/16'; +Select f121,f122 from tb3 where f121='Test 3.5.7.15/16'; +f121 f122 +select @test_var; +@test_var +6 +delete from tb3 where f121='Test 3.5.7.15/16'; +select @test_var; +@test_var +6 +drop trigger trg_3_406010_1; +drop trigger trg_3_406010_2; +delete from tb3 where f121='Test 3.5.7.15/16'; + +Testcase 3.5.7.17 (see Testcase 3.5.1.1) +---------------------------------------- +drop user test_general@localhost; +drop user test_general; +drop user test_super@localhost; +DROP TABLE test.tb3; diff --git a/mysql-test/suite/funcs_1/r/ndb_trig_08.result b/mysql-test/suite/funcs_1/r/ndb_trig_08.result new file mode 100644 index 00000000000..6ced07cef73 --- /dev/null +++ b/mysql-test/suite/funcs_1/r/ndb_trig_08.result @@ -0,0 +1,529 @@ +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 char(50), +f122 char(50), +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 = <engine_to_be_used>; +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 + +Testcase: 3.5: +-------------- +create User test_general@localhost; +set password for test_general@localhost = password('PWD'); +revoke ALL PRIVILEGES, GRANT OPTION FROM test_general@localhost; +create User test_super@localhost; +set password for test_super@localhost = password('PWD'); +grant ALL on *.* to test_super@localhost with grant OPTION; +connect(localhost,test_general,PWD,test,MASTER_MYPORT,MASTER_MYSOCK); +connect(localhost,test_super,PWD,test,MASTER_MYPORT,MASTER_MYSOCK); + +Testcase 3.5.8.1: (implied in previous tests) +--------------------------------------------- + +Testcase 3.5.8.2: (implied in previous tests) +--------------------------------------------- + +Testcase 3.5.8.3/4: +------------------- +create database db_test; +grant SELECT, INSERT, UPDATE, DELETE on db_test.* to test_general; +grant LOCK TABLES on db_test.* to test_general; +Use db_test; +create table t1_i ( +i120 char ascii not null DEFAULT b'101', +i136 smallint zerofill not null DEFAULT 999, +i144 int zerofill not null DEFAULT 99999, +i163 decimal (63,30)) engine=<engine_to_be_used>; +create table t1_u ( +u120 char ascii not null DEFAULT b'101', +u136 smallint zerofill not null DEFAULT 999, +u144 int zerofill not null DEFAULT 99999, +u163 decimal (63,30)) engine=<engine_to_be_used>; +create table t1_d ( +d120 char ascii not null DEFAULT b'101', +d136 smallint zerofill not null DEFAULT 999, +d144 int zerofill not null DEFAULT 99999, +d163 decimal (63,30)) engine=<engine_to_be_used>; +Insert into t1_u values ('a',111,99999,999.99); +Insert into t1_u values ('b',222,99999,999.99); +Insert into t1_u values ('c',333,99999,999.99); +Insert into t1_u values ('d',222,99999,999.99); +Insert into t1_u values ('e',222,99999,999.99); +Insert into t1_u values ('f',333,99999,999.99); +Insert into t1_d values ('a',111,99999,999.99); +Insert into t1_d values ('b',222,99999,999.99); +Insert into t1_d values ('c',333,99999,999.99); +Insert into t1_d values ('d',444,99999,999.99); +Insert into t1_d values ('e',222,99999,999.99); +Insert into t1_d values ('f',222,99999,999.99); + +3.5.8.4 - multiple SQL +---------------------- +use test; +Create trigger trg1 AFTER INSERT on tb3 for each row +BEGIN +insert into db_test.t1_i +values (new.f120, new.f136, new.f144, new.f163); +update db_test.t1_u +set u144=new.f144, u163=new.f163 +where u136=new.f136; +delete from db_test.t1_d where d136= new.f136; +select sum(db_test.t1_u.u163) into @test_var from db_test.t1_u +where u136= new.f136; +END// +Use test; +set @test_var=0; +Insert into tb3 (f120, f122, f136, f144, f163) +values ('1', 'Test 3.5.8.4', 222, 23456, 1.05); +Select f120, f122, f136, f144, f163 from tb3 where f122= 'Test 3.5.8.4'; +f120 f122 f136 f144 f163 +1 Test 3.5.8.4 00222 0000023456 1.050000000000000000000000000000 +select * from db_test.t1_i; +i120 i136 i144 i163 +1 00222 0000023456 1.050000000000000000000000000000 +select * from db_test.t1_u; +u120 u136 u144 u163 +a 00111 0000099999 999.990000000000000000000000000000 +b 00222 0000023456 1.050000000000000000000000000000 +c 00333 0000099999 999.990000000000000000000000000000 +d 00222 0000023456 1.050000000000000000000000000000 +e 00222 0000023456 1.050000000000000000000000000000 +f 00333 0000099999 999.990000000000000000000000000000 +select * from db_test.t1_d; +d120 d136 d144 d163 +a 00111 0000099999 999.990000000000000000000000000000 +c 00333 0000099999 999.990000000000000000000000000000 +d 00444 0000099999 999.990000000000000000000000000000 +select @test_var; +@test_var +3.150000000000000000000000000000 + +3.5.8.4 - single SQL - insert +----------------------------- +Create trigger trg2 BEFORE UPDATE on tb3 for each row +BEGIN +insert into db_test.t1_i +values (new.f120, new.f136, new.f144, new.f163); +END// +Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; +f120 f122 f136 f144 f163 +1 Test 3.5.8.4 00222 0000023456 1.050000000000000000000000000000 +select * from db_test.t1_i order by i120; +i120 i136 i144 i163 +1 00222 0000023456 1.050000000000000000000000000000 +update tb3 set f120='I', f122='Test 3.5.8.4-Single Insert' + where f122='Test 3.5.8.4'; +Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; +f120 f122 f136 f144 f163 +I Test 3.5.8.4-Single Insert 00222 0000023456 1.050000000000000000000000000000 +select * from db_test.t1_i order by i120; +i120 i136 i144 i163 +1 00222 0000023456 1.050000000000000000000000000000 +I 00222 0000023456 1.050000000000000000000000000000 + +3.5.8.4 - single SQL - update +----------------------------- +drop trigger trg2; +Create trigger trg3 BEFORE UPDATE on tb3 for each row +update db_test.t1_u +set u120=new.f120 +where u136=new.f136; +update tb3 set f120='U', f122='Test 3.5.8.4-Single Update' + where f122='Test 3.5.8.4-Single Insert'; +Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; +f120 f122 f136 f144 f163 +U Test 3.5.8.4-Single Update 00222 0000023456 1.050000000000000000000000000000 +select * from db_test.t1_u order by u120; +u120 u136 u144 u163 +a 00111 0000099999 999.990000000000000000000000000000 +c 00333 0000099999 999.990000000000000000000000000000 +f 00333 0000099999 999.990000000000000000000000000000 +U 00222 0000023456 1.050000000000000000000000000000 +U 00222 0000023456 1.050000000000000000000000000000 +U 00222 0000023456 1.050000000000000000000000000000 + +3.5.8.3/4 - single SQL - delete +------------------------------- +drop trigger trg3; +Create trigger trg4 AFTER UPDATE on tb3 for each row +delete from db_test.t1_d where d136= new.f136; +update tb3 set f120='D', f136=444, +f122='Test 3.5.8.4-Single Delete' + where f122='Test 3.5.8.4-Single Update'; +Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; +f120 f122 f136 f144 f163 +D Test 3.5.8.4-Single Delete 00444 0000023456 1.050000000000000000000000000000 +select * from db_test.t1_d order by d120; +d120 d136 d144 d163 +a 00111 0000099999 999.990000000000000000000000000000 +c 00333 0000099999 999.990000000000000000000000000000 + +3.5.8.3/4 - single SQL - select +------------------------------- +drop trigger trg4; +Create trigger trg5 AFTER UPDATE on tb3 for each row +select sum(db_test.t1_u.u163) into @test_var from db_test.t1_u +where u136= new.f136; +set @test_var=0; +update tb3 set f120='S', f136=111, +f122='Test 3.5.8.4-Single Select' + where f122='Test 3.5.8.4-Single Delete'; +Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; +f120 f122 f136 f144 f163 +S Test 3.5.8.4-Single Select 00111 0000023456 1.050000000000000000000000000000 +select @test_var; +@test_var +999.990000000000000000000000000000 +drop trigger trg1; +drop trigger trg5; +drop database if exists db_test; +delete from tb3 where f122 like 'Test 3.5.8.4%'; +revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost'; + +Testcase 3.5.8.5 (IF): +---------------------- +create trigger trg2 before insert on tb3 for each row +BEGIN +IF new.f120='1' then +set @test_var='one', new.f120='2'; +ELSEIF new.f120='2' then +set @test_var='two', new.f120='3'; +ELSEIF new.f120='3' then +set @test_var='three', new.f120='4'; +END IF; +IF (new.f120='4') and (new.f136=10) then +set @test_var2='2nd if', new.f120='d'; +ELSE +set @test_var2='2nd else', new.f120='D'; +END IF; +END// +set @test_var='Empty', @test_var2=0; +Insert into tb3 (f120, f122, f136) values ('1', 'Test 3.5.8.5-if', 101); +select f120, f122, f136, @test_var, @test_var2 +from tb3 where f122 = 'Test 3.5.8.5-if' order by f136; +f120 f122 f136 @test_var @test_var2 +D Test 3.5.8.5-if 00101 one 2nd else +Insert into tb3 (f120, f122, f136) values ('2', 'Test 3.5.8.5-if', 102); +select f120, f122, f136, @test_var, @test_var2 +from tb3 where f122 = 'Test 3.5.8.5-if' order by f136; +f120 f122 f136 @test_var @test_var2 +D Test 3.5.8.5-if 00101 two 2nd else +D Test 3.5.8.5-if 00102 two 2nd else +Insert into tb3 (f120, f122, f136) values ('3', 'Test 3.5.8.5-if', 10); +select f120, f122, f136, @test_var, @test_var2 +from tb3 where f122 = 'Test 3.5.8.5-if' order by f136; +f120 f122 f136 @test_var @test_var2 +d Test 3.5.8.5-if 00010 three 2nd if +D Test 3.5.8.5-if 00101 three 2nd if +D Test 3.5.8.5-if 00102 three 2nd if +Insert into tb3 (f120, f122, f136) values ('3', 'Test 3.5.8.5-if', 103); +select f120, f122, f136, @test_var, @test_var2 +from tb3 where f122 = 'Test 3.5.8.5-if' order by f136; +f120 f122 f136 @test_var @test_var2 +d Test 3.5.8.5-if 00010 three 2nd else +D Test 3.5.8.5-if 00101 three 2nd else +D Test 3.5.8.5-if 00102 three 2nd else +D Test 3.5.8.5-if 00103 three 2nd else +create trigger trg3 before update on tb3 for each row +BEGIN +ELSEIF new.f120='2' then +END IF; +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 'ELSEIF new.f120='2' then +END IF; +END' at line 3 +drop trigger trg3// +create trigger trg4 before update on tb3 for each row +BEGIN +IF (new.f120='4') and (new.f136=10) then +set @test_var2='2nd if', new.f120='d'; +ELSE +set @test_var2='2nd else', new.f120='D'; +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 '' at line 7 +drop trigger trg4; +drop trigger trg2; +delete from tb3 where f121='Test 3.5.8.5-if'; + +Testcase 3.5.8.5-case: +---------------------- +create trigger trg3 before insert on tb3 for each row +BEGIN +SET new.f120=char(ascii(new.f120)-32); +CASE +when new.f136<100 then set new.f136=new.f136+120; +when new.f136<10 then set new.f144=777; +when new.f136>100 then set new.f120=new.f136-1; +END case; +CASE +when new.f136=200 then set @test_var=CONCAT(new.f120, '='); +ELSE set @test_var=concat(new.f120, '*'); +END case; +CASE new.f144 +when 1 then set @test_var=concat(@test_var, 'one'); +when 2 then set @test_var=concat(@test_var, 'two'); +when 3 then set @test_var=concat(@test_var, 'three'); +when 4 then set @test_var=concat(@test_var, 'four'); +when 5 then set @test_var=concat(@test_var, 'five'); +when 6 then set @test_var=concat(@test_var, 'six'); +when 7 then set @test_var=concat(@test_var, 'seven'); +when 8 then set @test_var=concat(@test_var, 'eight'); +when 9 then set @test_var=concat(@test_var, 'nine'); +when 10 then set @test_var=concat(@test_var, 'ten'); +when 11 then set @test_var=concat(@test_var, 'eleven'); +when 12 then set @test_var=concat(@test_var, 'twelve'); +when 13 then set @test_var=concat(@test_var, 'thirteen'); +when 14 then set @test_var=concat(@test_var, 'fourteen'); +when 15 then set @test_var=concat(@test_var, 'fifteen'); +ELSE set @test_var=CONCAT(new.f120, '*', new.f144); +END case; +END// +set @test_var='Empty'; +Insert into tb3 (f120, f122, f136, f144) +values ('a', 'Test 3.5.8.5-case', 5, 7); +select f120, f122, f136, f144, @test_var +from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136; +f120 f122 f136 f144 @test_var +A Test 3.5.8.5-case 00125 0000000007 A*seven +Insert into tb3 (f120, f122, f136, f144) +values ('b', 'Test 3.5.8.5-case', 71,16); +select f120, f122, f136, f144, @test_var +from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136; +f120 f122 f136 f144 @test_var +A Test 3.5.8.5-case 00125 0000000007 B*0000000016 +B Test 3.5.8.5-case 00191 0000000016 B*0000000016 +Insert into tb3 (f120, f122, f136, f144) +values ('c', 'Test 3.5.8.5-case', 80,1); +select f120, f122, f136, f144, @test_var +from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136; +f120 f122 f136 f144 @test_var +A Test 3.5.8.5-case 00125 0000000007 C=one +B Test 3.5.8.5-case 00191 0000000016 C=one +C Test 3.5.8.5-case 00200 0000000001 C=one +Insert into tb3 (f120, f122, f136) +values ('d', 'Test 3.5.8.5-case', 152); +Warnings: +Warning 1265 Data truncated for column 'f120' at row 1 +select f120, f122, f136, f144, @test_var +from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136; +f120 f122 f136 f144 @test_var +1 Test 3.5.8.5-case 00152 0000099999 1*0000099999 +A Test 3.5.8.5-case 00125 0000000007 1*0000099999 +B Test 3.5.8.5-case 00191 0000000016 1*0000099999 +C Test 3.5.8.5-case 00200 0000000001 1*0000099999 +Insert into tb3 (f120, f122, f136, f144) +values ('e', 'Test 3.5.8.5-case', 200, 8); +Warnings: +Warning 1265 Data truncated for column 'f120' at row 1 +select f120, f122, f136, f144, @test_var +from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136; +f120 f122 f136 f144 @test_var +1 Test 3.5.8.5-case 00152 0000099999 1=eight +1 Test 3.5.8.5-case 00200 0000000008 1=eight +A Test 3.5.8.5-case 00125 0000000007 1=eight +B Test 3.5.8.5-case 00191 0000000016 1=eight +C Test 3.5.8.5-case 00200 0000000001 1=eight +Insert into tb3 (f120, f122, f136, f144) +values ('f', 'Test 3.5.8.5-case', 100, 8); +select f120, f122, f136, f144, @test_var +from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136; +f120 f122 f136 f144 @test_var +1 Test 3.5.8.5-case 00152 0000099999 1=eight +1 Test 3.5.8.5-case 00200 0000000008 1=eight +A Test 3.5.8.5-case 00125 0000000007 1=eight +B Test 3.5.8.5-case 00191 0000000016 1=eight +C Test 3.5.8.5-case 00200 0000000001 1=eight +create trigger trg3a before update on tb3 for each row +BEGIN +CASE +when new.f136<100 then set new.f120='p'; +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 '' at line 5 +drop trigger trg3a; +drop trigger trg3; +delete from tb3 where f121='Test 3.5.8.5-case'; + +Testcase 3.5.8.5-loop/leave: +---------------------------- +Create trigger trg4 after insert on tb3 for each row +BEGIN +set @counter=0, @flag='Initial'; +Label1: loop +if new.f136<new.f144 then +set @counter='Nothing to loop'; +leave Label1; +else +set @counter=@counter+1; +if new.f136=new.f144+@counter then +set @counter=concat(@counter, ' loops'); +leave Label1; +end if; +end if; +iterate label1; +set @flag='Final'; +END loop Label1; +END// +Insert into tb3 (f122, f136, f144) +values ('Test 3.5.8.5-loop', 2, 8); +select @counter, @flag; +@counter @flag +Nothing to loop Initial +Insert into tb3 (f122, f136, f144) +values ('Test 3.5.8.5-loop', 11, 8); +select @counter, @flag; +@counter @flag +3 loops Initial +Create trigger trg4_2 after update on tb3 for each row +BEGIN +Label1: loop +set @counter=@counter+1; +END; +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 '; +END' at line 5 +drop trigger trg4_2; +drop trigger trg4; +delete from tb3 where f122='Test 3.5.8.5-loop'; + +Testcase 3.5.8.5-repeat: +------------------------ +Create trigger trg6 after insert on tb3 for each row +BEGIN +rp_label: REPEAT +SET @counter1 = @counter1 + 1; +IF (@counter1 MOD 2 = 0) THEN ITERATE rp_label; +END IF; +SET @counter2 = @counter2 + 1; +UNTIL @counter1> new.f136 END REPEAT rp_label; +END// +set @counter1= 0, @counter2= 0; +Insert into tb3 (f122, f136) +values ('Test 3.5.8.5-repeat', 13); +select @counter1, @counter2; +@counter1 @counter2 +15 8 +Create trigger trg6_2 after update on tb3 for each row +BEGIN +REPEAT +SET @counter2 = @counter2 + 1; +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 'END' at line 5 +drop trigger trg6; +delete from tb3 where f122='Test 3.5.8.5-repeat'; + +Testcase 3.5.8.5-while: +----------------------- +Create trigger trg7 after insert on tb3 for each row +wl_label: WHILE @counter1 < new.f136 DO +SET @counter1 = @counter1 + 1; +IF (@counter1 MOD 2 = 0) THEN ITERATE wl_label; +END IF; +SET @counter2 = @counter2 + 1; +END WHILE wl_label// +set @counter1= 0, @counter2= 0; +Insert into tb3 (f122, f136) +values ('Test 3.5.8.5-while', 7); +select @counter1, @counter2; +@counter1 @counter2 +7 4 +Create trigger trg7_2 after update on tb3 for each row +BEGIN +WHILE @counter1 < new.f136 +SET @counter1 = @counter1 + 1; +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 @counter1 = @counter1 + 1; +END' at line 4 +delete from tb3 where f122='Test 3.5.8.5-while'; +drop trigger trg7; + +Testcase 3.5.8.6: (requirement void) +------------------------------------ +CREATE PROCEDURE sp_01 () BEGIN set @v1=1; END// +CREATE TRIGGER trg8_1 BEFORE UPDATE ON tb3 FOR EACH ROW +BEGIN +CALL sp_01 (); +END// +Insert into tb3 (f120, f122, f136) values ('6', 'Test 3.5.8.6-insert', 101); +update tb3 set f120='S', f136=111, +f122='Test 3.5.8.6-tr8_1' + where f122='Test 3.5.8.6-insert'; +select f120, f122 +from tb3 where f122 like 'Test 3.5.8.6%' order by f120; +f120 f122 +S Test 3.5.8.6-tr8_1 +DROP TRIGGER trg8_1; +DROP PROCEDURE sp_01; + +Testcase 3.5.8.7 +---------------- +Create trigger trg9_1 before update on tb3 for each row +BEGIN +Start transaction; +Set new.f120='U'; +Commit; +END// +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +Create trigger trg9_2 before delete on tb3 for each row +BEGIN +Start transaction; +Set @var2=old.f120; +Rollback; +END// +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +drop user test_general@localhost; +drop user test_general; +drop user test_super@localhost; +DROP TABLE test.tb3; diff --git a/mysql-test/suite/funcs_1/r/ndb_trig_09.result b/mysql-test/suite/funcs_1/r/ndb_trig_09.result new file mode 100644 index 00000000000..b84f4f60583 --- /dev/null +++ b/mysql-test/suite/funcs_1/r/ndb_trig_09.result @@ -0,0 +1,267 @@ +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 char(50), +f122 char(50), +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 = <engine_to_be_used>; +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/memory_tb3.txt' +into table tb3; + +Testcase 3.5.9.1/2: +------------------- +Create trigger trg1 BEFORE UPDATE on tb3 for each row +set new.f142 = 94087, @counter=@counter+1; +TotalRows +10 +Affected +9 +NotAffected +1 +NewValuew +0 +set @counter=0; +Update tb3 Set f142='1' where f130<100; +select count(*) as ExpectedChanged, @counter as TrigCounter +from tb3 where f142=94087; +ExpectedChanged TrigCounter +9 9 +select count(*) as ExpectedNotChange from tb3 +where f130<100 and f142<>94087; +ExpectedNotChange +0 +select count(*) as NonExpectedChanged from tb3 +where f130>=130 and f142=94087; +NonExpectedChanged +0 +drop trigger trg1; + +Testcase 3.5.9.3: +----------------- +Create trigger trg2_a before update on tb3 for each row +set @tr_var_b4_118=old.f118, @tr_var_b4_121=old.f121, +@tr_var_b4_122=old.f122, @tr_var_b4_136=old.f136, +@tr_var_b4_163=old.f163; +Create trigger trg2_b after update on tb3 for each row +set @tr_var_af_118=old.f118, @tr_var_af_121=old.f121, +@tr_var_af_122=old.f122, @tr_var_af_136=old.f136, +@tr_var_af_163=old.f163; +Create trigger trg2_c before delete on tb3 for each row +set @tr_var_b4_118=old.f118, @tr_var_b4_121=old.f121, +@tr_var_b4_122=old.f122, @tr_var_b4_136=old.f136, +@tr_var_b4_163=old.f163; +Create trigger trg2_d after delete on tb3 for each row +set @tr_var_af_118=old.f118, @tr_var_af_121=old.f121, +@tr_var_af_122=old.f122, @tr_var_af_136=old.f136, +@tr_var_af_163=old.f163; +@tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_163 +0 0 0 0 0 +@tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_163 +0 0 0 0 0 +Insert into tb3 (f122, f136, f163) +values ('Test 3.5.9.3', 7, 123.17); +Update tb3 Set f136=8 where f122='Test 3.5.9.3'; +select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3' order by f136; +f118 f121 f122 f136 f163 +a NULL Test 3.5.9.3 00008 123.170000000000000000000000000000 +select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, +@tr_var_b4_136, @tr_var_b4_163; +@tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_163 +a NULL Test 3.5.9.3 7 123.170000000000000000000000000000 +select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, +@tr_var_af_136, @tr_var_af_163; +@tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_163 +a NULL Test 3.5.9.3 7 123.170000000000000000000000000000 +@tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_163 +0 0 0 0 0 +@tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_163 +0 0 0 0 0 +delete from tb3 where f122='Test 3.5.9.3'; +select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3' order by f136; +f118 f121 f122 f136 f163 +select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, +@tr_var_b4_136, @tr_var_b4_163; +@tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_163 +a NULL Test 3.5.9.3 8 123.170000000000000000000000000000 +select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, +@tr_var_af_136, @tr_var_af_163; +@tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_163 +a NULL Test 3.5.9.3 8 123.170000000000000000000000000000 +drop trigger trg2_a; +drop trigger trg2_b; +drop trigger trg2_c; +drop trigger trg2_d; + +Testcase 3.5.9.4: +----------------- +Create trigger trg3_a before insert on tb3 for each row +set @tr_var_b4_118=new.f118, @tr_var_b4_121=new.f121, +@tr_var_b4_122=new.f122, @tr_var_b4_136=new.f136, +@tr_var_b4_151=new.f151, @tr_var_b4_163=new.f163; +Create trigger trg3_b after insert on tb3 for each row +set @tr_var_af_118=new.f118, @tr_var_af_121=new.f121, +@tr_var_af_122=new.f122, @tr_var_af_136=new.f136, +@tr_var_af_151=new.f151, @tr_var_af_163=new.f163; +Create trigger trg3_c before update on tb3 for each row +set @tr_var_b4_118=new.f118, @tr_var_b4_121=new.f121, +@tr_var_b4_122=new.f122, @tr_var_b4_136=new.f136, +@tr_var_b4_151=new.f151, @tr_var_b4_163=new.f163; +Create trigger trg3_d after update on tb3 for each row +set @tr_var_af_118=new.f118, @tr_var_af_121=new.f121, +@tr_var_af_122=new.f122, @tr_var_af_136=new.f136, +@tr_var_af_151=new.f151, @tr_var_af_163=new.f163; +@tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_151 @tr_var_b4_163 +0 0 0 0 0 0 +@tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_151 @tr_var_af_163 +0 0 0 0 0 0 +Insert into tb3 (f122, f136, f151, f163) +values ('Test 3.5.9.4', 7, DEFAULT, 995.24); +select f118, f121, f122, f136, f151, f163 from tb3 +where f122 like 'Test 3.5.9.4%' order by f163; +f118 f121 f122 f136 f151 f163 +a NULL Test 3.5.9.4 00007 999 995.240000000000000000000000000000 +select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, +@tr_var_b4_136, @tr_var_b4_151, @tr_var_b4_163; +@tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_151 @tr_var_b4_163 +a NULL Test 3.5.9.4 7 999 995.240000000000000000000000000000 +select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, +@tr_var_af_136, @tr_var_af_151, @tr_var_af_163; +@tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_151 @tr_var_af_163 +a NULL Test 3.5.9.4 7 999 995.240000000000000000000000000000 +@tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_151 @tr_var_b4_163 +0 0 0 0 0 0 +@tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_151 @tr_var_af_163 +0 0 0 0 0 0 +Update tb3 Set f122='Test 3.5.9.4-trig', f136=NULL, f151=DEFAULT, f163=NULL +where f122='Test 3.5.9.4'; +Warnings: +Warning 1048 Column 'f136' cannot be null +select f118, f121, f122, f136, f151, f163 from tb3 +where f122 like 'Test 3.5.9.4-trig' order by f163; +f118 f121 f122 f136 f151 f163 +a NULL Test 3.5.9.4-trig 00000 999 NULL +select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, +@tr_var_b4_136, @tr_var_b4_151, @tr_var_b4_163; +@tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_151 @tr_var_b4_163 +a NULL Test 3.5.9.4-trig 0 999 NULL +select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, +@tr_var_af_136, @tr_var_af_151, @tr_var_af_163; +@tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_151 @tr_var_af_163 +a NULL Test 3.5.9.4-trig 0 999 NULL +drop trigger trg3_a; +drop trigger trg3_b; +drop trigger trg3_c; +drop trigger trg3_d; +delete from tb3 where f122='Test 3.5.9.4-trig'; + +Testcase 3.5.9.5: (implied in previous tests) +--------------------------------------------- + +Testcase 3.5.9.6: +----------------- +create trigger trg4a before insert on tb3 for each row +set @temp1= old.f120; +ERROR HY000: There is no OLD row in on INSERT trigger +create trigger trg4b after insert on tb3 for each row +set old.f120= 'test'; +ERROR HY000: Updating of OLD row is not allowed in trigger +drop trigger trg4a; +drop trigger trg4b; + +Testcase 3.5.9.7: (implied in previous tests) +--------------------------------------------- + +Testcase 3.5.9.8: (implied in previous tests) +--------------------------------------------- + +Testcase 3.5.9.9: +----------------- +create trigger trg5a before DELETE on tb3 for each row +set @temp1=new.f122; +ERROR HY000: There is no NEW row in on DELETE trigger +create trigger trg5b after DELETE on tb3 for each row +set new.f122='test'; +ERROR HY000: There is no NEW row in on DELETE trigger +drop trigger trg5a; +drop trigger trg5b; + +Testcase 3.5.9.10: (implied in previous tests) +---------------------------------------------- + +Testcase 3.5.9.11: covered by 3.5.9.9 +------------------------------------- + +Testcase 3.5.9.12: covered by 3.5.9.6 +------------------------------------- + +Testcase 3.5.9.13: +------------------ +create trigger trg6a before UPDATE on tb3 for each row +set old.f118='C', new.f118='U'; +ERROR HY000: Updating of OLD row is not allowed in trigger +create trigger trg6b after INSERT on tb3 for each row +set old.f136=163, new.f118='U'; +ERROR HY000: Updating of OLD row is not allowed in trigger +create trigger trg6c after UPDATE on tb3 for each row +set old.f136=NULL; +ERROR HY000: Updating of OLD row is not allowed in trigger +drop trigger trg6a; +drop trigger trg6b; +drop trigger trg6c; + +Testcase 3.5.9.14: (implied in previous tests) +---------------------------------------------- +DROP TABLE test.tb3; diff --git a/mysql-test/suite/funcs_1/r/ndb_trig_1011ext.result b/mysql-test/suite/funcs_1/r/ndb_trig_1011ext.result new file mode 100644 index 00000000000..60b70d1c981 --- /dev/null +++ b/mysql-test/suite/funcs_1/r/ndb_trig_1011ext.result @@ -0,0 +1,394 @@ +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 char(50), +f122 char(50), +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 = <engine_to_be_used>; +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/memory_tb3.txt' +into table tb3; + +Testcase 3.5.10.1/2/3: +---------------------- +Create view vw11 as select * from tb3 +where f122 like 'Test 3.5.10.1/2/3%'; +Create trigger trg1a before insert on tb3 +for each row set new.f163=111.11; +Create trigger trg1b after insert on tb3 +for each row set @test_var='After Insert'; +Create trigger trg1c before update on tb3 +for each row set new.f121='Y', new.f122='Test 3.5.10.1/2/3-Update'; +Create trigger trg1d after update on tb3 +for each row set @test_var='After Update'; +Create trigger trg1e before delete on tb3 +for each row set @test_var=5; +Create trigger trg1f after delete on tb3 +for each row set @test_var= 2* @test_var+7; +Insert into vw11 (f122, f151) values ('Test 3.5.10.1/2/3', 1); +Insert into vw11 (f122, f151) values ('Test 3.5.10.1/2/3', 2); +Insert into vw11 (f122, f151) values ('Not in View', 3); +select f121, f122, f151, f163 +from tb3 where f122 like 'Test 3.5.10.1/2/3%' order by f151; +f121 f122 f151 f163 +NULL Test 3.5.10.1/2/3 1 111.110000000000000000000000000000 +NULL Test 3.5.10.1/2/3 2 111.110000000000000000000000000000 +select f121, f122, f151, f163 from vw11; +f121 f122 f151 f163 +NULL Test 3.5.10.1/2/3 1 111.110000000000000000000000000000 +NULL Test 3.5.10.1/2/3 2 111.110000000000000000000000000000 +select f121, f122, f151, f163 +from tb3 where f122 like 'Not in View'; +f121 f122 f151 f163 +NULL Not in View 3 111.110000000000000000000000000000 +Update vw11 set f163=1; +select f121, f122, f151, f163 from tb3 +where f122 like 'Test 3.5.10.1/2/3%' order by f151; +f121 f122 f151 f163 +Y Test 3.5.10.1/2/3-Update 1 1.000000000000000000000000000000 +Y Test 3.5.10.1/2/3-Update 2 1.000000000000000000000000000000 +select f121, f122, f151, f163 from vw11; +f121 f122 f151 f163 +Y Test 3.5.10.1/2/3-Update 1 1.000000000000000000000000000000 +Y Test 3.5.10.1/2/3-Update 2 1.000000000000000000000000000000 +set @test_var=0; +Select @test_var as 'before delete'; +before delete +0 +delete from vw11 where f151=1; +select f121, f122, f151, f163 from tb3 +where f122 like 'Test 3.5.10.1/2/3%' order by f151; +f121 f122 f151 f163 +Y Test 3.5.10.1/2/3-Update 2 1.000000000000000000000000000000 +select f121, f122, f151, f163 from vw11; +f121 f122 f151 f163 +Y Test 3.5.10.1/2/3-Update 2 1.000000000000000000000000000000 +Select @test_var as 'after delete'; +after delete +17 +drop view vw11; +drop trigger trg1a; +drop trigger trg1b; +drop trigger trg1c; +drop trigger trg1d; +drop trigger trg1e; +drop trigger trg1f; +delete from tb3 where f122 like 'Test 3.5.10.1/2/3%'; + +Testcase 3.5.10.4: +------------------ +create table tb_load (f1 int, f2 char(25),f3 int) engine = <engine_to_be_used>; +Create trigger trg4 before insert on tb_load +for each row set new.f3=-(new.f1 div 5), @counter= @counter+1; +set @counter= 0; +select @counter as 'Rows Loaded Before'; +Rows Loaded Before +0 +load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/t9.txt' into table tb_load; +select @counter as 'Rows Loaded After'; +Rows Loaded After +10 +Select * from tb_load order by f1 limit 10; +f1 f2 f3 +-5000 a` 1000 +-4999 aaa 999 +-4998 abaa 999 +-4997 acaaa 999 +-4996 adaaaa 999 +-4995 aeaaaaa 999 +-4994 afaaaaaa 998 +-4993 agaaaaaaa 998 +-4992 a^aaaaaaaa 998 +-4991 a_aaaaaaaaa 998 +drop trigger trg4; +drop table tb_load; + +Testcase 3.5.10.5: (implemented in trig_frkey.test) +--------------------------------------------------- + +Testcase 3.5.10.6: (implemented in trig_frkey.test) +--------------------------------------------------- + +Testcase 3.5.10.extra: +---------------------- +create table t1_sp (var136 tinyint, var151 decimal) engine = <engine_to_be_used>; +create trigger trg before insert on t1_sp +for each row set @counter=@counter+1; +create procedure trig_sp() +begin +declare done int default 0; +declare var151 decimal; +declare var136 tinyint; +declare cur1 cursor for select f136, f151 from tb3; +declare continue handler for sqlstate '01000' set done = 1; +open cur1; +fetch cur1 into var136, var151; +wl_loop: WHILE NOT done DO +insert into t1_sp values (var136, var151); +fetch cur1 into var136, var151; +END WHILE wl_loop; +close cur1; +end// +set @counter=0; +select @counter; +@counter +0 +call trig_sp(); +ERROR 02000: No data - zero rows fetched, selected, or processed +select @counter; +@counter +11 +select count(*) from tb3; +count(*) +11 +select count(*) from t1_sp; +count(*) +11 +drop procedure trig_sp; +drop trigger trg; +drop table t1_sp; + +Testcase 3.5.11.1 (implemented in trig_perf.test) +------------------------------------------------- + +Testcase y.y.y.2: Check for triggers starting triggers +------------------------------------------------------ +use test; +drop table if exists t1; +drop table if exists t2_1; +drop table if exists t2_2; +drop table if exists t2_3; +drop table if exists t2_4; +drop table if exists t3; +create table t1 (f1 integer) engine = <engine_to_be_used>; +create table t2_1 (f1 integer) engine = <engine_to_be_used>; +create table t2_2 (f1 integer) engine = <engine_to_be_used>; +create table t2_3 (f1 integer) engine = <engine_to_be_used>; +create table t2_4 (f1 integer) engine = <engine_to_be_used>; +create table t3 (f1 integer) engine = <engine_to_be_used>; +insert into t1 values (1); +create trigger tr1 after insert on t1 for each row +BEGIN +insert into t2_1 (f1) values (new.f1+1); +insert into t2_2 (f1) values (new.f1+1); +insert into t2_3 (f1) values (new.f1+1); +insert into t2_4 (f1) values (new.f1+1); +END// +create trigger tr2_1 after insert on t2_1 for each row +insert into t3 (f1) values (new.f1+10); +create trigger tr2_2 after insert on t2_2 for each row +insert into t3 (f1) values (new.f1+100); +create trigger tr2_3 after insert on t2_3 for each row +insert into t3 (f1) values (new.f1+1000); +create trigger tr2_4 after insert on t2_4 for each row +insert into t3 (f1) values (new.f1+10000); +insert into t1 values (1); +select * from t3 order by f1; +f1 +12 +102 +1002 +10002 +drop trigger tr1; +drop trigger tr2_1; +drop trigger tr2_2; +drop trigger tr2_3; +drop trigger tr2_4; +drop table t1, t2_1, t2_2, t2_3, t2_4, t3; + +Testcase y.y.y.3: Circular trigger reference +-------------------------------------------- +use test; +drop table if exists t1; +drop table if exists t2; +drop table if exists t3; +drop table if exists t4; +create table t1 (f1 integer) engine = <engine_to_be_used>; +create table t2 (f2 integer) engine = <engine_to_be_used>; +create table t3 (f3 integer) engine = <engine_to_be_used>; +create table t4 (f4 integer) engine = <engine_to_be_used>; +insert into t1 values (0); +create trigger tr1 after insert on t1 +for each row insert into t2 (f2) values (new.f1+1); +create trigger tr2 after insert on t2 +for each row insert into t3 (f3) values (new.f2+1); +create trigger tr3 after insert on t3 +for each row insert into t4 (f4) values (new.f3+1); +create trigger tr4 after insert on t4 +for each row insert into t1 (f1) values (new.f4+1); +insert into t1 values (1); +ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger. +select * from t1 order by f1; +f1 +0 +select * from t2 order by f2; +f2 +select * from t3 order by f3; +f3 +select * from t4 order by f4; +f4 +drop trigger tr1; +drop trigger tr2; +drop trigger tr3; +drop trigger tr4; +drop table t1; +drop table t2; +drop table t3; +drop table t4; + +Testcase y.y.y.4: Recursive trigger/SP references +------------------------------------------------- +set @sql_mode='traditional'; +create table t1_sp ( +count integer, +var136 tinyint, +var151 decimal) engine = <engine_to_be_used>; +create procedure trig_sp() +begin +declare done int default 0; +declare var151 decimal; +declare var136 tinyint; +declare cur1 cursor for select f136, f151 from tb3; +declare continue handler for sqlstate '01000' set done = 1; +set @counter= @counter+1; +open cur1; +fetch cur1 into var136, var151; +wl_loop: WHILE NOT done DO +insert into t1_sp values (@counter, var136, var151); +fetch cur1 into var136, var151; +END WHILE wl_loop; +close cur1; +end// +create trigger trg before insert on t1_sp +for each row call trig_sp(); +set @counter=0; +select @counter; +@counter +0 +call trig_sp(); +ERROR HY000: Recursive limit 0 (as set by the max_sp_recursion_depth variable) was exceeded for routine trig_sp +select @counter; +@counter +1 +select count(*) from tb3; +count(*) +11 +select count(*) from t1_sp; +count(*) +0 +set @@max_sp_recursion_depth= 10; +set @counter=0; +select @counter; +@counter +0 +call trig_sp(); +ERROR HY000: Can't update table 't1_sp' in stored function/trigger because it is already used by statement which invoked this stored function/trigger. +select @counter; +@counter +2 +select count(*) from tb3; +count(*) +11 +select count(*) from t1_sp; +count(*) +0 +drop procedure trig_sp; +drop trigger trg; +drop table t1_sp; + +Testcase y.y.y.5: Rollback of nested trigger references +------------------------------------------------------- +set @@sql_mode='traditional'; +use test; +drop table if exists t1; +drop table if exists t2; +drop table if exists t3; +drop table if exists t4; +create table t1 (f1 integer) engine = <engine_to_be_used>; +create table t2 (f2 integer) engine = <engine_to_be_used>; +create table t3 (f3 integer) engine = <engine_to_be_used>; +create table t4 (f4 tinyint) engine = <engine_to_be_used>; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) default NULL +) ENGINE=<engine_to_be_used> DEFAULT CHARSET=latin1 +insert into t1 values (1); +create trigger tr1 after insert on t1 +for each row insert into t2 (f2) values (new.f1+1); +create trigger tr2 after insert on t2 +for each row insert into t3 (f3) values (new.f2+1); +create trigger tr3 after insert on t3 +for each row insert into t4 (f4) values (new.f3+1000); +set autocommit=0; +start transaction; +insert into t1 values (1); +ERROR 22003: Out of range value adjusted for column 'f4' at row 1 +commit; +select * from t1 order by f1; +f1 +1 +select * from t2 order by f2; +f2 +select * from t3 order by f3; +f3 +drop trigger tr1; +drop trigger tr2; +drop trigger tr3; +drop table t1; +drop table t2; +drop table t3; +drop table t4; +DROP TABLE test.tb3; diff --git a/mysql-test/suite/funcs_1/storedproc/cleanup_sp_tb.inc b/mysql-test/suite/funcs_1/storedproc/cleanup_sp_tb.inc index 493c4373d20..bd41f2dcb16 100644 --- a/mysql-test/suite/funcs_1/storedproc/cleanup_sp_tb.inc +++ b/mysql-test/suite/funcs_1/storedproc/cleanup_sp_tb.inc @@ -1,5 +1,6 @@ -let $message= --source suite/funcs_1/storedproc/cleanup_sp_tb.inc; ---source include/show_msg80.inc +--echo +--echo --source suite/funcs_1/storedproc/cleanup_sp_tb.inc +--echo -------------------------------------------------------------------------------- # called both to cleanup possibly existing data before and after the SP tests diff --git a/mysql-test/suite/funcs_1/storedproc/load_sp_tb.inc b/mysql-test/suite/funcs_1/storedproc/load_sp_tb.inc index b7f7b2cae02..5224860925c 100644 --- a/mysql-test/suite/funcs_1/storedproc/load_sp_tb.inc +++ b/mysql-test/suite/funcs_1/storedproc/load_sp_tb.inc @@ -1,11 +1,12 @@ -let $message= --source suite/funcs_1/storedproc/load_sp_tb.inc; ---source include/show_msg80.inc +--echo +--echo --source suite/funcs_1/storedproc/load_sp_tb.inc +--echo -------------------------------------------------------------------------------- # ============================================================================== # -# this load script can be called multiple times inside a test script because it +# This load script can be called multiple times inside a test script because it # first cleans up all objects that will be created. -# therefore the same script is used as it will be used at the end of a test. +# Therefore the same script is used as it will be used at the end of a test. # # ============================================================================== @@ -20,46 +21,84 @@ CREATE DATABASE db_storedproc_1; USE db_storedproc; -eval create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = $engine_type; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval load data infile '$MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t1; - -eval create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = $engine_type; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval load data infile '$MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t2; - -eval create table t3(f1 char(20),f2 char(20),f3 integer) engine = $engine_type; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval load data infile '$MYSQL_TEST_DIR/suite/funcs_1/data/t3.txt' into table t3; - -eval create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = $engine_type; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval load data infile '$MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t4; +--replace_result $engine_type <engine_to_be_tested> +eval +create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = $engine_type; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +load data infile '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/t4.txt' into table t1; + +--replace_result $engine_type <engine_to_be_tested> +eval +create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = $engine_type; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +load data infile '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/t4.txt' into table t2; + +--replace_result $engine_type <engine_to_be_tested> +eval +create table t3(f1 char(20),f2 char(20),f3 integer) engine = $engine_type; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +load data infile '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/t3.txt' into table t3; + +--replace_result $engine_type <engine_to_be_tested> +eval +create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = $engine_type; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +load data infile '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/t4.txt' into table t4; USE db_storedproc_1; -eval create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = $engine_type; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval load data infile '$MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t6; +--replace_result $engine_type <engine_to_be_tested> +eval +create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = $engine_type; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +load data infile '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/t4.txt' into table t6; USE db_storedproc; -eval create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) engine = $engine_type; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval load data infile '$MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t7; - -eval create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) engine = $engine_type; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval load data infile '$MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t8; - -eval create table t9(f1 int, f2 char(25), f3 int) engine = $engine_type; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval load data infile '$MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' into table t9; - -eval create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = $engine_type; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval load data infile '$MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t10; - -eval create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = $engine_type; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval load data infile '$MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t11; +--replace_result $engine_type <engine_to_be_tested> +eval +create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = $engine_type; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +load data infile '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/t7.txt' into table t7; + +--replace_result $engine_type <engine_to_be_tested> +eval +create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) +engine = $engine_type; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +load data infile '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/t7.txt' into table t8; + +--replace_result $engine_type <engine_to_be_tested> +eval +create table t9(f1 int, f2 char(25), f3 int) engine = $engine_type; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +load data infile '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/t9.txt' into table t9; + +--replace_result $engine_type <engine_to_be_tested> +eval +create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = $engine_type; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +load data infile '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/t4.txt' into table t10; + +--replace_result $engine_type <engine_to_be_tested> +eval +create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) +engine = $engine_type; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +load data infile '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/t4.txt' into table t11; diff --git a/mysql-test/suite/funcs_1/storedproc/storedproc_02.inc b/mysql-test/suite/funcs_1/storedproc/storedproc_02.inc index a8d52fee0b5..0f62a559985 100644 --- a/mysql-test/suite/funcs_1/storedproc/storedproc_02.inc +++ b/mysql-test/suite/funcs_1/storedproc/storedproc_02.inc @@ -5,85 +5,192 @@ # ============================================================================== # (numbering from requirement document TP v1.0, Last updated: 25 Jan 2005 01:00) # -# 3.1.2 Syntax checks for the stored procedure-specific programming statements BEGIN/END, DECLARE, SET, SELECT/INTO, OPEN, FETCH, CLOSE: +# 3.1.2 Syntax checks for the stored procedure-specific programming statements +# BEGIN/END, DECLARE, SET, SELECT/INTO, OPEN, FETCH, CLOSE: # #- 1. Ensure that all subclauses that should be supported are supported. -#- 2. Ensure that all subclauses that should not be supported are disallowed with an appropriate error message. -#- 3. Ensure that all supported subclauses are supported only in the correct order. -#- 4. Ensure that an appropriate error message is returned if a subclause is out-of-order in a stored procedure definition. -#- 5. Ensure that all subclauses that are defined to be mandatory are indeed required to be mandatory by the MySQL server and tools. -#- 6. Ensure that any subclauses that are defined to be optional are indeed treated as optional by the MySQL server and tools. -#- 7. Ensure that every BEGIN statement is coupled with a terminating END statement. -## 8. Ensure that the scope of each BEGIN/END compound statement within a stored procedure definition is properly applied. -#- 9. Ensure that the labels enclosing each BEGIN/END compound statement must match. -#- 10. Ensure that it is possible to put a beginning label at the start of a BEGIN/END compound statement without also requiring an ending label at the end of the same statement. -#- 11. Ensure that it is not possible to put an ending label at the end of a BEGIN/END compound statement without also requiring a matching beginning label at the start of the same statement. +#- 2. Ensure that all subclauses that should not be supported are disallowed +# with an appropriate error message. +#- 3. Ensure that all supported subclauses are supported only in the +# correct order. +#- 4. Ensure that an appropriate error message is returned if a subclause is +# out-of-order in a stored procedure definition. +#- 5. Ensure that all subclauses that are defined to be mandatory are indeed +# required to be mandatory by the MySQL server and tools. +#- 6. Ensure that any subclauses that are defined to be optional are indeed +# treated as optional by the MySQL server and tools. +#- 7. Ensure that every BEGIN statement is coupled with a terminating +# END statement. +## 8. Ensure that the scope of each BEGIN/END compound statement within a +# stored procedure definition is properly applied. +#- 9. Ensure that the labels enclosing each BEGIN/END compound statement +# must match. +#- 10. Ensure that it is possible to put a beginning label at the start of +# a BEGIN/END compound statement without also requiring an ending label +# at the end of the same statement. +#- 11. Ensure that it is not possible to put an ending label at the end of +# a BEGIN/END compound statement without also requiring a matching +# beginning label at the start of the same statement. #- 12. Ensure that every beginning label must end with a colon (:). #- 13. Ensure that every beginning label with the same scope must be unique. -#- 14. Ensure that the variables, cursors, conditions, and handlers declared for a stored procedure (with the DECLARE statement) may only be properly defined. -#- 15. Ensure that the variables, cursors, conditions, and handlers declared for a stored procedure (with the DECLARE statement) may only be defined in the correct order. -#- 16. Ensure that every possible type of variable -- utilizing every data type definition supported by the MySQL server in combination with both no DEFAULT subclause and with DEFAULT subclauses that set the variable’s default value to a range of appropriate values -- may be declared for a stored procedure. -#- 17. Ensure that the DECLARE statement can declare multiple variables both separately and all at once from a variable list. -#- 18. Ensure that invalid variable declarations are rejected, with an appropriate error message. -#- 19. Ensure that every possible type of cursor may be declared for a stored procedure. -#- 20. Ensure that invalid cursor declarations are rejected, with an appropriate error message. -#- 21. Ensure that every possible type of condition may be declared for a stored procedure. -# -22. Ensure that invalid condition declarations are rejected, with an appropriate error message. -#- 23. Ensure that every possible type of handler may be declared for a stored procedure. -#- 24. Ensure that invalid handler declarations are rejected, with an appropriate error message. -#- 25. Ensure that the scope of every variable, cursor, condition, and handler declared for a stored procedure (with the DECLARE statement) is properly applied. -## 26. Ensure that the initial value of every variable declared for a stored procedure is either NULL or its DEFAULT value, as appropriate. -#- 27. Ensure that the SET statement can assign a value to every local variable declared within a stored procedure’s definition, as well as to every appropriate global server variable. -#- 28. Ensure that the SET statement can assign values to variables either separately or to multiple variables in a list. -#- 29. Ensure that the SET statement may assign only those values to a variable that are appropriate for that variable’s data type definition. -## 30. Ensure that, when a stored procedure is called/executed, every variable always uses the correct value: either the value with which it is initialized or the value to which it is subsequently SET or otherwise assigned, as appropriate. -## 31. Ensure that the SELECT ... INTO statement properly assigns values to the variables in its variable list. -## 32. Ensure that a SELECT ... INTO statement that retrieves multiple rows is rejected, with an appropriate error message. -## 33. Ensure that a SELECT ... INTO statement that retrieves too many columns for the number of variables in its variable list is rejected, with an appropriate error message. -## 34. Ensure that a SELECT ... INTO statement that retrieves too few columns for the number of variables in its variable list is rejected, with an appropriate error message. -#- 35. Ensure that a SELECT ... INTO statement that retrieves column values with inappropriate data types for the matching variables in its variable list is rejected, with an appropriate error message. -#- 36. Ensure that the DECLARE ... CONDITION FOR statement can declare a properly-named condition for every possible SQLSTATE and MySQL-specific error code. -#- 37. Ensure that no two conditions declared with the same scope may have the same condition name. +#- 14. Ensure that the variables, cursors, conditions, and handlers declared +# for a stored procedure (with the DECLARE statement) may only be +# properly defined. +#- 15. Ensure that the variables, cursors, conditions, and handlers declared for +# a stored procedure (with the DECLARE statement) may only be defined in +# the correct order. +#- 16. Ensure that every possible type of variable -- utilizing every data type +# definition supported by the MySQL server in combination with both no +# DEFAULT subclause and with DEFAULT subclauses that set the variableÂ’s +# default value to a range of appropriate values -- may be declared for +# a stored procedure. +#- 17. Ensure that the DECLARE statement can declare multiple variables both +# separately and all at once from a variable list. +#- 18. Ensure that invalid variable declarations are rejected, with an +# appropriate error message. +#- 19. Ensure that every possible type of cursor may be declared for a +# stored procedure. +#- 20. Ensure that invalid cursor declarations are rejected, with an appropriate +# error message. +#- 21. Ensure that every possible type of condition may be declared for +# a stored procedure. +# -22. Ensure that invalid condition declarations are rejected, with an +# appropriate error message. +#- 23. Ensure that every possible type of handler may be declared for a +# stored procedure. +#- 24. Ensure that invalid handler declarations are rejected, with an +# appropriate error message. +#- 25. Ensure that the scope of every variable, cursor, condition, and handler +# declared for a stored procedure (with the DECLARE statement) is +# properly applied. +## 26. Ensure that the initial value of every variable declared for a stored +# procedure is either NULL or its DEFAULT value, as appropriate. +#- 27. Ensure that the SET statement can assign a value to every local variable +# declared within a stored procedureÂ’s definition, as well as to every +# appropriate global server variable. +#- 28. Ensure that the SET statement can assign values to variables either +# separately or to multiple variables in a list. +#- 29. Ensure that the SET statement may assign only those values to a variable +# that are appropriate for that variableÂ’s data type definition. +## 30. Ensure that, when a stored procedure is called/executed, every variable +# always uses the correct value: either the value with which it is +# initialized or the value to which it is subsequently SET or otherwise +# assigned, as appropriate. +## 31. Ensure that the SELECT ... INTO statement properly assigns values to the +# variables in its variable list. +## 32. Ensure that a SELECT ... INTO statement that retrieves multiple rows is +# rejected, with an appropriate error message. +## 33. Ensure that a SELECT ... INTO statement that retrieves too many columns +# for the number of variables in its variable list is rejected, with an +# appropriate error message. +## 34. Ensure that a SELECT ... INTO statement that retrieves too few columns +# for the number of variables in its variable list is rejected, with an +# appropriate error message. +#- 35. Ensure that a SELECT ... INTO statement that retrieves column values +# with inappropriate data types for the matching variables in its variable +# list is rejected, with an appropriate error message. +#- 36. Ensure that the DECLARE ... CONDITION FOR statement can declare a +# properly-named condition for every possible SQLSTATE and MySQL-specific +# error code. +#- 37. Ensure that no two conditions declared with the same scope may have the +# same condition name. ## 38. Ensure that the scope of every condition declared is properly applied. -#- 39. Ensure that every SQLSTATE value declared with a DECLARE ... CONDITION FOR statement is a character string that is 5 characters long. -#- 40. Ensure that the DECLARE ... CONDITION FOR statement cannot declare a condition for an invalid SQLSTATE. -#- 41. Ensure that the DECLARE ... CONDITION FOR statement cannot declare a condition for the “successful completion SQLSTATE: “00000“. -#- 42. Ensure that the DECLARE ... HANDLER FOR statement can declare a CONTINUE, EXIT, and UNDO handler for every condition declared (with a DECLARE ... CONDITION FOR statement), within the scope of the handler, for a stored procedure, as well as for every possible SQLSTATE and MySQL-specific error code, as well as for the predefined conditions SQLWARNING, NOT FOUND, and SQLEXCEPTION. -## 43. Ensure that the DECLARE ... HANDLER FOR statement can not declare any handler for a condition declared outside of the scope of the handler. -## 44. Ensure that the DECLARE ... HANDLER FOR statement cannot declare a handler for any invalid, or undeclared, condition. +#- 39. Ensure that every SQLSTATE value declared with a DECLARE ... CONDITION +# FOR statement is a character string that is 5 characters long. +#- 40. Ensure that the DECLARE ... CONDITION FOR statement cannot declare a +# condition for an invalid SQLSTATE. +#- 41. Ensure that the DECLARE ... CONDITION FOR statement cannot declare a +# condition for the “successful completion SQLSTATE: “00000“. +#- 42. Ensure that the DECLARE ... HANDLER FOR statement can declare a CONTINUE, +# EXIT, and UNDO handler for every condition declared (with a DECLARE ... +# CONDITION FOR statement), within the scope of the handler, for a stored +# procedure, as well as for every possible SQLSTATE and MySQL-specific +# error code, as well as for the predefined conditions SQLWARNING, +# NOT FOUND, and SQLEXCEPTION. +## 43. Ensure that the DECLARE ... HANDLER FOR statement can not declare any +# handler for a condition declared outside of the scope of the handler. +## 44. Ensure that the DECLARE ... HANDLER FOR statement cannot declare a +# handler for any invalid, or undeclared, condition. ## 45. Ensure that the scope of every handler declared is properly applied. -#- 46. Ensure that, within the same scope, no two handlers may be declared for the same condition. -#- 47. Ensure that every SQLSTATE value declared with a DECLARE ... HANDLER FOR statement is a character string that is 5 characters long. -#- 48. Ensure that the DECLARE ... HANDLER FOR statement cannot declare a condition for an invalid SQLSTATE. -#- 49. Ensure that the DECLARE ... HANDLER FOR statement cannot declare a condition for the “successful completion SQLSTATE: “00000“. -## 50. Ensure that a CONTINUE handler allows the execution of the stored procedure to continue once the handler statement has completed its own execution (that is, once the handler action statement has been executed). -## 51. Ensure that an EXIT handler causes the execution of the stored procedure to terminate, within its scope, once the handler action statement has been executed. -## 52. Ensure that an EXIT handler does not cause the execution of the stored procedure to terminate outside of its scope. -#- 53. Ensure that a handler condition of SQLWARNING takes the same action as a handler condition defined with an SQLSTATE that begins with “01“. -## 54. Ensure that a handler with a condition defined with an SQLSTATE that begins with “01“ is always exactly equivalent in action to a handler with an SQLWARNING condition. -#- 55. Ensure that a handler condition of NOT FOUND takes the same action as a handler condition defined with an SQLSTATE that begins with “02“. -## 56. Ensure that a handler with a condition defined with an SQLSTATE that begins with “02“ is always exactly equivalent in action to a handler with a NOT FOUND condition. -#- 57. Ensure that a handler condition of SQLEXCEPTION takes the same action as a handler condition defined with an SQLSTATE that begins with anything other that “01“ or “02“. -## 58. Ensure that a handler with a condition defined with an SQLSTATE that begins with anything other that “01“ or “02“ is always exactly equivalent in action to a handler with an SQLEXCEPTION condition. +#- 46. Ensure that, within the same scope, no two handlers may be declared for +# the same condition. +#- 47. Ensure that every SQLSTATE value declared with a DECLARE ... HANDLER FOR +# statement is a character string that is 5 characters long. +#- 48. Ensure that the DECLARE ... HANDLER FOR statement cannot declare a +# condition for an invalid SQLSTATE. +#- 49. Ensure that the DECLARE ... HANDLER FOR statement cannot declare a +# condition for the “successful completion SQLSTATE: “00000“. +## 50. Ensure that a CONTINUE handler allows the execution of the stored +# procedure to continue once the handler statement has completed its +# own execution (that is, once the handler action statement has been +# executed). +## 51. Ensure that an EXIT handler causes the execution of the stored procedure +# to terminate, within its scope, once the handler action statement has +# been executed. +## 52. Ensure that an EXIT handler does not cause the execution of the stored +# procedure to terminate outside of its scope. +#- 53. Ensure that a handler condition of SQLWARNING takes the same action as +# a handler condition defined with an SQLSTATE that begins with “01“. +## 54. Ensure that a handler with a condition defined with an SQLSTATE that +# begins with “01“ is always exactly equivalent in action to a +# handler with an SQLWARNING condition. +#- 55. Ensure that a handler condition of NOT FOUND takes the same action as a +# handler condition defined with an SQLSTATE that begins with “02“. +## 56. Ensure that a handler with a condition defined with an SQLSTATE that +# begins with “02“ is always exactly equivalent in action to a +# handler with a NOT FOUND condition. +#- 57. Ensure that a handler condition of SQLEXCEPTION takes the same action +# as a handler condition defined with an SQLSTATE that begins with +# anything other that “01“ or “02“. +## 58. Ensure that a handler with a condition defined with an SQLSTATE that +# begins with anything other that “01“ or “02“ is always +# exactly equivalent in action to a handler with an SQLEXCEPTION condition. #- 59. Ensure that no two cursors in a stored procedure can have the same name. -#- 60. Ensure that a cursor declaration may not include a SELECT ... INTO statement. -#- 61. Ensure that a cursor declaration that includes an ORDER BY clause may not be an updatable cursor. -#- 62. Ensure that OPEN <cursor name> fails unless a cursor with the same name has already been declared. -#- 63. Ensure that OPEN <cursor name> fails if the same cursor is currently already open. -#- 64. Ensure that FETCH <cursor name> fails unless a cursor with the same name is already open. -## 65. Ensure that FETCH <cursor name> returns the first row of the cursor’s result set the first time FETCH is executed, that it returns each subsequent row of the cursor’s result set each of the subsequent times FETCH is executed, and that it returns a NOT FOUND warning if it is executed after the last row of the cursor’s result set has already been fetched. -#- 66. Ensure that FETCH <cursor name> fails with an appropriate error message if it is executed before the cursor has been opened. -#- 67. Ensure that FETCH <cursor name> fails with an appropriate error message if it is executed after the cursor has been closed. -## 68. Ensure that FETCH <cursor name> fails with an appropriate error message if the number of columns to be fetched does not match the number of variables specified by the FETCH statement. -#- 69. Ensure that FETCH <cursor name> fails with an appropriate error message if the data type of the column values being fetched are not appropriate for the matching FETCH variables to which the data is being assigned. -#- 70. Ensure that CLOSE <cursor name> fails unless a cursor with the same name is already open. -#- 71. Ensure that all cursors are closed when a transaction terminates with a COMMIT statement. -#- 72. Ensure that all cursors are closed when a transaction terminates with a ROLLBACK statement. -#- 73. Ensure that the result set of a cursor that has been closed is not longer available to the FETCH statement. -#- 74. Ensure that every cursor declared within a compound statement is closed when that compound statement ends. -## 75. Ensure that, for nested compound statements, a cursor that was declared and opened during an outer level of the statement is not closed when an inner level of a compound statement ends. -## 76. Ensure that all cursors operate asensitively, so that there is no concurrency conflict between cursors operating on the same, or similar, sets of results during execution of one or more stored procedures. -# 77. Ensure that multiple cursors, nested within multiple compound statements within a stored procedure, always act correctly and return the expected result. +#- 60. Ensure that a cursor declaration may not include a SELECT ... INTO +# statement. +#- 61. Ensure that a cursor declaration that includes an ORDER BY clause may +# not be an updatable cursor. +#- 62. Ensure that OPEN <cursor name> fails unless a cursor with the same name +# has already been declared. +#- 63. Ensure that OPEN <cursor name> fails if the same cursor is currently +# already open. +#- 64. Ensure that FETCH <cursor name> fails unless a cursor with the same name +# is already open. +## 65. Ensure that FETCH <cursor name> returns the first row of the cursorÂ’s +# result set the first time FETCH is executed, that it returns each +# subsequent row of the cursorÂ’s result set each of the subsequent +# times FETCH is executed, and that it returns a NOT FOUND warning if it +# is executed after the last row of the cursorÂ’s result set has already +# been fetched. +#- 66. Ensure that FETCH <cursor name> fails with an appropriate error message +# if it is executed before the cursor has been opened. +#- 67. Ensure that FETCH <cursor name> fails with an appropriate error message +# if it is executed after the cursor has been closed. +## 68. Ensure that FETCH <cursor name> fails with an appropriate error message +# if the number of columns to be fetched does not match the number of +# variables specified by the FETCH statement. +#- 69. Ensure that FETCH <cursor name> fails with an appropriate error message +# if the data type of the column values being fetched are not appropriate +# for the matching FETCH variables to which the data is being assigned. +#- 70. Ensure that CLOSE <cursor name> fails unless a cursor with the same name +# is already open. +#- 71. Ensure that all cursors are closed when a transaction terminates with +# a COMMIT statement. +#- 72. Ensure that all cursors are closed when a transaction terminates with +# a ROLLBACK statement. +#- 73. Ensure that the result set of a cursor that has been closed is not +# longer available to the FETCH statement. +#- 74. Ensure that every cursor declared within a compound statement is closed +# when that compound statement ends. +## 75. Ensure that, for nested compound statements, a cursor that was declared +# and opened during an outer level of the statement is not closed when an +# inner level of a compound statement ends. +## 76. Ensure that all cursors operate asensitively, so that there is no +# concurrency conflict between cursors operating on the same, or similar, +# sets of results during execution of one or more stored procedures. +# 77. Ensure that multiple cursors, nested within multiple compound statements +# within a stored procedure, always act correctly and return the +# expected result. # # ============================================================================== let $message= Section 3.1.2 - Syntax checks for the stored procedure-specific @@ -209,7 +316,7 @@ BEGIN set @x = x; set @y = y; set @z = 234; - SELECT f1, f2 into @x, @y from t2 limit 1; + SELECT f1, f2 into @x, @y from t2 where f1='a`' and f2='a`' limit 1; SELECT @x, @y, @z, invar; BEGIN set @x = 2; @@ -257,7 +364,7 @@ BEGIN declare x integer; declare y integer; set @x=x; set @y=y; - SELECT f4, f3 into @x, @y from t2 limit 1; + SELECT f4, f3 into @x, @y from t2 where f4=-5000 and f3='1000-01-01' limit 1; SELECT @x, @y; END// delimiter ;// @@ -290,8 +397,9 @@ BEGIN END// delimiter ;// -#Error: 1172 SQLSTATE: 42000 (ER_TOO_MANY_ROWS) Message: Result consisted of more than one row ---error 1172 +# Error: SQLSTATE: 42000 (ER_TOO_MANY_ROWS) +# Message: Result consisted of more than one row +--error ER_TOO_MANY_ROWS CALL sp1(); # cleanup 3.1.2.32 @@ -321,7 +429,7 @@ BEGIN END// delimiter ;// ---error 1222 +--error ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT CALL sp1(); # cleanup 3.1.2.33 @@ -352,7 +460,7 @@ BEGIN END// delimiter ;// ---error 1222 +--error ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT CALL sp1(); # cleanup 3.1.2.34 @@ -375,8 +483,10 @@ create table res_t1(w char unique, x char); insert into res_t1 values('a', 'b'); -# Error: 1339 SQLSTATE: 20000 (ER_SP_CASE_NOT_FOUND) Message: Case not found for CASE statement -# Error: 1022 SQLSTATE: 23000 (ER_DUP_KEY) Message: Can't write; duplicate key in table '%s' +# Error: SQLSTATE: 20000 (ER_SP_CASE_NOT_FOUND) +# Message: Case not found for CASE statement +# Error: SQLSTATE: 23000 (ER_DUP_KEY) +# Message: Can't write; duplicate key in table '%s' delimiter //; CREATE PROCEDURE h1 () @@ -472,7 +582,7 @@ create table res_t1(w char unique, x char); insert into res_t1 values ('a', 'b'); delimiter //; ---error 1319 +--error ER_SP_COND_MISMATCH CREATE PROCEDURE h1 () BEGIN declare x1, x2, x3, x4, x5, x6 int default 0; @@ -561,8 +671,9 @@ DROP PROCEDURE IF EXISTS h1; --enable_warnings delimiter //; -#Error: 1319 SQLSTATE: 42000 (ER_SP_COND_MISMATCH) Message: Undefined CONDITION: %s ---error 1319 +# Error: SQLSTATE: 42000 (ER_SP_COND_MISMATCH) +# Message: Undefined CONDITION: %s +--error ER_SP_COND_MISMATCH CREATE PROCEDURE h1 () BEGIN declare x1, x2, x3, x4, x5, x6 int default 0; @@ -582,8 +693,9 @@ BEGIN END; END// -#Error: 1064 SQLSTATE: 42000 (ER_PARSE_ERROR) Message: %s near '%s' at line %d ---error 1064 +# Error: SQLSTATE: 42000 (ER_PARSE_ERROR) +# Message: %s near '%s' at line %d +--error ER_PARSE_ERROR CREATE PROCEDURE h1 () BEGIN DECLARE x1 INT DEFAULT 0; @@ -593,8 +705,9 @@ BEGIN DECLARE CONTINUE HANDLER FOR condname1 SET x1 = 1; END// -#Error: 1407 SQLSTATE: 42000 (ER_SP_BAD_SQLSTATE) Message: Bad SQLSTATE: '%s' ---error 1407 +# Error: SQLSTATE: 42000 (ER_SP_BAD_SQLSTATE) +# Message: Bad SQLSTATE: '%s' +--error ER_SP_BAD_SQLSTATE CREATE PROCEDURE h1 () BEGIN DECLARE x1 INT DEFAULT 0; @@ -632,7 +745,7 @@ drop table IF EXISTS res_t1; --echo ==> 'UNDO' is still not supported. delimiter //; ---error 1064 +--error ER_PARSE_ERROR create procedure p1undo () begin declare undo handler for sqlexception select '1'; @@ -723,7 +836,7 @@ DROP TABLE res_t1; let $message= Testcase 3.1.2.50:; --source include/show_msg.inc -# testcase: ensure that a continue handler allows the execution of the stored procedure +# Testcase: Ensure that a continue handler allows the execution of the stored procedure # to continue once the handler statement has completed its own execution # (that is, once the handler action statement has been executed). @@ -794,8 +907,9 @@ BEGIN END// delimiter ;// -# Error: 1318 SQLSTATE: 42000 (ER_SP_WRONG_NO_OF_ARGS) Message: Incorrect number of arguments for %s %s; expected %u, got %u ---error 1318 +# Error: SQLSTATE: 42000 (ER_SP_WRONG_NO_OF_ARGS) +# Message: Incorrect number of arguments for %s %s; expected %u, got %u +--error ER_SP_WRONG_NO_OF_ARGS CALL sp1(1); CALL sp2(); SELECT '-3-', @x2, @x; @@ -858,7 +972,7 @@ let $message= Testcase 3.1.2.54:; --source include/show_msg.inc let $message= Ensure that a handler with a condition defined with an SQLSTATE that begins with -“01“ is always exactly equivalent in action to a handler with an SQLWARNING +“01“ is always exactly equivalent in action to a handler with an SQLWARNING condition.; --source include/show_msg80.inc @@ -959,7 +1073,7 @@ let $message= Testcase 3.1.2.56:; --source include/show_msg.inc let $message= Ensure that a handler with a condition defined with an SQLSTATE that begins with -“02“ is always exactly equivalent in action to a handler with a NOT FOUND +“02“ is always exactly equivalent in action to a handler with a NOT FOUND condition.; --source include/show_msg80.inc @@ -1052,7 +1166,7 @@ BEGIN END// delimiter ;// ---error 1329 +--error ER_SP_FETCH_NO_DATA CALL sp0(); SELECT @done, @x; @@ -1081,13 +1195,16 @@ let $message= Testcase 3.1.2.58:; --source include/show_msg.inc let $message= Ensure that a handler with a condition defined with an SQLSTATE that begins with -anything other that “01“ or “02“ is always exactly equivalent in action to a +anything other that “01“ or “02“ is always exactly equivalent in action to a handler with an SQLEXCEPTION condition.; --source include/show_msg80.inc -# Error: 1339 SQLSTATE: 20000 (ER_SP_CASE_NOT_FOUND) Message: Case not found for CASE statement -# Error: 1222 SQLSTATE: 21000 (ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT) Message: The used SELECT statements have a different number of columns -# Error: 1326 SQLSTATE: 24000 (ER_SP_CURSOR_NOT_OPEN) Message: Cursor is not open +# Error: SQLSTATE: 20000 (ER_SP_CASE_NOT_FOUND) +# Message: Case not found for CASE statement +# Error: SQLSTATE: 21000 (ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT) +# Message: The used SELECT statements have a different number of columns +# Error: SQLSTATE: 24000 (ER_SP_CURSOR_NOT_OPEN) +# Message: Cursor is not open --disable_warnings DROP PROCEDURE IF EXISTS sp0; @@ -1271,7 +1388,8 @@ BEGIN declare f5_value char(20); declare f4_value integer; declare f6_value integer; - declare cur1 cursor for SELECT f1, f2, f4, f5, f6 from t2 limit 3; + declare cur1 cursor for SELECT f1, f2, f4, f5, f6 from t2 + where f4 >=-5000 order by f4 limit 3; open cur1; while proceed do SELECT count AS 'loop'; @@ -1282,7 +1400,7 @@ BEGIN END// delimiter ;// ---error 1329 +--error ER_SP_FETCH_NO_DATA CALL sp1(); SELECT * FROM temp; @@ -1338,11 +1456,11 @@ END// delimiter ;// --echo --> not enough columns in FETCH statement ---error 1328 +--error ER_SP_WRONG_NO_OF_FETCH_ARGS CALL sp1(); --echo --> too many columns in FETCH statement ---error 1328 +--error ER_SP_WRONG_NO_OF_FETCH_ARGS CALL sp2(); # cleanup 3.1.2.68 @@ -1366,9 +1484,10 @@ DROP PROCEDURE IF EXISTS sp1; create table temp1( f0 char(20), f1 char(20), f2 char(20), f3 int, f4 char(20) ); -#Error: 1329 SQLSTATE: 02000 (ER_SP_FETCH_NO_DATA) Message: No data to FETCH +# Error: SQLSTATE: 02000 (ER_SP_FETCH_NO_DATA) +# Message: No data to FETCH -SELECT f1, f2, f4, f5 from t2; +SELECT f1, f2, f4, f5 from t2 order by f4; delimiter //; CREATE PROCEDURE sp1( ) @@ -1379,8 +1498,8 @@ BEGIN declare newf2 char(20); declare newf5 char(20); declare newf4 integer; - declare cur1 cursor for SELECT f1, f2, f4, f5 from t2 limit 5; - declare cur2 cursor for SELECT f1, f2, f4, f5 from t2 limit 5; + declare cur1 cursor for SELECT f1, f2, f4, f5 from t2 where f4 >= -5000 order by f4 limit 5; + declare cur2 cursor for SELECT f1, f2, f4, f5 from t2 where f4 >= -5000 order by f4 limit 5; open cur1; open cur2; BEGIN @@ -1453,8 +1572,10 @@ BEGIN declare i_newf12 char(20); declare i_newf13 date; declare i_newf14 integer; - declare cur1 cursor for SELECT f1, f2, f3, f4 from t2 limit 4; - declare cur2 cursor for SELECT f1, f2, f3, f4 from t2 limit 3; + declare cur1 cursor for SELECT f1, f2, f3, f4 from t2 + where f4>=-5000 order by f4 limit 4; + declare cur2 cursor for SELECT f1, f2, f3, f4 from t2 + where f4>=-5000 order by f4 limit 3; declare continue handler for sqlstate '02000' set proceed=0; open cur1; open cur2; @@ -1486,8 +1607,10 @@ BEGIN DECLARE o_newf12 CHAR(20); DECLARE o_newf13 DATE; DECLARE o_newf14 INTEGER; - DECLARE cur1 CURSOR FOR SELECT f1, f2, f3, f4 FROM t2 LIMIT 5; - DECLARE cur2 CURSOR FOR SELECT f1, f2, f3, f4 FROM t2 LIMIT 5; + DECLARE cur1 CURSOR FOR SELECT f1, f2, f3, f4 FROM t2 + WHERE f4>=-5000 ORDER BY f4 LIMIT 5; + DECLARE cur2 CURSOR FOR SELECT f1, f2, f3, f4 FROM t2 + WHERE f4>=-5000 ORDER BY f4 LIMIT 5; DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET proceed=0; OPEN cur1; OPEN cur2; @@ -1526,6 +1649,7 @@ DROP TABLE temp2; --source suite/funcs_1/storedproc/cleanup_sp_tb.inc # ============================================================================== -let $message= . +++ END OF SCRIPT +++; ---source include/show_msg80.inc +--echo +--echo . +++ END OF SCRIPT +++ +--echo -------------------------------------------------------------------------------- # ============================================================================== diff --git a/mysql-test/suite/funcs_1/storedproc/storedproc_03.inc b/mysql-test/suite/funcs_1/storedproc/storedproc_03.inc index 9ffa7d7f66c..01810390a92 100644 --- a/mysql-test/suite/funcs_1/storedproc/storedproc_03.inc +++ b/mysql-test/suite/funcs_1/storedproc/storedproc_03.inc @@ -5,38 +5,67 @@ # ============================================================================== # (numbering from requirement document TP v1.0, Last updated: 25 Jan 2005 01:00) # -# 3.1.3 Syntax checks for the stored procedure-specific flow control statements IF, CASE, LOOP, LEAVE, ITERATE, REPEAT, WHILE: +# 3.1.3 Syntax checks for the stored procedure-specific flow control statements +# IF, CASE, LOOP, LEAVE, ITERATE, REPEAT, WHILE: # #- 1. Ensure that all subclauses that should be supported are supported. -#- 2. Ensure that all subclauses that should not be supported are disallowed with an appropriate error message. -#- 3. Ensure that all supported subclauses are supported only in the correct order. -#- 4. Ensure that an appropriate error message is returned if a subclause is out-of-order in a stored procedure definition. -#- 5. Ensure that all subclauses that are defined to be mandatory are indeed required to be mandatory by the MySQL server and tools. -#- 6. Ensure that any subclauses that are defined to be optional are indeed treated as optional by the MySQL server and tools. -## 7. Ensure that the IF statement acts correctly for all variants, including cases where statements are nested. -## 8. Ensure that the CASE statement acts correctly for all variants, including cases where statements are nested. -## 9. Ensure that the LOOP statement acts correctly for all variants, including cases where statements are nested. +#- 2. Ensure that all subclauses that should not be supported are disallowed +# with an appropriate error message. +#- 3. Ensure that all supported subclauses are supported only in the +# correct order. +#- 4. Ensure that an appropriate error message is returned if a subclause is +# out-of-order in a stored procedure definition. +#- 5. Ensure that all subclauses that are defined to be mandatory are indeed +# required to be mandatory by the MySQL server and tools. +#- 6. Ensure that any subclauses that are defined to be optional are indeed +# treated as optional by the MySQL server and tools. +## 7. Ensure that the IF statement acts correctly for all variants, including +# cases where statements are nested. +## 8. Ensure that the CASE statement acts correctly for all variants, +# including cases where statements are nested. +## 9. Ensure that the LOOP statement acts correctly for all variants, +# including cases where statements are nested. #- 10. Ensure that the labels enclosing each LOOP statement must match. -#- 11. Ensure that it is possible to put a beginning label at the start of a LOOP statement without also requiring an ending label at the end of the same statement. -#- 12. Ensure that it is not possible to put an ending label at the end of a LOOP statement without also requiring a matching beginning label at the start of the same statement. +#- 11. Ensure that it is possible to put a beginning label at the start of +# a LOOP statement without also requiring an ending label at the end of +# the same statement. +#- 12. Ensure that it is not possible to put an ending label at the end of +# a LOOP statement without also requiring a matching beginning label +# at the start of the same statement. #- 13. Ensure that every beginning label must end with a colon (:). #- 14. Ensure that every beginning label with the same scope must be unique. -## 15. Ensure that the LEAVE statement acts correctly for all variants, including cases where statements are nested. -## 16. Ensure that the ITERATE statement acts correctly for all variants, including cases where statements are nested. -#- 17. Ensure that the ITERATE statement fails, with an appropriate error message, if it appears in any context other than within LOOP, REPEAT, or WHILE statements. -## 18. Ensure that the REPEAT statement acts correctly for all variants, including cases where statements are nested. +## 15. Ensure that the LEAVE statement acts correctly for all variants, +# including cases where statements are nested. +## 16. Ensure that the ITERATE statement acts correctly for all variants, +# including cases where statements are nested. +#- 17. Ensure that the ITERATE statement fails, with an appropriate error +# message, if it appears in any context other than within LOOP, REPEAT, +# or WHILE statements. +## 18. Ensure that the REPEAT statement acts correctly for all variants, +# including cases where statements are nested. #- 19. Ensure that the labels enclosing each REPEAT statement must match. -#- 20. Ensure that it is possible to put a beginning label at the start of a REPEAT statement without also requiring an ending label at the end of the same statement. -#- 21. Ensure that it is not possible to put an ending label at the end of a REPEAT statement without also requiring a matching beginning label at the start of the same statement. +#- 20. Ensure that it is possible to put a beginning label at the start of +# a REPEAT statement without also requiring an ending label at the end +# of the same statement. +#- 21. Ensure that it is not possible to put an ending label at the end of +# a REPEAT statement without also requiring a matching beginning label +# at the start of the same statement. #- 22. Ensure that every beginning label must end with a colon (:). #- 23. Ensure that every beginning label with the same scope must be unique. -## 24. Ensure that the WHILE statement acts correctly for all variants, including cases where statements are nested. +## 24. Ensure that the WHILE statement acts correctly for all variants, +# including cases where statements are nested. #- 25. Ensure that the labels enclosing each WHILE statement must match. -#- 26. Ensure that it is possible to put a beginning label at the start of a WHILE statement without also requiring an ending label at the end of the same statement. -#- 27. Ensure that it is not possible to put an ending label at the end of a WHILE statement without also requiring a matching beginning label at the start of the same statement. +#- 26. Ensure that it is possible to put a beginning label at the start of +# a WHILE statement without also requiring an ending label at the end +# of the same statement. +#- 27. Ensure that it is not possible to put an ending label at the end of +# a WHILE statement without also requiring a matching beginning label +# at the start of the same statement. #- 28. Ensure that every beginning label must end with a colon (:). #- 29. Ensure that every beginning label with the same scope must be unique. -## 30. Ensure that multiple cases of all possible combinations of the control flow statements, nested within multiple compound statements within a stored procedure, always act correctly and return the expected result. +## 30. Ensure that multiple cases of all possible combinations of the control +# flow statements, nested within multiple compound statements within +# a stored procedure, always act correctly and return the expected result. # # ============================================================================== let $message= Section 3.1.3 - Syntax checks for the stored procedure-specific flow @@ -237,8 +266,9 @@ DROP PROCEDURE IF EXISTS sp31316; delimiter //; # wrong label at iterate -#Error: 1308 SQLSTATE: 42000 (ER_SP_LILABEL_MISMATCH) Message: %s with no matching label: %s ---error 1308 +# Error: SQLSTATE: 42000 (ER_SP_LILABEL_MISMATCH) +# Message: %s with no matching label: %s +--error ER_SP_LILABEL_MISMATCH CREATE PROCEDURE sp31316( ) BEGIN declare count1 integer default 1; @@ -436,8 +466,9 @@ BEGIN END// delimiter ;// -#Error: 1318 SQLSTATE: 42000 (ER_SP_WRONG_NO_OF_ARGS) Message: Incorrect number of arguments for %s %s; expected %u, got %u ---error 1318 +# Error: SQLSTATE: 42000 (ER_SP_WRONG_NO_OF_ARGS) +# Message: Incorrect number of arguments for %s %s; expected %u, got %u +--error ER_SP_WRONG_NO_OF_ARGS CALL sp31330(); CALL sp31330(1); @@ -459,6 +490,7 @@ drop table res_tbl; --source suite/funcs_1/storedproc/cleanup_sp_tb.inc # ============================================================================== -let $message= . +++ END OF SCRIPT +++; ---source include/show_msg80.inc +--echo +--echo . +++ END OF SCRIPT +++ +--echo -------------------------------------------------------------------------------- # ============================================================================== diff --git a/mysql-test/suite/funcs_1/storedproc/storedproc_06.inc b/mysql-test/suite/funcs_1/storedproc/storedproc_06.inc index e2b9e846b97..29f5bd73b04 100644 --- a/mysql-test/suite/funcs_1/storedproc/storedproc_06.inc +++ b/mysql-test/suite/funcs_1/storedproc/storedproc_06.inc @@ -1,5 +1,9 @@ #### suite/funcs_1/storedproc/storedproc_06.inc -# + +# This test cannot be used for the embedded server because we check here +# privileges. +--source include/not_embedded.inc + --source suite/funcs_1/storedproc/load_sp_tb.inc # ============================================================================== @@ -7,20 +11,29 @@ # # 3.1.6 Privilege checks: # -# 1. Ensure that no user may create a stored procedure without the GRANT CREATE ROUTINE privilege. +# 1. Ensure that no user may create a stored procedure without the +# GRANT CREATE ROUTINE privilege. # 2. Ensure that root always has the GRANT CREATE ROUTINE privilege. -# 3. Ensure that a user with the GRANT CREATE ROUTINE privilege can always create both a procedure and a function, on any appropriate database. -# 4. Ensure that the default security provision of a stored procedure is SQL SECURITY DEFINER. -# 5. Ensure that a stored procedure defined with SQL SECURITY DEFINER can be called/executed by any user, using only the privileges (including database access privileges) associated with the user who created the stored procedure. -# 6. Ensure that a stored procedure defined with SQL SECURITY INVOKER can be called/executed by any user, using only the privileges (including database access privileges) associated with the user executing the stored procedure. +# 3. Ensure that a user with the GRANT CREATE ROUTINE privilege can always +# create both a procedure and a function, on any appropriate database. +# 4. Ensure that the default security provision of a stored procedure is +# SQL SECURITY DEFINER. +# 5. Ensure that a stored procedure defined with SQL SECURITY DEFINER can be +# called/executed by any user, using only the privileges (including +# database access privileges) associated with the user who created +# the stored procedure. +# 6. Ensure that a stored procedure defined with SQL SECURITY INVOKER can be +# called/executed by any user, using only the privileges (including +# database access privileges) associated with the user executing +# the stored procedure. # # ============================================================================== let $message= Section 3.1.6 - Privilege Checks:; --source include/show_msg80.inc -USE db_storedproc_1; connection default; +USE db_storedproc_1; --source suite/funcs_1/include/show_connection.inc # ------------------------------------------------------------------------------ @@ -47,7 +60,7 @@ connect (user1a, localhost, user_1, , db_storedproc_1); USE db_storedproc_1; delimiter //; ---error 1044 +--error ER_DBACCESS_DENIED_ERROR CREATE PROCEDURE sp1(v1 char(20)) BEGIN SELECT * from db_storedproc_1.t6 where t6.f2= 'xyz'; @@ -58,6 +71,7 @@ disconnect user1a; # add privilege again and check connection default; +USE db_storedproc_1; --source suite/funcs_1/include/show_connection.inc GRANT CREATE ROUTINE ON db_storedproc_1.* TO 'user_1'@'localhost'; @@ -77,6 +91,7 @@ disconnect user1b; # cleanup connection default; +USE db_storedproc_1; --source suite/funcs_1/include/show_connection.inc DROP USER 'user_1'@'localhost'; @@ -132,6 +147,7 @@ disconnect user2; # cleanup connection default; +USE db_storedproc_1; --source suite/funcs_1/include/show_connection.inc drop user 'user_1'@'localhost'; @@ -242,33 +258,33 @@ disconnect user5_1; connect (user5_2, localhost, user_2, , db_storedproc_1); --source suite/funcs_1/include/show_connection.inc ---error 1142 +--error ER_TABLEACCESS_DENIED_ERROR CALL sp5_s_i(); ---error 1142 +--error ER_TABLEACCESS_DENIED_ERROR CALL sp5_ins(); ---error 1142 +--error ER_TABLEACCESS_DENIED_ERROR CALL sp5_sel(); # now 'add' INSERT to DEFINER connection default; --source suite/funcs_1/include/show_connection.inc ---error 1142 +--error ER_TABLEACCESS_DENIED_ERROR CALL sp5_sel(); grant insert on db_storedproc_1.* to 'user_1'@'localhost'; flush privileges; connection user5_2; --source suite/funcs_1/include/show_connection.inc ---error 1142 +--error ER_TABLEACCESS_DENIED_ERROR CALL sp5_s_i(); CALL sp5_ins(); ---error 1142 +--error ER_TABLEACCESS_DENIED_ERROR CALL sp5_sel(); # now 'add' SELECT to DEFINER connection default; --source suite/funcs_1/include/show_connection.inc ---error 1142 +--error ER_TABLEACCESS_DENIED_ERROR CALL sp5_sel(); grant SELECT on db_storedproc_1.* to 'user_1'@'localhost'; #grant execute on db_storedproc_1.* to 'user_2'@'localhost'; @@ -288,9 +304,9 @@ flush privileges; connection user5_2; --source suite/funcs_1/include/show_connection.inc ---error 1142 +--error ER_TABLEACCESS_DENIED_ERROR CALL sp5_s_i(); ---error 1142 +--error ER_TABLEACCESS_DENIED_ERROR CALL sp5_ins(); CALL sp5_sel(); @@ -302,11 +318,11 @@ flush privileges; connection user5_2; --source suite/funcs_1/include/show_connection.inc ---error 1142 +--error ER_TABLEACCESS_DENIED_ERROR CALL sp5_s_i(); ---error 1142 +--error ER_TABLEACCESS_DENIED_ERROR CALL sp5_ins(); ---error 1142 +--error ER_TABLEACCESS_DENIED_ERROR CALL sp5_sel(); # cleanup @@ -373,9 +389,9 @@ disconnect user6_1; connect (user6_2, localhost, user_2, , db_storedproc_1); --source suite/funcs_1/include/show_connection.inc ---error 1142 +--error ER_TABLEACCESS_DENIED_ERROR CALL sp3166_s_i(); ---error 1142 +--error ER_TABLEACCESS_DENIED_ERROR CALL sp3166_ins(); CALL sp3166_sel(); @@ -405,10 +421,10 @@ FLUSH PRIVILEGES; --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK connect (user6_4, localhost, user_2, , db_storedproc_1); --source suite/funcs_1/include/show_connection.inc ---error 1142 +--error ER_TABLEACCESS_DENIED_ERROR CALL sp3166_s_i(); CALL sp3166_ins(); ---error 1142 +--error ER_TABLEACCESS_DENIED_ERROR CALL sp3166_sel(); disconnect user6_4; @@ -422,11 +438,11 @@ FLUSH PRIVILEGES; --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK connect (user6_5, localhost, user_2, , db_storedproc_1); --source suite/funcs_1/include/show_connection.inc ---error 1370 +--error ER_PROCACCESS_DENIED_ERROR CALL sp3166_s_i(); ---error 1370 +--error ER_PROCACCESS_DENIED_ERROR CALL sp3166_ins(); ---error 1370 +--error ER_PROCACCESS_DENIED_ERROR CALL sp3166_sel(); disconnect user6_5; @@ -447,6 +463,7 @@ DROP USER 'user_2'@'localhost'; --source suite/funcs_1/storedproc/cleanup_sp_tb.inc # ============================================================================== -let $message= . +++ END OF SCRIPT +++; ---source include/show_msg80.inc +--echo +--echo . +++ END OF SCRIPT +++ +--echo -------------------------------------------------------------------------------- # ============================================================================== diff --git a/mysql-test/suite/funcs_1/storedproc/storedproc_10.inc b/mysql-test/suite/funcs_1/storedproc/storedproc_10.inc index d7b0a370a82..83f5f2105c5 100644 --- a/mysql-test/suite/funcs_1/storedproc/storedproc_10.inc +++ b/mysql-test/suite/funcs_1/storedproc/storedproc_10.inc @@ -1,5 +1,9 @@ #### suite/funcs_1/storedproc/storedproc_10.inc -# + +# This test cannot be used for the embedded server because we check here +# privilgeges. +--source include/not_embedded.inc + --source suite/funcs_1/storedproc/load_sp_tb.inc # ============================================================================== @@ -7,14 +11,21 @@ # # 3.1.10 CALL checks: # -## 1. Ensure that a properly defined procedure can always be called, assuming the appropriate privileges exist. -#- 2. Ensure that a procedure cannot be called if the appropriate privileges do not exist. +## 1. Ensure that a properly defined procedure can always be called, assuming +# the appropriate privileges exist. +#- 2. Ensure that a procedure cannot be called if the appropriate privileges +# do not exist. ## 3. Ensure that a function can never be called. -## 4. Ensure that a properly defined function can always be executed, assuming the appropriate privileges exist. -#- 5. Ensure that a function cannot be executed if the appropriate privileges do not exist. +## 4. Ensure that a properly defined function can always be executed, assuming +# the appropriate privileges exist. +#- 5. Ensure that a function cannot be executed if the appropriate privileges +# do not exist. ## 6. Ensure that a procedure can never be executed. -## 7. Ensure that the ROW_COUNT() SQL function always returns the correct number of rows affected by the execution of a stored procedure. -## 8. Ensure that the mysql_affected_rows() C API function always returns the correct number of rows affected by the execution of a stored procedure. +## 7. Ensure that the ROW_COUNT() SQL function always returns the correct +# number of rows affected by the execution of a stored procedure. +## 8. Ensure that the mysql_affected_rows() C API function always returns +# the correct number of rows affected by the execution of a +# stored procedure. # # ============================================================================== let $message= Section 3.1.10 - CALL checks:; @@ -54,7 +65,7 @@ connect (user2_1, localhost, user_1, , db_storedproc); delimiter //; CREATE PROCEDURE sp31102 () SQL SECURITY INVOKER BEGIN - SELECT * FROM db_storedproc.t1 LIMIT 1; + SELECT * FROM db_storedproc.t1 WHERE f4=-5000 LIMIT 1; END// delimiter ;// @@ -74,12 +85,14 @@ connect (user2_2, localhost, user_2, , db_storedproc); --source suite/funcs_1/include/show_connection.inc # no privileges exist ---error 1370 +--error ER_PROCACCESS_DENIED_ERROR CALL sp31102(); SELECT fn31105( 9 ); # now 'add' EXECUTE to INVOKER +--echo connection default; connection default; +USE db_storedproc; --source suite/funcs_1/include/show_connection.inc # root can execute ... CALL sp31102(); @@ -97,7 +110,9 @@ SELECT fn31105( 9 ); disconnect user2_3; # now 'remove' SELECT from INVOKER +--echo connection default; connection default; +USE db_storedproc; --source suite/funcs_1/include/show_connection.inc REVOKE EXECUTE ON db_storedproc.* FROM 'user_2'@'localhost'; FLUSH PRIVILEGES; @@ -115,6 +130,7 @@ disconnect user2_4; # cleanup connection default; +USE db_storedproc; --source suite/funcs_1/include/show_connection.inc DROP PROCEDURE sp31102; @@ -142,7 +158,7 @@ BEGIN END// delimiter ;// ---error 1305 +--error ER_SP_DOES_NOT_EXIST CALL fn1(); # cleanup @@ -168,7 +184,7 @@ BEGIN END// delimiter ;// ---error 1305 +--error ER_SP_DOES_NOT_EXIST SELECT sp1(); # cleanup @@ -182,26 +198,32 @@ let $message= Ensure that the ROW_COUNT() SQL function always returns the correct number of rows affected by the execution of a stored procedure.; --source include/show_msg80.inc +# Note(mleich): Information taken from a comments in +# Bug#21818 Return value of ROW_COUNT() is incorrect for +# ALTER TABLE, LOAD DATA +# ROW_COUNT() is -1 following any statement which is not DELETE, INSERT +# or UPDATE. +# Also, after a CALL statement, ROW_COUNT() will return the value of the +# last statement in the stored procedure. --disable_warnings DROP PROCEDURE IF EXISTS sp_ins_1; DROP PROCEDURE IF EXISTS sp_ins_3; DROP PROCEDURE IF EXISTS sp_upd; DROP PROCEDURE IF EXISTS sp_ins_upd; +DROP PROCEDURE IF EXISTS sp_del; +DROP PROCEDURE IF EXISTS sp_with_rowcount; --enable_warnings CREATE TABLE temp(f1 CHAR(20),f2 CHAR(25),f3 DATE,f4 INT,f5 CHAR(25),f6 INT); INSERT INTO temp SELECT * FROM t10; delimiter //; -#FIXME: add to proc: SELECT row_count() 'ins'; CREATE PROCEDURE sp_ins_1() BEGIN INSERT INTO temp VALUES ('abc', 'abc', '20051003', 100, 'uvw', 1000); END// - -#FIXME: add to proc: SELECT row_count() 'ins_3'; CREATE PROCEDURE sp_ins_3() BEGIN INSERT INTO temp VALUES ('abc', 'xyz', '19490523', 100, 'uvw', 1000); @@ -209,26 +231,11 @@ BEGIN INSERT INTO temp VALUES ('abc', 'xyz', '2005-10-24', 100, 'uvw', 1000); END// -# FIXME: add to proc: SELECT row_count() AS 'updated'; CREATE PROCEDURE sp_upd() BEGIN UPDATE temp SET temp.f1 = 'updated' WHERE temp.f1 ='abc'; END// -# FIXME: use commented proc -# CREATE PROCEDURE sp_ins_upd() -# BEGIN -# BEGIN -# INSERT INTO temp VALUES ('qwe', 'abc', '1989-11-09', 100, 'uvw', 1000); -# INSERT INTO temp VALUES ('qwe', 'xyz', '1998-03-26', 100, 'uvw', 1000); -# INSERT INTO temp VALUES ('qwe', 'abc', '2000-11-09', 100, 'uvw', 1000); -# INSERT INTO temp VALUES ('qwe', 'abc', '2005-11-07', 100, 'uvw', 1000); -# END; -# SELECT row_count() AS 'insert "qwe"'; -# SELECT COUNT( f1 ), f1 FROM temp GROUP BY f1; -# UPDATE temp SET temp.f1 = 'updated_2' WHERE temp.f1 ='qwe' AND temp.f2 = 'abc'; -# SELECT row_count() AS 'update "qwe" AND "abc"'; -# END// CREATE PROCEDURE sp_ins_upd() BEGIN BEGIN @@ -240,31 +247,70 @@ BEGIN SELECT COUNT( f1 ), f1 FROM temp GROUP BY f1; UPDATE temp SET temp.f1 = 'updated_2' WHERE temp.f1 ='qwe' AND temp.f2 = 'abc'; END// + +CREATE PROCEDURE sp_del() +BEGIN + DELETE FROM temp WHERE temp.f1 ='qwe' OR temp.f1 = 'updated_2'; +END// + +CREATE PROCEDURE sp_with_rowcount() +BEGIN + BEGIN + INSERT INTO temp VALUES ('qwe', 'abc', '1989-11-09', 100, 'uvw', 1000), + ('qwe', 'xyz', '1998-03-26', 100, 'uvw', 1000), + ('qwe', 'abc', '2000-11-09', 100, 'uvw', 1000), + ('qwe', 'xyz', '2005-11-07', 100, 'uvw', 1000); + END; + SELECT row_count() AS 'row_count() after insert'; + SELECT row_count() AS 'row_count() after select row_count()'; + SELECT f1,f2,f3 FROM temp ORDER BY f1,f2,f3; + UPDATE temp SET temp.f1 = 'updated_2' WHERE temp.f2 = 'abc'; + SELECT row_count() AS 'row_count() after update'; + SELECT f1,f2,f3 FROM temp ORDER BY f1,f2,f3; + DELETE FROM temp WHERE temp.f1 = 'updated_2'; + SELECT row_count() AS 'row_count() after delete'; +END// delimiter ;// CALL sp_ins_1(); SELECT row_count(); +--sorted_result SELECT * FROM temp; CALL sp_ins_3(); -#FIXME: check is 1 correct here? I expect 3 for 3 inserted rows inside the procedure SELECT row_count(); +--sorted_result SELECT * FROM temp; CALL sp_upd(); SELECT row_count(); +--sorted_result SELECT * FROM temp; -#FIXME: check is 3 correct here? I expect 7 for 4 inserted and then 3 updated rows inside the procedure CALL sp_ins_upd(); SELECT row_count(); +--sorted_result +SELECT * FROM temp; + +CALL sp_del(); +SELECT row_count(); +--sorted_result SELECT * FROM temp; +DELETE FROM temp; +CALL sp_with_rowcount(); +SELECT row_count(); +--sorted_result +SELECT * FROM temp; + + # cleanup DROP PROCEDURE sp_ins_1; DROP PROCEDURE sp_ins_3; DROP PROCEDURE sp_upd; DROP PROCEDURE sp_ins_upd; +DROP PROCEDURE sp_del; +DROP PROCEDURE sp_with_rowcount; DROP TABLE temp; @@ -272,7 +318,7 @@ DROP TABLE temp; let $message= Testcase 3.1.10.8:; --source include/show_msg.inc let $message= -Ensure that the mysql_affected_rows() C API function always returns the correct +Ensure that the mysql_affected_rows() C API function always returns the correct number of rows affected by the execution of a stored procedure.; --source include/show_msg80.inc @@ -283,6 +329,7 @@ number of rows affected by the execution of a stored procedure.; --source suite/funcs_1/storedproc/cleanup_sp_tb.inc # ============================================================================== -let $message= . +++ END OF SCRIPT +++; ---source include/show_msg80.inc +--echo +--echo . +++ END OF SCRIPT +++ +--echo -------------------------------------------------------------------------------- # ============================================================================== diff --git a/mysql-test/suite/funcs_1/t/charset_collation_1.test b/mysql-test/suite/funcs_1/t/charset_collation_1.test index 7415220455e..15777062a72 100644 --- a/mysql-test/suite/funcs_1/t/charset_collation_1.test +++ b/mysql-test/suite/funcs_1/t/charset_collation_1.test @@ -22,9 +22,11 @@ if (`SELECT EXISTS (SELECT 1 FROM information_schema.collations OR ( @@version_comment NOT LIKE '%Source%' AND @@version_comment NOT LIKE '%Enterprise%' AND @@version_comment NOT LIKE '%Classic%' - AND @@version_comment NOT LIKE '%Pushbuild%')`) + AND @@version_comment NOT LIKE '%Pushbuild%') + OR (SELECT count(*) = 0 FROM information_schema.collations + WHERE collation_name = 'ucs2_bin')`) { - skip Test needs Enterprise, Classic , Pushbuild or Source-without-max build; + skip Test needs Enterprise, Classic , regular Pushbuild or Source-without-max build; } --source suite/funcs_1/datadict/charset_collation.inc diff --git a/mysql-test/suite/funcs_1/t/charset_collation_3.test b/mysql-test/suite/funcs_1/t/charset_collation_3.test index 0701b96896f..e88b44e4a0f 100644 --- a/mysql-test/suite/funcs_1/t/charset_collation_3.test +++ b/mysql-test/suite/funcs_1/t/charset_collation_3.test @@ -16,9 +16,10 @@ # if (`SELECT @@version_comment NOT LIKE '%Community%' - AND @@version_comment NOT LIKE '%Cluster%'`) + AND @@version_comment NOT LIKE '%Cluster%' + AND @@version_comment NOT LIKE '%Advanced%'`) { - skip Test needs Community or Cluster build; + skip Test needs Community, Cluster or Advanced build; } --source suite/funcs_1/datadict/charset_collation.inc diff --git a/mysql-test/suite/funcs_1/t/disabled.def b/mysql-test/suite/funcs_1/t/disabled.def index 6833178a353..e9b85036259 100644 --- a/mysql-test/suite/funcs_1/t/disabled.def +++ b/mysql-test/suite/funcs_1/t/disabled.def @@ -13,3 +13,5 @@ innodb_storedproc: (changes of WL#2984, using storeproc_nn instead) memory_storedproc: (changes of WL#2984, using storeproc_nn instead) myisam_storedproc: (changes of WL#2984, using storeproc_nn instead) +ndb_trig_1011ext: Bug#32656 NDB: Duplicate key error aborts transaction in handler. Doesn't talk back to SQL +is_tables_ndb: Bug#37198 user without any right on schema sees NDB table diff --git a/mysql-test/suite/funcs_1/t/innodb_trig_0102.test b/mysql-test/suite/funcs_1/t/innodb_trig_0102.test index c1da8f5448e..d5e65d3580f 100644 --- a/mysql-test/suite/funcs_1/t/innodb_trig_0102.test +++ b/mysql-test/suite/funcs_1/t/innodb_trig_0102.test @@ -1,4 +1,4 @@ -#### suite/funcs_1/t/innodb_triggers.test +#### suite/funcs_1/t/innodb_trig_0102.test # InnoDB tables should be used # @@ -7,10 +7,4 @@ # 2. Set $engine_type let $engine_type= innodb; -# Create some objects needed in many testcases -USE test; ---source suite/funcs_1/include/innodb_tb3.inc - --source suite/funcs_1/triggers/triggers_0102.inc -DROP TABLE test.tb3; - diff --git a/mysql-test/suite/funcs_1/t/innodb_trig_03.test b/mysql-test/suite/funcs_1/t/innodb_trig_03.test index 374bcf59a37..2a611c97fbf 100644 --- a/mysql-test/suite/funcs_1/t/innodb_trig_03.test +++ b/mysql-test/suite/funcs_1/t/innodb_trig_03.test @@ -1,4 +1,4 @@ -#### suite/funcs_1/t/innodb_triggers.test +#### suite/funcs_1/t/innodb_trig_03.test # InnoDB tables should be used # @@ -7,10 +7,4 @@ # 2. Set $engine_type let $engine_type= innodb; -# Create some objects needed in many testcases -USE test; ---source suite/funcs_1/include/innodb_tb3.inc - --source suite/funcs_1/triggers/triggers_03.inc -DROP TABLE test.tb3; - diff --git a/mysql-test/suite/funcs_1/t/innodb_trig_0407.test b/mysql-test/suite/funcs_1/t/innodb_trig_0407.test index d6b7d4a9942..d8081770f4b 100644 --- a/mysql-test/suite/funcs_1/t/innodb_trig_0407.test +++ b/mysql-test/suite/funcs_1/t/innodb_trig_0407.test @@ -1,4 +1,4 @@ -#### suite/funcs_1/t/innodb_triggers.test +#### suite/funcs_1/t/innodb_trig_0407.test # InnoDB tables should be used # @@ -7,10 +7,4 @@ # 2. Set $engine_type let $engine_type= innodb; -# Create some objects needed in many testcases -USE test; ---source suite/funcs_1/include/innodb_tb3.inc - --source suite/funcs_1/triggers/triggers_0407.inc -DROP TABLE test.tb3; - diff --git a/mysql-test/suite/funcs_1/t/innodb_trig_08.test b/mysql-test/suite/funcs_1/t/innodb_trig_08.test index a4ac2db0955..ba48b977ba2 100644 --- a/mysql-test/suite/funcs_1/t/innodb_trig_08.test +++ b/mysql-test/suite/funcs_1/t/innodb_trig_08.test @@ -1,4 +1,4 @@ -#### suite/funcs_1/t/innodb_triggers.test +#### suite/funcs_1/t/innodb_trig_08.test # InnoDB tables should be used # @@ -7,10 +7,4 @@ # 2. Set $engine_type let $engine_type= innodb; -# Create some objects needed in many testcases -USE test; ---source suite/funcs_1/include/innodb_tb3.inc - --source suite/funcs_1/triggers/triggers_08.inc -DROP TABLE test.tb3; - diff --git a/mysql-test/suite/funcs_1/t/innodb_trig_09.test b/mysql-test/suite/funcs_1/t/innodb_trig_09.test index 40a0f145ef0..ad11465ff3c 100644 --- a/mysql-test/suite/funcs_1/t/innodb_trig_09.test +++ b/mysql-test/suite/funcs_1/t/innodb_trig_09.test @@ -1,4 +1,4 @@ -#### suite/funcs_1/t/innodb_triggers.test +#### suite/funcs_1/t/innodb_trig_09.test # InnoDB tables should be used # @@ -7,10 +7,4 @@ # 2. Set $engine_type let $engine_type= innodb; -# Create some objects needed in many testcases -USE test; ---source suite/funcs_1/include/innodb_tb3.inc - --source suite/funcs_1/triggers/triggers_09.inc -DROP TABLE test.tb3; - diff --git a/mysql-test/suite/funcs_1/t/innodb_trig_1011ext.test b/mysql-test/suite/funcs_1/t/innodb_trig_1011ext.test index f778b097a1b..b3252499191 100644 --- a/mysql-test/suite/funcs_1/t/innodb_trig_1011ext.test +++ b/mysql-test/suite/funcs_1/t/innodb_trig_1011ext.test @@ -1,4 +1,4 @@ -#### suite/funcs_1/t/innodb_triggers.test +#### suite/funcs_1/t/innodb_trig_1011ext.test # InnoDB tables should be used # @@ -7,10 +7,4 @@ # 2. Set $engine_type let $engine_type= innodb; -# Create some objects needed in many testcases -USE test; ---source suite/funcs_1/include/innodb_tb3.inc - --source suite/funcs_1/triggers/triggers_1011ext.inc -DROP TABLE test.tb3; - diff --git a/mysql-test/suite/funcs_1/t/innodb_trig_frkey.test b/mysql-test/suite/funcs_1/t/innodb_trig_frkey.test index 57298fd9056..32da61ec876 100644 --- a/mysql-test/suite/funcs_1/t/innodb_trig_frkey.test +++ b/mysql-test/suite/funcs_1/t/innodb_trig_frkey.test @@ -7,10 +7,4 @@ # 2. Set $engine_type let $engine_type= innodb; -# Create some objects needed in many testcases -USE test; ---source suite/funcs_1/include/innodb_tb3.inc - --source suite/funcs_1/triggers/trig_frkey.inc -DROP TABLE test.tb3; - diff --git a/mysql-test/suite/funcs_1/t/is_basics_mixed.test b/mysql-test/suite/funcs_1/t/is_basics_mixed.test index 8097c3ab3b1..235b91c67d0 100644 --- a/mysql-test/suite/funcs_1/t/is_basics_mixed.test +++ b/mysql-test/suite/funcs_1/t/is_basics_mixed.test @@ -11,6 +11,19 @@ # Create this script based on older scripts and new code. # +# This test is strict adjusted to the behaviour of the non embedded server. +# Example of common differences between both servers: +# USE information_schema; CREATE VIEW tables AS SELECT 'garbage'; +# non embedded server: +# - errname ER_DBACCESS_DENIED_ERROR +# - ERROR 42000: Access denied for user 'root'@'localhost' to +# database 'information_schema' +# embedded server: +# - errno 1 +# - Can't create/write to file +# '.../var/master-data/information_schema/tables.frm~ +--source include/not_embedded.inc + --source suite/funcs_1/datadict/datadict.pre # $engine_type must point to storage engine which is all time available. @@ -174,7 +187,7 @@ WHERE table_schema = 'db_datadict' ORDER BY table_name LIMIT 1; SELECT @table_name,@table_schema; # # SELECT INTO OUTFILE -let $OUTFILE = $MYSQL_TMP_DIR/datadict.out; +let $OUTFILE = $MYSQLTEST_VARDIR/tmp/datadict.out; --error 0,1 remove_file $OUTFILE; --replace_result $OUTFILE <OUTFILE> diff --git a/mysql-test/suite/funcs_1/t/is_cml_innodb.test b/mysql-test/suite/funcs_1/t/is_cml_innodb.test new file mode 100644 index 00000000000..a37e5c8d94c --- /dev/null +++ b/mysql-test/suite/funcs_1/t/is_cml_innodb.test @@ -0,0 +1,41 @@ +# suite/funcs_1/t/is_cml_innodb.test +# +# Check the content of information_schema.columns about tables using +# UNICODE columns. +# Variant for storage engine InnoDB +# +# Author: +# 2008-06-04 mleich Create this script based on older scripts and new code. +# + +--source include/have_ucs2.inc + +# This test cannot be used for the embedded server because privileges +# are expected within result sets. +--source include/not_embedded.inc + +--source include/have_innodb.inc +let $engine_type= InnoDB; +USE test; +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings +eval CREATE TABLE t1 +( + f1 CHAR UNICODE, + f2 CHAR(0) UNICODE, + f3 CHAR(10) UNICODE, + f5 VARCHAR(0) UNICODE, + f6 VARCHAR(255) UNICODE, + f7 VARCHAR(260) UNICODE, + f8 TEXT UNICODE, + f9 TINYTEXT UNICODE, + f10 MEDIUMTEXT UNICODE, + f11 LONGTEXT UNICODE +) ENGINE = $engine_type; + +# We look only for the tables created here. +let $my_where = WHERE table_schema LIKE 'test%'; +--source suite/funcs_1/datadict/columns.inc + +DROP TABLE t1; diff --git a/mysql-test/suite/funcs_1/t/is_cml_memory.test b/mysql-test/suite/funcs_1/t/is_cml_memory.test new file mode 100644 index 00000000000..41602ac863a --- /dev/null +++ b/mysql-test/suite/funcs_1/t/is_cml_memory.test @@ -0,0 +1,37 @@ +# suite/funcs_1/t/is_cml_memory.test +# +# Check the content of information_schema.columns about tables using +# UNICODE columns. +# Variant for storage engine MEMORY +# +# Author: +# 2008-06-04 mleich Create this script based on older scripts and new code. +# + +--source include/have_ucs2.inc + +# This test cannot be used for the embedded server because privileges +# are expected within result sets. +--source include/not_embedded.inc + +let $engine_type= MEMORY; +SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION'; +USE test; +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings +eval CREATE TABLE t1 +( + f1 CHAR UNICODE, + f2 CHAR(0) UNICODE, + f3 CHAR(10) UNICODE, + f5 VARCHAR(0) UNICODE, + f6 VARCHAR(255) UNICODE, + f7 VARCHAR(260) UNICODE +) ENGINE = $engine_type; + +# We look only for the tables created here. +let $my_where = WHERE table_schema LIKE 'test%'; +--source suite/funcs_1/datadict/columns.inc + +DROP TABLE t1; diff --git a/mysql-test/suite/funcs_1/t/is_cml_myisam.test b/mysql-test/suite/funcs_1/t/is_cml_myisam.test new file mode 100644 index 00000000000..904cefbd4d7 --- /dev/null +++ b/mysql-test/suite/funcs_1/t/is_cml_myisam.test @@ -0,0 +1,41 @@ +# suite/funcs_1/t/is_cml_myisam.test +# +# Check the content of information_schema.columns about tables using +# UNICODE columns. +# Variant for storage engine MyISAM +# +# Author: +# 2008-06-04 mleich Create this script based on older scripts and new code. +# + +--source include/have_ucs2.inc + +# This test cannot be used for the embedded server because privileges +# are expected within result sets. +--source include/not_embedded.inc + +let $engine_type= MyISAM; +SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION'; +USE test; +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings +eval CREATE TABLE t1 +( + f1 CHAR UNICODE, + f2 CHAR(0) UNICODE, + f3 CHAR(10) UNICODE, + f5 VARCHAR(0) UNICODE, + f6 VARCHAR(255) UNICODE, + f7 VARCHAR(260) UNICODE, + f8 TEXT UNICODE, + f9 TINYTEXT UNICODE, + f10 MEDIUMTEXT UNICODE, + f11 LONGTEXT UNICODE +) ENGINE = $engine_type; + +# We look only for the tables created here. +let $my_where = WHERE table_schema LIKE 'test%'; +--source suite/funcs_1/datadict/columns.inc + +DROP TABLE t1; diff --git a/mysql-test/suite/funcs_1/t/is_cml_ndb.test b/mysql-test/suite/funcs_1/t/is_cml_ndb.test new file mode 100644 index 00000000000..55899be830b --- /dev/null +++ b/mysql-test/suite/funcs_1/t/is_cml_ndb.test @@ -0,0 +1,41 @@ +# suite/funcs_1/t/is_cml_ndb.test +# +# Check the content of information_schema.columns about tables using +# UNICODE columns. +# Variant for storage engine NDB +# +# Author: +# 2008-06-04 mleich Create this script based on older scripts and new code. +# + +--source include/have_ucs2.inc + +# This test cannot be used for the embedded server because privileges +# are expected within result sets. +--source include/not_embedded.inc + +--source include/have_ndb.inc +let $engine_type= NDB; +USE test; +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings +eval CREATE TABLE t1 +( + f1 CHAR UNICODE, + f2 CHAR(0) UNICODE, + f3 CHAR(10) UNICODE, + f5 VARCHAR(0) UNICODE, + f6 VARCHAR(255) UNICODE, + f7 VARCHAR(260) UNICODE, + f8 TEXT UNICODE, + f9 TINYTEXT UNICODE, + f10 MEDIUMTEXT UNICODE, + f11 LONGTEXT UNICODE +) ENGINE = $engine_type; + +# We look only for the tables created here. +let $my_where = WHERE table_schema LIKE 'test%'; +--source suite/funcs_1/datadict/columns.inc + +DROP TABLE t1; diff --git a/mysql-test/suite/funcs_1/t/is_column_privileges.test b/mysql-test/suite/funcs_1/t/is_column_privileges.test index 8f125051060..cb8c50c01b7 100644 --- a/mysql-test/suite/funcs_1/t/is_column_privileges.test +++ b/mysql-test/suite/funcs_1/t/is_column_privileges.test @@ -16,7 +16,9 @@ # Create this script based on older scripts and new code. # -# --source suite/funcs_1/datadict/datadict.pre +# This test cannot be used for the embedded server because we check here +# privileges. +--source include/not_embedded.inc let $engine_type = MEMORY; let $other_engine_type = MyISAM; diff --git a/mysql-test/suite/funcs_1/t/is_column_privileges_is_mysql_test.test b/mysql-test/suite/funcs_1/t/is_column_privileges_is_mysql_test.test index 3ed8597e309..33269fe929c 100644 --- a/mysql-test/suite/funcs_1/t/is_column_privileges_is_mysql_test.test +++ b/mysql-test/suite/funcs_1/t/is_column_privileges_is_mysql_test.test @@ -8,7 +8,10 @@ # testsuite funcs_1 # Create this script based on older scripts and new code. # -# + +# This test cannot be used for the embedded server because we check here +# privileges. +--source include/not_embedded.inc --echo ############################################################################## --echo # Testcases 3.2.9.2+3.2.9.3 INFORMATION_SCHEMA.SCHEMATA accessible information diff --git a/mysql-test/suite/funcs_1/t/is_columns.test b/mysql-test/suite/funcs_1/t/is_columns.test index 385de733ac3..efb52acd48c 100644 --- a/mysql-test/suite/funcs_1/t/is_columns.test +++ b/mysql-test/suite/funcs_1/t/is_columns.test @@ -16,7 +16,9 @@ # Create this script based on older scripts and new code. # -# --source suite/funcs_1/datadict/datadict.pre +# This test cannot be used for the embedded server because we check here +# privileges. +--source include/not_embedded.inc let $engine_type = MEMORY; let $other_engine_type = MyISAM; diff --git a/mysql-test/suite/funcs_1/t/is_columns_innodb.test b/mysql-test/suite/funcs_1/t/is_columns_innodb.test index 04b9f8354e4..7d8ca9a3a8e 100644 --- a/mysql-test/suite/funcs_1/t/is_columns_innodb.test +++ b/mysql-test/suite/funcs_1/t/is_columns_innodb.test @@ -10,6 +10,10 @@ # Create this script based on older scripts and new code. # +# This test cannot be used for the embedded server because we check here +# privileges. +--source include/not_embedded.inc + --source include/have_innodb.inc let $engine_type= InnoDB; --source suite/funcs_1/datadict/datadict_load.inc diff --git a/mysql-test/suite/funcs_1/t/is_columns_is.test b/mysql-test/suite/funcs_1/t/is_columns_is.test index 41a7d180be8..743b11d7bff 100644 --- a/mysql-test/suite/funcs_1/t/is_columns_is.test +++ b/mysql-test/suite/funcs_1/t/is_columns_is.test @@ -2,6 +2,9 @@ # # Check the content of information_schema.columns about tables within # the database information_schema. +# Variant for the non embedded server +# The expected results must equal is_columns_is_embedded except that +# columns.privileges are not empty. # # Note: The INFORMATION_SCHEMA table PROFILING is optional (exists in MySQL # Community version only) and therefore we exclude it from retrieval. @@ -12,8 +15,8 @@ # Create this script based on older scripts and new code. # +--source include/not_embedded.inc + let $my_where = WHERE table_schema = 'information_schema' AND table_name <> 'profiling'; -# --source suite/funcs_1/datadict/datadict.pre --source suite/funcs_1/datadict/columns.inc - diff --git a/mysql-test/suite/funcs_1/t/is_columns_is_embedded.test b/mysql-test/suite/funcs_1/t/is_columns_is_embedded.test new file mode 100644 index 00000000000..7bc29624f1d --- /dev/null +++ b/mysql-test/suite/funcs_1/t/is_columns_is_embedded.test @@ -0,0 +1,23 @@ +# suite/funcs_1/t/is_columns_is_embedded.test +# +# Check the content of information_schema.columns about tables within +# the database information_schema. +# Variant for the embedded server +# The expected results must equal is_columns_is except that +# columns.privileges is empty. +# +# Note: The INFORMATION_SCHEMA table PROFILING is optional (exists in MySQL +# Community version only) and therefore we exclude it from retrieval. +# +# Author: +# 2008-06-06 mleich Create this variant for the embedded server +# + +if (`SELECT VERSION() NOT LIKE '%embedded%'`) +{ + --skip Test requires: embedded server +} + +let $my_where = WHERE table_schema = 'information_schema' +AND table_name <> 'profiling'; +--source suite/funcs_1/datadict/columns.inc diff --git a/mysql-test/suite/funcs_1/t/is_columns_memory.test b/mysql-test/suite/funcs_1/t/is_columns_memory.test index 6cbf3b298b4..b76325d114a 100644 --- a/mysql-test/suite/funcs_1/t/is_columns_memory.test +++ b/mysql-test/suite/funcs_1/t/is_columns_memory.test @@ -10,6 +10,10 @@ # Create this script based on older scripts and new code. # +# This test cannot be used for the embedded server because we check here +# privileges. +--source include/not_embedded.inc + let $engine_type= MEMORY; SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION'; --source suite/funcs_1/datadict/datadict_load.inc diff --git a/mysql-test/suite/funcs_1/t/is_columns_myisam.test b/mysql-test/suite/funcs_1/t/is_columns_myisam.test index d98cd0347c6..09b5b088489 100644 --- a/mysql-test/suite/funcs_1/t/is_columns_myisam.test +++ b/mysql-test/suite/funcs_1/t/is_columns_myisam.test @@ -2,7 +2,9 @@ # # Check the content of information_schema.columns about tables within # the databases created by the user. -# Variant for storage engine MyISAM +# Variant for storage engine MyISAM and the non embedded server +# The expected results must equal is_columns_myisam_embedded except that +# that the privilege system works (affects some result sets). # # Author: # 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of @@ -10,6 +12,7 @@ # Create this script based on older scripts and new code. # +--source include/not_embedded.inc let $engine_type= MyISAM; SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION'; --source suite/funcs_1/datadict/datadict_load.inc diff --git a/mysql-test/suite/funcs_1/t/is_columns_myisam_embedded.test b/mysql-test/suite/funcs_1/t/is_columns_myisam_embedded.test new file mode 100644 index 00000000000..0d5f1a72cdb --- /dev/null +++ b/mysql-test/suite/funcs_1/t/is_columns_myisam_embedded.test @@ -0,0 +1,30 @@ +# suite/funcs_1/t/is_columns_myisam_embedded.test +# +# Check the content of information_schema.columns about tables within +# the databases created by the user. +# Variant for storage engine MyISAM and the embedded server +# The expected results must equal is_columns_myisam except that all users +# have all privileges (affects some result sets). +# +# Author: +# 2008-06-06 mleich Create this this variant for the embedded server. +# + +let $value= query_get_value(SHOW VARIABLES LIKE 'version_compile_os',Value,1); +if (`SELECT '$value' LIKE 'apple-darwin%'`) +{ + skip Bug#37380 Test funcs_1.is_columns_myisam_embedded fails on OS X; +} +if (`SELECT VERSION() NOT LIKE '%embedded%'`) +{ + --skip Test requires: embedded server +} +let $engine_type= MyISAM; +SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION'; +--source suite/funcs_1/datadict/datadict_load.inc + +# We look only for the tables created by datadict_load.inc. +let $my_where = WHERE table_schema LIKE 'test%'; +--source suite/funcs_1/datadict/columns.inc + +--source suite/funcs_1/include/cleanup.inc diff --git a/mysql-test/suite/funcs_1/t/is_columns_mysql.test b/mysql-test/suite/funcs_1/t/is_columns_mysql.test index 26539d0c8e0..a844e18f5be 100644 --- a/mysql-test/suite/funcs_1/t/is_columns_mysql.test +++ b/mysql-test/suite/funcs_1/t/is_columns_mysql.test @@ -2,6 +2,9 @@ # # Check the content of information_schema.columns about tables within # the database mysql. +# Variant for the non embedded server +# The expected results must equal is_columns_mysql_embedded except that +# columns.privileges are not empty. # # Author: # 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of @@ -9,5 +12,7 @@ # Create this script based on older scripts and new code. # +--source include/not_embedded.inc + let $my_where = WHERE table_schema = 'mysql'; --source suite/funcs_1/datadict/columns.inc diff --git a/mysql-test/suite/funcs_1/t/is_columns_mysql_embedded.test b/mysql-test/suite/funcs_1/t/is_columns_mysql_embedded.test new file mode 100644 index 00000000000..d1ed45425ec --- /dev/null +++ b/mysql-test/suite/funcs_1/t/is_columns_mysql_embedded.test @@ -0,0 +1,19 @@ +# suite/funcs_1/t/is_columns_mysql_embedded.test +# +# Check the content of information_schema.columns about tables within +# the database mysql. +# Variant for the embedded server +# The expected results must equal is_columns_mysql except that +# columns.privileges is empty. +# +# Author: +# 2008-06-06 mleich Create this variant for the embedded server +# + +if (`SELECT VERSION() NOT LIKE '%embedded%'`) +{ + --skip Test requires: embedded server +} + +let $my_where = WHERE table_schema = 'mysql'; +--source suite/funcs_1/datadict/columns.inc diff --git a/mysql-test/suite/funcs_1/t/is_columns_ndb.test b/mysql-test/suite/funcs_1/t/is_columns_ndb.test index 960e5f079bb..3d2a8d7aa5b 100644 --- a/mysql-test/suite/funcs_1/t/is_columns_ndb.test +++ b/mysql-test/suite/funcs_1/t/is_columns_ndb.test @@ -10,6 +10,10 @@ # Create this script based on older scripts and new code. # +# This test cannot be used for the embedded server because we check here +# privileges. +--source include/not_embedded.inc + --source include/have_ndb.inc let $engine_type= ndb; --source suite/funcs_1/datadict/datadict_load.inc diff --git a/mysql-test/suite/funcs_1/t/is_key_column_usage.test b/mysql-test/suite/funcs_1/t/is_key_column_usage.test index 219277c8645..a6bd8fc3989 100644 --- a/mysql-test/suite/funcs_1/t/is_key_column_usage.test +++ b/mysql-test/suite/funcs_1/t/is_key_column_usage.test @@ -2,13 +2,12 @@ # # Check the layout of information_schema.key_column_usage and the impact of # CREATE/ALTER/DROP TABLE/VIEW/SCHEMA/COLUMN ... on it. +# Variant for the non embedded server +# The expected results must equal is_key_column_usage_embedded except that +# that the privilege system works (affects some result sets). # -# 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. +# There is detailed information about this test within +# suite/funcs_1/datadict/is_key_column_usage.inc # # Author: # 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of @@ -16,329 +15,5 @@ # Create this script based on older scripts and new code. # -# --source suite/funcs_1/datadict/datadict.pre - -let $engine_type = MEMORY; -# let $other_engine_type = MyISAM; - -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; - ---error ER_DBACCESS_DENIED_ERROR -INSERT INTO information_schema.key_column_usage - (constraint_schema, constraint_name, table_name) -VALUES ( 'mysql', 'primary', 'db'); ---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; - -# Cleanup -DROP TABLE db_datadict.t1; -DROP DATABASE db_datadict; - +--source include/not_embedded.inc +--source suite/funcs_1/datadict/is_key_column_usage.inc diff --git a/mysql-test/suite/funcs_1/t/is_key_column_usage_embedded.test b/mysql-test/suite/funcs_1/t/is_key_column_usage_embedded.test new file mode 100644 index 00000000000..ccdc8dec3d9 --- /dev/null +++ b/mysql-test/suite/funcs_1/t/is_key_column_usage_embedded.test @@ -0,0 +1,20 @@ +# suite/funcs_1/t/is_key_column_usage_embedded.test +# +# Check the layout of information_schema.key_column_usage and the impact of +# CREATE/ALTER/DROP TABLE/VIEW/SCHEMA/COLUMN ... on it. +# Variant for the embedded server +# The expected results must equal is_key_column_usage except that all users +# have all privileges (affects some result sets). +# +# There is detailed information about this test within +# suite/funcs_1/datadict/is_key_column_usage.inc +# +# Author: +# 2008-06-06 mleich Create this this variant for the embedded server. +# + +if (`SELECT VERSION() NOT LIKE '%embedded%'`) +{ + --skip Test requires: embedded server +} +--source suite/funcs_1/datadict/is_key_column_usage.inc diff --git a/mysql-test/suite/funcs_1/t/is_routines.test b/mysql-test/suite/funcs_1/t/is_routines.test index 5f015b8624b..30a0e02c23a 100644 --- a/mysql-test/suite/funcs_1/t/is_routines.test +++ b/mysql-test/suite/funcs_1/t/is_routines.test @@ -2,13 +2,12 @@ # # Check the layout of information_schema.routines and the impact of # CREATE/ALTER/DROP PROCEDURE/FUNCTION ... on it. +# Variant for the non embedded server +# The expected results must equal is_routines_embedded except that +# that the privilege system works (affects some result sets). # -# 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. +# There is detailed information about this test within +# suite/funcs_1/datadict/is_routines.inc # # Author: # 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of @@ -16,456 +15,5 @@ # Create this script based on older scripts and new code. # -# --source suite/funcs_1/datadict/datadict.pre - -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). -# ---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; - ---error ER_DBACCESS_DENIED_ERROR -INSERT INTO information_schema.routines (routine_name, routine_type ) -VALUES ('p2', 'procedure'); - ---error ER_DBACCESS_DENIED_ERROR -UPDATE information_schema.routines SET routine_name = 'p2' -WHERE routine_body = 'sql'; - ---error ER_DBACCESS_DENIED_ERROR -DELETE FROM information_schema.routines ; -# ---error ER_DBACCESS_DENIED_ERROR -TRUNCATE information_schema.routines ; - ---error ER_DBACCESS_DENIED_ERROR -CREATE INDEX i7 ON information_schema.routines (routine_name); - ---error ER_DBACCESS_DENIED_ERROR -ALTER TABLE information_schema.routines ADD f1 INT; -# ---error ER_DBACCESS_DENIED_ERROR -ALTER TABLE information_schema.routines DISCARD TABLESPACE; - ---error ER_DBACCESS_DENIED_ERROR -DROP TABLE information_schema.routines ; - ---error ER_DBACCESS_DENIED_ERROR -ALTER TABLE information_schema.routines RENAME db_datadict.routines; -# ---error ER_DBACCESS_DENIED_ERROR -ALTER TABLE information_schema.routines RENAME information_schema.xroutines; - -# Cleanup -DROP DATABASE db_datadict; - +--source include/not_embedded.inc +--source suite/funcs_1/datadict/is_routines.inc diff --git a/mysql-test/suite/funcs_1/t/is_routines_embedded.test b/mysql-test/suite/funcs_1/t/is_routines_embedded.test new file mode 100644 index 00000000000..86e1145690d --- /dev/null +++ b/mysql-test/suite/funcs_1/t/is_routines_embedded.test @@ -0,0 +1,20 @@ +# suite/funcs_1/t/is_routines_embedded.test +# +# Check the layout of information_schema.routines and the impact of +# CREATE/ALTER/DROP PROCEDURE/FUNCTION ... on it. +# Variant for the embedded server +# The expected results must equal is_routines except that all users +# have all privileges (affects some result sets). +# +# There is detailed information about this test within +# suite/funcs_1/datadict/is_routines.inc +# +# Author: +# 2008-06-06 mleich Create this this variant for the embedded server. +# + +if (`SELECT VERSION() NOT LIKE '%embedded%'`) +{ + --skip Test requires: embedded server +} +--source suite/funcs_1/datadict/is_routines.inc diff --git a/mysql-test/suite/funcs_1/t/is_schema_privileges.test b/mysql-test/suite/funcs_1/t/is_schema_privileges.test index 4eb4a273362..1f408d71b39 100644 --- a/mysql-test/suite/funcs_1/t/is_schema_privileges.test +++ b/mysql-test/suite/funcs_1/t/is_schema_privileges.test @@ -16,7 +16,9 @@ # Create this script based on older scripts and new code. # -# --source suite/funcs_1/datadict/datadict.pre +# This test cannot be used for the embedded server because we check here +# privileges. +--source include/not_embedded.inc let $engine_type = MEMORY; let $other_engine_type = MyISAM; diff --git a/mysql-test/suite/funcs_1/t/is_schema_privileges_is_mysql_test.test b/mysql-test/suite/funcs_1/t/is_schema_privileges_is_mysql_test.test index cb34d1bad2d..3f60f71fe9a 100644 --- a/mysql-test/suite/funcs_1/t/is_schema_privileges_is_mysql_test.test +++ b/mysql-test/suite/funcs_1/t/is_schema_privileges_is_mysql_test.test @@ -8,7 +8,10 @@ # testsuite funcs_1 # Create this script based on older scripts and new code. # -# + +# This test cannot be used for the embedded server because we check here +# privileges. +--source include/not_embedded.inc --echo ############################################################################## --echo # Testcases 3.2.9.2+3.2.9.3 INFORMATION_SCHEMA.SCHEMATA accessible information diff --git a/mysql-test/suite/funcs_1/t/is_schemata.test b/mysql-test/suite/funcs_1/t/is_schemata.test index 7eb08dba463..e262869e6d4 100644 --- a/mysql-test/suite/funcs_1/t/is_schemata.test +++ b/mysql-test/suite/funcs_1/t/is_schemata.test @@ -2,12 +2,12 @@ # # Check the layout of information_schema.schemata, permissions and the impact of # CREATE/ALTER/DROP SCHEMA on it. +# Variant for the non embedded server +# The expected results must equal is_schemata_embedded except that +# that the privilege system works (affects some result sets). # -# Note: -# This test is not intended -# - to show information about the all time existing databases -# information_schema and mysql -# - for checking storage engine properties +# There is detailed information about this test within +# suite/funcs_1/datadict/is_schemata.inc # # Author: # 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of @@ -15,232 +15,5 @@ # Create this script based on older scripts and new code. # -# --source suite/funcs_1/datadict/datadict.pre - -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'; - ---error ER_DBACCESS_DENIED_ERROR -INSERT INTO information_schema.schemata - (catalog_name, schema_name, default_character_set_name, sql_path) -VALUES (NULL, 'db1', 'latin1', NULL); ---error ER_DBACCESS_DENIED_ERROR -INSERT INTO information_schema.schemata -SELECT * FROM information_schema.schemata; - ---error ER_DBACCESS_DENIED_ERROR -UPDATE information_schema.schemata -SET default_character_set_name = 'utf8' -WHERE schema_name = 'db_datadict'; ---error ER_DBACCESS_DENIED_ERROR -UPDATE information_schema.schemata SET catalog_name = 't_4711'; - ---error ER_DBACCESS_DENIED_ERROR -DELETE FROM information_schema.schemata WHERE schema_name = 'db_datadict'; ---error ER_DBACCESS_DENIED_ERROR -TRUNCATE information_schema.schemata; - ---error ER_DBACCESS_DENIED_ERROR -CREATE INDEX i1 ON information_schema.schemata(schema_name); - ---error ER_DBACCESS_DENIED_ERROR -ALTER TABLE information_schema.schemata ADD f1 INT; - ---error ER_DBACCESS_DENIED_ERROR -DROP TABLE information_schema.schemata; - ---error ER_DBACCESS_DENIED_ERROR -ALTER TABLE information_schema.schemata RENAME db_datadict.schemata; ---error ER_DBACCESS_DENIED_ERROR -ALTER TABLE information_schema.schemata RENAME information_schema.xschemata; - -# Cleanup -DROP DATABASE db_datadict; - +--source include/not_embedded.inc +--source suite/funcs_1/datadict/is_schemata.inc diff --git a/mysql-test/suite/funcs_1/t/is_schemata_embedded.test b/mysql-test/suite/funcs_1/t/is_schemata_embedded.test new file mode 100644 index 00000000000..5fbb023dd8e --- /dev/null +++ b/mysql-test/suite/funcs_1/t/is_schemata_embedded.test @@ -0,0 +1,20 @@ +# suite/funcs_1/t/is_schemata_embedded.test +# +# Check the layout of information_schema.schemata, permissions and the impact of +# CREATE/ALTER/DROP SCHEMA on it. +# Variant for the embedded server +# The expected results must equal is_schemata except that all users +# have all privileges (affects some result sets). +# +# There is detailed information about this test within +# suite/funcs_1/datadict/is_schemata.inc +# +# Author: +# 2008-06-06 mleich Create this this variant for the embedded server. +# + +if (`SELECT VERSION() NOT LIKE '%embedded%'`) +{ + --skip Test requires: embedded server +} +--source suite/funcs_1/datadict/is_schemata.inc diff --git a/mysql-test/suite/funcs_1/t/is_schemata_is_mysql_test.test b/mysql-test/suite/funcs_1/t/is_schemata_is_mysql_test.test index cabcfa640d7..9bfbf0cf335 100644 --- a/mysql-test/suite/funcs_1/t/is_schemata_is_mysql_test.test +++ b/mysql-test/suite/funcs_1/t/is_schemata_is_mysql_test.test @@ -8,7 +8,10 @@ # testsuite funcs_1 # Create this script based on older scripts and new code. # -# + +# This test cannot be used for the embedded server because we check here +# privileges. +--source include/not_embedded.inc --echo ################################################################################# --echo # Testcases 3.2.9.2 + 3.2.9.3: INFORMATION_SCHEMA.SCHEMATA accessible information diff --git a/mysql-test/suite/funcs_1/t/is_statistics.test b/mysql-test/suite/funcs_1/t/is_statistics.test index 5b17b711fff..458892a6d91 100644 --- a/mysql-test/suite/funcs_1/t/is_statistics.test +++ b/mysql-test/suite/funcs_1/t/is_statistics.test @@ -16,7 +16,9 @@ # Create this script based on older scripts and new code. # -# --source suite/funcs_1/datadict/datadict.pre +# This test cannot be used for the embedded server because we check here +# privileges. +--source include/not_embedded.inc let $engine_type = MEMORY; let $other_engine_type = MyISAM; diff --git a/mysql-test/suite/funcs_1/t/is_statistics_mysql.test b/mysql-test/suite/funcs_1/t/is_statistics_mysql.test index a75cc922777..a1250b67b8c 100644 --- a/mysql-test/suite/funcs_1/t/is_statistics_mysql.test +++ b/mysql-test/suite/funcs_1/t/is_statistics_mysql.test @@ -2,6 +2,9 @@ # # Check the content of information_schema.statistics about tables within # the database mysql for a high and a low privileged user. +# Variant for the non embedded server +# The expected results must equal is_statistics_mysql_embedded except that +# that the privilege system works (affects some result sets). # # Author: # 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of @@ -9,7 +12,7 @@ # Create this script based on older scripts and new code. # +--source include/not_embedded.inc let $database = mysql; let $my_where = WHERE table_schema = 'mysql'; --source suite/funcs_1/datadict/statistics.inc - diff --git a/mysql-test/suite/funcs_1/t/is_statistics_mysql_embedded.test b/mysql-test/suite/funcs_1/t/is_statistics_mysql_embedded.test new file mode 100644 index 00000000000..6fedbe4d3a8 --- /dev/null +++ b/mysql-test/suite/funcs_1/t/is_statistics_mysql_embedded.test @@ -0,0 +1,19 @@ +# suite/funcs_1/t/is_statistics_mysql_embedded.test +# +# Check the content of information_schema.statistics about tables within +# the database mysql for a high and a low privileged user. +# Variant for the embedded server +# The expected results must equal is_statistics_mysql except that all users +# have all privileges (affects some result sets). +# +# Author: +# 2008-06-06 mleich Create this this variant for the embedded server. +# + +if (`SELECT VERSION() NOT LIKE '%embedded%'`) +{ + --skip Test requires: embedded server +} +let $database = mysql; +let $my_where = WHERE table_schema = 'mysql'; +--source suite/funcs_1/datadict/statistics.inc diff --git a/mysql-test/suite/funcs_1/t/is_table_constraints.test b/mysql-test/suite/funcs_1/t/is_table_constraints.test index 60d5ebce703..a64b3bfaa6e 100644 --- a/mysql-test/suite/funcs_1/t/is_table_constraints.test +++ b/mysql-test/suite/funcs_1/t/is_table_constraints.test @@ -16,7 +16,9 @@ # Create this script based on older scripts and new code. # -# --source suite/funcs_1/datadict/datadict.pre +# This test cannot be used for the embedded server because we check here +# privileges. +--source include/not_embedded.inc let $engine_type = MyISAM; diff --git a/mysql-test/suite/funcs_1/t/is_table_constraints_mysql.test b/mysql-test/suite/funcs_1/t/is_table_constraints_mysql.test index 5ef1561ccdf..a909676943e 100644 --- a/mysql-test/suite/funcs_1/t/is_table_constraints_mysql.test +++ b/mysql-test/suite/funcs_1/t/is_table_constraints_mysql.test @@ -2,6 +2,9 @@ # # Check the content of information_schema.table_constraints about tables within # the database mysql (= the system tables) with different privileged users. +# Variant for the non embedded server +# The expected results must equal is_table_constraints_mysql_embedded +# except that the privilege system works (affects some result sets). # # Author: # 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of @@ -9,6 +12,6 @@ # Create this script based on older scripts and new code. # +--source include/not_embedded.inc let $table_schema = mysql; --source suite/funcs_1/datadict/table_constraints.inc - diff --git a/mysql-test/suite/funcs_1/t/is_table_constraints_mysql_embedded.test b/mysql-test/suite/funcs_1/t/is_table_constraints_mysql_embedded.test new file mode 100644 index 00000000000..8994be31be8 --- /dev/null +++ b/mysql-test/suite/funcs_1/t/is_table_constraints_mysql_embedded.test @@ -0,0 +1,18 @@ +# suite/funcs_1/t/is_table_constraints_mysql_embedded.test +# +# Check the content of information_schema.table_constraints about tables within +# the database mysql (= the system tables) with different privileged users. +# Variant for the embedded server +# The expected results must equal is_table_constraints_mysql +# except that all users have all privileges (affects some result sets). +# +# Author: +# 2008-06-06 mleich Create this this variant for the embedded server. +# + +if (`SELECT VERSION() NOT LIKE '%embedded%'`) +{ + --skip Test requires: embedded server +} +let $table_schema = mysql; +--source suite/funcs_1/datadict/table_constraints.inc diff --git a/mysql-test/suite/funcs_1/t/is_table_privileges.test b/mysql-test/suite/funcs_1/t/is_table_privileges.test index b095a5ddad6..5ea0dd7c6a7 100644 --- a/mysql-test/suite/funcs_1/t/is_table_privileges.test +++ b/mysql-test/suite/funcs_1/t/is_table_privileges.test @@ -16,7 +16,9 @@ # Create this script based on older scripts and new code. # -# --source suite/funcs_1/datadict/datadict.pre +# This test cannot be used for the embedded server because we check here +# privileges. +--source include/not_embedded.inc let $engine_type = MEMORY; let $other_engine_type = MyISAM; diff --git a/mysql-test/suite/funcs_1/t/is_tables.test b/mysql-test/suite/funcs_1/t/is_tables.test index 35b6b7ef007..1c7620ffd45 100644 --- a/mysql-test/suite/funcs_1/t/is_tables.test +++ b/mysql-test/suite/funcs_1/t/is_tables.test @@ -2,14 +2,12 @@ # # Check the layout of information_schema.tables and the impact of # CREATE/ALTER/DROP TABLE/VIEW/SCHEMA ... on it. +# Variant for the non embedded server +# The expected results must equal is_tables_embedded except that +# that the privilege system works (affects some result sets). # -# 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. +# There is detailed information about this test within +# suite/funcs_1/datadict/is_tables.inc # # Author: # 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of @@ -17,458 +15,5 @@ # Create this script based on older scripts and new code. # -# --source suite/funcs_1/datadict/datadict.pre - -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; - +--source include/not_embedded.inc +--source suite/funcs_1/datadict/is_tables.inc diff --git a/mysql-test/suite/funcs_1/t/is_tables_embedded.test b/mysql-test/suite/funcs_1/t/is_tables_embedded.test new file mode 100644 index 00000000000..d3c59ffff36 --- /dev/null +++ b/mysql-test/suite/funcs_1/t/is_tables_embedded.test @@ -0,0 +1,20 @@ +# suite/funcs_1/t/is_tables_embedded.test +# +# Check the layout of information_schema.tables and the impact of +# CREATE/ALTER/DROP TABLE/VIEW/SCHEMA ... on it. +# Variant for the embedded server +# The expected results must equal is_tables except that all users +# have all privileges (affects some result sets). +# +# There is detailed information about this test within +# suite/funcs_1/datadict/is_tables.inc +# +# Author: +# 2008-06-06 mleich Create this this variant for the embedded server. +# + +if (`SELECT VERSION() NOT LIKE '%embedded%'`) +{ + --skip Test requires: embedded server +} +--source suite/funcs_1/datadict/is_tables.inc diff --git a/mysql-test/suite/funcs_1/t/is_tables_innodb.test b/mysql-test/suite/funcs_1/t/is_tables_innodb.test index 31a3900c7c3..ed6b7e60bbd 100644 --- a/mysql-test/suite/funcs_1/t/is_tables_innodb.test +++ b/mysql-test/suite/funcs_1/t/is_tables_innodb.test @@ -10,13 +10,13 @@ # Create this script based on older scripts and new code. # +# This test cannot be used for the embedded server because we check here +# privileges. +--source include/not_embedded.inc + --source include/have_innodb.inc let $engine_type= InnoDB; ---source suite/funcs_1/datadict/datadict_load.inc ---enable_abort_on_error -# We look only for the tables created by datadict_load.inc. +# We look only for the tables created by suite/funcs_1/datadict/tables.inc let $my_where = WHERE table_schema LIKE 'test%' AND table_type = 'BASE TABLE'; ---source suite/funcs_1/datadict/tables1.inc - ---source suite/funcs_1/include/cleanup.inc +--source suite/funcs_1/datadict/tables.inc diff --git a/mysql-test/suite/funcs_1/t/is_tables_memory.test b/mysql-test/suite/funcs_1/t/is_tables_memory.test index 8b5da595462..68909aee866 100644 --- a/mysql-test/suite/funcs_1/t/is_tables_memory.test +++ b/mysql-test/suite/funcs_1/t/is_tables_memory.test @@ -10,13 +10,13 @@ # Create this script based on older scripts and new code. # +# This test cannot be used for the embedded server because we check here +# privileges. +--source include/not_embedded.inc + let $engine_type= MEMORY; SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION'; ---source suite/funcs_1/datadict/datadict_load.inc ---enable_abort_on_error -# We look only for the tables created by datadict_load.inc. +# We look only for the tables created by suite/funcs_1/datadict/tables.inc let $my_where = WHERE table_schema LIKE 'test%' AND table_type = 'BASE TABLE'; ---source suite/funcs_1/datadict/tables1.inc - ---source suite/funcs_1/include/cleanup.inc +--source suite/funcs_1/datadict/tables.inc diff --git a/mysql-test/suite/funcs_1/t/is_tables_myisam.test b/mysql-test/suite/funcs_1/t/is_tables_myisam.test index 4fc88364d87..c3f7c87b0ed 100644 --- a/mysql-test/suite/funcs_1/t/is_tables_myisam.test +++ b/mysql-test/suite/funcs_1/t/is_tables_myisam.test @@ -2,7 +2,9 @@ # # Check the content of information_schema.tables about tables within # the databases created by the user. -# Variant for storage engine MyISAM +# Variant for storage engine MyISAM and the non embedded server +# The expected results must equal is_columns_myisam_embedded except that +# that the privilege system works (affects some result sets). # # Author: # 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of @@ -10,13 +12,10 @@ # Create this script based on older scripts and new code. # +--source include/not_embedded.inc let $engine_type= MyISAM; SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION'; ---source suite/funcs_1/datadict/datadict_load.inc ---enable_abort_on_error -# We look only for the tables created by datadict_load.inc. +# We look only for the tables created by suite/funcs_1/datadict/tables.inc let $my_where = WHERE table_schema LIKE 'test%' AND table_type = 'BASE TABLE'; ---source suite/funcs_1/datadict/tables1.inc - ---source suite/funcs_1/include/cleanup.inc +--source suite/funcs_1/datadict/tables.inc diff --git a/mysql-test/suite/funcs_1/t/is_tables_myisam_embedded.test b/mysql-test/suite/funcs_1/t/is_tables_myisam_embedded.test new file mode 100644 index 00000000000..d4595900939 --- /dev/null +++ b/mysql-test/suite/funcs_1/t/is_tables_myisam_embedded.test @@ -0,0 +1,22 @@ +# suite/funcs_1/t/is_tables_myisam_embedded.test +# +# Check the content of information_schema.tables about tables within +# the databases created by the user. +# Variant for storage engine MyISAM and the embedded server +# The expected results must equal is_tabless_myisam except that +# that the privilege system works (affects some result sets). +# +# Author: +# 2008-06-06 mleich Create this this variant for the embedded server. +# + +if (`SELECT VERSION() NOT LIKE '%embedded%'`) +{ + --skip Test requires: embedded server +} +let $engine_type= MyISAM; +SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION'; + +# We look only for the tables created by suite/funcs_1/datadict/tables.inc +let $my_where = WHERE table_schema LIKE 'test%' AND table_type = 'BASE TABLE'; +--source suite/funcs_1/datadict/tables.inc diff --git a/mysql-test/suite/funcs_1/t/is_tables_mysql.test b/mysql-test/suite/funcs_1/t/is_tables_mysql.test index a6c3a72a1cf..838704051f8 100644 --- a/mysql-test/suite/funcs_1/t/is_tables_mysql.test +++ b/mysql-test/suite/funcs_1/t/is_tables_mysql.test @@ -2,6 +2,9 @@ # # Check the content of information_schema.tables about tables within # the database mysql (= the system tables). +# Variant for the non embedded server +# The expected results must equal is_tables_mysql_embedded except that +# that the privilege system works (affects some result sets). # # Author: # 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of @@ -9,6 +12,6 @@ # Create this script based on older scripts and new code. # +--source include/not_embedded.inc let $my_where = WHERE table_schema = 'mysql'; --source suite/funcs_1/datadict/tables1.inc - diff --git a/mysql-test/suite/funcs_1/t/is_tables_mysql_embedded.test b/mysql-test/suite/funcs_1/t/is_tables_mysql_embedded.test new file mode 100644 index 00000000000..3f4ca17cdd3 --- /dev/null +++ b/mysql-test/suite/funcs_1/t/is_tables_mysql_embedded.test @@ -0,0 +1,18 @@ +# suite/funcs_1/t/is_tables_mysql_embedded.test +# +# Check the content of information_schema.tables about tables within +# the database mysql (= the system tables). +# Variant for the embedded server +# The expected results must equal is_tables_mysql except that all users +# have all privileges (affects some result sets). +# +# Author: +# 2008-06-06 mleich Create this this variant for the embedded server. +# + +if (`SELECT VERSION() NOT LIKE '%embedded%'`) +{ + --skip Test requires: embedded server +} +let $my_where = WHERE table_schema = 'mysql'; +--source suite/funcs_1/datadict/tables1.inc diff --git a/mysql-test/suite/funcs_1/t/is_tables_ndb.test b/mysql-test/suite/funcs_1/t/is_tables_ndb.test index 49ce60b08bd..d21831b75c8 100644 --- a/mysql-test/suite/funcs_1/t/is_tables_ndb.test +++ b/mysql-test/suite/funcs_1/t/is_tables_ndb.test @@ -10,25 +10,13 @@ # Create this script based on older scripts and new code. # +# This test cannot be used for the embedded server because we check here +# privileges. +--source include/not_embedded.inc + --source include/have_ndb.inc let $engine_type= NDB; ---source suite/funcs_1/datadict/datadict_load.inc ---enable_abort_on_error -# We look only for the tables created by datadict_load.inc. +# We look only for the tables created by suite/funcs_1/datadict/tables.inc let $my_where = WHERE table_schema LIKE 'test%' AND table_type = 'BASE TABLE'; ---source suite/funcs_1/datadict/tables1.inc - -# This test runs with a different set of tables. -# --source suite/funcs_1/include/cleanup.inc -DROP DATABASE test1; -DROP DATABASE test4; -DROP TABLE test.t1; -DROP TABLE test.t2; -DROP TABLE test.t3; -DROP TABLE test.t4; -DROP TABLE test.t7; -DROP TABLE test.t8; -DROP TABLE test.t9; -DROP TABLE test.t10; -DROP TABLE test.t11; +--source suite/funcs_1/datadict/tables.inc diff --git a/mysql-test/suite/funcs_1/t/is_triggers.test b/mysql-test/suite/funcs_1/t/is_triggers.test index 261f082fb50..fd42cb4e734 100644 --- a/mysql-test/suite/funcs_1/t/is_triggers.test +++ b/mysql-test/suite/funcs_1/t/is_triggers.test @@ -2,14 +2,12 @@ # # Check the layout of information_schema.triggers and the impact of # CREATE/ALTER/DROP TABLE/VIEW/SCHEMA ... on it. +# Variant for the non embedded server +# The expected results must equal is_triggers_embedded except that +# that the privilege system works (affects some result sets). # -# 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. +# There is detailed information about this test within +# suite/funcs_1/datadict/is_triggers.inc # # Author: # 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of @@ -17,237 +15,5 @@ # Create this script based on older scripts and new code. # -# --source suite/funcs_1/datadict/datadict.pre - -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 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 SUPER ON *.* TO 'testuser1'@'localhost'; -GRANT SUPER ON *.* TO 'testuser3'@'localhost'; -GRANT SUPER 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'; -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 SUPER 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 # SUPER 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 # SUPER Privilege + no SELECT Privilege on t1 --> no result for query -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; - +--source include/not_embedded.inc +--source suite/funcs_1/datadict/is_triggers.inc diff --git a/mysql-test/suite/funcs_1/t/is_triggers_embedded.test b/mysql-test/suite/funcs_1/t/is_triggers_embedded.test new file mode 100644 index 00000000000..d8e99c77bff --- /dev/null +++ b/mysql-test/suite/funcs_1/t/is_triggers_embedded.test @@ -0,0 +1,20 @@ +# suite/funcs_1/t/is_triggers_embedded.test +# +# Check the layout of information_schema.triggers and the impact of +# CREATE/ALTER/DROP TABLE/VIEW/SCHEMA ... on it. +# Variant for the embedded server +# The expected results must equal is_triggers except that all users +# have all privileges (affects some result sets). +# +# There is detailed information about this test within +# suite/funcs_1/datadict/is_triggers.inc +# +# Author: +# 2008-06-06 mleich Create this this variant for the embedded server. +# + +if (`SELECT VERSION() NOT LIKE '%embedded%'`) +{ + --skip Test requires: embedded server +} +--source suite/funcs_1/datadict/is_triggers.inc diff --git a/mysql-test/suite/funcs_1/t/is_user_privileges.test b/mysql-test/suite/funcs_1/t/is_user_privileges.test index dc39ad6fe4f..1d0d3e51aae 100644 --- a/mysql-test/suite/funcs_1/t/is_user_privileges.test +++ b/mysql-test/suite/funcs_1/t/is_user_privileges.test @@ -16,7 +16,9 @@ # Create this script based on older scripts and new code. # -# --source suite/funcs_1/datadict/datadict.pre +# This test cannot be used for the embedded server because we check here +# privileges. +--source include/not_embedded.inc let $engine_type = MEMORY; let $other_engine_type = MyISAM; diff --git a/mysql-test/suite/funcs_1/t/is_views.test b/mysql-test/suite/funcs_1/t/is_views.test index 9819fe1ffe0..b8c9c114e5f 100644 --- a/mysql-test/suite/funcs_1/t/is_views.test +++ b/mysql-test/suite/funcs_1/t/is_views.test @@ -2,13 +2,12 @@ # # Check the layout of information_schema.views and the impact of # CREATE/ALTER/DROP TABLE/VIEW/SCHEMA ... on it. +# Variant for the non embedded server +# The expected results must equal is_views_embedded except that +# that the privilege system works (affects some result sets). # -# 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. +# There is detailed information about this test within +# suite/funcs_1/datadict/is_views.inc # # Author: # 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of @@ -16,290 +15,5 @@ # Create this script based on older scripts and new code. # -# --source suite/funcs_1/datadict/datadict.pre - -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; - +--source include/not_embedded.inc +--source suite/funcs_1/datadict/is_views.inc diff --git a/mysql-test/suite/funcs_1/t/is_views_embedded.test b/mysql-test/suite/funcs_1/t/is_views_embedded.test new file mode 100644 index 00000000000..66b4f59e897 --- /dev/null +++ b/mysql-test/suite/funcs_1/t/is_views_embedded.test @@ -0,0 +1,20 @@ +# suite/funcs_1/t/is_views_embedded.test +# +# Check the layout of information_schema.views and the impact of +# CREATE/ALTER/DROP TABLE/VIEW/SCHEMA ... on it. +# Variant for the embedded server +# The expected results must equal is_views except that all users +# have all privileges (affects some result sets). +# +# There is detailed information about this test within +# suite/funcs_1/datadict/is_views.inc +# +# Author: +# 2008-06-06 mleich Create this this variant for the embedded server. +# + +if (`SELECT VERSION() NOT LIKE '%embedded%'`) +{ + --skip Test requires: embedded server +} +--source suite/funcs_1/datadict/is_views.inc diff --git a/mysql-test/suite/funcs_1/t/memory_storedproc_02.test b/mysql-test/suite/funcs_1/t/memory_storedproc_02.test index f92657ee665..5b5e0b52932 100644 --- a/mysql-test/suite/funcs_1/t/memory_storedproc_02.test +++ b/mysql-test/suite/funcs_1/t/memory_storedproc_02.test @@ -1,6 +1,6 @@ #### suite/funcs_1/t/memory_storedproc_02.test # - + let $engine_type= memory; - + --source suite/funcs_1/storedproc/storedproc_02.inc diff --git a/mysql-test/suite/funcs_1/t/memory_storedproc_03.test b/mysql-test/suite/funcs_1/t/memory_storedproc_03.test index 8a839b255e1..61a601c8c66 100644 --- a/mysql-test/suite/funcs_1/t/memory_storedproc_03.test +++ b/mysql-test/suite/funcs_1/t/memory_storedproc_03.test @@ -1,6 +1,6 @@ #### suite/funcs_1/t/memory_storedproc_03.test # - + let $engine_type= memory; - + --source suite/funcs_1/storedproc/storedproc_03.inc diff --git a/mysql-test/suite/funcs_1/t/memory_storedproc_06.test b/mysql-test/suite/funcs_1/t/memory_storedproc_06.test index 059528590b9..ac4b1173553 100644 --- a/mysql-test/suite/funcs_1/t/memory_storedproc_06.test +++ b/mysql-test/suite/funcs_1/t/memory_storedproc_06.test @@ -1,6 +1,6 @@ #### suite/funcs_1/t/memory_storedproc_06.test # - + let $engine_type= memory; - + --source suite/funcs_1/storedproc/storedproc_06.inc diff --git a/mysql-test/suite/funcs_1/t/memory_storedproc_07.test b/mysql-test/suite/funcs_1/t/memory_storedproc_07.test index 1d7cee3dbd6..be74d5c9c38 100644 --- a/mysql-test/suite/funcs_1/t/memory_storedproc_07.test +++ b/mysql-test/suite/funcs_1/t/memory_storedproc_07.test @@ -1,6 +1,6 @@ #### suite/funcs_1/t/memory_storedproc_07.test # - + let $engine_type= memory; - + --source suite/funcs_1/storedproc/storedproc_07.inc diff --git a/mysql-test/suite/funcs_1/t/memory_storedproc_08.test b/mysql-test/suite/funcs_1/t/memory_storedproc_08.test index 304be8c477a..d898f288f29 100644 --- a/mysql-test/suite/funcs_1/t/memory_storedproc_08.test +++ b/mysql-test/suite/funcs_1/t/memory_storedproc_08.test @@ -1,6 +1,6 @@ #### suite/funcs_1/t/memory_storedproc_08.test # - + let $engine_type= memory; - + --source suite/funcs_1/storedproc/storedproc_08.inc diff --git a/mysql-test/suite/funcs_1/t/memory_storedproc_10.test b/mysql-test/suite/funcs_1/t/memory_storedproc_10.test index 13fbe99fabf..753e5d0bfc7 100644 --- a/mysql-test/suite/funcs_1/t/memory_storedproc_10.test +++ b/mysql-test/suite/funcs_1/t/memory_storedproc_10.test @@ -1,6 +1,6 @@ #### suite/funcs_1/t/memory_storedproc_10.test # - + let $engine_type= memory; - + --source suite/funcs_1/storedproc/storedproc_10.inc diff --git a/mysql-test/suite/funcs_1/t/memory_trig_0102.test b/mysql-test/suite/funcs_1/t/memory_trig_0102.test index c7b07cedfad..a9e4f1142d0 100644 --- a/mysql-test/suite/funcs_1/t/memory_trig_0102.test +++ b/mysql-test/suite/funcs_1/t/memory_trig_0102.test @@ -1,14 +1,9 @@ -#### suite/funcs_1/t/memory_triggers.test +#### suite/funcs_1/t/memory_trig_0102.test # Memory tables should be used # # Set $engine_type let $engine_type= memory; - -# Create some objects needed in many testcases -USE test; ---source suite/funcs_1/include/memory_tb3.inc +--source suite/funcs_1/include/bug28309_skip.inc --source suite/funcs_1/triggers/triggers_0102.inc -DROP TABLE test.tb3; - diff --git a/mysql-test/suite/funcs_1/t/memory_trig_03.test b/mysql-test/suite/funcs_1/t/memory_trig_03.test index b7205ce15d2..617400679d0 100644 --- a/mysql-test/suite/funcs_1/t/memory_trig_03.test +++ b/mysql-test/suite/funcs_1/t/memory_trig_03.test @@ -1,14 +1,8 @@ -#### suite/funcs_1/t/memory_triggers.test +#### suite/funcs_1/t/memory_trig_03.test # Memory tables should be used # # Set $engine_type let $engine_type= memory; -# Create some objects needed in many testcases -USE test; ---source suite/funcs_1/include/memory_tb3.inc - --source suite/funcs_1/triggers/triggers_03.inc -DROP TABLE test.tb3; - diff --git a/mysql-test/suite/funcs_1/t/memory_trig_0407.test b/mysql-test/suite/funcs_1/t/memory_trig_0407.test index 01b4bc39159..93efe2d0fe8 100644 --- a/mysql-test/suite/funcs_1/t/memory_trig_0407.test +++ b/mysql-test/suite/funcs_1/t/memory_trig_0407.test @@ -1,14 +1,9 @@ -#### suite/funcs_1/t/memory_triggers.test +#### suite/funcs_1/t/memory_trig_0407.test # Memory tables should be used # # Set $engine_type let $engine_type= memory; - -# Create some objects needed in many testcases -USE test; ---source suite/funcs_1/include/memory_tb3.inc +--source suite/funcs_1/include/bug28309_skip.inc --source suite/funcs_1/triggers/triggers_0407.inc -DROP TABLE test.tb3; - diff --git a/mysql-test/suite/funcs_1/t/memory_trig_08.test b/mysql-test/suite/funcs_1/t/memory_trig_08.test index bc09d4f3943..05c09312575 100644 --- a/mysql-test/suite/funcs_1/t/memory_trig_08.test +++ b/mysql-test/suite/funcs_1/t/memory_trig_08.test @@ -1,14 +1,8 @@ -#### suite/funcs_1/t/memory_triggers.test +#### suite/funcs_1/t/memory_trig_08.test # Memory tables should be used # # Set $engine_type let $engine_type= memory; -# Create some objects needed in many testcases -USE test; ---source suite/funcs_1/include/memory_tb3.inc - --source suite/funcs_1/triggers/triggers_08.inc -DROP TABLE test.tb3; - diff --git a/mysql-test/suite/funcs_1/t/memory_trig_09.test b/mysql-test/suite/funcs_1/t/memory_trig_09.test index 682e07f9fad..9ebced07bee 100644 --- a/mysql-test/suite/funcs_1/t/memory_trig_09.test +++ b/mysql-test/suite/funcs_1/t/memory_trig_09.test @@ -1,14 +1,8 @@ -#### suite/funcs_1/t/memory_triggers.test +#### suite/funcs_1/t/memory_trig_09.test # Memory tables should be used # # Set $engine_type let $engine_type= memory; -# Create some objects needed in many testcases -USE test; ---source suite/funcs_1/include/memory_tb3.inc - --source suite/funcs_1/triggers/triggers_09.inc -DROP TABLE test.tb3; - diff --git a/mysql-test/suite/funcs_1/t/memory_trig_1011ext.test b/mysql-test/suite/funcs_1/t/memory_trig_1011ext.test index c6dfe54b64d..339a5a9cd9a 100644 --- a/mysql-test/suite/funcs_1/t/memory_trig_1011ext.test +++ b/mysql-test/suite/funcs_1/t/memory_trig_1011ext.test @@ -1,14 +1,9 @@ -#### suite/funcs_1/t/memory_triggers.test +#### suite/funcs_1/t/memory_trig_1011ext.test # Memory tables should be used # # Set $engine_type let $engine_type= memory; - -# Create some objects needed in many testcases -USE test; ---source suite/funcs_1/include/memory_tb3.inc +--source suite/funcs_1/include/bug28309_skip.inc --source suite/funcs_1/triggers/triggers_1011ext.inc -DROP TABLE test.tb3; - diff --git a/mysql-test/suite/funcs_1/t/memory_views.test b/mysql-test/suite/funcs_1/t/memory_views.test index b506f08cf31..9bf9af11dfa 100644 --- a/mysql-test/suite/funcs_1/t/memory_views.test +++ b/mysql-test/suite/funcs_1/t/memory_views.test @@ -4,6 +4,7 @@ # # Set $engine_type let $engine_type= memory; +--source suite/funcs_1/include/bug28309_skip.inc # Create some objects needed in many testcases USE test; diff --git a/mysql-test/suite/funcs_1/t/myisam_storedproc_02.test b/mysql-test/suite/funcs_1/t/myisam_storedproc_02.test index 108b0fe5611..be3e0e9685f 100644 --- a/mysql-test/suite/funcs_1/t/myisam_storedproc_02.test +++ b/mysql-test/suite/funcs_1/t/myisam_storedproc_02.test @@ -1,6 +1,6 @@ #### suite/funcs_1/t/myisam_storedproc_02.test # - + let $engine_type= myisam; - + --source suite/funcs_1/storedproc/storedproc_02.inc diff --git a/mysql-test/suite/funcs_1/t/myisam_storedproc_03.test b/mysql-test/suite/funcs_1/t/myisam_storedproc_03.test index b181e3ce7ab..740db774552 100644 --- a/mysql-test/suite/funcs_1/t/myisam_storedproc_03.test +++ b/mysql-test/suite/funcs_1/t/myisam_storedproc_03.test @@ -1,6 +1,6 @@ #### suite/funcs_1/t/myisam_storedproc_03.test # - + let $engine_type= myisam; - + --source suite/funcs_1/storedproc/storedproc_03.inc diff --git a/mysql-test/suite/funcs_1/t/myisam_storedproc_06.test b/mysql-test/suite/funcs_1/t/myisam_storedproc_06.test index 81d3d24a01f..1038a40b57d 100644 --- a/mysql-test/suite/funcs_1/t/myisam_storedproc_06.test +++ b/mysql-test/suite/funcs_1/t/myisam_storedproc_06.test @@ -1,6 +1,6 @@ #### suite/funcs_1/t/myisam_storedproc_06.test # - + let $engine_type= myisam; - + --source suite/funcs_1/storedproc/storedproc_06.inc diff --git a/mysql-test/suite/funcs_1/t/myisam_storedproc_07.test b/mysql-test/suite/funcs_1/t/myisam_storedproc_07.test index a02f2f544ee..674c3ef3fb6 100644 --- a/mysql-test/suite/funcs_1/t/myisam_storedproc_07.test +++ b/mysql-test/suite/funcs_1/t/myisam_storedproc_07.test @@ -1,6 +1,6 @@ #### suite/funcs_1/t/myisam_storedproc_07.test # - + let $engine_type= myisam; - + --source suite/funcs_1/storedproc/storedproc_07.inc diff --git a/mysql-test/suite/funcs_1/t/myisam_storedproc_08.test b/mysql-test/suite/funcs_1/t/myisam_storedproc_08.test index 24e574fa9e2..a27d593bd92 100644 --- a/mysql-test/suite/funcs_1/t/myisam_storedproc_08.test +++ b/mysql-test/suite/funcs_1/t/myisam_storedproc_08.test @@ -1,6 +1,6 @@ #### suite/funcs_1/t/myisam_storedproc_08.test # - + let $engine_type= myisam; - + --source suite/funcs_1/storedproc/storedproc_08.inc diff --git a/mysql-test/suite/funcs_1/t/myisam_storedproc_10.test b/mysql-test/suite/funcs_1/t/myisam_storedproc_10.test index 6b4f6c21b62..bfa83c01a57 100644 --- a/mysql-test/suite/funcs_1/t/myisam_storedproc_10.test +++ b/mysql-test/suite/funcs_1/t/myisam_storedproc_10.test @@ -1,6 +1,6 @@ #### suite/funcs_1/t/myisam_storedproc_10.test # - + let $engine_type= myisam; - + --source suite/funcs_1/storedproc/storedproc_10.inc diff --git a/mysql-test/suite/funcs_1/t/myisam_trig_0102.test b/mysql-test/suite/funcs_1/t/myisam_trig_0102.test index fd326b2f061..473f25da26a 100644 --- a/mysql-test/suite/funcs_1/t/myisam_trig_0102.test +++ b/mysql-test/suite/funcs_1/t/myisam_trig_0102.test @@ -1,14 +1,8 @@ -#### suite/funcs_1/t/myisam_triggers.test +#### suite/funcs_1/t/myisam_trig_0102.test # MyISAM tables should be used # # Set $engine_type let $engine_type= myisam; -# Create some objects needed in many testcases -USE test; ---source suite/funcs_1/include/myisam_tb3.inc - --source suite/funcs_1/triggers/triggers_0102.inc -DROP TABLE test.tb3; - diff --git a/mysql-test/suite/funcs_1/t/myisam_trig_03.test b/mysql-test/suite/funcs_1/t/myisam_trig_03.test index 77b2d16a2a6..66087725597 100644 --- a/mysql-test/suite/funcs_1/t/myisam_trig_03.test +++ b/mysql-test/suite/funcs_1/t/myisam_trig_03.test @@ -1,14 +1,8 @@ -#### suite/funcs_1/t/myisam_triggers.test +#### suite/funcs_1/t/myisam_trig_03.test # MyISAM tables should be used # # Set $engine_type let $engine_type= myisam; -# Create some objects needed in many testcases -USE test; ---source suite/funcs_1/include/myisam_tb3.inc - --source suite/funcs_1/triggers/triggers_03.inc -DROP TABLE test.tb3; - diff --git a/mysql-test/suite/funcs_1/t/myisam_trig_0407.test b/mysql-test/suite/funcs_1/t/myisam_trig_0407.test index e1e9b6fd230..334bf764191 100644 --- a/mysql-test/suite/funcs_1/t/myisam_trig_0407.test +++ b/mysql-test/suite/funcs_1/t/myisam_trig_0407.test @@ -1,14 +1,8 @@ -#### suite/funcs_1/t/myisam_triggers.test +#### suite/funcs_1/t/myisam_trig_0407.test # MyISAM tables should be used # # Set $engine_type let $engine_type= myisam; -# Create some objects needed in many testcases -USE test; ---source suite/funcs_1/include/myisam_tb3.inc - --source suite/funcs_1/triggers/triggers_0407.inc -DROP TABLE test.tb3; - diff --git a/mysql-test/suite/funcs_1/t/myisam_trig_08.test b/mysql-test/suite/funcs_1/t/myisam_trig_08.test index 225d994a732..af040e228e2 100644 --- a/mysql-test/suite/funcs_1/t/myisam_trig_08.test +++ b/mysql-test/suite/funcs_1/t/myisam_trig_08.test @@ -1,14 +1,8 @@ -#### suite/funcs_1/t/myisam_triggers.test +#### suite/funcs_1/t/myisam_trig_08.test # MyISAM tables should be used # # Set $engine_type let $engine_type= myisam; -# Create some objects needed in many testcases -USE test; ---source suite/funcs_1/include/myisam_tb3.inc - --source suite/funcs_1/triggers/triggers_08.inc -DROP TABLE test.tb3; - diff --git a/mysql-test/suite/funcs_1/t/myisam_trig_09.test b/mysql-test/suite/funcs_1/t/myisam_trig_09.test index f5c53f48adb..9add2cda204 100644 --- a/mysql-test/suite/funcs_1/t/myisam_trig_09.test +++ b/mysql-test/suite/funcs_1/t/myisam_trig_09.test @@ -1,14 +1,8 @@ -#### suite/funcs_1/t/myisam_triggers.test +#### suite/funcs_1/t/myisam_trig_09.test # MyISAM tables should be used # # Set $engine_type let $engine_type= myisam; -# Create some objects needed in many testcases -USE test; ---source suite/funcs_1/include/myisam_tb3.inc - --source suite/funcs_1/triggers/triggers_09.inc -DROP TABLE test.tb3; - diff --git a/mysql-test/suite/funcs_1/t/myisam_trig_1011ext.test b/mysql-test/suite/funcs_1/t/myisam_trig_1011ext.test index e7e36c39706..44ba5cefee2 100644 --- a/mysql-test/suite/funcs_1/t/myisam_trig_1011ext.test +++ b/mysql-test/suite/funcs_1/t/myisam_trig_1011ext.test @@ -1,14 +1,8 @@ -#### suite/funcs_1/t/myisam_triggers.test +#### suite/funcs_1/t/myisam_trig_1011ext.test # MyISAM tables should be used # # Set $engine_type let $engine_type= myisam; -# Create some objects needed in many testcases -USE test; ---source suite/funcs_1/include/myisam_tb3.inc - --source suite/funcs_1/triggers/triggers_1011ext.inc -DROP TABLE test.tb3; - diff --git a/mysql-test/suite/funcs_1/t/ndb_trig_0102.test b/mysql-test/suite/funcs_1/t/ndb_trig_0102.test new file mode 100644 index 00000000000..dd239ff5edb --- /dev/null +++ b/mysql-test/suite/funcs_1/t/ndb_trig_0102.test @@ -0,0 +1,10 @@ +#### suite/funcs_1/t/ndb_trig_0102.test + +# NDB tables should be used +# +# 1. Check if NDB is available +--source include/have_ndb.inc +# 2. Set $engine_type +let $engine_type= ndbcluster; + +--source suite/funcs_1/triggers/triggers_0102.inc diff --git a/mysql-test/suite/funcs_1/t/ndb_trig_03.test b/mysql-test/suite/funcs_1/t/ndb_trig_03.test new file mode 100644 index 00000000000..1f68bd05a80 --- /dev/null +++ b/mysql-test/suite/funcs_1/t/ndb_trig_03.test @@ -0,0 +1,10 @@ +#### suite/funcs_1/t/ndb_trig_03.test + +# NDB tables should be used +# +# 1. Check if NDB is available +--source include/have_ndb.inc +# 2. Set $engine_type +let $engine_type= ndbcluster; + +--source suite/funcs_1/triggers/triggers_03.inc diff --git a/mysql-test/suite/funcs_1/t/ndb_trig_0407.test b/mysql-test/suite/funcs_1/t/ndb_trig_0407.test new file mode 100644 index 00000000000..eccefd12dd9 --- /dev/null +++ b/mysql-test/suite/funcs_1/t/ndb_trig_0407.test @@ -0,0 +1,10 @@ +#### suite/funcs_1/t/ndb_trig_0407.test + +# NDB tables should be used +# +# 1. Check if NDB is available +--source include/have_ndb.inc +# 2. Set $engine_type +let $engine_type= ndbcluster; + +--source suite/funcs_1/triggers/triggers_0407.inc diff --git a/mysql-test/suite/funcs_1/t/ndb_trig_08.test b/mysql-test/suite/funcs_1/t/ndb_trig_08.test new file mode 100644 index 00000000000..e07c4fe7ec4 --- /dev/null +++ b/mysql-test/suite/funcs_1/t/ndb_trig_08.test @@ -0,0 +1,10 @@ +#### suite/funcs_1/t/ndb_trig_08.test + +# NDB tables should be used +# +# 1. Check if NDB is available +--source include/have_ndb.inc +# 2. Set $engine_type +let $engine_type= ndbcluster; + +--source suite/funcs_1/triggers/triggers_08.inc diff --git a/mysql-test/suite/funcs_1/t/ndb_trig_09.test b/mysql-test/suite/funcs_1/t/ndb_trig_09.test new file mode 100644 index 00000000000..8def1d9eea1 --- /dev/null +++ b/mysql-test/suite/funcs_1/t/ndb_trig_09.test @@ -0,0 +1,10 @@ +#### suite/funcs_1/t/ndb_trig_09.test + +# NDB tables should be used +# +# 1. Check if NDB is available +--source include/have_ndb.inc +# 2. Set $engine_type +let $engine_type= ndbcluster; + +--source suite/funcs_1/triggers/triggers_09.inc diff --git a/mysql-test/suite/funcs_1/t/ndb_trig_1011ext.test b/mysql-test/suite/funcs_1/t/ndb_trig_1011ext.test new file mode 100644 index 00000000000..729d5fee60b --- /dev/null +++ b/mysql-test/suite/funcs_1/t/ndb_trig_1011ext.test @@ -0,0 +1,10 @@ +#### suite/funcs_1/t/ndb_trig_1011ext.test + +# NDB tables should be used +# +# 1. Check if NDB is available +--source include/have_ndb.inc +# 2. Set $engine_type +let $engine_type= ndbcluster; + +--source suite/funcs_1/triggers/triggers_1011ext.inc diff --git a/mysql-test/suite/funcs_1/triggers/trig_frkey.inc b/mysql-test/suite/funcs_1/triggers/trig_frkey.inc index 5d6b6a72b1e..5aba368f531 100644 --- a/mysql-test/suite/funcs_1/triggers/trig_frkey.inc +++ b/mysql-test/suite/funcs_1/triggers/trig_frkey.inc @@ -1,50 +1,59 @@ ################################################################# -# This file inclde tests that address the foreign key cases of +# This file include tests that address the foreign key cases of # the following requirements since they are specific to innodb. # Other test cases for these requirements are included in the -# triggers_master.test file. +# triggers_*.inc files. ################################################################# --disable_abort_on_error -#Section x.x.x.1 +# Section x.x.x.1 # Test case: Verifing that a trigger that activates a primary key results in # the primary key acting correctly on the foreign key let $message= Testcase x.x.x.1:; --source include/show_msg.inc - --disable_warnings - DROP TABLE IF EXISTS t0, t1, t2; - --enable_warnings - - eval CREATE TABLE t0 (col1 char(50)) ENGINE=$engine_type; - eval CREATE TABLE t1 (id INT NOT NULL, col1 char(50), - PRIMARY KEY (id)) ENGINE=$engine_type; - eval 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=$engine_type; - - 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; -lock tables t0 write, t1 write; - insert into t0 values ('Department B'); -unlock tables; - select * from t2; +--disable_warnings +DROP TABLE IF EXISTS t0, t1, t2; +--enable_warnings + +--replace_result $engine_type <engine_to_be_tested> +eval +CREATE TABLE t0 (col1 CHAR(50)) +ENGINE = $engine_type; +--replace_result $engine_type <engine_to_be_tested> +eval +CREATE TABLE t1 (id INT NOT NULL, col1 CHAR(50), PRIMARY KEY (id)) +ENGINE = $engine_type; +--replace_result $engine_type <engine_to_be_tested> +eval +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 = $engine_type; + +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; + +--sorted_result +SELECT * FROM t2; +LOCK TABLES t0 WRITE, t1 WRITE; +INSERT INTO t0 VALUES ('Department B'); +UNLOCK TABLES; +--sorted_result +SELECT * FROM t2; # Cleanup - drop trigger trig; - drop table t2, t1; +DROP TRIGGER trig; +DROP TABLE t2, t1; #Section x.x.x.2 @@ -53,41 +62,47 @@ unlock tables; let $message= Testcase x.x.x.2:; --source include/show_msg.inc - --disable_warnings - DROP TABLE IF EXISTS t1, t2; - --enable_warnings - - eval CREATE TABLE t1 (id INT NOT NULL, col1 char(50), - PRIMARY KEY (id)) ENGINE=$engine_type; - eval 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=$engine_type; - - 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'); - - --error 1452 - insert into t2 values (3,4,'Emp 3'); - - 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; - select * from t2; +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +--enable_warnings + +--replace_result $engine_type <engine_to_be_tested> +eval +CREATE TABLE t1 (id INT NOT NULL, col1 CHAR(50), PRIMARY KEY (id)) +ENGINE = $engine_type; +--replace_result $engine_type <engine_to_be_tested> +eval +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 = $engine_type; + +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'); + +--error ER_NO_REFERENCED_ROW_2 +insert into t2 VALUES (3,4,'Emp 3'); + +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; + +--sorted_result +SELECT * FROM t1; +--sorted_result +SELECT * FROM t2; # Cleanup - drop trigger tr_t2; - drop table t2, t1, t0; - +DROP TRIGGER tr_t2; +DROP TABLE t2, t1, t0; -let $message= Foreign Key tests disabled (bug 11472 - stored in trig_frkey2.test); ---source include/show_msg.inc +--echo +--echo Foreign Key tests disabled (bug 11472 - stored in trig_frkey2.test) +--echo ------------------------------------------------------------------- diff --git a/mysql-test/suite/funcs_1/triggers/trig_frkey2.inc b/mysql-test/suite/funcs_1/triggers/trig_frkey2.inc index 51cc2a81d18..c3de88a28f7 100644 --- a/mysql-test/suite/funcs_1/triggers/trig_frkey2.inc +++ b/mysql-test/suite/funcs_1/triggers/trig_frkey2.inc @@ -1,17 +1,17 @@ ################################################################# -# This file inclde tests that address the foreign key cases of -# the following requirements since they are specific to innodb. -# Other test cases for these requirements are included in the +# This file inclde tests that address the foreign key cases of +# the following requirements since they are specific to innodb. +# Other test cases for these requirements are included in the # triggers_master.test file. ################################################################# --disable_abort_on_error # OBN - The following tests are disabled until triggers are supported with forign -# keys in innodb (foreign keys tests dispabled - bug 11472) +# keys in innodb (foreign keys tests dispabled - bug 11472) ################################################################################# #Section x.x.x.3 -# Test case: Similar to 3.5.10.5 but with ten tables to see if multiple triggers +# Test case: Similar to 3.5.10.5 but with ten tables to see if multiple triggers # can be executed at once let $message= Testcase x.x.x.3:; --source include/show_msg.inc @@ -21,58 +21,58 @@ let $message= Testcase x.x.x.3:; --enable_warnings eval CREATE TABLE t0 (col1 char(50)) ENGINE=$engine_type; - eval CREATE TABLE t1 (id INT NOT NULL, col1 char(50), + eval CREATE TABLE t1 (id INT NOT NULL, col1 char(50), PRIMARY KEY (id)) ENGINE=$engine_type; - eval 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) + eval 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=$engine_type; - eval CREATE TABLE t3 (id INT PRIMARY KEY, f_id INT, INDEX par_ind - (f_id), col1 char(50), FOREIGN KEY (f_id) REFERENCES t1(id) + eval CREATE TABLE t3 (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 ON UPDATE CASCADE) ENGINE=$engine_type; - eval CREATE TABLE t4 (id INT PRIMARY KEY, f_id INT, INDEX par_ind - (f_id), col1 char(50), FOREIGN KEY (f_id) REFERENCES t1(id) + eval CREATE TABLE t4 (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 ON UPDATE CASCADE) ENGINE=$engine_type; - eval CREATE TABLE t5 (id INT PRIMARY KEY, f_id INT, INDEX par_ind - (f_id), col1 char(50), FOREIGN KEY (f_id) REFERENCES t1(id) + eval CREATE TABLE t5 (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 ON UPDATE CASCADE) ENGINE=$engine_type; - eval CREATE TABLE t6 (id INT PRIMARY KEY, f_id INT, INDEX par_ind - (f_id), col1 char(50), FOREIGN KEY (f_id) REFERENCES t1(id) + eval CREATE TABLE t6 (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 ON UPDATE CASCADE) ENGINE=$engine_type; - eval CREATE TABLE t7 (id INT PRIMARY KEY, f_id INT, INDEX par_ind - (f_id), col1 char(50), FOREIGN KEY (f_id) REFERENCES t1(id) + eval CREATE TABLE t7 (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 ON UPDATE CASCADE) ENGINE=$engine_type; - eval CREATE TABLE t8 (id INT PRIMARY KEY, f_id INT, INDEX par_ind - (f_id), col1 char(50), FOREIGN KEY (f_id) REFERENCES t1(id) + eval CREATE TABLE t8 (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 ON UPDATE CASCADE) ENGINE=$engine_type; - eval CREATE TABLE t9 (id INT PRIMARY KEY, f_id INT, INDEX par_ind - (f_id), col1 char(50), FOREIGN KEY (f_id) REFERENCES t1(id) + eval CREATE TABLE t9 (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 ON UPDATE CASCADE) ENGINE=$engine_type; - eval CREATE TABLE t10(id INT PRIMARY KEY, f_id INT, INDEX par_ind - (f_id), col1 char(50), FOREIGN KEY (f_id) REFERENCES t1(id) + eval CREATE TABLE t10(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 ON UPDATE CASCADE) ENGINE=$engine_type; - eval CREATE TABLE t11(id INT PRIMARY KEY, f_id INT, INDEX par_ind - (f_id), col1 char(50), FOREIGN KEY (f_id) REFERENCES t1(id) + eval CREATE TABLE t11(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 ON UPDATE CASCADE) ENGINE=$engine_type; - create trigger tr1 after update on t2 for each row + create trigger tr1 after update on t2 for each row insert into t0 values ('tr_t2'); - create trigger tr2 after update on t3 for each row + create trigger tr2 after update on t3 for each row insert into t0 values ('tr_t3'); - create trigger tr3 after update on t4 for each row + create trigger tr3 after update on t4 for each row insert into t0 values ('tr_t4'); - create trigger tr3 after update on t5 for each row + create trigger tr3 after update on t5 for each row insert into t0 values ('tr_t5'); - create trigger tr4 after update on t6 for each row + create trigger tr4 after update on t6 for each row insert into t0 values ('tr_t6'); - create trigger tr5 after update on t7 for each row + create trigger tr5 after update on t7 for each row insert into t0 values ('tr_t7'); - create trigger tr5 after update on t8 for each row + create trigger tr5 after update on t8 for each row insert into t0 values ('tr_t8'); - create trigger tr6 after update on t9 for each row + create trigger tr6 after update on t9 for each row insert into t0 values ('tr_t9'); - create trigger tr7 after update on t10 for each row + create trigger tr7 after update on t10 for each row insert into t0 values ('tr_t10'); - create trigger tr8 after update on t11 for each row + create trigger tr8 after update on t11 for each row insert into t0 values ('tr_t11'); insert into t1 values (1,'Department A'); @@ -134,10 +134,10 @@ let $message= Testcase x.x.x.3:; #Section 3.5.10.5 -# Test case: Ensure that every trigger that should be activated by every possible -# type of implicit update of its subject table (e.g. a FOREIGN KEY SET -# DEFAULT action or an UPDATE of a view based on the subject table) -# is indeed activated correctly. +# Test case: Ensure that every trigger that should be activated by every possible +# type of implicit update of its subject table (e.g. a FOREIGN KEY SET +# DEFAULT action or an UPDATE of a view based on the subject table) +# is indeed activated correctly. let $message= Testcase 3.5.10.5 (foreign keys):; --source include/show_msg.inc @@ -146,11 +146,11 @@ let $message= Testcase 3.5.10.5 (foreign keys):; DROP TABLE IF EXISTS t1, t2; --enable_warnings - eval CREATE TABLE t1 (id INT NOT NULL, col1 char(50), + eval CREATE TABLE t1 (id INT NOT NULL, col1 char(50), PRIMARY KEY (id)) ENGINE=$engine_type; - eval 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) + eval 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 ON UPDATE CASCADE) ENGINE=$engine_type; create trigger tr_t2 after update on t2 for each row set @counter=@counter+1; @@ -191,9 +191,9 @@ let $message= Testcase 3.5.10.5 (foreign keys):; #Section 3.5.10.6 -# Test case: Ensure that every trigger that should be activated by every possible -# type of implicit deletion from its subject table (e.g. a FOREIGN KEY -# CASCADE action or a DELETE from a view based on the subject table) +# Test case: Ensure that every trigger that should be activated by every possible +# type of implicit deletion from its subject table (e.g. a FOREIGN KEY +# CASCADE action or a DELETE from a view based on the subject table) # is indeed activated correctly. let $message= Testcase 3.5.10.6 (foreign keys):; --source include/show_msg.inc @@ -202,11 +202,11 @@ let $message= Testcase 3.5.10.6 (foreign keys):; DROP TABLE IF EXISTS t1, t2; --enable_warnings - eval CREATE TABLE t1 (id INT NOT NULL, col1 char(50), + eval CREATE TABLE t1 (id INT NOT NULL, col1 char(50), PRIMARY KEY (id)) ENGINE=$engine_type; - eval 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) + eval 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 CASCADE) ENGINE=$engine_type; create trigger tr_t2 before delete on t2 diff --git a/mysql-test/suite/funcs_1/triggers/triggers_0102.inc b/mysql-test/suite/funcs_1/triggers/triggers_0102.inc index b11455c07d3..dced2f2f42c 100644 --- a/mysql-test/suite/funcs_1/triggers/triggers_0102.inc +++ b/mysql-test/suite/funcs_1/triggers/triggers_0102.inc @@ -1,9 +1,12 @@ #====================================================================== # -# Trigger Tests -# (test case numbering refer to requirement document TP v1.1) +# Trigger Tests +# (test case numbering refer to requirement document TP v1.1) #====================================================================== +USE test; +--source suite/funcs_1/include/tb3.inc + # OBM - ToDo ############ # 1. Performace @@ -20,38 +23,39 @@ # Testcase: Ensure that all clauses that should be supported are supported. let $message= Testcase: 3.5.1.1:; --source include/show_msg.inc -# OBN - This test case tests basic trigger definition and execution +# OBN - This test case tests basic trigger definition and execution # of INSERT/UPDATE/DELETE actions and BEFORE/AFTER timings. -# As such it covers the equirements in sections 3.5.6.1, 3.5.6.2, +# As such it covers the equirements in sections 3.5.6.1, 3.5.6.2, # 3.5.6.4, 3.5.6.5, 3.5.7.1, 3.5.7.2, 3.5.7.3, 3.5.7.17 below. -# - Note currently as a result of limitations with locking tables in +# - Note currently as a result of limitations with locking tables in # triggers, a specifc lockingof the tables is done. # Once fixed, the locking and alias referances should be removed use test; # Trigger Definition - Create trigger trg1_1 BEFORE INSERT + Create trigger trg1_1 BEFORE INSERT on tb3 for each row set @test_before = 2, new.f142 = @test_before; - Create trigger trg1_2 AFTER INSERT + Create trigger trg1_2 AFTER INSERT on tb3 for each row set @test_after = 6; - Create trigger trg1_4 BEFORE UPDATE - on tb3 for each row set @test_before = 27, - new.f142 = @test_before, + Create trigger trg1_4 BEFORE UPDATE + on tb3 for each row set @test_before = 27, + new.f142 = @test_before, new.f122 = 'Before Update Trigger'; - Create trigger trg1_3 AFTER UPDATE + Create trigger trg1_3 AFTER UPDATE on tb3 for each row set @test_after = '15'; - Create trigger trg1_5 BEFORE DELETE on tb3 for each row - select count(*) into @test_before from tb3 as tr_tb3 + Create trigger trg1_5 BEFORE DELETE on tb3 for each row + select count(*) into @test_before from tb3 as tr_tb3 where f121 = 'Test 3.5.1.1'; - Create trigger trg1_6 AFTER DELETE on tb3 for each row - select count(*) into @test_after from tb3 as tr_tb3 + Create trigger trg1_6 AFTER DELETE on tb3 for each row + select count(*) into @test_after from tb3 as tr_tb3 where f121 = 'Test 3.5.1.1'; # Trigger Execution Insert (before and after) set @test_before = 1; set @test_after = 5; select @test_before, @test_after; - Insert into tb3 (f121, f122, f142, f144, f134) + Insert into tb3 (f121, f122, f142, f144, f134) values ('Test 3.5.1.1', 'First Row', @test_before, @test_after, 1); + --sorted_result select f121, f122, f142, f144, f134 from tb3 where f121 = 'Test 3.5.1.1'; select @test_before, @test_after; @@ -59,55 +63,58 @@ use test; set @test_before = 18; set @test_after = 8; select @test_before, @test_after; - Update tb3 set tb3.f122 = 'Update', - tb3.f142 = @test_before, - tb3.f144 = @test_after + Update tb3 set tb3.f122 = 'Update', + tb3.f142 = @test_before, + tb3.f144 = @test_after where tb3.f121 = 'Test 3.5.1.1'; + --sorted_result select f121, f122, f142, f144, f134 from tb3 where f121 = 'Test 3.5.1.1'; select @test_before, @test_after; # Trigger Execution Delete (before and after) - Insert into tb3 (f121, f122, f142, f144, f134) + Insert into tb3 (f121, f122, f142, f144, f134) values ('Test 3.5.1.1', 'Second Row', 5, 6, 2); set @test_before = 0; set @test_after = 0; + --sorted_result select f121, f122, f142, f144, f134 from tb3 where f121 = 'Test 3.5.1.1'; select @test_before, @test_after; Delete from tb3 where f121 = 'Test 3.5.1.1' and f134 = 2; + --sorted_result select f121, f122, f142, f144, f134 from tb3 where f121 = 'Test 3.5.1.1'; select @test_before, @test_after; #Cleanup --disable_warnings - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg1_1; - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg1_2; - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg1_3; - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg1_4; - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg1_5; - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg1_6; --enable_warnings delete from tb3 where f121='Test 3.5.1.1'; --enable_warnings #Section 3.5.1.2 -# Testcase: Ensure that all clauses that should not be supported are disallowed -# with an appropriate error message. +# Testcase: Ensure that all clauses that should not be supported are disallowed +# with an appropriate error message. let $message= Testcase: 3.5.1.2:; --source include/show_msg.inc - --error 1064 - Create trigger trg_1 after insert + --error ER_PARSE_ERROR + Create trigger trg_1 after insert on tb3 for each statement set @x= 1; -#Cleanup - --disable_warnings - --error 0, 1360 +#Cleanup + --disable_warnings + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg_1; --enable_warnings @@ -116,66 +123,66 @@ let $message= Testcase: 3.5.1.2:; # Testcase: Ensure that all supported clauses are supported only in the correct order. let $message= Testcase 3.5.1.3:; --source include/show_msg.inc - --error 1064 + --error ER_PARSE_ERROR CREATE TRIGGER trg3_1 on tb3 BEFORE INSERT for each row set new.f120 = 't'; - --error 1064 + --error ER_PARSE_ERROR CREATE trg3_2 TRIGGER AFTER INSERT on tb3 for each row set new.f120 = 's'; - --error 1064 + --error ER_PARSE_ERROR CREATE TRIGGER trg3_3 Before DELETE on tb3 set @ret1 = 'test' for each row; - --error 1064 + --error ER_PARSE_ERROR CREATE TRIGGER trg3_4 DELETE AFTER on tb3 set @ret1 = 'test' for each row; - --error 1064 - CREATE for each row TRIGGER trg3_5 AFTER UPDATE on tb3 set @ret1 = 'test'; + --error ER_PARSE_ERROR + CREATE for each row TRIGGER trg3_5 AFTER UPDATE on tb3 set @ret1 = 'test'; #Cleanup # OBN - Although none of the above should have been created we should do a cleanup # since if they have been created, not dropping them will affect following # tests. --disable_warnings - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg3_1; - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg3_2; - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg3_3; - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg3_4; - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg3_5; --enable_warnings #Section 3.5.1.4 -# Testcase: Ensure that an appropriate error message is returned if a clause +# Testcase: Ensure that an appropriate error message is returned if a clause # is out-of-order in an SQL statement. # OBN - FIXME - Missing 3.5.1.4 need to add #Section 3.5.1.5 -# Testcase: Ensure that all clauses that are defined to be mandatory are indeed +# Testcase: Ensure that all clauses that are defined to be mandatory are indeed # required to be mandatory by the MySQL server and tools let $message= Testcase: 3.5.1.5:; --source include/show_msg.inc - --error 1064 + --error ER_PARSE_ERROR CREATE TRIGGER trg4_1 AFTER on tb3 for each row set new.f120 = 'e'; - --error 1064 + --error ER_PARSE_ERROR CREATE TRIGGER trg4_2 INSERT on tb3 for each set row new.f120 = 'f'; - --error 1064 + --error ER_PARSE_ERROR CREATE TRIGGER trg4_3 BEFORE INSERT tb3 for each row set new.f120 = 'g'; - --error 1064 + --error ER_PARSE_ERROR CREATE TRIGGER trg4_4 AFTER UPDATE on tb3 for each set new.f120 = 'g'; - --error 1064 + --error ER_PARSE_ERROR CREATE trg4_5 AFTER DELETE on tb3 for each set new.f120 = 'g'; - --error 1064 + --error ER_PARSE_ERROR CREATE TRIGGER trg4_6 BEFORE DELETE for each row set new.f120 = 'g'; #Cleanup @@ -183,19 +190,19 @@ let $message= Testcase: 3.5.1.5:; # since if they have been created, not dropping them will affect following # tests. --disable_warnings - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg4_1; - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg4_2; - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg4_3; - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg4_4; - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg4_5; - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg4_6; - --enable_warnings + --enable_warnings #Section 3.5.1.6 # Testcase: Ensure that any clauses that are defined to be optional are indeed @@ -204,15 +211,16 @@ let $message= Testcase 3.5.1.6: - Need to fix; --source include/show_msg.inc # OBN - FIXME - Missing 3.5.1.6 need to add -#Section 3.5.1.7 -# Testcase: Ensure that all valid, fully-qualified, and non-qualified, +#Section 3.5.1.7 +# Testcase: Ensure that all valid, fully-qualified, and non-qualified, # trigger names are accepted, at creation time. let $message= Testcase 3.5.1.7: - need to fix; --source include/show_msg.inc drop table if exists t1; - eval create table t1 (f1 int, f2 char(25),f3 int) engine=$engine_type; - CREATE TRIGGER trg5_1 BEFORE INSERT on test.t1 + --replace_result $engine_type <engine_to_be_used> + eval create table t1 (f1 int, f2 char(25),f3 int) engine = $engine_type; + CREATE TRIGGER trg5_1 BEFORE INSERT on test.t1 for each row set new.f3 = '14'; CREATE TRIGGER trg_abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ BEFORE UPDATE on test.t1 for each row set new.f3 = '42'; @@ -221,39 +229,39 @@ let $message= Testcase 3.5.1.7: - need to fix; select * from t1; update t1 set f2='update 3.5.1.7'; select * from t1; - select trigger_name from information_schema.triggers; + select trigger_name from information_schema.triggers order by trigger_name; #Cleanup - --disable_warnings - --error 0, 1360 + --disable_warnings + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg5_1; # The above trigger should be dropped since the name was trimmed. drop trigger trg_abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ; drop table t1; #Section 3.5.1.8 -# Testcase: Ensure that any invalid trigger name is never accepted, and that an +# Testcase: Ensure that any invalid trigger name is never accepted, and that an # appropriate error message is returned when the name is rejected. let $message= Testcase 3.5.1.8:; --source include/show_msg.inc - --error 1064 + --error ER_PARSE_ERROR CREATE TRIGGER trg12* before insert on tb3 for each row set new.f120 = 't'; - --error 1064 + --error ER_PARSE_ERROR CREATE TRIGGER trigger before insert on tb3 for each row set new.f120 = 't'; - --error 1064 + --error ER_PARSE_ERROR CREATE TRIGGER 100 before insert on tb3 for each row set new.f120 = 't'; - --error 1064 + --error ER_PARSE_ERROR CREATE TRIGGER @@view before insert on tb3 for each row set new.f120 = 't'; - --error 1064 + --error ER_PARSE_ERROR CREATE TRIGGER @name before insert on tb3 for each row set new.f120 = 't'; - --error 1435 - CREATE TRIGGER tb3.trg6_1 BEFORE INSERT on test.tb3 + --error ER_TRG_IN_WRONG_SCHEMA + CREATE TRIGGER tb3.trg6_1 BEFORE INSERT on test.tb3 for each row set new.f120 ='X'; --disable_warnings @@ -261,33 +269,34 @@ let $message= Testcase 3.5.1.8:; --enable_warnings create database trig_db; use trig_db; + --replace_result $engine_type <engine_to_be_used> eval create table t1 (f1 integer) engine = $engine_type; # Can't create a trigger in a different database use test; - --error 1146 - CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3 + --error ER_NO_SUCH_TABLE + CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3 for each row set @ret_trg6_2 = 5; # Can't create a trigger refrencing a table in a different db use trig_db; - --error 1435 - CREATE TRIGGER trg6_3 AFTER INSERT on test.tb3 + --error ER_TRG_IN_WRONG_SCHEMA + CREATE TRIGGER trg6_3 AFTER INSERT on test.tb3 for each row set @ret_trg6_3 = 18; use test; #Cleanup - --disable_warnings + --disable_warnings drop database trig_db; # OBN - Although none of the above should have been created we should do a cleanup # since if they have been created, not dropping them will affect following # tests. - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg6_1; - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg6_3; - --enable_warnings + --enable_warnings #Section 3.5.1.9 #Testcase: Ensure that a reference to a non-existent trigger is rejected with @@ -297,41 +306,43 @@ let $message= Testcase 3.5.1.9:(cannot be inplemented at this point); #Section 3.5.1.10 -#Testcase: Ensure that it is not possible to create two triggers with the same name on +#Testcase: Ensure that it is not possible to create two triggers with the same name on # the same table let $message= Testcase 3.5.1.10:; --source include/show_msg.inc CREATE TRIGGER trg7_1 BEFORE UPDATE on tb3 for each row set new.f120 ='X'; - --error 1359 + --error ER_TRG_ALREADY_EXISTS CREATE TRIGGER trg7_1 AFTER INSERT on tb3 for each row set @x ='Y'; #Cleanup - --disable_warnings - --error 0, 1360 + --disable_warnings + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg7_1; --enable_warnings -#Section 3.5.1.? -# Testcase: Ensure that it is not possible to create two or more triggers with +#Section 3.5.1.? +# Testcase: Ensure that it is not possible to create two or more triggers with # the same name, provided each is associated with a different table. let $message= Testcase 3.5.1.?:; --source include/show_msg.inc - --disable_warnings + --disable_warnings drop table if exists t1; drop table if exists t2; --enable_warnings + --replace_result $engine_type <engine_to_be_used> eval create table t1 (f1 char(50), f2 integer) engine = $engine_type; + --replace_result $engine_type <engine_to_be_used> eval create table t2 (f1 char(50), f2 integer) engine = $engine_type; - create trigger trig before insert on t1 + create trigger trig before insert on t1 for each row set new.f1 ='trig t1'; - --error 1359 - create trigger trig before update on t2 + --error ER_TRG_ALREADY_EXISTS + create trigger trig before update on t2 for each row set new.f1 ='trig t2'; insert into t1 value ('insert to t1',1); @@ -343,16 +354,16 @@ let $message= Testcase 3.5.1.?:; select * from t2; #Cleanup - --disable_warnings + --disable_warnings drop table t1; drop table t2; - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trig; --enable_warnings -#Section 3.5.1.11 -# Testcase: Ensure that it is possible to create two or more triggers with +#Section 3.5.1.11 +# Testcase: Ensure that it is possible to create two or more triggers with # the same name, provided each resides in a different database let $message= Testcase 3.5.1.11:; --source include/show_msg.inc @@ -366,16 +377,19 @@ let $message= Testcase 3.5.1.11:; create database trig_db2; create database trig_db3; use trig_db1; + --replace_result $engine_type <engine_to_be_used> eval create table t1 (f1 char(50), f2 integer) engine = $engine_type; - create trigger trig before insert on t1 + create trigger trig before insert on t1 for each row set new.f1 ='trig1', @test_var1='trig1'; use trig_db2; + --replace_result $engine_type <engine_to_be_used> eval create table t2 (f1 char(50), f2 integer) engine = $engine_type; - create trigger trig before insert on t2 + create trigger trig before insert on t2 for each row set new.f1 ='trig2', @test_var2='trig2'; use trig_db3; + --replace_result $engine_type <engine_to_be_used> eval create table t1 (f1 char(50), f2 integer) engine = $engine_type; - create trigger trig before insert on t1 + create trigger trig before insert on t1 for each row set new.f1 ='trig3', @test_var3='trig3'; set @test_var1= '', @test_var2= '', @test_var3= ''; @@ -385,14 +399,14 @@ let $message= Testcase 3.5.1.11:; insert into trig_db2.t2 (f1,f2) values ('insert to db2 t2 from db1',3); insert into trig_db3.t1 (f1,f2) values ('insert to db3 t1 from db1',4); select @test_var1, @test_var2, @test_var3; - select * from t1; + select * from t1 order by f2; select * from trig_db2.t2; select * from trig_db3.t1; - select * from t1; + select * from t1 order by f2; use test; #Cleanup - --disable_warnings + --disable_warnings drop database trig_db1; drop database trig_db2; drop database trig_db3; @@ -403,16 +417,16 @@ let $message= Testcase 3.5.1.11:; # Check for the global nature of Triggers # ########################################### -#Section 3.5.2.1 -# Test case: Ensure that if a trigger created without a qualifying database +#Section 3.5.2.1 +# Test case: Ensure that if a trigger created without a qualifying database # name belongs to the database in use at creation time. -#Section 3.5.2.2 -# Test case: Ensure that if a trigger created with a qualifying database name +#Section 3.5.2.2 +# Test case: Ensure that if a trigger created with a qualifying database name # belongs to the database specified. -#Section 3.5.2.3 -# Test case: Ensure that if a trigger created with a qualifying database name -# does not belong to the database in use at creation time unless -# the qualifying database name identifies the database that is +#Section 3.5.2.3 +# Test case: Ensure that if a trigger created with a qualifying database name +# does not belong to the database in use at creation time unless +# the qualifying database name identifies the database that is # also in use at creation time. let $message= Testcase 3.5.2.1/2/3:; --source include/show_msg.inc @@ -425,16 +439,18 @@ let $message= Testcase 3.5.2.1/2/3:; create database trig_db1; create database trig_db2; use trig_db1; + --replace_result $engine_type <engine_to_be_used> eval create table t1 (f1 char(50), f2 integer) engine = $engine_type; + --replace_result $engine_type <engine_to_be_used> eval create table trig_db2.t1 (f1 char(50), f2 integer) engine = $engine_type; - create trigger trig1_b before insert on t1 + create trigger trig1_b before insert on t1 for each row set @test_var1='trig1_b'; - create trigger trig_db1.trig1_a after insert on t1 + create trigger trig_db1.trig1_a after insert on t1 for each row set @test_var2='trig1_a'; - create trigger trig_db2.trig2 before insert on trig_db2.t1 + create trigger trig_db2.trig2 before insert on trig_db2.t1 for each row set @test_var3='trig2'; select trigger_schema, trigger_name, event_object_table - from information_schema.triggers; + from information_schema.triggers order by trigger_name; set @test_var1= '', @test_var2= '', @test_var3= ''; insert into t1 (f1,f2) values ('insert to db1 t1 from db1',352); @@ -442,6 +458,7 @@ let $message= Testcase 3.5.2.1/2/3:; select @test_var1, @test_var2, @test_var3; #Cleanup - --disable_warnings + --disable_warnings drop database trig_db1; drop database trig_db2; +DROP TABLE test.tb3; diff --git a/mysql-test/suite/funcs_1/triggers/triggers_03.inc b/mysql-test/suite/funcs_1/triggers/triggers_03.inc index 764fccec734..d0bfc5e9c0e 100644 --- a/mysql-test/suite/funcs_1/triggers/triggers_03.inc +++ b/mysql-test/suite/funcs_1/triggers/triggers_03.inc @@ -1,9 +1,17 @@ +#### suite/funcs_1/triggers/triggers_03.inc #====================================================================== # # Trigger Tests # (test case numbering refer to requirement document TP v1.1) #====================================================================== +# This test cannot be used for the embedded server because we check here +# privilgeges. +--source include/not_embedded.inc + +USE test; +--source suite/funcs_1/include/tb3.inc + --disable_abort_on_error ########################################### @@ -20,6 +28,7 @@ let $message= Testcase 3.5.3:; --enable_warnings create database priv_db; use priv_db; + --replace_result $engine_type <engine_to_be_used> eval create table t1 (f1 char(20)) engine= $engine_type; create User test_noprivs@localhost; @@ -63,14 +72,14 @@ let $message= Testcase 3.5.3.2:; select current_user; use priv_db; - --error 1227 + --error ER_SPECIFIC_ACCESS_DENIED_ERROR create trigger trg1_1 before INSERT on t1 for each row set new.f1 = 'trig 3.5.3.2_1-no'; connection default; use priv_db; insert into t1 (f1) values ('insert 3.5.3.2-no'); - select f1 from t1; + select f1 from t1 order by f1; connection yes_privs; select current_user; @@ -83,29 +92,27 @@ let $message= Testcase 3.5.3.2:; select current_user; use priv_db; - # Added following the fix to bug 5861 - --error 1143 + --error ER_COLUMNACCESS_DENIED_ERROR insert into t1 (f1) values ('insert 3.5.3.2-yes'); - select f1 from t1; - grant UPDATE on priv_db.t1 to test_yesprivs@localhost; -let $message= note: once 15166 is fixed a similar case for SELECT needs to be added; ---source include/show_msg.inc + select f1 from t1 order by f1; + + grant UPDATE on priv_db.t1 to test_yesprivs@localhost; + insert into t1 (f1) values ('insert 3.5.3.2-yes'); + select f1 from t1 order by f1; - insert into t1 (f1) values ('insert 3.5.3.2-yes'); - select f1 from t1; let $message= Testcase 3.5.3.6:; --source include/show_msg.inc connection no_privs; use priv_db; - --error 1227 + --error ER_SPECIFIC_ACCESS_DENIED_ERROR drop trigger trg1_2; connection default; use priv_db; insert into t1 (f1) values ('insert 3.5.3.6-yes'); - select f1 from t1; + select f1 from t1 order by f1; connection yes_privs; use priv_db; @@ -115,12 +122,12 @@ let $message= Testcase 3.5.3.6:; connection default; use priv_db; insert into t1 (f1) values ('insert 3.5.3.6-no'); - select f1 from t1; + select f1 from t1 order by f1; # Cleanup --disable_warnings connection default; - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg1_2; disconnect no_privs; disconnect yes_privs; @@ -131,8 +138,6 @@ let $message= Testcase 3.5.3.6:; # Test case: Ensure that use of the construct "SET NEW. <column name> = <value>" # fails at CREATE TRIGGER time, if the current user does not have the # UPDATE privilege on the column specified -# Note: As a result of bug 8884 the triggers are actually created. -# Disabled because of bug 8884 # --- 3.5.3.7a - Privs set on a global level let $message=Testcase 3.5.3.7a:; @@ -156,18 +161,15 @@ let $message=Testcase 3.5.3.7a:; select current_user; use priv_db; show grants; - select f1 from t1; + select f1 from t1 order by f1; -let $message= Trigger create disabled - should fail - Bug 8884; ---source include/show_msg.inc -# --error 1227 -# create trigger trg4a_1 before INSERT on t1 for each row -# set new.f1 = 'trig 3.5.3.7-1a'; + create trigger trg4a_1 before INSERT on t1 for each row + set new.f1 = 'trig 3.5.3.7-1a'; connection default; + --error ER_COLUMNACCESS_DENIED_ERROR insert into t1 (f1) values ('insert 3.5.3.7-1a'); - select f1 from t1; - --error 0, 1360 + select f1 from t1 order by f1; drop trigger trg4a_1; connection yes_privs_424a; @@ -179,14 +181,8 @@ let $message= Trigger create disabled - should fail - Bug 8884; connection default; - - # Added to bypass bug 15166 -let $message= SELECT priv added to bypass bug 15166; ---source include/show_msg.inc - grant SELECT on *.* to test_yesprivs@localhost; - insert into t1 (f1) values ('insert 3.5.3.7-2b'); - select f1 from t1; + select f1 from t1 order by f1; # Cleanup --disable_warnings @@ -220,18 +216,14 @@ let $message= Testcase 3.5.3.7b:; show grants; use priv_db; -let $message= Trigger create disabled - should fail - Bug 8884; ---source include/show_msg.inc -# --error 1227 -# create trigger trg4b_1 before UPDATE on t1 for each row -# set new.f1 = 'trig 3.5.3.7-1b'; + create trigger trg4b_1 before UPDATE on t1 for each row + set new.f1 = 'trig 3.5.3.7-1b'; connection default; insert into t1 (f1) values ('insert 3.5.3.7-1b'); - select f1 from t1; + select f1 from t1 order by f1; update t1 set f1 = 'update 3.5.3.7-1b' where f1 = 'insert 3.5.3.7-1b'; - select f1 from t1; - --error 0, 1360 + select f1 from t1 order by f1; drop trigger trg4b_1; connection yes_privs_424b; @@ -242,15 +234,10 @@ let $message= Trigger create disabled - should fail - Bug 8884; connection default; - # Added to bypass bug 15166 -let $message= SELECT priv added to bypass bug 15166; ---source include/show_msg.inc - grant SELECT on priv_db.* to test_yesprivs@localhost; - insert into t1 (f1) values ('insert 3.5.3.7-2b'); - select f1 from t1; + select f1 from t1 order by f1; update t1 set f1 = 'update 3.5.3.7-2b' where f1 = 'insert 3.5.3.7-2b'; - select f1 from t1; + select f1 from t1 order by f1; # Cleanup --disable_warnings drop trigger trg4b_2; @@ -283,16 +270,12 @@ let $message= Testcase 3.5.3.7c; show grants; use priv_db; -let $message= Trigger create disabled - should fail - Bug 8884; ---source include/show_msg.inc -# --error 1227 -# create trigger trg4c_1 before INSERT on t1 for each row -# set new.f1 = 'trig 3.5.3.7-1c'; + create trigger trg4c_1 before INSERT on t1 for each row + set new.f1 = 'trig 3.5.3.7-1c'; connection default; insert into t1 (f1) values ('insert 3.5.3.7-1c'); - select f1 from t1; - --error 0, 1360 + select f1 from t1 order by f1; drop trigger trg4c_1; connection yes_privs_424c; @@ -303,13 +286,8 @@ let $message= Trigger create disabled - should fail - Bug 8884; connection default; - # Added to bypass bug 15166 -let $message= SELECT priv added to bypass bug 15166; ---source include/show_msg.inc - grant SELECT on priv_db.t1 to test_yesprivs@localhost; - insert into t1 (f1) values ('insert 3.5.3.7-2c'); - select f1 from t1; + select f1 from t1 order by f1; # Cleanup --disable_warnings @@ -344,16 +322,12 @@ let $message= Testcase 3.5.3.7d:; connection no_privs_424d; show grants; use priv_db; -let $message= Trigger create disabled - should fail - Bug 8884; ---source include/show_msg.inc -# --error 1227 -# create trigger trg4d_1 before INSERT on t1 for each row -# set new.f1 = 'trig 3.5.3.7-1d'; + create trigger trg4d_1 before INSERT on t1 for each row + set new.f1 = 'trig 3.5.3.7-1d'; connection default; insert into t1 (f1) values ('insert 3.5.3.7-1d'); - select f1 from t1; - --error 0, 1360 + select f1 from t1 order by f1; drop trigger trg4d_1; connection yes_privs_424d; @@ -364,13 +338,8 @@ let $message= Trigger create disabled - should fail - Bug 8884; connection default; - # Added to bypass bug 15166 -let $message= SELECT priv added to bypass bug 15166; ---source include/show_msg.inc - grant SELECT (f1) on priv_db.t1 to test_yesprivs@localhost; - insert into t1 (f1) values ('insert 3.5.3.7-2d'); - select f1 from t1; + select f1 from t1 order by f1; # Cleanup --disable_warnings @@ -408,18 +377,14 @@ let $message= Testcase 3.5.3.8a:; use priv_db; show grants; -let $message= Trigger create disabled - should fail - Bug 8887; ---source include/show_msg.inc -# --error 1227 -# create trigger trg5a_1 before INSERT on t1 for each row -# set @test_var = new.f1; + create trigger trg5a_1 before INSERT on t1 for each row + set @test_var = new.f1; connection default; set @test_var = 'before trig 3.5.3.8-1a'; select @test_var; insert into t1 (f1) values ('insert 3.5.3.8-1a'); select @test_var; - --error 0, 1360 drop trigger trg5a_1; connection yes_privs_425a; @@ -433,11 +398,6 @@ let $message= Trigger create disabled - should fail - Bug 8887; set @test_var= 'before trig 3.5.3.8-2a'; select @test_var; - # Added to bypass bug 15166 -let $message= UPDATE priv added to bypass bug 15166; ---source include/show_msg.inc - grant UPDATE on *.* to test_yesprivs@localhost; - insert into t1 (f1) values ('insert 3.5.3.8-2a'); select @test_var; @@ -473,11 +433,8 @@ let $message= Testcase: 3.5.3.8b; show grants; use priv_db; -let $message= Trigger create disabled - should fail - Bug 8887; ---source include/show_msg.inc -# --error 1227 -# create trigger trg5b_1 before UPDATE on t1 for each row -# set @test_var= new.f1; + create trigger trg5b_1 before UPDATE on t1 for each row + set @test_var= new.f1; connection default; set @test_var= 'before trig 3.5.3.8-1b'; @@ -485,7 +442,6 @@ let $message= Trigger create disabled - should fail - Bug 8887; select @test_var; update t1 set f1= 'update 3.5.3.8-1b' where f1 = 'insert 3.5.3.8-1b'; select @test_var; - --error 0, 1360 drop trigger trg5b_1; connection yes_privs_425b; @@ -499,11 +455,6 @@ let $message= Trigger create disabled - should fail - Bug 8887; insert into t1 (f1) values ('insert 3.5.3.8-2b'); select @test_var; - # Added to bypass bug 15166 -let $message= UPDATE priv added to bypass bug 15166; ---source include/show_msg.inc - grant UPDATE on priv_db.* to test_yesprivs@localhost; - update t1 set f1= 'update 3.5.3.8-2b' where f1 = 'insert 3.5.3.8-2b'; select @test_var; # Cleanup @@ -538,17 +489,13 @@ let $message= Testcase 3.5.3.8c:; show grants; use priv_db; -let $message= Trigger create disabled - should fail - Bug 8887; ---source include/show_msg.inc -# --error 1227 -# create trigger trg5c_1 before INSERT on t1 for each row -# set @test_var= new.f1; + create trigger trg5c_1 before INSERT on t1 for each row + set @test_var= new.f1; connection default; set @test_var= 'before trig 3.5.3.8-1c'; insert into t1 (f1) values ('insert 3.5.3.8-1c'); select @test_var; - --error 0, 1360 drop trigger trg5c_1; connection yes_privs_425c; @@ -560,11 +507,6 @@ let $message= Trigger create disabled - should fail - Bug 8887; connection default; set @test_var='before trig 3.5.3.8-2c'; - # Added to bypass bug 15166 -let $message= UPDATE priv added to bypass bug 15166; ---source include/show_msg.inc - grant UPDATE on priv_db.t1 to test_yesprivs@localhost; - insert into t1 (f1) values ('insert 3.5.3.8-2c'); select @test_var; # Cleanup @@ -598,17 +540,13 @@ let $message=Testcase: 3.5.3.8d:; connection no_privs_425d; show grants; use priv_db; -let $message= Trigger create disabled - should fail - Bug 8887; ---source include/show_msg.inc -# --error 1227 -# create trigger trg5d_1 before INSERT on t1 for each row -# set @test_var= new.f1; + create trigger trg5d_1 before INSERT on t1 for each row + set @test_var= new.f1; connection default; set @test_var='before trig 3.5.3.8-1d'; insert into t1 (f1) values ('insert 3.5.3.8-1d'); select @test_var; - --error 0, 1360 drop trigger trg5d_1; connection yes_privs_425d; @@ -620,11 +558,6 @@ let $message= Trigger create disabled - should fail - Bug 8887; connection default; set @test_var='before trig 3.5.3.8-2d'; - # Added to bypass bug 15166 -let $message= UPDATE priv added to bypass bug 15166; ---source include/show_msg.inc - grant UPDATE (f1) on priv_db.t1 to test_yesprivs@localhost; - insert into t1 (f1) values ('insert 3.5.3.8-2d'); select @test_var; @@ -633,8 +566,7 @@ let $message= UPDATE priv added to bypass bug 15166; drop trigger trg5d_2; --enable_warnings -# --- 3.5.3.x - additional tests following the fix to bug 5861 / WL 2818 -# to test for trigger definer privs in the case of trigger +# --- 3.5.3.x to test for trigger definer privs in the case of trigger # actions (insert/update/delete/select) performed on other # tables. let $message=Testcase: 3.5.3.x:; @@ -646,7 +578,9 @@ let $message=Testcase: 3.5.3.x:; drop table if exists t2; --enable_warnings + --replace_result $engine_type <engine_to_be_used> eval create table t1 (f1 int) engine= $engine_type; + --replace_result $engine_type <engine_to_be_used> eval create table t2 (f2 int) engine= $engine_type; revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; @@ -671,8 +605,8 @@ let $message=Testcase: 3.5.3.x:; revoke SELECT on priv_db.t2 from test_yesprivs@localhost; grant INSERT on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (4); - select f1 from t1; - select f2 from t2; + select f1 from t1 order by f1; + select f2 from t2 order by f2; connection yes_353x; use priv_db; @@ -687,8 +621,8 @@ let $message=Testcase: 3.5.3.x:; revoke INSERT on priv_db.t2 from test_yesprivs@localhost; grant UPDATE on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (2); - select f1 from t1; - select f2 from t2; + select f1 from t1 order by f1; + select f2 from t2 order by f2; connection yes_353x; use priv_db; @@ -703,8 +637,8 @@ let $message=Testcase: 3.5.3.x:; revoke UPDATE on priv_db.t2 from test_yesprivs@localhost; grant SELECT on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (1); - select f1 from t1; - select f2 from t2; + select f1 from t1 order by f1; + select f2 from t2 order by f2; select @aaa; connection yes_353x; @@ -720,8 +654,8 @@ let $message=Testcase: 3.5.3.x:; revoke SELECT on priv_db.t2 from test_yesprivs@localhost; grant DELETE on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (1); - select f1 from t1; - select f2 from t2; + select f1 from t1 order by f1; + select f2 from t2 order by f2; @@ -733,3 +667,5 @@ let $message=Testcase: 3.5.3.x:; drop user test_noprivs; --enable_warnings +use test; +drop table tb3; diff --git a/mysql-test/suite/funcs_1/triggers/triggers_0407.inc b/mysql-test/suite/funcs_1/triggers/triggers_0407.inc index 15c94ada975..8bacc3944de 100644 --- a/mysql-test/suite/funcs_1/triggers/triggers_0407.inc +++ b/mysql-test/suite/funcs_1/triggers/triggers_0407.inc @@ -1,9 +1,12 @@ #====================================================================== # -# Trigger Tests -# (test case numbering refer to requirement document TP v1.1) +# Trigger Tests +# (test case numbering refer to requirement document TP v1.1) #====================================================================== +USE test; +--source suite/funcs_1/include/tb3.inc + --disable_abort_on_error # General setup for Trigger tests @@ -43,35 +46,36 @@ let $message= Testcase 3.5.4.1:; connection con1_super; create database db_drop; Use db_drop; - eval create table t1 (f1 char(30)) engine=$engine_type; + --replace_result $engine_type <engine_to_be_used> + eval create table t1 (f1 char(30)) engine = $engine_type; grant INSERT, SELECT on db_drop.t1 to test_general; Use db_drop; - Create trigger trg1 BEFORE INSERT on t1 + Create trigger trg1 BEFORE INSERT on t1 for each row set new.f1='Trigger 3.5.4.1'; connection con1_general; Use db_drop; Insert into t1 values ('Insert error 3.5.4.1'); - Select * from t1; + Select * from t1 order by f1; connection con1_super; drop trigger trg1; select trigger_schema, trigger_name, event_object_table - from information_schema.triggers; + from information_schema.triggers order by trigger_name; connection con1_general; Insert into t1 values ('Insert no trigger 3.5.4.1'); - Select * from t1; + Select * from t1 order by f1; #Cleanup - --disable_warnings + --disable_warnings connection con1_super; --disable_warnings - --error 0,1360 - drop trigger trg1; + --error 0,ER_TRG_DOES_NOT_EXIST + drop trigger trg1; drop database if exists db_drop; revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost'; --enable_warnings #Section 3.5.4.2 -# Test case: Ensure that DROP TRIGGER <trigger name> fails, with an appropriate error +# Test case: Ensure that DROP TRIGGER <trigger name> fails, with an appropriate error # message, if the trigger name does not exist. let $message= Testcase 3.5.4.2:; --source include/show_msg.inc @@ -82,17 +86,18 @@ let $message= Testcase 3.5.4.2:; --disable_warnings drop table if exists t1_432 ; --enable_warnings - eval create table t1_432 (f1 char (30)) engine=$engine_type; - --error 1360 + --replace_result $engine_type <engine_to_be_used> + eval create table t1_432 (f1 char (30)) engine = $engine_type; + --error ER_TRG_DOES_NOT_EXIST Drop trigger tr_does_not_exit; -#cleanup +#cleanup --disable_warnings drop table if exists t1_432 ; drop database if exists db_drop2; --enable_warnings #Section 3.5.4.3 -# Test case: Ensure that DROP TRIGGER <trigger name> fails, with an appropriate +# Test case: Ensure that DROP TRIGGER <trigger name> fails, with an appropriate # error message, if <trigger name> is not a qualified name. let $message= Testcase 3.5.4.3:; --source include/show_msg.inc @@ -104,36 +109,38 @@ let $message= Testcase 3.5.4.3:; drop table if exists t1_433 ; drop table if exists t1_433a ; --enable_warnings - eval create table t1_433 (f1 char (30)) engine=$engine_type; - eval create table t1_433a (f1a char (5)) engine=$engine_type; + --replace_result $engine_type <engine_to_be_used> + eval create table t1_433 (f1 char (30)) engine = $engine_type; + --replace_result $engine_type <engine_to_be_used> + eval create table t1_433a (f1a char (5)) engine = $engine_type; - CREATE TRIGGER trg3 BEFORE INSERT on t1_433 for each row + CREATE TRIGGER trg3 BEFORE INSERT on t1_433 for each row set new.f1 = 'Trigger 3.5.4.3'; -# Using table - --error 1064 +# Using table + --error ER_PARSE_ERROR Drop trigger t1.433.trg3; -# Using database.table - --error 1064 +# Using database.table + --error ER_PARSE_ERROR Drop trigger db_drop3.t1.433.trg3; # wrong database - --error 1360 + --error ER_TRG_DOES_NOT_EXIST Drop trigger mysql.trg3; # database does not exist - --error 1360 + --error ER_TRG_DOES_NOT_EXIST Drop trigger tbx.trg3; -#cleanup +#cleanup Drop trigger db_drop3.trg3; drop table if exists t1_433; drop table if exists t1_433a; drop database if exists db_drop3; #Section 3.5.4.4 -# Test case: Ensure that when a database is dropped, all triggers created within +# Test case: Ensure that when a database is dropped, all triggers created within # that database are also cleanly dropped. let $message= Testcase 3.5.4.4:; --source include/show_msg.inc @@ -141,9 +148,10 @@ let $message= Testcase 3.5.4.4:; connection con1_super; create database db_drop4; Use db_drop4; - eval create table t1 (f1 char(30)) engine=$engine_type; + --replace_result $engine_type <engine_to_be_used> + eval create table t1 (f1 char(30)) engine = $engine_type; grant INSERT, SELECT on db_drop4.t1 to test_general; - Create trigger trg4 BEFORE INSERT on t1 + Create trigger trg4 BEFORE INSERT on t1 for each row set new.f1='Trigger 3.5.4.4'; connection con1_general; Use db_drop4; @@ -157,7 +165,8 @@ let $message= Testcase 3.5.4.4:; where information_schema.triggers.trigger_name='trg4'; create database db_drop4; Use db_drop4; - eval create table t1 (f1 char(30)) engine=$engine_type; + --replace_result $engine_type <engine_to_be_used> + eval create table t1 (f1 char(30)) engine = $engine_type; grant INSERT, SELECT on db_drop4.t1 to test_general; connection con1_general; Insert into t1 values ('2nd Insert 3.5.4.4'); @@ -166,14 +175,14 @@ let $message= Testcase 3.5.4.4:; #Cleanup connection con1_super; --disable_warnings - --error 1360 - drop trigger trg4; + --error ER_TRG_DOES_NOT_EXIST + drop trigger trg4; drop database if exists db_drop4; --enable_warnings revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost'; #Section 3.5.4.5 -# Test case: Ensure that when a table is dropped, all triggers for which it is the +# Test case: Ensure that when a table is dropped, all triggers for which it is the # subject table are also cleanly dropped. let $message= Testcase 3.5.4.5:; --source include/show_msg.inc @@ -181,9 +190,10 @@ let $message= Testcase 3.5.4.5:; connection con1_super; create database db_drop5; Use db_drop5; - eval create table t1 (f1 char(50)) engine=$engine_type; + --replace_result $engine_type <engine_to_be_used> + eval create table t1 (f1 char(50)) engine = $engine_type; grant INSERT, SELECT on t1 to test_general; - Create trigger trg5 BEFORE INSERT on t1 + Create trigger trg5 BEFORE INSERT on t1 for each row set new.f1='Trigger 3.5.4.5'; connection con1_general; Use db_drop5; @@ -195,7 +205,8 @@ let $message= Testcase 3.5.4.5:; select trigger_schema, trigger_name, event_object_table from information_schema.triggers where information_schema.triggers.trigger_name='trg5'; - eval create table t1 (f1 char(50)) engine=$engine_type; + --replace_result $engine_type <engine_to_be_used> + eval create table t1 (f1 char(50)) engine = $engine_type; grant INSERT, SELECT on t1 to test_general; connection con1_general; Insert into t1 values ('2nd Insert 3.5.4.5'); @@ -204,8 +215,8 @@ let $message= Testcase 3.5.4.5:; #Cleanup connection con1_super; --disable_warnings - --error 1360 - drop trigger trg5; + --error ER_TRG_DOES_NOT_EXIST + drop trigger trg5; drop database if exists db_drop5; --enable_warnings revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost'; @@ -223,55 +234,55 @@ let $message= Testcase 3.5.5:; use test; #Section 3.5.5.1 -# Test case: Ensure that, if CREATE TRIGGER is executed with a non-existent +# Test case: Ensure that, if CREATE TRIGGER is executed with a non-existent # subject table, the statement fails with an appropriate error message. let $message= Testcase 3.5.5.1:; --source include/show_msg.inc - --error 1146 + --error ER_NO_SUCH_TABLE Create trigger trg1 before INSERT on t100 for each row set new.f2=1000; #Section 3.5.5.2 -# Test case: Ensure that, if CREATE TRIGGER is executed with a temporary table +# Test case: Ensure that, if CREATE TRIGGER is executed with a temporary table # as the subject table, the statement fails with an appropriate error message. let $message= Testcase 3.5.5.2:; --source include/show_msg.inc Create temporary table t1_temp (f1 bigint signed, f2 bigint unsigned); - --error 1361 - Create trigger trg2 before INSERT + --error ER_TRG_ON_VIEW_OR_TEMP_TABLE + Create trigger trg2 before INSERT on t1_temp for each row set new.f2=9999; #Cleanup - --disable_warnings + --disable_warnings drop table t1_temp; --enable_warnings #Section 3.5.5.3 -# Test case: Ensure that, if CREATE TRIGGER is executed with a view as the subject +# Test case: Ensure that, if CREATE TRIGGER is executed with a view as the subject # table, the statement fails with an appropriate error message. let $message= Testcase 3.5.5.3:; --source include/show_msg.inc Create view vw3 as select f118 from tb3; -# OBN Not sure why the server is returning error 1347 - --error 1347 - Create trigger trg3 before INSERT +# OBN Not sure why the server is returning error ER_WRONG_OBJECT + --error ER_WRONG_OBJECT + Create trigger trg3 before INSERT on vw3 for each row set new.f118='s'; #Cleanup - --disable_warnings + --disable_warnings drop view vw3; --enable_warnings #Section 3.5.5.4 -# Test case: Ensure that, if CREATE TRIGGER is executed with a table that resides -# in a different database than in which the trigger will reside, the +# Test case: Ensure that, if CREATE TRIGGER is executed with a table that resides +# in a different database than in which the trigger will reside, the # statement fails with an appropriate error message; that is, ensure that # the trigger and its subject table must reside in the same database. let $message= Testcase 3.5.5.4:; @@ -281,9 +292,10 @@ let $message= Testcase 3.5.5.4:; create database dbtest_one; create database dbtest_two; use dbtest_two; - eval create table t2 (f1 char(15)) engine=$engine_type; + --replace_result $engine_type <engine_to_be_used> + eval create table t2 (f1 char(15)) engine = $engine_type; use dbtest_one; - --error 1435 + --error ER_TRG_IN_WRONG_SCHEMA create trigger trg4 before INSERT on dbtest_two.t2 for each row set new.f1='trig 3.5.5.4'; grant INSERT, SELECT on dbtest_two.t2 to test_general; @@ -294,11 +306,11 @@ let $message= Testcase 3.5.5.4:; Select * from t2; use dbtest_one; Insert into dbtest_two.t2 values ('2nd Insert 3.5.5.4'); - Select * from dbtest_two.t2; + Select * from dbtest_two.t2 order by f1; #Cleanup connection con1_super; - --disable_warnings + --disable_warnings revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost'; DROP DATABASE if exists dbtest_one; drop database if EXISTS dbtest_two; @@ -316,7 +328,7 @@ let $message= Testcase 3.5.6:; use test; #Section 3.5.6.1 -# Test case: Ensure that a trigger definition can specify a trigger action time of BEFORE. +# Test case: Ensure that a trigger definition can specify a trigger action time of BEFORE. # See section 3.5.1.1 let $message= Testcase 3.5.6.1 (see Testcase 3.5.1.1); --source include/show_msg.inc @@ -328,37 +340,37 @@ let $message= Testcase 3.5.6.2 (see Testcase 3.5.1.1); --source include/show_msg.inc #Section 3.5.6.3 -# Test case: Ensure that a trigger definition that specifies a trigger action -# time that is not either BEFORE or AFTER fails, with an appropriate +# Test case: Ensure that a trigger definition that specifies a trigger action +# time that is not either BEFORE or AFTER fails, with an appropriate # error message, at CREATE TRIGGER time. let $message= Testcase 3.5.6.3:; --source include/show_msg.inc - --error 1064 + --error ER_PARSE_ERROR Create trigger trg3_1 DURING UPDATE on tb3 for each row set new.f132=25; - --error 1064 + --error ER_PARSE_ERROR Create trigger trg3_2 TIME INSERT on tb3 for each row set new.f132=15; -#Cleanup +#Cleanup # OBN - Although none of the above should have been created we should do a cleanup # since if they have been created, not dropping them will affect following # tests. --disable_warnings - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger tb3.trg3_1; - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger tb3.trg3_2; --enable_warnings #Section 3.5.6.4 -# Test case: Ensure that a trigger defined with a trigger action time of BEFORE -# always executes its triggered action immediately before the trigger event. +# Test case: Ensure that a trigger defined with a trigger action time of BEFORE +# always executes its triggered action immediately before the trigger event. # See section 3.5.1.1 let $message= Testcase 3.5.6.4 (see Testcase 3.5.1.1); --source include/show_msg.inc #Section 3.5.6.5 -# Test case: Ensure that a trigger defined with a trigger action time of AFTER +# Test case: Ensure that a trigger defined with a trigger action time of AFTER # always executes its triggered action immediately after the trigger event. let $message= Testcase 3.5.6.5 (see Testcase 3.5.1.1); --source include/show_msg.inc @@ -384,40 +396,40 @@ let $message= Testcase 3.5.7.3 (see Testcase 3.5.1.1); --source include/show_msg.inc #Section 3.5.7.4 -# Test case: Ensure that a trigger definition that specifies a trigger event that -# is not either INSERT, UPDATE or DELETE fails, with an appropriate error +# Test case: Ensure that a trigger definition that specifies a trigger event that +# is not either INSERT, UPDATE or DELETE fails, with an appropriate error # message, at CREATE TRIGGER time. let $message= Testcase 3.5.7.4:; --source include/show_msg.inc - --error 1064 + --error ER_PARSE_ERROR Create trigger trg4_1 BEFORE SELECT on tb3 for each row set new.f132=5; - --error 1064 + --error ER_PARSE_ERROR Create trigger trg4_2 AFTER VALUE on tb3 for each row set new.f132=1; -#Cleanup +#Cleanup # OBN - Although none of the above should have been created we should do a cleanup # since if they have been created, not dropping them will affect following # tests. --disable_warnings - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger tb3.trg4_1; - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger tb3.trg4_2; --enable_warnings -#Section 3.5.7.5 / 3.5.7.6 -# Test case: Ensure that it is not possible to create multiple BEFORE INSERT triggers +#Section 3.5.7.5 / 3.5.7.6 +# Test case: Ensure that it is not possible to create multiple BEFORE INSERT triggers # on the same table, even if the triggers have different names / different # triggered actions. let $message= Testcase 3.5.7.5 / 3.5.7.6:; --source include/show_msg.inc - Create trigger trg5_1 BEFORE INSERT + Create trigger trg5_1 BEFORE INSERT on tb3 for each row set new.f122='Trigger1 3.5.7.5/6'; - --error ER_NOT_SUPPORTED_YET - Create trigger trg5_2 BEFORE INSERT + --error ER_NOT_SUPPORTED_YET + Create trigger trg5_2 BEFORE INSERT on tb3 for each row set new.f122='Trigger2 3.5.7.5'; Insert into tb3 (f121,f122) values ('Test 3.5.7.5/6','Insert 3.5.7.5'); @@ -426,27 +438,27 @@ let $message= Testcase 3.5.7.5 / 3.5.7.6:; Select f121,f122 from tb3 where f121='Test 3.5.7.5/6'; #Cleanup - --disable_warnings + --disable_warnings drop trigger trg5_1; - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg5_2; delete from tb3 where f121='Test 3.5.7.5/6'; --enable_warnings -#Section 3.5.7.7 / 3.5.7.8 -# Test case: Ensure that it is not possible to create multiple AFTER INSERT triggers +#Section 3.5.7.7 / 3.5.7.8 +# Test case: Ensure that it is not possible to create multiple AFTER INSERT triggers # on the same table, even if the triggers have different names / different # triggered actions. let $message= Testcase 3.5.7.7 / 3.5.7.8:; --source include/show_msg.inc set @test_var='Before trig 3.5.7.7'; - Create trigger trg6_1 AFTER INSERT + Create trigger trg6_1 AFTER INSERT on tb3 for each row set @test_var='Trigger1 3.5.7.7/8'; - --error ER_NOT_SUPPORTED_YET - Create trigger trg6_2 AFTER INSERT + --error ER_NOT_SUPPORTED_YET + Create trigger trg6_2 AFTER INSERT on tb3 for each row set @test_var='Trigger2 3.5.7.7'; select @test_var; @@ -458,26 +470,26 @@ let $message= Testcase 3.5.7.7 / 3.5.7.8:; select @test_var; #Cleanup - --disable_warnings + --disable_warnings drop trigger trg6_1; - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg6_2; delete from tb3 where f121='Test 3.5.7.7/8'; --enable_warnings #Section 3.5.7.9 / 3.5.7.10 -# Test case: Ensure that it is not possible to create multiple BEFORE UPDATE triggers -# on the same table, even if the triggers have different names / different +# Test case: Ensure that it is not possible to create multiple BEFORE UPDATE triggers +# on the same table, even if the triggers have different names / different # triggered actions. let $message= Testcase 3.5.7.9/10:; --source include/show_msg.inc - Create trigger trg7_1 BEFORE UPDATE + Create trigger trg7_1 BEFORE UPDATE on tb3 for each row set new.f122='Trigger1 3.5.7.9/10'; - --error ER_NOT_SUPPORTED_YET - Create trigger trg7_2 BEFORE UPDATE + --error ER_NOT_SUPPORTED_YET + Create trigger trg7_2 BEFORE UPDATE on tb3 for each row set new.f122='Trigger2 3.5.7.9'; Insert into tb3 (f121,f122) values ('Test 3.5.7.9/10','Insert 3.5.7.9'); @@ -486,25 +498,25 @@ let $message= Testcase 3.5.7.9/10:; Select f121,f122 from tb3 where f121='Test 3.5.7.9/10'; #Cleanup - --disable_warnings + --disable_warnings drop trigger trg7_1; - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg7_2; delete from tb3 where f121='Test 3.5.7.9/10'; #Section 3.5.7.11 / 3.5.7.12 -# Test case: Ensure that it is not possible to create multiple AFTER UPDATE triggers +# Test case: Ensure that it is not possible to create multiple AFTER UPDATE triggers # on the same table, even if the triggers have different names / different -# triggered actions. +# triggered actions. let $message= Testcase 3.5.7.11/12:; --source include/show_msg.inc set @test_var='Before trig 3.5.7.11'; - Create trigger trg8_1 AFTER UPDATE + Create trigger trg8_1 AFTER UPDATE on tb3 for each row set @test_var='Trigger 3.5.7.11/12'; - --error ER_NOT_SUPPORTED_YET - Create trigger trg8_2 AFTER UPDATE + --error ER_NOT_SUPPORTED_YET + Create trigger trg8_2 AFTER UPDATE on tb3 for each row set @test_var='Trigger2 3.5.7.11'; @@ -518,25 +530,25 @@ let $message= Testcase 3.5.7.11/12:; delete from tb3 where f121='Test 3.5.7.11/12'; #Cleanup - --disable_warnings + --disable_warnings drop trigger trg8_1; - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg8_2; delete from tb3 where f121='Test 3.5.7.11/12'; #Section 3.5.7.13 / 3.5.7.14 -# Test case: Ensure that it is not possible to create multiple BEFORE DELETE triggers +# Test case: Ensure that it is not possible to create multiple BEFORE DELETE triggers # on the same table, even if the triggers have different names / different # triggered actions. let $message= Testcase 3.5.7.13/14:; --source include/show_msg.inc set @test_var=1; - Create trigger trg9_1 BEFORE DELETE + Create trigger trg9_1 BEFORE DELETE on tb3 for each row set @test_var=@test_var+1; - --error ER_NOT_SUPPORTED_YET - Create trigger trg9_2 BEFORE DELETE + --error ER_NOT_SUPPORTED_YET + Create trigger trg9_2 BEFORE DELETE on tb3 for each row set @test_var=@test_var+10; select @test_var; @@ -550,29 +562,29 @@ let $message= Testcase 3.5.7.13/14:; select @test_var; #Cleanup - --disable_warnings + --disable_warnings drop trigger trg9_1; - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg9_2; delete from tb3 where f121='Test 3.5.7.13/14'; #Section 3.5.7.15 / 3.5.7.16 -# Test case: Ensure that it is not possible to create multiple AFTER DELETE triggers -# on the same table, even if the triggers have different names / different +# Test case: Ensure that it is not possible to create multiple AFTER DELETE triggers +# on the same table, even if the triggers have different names / different # triggered actions. let $message= Testcase 3.5.7.15/16:; --source include/show_msg.inc set @test_var=1; - Create trigger trg_3_406010_1 AFTER DELETE + Create trigger trg_3_406010_1 AFTER DELETE on tb3 for each row set @test_var=@test_var+5; - --error ER_NOT_SUPPORTED_YET - Create trigger trg_3_406010_2 AFTER DELETE + --error ER_NOT_SUPPORTED_YET + Create trigger trg_3_406010_2 AFTER DELETE on tb3 for each row set @test_var=@test_var+50; - --error 1359 - Create trigger trg_3_406010_1 AFTER INSERT + --error ER_TRG_ALREADY_EXISTS + Create trigger trg_3_406010_1 AFTER INSERT on tb3 for each row set @test_var=@test_var+1; select @test_var; @@ -586,18 +598,18 @@ let $message= Testcase 3.5.7.15/16:; select @test_var; #Cleanup - --disable_warnings + --disable_warnings drop trigger trg_3_406010_1; - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg_3_406010_2; delete from tb3 where f121='Test 3.5.7.15/16'; --enable_warnings #Section 3.5.7.17 -# Test case: Ensure that it is possible to have a BEFORE INSERT, an AFTER INSERT, -# a BEFORE UPDATE, an AFTER UPDATE, a BEFORE DELETE, and an AFTER DELETE -# trigger on the same table; that is, ensure that every persistent base +# Test case: Ensure that it is possible to have a BEFORE INSERT, an AFTER INSERT, +# a BEFORE UPDATE, an AFTER UPDATE, a BEFORE DELETE, and an AFTER DELETE +# trigger on the same table; that is, ensure that every persistent base # table may be the subject table for exactly six triggers let $message= Testcase 3.5.7.17 (see Testcase 3.5.1.1); --source include/show_msg.inc @@ -609,3 +621,4 @@ let $message= Testcase 3.5.7.17 (see Testcase 3.5.1.1); drop user test_general; drop user test_super@localhost; +DROP TABLE test.tb3; diff --git a/mysql-test/suite/funcs_1/triggers/triggers_08.inc b/mysql-test/suite/funcs_1/triggers/triggers_08.inc index 300080e455d..45228357bc5 100644 --- a/mysql-test/suite/funcs_1/triggers/triggers_08.inc +++ b/mysql-test/suite/funcs_1/triggers/triggers_08.inc @@ -1,9 +1,12 @@ #====================================================================== # -# Trigger Tests -# (test case numbering refer to requirement document TP v1.1) +# Trigger Tests +# (test case numbering refer to requirement document TP v1.1) #====================================================================== +USE test; +--source suite/funcs_1/include/tb3.inc + # General setup for Trigger tests let $message= Testcase: 3.5:; --source include/show_msg.inc @@ -29,22 +32,20 @@ let $message= Testcase: 3.5:; ################################# #Section 3.5.8.1 -# Testcase: Ensure that the triggered action of every trigger always executes +# Testcase: Ensure that the triggered action of every trigger always executes # correctly and the results in all expected changes made to the database let $message= Testcase 3.5.8.1: (implied in previous tests); --source include/show_msg.inc -# OBN - FIXME - Missing 3.5.8.1 need to add - #Section 3.5.8.2 -# Testcase: Ensure that the triggered actions of every trigger never results +# Testcase: Ensure that the triggered actions of every trigger never results # in an unexpected change made to the database. let $message= Testcase 3.5.8.2: (implied in previous tests); --source include/show_msg.inc #Section 3.5.8.3 / 3.5.8.4 -#Test case: Ensure that the triggered action can any valid SQL statement / set +#Test case: Ensure that the triggered action can any valid SQL statement / set # of valid SQL statements, provided the statements are written within # a BEGIN/END compound statement construct # OBN - At this point the tests focuses on the the INSERT/UPDATE/DELETE SQL statements @@ -58,17 +59,20 @@ let $message= Testcase 3.5.8.3/4:; grant SELECT, INSERT, UPDATE, DELETE on db_test.* to test_general; grant LOCK TABLES on db_test.* to test_general; Use db_test; - eval create table t1_i ( + --replace_result $engine_type <engine_to_be_used> + eval create table t1_i ( i120 char ascii not null DEFAULT b'101', i136 smallint zerofill not null DEFAULT 999, i144 int zerofill not null DEFAULT 99999, i163 decimal (63,30)) engine=$engine_type; - eval create table t1_u ( + --replace_result $engine_type <engine_to_be_used> + eval create table t1_u ( u120 char ascii not null DEFAULT b'101', u136 smallint zerofill not null DEFAULT 999, u144 int zerofill not null DEFAULT 99999, u163 decimal (63,30)) engine=$engine_type; - eval create table t1_d ( + --replace_result $engine_type <engine_to_be_used> + eval create table t1_d ( d120 char ascii not null DEFAULT b'101', d136 smallint zerofill not null DEFAULT 999, d144 int zerofill not null DEFAULT 99999, @@ -93,26 +97,29 @@ let $message= 3.5.8.4 - multiple SQL; delimiter //; Create trigger trg1 AFTER INSERT on tb3 for each row BEGIN - insert into db_test.t1_i + insert into db_test.t1_i values (new.f120, new.f136, new.f144, new.f163); - update db_test.t1_u + update db_test.t1_u set u144=new.f144, u163=new.f163 - where u136=new.f136; + where u136=new.f136; delete from db_test.t1_d where d136= new.f136; - select sum(db_test.t1_u.u163) into @test_var from db_test.t1_u - where u136= new.f136; - END// + select sum(db_test.t1_u.u163) into @test_var from db_test.t1_u + where u136= new.f136; + END// delimiter ;// # Test trigger execution - multiple SQL connection con2_general; Use test; set @test_var=0; - Insert into tb3 (f120, f122, f136, f144, f163) + Insert into tb3 (f120, f122, f136, f144, f163) values ('1', 'Test 3.5.8.4', 222, 23456, 1.05); Select f120, f122, f136, f144, f163 from tb3 where f122= 'Test 3.5.8.4'; + --sorted_result select * from db_test.t1_i; + --sorted_result select * from db_test.t1_u; + --sorted_result select * from db_test.t1_d; select @test_var; @@ -121,16 +128,22 @@ let $message= 3.5.8.4 - single SQL - insert; --source include/show_msg.inc # Trigger definition - single SQL Insert connection con2_super; + delimiter //; Create trigger trg2 BEFORE UPDATE on tb3 for each row - insert into db_test.t1_i + BEGIN + insert into db_test.t1_i values (new.f120, new.f136, new.f144, new.f163); + END// + delimiter ;// # Trigger exeution - single SQL Insert connection con2_general; + Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; + select * from db_test.t1_i order by i120; update tb3 set f120='I', f122='Test 3.5.8.4-Single Insert' where f122='Test 3.5.8.4'; Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; - select * from db_test.t1_i; + select * from db_test.t1_i order by i120; let $message= 3.5.8.4 - single SQL - update; @@ -139,16 +152,16 @@ let $message= 3.5.8.4 - single SQL - update; connection con2_super; drop trigger trg2; Create trigger trg3 BEFORE UPDATE on tb3 for each row - update db_test.t1_u + update db_test.t1_u set u120=new.f120 - where u136=new.f136; + where u136=new.f136; # Trigger exeution - single SQL - update; connection con2_general; update tb3 set f120='U', f122='Test 3.5.8.4-Single Update' where f122='Test 3.5.8.4-Single Insert'; Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; - select * from db_test.t1_u; + select * from db_test.t1_u order by u120; let $message= 3.5.8.3/4 - single SQL - delete; @@ -162,12 +175,12 @@ let $message= 3.5.8.3/4 - single SQL - delete; # Trigger exeution - single SQL delete connection con2_general; #lock tables tb3 write, db_test.t1_i write, db_test.t1_u write, db_test.t1_d write; - update tb3 set f120='D', f136=444, + update tb3 set f120='D', f136=444, f122='Test 3.5.8.4-Single Delete' where f122='Test 3.5.8.4-Single Update'; #unlock tables; Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; - select * from db_test.t1_d; + select * from db_test.t1_d order by d120; let $message= 3.5.8.3/4 - single SQL - select; @@ -176,13 +189,13 @@ let $message= 3.5.8.3/4 - single SQL - select; connection con2_super; drop trigger trg4; Create trigger trg5 AFTER UPDATE on tb3 for each row - select sum(db_test.t1_u.u163) into @test_var from db_test.t1_u - where u136= new.f136; + select sum(db_test.t1_u.u163) into @test_var from db_test.t1_u + where u136= new.f136; # Trigger exeution - single SQL select connection con2_general; set @test_var=0; - update tb3 set f120='S', f136=111, + update tb3 set f120='S', f136=111, f122='Test 3.5.8.4-Single Select' where f122='Test 3.5.8.4-Single Delete'; Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; @@ -190,7 +203,7 @@ let $message= 3.5.8.3/4 - single SQL - select; #Cleanup connection default; - --disable_warnings + --disable_warnings drop trigger trg1; drop trigger trg5; drop database if exists db_test; @@ -200,8 +213,8 @@ let $message= 3.5.8.3/4 - single SQL - select; #Section 3.5.8.5 (IF) -# Test case: Ensure that the stored procedure-specific flow control statement like IF -# works correctly when it is a part of the triggered action portion of a +# Test case: Ensure that the stored procedure-specific flow control statement like IF +# works correctly when it is a part of the triggered action portion of a # trigger definition. let $message= Testcase 3.5.8.5 (IF):; --source include/show_msg.inc @@ -219,7 +232,7 @@ let $message= Testcase 3.5.8.5 (IF):; IF (new.f120='4') and (new.f136=10) then set @test_var2='2nd if', new.f120='d'; - ELSE + ELSE set @test_var2='2nd else', new.f120='D'; END IF; END// @@ -227,50 +240,50 @@ let $message= Testcase 3.5.8.5 (IF):; set @test_var='Empty', @test_var2=0; Insert into tb3 (f120, f122, f136) values ('1', 'Test 3.5.8.5-if', 101); - select f120, f122, f136, @test_var, @test_var2 - from tb3 where f122 = 'Test 3.5.8.5-if'; + select f120, f122, f136, @test_var, @test_var2 + from tb3 where f122 = 'Test 3.5.8.5-if' order by f136; Insert into tb3 (f120, f122, f136) values ('2', 'Test 3.5.8.5-if', 102); - select f120, f122, f136, @test_var, @test_var2 - from tb3 where f122 = 'Test 3.5.8.5-if'; + select f120, f122, f136, @test_var, @test_var2 + from tb3 where f122 = 'Test 3.5.8.5-if' order by f136; Insert into tb3 (f120, f122, f136) values ('3', 'Test 3.5.8.5-if', 10); - select f120, f122, f136, @test_var, @test_var2 - from tb3 where f122 = 'Test 3.5.8.5-if'; + select f120, f122, f136, @test_var, @test_var2 + from tb3 where f122 = 'Test 3.5.8.5-if' order by f136; Insert into tb3 (f120, f122, f136) values ('3', 'Test 3.5.8.5-if', 103); - select f120, f122, f136, @test_var, @test_var2 - from tb3 where f122 = 'Test 3.5.8.5-if'; + select f120, f122, f136, @test_var, @test_var2 + from tb3 where f122 = 'Test 3.5.8.5-if' order by f136; delimiter //; - --error 1064 + --error ER_PARSE_ERROR create trigger trg3 before update on tb3 for each row BEGIN ELSEIF new.f120='2' then END IF; END// - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg3// - --error 1064 + --error ER_PARSE_ERROR create trigger trg4 before update on tb3 for each row BEGIN IF (new.f120='4') and (new.f136=10) then set @test_var2='2nd if', new.f120='d'; - ELSE + ELSE set @test_var2='2nd else', new.f120='D'; END// delimiter ;// - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg4; #Cleanup - --disable_warnings + --disable_warnings drop trigger trg2; delete from tb3 where f121='Test 3.5.8.5-if'; --enable_warnings #Section 3.5.8.5 (CASE) -# Test case: Ensure that the stored procedure-specific flow control statement -# like CASE works correctly when it is a part of the triggered action +# Test case: Ensure that the stored procedure-specific flow control statement +# like CASE works correctly when it is a part of the triggered action # portion of a trigger definition. let $message= Testcase 3.5.8.5-case:; --source include/show_msg.inc @@ -310,34 +323,34 @@ let $message= Testcase 3.5.8.5-case:; delimiter ;// set @test_var='Empty'; - Insert into tb3 (f120, f122, f136, f144) + Insert into tb3 (f120, f122, f136, f144) values ('a', 'Test 3.5.8.5-case', 5, 7); - select f120, f122, f136, f144, @test_var - from tb3 where f122 = 'Test 3.5.8.5-case'; - Insert into tb3 (f120, f122, f136, f144) + select f120, f122, f136, f144, @test_var + from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136; + Insert into tb3 (f120, f122, f136, f144) values ('b', 'Test 3.5.8.5-case', 71,16); - select f120, f122, f136, f144, @test_var - from tb3 where f122 = 'Test 3.5.8.5-case'; - Insert into tb3 (f120, f122, f136, f144) + select f120, f122, f136, f144, @test_var + from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136; + Insert into tb3 (f120, f122, f136, f144) values ('c', 'Test 3.5.8.5-case', 80,1); - select f120, f122, f136, f144, @test_var - from tb3 where f122 = 'Test 3.5.8.5-case'; - Insert into tb3 (f120, f122, f136) + select f120, f122, f136, f144, @test_var + from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136; + Insert into tb3 (f120, f122, f136) values ('d', 'Test 3.5.8.5-case', 152); - select f120, f122, f136, f144, @test_var - from tb3 where f122 = 'Test 3.5.8.5-case'; - Insert into tb3 (f120, f122, f136, f144) + select f120, f122, f136, f144, @test_var + from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136; + Insert into tb3 (f120, f122, f136, f144) values ('e', 'Test 3.5.8.5-case', 200, 8); - select f120, f122, f136, f144, @test_var - from tb3 where f122 = 'Test 3.5.8.5-case'; - --error 0, 1339 - Insert into tb3 (f120, f122, f136, f144) + select f120, f122, f136, f144, @test_var + from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136; + --error 0, ER_SP_CASE_NOT_FOUND + Insert into tb3 (f120, f122, f136, f144) values ('f', 'Test 3.5.8.5-case', 100, 8); - select f120, f122, f136, f144, @test_var - from tb3 where f122 = 'Test 3.5.8.5-case'; + select f120, f122, f136, f144, @test_var + from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136; delimiter //; - --error 1064 + --error ER_PARSE_ERROR create trigger trg3a before update on tb3 for each row BEGIN CASE @@ -345,11 +358,11 @@ let $message= Testcase 3.5.8.5-case:; END// delimiter ;// - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg3a; #Cleanup - --disable_warnings + --disable_warnings drop trigger trg3; delete from tb3 where f121='Test 3.5.8.5-case'; --enable_warnings @@ -363,53 +376,53 @@ let $message= Testcase 3.5.8.5-loop/leave:; delimiter //; Create trigger trg4 after insert on tb3 for each row - BEGIN + BEGIN set @counter=0, @flag='Initial'; - Label1: loop + Label1: loop if new.f136<new.f144 then set @counter='Nothing to loop'; - leave Label1; + leave Label1; else set @counter=@counter+1; if new.f136=new.f144+@counter then set @counter=concat(@counter, ' loops'); leave Label1; - end if; - end if; - iterate label1; + end if; + end if; + iterate label1; set @flag='Final'; - END loop Label1; + END loop Label1; END// delimiter ;// - Insert into tb3 (f122, f136, f144) + Insert into tb3 (f122, f136, f144) values ('Test 3.5.8.5-loop', 2, 8); select @counter, @flag; - Insert into tb3 (f122, f136, f144) + Insert into tb3 (f122, f136, f144) values ('Test 3.5.8.5-loop', 11, 8); select @counter, @flag; delimiter //; - --error 1064 + --error ER_PARSE_ERROR Create trigger trg4_2 after update on tb3 for each row - BEGIN - Label1: loop + BEGIN + Label1: loop set @counter=@counter+1; - END; + END; END// delimiter ;// - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg4_2; #Cleanup - --disable_warnings + --disable_warnings drop trigger trg4; delete from tb3 where f122='Test 3.5.8.5-loop'; --enable_warnings #Section 3.5.8.5 (REPEAT ITERATE) -#Testcase: Ensure that the stored procedure-specific flow control statements +#Testcase: Ensure that the stored procedure-specific flow control statements # like REPEAT work correctly when they are part of the triggered action # portion of a trigger definition. let $message= Testcase 3.5.8.5-repeat:; @@ -418,108 +431,122 @@ let $message= Testcase 3.5.8.5-repeat:; delimiter //; Create trigger trg6 after insert on tb3 for each row BEGIN - rp_label: REPEAT - SET @counter1 = @counter1 + 1; + rp_label: REPEAT + SET @counter1 = @counter1 + 1; IF (@counter1 MOD 2 = 0) THEN ITERATE rp_label; END IF; - SET @counter2 = @counter2 + 1; + SET @counter2 = @counter2 + 1; UNTIL @counter1> new.f136 END REPEAT rp_label; END// delimiter ;// set @counter1= 0, @counter2= 0; - Insert into tb3 (f122, f136) + Insert into tb3 (f122, f136) values ('Test 3.5.8.5-repeat', 13); select @counter1, @counter2; delimiter //; - --error 1064 + --error ER_PARSE_ERROR Create trigger trg6_2 after update on tb3 for each row BEGIN - REPEAT - SET @counter2 = @counter2 + 1; + REPEAT + SET @counter2 = @counter2 + 1; END// delimiter ;// #Cleanup - --disable_warnings + --disable_warnings drop trigger trg6; delete from tb3 where f122='Test 3.5.8.5-repeat'; --enable_warnings #Section 3.5.8.5 (WHILE) -# Test case: Ensure that the stored procedure-specific flow control -# statements WHILE, work correctly when they are part of +# Test case: Ensure that the stored procedure-specific flow control +# statements WHILE, work correctly when they are part of # the triggered action portion of a trigger definition. let $message= Testcase 3.5.8.5-while:; --source include/show_msg.inc delimiter //; Create trigger trg7 after insert on tb3 for each row - wl_label: WHILE @counter1 < new.f136 DO - SET @counter1 = @counter1 + 1; + wl_label: WHILE @counter1 < new.f136 DO + SET @counter1 = @counter1 + 1; IF (@counter1 MOD 2 = 0) THEN ITERATE wl_label; END IF; - SET @counter2 = @counter2 + 1; + SET @counter2 = @counter2 + 1; END WHILE wl_label// delimiter ;// set @counter1= 0, @counter2= 0; - Insert into tb3 (f122, f136) + Insert into tb3 (f122, f136) values ('Test 3.5.8.5-while', 7); select @counter1, @counter2; delimiter //; - --error 1064 + --error ER_PARSE_ERROR Create trigger trg7_2 after update on tb3 for each row BEGIN - WHILE @counter1 < new.f136 - SET @counter1 = @counter1 + 1; + WHILE @counter1 < new.f136 + SET @counter1 = @counter1 + 1; END// delimiter ;// #Cleanup - --disable_warnings + --disable_warnings delete from tb3 where f122='Test 3.5.8.5-while'; drop trigger trg7; --enable_warnings #Section 3.5.8.6 -# Test case: Ensure that a trigger definition that includes a CALL to a stored -# procedure fails, at CREATE TRIGGER time, with an appropriate error -# message -# OBN - requirement void since allowed -# Fails due to Bug 9909 the bug allows the trigger to be created -# and fails in execution time +# Test case: Ensure that a trigger definition that includes a CALL to a stored +# procedure fails, at CREATE TRIGGER time, with an appropriate error +# message. Not more valid requirement. let $message= Testcase 3.5.8.6: (requirement void); --source include/show_msg.inc + delimiter //; + CREATE PROCEDURE sp_01 () BEGIN set @v1=1; END// + + CREATE TRIGGER trg8_1 BEFORE UPDATE ON tb3 FOR EACH ROW + BEGIN + CALL sp_01 (); + END// + delimiter ;// + Insert into tb3 (f120, f122, f136) values ('6', 'Test 3.5.8.6-insert', 101); + update tb3 set f120='S', f136=111, + f122='Test 3.5.8.6-tr8_1' + where f122='Test 3.5.8.6-insert'; + select f120, f122 + from tb3 where f122 like 'Test 3.5.8.6%' order by f120; + DROP TRIGGER trg8_1; + DROP PROCEDURE sp_01; #Section 3.5.8.7 -# Test case: Ensure that a trigger definition that includes a -# transaction-delimiting statement (e.g. COMMIT, -# ROLLBACK, START TRANSACTION) fails, at CREATE TRIGGER +# Test case: Ensure that a trigger definition that includes a +# transaction-delimiting statement (e.g. COMMIT, +# ROLLBACK, START TRANSACTION) fails, at CREATE TRIGGER # time, with an appropriate error message. -# OBN - Fails due to Bug ____ -let $message= Testcase 3.5.8.7: (Disabled as a result of bug _____); +let $message= Testcase 3.5.8.7; --source include/show_msg.inc + + delimiter //; + --error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG + Create trigger trg9_1 before update on tb3 for each row + BEGIN + Start transaction; + Set new.f120='U'; + Commit; + END// -# --error 1314 -# Create trigger trg9_1 before update on tb3 for each row -# BEGIN -# Start transaction; -# Set new.f120='U'; -# Commit; -# END; - -# --error 1314 -# Create trigger trg9_2 before delete on tb3 for each row -# BEGIN -# Start transaction; -# Set @var2=old.f120; -# Rollback; -# END; + --error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG + Create trigger trg9_2 before delete on tb3 for each row + BEGIN + Start transaction; + Set @var2=old.f120; + Rollback; + END// + delimiter ;// # Cleanup section 3.5 @@ -528,4 +555,4 @@ let $message= Testcase 3.5.8.7: (Disabled as a result of bug _____); drop user test_general; drop user test_super@localhost; - +DROP TABLE test.tb3; diff --git a/mysql-test/suite/funcs_1/triggers/triggers_09.inc b/mysql-test/suite/funcs_1/triggers/triggers_09.inc index 4eaaf3e35e2..1645f7384ef 100644 --- a/mysql-test/suite/funcs_1/triggers/triggers_09.inc +++ b/mysql-test/suite/funcs_1/triggers/triggers_09.inc @@ -1,9 +1,16 @@ #====================================================================== # -# Trigger Tests -# (test case numbering refer to requirement document TP v1.1) +# Trigger Tests +# (test case numbering refer to requirement document TP v1.1) #====================================================================== +USE test; +--source suite/funcs_1/include/tb3.inc + +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +load data infile '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/memory_tb3.txt' +into table tb3; ################################# ####### Section 3.5.9 ########### @@ -11,15 +18,15 @@ ################################# #Section 3.5.9.1 -#Test case: Ensure that every trigger executes its triggered action on each row +#Test case: Ensure that every trigger executes its triggered action on each row # that meets the conditions stated in the trigger definition. #Section 3.5.9.2 -#Testcase: Ensure that a trigger never executes its triggered action on any row +#Testcase: Ensure that a trigger never executes its triggered action on any row # that doesn't meet the conditions stated in the trigger definition. let $message= Testcase 3.5.9.1/2:; --source include/show_msg.inc - Create trigger trg1 BEFORE UPDATE on tb3 for each row + Create trigger trg1 BEFORE UPDATE on tb3 for each row set new.f142 = 94087, @counter=@counter+1; --disable_query_log select count(*) as TotalRows from tb3; @@ -29,22 +36,22 @@ let $message= Testcase 3.5.9.1/2:; --enable_query_log set @counter=0; Update tb3 Set f142='1' where f130<100; - select count(*) as ExpectedChanged, @counter as TrigCounter + select count(*) as ExpectedChanged, @counter as TrigCounter from tb3 where f142=94087; - select count(*) as ExpectedNotChange from tb3 + select count(*) as ExpectedNotChange from tb3 where f130<100 and f142<>94087; - select count(*) as NonExpectedChanged from tb3 + select count(*) as NonExpectedChanged from tb3 where f130>=130 and f142=94087; #Cleanup - --disable_warnings + --disable_warnings drop trigger trg1; --enable_warnings #Section 3.5.9.3 -#Test case: Ensure that a reference to OLD.<column name> always correctly refers -# to the values of the specified column of the subject table before a +#Test case: Ensure that a reference to OLD.<column name> always correctly refers +# to the values of the specified column of the subject table before a # data row is updated or deleted. let $message= Testcase 3.5.9.3:; --source include/show_msg.inc @@ -71,46 +78,46 @@ let $message= Testcase 3.5.9.3:; --disable_query_log - set @tr_var_b4_118=0, @tr_var_b4_121=0, @tr_var_b4_122=0, + set @tr_var_b4_118=0, @tr_var_b4_121=0, @tr_var_b4_122=0, @tr_var_b4_136=0, @tr_var_b4_163=0; - set @tr_var_af_118=0, @tr_var_af_121=0, @tr_var_af_122=0, + set @tr_var_af_118=0, @tr_var_af_121=0, @tr_var_af_122=0, @tr_var_af_136=0, @tr_var_af_163=0; - select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, + select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_163; - select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, + select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_163; --enable_query_log - Insert into tb3 (f122, f136, f163) + Insert into tb3 (f122, f136, f163) values ('Test 3.5.9.3', 7, 123.17); Update tb3 Set f136=8 where f122='Test 3.5.9.3'; - select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3'; - select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, + select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3' order by f136; + select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_163; - select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, + select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_163; --disable_query_log - set @tr_var_b4_118=0, @tr_var_b4_121=0, @tr_var_b4_122=0, + set @tr_var_b4_118=0, @tr_var_b4_121=0, @tr_var_b4_122=0, @tr_var_b4_136=0, @tr_var_b4_163=0; - set @tr_var_af_118=0, @tr_var_af_121=0, @tr_var_af_122=0, + set @tr_var_af_118=0, @tr_var_af_121=0, @tr_var_af_122=0, @tr_var_af_136=0, @tr_var_af_163=0; - select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, + select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_163; - select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, + select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_163; --enable_query_log delete from tb3 where f122='Test 3.5.9.3'; - select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3'; - select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, + select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3' order by f136; + select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_163; - select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, + select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_163; #Cleanup - --disable_warnings + --disable_warnings drop trigger trg2_a; drop trigger trg2_b; drop trigger trg2_c; @@ -118,8 +125,8 @@ let $message= Testcase 3.5.9.3:; --enable_warnings #Section 3.5.9.4 -#Test case: Ensure that a reference to NEW.<column name> always correctly refers -# to the values of the specified column of the subject table after an +#Test case: Ensure that a reference to NEW.<column name> always correctly refers +# to the values of the specified column of the subject table after an # existing data row has been updated or a new data row has been inserted. let $message= Testcase 3.5.9.4:; --source include/show_msg.inc @@ -145,48 +152,48 @@ let $message= Testcase 3.5.9.4:; @tr_var_af_151=new.f151, @tr_var_af_163=new.f163; --disable_query_log - set @tr_var_b4_118=0, @tr_var_b4_121=0, @tr_var_b4_122=0, + set @tr_var_b4_118=0, @tr_var_b4_121=0, @tr_var_b4_122=0, @tr_var_b4_136=0, @tr_var_b4_151=0, @tr_var_b4_163=0; - set @tr_var_af_118=0, @tr_var_af_121=0, @tr_var_af_122=0, + set @tr_var_af_118=0, @tr_var_af_121=0, @tr_var_af_122=0, @tr_var_af_136=0, @tr_var_af_151=0, @tr_var_af_163=0; - select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, + select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_151, @tr_var_b4_163; - select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, + select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_151, @tr_var_af_163; --enable_query_log - Insert into tb3 (f122, f136, f151, f163) + Insert into tb3 (f122, f136, f151, f163) values ('Test 3.5.9.4', 7, DEFAULT, 995.24); - select f118, f121, f122, f136, f151, f163 from tb3 - where f122 like 'Test 3.5.9.4%'; - select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, + select f118, f121, f122, f136, f151, f163 from tb3 + where f122 like 'Test 3.5.9.4%' order by f163; + select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_151, @tr_var_b4_163; - select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, + select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_151, @tr_var_af_163; --disable_query_log - set @tr_var_b4_118=0, @tr_var_b4_121=0, @tr_var_b4_122=0, + set @tr_var_b4_118=0, @tr_var_b4_121=0, @tr_var_b4_122=0, @tr_var_b4_136=0, @tr_var_b4_151=0, @tr_var_b4_163=0; - set @tr_var_af_118=0, @tr_var_af_121=0, @tr_var_af_122=0, + set @tr_var_af_118=0, @tr_var_af_121=0, @tr_var_af_122=0, @tr_var_af_136=0, @tr_var_af_151=0, @tr_var_af_163=0; - select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, + select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_151, @tr_var_b4_163; - select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, + select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_151, @tr_var_af_163; --enable_query_log Update tb3 Set f122='Test 3.5.9.4-trig', f136=NULL, f151=DEFAULT, f163=NULL where f122='Test 3.5.9.4'; - select f118, f121, f122, f136, f151, f163 from tb3 - where f122 like 'Test 3.5.9.4-trig'; - select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, + select f118, f121, f122, f136, f151, f163 from tb3 + where f122 like 'Test 3.5.9.4-trig' order by f163; + select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_151, @tr_var_b4_163; - select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, + select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_151, @tr_var_af_163; #Cleanup - --disable_warnings + --disable_warnings drop trigger trg3_a; drop trigger trg3_b; drop trigger trg3_c; @@ -196,123 +203,121 @@ let $message= Testcase 3.5.9.4:; #Section 3.5.9.5 -# Test case: Ensure that the definition of an INSERT trigger can include a +# Test case: Ensure that the definition of an INSERT trigger can include a # reference to NEW. <Column name>. let $message= Testcase 3.5.9.5: (implied in previous tests); --source include/show_msg.inc #Section 3.5.9.6 -# Test case: Ensure that the definition of an INSERT trigger cannot include +# Test case: Ensure that the definition of an INSERT trigger cannot include # a reference to OLD. <Column name>. let $message= Testcase 3.5.9.6:; --source include/show_msg.inc - --error 1363 + --error ER_TRG_NO_SUCH_ROW_IN_TRG create trigger trg4a before insert on tb3 for each row set @temp1= old.f120; - --error 1362 + --error ER_TRG_CANT_CHANGE_ROW create trigger trg4b after insert on tb3 for each row set old.f120= 'test'; #Cleanup - --disable_warnings - --error 0, 1360 + --disable_warnings + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg4a; - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg4b; --enable_warnings #Section 3.5.9.7 -# Test case: Ensure that the definition of an UPDATE trigger can include a +# Test case: Ensure that the definition of an UPDATE trigger can include a # reference to NEW. <Column name>. let $message= Testcase 3.5.9.7: (implied in previous tests); --source include/show_msg.inc #Section 3.5.9.8 -# Test case: Ensure that the definition of an UPDATE trigger cannot include a +# Test case: Ensure that the definition of an UPDATE trigger cannot include a # reference to OLD. <Column name>. let $message= Testcase 3.5.9.8: (implied in previous tests); --source include/show_msg.inc #Section 3.5.9.9 -# Test case: Ensure that the definition of a DELETE trigger cannot include a +# Test case: Ensure that the definition of a DELETE trigger cannot include a # reference to NEW.<column name>. let $message= Testcase 3.5.9.9:; --source include/show_msg.inc - --error 1363 + --error ER_TRG_NO_SUCH_ROW_IN_TRG create trigger trg5a before DELETE on tb3 for each row set @temp1=new.f122; - --error 1363 + --error ER_TRG_NO_SUCH_ROW_IN_TRG create trigger trg5b after DELETE on tb3 for each row set new.f122='test'; -let $message= The above returns the wrong error, should be error 1362 (Bug 11648) ---source include/show_msg.inc #Cleanup - --disable_warnings - --error 0, 1360 + --disable_warnings + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg5a; - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg5b; --enable_warnings #Section 3.5.9.10 -# Test case: Ensure that the definition of a DELETE trigger can include a reference +# Test case: Ensure that the definition of a DELETE trigger can include a reference # to OLD.<column name>. let $message= Testcase 3.5.9.10: (implied in previous tests); --source include/show_msg.inc #Section 3.5.9.11 -# Testcase: Ensure that trigger definition that includes a referance to -# NEW.<colunm name> fails with an appropriate error message, +# Testcase: Ensure that trigger definition that includes a referance to +# NEW.<colunm name> fails with an appropriate error message, # at CREATE TRIGGER time, if the trigger event in not INSERT or UPDATE let $message= Testcase 3.5.9.11: covered by 3.5.9.9; --source include/show_msg.inc #Section 3.5.9.12 -# Testcase: Ensure that trigger definition that includes a referance to -# OLD.<column name> fails with an appropriate error message, at +# Testcase: Ensure that trigger definition that includes a referance to +# OLD.<column name> fails with an appropriate error message, at # CREATE TRIGGER time, if the trigger event is not DELETE or UPDATE let $message= Testcase 3.5.9.12: covered by 3.5.9.6; --source include/show_msg.inc #Section 3.5.9.13 -# Test case: Ensure that all references to OLD. <Column name> are read-only, +# Test case: Ensure that all references to OLD. <Column name> are read-only, # that is, that they cannot be used to modify a data row. let $message= Testcase 3.5.9.13:; --source include/show_msg.inc - --error 1362 + --error ER_TRG_CANT_CHANGE_ROW create trigger trg6a before UPDATE on tb3 for each row set old.f118='C', new.f118='U'; - --error 1362 + --error ER_TRG_CANT_CHANGE_ROW create trigger trg6b after INSERT on tb3 for each row set old.f136=163, new.f118='U'; - --error 1362 + --error ER_TRG_CANT_CHANGE_ROW create trigger trg6c after UPDATE on tb3 for each row set old.f136=NULL; #Cleanup - --disable_warnings - --error 0, 1360 + --disable_warnings + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg6a; - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg6b; - --error 0, 1360 + --error 0, ER_TRG_DOES_NOT_EXIST drop trigger trg6c; --enable_warnings #Section 3.5.9.14 -# Test case: Ensure that all references to NEW. <Column name> may be used both to +# Test case: Ensure that all references to NEW. <Column name> may be used both to # read a data row and to modify a data row let $message= Testcase 3.5.9.14: (implied in previous tests); --source include/show_msg.inc - +DROP TABLE test.tb3; diff --git a/mysql-test/suite/funcs_1/triggers/triggers_1011ext.inc b/mysql-test/suite/funcs_1/triggers/triggers_1011ext.inc index 534c4efaa86..20229434b5f 100644 --- a/mysql-test/suite/funcs_1/triggers/triggers_1011ext.inc +++ b/mysql-test/suite/funcs_1/triggers/triggers_1011ext.inc @@ -4,6 +4,14 @@ # (test case numbering refer to requirement document TP v1.1) #====================================================================== +USE test; +--source suite/funcs_1/include/tb3.inc + +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval +load data infile '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/memory_tb3.txt' +into table tb3; + --disable_abort_on_error ############################################## @@ -48,7 +56,8 @@ let $message= Testcase 3.5.10.1/2/3:; Insert into vw11 (f122, f151) values ('Test 3.5.10.1/2/3', 2); Insert into vw11 (f122, f151) values ('Not in View', 3); select f121, f122, f151, f163 - from tb3 where f122 like 'Test 3.5.10.1/2/3%'; + from tb3 where f122 like 'Test 3.5.10.1/2/3%' order by f151; + --sorted_result select f121, f122, f151, f163 from vw11; select f121, f122, f151, f163 from tb3 where f122 like 'Not in View'; @@ -56,7 +65,8 @@ let $message= Testcase 3.5.10.1/2/3:; #Section 3.5.10.2 Update vw11 set f163=1; select f121, f122, f151, f163 from tb3 - where f122 like 'Test 3.5.10.1/2/3%'; + where f122 like 'Test 3.5.10.1/2/3%' order by f151; + --sorted_result select f121, f122, f151, f163 from vw11; #Section 3.5.10.3 @@ -64,7 +74,8 @@ let $message= Testcase 3.5.10.1/2/3:; Select @test_var as 'before delete'; delete from vw11 where f151=1; select f121, f122, f151, f163 from tb3 - where f122 like 'Test 3.5.10.1/2/3%'; + where f122 like 'Test 3.5.10.1/2/3%' order by f151; + --sorted_result select f121, f122, f151, f163 from vw11; Select @test_var as 'after delete'; @@ -88,17 +99,18 @@ let $message= Testcase 3.5.10.1/2/3:; let $message= Testcase 3.5.10.4:; --source include/show_msg.inc - eval create table tb_load (f1 int, f2 char(25),f3 int) engine=$engine_type; + --replace_result $engine_type <engine_to_be_used> + eval create table tb_load (f1 int, f2 char(25),f3 int) engine = $engine_type; Create trigger trg4 before insert on tb_load for each row set new.f3=-(new.f1 div 5), @counter= @counter+1; set @counter= 0; select @counter as 'Rows Loaded Before'; - --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR - eval load data infile '$MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' into table tb_load; + --replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> + eval load data infile '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/t9.txt' into table tb_load; select @counter as 'Rows Loaded After'; - Select * from tb_load limit 10; + Select * from tb_load order by f1 limit 10; #Cleanup --disable_warnings @@ -131,7 +143,8 @@ let $message= Testcase 3.5.10.6: (implemented in trig_frkey.test); let $message= Testcase 3.5.10.extra:; --source include/show_msg.inc - eval create table t1_sp (var136 tinyint, var151 decimal) engine=$engine_type; + --replace_result $engine_type <engine_to_be_used> + eval create table t1_sp (var136 tinyint, var151 decimal) engine = $engine_type; create trigger trg before insert on t1_sp for each row set @counter=@counter+1; @@ -157,7 +170,7 @@ let $message= Testcase 3.5.10.extra:; set @counter=0; select @counter; - --error 1329 + --error ER_SP_FETCH_NO_DATA call trig_sp(); select @counter; select count(*) from tb3; @@ -203,12 +216,18 @@ let $message= Testcase y.y.y.2: Check for triggers starting triggers; drop table if exists t3; --enable_warnings - eval create table t1 (f1 integer) engine=$engine_type; - eval create table t2_1 (f1 integer) engine=$engine_type; - eval create table t2_2 (f1 integer) engine=$engine_type; - eval create table t2_3 (f1 integer) engine=$engine_type; - eval create table t2_4 (f1 integer) engine=$engine_type; - eval create table t3 (f1 integer) engine=$engine_type; + --replace_result $engine_type <engine_to_be_used> + eval create table t1 (f1 integer) engine = $engine_type; + --replace_result $engine_type <engine_to_be_used> + eval create table t2_1 (f1 integer) engine = $engine_type; + --replace_result $engine_type <engine_to_be_used> + eval create table t2_2 (f1 integer) engine = $engine_type; + --replace_result $engine_type <engine_to_be_used> + eval create table t2_3 (f1 integer) engine = $engine_type; + --replace_result $engine_type <engine_to_be_used> + eval create table t2_4 (f1 integer) engine = $engine_type; + --replace_result $engine_type <engine_to_be_used> + eval create table t3 (f1 integer) engine = $engine_type; insert into t1 values (1); delimiter //; @@ -233,7 +252,7 @@ let $message= Testcase y.y.y.2: Check for triggers starting triggers; #lock tables t1 write, t2_1 write, t2_2 write, t2_3 write, t2_4 write, t3 write; insert into t1 values (1); #unlock tables; - select * from t3; + select * from t3 order by f1; #Cleanup --disable_warnings @@ -256,9 +275,13 @@ let $message= Testcase y.y.y.3: Circular trigger reference; drop table if exists t3; drop table if exists t4; --enable_warnings + --replace_result $engine_type <engine_to_be_used> eval create table t1 (f1 integer) engine = $engine_type; + --replace_result $engine_type <engine_to_be_used> eval create table t2 (f2 integer) engine = $engine_type; + --replace_result $engine_type <engine_to_be_used> eval create table t3 (f3 integer) engine = $engine_type; + --replace_result $engine_type <engine_to_be_used> eval create table t4 (f4 integer) engine = $engine_type; insert into t1 values (0); @@ -271,13 +294,13 @@ let $message= Testcase y.y.y.3: Circular trigger reference; create trigger tr4 after insert on t4 for each row insert into t1 (f1) values (new.f4+1); - # OBN See bug 11896 - --error 1442 + # Bug#11896 Partial locking in case of recursive trigger definittions + --error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG insert into t1 values (1); - select * from t1; - select * from t2; - select * from t3; - select * from t4; + select * from t1 order by f1; + select * from t2 order by f2; + select * from t3 order by f3; + select * from t4 order by f4; #Cleanup --disable_warnings @@ -294,14 +317,15 @@ let $message= Testcase y.y.y.3: Circular trigger reference; #Section y.y.y.4 # Testcase: create recursive trigger/storedprocedures conditions -let $message= Testcase y.y.y.4: Recursive trigger/SP references (disabled bug 11889); +let $message= Testcase y.y.y.4: Recursive trigger/SP references; --source include/show_msg.inc set @sql_mode='traditional'; + --replace_result $engine_type <engine_to_be_used> eval create table t1_sp ( count integer, var136 tinyint, - var151 decimal) engine=$engine_type; + var151 decimal) engine = $engine_type; delimiter //; create procedure trig_sp() @@ -327,7 +351,7 @@ set @sql_mode='traditional'; set @counter=0; select @counter; - --error 1456 + --error ER_SP_RECURSION_LIMIT call trig_sp(); select @counter; select count(*) from tb3; @@ -337,7 +361,7 @@ set @sql_mode='traditional'; set @@max_sp_recursion_depth= 10; set @counter=0; select @counter; - --error 1442 + --error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG call trig_sp(); select @counter; select count(*) from tb3; @@ -353,7 +377,7 @@ set @sql_mode='traditional'; # Testcase: y.y.y.5: # Checking rollback of nested trigger definitions -let $message= Testcase y.y.y.5: Roleback of nested trigger references; +let $message= Testcase y.y.y.5: Rollback of nested trigger references; --source include/show_msg.inc set @@sql_mode='traditional'; @@ -364,10 +388,15 @@ let $message= Testcase y.y.y.5: Roleback of nested trigger references; drop table if exists t3; drop table if exists t4; --enable_warnings + --replace_result $engine_type <engine_to_be_used> eval create table t1 (f1 integer) engine = $engine_type; + --replace_result $engine_type <engine_to_be_used> eval create table t2 (f2 integer) engine = $engine_type; + --replace_result $engine_type <engine_to_be_used> eval create table t3 (f3 integer) engine = $engine_type; + --replace_result $engine_type <engine_to_be_used> eval create table t4 (f4 tinyint) engine = $engine_type; + --replace_result $engine_type <engine_to_be_used> show create table t1; insert into t1 values (1); create trigger tr1 after insert on t1 @@ -377,19 +406,18 @@ let $message= Testcase y.y.y.5: Roleback of nested trigger references; create trigger tr3 after insert on t3 for each row insert into t4 (f4) values (new.f3+1000); -#lock tables t1 write, t2 write, t3 write, t4 write; - set autocommit=0; start transaction; - --error 1264 +# Bug#32656 NDB: Duplicate key error aborts transaction in handler. +# Doesn't talk back to SQL + --error ER_WARN_DATA_OUT_OF_RANGE insert into t1 values (1); commit; - select * from t1; - select * from t2; - select * from t3; -#unlock tables; + select * from t1 order by f1; + select * from t2 order by f2; + select * from t3 order by f3; + #Cleanup - --disable_warnings drop trigger tr1; drop trigger tr2; drop trigger tr3; @@ -397,5 +425,5 @@ let $message= Testcase y.y.y.5: Roleback of nested trigger references; drop table t2; drop table t3; drop table t4; - --enable_warnings +DROP TABLE test.tb3; diff --git a/mysql-test/suite/funcs_1/triggers/triggers_master.test b/mysql-test/suite/funcs_1/triggers/triggers_master.test deleted file mode 100644 index 0f6d4ff555f..00000000000 --- a/mysql-test/suite/funcs_1/triggers/triggers_master.test +++ /dev/null @@ -1,2818 +0,0 @@ -#====================================================================== -# -# Trigger Tests -# (test case numbering refer to requirement document TP v1.1) -#====================================================================== - -# OBM - ToDo -############ -# 1. Information Schema Trigger Table -# 2. Performace -############################################### - -# General setup for Trigger tests -let $message= Testcase: 3.5:; ---source include/show_msg.inc - ---disable_abort_on_error - - create User test_general@localhost; - set password for test_general@localhost = password('PWD'); - revoke ALL PRIVILEGES, GRANT OPTION FROM test_general@localhost; - - create User test_super@localhost; - set password for test_super@localhost = password('PWD'); - grant ALL on *.* to test_super@localhost with grant OPTION; - --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK - connect (con_general,localhost,test_general,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); - --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK - connect (con_super,localhost,test_super,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); - connection default; - - -##################################################### -################# Section 3.5.1 ##################### -# Syntax checks for CREATE TRIGGER and DROP TRIGGER # -##################################################### - -#Section 3.5.1.1 -# Testcase: Ensure that all clauses that should be supported are supported. -let $message= Testcase: 3.5.1.1:; ---source include/show_msg.inc -# OBN - This test case tests basic trigger definition and execution -# of INSERT/UPDATE/DELETE actions and BEFORE/AFTER timings. -# As such it covers the equirements in sections 3.5.6.1, 3.5.6.2, -# 3.5.6.4, 3.5.6.5, 3.5.7.1, 3.5.7.2, 3.5.7.3, 3.5.7.17 below. -# - Note currently as a result of limitations with locking tables in -# triggers, a specifc lockingof the tables is done. -# Once fixed, the locking and alias referances should be removed - -use test; -# Trigger Definition - Create trigger trg1_1 BEFORE INSERT - on tb3 for each row set @test_before = 2, new.f142 = @test_before; - Create trigger trg1_2 AFTER INSERT - on tb3 for each row set @test_after = 6; - Create trigger trg1_4 BEFORE UPDATE - on tb3 for each row set @test_before = 27, - new.f142 = @test_before, - new.f122 = 'Before Update Trigger'; - Create trigger trg1_3 AFTER UPDATE - on tb3 for each row set @test_after = '15'; - Create trigger trg1_5 BEFORE DELETE on tb3 for each row - select count(*) into @test_before from tb3 as tr_tb3 - where f121 = 'Test 3.5.1.1'; - Create trigger trg1_6 AFTER DELETE on tb3 for each row - select count(*) into @test_after from tb3 as tr_tb3 - where f121 = 'Test 3.5.1.1'; -# Trigger Execution Insert (before and after) - set @test_before = 1; - set @test_after = 5; - select @test_before, @test_after; - Insert into tb3 (f121, f122, f142, f144, f134) - values ('Test 3.5.1.1', 'First Row', @test_before, @test_after, 1); - select f121, f122, f142, f144, f134 from tb3 where f121 = 'Test 3.5.1.1'; - select @test_before, @test_after; - -# Trigger Execution Update (before and after) - set @test_before = 18; - set @test_after = 8; - select @test_before, @test_after; - Update tb3 set tb3.f122 = 'Update', - tb3.f142 = @test_before, - tb3.f144 = @test_after - where tb3.f121 = 'Test 3.5.1.1'; - select f121, f122, f142, f144, f134 from tb3 where f121 = 'Test 3.5.1.1'; - select @test_before, @test_after; - -# Trigger Execution Delete (before and after) - Insert into tb3 (f121, f122, f142, f144, f134) - values ('Test 3.5.1.1', 'Second Row', 5, 6, 2); - set @test_before = 0; - set @test_after = 0; - select f121, f122, f142, f144, f134 from tb3 where f121 = 'Test 3.5.1.1'; - select @test_before, @test_after; - Delete from tb3 where f121 = 'Test 3.5.1.1' and f134 = 2; - select f121, f122, f142, f144, f134 from tb3 where f121 = 'Test 3.5.1.1'; - select @test_before, @test_after; - -#Cleanup - --disable_warnings - --error 0, 1360 - drop trigger trg1_1; - --error 0, 1360 - drop trigger trg1_2; - --error 0, 1360 - drop trigger trg1_3; - --error 0, 1360 - drop trigger trg1_4; - --error 0, 1360 - drop trigger trg1_5; - --error 0, 1360 - drop trigger trg1_6; - --enable_warnings - delete from tb3 where f121='Test 3.5.1.1'; - --enable_warnings - -#Section 3.5.1.2 -# Testcase: Ensure that all clauses that should not be supported are disallowed -# with an appropriate error message. -let $message= Testcase: 3.5.1.2:; ---source include/show_msg.inc - - --error 1064 - Create trigger trg_1 after insert - on tb3 for each statement set @x= 1; - -#Cleanup - --disable_warnings - --error 0, 1360 - drop trigger trg_1; - --enable_warnings - - -#Section 3.5.1.3 -# Testcase: Ensure that all supported clauses are supported only in the correct order. -let $message= Testcase 3.5.1.3:; ---source include/show_msg.inc - --error 1064 - CREATE TRIGGER trg3_1 on tb3 BEFORE INSERT for each row set new.f120 = 't'; - - --error 1064 - CREATE trg3_2 TRIGGER AFTER INSERT on tb3 for each row set new.f120 = 's'; - - --error 1064 - CREATE TRIGGER trg3_3 Before DELETE on tb3 set @ret1 = 'test' for each row; - - --error 1064 - CREATE TRIGGER trg3_4 DELETE AFTER on tb3 set @ret1 = 'test' for each row; - - --error 1064 - CREATE for each row TRIGGER trg3_5 AFTER UPDATE on tb3 set @ret1 = 'test'; - -#Cleanup -# OBN - Although none of the above should have been created we should do a cleanup -# since if they have been created, not dropping them will affect following -# tests. - --disable_warnings - --error 0, 1360 - drop trigger trg3_1; - --error 0, 1360 - drop trigger trg3_2; - --error 0, 1360 - drop trigger trg3_3; - --error 0, 1360 - drop trigger trg3_4; - --error 0, 1360 - drop trigger trg3_5; - --enable_warnings - - -#Section 3.5.1.4 -# Testcase: Ensure that an appropriate error message is returned if a clause -# is out-of-order in an SQL statement. -# OBN - FIXME - Missing 3.5.1.4 need to add - -#Section 3.5.1.5 -# Testcase: Ensure that all clauses that are defined to be mandatory are indeed -# required to be mandatory by the MySQL server and tools -let $message= Testcase: 3.5.1.5:; ---source include/show_msg.inc - - --error 1064 - CREATE TRIGGER trg4_1 AFTER on tb3 for each row set new.f120 = 'e'; - - --error 1064 - CREATE TRIGGER trg4_2 INSERT on tb3 for each set row new.f120 = 'f'; - - --error 1064 - CREATE TRIGGER trg4_3 BEFORE INSERT tb3 for each row set new.f120 = 'g'; - - --error 1064 - CREATE TRIGGER trg4_4 AFTER UPDATE on tb3 for each set new.f120 = 'g'; - - --error 1064 - CREATE trg4_5 AFTER DELETE on tb3 for each set new.f120 = 'g'; - - --error 1064 - CREATE TRIGGER trg4_6 BEFORE DELETE for each row set new.f120 = 'g'; - -#Cleanup -# OBN - Although none of the above should have been created we should do a cleanup -# since if they have been created, not dropping them will affect following -# tests. - --disable_warnings - --error 0, 1360 - drop trigger trg4_1; - --error 0, 1360 - drop trigger trg4_2; - --error 0, 1360 - drop trigger trg4_3; - --error 0, 1360 - drop trigger trg4_4; - --error 0, 1360 - drop trigger trg4_5; - --error 0, 1360 - drop trigger trg4_6; - --enable_warnings - -#Section 3.5.1.6 -# Testcase: Ensure that any clauses that are defined to be optional are indeed -# trated as optional by MySQL server and tools -let $message= Testcase 3.5.1.6: - Need to fix; ---source include/show_msg.inc -# OBN - FIXME - Missing 3.5.1.6 need to add - -#Section 3.5.1.7 -# Testcase: Ensure that all valid, fully-qualified, and non-qualified, -# trigger names are accepted, at creation time. -let $message= Testcase 3.5.1.7: - need to fix; ---source include/show_msg.inc - - drop table if exists t1; - eval create table t1 (f1 int, f2 char(25),f3 int) engine=$engine_type; - CREATE TRIGGER trg5_1 BEFORE INSERT on test.t1 - for each row set new.f3 = '14'; - CREATE TRIGGER trg_abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ - BEFORE UPDATE on test.t1 for each row set new.f3 = '42'; - - insert into t1 (f2) values ('insert 3.5.1.7'); - select * from t1; - update t1 set f2='update 3.5.1.7'; - select * from t1; - select trigger_name from information_schema.triggers; - -#Cleanup - --disable_warnings - --error 0, 1360 - drop trigger trg5_1; - # The above trigger should be dropped since the name was trimmed. - drop trigger trg_abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ; - drop table t1; - -#Section 3.5.1.8 -# Testcase: Ensure that any invalid trigger name is never accepted, and that an -# appropriate error message is returned when the name is rejected. -let $message= Testcase 3.5.1.8:; ---source include/show_msg.inc - - --error 1064 - CREATE TRIGGER trg12* before insert on tb3 for each row set new.f120 = 't'; - - --error 1064 - CREATE TRIGGER trigger before insert on tb3 for each row set new.f120 = 't'; - - --error 1064 - CREATE TRIGGER 100 before insert on tb3 for each row set new.f120 = 't'; - - --error 1064 - CREATE TRIGGER @@view before insert on tb3 for each row set new.f120 = 't'; - - --error 1064 - CREATE TRIGGER @name before insert on tb3 for each row set new.f120 = 't'; - - --error 1435 - CREATE TRIGGER tb3.trg6_1 BEFORE INSERT on test.tb3 - for each row set new.f120 ='X'; - - --disable_warnings - drop database if exists trig_db; - --enable_warnings - create database trig_db; - use trig_db; - eval create table t1 (f1 integer) engine = $engine_type; - - # Can't create a trigger in a different database - use test; - --error 1435 - CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3 - for each row set @ret_trg6_2 = 5; - - # Can't create a trigger refrencing a table in a different db - use trig_db; - --error 1435 - CREATE TRIGGER trg6_3 AFTER INSERT on test.tb3 - for each row set @ret_trg6_3 = 18; - - use test; - -#Cleanup - --disable_warnings - drop database trig_db; -# OBN - Although none of the above should have been created we should do a cleanup -# since if they have been created, not dropping them will affect following -# tests. - --error 0, 1360 - drop trigger trg6_1; - --error 0, 1360 - drop trigger trg6_3; - --enable_warnings - -#Section 3.5.1.9 -#Testcase: Ensure that a reference to a non-existent trigger is rejected with -# an appropriate error message. -let $message= Testcase 3.5.1.9:(cannot be inplemented at this point); ---source include/show_msg.inc - - -#Section 3.5.1.10 -#Testcase: Ensure that it is not possible to create two triggers with the same name on -# the same table -let $message= Testcase 3.5.1.10:; ---source include/show_msg.inc - - CREATE TRIGGER trg7_1 BEFORE UPDATE on tb3 for each row set new.f120 ='X'; - - --error 1359 - CREATE TRIGGER trg7_1 AFTER INSERT on tb3 for each row set @x ='Y'; - -#Cleanup - --disable_warnings - --error 0, 1360 - drop trigger trg7_1; - --enable_warnings - - -#Section 3.5.1.? -# Testcase: Ensure that it is not possible to create two or more triggers with -# the same name, provided each is associated with a different table. -let $message= Testcase 3.5.1.?:; ---source include/show_msg.inc - - --disable_warnings - drop table if exists t1; - drop table if exists t2; - --enable_warnings - eval create table t1 (f1 char(50), f2 integer) engine = $engine_type; - eval create table t2 (f1 char(50), f2 integer) engine = $engine_type; - - create trigger trig before insert on t1 - for each row set new.f1 ='trig t1'; - - --error 1359 - create trigger trig before update on t2 - for each row set new.f1 ='trig t2'; - - insert into t1 value ('insert to t1',1); - select * from t1; - update t1 set f1='update to t1'; - select * from t1; - insert into t2 value ('insert to t2',2); - update t2 set f1='update to t1'; - select * from t2; - -#Cleanup - --disable_warnings - drop table t1; - drop table t2; - --error 0, 1360 - drop trigger trig; - --enable_warnings - - -#Section 3.5.1.11 -# Testcase: Ensure that it is possible to create two or more triggers with -# the same name, provided each resides in a different database -let $message= Testcase 3.5.1.11:; ---source include/show_msg.inc - - --disable_warnings - drop database if exists trig_db1; - drop database if exists trig_db2; - drop database if exists trig_db3; - --enable_warnings - create database trig_db1; - create database trig_db2; - create database trig_db3; - use trig_db1; - eval create table t1 (f1 char(50), f2 integer) engine = $engine_type; - create trigger trig before insert on t1 - for each row set new.f1 ='trig1', @test_var1='trig1'; - use trig_db2; - eval create table t2 (f1 char(50), f2 integer) engine = $engine_type; - create trigger trig before insert on t2 - for each row set new.f1 ='trig2', @test_var2='trig2'; - use trig_db3; - eval create table t1 (f1 char(50), f2 integer) engine = $engine_type; - create trigger trig before insert on t1 - for each row set new.f1 ='trig3', @test_var3='trig3'; - - set @test_var1= '', @test_var2= '', @test_var3= ''; - use trig_db1; - insert into t1 (f1,f2) values ('insert to db1 t1',1); - insert into trig_db1.t1 (f1,f2) values ('insert to db1 t1 from db1',2); - insert into trig_db2.t2 (f1,f2) values ('insert to db2 t2 from db1',3); - insert into trig_db3.t1 (f1,f2) values ('insert to db3 t1 from db1',4); - select @test_var1, @test_var2, @test_var3; - select * from t1; - select * from trig_db2.t2; - select * from trig_db3.t1; - select * from t1; - use test; - -#Cleanup - --disable_warnings - drop database trig_db1; - drop database trig_db2; - drop database trig_db3; - --enable_warnings - -########################################### -################ Section 3.5.2 ############ -# Check for the global nature of Triggers # -########################################### - -#Section 3.5.2.1 -# Test case: Ensure that if a trigger created without a qualifying database -# name belongs to the database in use at creation time. -#Section 3.5.2.2 -# Test case: Ensure that if a trigger created with a qualifying database name -# belongs to the database specified. -#Section 3.5.2.3 -# Test case: Ensure that if a trigger created with a qualifying database name -# does not belong to the database in use at creation time unless -# the qualifying database name identifies the database that is -# also in use at creation time. -let $message= Testcase 3.5.2.1/2/3:; ---source include/show_msg.inc - - - --disable_warnings - drop database if exists trig_db1; - drop database if exists trig_db2; - --enable_warnings - create database trig_db1; - create database trig_db2; - use trig_db1; - eval create table t1 (f1 char(50), f2 integer) engine = $engine_type; - eval create table trig_db2.t1 (f1 char(50), f2 integer) engine = $engine_type; - create trigger trig1_b before insert on t1 - for each row set @test_var1='trig1_b'; - create trigger trig_db1.trig1_a after insert on t1 - for each row set @test_var2='trig1_a'; - create trigger trig_db2.trig2 before insert on trig_db2.t1 - for each row set @test_var3='trig2'; - select trigger_schema, trigger_name, event_object_table - from information_schema.triggers; - - set @test_var1= '', @test_var2= '', @test_var3= ''; - insert into t1 (f1,f2) values ('insert to db1 t1 from db1',352); - insert into trig_db2.t1 (f1,f2) values ('insert to db2 t1 from db1',352); - select @test_var1, @test_var2, @test_var3; - -#Cleanup - --disable_warnings - drop database trig_db1; - drop database trig_db2; - -########################################### -################ Section 3.5.3 ############ -# Check for the global nature of Triggers # -########################################### - -# General setup to be used in all testcases of 3.5.3 -let $message= Testcase 3.5.3:; ---source include/show_msg.inc - - --disable_warnings - drop database if exists priv_db; - --enable_warnings - create database priv_db; - use priv_db; - create table t1 (f1 char(20)); - - create User test_noprivs@localhost; - set password for test_noprivs@localhost = password('PWD'); - - create User test_yesprivs@localhost; - set password for test_yesprivs@localhost = password('PWD'); - -#Section 3.5.3.1 / 3.5.3.2 -# Test case: Ensure SUPER privilege is required to create a trigger -#Section 3.5.3.3 / 3.5.3.4 -# Test case: Ensure that root always has the SUPER privilege. -# OMR - No need to test this since SUPER priv is an existing one and not related -# or added for triggers (TP 2005-06-06) -#Section 3.5.3.5 / 3.5.3.6 -# Test case: Ensure that the SUPER privilege is required to drop a trigger. -let $message= Testcase 3.5.3.2/6:; ---source include/show_msg.inc - - revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost; - grant ALL on *.* to test_noprivs@localhost; - revoke SUPER on *.* from test_noprivs@localhost; - show grants for test_noprivs@localhost; - - revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; - grant SUPER on *.* to test_yesprivs@localhost; -# Adding the minimal priv to be able to set to the db - grant SELECT on priv_db.t1 to test_yesprivs@localhost; - show grants for test_yesprivs@localhost; - - --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK - connect (no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); - --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK - connect (yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); - connection default; - -let $message= Testcase 3.5.3.2:; ---source include/show_msg.inc - - connection no_privs; - select current_user; - use priv_db; - - --error 1227 - create trigger trg1_1 before INSERT on t1 for each row - set new.f1 = 'trig 3.5.3.2_1-no'; - - connection default; - use priv_db; - insert into t1 (f1) values ('insert 3.5.3.2-no'); - select f1 from t1; - - connection yes_privs; - select current_user; - use priv_db; - - create trigger trg1_2 before INSERT on t1 for each row - set new.f1 = 'trig 3.5.3.2_2-yes'; - - connection default; - use priv_db; - insert into t1 (f1) values ('insert 3.5.3.2-yes'); - select f1 from t1; - -let $message= Testcase 3.5.3.6:; ---source include/show_msg.inc - - connection no_privs; - use priv_db; - - --error 1227 - drop trigger trg1_2; - - connection default; - use priv_db; - insert into t1 (f1) values ('insert 3.5.3.6-yes'); - select f1 from t1; - - connection yes_privs; - use priv_db; - - drop trigger trg1_2; - - connection default; - use priv_db; - insert into t1 (f1) values ('insert 3.5.3.6-no'); - select f1 from t1; - -# Cleanup - --disable_warnings - connection default; - --error 0, 1360 - drop trigger trg1_2; - disconnect no_privs; - disconnect yes_privs; - --enable_warnings - - -#Section 3.5.3.7 -# Test case: Ensure that use of the construct "SET NEW. <column name> = <value>" -# fails at CREATE TRIGGER time, if the current user does not have the -# UPDATE privilege on the column specified -# Note: As a result of bug 8884 the triggers are actually created. -# Disabled because of bug 8884 - -# --- 3.5.3.7a - Privs set on a global level -let $message=Testcase 3.5.3.7a:; ---source include/show_msg.inc - - revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost; - grant ALL on *.* to test_noprivs@localhost; - revoke UPDATE on *.* from test_noprivs@localhost; - show grants for test_noprivs@localhost; - - revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; - grant SUPER, UPDATE on *.* to test_yesprivs@localhost; - show grants for test_yesprivs@localhost; - - --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK - connect (no_privs_424a,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); - --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK - connect (yes_privs_424a,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); - - connection no_privs_424a; - select current_user; - use priv_db; - show grants; - select f1 from t1; - -let $message= Trigger create disabled - should fail - Bug 8884; ---source include/show_msg.inc -# --error 1227 -# create trigger trg4a_1 before INSERT on t1 for each row -# set new.f1 = 'trig 3.5.3.7-1a'; - - connection default; - insert into t1 (f1) values ('insert 3.5.3.7-1a'); - select f1 from t1; - --error 0, 1360 - drop trigger trg4a_1; - - connection yes_privs_424a; - use priv_db; - select current_user; - show grants; - create trigger trg4a_2 before INSERT on t1 for each row - set new.f1 = 'trig 3.5.3.7-2a'; - - connection default; - insert into t1 (f1) values ('insert 3.5.3.7-2b'); - select f1 from t1; - -# Cleanup - --disable_warnings - drop trigger trg4a_2; - disconnect no_privs_424a; - disconnect yes_privs_424a; - --enable_warnings - -# --- 3.5.3.7b - Privs set on a database level -let $message= Testcase 3.5.3.7b:; ---source include/show_msg.inc - - revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost; - grant SUPER on *.* to test_noprivs; - grant ALL on priv_db.* to test_noprivs@localhost; - revoke UPDATE on priv_db.* from test_noprivs@localhost; - show grants for test_noprivs; - - revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; - grant SUPER on *.* to test_yesprivs@localhost; - grant UPDATE on priv_db.* to test_yesprivs@localhost; - show grants for test_yesprivs@localhost; - - --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK - connect (no_privs_424b,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); - --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK - connect (yes_privs_424b,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); - connection default; - - connection no_privs_424b; - show grants; - use priv_db; - -let $message= Trigger create disabled - should fail - Bug 8884; ---source include/show_msg.inc -# --error 1227 -# create trigger trg4b_1 before UPDATE on t1 for each row -# set new.f1 = 'trig 3.5.3.7-1b'; - - connection default; - insert into t1 (f1) values ('insert 3.5.3.7-1b'); - select f1 from t1; - update t1 set f1 = 'update 3.5.3.7-1b' where f1 = 'insert 3.5.3.7-1b'; - select f1 from t1; - --error 0, 1360 - drop trigger trg4b_1; - - connection yes_privs_424b; - show grants; - use priv_db; - create trigger trg4b_2 before UPDATE on t1 for each row - set new.f1 = 'trig 3.5.3.7-2b'; - - connection default; - insert into t1 (f1) values ('insert 3.5.3.7-2b'); - select f1 from t1; - update t1 set f1 = 'update 3.5.3.7-2b' where f1 = 'insert 3.5.3.7-2b'; - select f1 from t1; -# Cleanup - --disable_warnings - drop trigger trg4b_2; - disconnect no_privs_424b; - disconnect yes_privs_424b; - --enable_warnings - -# --- 3.5.3.7c - Privs set on a table level -let $message= Testcase 3.5.3.7c; ---source include/show_msg.inc - - revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost; - grant SUPER on *.* to test_noprivs@localhost; - grant ALL on priv_db.t1 to test_noprivs@localhost; - revoke UPDATE on priv_db.t1 from test_noprivs@localhost; - show grants for test_noprivs; - - revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; - grant SUPER on *.* to test_yesprivs@localhost; - grant UPDATE on priv_db.t1 to test_yesprivs@localhost; - show grants for test_yesprivs@localhost; - - --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK - connect (no_privs_424c,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); - --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK - connect (yes_privs_424c,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); - connection default; - - connection no_privs_424c; - show grants; - use priv_db; - -let $message= Trigger create disabled - should fail - Bug 8884; ---source include/show_msg.inc -# --error 1227 -# create trigger trg4c_1 before INSERT on t1 for each row -# set new.f1 = 'trig 3.5.3.7-1c'; - - connection default; - insert into t1 (f1) values ('insert 3.5.3.7-1c'); - select f1 from t1; - --error 0, 1360 - drop trigger trg4c_1; - - connection yes_privs_424c; - show grants; - use priv_db; - create trigger trg4c_2 before INSERT on t1 for each row - set new.f1 = 'trig 3.5.3.7-2c'; - - connection default; - insert into t1 (f1) values ('insert 3.5.3.7-2c'); - select f1 from t1; - -# Cleanup - --disable_warnings - drop trigger trg4c_2; - disconnect no_privs_424c; - disconnect yes_privs_424c; - --enable_warnings - -# --- 3.5.3.7d - Privs set on a column level ---disable_query_log -let $message= Testcase 3.5.3.7d:; ---enable_query_log ---source include/show_msg.inc - - revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost; - grant SUPER on *.* to test_noprivs@localhost; -# There is no ALL privs on the column level - grant SELECT (f1), INSERT (f1) on priv_db.t1 to test_noprivs@localhost; - show grants for test_noprivs; - - revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; - grant SUPER on *.* to test_yesprivs@localhost; - grant UPDATE (f1) on priv_db.t1 to test_yesprivs@localhost; - show grants for test_noprivs; - - --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK - connect (no_privs_424d,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); - --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK - connect (yes_privs_424d,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); - connection default; - - connection no_privs_424d; - show grants; - use priv_db; -let $message= Trigger create disabled - should fail - Bug 8884; ---source include/show_msg.inc -# --error 1227 -# create trigger trg4d_1 before INSERT on t1 for each row -# set new.f1 = 'trig 3.5.3.7-1d'; - - connection default; - insert into t1 (f1) values ('insert 3.5.3.7-1d'); - select f1 from t1; - --error 0, 1360 - drop trigger trg4d_1; - - connection yes_privs_424d; - show grants; - use priv_db; - create trigger trg4d_2 before INSERT on t1 for each row - set new.f1 = 'trig 3.5.3.7-2d'; - - connection default; - insert into t1 (f1) values ('insert 3.5.3.7-2d'); - select f1 from t1; - -# Cleanup - --disable_warnings - drop trigger trg4d_2; - disconnect no_privs_424d; - disconnect yes_privs_424d; - --enable_warnings - -#Section 3.5.3.8 -# Test case: Ensure that use of the construct "SET <target> = NEW. <Column name>" fails -# at CREATE TRIGGER time, if the current user does not have the SELECT privilege -# on the column specified. - -# --- 3.5.3.8a - Privs set on a global level -let $message= Testcase 3.5.3.8a:; ---source include/show_msg.inc - - revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost; - grant ALL on *.* to test_noprivs@localhost; - revoke SELECT on *.* from test_noprivs@localhost; - show grants for test_noprivs@localhost; - - revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; - grant SUPER, SELECT on *.* to test_yesprivs@localhost; - show grants for test_yesprivs@localhost; - - --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK - connect (no_privs_425a,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); - --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK - connect (yes_privs_425a,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); - connection default; - - connection no_privs_425a; - select current_user; - use priv_db; - show grants; - -let $message= Trigger create disabled - should fail - Bug 8887; ---source include/show_msg.inc -# --error 1227 -# create trigger trg5a_1 before INSERT on t1 for each row -# set @test_var = new.f1; - - connection default; - set @test_var = 'before trig 3.5.3.8-1a'; - select @test_var; - insert into t1 (f1) values ('insert 3.5.3.8-1a'); - select @test_var; - --error 0, 1360 - drop trigger trg5a_1; - - connection yes_privs_425a; - use priv_db; - select current_user; - show grants; - create trigger trg5a_2 before INSERT on t1 for each row - set @test_var= new.f1; - - connection default; - set @test_var= 'before trig 3.5.3.8-2a'; - select @test_var; - insert into t1 (f1) values ('insert 3.5.3.8-2a'); - select @test_var; - -# Cleanup - --disable_warnings - drop trigger trg5a_2; - disconnect no_privs_425a; - disconnect yes_privs_425a; - --enable_warnings - -# --- 3.5.3.8b - Privs set on a database level -let $message= Testcase: 3.5.3.8b; ---source include/show_msg.inc - - revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost; - grant SUPER on *.* to test_noprivs@localhost; - grant ALL on priv_db.* to test_noprivs@localhost; - revoke SELECT on priv_db.* from test_noprivs@localhost; - show grants for test_noprivs@localhost; - - revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; - grant SUPER on *.* to test_yesprivs@localhost; - grant SELECT on priv_db.* to test_yesprivs@localhost; - show grants for test_yesprivs@localhost; - - --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK - connect (no_privs_425b,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); - --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK - connect (yes_privs_425b,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); - connection default; - - connection no_privs_425b; - show grants; - use priv_db; - -let $message= Trigger create disabled - should fail - Bug 8887; ---source include/show_msg.inc -# --error 1227 -# create trigger trg5b_1 before UPDATE on t1 for each row -# set @test_var= new.f1; - - connection default; - set @test_var= 'before trig 3.5.3.8-1b'; - insert into t1 (f1) values ('insert 3.5.3.8-1b'); - select @test_var; - update t1 set f1= 'update 3.5.3.8-1b' where f1 = 'insert 3.5.3.8-1b'; - select @test_var; - --error 0, 1360 - drop trigger trg5b_1; - - connection yes_privs_425b; - show grants; - use priv_db; - create trigger trg5b_2 before UPDATE on t1 for each row - set @test_var= new.f1; - - connection default; - set @test_var= 'before trig 3.5.3.8-2b'; - insert into t1 (f1) values ('insert 3.5.3.8-2b'); - select @test_var; - update t1 set f1= 'update 3.5.3.8-2b' where f1 = 'insert 3.5.3.8-2b'; - select @test_var; -# Cleanup - --disable_warnings - drop trigger trg5b_2; - disconnect no_privs_425b; - disconnect yes_privs_425b; - --enable_warnings - -# --- 3.5.3.8c - Privs set on a table level -let $message= Testcase 3.5.3.8c:; ---source include/show_msg.inc - - revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost; - grant SUPER on *.* to test_noprivs@localhost; - grant ALL on priv_db.t1 to test_noprivs@localhost; - revoke SELECT on priv_db.t1 from test_noprivs@localhost; - show grants for test_noprivs@localhost; - - revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; - grant SUPER on *.* to test_yesprivs@localhost; - grant SELECT on priv_db.t1 to test_yesprivs@localhost; - show grants for test_yesprivs@localhost; - - --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK - connect (no_privs_425c,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); - --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK - connect (yes_privs_425c,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); - connection default; - - connection no_privs_425c; - show grants; - use priv_db; - -let $message= Trigger create disabled - should fail - Bug 8887; ---source include/show_msg.inc -# --error 1227 -# create trigger trg5c_1 before INSERT on t1 for each row -# set @test_var= new.f1; - - connection default; - set @test_var= 'before trig 3.5.3.8-1c'; - insert into t1 (f1) values ('insert 3.5.3.8-1c'); - select @test_var; - --error 0, 1360 - drop trigger trg5c_1; - - connection yes_privs_425c; - show grants; - use priv_db; - create trigger trg5c_2 before INSERT on t1 for each row - set @test_var= new.f1; - - connection default; - set @test_var='before trig 3.5.3.8-2c'; - insert into t1 (f1) values ('insert 3.5.3.8-2c'); - select @test_var; -# Cleanup - --disable_warnings - drop trigger trg5c_2; - disconnect no_privs_425c; - disconnect yes_privs_425c; - --enable_warnings - -# --- 3.5.3.8d - Privs set on a column level -let $message=Testcase: 3.5.3.8d:; ---source include/show_msg.inc - - revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost; - grant SUPER on *.* to test_noprivs@localhost; -# There is no ALL prov on the column level - grant UPDATE (f1), INSERT (f1) on priv_db.t1 to test_noprivs@localhost; - show grants for test_noprivs@localhost; - - revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; - grant SUPER on *.* to test_yesprivs@localhost; - grant SELECT (f1) on priv_db.t1 to test_yesprivs@localhost; - show grants for test_noprivs@localhost; - - --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK - connect (no_privs_425d,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); - --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK - connect (yes_privs_425d,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); - connection default; - - connection no_privs_425d; - show grants; - use priv_db; -let $message= Trigger create disabled - should fail - Bug 8887; ---source include/show_msg.inc -# --error 1227 -# create trigger trg5d_1 before INSERT on t1 for each row -# set @test_var= new.f1; - - connection default; - set @test_var='before trig 3.5.3.8-1d'; - insert into t1 (f1) values ('insert 3.5.3.8-1d'); - select @test_var; - --error 0, 1360 - drop trigger trg5d_1; - - connection yes_privs_425d; - show grants; - use priv_db; - create trigger trg5d_2 before INSERT on t1 for each row - set @test_var= new.f1; - - connection default; - set @test_var='before trig 3.5.3.8-2d'; - insert into t1 (f1) values ('insert 3.5.3.8-2d'); - select @test_var; - -# Cleanup 3.5.3.8 - --disable_warnings - drop trigger trg5d_2; - --enable_warnings - -# Cleanup 3.5.3 - --disable_warnings - drop database if exists priv_db; - drop user test_yesprivs@localhost; - drop user test_noprivs@localhost; - drop user test_noprivs; - --enable_warnings - -#################################### -############ Section 3.5.4 ######### -# Drop Trigger Checkes: # -#################################### -let $message= Testcase 3.5.4:; ---source include/show_msg.inc - - connection default; - use test; - -#Section 3.5.4.1 -# Testcase: Ensure that the DROP TRIGGER statement cleanly drops its target trigger. -let $message= Testcase 3.5.4.1:; ---source include/show_msg.inc - - connection con_super; - create database db_drop; - Use db_drop; - eval create table t1 (f1 char(30)) engine=$engine_type; - grant INSERT, SELECT on db_drop.t1 to test_general; - Use db_drop; - Create trigger trg1 BEFORE INSERT on t1 - for each row set new.f1='Trigger 3.5.4.1'; - connection con_general; - Use db_drop; - Insert into t1 values ('Insert error 3.5.4.1'); - Select * from t1; - connection con_super; - drop trigger trg1; - select trigger_schema, trigger_name, event_object_table - from information_schema.triggers; - connection con_general; - Insert into t1 values ('Insert no trigger 3.5.4.1'); - Select * from t1; - -#Cleanup - --disable_warnings - connection con_super; - --disable_warnings - --error 0,1360 - drop trigger trg1; - drop database if exists db_drop; - revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost'; - --enable_warnings - -#Section 3.5.4.2 -# Test case: Ensure that DROP TRIGGER <trigger name> fails, with an appropriate error -# message, if the trigger name does not exist. -let $message= Testcase 3.5.4.2:; ---source include/show_msg.inc - - connection con_super; - create database db_drop2; - Use db_drop2; - --disable_warnings - drop table if exists t1_432 ; - --enable_warnings - eval create table t1_432 (f1 char (30)) engine=$engine_type; - --error 1360 - Drop trigger tr_does_not_exit; -#cleanup - --disable_warnings - drop table if exists t1_432 ; - drop database if exists db_drop2; - --enable_warnings - -#Section 3.5.4.3 -# Test case: Ensure that DROP TRIGGER <trigger name> fails, with an appropriate -# error message, if <trigger name> is not a qualified name. -let $message= Testcase 3.5.4.3:; ---source include/show_msg.inc - - connection con_super; - create database db_drop3; - Use db_drop3; - --disable_warnings - drop table if exists t1_433 ; - drop table if exists t1_433a ; - --enable_warnings - eval create table t1_433 (f1 char (30)) engine=$engine_type; - eval create table t1_433a (f1a char (5)) engine=$engine_type; - - CREATE TRIGGER trg3 BEFORE INSERT on t1_433 for each row - set new.f1 = 'Trigger 3.5.4.3'; - -# Using table - --error 1064 - Drop trigger t1.433.trg3; - -# Using database.table - --error 1064 - Drop trigger db_drop3.t1.433.trg3; - -# wrong database - --error 1360 - Drop trigger mysql.trg3; - -# database does not exist - --error 1360 - Drop trigger tbx.trg3; - -#cleanup - Drop trigger db_drop3.trg3; - drop table if exists t1_433; - drop table if exists t1_433a; - drop database if exists db_drop3; - -#Section 3.5.4.4 -# Test case: Ensure that when a database is dropped, all triggers created within -# that database are also cleanly dropped. -let $message= Testcase 3.5.4.4:; ---source include/show_msg.inc - - connection con_super; - create database db_drop4; - Use db_drop4; - eval create table t1 (f1 char(30)) engine=$engine_type; - grant INSERT, SELECT on db_drop4.t1 to test_general; - Create trigger trg4 BEFORE INSERT on t1 - for each row set new.f1='Trigger 3.5.4.4'; - connection con_general; - Use db_drop4; - Insert into t1 values ('Insert 3.5.4.4'); - Select * from t1; - connection con_super; - Drop database db_drop4; - Show databases; - select trigger_schema, trigger_name, event_object_table - from information_schema.triggers - where information_schema.triggers.trigger_name='trg4'; - create database db_drop4; - Use db_drop4; - eval create table t1 (f1 char(30)) engine=$engine_type; - grant INSERT, SELECT on db_drop4.t1 to test_general; - connection con_general; - Insert into t1 values ('2nd Insert 3.5.4.4'); - Select * from t1; - -#Cleanup - connection con_super; - --disable_warnings - --error 1360 - drop trigger trg4; - drop database if exists db_drop4; - --enable_warnings - revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost'; - -#Section 3.5.4.5 -# Test case: Ensure that when a table is dropped, all triggers for which it is the -# subject table are also cleanly dropped. -let $message= Testcase 3.5.4.5:; ---source include/show_msg.inc - - connection con_super; - create database db_drop5; - Use db_drop5; - eval create table t1 (f1 char(50)) engine=$engine_type; - grant INSERT, SELECT on t1 to test_general; - Create trigger trg5 BEFORE INSERT on t1 - for each row set new.f1='Trigger 3.5.4.5'; - connection con_general; - Use db_drop5; - Insert into t1 values ('Insert 3.5.4.5'); - Select * from t1; - connection con_super; - Drop table t1; - Show tables; - select trigger_schema, trigger_name, event_object_table - from information_schema.triggers - where information_schema.triggers.trigger_name='trg5'; - eval create table t1 (f1 char(50)) engine=$engine_type; - grant INSERT, SELECT on t1 to test_general; - connection con_general; - Insert into t1 values ('2nd Insert 3.5.4.5'); - Select * from t1; - -#Cleanup - connection con_super; - --disable_warnings - --error 1360 - drop trigger trg5; - drop database if exists db_drop5; - --enable_warnings - revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost'; - - -################################## -######### Section 3.5.5 ########## -# Checks on the Subject Table # -################################## - -let $message= Testcase 3.5.5:; ---source include/show_msg.inc - - connection default; - use test; - -#Section 3.5.5.1 -# Test case: Ensure that, if CREATE TRIGGER is executed with a non-existent -# subject table, the statement fails with an appropriate error message. -let $message= Testcase 3.5.5.1:; ---source include/show_msg.inc - - --error 1146 - Create trigger trg1 before INSERT on t100 for each row set new.f2=1000; - - -#Section 3.5.5.2 -# Test case: Ensure that, if CREATE TRIGGER is executed with a temporary table -# as the subject table, the statement fails with an appropriate error message. -let $message= Testcase 3.5.5.2:; ---source include/show_msg.inc - - Create temporary table t1_temp (f1 bigint signed, f2 bigint unsigned); - - --error 1361 - Create trigger trg2 before INSERT - on t1_temp for each row set new.f2=9999; - -#Cleanup - --disable_warnings - drop table t1_temp; - --enable_warnings - - -#Section 3.5.5.3 -# Test case: Ensure that, if CREATE TRIGGER is executed with a view as the subject -# table, the statement fails with an appropriate error message. -let $message= Testcase 3.5.5.3:; ---source include/show_msg.inc - - Create view vw3 as select f118 from tb3; - -# OBN Not sure why the server is returning error 1347 - --error 1347 - Create trigger trg3 before INSERT - on vw3 for each row set new.f118='s'; - -#Cleanup - --disable_warnings - drop view vw3; - --enable_warnings - - -#Section 3.5.5.4 -# Test case: Ensure that, if CREATE TRIGGER is executed with a table that resides -# in a different database than in which the trigger will reside, the -# statement fails with an appropriate error message; that is, ensure that -# the trigger and its subject table must reside in the same database. -let $message= Testcase 3.5.5.4:; ---source include/show_msg.inc - - connection con_super; - create database dbtest_one; - create database dbtest_two; - use dbtest_two; - create table t2 (f1 char(15)); - use dbtest_one; - --error 1435 - create trigger trg4 before INSERT - on dbtest_two.t2 for each row set new.f1='trig 3.5.5.4'; - grant INSERT, SELECT on dbtest_two.t2 to test_general; - grant SELECT on dbtest_one.* to test_general; - connection con_general; - use dbtest_two; - Insert into t2 values ('1st Insert 3.5.5.4'); - Select * from t2; - use dbtest_one; - Insert into dbtest_two.t2 values ('2nd Insert 3.5.5.4'); - Select * from dbtest_two.t2; - -#Cleanup - connection con_super; - --disable_warnings - revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost'; - DROP DATABASE if exists dbtest_one; - drop database if EXISTS dbtest_two; - --enable_warnings - -##################################### -########### Section 3.5.6 ########### -# Check on the Trigger Action Time # -##################################### - -let $message= Testcase 3.5.6:; ---source include/show_msg.inc - - connection default; - use test; - -#Section 3.5.6.1 -# Test case: Ensure that a trigger definition can specify a trigger action time of BEFORE. -# See section 3.5.1.1 -let $message= Testcase 3.5.6.1 (see Testcase 3.5.1.1); ---source include/show_msg.inc - -#Section 3.5.6.2 -# Test case: Ensure that a trigger definition can specify a trigger action time of AFTER. -# See section 3.5.1.1 -let $message= Testcase 3.5.6.2 (see Testcase 3.5.1.1); ---source include/show_msg.inc - -#Section 3.5.6.3 -# Test case: Ensure that a trigger definition that specifies a trigger action -# time that is not either BEFORE or AFTER fails, with an appropriate -# error message, at CREATE TRIGGER time. -let $message= Testcase 3.5.6.3:; ---source include/show_msg.inc - - --error 1064 - Create trigger trg3_1 DURING UPDATE on tb3 for each row set new.f132=25; - --error 1064 - Create trigger trg3_2 TIME INSERT on tb3 for each row set new.f132=15; - -#Cleanup -# OBN - Although none of the above should have been created we should do a cleanup -# since if they have been created, not dropping them will affect following -# tests. - --disable_warnings - --error 0, 1360 - drop trigger tb3.trg3_1; - --error 0, 1360 - drop trigger tb3.trg3_2; - --enable_warnings - -#Section 3.5.6.4 -# Test case: Ensure that a trigger defined with a trigger action time of BEFORE -# always executes its triggered action immediately before the trigger event. -# See section 3.5.1.1 -let $message= Testcase 3.5.6.4 (see Testcase 3.5.1.1); ---source include/show_msg.inc - -#Section 3.5.6.5 -# Test case: Ensure that a trigger defined with a trigger action time of AFTER -# always executes its triggered action immediately after the trigger event. -let $message= Testcase 3.5.6.5 (see Testcase 3.5.1.1); ---source include/show_msg.inc - -############################# -####### Section 3.5.7 ####### -# Check on Trigger Event # -############################# - -#Section 3.5.7.1 -#Test case: Ensure that a trigger definition can specify a trigger event of INSERT. -let $message= Testcase 3.5.7.1 (see Testcase 3.5.1.1); ---source include/show_msg.inc - -#Section 3.5.7.2 -# Test case: Ensure that a trigger definition can specify a trigger event of UPDATE. -let $message= Testcase 3.5.7.2 (see Testcase 3.5.1.1); ---source include/show_msg.inc - -#Section 3.5.7.3 -# Test case: Ensure that a trigger definition can specify a trigger event of DELETE. -let $message= Testcase 3.5.7.3 (see Testcase 3.5.1.1); ---source include/show_msg.inc - -#Section 3.5.7.4 -# Test case: Ensure that a trigger definition that specifies a trigger event that -# is not either INSERT, UPDATE or DELETE fails, with an appropriate error -# message, at CREATE TRIGGER time. -let $message= Testcase 3.5.7.4:; ---source include/show_msg.inc - - --error 1064 - Create trigger trg4_1 BEFORE SELECT on tb3 for each row set new.f132=5; - --error 1064 - Create trigger trg4_2 AFTER VALUE on tb3 for each row set new.f132=1; - -#Cleanup -# OBN - Although none of the above should have been created we should do a cleanup -# since if they have been created, not dropping them will affect following -# tests. - --disable_warnings - --error 0, 1360 - drop trigger tb3.trg4_1; - --error 0, 1360 - drop trigger tb3.trg4_2; - --enable_warnings - -#Section 3.5.7.5 / 3.5.7.6 -# Test case: Ensure that it is not possible to create multiple BEFORE INSERT triggers -# on the same table, even if the triggers have different names / different -# triggered actions. -let $message= Testcase 3.5.7.5 / 3.5.7.6:; ---source include/show_msg.inc - - Create trigger trg5_1 BEFORE INSERT - on tb3 for each row set new.f122='Trigger1 3.5.7.5/6'; - - --error 1359 - Create trigger trg5_2 BEFORE INSERT - on tb3 for each row set new.f122='Trigger2 3.5.7.5'; - - Insert into tb3 (f121,f122) values ('Test 3.5.7.5/6','Insert 3.5.7.5'); - Select f121,f122 from tb3 where f121='Test 3.5.7.5/6'; - update tb3 set f122='Update 3.5.7.6' where f121= 'Test 3.5.7.5/6'; - Select f121,f122 from tb3 where f121='Test 3.5.7.5/6'; - -#Cleanup - --disable_warnings - drop trigger trg5_1; - --error 0, 1360 - drop trigger trg5_2; - delete from tb3 where f121='Test 3.5.7.5/6'; - --enable_warnings - - -#Section 3.5.7.7 / 3.5.7.8 -# Test case: Ensure that it is not possible to create multiple AFTER INSERT triggers -# on the same table, even if the triggers have different names / different -# triggered actions. -let $message= Testcase 3.5.7.7 / 3.5.7.8:; ---source include/show_msg.inc - - set @test_var='Before trig 3.5.7.7'; - Create trigger trg6_1 AFTER INSERT - on tb3 for each row set @test_var='Trigger1 3.5.7.7/8'; - - --error 1359 - Create trigger trg6_2 AFTER INSERT - on tb3 for each row set @test_var='Trigger2 3.5.7.7'; - - select @test_var; - Insert into tb3 (f121,f122) values ('Test 3.5.7.7/8','Insert 3.5.7.7'); - Select f121,f122 from tb3 where f121='Test 3.5.7.7/8'; - select @test_var; - update tb3 set f122='Update 3.5.7.8' where f121= 'Test 3.5.7.7/8'; - Select f121,f122 from tb3 where f121='Test 3.5.7.7/8'; - select @test_var; - -#Cleanup - --disable_warnings - drop trigger trg6_1; - --error 0, 1360 - drop trigger trg6_2; - delete from tb3 where f121='Test 3.5.7.7/8'; - --enable_warnings - - -#Section 3.5.7.9 / 3.5.7.10 -# Test case: Ensure that it is not possible to create multiple BEFORE UPDATE triggers -# on the same table, even if the triggers have different names / different -# triggered actions. -let $message= Testcase 3.5.7.9/10:; ---source include/show_msg.inc - - Create trigger trg7_1 BEFORE UPDATE - on tb3 for each row set new.f122='Trigger1 3.5.7.9/10'; - - --error 1359 - Create trigger trg7_2 BEFORE UPDATE - on tb3 for each row set new.f122='Trigger2 3.5.7.9'; - - Insert into tb3 (f121,f122) values ('Test 3.5.7.9/10','Insert 3.5.7.9'); - Select f121,f122 from tb3 where f121='Test 3.5.7.9/10'; - update tb3 set f122='update 3.5.7.10' where f121='Test 3.5.7.9/10'; - Select f121,f122 from tb3 where f121='Test 3.5.7.9/10'; - -#Cleanup - --disable_warnings - drop trigger trg7_1; - --error 0, 1360 - drop trigger trg7_2; - delete from tb3 where f121='Test 3.5.7.9/10'; - -#Section 3.5.7.11 / 3.5.7.12 -# Test case: Ensure that it is not possible to create multiple AFTER UPDATE triggers -# on the same table, even if the triggers have different names / different -# triggered actions. -let $message= Testcase 3.5.7.11/12:; ---source include/show_msg.inc - - set @test_var='Before trig 3.5.7.11'; - Create trigger trg8_1 AFTER UPDATE - on tb3 for each row set @test_var='Trigger 3.5.7.11/12'; - - --error 1359 - Create trigger trg8_2 AFTER UPDATE - on tb3 for each row set @test_var='Trigger2 3.5.7.11'; - - - select @test_var; - Insert into tb3 (f121,f122) values ('Test 3.5.7.11/12','Insert 3.5.7.11/12'); - select @test_var; - Select f121,f122 from tb3 where f121='Test 3.5.7.11/12'; - update tb3 set f122='update 3.5.7.12' where f121='Test 3.5.7.11/12'; - Select f121,f122 from tb3 where f121='Test 3.5.7.11/12'; - select @test_var; - delete from tb3 where f121='Test 3.5.7.11/12'; - -#Cleanup - --disable_warnings - drop trigger trg8_1; - --error 0, 1360 - drop trigger trg8_2; - delete from tb3 where f121='Test 3.5.7.11/12'; - -#Section 3.5.7.13 / 3.5.7.14 -# Test case: Ensure that it is not possible to create multiple BEFORE DELETE triggers -# on the same table, even if the triggers have different names / different -# triggered actions. -let $message= Testcase 3.5.7.13/14:; ---source include/show_msg.inc - - set @test_var=1; - Create trigger trg9_1 BEFORE DELETE - on tb3 for each row set @test_var=@test_var+1; - - --error 1359 - Create trigger trg9_2 BEFORE DELETE - on tb3 for each row set @test_var=@test_var+10; - - select @test_var; - Insert into tb3 (f121,f122) values ('Test 3.5.7.13/14','Insert 3.5.7.13'); - Select f121,f122 from tb3 where f121='Test 3.5.7.13/14'; - select @test_var; - delete from tb3 where f121='Test 3.5.7.13/14'; - Select f121,f122 from tb3 where f121='Test 3.5.7.13/14'; - select @test_var; - delete from tb3 where f121='Test 3.5.7.13/14'; - select @test_var; - -#Cleanup - --disable_warnings - drop trigger trg9_1; - --error 0, 1360 - drop trigger trg9_2; - delete from tb3 where f121='Test 3.5.7.13/14'; - -#Section 3.5.7.15 / 3.5.7.16 -# Test case: Ensure that it is not possible to create multiple AFTER DELETE triggers -# on the same table, even if the triggers have different names / different -# triggered actions. -let $message= Testcase 3.5.7.15/16:; ---source include/show_msg.inc - - set @test_var=1; - Create trigger trg_3_406010_1 AFTER DELETE - on tb3 for each row set @test_var=@test_var+5; - - --error 1359 - Create trigger trg_3_406010_2 AFTER DELETE - on tb3 for each row set @test_var=@test_var+50; - - --error 1359 - Create trigger trg_3_406010_1 AFTER INSERT - on tb3 for each row set @test_var=@test_var+1; - - select @test_var; - Insert into tb3 (f121,f122) values ('Test 3.5.7.15/16','Insert 3.5.7.15/16'); - Select f121,f122 from tb3 where f121='Test 3.5.7.15/16'; - select @test_var; - delete from tb3 where f121='Test 3.5.7.15/16'; - Select f121,f122 from tb3 where f121='Test 3.5.7.15/16'; - select @test_var; - delete from tb3 where f121='Test 3.5.7.15/16'; - select @test_var; - -#Cleanup - --disable_warnings - drop trigger trg_3_406010_1; - --error 0, 1360 - drop trigger trg_3_406010_2; - delete from tb3 where f121='Test 3.5.7.15/16'; - --enable_warnings - - -#Section 3.5.7.17 -# Test case: Ensure that it is possible to have a BEFORE INSERT, an AFTER INSERT, -# a BEFORE UPDATE, an AFTER UPDATE, a BEFORE DELETE, and an AFTER DELETE -# trigger on the same table; that is, ensure that every persistent base -# table may be the subject table for exactly six triggers -let $message= Testcase 3.5.7.17 (see Testcase 3.5.1.1); ---source include/show_msg.inc - - -################################# -####### Section 3.5.8 ########### -# Checks on Triggered Actions # -################################# - -#Section 3.5.8.1 -# Testcase: Ensure that the triggered action of every trigger always executes -# correctly and the results in all expected changes made to the database -let $message= Testcase 3.5.8.1: (implied in previous tests); ---source include/show_msg.inc -# OBN - FIXME - Missing 3.5.8.1 need to add - -#Section 3.5.8.2 -# Testcase: Ensure that the triggered actions of every trigger never results -# in an unexpected change made to the database. -let $message= Testcase 3.5.8.2: (implied in previous tests); ---source include/show_msg.inc - - -#Section 3.5.8.3 / 3.5.8.4 -#Test case: Ensure that the triggered action can any valid SQL statement / set -# of valid SQL statements, provided the statements are written within -# a BEGIN/END compound statement construct -# OBN - At this point the tests focuses on the the INSERT/UPDATE/DELETE SQL statements -# as there are the most likely to be used in triggers -let $message= Testcase 3.5.8.3/4:; ---source include/show_msg.inc - -# creating test tables to perform the trigger SQL on - connection con_super; - create database db_test; - grant SELECT, INSERT, UPDATE, DELETE on db_test.* to test_general; - grant LOCK TABLES on db_test.* to test_general; - Use db_test; - eval create table t1_i ( - i120 char ascii not null DEFAULT b'101', - i136 smallint zerofill not null DEFAULT 999, - i144 int zerofill not null DEFAULT 99999, - i163 decimal (63,30)) engine=$engine_type; - eval create table t1_u ( - u120 char ascii not null DEFAULT b'101', - u136 smallint zerofill not null DEFAULT 999, - u144 int zerofill not null DEFAULT 99999, - u163 decimal (63,30)) engine=$engine_type; - eval create table t1_d ( - d120 char ascii not null DEFAULT b'101', - d136 smallint zerofill not null DEFAULT 999, - d144 int zerofill not null DEFAULT 99999, - d163 decimal (63,30)) engine=$engine_type; - Insert into t1_u values ('a',111,99999,999.99); - Insert into t1_u values ('b',222,99999,999.99); - Insert into t1_u values ('c',333,99999,999.99); - Insert into t1_u values ('d',222,99999,999.99); - Insert into t1_u values ('e',222,99999,999.99); - Insert into t1_u values ('f',333,99999,999.99); - Insert into t1_d values ('a',111,99999,999.99); - Insert into t1_d values ('b',222,99999,999.99); - Insert into t1_d values ('c',333,99999,999.99); - Insert into t1_d values ('d',444,99999,999.99); - Insert into t1_d values ('e',222,99999,999.99); - Insert into t1_d values ('f',222,99999,999.99); - -let $message= 3.5.8.4 - multiple SQL; ---source include/show_msg.inc -# Trigger definition - multiple SQL - use test; - delimiter //; - Create trigger trg1 AFTER INSERT on tb3 for each row - BEGIN - insert into db_test.t1_i - values (new.f120, new.f136, new.f144, new.f163); - update db_test.t1_u - set u144=new.f144, u163=new.f163 - where u136=new.f136; - delete from db_test.t1_d where d136= new.f136; - select sum(db_test.t1_u.u163) into @test_var from db_test.t1_u - where u136= new.f136; - END// - delimiter ;// - -# Test trigger execution - multiple SQL - connection con_general; - Use test; - set @test_var=0; - Insert into tb3 (f120, f122, f136, f144, f163) - values ('1', 'Test 3.5.8.4', 222, 23456, 1.05); - Select f120, f122, f136, f144, f163 from tb3 where f122= 'Test 3.5.8.4'; - select * from db_test.t1_i; - select * from db_test.t1_u; - select * from db_test.t1_d; - select @test_var; - - -let $message= 3.5.8.4 - single SQL - insert; ---source include/show_msg.inc -# Trigger definition - single SQL Insert - connection con_super; - Create trigger trg2 BEFORE UPDATE on tb3 for each row - insert into db_test.t1_i - values (new.f120, new.f136, new.f144, new.f163); - -# Trigger exeution - single SQL Insert - connection con_general; - update tb3 set f120='I', f122='Test 3.5.8.4-Single Insert' - where f122='Test 3.5.8.4'; - Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; - select * from db_test.t1_i; - - -let $message= 3.5.8.4 - single SQL - update; ---source include/show_msg.inc -# Trigger definition - single SQL update - connection con_super; - drop trigger trg2; - Create trigger trg3 BEFORE UPDATE on tb3 for each row - update db_test.t1_u - set u120=new.f120 - where u136=new.f136; - -# Trigger exeution - single SQL - update; - connection con_general; - update tb3 set f120='U', f122='Test 3.5.8.4-Single Update' - where f122='Test 3.5.8.4-Single Insert'; - Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; - select * from db_test.t1_u; - - -let $message= 3.5.8.3/4 - single SQL - delete; ---source include/show_msg.inc -# Trigger definition - single SQL delete - connection con_super; - drop trigger trg3; - Create trigger trg4 AFTER UPDATE on tb3 for each row - delete from db_test.t1_d where d136= new.f136; - -# Trigger exeution - single SQL delete - connection con_general; -#lock tables tb3 write, db_test.t1_i write, db_test.t1_u write, db_test.t1_d write; - update tb3 set f120='D', f136=444, - f122='Test 3.5.8.4-Single Delete' - where f122='Test 3.5.8.4-Single Update'; -#unlock tables; - Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; - select * from db_test.t1_d; - - -let $message= 3.5.8.3/4 - single SQL - select; ---source include/show_msg.inc -# Trigger definition - single SQL select - connection con_super; - drop trigger trg4; - Create trigger trg5 AFTER UPDATE on tb3 for each row - select sum(db_test.t1_u.u163) into @test_var from db_test.t1_u - where u136= new.f136; - -# Trigger exeution - single SQL select - connection con_general; - set @test_var=0; - update tb3 set f120='S', f136=111, - f122='Test 3.5.8.4-Single Select' - where f122='Test 3.5.8.4-Single Delete'; - Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; - select @test_var; - -#Cleanup - connection default; - --disable_warnings - drop trigger trg1; - drop trigger trg5; - drop database if exists db_test; - delete from tb3 where f122 like 'Test 3.5.8.4%'; - revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost'; - --enable_warnings - - -#Section 3.5.8.5 (IF) -# Test case: Ensure that the stored procedure-specific flow control statement like IF -# works correctly when it is a part of the triggered action portion of a -# trigger definition. -let $message= Testcase 3.5.8.5 (IF):; ---source include/show_msg.inc - - delimiter //; - create trigger trg2 before insert on tb3 for each row - BEGIN - IF new.f120='1' then - set @test_var='one', new.f120='2'; - ELSEIF new.f120='2' then - set @test_var='two', new.f120='3'; - ELSEIF new.f120='3' then - set @test_var='three', new.f120='4'; - END IF; - - IF (new.f120='4') and (new.f136=10) then - set @test_var2='2nd if', new.f120='d'; - ELSE - set @test_var2='2nd else', new.f120='D'; - END IF; - END// - delimiter ;// - - set @test_var='Empty', @test_var2=0; - Insert into tb3 (f120, f122, f136) values ('1', 'Test 3.5.8.5-if', 101); - select f120, f122, f136, @test_var, @test_var2 - from tb3 where f122 = 'Test 3.5.8.5-if'; - Insert into tb3 (f120, f122, f136) values ('2', 'Test 3.5.8.5-if', 102); - select f120, f122, f136, @test_var, @test_var2 - from tb3 where f122 = 'Test 3.5.8.5-if'; - Insert into tb3 (f120, f122, f136) values ('3', 'Test 3.5.8.5-if', 10); - select f120, f122, f136, @test_var, @test_var2 - from tb3 where f122 = 'Test 3.5.8.5-if'; - Insert into tb3 (f120, f122, f136) values ('3', 'Test 3.5.8.5-if', 103); - select f120, f122, f136, @test_var, @test_var2 - from tb3 where f122 = 'Test 3.5.8.5-if'; - - delimiter //; - --error 1064 - create trigger trg3 before update on tb3 for each row - BEGIN - ELSEIF new.f120='2' then - END IF; - END// - --error 0, 1360 - drop trigger trg3// - - --error 1064 - create trigger trg4 before update on tb3 for each row - BEGIN - IF (new.f120='4') and (new.f136=10) then - set @test_var2='2nd if', new.f120='d'; - ELSE - set @test_var2='2nd else', new.f120='D'; - END// - delimiter ;// - --error 0, 1360 - drop trigger trg4; - -#Cleanup - --disable_warnings - drop trigger trg2; - delete from tb3 where f121='Test 3.5.8.5-if'; - --enable_warnings - - -#Section 3.5.8.5 (CASE) -# Test case: Ensure that the stored procedure-specific flow control statement -# like CASE works correctly when it is a part of the triggered action -# portion of a trigger definition. -let $message= Testcase 3.5.8.5-case:; ---source include/show_msg.inc - - delimiter //; - create trigger trg3 before insert on tb3 for each row - BEGIN - SET new.f120=char(ascii(new.f120)-32); - CASE - when new.f136<100 then set new.f136=new.f136+120; - when new.f136<10 then set new.f144=777; - when new.f136>100 then set new.f120=new.f136-1; - END case; - CASE - when new.f136=200 then set @test_var=CONCAT(new.f120, '='); - ELSE set @test_var=concat(new.f120, '*'); - END case; - CASE new.f144 - when 1 then set @test_var=concat(@test_var, 'one'); - when 2 then set @test_var=concat(@test_var, 'two'); - when 3 then set @test_var=concat(@test_var, 'three'); - when 4 then set @test_var=concat(@test_var, 'four'); - when 5 then set @test_var=concat(@test_var, 'five'); - when 6 then set @test_var=concat(@test_var, 'six'); - when 7 then set @test_var=concat(@test_var, 'seven'); - when 8 then set @test_var=concat(@test_var, 'eight'); - when 9 then set @test_var=concat(@test_var, 'nine'); - when 10 then set @test_var=concat(@test_var, 'ten'); - when 11 then set @test_var=concat(@test_var, 'eleven'); - when 12 then set @test_var=concat(@test_var, 'twelve'); - when 13 then set @test_var=concat(@test_var, 'thirteen'); - when 14 then set @test_var=concat(@test_var, 'fourteen'); - when 15 then set @test_var=concat(@test_var, 'fifteen'); - ELSE set @test_var=CONCAT(new.f120, '*', new.f144); - END case; - END// - delimiter ;// - - set @test_var='Empty'; - Insert into tb3 (f120, f122, f136, f144) - values ('a', 'Test 3.5.8.5-case', 5, 7); - select f120, f122, f136, f144, @test_var - from tb3 where f122 = 'Test 3.5.8.5-case'; - Insert into tb3 (f120, f122, f136, f144) - values ('b', 'Test 3.5.8.5-case', 71,16); - select f120, f122, f136, f144, @test_var - from tb3 where f122 = 'Test 3.5.8.5-case'; - Insert into tb3 (f120, f122, f136, f144) - values ('c', 'Test 3.5.8.5-case', 80,1); - select f120, f122, f136, f144, @test_var - from tb3 where f122 = 'Test 3.5.8.5-case'; - Insert into tb3 (f120, f122, f136) - values ('d', 'Test 3.5.8.5-case', 152); - select f120, f122, f136, f144, @test_var - from tb3 where f122 = 'Test 3.5.8.5-case'; - Insert into tb3 (f120, f122, f136, f144) - values ('e', 'Test 3.5.8.5-case', 200, 8); - select f120, f122, f136, f144, @test_var - from tb3 where f122 = 'Test 3.5.8.5-case'; - --error 0, 1339 - Insert into tb3 (f120, f122, f136, f144) - values ('f', 'Test 3.5.8.5-case', 100, 8); - select f120, f122, f136, f144, @test_var - from tb3 where f122 = 'Test 3.5.8.5-case'; - - delimiter //; - --error 1064 - create trigger trg3a before update on tb3 for each row - BEGIN - CASE - when new.f136<100 then set new.f120='p'; - END// - delimiter ;// - - --error 0, 1360 - drop trigger trg3a; - -#Cleanup - --disable_warnings - drop trigger trg3; - delete from tb3 where f121='Test 3.5.8.5-case'; - --enable_warnings - -#Section 3.5.8.5 (LOOP) -# Test case: Ensure that the stored procedure-specific flow control -# statement like LOOP / LEAVE work correctly when they are -# part of the triggered action portion of a trigger definition. -let $message= Testcase 3.5.8.5-loop/leave:; ---source include/show_msg.inc - - delimiter //; - Create trigger trg4 after insert on tb3 for each row - BEGIN - set @counter=0, @flag='Initial'; - Label1: loop - if new.f136<new.f144 then - set @counter='Nothing to loop'; - leave Label1; - else - set @counter=@counter+1; - if new.f136=new.f144+@counter then - set @counter=concat(@counter, ' loops'); - leave Label1; - end if; - end if; - iterate label1; - set @flag='Final'; - END loop Label1; - END// - delimiter ;// - Insert into tb3 (f122, f136, f144) - values ('Test 3.5.8.5-loop', 2, 8); - select @counter, @flag; - Insert into tb3 (f122, f136, f144) - values ('Test 3.5.8.5-loop', 11, 8); - select @counter, @flag; - - - delimiter //; - - --error 1064 - Create trigger trg4_2 after update on tb3 for each row - BEGIN - Label1: loop - set @counter=@counter+1; - END; - END// - delimiter ;// - --error 0, 1360 - drop trigger trg4_2; - -#Cleanup - --disable_warnings - drop trigger trg4; - delete from tb3 where f122='Test 3.5.8.5-loop'; - --enable_warnings - -#Section 3.5.8.5 (REPEAT ITERATE) -#Testcase: Ensure that the stored procedure-specific flow control statements -# like REPEAT work correctly when they are part of the triggered action -# portion of a trigger definition. -let $message= Testcase 3.5.8.5-repeat:; ---source include/show_msg.inc - - delimiter //; - Create trigger trg6 after insert on tb3 for each row - BEGIN - rp_label: REPEAT - SET @counter1 = @counter1 + 1; - IF (@counter1 MOD 2 = 0) THEN ITERATE rp_label; - END IF; - SET @counter2 = @counter2 + 1; - UNTIL @counter1> new.f136 END REPEAT rp_label; - END// - delimiter ;// - - set @counter1= 0, @counter2= 0; - Insert into tb3 (f122, f136) - values ('Test 3.5.8.5-repeat', 13); - select @counter1, @counter2; - - - delimiter //; - --error 1064 - Create trigger trg6_2 after update on tb3 for each row - BEGIN - REPEAT - SET @counter2 = @counter2 + 1; - END// - delimiter ;// - -#Cleanup - --disable_warnings - drop trigger trg6; - delete from tb3 where f122='Test 3.5.8.5-repeat'; - --enable_warnings - - -#Section 3.5.8.5 (WHILE) -# Test case: Ensure that the stored procedure-specific flow control -# statements WHILE, work correctly when they are part of -# the triggered action portion of a trigger definition. -let $message= Testcase 3.5.8.5-while:; ---source include/show_msg.inc - - delimiter //; - Create trigger trg7 after insert on tb3 for each row - wl_label: WHILE @counter1 < new.f136 DO - SET @counter1 = @counter1 + 1; - IF (@counter1 MOD 2 = 0) THEN ITERATE wl_label; - END IF; - SET @counter2 = @counter2 + 1; - END WHILE wl_label// - delimiter ;// - - set @counter1= 0, @counter2= 0; - Insert into tb3 (f122, f136) - values ('Test 3.5.8.5-while', 7); - select @counter1, @counter2; - delimiter //; - --error 1064 - Create trigger trg7_2 after update on tb3 for each row - BEGIN - WHILE @counter1 < new.f136 - SET @counter1 = @counter1 + 1; - END// - delimiter ;// - -#Cleanup - --disable_warnings - delete from tb3 where f122='Test 3.5.8.5-while'; - drop trigger trg7; - --enable_warnings - -#Section 3.5.8.6 -# Test case: Ensure that a trigger definition that includes a CALL to a stored -# procedure fails, at CREATE TRIGGER time, with an appropriate error -# message -# OBN - requirement void since allowed -# Fails due to Bug 9909 the bug allows the trigger to be created -# and fails in execution time -let $message= Testcase 3.5.8.6: (requirement void); ---source include/show_msg.inc - - -#Section 3.5.8.7 -# Test case: Ensure that a trigger definition that includes a -# transaction-delimiting statement (e.g. COMMIT, -# ROLLBACK, START TRANSACTION) fails, at CREATE TRIGGER -# time, with an appropriate error message. -# OBN - Fails due to Bug ____ -let $message= Testcase 3.5.8.7: (Disabled as a result of bug _____); ---source include/show_msg.inc - -# --error 1314 -# Create trigger trg9_1 before update on tb3 for each row -# BEGIN -# Start transaction; -# Set new.f120='U'; -# Commit; -# END; - -# --error 1314 -# Create trigger trg9_2 before delete on tb3 for each row -# BEGIN -# Start transaction; -# Set @var2=old.f120; -# Rollback; -# END; - -################################# -####### Section 3.5.9 ########### -# Checks on old and new rows # -################################# - -#Section 3.5.9.1 -#Test case: Ensure that every trigger executes its triggered action on each row -# that meets the conditions stated in the trigger definition. -#Section 3.5.9.2 -#Testcase: Ensure that a trigger never executes its triggered action on any row -# that doesn't meet the conditions stated in the trigger definition. -let $message= Testcase 3.5.9.1/2:; ---source include/show_msg.inc - - Create trigger trg1 BEFORE UPDATE on tb3 for each row - set new.f142 = 94087, @counter=@counter+1; ---disable_query_log - select count(*) as TotalRows from tb3; - select count(*) as Affected from tb3 where f130<100; - select count(*) as NotAffected from tb3 where f130>=100; - select count(*) as NewValuew from tb3 where f142=94087; ---enable_query_log - set @counter=0; - Update tb3 Set f142='1' where f130<100; - select count(*) as ExpectedChanged, @counter as TrigCounter - from tb3 where f142=94087; - select count(*) as ExpectedNotChange from tb3 - where f130<100 and f142<>94087; - select count(*) as NonExpectedChanged from tb3 - where f130>=130 and f142=94087; - -#Cleanup - --disable_warnings - drop trigger trg1; - --enable_warnings - - -#Section 3.5.9.3 -#Test case: Ensure that a reference to OLD.<column name> always correctly refers -# to the values of the specified column of the subject table before a -# data row is updated or deleted. -let $message= Testcase 3.5.9.3:; ---source include/show_msg.inc - - Create trigger trg2_a before update on tb3 for each row - set @tr_var_b4_118=old.f118, @tr_var_b4_121=old.f121, - @tr_var_b4_122=old.f122, @tr_var_b4_136=old.f136, - @tr_var_b4_163=old.f163; - - Create trigger trg2_b after update on tb3 for each row - set @tr_var_af_118=old.f118, @tr_var_af_121=old.f121, - @tr_var_af_122=old.f122, @tr_var_af_136=old.f136, - @tr_var_af_163=old.f163; - - Create trigger trg2_c before delete on tb3 for each row - set @tr_var_b4_118=old.f118, @tr_var_b4_121=old.f121, - @tr_var_b4_122=old.f122, @tr_var_b4_136=old.f136, - @tr_var_b4_163=old.f163; - - Create trigger trg2_d after delete on tb3 for each row - set @tr_var_af_118=old.f118, @tr_var_af_121=old.f121, - @tr_var_af_122=old.f122, @tr_var_af_136=old.f136, - @tr_var_af_163=old.f163; - - ---disable_query_log - set @tr_var_b4_118=0, @tr_var_b4_121=0, @tr_var_b4_122=0, - @tr_var_b4_136=0, @tr_var_b4_163=0; - set @tr_var_af_118=0, @tr_var_af_121=0, @tr_var_af_122=0, - @tr_var_af_136=0, @tr_var_af_163=0; - select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, - @tr_var_b4_136, @tr_var_b4_163; - select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, - @tr_var_af_136, @tr_var_af_163; ---enable_query_log - - Insert into tb3 (f122, f136, f163) - values ('Test 3.5.9.3', 7, 123.17); - Update tb3 Set f136=8 where f122='Test 3.5.9.3'; - - select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3'; - select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, - @tr_var_b4_136, @tr_var_b4_163; - select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, - @tr_var_af_136, @tr_var_af_163; - ---disable_query_log - set @tr_var_b4_118=0, @tr_var_b4_121=0, @tr_var_b4_122=0, - @tr_var_b4_136=0, @tr_var_b4_163=0; - set @tr_var_af_118=0, @tr_var_af_121=0, @tr_var_af_122=0, - @tr_var_af_136=0, @tr_var_af_163=0; - select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, - @tr_var_b4_136, @tr_var_b4_163; - select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, - @tr_var_af_136, @tr_var_af_163; ---enable_query_log - - delete from tb3 where f122='Test 3.5.9.3'; - - select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3'; - select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, - @tr_var_b4_136, @tr_var_b4_163; - select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, - @tr_var_af_136, @tr_var_af_163; -#Cleanup - --disable_warnings - drop trigger trg2_a; - drop trigger trg2_b; - drop trigger trg2_c; - drop trigger trg2_d; - --enable_warnings - -#Section 3.5.9.4 -#Test case: Ensure that a reference to NEW.<column name> always correctly refers -# to the values of the specified column of the subject table after an -# existing data row has been updated or a new data row has been inserted. -let $message= Testcase 3.5.9.4:; ---source include/show_msg.inc - - Create trigger trg3_a before insert on tb3 for each row - set @tr_var_b4_118=new.f118, @tr_var_b4_121=new.f121, - @tr_var_b4_122=new.f122, @tr_var_b4_136=new.f136, - @tr_var_b4_151=new.f151, @tr_var_b4_163=new.f163; - - Create trigger trg3_b after insert on tb3 for each row - set @tr_var_af_118=new.f118, @tr_var_af_121=new.f121, - @tr_var_af_122=new.f122, @tr_var_af_136=new.f136, - @tr_var_af_151=new.f151, @tr_var_af_163=new.f163; - - Create trigger trg3_c before update on tb3 for each row - set @tr_var_b4_118=new.f118, @tr_var_b4_121=new.f121, - @tr_var_b4_122=new.f122, @tr_var_b4_136=new.f136, - @tr_var_b4_151=new.f151, @tr_var_b4_163=new.f163; - - Create trigger trg3_d after update on tb3 for each row - set @tr_var_af_118=new.f118, @tr_var_af_121=new.f121, - @tr_var_af_122=new.f122, @tr_var_af_136=new.f136, - @tr_var_af_151=new.f151, @tr_var_af_163=new.f163; - ---disable_query_log - set @tr_var_b4_118=0, @tr_var_b4_121=0, @tr_var_b4_122=0, - @tr_var_b4_136=0, @tr_var_b4_151=0, @tr_var_b4_163=0; - set @tr_var_af_118=0, @tr_var_af_121=0, @tr_var_af_122=0, - @tr_var_af_136=0, @tr_var_af_151=0, @tr_var_af_163=0; - select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, - @tr_var_b4_136, @tr_var_b4_151, @tr_var_b4_163; - select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, - @tr_var_af_136, @tr_var_af_151, @tr_var_af_163; ---enable_query_log - - Insert into tb3 (f122, f136, f151, f163) - values ('Test 3.5.9.4', 7, DEFAULT, 995.24); - - select f118, f121, f122, f136, f151, f163 from tb3 - where f122 like 'Test 3.5.9.4%'; - select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, - @tr_var_b4_136, @tr_var_b4_151, @tr_var_b4_163; - select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, - @tr_var_af_136, @tr_var_af_151, @tr_var_af_163; - ---disable_query_log - set @tr_var_b4_118=0, @tr_var_b4_121=0, @tr_var_b4_122=0, - @tr_var_b4_136=0, @tr_var_b4_151=0, @tr_var_b4_163=0; - set @tr_var_af_118=0, @tr_var_af_121=0, @tr_var_af_122=0, - @tr_var_af_136=0, @tr_var_af_151=0, @tr_var_af_163=0; - select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, - @tr_var_b4_136, @tr_var_b4_151, @tr_var_b4_163; - select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, - @tr_var_af_136, @tr_var_af_151, @tr_var_af_163; ---enable_query_log - - Update tb3 Set f122='Test 3.5.9.4-trig', f136=NULL, f151=DEFAULT, f163=NULL - where f122='Test 3.5.9.4'; - - select f118, f121, f122, f136, f151, f163 from tb3 - where f122 like 'Test 3.5.9.4-trig'; - select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, - @tr_var_b4_136, @tr_var_b4_151, @tr_var_b4_163; - select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, - @tr_var_af_136, @tr_var_af_151, @tr_var_af_163; -#Cleanup - --disable_warnings - drop trigger trg3_a; - drop trigger trg3_b; - drop trigger trg3_c; - drop trigger trg3_d; - delete from tb3 where f122='Test 3.5.9.4-trig'; - --enable_warnings - - -#Section 3.5.9.5 -# Test case: Ensure that the definition of an INSERT trigger can include a -# reference to NEW. <Column name>. -let $message= Testcase 3.5.9.5: (implied in previous tests); ---source include/show_msg.inc - -#Section 3.5.9.6 -# Test case: Ensure that the definition of an INSERT trigger cannot include -# a reference to OLD. <Column name>. -let $message= Testcase 3.5.9.6:; ---source include/show_msg.inc - - --error 1363 - create trigger trg4a before insert on tb3 for each row - set @temp1= old.f120; - --error 1362 - create trigger trg4b after insert on tb3 for each row - set old.f120= 'test'; - -#Cleanup - --disable_warnings - --error 0, 1360 - drop trigger trg4a; - --error 0, 1360 - drop trigger trg4b; - --enable_warnings - - -#Section 3.5.9.7 -# Test case: Ensure that the definition of an UPDATE trigger can include a -# reference to NEW. <Column name>. -let $message= Testcase 3.5.9.7: (implied in previous tests); ---source include/show_msg.inc - -#Section 3.5.9.8 -# Test case: Ensure that the definition of an UPDATE trigger cannot include a -# reference to OLD. <Column name>. -let $message= Testcase 3.5.9.8: (implied in previous tests); ---source include/show_msg.inc - -#Section 3.5.9.9 -# Test case: Ensure that the definition of a DELETE trigger cannot include a -# reference to NEW.<column name>. -let $message= Testcase 3.5.9.9:; ---source include/show_msg.inc - - --error 1363 - create trigger trg5a before DELETE on tb3 for each row - set @temp1=new.f122; - --error 1363 - create trigger trg5b after DELETE on tb3 for each row - set new.f122='test'; -let $message= The above returns the wrong error, should be error 1362 (Bug 11648) ---source include/show_msg.inc - -#Cleanup - --disable_warnings - --error 0, 1360 - drop trigger trg5a; - --error 0, 1360 - drop trigger trg5b; - --enable_warnings - - -#Section 3.5.9.10 -# Test case: Ensure that the definition of a DELETE trigger can include a reference -# to OLD.<column name>. -let $message= Testcase 3.5.9.10: (implied in previous tests); ---source include/show_msg.inc - - -#Section 3.5.9.11 -# Testcase: Ensure that trigger definition that includes a referance to -# NEW.<colunm name> fails with an appropriate error message, -# at CREATE TRIGGER time, if the trigger event in not INSERT or UPDATE -let $message= Testcase 3.5.9.11: covered by 3.5.9.9; ---source include/show_msg.inc - - -#Section 3.5.9.12 -# Testcase: Ensure that trigger definition that includes a referance to -# OLD.<column name> fails with an appropriate error message, at -# CREATE TRIGGER time, if the trigger event is not DELETE or UPDATE -let $message= Testcase 3.5.9.12: covered by 3.5.9.6; ---source include/show_msg.inc - - -#Section 3.5.9.13 -# Test case: Ensure that all references to OLD. <Column name> are read-only, -# that is, that they cannot be used to modify a data row. -let $message= Testcase 3.5.9.13:; ---source include/show_msg.inc - - --error 1362 - create trigger trg6a before UPDATE on tb3 for each row - set old.f118='C', new.f118='U'; - --error 1362 - create trigger trg6b after INSERT on tb3 for each row - set old.f136=163, new.f118='U'; - --error 1362 - create trigger trg6c after UPDATE on tb3 for each row - set old.f136=NULL; - -#Cleanup - --disable_warnings - --error 0, 1360 - drop trigger trg6a; - --error 0, 1360 - drop trigger trg6b; - --error 0, 1360 - drop trigger trg6c; - --enable_warnings - - -#Section 3.5.9.14 -# Test case: Ensure that all references to NEW. <Column name> may be used both to -# read a data row and to modify a data row -let $message= Testcase 3.5.9.14: (implied in previous tests); ---source include/show_msg.inc - - -############################################## -################ Section 3.5.10 ################# -# Check on Trigger Activation -############################################## -#Section 3.5.10.1 -# Test case: Ensure that every trigger that should be activated by -# every possible type of implicit insertion into its subject -# table (INSERT into a view based on the subject table) is -# indeed activated correctly -#Section 3.5.10.2 -# Test case: Ensure that every trigger that should be activated by every -# possible type of implicit insertion into its subject table -# (UPDATE into a view based on the subject table) is indeed -# activated correctly -#Section 3.5.10.3 -# Test case: Ensure that every trigger that should be activated by every -# possible type of implicit insertion into its subject table -# (DELETE from a view based on the subject table) is indeed -# activated correctly -let $message= Testcase 3.5.10.1/2/3:; ---source include/show_msg.inc - - Create view vw11 as select * from tb3 - where f122 like 'Test 3.5.10.1/2/3%'; - Create trigger trg1a before insert on tb3 - for each row set new.f163=111.11; - Create trigger trg1b after insert on tb3 - for each row set @test_var='After Insert'; - Create trigger trg1c before update on tb3 - for each row set new.f121='Y', new.f122='Test 3.5.10.1/2/3-Update'; - Create trigger trg1d after update on tb3 - for each row set @test_var='After Update'; - Create trigger trg1e before delete on tb3 - for each row set @test_var=5; - Create trigger trg1f after delete on tb3 - for each row set @test_var= 2* @test_var+7; - -#Section 3.5.10.1 - Insert into vw11 (f122, f151) values ('Test 3.5.10.1/2/3', 1); - Insert into vw11 (f122, f151) values ('Test 3.5.10.1/2/3', 2); - Insert into vw11 (f122, f151) values ('Not in View', 3); - select f121, f122, f151, f163 - from tb3 where f122 like 'Test 3.5.10.1/2/3%'; - select f121, f122, f151, f163 from vw11; - select f121, f122, f151, f163 - from tb3 where f122 like 'Not in View'; - -#Section 3.5.10.2 - Update vw11 set f163=1; - select f121, f122, f151, f163 from tb3 - where f122 like 'Test 3.5.10.1/2/3%'; - select f121, f122, f151, f163 from vw11; - -#Section 3.5.10.3 - set @test_var=0; - Select @test_var as 'before delete'; - delete from vw11 where f151=1; - select f121, f122, f151, f163 from tb3 - where f122 like 'Test 3.5.10.1/2/3%'; - select f121, f122, f151, f163 from vw11; - Select @test_var as 'after delete'; - -#Cleanup - --disable_warnings - drop view vw11; - drop trigger trg1a; - drop trigger trg1b; - drop trigger trg1c; - drop trigger trg1d; - drop trigger trg1e; - drop trigger trg1f; - delete from tb3 where f122 like 'Test 3.5.10.1/2/3%'; - --enable_warnings - - -#Section 3.5.10.4 -# Test case: Ensure that every trigger that should be activated by every -# possible type of implicit insertion into its subject table -# (LOAD into the subject table) is indeed activated correctly -let $message= Testcase 3.5.10.4:; ---source include/show_msg.inc - - eval create table tb_load (f1 int, f2 char(25),f3 int) engine=$engine_type; - Create trigger trg4 before insert on tb_load - for each row set new.f3=-(new.f1 div 5), @counter= @counter+1; - - set @counter= 0; - select @counter as 'Rows Loaded Before'; - --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR - eval load data infile '$MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' into table tb_load; - - select @counter as 'Rows Loaded After'; - Select * from tb_load limit 10; - -#Cleanup - --disable_warnings - drop trigger trg4; - drop table tb_load; - --enable_warnings - - -#Section 3.5.10.5 -# Testcase: Ensure that every trigger that should be activated by every possible -# type of implicit update of its subject table (e.g.a FOREIGN KEY SET -# DEFAULT action or an UPDATE of a view based on the subject table) is -# indeed activated correctly -let $message= Testcase 3.5.10.5: (implemented in trig_frkey.test); ---source include/show_msg.inc - - -#Section 3.5.10.6 -# Testcase: Ensure that every trigger that should be activated by every possible -# type of implicit deletion from its subject table (e.g.a FOREIGN KEY -# CASCADE action or a DELETE from a view based on the subject table) is -# indeed activated correctly -let $message= Testcase 3.5.10.6: (implemented in trig_frkey.test); ---source include/show_msg.inc - -#Section 3.5.10.extra -# Testcase: Ensure that every trigger that should be activated by every possible -# type of implicit deletion from its subject table (e.g. an action performed -# on the subject table from a stored procedure is indeed activated correctly -let $message= Testcase 3.5.10.extra:; ---source include/show_msg.inc - - eval create table t1_sp (var136 tinyint, var151 decimal) engine=$engine_type; - - create trigger trg before insert on t1_sp - for each row set @counter=@counter+1; - # declare continue handler for sqlstate '01000' set done = 1; - - delimiter //; - create procedure trig_sp() - begin - declare done int default 0; - declare var151 decimal; - declare var136 tinyint; - declare cur1 cursor for select f136, f151 from tb3; - declare continue handler for sqlstate '01000' set done = 1; - open cur1; - fetch cur1 into var136, var151; - wl_loop: WHILE NOT done DO - insert into t1_sp values (var136, var151); - fetch cur1 into var136, var151; - END WHILE wl_loop; - close cur1; - end// - delimiter ;// - - set @counter=0; - select @counter; - --error 1329 - call trig_sp(); - select @counter; - select count(*) from tb3; - select count(*) from t1_sp; - -#Cleanup - --disable_warnings - drop procedure trig_sp; - drop trigger trg; - drop table t1_sp; - --enable_warnings - -################################## -########## Section 3.5.11 ######## -# Check on Trigger Performance # -################################## -#Section 3.5.11.1 -# Testcase: Ensure that a set of complicated, interlocking triggers that are activated -# by multiple trigger events on no fewer than 50 different tables with at least -# 500,000 rows each, all work correctly, return the correct results, and have -# the correct effects on the database. It is expected that the Services Provider -# will use its own skills and experience in database testing to devise tables and -# triggers that fulfill this requirement. -let $message= Testcase 3.5.11.1 (implemented in trig_perf.test); ---source include/show_msg.inc - -# Cleanup section 3.5 - connection default; - drop user test_general@localhost; - drop user test_general; - drop user test_super@localhost; - -########################################## -# Other Scenasrios (not in requirements) # -########################################## -# Testcase: y.y.y.2: -# Checking for triggers starting triggers (no direct requirement) -let $message= Testcase y.y.y.2: Check for triggers starting triggers; ---source include/show_msg.inc - - use test; - --disable_warnings - drop table if exists t1; - drop table if exists t2_1; - drop table if exists t2_2; - drop table if exists t2_3; - drop table if exists t2_4; - drop table if exists t3; - --enable_warnings - - create table t1 (f1 integer); - create table t2_1 (f1 integer); - create table t2_2 (f1 integer); - create table t2_3 (f1 integer); - create table t2_4 (f1 integer); - create table t3 (f1 integer); - - insert into t1 values (1); - delimiter //; - create trigger tr1 after insert on t1 for each row - BEGIN - insert into t2_1 (f1) values (new.f1+1); - insert into t2_2 (f1) values (new.f1+1); - insert into t2_3 (f1) values (new.f1+1); - insert into t2_4 (f1) values (new.f1+1); - END// - delimiter ;// - - create trigger tr2_1 after insert on t2_1 for each row - insert into t3 (f1) values (new.f1+10); - create trigger tr2_2 after insert on t2_2 for each row - insert into t3 (f1) values (new.f1+100); - create trigger tr2_3 after insert on t2_3 for each row - insert into t3 (f1) values (new.f1+1000); - create trigger tr2_4 after insert on t2_4 for each row - insert into t3 (f1) values (new.f1+10000); - -#lock tables t1 write, t2_1 write, t2_2 write, t2_3 write, t2_4 write, t3 write; - insert into t1 values (1); -#unlock tables; - select * from t3; - -#Cleanup - --disable_warnings - drop trigger tr1; - drop trigger tr2_1; - drop trigger tr2_2; - drop trigger tr2_3; - drop trigger tr2_4; - drop table t1, t2_1, t2_2, t2_3, t2_4, t3; - --enable_warnings - -# Testcase: y.y.y.3: -# Checking for circular trigger definitions -let $message= Testcase y.y.y.3: Circular trigger reference; ---source include/show_msg.inc - use test; - --disable_warnings - drop table if exists t1; - drop table if exists t2; - drop table if exists t3; - drop table if exists t4; - --enable_warnings - eval create table t1 (f1 integer) engine = $engine_type; - eval create table t2 (f2 integer) engine = $engine_type; - eval create table t3 (f3 integer) engine = $engine_type; - eval create table t4 (f4 integer) engine = $engine_type; - - insert into t1 values (0); - create trigger tr1 after insert on t1 - for each row insert into t2 (f2) values (new.f1+1); - create trigger tr2 after insert on t2 - for each row insert into t3 (f3) values (new.f2+1); - create trigger tr3 after insert on t3 - for each row insert into t4 (f4) values (new.f3+1); - create trigger tr4 after insert on t4 - for each row insert into t1 (f1) values (new.f4+1); - - # OBN See bug 11896 - --error 1442 - insert into t1 values (1); - select * from t1; - select * from t2; - select * from t3; - select * from t4; - -#Cleanup - --disable_warnings - drop trigger tr1; - drop trigger tr2; - drop trigger tr3; - drop trigger tr4; - drop table t1; - drop table t2; - drop table t3; - drop table t4; - --enable_warnings - - -#Section y.y.y.4 -# Testcase: create recursive trigger/storedprocedures conditions -let $message= Testcase y.y.y.4: Recursive trigger/SP references (disabled bug 11889); ---source include/show_msg.inc - -set @sql_mode='traditional'; - eval create table t1_sp ( - count integer, - var136 tinyint, - var151 decimal) engine=$engine_type; - - delimiter //; - create procedure trig_sp() - begin - declare done int default 0; - declare var151 decimal; - declare var136 tinyint; - declare cur1 cursor for select f136, f151 from tb3; - declare continue handler for sqlstate '01000' set done = 1; - set @counter= @counter+1; - open cur1; - fetch cur1 into var136, var151; - wl_loop: WHILE NOT done DO - insert into t1_sp values (@counter, var136, var151); - fetch cur1 into var136, var151; - END WHILE wl_loop; - close cur1; - end// - delimiter ;// - - create trigger trg before insert on t1_sp - for each row call trig_sp(); - - set @counter=0; - select @counter; - --error 1424 - call trig_sp(); - select @counter; - select count(*) from tb3; - select count(*) from t1_sp; - -#Cleanup - --disable_warnings - drop procedure trig_sp; - drop trigger trg; - drop table t1_sp; - --enable_warnings - - -# Testcase: y.y.y.5: -# Checking rollback of nested trigger definitions -let $message= Testcase y.y.y.5: Roleback of nested trigger references; ---source include/show_msg.inc - - set @@sql_mode='traditional'; - use test; - --disable_warnings - drop table if exists t1; - drop table if exists t2; - drop table if exists t3; - drop table if exists t4; - --enable_warnings - eval create table t1 (f1 integer) engine = $engine_type; - eval create table t2 (f2 integer) engine = $engine_type; - eval create table t3 (f3 integer) engine = $engine_type; - eval create table t4 (f4 tinyint) engine = $engine_type; - show create table t1; - insert into t1 values (1); - create trigger tr1 after insert on t1 - for each row insert into t2 (f2) values (new.f1+1); - create trigger tr2 after insert on t2 - for each row insert into t3 (f3) values (new.f2+1); - create trigger tr3 after insert on t3 - for each row insert into t4 (f4) values (new.f3+1000); - -#lock tables t1 write, t2 write, t3 write, t4 write; - - set autocommit=0; - start transaction; - --error 1264 - insert into t1 values (1); - commit; - select * from t1; - select * from t2; - select * from t3; -#unlock tables; -#Cleanup - --disable_warnings - drop trigger tr1; - drop trigger tr2; - drop trigger tr3; - drop table t1; - drop table t2; - drop table t3; - drop table t4; - --enable_warnings - diff --git a/mysql-test/suite/funcs_1/views/func_view.inc b/mysql-test/suite/funcs_1/views/func_view.inc index c477eafc610..709560cdf99 100644 --- a/mysql-test/suite/funcs_1/views/func_view.inc +++ b/mysql-test/suite/funcs_1/views/func_view.inc @@ -3,11 +3,8 @@ # Functions within VIEWs # # # ################################################### -# 14.09.2005 ML +# Created 2005-09-14 mleich -let $message= ! Attention: The file with the expected results suffers from -Bug#10713: mysqldump includes database in create view and referenced tables; ---source include/show_msg80.inc # # 0. Some notes about this test: # ################################################################# @@ -15,9 +12,9 @@ Bug#10713: mysqldump includes database in create view and referenced tables; # 0.1 This test is unfinished and incomplete, but already useful. # ----------------------------------------------------------------- # 0.1.1 There will be architectural changes in future. -# The long sequences with +# The long sequences with # let $col_type= <column to use>; -# --source suite/funcs_1/views/<file containing the +# --source suite/funcs_1/views/<file containing the # select with function> # per every column type do not look very smart. # @@ -42,20 +39,13 @@ Bug#10713: mysqldump includes database in create view and referenced tables; # which was valid during VIEW creation time. This means some variations # of the SQL mode are needed. # 0.1.3 There are much more functions to be tested. -# 0.1.4 There are problems with the option "--ps-protocol". -# Double values with 15 digit mantissa are printed with 14 digit -# mantissa (Bug#11589). -# I altered the Minimum/Maximum double values to 14 digit mantissa -# to avoid these problems. But there are some other unsolved problems -# with "--ps-protocol". ---disable_ps_protocol -# 0.1.5 The result sets of some CAST sub testcases with ugly function parameter +# 0.1.4 The result sets of some CAST sub testcases with ugly function parameter # column data type combinations must be discussed. # # # 0.2 How to valuate the test results: # --------------------------------------------------------------------------- -# Due to the extreme "greedy bug hunting" architecture (combinatorics +# Due to the extreme "greedy bug hunting" architecture (combinatorics # + heavy use of sourced scripts) of the following tests, there will be # - no abort of the test execution, when one statements gets an return # code != 0 (The sub testcases are independend.) @@ -68,13 +58,13 @@ Bug#10713: mysqldump includes database in create view and referenced tables; # But there will be a special messages within the protocol files. # Example: # "Attention: CAST --> SIGNED INTEGER -# The file with expected results suffers from Bug 5083 5913 9809"; +# The file with expected results suffers from Bug 5913"; # means, the file with expected results contains result sets which # are known to be wrong. -# "Attention: The last <whatever> failed" +# "Attention: The last <whatever> failed" # means, a statement which should be successful (bugfree MySQL) # failed. -# +# # "Passed" : The behaviour of your MySQL version does not differ from the # version used to generate the files with expected results. # Known bugs affecting these tests could be retrieved by @@ -96,13 +86,13 @@ Bug#10713: mysqldump includes database in create view and referenced tables; # with the suspicious result set or server response. # Now all t1_values records are preloaded. # 2. Start the server without the initial cleanup of databases etc. -# This preserves the content of the table t1_values, which +# This preserves the content of the table t1_values, which # might be needed for replaying the situation. # Example: # ./mysql-test-run.pl --socket=var/tmp/master.sock --start-dirty # 3. Issue the statements needed by using "mysql" or "mysqltest". # -# Maybe an internal routine of this test fails. Please ask me (ML) or +# Maybe an internal routine of this test fails. Please ask me (mleich) or # enable the logging of auxiliary queries and try to analyze the # problem. # @@ -157,7 +147,7 @@ Bug#10713: mysqldump includes database in create view and referenced tables; # The script will work with the VIEWs, but omit the simple selects. # The "reject" file contains the view select result sets. # 3. Compare the "reject" files of 1. and 2. within a graphical diff tool. -# +# # --disable_warnings @@ -187,6 +177,7 @@ CREATE TABLE t1_modes --enable_query_log # The table to be used in the FROM parts of the SELECTs +--replace_result $type <engine_to_be_tested> eval CREATE TABLE t1_values ( id BIGINT AUTO_INCREMENT, @@ -197,7 +188,7 @@ eval CREATE TABLE t1_values ##### BEGIN Basic preparations ####################################### # # 1. Extend t1_values with the columns you need -# - the column name must show the data type +# - the column name must show the data type # - do not add NOT NULL columns # - do not worry if the intended column data type is not # available for some storage engines @@ -229,7 +220,7 @@ ALTER TABLE t1_values ADD my_decimal DECIMAL(64,30); # we do not want to start with "illegal/unexpected/..." values. # Such experiments should be done in other testcases. # Please be careful -# - modifying column values of predefined rows they might change many +# - modifying column values of predefined rows they might change many # result sets # - additional predefined rows should be really useful for the majority of # all sub testcases, since they blow up all result sets. @@ -255,20 +246,18 @@ INSERT INTO t1_values SET my_bigint = -9223372036854775808, my_decimal = -9999999999999999999999999999999999.999999999999999999999999999999 , my_double = -1.7976931348623E+308; -# Note(ML): Values like -# - my_timestamp = '19700101030000' do not work -# - my_double = -1.7976931348623157E+308 cause problems with -# --ps-protocol (Bug#11589) +# shortened due to bug#32285 +# my_double = -1.7976931348623157E+308; # # 2.3 record -- everything to "maximum" # numbers, date/time types -> maximum of range # strings, blobs, binaries -> '<- full length of used data type>' # FIXME enum, set ?? INSERT INTO t1_values SET - my_char_30 = '<--------30 characters------->', + my_char_30 = '<--------30 characters------->', my_varchar_1000 = CONCAT('<---------1000 characters', RPAD('',965,'-'),'--------->'), - my_binary_30 = '<--------30 characters------->', + my_binary_30 = '<--------30 characters------->', my_varbinary_1000 = CONCAT('<---------1000 characters', RPAD('',965,'-'),'--------->'), my_datetime = '9999-12-31 23:59:59', @@ -279,10 +268,8 @@ INSERT INTO t1_values SET my_bigint = 9223372036854775807, my_decimal = +9999999999999999999999999999999999.999999999999999999999999999999 , my_double = 1.7976931348623E+308; -# Note(ML): Values like -# - my_timestamp = '20380101030000' do not work -# - my_double = 1.7976931348623157E+308 cause problems with -# --ps-protocol (Bug#11589) +# shortened due to bug#32285 +# my_double = -1.7976931348623157E+308; # # 2.4 record -- everything to "magic" value if available or # other interesting value @@ -291,28 +278,28 @@ INSERT INTO t1_values SET # characters and preceeding and trailing spaces # FIXME enum, set ?? INSERT INTO t1_values SET - my_char_30 = ' ---äÖüß@µ*$-- ', - my_varchar_1000 = ' ---äÖüß@µ*$-- ', - my_binary_30 = ' ---äÖüß@µ*$-- ', - my_varbinary_1000 = ' ---äÖüß@µ*$-- ', + my_char_30 = ' ---äÖüß@µ*$-- ', + my_varchar_1000 = ' ---äÖüß@µ*$-- ', + my_binary_30 = ' ---äÖüß@µ*$-- ', + my_varbinary_1000 = ' ---äÖüß@µ*$-- ', my_datetime = '2004-02-29 23:59:59', my_date = '2004-02-29', my_timestamp = '2004-02-29 23:59:59', my_time = '13:00:00', my_year = 2000, - my_bigint = 0, + my_bigint = 0, my_decimal = 0.0, my_double = 0; # # 2.5 record -- everything to "harmless" value if available # numbers -> -1 (logical) -# strings, blobs, binaries -> '-1' useful for numeric functions +# strings, blobs, binaries -> '-1' useful for numeric functions # FIXME enum, set ?? INSERT INTO t1_values SET - my_char_30 = '-1', - my_varchar_1000 = '-1', - my_binary_30 = '-1', - my_varbinary_1000 = '-1', + my_char_30 = '-1', + my_varchar_1000 = '-1', + my_binary_30 = '-1', + my_varbinary_1000 = '-1', my_datetime = '2005-06-28 10:00:00', my_date = '2005-06-28', my_timestamp = '2005-06-28 10:00:00', @@ -330,11 +317,11 @@ INSERT INTO t1_values SET # records which should be used dedicated to the SELECT above # - Please avoid WHERE clauses # - Include the PRIMARY KEY ("id") of the base table t1_values into the -# select column list -# - Include the base table column used as function parameter into the -# select column list, because it is much easier to check the results +# select column list +# - Include the base table column used as function parameter into the +# select column list, because it is much easier to check the results # - Do not forget to escape single quotes -# Example: +# Example: # SET @my_select = 'SELECT sqrt(my_bigint), my_bigint, id FROM t1_values' # SET @my_select = 'SELECT CONCAT(\'A\',my_char_30), id FROM t1_values'; # - Statements, which reveal open crashing bugs MUST be disabled. @@ -347,18 +334,18 @@ INSERT INTO t1_values SET # most preferred function. # This method avoids that we forget a function and gives a better # overview. -# +# # If you have the time to check the result sets do the insert of the # SELECT with function via: -# eval SET @my_select = +# eval SET @my_select = # '<your SELECT>'; # --source suite/funcs_1/views/fv1.inc # fv1.inc sets t1_selects.disable_result to 'No' and the effect will be, # that the result set will be logged. # -# If you do have the time to check the result sets do the insert of the +# If you do not have the time to check the result sets do the insert of the # SELECT with function via: -# eval SET @my_select = +# eval SET @my_select = # '<your SELECT>'; # --source suite/funcs_1/views/fv2.inc # fv2.inc sets t1_selects.disable_result to 'Yes' and the effect will be, @@ -384,7 +371,7 @@ INSERT INTO t1_values SET # # Example: # The function to be tested is "sqrt". -# The minimum, maximum, default and NULL value are covered by the +# The minimum, maximum, default and NULL value are covered by the # predefined rows. # A value where sqrt(<value>) = <integer value> in strict mathematics # would be of interest. @@ -416,18 +403,19 @@ eval INSERT INTO t1_values SET select_id = @select_id, $col_type = -25; # SELECT * FROM t1_values; -# 1. Cast Functions and Operators -# 1.1. CAST +# 1. Cast Functions and Operators +# 1.1 CAST # -# Note(ML): I guess the CAST routines are used in many other functions. -# Therefore check also nearly all "ugly" variants like -# CAST(<string composed of non digits> AS DECIMAL) here. +# Note(mleich): I guess the CAST routines are used in many other functions. +# Therefore check also nearly all "ugly" variants like +# CAST(<string composed of non digits> AS DECIMAL) here. # -# suite/funcs_1/views/fv_cast.inc contains +# suite/funcs_1/views/fv_cast.inc contains # SELECT CAST($col_type AS $target_type), ... # # # 1.1.1. CAST --> BINARY +--echo ##### 1.1.1. CAST --> BINARY let $target_type= BINARY; # let $col_type= my_char_30; @@ -457,6 +445,7 @@ let $col_type= my_year; # 1.1.2. CAST --> CHAR +--echo ##### 1.1.2. CAST --> CHAR let $target_type= CHAR; # let $col_type= my_char_30; @@ -486,6 +475,7 @@ let $col_type= my_year; # 1.1.3. CAST --> DATE +--echo ##### 1.1.3. CAST --> DATE let $target_type= DATE; # let $col_type= my_char_30; @@ -525,6 +515,7 @@ let $col_type= my_year; # 1.1.4. CAST --> DATETIME +--echo ##### 1.1.4. CAST --> DATETIME let $target_type= DATETIME; # let $col_type= my_char_30; @@ -564,6 +555,7 @@ let $col_type= my_year; # 1.1.5. CAST --> TIME +--echo ##### 1.1.5. CAST --> TIME let $target_type= TIME; # let $col_type= my_char_30; @@ -587,15 +579,10 @@ let $col_type= my_bigint; eval INSERT INTO t1_values SET select_id = @select_id, $col_type = 1758; let $col_type= my_double; -let $message= some statements disabled because of -Bug#12440: CAST(data type DOUBLE AS TIME) strange results; ---source include/show_msg80.inc -if (0) -{ +# Bug#12440: CAST(data type DOUBLE AS TIME) strange results; --source suite/funcs_1/views/fv_cast.inc eval INSERT INTO t1_values SET select_id = @select_id, $col_type = +1.758E+3; -} let $col_type= my_datetime; --source suite/funcs_1/views/fv_cast.inc let $col_type= my_date; @@ -609,6 +596,7 @@ let $col_type= my_year; # 1.1.6. CAST --> DECIMAL +--echo ##### 1.1.6. CAST --> DECIMAL # Set the following to (37,2) since the default was changed to (10,0) - OBN let $target_type= DECIMAL(37,2); # @@ -632,16 +620,11 @@ let $col_type= my_bigint; --source suite/funcs_1/views/fv_cast.inc let $col_type= my_decimal; --source suite/funcs_1/views/fv_cast.inc -let $message= some statements disabled because of -Bug#13349: CAST(1.0E+300 TO DECIMAL) returns wrong result + diff little/big endian; ---source include/show_msg80.inc -if (0) -{ +# Bug#13349: CAST(1.0E+300 TO DECIMAL) returns wrong result + diff little/big endian; let $col_type= my_double; --source suite/funcs_1/views/fv_cast.inc eval INSERT INTO t1_values SET select_id = @select_id, $col_type = -0.33333333E+4; -} let $col_type= my_datetime; --source suite/funcs_1/views/fv_cast.inc let $col_type= my_date; @@ -655,15 +638,13 @@ let $col_type= my_year; # 1.1.7. CAST --> SIGNED INTEGER +--echo ##### 1.1.7. CAST --> SIGNED INTEGER let $target_type= SIGNED INTEGER; # -let $message= +let $message= "Attention: CAST --> SIGNED INTEGER - The file with expected results suffers from - Bug#5083 Big integer values are inserted as negative into - decimal/string columns Bug#5913 Traditional mode: BIGINT range not correctly delimited - Both have the status: To be fixed later"; + Status: To be fixed later"; --source include/show_msg80.inc let $col_type= my_char_30; --source suite/funcs_1/views/fv_cast.inc @@ -677,14 +658,9 @@ let $col_type= my_bigint; --source suite/funcs_1/views/fv_cast.inc let $col_type= my_decimal; --source suite/funcs_1/views/fv_cast.inc -let $message= some statements disabled because of -Bug #13344: CAST(1E+300 TO signed int) on little endian CPU, wrong result; ---source include/show_msg80.inc -if (0) -{ +# Bug #13344: CAST(1E+300 TO signed int) on little endian CPU, wrong result; let $col_type= my_double; --source suite/funcs_1/views/fv_cast.inc -} let $col_type= my_datetime; --source suite/funcs_1/views/fv_cast.inc let $col_type= my_date; @@ -698,11 +674,12 @@ let $col_type= my_year; # 1.1.8. CAST --> UNSIGNED INTEGER +--echo ##### 1.1.8. CAST --> UNSIGNED INTEGER let $target_type= UNSIGNED INTEGER; # -let $message= +let $message= "Attention: CAST --> UNSIGNED INTEGER - The file with expected results suffers from Bug 5083 5913 9809"; + The file with expected results suffers from Bug 5913"; --source include/show_msg80.inc let $col_type= my_char_30; --source suite/funcs_1/views/fv_cast.inc @@ -717,13 +694,11 @@ let $col_type= my_bigint; let $col_type= my_decimal; --source suite/funcs_1/views/fv_cast.inc let $message= some statements disabled because of -Bugs#8663: cant use bgint unsigned as input to cast; +Bug#5913 Traditional mode: BIGINT range not correctly delimited; --source include/show_msg80.inc -if (0) -{ +# Bug#8663 cant use bgint unsigned as input to cast let $col_type= my_double; --source suite/funcs_1/views/fv_cast.inc -} let $col_type= my_datetime; --source suite/funcs_1/views/fv_cast.inc let $col_type= my_date; @@ -748,38 +723,38 @@ let $col_type= my_year; let $target_charset= utf8; # let $col_type= my_char_30; -eval SET @my_select = 'SELECT CONVERT($col_type USING $target_charset), +eval SET @my_select = 'SELECT CONVERT($col_type USING $target_charset), $col_type, id FROM t1_values'; --source suite/funcs_1/views/fv1.inc let $col_type= my_varchar_1000; -eval SET @my_select = 'SELECT CONVERT($col_type USING $target_charset), +eval SET @my_select = 'SELECT CONVERT($col_type USING $target_charset), $col_type, id FROM t1_values'; --source suite/funcs_1/views/fv1.inc let $col_type= my_binary_30; -eval SET @my_select = 'SELECT CONVERT($col_type USING $target_charset), +eval SET @my_select = 'SELECT CONVERT($col_type USING $target_charset), $col_type, id FROM t1_values'; --source suite/funcs_1/views/fv1.inc let $col_type= my_varbinary_1000; -eval SET @my_select = 'SELECT CONVERT($col_type USING $target_charset), +eval SET @my_select = 'SELECT CONVERT($col_type USING $target_charset), $col_type, id FROM t1_values'; --source suite/funcs_1/views/fv1.inc # # 1.3.2 CONVERT(expr USING koi8r) let $target_charset= koi8r; let $col_type= my_char_30; -eval SET @my_select = 'SELECT CONVERT($col_type USING $target_charset), +eval SET @my_select = 'SELECT CONVERT($col_type USING $target_charset), $col_type, id FROM t1_values'; --source suite/funcs_1/views/fv1.inc let $col_type= my_varchar_1000; -eval SET @my_select = 'SELECT CONVERT($col_type USING $target_charset), +eval SET @my_select = 'SELECT CONVERT($col_type USING $target_charset), $col_type, id FROM t1_values'; --source suite/funcs_1/views/fv1.inc let $col_type= my_binary_30; -eval SET @my_select = 'SELECT CONVERT($col_type USING $target_charset), +eval SET @my_select = 'SELECT CONVERT($col_type USING $target_charset), $col_type, id FROM t1_values'; --source suite/funcs_1/views/fv1.inc let $col_type= my_varbinary_1000; -eval SET @my_select = 'SELECT CONVERT($col_type USING $target_charset), +eval SET @my_select = 'SELECT CONVERT($col_type USING $target_charset), $col_type, id FROM t1_values'; --source suite/funcs_1/views/fv1.inc @@ -787,7 +762,7 @@ $col_type, id FROM t1_values'; # 2. Control Flow Functions # 2.1. CASE value WHEN [compare-value] THEN result [WHEN ...] [ELSE result] # END or -# CASE WHEN [condition] THEN result [WHEN ...] [ELSE result] END +# CASE WHEN [condition] THEN result [WHEN ...] [ELSE result] END # # FIXME: to be implemented # @@ -796,7 +771,7 @@ $col_type, id FROM t1_values'; # # 2.2.1 IF(expr1,expr2,expr3) with expr1 = <column> # -# Note(ML): Strings, which do not contain a number -> FALSE +# Note(mleich): Strings, which do not contain a number -> FALSE # # suite/funcs_1/views/fv_if1.inc contains # SELECT IF($col_type, 'IS TRUE', 'IS NOT TRUE'), ... @@ -843,16 +818,12 @@ let $col_type= my_year; # suite/funcs_1/views/fv_if2.inc contains # SELECT IF($col_type IS NULL, 'IS NULL', 'IS NOT NULL'), ... # -# Note(ML): July 2005 IF($col_type IS NULL, ...) is mapped to a VIEW definition -# create ... view ... as -# select if(isnull(`test`.`t1`.`f1`),_latin1'IS NULL', +# Note(mleich): July 2005 +# IF($col_type IS NULL, ...) is mapped to a VIEW definition +# create ... view ... as +# select if(isnull(`test`.`t1`.`f1`),_latin1'IS NULL', # _latin1'IS NOT NULL'),... # -let $message= -"Attention: IF($col_type IS NULL, ... - The file with expected results suffers from - Bug#11689. successful CREATE VIEW but SELECT on view fails."; ---source include/show_msg80.inc # Bug#11689 success on Create view .. IF(col1 IS NULL,...), col2 ; but SELECT fails let $col_type= my_char_30; --source suite/funcs_1/views/fv_if2.inc @@ -891,7 +862,7 @@ let $col_type= my_year; --source suite/funcs_1/views/fv_if2.inc -# 2.3. IFNULL(expr1,expr2) +# 2.3. IFNULL(expr1,expr2) # If expr1 is not NULL, IFNULL() returns expr1, else it returns expr2. # # suite/funcs_1/views/fv_ifnull.inc contains @@ -942,7 +913,7 @@ let $col_type= my_year; # 2.4. NULLIF(expr1,expr2) # Returns NULL if expr1 = expr2 is true, else returns expr1. -# This is the same as +# This is the same as # CASE WHEN expr1 = expr2 THEN NULL ELSE expr1 END. # # FIXME: to be implemented @@ -979,11 +950,11 @@ $col_type, id FROM t1_values'; # 3.5. CHAR_LENGTH(str) # 3.6 CHARACTER_LENGTH(str) # CHARACTER_LENGTH() is a synonym for CHAR_LENGTH(). -# 3.7. COMPRESS(string_to_compress) +# 3.7. COMPRESS(string_to_compress) # 3.8. CONCAT(str1,str2,...) # 3.9. CONCAT_WS(separator,str1,str2,...) # 3.10. CONV(N,from_base,to_base) -# 3.11. ELT(N,str1,str2,str3,...) +# 3.11. ELT(N,str1,str2,str3,...) # 3.12. EXPORT_SET(bits,on,off[,separator[,number_of_bits]]) # 3.13. FIELD(str,str1,str2,str3,...) # 3.14. FIND_IN_SET(str,strlist) @@ -1011,55 +982,38 @@ $col_type, id FROM t1_values'; # 3.19. LEFT(str,len) -# Returns the leftmost len characters from the string str. +# Returns the leftmost len characters from the string str. let $col_type= my_char_30; -eval SET @my_select = +eval SET @my_select = 'SELECT LEFT($col_type, 2), $col_type, id FROM t1_values'; --source suite/funcs_1/views/fv1.inc let $col_type= my_varchar_1000; -eval SET @my_select = +eval SET @my_select = 'SELECT LEFT($col_type, 2), $col_type, id FROM t1_values'; --source suite/funcs_1/views/fv1.inc let $col_type= my_binary_30; -eval SET @my_select = +eval SET @my_select = 'SELECT LEFT($col_type, 2), $col_type, id FROM t1_values'; --source suite/funcs_1/views/fv1.inc let $col_type= my_varbinary_1000; -eval SET @my_select = +eval SET @my_select = 'SELECT LEFT($col_type, 2), $col_type, id FROM t1_values'; --source suite/funcs_1/views/fv1.inc -# -let $message= -"Attention: LEFT(''AaBbCcDdEeFfGgHhIiJjÄäÜüÖö'', <numeric column>) - The file with expected results suffers from Bug 10963 11728" - and the testcases with length = BIGINT or DOUBLE column are deactivated, - because there are 32/64 Bit differences; ---source include/show_msg80.inc # Bug#11728 string function LEFT, strange undocumented behaviour, strict mode # Bug#10963 LEFT string function returns wrong result with large length let $col_type= my_bigint; -if (0) -{ -# Bug#10963 LEFT string function returns wrong result with large length -eval SET @my_select = +eval SET @my_select = 'SELECT LEFT(''AaBbCcDdEeFfGgHhIiJjÄäÜüÖö'', $col_type), $col_type, id FROM t1_values'; --source suite/funcs_1/views/fv1.inc -} -# let $col_type= my_decimal; eval SET @my_select = 'SELECT LEFT(''AaBbCcDdEeFfGgHhIiJjÄäÜüÖö'', $col_type), $col_type, id FROM t1_values'; --source suite/funcs_1/views/fv1.inc -# -if (0) -{ # Bug#10963 LEFT string function returns wrong result with large length let $col_type= my_double; eval SET @my_select = 'SELECT LEFT(''AaBbCcDdEeFfGgHhIiJjÄäÜüÖö'', $col_type), $col_type, id FROM t1_values'; --source suite/funcs_1/views/fv1.inc -} - # 3.20. LENGTH(str) let $col_type= my_char_30; @@ -1085,8 +1039,11 @@ $col_type, id FROM t1_values'; # If the file doesn't exist or cannot be read ... , # the function returns NULL. # SELECT LOADFILE -eval SET @my_select = -'SELECT LOAD_FILE(''../log/current_test''), id FROM t1_values'; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval SET @my_select = +'SELECT LOAD_FILE(''$MYSQLTEST_VARDIR/std_data_ln/funcs_1/load_file.txt'') + AS my_col, + id FROM t1_values'; --source suite/funcs_1/views/fv1.inc @@ -1253,8 +1210,8 @@ $col_type, id FROM t1_values'; --source suite/funcs_1/views/fv2.inc -# 3.26. MAKE_SET(bits,str1,str2,...) -# ..... +# 3.26. MAKE_SET(bits,str1,str2,...) +# ..... # FIXME: to be implemented ################################################################################ @@ -1278,6 +1235,7 @@ SET sql_mode = ''; # let $message= "# The basic preparations end and the main test starts here"; --source include/show_msg80.inc +--disable_ps_protocol ##### The tests start here ##################################################### @@ -1306,18 +1264,18 @@ while ($select_id) if ($view_select_result) { # Create the VIEW + --replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> eval CREATE VIEW v1 AS $my_select; --disable_query_log eval set @got_errno= $mysql_errno ; let $run0= `SELECT @got_errno = 0`; - let $print_warning= `SELECT @got_errno`; - if ($print_warning) + --enable_query_log + if (!$run0) { - SELECT 'Attention: The last CREATE VIEW failed ' AS "" - UNION - SELECT '' ; + --echo + --echo Attention: The last CREATE VIEW failed + --echo } - --enable_query_log } # FIXME The loop over the modes will start here. @@ -1325,27 +1283,24 @@ while ($select_id) if ($simple_select_result) { # Simple SELECT on the base table of the VIEW for comparison - + if ($run_no_result) { --disable_result_log } + --replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> eval $my_select - WHERE select_id = $select_id OR select_id IS NULL; + WHERE select_id = $select_id OR select_id IS NULL order by id; if ($run_no_result) { --enable_result_log } - --disable_query_log - eval set @got_errno= $mysql_errno ; - let $print_warning= `SELECT @got_errno`; - if ($print_warning) + if ($mysql_errno) { - SELECT 'Attention: The last SELECT on the base table failed' AS "" - UNION - SELECT '' ; + --echo + --echo Attention: The last SELECT on the base table failed + --echo } - --enable_query_log } # $run0 is 1, if CREATE VIEW was successful. @@ -1353,17 +1308,14 @@ while ($select_id) if ($run0) { # Check the CREATE VIEW statement + --replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> SHOW CREATE VIEW v1; - --disable_query_log - eval set @got_errno= $mysql_errno ; - let $print_warning= `SELECT @got_errno`; - if ($print_warning) + if ($mysql_errno) { - SELECT 'Attention: The last SHOW CREATE VIEW failed' AS "" - UNION - SELECT '' ; + --echo + --echo Attention: The last SHOW CREATE VIEW failed + --echo } - --enable_query_log # Maybe a Join is faster if ($run_no_result) @@ -1372,21 +1324,17 @@ while ($select_id) } eval SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values - WHERE select_id = $select_id OR select_id IS NULL); + WHERE select_id = $select_id OR select_id IS NULL) order by id; if ($run_no_result) { --enable_result_log } - --disable_query_log - eval set @got_errno= $mysql_errno ; - let $print_warning= `SELECT @got_errno`; - if ($print_warning) + if ($mysql_errno) { - SELECT 'Attention: The last SELECT from VIEW failed' AS "" - UNION - SELECT '' ; + --echo + --echo Attention: The last SELECT from VIEW failed + --echo } - --enable_query_log DROP VIEW v1; } @@ -1395,11 +1343,12 @@ while ($select_id) # Produce two empty lines as separator between different SELECTS # to be tested. - --disable_query_log - SELECT '' AS ""; - --enable_query_log + --echo + --echo dec $select_id ; } +--enable_ps_protocol + DROP TABLE t1_selects, t1_modes, t1_values; diff --git a/mysql-test/suite/funcs_1/views/views_master.inc b/mysql-test/suite/funcs_1/views/views_master.inc index f08082676ed..bc475c6807c 100644 --- a/mysql-test/suite/funcs_1/views/views_master.inc +++ b/mysql-test/suite/funcs_1/views/views_master.inc @@ -4,7 +4,7 @@ # 2007-10-05 mleich # 1. Fix for Bug#31237 Test "ndb_views" fails because of differing order ... # 2. Cleanup of test -# 2007-11-15 hhunger WL#4084: Review and fix all disabled tests ... +# 2007-11-15 hhunger WL#4084: Review and fix all disabled tests ... let $message= ! Attention: The file with the expected results is not | thoroughly checked. @@ -19,7 +19,7 @@ let $message= ! Attention: The file with the expected results is not # If this bug is fixed, please # 1. set the following variable to 0 # 2. check, if the test passes -# 3. remove the workarounds +# 3. remove the workarounds let $have_bug_32285= 1; if ($have_bug_32285) { @@ -2004,7 +2004,7 @@ let $message= Testcase 3.3.1.49A ; # The annoying redundant # eval INSERT INTO t1_results VALUES (@v3_to_v1_options,@statement, # @v3_to_v1_violation,$mysql_errno); -# could not be put into a file to be sourced because of the closed +# could not be put into a file to be sourced because of the closed # Bug#10267 mysqltest, wrong number of loops when a script is sourced # within a loop # To be implemented later. @@ -3998,7 +3998,7 @@ DESCRIBE v1; SELECT * FROM t1 order by f1, f2; SELECT * FROM v1 order by 2; # Some statements for comparison -# - the ugly SQRT('DEF) as constant +# - the ugly SQRT('DEF') as constant SELECT SQRT('DEF'); # - Will a VIEW based on the same definition show the same result ? CREATE VIEW v2 AS SELECT SQRT('DEF'); diff --git a/mysql-test/t/binlog_index.test b/mysql-test/t/binlog_index.test new file mode 100644 index 00000000000..1e44a9b02e2 --- /dev/null +++ b/mysql-test/t/binlog_index.test @@ -0,0 +1,69 @@ +# +# testing of purging of binary log files bug#18199/Bug#18453 +# +source include/have_log_bin.inc; +source include/not_embedded.inc; + +# +# testing purge binary logs TO +# + +flush logs; +flush logs; +flush logs; + +source include/show_binary_logs.inc; + +remove_file $MYSQLTEST_VARDIR/log/master-bin.000001; + +# there must be a warning with file names +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +purge binary logs TO 'master-bin.000004'; + +--echo *** must show a list starting from the 'TO' argument of PURGE *** +source include/show_binary_logs.inc; + +# +# testing purge binary logs BEFORE +# + +reset master; + +flush logs; +flush logs; +flush logs; +remove_file $MYSQLTEST_VARDIR/log/master-bin.000001; + +--echo *** must be a warning master-bin.000001 was not found *** +let $date=`select NOW() + INTERVAL 1 MINUTE`; +--disable_query_log +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval purge binary logs BEFORE '$date'; +--enable_query_log + +--echo *** must show one record, of the active binlog, left in the index file after PURGE *** +source include/show_binary_logs.inc; + +# +# testing a fatal error +# Turning a binlog file into a directory must be a portable setup +# + +reset master; + +flush logs; +flush logs; +flush logs; + +remove_file $MYSQLTEST_VARDIR/log/master-bin.000001; +mkdir $MYSQLTEST_VARDIR/log/master-bin.000001; + +--error ER_BINLOG_PURGE_FATAL_ERR +purge binary logs TO 'master-bin.000002'; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +show warnings; +rmdir $MYSQLTEST_VARDIR/log/master-bin.000001; +--disable_warnings +reset master; +--enable_warnings +--echo End of tests diff --git a/mysql-test/t/blackhole.test b/mysql-test/t/blackhole.test index ba77b7b7f6a..cb8010d7967 100644 --- a/mysql-test/t/blackhole.test +++ b/mysql-test/t/blackhole.test @@ -142,7 +142,6 @@ CREATE TABLE t1(a INT) ENGINE=BLACKHOLE; INSERT DELAYED INTO t1 VALUES(1); DROP TABLE t1; -# End of 4.1 tests # #Bug#19717: DELETE Query Error on BLACKHOLE when using WHERE on column with UNIQUE INDEX @@ -159,4 +158,27 @@ ALTER TABLE t1 ADD PRIMARY KEY(a); DELETE FROM t1 WHERE a=10; DROP TABLE t1; -# End of 5.0 tests +# +# Bug#35178 INSERT_ID not written to binary log for inserts against BLACKHOLE backed tables +# +# +# the test checks that explicitly prescribed with set insert_id= value +# preceeds the following autoincrement insert in a blachhole +# + +reset master; +create table t1 (a int auto_increment, primary key (a)) engine=blackhole; + +# not insert_id prescribed insert binlogs with the default set insert_id 1 +insert into t1 values (11), (NULL), (NULL), (NULL); +set insert_id= 3; +insert into t1 values (NULL), (33), (NULL); +set insert_id= 5; +insert into t1 values (55), (NULL); +source include/show_binlog_events2.inc; + +# cleanup +drop table t1; + + +# End of tests diff --git a/mysql-test/t/ctype_gbk.test b/mysql-test/t/ctype_gbk.test index 3ea696338dc..91fe50d89b9 100644 --- a/mysql-test/t/ctype_gbk.test +++ b/mysql-test/t/ctype_gbk.test @@ -53,4 +53,18 @@ alter table t1 change c1 c1 mediumtext character set gbk not null; show create table t1; drop table t1; +# +# Bug#35993: severe memory corruption and crash with multibyte conversion +# + +CREATE TABLE t1(a MEDIUMTEXT CHARACTER SET gbk, + b MEDIUMTEXT CHARACTER SET big5); +INSERT INTO t1 VALUES + (REPEAT(0x1125,200000), REPEAT(0x1125,200000)), ('', ''), ('', ''); + +SELECT a FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll; +SELECT b FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll; + +DROP TABLES t1; + --echo End of 5.0 tests diff --git a/mysql-test/t/federated_disabled-master.opt b/mysql-test/t/federated_disabled-master.opt new file mode 100644 index 00000000000..4f2df1dd301 --- /dev/null +++ b/mysql-test/t/federated_disabled-master.opt @@ -0,0 +1 @@ +--skip-federated diff --git a/mysql-test/t/federated_disabled.test b/mysql-test/t/federated_disabled.test new file mode 100644 index 00000000000..99fcad76828 --- /dev/null +++ b/mysql-test/t/federated_disabled.test @@ -0,0 +1,3 @@ +source include/federated.inc; + +SHOW VARIABLES LIKE 'have_federated_engine'; diff --git a/mysql-test/t/flush.test b/mysql-test/t/flush.test index 72efa8a2ee6..4c6d4265600 100644 --- a/mysql-test/t/flush.test +++ b/mysql-test/t/flush.test @@ -164,4 +164,13 @@ drop table t1, t2; set session low_priority_updates=default; +# +# Bug #33334 mysqltest_embedded crashes when disconnecting before reap +# + +connect (con1,localhost,root,,); +send select benchmark(200, (select sin(1))) > 1000; +disconnect con1; +connection default; + # End of 5.0 tests diff --git a/mysql-test/t/func_concat.test b/mysql-test/t/func_concat.test index 5487ad9c56b..f2aa0d004e5 100644 --- a/mysql-test/t/func_concat.test +++ b/mysql-test/t/func_concat.test @@ -68,3 +68,13 @@ create table t1(f1 varchar(6)) charset=utf8; insert into t1 values ("123456"); select concat(f1, 2) a from t1 union select 'x' a from t1; drop table t1; + +# +# Bug #36488: regexp returns false matches, concatenating with previous rows +# +CREATE TABLE t1 (c1 varchar(100), c2 varchar(100)); +INSERT INTO t1 VALUES ('',''), ('','First'), ('Random','Random'); +SELECT * FROM t1 WHERE CONCAT(c1,' ',c2) REGEXP 'First.*'; +DROP TABLE t1; + +--echo # End of 5.0 tests diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test index 87632fbdbb8..816ac9c2959 100644 --- a/mysql-test/t/func_gconcat.test +++ b/mysql-test/t/func_gconcat.test @@ -657,4 +657,40 @@ SELECT s1.d1 FROM ) AS s1; DROP TABLE t1; +# +# Bug #35298: GROUP_CONCAT with DISTINCT can crash the server +# + +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a INT); + +INSERT INTO t1 VALUES(1); + +SELECT GROUP_CONCAT(DISTINCT t2.a) FROM t1 LEFT JOIN t2 ON t2.a = t1.a GROUP BY t1.a; + +DROP TABLE t1, t2; + +# +# Bug #36024: group_concat distinct in subquery crash +# + +CREATE TABLE t1 (a INT, KEY(a)); +CREATE TABLE t2 (b INT); + +INSERT INTO t1 VALUES (NULL), (8), (2); +INSERT INTO t2 VALUES (4), (10); + +SELECT 1 FROM t1 WHERE t1.a NOT IN +( + SELECT GROUP_CONCAT(DISTINCT t1.a) + FROM t1 WHERE t1.a IN + ( + SELECT b FROM t2 + ) + AND NOT t1.a >= (SELECT t1.a FROM t1 LIMIT 1) + GROUP BY t1.a +); + +DROP TABLE t1, t2; + --echo End of 5.0 tests diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test index 75a380c733f..dbe6d3113d5 100644 --- a/mysql-test/t/func_group.test +++ b/mysql-test/t/func_group.test @@ -916,5 +916,15 @@ DROP VIEW v1; DROP TABLE t1; SET SQL_MODE=DEFAULT; +# +# Bug #34512: CAST( AVG( double ) AS DECIMAL ) returns wrong results +# + +CREATE TABLE t1(a DOUBLE); +INSERT INTO t1 VALUES (10), (20); +SELECT AVG(a), CAST(AVG(a) AS DECIMAL) FROM t1; + +DROP TABLE t1; + ### --echo End of 5.0 tests diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test index 12824a9b39d..36c18979154 100644 --- a/mysql-test/t/func_misc.test +++ b/mysql-test/t/func_misc.test @@ -94,36 +94,192 @@ show create table t1; drop table t1; # -# Bug #6760: Add SLEEP() function -# -create table t1 (a timestamp default '2005-05-05 01:01:01', - b timestamp default '2005-05-05 01:01:01'); -insert into t1 set a = now(); -select sleep(3); -update t1 set b = now(); -select timediff(b, a) >= '00:00:03' from t1; -drop table t1; - -# -# Bug #12689: SLEEP() gets incorrectly cached/optimized-away -# -set global query_cache_size=1355776; -create table t1 (a int); -insert into t1 values (1),(1),(1); -create table t2 (a datetime default null, b datetime default null); -insert into t2 set a = now(); -select a from t1 where sleep(1); -update t2 set b = now() where b is null; -insert into t2 set a = now(); -select a from t1 where sleep(a); -update t2 set b = now() where b is null; -insert into t2 set a = now(); -select a from t1 where sleep(1); -update t2 set b = now() where b is null; -select timediff(b, a) >= '00:00:03' from t2; -drop table t2; -drop table t1; -set global query_cache_size=default; +# Bug#6760: Add SLEEP() function (feature request) +# +# Logics of original test: +# Reveal that a query with SLEEP does not need less time than estimated. +# +# Bug#12689: SLEEP() gets incorrectly cached/optimized-away +# +# Description from bug report (slightly modified) +# +# Bug 1 (happened all time): +# SELECT * FROM t1 WHERE SLEEP(1) will only result in a sleep of 1 +# second, regardless of the number of rows in t1. +# Bug 2 (happened all time): +# Such a query will also get cached by the query cache, but should not. +# +# Notes (mleich, 2008-05) +# ======================= +# +# Experiments around +# Bug#36345 Test 'func_misc' fails on RHAS3 x86_64 +# showed that the tests for both bugs could produce in case of parallel +# artificial system time (like via ntpd) +# - decreases false alarm +# - increases false success +# +# We try here to circumvent these issues by reimplementation of the tests +# and sophisticated scripting, although the cause of the problems is a massive +# error within the setup of the testing environment. +# Tests relying on or checking derivates of the system time must never meet +# parallel manipulations of system time. +# +# Results of experiments with/without manipulation of system time, +# information_schema.processlist content, high load on testing box +# ---------------------------------------------------------------- +# Definition: Predicted_cumulative_sleep_time = +# #_of_result_rows * sleep_time_per_result_row +# +# 1. Total (real sleep time) ~= predicted_cumulative_sleep_time !! +# 2. The state of a session within the PROCESSLIST changes to 'User sleep' +# if the sessions runs a statement containing the sleep function and the +# processing of the statement is just within the phase where the sleep +# is done. (*) +# 3. NOW() and processlist.time behave "synchronous" to system time and +# show also the "jumps" caused by system time manipulations. (*) +# 4. processlist.time is unsigned, the "next" value below 0 is ~ 4G (*) +# 5. Current processlist.time ~= current real sleep time if the system time +# was not manipulated. (*) +# 6. High system load can cause delays of <= 2 seconds. +# 7. Thanks to Davi for excellent hints and ideas. +# +# (*) +# - information_schema.processlist is not available before MySQL 5.1. +# - Observation of processlist content requires a +# - "worker" session sending the query with "send" and pulling results +# with "reap" +# - session observing the processlist parallel to the worker session +# "send" and "reap" do not work in case of an embedded server. +# Conclusion: Tests based on processlist have too many restrictions. +# +# Solutions for subtests based on TIMEDIFF of values filled via NOW() +# ------------------------------------------------------------------- +# Run the following sequence three times +# 1. SELECT <start_time> +# 2. Query with SLEEP +# 3. SELECT <end_time> +# If TIMEDIFF(<end_time>,<start_time>) is at least two times within a +# reasonable range assume that we did not met errors we were looking for. +# +# It is extreme unlikely that we have two system time changes within the +# < 30 seconds runtime. Even if the unlikely happens, there are so +# frequent runs of this test on this or another testing box which will +# catch the problem. +# + +--echo #------------------------------------------------------------------------ +--echo # Tests for Bug#6760 and Bug#12689 +# Number of rows within the intended result set. +SET @row_count = 4; +# Parameter within SLEEP function +SET @sleep_time_per_result_row = 1; +# Maximum acceptable delay caused by high load on testing box +SET @max_acceptable_delay = 2; +# TIMEDIFF = time for query with sleep (mostly the time caused by SLEEP) +# + time for delays caused by high load on testing box +# Ensure that at least a reasonable fraction of TIMEDIFF belongs to the SLEEP +# by appropriate setting of variables. +# Ensure that any "judging" has a base of minimum three attempts. +# (Test 2 uses all attempts except the first one.) +if (!` SELECT (@sleep_time_per_result_row * @row_count - @max_acceptable_delay > + @sleep_time_per_result_row) AND (@row_count - 1 >= 3)`) +{ + --echo # Have to abort because of error in plausibility check + --echo ###################################################### + --vertical_results + SELECT @sleep_time_per_result_row * @row_count - @max_acceptable_delay > + @sleep_time_per_result_row AS must_be_1, + @row_count - 1 >= 3 AS must_be_also_1, + @sleep_time_per_result_row, @row_count, @max_acceptable_delay; + exit; +} +SET @@global.query_cache_size = 1024 * 64; +--disable_warnings +DROP TEMPORARY TABLE IF EXISTS t_history; +DROP TABLE IF EXISTS t1; +--enable_warnings +CREATE TEMPORARY TABLE t_history (attempt SMALLINT, +start_ts DATETIME, end_ts DATETIME, +start_cached INTEGER, end_cached INTEGER); +CREATE TABLE t1 (f1 BIGINT); +let $num = `SELECT @row_count`; +while ($num) +{ + INSERT INTO t1 VALUES (1); + dec $num; +} + +let $loops = 4; +let $num = $loops; +while ($num) +{ + let $Qcache_queries_in_cache = + query_get_value(SHOW STATUS LIKE 'Qcache_queries_in_cache', Value, 1); + eval + INSERT INTO t_history + SET attempt = $loops - $num + 1, start_ts = NOW(), + start_cached = $Qcache_queries_in_cache; + SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1; + # + # Do not determine Qcache_queries_in_cache before updating end_ts. The SHOW + # might cost too much time on an overloaded box. + eval + UPDATE t_history SET end_ts = NOW() + WHERE attempt = $loops - $num + 1; + let $Qcache_queries_in_cache = + query_get_value(SHOW STATUS LIKE 'Qcache_queries_in_cache', Value, 1); + eval + UPDATE t_history SET end_cached = $Qcache_queries_in_cache + WHERE attempt = $loops - $num + 1; + # DEBUG eval SELECT * FROM t_history WHERE attempt = $loops - $num + 1; + dec $num; +} + +# 1. The majority of queries with SLEEP must need a reasonable time +# -> SLEEP has an impact on runtime +# = Replacement for original Bug#6760 test +# -> total runtime is clear more needed than for one result row needed +# = Replacement for one of the original Bug#12689 tests +--echo # Test 1: Does the query with SLEEP need a reasonable time? +eval SELECT COUNT(*) >= $loops - 1 INTO @aux1 FROM t_history +WHERE TIMEDIFF(end_ts,start_ts) - @sleep_time_per_result_row * @row_count + BETWEEN 0 AND @max_acceptable_delay; +SELECT @aux1 AS "Expect 1"; +# +# 2. The majority of queries (the first one must be ignored) with SLEEP must +# need a reasonable time +# -> If we assume that the result of a cached query will be sent back +# immediate, without any sleep, than the query with SLEEP cannot be cached +# (current and intended behaviour for queries with SLEEP). +# -> It could be also not excluded that the query was cached but the server +# honoured somehow the SLEEP. Such a behaviour would be also acceptable. +# = Replacement for one of the original Bug#12689 tests +--echo # Test 2: Does the query with SLEEP need a reasonable time even in case +--echo # of the non first execution? +eval SELECT COUNT(*) >= $loops - 1 - 1 INTO @aux2 FROM t_history +WHERE TIMEDIFF(end_ts,start_ts) - @sleep_time_per_result_row * @row_count + BETWEEN 0 AND @max_acceptable_delay + AND attempt > 1; +SELECT @aux2 AS "Expect 1"; +# +# 3. The query with SLEEP should be not cached. +# -> SHOW STATUS Qcache_queries_in_cache must be not incremented after +# the execution of the query with SLEEP +--echo # Test 3: The query with SLEEP must be not cached. +eval SELECT COUNT(*) = $loops INTO @aux3 FROM t_history +WHERE end_cached = start_cached; +SELECT @aux3 AS "Expect 1"; +# +# Dump the content of t_history if one of the tests failed. +if (`SELECT @aux1 + @aux2 + @aux3 <> 3`) +{ + --echo # Some tests failed, dumping the content of t_history + SELECT * FROM t_history; +} +DROP TABLE t1; +DROP TEMPORARY TABLE t_history; +SET @@global.query_cache_size = default; # # Bug #21466: INET_ATON() returns signed, not unsigned @@ -223,7 +379,7 @@ SELECT NAME_CONST('flag',-SQRT(4)) * MAX(a) FROM t1; DROP TABLE t1; # -# Bug #27545: erroneous usage of NAME_CONST with a name as the first parameter +# Bug #27545: erroneous usage of NAME_CONST with a name as the first parameter # resolved against a column name of a derived table hangs the client # diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test index ed95d90c8f8..e4b95502143 100644 --- a/mysql-test/t/grant.test +++ b/mysql-test/t/grant.test @@ -1153,4 +1153,26 @@ DROP DATABASE db27878; use test; DROP TABLE t1; +# +# Bug #33201 Crash occurs when granting update privilege on one column of a view +# +drop table if exists test; +drop function if exists test_function; +drop view if exists v1; +create table test (col1 varchar(30)); +delimiter |; +create function test_function() returns varchar(30) +begin + declare tmp varchar(30); + select col1 from test limit 1 into tmp; + return '1'; +end| +delimiter ;| +create view v1 as select test.* from test where test.col1=test_function(); +grant update (col1) on v1 to 'greg'@'localhost'; +drop user 'greg'@'localhost'; +drop view v1; +drop table test; +drop function test_function; + --echo End of 5.0 tests diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index 636544f7854..82bb8a45faa 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -893,4 +893,121 @@ FROM t1; DROP TABLE t1; SET @@sql_mode = @old_sql_mode; +--echo # +--echo # Bug#27219: Aggregate functions in ORDER BY. +--echo # +SET @save_sql_mode=@@sql_mode; +SET @@sql_mode='ONLY_FULL_GROUP_BY'; + +CREATE TABLE t1 (a INT, b INT, c INT DEFAULT 0); +INSERT INTO t1 (a, b) VALUES (3,3), (2,2), (3,3), (2,2), (3,3), (4,4); +CREATE TABLE t2 SELECT * FROM t1; + +SELECT 1 FROM t1 ORDER BY COUNT(*); +SELECT 1 FROM t1 ORDER BY COUNT(*) + 1; +--error 1140 +SELECT 1 FROM t1 ORDER BY COUNT(*) + a; +SELECT 1 FROM t1 ORDER BY COUNT(*), 1; +--error 1140 +SELECT 1 FROM t1 ORDER BY COUNT(*), a; + +SELECT 1 FROM t1 ORDER BY SUM(a); +SELECT 1 FROM t1 ORDER BY SUM(a + 1); +SELECT 1 FROM t1 ORDER BY SUM(a) + 1; +--error 1140 +SELECT 1 FROM t1 ORDER BY SUM(a), b; + +--error 1140 +SELECT a FROM t1 ORDER BY COUNT(b); + +SELECT t1.a FROM t1 ORDER BY (SELECT SUM(t2.a) FROM t2); + +--error 1140 +SELECT t1.a FROM t1 ORDER BY (SELECT SUM(t2.a), t2.a FROM t2); +--error 1140 +SELECT t1.a FROM t1 ORDER BY (SELECT SUM(t2.a) FROM t2 ORDER BY t2.a); +--error 1140 +SELECT t1.a FROM t1 ORDER BY (SELECT t2.a FROM t2 ORDER BY SUM(t2.b) LIMIT 1); + +--error 1140 +SELECT t1.a FROM t1 + WHERE t1.a = (SELECT t2.a FROM t2 ORDER BY SUM(t2.b) LIMIT 1); +--error 1140 +SELECT t1.a FROM t1 GROUP BY t1.a + HAVING t1.a = (SELECT t2.a FROM t2 ORDER BY SUM(t2.a) LIMIT 1); + +SELECT t1.a FROM t1 GROUP BY t1.a + HAVING t1.a IN (SELECT t2.a FROM t2 ORDER BY SUM(t1.b)); +--error 1140 +SELECT t1.a FROM t1 GROUP BY t1.a + HAVING t1.a IN (SELECT t2.a FROM t2 ORDER BY t2.a, SUM(t2.b)); +--error 1140 +SELECT t1.a FROM t1 GROUP BY t1.a + HAVING t1.a > ANY (SELECT t2.a FROM t2 ORDER BY t2.a, SUM(t2.b)); + +--error 1140 +SELECT t1.a FROM t1 + WHERE t1.a = (SELECT t2.a FROM t2 ORDER BY SUM(t1.b)); + +SELECT 1 FROM t1 GROUP BY t1.a + HAVING (SELECT AVG(SUM(t1.b) + 1) FROM t2 ORDER BY SUM(t2.a) LIMIT 1); +SELECT 1 FROM t1 GROUP BY t1.a + HAVING (SELECT AVG(SUM(t1.b) + t2.b) FROM t2 ORDER BY SUM(t2.a) LIMIT 1); +SELECT 1 FROM t1 GROUP BY t1.a + HAVING (SELECT AVG(t1.b + t2.b) FROM t2 ORDER BY SUM(t2.a) LIMIT 1); + +--error 1140 +SELECT 1 FROM t1 GROUP BY t1.a + HAVING (SELECT AVG(SUM(t1.b) + 1) FROM t2 ORDER BY t2.a LIMIT 1); +--error 1140 +SELECT 1 FROM t1 GROUP BY t1.a + HAVING (SELECT AVG(SUM(t1.b) + t2.b) FROM t2 ORDER BY t2.a LIMIT 1); +--error 1140 +SELECT 1 FROM t1 GROUP BY t1.a + HAVING (SELECT AVG(t1.b + t2.b) FROM t2 ORDER BY t2.a LIMIT 1); + +# Both SUMs are aggregated in the subquery, no mixture: +SELECT t1.a FROM t1 + WHERE t1.a = (SELECT t2.a FROM t2 GROUP BY t2.a + ORDER BY SUM(t2.b), SUM(t1.b) LIMIT 1); + +# SUM(t1.b) is aggregated in the subquery, no mixture: +SELECT t1.a, SUM(t1.b) FROM t1 + WHERE t1.a = (SELECT SUM(t2.b) FROM t2 GROUP BY t2.a + ORDER BY SUM(t2.b), SUM(t1.b) LIMIT 1) + GROUP BY t1.a; + +# 2nd SUM(t1.b) is aggregated in the subquery, no mixture: +SELECT t1.a, SUM(t1.b) FROM t1 + WHERE t1.a = (SELECT SUM(t2.b) FROM t2 + ORDER BY SUM(t2.b) + SUM(t1.b) LIMIT 1) + GROUP BY t1.a; + +# SUM(t2.b + t1.a) is aggregated in the subquery, no mixture: +SELECT t1.a, SUM(t1.b) FROM t1 + WHERE t1.a = (SELECT SUM(t2.b) FROM t2 + ORDER BY SUM(t2.b + t1.a) LIMIT 1) + GROUP BY t1.a; + +SELECT t1.a FROM t1 GROUP BY t1.a + HAVING (1, 1) = (SELECT SUM(t1.a), t1.a FROM t2 LIMIT 1); + +select avg ( + (select + (select sum(outr.a + innr.a) from t1 as innr limit 1) as tt + from t1 as outr order by outr.a limit 1)) +from t1 as most_outer; + +--error 1140 +select avg ( + (select ( + (select sum(outr.a + innr.a) from t1 as innr limit 1)) as tt + from t1 as outr order by count(outr.a) limit 1)) as tt +from t1 as most_outer; + +select (select sum(outr.a + t1.a) from t1 limit 1) as tt from t1 as outr order by outr.a; + +SET sql_mode=@save_sql_mode; +DROP TABLE t1, t2; + --echo End of 5.0 tests diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index b0ebc340e6e..8fd3148c34d 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -1113,8 +1113,6 @@ select * from `information_schema`.`TRIGGERS` where `EVENT_OBJECT_TABLE` = NULL; select * from `information_schema`.`VIEWS` where `TABLE_SCHEMA` = NULL; select * from `information_schema`.`VIEWS` where `TABLE_NAME` = NULL; ---echo End of 5.0 tests. - # # Bug#30079 A check for "hidden" I_S tables is flawed # @@ -1123,3 +1121,28 @@ show fields from information_schema.table_names; --error 1109 show keys from information_schema.table_names; +# +# Bug#34529: Crash on complex Falcon I_S select after ALTER .. PARTITION BY +# +USE information_schema; +SET max_heap_table_size = 16384; + +CREATE TABLE test.t1( a INT ); + +# What we need to create here is a bit of a corner case: +# We need a star query with information_schema tables, where the first +# branch of the star join produces zero rows, so that reading of the +# second branch never happens. At the same time we have to make sure +# that data for at least the last table is swapped from MEMORY/HEAP to +# MyISAM. This and only this triggers the bug. +SELECT * +FROM tables ta +JOIN collations co ON ( co.collation_name = ta.table_catalog ) +JOIN character_sets cs ON ( cs.character_set_name = ta.table_catalog ); + +DROP TABLE test.t1; +SET max_heap_table_size = DEFAULT; +USE test; + +--echo End of 5.0 tests. + diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test index 9eb92015399..e9da2bbadc5 100644 --- a/mysql-test/t/loaddata.test +++ b/mysql-test/t/loaddata.test @@ -236,4 +236,86 @@ SELECT * FROM t1; remove_file $MYSQLTEST_VARDIR/tmp/t1; DROP TABLE t1; +########################################################################### + +--echo +--echo # -- +--echo # -- Bug#35469: server crash with LOAD DATA INFILE to a VIEW. +--echo # -- + +--echo +--disable_warnings +DROP TABLE IF EXISTS t1; +DROP VIEW IF EXISTS v1; +DROP VIEW IF EXISTS v2; +DROP VIEW IF EXISTS v3; +--enable_warnings + +--echo +CREATE TABLE t1(c1 INT, c2 VARCHAR(255)); + +--echo +CREATE VIEW v1 AS SELECT * FROM t1; +CREATE VIEW v2 AS SELECT 1 + 2 AS c0, c1, c2 FROM t1; +CREATE VIEW v3 AS SELECT 1 AS d1, 2 AS d2; + +--echo +LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v1 + FIELDS ESCAPED BY '\\' + TERMINATED BY ',' + ENCLOSED BY '"' + LINES TERMINATED BY '\n' (c1, c2); + +--echo +SELECT * FROM t1; + +--echo +SELECT * FROM v1; + +--echo +DELETE FROM t1; + +--echo +LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v2 + FIELDS ESCAPED BY '\\' + TERMINATED BY ',' + ENCLOSED BY '"' + LINES TERMINATED BY '\n' (c1, c2); + +--echo +SELECT * FROM t1; + +--echo +SELECT * FROM v2; + +--echo +DELETE FROM t1; + +--echo +--error ER_LOAD_DATA_INVALID_COLUMN +LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v2 + FIELDS ESCAPED BY '\\' + TERMINATED BY ',' + ENCLOSED BY '"' + LINES TERMINATED BY '\n' (c0, c2); + +--echo +--error ER_NON_UPDATABLE_TABLE +LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v3 + FIELDS ESCAPED BY '\\' + TERMINATED BY ',' + ENCLOSED BY '"' + LINES TERMINATED BY '\n' (d1, d2); + +--echo +DROP TABLE t1; +DROP VIEW v1; +DROP VIEW v2; +DROP VIEW v3; + +--echo +--echo # -- End of Bug#35469. + +########################################################################### + # End of 5.0 tests diff --git a/mysql-test/t/multi_update_tiny_hash-master.opt b/mysql-test/t/multi_update_tiny_hash-master.opt new file mode 100644 index 00000000000..d81cc55090d --- /dev/null +++ b/mysql-test/t/multi_update_tiny_hash-master.opt @@ -0,0 +1 @@ +--set-variable=max_heap_table_size=16384 diff --git a/mysql-test/t/multi_update_tiny_hash.test b/mysql-test/t/multi_update_tiny_hash.test new file mode 100644 index 00000000000..10d469fb076 --- /dev/null +++ b/mysql-test/t/multi_update_tiny_hash.test @@ -0,0 +1,61 @@ +# +# Test of update statement that uses many tables, +# --max_heap_table_size=1 +# + +--disable_warnings +drop table if exists t1, t2; +--enable_warnings + +--echo # +--echo # Bug #36676: multiupdate using LEFT JOIN updates only +--echo # first row or fails with an error: +--echo # ERROR 1022 (23000): Can't write; duplicate key in table '' +--echo # + +--echo + +--echo # +--echo # Multiupdate creates MyISAM temporary table without MEMORY table +--echo # + +CREATE TABLE t1 (ID INT); +CREATE TABLE t2 (ID INT, + s1 TEXT, s2 TEXT, s3 VARCHAR(10), s4 TEXT, s5 VARCHAR(10)); + +INSERT INTO t1 VALUES (1),(2); +INSERT INTO t2 VALUES (1,'test', 'test', 'test', 'test', 'test'), + (2,'test', 'test', 'test', 'test', 'test'); + +SELECT * FROM t1 LEFT JOIN t2 USING(ID); +UPDATE t1 LEFT JOIN t2 USING(ID) SET s1 = 'changed'; +UPDATE t1 JOIN t2 USING(ID) SET s2 = 'changed'; +UPDATE t1 LEFT JOIN t2 USING(ID) SET s3 = 'changed'; +UPDATE t1 LEFT JOIN t2 USING(ID) SET s4 = 'changed', s5 = 'changed'; +SELECT * FROM t1 LEFT JOIN t2 USING(ID); + +DROP TABLE t1, t2; + +--echo # +--echo # Multiupdate creates temporary MyISAM table from MEMORY table +--echo # + +CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY); +CREATE TABLE t2 (id INT, s1 CHAR(255)); + +# insert [1..64] into table `t1` +INSERT INTO t1 VALUES (0), (0), (0), (0), (0), (0), (0), (0); +INSERT INTO t1 (SELECT 0 FROM t1); +INSERT INTO t1 (SELECT 0 FROM t1); +INSERT INTO t1 (SELECT 0 FROM t1); + +INSERT INTO t2 (SELECT ID, 'a' FROM t1); + +UPDATE t1 LEFT JOIN t2 USING(id) SET s1 = 'b'; + +SELECT DISTINCT s1 FROM t1 LEFT JOIN t2 USING(id); + +DROP TABLE t1, t2; + + +--echo # End of 5.0 tests diff --git a/mysql-test/t/mysql_delimiter.sql b/mysql-test/t/mysql_delimiter.sql index db679c3b06b..917401275a2 100644 --- a/mysql-test/t/mysql_delimiter.sql +++ b/mysql-test/t/mysql_delimiter.sql @@ -59,3 +59,16 @@ source t/mysql_delimiter_19799.sql use test// show tables// delimiter ; # Reset delimiter + +# +# Bug #33812: mysql client incorrectly parsing DELIMITER +# +select a as delimiter from t1 +delimiter ; # Reset delimiter + +# +# Bug #36244: MySQL CLI doesn't recognize standalone -- as comment +# before DELIMITER statement +# +-- +DELIMITER ; diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index 1352b366508..cdbedb1f848 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -972,4 +972,50 @@ EXPLAIN SELECT a FROM t1 WHERE a='b' OR a='B'; DROP TABLE t1; +# +# Bug #34731: highest possible value for INT erroneously filtered by WHERE +# + +# test UNSIGNED. only occurs when indexed. +CREATE TABLE t1 (f1 TINYINT(11) UNSIGNED NOT NULL, PRIMARY KEY (f1)); + +INSERT INTO t1 VALUES (127),(254),(0),(1),(255); + +# test upper bound +# count 5 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 256; +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 256.0; +# count 4 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 255; + +# show we don't fiddle with lower bound on UNSIGNED +# count 0 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < -1; +# count 5 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -1; + +DROP TABLE t1; + + +# test signed. only occurs when index. +CREATE TABLE t1 ( f1 TINYINT(11) NOT NULL, PRIMARY KEY (f1)); + +INSERT INTO t1 VALUES (127),(126),(0),(-128),(-127); + +# test upper bound +# count 5 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 128; +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 128.0; +# count 4 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 127; + +# test lower bound +# count 5 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -129; +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -129.0; +# count 4 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -128; + +DROP TABLE t1; + # End of 5.0 tests diff --git a/mysql-test/t/repair.test b/mysql-test/t/repair.test index 9870e1749b3..4af0895827c 100644 --- a/mysql-test/t/repair.test +++ b/mysql-test/t/repair.test @@ -113,3 +113,33 @@ SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size; DROP TABLE t1; --echo End of 4.1 tests + +# +# BUG#36055 - mysql_upgrade doesn't really 'upgrade' tables +# + +--echo # Test with a saved table from 4.1 +--copy_file std_data/bug36055.frm $MYSQLTEST_VARDIR/master-data/test/t1.frm +--copy_file std_data/bug36055.MYD $MYSQLTEST_VARDIR/master-data/test/t1.MYD +--copy_file std_data/bug36055.MYI $MYSQLTEST_VARDIR/master-data/test/t1.MYI + +--replace_column 12 # 13 # +SHOW TABLE STATUS LIKE 't1'; +SELECT * FROM t1; + +--echo # Run CHECK TABLE, it should indicate table need a REPAIR TABLE +CHECK TABLE t1 FOR UPGRADE; + +--echo # REPAIR old table USE_FRM should fail +REPAIR TABLE t1 USE_FRM; + +--echo # Run REPAIR TABLE to upgrade .frm file +REPAIR TABLE t1; +--replace_column 12 # 13 # +SHOW TABLE STATUS LIKE 't1'; +SELECT * FROM t1; + +REPAIR TABLE t1 USE_FRM; +SELECT * FROM t1; + +DROP TABLE t1; diff --git a/mysql-test/t/rpl_auto_increment_bug33029.test b/mysql-test/t/rpl_auto_increment_bug33029.test new file mode 100644 index 00000000000..db548945c7f --- /dev/null +++ b/mysql-test/t/rpl_auto_increment_bug33029.test @@ -0,0 +1,109 @@ +# BUG#33029 5.0 to 5.1 replication fails on dup key when inserting +# using a trig in SP + +# For all 5.0 up to 5.0.58 exclusive, and 5.1 up to 5.1.12 exclusive, +# if one statement in a SP generated AUTO_INCREMENT value by the top +# statement, all statements after it would be considered generated +# AUTO_INCREMENT value by the top statement, and a erroneous INSERT_ID +# value might be associated with these statement, which could cause +# duplicate entry error and stop the slave. + +source include/master-slave.inc; + +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS p2; +DROP TRIGGER IF EXISTS tr1; +DROP FUNCTION IF EXISTS f1; +--enable_warnings + +CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY); +CREATE TABLE t2 (id INT AUTO_INCREMENT PRIMARY KEY); + +delimiter //; + +CREATE PROCEDURE p1() +BEGIN + DECLARE ins_count INT DEFAULT 10; + + WHILE ins_count > 0 DO + INSERT INTO t1 VALUES (NULL); + SET ins_count = ins_count - 1; + END WHILE; + + DELETE FROM t1 WHERE id = 1; + DELETE FROM t1 WHERE id = 2; + DELETE FROM t2 WHERE id = 1; + DELETE FROM t2 WHERE id = 2; +END// + +CREATE PROCEDURE p2() +BEGIN + INSERT INTO t1 VALUES (NULL); + DELETE FROM t1 WHERE id = f1(3); + DELETE FROM t1 WHERE id = f1(4); + DELETE FROM t2 WHERE id = 3; + DELETE FROM t2 WHERE id = 4; +END// + +CREATE TRIGGER tr1 BEFORE DELETE + ON t1 FOR EACH ROW + BEGIN + INSERT INTO t2 VALUES (NULL); + END// + +CREATE FUNCTION f1 (i int) RETURNS int + BEGIN + INSERT INTO t2 VALUES (NULL); + RETURN i; + END// + +delimiter ;// + +# the $binlog_start will be used by the show_binlog_events.inc, so +# that we can skip binlog events we don't care +let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); +CALL p1(); +source include/show_binlog_events.inc; + +echo # Result on master; +SELECT * FROM t1; +SELECT * FROM t2; + +sync_slave_with_master; + +echo # Result on slave; +SELECT * FROM t1; +SELECT * FROM t2; + +connection master; + +DROP TRIGGER tr1; + +# the $binlog_start will be used by the show_binlog_events.inc, so +# that we can skip binlog events we don't care +let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); +CALL p2(); +source include/show_binlog_events.inc; + +echo # Result on master; +SELECT * FROM t1; +SELECT * FROM t2; + +sync_slave_with_master; + +echo # Result on slave; +SELECT * FROM t1; +SELECT * FROM t2; + +# clean up +connection master; +disable_warnings; +DROP TABLE IF EXISTS t1, t2; +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS p2; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS tr1; +enable_warnings; +sync_slave_with_master; diff --git a/mysql-test/t/rpl_packet.test b/mysql-test/t/rpl_packet.test index 84bc5d908bf..a3efdf24bce 100644 --- a/mysql-test/t/rpl_packet.test +++ b/mysql-test/t/rpl_packet.test @@ -13,13 +13,25 @@ enable_warnings; eval create database $db; connection master; -select @@net_buffer_length, @@max_allowed_packet; +SET @@global.max_allowed_packet=1024; +SET @@global.net_buffer_length=1024; + +# Restart slave for setting to take effect +connection slave; +STOP SLAVE; +source include/wait_for_slave_to_stop.inc; +START SLAVE; +source include/wait_for_slave_to_start.inc; + +# Reconnect to master for new setting to take effect disconnect master; # alas, can't use eval here; if db name changed apply the change here connect (master,localhost,root,,DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________); connection master; +select @@net_buffer_length, @@max_allowed_packet; + create table `t1` (`f1` LONGTEXT) ENGINE=MyISAM; INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1023'); @@ -52,7 +64,9 @@ SET @@global.net_buffer_length=4096; # Restart slave for new setting to take effect connection slave; STOP SLAVE; +source include/wait_for_slave_to_stop.inc; START SLAVE; +source include/wait_for_slave_to_start.inc; # Reconnect to master for new setting to take effect disconnect master; diff --git a/mysql-test/t/rpl_sp.test b/mysql-test/t/rpl_sp.test index f7cd8907e34..f045257d279 100644 --- a/mysql-test/t/rpl_sp.test +++ b/mysql-test/t/rpl_sp.test @@ -577,3 +577,55 @@ set global log_bin_trust_function_creators=0; drop database mysqltest; drop database mysqltest2; sync_slave_with_master; + +# +# Bug#36570: Parse error of CREATE PROCEDURE stmt with comments on slave +# +connection master; +use test; +delimiter |; + +/*!50001 create procedure `mysqltestbug36570_p1`() */ +begin + select 1; +end| + +use mysql| +create procedure test.` mysqltestbug36570_p2`(/*!50001 a int*/)`label`: +begin + select a; +end| + +/*!50001 create function test.mysqltestbug36570_f1() */ + returns int + /*!50001 deterministic */ +begin + return 3; +end| +use test| + +delimiter ;| + +--replace_column 5 t 6 t +show procedure status like '%mysqltestbug36570%'; +show create procedure ` mysqltestbug36570_p2`; + +sync_slave_with_master; +connection slave; + +--replace_column 5 t 6 t +show procedure status like '%mysqltestbug36570%'; +show create procedure ` mysqltestbug36570_p2`; +call ` mysqltestbug36570_p2`(42); + +--replace_column 5 t 6 t +show function status like '%mysqltestbug36570%'; + +connection master; +flush logs; +--replace_regex s/$MYSQL_TEST_DIR/MYSQL_TEST_DIR/ s/TIMESTAMP=[0-9]*/TIMESTAMP=t/ +--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001 +use test; +drop procedure mysqltestbug36570_p1; +drop procedure ` mysqltestbug36570_p2`; +drop function mysqltestbug36570_f1; diff --git a/mysql-test/t/rpl_view.test b/mysql-test/t/rpl_view.test index 21748586130..44ef0c3e1eb 100644 --- a/mysql-test/t/rpl_view.test +++ b/mysql-test/t/rpl_view.test @@ -161,4 +161,22 @@ DROP VIEW v1; DROP TABLE t1; sync_slave_with_master; +# +# Bug#32575 Parse error of stmt with extended comments on slave side +# Verify that 'CREATE VIEW' with comments is properly logged to binlog +connection master; +CREATE TABLE t1 (a INT); +--echo # create view as output from mysqldump 10.11 (5.0.62) +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` < 3) */ +/*!50002 WITH CASCADED CHECK OPTION */; +SHOW CREATE VIEW v1; +sync_slave_with_master; +SHOW CREATE VIEW v1; +connection master; +DROP VIEW v1; +DROP TABLE t1; +sync_slave_with_master; + --echo End of 5.0 tests diff --git a/mysql-test/t/sp-code.test b/mysql-test/t/sp-code.test index 751282c895a..a76863dd5fa 100644 --- a/mysql-test/t/sp-code.test +++ b/mysql-test/t/sp-code.test @@ -598,4 +598,36 @@ show procedure code proc_33618_c; drop procedure proc_33618_h; drop procedure proc_33618_c; +# +# Bug#20906 (Multiple assignments in SET in stored routine produce incorrect +# instructions) +# + +--disable_warnings +drop procedure if exists p_20906_a; +drop procedure if exists p_20906_b; +--enable_warnings + +create procedure p_20906_a() SET @a=@a+1, @b=@b+1; +show procedure code p_20906_a; + +set @a=1; +set @b=1; + +call p_20906_a(); +select @a, @b; + +create procedure p_20906_b() SET @a=@a+1, @b=@b+1, @c=@c+1; +show procedure code p_20906_b; + +set @a=1; +set @b=1; +set @c=1; + +call p_20906_b(); +select @a, @b, @c; + +drop procedure p_20906_a; +drop procedure p_20906_b; + --echo End of 5.0 tests. diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index c5edd5414e3..4d9507f1231 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -9,28 +9,28 @@ SELECT (SELECT 1) UNION SELECT (SELECT 2); explain extended SELECT (SELECT 1) UNION SELECT (SELECT 2); SELECT (SELECT (SELECT 0 UNION SELECT 0)); explain extended SELECT (SELECT (SELECT 0 UNION SELECT 0)); --- error 1247 +-- error ER_ILLEGAL_REFERENCE SELECT (SELECT 1 FROM (SELECT 1) as b HAVING a=1) as a; --- error 1247 +-- error ER_ILLEGAL_REFERENCE SELECT (SELECT 1 FROM (SELECT 1) as b HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) as c HAVING a=1) as b; SELECT (SELECT 1),MAX(1) FROM (SELECT 1) as a; --- error 1247 +-- error ER_ILLEGAL_REFERENCE SELECT (SELECT a) as a; EXPLAIN EXTENDED SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1; SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1; --- error 1054 +-- error ER_BAD_FIELD_ERROR SELECT (SELECT 1), a; SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1; --- error 1054 +-- error ER_BAD_FIELD_ERROR SELECT 1 FROM (SELECT (SELECT a) b) c; SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id); --- error 1241 +-- error ER_OPERAND_COLUMNS SELECT * FROM (SELECT 1) a WHERE 1 IN (SELECT 1,1); SELECT 1 IN (SELECT 1); SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a)); --- error 1221 +-- error ER_WRONG_USAGE select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1)); --- error 1108 +-- error ER_WRONG_PARAMETERS_TO_PROCEDURE SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1)); -- error ER_BAD_FIELD_ERROR SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL; @@ -53,7 +53,7 @@ SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a'); SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a'); SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a'); --- error 1241 +-- error ER_OPERAND_COLUMNS SELECT (SELECT * FROM (SELECT 'test' a,'test' b) a); SELECT 1 as a,(SELECT a+a) b,(SELECT b); @@ -65,7 +65,7 @@ create table t4 (a int not null, b int not null); insert into t1 values (2); insert into t2 values (1,7),(2,7); insert into t4 values (4,8),(3,8),(5,9); --- error 1247 +-- error ER_ILLEGAL_REFERENCE select (select a from t1 where t1.a = a1) as a2, (select b from t2 where t2.b=a2) as a1; select (select a from t1 where t1.a=t2.a), a from t2; select (select a from t1 where t1.a=t2.b), a from t2; @@ -105,9 +105,9 @@ select * from t3 where a >= any (select b from t2); explain extended select * from t3 where a >= any (select b from t2); select * from t3 where a >= all (select b from t2); delete from t2 where a=100; --- error 1241 +-- error ER_OPERAND_COLUMNS select * from t3 where a in (select a,b from t2); --- error 1241 +-- error ER_OPERAND_COLUMNS select * from t3 where a in (select * from t2); insert into t4 values (12,7),(1,7),(10,9),(9,6),(7,6),(3,9),(1,10); # empty set @@ -123,7 +123,7 @@ select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) insert into t5 values (2); select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; explain extended select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; --- error 1242 +-- error ER_SUBQUERY_NO_1_ROW select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2; create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq)); create table t7( uq int primary key, name char(25)); @@ -133,7 +133,7 @@ select * from t6 where exists (select * from t7 where uq = clinic_uq); explain extended select * from t6 where exists (select * from t7 where uq = clinic_uq); # not unique fields --- error 1052 +-- error ER_NON_UNIQ_ERROR select * from t1 where a= (select a from t2,t4 where t2.b=t4.b); # different tipes & group functions @@ -160,14 +160,14 @@ INSERT INTO t8 (pseudo,email) VALUES ('joce','test'); INSERT INTO t8 (pseudo,email) VALUES ('joce1','test1'); INSERT INTO t8 (pseudo,email) VALUES ('2joce1','2test1'); EXPLAIN EXTENDED SELECT pseudo,(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce')) FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'); --- error 1241 +-- error ER_OPERAND_COLUMNS SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM t8 WHERE pseudo='joce'); --- error 1241 +-- error ER_OPERAND_COLUMNS SELECT pseudo FROM t8 WHERE pseudo=(SELECT * FROM t8 WHERE pseudo='joce'); SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'); --- error 1242 +-- error ER_SUBQUERY_NO_1_ROW SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo LIKE '%joce%'); drop table if exists t1,t2,t3,t4,t5,t6,t7,t8; @@ -187,7 +187,7 @@ EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'); SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'); SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1) UNION ALL SELECT 1; --- error 1242 +-- error ER_SUBQUERY_NO_1_ROW SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1) UNION SELECT 1; EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1); drop table t1; @@ -213,9 +213,9 @@ CREATE TABLE `t2` ( INSERT INTO t2 (mot,topic,date,pseudo) VALUES ('joce','40143','2002-10-22','joce'), ('joce','43506','2002-10-22','joce'); select numeropost as a FROM t1 GROUP BY (SELECT 1 FROM t1 HAVING a=1); SELECT numeropost,maxnumrep FROM t1 WHERE exists (SELECT 1 FROM t2 WHERE (mot='joce') AND date >= '2002-10-21' AND t1.numeropost = t2.topic) ORDER BY maxnumrep DESC LIMIT 0, 20; --- error 1054 +-- error ER_BAD_FIELD_ERROR SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) b; --- error 1054 +-- error ER_BAD_FIELD_ERROR SELECT 1 IN (SELECT 1 FROM t2 HAVING a); SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY topic); @@ -244,9 +244,9 @@ CREATE TABLE `t1` ( ) ENGINE=MyISAM ROW_FORMAT=FIXED; INSERT INTO t1 (numeropost,maxnumrep) VALUES (1,0),(2,1); --- error 1242 +-- error ER_SUBQUERY_NO_1_ROW select numeropost as a FROM t1 GROUP BY (SELECT 1 FROM t1 HAVING a=1); --- error 1242 +-- error ER_SUBQUERY_NO_1_ROW select numeropost as a FROM t1 ORDER BY (SELECT 1 FROM t1 HAVING a=1); drop table t1; @@ -258,7 +258,7 @@ drop table t1; #iftest CREATE TABLE t1 (field char(1) NOT NULL DEFAULT 'b'); INSERT INTO t1 VALUES (); --- error 1242 +-- error ER_SUBQUERY_NO_1_ROW SELECT field FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1 FROM (SELECT 1) a HAVING field='b'); drop table t1; @@ -271,13 +271,13 @@ CREATE TABLE `t1` ( UNIQUE KEY `numreponse` (`numreponse`), KEY `pseudo` (`pseudo`,`numeropost`) ) ENGINE=MyISAM; --- error 1247 +-- error ER_ILLEGAL_REFERENCE SELECT (SELECT numeropost FROM t1 HAVING numreponse=a),numreponse FROM (SELECT * FROM t1) as a; --- error 1054 +-- error ER_BAD_FIELD_ERROR SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=a) FROM (SELECT * FROM t1) as a; SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT * FROM t1) as a; INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test'); --- error 1242 +-- error ER_SUBQUERY_NO_1_ROW EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1'); EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'; EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'); @@ -294,9 +294,9 @@ create table t2 (a int NOT NULL, b int, primary key (a)); insert into t1 values (0, 10),(1, 11),(2, 12); insert into t2 values (1, 21),(2, 22),(3, 23); select * from t1; --- error 1093 +-- error ER_UPDATE_TABLE_USED update t1 set b= (select b from t1); --- error 1242 +-- error ER_SUBQUERY_NO_1_ROW update t1 set b= (select b from t2); update t1 set b= (select b from t2 where t1.a = t2.a); select * from t1; @@ -309,9 +309,9 @@ insert into t1 values (0, 10),(1, 11),(2, 12); insert into t2 values (1, 21),(2, 12),(3, 23); select * from t1; select * from t1 where b = (select b from t2 where t1.a = t2.a); --- error 1093 +-- error ER_UPDATE_TABLE_USED delete from t1 where b = (select b from t1); --- error 1242 +-- error ER_SUBQUERY_NO_1_ROW delete from t1 where b = (select b from t2); delete from t1 where b = (select b from t2 where t1.a = t2.a); select * from t1; @@ -327,9 +327,9 @@ insert into t12 values (33, 10),(22, 11),(2, 12); insert into t2 values (1, 21),(2, 12),(3, 23); select * from t11; select * from t12; --- error 1093 +-- error ER_UPDATE_TABLE_USED delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a); --- error 1242 +-- error ER_SUBQUERY_NO_1_ROW delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2); delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a); select * from t11; @@ -342,25 +342,29 @@ create table t2 (a int); create table t3 (b int); insert into t2 values (1); insert into t3 values (1),(2); --- error 1093 +-- error ER_UPDATE_TABLE_USED INSERT INTO t1 (x) VALUES ((SELECT x FROM t1)); --- error 1242 +-- error ER_SUBQUERY_NO_1_ROW INSERT INTO t1 (x) VALUES ((SELECT b FROM t3)); INSERT INTO t1 (x) VALUES ((SELECT a FROM t2)); select * from t1; insert into t2 values (1); +let $row_count_before= `SELECT COUNT(*) FROM t1`; INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2)); --- sleep 1 +let $wait_condition= SELECT COUNT(*) <> $row_count_before FROM t1; +--source include/wait_condition.inc select * from t1; INSERT INTO t1 (x) select (SELECT SUM(a)+1 FROM t2) FROM t2; select * from t1; # After this, only data based on old t1 records should have been added. INSERT INTO t1 (x) select (SELECT SUM(x)+2 FROM t1) FROM t2; select * from t1; --- error 1054 +-- error ER_BAD_FIELD_ERROR INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(x) FROM t2)); +let $row_count_before= `SELECT COUNT(*) FROM t1`; INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2)); --- sleep 1 +let $wait_condition= SELECT COUNT(*) <> $row_count_before FROM t1; +--source include/wait_condition.inc select * from t1; # #TODO: should be uncommented after bug 380 fix pushed @@ -375,25 +379,30 @@ create table t3 (a int); insert into t2 values (1); insert into t3 values (1),(2); select * from t1; --- error 1093 +-- error ER_UPDATE_TABLE_USED replace into t1 (x, y) VALUES ((SELECT x FROM t1), (SELECT a+1 FROM t2)); --- error 1242 +-- error ER_SUBQUERY_NO_1_ROW replace into t1 (x, y) VALUES ((SELECT a FROM t3), (SELECT a+1 FROM t2)); replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+1 FROM t2)); select * from t1; replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+2 FROM t2)); select * from t1; +let $row_count_before= `SELECT COUNT(*) FROM t1`; replace DELAYED into t1 (x, y) VALUES ((SELECT a+3 FROM t2), (SELECT a FROM t2)); --- sleep 1 +# We get one additional row +let $wait_condition= SELECT COUNT(*) <> $row_count_before FROM t1; +--source include/wait_condition.inc select * from t1; +let $row_count_before= `SELECT COUNT(*) FROM t1 WHERE y = 2`; replace DELAYED into t1 (x, y) VALUES ((SELECT a+3 FROM t2), (SELECT a+1 FROM t2)); --- sleep 1 +let $wait_condition= SELECT COUNT(*) <> $row_count_before FROM t1 WHERE y = 2; +--source include/wait_condition.inc select * from t1; replace LOW_PRIORITY into t1 (x, y) VALUES ((SELECT a+1 FROM t2), (SELECT a FROM t2)); select * from t1; drop table t1, t2, t3; --- error 1096 +-- error ER_NO_TABLES_USED SELECT * FROM (SELECT 1) b WHERE 1 IN (SELECT *); CREATE TABLE t2 (id int(11) default NULL, KEY id (id)) ENGINE=MyISAM CHARSET=latin1; @@ -406,14 +415,14 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1)); EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3); SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3); SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2); --- error 1093 +-- error ER_UPDATE_TABLE_USED INSERT INTO t2 VALUES ((SELECT * FROM t2)); --- error 1093 +-- error ER_UPDATE_TABLE_USED INSERT INTO t2 VALUES ((SELECT id FROM t2)); SELECT * FROM t2; CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) ENGINE=MyISAM CHARSET=latin1; INSERT INTO t1 values (1),(1); --- error 1242 +-- error ER_SUBQUERY_NO_1_ROW UPDATE t2 SET id=(SELECT * FROM t1); drop table t2, t1; @@ -481,9 +490,9 @@ drop table t1,t2,t3; #LIMIT is not supported now create table t1 (a float); --- error 1235 +-- error ER_NOT_SUPPORTED_YET select 10.5 IN (SELECT * from t1 LIMIT 1); --- error 1235 +-- error ER_NOT_SUPPORTED_YET select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5); drop table t1; @@ -507,7 +516,7 @@ select ROW(1, 1, 'a') IN (select b,a,c from t1 where a is not null); select ROW(1, 1, 'a') IN (select a,b,c from t1 where c='b' or c='a'); select ROW(1, 2, 'a') IN (select a,b,c from t1 where c='b' or c='a'); select ROW(1, 1, 'a') IN (select b,a,c from t1 where c='b' or c='a'); --- error 1235 +-- error ER_NOT_SUPPORTED_YET select ROW(1, 1, 'a') IN (select b,a,c from t1 limit 2); drop table t1; @@ -522,14 +531,14 @@ set @a:=2; set @a:=(SELECT a from t1); select @a; drop table t1; --- error 1146 +-- error ER_NO_SUCH_TABLE do (SELECT a from t1); --- error 1146 +-- error ER_NO_SUCH_TABLE set @a:=(SELECT a from t1); CREATE TABLE t1 (a int, KEY(a)); HANDLER t1 OPEN; --- error 1064 +-- error ER_PARSE_ERROR HANDLER t1 READ a=((SELECT 1)); HANDLER t1 CLOSE; drop table t1; @@ -627,7 +636,7 @@ drop table t1; # # error in IN # --- error 1146 +-- error ER_NO_SUCH_TABLE select t1.Continent, t2.Name, t2.Population from t1 LEFT JOIN t2 ON t1.Code = t2.Country where t2.Population IN (select max(t2.Population) AS Population from t2, t1 where t2.Country = t1.Code group by Continent); # @@ -698,7 +707,7 @@ CREATE TABLE `t1` ( INSERT INTO t1 VALUES (1); UPDATE t1 SET i=i+(SELECT MAX(i) FROM (SELECT 1) t) WHERE i=(SELECT MAX(i)); UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i)); --- error 1054 +-- error ER_BAD_FIELD_ERROR UPDATE t1 SET t.i=i+(SELECT MAX(i) FROM (SELECT 1) t); select * from t1; drop table t1; @@ -855,7 +864,7 @@ create table t1 (s1 int); create table t2 (s1 int); insert into t1 values (1); insert into t2 values (1); --- error 1054 +-- error ER_BAD_FIELD_ERROR update t1 set s1 = s1 + 1 where 1 = (select x.s1 as A from t2 WHERE t2.s1 > t1.s1 order by A); DROP TABLE t1, t2; @@ -865,9 +874,9 @@ DROP TABLE t1, t2; CREATE TABLE t1 (s1 CHAR(5) COLLATE latin1_german1_ci, s2 CHAR(5) COLLATE latin1_swedish_ci); INSERT INTO t1 VALUES ('z','?'); --- error 1267 +-- error ER_CANT_AGGREGATE_2COLLATIONS select * from t1 where s1 > (select max(s2) from t1); --- error 1267 +-- error ER_CANT_AGGREGATE_2COLLATIONS select * from t1 where s1 > any (select max(s2) from t1); drop table t1; @@ -885,7 +894,7 @@ drop table t1, t2; # row union # create table t1 (s1 char(5)); --- error 1241 +-- error ER_OPERAND_COLUMNS select (select 'a','b' from t1 union select 'a','b' from t1) from t1; insert into t1 values ('tttt'); select * from t1 where ('a','b')=(select 'a','b' from t1 union select 'a','b' from t1); @@ -963,7 +972,7 @@ CREATE TABLE t1 (id int(11) default NULL) ENGINE=MyISAM CHARSET=latin1; INSERT INTO t1 VALUES (1),(5); CREATE TABLE t2 (id int(11) default NULL) ENGINE=MyISAM CHARSET=latin1; INSERT INTO t2 VALUES (2),(6); --- error 1241 +-- error ER_OPERAND_COLUMNS select * from t1 where (1,2,6) in (select * from t2); DROP TABLE t1,t2; @@ -973,7 +982,7 @@ DROP TABLE t1,t2; create table t1 (s1 int); insert into t1 values (1); insert into t1 values (2); --- error 1242 +-- error ER_SUBQUERY_NO_1_ROW set sort_buffer_size = (select s1 from t1); do (select * from t1); drop table t1; @@ -1003,11 +1012,11 @@ drop table t1, t2; # create table t1 (s1 int); create table t2 (s1 int); --- error 1054 +-- error ER_BAD_FIELD_ERROR select * from t1 where (select count(*) from t2 where t1.s2) = 1; --- error 1054 +-- error ER_BAD_FIELD_ERROR select * from t1 where (select count(*) from t2 group by t1.s2) = 1; --- error 1054 +-- error ER_BAD_FIELD_ERROR select count(*) from t2 group by t1.s2; drop table t1, t2; @@ -1032,9 +1041,13 @@ DROP TABLE t1; create table t1 (a int, b decimal(13, 3)); insert into t1 values (1, 0.123); +let $outfile = $MYSQLTEST_VARDIR/master-data/test/subselect.out.file.1; +--error 0,1 +--remove_file $outfile select a, (select max(b) from t1) into outfile "subselect.out.file.1" from t1; delete from t1; load data infile "subselect.out.file.1" into table t1; +--remove_file $outfile select * from t1; drop table t1; @@ -1123,7 +1136,7 @@ drop table t1; create table t1(id int); create table t2(id int); create table t3(flag int); --- error 1064 +-- error ER_PARSE_ERROR select (select * from t3 where id not null) from t1, t2; drop table t1,t2,t3; @@ -1212,31 +1225,31 @@ SELECT a FROM t1 WHERE a <= ALL (SELECT a FROM t1 HAVING a = 2 UNION SELECT a FR SELECT a FROM t1 WHERE a <> ALL (SELECT a FROM t1 HAVING a = 2 UNION SELECT a FROM t1 HAVING a = 2); # row tests # < > >= <= and = ALL/ <> ANY do not support row operation --- error 1241 +-- error ER_OPERAND_COLUMNS SELECT a FROM t1 WHERE (1,2) > ANY (SELECT a FROM t1 WHERE b = 2); --- error 1241 +-- error ER_OPERAND_COLUMNS SELECT a FROM t1 WHERE a > ANY (SELECT a,2 FROM t1 WHERE b = 2); --- error 1241 +-- error ER_OPERAND_COLUMNS SELECT a FROM t1 WHERE (1,2) > ANY (SELECT a,2 FROM t1 WHERE b = 2); --- error 1241 +-- error ER_OPERAND_COLUMNS SELECT a FROM t1 WHERE (1,2) > ALL (SELECT a FROM t1 WHERE b = 2); --- error 1241 +-- error ER_OPERAND_COLUMNS SELECT a FROM t1 WHERE a > ALL (SELECT a,2 FROM t1 WHERE b = 2); --- error 1241 +-- error ER_OPERAND_COLUMNS SELECT a FROM t1 WHERE (1,2) > ALL (SELECT a,2 FROM t1 WHERE b = 2); --- error 1241 +-- error ER_OPERAND_COLUMNS SELECT a FROM t1 WHERE (1,2) = ALL (SELECT a,2 FROM t1 WHERE b = 2); --- error 1241 +-- error ER_OPERAND_COLUMNS SELECT a FROM t1 WHERE (1,2) <> ANY (SELECT a,2 FROM t1 WHERE b = 2); # following should be converted to IN --- error 1241 +-- error ER_OPERAND_COLUMNS SELECT a FROM t1 WHERE (1,2) = ANY (SELECT a FROM t1 WHERE b = 2); --- error 1241 +-- error ER_OPERAND_COLUMNS SELECT a FROM t1 WHERE a = ANY (SELECT a,2 FROM t1 WHERE b = 2); SELECT a FROM t1 WHERE (1,2) = ANY (SELECT a,2 FROM t1 WHERE b = 2); --- error 1241 +-- error ER_OPERAND_COLUMNS SELECT a FROM t1 WHERE (1,2) <> ALL (SELECT a FROM t1 WHERE b = 2); --- error 1241 +-- error ER_OPERAND_COLUMNS SELECT a FROM t1 WHERE a <> ALL (SELECT a,2 FROM t1 WHERE b = 2); SELECT a FROM t1 WHERE (1,2) <> ALL (SELECT a,2 FROM t1 WHERE b = 2); SELECT a FROM t1 WHERE (a,1) = ANY (SELECT a,1 FROM t1 WHERE b = 2); @@ -1441,7 +1454,7 @@ CREATE TABLE `t1` ( `master` int(10) unsigned NOT NULL default '0', `map` smalli INSERT INTO `t1` VALUES (1,0,0,700),(1,1,1,400),(1,5,5,400),(1,12,12,400),(1,12,32,400),(4,12,32,400); CREATE TABLE `t2` ( `id` int(10) unsigned NOT NULL default '0', `pid` int(10) unsigned NOT NULL default '0', `map` smallint(6) unsigned NOT NULL default '0', `level` tinyint(4) unsigned NOT NULL default '0', `title` varchar(255) default NULL, PRIMARY KEY (`id`,`pid`,`map`), KEY `level` (`level`), KEY `id` (`id`,`map`)) ; INSERT INTO `t2` VALUES (6,5,12,7,'a'),(12,0,0,7,'a'),(12,1,0,7,'a'),(12,5,5,7,'a'),(12,5,12,7,'a'); --- error 1054 +-- error ER_BAD_FIELD_ERROR SELECT b.sc FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b; SELECT b.ac FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b; drop tables t1,t2; @@ -1545,7 +1558,7 @@ drop table t1; # create table t1 (a1 int); create table t2 (b1 int); ---error 1054 +--error ER_BAD_FIELD_ERROR select * from t1 where a2 > any(select b1 from t2); select * from t1 where a1 > any(select b1 from t2); drop table t1,t2; @@ -1566,11 +1579,11 @@ drop table t1; # Comparison subquery and row with nested rows # create table t1 (a integer, b integer); --- error 1241 +-- error ER_OPERAND_COLUMNS select row(1,(2,2)) in (select * from t1 ); --- error 1241 +-- error ER_OPERAND_COLUMNS select row(1,(2,2)) = (select * from t1 ); --- error 1241 +-- error ER_OPERAND_COLUMNS select (select * from t1) = row(1,(2,2)); drop table t1; @@ -1579,14 +1592,14 @@ drop table t1; # create table t1 (a integer); insert into t1 values (1); --- error 1247 +-- error ER_ILLEGAL_REFERENCE select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx ; --- error 1247 +-- error ER_ILLEGAL_REFERENCE select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx; select 1 as xx, 1 = ALL ( select 1 from t1 where 1 = xx ); --- error 1247 +-- error ER_ILLEGAL_REFERENCE select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx; --- error 1247 +-- error ER_ILLEGAL_REFERENCE select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx from DUAL; drop table t1; @@ -1723,17 +1736,17 @@ drop table t1, t2; # create table t1 (a int, b int); insert into t1 values (1,2); --- error 1241 +-- error ER_OPERAND_COLUMNS select 1 = (select * from t1); --- error 1241 +-- error ER_OPERAND_COLUMNS select (select * from t1) = 1; --- error 1241 +-- error ER_OPERAND_COLUMNS select (1,2) = (select a from t1); --- error 1241 +-- error ER_OPERAND_COLUMNS select (select a from t1) = (1,2); --- error 1241 +-- error ER_OPERAND_COLUMNS select (1,2,3) = (select * from t1); --- error 1241 +-- error ER_OPERAND_COLUMNS select (select * from t1) = (1,2,3); drop table t1; @@ -2014,21 +2027,21 @@ INSERT INTO t2 VALUES (2,1), (1,3), (2,1), (4,4), (2,2), (1,4); SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 2 ); ---error 1242 +--error ER_SUBQUERY_NO_1_ROW SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 1); SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 2), a; ---error 1242 +--error ER_SUBQUERY_NO_1_ROW SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 1), a; SELECT b, MAX(c) FROM t2 GROUP BY b, (SELECT c FROM t2 WHERE b > 2); ---error 1242 +--error ER_SUBQUERY_NO_1_ROW SELECT b, MAX(c) FROM t2 GROUP BY b, (SELECT c FROM t2 WHERE b > 1); SELECT a FROM t1 GROUP BY a HAVING IFNULL((SELECT b FROM t2 WHERE b > 2), (SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b)) > 3; ---error 1242 +--error ER_SUBQUERY_NO_1_ROW SELECT a FROM t1 GROUP BY a HAVING IFNULL((SELECT b FROM t2 WHERE b > 1), (SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b)) > 3; @@ -2036,7 +2049,7 @@ SELECT a FROM t1 GROUP BY a SELECT a FROM t1 GROUP BY a HAVING IFNULL((SELECT b FROM t2 WHERE b > 4), (SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b)) > 3; ---error 1242 +--error ER_SUBQUERY_NO_1_ROW SELECT a FROM t1 GROUP BY a HAVING IFNULL((SELECT b FROM t2 WHERE b > 4), (SELECT c FROM t2 WHERE c=a AND b > 1 ORDER BY b)) > 3; @@ -2044,7 +2057,7 @@ SELECT a FROM t1 GROUP BY a SELECT a FROM t1 ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 2), (SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b)); ---error 1242 +--error ER_SUBQUERY_NO_1_ROW SELECT a FROM t1 ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 1), (SELECT c FROM t2 WHERE c=a AND b > 1 ORDER BY b)); @@ -2052,7 +2065,7 @@ SELECT a FROM t1 SELECT a FROM t1 ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 4), (SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b)); ---error 1242 +--error ER_SUBQUERY_NO_1_ROW SELECT a FROM t1 ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 4), (SELECT c FROM t2 WHERE c=a AND b > 1 ORDER BY b)); @@ -2263,12 +2276,12 @@ SELECT t1.a FROM t1 GROUP BY t1.a HAVING t1.a > ALL(SELECT t2.c FROM t2 WHERE EXISTS(SELECT t3.e FROM t3 GROUP BY t3.e HAVING SUM(t1.a+t2.c) < t3.e/4)); --- error 1111 +-- error ER_INVALID_GROUP_FUNC_USE SELECT t1.a FROM t1 GROUP BY t1.a HAVING t1.a > ALL(SELECT t2.c FROM t2 WHERE EXISTS(SELECT t3.e FROM t3 WHERE SUM(t1.a+t2.c) < t3.e/4)); --- error 1111 +-- error ER_INVALID_GROUP_FUNC_USE SELECT t1.a from t1 GROUP BY t1.a HAVING AVG(SUM(t1.b)) > 20; SELECT t1.a FROM t1 GROUP BY t1.a @@ -2330,11 +2343,11 @@ drop table t1, t2; CREATE TABLE t1 (a INT); ---error 1054 +--error ER_BAD_FIELD_ERROR CREATE VIEW v1 AS SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1); ---error 1054 +--error ER_BAD_FIELD_ERROR CREATE VIEW v2 AS SELECT * FROM t1 WHERE no_such_column = (SELECT 1); ---error 1054 +--error ER_BAD_FIELD_ERROR SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1); DROP TABLE t1; @@ -2469,7 +2482,7 @@ SELECT * FROM t1 WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1))); #TODO:not supported ---error 1064 +--error ER_PARSE_ERROR explain select ((select t11.i from t1 t11) union (select t12.i from t1 t12)) from t1; @@ -2839,12 +2852,12 @@ SELECT a FROM t1 t0 WHERE (SELECT COUNT(t0.b) FROM t1 t WHERE t.b>20) GROUP BY a; SET @@sql_mode='ansi'; ---error 1111 +--error ER_INVALID_GROUP_FUNC_USE SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 0 GROUP BY a; ---error 1111 +--error ER_INVALID_GROUP_FUNC_USE SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 1 GROUP BY a; ---error 1111 +--error ER_INVALID_GROUP_FUNC_USE SELECT a FROM t1 t0 WHERE (SELECT COUNT(t0.b) FROM t1 t WHERE t.b>20) GROUP BY a; @@ -3032,9 +3045,9 @@ while ($should_work_nesting) while ($nesting) { --echo $nesting ---error 0,1436 +--error 0,ER_STACK_OVERRUN_NEED_MORE eval $start $end; ---error 0,1436 +--error 0,ER_STACK_OVERRUN_NEED_MORE eval explain $start $end; let $start= $start $start_app; @@ -3259,5 +3272,28 @@ GROUP BY a4; DROP TABLE t1, t2, t3, t4; +# +# BUG#36139 "float, zerofill, crash with subquery" +# +create table t1 (a float(5,4) zerofill); +create table t2 (a float(5,4),b float(2,0)); + +select t1.a from t1 where + t1.a= (select b from t2 limit 1) and not + t1.a= (select a from t2 limit 1) ; + +drop table t1, t2; + +# +# Bug #36011: Server crash with explain extended on query with dependent +# subqueries +# + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 GROUP BY a); +EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 WHERE a > 3 GROUP BY a); +DROP TABLE t1; + --echo End of 5.0 tests. diff --git a/mysql-test/t/subselect3.test b/mysql-test/t/subselect3.test index 2f844c9cc21..d7bb1f7186a 100644 --- a/mysql-test/t/subselect3.test +++ b/mysql-test/t/subselect3.test @@ -586,6 +586,36 @@ SELECT a FROM t1 WHERE a NOT IN (65,66); SELECT a FROM t1 WHERE a NOT IN (SELECT a FROM t2); EXPLAIN SELECT a FROM t1 WHERE a NOT IN (SELECT a FROM t2); -DROP TABLE t1; +DROP TABLE t1, t2; + +# +# Bug #34763: item_subselect.cc:1235:Item_in_subselect::row_value_transformer: +# Assertion failed, unexpected error message: +# ERROR 1247 (42S22): Reference '<list ref>' not supported (forward +# reference in item list) +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES(1); + +CREATE TABLE t2 (placeholder CHAR(11)); +INSERT INTO t2 VALUES("placeholder"); + +SELECT ROW(1, 2) IN (SELECT t1.a, 2) FROM t1 GROUP BY t1.a; +SELECT ROW(1, 2) IN (SELECT t1.a, 2 FROM t2) FROM t1 GROUP BY t1.a; + +DROP TABLE t1, t2; + +# +# Bug #36005: crash in subselect with single row +# (subselect_single_select_engine::exec) +# + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +CREATE TABLE t2 SELECT * FROM t1; + +SELECT 1 FROM t1 WHERE t1.a NOT IN (SELECT 1 FROM t1, t2 WHERE 0); + +DROP TABLE t1, t2; --echo End of 5.0 tests diff --git a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test index d79b749dd65..2b465e6be77 100644 --- a/mysql-test/t/type_blob.test +++ b/mysql-test/t/type_blob.test @@ -446,5 +446,169 @@ INSERT INTO t (c) VALUES (REPEAT('2',65536)); INSERT INTO t (c) VALUES (REPEAT('3',65535)); SELECT LENGTH(c), CHAR_LENGTH(c) FROM t; DROP TABLE t; +# Bug#15776: 32-bit signed int used for length of blob +# """LONGBLOB: A BLOB column with a maximum length of 4,294,967,295 or 4GB.""" +# +# Conditions should be in this order: +# A size is not in the allowed bounds. +# If the type is char-ish AND size is within the max blob size: +# raise ER_TOO_BIG_FIELDLENGTH (suggest using BLOB) +# If size is too small: +# raise ER_PARSE_ERROR +# raise ER_TOO_BIG_DISPLAYWIDTH + +# BLOB and TEXT types +--disable_warnings +drop table if exists b15776; +--enable_warnings +create table b15776 (data blob(2147483647)); +drop table b15776; +--error ER_PARSE_ERROR +create table b15776 (data blob(-1)); +create table b15776 (data blob(2147483648)); +drop table b15776; +create table b15776 (data blob(4294967294)); +drop table b15776; +create table b15776 (data blob(4294967295)); +drop table b15776; +--error ER_TOO_BIG_DISPLAYWIDTH +create table b15776 (data blob(4294967296)); + +CREATE TABLE b15776 (a blob(2147483647), b blob(2147483648), c blob(4294967295), a1 text(2147483647), b1 text(2147483648), c1 text(4294967295) ); +show columns from b15776; +drop table b15776; + +--error ER_TOO_BIG_DISPLAYWIDTH +CREATE TABLE b15776 (a blob(4294967296)); +--error ER_TOO_BIG_DISPLAYWIDTH +CREATE TABLE b15776 (a text(4294967296)); +--error ER_TOO_BIG_DISPLAYWIDTH +CREATE TABLE b15776 (a blob(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); +--error ER_TOO_BIG_DISPLAYWIDTH +CREATE TABLE b15776 (a text(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); + +# Int types +# "Another extension is supported by MySQL for optionally specifying the +# display width of integer data types in parentheses following the base keyword +# for the type (for example, INT(4)). This optional display width is used to +# display integer values having a width less than the width specified for the +# column by left-padding them with spaces." § Numeric Types +CREATE TABLE b15776 (a int(0)); # 0 is special case, means default size +INSERT INTO b15776 values (NULL), (1), (42), (654); +SELECT * from b15776 ORDER BY a; +DROP TABLE b15776; +--error ER_PARSE_ERROR +CREATE TABLE b15776 (a int(-1)); +CREATE TABLE b15776 (a int(255)); +DROP TABLE b15776; +--error ER_TOO_BIG_DISPLAYWIDTH +CREATE TABLE b15776 (a int(256)); +--error ER_PARSE_ERROR +CREATE TABLE b15776 (data blob(-1)); + +# Char types +# Recommend BLOB +--error ER_TOO_BIG_FIELDLENGTH +CREATE TABLE b15776 (a char(2147483647)); +--error ER_TOO_BIG_FIELDLENGTH +CREATE TABLE b15776 (a char(2147483648)); +--error ER_TOO_BIG_FIELDLENGTH +CREATE TABLE b15776 (a char(4294967295)); +# Even BLOB won't hold +--error ER_TOO_BIG_DISPLAYWIDTH +CREATE TABLE b15776 (a char(4294967296)); + + +# Other numeric-ish types +## For year, widths not "2" or "4" are silently rewritten to "4". But +## When we complain about it, we say that the max is 255. We may be +## talking about different things. It's confusing. +CREATE TABLE b15776 (a year(4294967295)); +INSERT INTO b15776 VALUES (42); +SELECT * FROM b15776; +DROP TABLE b15776; +--error ER_TOO_BIG_DISPLAYWIDTH +CREATE TABLE b15776 (a year(4294967296)); +CREATE TABLE b15776 (a year(0)); # 0 is special case, means default size +DROP TABLE b15776; +--error ER_PARSE_ERROR +CREATE TABLE b15776 (a year(-2)); + +## For timestamp, we silently rewrite widths to 14 or 19. +CREATE TABLE b15776 (a timestamp(4294967294)); +DROP TABLE b15776; +CREATE TABLE b15776 (a timestamp(4294967295)); +DROP TABLE b15776; +--error ER_TOO_BIG_DISPLAYWIDTH +CREATE TABLE b15776 (a timestamp(4294967296)); +--error ER_PARSE_ERROR +CREATE TABLE b15776 (a timestamp(-1)); +--error ER_PARSE_ERROR +CREATE TABLE b15776 (a timestamp(-2)); + + +# We've already tested the case, but this should visually show that +# widths that are too large to be interpreted cause DISPLAYWIDTH errors. +--error ER_TOO_BIG_DISPLAYWIDTH +CREATE TABLE b15776 (a int(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); +--error ER_TOO_BIG_DISPLAYWIDTH +CREATE TABLE b15776 (a char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); +--error ER_TOO_BIG_DISPLAYWIDTH +CREATE TABLE b15776 (a year(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); +--error ER_TOO_BIG_DISPLAYWIDTH +CREATE TABLE b15776 (a timestamp(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); + +## Do not select, too much memory needed. +CREATE TABLE b15776 select cast(null as char(4294967295)); +show columns from b15776; +drop table b15776; +CREATE TABLE b15776 select cast(null as nchar(4294967295)); +show columns from b15776; +drop table b15776; +CREATE TABLE b15776 select cast(null as binary(4294967295)); +show columns from b15776; +drop table b15776; + +explain select cast(1 as char(4294967295)); +explain select cast(1 as nchar(4294967295)); +explain select cast(1 as binary(4294967295)); + +--error ER_TOO_BIG_DISPLAYWIDTH +explain select cast(1 as char(4294967296)); +--error ER_TOO_BIG_DISPLAYWIDTH +explain select cast(1 as nchar(4294967296)); +--error ER_TOO_BIG_DISPLAYWIDTH +explain select cast(1 as binary(4294967296)); + +--error ER_PARSE_ERROR +explain select cast(1 as decimal(-1)); +explain select cast(1 as decimal(64, 30)); +# It's not as important which errors are raised for these, since the +# limit is nowhere near 2**32. We may fix these eventually to take +# 4294967295 and still reject it because it's greater than 64 or 30, +# but that's not a high priority and the parser needn't worry about +# such a weird case. +--error ER_TOO_BIG_SCALE,ER_PARSE_ERROR +explain select cast(1 as decimal(64, 999999999999999999999999999999)); +--error ER_TOO_BIG_PRECISION,ER_PARSE_ERROR +explain select cast(1 as decimal(4294967296)); +--error ER_TOO_BIG_PRECISION,ER_PARSE_ERROR +explain select cast(1 as decimal(999999999999999999999999999999999999)); + +explain select convert(1, char(4294967295)); +--error ER_TOO_BIG_DISPLAYWIDTH +explain select convert(1, char(4294967296)); +--error ER_TOO_BIG_DISPLAYWIDTH +explain select convert(1, char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); +explain select convert(1, nchar(4294967295)); +--error ER_TOO_BIG_DISPLAYWIDTH +explain select convert(1, nchar(4294967296)); +--error ER_TOO_BIG_DISPLAYWIDTH +explain select convert(1, nchar(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); +explain select convert(1, binary(4294967295)); +--error ER_TOO_BIG_DISPLAYWIDTH +explain select convert(1, binary(4294967296)); +--error ER_TOO_BIG_DISPLAYWIDTH +explain select convert(1, binary(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); --echo End of 5.0 tests diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test index 6841b3cdd68..8a81908296f 100644 --- a/mysql-test/t/type_decimal.test +++ b/mysql-test/t/type_decimal.test @@ -521,4 +521,12 @@ SELECT ROUND(20061108085411.000002); DROP TABLE t1, t2, t3, t4, t5, t6; +# +# Bug#36023: Incorrect handling of zero length caused an assertion to fail. +# +create table t1(`c` decimal(9,2)); +insert into t1 values (300),(201.11); +select max(case 1 when 1 then c else null end) from t1 group by c; +drop table t1; + --echo End of 5.0 tests diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 23e64b0546f..9fa981ccb9a 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -3538,5 +3538,28 @@ DROP TABLE t1; ########################################################################### --echo # ----------------------------------------------------------------- +--echo # -- Bug#35193: VIEW query is rewritten without "FROM DUAL", +--echo # -- causing syntax error +--echo # ----------------------------------------------------------------- +--echo + +CREATE VIEW v1 AS SELECT 1 FROM DUAL WHERE 1; + +--echo + +SELECT * FROM v1; +SHOW CREATE TABLE v1; + +--echo + +DROP VIEW v1; + +--echo +--echo # -- End of test case for Bug#35193. +--echo + +########################################################################### + +--echo # ----------------------------------------------------------------- --echo # -- End of 5.0 tests. --echo # ----------------------------------------------------------------- diff --git a/mysys/errors.c b/mysys/errors.c index 857de1325d4..1c13255a616 100644 --- a/mysys/errors.c +++ b/mysys/errors.c @@ -74,7 +74,7 @@ void init_glob_errs() EE(EE_STAT) = "Can't get stat of '%s' (Errcode: %d)"; EE(EE_CANT_CHSIZE) = "Can't change size of file (Errcode: %d)"; EE(EE_CANT_OPEN_STREAM)= "Can't open stream from handle (Errcode: %d)"; - EE(EE_GETWD) = "Can't get working dirctory (Errcode: %d)"; + EE(EE_GETWD) = "Can't get working directory (Errcode: %d)"; EE(EE_SETWD) = "Can't change dir to '%s' (Errcode: %d)"; EE(EE_LINK_WARNING) = "Warning: '%s' had %d links"; EE(EE_OPEN_WARNING) = "%d files and %d streams is left open\n"; diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c index baf3bffccb8..f27ade7bfc0 100644 --- a/mysys/mf_keycache.c +++ b/mysys/mf_keycache.c @@ -551,7 +551,7 @@ finish: } #endif keycache_pthread_mutex_unlock(&keycache->cache_lock); - return blocks; + DBUG_RETURN(blocks); } diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c index d11883a4ea4..94ef309097a 100644 --- a/mysys/thr_alarm.c +++ b/mysys/thr_alarm.c @@ -14,8 +14,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* To avoid problems with alarms in debug code, we disable DBUG here */ -#undef DBUG_OFF -#define DBUG_OFF +#define FORCE_DBUG_OFF #include <my_global.h> #if defined(THREAD) && !defined(DONT_USE_THR_ALARM) diff --git a/ndb/src/ndbapi/NdbBlob.cpp b/ndb/src/ndbapi/NdbBlob.cpp index 611d0396f96..8a854bf9a42 100644 --- a/ndb/src/ndbapi/NdbBlob.cpp +++ b/ndb/src/ndbapi/NdbBlob.cpp @@ -338,7 +338,7 @@ int NdbBlob::setTableKeyValue(NdbOperation* anOp) { DBUG_ENTER("NdbBlob::setTableKeyValue"); - DBUG_DUMP("info", theKeyBuf.data, 4 * theTable->m_keyLenInWords); + DBUG_DUMP("info", (uchar*)theKeyBuf.data, 4 * theTable->m_keyLenInWords); const Uint32* data = (const Uint32*)theKeyBuf.data; const unsigned columns = theTable->m_columns.size(); unsigned pos = 0; @@ -362,7 +362,8 @@ int NdbBlob::setAccessKeyValue(NdbOperation* anOp) { DBUG_ENTER("NdbBlob::setAccessKeyValue"); - DBUG_DUMP("info", theAccessKeyBuf.data, 4 * theAccessTable->m_keyLenInWords); + DBUG_DUMP("info", (uchar*)theAccessKeyBuf.data, + 4 * theAccessTable->m_keyLenInWords); const Uint32* data = (const Uint32*)theAccessKeyBuf.data; const unsigned columns = theAccessTable->m_columns.size(); unsigned pos = 0; @@ -387,7 +388,8 @@ NdbBlob::setPartKeyValue(NdbOperation* anOp, Uint32 part) { DBUG_ENTER("NdbBlob::setPartKeyValue"); DBUG_PRINT("info", ("dist=%u part=%u key=", getDistKey(part), part)); - DBUG_DUMP("info", theKeyBuf.data, 4 * theTable->m_keyLenInWords); + DBUG_DUMP("info", (uchar *)theKeyBuf.data, + 4 * theTable->m_keyLenInWords); // TODO use attr ids after compatibility with 4.1.7 not needed if (anOp->equal("PK", theKeyBuf.data) == -1 || anOp->equal("DIST", getDistKey(part)) == -1 || diff --git a/ndb/src/ndbapi/NdbOperationDefine.cpp b/ndb/src/ndbapi/NdbOperationDefine.cpp index cd357bb44c1..5db0d9f098e 100644 --- a/ndb/src/ndbapi/NdbOperationDefine.cpp +++ b/ndb/src/ndbapi/NdbOperationDefine.cpp @@ -440,7 +440,7 @@ NdbOperation::setValue( const NdbColumnImpl* tAttrInfo, theOperationType, (long) aValuePassed, len)); if (aValuePassed != NULL) - DBUG_DUMP("value", (char*)aValuePassed, len); + DBUG_DUMP("value", (uchar*)aValuePassed, len); int tReturnCode; Uint32 tAttrId; diff --git a/ndb/src/ndbapi/NdbOperationInt.cpp b/ndb/src/ndbapi/NdbOperationInt.cpp index 24e77363fb5..624b15b46f3 100644 --- a/ndb/src/ndbapi/NdbOperationInt.cpp +++ b/ndb/src/ndbapi/NdbOperationInt.cpp @@ -1017,7 +1017,7 @@ NdbOperation::branch_col(Uint32 type, DBUG_PRINT("enter", ("type: %u col:%u val: 0x%lx len: %u label: %u", type, ColId, (long) val, len, Label)); if (val != NULL) - DBUG_DUMP("value", (char*)val, len); + DBUG_DUMP("value", (uchar*)val, len); if (initial_interpreterCheck() == -1) DBUG_RETURN(-1); diff --git a/ndb/src/ndbapi/NdbOperationSearch.cpp b/ndb/src/ndbapi/NdbOperationSearch.cpp index 7f8659916dc..4bdbf135396 100644 --- a/ndb/src/ndbapi/NdbOperationSearch.cpp +++ b/ndb/src/ndbapi/NdbOperationSearch.cpp @@ -62,7 +62,7 @@ NdbOperation::equal_impl(const NdbColumnImpl* tAttrInfo, theOperationType, (long) aValuePassed, aVariableKeyLen)); if (aValuePassed != NULL) - DBUG_DUMP("value", (char*)aValuePassed, aVariableKeyLen); + DBUG_DUMP("value", (uchar*)aValuePassed, aVariableKeyLen); register Uint32 tAttrId; diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index 68af030f17a..50cff8578c9 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -293,21 +293,15 @@ $CP mysql-test/t/*.def $BASE/mysql-test/t $CP mysql-test/include/*.inc $BASE/mysql-test/include $CP mysql-test/include/*.test $BASE/mysql-test/include $CP mysql-test/t/*.def $BASE/mysql-test/t -$CP mysql-test/std_data/*.dat mysql-test/std_data/*.frm \ - mysql-test/std_data/*.MYD mysql-test/std_data/*.MYI \ - mysql-test/std_data/*.pem mysql-test/std_data/Moscow_leap \ - mysql-test/std_data/Index.xml \ - mysql-test/std_data/des_key_file mysql-test/std_data/*.*001 \ - mysql-test/std_data/*.cnf mysql-test/std_data/*.MY* \ - $BASE/mysql-test/std_data $CP mysql-test/t/*.test mysql-test/t/*.imtest \ mysql-test/t/*.disabled mysql-test/t/*.opt \ mysql-test/t/*.slave-mi mysql-test/t/*.sh mysql-test/t/*.sql $BASE/mysql-test/t $CP mysql-test/r/*.result mysql-test/r/*.require \ $BASE/mysql-test/r -# Copy the additional suites "as is", they are in flux -$tar cf - mysql-test/suite | ( cd $BASE ; $tar xf - ) +# Copy the additional suites and data "as is", they are in flux +$tar cf - mysql-test/suite | ( cd $BASE ; $tar xf - ) +$tar cf - mysql-test/std_data | ( cd $BASE ; $tar xf - ) # Clean up if we did this from a bk tree if [ -d mysql-test/SCCS ] ; then find $BASE/mysql-test -name SCCS -print | xargs rm -rf diff --git a/sql-common/client.c b/sql-common/client.c index 88774ce61e1..519deac2bc5 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -2113,7 +2113,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, /* Check if version of protocol matches current one */ mysql->protocol_version= net->read_pos[0]; - DBUG_DUMP("packet",(char*) net->read_pos,10); + DBUG_DUMP("packet",(uchar*) net->read_pos,10); DBUG_PRINT("info",("mysql protocol version %d, server=%d", PROTOCOL_VERSION, mysql->protocol_version)); if (mysql->protocol_version != PROTOCOL_VERSION) diff --git a/sql-common/my_time.c b/sql-common/my_time.c index ecc5aaf8af2..1781251fca1 100644 --- a/sql-common/my_time.c +++ b/sql-common/my_time.c @@ -704,9 +704,9 @@ int check_time_range(struct st_mysql_time *my_time, int *warning) Prepare offset of system time zone from UTC for my_system_gmt_sec() func. SYNOPSIS - init_time() + my_init_time() */ -void init_time(void) +void my_init_time(void) { time_t seconds; struct tm *l_time,tm_tmp; @@ -795,7 +795,7 @@ long calc_daynr(uint year,uint month,uint day) NOTES The idea is to cache the time zone offset from UTC (including daylight saving time) for the next call to make things faster. But currently we - just calculate this offset during startup (by calling init_time() + just calculate this offset during startup (by calling my_init_time() function) and use it all the time. Time value provided should be legal time value (e.g. '2003-01-01 25:00:00' is not allowed). diff --git a/sql/examples/ha_tina.cc b/sql/examples/ha_tina.cc index 0d1d821cf17..0b57fe86e62 100644 --- a/sql/examples/ha_tina.cc +++ b/sql/examples/ha_tina.cc @@ -883,7 +883,7 @@ int ha_tina::delete_all_rows() DBUG_ENTER("ha_tina::delete_all_rows"); if (!records_is_known) - return (my_errno=HA_ERR_WRONG_COMMAND); + DBUG_RETURN(my_errno=HA_ERR_WRONG_COMMAND); /* Invalidate all cached mmap pages */ if (free_mmap(share)) diff --git a/sql/field.cc b/sql/field.cc index 53eafcaf2cc..d840034f8dc 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -5868,6 +5868,7 @@ check_string_copy_error(Field_str *field, Field_longstr::report_if_important_data() ptr - Truncated rest of string end - End of truncated string + count_spaces - Treat traling spaces as important data RETURN VALUES 0 - None was truncated (or we don't count cut fields) @@ -5877,10 +5878,12 @@ check_string_copy_error(Field_str *field, Check if we lost any important data (anything in a binary string, or any non-space in others). If only trailing spaces was lost, send a truncation note, otherwise send a truncation error. + Silently ignore traling spaces if the count_space parameter is FALSE. */ int -Field_longstr::report_if_important_data(const char *ptr, const char *end) +Field_longstr::report_if_important_data(const char *ptr, const char *end, + bool count_spaces) { if ((ptr < end) && table->in_use->count_cuted_fields) { @@ -5890,10 +5893,13 @@ Field_longstr::report_if_important_data(const char *ptr, const char *end) set_warning(MYSQL_ERROR::WARN_LEVEL_ERROR, ER_DATA_TOO_LONG, 1); else set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1); + return 2; } - else /* If we lost only spaces then produce a NOTE, not a WARNING */ + else if (count_spaces) + { /* If we lost only spaces then produce a NOTE, not a WARNING */ set_warning(MYSQL_ERROR::WARN_LEVEL_NOTE, WARN_DATA_TRUNCATED, 1); - return 2; + return 2; + } } return 0; } @@ -5929,7 +5935,7 @@ int Field_string::store(const char *from,uint length,CHARSET_INFO *cs) cannot_convert_error_pos, from + length)) return 2; - return report_if_important_data(from_end_pos, from + length); + return report_if_important_data(from_end_pos, from + length, FALSE); } @@ -6388,7 +6394,7 @@ int Field_varstring::store(const char *from,uint length,CHARSET_INFO *cs) cannot_convert_error_pos, from + length)) return 2; - return report_if_important_data(from_end_pos, from + length); + return report_if_important_data(from_end_pos, from + length, TRUE); } @@ -6930,6 +6936,7 @@ uint32 Field_blob::get_length(const char *pos) return (uint32) tmp; } } + /* When expanding this, see also MAX_FIELD_BLOBLENGTH. */ return 0; // Impossible } @@ -7024,7 +7031,7 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs) cannot_convert_error_pos, from + length)) return 2; - return report_if_important_data(from_end_pos, from + length); + return report_if_important_data(from_end_pos, from + length, TRUE); oom_error: /* Fatal OOM error */ @@ -8441,8 +8448,20 @@ bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type, (fld_type_modifier & NOT_NULL_FLAG) && fld_type != FIELD_TYPE_TIMESTAMP) flags|= NO_DEFAULT_VALUE_FLAG; - if (fld_length && !(length= (uint) atoi(fld_length))) - fld_length= 0; /* purecov: inspected */ + if (fld_length != NULL) + { + errno= 0; + length= strtoul(fld_length, NULL, 10); + if ((errno != 0) || (length > MAX_FIELD_BLOBLENGTH)) + { + my_error(ER_TOO_BIG_DISPLAYWIDTH, MYF(0), fld_name, MAX_FIELD_BLOBLENGTH); + DBUG_RETURN(TRUE); + } + + if (length == 0) + fld_length= 0; /* purecov: inspected */ + } + sign_len= fld_type_modifier & UNSIGNED_FLAG ? 0 : 1; switch (fld_type) { @@ -8590,7 +8609,7 @@ bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type, } break; case FIELD_TYPE_TIMESTAMP: - if (!fld_length) + if (fld_length == NULL) { /* Compressed date YYYYMMDDHHMMSS */ length= MAX_DATETIME_COMPRESSED_WIDTH; @@ -8599,12 +8618,21 @@ bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type, { /* We support only even TIMESTAMP lengths less or equal than 14 - and 19 as length of 4.1 compatible representation. + and 19 as length of 4.1 compatible representation. Silently + shrink it to MAX_DATETIME_COMPRESSED_WIDTH. */ - length= ((length+1)/2)*2; /* purecov: inspected */ - length= min(length, MAX_DATETIME_COMPRESSED_WIDTH); /* purecov: inspected */ + DBUG_ASSERT(MAX_DATETIME_COMPRESSED_WIDTH < UINT_MAX); + if (length != UINT_MAX) /* avoid overflow; is safe because of min() */ + length= ((length+1)/2)*2; + length= min(length, MAX_DATETIME_COMPRESSED_WIDTH); } flags|= ZEROFILL_FLAG | UNSIGNED_FLAG; + /* + Since we silently rewrite down to MAX_DATETIME_COMPRESSED_WIDTH bytes, + the parser should not raise errors unless bizzarely large. + */ + max_field_charlength= UINT_MAX; + if (fld_default_value) { /* Grammar allows only NOW() value for ON UPDATE clause */ @@ -8711,7 +8739,7 @@ bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type, ((length > max_field_charlength && fld_type != FIELD_TYPE_SET && fld_type != FIELD_TYPE_ENUM && (fld_type != MYSQL_TYPE_VARCHAR || fld_default_value)) || - (!length && + ((length == 0) && fld_type != MYSQL_TYPE_STRING && fld_type != MYSQL_TYPE_VARCHAR && fld_type != FIELD_TYPE_GEOMETRY))) { diff --git a/sql/field.h b/sql/field.h index c82d65147ac..8d771a151a7 100644 --- a/sql/field.h +++ b/sql/field.h @@ -455,7 +455,8 @@ public: class Field_longstr :public Field_str { protected: - int report_if_important_data(const char *ptr, const char *end); + int report_if_important_data(const char *ptr, const char *end, + bool count_spaces); public: Field_longstr(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, utype unireg_check_arg, diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index 84eaa82728a..12766b42bc2 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -467,7 +467,7 @@ berkeley_cmp_packed_key(DB *file, const DBT *new_key, const DBT *saved_key) KEY_PART_INFO *key_part= key->key_part, *end=key_part+key->key_parts; uint key_length=new_key->size; - DBUG_DUMP("key_in_index", saved_key_ptr, saved_key->size); + DBUG_DUMP("key_in_index", (uchar *)saved_key_ptr, saved_key->size); for (; key_part != end && (int) key_length > 0; key_part++) { int cmp; @@ -903,7 +903,7 @@ DBT *ha_berkeley::create_key(DBT *key, uint keynr, char *buff, key_length-=key_part->length; } key->size= (u_int32_t) (buff - (char*) key->data); - DBUG_DUMP("key",(char*) key->data, key->size); + DBUG_DUMP("key",(uchar*) key->data, key->size); DBUG_RETURN(key); } @@ -947,7 +947,7 @@ DBT *ha_berkeley::pack_key(DBT *key, uint keynr, char *buff, key_length-=key_part->store_length; } key->size= (u_int32_t) (buff - (char*) key->data); - DBUG_DUMP("key",(char*) key->data, key->size); + DBUG_DUMP("key",(uchar*) key->data, key->size); DBUG_RETURN(key); } @@ -1705,7 +1705,7 @@ DBT *ha_berkeley::get_pos(DBT *to, byte *pos) pos+=key_part->field->packed_col_length((char*) pos,key_part->length); to->size= (uint) (pos- (byte*) to->data); } - DBUG_DUMP("key", (char*) to->data, to->size); + DBUG_DUMP("key", (uchar*) to->data, to->size); return to; } diff --git a/sql/ha_blackhole.cc b/sql/ha_blackhole.cc index e477686d18e..01ede3d3bd2 100644 --- a/sql/ha_blackhole.cc +++ b/sql/ha_blackhole.cc @@ -115,7 +115,7 @@ const char *ha_blackhole::index_type(uint key_number) int ha_blackhole::write_row(byte * buf) { DBUG_ENTER("ha_blackhole::write_row"); - DBUG_RETURN(0); + DBUG_RETURN(table->next_number_field ? update_auto_increment() : 0); } int ha_blackhole::rnd_init(bool scan) diff --git a/sql/ha_federated.cc b/sql/ha_federated.cc index d414dc34f02..2ccfeba74cb 100644 --- a/sql/ha_federated.cc +++ b/sql/ha_federated.cc @@ -1095,7 +1095,7 @@ bool ha_federated::create_where_from_key(String *to, uint store_length= key_part->store_length; uint part_length= min(store_length, length); needs_quotes= 1; - DBUG_DUMP("key, start of loop", (char *) ptr, length); + DBUG_DUMP("key, start of loop", (uchar *)ptr, length); if (key_part->null_bit) { diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 2d2007c8fdd..1be6137460b 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -4250,7 +4250,7 @@ ha_innobase::rnd_pos( int error; uint keynr = active_index; DBUG_ENTER("rnd_pos"); - DBUG_DUMP("key", (char*) pos, ref_length); + DBUG_DUMP("key", (uchar *)pos, ref_length); statistic_increment(current_thd->status_var.ha_read_rnd_count, &LOCK_status); diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index a5cdc128724..0a75b328ca0 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -677,7 +677,7 @@ int ha_ndbcluster::set_ndb_key(NdbOperation *ndb_op, Field *field, DBUG_PRINT("enter", ("%d: %s, ndb_type: %u, len=%d", fieldnr, field->field_name, field->type(), pack_len)); - DBUG_DUMP("key", (char*)field_ptr, pack_len); + DBUG_DUMP("key", (uchar*)field_ptr, pack_len); DBUG_ASSERT(ndb_supported_type(field->type())); DBUG_ASSERT(! (field->flags & BLOB_FLAG)); @@ -699,7 +699,7 @@ int ha_ndbcluster::set_ndb_value(NdbOperation *ndb_op, Field *field, DBUG_PRINT("enter", ("%d: %s, type: %u, len=%d, is_null=%s", fieldnr, field->field_name, field->type(), pack_len, field->is_null()?"Y":"N")); - DBUG_DUMP("value", (char*) field_ptr, pack_len); + DBUG_DUMP("value", (uchar*) field_ptr, pack_len); DBUG_ASSERT(ndb_supported_type(field->type())); { @@ -737,7 +737,7 @@ int ha_ndbcluster::set_ndb_value(NdbOperation *ndb_op, Field *field, // Set value to NULL DBUG_RETURN((ndb_op->setValue(fieldnr, (char*)NULL, pack_len) != 0)); DBUG_PRINT("info", ("bit field")); - DBUG_DUMP("value", (char*)&bits, pack_len); + DBUG_DUMP("value", (uchar*)&bits, pack_len); #ifdef WORDS_BIGENDIAN /* store lsw first */ bits = ((bits >> 32) & 0x00000000FFFFFFFFLL) @@ -768,7 +768,7 @@ int ha_ndbcluster::set_ndb_value(NdbOperation *ndb_op, Field *field, DBUG_PRINT("value", ("set blob ptr: %p len: %u", blob_ptr, blob_len)); - DBUG_DUMP("value", (char*)blob_ptr, min(blob_len, 26)); + DBUG_DUMP("value", (uchar*)blob_ptr, min(blob_len, 26)); if (set_blob_value) *set_blob_value= TRUE; @@ -1007,8 +1007,8 @@ int ha_ndbcluster::get_metadata(const char *path) ("metadata, pack_length: %d getFrmLength: %d memcmp: %d", pack_length, tab->getFrmLength(), memcmp(pack_data, tab->getFrmData(), pack_length))); - DBUG_DUMP("pack_data", (char*)pack_data, pack_length); - DBUG_DUMP("frm", (char*)tab->getFrmData(), tab->getFrmLength()); + DBUG_DUMP("pack_data", (uchar*)pack_data, pack_length); + DBUG_DUMP("frm", (uchar*)tab->getFrmData(), tab->getFrmLength()); error= 3; invalidating_ndb_table= FALSE; } @@ -1502,7 +1502,7 @@ int ha_ndbcluster::pk_read(const byte *key, uint key_len, byte *buf) int res; DBUG_ENTER("pk_read"); DBUG_PRINT("enter", ("key_len: %u", key_len)); - DBUG_DUMP("key", (char*)key, key_len); + DBUG_DUMP("key", (uchar*)key, key_len); NdbOperation::LockMode lm= (NdbOperation::LockMode)get_ndb_lock_type(m_lock.type); @@ -1514,7 +1514,7 @@ int ha_ndbcluster::pk_read(const byte *key, uint key_len, byte *buf) { // This table has no primary key, use "hidden" primary key DBUG_PRINT("info", ("Using hidden key")); - DBUG_DUMP("key", (char*)key, 8); + DBUG_DUMP("key", (uchar*)key, 8); if (set_hidden_key(op, no_fields, key)) ERR_RETURN(trans->getNdbError()); @@ -1797,7 +1797,7 @@ int ha_ndbcluster::unique_index_read(const byte *key, NdbIndexOperation *op; DBUG_ENTER("ha_ndbcluster::unique_index_read"); DBUG_PRINT("enter", ("key_len: %u, index: %u", key_len, active_index)); - DBUG_DUMP("key", (char*)key, key_len); + DBUG_DUMP("key", (uchar*)key, key_len); NdbOperation::LockMode lm= (NdbOperation::LockMode)get_ndb_lock_type(m_lock.type); @@ -2126,7 +2126,7 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op, { DBUG_PRINT("info", ("key %d:%d offset=%d length=%d last=%d bound=%d", j, i, tot_len, part_len, p.part_last, p.bound_type)); - DBUG_DUMP("info", (const char*)p.part_ptr, part_store_len); + DBUG_DUMP("info", (const uchar*)p.part_ptr, part_store_len); // Set bound if not cancelled via type -1 if (p.bound_type != -1) @@ -2644,7 +2644,7 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data) // Require that the PK for this record has previously been // read into m_ref - DBUG_DUMP("key", m_ref, NDB_HIDDEN_PRIMARY_KEY_LENGTH); + DBUG_DUMP("key", (uchar *)m_ref, NDB_HIDDEN_PRIMARY_KEY_LENGTH); if (set_hidden_key(op, table->s->fields, m_ref)) ERR_RETURN(op->getNdbError()); @@ -2864,8 +2864,6 @@ void ha_ndbcluster::print_results() DBUG_ENTER("print_results"); #ifndef DBUG_OFF - if (!_db_on_) - DBUG_VOID_RETURN; char buf_type[MAX_FIELD_WIDTH], buf_val[MAX_FIELD_WIDTH]; String type(buf_type, sizeof(buf_type), &my_charset_bin); @@ -3341,7 +3339,7 @@ void ha_ndbcluster::position(const byte *record) memcpy(ref, m_ref, ref_length); } - DBUG_DUMP("ref", (char*)ref, ref_length); + DBUG_DUMP("ref", (uchar*)ref, ref_length); DBUG_VOID_RETURN; } @@ -6263,7 +6261,7 @@ static int packfrm(const void *data, uint len, } DBUG_PRINT("info", ("org_len: %lu comp_len: %lu", org_len, comp_len)); - DBUG_DUMP("compressed", (char*)data, org_len); + DBUG_DUMP("compressed", (uchar*)data, org_len); error= 2; blob_len= sizeof(frm_blob_struct::frm_blob_header)+org_len; @@ -6307,7 +6305,7 @@ static int unpackfrm(const void **unpack_data, uint *unpack_len, DBUG_PRINT("blob",("ver: %lu complen: %lu orglen: %lu", ver,complen,orglen)); - DBUG_DUMP("blob->data", (char*) blob->data, complen); + DBUG_DUMP("blob->data", (uchar*) blob->data, complen); if (ver != 1) { diff --git a/sql/ha_ndbcluster_cond.cc b/sql/ha_ndbcluster_cond.cc index f5b41959b40..37e710acff4 100644 --- a/sql/ha_ndbcluster_cond.cc +++ b/sql/ha_ndbcluster_cond.cc @@ -1419,7 +1419,7 @@ int ha_ndbcluster_cond::generate_scan_filter_from_key(NdbScanOperation *op, uint32 pack_len= field->pack_length(); const byte* ptr= key; DBUG_PRINT("info", ("Filtering value for %s", field->field_name)); - DBUG_DUMP("key", (char*)ptr, pack_len); + DBUG_DUMP("key", (uchar*)ptr, pack_len); if (key_part->null_bit) { DBUG_PRINT("info", ("Generating ISNULL filter")); diff --git a/sql/handler.cc b/sql/handler.cc index bfad10f986f..0de772e366b 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1980,6 +1980,8 @@ int handler::ha_check_for_upgrade(HA_CHECK_OPT *check_opt) } } } + if (table->s->frm_version != FRM_VER_TRUE_VARCHAR) + return HA_ADMIN_NEEDS_ALTER; return check_for_upgrade(check_opt); } @@ -2348,8 +2350,8 @@ int ha_init_key_cache(const char *name, KEY_CACHE *key_cache) if (!key_cache->key_cache_inited) { pthread_mutex_lock(&LOCK_global_system_variables); - long tmp_buff_size= (long) key_cache->param_buff_size; - long tmp_block_size= (long) key_cache->param_block_size; + ulong tmp_buff_size= (ulong) key_cache->param_buff_size; + uint tmp_block_size= (uint) key_cache->param_block_size; uint division_limit= key_cache->param_division_limit; uint age_threshold= key_cache->param_age_threshold; pthread_mutex_unlock(&LOCK_global_system_variables); diff --git a/sql/handler.h b/sql/handler.h index 74c09d2d9ee..aa3377c3868 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -815,7 +815,7 @@ public: { return HA_ADMIN_NOT_IMPLEMENTED; } /* end of the list of admin commands */ - virtual bool check_and_repair(THD *thd) { return HA_ERR_WRONG_COMMAND; } + virtual bool check_and_repair(THD *thd) { return TRUE; } virtual int dump(THD* thd, int fd = -1) { return HA_ERR_WRONG_COMMAND; } virtual int disable_indexes(uint mode) { return HA_ERR_WRONG_COMMAND; } virtual int enable_indexes(uint mode) { return HA_ERR_WRONG_COMMAND; } diff --git a/sql/init.cc b/sql/init.cc index b3b68926683..2dd2031cdaa 100644 --- a/sql/init.cc +++ b/sql/init.cc @@ -30,7 +30,7 @@ void unireg_init(ulong options) wild_many='%'; wild_one='_'; wild_prefix='\\'; /* Change to sql syntax */ current_pid=(ulong) getpid(); /* Save for later ref */ - init_time(); /* Init time-functions (read zone) */ + my_init_time(); /* Init time-functions (read zone) */ #ifndef EMBEDDED_LIBRARY my_abort_hook=unireg_abort; /* Abort with close of databases */ #endif diff --git a/sql/item.cc b/sql/item.cc index c5b8d7a89ef..9ff1f8c0084 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -3931,9 +3931,9 @@ bool Item_field::fix_fields(THD *thd, Item **reference) } if ((ret= fix_outer_field(thd, &from_field, reference)) < 0) goto error; - else if (!ret) - return FALSE; outer_fixed= TRUE; + if (!ret) + goto mark_non_agg_field; } else if (!from_field) goto error; @@ -3945,9 +3945,9 @@ bool Item_field::fix_fields(THD *thd, Item **reference) int ret; if ((ret= fix_outer_field(thd, &from_field, reference)) < 0) goto error; - else if (!ret) - return FALSE; outer_fixed= 1; + if (!ret) + goto mark_non_agg_field; } /* @@ -4013,6 +4013,26 @@ bool Item_field::fix_fields(THD *thd, Item **reference) thd->lex->current_select->non_agg_fields.push_back(this); marker= thd->lex->current_select->cur_pos_in_select_list; } +mark_non_agg_field: + if (fixed && thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY) + { + /* + Mark selects according to presence of non aggregated fields. + Fields from outer selects added to the aggregate function + outer_fields list as its unknown at the moment whether it's + aggregated or not. + */ + if (!thd->lex->in_sum_func) + cached_table->select_lex->full_group_by_flag|= NON_AGG_FIELD_USED; + else + { + if (outer_fixed) + thd->lex->in_sum_func->outer_fields.push_back(this); + else if (thd->lex->in_sum_func->nest_level != + thd->lex->current_select->nest_level) + cached_table->select_lex->full_group_by_flag|= NON_AGG_FIELD_USED; + } + } return FALSE; error: @@ -4136,9 +4156,14 @@ static void convert_zerofill_number_to_string(Item **item, Field_num *field) String tmp(buff,sizeof(buff), field->charset()), *res; res= (*item)->val_str(&tmp); - field->prepend_zeros(res); - pos= (char *) sql_strmake (res->ptr(), res->length()); - *item= new Item_string(pos, res->length(), field->charset()); + if ((*item)->is_null()) + *item= new Item_null(); + else + { + field->prepend_zeros(res); + pos= (char *) sql_strmake (res->ptr(), res->length()); + *item= new Item_string(pos, res->length(), field->charset()); + } } @@ -5482,13 +5507,16 @@ bool Item_ref::fix_fields(THD *thd, Item **reference) DBUG_ASSERT(*ref); /* Check if this is an incorrect reference in a group function or forward - reference. Do not issue an error if this is an unnamed reference inside an - aggregate function. + reference. Do not issue an error if this is: + 1. outer reference (will be fixed later by the fix_inner_refs function); + 2. an unnamed reference inside an aggregate function. */ - if (((*ref)->with_sum_func && name && - !(current_sel->linkage != GLOBAL_OPTIONS_TYPE && - current_sel->having_fix_field)) || - !(*ref)->fixed) + if (!((*ref)->type() == REF_ITEM && + ((Item_ref *)(*ref))->ref_type() == OUTER_REF) && + (((*ref)->with_sum_func && name && + !(current_sel->linkage != GLOBAL_OPTIONS_TYPE && + current_sel->having_fix_field)) || + !(*ref)->fixed)) { my_error(ER_ILLEGAL_REFERENCE, MYF(0), name, ((*ref)->with_sum_func? diff --git a/sql/item_create.cc b/sql/item_create.cc index 60a17c21521..c897b7aef79 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -464,8 +464,42 @@ Item *create_func_cast(Item *a, Cast_target cast_type, case ITEM_CAST_TIME: res= new Item_time_typecast(a); break; case ITEM_CAST_DATETIME: res= new Item_datetime_typecast(a); break; case ITEM_CAST_DECIMAL: - len= c_len ? atoi(c_len) : 0; - dec= c_dec ? atoi(c_dec) : 0; + if (c_len == NULL) + { + len= 0; + } + else + { + ulong decoded_size; + errno= 0; + decoded_size= strtoul(c_len, NULL, 10); + if (errno != 0) + { + my_error(ER_TOO_BIG_PRECISION, MYF(0), c_len, a->name, + DECIMAL_MAX_PRECISION); + return NULL; + } + len= decoded_size; + } + + if (c_dec == NULL) + { + dec= 0; + } + else + { + ulong decoded_size; + errno= 0; + decoded_size= strtoul(c_dec, NULL, 10); + if ((errno != 0) || (decoded_size > UINT_MAX)) + { + my_error(ER_TOO_BIG_SCALE, MYF(0), c_dec, a->name, + DECIMAL_MAX_SCALE); + return NULL; + } + dec= decoded_size; + } + my_decimal_trim(&len, &dec); if (len < dec) { @@ -486,8 +520,25 @@ Item *create_func_cast(Item *a, Cast_target cast_type, } res= new Item_decimal_typecast(a, len, dec); break; + case ITEM_CAST_CHAR: - len= c_len ? atoi(c_len) : -1; + if (c_len == NULL) + { + len= LL(-1); + } + else + { + ulong decoded_size; + errno= 0; + decoded_size= strtoul(c_len, NULL, 10); + if ((errno != 0) || (decoded_size > MAX_FIELD_BLOBLENGTH)) + { + my_error(ER_TOO_BIG_DISPLAYWIDTH, MYF(0), "cast as char", MAX_FIELD_BLOBLENGTH); + return NULL; + } + len= decoded_size; + } + res= new Item_char_typecast(a, len, cs ? cs : current_thd->variables.collation_connection); break; diff --git a/sql/item_func.cc b/sql/item_func.cc index 87e547d1f89..1238efbb653 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -5115,7 +5115,7 @@ double Item_func_match::val_real() DBUG_RETURN(-1.0); if (key != NO_SUCH_KEY && table->null_row) /* NULL row from an outer join */ - return 0.0; + DBUG_RETURN(0.0); if (join_key) { diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 4e72f117869..c443364ce52 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -294,6 +294,12 @@ String *Item_func_concat::val_str(String *str) { if (!(res=args[i]->val_str(str))) goto null; + /* + CONCAT accumulates its result in the result of its the first + non-empty argument. Because of this we need is_const to be + evaluated only for it. + */ + is_const= args[i]->const_item() || !args[i]->used_tables(); } else { diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index b3710841dfb..401751660fd 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -1232,7 +1232,11 @@ Item_in_subselect::row_value_transformer(JOIN *join) Item *item_having_part2= 0; for (uint i= 0; i < cols_num; i++) { - DBUG_ASSERT(left_expr->fixed && select_lex->ref_pointer_array[i]->fixed); + DBUG_ASSERT(left_expr->fixed && + select_lex->ref_pointer_array[i]->fixed || + (select_lex->ref_pointer_array[i]->type() == REF_ITEM && + ((Item_ref*)(select_lex->ref_pointer_array[i]))->ref_type() == + Item_ref::OUTER_REF)); if (select_lex->ref_pointer_array[i]-> check_cols(left_expr->element_index(i)->cols())) DBUG_RETURN(RES_ERROR); @@ -1306,7 +1310,11 @@ Item_in_subselect::row_value_transformer(JOIN *join) for (uint i= 0; i < cols_num; i++) { Item *item, *item_isnull; - DBUG_ASSERT(left_expr->fixed && select_lex->ref_pointer_array[i]->fixed); + DBUG_ASSERT(left_expr->fixed && + select_lex->ref_pointer_array[i]->fixed || + (select_lex->ref_pointer_array[i]->type() == REF_ITEM && + ((Item_ref*)(select_lex->ref_pointer_array[i]))->ref_type() == + Item_ref::OUTER_REF)); if (select_lex->ref_pointer_array[i]-> check_cols(left_expr->element_index(i)->cols())) DBUG_RETURN(RES_ERROR); @@ -1434,6 +1442,19 @@ Item_in_subselect::select_in_like_transformer(JOIN *join, Comp_creator *func) DBUG_ENTER("Item_in_subselect::select_in_like_transformer"); + { + /* + IN/SOME/ALL/ANY subqueries aren't support LIMIT clause. Without it + ORDER BY clause becomes meaningless thus we drop it here. + */ + SELECT_LEX *sl= current->master_unit()->first_select(); + for (; sl; sl= sl->next_select()) + { + if (sl->join) + sl->join->order= 0; + } + } + if (changed) { DBUG_RETURN(RES_OK); @@ -1468,6 +1489,7 @@ Item_in_subselect::select_in_like_transformer(JOIN *join, Comp_creator *func) transformed= 1; arena= thd->activate_stmt_arena_if_needed(&backup); + /* Both transformers call fix_fields() only for Items created inside them, and all that items do not make permanent changes in current item arena diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 3d6d46ab3f4..91320d6b56b 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -66,6 +66,7 @@ bool Item_sum::init_sum_func_check(THD *thd) aggr_sel= NULL; max_arg_level= -1; max_sum_func_level= -1; + outer_fields.empty(); return FALSE; } @@ -175,6 +176,7 @@ bool Item_sum::check_sum_func(THD *thd, Item **ref) MYF(0)); return TRUE; } + if (in_sum_func) { /* @@ -195,6 +197,68 @@ bool Item_sum::check_sum_func(THD *thd, Item **ref) set_if_bigger(in_sum_func->max_sum_func_level, aggr_level); set_if_bigger(in_sum_func->max_sum_func_level, max_sum_func_level); } + + /* + Check that non-aggregated fields and sum functions aren't mixed in the + same select in the ONLY_FULL_GROUP_BY mode. + */ + if (outer_fields.elements) + { + Item_field *field; + /* + Here we compare the nesting level of the select to which an outer field + belongs to with the aggregation level of the sum function. All fields in + the outer_fields list are checked. + + If the nesting level is equal to the aggregation level then the field is + aggregated by this sum function. + If the nesting level is less than the aggregation level then the field + belongs to an outer select. In this case if there is an embedding sum + function add current field to functions outer_fields list. If there is + no embedding function then the current field treated as non aggregated + and the select it belongs to is marked accordingly. + If the nesting level is greater than the aggregation level then it means + that this field was added by an inner sum function. + Consider an example: + + select avg ( <-- we are here, checking outer.f1 + select ( + select sum(outer.f1 + inner.f1) from inner + ) from outer) + from most_outer; + + In this case we check that no aggregate functions are used in the + select the field belongs to. If there are some then an error is + raised. + */ + List_iterator<Item_field> of(outer_fields); + while ((field= of++)) + { + SELECT_LEX *sel= field->cached_table->select_lex; + if (sel->nest_level < aggr_level) + { + if (in_sum_func) + { + /* + Let upper function decide whether this field is a non + aggregated one. + */ + in_sum_func->outer_fields.push_back(field); + } + else + sel->full_group_by_flag|= NON_AGG_FIELD_USED; + } + if (sel->nest_level > aggr_level && + (sel->full_group_by_flag & SUM_FUNC_USED) && + !sel->group_list.elements) + { + my_message(ER_MIX_OF_GROUP_FUNC_AND_FIELDS, + ER(ER_MIX_OF_GROUP_FUNC_AND_FIELDS), MYF(0)); + return TRUE; + } + } + } + aggr_sel->full_group_by_flag|= SUM_FUNC_USED; update_used_tables(); thd->lex->in_sum_func= in_sum_func; return FALSE; @@ -1206,7 +1270,15 @@ my_decimal *Item_sum_avg::val_decimal(my_decimal *val) null_value=1; return NULL; } - sum_dec= Item_sum_sum::val_decimal(&sum_buff); + + /* + For non-DECIMAL hybrid_type the division will be done in + Item_sum_avg::val_real(). + */ + if (hybrid_type != DECIMAL_RESULT) + return val_decimal_from_real(val); + + sum_dec= dec_buffs + curr_dec_buff; int2my_decimal(E_DEC_FATAL_ERROR, count, 0, &cnt); my_decimal_div(E_DEC_FATAL_ERROR, val, sum_dec, &cnt, prec_increment); return val; @@ -3150,7 +3222,7 @@ void Item_func_group_concat::clear() no_appended= TRUE; if (tree) reset_tree(tree); - if (distinct) + if (unique_filter) unique_filter->reset(); /* No need to reset the table as we never call write_row */ } diff --git a/sql/item_sum.h b/sql/item_sum.h index bf0abe53eea..d39fc96e254 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -239,6 +239,13 @@ public: int8 max_arg_level; /* max level of unbound column references */ int8 max_sum_func_level;/* max level of aggregation for embedded functions */ bool quick_group; /* If incremental update of fields */ + /* + This list is used by the check for mixing non aggregated fields and + sum functions in the ONLY_FULL_GROUP_BY_MODE. We save all outer fields + directly or indirectly used under this function it as it's unclear + at the moment of fixing outer field whether it's aggregated or not. + */ + List<Item_field> outer_fields; protected: table_map used_tables_cache; diff --git a/sql/lock.cc b/sql/lock.cc index d0576202606..4927146d96b 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -703,7 +703,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count, { my_error(ER_WRONG_LOCK_OF_SYSTEM_TABLE, MYF(0), table_ptr[i]->s->db, table_ptr[i]->s->table_name); - return 0; + DBUG_RETURN(0); } } diff --git a/sql/log.cc b/sql/log.cc index 15e8679171c..9e112e46c65 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1180,6 +1180,8 @@ int MYSQL_LOG::update_log_index(LOG_INFO* log_info, bool need_update_threads) RETURN VALUES 0 ok LOG_INFO_EOF to_log not found + LOG_INFO_FATAL if any other than ENOENT error from + my_stat() or my_delete() */ int MYSQL_LOG::purge_logs(const char *to_log, @@ -1208,33 +1210,75 @@ int MYSQL_LOG::purge_logs(const char *to_log, while ((strcmp(to_log,log_info.log_file_name) || (exit_loop=included)) && !log_in_use(log_info.log_file_name)) { - ulong file_size= 0; - if (decrease_log_space) //stat the file we want to delete + MY_STAT s; + if (!my_stat(log_info.log_file_name, &s, MYF(0))) { - MY_STAT s; - - /* - If we could not stat, we can't know the amount - of space that deletion will free. In most cases, - deletion won't work either, so it's not a problem. - */ - if (my_stat(log_info.log_file_name,&s,MYF(0))) - file_size= s.st_size; - else - sql_print_information("Failed to execute my_stat on file '%s'", + if (my_errno == ENOENT) + { + /* + It's not fatal if we can't stat a log file that does not exist; + If we could not stat, we won't delete. + */ + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_LOG_PURGE_NO_FILE, ER(ER_LOG_PURGE_NO_FILE), + log_info.log_file_name); + sql_print_information("Failed to execute my_stat on file '%s'", log_info.log_file_name); + my_errno= 0; + } + else + { + /* + Other than ENOENT are fatal + */ + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR, + ER_BINLOG_PURGE_FATAL_ERR, + "a problem with getting info on being purged %s; " + "consider examining correspondence " + "of your binlog index file " + "to the actual binlog files", + log_info.log_file_name); + error= LOG_INFO_FATAL; + goto err; + } + } + else + { + DBUG_PRINT("info",("purging %s",log_info.log_file_name)); + if (!my_delete(log_info.log_file_name, MYF(0))) + { + if (decrease_log_space) + *decrease_log_space-= s.st_size; + } + else + { + if (my_errno == ENOENT) + { + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_LOG_PURGE_NO_FILE, ER(ER_LOG_PURGE_NO_FILE), + log_info.log_file_name); + sql_print_information("Failed to delete file '%s'", + log_info.log_file_name); + my_errno= 0; + } + else + { + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR, + ER_BINLOG_PURGE_FATAL_ERR, + "a problem with deleting %s; " + "consider examining correspondence " + "of your binlog index file " + "to the actual binlog files", + log_info.log_file_name); + error= LOG_INFO_FATAL; + goto err; + } + } } - /* - It's not fatal if we can't delete a log file ; - if we could delete it, take its size into account - */ - DBUG_PRINT("info",("purging %s",log_info.log_file_name)); - if (!my_delete(log_info.log_file_name, MYF(0)) && decrease_log_space) - *decrease_log_space-= file_size; if (find_next_log(&log_info, 0) || exit_loop) break; } - + /* If we get killed -9 here, the sysadmin would have to edit the log index file after restart - otherwise, this should be safe @@ -1263,6 +1307,8 @@ err: RETURN VALUES 0 ok LOG_INFO_PURGE_NO_ROTATE Binary file that can't be rotated + LOG_INFO_FATAL if any other than ENOENT error from + my_stat() or my_delete() */ int MYSQL_LOG::purge_logs_before_date(time_t purge_time) @@ -1286,11 +1332,66 @@ int MYSQL_LOG::purge_logs_before_date(time_t purge_time) while (strcmp(log_file_name, log_info.log_file_name) && !log_in_use(log_info.log_file_name)) { - /* It's not fatal even if we can't delete a log file */ - if (!my_stat(log_info.log_file_name, &stat_area, MYF(0)) || - stat_area.st_mtime >= purge_time) - break; - my_delete(log_info.log_file_name, MYF(0)); + if (!my_stat(log_info.log_file_name, &stat_area, MYF(0))) + { + if (my_errno == ENOENT) + { + /* + It's not fatal if we can't stat a log file that does not exist. + */ + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_LOG_PURGE_NO_FILE, ER(ER_LOG_PURGE_NO_FILE), + log_info.log_file_name); + sql_print_information("Failed to execute my_stat on file '%s'", + log_info.log_file_name); + my_errno= 0; + } + else + { + /* + Other than ENOENT are fatal + */ + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR, + ER_BINLOG_PURGE_FATAL_ERR, + "a problem with getting info on being purged %s; " + "consider examining correspondence " + "of your binlog index file " + "to the actual binlog files", + log_info.log_file_name); + error= LOG_INFO_FATAL; + goto err; + } + } + else + { + if (stat_area.st_mtime >= purge_time) + break; + if (my_delete(log_info.log_file_name, MYF(0))) + { + if (my_errno == ENOENT) + { + /* It's not fatal even if we can't delete a log file */ + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_LOG_PURGE_NO_FILE, ER(ER_LOG_PURGE_NO_FILE), + log_info.log_file_name); + sql_print_information("Failed to delete file '%s'", + log_info.log_file_name); + my_errno= 0; + } + else + { + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR, + ER_BINLOG_PURGE_FATAL_ERR, + "a problem with deleting %s; " + "consider examining correspondence " + "of your binlog index file " + "to the actual binlog files", + log_info.log_file_name); + error= LOG_INFO_FATAL; + goto err; + } + } + } if (find_next_log(&log_info, 0)) break; } diff --git a/sql/my_decimal.h b/sql/my_decimal.h index c661579ea66..6a0d05921ec 100644 --- a/sql/my_decimal.h +++ b/sql/my_decimal.h @@ -164,14 +164,23 @@ inline int check_result_and_overflow(uint mask, int result, my_decimal *val) inline uint my_decimal_length_to_precision(uint length, uint scale, bool unsigned_flag) { - return (uint) (length - (scale>0 ? 1:0) - (unsigned_flag ? 0:1)); + /* Precision can't be negative thus ignore unsigned_flag when length is 0. */ + DBUG_ASSERT(length || !scale); + return (uint) (length - (scale>0 ? 1:0) - + (unsigned_flag || !length ? 0:1)); } inline uint32 my_decimal_precision_to_length(uint precision, uint8 scale, bool unsigned_flag) { + /* + When precision is 0 it means that original length was also 0. Thus + unsigned_flag is ignored in this case. + */ + DBUG_ASSERT(precision || !scale); set_if_smaller(precision, DECIMAL_MAX_PRECISION); - return (uint32)(precision + (scale>0 ? 1:0) + (unsigned_flag ? 0:1)); + return (uint32)(precision + (scale>0 ? 1:0) + + (unsigned_flag || !precision ? 0:1)); } inline diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 4f27994c13c..f3bda4e5819 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -615,8 +615,8 @@ bool check_merge_table_access(THD *thd, char *db, bool check_some_routine_access(THD *thd, const char *db, const char *name, bool is_proc); bool multi_update_precheck(THD *thd, TABLE_LIST *tables); bool multi_delete_precheck(THD *thd, TABLE_LIST *tables); -bool mysql_multi_update_prepare(THD *thd); -bool mysql_multi_delete_prepare(THD *thd); +int mysql_multi_update_prepare(THD *thd); +int mysql_multi_delete_prepare(THD *thd); bool mysql_insert_select_prepare(THD *thd); bool update_precheck(THD *thd, TABLE_LIST *tables); bool delete_precheck(THD *thd, TABLE_LIST *tables); @@ -709,7 +709,7 @@ struct Query_cache_query_flags uint build_table_path(char *buff, size_t bufflen, const char *db, const char *table, const char *ext); -bool mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create, bool silent); +int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create, bool silent); bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create); bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent); void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, ushort flags); @@ -749,7 +749,7 @@ pthread_handler_t handle_one_connection(void *arg); pthread_handler_t handle_bootstrap(void *arg); void end_thread(THD *thd,bool put_in_cache); void flush_thread_cache(); -bool mysql_execute_command(THD *thd); +int mysql_execute_command(THD *thd); bool dispatch_command(enum enum_server_command command, THD *thd, char* packet, uint packet_length); void log_slow_statement(THD *thd); @@ -880,7 +880,7 @@ void prepare_triggers_for_insert_stmt(THD *thd, TABLE *table, enum_duplicates duplic); void mark_fields_used_by_triggers_for_insert_stmt(THD *thd, TABLE *table, enum_duplicates duplic); -bool mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds); +int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds); bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order, ha_rows rows, ulonglong options, bool reset_auto_increment); @@ -1065,6 +1065,13 @@ SQL_SELECT *make_select(TABLE *head, table_map const_tables, extern Item **not_found_item; /* + A set of constants used for checking non aggregated fields and sum + functions mixture in the ONLY_FULL_GROUP_BY_MODE. +*/ +#define NON_AGG_FIELD_USED 1 +#define SUM_FUNC_USED 2 + +/* This enumeration type is used only by the function find_item_in_list to return the info on how an item has been resolved against a list of possibly aliased items. @@ -1126,7 +1133,7 @@ int init_ftfuncs(THD *thd, SELECT_LEX* select, bool no_order); void wait_for_refresh(THD *thd); int open_tables(THD *thd, TABLE_LIST **tables, uint *counter, uint flags); int simple_open_n_lock_tables(THD *thd,TABLE_LIST *tables); -bool open_and_lock_tables(THD *thd,TABLE_LIST *tables); +int open_and_lock_tables(THD *thd,TABLE_LIST *tables); bool open_normal_and_derived_tables(THD *thd, TABLE_LIST *tables, uint flags); int lock_tables(THD *thd, TABLE_LIST *tables, uint counter, bool *need_reopen); TABLE *open_temporary_table(THD *thd, const char *path, const char *db, @@ -1197,7 +1204,7 @@ inline TABLE_LIST *find_table_in_local_list(TABLE_LIST *table, bool eval_const_cond(COND *cond); /* sql_load.cc */ -bool mysql_load(THD *thd, sql_exchange *ex, TABLE_LIST *table_list, +int mysql_load(THD *thd, sql_exchange *ex, TABLE_LIST *table_list, List<Item> &fields_vars, List<Item> &set_fields, List<Item> &set_values_list, enum enum_duplicates handle_duplicates, bool ignore, diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 08f881ce8ed..7edc3b91752 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -328,7 +328,7 @@ static bool lower_case_table_names_used= 0; static bool volatile select_thread_in_use, signal_thread_in_use; static bool volatile ready_to_exit; static my_bool opt_debugging= 0, opt_external_locking= 0, opt_console= 0; -static my_bool opt_bdb, opt_isam, opt_ndbcluster, opt_merge; +static my_bool opt_bdb, opt_isam, opt_ndbcluster, opt_merge, opt_federated; static my_bool opt_short_log_format= 0; static uint kill_cached_threads, wake_thread; static ulong killed_threads, thread_created; @@ -1071,12 +1071,9 @@ pthread_handler_t kill_server_thread(void *arg __attribute__((unused))) extern "C" sig_handler print_signal_warning(int sig) { - if (!DBUG_IN_USE) - { - if (global_system_variables.log_warnings) - sql_print_warning("Got signal %d from thread %ld", - sig, my_thread_id()); - } + if (global_system_variables.log_warnings) + sql_print_warning("Got signal %d from thread %ld", + sig, my_thread_id()); #ifdef DONT_REMEMBER_SIGNAL my_sigset(sig,print_signal_warning); /* int. thread system calls */ #endif @@ -3623,8 +3620,6 @@ int main(int argc, char **argv) MY_INIT(argv[0]); // init my_sys library & pthreads /* ^^^ Nothing should be before this line! */ - DEBUGGER_OFF; - /* Set signal used to kill MySQL */ #if defined(SIGUSR2) thr_kill_signal= thd_lib_detected == THD_LIB_LT ? SIGINT : SIGUSR2; @@ -4995,7 +4990,8 @@ enum options_mysqld OPT_INNODB_ROLLBACK_ON_TIMEOUT, OPT_SECURE_FILE_PRIV, OPT_KEEP_FILES_ON_CREATE, - OPT_INNODB_ADAPTIVE_HASH_INDEX + OPT_INNODB_ADAPTIVE_HASH_INDEX, + OPT_FEDERATED }; @@ -5181,6 +5177,9 @@ Disable with --skip-external-locking.", 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"flush", OPT_FLUSH, "Flush tables to disk between SQL commands.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"federated", OPT_FEDERATED, "Enable Federated storage engine. Disable with \ +--skip-federated.", + (gptr*) &opt_federated, (gptr*) &opt_federated, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, /* We must always support the next option to make scripts like mysqltest easier to do */ {"gdb", OPT_DEBUGGING, @@ -6956,7 +6955,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), switch(optid) { case '#': #ifndef DBUG_OFF - DBUG_PUSH(argument ? argument : default_dbug_option); + DBUG_SET_INITIAL(argument ? argument : default_dbug_option); #endif opt_endinfo=1; /* unireg: memory allocation */ break; @@ -7335,6 +7334,14 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), else have_merge_db= SHOW_OPTION_DISABLED; break; +#ifdef HAVE_FEDERATED_DB + case OPT_FEDERATED: + if (opt_federated) + have_federated_db= SHOW_OPTION_YES; + else + have_federated_db= SHOW_OPTION_DISABLED; + break; +#endif #ifdef HAVE_BERKELEY_DB case OPT_BDB_NOSYNC: /* Deprecated option */ diff --git a/sql/net_serv.cc b/sql/net_serv.cc index 017a2eb9ecd..a40764577fd 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -394,7 +394,7 @@ my_net_write(NET *net,const char *packet,ulong len) if (net_write_buff(net,(char*) buff,NET_HEADER_SIZE)) return 1; #ifndef DEBUG_DATA_PACKETS - DBUG_DUMP("packet_header",(char*) buff,NET_HEADER_SIZE); + DBUG_DUMP("packet_header", buff, NET_HEADER_SIZE); #endif return test(net_write_buff(net,packet,len)); } @@ -892,7 +892,7 @@ my_real_read(NET *net, ulong *complen) if (i == 0) { /* First parts is packet length */ ulong helping; - DBUG_DUMP("packet_header",(char*) net->buff+net->where_b, + DBUG_DUMP("packet_header", net->buff+net->where_b, NET_HEADER_SIZE); if (net->buff[net->where_b + 3] != (uchar) net->pkt_nr) { diff --git a/sql/opt_range.cc b/sql/opt_range.cc index a8cf0f67635..17a4701b515 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -4405,52 +4405,70 @@ get_mm_leaf(PARAM *param, COND *conf_func, Field *field, KEY_PART *key_part, field->type() == FIELD_TYPE_DATETIME)) field->table->in_use->variables.sql_mode|= MODE_INVALID_DATES; err= value->save_in_field_no_warnings(field, 1); - if (err > 0 && field->cmp_type() != value->result_type()) + if (err > 0) { - if ((type == Item_func::EQ_FUNC || type == Item_func::EQUAL_FUNC) && - value->result_type() == item_cmp_type(field->result_type(), - value->result_type())) - - { - tree= new (alloc) SEL_ARG(field, 0, 0); - tree->type= SEL_ARG::IMPOSSIBLE; - goto end; - } - else + if (field->cmp_type() != value->result_type()) { - /* - TODO: We should return trees of the type SEL_ARG::IMPOSSIBLE - for the cases like int_field > 999999999999999999999999 as well. - */ - tree= 0; - if (err == 3 && field->type() == FIELD_TYPE_DATE && - (type == Item_func::GT_FUNC || type == Item_func::GE_FUNC || - type == Item_func::LT_FUNC || type == Item_func::LE_FUNC) ) + if ((type == Item_func::EQ_FUNC || type == Item_func::EQUAL_FUNC) && + value->result_type() == item_cmp_type(field->result_type(), + value->result_type())) + { + tree= new (alloc) SEL_ARG(field, 0, 0); + tree->type= SEL_ARG::IMPOSSIBLE; + goto end; + } + else { /* - We were saving DATETIME into a DATE column, the conversion went ok - but a non-zero time part was cut off. + TODO: We should return trees of the type SEL_ARG::IMPOSSIBLE + for the cases like int_field > 999999999999999999999999 as well. + */ + tree= 0; + if (err == 3 && field->type() == FIELD_TYPE_DATE && + (type == Item_func::GT_FUNC || type == Item_func::GE_FUNC || + type == Item_func::LT_FUNC || type == Item_func::LE_FUNC) ) + { + /* + We were saving DATETIME into a DATE column, the conversion went ok + but a non-zero time part was cut off. - In MySQL's SQL dialect, DATE and DATETIME are compared as datetime - values. Index over a DATE column uses DATE comparison. Changing - from one comparison to the other is possible: + In MySQL's SQL dialect, DATE and DATETIME are compared as datetime + values. Index over a DATE column uses DATE comparison. Changing + from one comparison to the other is possible: - datetime(date_col)< '2007-12-10 12:34:55' -> date_col<='2007-12-10' - datetime(date_col)<='2007-12-10 12:34:55' -> date_col<='2007-12-10' + datetime(date_col)< '2007-12-10 12:34:55' -> date_col<='2007-12-10' + datetime(date_col)<='2007-12-10 12:34:55' -> date_col<='2007-12-10' - datetime(date_col)> '2007-12-10 12:34:55' -> date_col>='2007-12-10' - datetime(date_col)>='2007-12-10 12:34:55' -> date_col>='2007-12-10' + datetime(date_col)> '2007-12-10 12:34:55' -> date_col>='2007-12-10' + datetime(date_col)>='2007-12-10 12:34:55' -> date_col>='2007-12-10' - but we'll need to convert '>' to '>=' and '<' to '<='. This will - be done together with other types at the end of this function - (grep for field_is_equal_to_item) - */ + but we'll need to convert '>' to '>=' and '<' to '<='. This will + be done together with other types at the end of this function + (grep for field_is_equal_to_item) + */ + } + else + goto end; } - else - goto end; } - } - if (err < 0) + + /* + guaranteed at this point: err > 0; field and const of same type + If an integer got bounded (e.g. to within 0..255 / -128..127) + for < or >, set flags as for <= or >= (no NEAR_MAX / NEAR_MIN) + */ + else if (err == 1 && field->result_type() == INT_RESULT) + { + if (type == Item_func::LT_FUNC && (value->val_int() > 0)) + type = Item_func::LE_FUNC; + else if (type == Item_func::GT_FUNC && + !((Field_num*)field)->unsigned_flag && + !((Item_int*)value)->unsigned_flag && + (value->val_int() < 0)) + type = Item_func::GE_FUNC; + } + } + else if (err < 0) { field->table->in_use->variables.sql_mode= orig_sql_mode; /* This happens when we try to insert a NULL field in a not null column */ @@ -9552,8 +9570,6 @@ static void print_sel_tree(PARAM *param, SEL_TREE *tree, key_map *tree_map, int idx; char buff[1024]; DBUG_ENTER("print_sel_tree"); - if (! _db_on_) - DBUG_VOID_RETURN; String tmp(buff,sizeof(buff),&my_charset_bin); tmp.length(0); @@ -9583,8 +9599,6 @@ static void print_ror_scans_arr(TABLE *table, const char *msg, struct st_ror_scan_info **end) { DBUG_ENTER("print_ror_scans"); - if (! _db_on_) - DBUG_VOID_RETURN; char buff[1024]; String tmp(buff,sizeof(buff),&my_charset_bin); @@ -9647,7 +9661,7 @@ static void print_quick(QUICK_SELECT_I *quick, const key_map *needed_reg) { char buf[MAX_KEY/8+1]; DBUG_ENTER("print_quick"); - if (! _db_on_ || !quick) + if (!quick) DBUG_VOID_RETURN; DBUG_LOCK_FILE; diff --git a/sql/procedure.h b/sql/procedure.h index 850d5c74db4..f1fb433a6ee 100644 --- a/sql/procedure.h +++ b/sql/procedure.h @@ -144,7 +144,7 @@ public: virtual int send_row(List<Item> &fields)=0; virtual bool change_columns(List<Item> &fields)=0; virtual void update_refs(void) {} - virtual bool end_of_records() { return 0; } + virtual int end_of_records() { return 0; } }; Procedure *setup_procedure(THD *thd,ORDER *proc_param,select_result *result, diff --git a/sql/set_var.cc b/sql/set_var.cc index 71a5a26f1d7..eb381bfecf4 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -2004,7 +2004,7 @@ void sys_var_thd_date_time_format::update2(THD *thd, enum_var_type type, { DATE_TIME_FORMAT *old; DBUG_ENTER("sys_var_date_time_format::update2"); - DBUG_DUMP("positions",(char*) new_value->positions, + DBUG_DUMP("positions", new_value->positions, sizeof(new_value->positions)); if (type == OPT_GLOBAL) diff --git a/sql/share/charsets/README b/sql/share/charsets/README index 172d1ee8e1e..3c5b3206faa 100644 --- a/sql/share/charsets/README +++ b/sql/share/charsets/README @@ -1,28 +1,31 @@ -This directory holds configuration files which allow MySQL to work with +This directory holds configuration files that enable MySQL to work with different character sets. It contains: -*.conf - Each conf file contains four tables which describe character types, +charset_name.xml + Each charset_name.xml file contains information for a simple character + set. The information in the file describes character types, lower- and upper-case equivalencies and sorting orders for the character values in the set. -Index - The Index file lists all of the available charset configurations. +Index.xml + The Index.xml file lists all of the available charset configurations, + including collations. - Each charset is paired with a number. The number is stored - IN THE DATABASE TABLE FILES and must not be changed. Always - add new character sets to the end of the list, so that the - numbers of the other character sets will not be changed. + Each collation must have a unique number. The number is stored + IN THE DATABASE TABLE FILES and must not be changed. + + The max-id attribute of the <charsets> element must be set to + the largest collation number. Compiled in or configuration file? When should a character set be compiled in to MySQL's string library - (libmystrings), and when should it be placed in a configuration - file? + (libmystrings), and when should it be placed in a charset_name.xml + configuration file? If the character set requires the strcoll functions or is a multi-byte character set, it MUST be compiled in to the string library. If it does not require these functions, it should be - placed in a configuration file. + placed in a charset_name.xml configuration file. If the character set uses any one of the strcoll functions, it must define all of them. Likewise, if the set uses one of the @@ -30,11 +33,7 @@ Compiled in or configuration file? more information on how to add a complex character set to MySQL. Syntax of configuration files - The syntax is very simple. Comments start with a '#' character and - proceed to the end of the line. Words are separated by arbitrary - amounts of whitespace. - - For the character set configuration files, every word must be a - number in hexadecimal format. The ctype array takes up the first - 257 words; the to_lower, to_upper and sort_order arrays take up 256 - words each after that. + The syntax is very simple. Words in <map> array elements are + separated by arbitrary amounts of whitespace. Each word must be a + number in hexadecimal format. The ctype array has 257 words; the + other arrays (lower, upper, etc.) take up 256 words each after that. diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index 9e6cf462113..7d345d633c6 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -1771,30 +1771,30 @@ ER_BLOB_USED_AS_KEY 42000 S1009 swe "En BLOB '%-.64s' kan inte vara nyckel med den använda tabelltypen" ukr "BLOB ÓÔÏ×ÂÅÃØ '%-.64s' ÎÅ ÍÏÖÅ ÂÕÔÉ ×ÉËÏÒÉÓÔÁÎÉÊ Õ ×ÉÚÎÁÞÅÎΦ ËÌÀÞÁ × ÃØÏÍÕ ÔÉЦ ÔÁÂÌÉæ" ER_TOO_BIG_FIELDLENGTH 42000 S1009 - cze "P-Bøíli¹ velká délka sloupce '%-.64s' (nejvíce %d). Pou¾ijte BLOB" - dan "For stor feltlængde for kolonne '%-.64s' (maks = %d). Brug BLOB i stedet" - nla "Te grote kolomlengte voor '%-.64s' (max = %d). Maak hiervoor gebruik van het type BLOB" - eng "Column length too big for column '%-.64s' (max = %d); use BLOB or TEXT instead" - jps "column '%-.64s' ‚Í,Šm•Û‚·‚é column ‚Ì‘å‚«‚³‚ª‘½‚·‚¬‚Ü‚·. (Å‘å %d ‚Ü‚Å). BLOB ‚ð‚©‚í‚è‚ÉŽg—p‚µ‚Ä‚‚¾‚³‚¢.", - est "Tulba '%-.64s' pikkus on liiga pikk (maksimaalne pikkus: %d). Kasuta BLOB väljatüüpi" - fre "Champ '%-.64s' trop long (max = %d). Utilisez un BLOB" - ger "Feldlänge für Feld '%-.64s' zu groß (maximal %d). BLOB- oder TEXT-Spaltentyp verwenden!" - greek "Ðïëý ìåãÜëï ìÞêïò ãéá ôï ðåäßï '%-.64s' (max = %d). Ðáñáêáëþ ÷ñçóéìïðïéåßóôå ôïí ôýðï BLOB" - hun "A(z) '%-.64s' oszlop tul hosszu. (maximum = %d). Hasznaljon BLOB tipust inkabb." - ita "La colonna '%-.64s' e` troppo grande (max=%d). Utilizza un BLOB." - jpn "column '%-.64s' ¤Ï,³ÎÊݤ¹¤ë column ¤ÎÂ礤µ¤¬Â¿¤¹¤®¤Þ¤¹. (ºÇÂç %d ¤Þ¤Ç). BLOB ¤ò¤«¤ï¤ê¤Ë»ÈÍѤ·¤Æ¤¯¤À¤µ¤¤." - kor "Ä®·³ '%-.64s'ÀÇ Ä®·³ ±æÀÌ°¡ ³Ê¹« ±é´Ï´Ù (ÃÖ´ë = %d). ´ë½Å¿¡ BLOB¸¦ »ç¿ëÇϼ¼¿ä." - nor "For stor nøkkellengde for kolonne '%-.64s' (maks = %d). Bruk BLOB istedenfor" - norwegian-ny "For stor nykkellengde for felt '%-.64s' (maks = %d). Bruk BLOB istadenfor" - pol "Zbyt du¿a d³ugo?æ kolumny '%-.64s' (maks. = %d). W zamian u¿yj typu BLOB" - por "Comprimento da coluna '%-.64s' grande demais (max = %d); use BLOB em seu lugar" - rum "Lungimea coloanei '%-.64s' este prea lunga (maximum = %d). Foloseste BLOB mai bine" - rus "óÌÉÛËÏÍ ÂÏÌØÛÁÑ ÄÌÉÎÁ ÓÔÏÌÂÃÁ '%-.64s' (ÍÁËÓÉÍÕÍ = %d). éÓÐÏÌØÚÕÊÔÅ ÔÉÐ BLOB ÉÌÉ TEXT ×ÍÅÓÔÏ ÔÅËÕÝÅÇÏ" - serbian "Previše podataka za kolonu '%-.64s' (maksimum je %d). Upotrebite BLOB polje" - slo "Príli¹ veµká då¾ka pre pole '%-.64s' (maximum = %d). Pou¾ite BLOB" - spa "Longitud de columna demasiado grande para la columna '%-.64s' (maximo = %d).Usar BLOB en su lugar" - swe "För stor kolumnlängd angiven för '%-.64s' (max= %d). Använd en BLOB instället" - ukr "úÁÄÏ×ÇÁ ÄÏ×ÖÉÎÁ ÓÔÏ×ÂÃÑ '%-.64s' (max = %d). ÷ÉËÏÒÉÓÔÁÊÔÅ ÔÉÐ BLOB" + cze "P-Bøíli¹ velká délka sloupce '%-.64s' (nejvíce %lu). Pou¾ijte BLOB" + dan "For stor feltlængde for kolonne '%-.64s' (maks = %lu). Brug BLOB i stedet" + nla "Te grote kolomlengte voor '%-.64s' (max = %lu). Maak hiervoor gebruik van het type BLOB" + eng "Column length too big for column '%-.64s' (max = %lu); use BLOB or TEXT instead" + jps "column '%-.64s' ‚Í,Šm•Û‚·‚é column ‚Ì‘å‚«‚³‚ª‘½‚·‚¬‚Ü‚·. (Å‘å %lu ‚Ü‚Å). BLOB ‚ð‚©‚í‚è‚ÉŽg—p‚µ‚Ä‚‚¾‚³‚¢.", + est "Tulba '%-.64s' pikkus on liiga pikk (maksimaalne pikkus: %lu). Kasuta BLOB väljatüüpi" + fre "Champ '%-.64s' trop long (max = %lu). Utilisez un BLOB" + ger "Feldlänge für Feld '%-.64s' zu groß (maximal %lu). BLOB- oder TEXT-Spaltentyp verwenden!" + greek "Ðïëý ìåãÜëï ìÞêïò ãéá ôï ðåäßï '%-.64s' (max = %lu). Ðáñáêáëþ ÷ñçóéìïðïéåßóôå ôïí ôýðï BLOB" + hun "A(z) '%-.64s' oszlop tul hosszu. (maximum = %lu). Hasznaljon BLOB tipust inkabb." + ita "La colonna '%-.64s' e` troppo grande (max=%lu). Utilizza un BLOB." + jpn "column '%-.64s' ¤Ï,³ÎÊݤ¹¤ë column ¤ÎÂ礤µ¤¬Â¿¤¹¤®¤Þ¤¹. (ºÇÂç %lu ¤Þ¤Ç). BLOB ¤ò¤«¤ï¤ê¤Ë»ÈÍѤ·¤Æ¤¯¤À¤µ¤¤." + kor "Ä®·³ '%-.64s'ÀÇ Ä®·³ ±æÀÌ°¡ ³Ê¹« ±é´Ï´Ù (ÃÖ´ë = %lu). ´ë½Å¿¡ BLOB¸¦ »ç¿ëÇϼ¼¿ä." + nor "For stor nøkkellengde for kolonne '%-.64s' (maks = %lu). Bruk BLOB istedenfor" + norwegian-ny "For stor nykkellengde for felt '%-.64s' (maks = %lu). Bruk BLOB istadenfor" + pol "Zbyt du¿a d³ugo?æ kolumny '%-.64s' (maks. = %lu). W zamian u¿yj typu BLOB" + por "Comprimento da coluna '%-.64s' grande demais (max = %lu); use BLOB em seu lugar" + rum "Lungimea coloanei '%-.64s' este prea lunga (maximum = %lu). Foloseste BLOB mai bine" + rus "óÌÉÛËÏÍ ÂÏÌØÛÁÑ ÄÌÉÎÁ ÓÔÏÌÂÃÁ '%-.64s' (ÍÁËÓÉÍÕÍ = %lu). éÓÐÏÌØÚÕÊÔÅ ÔÉÐ BLOB ÉÌÉ TEXT ×ÍÅÓÔÏ ÔÅËÕÝÅÇÏ" + serbian "Previše podataka za kolonu '%-.64s' (maksimum je %lu). Upotrebite BLOB polje" + slo "Príli¹ veµká då¾ka pre pole '%-.64s' (maximum = %lu). Pou¾ite BLOB" + spa "Longitud de columna demasiado grande para la columna '%-.64s' (maximo = %lu).Usar BLOB en su lugar" + swe "För stor kolumnlängd angiven för '%-.64s' (max= %lu). Använd en BLOB instället" + ukr "úÁÄÏ×ÇÁ ÄÏ×ÖÉÎÁ ÓÔÏ×ÂÃÑ '%-.64s' (max = %lu). ÷ÉËÏÒÉÓÔÁÊÔÅ ÔÉÐ BLOB" ER_WRONG_AUTO_KEY 42000 S1009 cze "M-Bù¾ete mít pouze jedno AUTO pole a to musí být definováno jako klíè" dan "Der kan kun specificeres eet AUTO_INCREMENT-felt, og det skal være indekseret" @@ -5508,11 +5508,11 @@ ER_SP_NO_RECURSION eng "Recursive stored functions and triggers are not allowed." ger "Rekursive gespeicherte Routinen und Triggers sind nicht erlaubt" ER_TOO_BIG_SCALE 42000 S1009 - eng "Too big scale %d specified for column '%-.64s'. Maximum is %d." - ger "Zu großer Skalierungsfaktor %d für Feld '%-.64s' angegeben. Maximum ist %d" + eng "Too big scale %lu specified for column '%-.64s'. Maximum is %d." + ger "Zu großer Skalierungsfaktor %lu für Feld '%-.64s' angegeben. Maximum ist %d" ER_TOO_BIG_PRECISION 42000 S1009 - eng "Too big precision %d specified for column '%-.64s'. Maximum is %d." - ger "Zu große Genauigkeit %d für Feld '%-.64s' angegeben. Maximum ist %d" + eng "Too big precision %lu specified for column '%-.64s'. Maximum is %lu." + ger "Zu große Genauigkeit %lu für Feld '%-.64s' angegeben. Maximum ist %lu" ER_M_BIGGER_THAN_D 42000 S1009 eng "For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '%-.64s')." ger "Für FLOAT(M,D), DOUBLE(M,D) oder DECIMAL(M,D) muss M >= D sein (Feld '%-.64s')" @@ -5550,8 +5550,8 @@ ER_WARN_CANT_DROP_DEFAULT_KEYCACHE eng "Cannot drop default keycache" ger "Der vorgabemäßige Schlüssel-Cache kann nicht gelöscht werden" ER_TOO_BIG_DISPLAYWIDTH 42000 S1009 - eng "Display width out of range for column '%-.64s' (max = %d)" - ger "Anzeigebreite außerhalb des zulässigen Bereichs für Spalte '%-.64s' (Maximum: %d)" + eng "Display width out of range for column '%-.64s' (max = %lu)" + ger "Anzeigebreite außerhalb des zulässigen Bereichs für Spalte '%-.64s' (Maximum: %lu)" ER_XAER_DUPID XAE08 eng "XAER_DUPID: The XID already exists" ger "XAER_DUPID: Die XID existiert bereits" @@ -5641,3 +5641,7 @@ ER_NAME_BECOMES_EMPTY eng "Name '%-.64s' has become ''" ER_AMBIGUOUS_FIELD_TERM eng "First character of the FIELDS TERMINATED string is ambiguous; please use non-optional and non-empty FIELDS ENCLOSED BY" +ER_LOAD_DATA_INVALID_COLUMN + eng "Invalid column reference (%-.64s) in LOAD DATA" +ER_LOG_PURGE_NO_FILE + eng "Being purged log %s was not found" diff --git a/sql/sp.cc b/sql/sp.cc index 7224d3c4f0e..2392cabb220 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -25,7 +25,8 @@ static bool create_string(THD *thd, String *buf, int sp_type, - sp_name *name, + const char *db, ulong dblen, + const char *name, ulong namelen, const char *params, ulong paramslen, const char *returns, ulong returnslen, const char *body, ulong bodylen, @@ -426,12 +427,13 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp, */ if (!create_string(thd, &defstr, - type, - name, - params, strlen(params), - returns, strlen(returns), - body, strlen(body), - &chistics, &definer_user_name, &definer_host_name)) + type, + NULL, 0, + name->m_name.str, name->m_name.length, + params, strlen(params), + returns, strlen(returns), + body, strlen(body), + &chistics, &definer_user_name, &definer_host_name)) { ret= SP_INTERNAL_ERROR; goto end; @@ -518,6 +520,7 @@ db_create_routine(THD *thd, int type, sp_head *sp) DBUG_ENTER("db_create_routine"); DBUG_PRINT("enter", ("type: %d name: %.*s",type,sp->m_name.length, sp->m_name.str)); + String retstr(64); if (!(table= open_proc_table_for_update(thd))) ret= SP_OPEN_TABLE_FAILED; @@ -568,7 +571,6 @@ db_create_routine(THD *thd, int type, sp_head *sp) store(sp->m_params.str, sp->m_params.length, system_charset_info); if (sp->m_type == TYPE_ENUM_FUNCTION) { - String retstr(64); sp_returns_type(thd, retstr, sp); table->field[MYSQL_PROC_FIELD_RETURNS]-> store(retstr.ptr(), retstr.length(), system_charset_info); @@ -625,13 +627,21 @@ db_create_routine(THD *thd, int type, sp_head *sp) String log_query; log_query.set_charset(system_charset_info); - log_query.append(STRING_WITH_LEN("CREATE ")); - append_definer(thd, &log_query, &thd->lex->definer->user, - &thd->lex->definer->host); - log_query.append(thd->lex->stmt_definition_begin, - (char *)sp->m_body_begin - - thd->lex->stmt_definition_begin + - sp->m_body.length); + + if (!create_string(thd, &log_query, + sp->m_type, + (sp->m_explicit_name ? sp->m_db.str : NULL), + (sp->m_explicit_name ? sp->m_db.length : 0), + sp->m_name.str, sp->m_name.length, + sp->m_params.str, sp->m_params.length, + retstr.c_ptr(), retstr.length(), + sp->m_body.str, sp->m_body.length, + sp->m_chistics, &(thd->lex->definer->user), + &(thd->lex->definer->host))) + { + ret= SP_INTERNAL_ERROR; + goto done; + } /* Such a statement can always go directly to binlog, no trans cache */ Query_log_event qinfo(thd, log_query.c_ptr(), log_query.length(), 0, @@ -1797,17 +1807,18 @@ sp_cache_routines_and_add_tables_for_triggers(THD *thd, LEX *lex, */ static bool create_string(THD *thd, String *buf, - int type, - sp_name *name, - const char *params, ulong paramslen, - const char *returns, ulong returnslen, - const char *body, ulong bodylen, - st_sp_chistics *chistics, + int type, + const char *db, ulong dblen, + const char *name, ulong namelen, + const char *params, ulong paramslen, + const char *returns, ulong returnslen, + const char *body, ulong bodylen, + st_sp_chistics *chistics, const LEX_STRING *definer_user, const LEX_STRING *definer_host) { /* Make some room to begin with */ - if (buf->alloc(100 + name->m_qname.length + paramslen + returnslen + bodylen + + if (buf->alloc(100 + dblen + 1 + namelen + paramslen + returnslen + bodylen + chistics->comment.length + 10 /* length of " DEFINER= "*/ + USER_HOST_BUFF_SIZE)) return FALSE; @@ -1818,7 +1829,12 @@ create_string(THD *thd, String *buf, buf->append(STRING_WITH_LEN("FUNCTION ")); else buf->append(STRING_WITH_LEN("PROCEDURE ")); - append_identifier(thd, buf, name->m_name.str, name->m_name.length); + if (dblen > 0) + { + append_identifier(thd, buf, db, dblen); + buf->append('.'); + } + append_identifier(thd, buf, name, namelen); buf->append('('); buf->append(params, paramslen); buf->append(')'); diff --git a/sql/sp_head.cc b/sql/sp_head.cc index f7119323055..4556d70e4c3 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -522,6 +522,8 @@ sp_head::init(LEX *lex) m_qname.str= NULL; m_qname.length= 0; + m_explicit_name= false; + m_db.str= NULL; m_db.length= 0; @@ -564,6 +566,8 @@ sp_head::init_sp_name(THD *thd, sp_name *spname) m_name.str= strmake_root(thd->mem_root, spname->m_name.str, spname->m_name.length); + m_explicit_name= spname->m_explicit_name; + if (spname->m_qname.length == 0) spname->init_qname(thd); diff --git a/sql/sp_head.h b/sql/sp_head.h index 0e710196603..11ff7160c03 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -121,6 +121,7 @@ public: st_sp_chistics *m_chistics; ulong m_sql_mode; // For SHOW CREATE and execution LEX_STRING m_qname; // db.name + bool m_explicit_name; /**< Prepend the db name? */ /** Key representing routine in the set of stored routines used by statement. [routine_type]db.name\0 diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index e9504f423ad..7592986ef81 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1382,7 +1382,7 @@ bool acl_check_host(const char *host, const char *ip) 1 ERROR ; In this case the error is sent to the client. */ -bool check_change_password(THD *thd, const char *host, const char *user, +int check_change_password(THD *thd, const char *host, const char *user, char *new_password, uint new_password_len) { if (!initialized) @@ -2763,7 +2763,7 @@ table_error: TRUE error */ -bool mysql_table_grant(THD *thd, TABLE_LIST *table_list, +int mysql_table_grant(THD *thd, TABLE_LIST *table_list, List <LEX_USER> &user_list, List <LEX_COLUMN> &columns, ulong rights, bool revoke_grant) @@ -2880,6 +2880,12 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list, } #endif + /* + The lock api is depending on the thd->lex variable which needs to be + re-initialized. + */ + Query_tables_list backup; + thd->lex->reset_n_backup_query_tables_list(&backup); if (simple_open_n_lock_tables(thd,tables)) { // Should never happen close_thread_tables(thd); /* purecov: deadcode */ @@ -3018,6 +3024,7 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list, send_ok(thd); /* Tables are automatically closed */ + thd->lex->restore_backup_query_tables_list(&backup); DBUG_RETURN(result); } @@ -5805,7 +5812,7 @@ bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name, < 0 Error. Error message not yet sent. */ -bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name, +int sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name, bool is_proc) { Security_context *sctx= thd->security_ctx; diff --git a/sql/sql_acl.h b/sql/sql_acl.h index b2007ccdf47..1efcd2e3b6b 100644 --- a/sql/sql_acl.h +++ b/sql/sql_acl.h @@ -183,13 +183,13 @@ int acl_getroot(THD *thd, USER_RESOURCES *mqh, const char *passwd, bool acl_getroot_no_password(Security_context *sctx, char *user, char *host, char *ip, char *db); bool acl_check_host(const char *host, const char *ip); -bool check_change_password(THD *thd, const char *host, const char *user, +int check_change_password(THD *thd, const char *host, const char *user, char *password, uint password_len); bool change_password(THD *thd, const char *host, const char *user, char *password); bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &user_list, ulong rights, bool revoke); -bool mysql_table_grant(THD *thd, TABLE_LIST *table, List <LEX_USER> &user_list, +int mysql_table_grant(THD *thd, TABLE_LIST *table, List <LEX_USER> &user_list, List <LEX_COLUMN> &column_list, ulong rights, bool revoke); bool mysql_routine_grant(THD *thd, TABLE_LIST *table, bool is_proc, @@ -225,7 +225,7 @@ void fill_effective_table_privileges(THD *thd, GRANT_INFO *grant, const char *db, const char *table); bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name, bool is_proc); -bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name, +int sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name, bool is_proc); bool check_routine_level_acl(THD *thd, const char *db, const char *name, bool is_proc); diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc index 95a7fb3d34d..4b3264069b5 100644 --- a/sql/sql_analyse.cc +++ b/sql/sql_analyse.cc @@ -195,13 +195,13 @@ bool test_if_number(NUM_INFO *info, const char *str, uint str_len) */ for (; str != end && my_isspace(system_charset_info, *str); str++) ; if (str == end) - return 0; + DBUG_RETURN(0); if (*str == '-') { info->negative = 1; if (++str == end || *str == '0') // converting -0 to a number - return 0; // might lose information + DBUG_RETURN(0); // might lose information } else info->negative = 0; @@ -219,33 +219,33 @@ bool test_if_number(NUM_INFO *info, const char *str, uint str_len) int error; info->ullval= (ulonglong) my_strtoll10(begin, &endpos, &error); if (info->integers == 1) - return 0; // a single number can't be zerofill + DBUG_RETURN(0); // a single number can't be zerofill info->maybe_zerofill = 1; - return 1; // a zerofill number, or an integer + DBUG_RETURN(1); // a zerofill number, or an integer } if (*str == '.' || *str == 'e' || *str == 'E') { if (info->zerofill) // can't be zerofill anymore - return 0; + DBUG_RETURN(0); if ((str + 1) == end) // number was something like '123[.eE]' { char *endpos= (char*) str; int error; info->ullval= (ulonglong) my_strtoll10(begin, &endpos, &error); - return 1; + DBUG_RETURN(1); } if (*str == 'e' || *str == 'E') // number may be something like '1e+50' { str++; if (*str != '-' && *str != '+') - return 0; + DBUG_RETURN(0); for (str++; str != end && my_isdigit(system_charset_info,*str); str++) ; if (str == end) { info->is_float = 1; // we can't use variable decimals here - return 1; + DBUG_RETURN(1); } - return 0; + DBUG_RETURN(0); } for (str++; *(end - 1) == '0'; end--); // jump over zeros at the end if (str == end) // number was something like '123.000' @@ -253,17 +253,17 @@ bool test_if_number(NUM_INFO *info, const char *str, uint str_len) char *endpos= (char*) str; int error; info->ullval= (ulonglong) my_strtoll10(begin, &endpos, &error); - return 1; + DBUG_RETURN(1); } for (; str != end && my_isdigit(system_charset_info,*str); str++) info->decimals++; if (str == end) { info->dval = my_atof(begin); - return 1; + DBUG_RETURN(1); } } - return 0; + DBUG_RETURN(0); } @@ -683,7 +683,7 @@ int analyse::send_row(List<Item> &field_list __attribute__((unused))) } // analyse::send_row -bool analyse::end_of_records() +int analyse::end_of_records() { field_info **f = f_info; char buff[MAX_FIELD_WIDTH]; diff --git a/sql/sql_analyse.h b/sql/sql_analyse.h index 21a37209e89..2a4226b2d95 100644 --- a/sql/sql_analyse.h +++ b/sql/sql_analyse.h @@ -350,7 +350,7 @@ public: virtual bool change_columns(List<Item> &fields); virtual int send_row(List<Item> &fields); virtual void end_group(void) {} - virtual bool end_of_records(void); + virtual int end_of_records(void); friend Procedure *proc_analyse_init(THD *thd, ORDER *param, select_result *result, List<Item> &field_list); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 89c16b7e54c..9cdcc2bbb75 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -3046,7 +3046,7 @@ int simple_open_n_lock_tables(THD *thd, TABLE_LIST *tables) The lock will automaticaly be freed by close_thread_tables() */ -bool open_and_lock_tables(THD *thd, TABLE_LIST *tables) +int open_and_lock_tables(THD *thd, TABLE_LIST *tables) { uint counter; bool need_reopen; diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 226117f4e2f..6da6925e82d 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -639,6 +639,13 @@ void THD::cleanup_after_query() { clear_next_insert_id= 0; next_insert_id= 0; + + /* + BUG#33029, if one statement in a SP set this member to 1, all + statment after this statement in the SP would be considered used + INSERT_ID value, reset this member after each query to fix this. + */ + insert_id_used= 0; } /* Reset rand_used so that detection of calls to rand() will save random diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 91b0c02d23b..e25ede1be03 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -449,7 +449,7 @@ bool load_db_opt_by_name(THD *thd, const char *db_name, */ -bool mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info, +int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info, bool silent) { char path[FN_REFLEN+16]; diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index eeb77cef583..b9177f65ad5 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -375,7 +375,7 @@ cleanup: FALSE OK TRUE error */ -bool mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds) +int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds) { Item *fake_conds= 0; SELECT_LEX *select_lex= &thd->lex->select_lex; @@ -438,7 +438,7 @@ extern "C" int refpos_order_cmp(void* arg, const void *a,const void *b) TRUE Error */ -bool mysql_multi_delete_prepare(THD *thd) +int mysql_multi_delete_prepare(THD *thd) { LEX *lex= thd->lex; TABLE_LIST *aux_tables= (TABLE_LIST *)lex->auxiliary_table_list.first; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index f2a539fd02b..68c402d9895 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -708,9 +708,11 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, error=0; id=0; + thd_proc_info(thd, "update"); if (duplic != DUP_ERROR || ignore) table->file->extra(HA_EXTRA_IGNORE_DUP_KEY); + if (duplic == DUP_REPLACE) { if (!table->triggers || !table->triggers->has_delete_triggers()) @@ -736,8 +738,15 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, values_list.elements, and - if nothing else - to initialize the code to make the call of end_bulk_insert() below safe. */ - if (lock_type != TL_WRITE_DELAYED && !thd->prelocked_mode) - table->file->start_bulk_insert(values_list.elements); +#ifndef EMBEDDED_LIBRARY + if (lock_type != TL_WRITE_DELAYED) +#endif /* EMBEDDED_LIBRARY */ + { + if (duplic != DUP_ERROR || ignore) + table->file->extra(HA_EXTRA_IGNORE_DUP_KEY); + if (!thd->prelocked_mode) + table->file->start_bulk_insert(values_list.elements); + } thd->abort_on_warning= (!ignore && (thd->variables.sql_mode & (MODE_STRICT_TRANS_TABLES | @@ -863,6 +872,9 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, else if (table->next_number_field && info.copied) id=table->next_number_field->val_int(); // Return auto_increment value + if (duplic != DUP_ERROR || ignore) + table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); + transactional_table= table->file->has_transactions(); if ((changed= (info.copied || info.deleted || info.updated))) @@ -942,8 +954,6 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, thd->count_cuted_fields= CHECK_FIELD_IGNORE; thd->next_insert_id=0; // Reset this if wrongly used table->auto_increment_field_not_null= FALSE; - if (duplic != DUP_ERROR || ignore) - table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); if (duplic == DUP_REPLACE && (!table->triggers || !table->triggers->has_delete_triggers())) table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE); @@ -1283,7 +1293,12 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, select_lex->fix_prepare_information(thd, &fake_conds, &fake_conds); select_lex->first_execution= 0; } - if (duplic == DUP_UPDATE || duplic == DUP_REPLACE) + /* + Only call extra() handler method if we are not performing a DELAYED + operation. It will instead be executed by delayed insert thread. + */ + if ((duplic == DUP_UPDATE || duplic == DUP_REPLACE) && + (table->reginfo.lock_type != TL_WRITE_DELAYED)) table->file->extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY); DBUG_RETURN(FALSE); } @@ -2453,6 +2468,9 @@ bool Delayed_insert::handle_inserts(void) info.ignore= row->ignore; info.handle_duplicates= row->dup; + if (info.handle_duplicates == DUP_UPDATE || + info.handle_duplicates == DUP_REPLACE) + table->file->extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY); if (info.ignore || info.handle_duplicates != DUP_ERROR) { diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index b669919dba6..468bae02b13 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1253,6 +1253,7 @@ void st_select_lex::init_select() non_agg_fields.empty(); cond_value= having_value= Item::COND_UNDEF; inner_refs_list.empty(); + full_group_by_flag= 0; } /* @@ -1491,8 +1492,6 @@ bool st_select_lex::test_limit() "LIMIT & IN/ALL/ANY/SOME subquery"); return(1); } - // no sense in ORDER BY without LIMIT - order_list.empty(); return(0); } diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 890c18121bd..6878e2a4694 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -616,7 +616,16 @@ public: joins on the right. */ List<String> *prev_join_using; - + /* + Bitmap used in the ONLY_FULL_GROUP_BY_MODE to prevent mixture of aggregate + functions and non aggregated fields when GROUP BY list is absent. + Bits: + 0 - non aggregated fields are used in this select, + defined as NON_AGG_FIELD_USED. + 1 - aggregate functions are used in this select, + defined as SUM_FUNC_USED. + */ + uint8 full_group_by_flag; void init_query(); void init_select(); st_select_lex_unit* master_unit(); diff --git a/sql/sql_load.cc b/sql/sql_load.cc index d687ceff393..e9fd04dff15 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -110,7 +110,7 @@ static bool write_execute_load_query_log_event(THD *thd, TRUE - error / FALSE - success */ -bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, +int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, List<Item> &fields_vars, List<Item> &set_fields, List<Item> &set_values, enum enum_duplicates handle_duplicates, bool ignore, @@ -233,9 +233,11 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, while ((item= it++)) { - if (item->type() == Item::FIELD_ITEM) + Item *real_item= item->real_item(); + + if (real_item->type() == Item::FIELD_ITEM) { - Field *field= ((Item_field*)item)->field; + Field *field= ((Item_field*)real_item)->field; if (field->flags & BLOB_FLAG) { use_blobs= 1; @@ -244,7 +246,7 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, else tot_length+= field->field_length; } - else + else if (item->type() == Item::STRING_ITEM) use_vars= 1; } if (use_blobs && !ex->line_term->length() && !field_term->length()) @@ -705,6 +707,7 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, { uint length; byte *pos; + Item *real_item; if (read_info.read_field()) break; @@ -716,14 +719,17 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, pos=read_info.row_start; length=(uint) (read_info.row_end-pos); + real_item= item->real_item(); + if (!read_info.enclosed && (enclosed_length && length == 4 && !memcmp(pos, STRING_WITH_LEN("NULL"))) || (length == 1 && read_info.found_null)) { - if (item->type() == Item::FIELD_ITEM) + + if (real_item->type() == Item::FIELD_ITEM) { - Field *field= ((Item_field *)item)->field; + Field *field= ((Item_field *)real_item)->field; if (field->reset()) { my_error(ER_WARN_NULL_TO_NOTNULL, MYF(0), field->field_name, @@ -740,25 +746,39 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, ER_WARN_NULL_TO_NOTNULL, 1); } } - else + else if (item->type() == Item::STRING_ITEM) + { ((Item_user_var_as_out_param *)item)->set_null_value( read_info.read_charset); + } + else + { + my_error(ER_LOAD_DATA_INVALID_COLUMN, MYF(0), item->full_name()); + DBUG_RETURN(1); + } + continue; } - if (item->type() == Item::FIELD_ITEM) + if (real_item->type() == Item::FIELD_ITEM) { - - Field *field= ((Item_field *)item)->field; + Field *field= ((Item_field *)real_item)->field; field->set_notnull(); read_info.row_end[0]=0; // Safe to change end marker if (field == table->next_number_field) table->auto_increment_field_not_null= TRUE; field->store((char*) pos, length, read_info.read_charset); } - else + else if (item->type() == Item::STRING_ITEM) + { ((Item_user_var_as_out_param *)item)->set_value((char*) pos, length, - read_info.read_charset); + read_info.read_charset); + } + else + { + my_error(ER_LOAD_DATA_INVALID_COLUMN, MYF(0), item->full_name()); + DBUG_RETURN(1); + } } if (read_info.error) break; @@ -774,9 +794,10 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, break; for (; item ; item= it++) { - if (item->type() == Item::FIELD_ITEM) + Item *real_item= item->real_item(); + if (real_item->type() == Item::FIELD_ITEM) { - Field *field= ((Item_field *)item)->field; + Field *field= ((Item_field *)real_item)->field; if (field->reset()) { my_error(ER_WARN_NULL_TO_NOTNULL, MYF(0),field->field_name, @@ -796,9 +817,16 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, ER_WARN_TOO_FEW_RECORDS, ER(ER_WARN_TOO_FEW_RECORDS), thd->row_count); } - else + else if (item->type() == Item::STRING_ITEM) + { ((Item_user_var_as_out_param *)item)->set_null_value( read_info.read_charset); + } + else + { + my_error(ER_LOAD_DATA_INVALID_COLUMN, MYF(0), item->full_name()); + DBUG_RETURN(1); + } } } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index dee3f2b5b22..ccd131e5f90 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2538,10 +2538,10 @@ static void reset_one_shot_variables(THD *thd) TRUE Error */ -bool +int mysql_execute_command(THD *thd) { - bool res= FALSE; + int res= FALSE; bool need_start_waiting= FALSE; // have protection against global read lock int up_result= 0; LEX *lex= thd->lex; diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 33eeff03d0a..ae6764254cd 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1403,7 +1403,7 @@ error: */ static bool select_like_stmt_test(Prepared_statement *stmt, - bool (*specific_prepare)(THD *thd), + int (*specific_prepare)(THD *thd), ulong setup_tables_done_option) { DBUG_ENTER("select_like_stmt_test"); @@ -1441,7 +1441,7 @@ static bool select_like_stmt_test(Prepared_statement *stmt, static bool select_like_stmt_test_with_open_n_lock(Prepared_statement *stmt, TABLE_LIST *tables, - bool (*specific_prepare)(THD *thd), + int (*specific_prepare)(THD *thd), ulong setup_tables_done_option) { DBUG_ENTER("select_like_stmt_test_with_open_n_lock"); @@ -1630,7 +1630,7 @@ error: because mysql_handle_derived uses local tables lists. */ -static bool mysql_insert_select_prepare_tester(THD *thd) +static int mysql_insert_select_prepare_tester(THD *thd) { SELECT_LEX *first_select= &thd->lex->select_lex; TABLE_LIST *second_table= ((TABLE_LIST*)first_select->table_list.first)-> diff --git a/sql/sql_select.cc b/sql/sql_select.cc index d6e1582544e..9492fd5337a 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -568,37 +568,13 @@ JOIN::prepare(Item ***rref_pointer_array, /* Check if there are references to un-aggregated columns when computing aggregate functions with implicit grouping (there is no GROUP BY). - TODO: Add check of calculation of GROUP functions and fields: - SELECT COUNT(*)+table.col1 from table1; */ - if (thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY) + if (thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY && !group_list && + select_lex->full_group_by_flag == (NON_AGG_FIELD_USED | SUM_FUNC_USED)) { - if (!group_list) - { - uint flag=0; - List_iterator_fast<Item> it(fields_list); - Item *item; - while ((item= it++)) - { - if (item->with_sum_func) - flag|=1; - else if (!(flag & 2) && !item->const_during_execution()) - flag|=2; - } - if (having) - { - if (having->with_sum_func) - flag |= 1; - else if (!having->const_during_execution()) - flag |= 2; - } - if (flag == 3) - { - my_message(ER_MIX_OF_GROUP_FUNC_AND_FIELDS, - ER(ER_MIX_OF_GROUP_FUNC_AND_FIELDS), MYF(0)); - DBUG_RETURN(-1); - } - } + my_message(ER_MIX_OF_GROUP_FUNC_AND_FIELDS, + ER(ER_MIX_OF_GROUP_FUNC_AND_FIELDS), MYF(0)); + DBUG_RETURN(-1); } { /* Caclulate the number of groups */ @@ -857,6 +833,7 @@ JOIN::optimize() "Impossible HAVING" : "Impossible WHERE")); zero_result_cause= having_value == Item::COND_FALSE ? "Impossible HAVING" : "Impossible WHERE"; + tables= 0; error= 0; DBUG_RETURN(0); } @@ -2138,11 +2115,12 @@ JOIN::exec() /* With EXPLAIN EXTENDED we have to restore original ref_array for a derived table which is always materialized. - Otherwise we would not be able to print the query correctly. + We also need to do this when we have temp table(s). + Otherwise we would not be able to print the query correctly. */ - if (items0 && - (thd->lex->describe & DESCRIBE_EXTENDED) && - select_lex->linkage == DERIVED_TABLE_TYPE) + if (items0 && (thd->lex->describe & DESCRIBE_EXTENDED) && + (select_lex->linkage == DERIVED_TABLE_TYPE || + exec_tmp_table1 || exec_tmp_table2)) set_items_ref_array(items0); DBUG_VOID_RETURN; @@ -14482,7 +14460,7 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array, ifield->db_name= iref->db_name; } #ifndef DBUG_OFF - if (_db_on_ && !item_field->name) + if (!item_field->name) { char buff[256]; String str(buff,sizeof(buff),&my_charset_bin); @@ -15818,6 +15796,14 @@ void st_select_lex::print(THD *thd, String *str) /* go through join tree */ print_join(thd, str, &top_join_list); } + else if (where) + { + /* + "SELECT 1 FROM DUAL WHERE 2" should not be printed as + "SELECT 1 WHERE 2": the 1st syntax is valid, but the 2nd is not. + */ + str->append(STRING_WITH_LEN(" from DUAL ")); + } // Where Item *cur_where= where; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 1eb6838d98e..1230e8df494 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -4105,9 +4105,11 @@ bool get_schema_tables_result(JOIN *join, { result= 1; join->error= 1; + tab->read_record.file= table_list->table->file; table_list->schema_table_state= executed_place; break; } + tab->read_record.file= table_list->table->file; table_list->schema_table_state= executed_place; } } diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 48bdfd87f9f..accd943a05b 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2118,6 +2118,13 @@ static int prepare_for_repair(THD* thd, TABLE_LIST *table_list, const char **ext= table->file->bas_ext(); MY_STAT stat_info; + if (table->s->frm_version != FRM_VER_TRUE_VARCHAR) + { + error= send_check_errmsg(thd, table_list, "repair", + "Failed reparing incompatible .FRM file"); + goto end; + } + /* Check if this is a table type that stores index and data separately, like ISAM or MyISAM. We assume fixed order of engine file name diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 25a0540e4dd..da5e118b069 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -444,7 +444,9 @@ bool st_select_lex_unit::exec() } /* re-enabling indexes for next subselect iteration */ if (union_distinct && table->file->enable_indexes(HA_KEY_SWITCH_ALL)) + { DBUG_ASSERT(0); + } } for (SELECT_LEX *sl= select_cursor; sl; sl= sl->next_select()) { diff --git a/sql/sql_update.cc b/sql/sql_update.cc index e4965748e24..7c619092df1 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -716,7 +716,7 @@ static table_map get_table_map(List<Item> *items) TRUE Error */ -bool mysql_multi_update_prepare(THD *thd) +int mysql_multi_update_prepare(THD *thd) { LEX *lex= thd->lex; TABLE_LIST *table_list= lex->query_tables; @@ -1440,6 +1440,12 @@ bool multi_update::send_data(List<Item> ¬_used_values) tbl->file->position(tbl->record[0]); memcpy((char*) tmp_table->field[field_num]->ptr, (char*) tbl->file->ref, tbl->file->ref_length); + /* + For outer joins a rowid field may have no NOT_NULL_FLAG, + so we have to reset NULL bit for this field. + (set_notnull() resets NULL bit only if available). + */ + tmp_table->field[field_num]->set_notnull(); field_num++; } while ((tbl= tbl_it++)); diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 3056109e86b..fee71e01c78 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -649,7 +649,11 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views, buff.append(')'); } buff.append(STRING_WITH_LEN(" AS ")); - buff.append(views->source.str, views->source.length); + buff.append(views->query.str, views->query.length); + if (views->with_check == VIEW_CHECK_LOCAL) + buff.append(STRING_WITH_LEN(" WITH LOCAL CHECK OPTION")); + else if (views->with_check == VIEW_CHECK_CASCADED) + buff.append(STRING_WITH_LEN(" WITH CASCADED CHECK OPTION")); Query_log_event qinfo(thd, buff.ptr(), buff.length(), 0, FALSE); mysql_bin_log.write(&qinfo); @@ -926,8 +930,6 @@ loop_out: } DBUG_RETURN(0); err: - view->query.str= NULL; - view->query.length= 0; view->md5.str= NULL; view->md5.length= 0; DBUG_RETURN(error); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 6eae98e14db..02692855c4d 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1187,7 +1187,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); single_multi table_wild_list table_wild_one opt_wild union_clause union_list precision subselect_start opt_and charset - subselect_end select_var_list select_var_list_init help opt_len + subselect_end select_var_list select_var_list_init help opt_field_length field_length opt_extended_describe prepare prepare_src execute deallocate statement sp_suid @@ -3144,45 +3144,38 @@ field_spec: }; type: - int_type opt_len field_options { $$=$1; } + int_type opt_field_length field_options { $$=$1; } | real_type opt_precision field_options { $$=$1; } | FLOAT_SYM float_options field_options { $$=FIELD_TYPE_FLOAT; } | BIT_SYM { Lex->length= (char*) "1"; $$=FIELD_TYPE_BIT; } - | BIT_SYM '(' NUM ')' { Lex->length= $3.str; - $$=FIELD_TYPE_BIT; } + | BIT_SYM field_length { $$=FIELD_TYPE_BIT; } | BOOL_SYM { Lex->length=(char*) "1"; $$=FIELD_TYPE_TINY; } | BOOLEAN_SYM { Lex->length=(char*) "1"; $$=FIELD_TYPE_TINY; } - | char '(' NUM ')' opt_binary { Lex->length=$3.str; - $$=FIELD_TYPE_STRING; } + | char field_length opt_binary { $$=FIELD_TYPE_STRING; } | char opt_binary { Lex->length=(char*) "1"; $$=FIELD_TYPE_STRING; } - | nchar '(' NUM ')' opt_bin_mod { Lex->length=$3.str; - $$=FIELD_TYPE_STRING; + | nchar field_length opt_bin_mod { $$=FIELD_TYPE_STRING; Lex->charset=national_charset_info; } | nchar opt_bin_mod { Lex->length=(char*) "1"; $$=FIELD_TYPE_STRING; Lex->charset=national_charset_info; } - | BINARY '(' NUM ')' { Lex->length=$3.str; - Lex->charset=&my_charset_bin; + | BINARY field_length { Lex->charset=&my_charset_bin; $$=FIELD_TYPE_STRING; } | BINARY { Lex->length= (char*) "1"; Lex->charset=&my_charset_bin; $$=FIELD_TYPE_STRING; } - | varchar '(' NUM ')' opt_binary { Lex->length=$3.str; - $$= MYSQL_TYPE_VARCHAR; } - | nvarchar '(' NUM ')' opt_bin_mod { Lex->length=$3.str; - $$= MYSQL_TYPE_VARCHAR; + | varchar field_length opt_binary { $$= MYSQL_TYPE_VARCHAR; } + | nvarchar field_length opt_bin_mod { $$= MYSQL_TYPE_VARCHAR; Lex->charset=national_charset_info; } - | VARBINARY '(' NUM ')' { Lex->length=$3.str; - Lex->charset=&my_charset_bin; + | VARBINARY field_length { Lex->charset=&my_charset_bin; $$= MYSQL_TYPE_VARCHAR; } - | YEAR_SYM opt_len field_options { $$=FIELD_TYPE_YEAR; } + | YEAR_SYM opt_field_length field_options { $$=FIELD_TYPE_YEAR; } | DATE_SYM { $$=FIELD_TYPE_DATE; } | TIME_SYM { $$=FIELD_TYPE_TIME; } - | TIMESTAMP opt_len + | TIMESTAMP opt_field_length { if (YYTHD->variables.sql_mode & MODE_MAXDB) $$=FIELD_TYPE_DATETIME; @@ -3198,7 +3191,7 @@ type: | DATETIME { $$=FIELD_TYPE_DATETIME; } | TINYBLOB { Lex->charset=&my_charset_bin; $$=FIELD_TYPE_TINY_BLOB; } - | BLOB_SYM opt_len { Lex->charset=&my_charset_bin; + | BLOB_SYM opt_field_length { Lex->charset=&my_charset_bin; $$=FIELD_TYPE_BLOB; } | spatial_type { @@ -3220,7 +3213,7 @@ type: $$=FIELD_TYPE_MEDIUM_BLOB; } | LONG_SYM varchar opt_binary { $$=FIELD_TYPE_MEDIUM_BLOB; } | TINYTEXT opt_binary { $$=FIELD_TYPE_TINY_BLOB; } - | TEXT_SYM opt_len opt_binary { $$=FIELD_TYPE_BLOB; } + | TEXT_SYM opt_field_length opt_binary { $$=FIELD_TYPE_BLOB; } | MEDIUMTEXT opt_binary { $$=FIELD_TYPE_MEDIUM_BLOB; } | LONGTEXT opt_binary { $$=FIELD_TYPE_LONG_BLOB; } | DECIMAL_SYM float_options field_options @@ -3293,7 +3286,7 @@ real_type: float_options: /* empty */ { Lex->dec=Lex->length= (char*)0; } - | '(' NUM ')' { Lex->length=$2.str; Lex->dec= (char*)0; } + | field_length { Lex->dec= (char*)0; } | precision {}; precision: @@ -3316,9 +3309,15 @@ field_option: | UNSIGNED { Lex->type|= UNSIGNED_FLAG;} | ZEROFILL { Lex->type|= UNSIGNED_FLAG | ZEROFILL_FLAG; }; -opt_len: - /* empty */ { Lex->length=(char*) 0; } /* use default length */ - | '(' NUM ')' { Lex->length= $2.str; }; +opt_field_length: + /* empty */ { Lex->length=(char*) NULL; } /* use default length */ + | field_length {}; + +field_length: + '(' LONG_NUM ')' { Lex->length= $2.str; } + | '(' ULONGLONG_NUM ')' { Lex->length= $2.str; } + | '(' DECIMAL_NUM ')' { Lex->length= $2.str; } + | '(' NUM ')' { Lex->length= $2.str; }; opt_precision: /* empty */ {} @@ -5587,9 +5586,9 @@ in_sum_expr: }; cast_type: - BINARY opt_len { $$=ITEM_CAST_CHAR; Lex->charset= &my_charset_bin; Lex->dec= 0; } - | CHAR_SYM opt_len opt_binary { $$=ITEM_CAST_CHAR; Lex->dec= 0; } - | NCHAR_SYM opt_len { $$=ITEM_CAST_CHAR; Lex->charset= national_charset_info; Lex->dec=0; } + BINARY opt_field_length { $$=ITEM_CAST_CHAR; Lex->charset= &my_charset_bin; Lex->dec= 0; } + | CHAR_SYM opt_field_length opt_binary { $$=ITEM_CAST_CHAR; Lex->dec= 0; } + | NCHAR_SYM opt_field_length { $$=ITEM_CAST_CHAR; Lex->charset= national_charset_info; Lex->dec=0; } | SIGNED_SYM { $$=ITEM_CAST_SIGNED_INT; Lex->charset= NULL; Lex->dec=Lex->length= (char*)0; } | SIGNED_SYM INT_SYM { $$=ITEM_CAST_SIGNED_INT; Lex->charset= NULL; Lex->dec=Lex->length= (char*)0; } | UNSIGNED { $$=ITEM_CAST_UNSIGNED_INT; Lex->charset= NULL; Lex->dec=Lex->length= (char*)0; } diff --git a/sql/tztime.cc b/sql/tztime.cc index bedbf921cae..709e3b64752 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -1035,7 +1035,7 @@ public: return lowest possible my_time_t in case of ambiguity or if we provide time corresponding to the time-gap. - You should call init_time() function before using this function. + You should call my_init_time() function before using this function. RETURN VALUE Corresponding my_time_t value or 0 in case of error @@ -2278,7 +2278,7 @@ my_tz_find(const String * name, TABLE_LIST *tz_tables) DBUG_ENTER("my_tz_find"); DBUG_PRINT("enter", ("time zone name='%s'", - name ? ((String *)name)->c_ptr() : "NULL")); + name ? ((String *)name)->c_ptr_safe() : "NULL")); DBUG_ASSERT(!time_zone_tables_exist || tz_tables || current_thd->slave_thread); @@ -2757,7 +2757,7 @@ main(int argc, char **argv) } printf("gmt_sec_to_TIME = localtime for time_t in [1000000000,1100000000) range\n"); - init_time(); + my_init_time(); /* Be careful here! my_system_gmt_sec doesn't fully handle unnormalized diff --git a/sql/unireg.h b/sql/unireg.h index d8301060cc4..1326b22c8c9 100644 --- a/sql/unireg.h +++ b/sql/unireg.h @@ -60,6 +60,7 @@ #define MAX_MBWIDTH 3 /* Max multibyte sequence */ #define MAX_FIELD_CHARLENGTH 255 #define MAX_FIELD_VARCHARLENGTH 65535 +#define MAX_FIELD_BLOBLENGTH UINT_MAX32 /* cf field_blob::get_length() */ #define CONVERT_IF_BIGGER_TO_BLOB 512 /* Used for CREATE ... SELECT */ /* Max column width +1 */ diff --git a/strings/CHARSET_INFO.txt b/strings/CHARSET_INFO.txt index 3fd262c6f12..bb8e40025c7 100644 --- a/strings/CHARSET_INFO.txt +++ b/strings/CHARSET_INFO.txt @@ -3,9 +3,8 @@ CHARSET_INFO ============ A structure containing data for charset+collation pair implementation. -Virtual functions which use this data are collected -into separate structures MY_CHARSET_HANDLER and -MY_COLLATION_HANDLER. +Virtual functions that use this data are collected into separate +structures, MY_CHARSET_HANDLER and MY_COLLATION_HANDLER. typedef struct charset_info_st @@ -56,7 +55,7 @@ character set. Not really used now. Intended to optimize some parts of the code where we need to find the default collation using its non-default counterpart for the given character set. -binary_numner - ID of a charset+collation pair, which consists +binary_number - ID of a charset+collation pair, which consists of the same character set and the binary collation of this character set. Not really used now. @@ -65,15 +64,15 @@ Names csname - name of the character set for this charset+collation pair. name - name of the collation for this charset+collation pair. - comment - a text comment, dysplayed in "Description" column of + comment - a text comment, displayed in "Description" column of SHOW CHARACTER SET output. Conversion tables ----------------- ctype - pointer to array[257] of "type of characters" - bit mask for each chatacter, e.g. if a - character is a digit or a letter or a separator, etc. + bit mask for each character, e.g., whether a + character is a digit, letter, separator, etc. Monty 2004-10-21: If you look at the macros, we use ctype[(char)+1]. @@ -87,17 +86,64 @@ Conversion tables to_upper - pointer to array[256] used in UCASE() sort_order - pointer to array[256] used for strings comparison +In all Asian charsets these arrays are set up as follows: + +- All bytes in the range 0x80..0xFF were marked as letters in the + ctype array. + +- The to_lower and to_upper arrays map only ASCII letters. + UPPER() and LOWER() doesn't really work for multi-byte characters. + Most of the characters in Asian character sets are ideograms + anyway and they don't have case mapping. However, there are + still some characters from European alphabets. + For example: + _ujis 0x8FAAF2 - LATIN CAPITAL LETTER Y WITH ACUTE + _ujis 0x8FABF2 - LATIN SMALL LETTER Y WITH ACUTE + + But they don't map to each other with UPPER and LOWER operations. + +- The sort_order array is filled case insensitively for the + ASCII range 0x00..0x7F, and in "binary" fashion for the multi-byte + range 0x80..0xFF for these collations: + + cp932_japanese_ci, + euckr_korean_ci, + eucjpms_japanese_ci, + gb2312_chinese_ci, + sjis_japanese_ci, + ujis_japanese_ci. + + So multi-byte characters are sorted just according to their codes. + + +- Two collations are still case insensitive for the ASCII characters, + but have special sorting order for multi-byte characters + (something more complex than just according to codes): + + big5_chinese_ci + gbk_chinese_ci + + So handlers for these collations use only the 0x00..0x7F part + of their sort_order arrays, and apply the special functions + for multi-byte characters + +In Unicode character sets we have full support of UPPER/LOWER mapping, +for sorting order, and for character type detection. +"utf8_general_ci" still has the "old-fashioned" arrays +like to_upper, to_lower, sort_order and ctype, but they are +not really used (maybe only in some rare legacy functions). + Unicode conversion data ----------------------- -For 8bit character sets: +For 8-bit character sets: tab_to_uni : array[256] of charset->Unicode translation tab_from_uni: a structure for Unicode->charset translation -Non-8 bit charsets have their own structures per charset -hidden in correspondent ctype-xxx.c file and don't use +Non-8-bit charsets have their own structures per charset +hidden in corresponding ctype-xxx.c file and don't use tab_to_uni and tab_from_uni tables. @@ -106,9 +152,9 @@ Parser maps state_map[] ident_map[] - These maps are to quickly identify if a character is -an identificator part, a digit, a special character, -or a part of other SQL language lexical item. +These maps are used to quickly identify whether a character is an +identifier part, a digit, a special character, or a part of another +SQL language lexical item. Probably can be combined with ctype array in the future. But for some reasons these two arrays are used in the parser, @@ -116,32 +162,32 @@ while a separate ctype[] array is used in the other part of the code, like fulltext, etc. -Misc fields ------------ +Miscellaneous fields +-------------------- - strxfrm_multiply - how many times a sort key (i.e. a string - which can be passed into memcmp() for comparison) + strxfrm_multiply - how many times a sort key (that is, a string + that can be passed into memcmp() for comparison) can be longer than the original string. Usually it is 1. For some complex - collations it can be bigger. For example + collations it can be bigger. For example, in latin1_german2_ci, a sort key is up to - twice longer than the original string. + two times longer than the original string. e.g. Letter 'A' with two dots above is substituted with 'AE'. - mbminlen - mininum multibyte sequence length. - Now always 1 except ucs2. For ucs2 + mbminlen - minimum multi-byte sequence length. + Now always 1 except for ucs2. For ucs2, it is 2. - mbmaxlen - maximum multibyte sequence length. - 1 for 8bit charsets. Can be also 2 or 3. + mbmaxlen - maximum multi-byte sequence length. + 1 for 8-bit charsets. Can be also 2 or 3. max_sort_char - for LIKE range - in case of 8bit character sets - native code + in case of 8-bit character sets - native code of maximum character (max_str pad byte); in case of UTF8 and UCS2 - Unicode code of the maximum possible character (usually U+FFFF). This code is - converted to multibyte representation (usually 0xEFBFBF) + converted to multi-byte representation (usually 0xEFBFBF) and then used as a pad sequence for max_str. - in case of other multibyte character sets - + in case of other multi-byte character sets - max_str pad byte (usually 0xFF). MY_CHARSET_HANDLER @@ -151,10 +197,10 @@ MY_CHARSET_HANDLER is a collection of character-set related routines. Defined in m_ctype.h. Have the following set of functions: -Multibyte routines +Multi-byte routines ------------------ -ismbchar() - detects if the given string is a multibyte sequence -mbcharlen() - returns length of multibyte sequence starting with +ismbchar() - detects whether the given string is a multi-byte sequence +mbcharlen() - returns length of multi-byte sequence starting with the given character numchars() - returns number of characters in the given string, e.g. in SQL function CHAR_LENGTH(). @@ -163,29 +209,29 @@ charpos() - calculates the offset of the given position in the string. INSERT() well_formed_length() - - finds the length of correctly formed multybyte beginning. + - finds the length of correctly formed multi-byte beginning. Used in INSERTs to cut a beginning of the given string which is a) "well formed" according to the given character set. - b) can fit into the given data type + b) can fit into the given data type Terminates the string in the good position, taking in account - multibyte character boundaries. + multi-byte character boundaries. -lengthsp() - returns the length of the given string without traling spaces. +lengthsp() - returns the length of the given string without trailing spaces. Unicode conversion routines --------------------------- -mb_wc - converts the left multibyte sequence into it Unicode code. -mc_mb - converts the given Unicode code into multibyte sequence. +mb_wc - converts the left multi-byte sequence into its Unicode code. +mc_mb - converts the given Unicode code into multi-byte sequence. -Case and sort convertion +Case and sort conversion ------------------------ -caseup_str - converts the given 0-terminated string into the upper case -casedn_str - converts the given 0-terminated string into the lower case -caseup - converts the given string into the lower case using length -casedn - converts the given string into the lower case using length +caseup_str - converts the given 0-terminated string to uppercase +casedn_str - converts the given 0-terminated string to lowercase +caseup - converts the given string to lowercase using length +casedn - converts the given string to lowercase using length Number-to-string conversion routines ------------------------------------ @@ -193,7 +239,7 @@ snprintf() long10_to_str() longlong10_to_str() -The names are pretty self-descripting. +The names are pretty self-describing. String padding routines ----------------------- @@ -201,7 +247,7 @@ fill() - writes the given Unicode value into the given string with the given length. Used to pad the string, usually with space character, according to the given charset. -String-to-numner conversion routines +String-to-number conversion routines ------------------------------------ strntol() strntoul() @@ -209,10 +255,10 @@ strntoll() strntoull() strntod() -These functions are almost for the same thing with their -STDLIB counterparts, but also: +These functions are almost the same as their STDLIB counterparts, +but also: - accept length instead of 0-terminator - - and are character set dependant + - are character set dependent Simple scanner routines ----------------------- @@ -230,9 +276,9 @@ strnxfrm() - makes a sort key suitable for memcmp() corresponding like_range() - creates a LIKE range, for optimizer wildcmp() - wildcard comparison, for LIKE strcasecmp() - 0-terminated string comparison -instr() - finds the first substring appearence in the string -hash_sort() - calculates hash value taking in account +instr() - finds the first substring appearance in the string +hash_sort() - calculates hash value taking into account the collation rules, e.g. case-insensitivity, accent sensitivity, etc. -
\ No newline at end of file + diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c index 44b9951657d..c73247db404 100644 --- a/strings/ctype-big5.c +++ b/strings/ctype-big5.c @@ -307,15 +307,17 @@ static int my_strnxfrm_big5(CHARSET_INFO *cs __attribute__((unused)), { uint16 e; uint dstlen= len; + uchar *dest_end= dest + dstlen; len = srclen; - while (len--) + while (len-- && dest < dest_end) { if ((len > 0) && isbig5code(*src, *(src+1))) { e = big5strokexfrm((uint16) big5code(*src, *(src+1))); *dest++ = big5head(e); - *dest++ = big5tail(e); + if (dest < dest_end) + *dest++ = big5tail(e); src +=2; len--; } else diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c index 8ac7d62c9da..d0ba33aa3cc 100644 --- a/strings/ctype-gbk.c +++ b/strings/ctype-gbk.c @@ -2668,15 +2668,17 @@ static int my_strnxfrm_gbk(CHARSET_INFO *cs __attribute__((unused)), { uint16 e; uint dstlen= len; + uchar *dest_end= dest + dstlen; len = srclen; - while (len--) + while (len-- && dest < dest_end) { if ((len > 0) && isgbkcode(*src, *(src+1))) { e = gbksortorder((uint16) gbkcode(*src, *(src+1))); *dest++ = gbkhead(e); - *dest++ = gbktail(e); + if (dest < dest_end) + *dest++ = gbktail(e); src+=2; len--; } else diff --git a/support-files/my-huge.cnf.sh b/support-files/my-huge.cnf.sh index 5dc3e5a1900..e4747ac4564 100644 --- a/support-files/my-huge.cnf.sh +++ b/support-files/my-huge.cnf.sh @@ -46,6 +46,9 @@ thread_concurrency = 8 # #skip-networking +# Disable Federated by default +skip-federated + # Replication Master Server (default) # binary logging is required for replication log-bin=mysql-bin diff --git a/support-files/my-innodb-heavy-4G.cnf.sh b/support-files/my-innodb-heavy-4G.cnf.sh index 77c6cea56d5..cda11d661bc 100644 --- a/support-files/my-innodb-heavy-4G.cnf.sh +++ b/support-files/my-innodb-heavy-4G.cnf.sh @@ -357,6 +357,9 @@ myisam_repair_threads = 1 myisam_recover +# Disable Federated by default +skip-federated + # *** BDB Specific options *** # Use this option if you run a MySQL server with BDB support enabled but diff --git a/support-files/my-large.cnf.sh b/support-files/my-large.cnf.sh index 4dc3f929c48..981b13731e4 100644 --- a/support-files/my-large.cnf.sh +++ b/support-files/my-large.cnf.sh @@ -46,6 +46,9 @@ thread_concurrency = 8 # #skip-networking +# Disable Federated by default +skip-federated + # Replication Master Server (default) # binary logging is required for replication log-bin=mysql-bin diff --git a/support-files/my-medium.cnf.sh b/support-files/my-medium.cnf.sh index 99b6e823f39..c3135ea2c2b 100644 --- a/support-files/my-medium.cnf.sh +++ b/support-files/my-medium.cnf.sh @@ -44,6 +44,9 @@ myisam_sort_buffer_size = 8M # #skip-networking +# Disable Federated by default +skip-federated + # Replication Master Server (default) # binary logging is required for replication log-bin=mysql-bin diff --git a/support-files/my-small.cnf.sh b/support-files/my-small.cnf.sh index 288df893b4c..cf2ebed463c 100644 --- a/support-files/my-small.cnf.sh +++ b/support-files/my-small.cnf.sh @@ -48,6 +48,9 @@ server-id = 1 # Uncomment the following if you want to log updates #log-bin=mysql-bin +# Disable Federated by default +skip-federated + # Uncomment the following if you are NOT using BDB tables #skip-bdb diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index e3b76e79f6e..5e1c2afe84a 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -11675,7 +11675,7 @@ static void test_bug5194() MAX_PARAM_COUNT * CHARS_PER_PARAM + 1); param_str= (char*) malloc(COLUMN_COUNT * CHARS_PER_PARAM); - if (bind == 0 || query == 0 || param_str == 0) + if (my_bind == 0 || query == 0 || param_str == 0) { fprintf(stderr, "Can't allocate enough memory for query structs\n"); if (my_bind) @@ -16596,7 +16596,6 @@ int main(int argc, char **argv) { struct my_tests_st *fptr; - DEBUGGER_OFF; MY_INIT(argv[0]); load_defaults("my", client_test_load_default_groups, &argc, &argv); |