mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
second merge from main, with adaptions
This commit is contained in:
commit
31f9d5fd16
145 changed files with 6274 additions and 1070 deletions
|
@ -70,6 +70,11 @@ check_cpu () {
|
|||
Alpha*EV6*)
|
||||
cpu_arg="ev6";
|
||||
;;
|
||||
#Core 2 Duo
|
||||
*Intel*Core\(TM\)2*)
|
||||
cpu_arg="nocona"
|
||||
core2="yes"
|
||||
;;
|
||||
# Intel ia32
|
||||
*Intel*Core*|*X[eE][oO][nN]*)
|
||||
# a Xeon is just another pentium4 ...
|
||||
|
@ -134,10 +139,6 @@ check_cpu () {
|
|||
*i386*)
|
||||
cpu_arg="i386"
|
||||
;;
|
||||
#Core 2 Duo
|
||||
*Intel*Core\(TM\)2*)
|
||||
cpu_arg="nocona"
|
||||
;;
|
||||
# Intel ia64
|
||||
*Itanium*)
|
||||
cpu_arg="itanium"
|
||||
|
|
|
@ -86,7 +86,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#undef bcmp // Fix problem with new readline
|
||||
#if defined( __WIN__)
|
||||
#if defined(__WIN__)
|
||||
#include <conio.h>
|
||||
#elif !defined(__NETWARE__)
|
||||
#include <readline/readline.h>
|
||||
|
@ -106,7 +106,7 @@ extern "C" {
|
|||
#define cmp_database(cs,A,B) strcmp((A),(B))
|
||||
#endif
|
||||
|
||||
#if !defined( __WIN__) && !defined(__NETWARE__) && !defined(THREAD)
|
||||
#if !defined(__WIN__) && !defined(__NETWARE__) && !defined(THREAD)
|
||||
#define USE_POPEN
|
||||
#endif
|
||||
|
||||
|
@ -1862,7 +1862,7 @@ static int read_and_execute(bool interactive)
|
|||
if (opt_outfile && glob_buffer.is_empty())
|
||||
fflush(OUTFILE);
|
||||
|
||||
#if defined( __WIN__) || defined(__NETWARE__)
|
||||
#if defined(__WIN__) || defined(__NETWARE__)
|
||||
tee_fputs(prompt, stdout);
|
||||
#if defined(__NETWARE__)
|
||||
line=fgets(linebuffer, sizeof(linebuffer)-1, stdin);
|
||||
|
@ -1873,7 +1873,7 @@ static int read_and_execute(bool interactive)
|
|||
if (p != NULL)
|
||||
*p = '\0';
|
||||
}
|
||||
#else defined(__WIN__)
|
||||
#else
|
||||
if (!tmpbuf.is_alloced())
|
||||
tmpbuf.alloc(65535);
|
||||
tmpbuf.length(0);
|
||||
|
@ -1899,7 +1899,7 @@ static int read_and_execute(bool interactive)
|
|||
if (opt_outfile)
|
||||
fputs(prompt, OUTFILE);
|
||||
line= readline(prompt);
|
||||
#endif /* defined( __WIN__) || defined(__NETWARE__) */
|
||||
#endif /* defined(__WIN__) || defined(__NETWARE__) */
|
||||
|
||||
/*
|
||||
When Ctrl+d or Ctrl+z is pressed, the line may be NULL on some OS
|
||||
|
@ -1947,10 +1947,10 @@ static int read_and_execute(bool interactive)
|
|||
}
|
||||
}
|
||||
|
||||
#if defined( __WIN__) || defined(__NETWARE__)
|
||||
#if defined(__WIN__) || defined(__NETWARE__)
|
||||
buffer.free();
|
||||
#endif
|
||||
#if defined( __WIN__)
|
||||
#if defined(__WIN__)
|
||||
tmpbuf.free();
|
||||
#endif
|
||||
|
||||
|
@ -3819,7 +3819,8 @@ com_edit(String *buffer,char *line __attribute__((unused)))
|
|||
!(editor = (char *)getenv("VISUAL")))
|
||||
editor = "vi";
|
||||
strxmov(buff,editor," ",filename,NullS);
|
||||
(void) system(buff);
|
||||
if(system(buff) == -1)
|
||||
goto err;
|
||||
|
||||
MY_STAT stat_arg;
|
||||
if (!my_stat(filename,&stat_arg,MYF(MY_WME)))
|
||||
|
@ -4602,7 +4603,7 @@ void tee_putc(int c, FILE *file)
|
|||
putc(c, OUTFILE);
|
||||
}
|
||||
|
||||
#if defined( __WIN__) || defined(__NETWARE__)
|
||||
#if defined(__WIN__) || defined(__NETWARE__)
|
||||
#include <time.h>
|
||||
#else
|
||||
#include <sys/times.h>
|
||||
|
@ -4614,7 +4615,7 @@ void tee_putc(int c, FILE *file)
|
|||
|
||||
static ulong start_timer(void)
|
||||
{
|
||||
#if defined( __WIN__) || defined(__NETWARE__)
|
||||
#if defined(__WIN__) || defined(__NETWARE__)
|
||||
return clock();
|
||||
#else
|
||||
struct tms tms_tmp;
|
||||
|
|
|
@ -552,6 +552,7 @@ static int upgrade_already_done(void)
|
|||
FILE *in;
|
||||
char upgrade_info_file[FN_REFLEN]= {0};
|
||||
char buf[sizeof(MYSQL_SERVER_VERSION)+1];
|
||||
char *res;
|
||||
|
||||
if (get_upgrade_info_file_name(upgrade_info_file))
|
||||
return 0; /* Could not get filename => not sure */
|
||||
|
@ -564,7 +565,7 @@ static int upgrade_already_done(void)
|
|||
will be detected by the strncmp
|
||||
*/
|
||||
bzero(buf, sizeof(buf));
|
||||
fgets(buf, sizeof(buf), in);
|
||||
res= fgets(buf, sizeof(buf), in);
|
||||
|
||||
my_fclose(in, MYF(0));
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#endif
|
||||
#include <sys/stat.h>
|
||||
#include <mysql.h>
|
||||
#include <sql_common.h>
|
||||
|
||||
#define ADMIN_VERSION "8.42"
|
||||
#define MAX_MYSQL_VAR 512
|
||||
|
@ -353,6 +354,11 @@ int main(int argc,char *argv[])
|
|||
|
||||
if (sql_connect(&mysql, option_wait))
|
||||
{
|
||||
/*
|
||||
We couldn't get an initial connection and will definitely exit.
|
||||
The following just determines the exit-code we'll give.
|
||||
*/
|
||||
|
||||
unsigned int err= mysql_errno(&mysql);
|
||||
if (err >= CR_MIN_ERROR && err <= CR_MAX_ERROR)
|
||||
error= 1;
|
||||
|
@ -371,41 +377,79 @@ int main(int argc,char *argv[])
|
|||
}
|
||||
else
|
||||
{
|
||||
while (!interrupted)
|
||||
/*
|
||||
--count=0 aborts right here. Otherwise iff --sleep=t ("interval")
|
||||
is given a t!=0, we get an endless loop, or n iterations if --count=n
|
||||
was given an n!=0. If --sleep wasn't given, we get one iteration.
|
||||
|
||||
To wit, --wait loops the connection-attempts, while --sleep loops
|
||||
the command execution (endlessly if no --count is given).
|
||||
*/
|
||||
|
||||
while (!interrupted && (!opt_count_iterations || nr_iterations))
|
||||
{
|
||||
new_line = 0;
|
||||
if ((error=execute_commands(&mysql,argc,commands)))
|
||||
|
||||
if ((error= execute_commands(&mysql,argc,commands)))
|
||||
{
|
||||
/*
|
||||
Unknown/malformed command always aborts and can't be --forced.
|
||||
If the user got confused about the syntax, proceeding would be
|
||||
dangerous ...
|
||||
*/
|
||||
if (error > 0)
|
||||
break; /* Wrong command error */
|
||||
if (!option_force)
|
||||
break;
|
||||
|
||||
/*
|
||||
Command was well-formed, but failed on the server. Might succeed
|
||||
on retry (if conditions on server change etc.), but needs --force
|
||||
to retry.
|
||||
*/
|
||||
if (!option_force)
|
||||
break;
|
||||
} /* if((error= ... */
|
||||
|
||||
if (interval) /* --sleep=interval given */
|
||||
{
|
||||
/*
|
||||
If connection was dropped (unintentionally, or due to SHUTDOWN),
|
||||
re-establish it if --wait ("retry-connect") was given and user
|
||||
didn't signal for us to die. Otherwise, signal failure.
|
||||
*/
|
||||
|
||||
if (mysql.net.vio == 0)
|
||||
{
|
||||
if (option_wait && !interrupted)
|
||||
{
|
||||
mysql_close(&mysql);
|
||||
if (!sql_connect(&mysql, option_wait))
|
||||
{
|
||||
sleep(1); /* Don't retry too rapidly */
|
||||
continue; /* Retry */
|
||||
}
|
||||
sleep(1);
|
||||
sql_connect(&mysql, option_wait);
|
||||
/*
|
||||
continue normally and decrease counters so that
|
||||
"mysqladmin --count=1 --wait=1 shutdown"
|
||||
cannot loop endlessly.
|
||||
*/
|
||||
}
|
||||
error=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (interval)
|
||||
{
|
||||
if (opt_count_iterations && --nr_iterations == 0)
|
||||
break;
|
||||
else
|
||||
{
|
||||
/*
|
||||
connexion broke, and we have no order to re-establish it. fail.
|
||||
*/
|
||||
if (!option_force)
|
||||
error= 1;
|
||||
break;
|
||||
}
|
||||
} /* lost connection */
|
||||
|
||||
sleep(interval);
|
||||
if (new_line)
|
||||
puts("");
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
mysql_close(&mysql);
|
||||
}
|
||||
break; /* no --sleep, done looping */
|
||||
} /* command-loop */
|
||||
} /* got connection */
|
||||
|
||||
mysql_close(&mysql);
|
||||
my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
|
||||
my_free(user,MYF(MY_ALLOW_ZERO_PTR));
|
||||
#ifdef HAVE_SMEM
|
||||
|
@ -423,6 +467,17 @@ sig_handler endprog(int signal_number __attribute__((unused)))
|
|||
interrupted=1;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief connect to server, optionally waiting for same to come up
|
||||
|
||||
@param mysql connection struct
|
||||
@param wait wait for server to come up?
|
||||
(0: no, ~0: forever, n: cycles)
|
||||
|
||||
@return Operation result
|
||||
@retval 0 success
|
||||
@retval 1 failure
|
||||
*/
|
||||
|
||||
static my_bool sql_connect(MYSQL *mysql, uint wait)
|
||||
{
|
||||
|
@ -431,7 +486,7 @@ static my_bool sql_connect(MYSQL *mysql, uint wait)
|
|||
for (;;)
|
||||
{
|
||||
if (mysql_real_connect(mysql,host,user,opt_password,NullS,tcp_port,
|
||||
unix_port, 0))
|
||||
unix_port, CLIENT_REMEMBER_OPTIONS))
|
||||
{
|
||||
mysql->reconnect= 1;
|
||||
if (info)
|
||||
|
@ -442,9 +497,9 @@ static my_bool sql_connect(MYSQL *mysql, uint wait)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (!wait)
|
||||
if (!wait) // was or reached 0, fail
|
||||
{
|
||||
if (!option_silent)
|
||||
if (!option_silent) // print diagnostics
|
||||
{
|
||||
if (!host)
|
||||
host= (char*) LOCAL_HOST;
|
||||
|
@ -468,11 +523,18 @@ static my_bool sql_connect(MYSQL *mysql, uint wait)
|
|||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (wait != (uint) ~0)
|
||||
wait--; /* One less retry */
|
||||
wait--; /* count down, one less retry */
|
||||
|
||||
if ((mysql_errno(mysql) != CR_CONN_HOST_ERROR) &&
|
||||
(mysql_errno(mysql) != CR_CONNECTION_ERROR))
|
||||
{
|
||||
/*
|
||||
Error is worse than "server doesn't answer (yet?)";
|
||||
fail even if we still have "wait-coins" unless --force
|
||||
was also given.
|
||||
*/
|
||||
fprintf(stderr,"Got error: %s\n", mysql_error(mysql));
|
||||
if (!option_force)
|
||||
return 1;
|
||||
|
@ -496,11 +558,18 @@ static my_bool sql_connect(MYSQL *mysql, uint wait)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
Execute a command.
|
||||
Return 0 on ok
|
||||
-1 on retryable error
|
||||
1 on fatal error
|
||||
/**
|
||||
@brief Execute all commands
|
||||
|
||||
@details We try to execute all commands we were given, in the order
|
||||
given, but return with non-zero as soon as we encounter trouble.
|
||||
By that token, individual commands can be considered a conjunction
|
||||
with boolean short-cut.
|
||||
|
||||
@return success?
|
||||
@retval 0 Yes! ALL commands worked!
|
||||
@retval 1 No, one failed and will never work (malformed): fatal error!
|
||||
@retval -1 No, one failed on the server, may work next time!
|
||||
*/
|
||||
|
||||
static int execute_commands(MYSQL *mysql,int argc, char **argv)
|
||||
|
@ -570,7 +639,6 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
|
|||
mysql_error(mysql));
|
||||
return -1;
|
||||
}
|
||||
mysql_close(mysql); /* Close connection to avoid error messages */
|
||||
argc=1; /* force SHUTDOWN to be the last command */
|
||||
if (got_pidfile)
|
||||
{
|
||||
|
@ -1036,14 +1104,16 @@ static void usage(void)
|
|||
static int drop_db(MYSQL *mysql, const char *db)
|
||||
{
|
||||
char name_buff[FN_REFLEN+20], buf[10];
|
||||
char *input;
|
||||
|
||||
if (!option_force)
|
||||
{
|
||||
puts("Dropping the database is potentially a very bad thing to do.");
|
||||
puts("Any data stored in the database will be destroyed.\n");
|
||||
printf("Do you really want to drop the '%s' database [y/N] ",db);
|
||||
fflush(stdout);
|
||||
VOID(fgets(buf,sizeof(buf)-1,stdin));
|
||||
if ((*buf != 'y') && (*buf != 'Y'))
|
||||
input= fgets(buf, sizeof(buf)-1, stdin);
|
||||
if (!input || ((*input != 'y') && (*input != 'Y')))
|
||||
{
|
||||
puts("\nOK, aborting database drop!");
|
||||
return -1;
|
||||
|
|
|
@ -5008,7 +5008,7 @@ int main(int argc, char **argv)
|
|||
exit_code= get_options(&argc, &argv);
|
||||
if (exit_code)
|
||||
{
|
||||
free_resources(0);
|
||||
free_resources();
|
||||
exit(exit_code);
|
||||
}
|
||||
|
||||
|
@ -5016,14 +5016,14 @@ int main(int argc, char **argv)
|
|||
{
|
||||
if(!(stderror_file= freopen(log_error_file, "a+", stderr)))
|
||||
{
|
||||
free_resources(0);
|
||||
free_resources();
|
||||
exit(EX_MYSQLERR);
|
||||
}
|
||||
}
|
||||
|
||||
if (connect_to_db(current_host, current_user, opt_password))
|
||||
{
|
||||
free_resources(0);
|
||||
free_resources();
|
||||
exit(EX_MYSQLERR);
|
||||
}
|
||||
if (!path)
|
||||
|
|
|
@ -432,10 +432,12 @@ DYNAMIC_STRING ds_res;
|
|||
|
||||
char builtin_echo[FN_REFLEN];
|
||||
|
||||
static void cleanup_and_exit(int exit_code) __attribute__((noreturn));
|
||||
|
||||
void die(const char *fmt, ...)
|
||||
ATTRIBUTE_FORMAT(printf, 1, 2);
|
||||
ATTRIBUTE_FORMAT(printf, 1, 2) __attribute__((noreturn));
|
||||
void abort_not_supported_test(const char *fmt, ...)
|
||||
ATTRIBUTE_FORMAT(printf, 1, 2);
|
||||
ATTRIBUTE_FORMAT(printf, 1, 2) __attribute__((noreturn));
|
||||
void verbose_msg(const char *fmt, ...)
|
||||
ATTRIBUTE_FORMAT(printf, 1, 2);
|
||||
void log_msg(const char *fmt, ...)
|
||||
|
@ -3722,10 +3724,9 @@ void do_wait_for_slave_to_stop(struct st_command *c __attribute__((unused)))
|
|||
MYSQL* mysql = &cur_con->mysql;
|
||||
for (;;)
|
||||
{
|
||||
MYSQL_RES *res;
|
||||
MYSQL_RES *UNINIT_VAR(res);
|
||||
MYSQL_ROW row;
|
||||
int done;
|
||||
LINT_INIT(res);
|
||||
|
||||
if (mysql_query(mysql,"show status like 'Slave_running'") ||
|
||||
!(res=mysql_store_result(mysql)))
|
||||
|
@ -5257,13 +5258,12 @@ my_bool end_of_query(int c)
|
|||
|
||||
int read_line(char *buf, int size)
|
||||
{
|
||||
char c, last_quote;
|
||||
char c, UNINIT_VAR(last_quote);
|
||||
char *p= buf, *buf_end= buf + size - 1;
|
||||
int skip_char= 0;
|
||||
enum {R_NORMAL, R_Q, R_SLASH_IN_Q,
|
||||
R_COMMENT, R_LINE_START} state= R_LINE_START;
|
||||
DBUG_ENTER("read_line");
|
||||
LINT_INIT(last_quote);
|
||||
|
||||
start_lineno= cur_file->lineno;
|
||||
DBUG_PRINT("info", ("Starting to read at lineno: %d", start_lineno));
|
||||
|
@ -6495,8 +6495,7 @@ void run_query_normal(struct st_connection *cn, struct st_command *command,
|
|||
|
||||
if (!disable_result_log)
|
||||
{
|
||||
ulonglong affected_rows; /* Ok to be undef if 'disable_info' is set */
|
||||
LINT_INIT(affected_rows);
|
||||
ulonglong UNINIT_VAR(affected_rows); /* Ok to be undef if 'disable_info' is set */
|
||||
|
||||
if (res)
|
||||
{
|
||||
|
|
|
@ -339,9 +339,7 @@ rl_generic_bind (type, keyseq, data, map)
|
|||
char *keys;
|
||||
int keys_len;
|
||||
register int i;
|
||||
KEYMAP_ENTRY k;
|
||||
|
||||
k.function = 0;
|
||||
KEYMAP_ENTRY k= { 0, NULL };
|
||||
|
||||
/* If no keys to bind to, exit right away. */
|
||||
if (keyseq == 0 || *keyseq == 0)
|
||||
|
@ -776,7 +774,7 @@ _rl_read_file (filename, sizep)
|
|||
file_size = (size_t)finfo.st_size;
|
||||
|
||||
/* check for overflow on very large files */
|
||||
if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) ||
|
||||
if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) ||
|
||||
file_size + 1 < file_size)
|
||||
{
|
||||
if (file >= 0)
|
||||
|
|
|
@ -186,7 +186,7 @@ read_history_range (filename, from, to)
|
|||
file_size = (size_t)finfo.st_size;
|
||||
|
||||
/* check for overflow on very large files */
|
||||
if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) ||
|
||||
if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) ||
|
||||
file_size + 1 < file_size)
|
||||
{
|
||||
errno = overflow_errno;
|
||||
|
@ -311,6 +311,7 @@ history_truncate_file (fname, lines)
|
|||
int file, chars_read, rv;
|
||||
struct stat finfo;
|
||||
size_t file_size;
|
||||
size_t bytes_written;
|
||||
|
||||
buffer = (char *)NULL;
|
||||
filename = history_filename (fname);
|
||||
|
@ -340,7 +341,7 @@ history_truncate_file (fname, lines)
|
|||
file_size = (size_t)finfo.st_size;
|
||||
|
||||
/* check for overflow on very large files */
|
||||
if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) ||
|
||||
if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) ||
|
||||
file_size + 1 < file_size)
|
||||
{
|
||||
close (file);
|
||||
|
@ -400,7 +401,7 @@ if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) ||
|
|||
truncate to. */
|
||||
if (bp > buffer && ((file = open (filename, O_WRONLY|O_TRUNC|O_BINARY, 0600)) != -1))
|
||||
{
|
||||
write (file, bp, chars_read - (bp - buffer));
|
||||
bytes_written= write (file, bp, chars_read - (bp - buffer));
|
||||
|
||||
#if defined (__BEOS__)
|
||||
/* BeOS ignores O_TRUNC. */
|
||||
|
|
|
@ -137,7 +137,8 @@ UNDO_LIST *
|
|||
_rl_copy_undo_list (head)
|
||||
UNDO_LIST *head;
|
||||
{
|
||||
UNDO_LIST *list, *new, *roving, *c;
|
||||
UNDO_LIST *list, *new, *c;
|
||||
UNDO_LIST *roving= NULL;
|
||||
|
||||
list = head;
|
||||
new = 0;
|
||||
|
|
|
@ -564,6 +564,25 @@ int __void__;
|
|||
#define PURIFY_OR_LINT_INIT(var)
|
||||
#endif
|
||||
|
||||
/*
|
||||
Suppress uninitialized variable warning without generating code.
|
||||
|
||||
The _cplusplus is a temporary workaround for C++ code pending a fix
|
||||
for a g++ bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772).
|
||||
*/
|
||||
#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || defined(__cplusplus) || \
|
||||
!defined(__GNUC__)
|
||||
#define UNINIT_VAR(x) x= 0
|
||||
#else
|
||||
#define UNINIT_VAR(x) x= x
|
||||
#endif
|
||||
|
||||
/* Define some useful general macros */
|
||||
#if !defined(max)
|
||||
#define max(a, b) ((a) > (b) ? (a) : (b))
|
||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_UINT)
|
||||
#undef HAVE_UINT
|
||||
#define HAVE_UINT
|
||||
|
|
|
@ -1635,8 +1635,7 @@ myodbc_remove_escape(MYSQL *mysql,char *name)
|
|||
char *to;
|
||||
#ifdef USE_MB
|
||||
my_bool use_mb_flag=use_mb(mysql->charset);
|
||||
char *end;
|
||||
LINT_INIT(end);
|
||||
char *UNINIT_VAR(end);
|
||||
if (use_mb_flag)
|
||||
for (end=name; *end ; end++) ;
|
||||
#endif
|
||||
|
|
|
@ -3,12 +3,6 @@ main.plugin_load @solaris # Bug#42144
|
|||
binlog.binlog_tmp_table* # Bug#45578: Test binlog_tmp_table fails ramdonly on PB2: Unknown table 't2'
|
||||
main.ctype_gbk_binlog @solaris # Bug#46010: main.ctype_gbk_binlog fails sporadically : Table 't2' already exists
|
||||
rpl.rpl_row_create_table* # Bug#45576: rpl_row_create_table fails on PB2
|
||||
rpl.rpl_extraColmaster_myisam* @windows # Bug#46013: rpl_extraColmaster_myisam fails on pb2
|
||||
rpl.rpl_stm_reset_slave* @windows # Bug#46014: rpl_stm_reset_slave crashes the server sporadically in pb2
|
||||
rpl.rpl_extraCol_myisam* # Bug#40796
|
||||
rpl.rpl_extraColmaster_innodb* # Bug#40796
|
||||
rpl.rpl_extraCol_innodb* # Bug#40796
|
||||
rpl_ndb.rpl_ndb_log # Bug#38998
|
||||
rpl.rpl_innodb_bug28430* @solaris # Bug#46029
|
||||
rpl.rpl_row_basic_3innodb* # Bug#45243
|
||||
rpl.rpl_truncate_3innodb* @windows # Bug#46030
|
||||
rpl.rpl_get_master_version_and_clock* # Bug#46931 2009-08-26 alik rpl.rpl_get_master_version_and_clock fails on hpux11.31
|
||||
|
|
710
mysql-test/extra/rpl_tests/rpl_mixing_engines.test
Normal file
710
mysql-test/extra/rpl_tests/rpl_mixing_engines.test
Normal file
|
@ -0,0 +1,710 @@
|
|||
###################################################################################
|
||||
# This test checks if transactions that mixes transactional and non-transactional
|
||||
# tables are correctly handled in statement mode. In an nutshell, we have what
|
||||
# follows:
|
||||
#
|
||||
# 1) "B T T C" generates in binlog the "B T T C" entries.
|
||||
#
|
||||
# 2) "B T T R" generates in binlog an "empty" entry.
|
||||
#
|
||||
# 3) "B T N C" generates in binlog the "B T N C" entries.
|
||||
#
|
||||
# 4) "B T N R" generates in binlog the "B T N R" entries.
|
||||
#
|
||||
# 5) "T" generates in binlog the "B T C" entry.
|
||||
#
|
||||
# 6) "N" generates in binlog the "N" entry.
|
||||
#
|
||||
# 7) "M" generates in binglog the "B M C" entries.
|
||||
#
|
||||
# 8) "B N N T C" generates in binglog the "N N B T C" entries.
|
||||
#
|
||||
# 9) "B N N T R" generates in binlog the "N N B T R" entries.
|
||||
#
|
||||
# 10) "B N N C" generates in binglog the "N N" entries.
|
||||
#
|
||||
# 11) "B N N R" generates in binlog the "N N" entries.
|
||||
#
|
||||
# 12) "B M T C" generates in the binlog the "B M T C" entries.
|
||||
#
|
||||
# 13) "B M T R" generates in the binlog the "B M T R" entries.
|
||||
###################################################################################
|
||||
|
||||
--echo ###################################################################################
|
||||
--echo # CONFIGURATION
|
||||
--echo ###################################################################################
|
||||
connection master;
|
||||
|
||||
SET SQL_LOG_BIN=0;
|
||||
CREATE TABLE nt_1 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
|
||||
CREATE TABLE nt_2 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
|
||||
CREATE TABLE nt_3 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
|
||||
CREATE TABLE nt_4 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
|
||||
CREATE TABLE tt_1 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
|
||||
CREATE TABLE tt_2 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
|
||||
CREATE TABLE tt_3 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
|
||||
CREATE TABLE tt_4 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
|
||||
SET SQL_LOG_BIN=1;
|
||||
|
||||
connection slave;
|
||||
|
||||
SET SQL_LOG_BIN=0;
|
||||
CREATE TABLE nt_1 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
|
||||
CREATE TABLE nt_2 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
|
||||
CREATE TABLE nt_3 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
|
||||
CREATE TABLE nt_4 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
|
||||
CREATE TABLE tt_1 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
|
||||
CREATE TABLE tt_2 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
|
||||
CREATE TABLE tt_3 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
|
||||
CREATE TABLE tt_4 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
|
||||
SET SQL_LOG_BIN=1;
|
||||
|
||||
connection master;
|
||||
|
||||
DELIMITER |;
|
||||
|
||||
CREATE FUNCTION f1 () RETURNS VARCHAR(64)
|
||||
BEGIN
|
||||
RETURN "Testing...";
|
||||
END|
|
||||
|
||||
CREATE FUNCTION f2 () RETURNS VARCHAR(64)
|
||||
BEGIN
|
||||
RETURN f1();
|
||||
END|
|
||||
|
||||
CREATE PROCEDURE pc_i_tt_3 (IN x INT, IN y VARCHAR(64))
|
||||
BEGIN
|
||||
INSERT INTO tt_3 VALUES (y,x,x);
|
||||
END|
|
||||
|
||||
CREATE TRIGGER tr_i_tt_3_to_nt_3 BEFORE INSERT ON tt_3 FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO nt_3 VALUES (NEW.a, NEW.b, NEW.c);
|
||||
END|
|
||||
|
||||
CREATE TRIGGER tr_i_nt_4_to_tt_4 BEFORE INSERT ON nt_4 FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO tt_4 VALUES (NEW.a, NEW.b, NEW.c);
|
||||
END|
|
||||
|
||||
DELIMITER ;|
|
||||
|
||||
--echo ###################################################################################
|
||||
--echo # MIXING TRANSACTIONAL and NON-TRANSACTIONAL TABLES
|
||||
--echo ###################################################################################
|
||||
connection master;
|
||||
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #1) "B T T C" generates in binlog the "B T T C" entries.
|
||||
--echo #
|
||||
BEGIN;
|
||||
INSERT INTO tt_1 VALUES ("new text 4", 4, "new text 4");
|
||||
INSERT INTO tt_2 VALUES ("new text 4", 4, "new text 4");
|
||||
COMMIT;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #1.e) "B T T C" with error in T generates in binlog the "B T T C" entries.
|
||||
--echo #
|
||||
INSERT INTO tt_1 VALUES ("new text -2", -2, "new text -2");
|
||||
BEGIN;
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO tt_1 VALUES ("new text -1", -1, "new text -1"), ("new text -2", -2, "new text -2");
|
||||
INSERT INTO tt_2 VALUES ("new text -3", -3, "new text -3");
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tt_2 VALUES ("new text -5", -5, "new text -5");
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO tt_2 VALUES ("new text -4", -4, "new text -4"), ("new text -5", -5, "new text -5");
|
||||
COMMIT;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #2) "B T T R" generates in binlog an "empty" entry.
|
||||
--echo #
|
||||
BEGIN;
|
||||
INSERT INTO tt_1 VALUES ("new text 5", 5, "new text 5");
|
||||
INSERT INTO tt_2 VALUES ("new text 5", 5, "new text 5");
|
||||
ROLLBACK;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #2.e) "B T T R" with error in T generates in binlog an "empty" entry.
|
||||
--echo #
|
||||
INSERT INTO tt_1 VALUES ("new text -7", -7, "new text -7");
|
||||
BEGIN;
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO tt_1 VALUES ("new text -6", -6, "new text -6"), ("new text -7", -7, "new text -7");
|
||||
INSERT INTO tt_2 VALUES ("new text -8", -8, "new text -8");
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tt_2 VALUES ("new text -10", -10, "new text -10");
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO tt_2 VALUES ("new text -9", -9, "new text -9"), ("new text -10", -10, "new text -10");
|
||||
ROLLBACK;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #3) "B T N C" generates in binlog the "B T N C" entries.
|
||||
--echo #
|
||||
BEGIN;
|
||||
INSERT INTO tt_1 VALUES ("new text 6", 6, "new text 6");
|
||||
INSERT INTO nt_1 VALUES ("new text 6", 6, "new text 6");
|
||||
COMMIT;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #3.e) "B T N C" with error in either T or N generates in binlog the "B T N C" entries.
|
||||
--echo #
|
||||
INSERT INTO tt_1 VALUES ("new text -12", -12, "new text -12");
|
||||
BEGIN;
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO tt_1 VALUES ("new text -11", -11, "new text -11"), ("new text -12", -12, "new text -12");
|
||||
INSERT INTO nt_1 VALUES ("new text -13", -13, "new text -13");
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tt_1 VALUES ("new text -14", -14, "new text -14");
|
||||
INSERT INTO nt_1 VALUES ("new text -16", -16, "new text -16");
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO nt_1 VALUES ("new text -15", -15, "new text -15"), ("new text -16", -16, "new text -16");
|
||||
COMMIT;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #4) "B T N R" generates in binlog the "B T N R" entries.
|
||||
--echo #
|
||||
BEGIN;
|
||||
INSERT INTO tt_1 VALUES ("new text 7", 7, "new text 7");
|
||||
INSERT INTO nt_1 VALUES ("new text 7", 7, "new text 7");
|
||||
ROLLBACK;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #4.e) "B T N R" with error in either T or N generates in binlog the "B T N R" entries.
|
||||
--echo #
|
||||
INSERT INTO tt_1 VALUES ("new text -17", -17, "new text -17");
|
||||
BEGIN;
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO tt_1 VALUES ("new text -16", -16, "new text -16"), ("new text -17", -17, "new text -17");
|
||||
INSERT INTO nt_1 VALUES ("new text -18", -18, "new text -18");
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tt_1 VALUES ("new text -19", -19, "new text -19");
|
||||
INSERT INTO nt_1 VALUES ("new text -21", -21, "new text -21");
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO nt_1 VALUES ("new text -20", -20, "new text -20"), ("new text -21", -21, "new text -21");
|
||||
ROLLBACK;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #5) "T" generates in binlog the "B T C" entry.
|
||||
--echo #
|
||||
INSERT INTO tt_1 VALUES ("new text 8", 8, "new text 8");
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #5.e) "T" with error in T generates in binlog an "empty" entry.
|
||||
--echo #
|
||||
INSERT INTO tt_1 VALUES ("new text -1", -1, "new text -1");
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO tt_1 VALUES ("new text -1", -1, "new text -1"), ("new text -22", -22, "new text -22");
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO tt_1 VALUES ("new text -23", -23, "new text -23"), ("new text -1", -1, "new text -1");
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #6) "N" generates in binlog the "N" entry.
|
||||
--echo #
|
||||
INSERT INTO nt_1 VALUES ("new text 9", 9, "new text 9");
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #6.e) "N" with error in N generates in binlog an empty entry if the error
|
||||
--echo # happens in the first tuple. Otherwise, generates the "N" entry and
|
||||
--echo # the error is appended.
|
||||
--echo #
|
||||
INSERT INTO nt_1 VALUES ("new text -1", -1, "new text -1");
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO nt_1 VALUES ("new text -1", -1, "new text -1");
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO nt_1 VALUES ("new text -24", -24, "new text -24"), ("new text -1", -1, "new text -1");
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #7) "M" generates in binglog the "B M C" entries.
|
||||
--echo #
|
||||
|
||||
DELETE FROM nt_1;
|
||||
|
||||
INSERT INTO nt_1 SELECT * FROM tt_1;
|
||||
|
||||
DELETE FROM tt_1;
|
||||
|
||||
INSERT INTO tt_1 SELECT * FROM nt_1;
|
||||
|
||||
INSERT INTO tt_3 VALUES ("new text 000", 000, '');
|
||||
|
||||
INSERT INTO tt_3 VALUES("new text 100", 100, f1());
|
||||
|
||||
INSERT INTO nt_4 VALUES("new text 100", 100, f1());
|
||||
|
||||
INSERT INTO tt_3 VALUES("new text 200", 200, f2());
|
||||
|
||||
INSERT INTO nt_4 VALUES ("new text 300", 300, '');
|
||||
|
||||
INSERT INTO nt_4 VALUES ("new text 400", 400, f1());
|
||||
|
||||
INSERT INTO nt_4 VALUES ("new text 500", 500, f2());
|
||||
|
||||
CALL pc_i_tt_3(600, "Testing...");
|
||||
|
||||
UPDATE nt_3, nt_4, tt_3, tt_4 SET nt_3.a= "new text 1", nt_4.a= "new text 1", tt_3.a= "new text 1", tt_4.a= "new text 1" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
|
||||
UPDATE tt_3, tt_4, nt_3, nt_4 SET tt_3.a= "new text 2", tt_4.a= "new text 2", nt_3.a= "new text 2", nt_4.a = "new text 2" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
|
||||
UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 3", nt_3.a= "new text 3", nt_4.a= "new text 3", tt_4.a = "new text 3" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
|
||||
UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 4", nt_3.a= "new text 4", nt_4.a= "new text 4", tt_4.a = "new text 4" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #7.e) "M" with error in M generates in binglog the "B M R" entries.
|
||||
--echo #
|
||||
|
||||
INSERT INTO nt_3 VALUES ("new text -26", -26, '');
|
||||
SELECT * FROM tt_3;
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO tt_3 VALUES ("new text -25", -25, ''), ("new text -26", -26, '');
|
||||
SELECT * FROM tt_3;
|
||||
|
||||
INSERT INTO tt_4 VALUES ("new text -26", -26, '');
|
||||
SELECT * FROM nt_4;
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO nt_4 VALUES ("new text -25", -25, ''), ("new text -26", -26, '');
|
||||
SELECT * FROM nt_4;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #8) "B N N T C" generates in binglog the "N N B T C" entries.
|
||||
--echo #
|
||||
BEGIN;
|
||||
INSERT INTO nt_1 VALUES ("new text 10", 10, "new text 10");
|
||||
INSERT INTO nt_2 VALUES ("new text 10", 10, "new text 10");
|
||||
INSERT INTO tt_1 VALUES ("new text 10", 10, "new text 10");
|
||||
COMMIT;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo #
|
||||
--echo #8.e) "B N N T R" See 6.e and 9.e.
|
||||
--echo #
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #9) "B N N T R" generates in binlog the "N N B T R" entries.
|
||||
--echo #
|
||||
BEGIN;
|
||||
INSERT INTO nt_1 VALUES ("new text 11", 11, "new text 11");
|
||||
INSERT INTO nt_2 VALUES ("new text 11", 11, "new text 11");
|
||||
INSERT INTO tt_1 VALUES ("new text 11", 11, "new text 11");
|
||||
ROLLBACK;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #9.e) "B N N T R" with error in N generates in binlog the "N N B T R" entries.
|
||||
--echo #
|
||||
BEGIN;
|
||||
INSERT INTO nt_1 VALUES ("new text -25", -25, "new text -25");
|
||||
INSERT INTO nt_2 VALUES ("new text -25", -25, "new text -25");
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO nt_2 VALUES ("new text -26", -26, "new text -26"), ("new text -25", -25, "new text -25");
|
||||
INSERT INTO tt_1 VALUES ("new text -27", -27, "new text -27");
|
||||
ROLLBACK;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #10) "B N N C" generates in binglog the "N N" entries.
|
||||
--echo #
|
||||
BEGIN;
|
||||
INSERT INTO nt_1 VALUES ("new text 12", 12, "new text 12");
|
||||
INSERT INTO nt_2 VALUES ("new text 12", 12, "new text 12");
|
||||
COMMIT;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo #
|
||||
--echo #10.e) "B N N C" See 6.e and 9.e.
|
||||
--echo #
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #11) "B N N R" generates in binlog the "N N" entries.
|
||||
--echo #
|
||||
BEGIN;
|
||||
INSERT INTO nt_1 VALUES ("new text 13", 13, "new text 13");
|
||||
INSERT INTO nt_2 VALUES ("new text 13", 13, "new text 13");
|
||||
ROLLBACK;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo #
|
||||
--echo #11.e) "B N N R" See 6.e and 9.e.
|
||||
--echo #
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #12) "B M T C" generates in the binlog the "B M T C" entries.
|
||||
--echo #
|
||||
DELETE FROM nt_1;
|
||||
BEGIN;
|
||||
INSERT INTO nt_1 SELECT * FROM tt_1;
|
||||
INSERT INTO tt_2 VALUES ("new text 14", 14, "new text 14");
|
||||
COMMIT;
|
||||
|
||||
DELETE FROM tt_1;
|
||||
BEGIN;
|
||||
INSERT INTO tt_1 SELECT * FROM nt_1;
|
||||
INSERT INTO tt_2 VALUES ("new text 15", 15, "new text 15");
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tt_3 VALUES ("new text 700", 700, '');
|
||||
INSERT INTO tt_1 VALUES ("new text 800", 800, '');
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tt_3 VALUES("new text 900", 900, f1());
|
||||
INSERT INTO tt_1 VALUES ("new text 1000", 1000, '');
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tt_3 VALUES(1100, 1100, f2());
|
||||
INSERT INTO tt_1 VALUES ("new text 1200", 1200, '');
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO nt_4 VALUES ("new text 1300", 1300, '');
|
||||
INSERT INTO tt_1 VALUES ("new text 1400", 1400, '');
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO nt_4 VALUES("new text 1500", 1500, f1());
|
||||
INSERT INTO tt_1 VALUES ("new text 1600", 1600, '');
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO nt_4 VALUES("new text 1700", 1700, f2());
|
||||
INSERT INTO tt_1 VALUES ("new text 1800", 1800, '');
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
CALL pc_i_tt_3(1900, "Testing...");
|
||||
INSERT INTO tt_1 VALUES ("new text 2000", 2000, '');
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
UPDATE nt_3, nt_4, tt_3, tt_4 SET nt_3.a= "new text 5", nt_4.a= "new text 5", tt_3.a= "new text 5", tt_4.a= "new text 5" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
INSERT INTO tt_1 VALUES ("new text 2100", 2100, '');
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
UPDATE tt_3, tt_4, nt_3, nt_4 SET tt_3.a= "new text 6", tt_4.a= "new text 6", nt_3.a= "new text 6", nt_4.a = "new text 6" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
INSERT INTO tt_1 VALUES ("new text 2200", 2200, '');
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 7", nt_3.a= "new text 7", nt_4.a= "new text 7", tt_4.a = "new text 7" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
INSERT INTO tt_1 VALUES ("new text 2300", 2300, '');
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 8", nt_3.a= "new text 8", nt_4.a= "new text 8", tt_4.a = "new text 8" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
INSERT INTO tt_1 VALUES ("new text 2400", 2400, '');
|
||||
COMMIT;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #12.e) "B M T C" with error in M generates in the binlog the "B M T C" entries.
|
||||
--echo #
|
||||
|
||||
--echo # There is a bug in the slave that needs to be fixed before enabling
|
||||
--echo # this part of the test. A bug report will be filed referencing this
|
||||
--echo # test case.
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO nt_3 VALUES ("new text -28", -28, '');
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO tt_3 VALUES ("new text -27", -27, ''), ("new text -28", -28, '');
|
||||
INSERT INTO tt_1 VALUES ("new text -27", -27, '');
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tt_4 VALUES ("new text -28", -28, '');
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO nt_4 VALUES ("new text -27", -27, ''), ("new text -28", -28, '');
|
||||
INSERT INTO tt_1 VALUES ("new text -28", -28, '');
|
||||
COMMIT;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #13) "B M T R" generates in the binlog the "B M T R" entries
|
||||
--echo #
|
||||
|
||||
DELETE FROM nt_1;
|
||||
BEGIN;
|
||||
INSERT INTO nt_1 SELECT * FROM tt_1;
|
||||
INSERT INTO tt_2 VALUES ("new text 17", 17, "new text 17");
|
||||
ROLLBACK;
|
||||
|
||||
DELETE FROM tt_1;
|
||||
BEGIN;
|
||||
INSERT INTO tt_1 SELECT * FROM nt_1;
|
||||
INSERT INTO tt_2 VALUES ("new text 18", 18, "new text 18");
|
||||
ROLLBACK;
|
||||
INSERT INTO tt_1 SELECT * FROM nt_1;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tt_3 VALUES ("new text 2500", 2500, '');
|
||||
INSERT INTO tt_1 VALUES ("new text 2600", 2600, '');
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tt_3 VALUES("new text 2700", 2700, f1());
|
||||
INSERT INTO tt_1 VALUES ("new text 2800", 2800, '');
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tt_3 VALUES(2900, 2900, f2());
|
||||
INSERT INTO tt_1 VALUES ("new text 3000", 3000, '');
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO nt_4 VALUES ("new text 3100", 3100, '');
|
||||
INSERT INTO tt_1 VALUES ("new text 3200", 3200, '');
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO nt_4 VALUES("new text 3300", 3300, f1());
|
||||
INSERT INTO tt_1 VALUES ("new text 3400", 3400, '');
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO nt_4 VALUES("new text 3500", 3500, f2());
|
||||
INSERT INTO tt_1 VALUES ("new text 3600", 3600, '');
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
CALL pc_i_tt_3(3700, "Testing...");
|
||||
INSERT INTO tt_1 VALUES ("new text 3700", 3700, '');
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
UPDATE nt_3, nt_4, tt_3, tt_4 SET nt_3.a= "new text 9", nt_4.a= "new text 9", tt_3.a= "new text 9", tt_4.a= "new text 9" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
INSERT INTO tt_1 VALUES ("new text 3800", 3800, '');
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
UPDATE tt_3, tt_4, nt_3, nt_4 SET tt_3.a= "new text 10", tt_4.a= "new text 10", nt_3.a= "new text 10", nt_4.a = "new text 10" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
INSERT INTO tt_1 VALUES ("new text 3900", 3900, '');
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 11", nt_3.a= "new text 11", nt_4.a= "new text 11", tt_4.a = "new text 11" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
INSERT INTO tt_1 VALUES ("new text 4000", 4000, '');
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 12", nt_3.a= "new text 12", nt_4.a= "new text 12", tt_4.a = "new text 12" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
INSERT INTO tt_1 VALUES ("new text 4100", 4100, '');
|
||||
ROLLBACK;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #13.e) "B M T R" with error in M generates in the binlog the "B M T R" entries.
|
||||
--echo #
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO nt_3 VALUES ("new text -30", -30, '');
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO tt_3 VALUES ("new text -29", -29, ''), ("new text -30", -30, '');
|
||||
INSERT INTO tt_1 VALUES ("new text -30", -30, '');
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tt_4 VALUES ("new text -30", -30, '');
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO nt_4 VALUES ("new text -29", -29, ''), ("new text -30", -30, '');
|
||||
INSERT INTO tt_1 VALUES ("new text -31", -31, '');
|
||||
ROLLBACK;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
connection master;
|
||||
sync_slave_with_master;
|
||||
|
||||
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-master.sql
|
||||
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-slave.sql
|
||||
--diff_files $MYSQLTEST_VARDIR/tmp/test-master.sql $MYSQLTEST_VARDIR/tmp/test-slave.sql
|
||||
|
||||
--echo ###################################################################################
|
||||
--echo # CLEAN
|
||||
--echo ###################################################################################
|
||||
|
||||
connection master;
|
||||
DROP TABLE tt_1;
|
||||
DROP TABLE tt_2;
|
||||
DROP TABLE tt_3;
|
||||
DROP TABLE tt_4;
|
||||
DROP TABLE nt_1;
|
||||
DROP TABLE nt_2;
|
||||
DROP TABLE nt_3;
|
||||
DROP TABLE nt_4;
|
||||
DROP PROCEDURE pc_i_tt_3;
|
||||
DROP FUNCTION f1;
|
||||
DROP FUNCTION f2;
|
||||
|
||||
sync_slave_with_master;
|
|
@ -725,9 +725,9 @@ call p_verify_status_increment(4, 4, 4, 4);
|
|||
alter table t3 add column (b int);
|
||||
call p_verify_status_increment(2, 0, 2, 0);
|
||||
alter table t3 rename t4;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
rename table t4 to t3;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
truncate table t3;
|
||||
call p_verify_status_increment(4, 4, 4, 4);
|
||||
create view v1 as select * from t2;
|
||||
|
|
|
@ -162,6 +162,8 @@ INSERT INTO global_suppressions VALUES
|
|||
("Slave: Unknown column 'c7' in 't15' Error_code: 1054"),
|
||||
("Slave: Can't DROP 'c7'.* 1091"),
|
||||
("Slave: Key column 'c6'.* 1072"),
|
||||
("Slave I/O: The slave I/O thread stops because a fatal error is encountered when it try to get the value of SERVER_ID variable from master."),
|
||||
(".SELECT UNIX_TIMESTAMP... failed on master, do not trust column Seconds_Behind_Master of SHOW SLAVE STATUS"),
|
||||
|
||||
/* Test case for Bug#31590 in order_by.test produces the following error */
|
||||
("Out of sort memory; increase server sort buffer size"),
|
||||
|
|
69
mysql-test/include/partition_date_range.inc
Normal file
69
mysql-test/include/partition_date_range.inc
Normal file
|
@ -0,0 +1,69 @@
|
|||
# Created for verifying bug#20577.
|
||||
# expects TABLE t1 (... , a DATE, ...)
|
||||
|
||||
--sorted_result
|
||||
SELECT * FROM t1 WHERE a < '1001-01-01';
|
||||
--sorted_result
|
||||
SELECT * FROM t1 WHERE a <= '1001-01-01';
|
||||
--sorted_result
|
||||
SELECT * FROM t1 WHERE a >= '1001-01-01';
|
||||
--sorted_result
|
||||
SELECT * FROM t1 WHERE a > '1001-01-01';
|
||||
--sorted_result
|
||||
SELECT * FROM t1 WHERE a = '1001-01-01';
|
||||
--sorted_result
|
||||
SELECT * FROM t1 WHERE a < '1001-00-00';
|
||||
--sorted_result
|
||||
SELECT * FROM t1 WHERE a <= '1001-00-00';
|
||||
--sorted_result
|
||||
SELECT * FROM t1 WHERE a >= '1001-00-00';
|
||||
--sorted_result
|
||||
SELECT * FROM t1 WHERE a > '1001-00-00';
|
||||
--sorted_result
|
||||
SELECT * FROM t1 WHERE a = '1001-00-00';
|
||||
--echo # Disabling warnings for the invalid date
|
||||
--disable_warnings
|
||||
--sorted_result
|
||||
SELECT * FROM t1 WHERE a < '1999-02-31';
|
||||
--sorted_result
|
||||
SELECT * FROM t1 WHERE a <= '1999-02-31';
|
||||
--sorted_result
|
||||
SELECT * FROM t1 WHERE a >= '1999-02-31';
|
||||
--sorted_result
|
||||
SELECT * FROM t1 WHERE a > '1999-02-31';
|
||||
--sorted_result
|
||||
SELECT * FROM t1 WHERE a = '1999-02-31';
|
||||
--enable_warnings
|
||||
--sorted_result
|
||||
SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00';
|
||||
--sorted_result
|
||||
SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01';
|
||||
--sorted_result
|
||||
SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00';
|
||||
--sorted_result
|
||||
SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01';
|
||||
if ($explain_partitions)
|
||||
{
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-01-01';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-01-01';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-01-01';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-01-01';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-01-01';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-00-00';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-00-00';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-00-00';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-00-00';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-00-00';
|
||||
--echo # Disabling warnings for the invalid date
|
||||
--disable_warnings
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1999-02-31';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1999-02-31';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1999-02-31';
|
||||
--enable_warnings
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01';
|
||||
}
|
35
mysql-test/include/rpl_loaddata_charset.inc
Normal file
35
mysql-test/include/rpl_loaddata_charset.inc
Normal file
|
@ -0,0 +1,35 @@
|
|||
connection master;
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS mysqltest;
|
||||
--enable_warnings
|
||||
|
||||
CREATE DATABASE mysqltest CHARSET UTF8;
|
||||
USE mysqltest;
|
||||
CREATE TABLE t (cl varchar(100)) CHARSET UTF8;
|
||||
|
||||
if (!$LOAD_LOCAL)
|
||||
{
|
||||
LOAD DATA INFILE '../../std_data/loaddata_utf8.dat' INTO TABLE t
|
||||
FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
|
||||
}
|
||||
if ($LOAD_LOCAL)
|
||||
{
|
||||
LOAD DATA LOCAL INFILE './std_data/loaddata_utf8.dat' INTO TABLE t
|
||||
FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
|
||||
}
|
||||
|
||||
save_master_pos;
|
||||
echo ----------content on master----------;
|
||||
SELECT hex(cl) FROM t;
|
||||
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
echo ----------content on slave----------;
|
||||
USE mysqltest;
|
||||
SELECT hex(cl) FROM t;
|
||||
|
||||
connection master;
|
||||
DROP DATABASE mysqltest;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
|
@ -28,9 +28,7 @@ test.t1.bool N Y 1 1 0 0 1.0000 NULL ENUM('N','Y') NOT NULL
|
|||
test.t1.d 2002-03-03 2002-03-05 10 10 0 0 10.0000 NULL ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
|
||||
drop table t1,t2;
|
||||
EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE();
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
|
||||
2 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
ERROR HY000: Incorrect usage of PROCEDURE and subquery
|
||||
create table t1 (a int not null);
|
||||
create table t2 select * from t1 where 0=1 procedure analyse();
|
||||
show create table t2;
|
||||
|
@ -153,4 +151,9 @@ select f3 from t1 procedure analyse(1, 1);
|
|||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
test.t1.f3 5.99999 9.55555 7 7 0 0 7.77777 1.77778 FLOAT(6,5) NOT NULL
|
||||
drop table t1;
|
||||
CREATE TABLE t1(a INT,b INT,c INT,d INT,e INT,f INT,g INT,h INT,i INT,j INT,k INT);
|
||||
INSERT INTO t1 VALUES ();
|
||||
SELECT * FROM (SELECT * FROM t1) d PROCEDURE ANALYSE();
|
||||
ERROR HY000: Incorrect usage of PROCEDURE and subquery
|
||||
DROP TABLE t1;
|
||||
End of 4.1 tests
|
||||
|
|
|
@ -462,3 +462,17 @@ select last_insert_id();
|
|||
last_insert_id()
|
||||
3
|
||||
drop table t1;
|
||||
#
|
||||
# Bug#46616: Assertion `!table->auto_increment_field_not_null' on view
|
||||
# manipulations
|
||||
#
|
||||
CREATE TABLE t1 ( a INT );
|
||||
INSERT INTO t1 VALUES (1), (1);
|
||||
CREATE TABLE t2 ( a INT AUTO_INCREMENT KEY );
|
||||
CREATE TABLE IF NOT EXISTS t2 AS SELECT a FROM t1;
|
||||
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
UPDATE t2 SET a = 2;
|
||||
SELECT a FROM t2;
|
||||
a
|
||||
2
|
||||
DROP TABLE t1, t2;
|
||||
|
|
|
@ -841,17 +841,17 @@ call p_verify_status_increment(2, 0, 2, 0);
|
|||
SUCCESS
|
||||
|
||||
alter table t3 rename t4;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
rename table t4 to t3;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
truncate table t3;
|
||||
call p_verify_status_increment(4, 4, 4, 4);
|
||||
ERROR
|
||||
Expected commit increment: 4 actual: 2
|
||||
SUCCESS
|
||||
|
||||
create view v1 as select * from t2;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
|
2
mysql-test/r/disabled_partition.require
Normal file
2
mysql-test/r/disabled_partition.require
Normal file
|
@ -0,0 +1,2 @@
|
|||
Variable_name Value
|
||||
have_partitioning DISABLED
|
|
@ -2502,3 +2502,15 @@ a MAX(b)
|
|||
2 1
|
||||
DROP TABLE t;
|
||||
End of 5.0 tests
|
||||
#
|
||||
# Bug #46607: Assertion failed: (cond_type == Item::FUNC_ITEM) results in
|
||||
# server crash
|
||||
#
|
||||
CREATE TABLE t (a INT, b INT, INDEX (a,b));
|
||||
INSERT INTO t VALUES (2,0), (2,0), (2,1), (2,1);
|
||||
INSERT INTO t SELECT * FROM t;
|
||||
SELECT a, MAX(b) FROM t WHERE b GROUP BY a;
|
||||
a MAX(b)
|
||||
2 1
|
||||
DROP TABLE t;
|
||||
End of 5.1 tests
|
||||
|
|
|
@ -741,3 +741,19 @@ USE information_schema;
|
|||
HANDLER COLUMNS OPEN;
|
||||
ERROR HY000: Incorrect usage of HANDLER OPEN and information_schema
|
||||
USE test;
|
||||
#
|
||||
# BUG #46456: HANDLER OPEN + TRUNCATE + DROP (temporary) TABLE, crash
|
||||
#
|
||||
CREATE TABLE t1 AS SELECT 1 AS f1;
|
||||
HANDLER t1 OPEN;
|
||||
TRUNCATE t1;
|
||||
HANDLER t1 READ FIRST;
|
||||
ERROR 42S02: Unknown table 't1' in HANDLER
|
||||
DROP TABLE t1;
|
||||
CREATE TEMPORARY TABLE t1 AS SELECT 1 AS f1;
|
||||
HANDLER t1 OPEN;
|
||||
TRUNCATE t1;
|
||||
HANDLER t1 READ FIRST;
|
||||
ERROR 42S02: Unknown table 't1' in HANDLER
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
SET @odl_sync_frm = @@global.sync_frm;
|
||||
SET @@global.sync_frm = OFF;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1( a INT, b INT );
|
||||
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4);
|
||||
|
@ -17,3 +19,4 @@ ALTER TABLE t1 ADD COLUMN a INT;
|
|||
# 2.2.1. normal mode
|
||||
# 2.2.2. PS mode
|
||||
DROP TABLE t1;
|
||||
SET @@global.sync_frm = @odl_sync_frm;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
SET @odl_sync_frm = @@global.sync_frm;
|
||||
SET @@global.sync_frm = OFF;
|
||||
DROP TABLE IF EXISTS t1,t2,t3;
|
||||
CREATE TABLE t1 (
|
||||
a int(11) unsigned default NULL,
|
||||
|
@ -15,3 +17,4 @@ CREATE TABLE t3 SELECT * FROM t1;
|
|||
# normal mode
|
||||
# PS mode
|
||||
DROP TABLE t1, t2, t3;
|
||||
SET @@global.sync_frm = @odl_sync_frm;
|
||||
|
|
|
@ -2207,4 +2207,16 @@ ERROR HY000: Table storage engine for 'm1' doesn't have this option
|
|||
DROP TABLE m1,t1,t2,t3,t4,t5,t6,t7;
|
||||
SELECT 1 FROM m1;
|
||||
ERROR 42S02: Table 'test.m1' doesn't exist
|
||||
#
|
||||
# Bug #46614: Assertion in show_create_trigger()
|
||||
#
|
||||
CREATE TABLE t1(a int);
|
||||
CREATE TABLE t2(a int);
|
||||
CREATE TABLE t3(a int) ENGINE = MERGE UNION(t1, t2);
|
||||
CREATE TRIGGER tr1 AFTER INSERT ON t3 FOR EACH ROW CALL foo();
|
||||
SHOW CREATE TRIGGER tr1;
|
||||
Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
|
||||
tr1 CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER INSERT ON t3 FOR EACH ROW CALL foo() latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
DROP TRIGGER tr1;
|
||||
DROP TABLE t1, t2, t3;
|
||||
End of 5.1 tests
|
||||
|
|
|
@ -215,7 +215,7 @@ COMMIT/*!*/;
|
|||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
TRUNCATE TABLE t1
|
||||
BEGIN
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
|
@ -223,6 +223,22 @@ SET TIMESTAMP=1000000000/*!*/;
|
|||
TRUNCATE TABLE t1
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Xid = #
|
||||
COMMIT/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
TRUNCATE TABLE t1
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Xid = #
|
||||
COMMIT/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
BEGIN
|
||||
|
@ -331,9 +347,17 @@ COMMIT/*!*/;
|
|||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
TRUNCATE TABLE t1
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Xid = #
|
||||
COMMIT/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
TRUNCATE TABLE t2
|
||||
|
@ -449,9 +473,17 @@ ROLLBACK
|
|||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
TRUNCATE TABLE t1
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Xid = #
|
||||
COMMIT/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
TRUNCATE TABLE t2
|
||||
|
|
|
@ -1,3 +1,48 @@
|
|||
DROP TABLE IF EXISTS t1;
|
||||
FLUSH TABLES;
|
||||
SELECT * FROM t1;
|
||||
ERROR 42000: Unknown table engine 'partition'
|
||||
TRUNCATE TABLE t1;
|
||||
ERROR 42000: Unknown table engine 'partition'
|
||||
ANALYZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze Error Unknown table engine 'partition'
|
||||
test.t1 analyze error Corrupt
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check Error Unknown table engine 'partition'
|
||||
test.t1 check error Corrupt
|
||||
OPTIMIZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize Error Unknown table engine 'partition'
|
||||
test.t1 optimize error Corrupt
|
||||
REPAIR TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair Error Unknown table engine 'partition'
|
||||
test.t1 repair error Corrupt
|
||||
ALTER TABLE t1 REPAIR PARTITION ALL;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair Error Unknown table engine 'partition'
|
||||
test.t1 repair error Corrupt
|
||||
ALTER TABLE t1 CHECK PARTITION ALL;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check Error Unknown table engine 'partition'
|
||||
test.t1 check error Corrupt
|
||||
ALTER TABLE t1 OPTIMIZE PARTITION ALL;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize Error Unknown table engine 'partition'
|
||||
test.t1 optimize error Corrupt
|
||||
ALTER TABLE t1 ANALYZE PARTITION ALL;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze Error Unknown table engine 'partition'
|
||||
test.t1 analyze error Corrupt
|
||||
ALTER TABLE t1 REBUILD PARTITION ALL;
|
||||
ERROR 42000: Unknown table engine 'partition'
|
||||
ALTER TABLE t1 ENGINE Memory;
|
||||
ERROR 42000: Unknown table engine 'partition'
|
||||
ALTER TABLE t1 ADD (new INT);
|
||||
ERROR 42000: Unknown table engine 'partition'
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
firstname VARCHAR(25) NOT NULL,
|
||||
lastname VARCHAR(25) NOT NULL,
|
||||
|
|
|
@ -1,4 +1,55 @@
|
|||
drop table if exists t1, t2;
|
||||
CREATE TABLE t1 (
|
||||
a int NOT NULL,
|
||||
b int NOT NULL);
|
||||
CREATE TABLE t2 (
|
||||
a int NOT NULL,
|
||||
b int NOT NULL,
|
||||
INDEX(b)
|
||||
)
|
||||
PARTITION BY HASH(a) PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (399, 22);
|
||||
INSERT INTO t2 VALUES (1, 22), (1, 42);
|
||||
INSERT INTO t2 SELECT 1, 399 FROM t2, t1
|
||||
WHERE t1.b = t2.b;
|
||||
DROP TABLE t1, t2;
|
||||
CREATE TABLE t1 (
|
||||
a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
b varchar(10),
|
||||
PRIMARY KEY (a)
|
||||
)
|
||||
PARTITION BY RANGE (to_days(a)) (
|
||||
PARTITION p1 VALUES LESS THAN (733407),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE
|
||||
);
|
||||
INSERT INTO t1 VALUES ('2007-07-30 17:35:48', 'p1');
|
||||
INSERT INTO t1 VALUES ('2009-07-14 17:35:55', 'pmax');
|
||||
INSERT INTO t1 VALUES ('2009-09-21 17:31:42', 'pmax');
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
2007-07-30 17:35:48 p1
|
||||
2009-07-14 17:35:55 pmax
|
||||
2009-09-21 17:31:42 pmax
|
||||
ALTER TABLE t1 REORGANIZE PARTITION pmax INTO (
|
||||
PARTITION p3 VALUES LESS THAN (733969),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
2007-07-30 17:35:48 p1
|
||||
2009-07-14 17:35:55 pmax
|
||||
2009-09-21 17:31:42 pmax
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`b` varchar(10) DEFAULT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
/*!50100 PARTITION BY RANGE (to_days(a))
|
||||
(PARTITION p1 VALUES LESS THAN (733407) ENGINE = MyISAM,
|
||||
PARTITION p3 VALUES LESS THAN (733969) ENGINE = MyISAM,
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INT, FOREIGN KEY (a) REFERENCES t0 (a))
|
||||
ENGINE=MyISAM
|
||||
PARTITION BY HASH (a);
|
||||
|
|
93
mysql-test/r/partition_disabled.result
Normal file
93
mysql-test/r/partition_disabled.result
Normal file
|
@ -0,0 +1,93 @@
|
|||
DROP TABLE IF EXISTS t1;
|
||||
FLUSH TABLES;
|
||||
SELECT * FROM t1;
|
||||
ERROR HY000: The MySQL server is running with the --skip-partition option so it cannot execute this statement
|
||||
TRUNCATE TABLE t1;
|
||||
ERROR HY000: The MySQL server is running with the --skip-partition option so it cannot execute this statement
|
||||
ANALYZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze Error The MySQL server is running with the --skip-partition option so it cannot execute this statement
|
||||
test.t1 analyze error Corrupt
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check Error The MySQL server is running with the --skip-partition option so it cannot execute this statement
|
||||
test.t1 check error Corrupt
|
||||
OPTIMIZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize Error The MySQL server is running with the --skip-partition option so it cannot execute this statement
|
||||
test.t1 optimize error Corrupt
|
||||
REPAIR TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair Error The MySQL server is running with the --skip-partition option so it cannot execute this statement
|
||||
test.t1 repair error Corrupt
|
||||
ALTER TABLE t1 REPAIR PARTITION ALL;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair Error The MySQL server is running with the --skip-partition option so it cannot execute this statement
|
||||
test.t1 repair error Corrupt
|
||||
ALTER TABLE t1 CHECK PARTITION ALL;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check Error The MySQL server is running with the --skip-partition option so it cannot execute this statement
|
||||
test.t1 check error Corrupt
|
||||
ALTER TABLE t1 OPTIMIZE PARTITION ALL;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize Error The MySQL server is running with the --skip-partition option so it cannot execute this statement
|
||||
test.t1 optimize error Corrupt
|
||||
ALTER TABLE t1 ANALYZE PARTITION ALL;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze Error The MySQL server is running with the --skip-partition option so it cannot execute this statement
|
||||
test.t1 analyze error Corrupt
|
||||
ALTER TABLE t1 REBUILD PARTITION ALL;
|
||||
ERROR HY000: The MySQL server is running with the --skip-partition option so it cannot execute this statement
|
||||
ALTER TABLE t1 ENGINE Memory;
|
||||
ERROR HY000: The MySQL server is running with the --skip-partition option so it cannot execute this statement
|
||||
ALTER TABLE t1 ADD (new INT);
|
||||
ERROR HY000: The MySQL server is running with the --skip-partition option so it cannot execute this statement
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
firstname VARCHAR(25) NOT NULL,
|
||||
lastname VARCHAR(25) NOT NULL,
|
||||
username VARCHAR(16) NOT NULL,
|
||||
email VARCHAR(35),
|
||||
joined DATE NOT NULL
|
||||
)
|
||||
PARTITION BY KEY(joined)
|
||||
PARTITIONS 6;
|
||||
ERROR HY000: The MySQL server is running with the --skip-partition option so it cannot execute this statement
|
||||
ALTER TABLE t1 PARTITION BY KEY(joined) PARTITIONS 2;
|
||||
ERROR HY000: The MySQL server is running with the --skip-partition option so it cannot execute this statement
|
||||
drop table t1;
|
||||
ERROR 42S02: Unknown table 't1'
|
||||
CREATE TABLE t1 (
|
||||
firstname VARCHAR(25) NOT NULL,
|
||||
lastname VARCHAR(25) NOT NULL,
|
||||
username VARCHAR(16) NOT NULL,
|
||||
email VARCHAR(35),
|
||||
joined DATE NOT NULL
|
||||
)
|
||||
PARTITION BY RANGE( YEAR(joined) ) (
|
||||
PARTITION p0 VALUES LESS THAN (1960),
|
||||
PARTITION p1 VALUES LESS THAN (1970),
|
||||
PARTITION p2 VALUES LESS THAN (1980),
|
||||
PARTITION p3 VALUES LESS THAN (1990),
|
||||
PARTITION p4 VALUES LESS THAN MAXVALUE
|
||||
);
|
||||
ERROR HY000: The MySQL server is running with the --skip-partition option so it cannot execute this statement
|
||||
drop table t1;
|
||||
ERROR 42S02: Unknown table 't1'
|
||||
CREATE TABLE t1 (id INT, purchased DATE)
|
||||
PARTITION BY RANGE( YEAR(purchased) )
|
||||
SUBPARTITION BY HASH( TO_DAYS(purchased) )
|
||||
SUBPARTITIONS 2 (
|
||||
PARTITION p0 VALUES LESS THAN (1990),
|
||||
PARTITION p1 VALUES LESS THAN (2000),
|
||||
PARTITION p2 VALUES LESS THAN MAXVALUE
|
||||
);
|
||||
ERROR HY000: The MySQL server is running with the --skip-partition option so it cannot execute this statement
|
||||
drop table t1;
|
||||
ERROR 42S02: Unknown table 't1'
|
||||
create table t1 (a varchar(10) charset latin1 collate latin1_bin);
|
||||
insert into t1 values (''),(' '),('a'),('a '),('a ');
|
||||
explain partitions select * from t1 where a='a ' OR a='a';
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where
|
||||
drop table t1;
|
File diff suppressed because it is too large
Load diff
|
@ -745,7 +745,7 @@ a
|
|||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE a >= '2004-07-01' AND a <= '2004-09-30';
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p407,p408,p409 ALL NULL NULL NULL NULL 9 Using where
|
||||
1 SIMPLE t1 p3xx,p407,p408,p409 ALL NULL NULL NULL NULL 18 Using where
|
||||
SELECT * from t1
|
||||
WHERE (a >= '2004-07-01' AND a <= '2004-09-30') OR
|
||||
(a >= '2005-07-01' AND a <= '2005-09-30');
|
||||
|
@ -772,7 +772,7 @@ EXPLAIN PARTITIONS SELECT * from t1
|
|||
WHERE (a >= '2004-07-01' AND a <= '2004-09-30') OR
|
||||
(a >= '2005-07-01' AND a <= '2005-09-30');
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p407,p408,p409,p507,p508,p509 ALL NULL NULL NULL NULL 18 Using where
|
||||
1 SIMPLE t1 p3xx,p407,p408,p409,p507,p508,p509 ALL NULL NULL NULL NULL 27 Using where
|
||||
DROP TABLE t1;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
|
|
|
@ -75,7 +75,7 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
|
|||
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
|
||||
ERROR HY000: Incorrect usage of PROCEDURE and subquery
|
||||
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
|
||||
ERROR HY000: Incorrect parameters to procedure 'ANALYSE'
|
||||
ERROR HY000: Incorrect usage of PROCEDURE and subquery
|
||||
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
|
||||
ERROR 42S22: Unknown column 'a' in 'field list'
|
||||
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;
|
||||
|
@ -4383,6 +4383,34 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY C ALL NULL NULL NULL NULL 20 100.00 Using where
|
||||
DROP TABLE C;
|
||||
# End of test for bug#45061.
|
||||
#
|
||||
# Bug #46749: Segfault in add_key_fields() with outer subquery level
|
||||
# field references
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
a int,
|
||||
b int,
|
||||
UNIQUE (a), KEY (b)
|
||||
);
|
||||
INSERT INTO t1 VALUES (1,1), (2,1);
|
||||
CREATE TABLE st1 like t1;
|
||||
INSERT INTO st1 VALUES (1,1), (2,1);
|
||||
CREATE TABLE st2 like t1;
|
||||
INSERT INTO st2 VALUES (1,1), (2,1);
|
||||
EXPLAIN
|
||||
SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
|
||||
FROM t1
|
||||
WHERE a = 230;
|
||||
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 st1 index NULL a 5 NULL 2 Using index
|
||||
2 DEPENDENT SUBQUERY st2 index b b 5 NULL 2 Using where; Using index; Using join buffer
|
||||
SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
|
||||
FROM t1
|
||||
WHERE a = 230;
|
||||
MAX(b) (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
|
||||
NULL 0
|
||||
DROP TABLE t1, st1, st2;
|
||||
End of 5.0 tests.
|
||||
CREATE TABLE t1 (a INT, b INT);
|
||||
INSERT INTO t1 VALUES (2,22),(1,11),(2,22);
|
||||
|
|
|
@ -1495,9 +1495,9 @@ CREATE TABLE t1 (a int DEFAULT NULL, b int DEFAULT NULL);
|
|||
INSERT INTO t1 VALUES (3,30), (1,10), (2,10);
|
||||
SELECT a+CAST(1 AS decimal(65,30)) AS aa, SUM(b) FROM t1 GROUP BY aa;
|
||||
aa SUM(b)
|
||||
2.000000000000000000000000000000 10
|
||||
3.000000000000000000000000000000 10
|
||||
4.000000000000000000000000000000 30
|
||||
2.00000000000000000000000000000 10
|
||||
3.00000000000000000000000000000 10
|
||||
4.00000000000000000000000000000 30
|
||||
SELECT a+CAST(1 AS decimal(65,31)) AS aa, SUM(b) FROM t1 GROUP BY aa;
|
||||
ERROR 42000: Too big scale 31 specified for column '1'. Maximum is 30.
|
||||
DROP TABLE t1;
|
||||
|
@ -1521,13 +1521,13 @@ f1
|
|||
DROP TABLE t1;
|
||||
CREATE TABLE t1 SELECT 123451234512345123451234512345123451234512345.678906789067890678906789067890678906789067890 AS f1;
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'f1' at row 1
|
||||
Note 1265 Data truncated for column 'f1' at row 1
|
||||
DESC t1;
|
||||
Field Type Null Key Default Extra
|
||||
f1 decimal(65,30) NO 0.000000000000000000000000000000
|
||||
f1 decimal(65,20) NO 0.00000000000000000000
|
||||
SELECT f1 FROM t1;
|
||||
f1
|
||||
99999999999999999999999999999999999.999999999999999999999999999999
|
||||
123451234512345123451234512345123451234512345.67890678906789067891
|
||||
DROP TABLE t1;
|
||||
select (1.20396873 * 0.89550000 * 0.68000000 * 1.08721696 * 0.99500000 *
|
||||
1.01500000 * 1.01500000 * 0.99500000);
|
||||
|
@ -1595,7 +1595,7 @@ Warnings:
|
|||
Note 1265 Data truncated for column 'my_col' at row 1
|
||||
DESCRIBE t1;
|
||||
Field Type Null Key Default Extra
|
||||
my_col decimal(65,30) NO 0.000000000000000000000000000000
|
||||
my_col decimal(32,30) NO 0.000000000000000000000000000000
|
||||
SELECT my_col FROM t1;
|
||||
my_col
|
||||
1.123456789123456789123456789123
|
||||
|
@ -1625,8 +1625,212 @@ Warnings:
|
|||
Note 1265 Data truncated for column 'my_col' at row 1
|
||||
DESCRIBE t1;
|
||||
Field Type Null Key Default Extra
|
||||
my_col decimal(65,30) YES NULL
|
||||
my_col decimal(30,30) YES NULL
|
||||
SELECT my_col FROM t1;
|
||||
my_col
|
||||
0.012345687012345687012345687012
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#45261: Crash, stored procedure + decimal
|
||||
#
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 SELECT
|
||||
/* 81 */ 100000000000000000000000000000000000000000000000000000000000000000000000000000001
|
||||
AS c1;
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'c1' at row 1
|
||||
DESC t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 decimal(65,0) NO 0
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
99999999999999999999999999999999999999999999999999999999999999999
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 SELECT
|
||||
/* 81 */ 100000000000000000000000000000000000000000000000000000000000000000000000000000001.
|
||||
AS c1;
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'c1' at row 1
|
||||
DESC t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 decimal(65,0) NO 0
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
99999999999999999999999999999999999999999999999999999999999999999
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 SELECT
|
||||
/* 81 */ 100000000000000000000000000000000000000000000000000000000000000000000000000000001.1 /* 1 */
|
||||
AS c1;
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'c1' at row 1
|
||||
DESC t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 decimal(65,0) NO 0
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
99999999999999999999999999999999999999999999999999999999999999999
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 SELECT
|
||||
/* 82 */ 1000000000000000000000000000000000000000000000000000000000000000000000000000000001
|
||||
AS c1;
|
||||
Warnings:
|
||||
Error 1292 Truncated incorrect DECIMAL value: ''
|
||||
DESC t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 decimal(65,0) NO 0
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
99999999999999999999999999999999999999999999999999999999999999999
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 SELECT
|
||||
/* 40 */ 1000000000000000000000000000000000000001.1000000000000000000000000000000000000001 /* 40 */
|
||||
AS c1;
|
||||
DESC t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 decimal(65,25) NO 0.0000000000000000000000000
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
1000000000000000000000000000000000000001.1000000000000000000000000
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 SELECT
|
||||
/* 1 */ 1.10000000000000000000000000000000000000000000000000000000000000000000000000000001 /* 80 */
|
||||
AS c1;
|
||||
DESC t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 decimal(31,30) NO 0.000000000000000000000000000000
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
1.100000000000000000000000000000
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 SELECT
|
||||
/* 1 */ 1.100000000000000000000000000000000000000000000000000000000000000000000000000000001 /* 81 */
|
||||
AS c1;
|
||||
DESC t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 decimal(31,30) NO 0.000000000000000000000000000000
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
1.100000000000000000000000000000
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 SELECT
|
||||
.100000000000000000000000000000000000000000000000000000000000000000000000000000001 /* 81 */
|
||||
AS c1;
|
||||
Warnings:
|
||||
Note 1265 Data truncated for column 'c1' at row 1
|
||||
DESC t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 decimal(30,30) NO 0.000000000000000000000000000000
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
0.100000000000000000000000000000
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 SELECT
|
||||
/* 45 */ 123456789012345678901234567890123456789012345.123456789012345678901234567890123456789012345 /* 45 */
|
||||
AS c1;
|
||||
Warnings:
|
||||
Note 1265 Data truncated for column 'c1' at row 1
|
||||
DESC t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 decimal(65,20) NO 0.00000000000000000000
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
123456789012345678901234567890123456789012345.12345678901234567890
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 SELECT
|
||||
/* 65 */ 12345678901234567890123456789012345678901234567890123456789012345.1 /* 1 */
|
||||
AS c1;
|
||||
Warnings:
|
||||
Note 1265 Data truncated for column 'c1' at row 1
|
||||
DESC t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 decimal(65,0) NO 0
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
12345678901234567890123456789012345678901234567890123456789012345
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 SELECT
|
||||
/* 66 */ 123456789012345678901234567890123456789012345678901234567890123456.1 /* 1 */
|
||||
AS c1;
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'c1' at row 1
|
||||
DESC t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 decimal(65,0) NO 0
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
99999999999999999999999999999999999999999999999999999999999999999
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 SELECT
|
||||
.123456789012345678901234567890123456789012345678901234567890123456 /* 66 */
|
||||
AS c1;
|
||||
Warnings:
|
||||
Note 1265 Data truncated for column 'c1' at row 1
|
||||
DESC t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 decimal(30,30) NO 0.000000000000000000000000000000
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
0.123456789012345678901234567890
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 AS SELECT 123.1234567890123456789012345678901 /* 31 */ AS c1;
|
||||
Warnings:
|
||||
Note 1265 Data truncated for column 'c1' at row 1
|
||||
DESC t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 decimal(33,30) NO 0.000000000000000000000000000000
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
123.123456789012345678901234567890
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 SELECT 1.1 + CAST(1 AS DECIMAL(65,30)) AS c1;
|
||||
DESC t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 decimal(65,29) NO 0.00000000000000000000000000000
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
2.10000000000000000000000000000
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Test that the integer and decimal parts are properly calculated.
|
||||
#
|
||||
CREATE TABLE t1 (a DECIMAL(30,30));
|
||||
INSERT INTO t1 VALUES (0.1),(0.2),(0.3);
|
||||
CREATE TABLE t2 SELECT MIN(a + 0.0000000000000000000000000000001) AS c1 FROM t1;
|
||||
Warnings:
|
||||
Note 1265 Data truncated for column 'c1' at row 3
|
||||
DESC t2;
|
||||
Field Type Null Key Default Extra
|
||||
c1 decimal(32,30) YES NULL
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (a DECIMAL(30,30));
|
||||
INSERT INTO t1 VALUES (0.1),(0.2),(0.3);
|
||||
CREATE TABLE t2 SELECT IFNULL(a + 0.0000000000000000000000000000001, NULL) AS c1 FROM t1;
|
||||
Warnings:
|
||||
Note 1265 Data truncated for column 'c1' at row 1
|
||||
Note 1265 Data truncated for column 'c1' at row 2
|
||||
Note 1265 Data truncated for column 'c1' at row 3
|
||||
DESC t2;
|
||||
Field Type Null Key Default Extra
|
||||
c1 decimal(32,30) YES NULL
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (a DECIMAL(30,30));
|
||||
INSERT INTO t1 VALUES (0.1),(0.2),(0.3);
|
||||
CREATE TABLE t2 SELECT CASE a WHEN 0.1 THEN 0.0000000000000000000000000000000000000000000000000000000000000000001 END AS c1 FROM t1;
|
||||
Warnings:
|
||||
Note 1265 Data truncated for column 'c1' at row 1
|
||||
DESC t2;
|
||||
Field Type Null Key Default Extra
|
||||
c1 decimal(31,30) YES NULL
|
||||
DROP TABLE t1,t2;
|
||||
#
|
||||
# Test that variables get maximum precision.
|
||||
#
|
||||
SET @decimal= 1.1;
|
||||
CREATE TABLE t1 SELECT @decimal AS c1;
|
||||
DESC t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 decimal(65,30) YES NULL
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
1.100000000000000000000000000000
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -3718,117 +3718,6 @@ DROP TABLE t1;
|
|||
|
||||
# -- End of test case for Bug#40825
|
||||
|
||||
#
|
||||
# Bug #45806 crash when replacing into a view with a join!
|
||||
#
|
||||
CREATE TABLE t1(a INT UNIQUE);
|
||||
CREATE VIEW v1 AS SELECT t1.a FROM t1, t1 AS a;
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
REPLACE INTO v1(a) SELECT 1 FROM t1,t1 AS c;
|
||||
SELECT * FROM v1;
|
||||
a
|
||||
1
|
||||
2
|
||||
1
|
||||
2
|
||||
REPLACE INTO v1(a) SELECT 3 FROM t1,t1 AS c;
|
||||
SELECT * FROM v1;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
1
|
||||
2
|
||||
3
|
||||
1
|
||||
2
|
||||
3
|
||||
DELETE FROM t1 WHERE a=3;
|
||||
INSERT INTO v1(a) SELECT 1 FROM t1,t1 AS c
|
||||
ON DUPLICATE KEY UPDATE `v1`.`a`= 1;
|
||||
SELECT * FROM v1;
|
||||
a
|
||||
1
|
||||
2
|
||||
1
|
||||
2
|
||||
CREATE VIEW v2 AS SELECT t1.a FROM t1, v1 AS a;
|
||||
REPLACE INTO v2(a) SELECT 1 FROM t1,t1 AS c;
|
||||
SELECT * FROM v2;
|
||||
a
|
||||
1
|
||||
2
|
||||
1
|
||||
2
|
||||
1
|
||||
2
|
||||
1
|
||||
2
|
||||
REPLACE INTO v2(a) SELECT 3 FROM t1,t1 AS c;
|
||||
SELECT * FROM v2;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
1
|
||||
2
|
||||
3
|
||||
1
|
||||
2
|
||||
3
|
||||
1
|
||||
2
|
||||
3
|
||||
1
|
||||
2
|
||||
3
|
||||
1
|
||||
2
|
||||
3
|
||||
1
|
||||
2
|
||||
3
|
||||
1
|
||||
2
|
||||
3
|
||||
1
|
||||
2
|
||||
3
|
||||
INSERT INTO v2(a) SELECT 1 FROM t1,t1 AS c
|
||||
ON DUPLICATE KEY UPDATE `v2`.`a`= 1;
|
||||
SELECT * FROM v2;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
1
|
||||
2
|
||||
3
|
||||
1
|
||||
2
|
||||
3
|
||||
1
|
||||
2
|
||||
3
|
||||
1
|
||||
2
|
||||
3
|
||||
1
|
||||
2
|
||||
3
|
||||
1
|
||||
2
|
||||
3
|
||||
1
|
||||
2
|
||||
3
|
||||
1
|
||||
2
|
||||
3
|
||||
DROP VIEW v1;
|
||||
DROP VIEW v2;
|
||||
DROP TABLE t1;
|
||||
# -- End of test case for Bug#45806
|
||||
# -----------------------------------------------------------------
|
||||
# -- End of 5.0 tests.
|
||||
# -----------------------------------------------------------------
|
||||
|
|
3
mysql-test/std_data/loaddata_utf8.dat
Normal file
3
mysql-test/std_data/loaddata_utf8.dat
Normal file
|
@ -0,0 +1,3 @@
|
|||
一二三
|
||||
四五六
|
||||
七八九
|
BIN
mysql-test/std_data/parts/t1.frm
Normal file
BIN
mysql-test/std_data/parts/t1.frm
Normal file
Binary file not shown.
|
@ -379,7 +379,9 @@ master-bin.000001 # Query # # BEGIN
|
|||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE table t2
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
|
@ -838,8 +840,10 @@ UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */;
|
|||
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Intvar # # INSERT_ID=6
|
||||
master-bin.000001 # Query # # use `test`; UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
select count(*) from t1 /* must be 4 */;
|
||||
count(*)
|
||||
4
|
||||
|
|
|
@ -17,5 +17,5 @@ master-bin.000001 # Query # # create database `drop-temp+table-test`
|
|||
master-bin.000001 # Query # # use `drop-temp+table-test`; create temporary table shortn1 (a int)
|
||||
master-bin.000001 # Query # # use `drop-temp+table-test`; create temporary table `table:name` (a int)
|
||||
master-bin.000001 # Query # # use `drop-temp+table-test`; create temporary table shortn2 (a int)
|
||||
master-bin.000001 # Query # # use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`shortn2`,`drop-temp+table-test`.`table:name`,`drop-temp+table-test`.`shortn1`
|
||||
master-bin.000001 # Query # # use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `shortn2`,`table:name`,`shortn1`
|
||||
drop database `drop-temp+table-test`;
|
||||
|
|
|
@ -258,7 +258,7 @@ 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`
|
||||
master-bin.000001 # Query # # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t1`,`ti`
|
||||
do release_lock("lock1");
|
||||
drop table t0,t2;
|
||||
set autocommit=0;
|
||||
|
@ -346,7 +346,9 @@ master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (3,3)
|
|||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t2
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4,4)
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE table t2
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5,5)
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE t2
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (6,6)
|
||||
|
@ -545,8 +547,10 @@ UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */;
|
|||
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Intvar # # INSERT_ID=6
|
||||
master-bin.000001 # Query # # use `test`; UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
/* the output must denote there is the query */;
|
||||
select count(*) from t1 /* must be 4 */;
|
||||
count(*)
|
||||
|
@ -782,8 +786,10 @@ UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */;
|
|||
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Intvar # # INSERT_ID=6
|
||||
master-bin.000001 # Query # # use `test`; UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
select count(*) from t1 /* must be 4 */;
|
||||
count(*)
|
||||
4
|
||||
|
|
|
@ -101,6 +101,8 @@ master-bin.000001 # Query # # use `test`; UPDATE t SET f = 'dark blue 1' WHERE f
|
|||
master-bin.000001 # Query # # use `test`; INSERT INTO t VALUES (6 + (1 * 10),"brown")
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO n VALUES (now(),"brown")
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
source include/diff_master_slave.inc;
|
||||
source include/diff_master_slave.inc;
|
||||
########################################################################
|
||||
# Cleanup
|
||||
########################################################################
|
||||
|
|
33
mysql-test/suite/rpl/r/rpl_create_if_not_exists.result
Normal file
33
mysql-test/suite/rpl/r/rpl_create_if_not_exists.result
Normal file
|
@ -0,0 +1,33 @@
|
|||
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 DATABASE IF EXISTS mysqltest;
|
||||
CREATE DATABASE IF NOT EXISTS mysqltest;
|
||||
USE mysqltest;
|
||||
CREATE TABLE IF NOT EXISTS t(c1 int);
|
||||
CREATE TABLE IF NOT EXISTS t1 LIKE t;
|
||||
CREATE TABLE IF NOT EXISTS t2 SELECT * FROM t;
|
||||
CREATE EVENT IF NOT EXISTS e
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR
|
||||
DO SELECT now();
|
||||
DROP DATABASE mysqltest;
|
||||
CREATE DATABASE IF NOT EXISTS mysqltest;
|
||||
USE mysqltest;
|
||||
CREATE TABLE IF NOT EXISTS t(c1 int);
|
||||
CREATE TABLE IF NOT EXISTS t1 LIKE t;
|
||||
CREATE TABLE IF NOT EXISTS t2 SELECT * FROM t;
|
||||
CREATE EVENT IF NOT EXISTS e
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR
|
||||
DO SELECT now();
|
||||
SHOW TABLES in mysqltest;
|
||||
Tables_in_mysqltest
|
||||
t
|
||||
t1
|
||||
t2
|
||||
SHOW EVENTS in mysqltest;
|
||||
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
|
||||
mysqltest e root@localhost SYSTEM ONE TIME # NULL NULL NULL NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
DROP DATABASE IF EXISTS mysqltest;
|
|
@ -0,0 +1,22 @@
|
|||
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 DATABASE IF EXISTS mysqltest;
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp(c1 int);
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp(c1 int);
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp1 LIKE tmp;
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp1 LIKE tmp;
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp2 SELECT * FROM tmp;
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp2 SELECT * FROM tmp;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # DROP DATABASE IF EXISTS mysqltest
|
||||
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS tmp(c1 int)
|
||||
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS tmp(c1 int)
|
||||
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS tmp1 LIKE tmp
|
||||
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS tmp1 LIKE tmp
|
||||
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS tmp2 SELECT * FROM tmp
|
||||
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS tmp2 SELECT * FROM tmp
|
|
@ -43,7 +43,7 @@ master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS db_bug_13684.t
|
|||
master-bin.000001 # Query # # DROP DATABASE IF EXISTS db_bug_13684
|
||||
master-bin.000001 # Query # # CREATE DATABASE db_bug_13684
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE db_bug_13684.t (a int)
|
||||
master-bin.000001 # Query # # use `test`; CREATE EVENT db_bug_13684.e
|
||||
master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` EVENT db_bug_13684.e
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR
|
||||
DO
|
||||
UPDATE db_bug_13684.t SET a = a + 1
|
||||
|
@ -75,7 +75,7 @@ master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS db_bug_13684.t
|
|||
master-bin.000001 # Query # # DROP DATABASE IF EXISTS db_bug_13684
|
||||
master-bin.000001 # Query # # CREATE DATABASE db_bug_13684
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE db_bug_13684.t (a int)
|
||||
master-bin.000001 # Query # # use `test`; CREATE EVENT db_bug_13684.e
|
||||
master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` EVENT db_bug_13684.e
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR
|
||||
DO
|
||||
UPDATE db_bug_13684.t SET a = a + 1
|
||||
|
|
|
@ -5,6 +5,7 @@ reset slave;
|
|||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
create database if not exists mysqltest;
|
||||
use mysqltest;
|
||||
create temporary table mysqltest.t1 (n int)ENGINE=MyISAM;
|
||||
create temporary table mysqltest.t2 (n int)ENGINE=MyISAM;
|
||||
show status like 'Slave_open_temp_tables';
|
||||
|
|
|
@ -191,5 +191,63 @@ select * from t28953;
|
|||
END;|
|
||||
ALTER EVENT event1 RENAME TO event2;
|
||||
DROP EVENT event2;
|
||||
CREATE TABLE test.t1(details CHAR(30));
|
||||
CREATE EVENT /*!50000 event44331_1 */
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP
|
||||
ON COMPLETION PRESERVE DISABLE
|
||||
DO INSERT INTO test.t1 VALUES('event event44331_1 fired - no definer');
|
||||
CREATE DEFINER=CURRENT_USER /*!50000 EVENT event44331_2 */
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP
|
||||
ON COMPLETION PRESERVE DISABLE
|
||||
DO INSERT INTO test.t1 VALUES('event event44331_2 fired - DEFINER=CURRENT_USER');
|
||||
CREATE DEFINER=CURRENT_USER() EVENT event44331_3
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP
|
||||
ON COMPLETION PRESERVE DISABLE
|
||||
DO INSERT INTO test.t1 VALUES('event event44331_3 fired - DEFINER=CURRENT_USER() function');
|
||||
CREATE /*!50000 DEFINER='user44331' */ EVENT event44331_4
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP
|
||||
ON COMPLETION PRESERVE DISABLE
|
||||
DO INSERT INTO test.t1 VALUES('event event44331_4 fired - DEFINER=user1');
|
||||
Warnings:
|
||||
Note 1449 The user specified as a definer ('user44331'@'%') does not exist
|
||||
#on master
|
||||
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
||||
where EVENT_NAME='event44331_1';
|
||||
EVENT_SCHEMA EVENT_NAME DEFINER
|
||||
test event44331_1 root@localhost
|
||||
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
||||
where EVENT_NAME='event44331_2';
|
||||
EVENT_SCHEMA EVENT_NAME DEFINER
|
||||
test event44331_2 root@localhost
|
||||
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
||||
where EVENT_NAME='event44331_3';
|
||||
EVENT_SCHEMA EVENT_NAME DEFINER
|
||||
test event44331_3 root@localhost
|
||||
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
||||
where EVENT_NAME='event44331_4';
|
||||
EVENT_SCHEMA EVENT_NAME DEFINER
|
||||
test event44331_4 user44331@%
|
||||
#on slave
|
||||
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
||||
where EVENT_NAME='event44331_1';
|
||||
EVENT_SCHEMA EVENT_NAME DEFINER
|
||||
test event44331_1 root@localhost
|
||||
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
||||
where EVENT_NAME='event44331_2';
|
||||
EVENT_SCHEMA EVENT_NAME DEFINER
|
||||
test event44331_2 root@localhost
|
||||
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
||||
where EVENT_NAME='event44331_3';
|
||||
EVENT_SCHEMA EVENT_NAME DEFINER
|
||||
test event44331_3 root@localhost
|
||||
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
||||
where EVENT_NAME='event44331_4';
|
||||
EVENT_SCHEMA EVENT_NAME DEFINER
|
||||
test event44331_4 user44331@%
|
||||
SET @@global.event_scheduler= @old_event_scheduler;
|
||||
DROP TABLE t28953;
|
||||
DROP TABLE t1;
|
||||
DROP EVENT event44331_1;
|
||||
DROP EVENT event44331_2;
|
||||
DROP EVENT event44331_3;
|
||||
DROP EVENT event44331_4;
|
||||
|
|
|
@ -690,7 +690,7 @@ test_rpl e1 root@localhost SYSTEM RECURRING NULL 1 # # NULL ENABLED 1 latin1 lat
|
|||
USE test_rpl;
|
||||
SHOW EVENTS;
|
||||
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
|
||||
test_rpl e1 @ SYSTEM RECURRING NULL 1 # # NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
test_rpl e1 root@localhost SYSTEM RECURRING NULL 1 # # NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
==========MASTER==========
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
|
@ -963,7 +963,9 @@ master-bin.000001 # Xid 1 # #
|
|||
master-bin.000001 # Query 1 # BEGIN
|
||||
master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
|
||||
master-bin.000001 # Xid 1 # #
|
||||
master-bin.000001 # Query 1 # BEGIN
|
||||
master-bin.000001 # Query 1 # use `test_rpl`; TRUNCATE t1
|
||||
master-bin.000001 # Xid 1 # #
|
||||
master-bin.000001 # Query 1 # BEGIN
|
||||
master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t1
|
||||
master-bin.000001 # Xid 1 # #
|
||||
|
@ -1076,7 +1078,7 @@ master-bin.000001 # Query 1 # use `test_rpl`; GRANT EVENT ON *.* TO 'root'@'loca
|
|||
master-bin.000001 # Query 1 # BEGIN
|
||||
master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t1 VALUES(1, 'test1')
|
||||
master-bin.000001 # Xid 1 # #
|
||||
master-bin.000001 # Query 1 # use `test_rpl`; CREATE EVENT e1 ON SCHEDULE EVERY '1' SECOND COMMENT 'e_second_comment' DO DELETE FROM t1
|
||||
master-bin.000001 # Query 1 # use `test_rpl`; CREATE DEFINER=`root`@`localhost` EVENT e1 ON SCHEDULE EVERY '1' SECOND COMMENT 'e_second_comment' DO DELETE FROM t1
|
||||
master-bin.000001 # Query 1 # use `test_rpl`; ALTER EVENT e1 RENAME TO e2
|
||||
master-bin.000001 # Query 1 # use `test_rpl`; DROP EVENT e2
|
||||
master-bin.000001 # Query 1 # BEGIN
|
||||
|
|
|
@ -35,3 +35,44 @@ C3BF
|
|||
D0AA
|
||||
D0AA
|
||||
drop table t1;
|
||||
-------------test bug#45516------------------
|
||||
DROP DATABASE IF EXISTS mysqltest;
|
||||
CREATE DATABASE mysqltest CHARSET UTF8;
|
||||
USE mysqltest;
|
||||
CREATE TABLE t (cl varchar(100)) CHARSET UTF8;
|
||||
LOAD DATA LOCAL INFILE './std_data/loaddata_utf8.dat' INTO TABLE t
|
||||
FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
|
||||
----------content on master----------
|
||||
SELECT hex(cl) FROM t;
|
||||
hex(cl)
|
||||
E4B880E4BA8CE4B889
|
||||
E59B9BE4BA94E585AD
|
||||
E4B883E585ABE4B99D
|
||||
----------content on slave----------
|
||||
USE mysqltest;
|
||||
SELECT hex(cl) FROM t;
|
||||
hex(cl)
|
||||
E4B880E4BA8CE4B889
|
||||
E59B9BE4BA94E585AD
|
||||
E4B883E585ABE4B99D
|
||||
DROP DATABASE mysqltest;
|
||||
DROP DATABASE IF EXISTS mysqltest;
|
||||
CREATE DATABASE mysqltest CHARSET UTF8;
|
||||
USE mysqltest;
|
||||
CREATE TABLE t (cl varchar(100)) CHARSET UTF8;
|
||||
LOAD DATA INFILE '../../std_data/loaddata_utf8.dat' INTO TABLE t
|
||||
FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
|
||||
----------content on master----------
|
||||
SELECT hex(cl) FROM t;
|
||||
hex(cl)
|
||||
E4B880E4BA8CE4B889
|
||||
E59B9BE4BA94E585AD
|
||||
E4B883E585ABE4B99D
|
||||
----------content on slave----------
|
||||
USE mysqltest;
|
||||
SELECT hex(cl) FROM t;
|
||||
hex(cl)
|
||||
E4B880E4BA8CE4B889
|
||||
E59B9BE4BA94E585AD
|
||||
E4B883E585ABE4B99D
|
||||
DROP DATABASE mysqltest;
|
||||
|
|
|
@ -90,5 +90,132 @@ a b
|
|||
2 row 2
|
||||
3 row 3
|
||||
0
|
||||
set sql_log_bin= 0;
|
||||
drop database rewrite;
|
||||
set sql_log_bin= 1;
|
||||
set sql_log_bin= 0;
|
||||
drop table t1;
|
||||
set sql_log_bin= 1;
|
||||
|
||||
****
|
||||
**** Bug #46861 Auto-closing of temporary tables broken by replicate-rewrite-db
|
||||
****
|
||||
|
||||
****
|
||||
**** Preparing the environment
|
||||
****
|
||||
SET sql_log_bin= 0;
|
||||
CREATE DATABASE database_master_temp_01;
|
||||
CREATE DATABASE database_master_temp_02;
|
||||
CREATE DATABASE database_master_temp_03;
|
||||
SET sql_log_bin= 1;
|
||||
SET sql_log_bin= 0;
|
||||
CREATE DATABASE database_slave_temp_01;
|
||||
CREATE DATABASE database_slave_temp_02;
|
||||
CREATE DATABASE database_slave_temp_03;
|
||||
SET sql_log_bin= 1;
|
||||
|
||||
****
|
||||
**** Creating temporary tables on different databases with different connections
|
||||
****
|
||||
**** con_temp_01 --> creates
|
||||
**** t_01_01_temp on database_master_temp_01
|
||||
****
|
||||
**** con_temp_02 --> creates
|
||||
**** t_01_01_temp on database_master_temp_01
|
||||
**** t_02_01_temp, t_02_02_temp on database_master_temp_02
|
||||
****
|
||||
**** con_temp_02 --> creates
|
||||
**** t_01_01_temp on database_master_temp_01
|
||||
**** t_02_01_temp, t_02_02_temp on database_master_temp_02
|
||||
**** t_03_01_temp, t_03_02_temp, t_03_03_temp on database_master_temp_03
|
||||
****
|
||||
|
||||
con_temp_01
|
||||
|
||||
USE database_master_temp_01;
|
||||
CREATE TEMPORARY TABLE t_01_01_temp(a int);
|
||||
INSERT INTO t_01_01_temp VALUES(1);
|
||||
|
||||
con_temp_02
|
||||
|
||||
USE database_master_temp_01;
|
||||
CREATE TEMPORARY TABLE t_01_01_temp(a int);
|
||||
INSERT INTO t_01_01_temp VALUES(1);
|
||||
USE database_master_temp_02;
|
||||
CREATE TEMPORARY TABLE t_02_01_temp(a int);
|
||||
INSERT INTO t_02_01_temp VALUES(1);
|
||||
CREATE TEMPORARY TABLE t_02_02_temp(a int);
|
||||
INSERT INTO t_02_02_temp VALUES(1);
|
||||
|
||||
con_temp_03
|
||||
|
||||
USE database_master_temp_01;
|
||||
CREATE TEMPORARY TABLE t_01_01_temp(a int);
|
||||
INSERT INTO t_01_01_temp VALUES(1);
|
||||
USE database_master_temp_02;
|
||||
CREATE TEMPORARY TABLE t_02_01_temp(a int);
|
||||
INSERT INTO t_02_01_temp VALUES(1);
|
||||
CREATE TEMPORARY TABLE t_02_02_temp(a int);
|
||||
INSERT INTO t_02_02_temp VALUES(1);
|
||||
USE database_master_temp_03;
|
||||
CREATE TEMPORARY TABLE t_03_01_temp(a int);
|
||||
INSERT INTO t_03_01_temp VALUES(1);
|
||||
CREATE TEMPORARY TABLE t_03_02_temp(a int);
|
||||
INSERT INTO t_03_02_temp VALUES(1);
|
||||
CREATE TEMPORARY TABLE t_03_03_temp(a int);
|
||||
INSERT INTO t_03_03_temp VALUES(1);
|
||||
|
||||
**** Dropping the connections
|
||||
**** We want to SHOW BINLOG EVENTS, to know what was logged. But there is no
|
||||
**** guarantee that logging of the terminated con1 has been done yet.a To be
|
||||
**** sure that logging has been done, we use a user lock.
|
||||
|
||||
show status like 'Slave_open_temp_tables';
|
||||
Variable_name Value
|
||||
Slave_open_temp_tables 10
|
||||
select get_lock("con_01",10);
|
||||
get_lock("con_01",10)
|
||||
1
|
||||
select get_lock("con_01",10);
|
||||
get_lock("con_01",10)
|
||||
1
|
||||
select get_lock("con_02",10);
|
||||
get_lock("con_02",10)
|
||||
1
|
||||
select get_lock("con_02",10);
|
||||
get_lock("con_02",10)
|
||||
1
|
||||
select get_lock("con_03",10);
|
||||
get_lock("con_03",10)
|
||||
1
|
||||
select get_lock("con_03",10);
|
||||
get_lock("con_03",10)
|
||||
1
|
||||
|
||||
**** Checking the binary log and temporary tables
|
||||
|
||||
show status like 'Slave_open_temp_tables';
|
||||
Variable_name Value
|
||||
Slave_open_temp_tables 0
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `database_master_temp_01`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t_01_01_temp`
|
||||
master-bin.000001 # Query # # use `database_master_temp_02`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t_02_02_temp`,`t_02_01_temp`
|
||||
master-bin.000001 # Query # # use `database_master_temp_01`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t_01_01_temp`
|
||||
master-bin.000001 # Query # # use `database_master_temp_03`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t_03_03_temp`,`t_03_02_temp`,`t_03_01_temp`
|
||||
master-bin.000001 # Query # # use `database_master_temp_02`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t_02_02_temp`,`t_02_01_temp`
|
||||
master-bin.000001 # Query # # use `database_master_temp_01`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t_01_01_temp`
|
||||
****
|
||||
**** Cleaning up the test case
|
||||
****
|
||||
SET sql_log_bin= 0;
|
||||
DROP DATABASE database_master_temp_01;
|
||||
DROP DATABASE database_master_temp_02;
|
||||
DROP DATABASE database_master_temp_03;
|
||||
SET sql_log_bin= 1;
|
||||
SET sql_log_bin= 0;
|
||||
DROP DATABASE database_slave_temp_01;
|
||||
DROP DATABASE database_slave_temp_02;
|
||||
DROP DATABASE database_slave_temp_03;
|
||||
SET sql_log_bin= 1;
|
||||
|
|
870
mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result
Normal file
870
mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result
Normal file
|
@ -0,0 +1,870 @@
|
|||
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;
|
||||
###################################################################################
|
||||
# CONFIGURATION
|
||||
###################################################################################
|
||||
SET SQL_LOG_BIN=0;
|
||||
CREATE TABLE nt_1 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
|
||||
CREATE TABLE nt_2 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
|
||||
CREATE TABLE nt_3 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
|
||||
CREATE TABLE nt_4 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
|
||||
CREATE TABLE tt_1 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
|
||||
CREATE TABLE tt_2 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
|
||||
CREATE TABLE tt_3 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
|
||||
CREATE TABLE tt_4 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
|
||||
SET SQL_LOG_BIN=1;
|
||||
SET SQL_LOG_BIN=0;
|
||||
CREATE TABLE nt_1 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
|
||||
CREATE TABLE nt_2 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
|
||||
CREATE TABLE nt_3 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
|
||||
CREATE TABLE nt_4 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
|
||||
CREATE TABLE tt_1 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
|
||||
CREATE TABLE tt_2 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
|
||||
CREATE TABLE tt_3 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
|
||||
CREATE TABLE tt_4 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
|
||||
SET SQL_LOG_BIN=1;
|
||||
CREATE FUNCTION f1 () RETURNS VARCHAR(64)
|
||||
BEGIN
|
||||
RETURN "Testing...";
|
||||
END|
|
||||
CREATE FUNCTION f2 () RETURNS VARCHAR(64)
|
||||
BEGIN
|
||||
RETURN f1();
|
||||
END|
|
||||
CREATE PROCEDURE pc_i_tt_3 (IN x INT, IN y VARCHAR(64))
|
||||
BEGIN
|
||||
INSERT INTO tt_3 VALUES (y,x,x);
|
||||
END|
|
||||
CREATE TRIGGER tr_i_tt_3_to_nt_3 BEFORE INSERT ON tt_3 FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO nt_3 VALUES (NEW.a, NEW.b, NEW.c);
|
||||
END|
|
||||
CREATE TRIGGER tr_i_nt_4_to_tt_4 BEFORE INSERT ON nt_4 FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO tt_4 VALUES (NEW.a, NEW.b, NEW.c);
|
||||
END|
|
||||
###################################################################################
|
||||
# MIXING TRANSACTIONAL and NON-TRANSACTIONAL TABLES
|
||||
###################################################################################
|
||||
#
|
||||
#1) "B T T C" generates in binlog the "B T T C" entries.
|
||||
#
|
||||
BEGIN;
|
||||
INSERT INTO tt_1 VALUES ("new text 4", 4, "new text 4");
|
||||
INSERT INTO tt_2 VALUES ("new text 4", 4, "new text 4");
|
||||
COMMIT;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 4", 4, "new text 4")
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 4", 4, "new text 4")
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
#1.e) "B T T C" with error in T generates in binlog the "B T T C" entries.
|
||||
#
|
||||
INSERT INTO tt_1 VALUES ("new text -2", -2, "new text -2");
|
||||
BEGIN;
|
||||
INSERT INTO tt_1 VALUES ("new text -1", -1, "new text -1"), ("new text -2", -2, "new text -2");
|
||||
ERROR 23000: Duplicate entry '-2' for key 'PRIMARY'
|
||||
INSERT INTO tt_2 VALUES ("new text -3", -3, "new text -3");
|
||||
COMMIT;
|
||||
BEGIN;
|
||||
INSERT INTO tt_2 VALUES ("new text -5", -5, "new text -5");
|
||||
INSERT INTO tt_2 VALUES ("new text -4", -4, "new text -4"), ("new text -5", -5, "new text -5");
|
||||
ERROR 23000: Duplicate entry '-5' for key 'PRIMARY'
|
||||
COMMIT;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text -2", -2, "new text -2")
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text -3", -3, "new text -3")
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text -5", -5, "new text -5")
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
#2) "B T T R" generates in binlog an "empty" entry.
|
||||
#
|
||||
BEGIN;
|
||||
INSERT INTO tt_1 VALUES ("new text 5", 5, "new text 5");
|
||||
INSERT INTO tt_2 VALUES ("new text 5", 5, "new text 5");
|
||||
ROLLBACK;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
#2.e) "B T T R" with error in T generates in binlog an "empty" entry.
|
||||
#
|
||||
INSERT INTO tt_1 VALUES ("new text -7", -7, "new text -7");
|
||||
BEGIN;
|
||||
INSERT INTO tt_1 VALUES ("new text -6", -6, "new text -6"), ("new text -7", -7, "new text -7");
|
||||
ERROR 23000: Duplicate entry '-7' for key 'PRIMARY'
|
||||
INSERT INTO tt_2 VALUES ("new text -8", -8, "new text -8");
|
||||
ROLLBACK;
|
||||
BEGIN;
|
||||
INSERT INTO tt_2 VALUES ("new text -10", -10, "new text -10");
|
||||
INSERT INTO tt_2 VALUES ("new text -9", -9, "new text -9"), ("new text -10", -10, "new text -10");
|
||||
ERROR 23000: Duplicate entry '-10' for key 'PRIMARY'
|
||||
ROLLBACK;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text -7", -7, "new text -7")
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
#3) "B T N C" generates in binlog the "B T N C" entries.
|
||||
#
|
||||
BEGIN;
|
||||
INSERT INTO tt_1 VALUES ("new text 6", 6, "new text 6");
|
||||
INSERT INTO nt_1 VALUES ("new text 6", 6, "new text 6");
|
||||
COMMIT;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 6", 6, "new text 6")
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text 6", 6, "new text 6")
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
#3.e) "B T N C" with error in either T or N generates in binlog the "B T N C" entries.
|
||||
#
|
||||
INSERT INTO tt_1 VALUES ("new text -12", -12, "new text -12");
|
||||
BEGIN;
|
||||
INSERT INTO tt_1 VALUES ("new text -11", -11, "new text -11"), ("new text -12", -12, "new text -12");
|
||||
ERROR 23000: Duplicate entry '-12' for key 'PRIMARY'
|
||||
INSERT INTO nt_1 VALUES ("new text -13", -13, "new text -13");
|
||||
COMMIT;
|
||||
BEGIN;
|
||||
INSERT INTO tt_1 VALUES ("new text -14", -14, "new text -14");
|
||||
INSERT INTO nt_1 VALUES ("new text -16", -16, "new text -16");
|
||||
INSERT INTO nt_1 VALUES ("new text -15", -15, "new text -15"), ("new text -16", -16, "new text -16");
|
||||
ERROR 23000: Duplicate entry '-16' for key 'PRIMARY'
|
||||
COMMIT;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text -12", -12, "new text -12")
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text -13", -13, "new text -13")
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text -14", -14, "new text -14")
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text -16", -16, "new text -16")
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text -15", -15, "new text -15"), ("new text -16", -16, "new text -16")
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
#4) "B T N R" generates in binlog the "B T N R" entries.
|
||||
#
|
||||
BEGIN;
|
||||
INSERT INTO tt_1 VALUES ("new text 7", 7, "new text 7");
|
||||
INSERT INTO nt_1 VALUES ("new text 7", 7, "new text 7");
|
||||
ROLLBACK;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 7", 7, "new text 7")
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text 7", 7, "new text 7")
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
#4.e) "B T N R" with error in either T or N generates in binlog the "B T N R" entries.
|
||||
#
|
||||
INSERT INTO tt_1 VALUES ("new text -17", -17, "new text -17");
|
||||
BEGIN;
|
||||
INSERT INTO tt_1 VALUES ("new text -16", -16, "new text -16"), ("new text -17", -17, "new text -17");
|
||||
ERROR 23000: Duplicate entry '-17' for key 'PRIMARY'
|
||||
INSERT INTO nt_1 VALUES ("new text -18", -18, "new text -18");
|
||||
ROLLBACK;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
BEGIN;
|
||||
INSERT INTO tt_1 VALUES ("new text -19", -19, "new text -19");
|
||||
INSERT INTO nt_1 VALUES ("new text -21", -21, "new text -21");
|
||||
INSERT INTO nt_1 VALUES ("new text -20", -20, "new text -20"), ("new text -21", -21, "new text -21");
|
||||
ERROR 23000: Duplicate entry '-21' for key 'PRIMARY'
|
||||
ROLLBACK;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text -17", -17, "new text -17")
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text -18", -18, "new text -18")
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text -19", -19, "new text -19")
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text -21", -21, "new text -21")
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text -20", -20, "new text -20"), ("new text -21", -21, "new text -21")
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
#5) "T" generates in binlog the "B T C" entry.
|
||||
#
|
||||
INSERT INTO tt_1 VALUES ("new text 8", 8, "new text 8");
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 8", 8, "new text 8")
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
#5.e) "T" with error in T generates in binlog an "empty" entry.
|
||||
#
|
||||
INSERT INTO tt_1 VALUES ("new text -1", -1, "new text -1");
|
||||
INSERT INTO tt_1 VALUES ("new text -1", -1, "new text -1"), ("new text -22", -22, "new text -22");
|
||||
ERROR 23000: Duplicate entry '-1' for key 'PRIMARY'
|
||||
INSERT INTO tt_1 VALUES ("new text -23", -23, "new text -23"), ("new text -1", -1, "new text -1");
|
||||
ERROR 23000: Duplicate entry '-1' for key 'PRIMARY'
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text -1", -1, "new text -1")
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
#6) "N" generates in binlog the "N" entry.
|
||||
#
|
||||
INSERT INTO nt_1 VALUES ("new text 9", 9, "new text 9");
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text 9", 9, "new text 9")
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
#6.e) "N" with error in N generates in binlog an empty entry if the error
|
||||
# happens in the first tuple. Otherwise, generates the "N" entry and
|
||||
# the error is appended.
|
||||
#
|
||||
INSERT INTO nt_1 VALUES ("new text -1", -1, "new text -1");
|
||||
INSERT INTO nt_1 VALUES ("new text -1", -1, "new text -1");
|
||||
ERROR 23000: Duplicate entry '-1' for key 'PRIMARY'
|
||||
INSERT INTO nt_1 VALUES ("new text -24", -24, "new text -24"), ("new text -1", -1, "new text -1");
|
||||
ERROR 23000: Duplicate entry '-1' for key 'PRIMARY'
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text -1", -1, "new text -1")
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text -24", -24, "new text -24"), ("new text -1", -1, "new text -1")
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
#7) "M" generates in binglog the "B M C" entries.
|
||||
#
|
||||
DELETE FROM nt_1;
|
||||
INSERT INTO nt_1 SELECT * FROM tt_1;
|
||||
DELETE FROM tt_1;
|
||||
INSERT INTO tt_1 SELECT * FROM nt_1;
|
||||
INSERT INTO tt_3 VALUES ("new text 000", 000, '');
|
||||
INSERT INTO tt_3 VALUES("new text 100", 100, f1());
|
||||
INSERT INTO nt_4 VALUES("new text 100", 100, f1());
|
||||
INSERT INTO tt_3 VALUES("new text 200", 200, f2());
|
||||
INSERT INTO nt_4 VALUES ("new text 300", 300, '');
|
||||
INSERT INTO nt_4 VALUES ("new text 400", 400, f1());
|
||||
INSERT INTO nt_4 VALUES ("new text 500", 500, f2());
|
||||
CALL pc_i_tt_3(600, "Testing...");
|
||||
UPDATE nt_3, nt_4, tt_3, tt_4 SET nt_3.a= "new text 1", nt_4.a= "new text 1", tt_3.a= "new text 1", tt_4.a= "new text 1" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
UPDATE tt_3, tt_4, nt_3, nt_4 SET tt_3.a= "new text 2", tt_4.a= "new text 2", nt_3.a= "new text 2", nt_4.a = "new text 2" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 3", nt_3.a= "new text 3", nt_4.a= "new text 3", tt_4.a = "new text 3" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 4", nt_3.a= "new text 4", nt_4.a= "new text 4", tt_4.a = "new text 4" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; DELETE FROM nt_1
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 SELECT * FROM tt_1
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; DELETE FROM tt_1
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 SELECT * FROM nt_1
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES ("new text 000", 000, '')
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES("new text 100", 100, f1())
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_4 VALUES("new text 100", 100, f1())
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES("new text 200", 200, f2())
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_4 VALUES ("new text 300", 300, '')
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_4 VALUES ("new text 400", 400, f1())
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_4 VALUES ("new text 500", 500, f2())
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES ( NAME_CONST('y',_latin1'Testing...' COLLATE 'latin1_swedish_ci'), NAME_CONST('x',600), NAME_CONST('x',600))
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; UPDATE nt_3, nt_4, tt_3, tt_4 SET nt_3.a= "new text 1", nt_4.a= "new text 1", tt_3.a= "new text 1", tt_4.a= "new text 1" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; UPDATE tt_3, tt_4, nt_3, nt_4 SET tt_3.a= "new text 2", tt_4.a= "new text 2", nt_3.a= "new text 2", nt_4.a = "new text 2" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 3", nt_3.a= "new text 3", nt_4.a= "new text 3", tt_4.a = "new text 3" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 4", nt_3.a= "new text 4", nt_4.a= "new text 4", tt_4.a = "new text 4" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
#7.e) "M" with error in M generates in binglog the "B M R" entries.
|
||||
#
|
||||
INSERT INTO nt_3 VALUES ("new text -26", -26, '');
|
||||
SELECT * FROM tt_3;
|
||||
a b c
|
||||
new text 000 0
|
||||
new text 4 100 Testing...
|
||||
new text 200 200 Testing...
|
||||
Testing... 600 600
|
||||
INSERT INTO tt_3 VALUES ("new text -25", -25, ''), ("new text -26", -26, '');
|
||||
ERROR 23000: Duplicate entry '-26' for key 'PRIMARY'
|
||||
SELECT * FROM tt_3;
|
||||
a b c
|
||||
new text 000 0
|
||||
new text 4 100 Testing...
|
||||
new text 200 200 Testing...
|
||||
Testing... 600 600
|
||||
INSERT INTO tt_4 VALUES ("new text -26", -26, '');
|
||||
SELECT * FROM nt_4;
|
||||
a b c
|
||||
new text 4 100 Testing...
|
||||
new text 300 300
|
||||
new text 400 400 Testing...
|
||||
new text 500 500 Testing...
|
||||
INSERT INTO nt_4 VALUES ("new text -25", -25, ''), ("new text -26", -26, '');
|
||||
ERROR 23000: Duplicate entry '-26' for key 'PRIMARY'
|
||||
SELECT * FROM nt_4;
|
||||
a b c
|
||||
new text 4 100 Testing...
|
||||
new text 300 300
|
||||
new text 400 400 Testing...
|
||||
new text 500 500 Testing...
|
||||
new text -25 -25
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_3 VALUES ("new text -26", -26, '')
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES ("new text -25", -25, ''), ("new text -26", -26, '')
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_4 VALUES ("new text -26", -26, '')
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_4 VALUES ("new text -25", -25, ''), ("new text -26", -26, '')
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
#8) "B N N T C" generates in binglog the "N N B T C" entries.
|
||||
#
|
||||
BEGIN;
|
||||
INSERT INTO nt_1 VALUES ("new text 10", 10, "new text 10");
|
||||
INSERT INTO nt_2 VALUES ("new text 10", 10, "new text 10");
|
||||
INSERT INTO tt_1 VALUES ("new text 10", 10, "new text 10");
|
||||
COMMIT;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text 10", 10, "new text 10")
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_2 VALUES ("new text 10", 10, "new text 10")
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 10", 10, "new text 10")
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
#8.e) "B N N T R" See 6.e and 9.e.
|
||||
#
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
#9) "B N N T R" generates in binlog the "N N B T R" entries.
|
||||
#
|
||||
BEGIN;
|
||||
INSERT INTO nt_1 VALUES ("new text 11", 11, "new text 11");
|
||||
INSERT INTO nt_2 VALUES ("new text 11", 11, "new text 11");
|
||||
INSERT INTO tt_1 VALUES ("new text 11", 11, "new text 11");
|
||||
ROLLBACK;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text 11", 11, "new text 11")
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_2 VALUES ("new text 11", 11, "new text 11")
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 11", 11, "new text 11")
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
#9.e) "B N N T R" with error in N generates in binlog the "N N B T R" entries.
|
||||
#
|
||||
BEGIN;
|
||||
INSERT INTO nt_1 VALUES ("new text -25", -25, "new text -25");
|
||||
INSERT INTO nt_2 VALUES ("new text -25", -25, "new text -25");
|
||||
INSERT INTO nt_2 VALUES ("new text -26", -26, "new text -26"), ("new text -25", -25, "new text -25");
|
||||
ERROR 23000: Duplicate entry '-25' for key 'PRIMARY'
|
||||
INSERT INTO tt_1 VALUES ("new text -27", -27, "new text -27");
|
||||
ROLLBACK;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text -25", -25, "new text -25")
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_2 VALUES ("new text -25", -25, "new text -25")
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_2 VALUES ("new text -26", -26, "new text -26"), ("new text -25", -25, "new text -25")
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text -27", -27, "new text -27")
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
#10) "B N N C" generates in binglog the "N N" entries.
|
||||
#
|
||||
BEGIN;
|
||||
INSERT INTO nt_1 VALUES ("new text 12", 12, "new text 12");
|
||||
INSERT INTO nt_2 VALUES ("new text 12", 12, "new text 12");
|
||||
COMMIT;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text 12", 12, "new text 12")
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_2 VALUES ("new text 12", 12, "new text 12")
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
#10.e) "B N N C" See 6.e and 9.e.
|
||||
#
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
#11) "B N N R" generates in binlog the "N N" entries.
|
||||
#
|
||||
BEGIN;
|
||||
INSERT INTO nt_1 VALUES ("new text 13", 13, "new text 13");
|
||||
INSERT INTO nt_2 VALUES ("new text 13", 13, "new text 13");
|
||||
ROLLBACK;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text 13", 13, "new text 13")
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_2 VALUES ("new text 13", 13, "new text 13")
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
#11.e) "B N N R" See 6.e and 9.e.
|
||||
#
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
#12) "B M T C" generates in the binlog the "B M T C" entries.
|
||||
#
|
||||
DELETE FROM nt_1;
|
||||
BEGIN;
|
||||
INSERT INTO nt_1 SELECT * FROM tt_1;
|
||||
INSERT INTO tt_2 VALUES ("new text 14", 14, "new text 14");
|
||||
COMMIT;
|
||||
DELETE FROM tt_1;
|
||||
BEGIN;
|
||||
INSERT INTO tt_1 SELECT * FROM nt_1;
|
||||
INSERT INTO tt_2 VALUES ("new text 15", 15, "new text 15");
|
||||
COMMIT;
|
||||
BEGIN;
|
||||
INSERT INTO tt_3 VALUES ("new text 700", 700, '');
|
||||
INSERT INTO tt_1 VALUES ("new text 800", 800, '');
|
||||
COMMIT;
|
||||
BEGIN;
|
||||
INSERT INTO tt_3 VALUES("new text 900", 900, f1());
|
||||
INSERT INTO tt_1 VALUES ("new text 1000", 1000, '');
|
||||
COMMIT;
|
||||
BEGIN;
|
||||
INSERT INTO tt_3 VALUES(1100, 1100, f2());
|
||||
INSERT INTO tt_1 VALUES ("new text 1200", 1200, '');
|
||||
COMMIT;
|
||||
BEGIN;
|
||||
INSERT INTO nt_4 VALUES ("new text 1300", 1300, '');
|
||||
INSERT INTO tt_1 VALUES ("new text 1400", 1400, '');
|
||||
COMMIT;
|
||||
BEGIN;
|
||||
INSERT INTO nt_4 VALUES("new text 1500", 1500, f1());
|
||||
INSERT INTO tt_1 VALUES ("new text 1600", 1600, '');
|
||||
COMMIT;
|
||||
BEGIN;
|
||||
INSERT INTO nt_4 VALUES("new text 1700", 1700, f2());
|
||||
INSERT INTO tt_1 VALUES ("new text 1800", 1800, '');
|
||||
COMMIT;
|
||||
BEGIN;
|
||||
CALL pc_i_tt_3(1900, "Testing...");
|
||||
INSERT INTO tt_1 VALUES ("new text 2000", 2000, '');
|
||||
COMMIT;
|
||||
BEGIN;
|
||||
UPDATE nt_3, nt_4, tt_3, tt_4 SET nt_3.a= "new text 5", nt_4.a= "new text 5", tt_3.a= "new text 5", tt_4.a= "new text 5" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
INSERT INTO tt_1 VALUES ("new text 2100", 2100, '');
|
||||
COMMIT;
|
||||
BEGIN;
|
||||
UPDATE tt_3, tt_4, nt_3, nt_4 SET tt_3.a= "new text 6", tt_4.a= "new text 6", nt_3.a= "new text 6", nt_4.a = "new text 6" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
INSERT INTO tt_1 VALUES ("new text 2200", 2200, '');
|
||||
COMMIT;
|
||||
BEGIN;
|
||||
UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 7", nt_3.a= "new text 7", nt_4.a= "new text 7", tt_4.a = "new text 7" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
INSERT INTO tt_1 VALUES ("new text 2300", 2300, '');
|
||||
COMMIT;
|
||||
BEGIN;
|
||||
UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 8", nt_3.a= "new text 8", nt_4.a= "new text 8", tt_4.a = "new text 8" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
INSERT INTO tt_1 VALUES ("new text 2400", 2400, '');
|
||||
COMMIT;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; DELETE FROM nt_1
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 SELECT * FROM tt_1
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 14", 14, "new text 14")
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; DELETE FROM tt_1
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 SELECT * FROM nt_1
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 15", 15, "new text 15")
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES ("new text 700", 700, '')
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 800", 800, '')
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES("new text 900", 900, f1())
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 1000", 1000, '')
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES(1100, 1100, f2())
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 1200", 1200, '')
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_4 VALUES ("new text 1300", 1300, '')
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 1400", 1400, '')
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_4 VALUES("new text 1500", 1500, f1())
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 1600", 1600, '')
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_4 VALUES("new text 1700", 1700, f2())
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 1800", 1800, '')
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES ( NAME_CONST('y',_latin1'Testing...' COLLATE 'latin1_swedish_ci'), NAME_CONST('x',1900), NAME_CONST('x',1900))
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 2000", 2000, '')
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; UPDATE nt_3, nt_4, tt_3, tt_4 SET nt_3.a= "new text 5", nt_4.a= "new text 5", tt_3.a= "new text 5", tt_4.a= "new text 5" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 2100", 2100, '')
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; UPDATE tt_3, tt_4, nt_3, nt_4 SET tt_3.a= "new text 6", tt_4.a= "new text 6", nt_3.a= "new text 6", nt_4.a = "new text 6" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 2200", 2200, '')
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 7", nt_3.a= "new text 7", nt_4.a= "new text 7", tt_4.a = "new text 7" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 2300", 2300, '')
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 8", nt_3.a= "new text 8", nt_4.a= "new text 8", tt_4.a = "new text 8" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 2400", 2400, '')
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
#12.e) "B M T C" with error in M generates in the binlog the "B M T C" entries.
|
||||
#
|
||||
# There is a bug in the slave that needs to be fixed before enabling
|
||||
# this part of the test. A bug report will be filed referencing this
|
||||
# test case.
|
||||
BEGIN;
|
||||
INSERT INTO nt_3 VALUES ("new text -28", -28, '');
|
||||
INSERT INTO tt_3 VALUES ("new text -27", -27, ''), ("new text -28", -28, '');
|
||||
ERROR 23000: Duplicate entry '-28' for key 'PRIMARY'
|
||||
INSERT INTO tt_1 VALUES ("new text -27", -27, '');
|
||||
COMMIT;
|
||||
BEGIN;
|
||||
INSERT INTO tt_4 VALUES ("new text -28", -28, '');
|
||||
INSERT INTO nt_4 VALUES ("new text -27", -27, ''), ("new text -28", -28, '');
|
||||
ERROR 23000: Duplicate entry '-28' for key 'PRIMARY'
|
||||
INSERT INTO tt_1 VALUES ("new text -28", -28, '');
|
||||
COMMIT;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_3 VALUES ("new text -28", -28, '')
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES ("new text -27", -27, ''), ("new text -28", -28, '')
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text -27", -27, '')
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_4 VALUES ("new text -28", -28, '')
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_4 VALUES ("new text -27", -27, ''), ("new text -28", -28, '')
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text -28", -28, '')
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
#13) "B M T R" generates in the binlog the "B M T R" entries
|
||||
#
|
||||
DELETE FROM nt_1;
|
||||
BEGIN;
|
||||
INSERT INTO nt_1 SELECT * FROM tt_1;
|
||||
INSERT INTO tt_2 VALUES ("new text 17", 17, "new text 17");
|
||||
ROLLBACK;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
DELETE FROM tt_1;
|
||||
BEGIN;
|
||||
INSERT INTO tt_1 SELECT * FROM nt_1;
|
||||
INSERT INTO tt_2 VALUES ("new text 18", 18, "new text 18");
|
||||
ROLLBACK;
|
||||
INSERT INTO tt_1 SELECT * FROM nt_1;
|
||||
BEGIN;
|
||||
INSERT INTO tt_3 VALUES ("new text 2500", 2500, '');
|
||||
INSERT INTO tt_1 VALUES ("new text 2600", 2600, '');
|
||||
ROLLBACK;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
BEGIN;
|
||||
INSERT INTO tt_3 VALUES("new text 2700", 2700, f1());
|
||||
INSERT INTO tt_1 VALUES ("new text 2800", 2800, '');
|
||||
ROLLBACK;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
BEGIN;
|
||||
INSERT INTO tt_3 VALUES(2900, 2900, f2());
|
||||
INSERT INTO tt_1 VALUES ("new text 3000", 3000, '');
|
||||
ROLLBACK;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
BEGIN;
|
||||
INSERT INTO nt_4 VALUES ("new text 3100", 3100, '');
|
||||
INSERT INTO tt_1 VALUES ("new text 3200", 3200, '');
|
||||
ROLLBACK;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
BEGIN;
|
||||
INSERT INTO nt_4 VALUES("new text 3300", 3300, f1());
|
||||
INSERT INTO tt_1 VALUES ("new text 3400", 3400, '');
|
||||
ROLLBACK;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
BEGIN;
|
||||
INSERT INTO nt_4 VALUES("new text 3500", 3500, f2());
|
||||
INSERT INTO tt_1 VALUES ("new text 3600", 3600, '');
|
||||
ROLLBACK;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
BEGIN;
|
||||
CALL pc_i_tt_3(3700, "Testing...");
|
||||
INSERT INTO tt_1 VALUES ("new text 3700", 3700, '');
|
||||
ROLLBACK;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
BEGIN;
|
||||
UPDATE nt_3, nt_4, tt_3, tt_4 SET nt_3.a= "new text 9", nt_4.a= "new text 9", tt_3.a= "new text 9", tt_4.a= "new text 9" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
INSERT INTO tt_1 VALUES ("new text 3800", 3800, '');
|
||||
ROLLBACK;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
BEGIN;
|
||||
UPDATE tt_3, tt_4, nt_3, nt_4 SET tt_3.a= "new text 10", tt_4.a= "new text 10", nt_3.a= "new text 10", nt_4.a = "new text 10" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
INSERT INTO tt_1 VALUES ("new text 3900", 3900, '');
|
||||
ROLLBACK;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
BEGIN;
|
||||
UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 11", nt_3.a= "new text 11", nt_4.a= "new text 11", tt_4.a = "new text 11" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
INSERT INTO tt_1 VALUES ("new text 4000", 4000, '');
|
||||
ROLLBACK;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
BEGIN;
|
||||
UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 12", nt_3.a= "new text 12", nt_4.a= "new text 12", tt_4.a = "new text 12" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
INSERT INTO tt_1 VALUES ("new text 4100", 4100, '');
|
||||
ROLLBACK;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; DELETE FROM nt_1
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 SELECT * FROM tt_1
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 17", 17, "new text 17")
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; DELETE FROM tt_1
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 SELECT * FROM nt_1
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES ("new text 2500", 2500, '')
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 2600", 2600, '')
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES("new text 2700", 2700, f1())
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 2800", 2800, '')
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES(2900, 2900, f2())
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 3000", 3000, '')
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_4 VALUES ("new text 3100", 3100, '')
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 3200", 3200, '')
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_4 VALUES("new text 3300", 3300, f1())
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 3400", 3400, '')
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_4 VALUES("new text 3500", 3500, f2())
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 3600", 3600, '')
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES ( NAME_CONST('y',_latin1'Testing...' COLLATE 'latin1_swedish_ci'), NAME_CONST('x',3700), NAME_CONST('x',3700))
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 3700", 3700, '')
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; UPDATE nt_3, nt_4, tt_3, tt_4 SET nt_3.a= "new text 9", nt_4.a= "new text 9", tt_3.a= "new text 9", tt_4.a= "new text 9" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 3800", 3800, '')
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; UPDATE tt_3, tt_4, nt_3, nt_4 SET tt_3.a= "new text 10", tt_4.a= "new text 10", nt_3.a= "new text 10", nt_4.a = "new text 10" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 3900", 3900, '')
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 11", nt_3.a= "new text 11", nt_4.a= "new text 11", tt_4.a = "new text 11" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 4000", 4000, '')
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 12", nt_3.a= "new text 12", nt_4.a= "new text 12", tt_4.a = "new text 12" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 4100", 4100, '')
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
#13.e) "B M T R" with error in M generates in the binlog the "B M T R" entries.
|
||||
#
|
||||
BEGIN;
|
||||
INSERT INTO nt_3 VALUES ("new text -30", -30, '');
|
||||
INSERT INTO tt_3 VALUES ("new text -29", -29, ''), ("new text -30", -30, '');
|
||||
ERROR 23000: Duplicate entry '-30' for key 'PRIMARY'
|
||||
INSERT INTO tt_1 VALUES ("new text -30", -30, '');
|
||||
ROLLBACK;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
BEGIN;
|
||||
INSERT INTO tt_4 VALUES ("new text -30", -30, '');
|
||||
INSERT INTO nt_4 VALUES ("new text -29", -29, ''), ("new text -30", -30, '');
|
||||
ERROR 23000: Duplicate entry '-30' for key 'PRIMARY'
|
||||
INSERT INTO tt_1 VALUES ("new text -31", -31, '');
|
||||
ROLLBACK;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_3 VALUES ("new text -30", -30, '')
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES ("new text -29", -29, ''), ("new text -30", -30, '')
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text -30", -30, '')
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_4 VALUES ("new text -30", -30, '')
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO nt_4 VALUES ("new text -29", -29, ''), ("new text -30", -30, '')
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text -31", -31, '')
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
###################################################################################
|
||||
# CLEAN
|
||||
###################################################################################
|
||||
DROP TABLE tt_1;
|
||||
DROP TABLE tt_2;
|
||||
DROP TABLE tt_3;
|
||||
DROP TABLE tt_4;
|
||||
DROP TABLE nt_1;
|
||||
DROP TABLE nt_2;
|
||||
DROP TABLE nt_3;
|
||||
DROP TABLE nt_4;
|
||||
DROP PROCEDURE pc_i_tt_3;
|
||||
DROP FUNCTION f1;
|
||||
DROP FUNCTION f2;
|
|
@ -125,14 +125,13 @@ while ($type)
|
|||
connection master;
|
||||
sync_slave_with_master;
|
||||
|
||||
# Re-enable this after fixing BUG#46130
|
||||
#connection master;
|
||||
#let $diff_statement= SELECT * FROM t order by i;
|
||||
#source include/diff_master_slave.inc;
|
||||
connection master;
|
||||
let $diff_statement= SELECT * FROM t order by i;
|
||||
source include/diff_master_slave.inc;
|
||||
|
||||
#connection master;
|
||||
#let $diff_statement= SELECT * FROM n order by d, f;
|
||||
#source include/diff_master_slave.inc;
|
||||
connection master;
|
||||
let $diff_statement= SELECT * FROM n order by d, f;
|
||||
source include/diff_master_slave.inc;
|
||||
|
||||
--echo ########################################################################
|
||||
--echo # Cleanup
|
||||
|
|
70
mysql-test/suite/rpl/t/rpl_create_if_not_exists.test
Normal file
70
mysql-test/suite/rpl/t/rpl_create_if_not_exists.test
Normal file
|
@ -0,0 +1,70 @@
|
|||
# BUG#45574:
|
||||
# SP: CREATE DATABASE|TABLE IF NOT EXISTS not binlogged if routine exists.
|
||||
#
|
||||
# There is an inconsistency with DROP DATABASE|TABLE|EVENT IF EXISTS and
|
||||
# CREATE DATABASE|TABLE|EVENT IF NOT EXISTS. DROP IF EXISTS statements are
|
||||
# binlogged even if either the DB, TABLE or EVENT does not exist. In
|
||||
# contrast, Only the CREATE EVENT IF NOT EXISTS is binlogged when the EVENT
|
||||
# exists.
|
||||
#
|
||||
# This problem caused some of the tests to fail randomly on PB or PB2.
|
||||
#
|
||||
# Description:
|
||||
# Fixed this bug by adding calls to write_bin_log in:
|
||||
# mysql_create_db
|
||||
# mysql_create_table_no_lock
|
||||
# mysql_create_like_table
|
||||
# create_table_from_items
|
||||
#
|
||||
# Test is implemented as follows:
|
||||
# i) test each "CREATE IF NOT EXISTS" (DDL), found in MySQL 5.1 manual
|
||||
# exclude CREATE TEMPORARY TABLE, on existent objects;
|
||||
#
|
||||
# Note:
|
||||
# rpl_create_tmp_table_if_not_exists.test tests CREATE TEMPORARY TABLE cases.
|
||||
#
|
||||
# References:
|
||||
# http://dev.mysql.com/doc/refman/5.1/en/sql-syntax-data-definition.html
|
||||
#
|
||||
|
||||
source include/master-slave.inc;
|
||||
disable_warnings;
|
||||
DROP DATABASE IF EXISTS mysqltest;
|
||||
|
||||
CREATE DATABASE IF NOT EXISTS mysqltest;
|
||||
USE mysqltest;
|
||||
CREATE TABLE IF NOT EXISTS t(c1 int);
|
||||
CREATE TABLE IF NOT EXISTS t1 LIKE t;
|
||||
CREATE TABLE IF NOT EXISTS t2 SELECT * FROM t;
|
||||
CREATE EVENT IF NOT EXISTS e
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR
|
||||
DO SELECT now();
|
||||
sync_slave_with_master;
|
||||
|
||||
connection slave;
|
||||
#DROP database from slave.
|
||||
#The database and all tables can be recreated in slave
|
||||
#if binlog of the second CREATE command is recorded and sent from master to slave.
|
||||
DROP DATABASE mysqltest;
|
||||
|
||||
connection master;
|
||||
CREATE DATABASE IF NOT EXISTS mysqltest;
|
||||
USE mysqltest;
|
||||
CREATE TABLE IF NOT EXISTS t(c1 int);
|
||||
CREATE TABLE IF NOT EXISTS t1 LIKE t;
|
||||
CREATE TABLE IF NOT EXISTS t2 SELECT * FROM t;
|
||||
CREATE EVENT IF NOT EXISTS e
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR
|
||||
DO SELECT now();
|
||||
sync_slave_with_master;
|
||||
|
||||
connection slave;
|
||||
SHOW TABLES in mysqltest;
|
||||
#Execution time changes in each run. So we disregard it by calling replace_column.
|
||||
replace_column 6 #;
|
||||
SHOW EVENTS in mysqltest;
|
||||
|
||||
|
||||
connection master;
|
||||
DROP DATABASE IF EXISTS mysqltest;
|
||||
source include/master-slave-end.inc;
|
|
@ -0,0 +1,41 @@
|
|||
# BUG#45574:
|
||||
# SP: CREATE DATABASE|TABLE IF NOT EXISTS not binlogged if routine exists.
|
||||
#
|
||||
# There is an inconsistency with DROP DATABASE|TABLE|EVENT IF EXISTS and
|
||||
# CREATE DATABASE|TABLE|EVENT IF NOT EXISTS. DROP IF EXISTS statements are
|
||||
# binlogged even if either the DB, TABLE or EVENT does not exist. In
|
||||
# contrast, Only the CREATE EVENT IF NOT EXISTS is binlogged when the EVENT
|
||||
# exists.
|
||||
#
|
||||
# This problem caused some of the tests to fail randomly on PB or PB2.
|
||||
#
|
||||
# Test is implemented as follows:
|
||||
#
|
||||
# i) test each "CREATE TEMPORARY TABLE IF EXISTS" (DDL), found in MySQL
|
||||
# 5.1 manual, on existent objects;
|
||||
# ii) show binlog events;
|
||||
#
|
||||
# Note:
|
||||
# rpl_create_if_not_exists.test tests other cases.
|
||||
#
|
||||
# References:
|
||||
# http://dev.mysql.com/doc/refman/5.1/en/sql-syntax-data-definition.html
|
||||
#
|
||||
|
||||
source include/master-slave.inc;
|
||||
#CREATE TEMPORARY TABLE statements are not binlogged in row mode,
|
||||
#So it must be test by itself.
|
||||
source include/have_binlog_format_mixed_or_statement.inc;
|
||||
disable_warnings;
|
||||
|
||||
DROP DATABASE IF EXISTS mysqltest;
|
||||
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp(c1 int);
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp(c1 int);
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp1 LIKE tmp;
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp1 LIKE tmp;
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp2 SELECT * FROM tmp;
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp2 SELECT * FROM tmp;
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
source include/master-slave-end.inc;
|
|
@ -12,21 +12,23 @@ source include/have_binlog_format_mixed_or_statement.inc;
|
|||
create database if not exists mysqltest;
|
||||
--enable_warnings
|
||||
|
||||
connect (con_temp,127.0.0.1,root,,test,$MASTER_MYPORT,);
|
||||
|
||||
connection con_temp;
|
||||
use mysqltest;
|
||||
create temporary table mysqltest.t1 (n int)ENGINE=MyISAM;
|
||||
create temporary table mysqltest.t2 (n int)ENGINE=MyISAM;
|
||||
|
||||
disconnect con_temp;
|
||||
--source include/wait_until_disconnected.inc
|
||||
|
||||
connection master;
|
||||
disconnect master;
|
||||
|
||||
connection master1;
|
||||
# Wait until drop of temp tables appears in binlog
|
||||
let $wait_binlog_event= DROP;
|
||||
source include/wait_for_binlog_event.inc;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
connection slave;
|
||||
show status like 'Slave_open_temp_tables';
|
||||
# Cleanup
|
||||
connection default;
|
||||
connection master;
|
||||
drop database mysqltest;
|
||||
sync_slave_with_master;
|
||||
|
||||
|
|
|
@ -46,12 +46,62 @@ connection master;
|
|||
|
||||
DROP EVENT event2;
|
||||
|
||||
sync_slave_with_master;
|
||||
#
|
||||
# BUG#44331
|
||||
# This test verifies if the definer is consistent between master and slave,
|
||||
# when the event is created without the DEFINER clause set explicitly or the
|
||||
# DEFINER is set to CURRENT_USER
|
||||
#
|
||||
CREATE TABLE test.t1(details CHAR(30));
|
||||
|
||||
# Doing cleanup of the table referred to in the event to guarantee
|
||||
# that there is no bad timing cauing it to try to access the table.
|
||||
CREATE EVENT /*!50000 event44331_1 */
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP
|
||||
ON COMPLETION PRESERVE DISABLE
|
||||
DO INSERT INTO test.t1 VALUES('event event44331_1 fired - no definer');
|
||||
|
||||
CREATE DEFINER=CURRENT_USER /*!50000 EVENT event44331_2 */
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP
|
||||
ON COMPLETION PRESERVE DISABLE
|
||||
DO INSERT INTO test.t1 VALUES('event event44331_2 fired - DEFINER=CURRENT_USER');
|
||||
|
||||
CREATE DEFINER=CURRENT_USER() EVENT event44331_3
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP
|
||||
ON COMPLETION PRESERVE DISABLE
|
||||
DO INSERT INTO test.t1 VALUES('event event44331_3 fired - DEFINER=CURRENT_USER() function');
|
||||
|
||||
CREATE /*!50000 DEFINER='user44331' */ EVENT event44331_4
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP
|
||||
ON COMPLETION PRESERVE DISABLE
|
||||
DO INSERT INTO test.t1 VALUES('event event44331_4 fired - DEFINER=user1');
|
||||
|
||||
--echo #on master
|
||||
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
||||
where EVENT_NAME='event44331_1';
|
||||
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
||||
where EVENT_NAME='event44331_2';
|
||||
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
||||
where EVENT_NAME='event44331_3';
|
||||
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
||||
where EVENT_NAME='event44331_4';
|
||||
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
--echo #on slave
|
||||
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
||||
where EVENT_NAME='event44331_1';
|
||||
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
||||
where EVENT_NAME='event44331_2';
|
||||
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
||||
where EVENT_NAME='event44331_3';
|
||||
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
||||
where EVENT_NAME='event44331_4';
|
||||
|
||||
connection master;
|
||||
SET @@global.event_scheduler= @old_event_scheduler;
|
||||
DROP TABLE t28953;
|
||||
DROP TABLE t1;
|
||||
DROP EVENT event44331_1;
|
||||
DROP EVENT event44331_2;
|
||||
DROP EVENT event44331_3;
|
||||
DROP EVENT event44331_4;
|
||||
sync_slave_with_master;
|
||||
|
|
|
@ -31,3 +31,20 @@ select hex(a) from t1;
|
|||
connection master;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
#
|
||||
# Bug#45516
|
||||
# When slave SQL thread executing LOAD DATA command, the
|
||||
# thd->variables.collation_database was not set properly to the default
|
||||
# database charset
|
||||
#
|
||||
|
||||
echo -------------test bug#45516------------------;
|
||||
|
||||
# LOAD DATA INFILE
|
||||
let $LOAD_LOCAL=1;
|
||||
source include/rpl_loaddata_charset.inc;
|
||||
|
||||
# LOAD DATA LOCAL INFILE
|
||||
let $LOAD_LOCAL=0;
|
||||
source include/rpl_loaddata_charset.inc;
|
||||
|
|
|
@ -1 +1 @@
|
|||
"--replicate-rewrite-db=test->rewrite" "--replicate-rewrite-db=mysqltest1->test"
|
||||
"--replicate-rewrite-db=test->rewrite" "--replicate-rewrite-db=mysqltest1->test" "--replicate-rewrite-db=database_master_temp_01->database_slave_temp_01" "--replicate-rewrite-db=database_master_temp_02->database_slave_temp_02" "--replicate-rewrite-db=database_master_temp_03->database_slave_temp_03"
|
||||
|
|
|
@ -76,9 +76,164 @@ connection slave;
|
|||
# The empty line last comes from the end line field in the file
|
||||
select * from rewrite.t1;
|
||||
|
||||
set sql_log_bin= 0;
|
||||
drop database rewrite;
|
||||
set sql_log_bin= 1;
|
||||
|
||||
connection master;
|
||||
set sql_log_bin= 0;
|
||||
drop table t1;
|
||||
set sql_log_bin= 1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
--echo
|
||||
--echo ****
|
||||
--echo **** Bug #46861 Auto-closing of temporary tables broken by replicate-rewrite-db
|
||||
--echo ****
|
||||
--echo
|
||||
|
||||
--echo ****
|
||||
--echo **** Preparing the environment
|
||||
--echo ****
|
||||
connection master;
|
||||
|
||||
connect (con_temp_03,127.0.0.1,root,,test,$MASTER_MYPORT,);
|
||||
connect (con_temp_02,127.0.0.1,root,,test,$MASTER_MYPORT,);
|
||||
connect (con_temp_01,127.0.0.1,root,,test,$MASTER_MYPORT,);
|
||||
|
||||
connection master;
|
||||
SET sql_log_bin= 0;
|
||||
CREATE DATABASE database_master_temp_01;
|
||||
CREATE DATABASE database_master_temp_02;
|
||||
CREATE DATABASE database_master_temp_03;
|
||||
SET sql_log_bin= 1;
|
||||
|
||||
connection slave;
|
||||
SET sql_log_bin= 0;
|
||||
CREATE DATABASE database_slave_temp_01;
|
||||
CREATE DATABASE database_slave_temp_02;
|
||||
CREATE DATABASE database_slave_temp_03;
|
||||
SET sql_log_bin= 1;
|
||||
|
||||
--echo
|
||||
--echo ****
|
||||
--echo **** Creating temporary tables on different databases with different connections
|
||||
--echo ****
|
||||
--echo **** con_temp_01 --> creates
|
||||
--echo **** t_01_01_temp on database_master_temp_01
|
||||
--echo ****
|
||||
--echo **** con_temp_02 --> creates
|
||||
--echo **** t_01_01_temp on database_master_temp_01
|
||||
--echo **** t_02_01_temp, t_02_02_temp on database_master_temp_02
|
||||
--echo ****
|
||||
--echo **** con_temp_02 --> creates
|
||||
--echo **** t_01_01_temp on database_master_temp_01
|
||||
--echo **** t_02_01_temp, t_02_02_temp on database_master_temp_02
|
||||
--echo **** t_03_01_temp, t_03_02_temp, t_03_03_temp on database_master_temp_03
|
||||
--echo ****
|
||||
|
||||
--echo
|
||||
--echo con_temp_01
|
||||
--echo
|
||||
connection con_temp_01;
|
||||
USE database_master_temp_01;
|
||||
CREATE TEMPORARY TABLE t_01_01_temp(a int);
|
||||
INSERT INTO t_01_01_temp VALUES(1);
|
||||
|
||||
--echo
|
||||
--echo con_temp_02
|
||||
--echo
|
||||
connection con_temp_02;
|
||||
USE database_master_temp_01;
|
||||
CREATE TEMPORARY TABLE t_01_01_temp(a int);
|
||||
INSERT INTO t_01_01_temp VALUES(1);
|
||||
USE database_master_temp_02;
|
||||
CREATE TEMPORARY TABLE t_02_01_temp(a int);
|
||||
INSERT INTO t_02_01_temp VALUES(1);
|
||||
CREATE TEMPORARY TABLE t_02_02_temp(a int);
|
||||
INSERT INTO t_02_02_temp VALUES(1);
|
||||
|
||||
--echo
|
||||
--echo con_temp_03
|
||||
--echo
|
||||
connection con_temp_03;
|
||||
USE database_master_temp_01;
|
||||
CREATE TEMPORARY TABLE t_01_01_temp(a int);
|
||||
INSERT INTO t_01_01_temp VALUES(1);
|
||||
USE database_master_temp_02;
|
||||
CREATE TEMPORARY TABLE t_02_01_temp(a int);
|
||||
INSERT INTO t_02_01_temp VALUES(1);
|
||||
CREATE TEMPORARY TABLE t_02_02_temp(a int);
|
||||
INSERT INTO t_02_02_temp VALUES(1);
|
||||
USE database_master_temp_03;
|
||||
CREATE TEMPORARY TABLE t_03_01_temp(a int);
|
||||
INSERT INTO t_03_01_temp VALUES(1);
|
||||
CREATE TEMPORARY TABLE t_03_02_temp(a int);
|
||||
INSERT INTO t_03_02_temp VALUES(1);
|
||||
CREATE TEMPORARY TABLE t_03_03_temp(a int);
|
||||
INSERT INTO t_03_03_temp VALUES(1);
|
||||
|
||||
--echo
|
||||
--echo **** Dropping the connections
|
||||
--echo **** We want to SHOW BINLOG EVENTS, to know what was logged. But there is no
|
||||
--echo **** guarantee that logging of the terminated con1 has been done yet.a To be
|
||||
--echo **** sure that logging has been done, we use a user lock.
|
||||
--echo
|
||||
connection master;
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
show status like 'Slave_open_temp_tables';
|
||||
|
||||
connection master;
|
||||
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
connection con_temp_01;
|
||||
select get_lock("con_01",10);
|
||||
connection master;
|
||||
disconnect con_temp_01;
|
||||
select get_lock("con_01",10);
|
||||
|
||||
connection con_temp_02;
|
||||
select get_lock("con_02",10);
|
||||
connection master;
|
||||
disconnect con_temp_02;
|
||||
select get_lock("con_02",10);
|
||||
|
||||
connection con_temp_03;
|
||||
select get_lock("con_03",10);
|
||||
connection master;
|
||||
disconnect con_temp_03;
|
||||
select get_lock("con_03",10);
|
||||
|
||||
--echo
|
||||
--echo **** Checking the binary log and temporary tables
|
||||
--echo
|
||||
connection master;
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
show status like 'Slave_open_temp_tables';
|
||||
|
||||
connection master;
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo ****
|
||||
--echo **** Cleaning up the test case
|
||||
--echo ****
|
||||
connection master;
|
||||
SET sql_log_bin= 0;
|
||||
DROP DATABASE database_master_temp_01;
|
||||
DROP DATABASE database_master_temp_02;
|
||||
DROP DATABASE database_master_temp_03;
|
||||
SET sql_log_bin= 1;
|
||||
|
||||
connection slave;
|
||||
SET sql_log_bin= 0;
|
||||
DROP DATABASE database_slave_temp_01;
|
||||
DROP DATABASE database_slave_temp_02;
|
||||
DROP DATABASE database_slave_temp_03;
|
||||
SET sql_log_bin= 1;
|
||||
|
||||
connection master;
|
||||
sync_slave_with_master;
|
||||
|
||||
# end of 5.0 tests
|
||||
|
|
5
mysql-test/suite/rpl/t/rpl_stm_mixing_engines.test
Normal file
5
mysql-test/suite/rpl/t/rpl_stm_mixing_engines.test
Normal file
|
@ -0,0 +1,5 @@
|
|||
--source include/have_binlog_format_statement.inc
|
||||
--source include/master-slave.inc
|
||||
--source include/have_innodb.inc
|
||||
|
||||
--source extra/rpl_tests/rpl_mixing_engines.test
|
|
@ -14,6 +14,7 @@ create table t2 select * from t1 procedure analyse();
|
|||
select * from t2;
|
||||
drop table t1,t2;
|
||||
|
||||
--error ER_WRONG_USAGE
|
||||
EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE();
|
||||
|
||||
#
|
||||
|
@ -102,4 +103,13 @@ select f2 from t1 procedure analyse(1, 1);
|
|||
select f3 from t1 procedure analyse(1, 1);
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#46184 Crash, SELECT ... FROM derived table procedure analyze
|
||||
#
|
||||
CREATE TABLE t1(a INT,b INT,c INT,d INT,e INT,f INT,g INT,h INT,i INT,j INT,k INT);
|
||||
INSERT INTO t1 VALUES ();
|
||||
--error ER_WRONG_USAGE
|
||||
SELECT * FROM (SELECT * FROM t1) d PROCEDURE ANALYSE();
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 4.1 tests
|
||||
|
|
|
@ -324,3 +324,21 @@ insert into t1 values(null,0,0,0,null);
|
|||
replace into t1 values(null,1,0,2,null);
|
||||
select last_insert_id();
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#46616: Assertion `!table->auto_increment_field_not_null' on view
|
||||
--echo # manipulations
|
||||
--echo #
|
||||
CREATE TABLE t1 ( a INT );
|
||||
INSERT INTO t1 VALUES (1), (1);
|
||||
|
||||
CREATE TABLE t2 ( a INT AUTO_INCREMENT KEY );
|
||||
--error ER_DUP_ENTRY
|
||||
CREATE TABLE IF NOT EXISTS t2 AS SELECT a FROM t1;
|
||||
|
||||
UPDATE t2 SET a = 2;
|
||||
|
||||
SELECT a FROM t2;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
|
|
|
@ -1018,3 +1018,18 @@ DROP TABLE t;
|
|||
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
--echo #
|
||||
--echo # Bug #46607: Assertion failed: (cond_type == Item::FUNC_ITEM) results in
|
||||
--echo # server crash
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t (a INT, b INT, INDEX (a,b));
|
||||
INSERT INTO t VALUES (2,0), (2,0), (2,1), (2,1);
|
||||
INSERT INTO t SELECT * FROM t;
|
||||
|
||||
SELECT a, MAX(b) FROM t WHERE b GROUP BY a;
|
||||
|
||||
DROP TABLE t;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
|
|
@ -19,3 +19,22 @@ let $other_engine_type= MEMORY;
|
|||
let $other_handler_engine_type= MyISAM;
|
||||
|
||||
--source include/handler.inc
|
||||
|
||||
--echo #
|
||||
--echo # BUG #46456: HANDLER OPEN + TRUNCATE + DROP (temporary) TABLE, crash
|
||||
--echo #
|
||||
CREATE TABLE t1 AS SELECT 1 AS f1;
|
||||
HANDLER t1 OPEN;
|
||||
TRUNCATE t1;
|
||||
--error ER_UNKNOWN_TABLE
|
||||
HANDLER t1 READ FIRST;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TEMPORARY TABLE t1 AS SELECT 1 AS f1;
|
||||
HANDLER t1 OPEN;
|
||||
TRUNCATE t1;
|
||||
--error ER_UNKNOWN_TABLE
|
||||
HANDLER t1 READ FIRST;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
# Save the initial number of concurrent sessions
|
||||
--source include/count_sessions.inc
|
||||
|
||||
SET @odl_sync_frm = @@global.sync_frm;
|
||||
SET @@global.sync_frm = OFF;
|
||||
|
||||
connect (locker,localhost,root,,);
|
||||
connect (writer,localhost,root,,);
|
||||
|
||||
|
@ -214,6 +217,8 @@ DROP TABLE t1;
|
|||
--disconnect locker
|
||||
--disconnect writer
|
||||
|
||||
SET @@global.sync_frm = @odl_sync_frm;
|
||||
|
||||
# End of 5.0 tests
|
||||
|
||||
# Wait till all disconnects are completed
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
# Save the initial number of concurrent sessions
|
||||
--source include/count_sessions.inc
|
||||
|
||||
SET @odl_sync_frm = @@global.sync_frm;
|
||||
SET @@global.sync_frm = OFF;
|
||||
|
||||
# Test to see if select will get the lock ahead of low priority update
|
||||
|
||||
connect (locker,localhost,root,,);
|
||||
|
@ -136,6 +139,8 @@ DROP TABLE t1, t2, t3;
|
|||
--disconnect locker
|
||||
--disconnect writer
|
||||
|
||||
SET @@global.sync_frm = @odl_sync_frm;
|
||||
|
||||
# Wait till all disconnects are completed
|
||||
--source include/wait_until_count_sessions.inc
|
||||
|
||||
|
|
|
@ -1622,4 +1622,15 @@ DROP TABLE m1,t1,t2,t3,t4,t5,t6,t7;
|
|||
--error ER_NO_SUCH_TABLE
|
||||
SELECT 1 FROM m1; # Should not hang!
|
||||
|
||||
--echo #
|
||||
--echo # Bug #46614: Assertion in show_create_trigger()
|
||||
--echo #
|
||||
CREATE TABLE t1(a int);
|
||||
CREATE TABLE t2(a int);
|
||||
CREATE TABLE t3(a int) ENGINE = MERGE UNION(t1, t2);
|
||||
CREATE TRIGGER tr1 AFTER INSERT ON t3 FOR EACH ROW CALL foo();
|
||||
SHOW CREATE TRIGGER tr1;
|
||||
DROP TRIGGER tr1;
|
||||
DROP TABLE t1, t2, t3;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
|
|
@ -1,12 +1,35 @@
|
|||
--disable_abort_on_error
|
||||
# Run this tets only when mysqld don't has partitioning
|
||||
# Run this test only when mysqld don't has partitioning (not compiled with)
|
||||
# the statements are not expected to work, just check that we
|
||||
# can't crash the server
|
||||
-- require r/not_partition.require
|
||||
disable_query_log;
|
||||
show variables like "have_partitioning";
|
||||
enable_query_log;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
let $MYSQLD_DATADIR= `SELECT @@datadir`;
|
||||
|
||||
#
|
||||
# Bug#39893: Crash if select on a partitioned table,
|
||||
# when partitioning is disabled
|
||||
FLUSH TABLES;
|
||||
--copy_file $MYSQLTEST_VARDIR/std_data/parts/t1.frm $MYSQLD_DATADIR/test/t1.frm
|
||||
SELECT * FROM t1;
|
||||
TRUNCATE TABLE t1;
|
||||
ANALYZE TABLE t1;
|
||||
CHECK TABLE t1;
|
||||
OPTIMIZE TABLE t1;
|
||||
REPAIR TABLE t1;
|
||||
ALTER TABLE t1 REPAIR PARTITION ALL;
|
||||
ALTER TABLE t1 CHECK PARTITION ALL;
|
||||
ALTER TABLE t1 OPTIMIZE PARTITION ALL;
|
||||
ALTER TABLE t1 ANALYZE PARTITION ALL;
|
||||
ALTER TABLE t1 REBUILD PARTITION ALL;
|
||||
ALTER TABLE t1 ENGINE Memory;
|
||||
ALTER TABLE t1 ADD (new INT);
|
||||
DROP TABLE t1;
|
||||
|
||||
--error ER_FEATURE_DISABLED
|
||||
CREATE TABLE t1 (
|
||||
|
|
|
@ -14,6 +14,53 @@
|
|||
drop table if exists t1, t2;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Bug#46639: 1030 (HY000): Got error 124 from storage engine on
|
||||
# INSERT ... SELECT ...
|
||||
CREATE TABLE t1 (
|
||||
a int NOT NULL,
|
||||
b int NOT NULL);
|
||||
|
||||
CREATE TABLE t2 (
|
||||
a int NOT NULL,
|
||||
b int NOT NULL,
|
||||
INDEX(b)
|
||||
)
|
||||
PARTITION BY HASH(a) PARTITIONS 2;
|
||||
|
||||
INSERT INTO t1 VALUES (399, 22);
|
||||
INSERT INTO t2 VALUES (1, 22), (1, 42);
|
||||
|
||||
INSERT INTO t2 SELECT 1, 399 FROM t2, t1
|
||||
WHERE t1.b = t2.b;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
#
|
||||
# Bug#46478: timestamp field incorrectly defaulted when partition is reorganized
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
b varchar(10),
|
||||
PRIMARY KEY (a)
|
||||
)
|
||||
PARTITION BY RANGE (to_days(a)) (
|
||||
PARTITION p1 VALUES LESS THAN (733407),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE
|
||||
);
|
||||
|
||||
INSERT INTO t1 VALUES ('2007-07-30 17:35:48', 'p1');
|
||||
INSERT INTO t1 VALUES ('2009-07-14 17:35:55', 'pmax');
|
||||
INSERT INTO t1 VALUES ('2009-09-21 17:31:42', 'pmax');
|
||||
|
||||
SELECT * FROM t1;
|
||||
ALTER TABLE t1 REORGANIZE PARTITION pmax INTO (
|
||||
PARTITION p3 VALUES LESS THAN (733969),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
SELECT * FROM t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#36001: Partitions: spelling and using some error messages
|
||||
#
|
||||
|
|
1
mysql-test/t/partition_disabled-master.opt
Normal file
1
mysql-test/t/partition_disabled-master.opt
Normal file
|
@ -0,0 +1 @@
|
|||
--loose-skip-partition
|
85
mysql-test/t/partition_disabled.test
Normal file
85
mysql-test/t/partition_disabled.test
Normal file
|
@ -0,0 +1,85 @@
|
|||
--disable_abort_on_error
|
||||
# Run this test only when mysqld has partitioning, but it is disabled.
|
||||
# The statements are not expected to work, just check that we
|
||||
# can't crash the server.
|
||||
--require r/disabled_partition.require
|
||||
--disable_query_log
|
||||
show variables like "have_partitioning";
|
||||
--enable_query_log
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
let $MYSQLD_DATADIR= `SELECT @@datadir`;
|
||||
|
||||
#
|
||||
# Bug#39893: Crash if select on a partitioned table,
|
||||
# when partitioning is disabled
|
||||
FLUSH TABLES;
|
||||
--copy_file $MYSQLTEST_VARDIR/std_data/parts/t1.frm $MYSQLD_DATADIR/test/t1.frm
|
||||
SELECT * FROM t1;
|
||||
TRUNCATE TABLE t1;
|
||||
ANALYZE TABLE t1;
|
||||
CHECK TABLE t1;
|
||||
OPTIMIZE TABLE t1;
|
||||
REPAIR TABLE t1;
|
||||
ALTER TABLE t1 REPAIR PARTITION ALL;
|
||||
ALTER TABLE t1 CHECK PARTITION ALL;
|
||||
ALTER TABLE t1 OPTIMIZE PARTITION ALL;
|
||||
ALTER TABLE t1 ANALYZE PARTITION ALL;
|
||||
ALTER TABLE t1 REBUILD PARTITION ALL;
|
||||
ALTER TABLE t1 ENGINE Memory;
|
||||
ALTER TABLE t1 ADD (new INT);
|
||||
DROP TABLE t1;
|
||||
|
||||
--error ER_OPTION_PREVENTS_STATEMENT
|
||||
CREATE TABLE t1 (
|
||||
firstname VARCHAR(25) NOT NULL,
|
||||
lastname VARCHAR(25) NOT NULL,
|
||||
username VARCHAR(16) NOT NULL,
|
||||
email VARCHAR(35),
|
||||
joined DATE NOT NULL
|
||||
)
|
||||
PARTITION BY KEY(joined)
|
||||
PARTITIONS 6;
|
||||
|
||||
--error ER_OPTION_PREVENTS_STATEMENT
|
||||
ALTER TABLE t1 PARTITION BY KEY(joined) PARTITIONS 2;
|
||||
|
||||
--error ER_BAD_TABLE_ERROR
|
||||
drop table t1;
|
||||
|
||||
--error ER_OPTION_PREVENTS_STATEMENT
|
||||
CREATE TABLE t1 (
|
||||
firstname VARCHAR(25) NOT NULL,
|
||||
lastname VARCHAR(25) NOT NULL,
|
||||
username VARCHAR(16) NOT NULL,
|
||||
email VARCHAR(35),
|
||||
joined DATE NOT NULL
|
||||
)
|
||||
PARTITION BY RANGE( YEAR(joined) ) (
|
||||
PARTITION p0 VALUES LESS THAN (1960),
|
||||
PARTITION p1 VALUES LESS THAN (1970),
|
||||
PARTITION p2 VALUES LESS THAN (1980),
|
||||
PARTITION p3 VALUES LESS THAN (1990),
|
||||
PARTITION p4 VALUES LESS THAN MAXVALUE
|
||||
);
|
||||
--error ER_BAD_TABLE_ERROR
|
||||
drop table t1;
|
||||
|
||||
--error ER_OPTION_PREVENTS_STATEMENT
|
||||
CREATE TABLE t1 (id INT, purchased DATE)
|
||||
PARTITION BY RANGE( YEAR(purchased) )
|
||||
SUBPARTITION BY HASH( TO_DAYS(purchased) )
|
||||
SUBPARTITIONS 2 (
|
||||
PARTITION p0 VALUES LESS THAN (1990),
|
||||
PARTITION p1 VALUES LESS THAN (2000),
|
||||
PARTITION p2 VALUES LESS THAN MAXVALUE
|
||||
);
|
||||
--error ER_BAD_TABLE_ERROR
|
||||
drop table t1;
|
||||
|
||||
# Create a table without partitions to test "EXPLAIN PARTITIONS"
|
||||
create table t1 (a varchar(10) charset latin1 collate latin1_bin);
|
||||
insert into t1 values (''),(' '),('a'),('a '),('a ');
|
||||
explain partitions select * from t1 where a='a ' OR a='a';
|
||||
drop table t1;
|
|
@ -8,6 +8,357 @@
|
|||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Bug#20577: Partitions: use of to_days() function leads to selection failures
|
||||
#
|
||||
--let $explain_partitions= 1;
|
||||
--let $verify_without_partitions= 0;
|
||||
--echo # test of RANGE and index
|
||||
CREATE TABLE t1 (a DATE, KEY(a))
|
||||
PARTITION BY RANGE (TO_DAYS(a))
|
||||
(PARTITION `pNULL` VALUES LESS THAN (0),
|
||||
PARTITION `p0001-01-01` VALUES LESS THAN (366 + 1),
|
||||
PARTITION `p1001-01-01` VALUES LESS THAN (TO_DAYS('1001-01-01') + 1),
|
||||
PARTITION `p2001-01-01` VALUES LESS THAN (TO_DAYS('2001-01-01') + 1));
|
||||
if ($verify_without_partitions)
|
||||
{
|
||||
ALTER TABLE t1 REMOVE PARTITIONING;
|
||||
}
|
||||
INSERT INTO t1 VALUES ('0000-00-00'), ('0000-01-02'), ('0001-01-01'),
|
||||
('1001-00-00'), ('1001-01-01'), ('1002-00-00'), ('2001-01-01');
|
||||
--source include/partition_date_range.inc
|
||||
--echo # test without index
|
||||
ALTER TABLE t1 DROP KEY a;
|
||||
--source include/partition_date_range.inc
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo # test of LIST and index
|
||||
CREATE TABLE t1 (a DATE, KEY(a))
|
||||
PARTITION BY LIST (TO_DAYS(a))
|
||||
(PARTITION `p0001-01-01` VALUES IN (TO_DAYS('0001-01-01')),
|
||||
PARTITION `p2001-01-01` VALUES IN (TO_DAYS('2001-01-01')),
|
||||
PARTITION `pNULL` VALUES IN (NULL),
|
||||
PARTITION `p0000-01-02` VALUES IN (TO_DAYS('0000-01-02')),
|
||||
PARTITION `p1001-01-01` VALUES IN (TO_DAYS('1001-01-01')));
|
||||
if ($verify_without_partitions)
|
||||
{
|
||||
ALTER TABLE t1 REMOVE PARTITIONING;
|
||||
}
|
||||
INSERT INTO t1 VALUES ('0000-00-00'), ('0000-01-02'), ('0001-01-01'),
|
||||
('1001-00-00'), ('1001-01-01'), ('1002-00-00'), ('2001-01-01');
|
||||
--source include/partition_date_range.inc
|
||||
--echo # test without index
|
||||
ALTER TABLE t1 DROP KEY a;
|
||||
--source include/partition_date_range.inc
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#46362: Endpoint should be set to false for TO_DAYS(DATE)
|
||||
# There is a problem when comparing DATE with DATETIME.
|
||||
# In pruning it is converted into the field type
|
||||
# and in row evaluation it is converted to longlong
|
||||
# (like a DATETIME).
|
||||
--echo # Test with DATETIME column NOT NULL
|
||||
CREATE TABLE t1 (
|
||||
a int(10) unsigned NOT NULL,
|
||||
b DATETIME NOT NULL,
|
||||
PRIMARY KEY (a, b)
|
||||
) PARTITION BY RANGE (TO_DAYS(b))
|
||||
(PARTITION p20090401 VALUES LESS THAN (TO_DAYS('2009-04-02')),
|
||||
PARTITION p20090402 VALUES LESS THAN (TO_DAYS('2009-04-03')),
|
||||
PARTITION p20090403 VALUES LESS THAN (TO_DAYS('2009-04-04')),
|
||||
PARTITION p20090404 VALUES LESS THAN (TO_DAYS('2009-04-05')),
|
||||
PARTITION p20090405 VALUES LESS THAN MAXVALUE);
|
||||
INSERT INTO t1 VALUES (1, '2009-01-01'), (1, '2009-04-01'), (2, '2009-04-01'),
|
||||
(1, '2009-04-02'), (2, '2009-04-02'), (1, '2009-04-02 23:59:59'),
|
||||
(1, '2009-04-03'), (2, '2009-04-03'), (1, '2009-04-04'), (2, '2009-04-04'),
|
||||
(1, '2009-04-05'), (1, '2009-04-06'), (1, '2009-04-07');
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b > CAST('2009-04-02 23:59:58' AS DATETIME);
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo # Test with DATE column NOT NULL
|
||||
CREATE TABLE t1 (
|
||||
a int(10) unsigned NOT NULL,
|
||||
b DATE NOT NULL,
|
||||
PRIMARY KEY (a, b)
|
||||
) PARTITION BY RANGE (TO_DAYS(b))
|
||||
(PARTITION p20090401 VALUES LESS THAN (TO_DAYS('2009-04-02')),
|
||||
PARTITION p20090402 VALUES LESS THAN (TO_DAYS('2009-04-03')),
|
||||
PARTITION p20090403 VALUES LESS THAN (TO_DAYS('2009-04-04')),
|
||||
PARTITION p20090404 VALUES LESS THAN (TO_DAYS('2009-04-05')),
|
||||
PARTITION p20090405 VALUES LESS THAN MAXVALUE);
|
||||
INSERT INTO t1 VALUES (1, '2009-01-01'), (1, '2009-04-01'), (2, '2009-04-01'),
|
||||
(1, '2009-04-02'), (2, '2009-04-02'), (1, '2009-04-03'), (2, '2009-04-03'),
|
||||
(1, '2009-04-04'), (2, '2009-04-04'), (1, '2009-04-05'), (1, '2009-04-06'),
|
||||
(1, '2009-04-07');
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b > CAST('2009-04-02 23:59:58' AS DATETIME);
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo # Test with DATETIME column NULL
|
||||
CREATE TABLE t1 (
|
||||
a int(10) unsigned NOT NULL,
|
||||
b DATETIME NULL
|
||||
) PARTITION BY RANGE (TO_DAYS(b))
|
||||
(PARTITION p20090401 VALUES LESS THAN (TO_DAYS('2009-04-02')),
|
||||
PARTITION p20090402 VALUES LESS THAN (TO_DAYS('2009-04-03')),
|
||||
PARTITION p20090403 VALUES LESS THAN (TO_DAYS('2009-04-04')),
|
||||
PARTITION p20090404 VALUES LESS THAN (TO_DAYS('2009-04-05')),
|
||||
PARTITION p20090405 VALUES LESS THAN MAXVALUE);
|
||||
INSERT INTO t1 VALUES (1, '2009-01-01'), (1, '2009-04-01'), (2, '2009-04-01'),
|
||||
(1, '2009-04-02'), (2, '2009-04-02'), (1, '2009-04-02 23:59:59'),
|
||||
(1, '2009-04-03'), (2, '2009-04-03'), (1, '2009-04-04'), (2, '2009-04-04'),
|
||||
(1, '2009-04-05'), (1, '2009-04-06'), (1, '2009-04-07');
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b > CAST('2009-04-02 23:59:58' AS DATETIME);
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo # Test with DATE column NULL
|
||||
CREATE TABLE t1 (
|
||||
a int(10) unsigned NOT NULL,
|
||||
b DATE NULL
|
||||
) PARTITION BY RANGE (TO_DAYS(b))
|
||||
(PARTITION p20090401 VALUES LESS THAN (TO_DAYS('2009-04-02')),
|
||||
PARTITION p20090402 VALUES LESS THAN (TO_DAYS('2009-04-03')),
|
||||
PARTITION p20090403 VALUES LESS THAN (TO_DAYS('2009-04-04')),
|
||||
PARTITION p20090404 VALUES LESS THAN (TO_DAYS('2009-04-05')),
|
||||
PARTITION p20090405 VALUES LESS THAN MAXVALUE);
|
||||
INSERT INTO t1 VALUES (1, '2009-01-01'), (1, '2009-04-01'), (2, '2009-04-01'),
|
||||
(1, '2009-04-02'), (2, '2009-04-02'), (1, '2009-04-03'), (2, '2009-04-03'),
|
||||
(1, '2009-04-04'), (2, '2009-04-04'), (1, '2009-04-05'), (1, '2009-04-06'),
|
||||
(1, '2009-04-07');
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03';
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME);
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1
|
||||
WHERE b > CAST('2009-04-02 23:59:58' AS DATETIME);
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo # For better code coverage of the patch
|
||||
CREATE TABLE t1 (
|
||||
a int(10) unsigned NOT NULL,
|
||||
b DATE
|
||||
) PARTITION BY RANGE ( TO_DAYS(b) )
|
||||
(PARTITION p20090401 VALUES LESS THAN (TO_DAYS('2009-04-02')),
|
||||
PARTITION p20090402 VALUES LESS THAN (TO_DAYS('2009-04-03')),
|
||||
PARTITION p20090403 VALUES LESS THAN (TO_DAYS('2009-04-04')),
|
||||
PARTITION p20090404 VALUES LESS THAN (TO_DAYS('2009-04-05')),
|
||||
PARTITION p20090405 VALUES LESS THAN MAXVALUE);
|
||||
INSERT INTO t1 VALUES (1, '2009-01-01'), (2, NULL);
|
||||
--echo # test with an invalid date, which lead to item->null_value is set.
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-99' AS DATETIME);
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#40972: some sql execution lead the whole database crashing
|
||||
#
|
||||
|
|
|
@ -30,7 +30,7 @@ SELECT 1 IN (SELECT 1);
|
|||
SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
|
||||
-- error ER_WRONG_USAGE
|
||||
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
|
||||
-- error ER_WRONG_PARAMETERS_TO_PROCEDURE
|
||||
-- error ER_WRONG_USAGE
|
||||
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;
|
||||
|
@ -3336,6 +3336,38 @@ EXPLAIN EXTENDED SELECT * FROM C WHERE `int_key` IN (SELECT `int_nokey`);
|
|||
DROP TABLE C;
|
||||
--echo # End of test for bug#45061.
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Bug #46749: Segfault in add_key_fields() with outer subquery level
|
||||
--echo # field references
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (
|
||||
a int,
|
||||
b int,
|
||||
UNIQUE (a), KEY (b)
|
||||
);
|
||||
INSERT INTO t1 VALUES (1,1), (2,1);
|
||||
|
||||
CREATE TABLE st1 like t1;
|
||||
INSERT INTO st1 VALUES (1,1), (2,1);
|
||||
|
||||
CREATE TABLE st2 like t1;
|
||||
INSERT INTO st2 VALUES (1,1), (2,1);
|
||||
|
||||
# should have "impossible where"
|
||||
EXPLAIN
|
||||
SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
|
||||
FROM t1
|
||||
WHERE a = 230;
|
||||
|
||||
# should not crash
|
||||
SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
|
||||
FROM t1
|
||||
WHERE a = 230;
|
||||
|
||||
DROP TABLE t1, st1, st2;
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
||||
#
|
||||
|
|
|
@ -1286,3 +1286,137 @@ CREATE TABLE t1 SELECT 1 % .1234567891234567891234567891234567891234567891234567
|
|||
DESCRIBE t1;
|
||||
SELECT my_col FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#45261: Crash, stored procedure + decimal
|
||||
--echo #
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 SELECT
|
||||
/* 81 */ 100000000000000000000000000000000000000000000000000000000000000000000000000000001
|
||||
AS c1;
|
||||
DESC t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 SELECT
|
||||
/* 81 */ 100000000000000000000000000000000000000000000000000000000000000000000000000000001.
|
||||
AS c1;
|
||||
DESC t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 SELECT
|
||||
/* 81 */ 100000000000000000000000000000000000000000000000000000000000000000000000000000001.1 /* 1 */
|
||||
AS c1;
|
||||
DESC t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 SELECT
|
||||
/* 82 */ 1000000000000000000000000000000000000000000000000000000000000000000000000000000001
|
||||
AS c1;
|
||||
DESC t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 SELECT
|
||||
/* 40 */ 1000000000000000000000000000000000000001.1000000000000000000000000000000000000001 /* 40 */
|
||||
AS c1;
|
||||
DESC t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 SELECT
|
||||
/* 1 */ 1.10000000000000000000000000000000000000000000000000000000000000000000000000000001 /* 80 */
|
||||
AS c1;
|
||||
DESC t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 SELECT
|
||||
/* 1 */ 1.100000000000000000000000000000000000000000000000000000000000000000000000000000001 /* 81 */
|
||||
AS c1;
|
||||
DESC t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 SELECT
|
||||
.100000000000000000000000000000000000000000000000000000000000000000000000000000001 /* 81 */
|
||||
AS c1;
|
||||
DESC t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 SELECT
|
||||
/* 45 */ 123456789012345678901234567890123456789012345.123456789012345678901234567890123456789012345 /* 45 */
|
||||
AS c1;
|
||||
DESC t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 SELECT
|
||||
/* 65 */ 12345678901234567890123456789012345678901234567890123456789012345.1 /* 1 */
|
||||
AS c1;
|
||||
DESC t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 SELECT
|
||||
/* 66 */ 123456789012345678901234567890123456789012345678901234567890123456.1 /* 1 */
|
||||
AS c1;
|
||||
DESC t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 SELECT
|
||||
.123456789012345678901234567890123456789012345678901234567890123456 /* 66 */
|
||||
AS c1;
|
||||
DESC t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 AS SELECT 123.1234567890123456789012345678901 /* 31 */ AS c1;
|
||||
DESC t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 SELECT 1.1 + CAST(1 AS DECIMAL(65,30)) AS c1;
|
||||
DESC t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Test that the integer and decimal parts are properly calculated.
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a DECIMAL(30,30));
|
||||
INSERT INTO t1 VALUES (0.1),(0.2),(0.3);
|
||||
CREATE TABLE t2 SELECT MIN(a + 0.0000000000000000000000000000001) AS c1 FROM t1;
|
||||
DESC t2;
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
CREATE TABLE t1 (a DECIMAL(30,30));
|
||||
INSERT INTO t1 VALUES (0.1),(0.2),(0.3);
|
||||
CREATE TABLE t2 SELECT IFNULL(a + 0.0000000000000000000000000000001, NULL) AS c1 FROM t1;
|
||||
DESC t2;
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
CREATE TABLE t1 (a DECIMAL(30,30));
|
||||
INSERT INTO t1 VALUES (0.1),(0.2),(0.3);
|
||||
CREATE TABLE t2 SELECT CASE a WHEN 0.1 THEN 0.0000000000000000000000000000000000000000000000000000000000000000001 END AS c1 FROM t1;
|
||||
DESC t2;
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
--echo #
|
||||
--echo # Test that variables get maximum precision.
|
||||
--echo #
|
||||
|
||||
SET @decimal= 1.1;
|
||||
CREATE TABLE t1 SELECT @decimal AS c1;
|
||||
DESC t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -3703,38 +3703,6 @@ DROP TABLE t1;
|
|||
--echo # -- End of test case for Bug#40825
|
||||
--echo
|
||||
|
||||
--echo #
|
||||
--echo # Bug #45806 crash when replacing into a view with a join!
|
||||
--echo #
|
||||
CREATE TABLE t1(a INT UNIQUE);
|
||||
CREATE VIEW v1 AS SELECT t1.a FROM t1, t1 AS a;
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
|
||||
REPLACE INTO v1(a) SELECT 1 FROM t1,t1 AS c;
|
||||
SELECT * FROM v1;
|
||||
REPLACE INTO v1(a) SELECT 3 FROM t1,t1 AS c;
|
||||
SELECT * FROM v1;
|
||||
DELETE FROM t1 WHERE a=3;
|
||||
INSERT INTO v1(a) SELECT 1 FROM t1,t1 AS c
|
||||
ON DUPLICATE KEY UPDATE `v1`.`a`= 1;
|
||||
SELECT * FROM v1;
|
||||
|
||||
CREATE VIEW v2 AS SELECT t1.a FROM t1, v1 AS a;
|
||||
|
||||
REPLACE INTO v2(a) SELECT 1 FROM t1,t1 AS c;
|
||||
SELECT * FROM v2;
|
||||
REPLACE INTO v2(a) SELECT 3 FROM t1,t1 AS c;
|
||||
SELECT * FROM v2;
|
||||
INSERT INTO v2(a) SELECT 1 FROM t1,t1 AS c
|
||||
ON DUPLICATE KEY UPDATE `v2`.`a`= 1;
|
||||
SELECT * FROM v2;
|
||||
|
||||
DROP VIEW v1;
|
||||
DROP VIEW v2;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo # -- End of test case for Bug#45806
|
||||
|
||||
--echo # -----------------------------------------------------------------
|
||||
--echo # -- End of 5.0 tests.
|
||||
--echo # -----------------------------------------------------------------
|
||||
|
|
|
@ -67,7 +67,7 @@ my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size,
|
|||
Since the dynamic array is usable even if allocation fails here malloc
|
||||
should not throw an error
|
||||
*/
|
||||
if (!(array->buffer= (char*) my_malloc_ci(element_size*init_alloc, MYF(0))))
|
||||
if (!(array->buffer= (uchar*) my_malloc_ci(element_size*init_alloc, MYF(0))))
|
||||
array->max_element=0;
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
|
|
@ -227,15 +227,21 @@ int init_io_cache(IO_CACHE *info, File file, size_t cachesize,
|
|||
for (;;)
|
||||
{
|
||||
size_t buffer_block;
|
||||
/*
|
||||
Unset MY_WAIT_IF_FULL bit if it is set, to prevent conflict with
|
||||
MY_ZEROFILL.
|
||||
*/
|
||||
myf flags= (myf) (cache_myflags & ~(MY_WME | MY_WAIT_IF_FULL));
|
||||
|
||||
if (cachesize < min_cache)
|
||||
cachesize = min_cache;
|
||||
buffer_block= cachesize;
|
||||
if (type == SEQ_READ_APPEND)
|
||||
buffer_block *= 2;
|
||||
if ((info->buffer=
|
||||
(uchar*) my_malloc(buffer_block,
|
||||
MYF((cache_myflags & ~ MY_WME) |
|
||||
(cachesize == min_cache ? MY_WME : 0)))) != 0)
|
||||
if (cachesize == min_cache)
|
||||
flags|= (myf) MY_WME;
|
||||
|
||||
if ((info->buffer= (uchar*) my_malloc(buffer_block, flags)) != 0)
|
||||
{
|
||||
info->write_buffer=info->buffer;
|
||||
if (type == SEQ_READ_APPEND)
|
||||
|
|
|
@ -33,12 +33,11 @@ static char * NEAR_F expand_tilde(char * *path);
|
|||
void pack_dirname(char * to, const char *from)
|
||||
{
|
||||
int cwd_err;
|
||||
size_t d_length,length,buff_length;
|
||||
size_t d_length,length,UNINIT_VAR(buff_length);
|
||||
char * start;
|
||||
char buff[FN_REFLEN];
|
||||
DBUG_ENTER("pack_dirname");
|
||||
|
||||
LINT_INIT(buff_length);
|
||||
(void) intern_filename(to,from); /* Change to intern name */
|
||||
|
||||
#ifdef FN_DEVCHAR
|
||||
|
|
|
@ -56,6 +56,7 @@ int my_copy(const char *from, const char *to, myf MyFlags)
|
|||
File from_file,to_file;
|
||||
uchar buff[IO_SIZE];
|
||||
MY_STAT stat_buff,new_stat_buff;
|
||||
int res;
|
||||
DBUG_ENTER("my_copy");
|
||||
DBUG_PRINT("my",("from %s to %s MyFlags %d", from, to, MyFlags));
|
||||
|
||||
|
@ -94,9 +95,9 @@ int my_copy(const char *from, const char *to, myf MyFlags)
|
|||
|
||||
if (MyFlags & MY_HOLD_ORIGINAL_MODES && !new_file_stat)
|
||||
DBUG_RETURN(0); /* File copyed but not stat */
|
||||
VOID(chmod(to, stat_buff.st_mode & 07777)); /* Copy modes */
|
||||
res= chmod(to, stat_buff.st_mode & 07777); /* Copy modes */
|
||||
#if !defined(__WIN__) && !defined(__NETWARE__)
|
||||
VOID(chown(to, stat_buff.st_uid,stat_buff.st_gid)); /* Copy ownership */
|
||||
res= chown(to, stat_buff.st_uid,stat_buff.st_gid); /* Copy ownership */
|
||||
#endif
|
||||
#if !defined(VMS) && !defined(__ZTC__)
|
||||
if (MyFlags & MY_COPYTIME)
|
||||
|
|
|
@ -116,7 +116,7 @@ int handle_options(int *argc, char ***argv,
|
|||
uint opt_found, argvpos= 0, length;
|
||||
my_bool end_of_options= 0, must_be_var, set_maximum_value,
|
||||
option_is_loose;
|
||||
char **pos, **pos_end, *optend, *prev_found,
|
||||
char **pos, **pos_end, *optend, *UNINIT_VAR(prev_found),
|
||||
*opt_str, key_name[FN_REFLEN];
|
||||
const struct my_option *optp;
|
||||
uchar* *value;
|
||||
|
|
|
@ -76,6 +76,9 @@ end:
|
|||
int my_copystat(const char *from, const char *to, int MyFlags)
|
||||
{
|
||||
struct stat statbuf;
|
||||
#if !defined(__WIN__) && !defined(__NETWARE__)
|
||||
int res;
|
||||
#endif
|
||||
|
||||
if (stat((char*) from, &statbuf))
|
||||
{
|
||||
|
@ -94,7 +97,7 @@ int my_copystat(const char *from, const char *to, int MyFlags)
|
|||
if (MyFlags & MY_LINK_WARNING)
|
||||
my_error(EE_LINK_WARNING,MYF(ME_BELL+ME_WAITTANG),from,statbuf.st_nlink);
|
||||
}
|
||||
VOID(chown(to, statbuf.st_uid, statbuf.st_gid)); /* Copy ownership */
|
||||
res= chown(to, statbuf.st_uid, statbuf.st_gid); /* Copy ownership */
|
||||
#endif /* !__WIN__ && !__NETWARE__ */
|
||||
|
||||
#ifndef VMS
|
||||
|
|
|
@ -70,7 +70,8 @@ int find_type_or_exit(const char *x, TYPELIB *typelib, const char *option)
|
|||
|
||||
int find_type(char *x, const TYPELIB *typelib, uint full_name)
|
||||
{
|
||||
int find,pos,findpos;
|
||||
int find,pos;
|
||||
int UNINIT_VAR(findpos); /* guarded by find */
|
||||
reg1 char * i;
|
||||
reg2 const char *j;
|
||||
DBUG_ENTER("find_type");
|
||||
|
@ -81,7 +82,6 @@ int find_type(char *x, const TYPELIB *typelib, uint full_name)
|
|||
DBUG_PRINT("exit",("no count"));
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
LINT_INIT(findpos);
|
||||
find=0;
|
||||
for (pos=0 ; (j=typelib->type_names[pos]) ; pos++)
|
||||
{
|
||||
|
|
|
@ -213,11 +213,11 @@ register struct parse *p;
|
|||
int stop; /* character this ERE should end at */
|
||||
{
|
||||
register char c;
|
||||
register sopno prevback;
|
||||
register sopno prevfwd;
|
||||
register sopno UNINIT_VAR(prevback);
|
||||
register sopno UNINIT_VAR(prevfwd);
|
||||
register sopno conc;
|
||||
register int first = 1; /* is this the first alternative? */
|
||||
LINT_INIT(prevback); LINT_INIT(prevfwd);
|
||||
|
||||
for (;;) {
|
||||
/* do a bunch of concatenated expressions */
|
||||
conc = HERE();
|
||||
|
|
|
@ -70,6 +70,18 @@ void my_net_local_init(NET *net)
|
|||
|
||||
C_MODE_END
|
||||
|
||||
/*
|
||||
Unused stub hook required for linking the client API.
|
||||
*/
|
||||
|
||||
C_MODE_START
|
||||
|
||||
void slave_io_thread_detach_vio()
|
||||
{
|
||||
}
|
||||
|
||||
C_MODE_END
|
||||
|
||||
|
||||
/*
|
||||
Every resource, which we can fail to acquire, is allocated in init().
|
||||
|
|
|
@ -481,6 +481,15 @@ HANDLE create_shared_memory(MYSQL *mysql,NET *net, uint connect_timeout)
|
|||
const char *prefix;
|
||||
int i;
|
||||
|
||||
/*
|
||||
If this is NULL, somebody freed the MYSQL* options. mysql_close()
|
||||
is a good candidate. We don't just silently (re)set it to
|
||||
def_shared_memory_base_name as that would create really confusing/buggy
|
||||
behavior if the user passed in a different name on the command-line or
|
||||
in a my.cnf.
|
||||
*/
|
||||
DBUG_ASSERT(shared_memory_base_name != NULL);
|
||||
|
||||
/*
|
||||
get enough space base-name + '_' + longest suffix we might ever send
|
||||
*/
|
||||
|
@ -933,6 +942,9 @@ void end_server(MYSQL *mysql)
|
|||
{
|
||||
init_sigpipe_variables
|
||||
DBUG_PRINT("info",("Net: %s", vio_description(mysql->net.vio)));
|
||||
#ifdef MYSQL_SERVER
|
||||
slave_io_thread_detach_vio();
|
||||
#endif
|
||||
set_sigpipe(mysql);
|
||||
vio_delete(mysql->net.vio);
|
||||
reset_sigpipe(mysql);
|
||||
|
@ -1846,7 +1858,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
|
|||
uint port, const char *unix_socket,ulong client_flag)
|
||||
{
|
||||
char buff[NAME_LEN+USERNAME_LENGTH+100];
|
||||
char *end,*host_info;
|
||||
char *end,*host_info= NULL;
|
||||
my_socket sock;
|
||||
in_addr_t ip_addr;
|
||||
struct sockaddr_in sock_addr;
|
||||
|
@ -1864,7 +1876,6 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
|
|||
#endif
|
||||
init_sigpipe_variables
|
||||
DBUG_ENTER("mysql_real_connect");
|
||||
LINT_INIT(host_info);
|
||||
|
||||
DBUG_PRINT("enter",("host: %s db: %s user: %s",
|
||||
host ? host : "(Null)",
|
||||
|
|
|
@ -160,7 +160,7 @@ enum enum_mysql_timestamp_type
|
|||
str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
|
||||
uint flags, int *was_cut)
|
||||
{
|
||||
uint field_length, year_length, digits, i, number_of_fields;
|
||||
uint field_length, UNINIT_VAR(year_length), digits, i, number_of_fields;
|
||||
uint date[MAX_DATE_PARTS], date_len[MAX_DATE_PARTS];
|
||||
uint add_hours= 0, start_loop;
|
||||
ulong not_zero_date, allow_space;
|
||||
|
@ -174,7 +174,6 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
|
|||
DBUG_PRINT("ENTER",("str: %.*s",length,str));
|
||||
|
||||
LINT_INIT(field_length);
|
||||
LINT_INIT(year_length);
|
||||
LINT_INIT(last_field_pos);
|
||||
|
||||
*was_cut= 0;
|
||||
|
@ -450,9 +449,7 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
|
|||
}
|
||||
}
|
||||
|
||||
DBUG_RETURN(l_time->time_type=
|
||||
(number_of_fields <= 3 ? MYSQL_TIMESTAMP_DATE :
|
||||
MYSQL_TIMESTAMP_DATETIME));
|
||||
DBUG_RETURN(l_time->time_type);
|
||||
|
||||
err:
|
||||
bzero((char*) l_time, sizeof(*l_time));
|
||||
|
@ -778,11 +775,12 @@ long calc_daynr(uint year,uint month,uint day)
|
|||
|
||||
if (y == 0 && month == 0 && day == 0)
|
||||
DBUG_RETURN(0); /* Skip errors */
|
||||
delsum= (long) (365L * y+ 31*(month-1) +day);
|
||||
/* Cast to int to be able to handle month == 0 */
|
||||
delsum= (long) (365 * y + 31 *((int) month - 1) + (int) day);
|
||||
if (month <= 2)
|
||||
y--;
|
||||
else
|
||||
delsum-= (long) (month*4+23)/10;
|
||||
delsum-= (long) ((int) month * 4 + 23) / 10;
|
||||
temp=(int) ((y/100+1)*3)/4;
|
||||
DBUG_PRINT("exit",("year: %d month: %d day: %d -> daynr: %ld",
|
||||
y+(month <= 2),month,day,delsum+y/4-temp));
|
||||
|
|
|
@ -33,3 +33,11 @@
|
|||
|
||||
#define mysql_server_init(a,b,c) 0
|
||||
|
||||
#ifdef HAVE_REPLICATION
|
||||
C_MODE_START
|
||||
void slave_io_thread_detach_vio();
|
||||
C_MODE_END
|
||||
#else
|
||||
#define slave_io_thread_detach_vio()
|
||||
#endif
|
||||
|
||||
|
|
|
@ -341,6 +341,33 @@ common_1_lev_code:
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Create a new query string for removing executable comments
|
||||
for avoiding leak and keeping consistency of the execution
|
||||
on master and slave.
|
||||
|
||||
@param[in] thd Thread handler
|
||||
@param[in] buf Query string
|
||||
|
||||
@return
|
||||
0 ok
|
||||
1 error
|
||||
*/
|
||||
static int
|
||||
create_query_string(THD *thd, String *buf)
|
||||
{
|
||||
/* Append the "CREATE" part of the query */
|
||||
if (buf->append(STRING_WITH_LEN("CREATE ")))
|
||||
return 1;
|
||||
/* Append definer */
|
||||
append_definer(thd, buf, &(thd->lex->definer->user), &(thd->lex->definer->host));
|
||||
/* Append the left part of thd->query after "DEFINER" part */
|
||||
if (buf->append(thd->lex->stmt_definition_begin))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
Create a new event.
|
||||
|
||||
|
@ -439,7 +466,16 @@ Events::create_event(THD *thd, Event_parse_data *parse_data,
|
|||
{
|
||||
/* Binlog the create event. */
|
||||
DBUG_ASSERT(thd->query && thd->query_length);
|
||||
write_bin_log(thd, TRUE, thd->query, thd->query_length);
|
||||
String log_query;
|
||||
if (create_query_string(thd, &log_query))
|
||||
{
|
||||
sql_print_error("Event Error: An error occurred while creating query string, "
|
||||
"before writing it into binary log.");
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
/* If the definer is not set or set to CURRENT_USER, the value of CURRENT_USER
|
||||
will be written into the binary log as the definer for the SQL thread. */
|
||||
write_bin_log(thd, TRUE, log_query.c_ptr(), log_query.length());
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&LOCK_event_metadata);
|
||||
|
|
104
sql/field.cc
104
sql/field.cc
|
@ -1922,16 +1922,16 @@ int Field_decimal::store(const char *from_arg, uint len, CHARSET_INFO *cs)
|
|||
Pointers used when digits move from the left of the '.' to the
|
||||
right of the '.' (explained below)
|
||||
*/
|
||||
const uchar *int_digits_tail_from;
|
||||
const uchar *UNINIT_VAR(int_digits_tail_from);
|
||||
/* Number of 0 that need to be added at the left of the '.' (1E3: 3 zeros) */
|
||||
uint int_digits_added_zeros;
|
||||
uint UNINIT_VAR(int_digits_added_zeros);
|
||||
/*
|
||||
Pointer used when digits move from the right of the '.' to the left
|
||||
of the '.'
|
||||
*/
|
||||
const uchar *frac_digits_head_end;
|
||||
const uchar *UNINIT_VAR(frac_digits_head_end);
|
||||
/* Number of 0 that need to be added at the right of the '.' (for 1E-3) */
|
||||
uint frac_digits_added_zeros;
|
||||
uint UNINIT_VAR(frac_digits_added_zeros);
|
||||
uchar *pos,*tmp_left_pos,*tmp_right_pos;
|
||||
/* Pointers that are used as limits (begin and end of the field buffer) */
|
||||
uchar *left_wall,*right_wall;
|
||||
|
@ -1942,11 +1942,6 @@ int Field_decimal::store(const char *from_arg, uint len, CHARSET_INFO *cs)
|
|||
*/
|
||||
bool is_cuted_fields_incr=0;
|
||||
|
||||
LINT_INIT(int_digits_tail_from);
|
||||
LINT_INIT(int_digits_added_zeros);
|
||||
LINT_INIT(frac_digits_head_end);
|
||||
LINT_INIT(frac_digits_added_zeros);
|
||||
|
||||
/*
|
||||
There are three steps in this function :
|
||||
- parse the input string
|
||||
|
@ -2485,12 +2480,97 @@ Field_new_decimal::Field_new_decimal(uint32 len_arg,
|
|||
{
|
||||
precision= my_decimal_length_to_precision(len_arg, dec_arg, unsigned_arg);
|
||||
set_if_smaller(precision, DECIMAL_MAX_PRECISION);
|
||||
DBUG_ASSERT(precision >= dec);
|
||||
DBUG_ASSERT((precision <= DECIMAL_MAX_PRECISION) &&
|
||||
(dec <= DECIMAL_MAX_SCALE));
|
||||
bin_size= my_decimal_get_binary_size(precision, dec);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Create a field to hold a decimal value from an item.
|
||||
|
||||
@remark The MySQL DECIMAL data type has a characteristic that needs to be
|
||||
taken into account when deducing the type from a Item_decimal.
|
||||
|
||||
But first, let's briefly recap what is the new MySQL DECIMAL type:
|
||||
|
||||
The declaration syntax for a decimal is DECIMAL(M,D), where:
|
||||
|
||||
* M is the maximum number of digits (the precision).
|
||||
It has a range of 1 to 65.
|
||||
* D is the number of digits to the right of the decimal separator (the scale).
|
||||
It has a range of 0 to 30 and must be no larger than M.
|
||||
|
||||
D and M are used to determine the storage requirements for the integer
|
||||
and fractional parts of each value. The integer part is to the left of
|
||||
the decimal separator and to the right is the fractional part. Hence:
|
||||
|
||||
M is the number of digits for the integer and fractional part.
|
||||
D is the number of digits for the fractional part.
|
||||
|
||||
Consequently, M - D is the number of digits for the integer part. For
|
||||
example, a DECIMAL(20,10) column has ten digits on either side of
|
||||
the decimal separator.
|
||||
|
||||
The characteristic that needs to be taken into account is that the
|
||||
backing type for Item_decimal is a my_decimal that has a higher
|
||||
precision (DECIMAL_MAX_POSSIBLE_PRECISION, see my_decimal.h) than
|
||||
DECIMAL.
|
||||
|
||||
Drawing a comparison between my_decimal and DECIMAL:
|
||||
|
||||
* M has a range of 1 to 81.
|
||||
* D has a range of 0 to 81.
|
||||
|
||||
There can be a difference in range if the decimal contains a integer
|
||||
part. This is because the fractional part must always be on a group
|
||||
boundary, leaving at least one group for the integer part. Since each
|
||||
group is 9 (DIG_PER_DEC1) digits and there are 9 (DECIMAL_BUFF_LENGTH)
|
||||
groups, the fractional part is limited to 72 digits if there is at
|
||||
least one digit in the integral part.
|
||||
|
||||
Although the backing type for a DECIMAL is also my_decimal, every
|
||||
time a my_decimal is stored in a DECIMAL field, the precision and
|
||||
scale are explicitly capped at 65 (DECIMAL_MAX_PRECISION) and 30
|
||||
(DECIMAL_MAX_SCALE) digits, following my_decimal truncation procedure
|
||||
(FIX_INTG_FRAC_ERROR).
|
||||
*/
|
||||
|
||||
Field_new_decimal *
|
||||
Field_new_decimal::new_decimal_field(const Item *item)
|
||||
{
|
||||
uint32 len;
|
||||
uint intg= item->decimal_int_part(), scale= item->decimals;
|
||||
|
||||
DBUG_ASSERT(item->decimal_precision() >= item->decimals);
|
||||
|
||||
/*
|
||||
Employ a procedure along the lines of the my_decimal truncation process:
|
||||
- If the integer part is equal to or bigger than the maximum precision:
|
||||
Truncate integer part to fit and the fractional becomes zero.
|
||||
- Otherwise:
|
||||
Truncate fractional part to fit.
|
||||
*/
|
||||
if (intg >= DECIMAL_MAX_PRECISION)
|
||||
{
|
||||
intg= DECIMAL_MAX_PRECISION;
|
||||
scale= 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint room= min(DECIMAL_MAX_PRECISION - intg, DECIMAL_MAX_SCALE);
|
||||
if (scale > room)
|
||||
scale= room;
|
||||
}
|
||||
|
||||
len= my_decimal_precision_to_length(intg + scale, scale, item->unsigned_flag);
|
||||
|
||||
return new Field_new_decimal(len, item->maybe_null, item->name, scale,
|
||||
item->unsigned_flag);
|
||||
}
|
||||
|
||||
|
||||
int Field_new_decimal::reset(void)
|
||||
{
|
||||
store_value(&decimal_zero);
|
||||
|
@ -9917,10 +9997,8 @@ Field *make_field(TABLE_SHARE *share, uchar *ptr, uint32 field_length,
|
|||
TYPELIB *interval,
|
||||
const char *field_name)
|
||||
{
|
||||
uchar *bit_ptr;
|
||||
uchar bit_offset;
|
||||
LINT_INIT(bit_ptr);
|
||||
LINT_INIT(bit_offset);
|
||||
uchar *UNINIT_VAR(bit_ptr);
|
||||
uchar UNINIT_VAR(bit_offset);
|
||||
if (field_type == MYSQL_TYPE_BIT && !f_bit_as_char(pack_flag))
|
||||
{
|
||||
bit_ptr= null_pos;
|
||||
|
|
|
@ -608,6 +608,10 @@ protected:
|
|||
|
||||
class Field_num :public Field {
|
||||
public:
|
||||
/**
|
||||
The scale of the Field's value, i.e. the number of digits to the right
|
||||
of the decimal point.
|
||||
*/
|
||||
const uint8 dec;
|
||||
bool zerofill,unsigned_flag; // Purify cannot handle bit fields
|
||||
Field_num(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg,
|
||||
|
@ -766,6 +770,11 @@ public:
|
|||
Field_new_decimal(uint32 len_arg, bool maybe_null_arg,
|
||||
const char *field_name_arg, uint8 dec_arg,
|
||||
bool unsigned_arg);
|
||||
/*
|
||||
Create a field to hold a decimal value from an item.
|
||||
Truncates the precision and/or scale if necessary.
|
||||
*/
|
||||
static Field_new_decimal *new_decimal_field(const Item *item);
|
||||
enum_field_types type() const { return MYSQL_TYPE_NEWDECIMAL;}
|
||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
|
||||
Item_result result_type () const { return DECIMAL_RESULT; }
|
||||
|
|
|
@ -4414,17 +4414,6 @@ int ha_partition::handle_unordered_scan_next_partition(uchar * buf)
|
|||
break;
|
||||
case partition_index_first:
|
||||
DBUG_PRINT("info", ("index_first on partition %d", i));
|
||||
/* MyISAM engine can fail if we call index_first() when indexes disabled */
|
||||
/* that happens if the table is empty. */
|
||||
/* Here we use file->stats.records instead of file->records() because */
|
||||
/* file->records() is supposed to return an EXACT count, and it can be */
|
||||
/* possibly slow. We don't need an exact number, an approximate one- from*/
|
||||
/* the last ::info() call - is sufficient. */
|
||||
if (file->stats.records == 0)
|
||||
{
|
||||
error= HA_ERR_END_OF_FILE;
|
||||
break;
|
||||
}
|
||||
error= file->index_first(buf);
|
||||
break;
|
||||
case partition_index_first_unordered:
|
||||
|
@ -4512,32 +4501,10 @@ int ha_partition::handle_ordered_index_scan(uchar *buf, bool reverse_order)
|
|||
m_start_key.flag);
|
||||
break;
|
||||
case partition_index_first:
|
||||
/* MyISAM engine can fail if we call index_first() when indexes disabled */
|
||||
/* that happens if the table is empty. */
|
||||
/* Here we use file->stats.records instead of file->records() because */
|
||||
/* file->records() is supposed to return an EXACT count, and it can be */
|
||||
/* possibly slow. We don't need an exact number, an approximate one- from*/
|
||||
/* the last ::info() call - is sufficient. */
|
||||
if (file->stats.records == 0)
|
||||
{
|
||||
error= HA_ERR_END_OF_FILE;
|
||||
break;
|
||||
}
|
||||
error= file->index_first(rec_buf_ptr);
|
||||
reverse_order= FALSE;
|
||||
break;
|
||||
case partition_index_last:
|
||||
/* MyISAM engine can fail if we call index_last() when indexes disabled */
|
||||
/* that happens if the table is empty. */
|
||||
/* Here we use file->stats.records instead of file->records() because */
|
||||
/* file->records() is supposed to return an EXACT count, and it can be */
|
||||
/* possibly slow. We don't need an exact number, an approximate one- from*/
|
||||
/* the last ::info() call - is sufficient. */
|
||||
if (file->stats.records == 0)
|
||||
{
|
||||
error= HA_ERR_END_OF_FILE;
|
||||
break;
|
||||
}
|
||||
error= file->index_last(rec_buf_ptr);
|
||||
reverse_order= TRUE;
|
||||
break;
|
||||
|
|
|
@ -895,7 +895,7 @@ class partition_info;
|
|||
struct st_partition_iter;
|
||||
#define NOT_A_PARTITION_ID ((uint32)-1)
|
||||
|
||||
enum ha_choice { HA_CHOICE_UNDEF, HA_CHOICE_NO, HA_CHOICE_YES };
|
||||
enum enum_ha_unused { HA_CHOICE_UNDEF, HA_CHOICE_NO, HA_CHOICE_YES };
|
||||
|
||||
typedef struct st_ha_create_information
|
||||
{
|
||||
|
@ -918,14 +918,12 @@ typedef struct st_ha_create_information
|
|||
uint options; /* OR of HA_CREATE_ options */
|
||||
uint merge_insert_method;
|
||||
uint extra_size; /* length of extra data segment */
|
||||
/** Transactional or not. Unused; reserved for future versions. */
|
||||
enum ha_choice transactional;
|
||||
enum enum_ha_unused unused1;
|
||||
bool table_existed; /* 1 in create if table existed */
|
||||
bool frm_only; /* 1 if no ha_create_table() */
|
||||
bool varchar; /* 1 if table has a VARCHAR */
|
||||
enum ha_storage_media storage_media; /* DEFAULT, DISK or MEMORY */
|
||||
/** Per-page checksums or not. Unused; reserved for future versions. */
|
||||
enum ha_choice page_checksum;
|
||||
enum enum_ha_unused unused2;
|
||||
} HA_CREATE_INFO;
|
||||
|
||||
|
||||
|
|
85
sql/item.cc
85
sql/item.cc
|
@ -435,17 +435,26 @@ Item::Item(THD *thd, Item *item):
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Decimal precision of the item.
|
||||
|
||||
@remark The precision must not be capped as it can be used in conjunction
|
||||
with Item::decimals to determine the size of the integer part when
|
||||
constructing a decimal data type.
|
||||
|
||||
@see Item::decimal_int_part()
|
||||
@see Item::decimals
|
||||
*/
|
||||
|
||||
uint Item::decimal_precision() const
|
||||
{
|
||||
uint precision= max_length;
|
||||
Item_result restype= result_type();
|
||||
|
||||
if ((restype == DECIMAL_RESULT) || (restype == INT_RESULT))
|
||||
{
|
||||
uint prec=
|
||||
my_decimal_length_to_precision(max_length, decimals, unsigned_flag);
|
||||
return min(prec, DECIMAL_MAX_PRECISION);
|
||||
}
|
||||
return min(max_length, DECIMAL_MAX_PRECISION);
|
||||
precision= my_decimal_length_to_precision(max_length, decimals, unsigned_flag);
|
||||
|
||||
return precision;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1664,7 +1673,7 @@ bool agg_item_collations_for_comparison(DTCollation &c, const char *fname,
|
|||
bool agg_item_set_converter(DTCollation &coll, const char *fname,
|
||||
Item **args, uint nargs, uint flags, int item_sep)
|
||||
{
|
||||
Item **arg, *safe_args[2];
|
||||
Item **arg, *safe_args[2]= {NULL, NULL};
|
||||
|
||||
/*
|
||||
For better error reporting: save the first and the second argument.
|
||||
|
@ -1673,8 +1682,6 @@ bool agg_item_set_converter(DTCollation &coll, const char *fname,
|
|||
doesn't display each argument's characteristics.
|
||||
- if nargs is 1, then this error cannot happen.
|
||||
*/
|
||||
LINT_INIT(safe_args[0]);
|
||||
LINT_INIT(safe_args[1]);
|
||||
if (nargs >=2 && nargs <= 3)
|
||||
{
|
||||
safe_args[0]= args[0];
|
||||
|
@ -3296,8 +3303,7 @@ Item_copy *Item_copy::create (Item *item)
|
|||
new Item_copy_uint (item) : new Item_copy_int (item);
|
||||
case DECIMAL_RESULT:
|
||||
return new Item_copy_decimal (item);
|
||||
|
||||
case ROW_RESULT:
|
||||
default:
|
||||
DBUG_ASSERT (0);
|
||||
}
|
||||
/* should not happen */
|
||||
|
@ -4902,9 +4908,7 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table, bool fixed_length)
|
|||
switch (field_type()) {
|
||||
case MYSQL_TYPE_DECIMAL:
|
||||
case MYSQL_TYPE_NEWDECIMAL:
|
||||
field= new Field_new_decimal((uchar*) 0, max_length, null_ptr, 0,
|
||||
Field::NONE, name, decimals, 0,
|
||||
unsigned_flag);
|
||||
field= Field_new_decimal::new_decimal_field(this);
|
||||
break;
|
||||
case MYSQL_TYPE_TINY:
|
||||
field= new Field_tiny((uchar*) 0, max_length, null_ptr, 0, Field::NONE,
|
||||
|
@ -5501,9 +5505,8 @@ bool Item_null::send(Protocol *protocol, String *packet)
|
|||
|
||||
bool Item::send(Protocol *protocol, String *buffer)
|
||||
{
|
||||
bool result;
|
||||
bool UNINIT_VAR(result); // Will be set if null_value == 0
|
||||
enum_field_types f_type;
|
||||
LINT_INIT(result); // Will be set if null_value == 0
|
||||
|
||||
switch ((f_type=field_type())) {
|
||||
default:
|
||||
|
@ -6846,14 +6849,21 @@ void resolve_const_item(THD *thd, Item **ref, Item *comp_item)
|
|||
}
|
||||
|
||||
/**
|
||||
Return true if the value stored in the field is equal to the const
|
||||
item.
|
||||
Compare the value stored in field, with the original item.
|
||||
|
||||
We need to use this on the range optimizer because in some cases
|
||||
we can't store the value in the field without some precision/character loss.
|
||||
@param field field which the item is converted and stored in
|
||||
@param item original item
|
||||
|
||||
@return Return an integer greater than, equal to, or less than 0 if
|
||||
the value stored in the field is greater than, equal to,
|
||||
or less than the original item
|
||||
|
||||
@note We only use this on the range optimizer/partition pruning,
|
||||
because in some cases we can't store the value in the field
|
||||
without some precision/character loss.
|
||||
*/
|
||||
|
||||
bool field_is_equal_to_item(Field *field,Item *item)
|
||||
int stored_field_cmp_to_item(Field *field, Item *item)
|
||||
{
|
||||
|
||||
Item_result res_type=item_cmp_type(field->result_type(),
|
||||
|
@ -6864,28 +6874,49 @@ bool field_is_equal_to_item(Field *field,Item *item)
|
|||
char field_buff[MAX_FIELD_WIDTH];
|
||||
String item_tmp(item_buff,sizeof(item_buff),&my_charset_bin),*item_result;
|
||||
String field_tmp(field_buff,sizeof(field_buff),&my_charset_bin);
|
||||
enum_field_types field_type;
|
||||
item_result=item->val_str(&item_tmp);
|
||||
if (item->null_value)
|
||||
return 1; // This must be true
|
||||
return 0;
|
||||
field->val_str(&field_tmp);
|
||||
return !stringcmp(&field_tmp,item_result);
|
||||
|
||||
/*
|
||||
If comparing DATE with DATETIME, append the time-part to the DATE.
|
||||
So that the strings are equally formatted.
|
||||
A DATE converted to string is 10 characters, and a DATETIME converted
|
||||
to string is 19 characters.
|
||||
*/
|
||||
field_type= field->type();
|
||||
if (field_type == MYSQL_TYPE_DATE &&
|
||||
item_result->length() == 19)
|
||||
field_tmp.append(" 00:00:00");
|
||||
else if (field_type == MYSQL_TYPE_DATETIME &&
|
||||
item_result->length() == 10)
|
||||
item_result->append(" 00:00:00");
|
||||
|
||||
return stringcmp(&field_tmp,item_result);
|
||||
}
|
||||
if (res_type == INT_RESULT)
|
||||
return 1; // Both where of type int
|
||||
return 0; // Both are of type int
|
||||
if (res_type == DECIMAL_RESULT)
|
||||
{
|
||||
my_decimal item_buf, *item_val,
|
||||
field_buf, *field_val;
|
||||
item_val= item->val_decimal(&item_buf);
|
||||
if (item->null_value)
|
||||
return 1; // This must be true
|
||||
return 0;
|
||||
field_val= field->val_decimal(&field_buf);
|
||||
return !my_decimal_cmp(item_val, field_val);
|
||||
return my_decimal_cmp(item_val, field_val);
|
||||
}
|
||||
double result= item->val_real();
|
||||
if (item->null_value)
|
||||
return 0;
|
||||
double field_result= field->val_real();
|
||||
if (field_result < result)
|
||||
return -1;
|
||||
else if (field_result > result)
|
||||
return 1;
|
||||
return result == field->val_real();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Item_cache* Item_cache::get_cache(const Item *item)
|
||||
|
|
18
sql/item.h
18
sql/item.h
|
@ -397,13 +397,20 @@ public:
|
|||
from INT_RESULT, may be NULL, or are unsigned.
|
||||
It will be possible to address this issue once the related partitioning bugs
|
||||
(BUG#16002, BUG#15447, BUG#13436) are fixed.
|
||||
|
||||
The NOT_NULL enums are used in TO_DAYS, since TO_DAYS('2001-00-00') returns
|
||||
NULL which puts those rows into the NULL partition, but
|
||||
'2000-12-31' < '2001-00-00' < '2001-01-01'. So special handling is needed
|
||||
for this (see Bug#20577).
|
||||
*/
|
||||
|
||||
typedef enum monotonicity_info
|
||||
{
|
||||
NON_MONOTONIC, /* none of the below holds */
|
||||
MONOTONIC_INCREASING, /* F() is unary and (x < y) => (F(x) <= F(y)) */
|
||||
MONOTONIC_STRICT_INCREASING /* F() is unary and (x < y) => (F(x) < F(y)) */
|
||||
MONOTONIC_INCREASING_NOT_NULL, /* But only for valid/real x and y */
|
||||
MONOTONIC_STRICT_INCREASING,/* F() is unary and (x < y) => (F(x) < F(y)) */
|
||||
MONOTONIC_STRICT_INCREASING_NOT_NULL /* But only for valid/real x and y */
|
||||
} enum_monotonicity_info;
|
||||
|
||||
/*************************************************************************/
|
||||
|
@ -576,8 +583,8 @@ public:
|
|||
left_endp FALSE <=> The interval is "x < const" or "x <= const"
|
||||
TRUE <=> The interval is "x > const" or "x >= const"
|
||||
|
||||
incl_endp IN TRUE <=> the comparison is '<' or '>'
|
||||
FALSE <=> the comparison is '<=' or '>='
|
||||
incl_endp IN FALSE <=> the comparison is '<' or '>'
|
||||
TRUE <=> the comparison is '<=' or '>='
|
||||
OUT The same but for the "F(x) $CMP$ F(const)" comparison
|
||||
|
||||
DESCRIPTION
|
||||
|
@ -755,9 +762,10 @@ public:
|
|||
virtual cond_result eq_cmp_result() const { return COND_OK; }
|
||||
inline uint float_length(uint decimals_par) const
|
||||
{ return decimals != NOT_FIXED_DEC ? (DBL_DIG+2+decimals_par) : DBL_DIG+8;}
|
||||
/** Returns the uncapped decimal precision of this item. */
|
||||
virtual uint decimal_precision() const;
|
||||
inline int decimal_int_part() const
|
||||
{ return my_decimal_int_part(decimal_precision(), decimals); }
|
||||
{ return decimal_precision() - decimals; }
|
||||
/*
|
||||
Returns true if this is constant (during query execution, i.e. its value
|
||||
will not change until next fix_fields) and its value is known.
|
||||
|
@ -3117,4 +3125,4 @@ void mark_select_range_as_dependent(THD *thd,
|
|||
extern Cached_item *new_Cached_item(THD *thd, Item *item);
|
||||
extern Item_result item_cmp_type(Item_result a,Item_result b);
|
||||
extern void resolve_const_item(THD *thd, Item **ref, Item *cmp_item);
|
||||
extern bool field_is_equal_to_item(Field *field,Item *item);
|
||||
extern int stored_field_cmp_to_item(Field *field, Item *item);
|
||||
|
|
|
@ -395,11 +395,10 @@ static bool convert_constant_item(THD *thd, Item_field *field_item,
|
|||
ulong orig_sql_mode= thd->variables.sql_mode;
|
||||
enum_check_fields orig_count_cuted_fields= thd->count_cuted_fields;
|
||||
my_bitmap_map *old_maps[2];
|
||||
ulonglong orig_field_val; /* original field value if valid */
|
||||
ulonglong UNINIT_VAR(orig_field_val); /* original field value if valid */
|
||||
|
||||
LINT_INIT(old_maps[0]);
|
||||
LINT_INIT(old_maps[1]);
|
||||
LINT_INIT(orig_field_val);
|
||||
|
||||
if (table)
|
||||
dbug_tmp_use_all_columns(table, old_maps,
|
||||
|
@ -2183,7 +2182,7 @@ uint Item_func_ifnull::decimal_precision() const
|
|||
int arg1_int_part= args[1]->decimal_int_part();
|
||||
int max_int_part= max(arg0_int_part, arg1_int_part);
|
||||
int precision= max_int_part + decimals;
|
||||
return min(precision, DECIMAL_MAX_PRECISION);
|
||||
return precision;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2367,7 +2366,7 @@ uint Item_func_if::decimal_precision() const
|
|||
int arg1_prec= args[1]->decimal_int_part();
|
||||
int arg2_prec= args[2]->decimal_int_part();
|
||||
int precision=max(arg1_prec,arg2_prec) + decimals;
|
||||
return min(precision, DECIMAL_MAX_PRECISION);
|
||||
return precision;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2775,7 +2774,7 @@ uint Item_func_case::decimal_precision() const
|
|||
|
||||
if (else_expr_num != -1)
|
||||
set_if_bigger(max_int_part, args[else_expr_num]->decimal_int_part());
|
||||
return min(max_int_part + decimals, DECIMAL_MAX_PRECISION);
|
||||
return max_int_part + decimals;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5032,10 +5032,9 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type,
|
|||
const char *c_len, const char *c_dec,
|
||||
CHARSET_INFO *cs)
|
||||
{
|
||||
Item *res;
|
||||
Item *UNINIT_VAR(res);
|
||||
ulong len;
|
||||
uint dec;
|
||||
LINT_INIT(res);
|
||||
|
||||
switch (cast_type) {
|
||||
case ITEM_CAST_BINARY:
|
||||
|
|
|
@ -452,45 +452,8 @@ Field *Item_func::tmp_table_field(TABLE *table)
|
|||
return make_string_field(table);
|
||||
break;
|
||||
case DECIMAL_RESULT:
|
||||
{
|
||||
uint8 dec= decimals;
|
||||
uint8 intg= decimal_precision() - dec;
|
||||
uint32 len= max_length;
|
||||
|
||||
/*
|
||||
Trying to put too many digits overall in a DECIMAL(prec,dec)
|
||||
will always throw a warning. We must limit dec to
|
||||
DECIMAL_MAX_SCALE however to prevent an assert() later.
|
||||
*/
|
||||
|
||||
if (dec > 0)
|
||||
{
|
||||
int overflow;
|
||||
|
||||
dec= min(dec, DECIMAL_MAX_SCALE);
|
||||
|
||||
/*
|
||||
If the value still overflows the field with the corrected dec,
|
||||
we'll throw out decimals rather than integers. This is still
|
||||
bad and of course throws a truncation warning.
|
||||
*/
|
||||
|
||||
const int required_length=
|
||||
my_decimal_precision_to_length(intg + dec, dec,
|
||||
unsigned_flag);
|
||||
|
||||
overflow= required_length - len;
|
||||
|
||||
if (overflow > 0)
|
||||
dec= max(0, dec - overflow); // too long, discard fract
|
||||
else
|
||||
/* Corrected value fits. */
|
||||
len= required_length;
|
||||
}
|
||||
|
||||
field= new Field_new_decimal(len, maybe_null, name, dec, unsigned_flag);
|
||||
field= Field_new_decimal::new_decimal_field(this);
|
||||
break;
|
||||
}
|
||||
case ROW_RESULT:
|
||||
default:
|
||||
// This case should never be chosen
|
||||
|
@ -2305,9 +2268,8 @@ void Item_func_min_max::fix_length_and_dec()
|
|||
|
||||
uint Item_func_min_max::cmp_datetimes(ulonglong *value)
|
||||
{
|
||||
longlong min_max;
|
||||
longlong UNINIT_VAR(min_max);
|
||||
uint min_max_idx= 0;
|
||||
LINT_INIT(min_max);
|
||||
|
||||
for (uint i=0; i < arg_count ; i++)
|
||||
{
|
||||
|
@ -2372,8 +2334,7 @@ String *Item_func_min_max::val_str(String *str)
|
|||
}
|
||||
case STRING_RESULT:
|
||||
{
|
||||
String *res;
|
||||
LINT_INIT(res);
|
||||
String *UNINIT_VAR(res);
|
||||
for (uint i=0; i < arg_count ; i++)
|
||||
{
|
||||
if (i == 0)
|
||||
|
@ -2462,8 +2423,7 @@ longlong Item_func_min_max::val_int()
|
|||
my_decimal *Item_func_min_max::val_decimal(my_decimal *dec)
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
my_decimal tmp_buf, *tmp, *res;
|
||||
LINT_INIT(res);
|
||||
my_decimal tmp_buf, *tmp, *UNINIT_VAR(res);
|
||||
|
||||
if (compare_as_dates)
|
||||
{
|
||||
|
@ -4781,6 +4741,19 @@ void Item_func_get_user_var::fix_length_and_dec()
|
|||
}
|
||||
|
||||
|
||||
uint Item_func_get_user_var::decimal_precision() const
|
||||
{
|
||||
uint precision= max_length;
|
||||
Item_result restype= result_type();
|
||||
|
||||
/* Default to maximum as the precision is unknown a priori. */
|
||||
if ((restype == DECIMAL_RESULT) || (restype == INT_RESULT))
|
||||
precision= DECIMAL_MAX_PRECISION;
|
||||
|
||||
return precision;
|
||||
}
|
||||
|
||||
|
||||
bool Item_func_get_user_var::const_item() const
|
||||
{
|
||||
return (!var_entry || current_thd->query_id != var_entry->update_query_id);
|
||||
|
@ -5444,8 +5417,7 @@ void Item_func_match::init_search(bool no_order)
|
|||
bool Item_func_match::fix_fields(THD *thd, Item **ref)
|
||||
{
|
||||
DBUG_ASSERT(fixed == 0);
|
||||
Item *item;
|
||||
LINT_INIT(item); // Safe as arg_count is > 1
|
||||
Item *UNINIT_VAR(item); // Safe as arg_count is > 1
|
||||
|
||||
maybe_null=1;
|
||||
join_key=0;
|
||||
|
|
|
@ -1393,6 +1393,7 @@ public:
|
|||
table_map used_tables() const
|
||||
{ return const_item() ? 0 : RAND_TABLE_BIT; }
|
||||
bool eq(const Item *item, bool binary_cmp) const;
|
||||
uint decimal_precision() const;
|
||||
private:
|
||||
bool set_value(THD *thd, sp_rcontext *ctx, Item **it);
|
||||
|
||||
|
|
|
@ -517,8 +517,7 @@ Field *Item_sum::create_tmp_field(bool group, TABLE *table,
|
|||
name, table->s, collation.collation);
|
||||
break;
|
||||
case DECIMAL_RESULT:
|
||||
field= new Field_new_decimal(max_length, maybe_null, name,
|
||||
decimals, unsigned_flag);
|
||||
field= Field_new_decimal::new_decimal_field(this);
|
||||
break;
|
||||
case ROW_RESULT:
|
||||
default:
|
||||
|
|
|
@ -960,9 +960,9 @@ enum_monotonicity_info Item_func_to_days::get_monotonicity_info() const
|
|||
if (args[0]->type() == Item::FIELD_ITEM)
|
||||
{
|
||||
if (args[0]->field_type() == MYSQL_TYPE_DATE)
|
||||
return MONOTONIC_STRICT_INCREASING;
|
||||
return MONOTONIC_STRICT_INCREASING_NOT_NULL;
|
||||
if (args[0]->field_type() == MYSQL_TYPE_DATETIME)
|
||||
return MONOTONIC_INCREASING;
|
||||
return MONOTONIC_INCREASING_NOT_NULL;
|
||||
}
|
||||
return NON_MONOTONIC;
|
||||
}
|
||||
|
@ -973,12 +973,27 @@ longlong Item_func_to_days::val_int_endpoint(bool left_endp, bool *incl_endp)
|
|||
DBUG_ASSERT(fixed == 1);
|
||||
MYSQL_TIME ltime;
|
||||
longlong res;
|
||||
if (get_arg0_date(<ime, TIME_NO_ZERO_DATE))
|
||||
int dummy; /* unused */
|
||||
if (get_arg0_date(<ime, TIME_FUZZY_DATE))
|
||||
{
|
||||
/* got NULL, leave the incl_endp intact */
|
||||
return LONGLONG_MIN;
|
||||
}
|
||||
res=(longlong) calc_daynr(ltime.year,ltime.month,ltime.day);
|
||||
/* Set to NULL if invalid date, but keep the value */
|
||||
null_value= check_date(<ime,
|
||||
(ltime.year || ltime.month || ltime.day),
|
||||
(TIME_NO_ZERO_IN_DATE | TIME_NO_ZERO_DATE),
|
||||
&dummy);
|
||||
if (null_value)
|
||||
{
|
||||
/*
|
||||
Even if the evaluation return NULL, the calc_daynr is useful for pruning
|
||||
*/
|
||||
if (args[0]->field_type() != MYSQL_TYPE_DATE)
|
||||
*incl_endp= TRUE;
|
||||
return res;
|
||||
}
|
||||
|
||||
if (args[0]->field_type() == MYSQL_TYPE_DATE)
|
||||
{
|
||||
|
@ -991,15 +1006,19 @@ longlong Item_func_to_days::val_int_endpoint(bool left_endp, bool *incl_endp)
|
|||
point to day bound ("strictly less" comparison stays intact):
|
||||
|
||||
col < '2007-09-15 00:00:00' -> TO_DAYS(col) < TO_DAYS('2007-09-15')
|
||||
col > '2007-09-15 23:59:59' -> TO_DAYS(col) > TO_DAYS('2007-09-15')
|
||||
|
||||
which is different from the general case ("strictly less" changes to
|
||||
"less or equal"):
|
||||
|
||||
col < '2007-09-15 12:34:56' -> TO_DAYS(col) <= TO_DAYS('2007-09-15')
|
||||
*/
|
||||
if (!left_endp && !(ltime.hour || ltime.minute || ltime.second ||
|
||||
ltime.second_part))
|
||||
; /* do nothing */
|
||||
if ((!left_endp && !(ltime.hour || ltime.minute || ltime.second ||
|
||||
ltime.second_part)) ||
|
||||
(left_endp && ltime.hour == 23 && ltime.minute == 59 &&
|
||||
ltime.second == 59))
|
||||
/* do nothing */
|
||||
;
|
||||
else
|
||||
*incl_endp= TRUE;
|
||||
return res;
|
||||
|
|
|
@ -1472,11 +1472,10 @@ void unlock_global_read_lock(THD *thd)
|
|||
bool wait_if_global_read_lock(THD *thd, bool abort_on_refresh,
|
||||
bool is_not_commit)
|
||||
{
|
||||
const char *old_message;
|
||||
const char *UNINIT_VAR(old_message);
|
||||
bool result= 0, need_exit_cond;
|
||||
DBUG_ENTER("wait_if_global_read_lock");
|
||||
|
||||
LINT_INIT(old_message);
|
||||
/*
|
||||
Assert that we do not own LOCK_open. If we would own it, other
|
||||
threads could not close their tables. This would make a pretty
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue