Merge mysql-trunk-bugfixing -> mysql-next-mr-bugfixing.

This commit is contained in:
Alexander Nozdrin 2009-09-16 11:03:35 +04:00
commit a7cf9a777b
167 changed files with 6865 additions and 907 deletions

View file

@ -73,6 +73,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 ...
@ -137,10 +142,6 @@ check_cpu () {
*i386*)
cpu_arg="i386"
;;
#Core 2 Duo
*Intel*Core\(TM\)2*)
cpu_arg="nocona"
;;
# Intel ia64
*Itanium*)
cpu_arg="itanium"

View file

@ -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;

View file

@ -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));

View file

@ -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;

View file

@ -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)

View file

@ -431,10 +431,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, ...)
@ -1163,6 +1165,7 @@ void free_used_memory()
mysql_server_end();
/* Don't use DBUG after mysql_server_end() */
DBUG_VIOLATION_HELPER_LEAVE;
return;
}
@ -2485,7 +2488,7 @@ void do_source(struct st_command *command)
}
dynstr_free(&ds_filename);
return;
DBUG_VOID_RETURN;
}
@ -3705,10 +3708,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)))
@ -5240,13 +5242,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));
@ -6478,8 +6479,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)
{
@ -7508,6 +7508,8 @@ static void init_signal_handling(void)
#endif
sigaction(SIGILL, &sa, NULL);
sigaction(SIGFPE, &sa, NULL);
DBUG_VOID_RETURN;
}
#endif /* !__WIN__ */
@ -8122,6 +8124,8 @@ void do_get_replace_column(struct st_command *command)
}
my_free(start, MYF(0));
command->last_argument= command->end;
DBUG_VOID_RETURN;
}

View file

@ -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)

View file

@ -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. */

View file

@ -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;

View file

@ -16,6 +16,29 @@
#ifndef _dbug_h
#define _dbug_h
#if defined(__cplusplus) && !defined(DBUG_OFF)
class Dbug_violation_helper
{
public:
inline Dbug_violation_helper() :
_entered(TRUE)
{ }
inline ~Dbug_violation_helper()
{
assert(!_entered);
}
inline void leave()
{
_entered= FALSE;
}
private:
bool _entered;
};
#endif /* C++ */
#ifdef __cplusplus
extern "C" {
#endif
@ -47,11 +70,31 @@ extern void _db_lock_file_(void);
extern void _db_unlock_file_(void);
extern FILE *_db_fp_(void);
#define DBUG_ENTER(a) const char *_db_func_, *_db_file_; uint _db_level_; \
char **_db_framep_; \
_db_enter_ (a,__FILE__,__LINE__,&_db_func_,&_db_file_,&_db_level_, \
&_db_framep_)
#ifdef __cplusplus
#define DBUG_ENTER(a) \
const char *_db_func_, *_db_file_; \
uint _db_level_; \
char **_db_framep_; \
Dbug_violation_helper dbug_violation_helper; \
_db_enter_ (a, __FILE__, __LINE__, &_db_func_, &_db_file_, \
&_db_level_, &_db_framep_)
#define DBUG_VIOLATION_HELPER_LEAVE dbug_violation_helper.leave()
#else /* C */
#define DBUG_ENTER(a) \
const char *_db_func_, *_db_file_; \
uint _db_level_; \
char **_db_framep_; \
_db_enter_ (a, __FILE__, __LINE__, &_db_func_, &_db_file_, \
&_db_level_, &_db_framep_)
#define DBUG_VIOLATION_HELPER_LEAVE do { } while(0)
#endif /* C++ */
#define DBUG_LEAVE \
DBUG_VIOLATION_HELPER_LEAVE; \
_db_return_ (__LINE__, &_db_func_, &_db_file_, &_db_level_)
#define DBUG_RETURN(a1) do {DBUG_LEAVE; return(a1);} while(0)
#define DBUG_VOID_RETURN do {DBUG_LEAVE; return;} while(0)
@ -85,6 +128,7 @@ extern FILE *_db_fp_(void);
#define DBUG_ENTER(a1)
#define DBUG_LEAVE
#define DBUG_VIOLATION_HELPER_LEAVE
#define DBUG_RETURN(a1) do { return(a1); } while(0)
#define DBUG_VOID_RETURN do { return; } while(0)
#define DBUG_EXECUTE(keyword,a1) do { } while(0)

View file

@ -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

View file

@ -67,6 +67,7 @@ extern int NEAR my_errno; /* Last error in mysys */
#define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */
#define MY_DONT_OVERWRITE_FILE 1024 /* my_copy: Don't overwrite file */
#define MY_THREADSAFE 2048 /* my_seek(): lock fd mutex */
#define MY_SYNC 4096 /* my_copy(): sync dst file */
#define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */
#define MY_GIVE_INFO 2 /* Give time info about process*/

View file

@ -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

View file

@ -163,5 +163,81 @@ show create table t1;
connection master;
drop table t1;
# End cleanup
#
# BUG#45999 Row based replication fails when auto_increment field = 0.
# Store engine of Slaves auto-generates new sequence numbers for
# auto_increment fields if the values of them are 0. There is an inconsistency
# between slave and master. When MODE_NO_AUTO_VALUE_ON_ZERO are masters treat
#
source include/master-slave-reset.inc;
connection master;
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
--enable_warnings
eval CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=$engine_type;
eval CREATE TABLE t2 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=$engine_type2;
SET SQL_MODE='';
# Value of the id will be 1;
INSERT INTO t1 VALUES(NULL);
INSERT INTO t2 VALUES(NULL);
SELECT * FROM t1;
SELECT * FROM t2;
# Value of the id will be 2;
INSERT INTO t1 VALUES();
INSERT INTO t2 VALUES();
SELECT * FROM t1;
SELECT * FROM t2;
# Value of the id will be 3. The master treats 0 as NULL or empty because
# NO_AUTO_VALUE_ON_ZERO is not assign to SQL_MODE.
INSERT INTO t1 VALUES(0);
INSERT INTO t2 VALUES(0);
SELECT * FROM t1;
SELECT * FROM t2;
SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
# Value of the id will be 0. The master does not treat 0 as NULL or empty
# because NO_AUTO_VALUE_ON_ZERO has assigned to SQL_MODE.
INSERT INTO t1 VALUES(0);
INSERT INTO t2 VALUES(0);
SELECT * FROM t1;
SELECT * FROM t2;
INSERT INTO t1 VALUES(4);
INSERT INTO t2 VALUES(4);
FLUSH LOGS;
sync_slave_with_master;
let $diff_table_1= master:test.t1;
let $diff_table_2= slave:test.t1;
source include/diff_tables.inc;
let $diff_table_1= master:test.t2;
let $diff_table_2= slave:test.t2;
source include/diff_tables.inc;
connection master;
DROP TABLE t1;
DROP TABLE t2;
sync_slave_with_master;
connection master;
let $MYSQLD_DATADIR= `SELECT @@DATADIR`;
--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 | $MYSQL test
sync_slave_with_master;
let $diff_table_1= master:test.t1;
let $diff_table_2= slave:test.t1;
source include/diff_tables.inc;
let $diff_table_1= master:test.t2;
let $diff_table_2= slave:test.t2;
source include/diff_tables.inc;
# End cleanup
DROP TABLE t1;
DROP TABLE t2;
SET SQL_MODE='';
sync_slave_with_master;

View 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;

View file

@ -9,29 +9,27 @@
#############################################################################
# Begin clean up test section
connection master;
--disable_warnings
create database if not exists mysqltest1;
DROP PROCEDURE IF EXISTS mysqltest1.p1;
DROP PROCEDURE IF EXISTS mysqltest1.p2;
DROP TABLE IF EXISTS mysqltest1.t2;
DROP TABLE IF EXISTS mysqltest1.t1;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p2;
--enable_warnings
# End of cleanup
# Begin test section 1
eval CREATE TABLE IF NOT EXISTS mysqltest1.t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=$engine_type;
eval CREATE TABLE IF NOT EXISTS mysqltest1.t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=$engine_type;
eval CREATE TABLE IF NOT EXISTS t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=$engine_type;
eval CREATE TABLE IF NOT EXISTS t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=$engine_type;
delimiter |;
CREATE PROCEDURE mysqltest1.p1()
CREATE PROCEDURE p1()
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE spa CHAR(16);
DECLARE spb INT;
DECLARE cur1 CURSOR FOR SELECT name,
(YEAR(CURDATE())-YEAR(birth))-(RIGHT(CURDATE(),5)<RIGHT(birth,5))
FROM mysqltest1.t1;
FROM t1;
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
OPEN cur1;
@ -41,7 +39,7 @@ BEGIN
FETCH cur1 INTO spa, spb;
IF NOT done THEN
START TRANSACTION;
INSERT INTO mysqltest1.t2 VALUES (spa,spb);
INSERT INTO t2 VALUES (spa,spb);
COMMIT;
END IF;
UNTIL done END REPEAT;
@ -49,30 +47,29 @@ BEGIN
SET AUTOCOMMIT=1;
CLOSE cur1;
END|
CREATE PROCEDURE mysqltest1.p2()
CREATE PROCEDURE p2()
BEGIN
INSERT INTO mysqltest1.t1 VALUES ('MySQL','1993-02-04'),('ROCKS', '1990-08-27'),('Texas', '1999-03-30'),('kyle','2005-1-1');
INSERT INTO t1 VALUES ('MySQL','1993-02-04'),('ROCKS', '1990-08-27'),('Texas', '1999-03-30'),('kyle','2005-1-1');
END|
delimiter ;|
CALL mysqltest1.p2();
CALL p2();
sync_slave_with_master;
connection master;
CALL mysqltest1.p1();
CALL p1();
sync_slave_with_master;
connection master;
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/sp006_master.sql
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/sp006_slave.sql
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp006_master.sql
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp006_slave.sql
DROP PROCEDURE IF EXISTS mysqltest1.p1;
DROP PROCEDURE IF EXISTS mysqltest1.p2;
DROP TABLE IF EXISTS mysqltest1.t1;
DROP TABLE IF EXISTS mysqltest1.t2;
DROP DATABASE mysqltest1;
DROP TABLE t1;
DROP TABLE t2;
DROP PROCEDURE p1;
DROP PROCEDURE p2;
# Lets compare. Note: If they match test will pass, if they do not match
# the test will show that the diff statement failed and not reject file

View file

@ -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;

View file

@ -0,0 +1,7 @@
#
# Whether server supports dynamic loading.
#
--require r/have_dynamic_loading.require
disable_query_log;
show variables like 'have_dynamic_loading';
enable_query_log;

View file

@ -2,10 +2,7 @@
# Check if server has support for loading udf's
# i.e it will support dlopen
#
--require r/have_dynamic_loading.require
disable_query_log;
show variables like 'have_dynamic_loading';
enable_query_log;
--source include/have_dynamic_loading.inc
#
# Check if the variable EXAMPLE_PLUGIN is set

View file

@ -2,10 +2,7 @@
# Check if server has support for loading udf's
# i.e it will support dlopen
#
--require r/have_dynamic_loading.require
disable_query_log;
show variables like 'have_dynamic_loading';
enable_query_log;
--source include/have_dynamic_loading.inc
#
# Check if the variable SIMPLE_PARSER is set

View file

@ -2,10 +2,7 @@
# Check if server has support for loading udf's
# i.e it will support dlopen
#
--require r/have_dynamic_loading.require
disable_query_log;
show variables like 'have_dynamic_loading';
enable_query_log;
--source include/have_dynamic_loading.inc
#
# Check if the variable UDF_EXAMPLE_LIB is set

View 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';
}

View file

@ -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

View file

@ -12695,3 +12695,25 @@ a b
1 NULL
2 NULL
DROP TABLE t1;
CREATE TABLE t1(a INT, b BLOB) ENGINE=archive;
SELECT DATA_LENGTH, AVG_ROW_LENGTH FROM
INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test';
DATA_LENGTH AVG_ROW_LENGTH
8666 15
INSERT INTO t1 VALUES(1, 'sampleblob1'),(2, 'sampleblob2');
SELECT DATA_LENGTH, AVG_ROW_LENGTH FROM
INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test';
DATA_LENGTH AVG_ROW_LENGTH
8700 4350
DROP TABLE t1;
SET @save_join_buffer_size= @@join_buffer_size;
SET @@join_buffer_size= 8228;
CREATE TABLE t1(a CHAR(255)) ENGINE=archive;
INSERT INTO t1 VALUES('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),
('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),
('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
SELECT COUNT(t1.a) FROM t1, t1 a, t1 b, t1 c, t1 d, t1 e;
COUNT(t1.a)
729
DROP TABLE t1;
SET @@join_buffer_size= @save_join_buffer_size;

View file

@ -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

View file

@ -1572,6 +1572,19 @@ CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
SELECT a FROM t1;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
DROP TABLE t1, t2;
#
# BUG#46384 - mysqld segfault when trying to create table with same
# name as existing view
#
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT);
INSERT INTO t1 VALUES (1),(2),(3);
INSERT INTO t2 VALUES (1),(2),(3);
CREATE VIEW v1 AS SELECT t1.a FROM t1, t2;
CREATE TABLE v1 AS SELECT * FROM t1;
ERROR 42S01: Table 'v1' already exists
DROP VIEW v1;
DROP TABLE t1,t2;
End of 5.0 tests
CREATE TABLE t1 (a int, b int);
insert into t1 values (1,1),(1,2);

View file

@ -1,3 +1,4 @@
RESET MASTER;
SET NAMES gbk;
CREATE TABLE t1 (
f1 BLOB

View file

@ -763,4 +763,34 @@ a b d c
1 2 0 2
1 2 0 3
DROP TABLE t1;
#
# Bug #46159: simple query that never returns
#
SET @old_max_heap_table_size = @@max_heap_table_size;
SET @@max_heap_table_size = 16384;
SET @old_sort_buffer_size = @@sort_buffer_size;
SET @@sort_buffer_size = 32804;
CREATE TABLE t1(c1 int, c2 VARCHAR(20));
INSERT INTO t1 VALUES (1, '1'), (1, '1'), (2, '2'), (3, '1'), (3, '1'), (4, '4');
INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
SELECT c1, c2, COUNT(*) FROM t1 GROUP BY c1 LIMIT 4;
c1 c2 COUNT(*)
1 1 2
2 2 1
3 1 2
4 4 1
SELECT DISTINCT c2 FROM t1 GROUP BY c1 HAVING COUNT(*) > 1;
c2
1
5
DROP TABLE t1;
SET @@sort_buffer_size = @old_sort_buffer_size;
SET @@max_heap_table_size = @old_max_heap_table_size;
End of 5.1 tests

View file

@ -159,6 +159,14 @@ CREATE TABLE t1 (a INT PRIMARY KEY);
EXPLAIN EXTENDED SELECT COUNT(a) FROM t1 USE KEY(a);
ERROR 42000: Key 'a' doesn't exist in table 't1'
DROP TABLE t1;
CREATE TABLE t1(a LONGTEXT);
INSERT INTO t1 VALUES (repeat('a',@@global.max_allowed_packet));
INSERT INTO t1 VALUES (repeat('b',@@global.max_allowed_packet));
EXPLAIN SELECT DISTINCT 1 FROM t1,
(SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) as d1
WHERE t1.a = d1.a;
ERROR 42S22: Unknown column 'd1.a' in 'where clause'
DROP TABLE t1;
#
# Bug#37870: Usage of uninitialized value caused failed assertion.
#

View file

@ -2534,6 +2534,15 @@ SELECT LOAD_FILE(a) FROM t1;
LOAD_FILE(a)
NULL
DROP TABLE t1;
CREATE TABLE t1 (f2 VARCHAR(20));
CREATE TABLE t2 (f2 VARCHAR(20));
INSERT INTO t1 VALUES ('MIN'),('MAX');
INSERT INTO t2 VALUES ('LOAD');
SELECT CONCAT_WS('_', (SELECT t2.f2 FROM t2), t1.f2) AS concat_name FROM t1;
concat_name
LOAD_MIN
LOAD_MAX
DROP TABLE t1, t2;
End of 5.0 tests
drop table if exists t1;
create table t1(f1 tinyint default null)engine=myisam;

View file

@ -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

View file

@ -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;

View file

@ -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;

View file

@ -0,0 +1,6 @@
drop table if exists t1;
create table t1 (id int) engine=InnoDB;
insert into t1 values (1);
create temporary table t2 engine=InnoDB select * from t1;
drop temporary table t2;
drop table t1;

View file

@ -1,4 +1,4 @@
flush logs;
RESET MASTER;
create table t3 (f text character set utf8);
create table t4 (f text character set cp932);
flush logs;

View file

@ -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

View file

@ -1,4 +1,18 @@
drop table if exists t1;
create table t1 (a int not null,
b datetime not null,
primary key (a,b))
engine=innodb
partition by range (to_days(b))
subpartition by hash (a)
subpartitions 2
( partition p0 values less than (to_days('2009-01-01')),
partition p1 values less than (to_days('2009-02-01')),
partition p2 values less than (to_days('2009-03-01')),
partition p3 values less than maxvalue);
alter table t1 reorganize partition p1,p2 into
( partition p2 values less than (to_days('2009-03-01')));
drop table t1;
CREATE TABLE t1 (id INT PRIMARY KEY, data INT) ENGINE = InnoDB
PARTITION BY RANGE(id) (
PARTITION p0 VALUES LESS THAN (5),
@ -250,3 +264,7 @@ SUBPARTITION BY KEY (char_column)
SUBPARTITIONS 2
(PARTITION p1 VALUES LESS THAN (5) ENGINE = MyISAM) */
drop table t1;
CREATE TABLE t1 (a INT) ENGINE=InnoDB
PARTITION BY list(a) (PARTITION p1 VALUES IN (1));
CREATE INDEX i1 ON t1 (a);
DROP TABLE t1;

File diff suppressed because it is too large Load diff

View file

@ -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);

View file

@ -6963,6 +6963,22 @@ CALL p1();
CALL p1();
DROP PROCEDURE p1;
DROP TABLE t1;
#
# Bug #46629: Item_in_subselect::val_int(): Assertion `0'
# on subquery inside a SP
#
CREATE TABLE t1(a INT);
CREATE TABLE t2(a INT, b INT PRIMARY KEY);
CREATE PROCEDURE p1 ()
BEGIN
SELECT a FROM t1 A WHERE A.b IN (SELECT b FROM t2 AS B);
END|
CALL p1;
ERROR 42S22: Unknown column 'A.b' in 'IN/ALL/ANY subquery'
CALL p1;
ERROR 42S22: Unknown column 'A.b' in 'IN/ALL/ANY subquery'
DROP PROCEDURE p1;
DROP TABLE t1, t2;
# ------------------------------------------------------------------
# -- End of 5.1 tests
# ------------------------------------------------------------------

View file

@ -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);

View file

@ -0,0 +1,30 @@
#
# Bug #46791: Assertion failed:(table->key_read==0),function unknown
# function,file sql_base.cc
#
CREATE TABLE t1 (a INT, b INT, KEY(a));
INSERT INTO t1 VALUES (1,1),(2,2);
CREATE TABLE t2 LIKE t1;
INSERT INTO t2 VALUES (1,1),(2,2);
CREATE TABLE t3 LIKE t1;
# should have 1 impossible where and 2 dependent subqueries
EXPLAIN
SELECT 1 FROM t1
WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3))
ORDER BY count(*);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL a 5 NULL 2 Using index; Using temporary
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
# should not crash the next statement
SELECT 1 FROM t1
WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3))
ORDER BY count(*);
1
1
# should not crash: the crash is caused by the previous statement
SELECT 1;
1
1
DROP TABLE t1,t2,t3;
End of 5.0 tests.

View file

@ -392,4 +392,20 @@ a
4
DROP FUNCTION sequence;
DROP TABLE t1,t2;
#
# Bug#46259: 5.0.83 -> 5.1.36, query doesn't work
#
CREATE TABLE t1 ( a INT );
INSERT INTO t1 VALUES (1), (2), (3);
SELECT IF( a = 1, a, a ) AS `b` FROM t1 ORDER BY field( `b` + 1, 1 );
b
1
2
3
SELECT IF( a = 1, a, a ) AS `b` FROM t1 ORDER BY field( `b`, 1 );
b
2
3
1
DROP TABLE t1;
End of 5.0 tests.

View file

@ -313,4 +313,9 @@ ERROR 22001: Data too long for column 'c_tinytext' at row 1
insert into t2 values(@q);
ERROR 22001: Data too long for column 'c_tinyblob' at row 1
drop table t1, t2;
DROP TABLE t1;
ERROR 42S02: Unknown table 't1'
SHOW ERRORS;
Level Code Message
Error 1051 Unknown table 't1'
End of 5.0 tests

View file

@ -1,3 +1,4 @@
RESET MASTER;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3);
SELECT * FROM t1;

View file

@ -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

View file

@ -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`;

View file

@ -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

View file

@ -1,3 +1,4 @@
RESET MASTER;
create table foo (a int);
flush logs;
create temporary table tmp1_foo like foo;

View file

@ -6,6 +6,7 @@ source include/have_log_bin.inc;
source include/have_debug.inc;
let $MYSQLD_DATADIR= `select @@datadir`;
RESET MASTER;
CREATE TABLE t1 (a INT);
@ -24,4 +25,4 @@ exec $MYSQL_BINLOG --start-position=106 $MYSQLD_DATADIR/master-bin.000001 >$MYSQ
eval SELECT cont LIKE '%RELOAD DATABASE; # Shall generate syntax error%' AS `Contain RELOAD DATABASE` FROM (SELECT load_file('$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql') AS cont) AS tbl;
--enable_query_log
remove_file $MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql;
remove_file $MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql;

View file

@ -30,6 +30,7 @@ source include/have_binlog_format_mixed_or_statement.inc;
connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,);
RESET MASTER;
create table foo (a int);

View file

@ -623,3 +623,195 @@ SHOW CREATE TABLE t1;
SELECT * FROM t1 ORDER BY c1;
DROP TABLE t1;
if (!$skip_negative_auto_inc)
{
--echo #############################################################################
--echo # Bug #45823 - Assertion failure in file row/row0mysql.c line 1386
--echo # Bug #43988 - AUTO_INCREMENT errors with partitioned InnoDB tables in 5.1.31
--echo ##############################################################################
--echo # Inserting negative autoincrement values into a partition table (partitions >= 4)
eval CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE=$engine PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (-1,-10);
INSERT INTO t(c2) VALUES (30);
INSERT INTO t(c2) VALUES (40);
SELECT * FROM t ORDER BY c1 ASC;
DROP TABLE t;
--echo # Reading from a partition table (partitions >= 2 ) after inserting a negative
--echo # value into the auto increment column
eval CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE=$engine PARTITION BY HASH(c1) PARTITIONS 2;
INSERT INTO t VALUES (-2,-20);
INSERT INTO t(c2) VALUES (30);
SELECT * FROM t ORDER BY c1 ASC;
DROP TABLE t;
--echo # Inserting negative auto increment value into a partition table (partitions >= 2)
--echo # auto increment value > 2.
eval CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE=$engine PARTITION BY HASH(c1) PARTITIONS 2;
INSERT INTO t VALUES (-4,-20);
INSERT INTO t(c2) VALUES (30);
INSERT INTO t(c2) VALUES (40);
SELECT * FROM t ORDER BY c1 ASC;
DROP TABLE t;
--echo # Inserting -1 into autoincrement column of a partition table (partition >= 4)
eval CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE=$engine PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (-1,-10);
SELECT * FROM t ORDER BY c1 ASC;
INSERT INTO t(c2) VALUES (30);
SELECT * FROM t ORDER BY c1 ASC;
DROP TABLE t;
--echo # Deleting from an auto increment table after inserting negative values
eval CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE=$engine PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (-1,-10);
INSERT INTO t(c2) VALUES (30);
INSERT INTO t VALUES (-3,-20);
INSERT INTO t(c2) VALUES (40);
SELECT * FROM t ORDER BY c1 ASC;
if (!$skip_delete)
{
DELETE FROM t WHERE c1 > 1;
}
SELECT * FROM t ORDER BY c1 ASC;
DROP TABLE t;
--echo # Inserting a positive value that exceeds maximum allowed value for an
--echo # Auto Increment column (positive maximum)
eval CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE=$engine PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (126,30);
INSERT INTO t VALUES (127,40);
--error ER_DUP_ENTRY
INSERT INTO t VALUES (128,50);
--error ER_DUP_ENTRY
INSERT INTO t VALUES (129,60);
SELECT * FROM t ORDER BY c1 ASC;
DROP TABLE t;
--echo # Inserting a negative value that goes below minimum allowed value for an
--echo # Auto Increment column (negative minimum)
eval CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE=$engine PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (-127,30);
INSERT INTO t VALUES (-128,40);
--error ER_DUP_ENTRY
INSERT INTO t VALUES (-129,50);
--error ER_DUP_ENTRY
INSERT INTO t VALUES (-130,60);
SELECT * FROM t ORDER BY c1 ASC;
DROP TABLE t;
--echo # Updating the partition table with a negative Auto Increment value
eval CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE=$engine PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (-1,-10);
INSERT INTO t(c2) VALUES (30);
SELECT * FROM t ORDER BY c1 ASC;
if (!$skip_update)
{
UPDATE t SET c1 = -6 WHERE c1 = 2;
}
SELECT * FROM t ORDER BY c1 ASC;
INSERT INTO t(c2) VALUES (40);
INSERT INTO t(c2) VALUES (50);
if (!$skip_update)
{
UPDATE t SET c1 = -6 WHERE c1 = 2;
}
SELECT * FROM t ORDER BY c1 ASC;
DROP TABLE t;
--echo # Updating the partition table with a value that crosses the upper limits
--echo # on both the positive and the negative side.
eval CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE=$engine PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (126,30);
INSERT INTO t VALUES (127,40);
SELECT * FROM t ORDER BY c1 ASC;
if (!$skip_update)
{
UPDATE t SET c1 = 130 where c1 = 127;
}
SELECT * FROM t ORDER BY c1 ASC;
if (!$skip_update)
{
UPDATE t SET c1 = -140 where c1 = 126;
}
SELECT * FROM t ORDER BY c1 ASC;
DROP TABLE t;
--echo ##############################################################################
}

View file

@ -825,3 +825,194 @@ c1
4
5
DROP TABLE t1;
#############################################################################
# Bug #45823 - Assertion failure in file row/row0mysql.c line 1386
# Bug #43988 - AUTO_INCREMENT errors with partitioned InnoDB tables in 5.1.31
##############################################################################
# Inserting negative autoincrement values into a partition table (partitions >= 4)
CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='InnoDB' PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (-1,-10);
INSERT INTO t(c2) VALUES (30);
INSERT INTO t(c2) VALUES (40);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-1 -10
1 10
2 20
3 30
4 40
DROP TABLE t;
# Reading from a partition table (partitions >= 2 ) after inserting a negative
# value into the auto increment column
CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='InnoDB' PARTITION BY HASH(c1) PARTITIONS 2;
INSERT INTO t VALUES (-2,-20);
INSERT INTO t(c2) VALUES (30);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-2 -20
1 30
DROP TABLE t;
# Inserting negative auto increment value into a partition table (partitions >= 2)
# auto increment value > 2.
CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='InnoDB' PARTITION BY HASH(c1) PARTITIONS 2;
INSERT INTO t VALUES (-4,-20);
INSERT INTO t(c2) VALUES (30);
INSERT INTO t(c2) VALUES (40);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-4 -20
1 30
2 40
DROP TABLE t;
# Inserting -1 into autoincrement column of a partition table (partition >= 4)
CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='InnoDB' PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (-1,-10);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-1 -10
1 10
2 20
INSERT INTO t(c2) VALUES (30);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-1 -10
1 10
2 20
3 30
DROP TABLE t;
# Deleting from an auto increment table after inserting negative values
CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='InnoDB' PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (-1,-10);
INSERT INTO t(c2) VALUES (30);
INSERT INTO t VALUES (-3,-20);
INSERT INTO t(c2) VALUES (40);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-3 -20
-1 -10
1 10
2 20
3 30
4 40
DELETE FROM t WHERE c1 > 1;
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-3 -20
-1 -10
1 10
DROP TABLE t;
# Inserting a positive value that exceeds maximum allowed value for an
# Auto Increment column (positive maximum)
CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='InnoDB' PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (126,30);
INSERT INTO t VALUES (127,40);
INSERT INTO t VALUES (128,50);
ERROR 23000: Duplicate entry '127' for key 'PRIMARY'
INSERT INTO t VALUES (129,60);
ERROR 23000: Duplicate entry '127' for key 'PRIMARY'
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
1 10
2 20
126 30
127 40
DROP TABLE t;
# Inserting a negative value that goes below minimum allowed value for an
# Auto Increment column (negative minimum)
CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='InnoDB' PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (-127,30);
INSERT INTO t VALUES (-128,40);
INSERT INTO t VALUES (-129,50);
ERROR 23000: Duplicate entry '-128' for key 'PRIMARY'
INSERT INTO t VALUES (-130,60);
ERROR 23000: Duplicate entry '-128' for key 'PRIMARY'
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-128 40
-127 30
1 10
2 20
DROP TABLE t;
# Updating the partition table with a negative Auto Increment value
CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='InnoDB' PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (-1,-10);
INSERT INTO t(c2) VALUES (30);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-1 -10
1 10
2 20
3 30
UPDATE t SET c1 = -6 WHERE c1 = 2;
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-6 20
-1 -10
1 10
3 30
INSERT INTO t(c2) VALUES (40);
INSERT INTO t(c2) VALUES (50);
UPDATE t SET c1 = -6 WHERE c1 = 2;
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-6 20
-1 -10
1 10
3 30
4 40
5 50
DROP TABLE t;
# Updating the partition table with a value that crosses the upper limits
# on both the positive and the negative side.
CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='InnoDB' PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (126,30);
INSERT INTO t VALUES (127,40);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
1 10
2 20
126 30
127 40
UPDATE t SET c1 = 130 where c1 = 127;
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
1 10
2 20
126 30
127 40
UPDATE t SET c1 = -140 where c1 = 126;
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-128 30
1 10
2 20
127 40
DROP TABLE t;
##############################################################################

View file

@ -851,3 +851,194 @@ c1
4
5
DROP TABLE t1;
#############################################################################
# Bug #45823 - Assertion failure in file row/row0mysql.c line 1386
# Bug #43988 - AUTO_INCREMENT errors with partitioned InnoDB tables in 5.1.31
##############################################################################
# Inserting negative autoincrement values into a partition table (partitions >= 4)
CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='Memory' PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (-1,-10);
INSERT INTO t(c2) VALUES (30);
INSERT INTO t(c2) VALUES (40);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-1 -10
1 10
2 20
3 30
4 40
DROP TABLE t;
# Reading from a partition table (partitions >= 2 ) after inserting a negative
# value into the auto increment column
CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='Memory' PARTITION BY HASH(c1) PARTITIONS 2;
INSERT INTO t VALUES (-2,-20);
INSERT INTO t(c2) VALUES (30);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-2 -20
1 30
DROP TABLE t;
# Inserting negative auto increment value into a partition table (partitions >= 2)
# auto increment value > 2.
CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='Memory' PARTITION BY HASH(c1) PARTITIONS 2;
INSERT INTO t VALUES (-4,-20);
INSERT INTO t(c2) VALUES (30);
INSERT INTO t(c2) VALUES (40);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-4 -20
1 30
2 40
DROP TABLE t;
# Inserting -1 into autoincrement column of a partition table (partition >= 4)
CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='Memory' PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (-1,-10);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-1 -10
1 10
2 20
INSERT INTO t(c2) VALUES (30);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-1 -10
1 10
2 20
3 30
DROP TABLE t;
# Deleting from an auto increment table after inserting negative values
CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='Memory' PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (-1,-10);
INSERT INTO t(c2) VALUES (30);
INSERT INTO t VALUES (-3,-20);
INSERT INTO t(c2) VALUES (40);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-3 -20
-1 -10
1 10
2 20
3 30
4 40
DELETE FROM t WHERE c1 > 1;
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-3 -20
-1 -10
1 10
DROP TABLE t;
# Inserting a positive value that exceeds maximum allowed value for an
# Auto Increment column (positive maximum)
CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='Memory' PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (126,30);
INSERT INTO t VALUES (127,40);
INSERT INTO t VALUES (128,50);
ERROR 23000: Duplicate entry '127' for key 'PRIMARY'
INSERT INTO t VALUES (129,60);
ERROR 23000: Duplicate entry '127' for key 'PRIMARY'
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
1 10
2 20
126 30
127 40
DROP TABLE t;
# Inserting a negative value that goes below minimum allowed value for an
# Auto Increment column (negative minimum)
CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='Memory' PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (-127,30);
INSERT INTO t VALUES (-128,40);
INSERT INTO t VALUES (-129,50);
ERROR 23000: Duplicate entry '-128' for key 'PRIMARY'
INSERT INTO t VALUES (-130,60);
ERROR 23000: Duplicate entry '-128' for key 'PRIMARY'
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-128 40
-127 30
1 10
2 20
DROP TABLE t;
# Updating the partition table with a negative Auto Increment value
CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='Memory' PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (-1,-10);
INSERT INTO t(c2) VALUES (30);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-1 -10
1 10
2 20
3 30
UPDATE t SET c1 = -6 WHERE c1 = 2;
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-6 20
-1 -10
1 10
3 30
INSERT INTO t(c2) VALUES (40);
INSERT INTO t(c2) VALUES (50);
UPDATE t SET c1 = -6 WHERE c1 = 2;
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-6 20
-1 -10
1 10
3 30
4 40
5 50
DROP TABLE t;
# Updating the partition table with a value that crosses the upper limits
# on both the positive and the negative side.
CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='Memory' PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (126,30);
INSERT INTO t VALUES (127,40);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
1 10
2 20
126 30
127 40
UPDATE t SET c1 = 130 where c1 = 127;
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
1 10
2 20
126 30
127 40
UPDATE t SET c1 = -140 where c1 = 126;
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-128 30
1 10
2 20
127 40
DROP TABLE t;
##############################################################################

View file

@ -870,3 +870,194 @@ c1
4
5
DROP TABLE t1;
#############################################################################
# Bug #45823 - Assertion failure in file row/row0mysql.c line 1386
# Bug #43988 - AUTO_INCREMENT errors with partitioned InnoDB tables in 5.1.31
##############################################################################
# Inserting negative autoincrement values into a partition table (partitions >= 4)
CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='MyISAM' PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (-1,-10);
INSERT INTO t(c2) VALUES (30);
INSERT INTO t(c2) VALUES (40);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-1 -10
1 10
2 20
3 30
4 40
DROP TABLE t;
# Reading from a partition table (partitions >= 2 ) after inserting a negative
# value into the auto increment column
CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='MyISAM' PARTITION BY HASH(c1) PARTITIONS 2;
INSERT INTO t VALUES (-2,-20);
INSERT INTO t(c2) VALUES (30);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-2 -20
1 30
DROP TABLE t;
# Inserting negative auto increment value into a partition table (partitions >= 2)
# auto increment value > 2.
CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='MyISAM' PARTITION BY HASH(c1) PARTITIONS 2;
INSERT INTO t VALUES (-4,-20);
INSERT INTO t(c2) VALUES (30);
INSERT INTO t(c2) VALUES (40);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-4 -20
1 30
2 40
DROP TABLE t;
# Inserting -1 into autoincrement column of a partition table (partition >= 4)
CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='MyISAM' PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (-1,-10);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-1 -10
1 10
2 20
INSERT INTO t(c2) VALUES (30);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-1 -10
1 10
2 20
3 30
DROP TABLE t;
# Deleting from an auto increment table after inserting negative values
CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='MyISAM' PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (-1,-10);
INSERT INTO t(c2) VALUES (30);
INSERT INTO t VALUES (-3,-20);
INSERT INTO t(c2) VALUES (40);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-3 -20
-1 -10
1 10
2 20
3 30
4 40
DELETE FROM t WHERE c1 > 1;
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-3 -20
-1 -10
1 10
DROP TABLE t;
# Inserting a positive value that exceeds maximum allowed value for an
# Auto Increment column (positive maximum)
CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='MyISAM' PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (126,30);
INSERT INTO t VALUES (127,40);
INSERT INTO t VALUES (128,50);
ERROR 23000: Duplicate entry '127' for key 'PRIMARY'
INSERT INTO t VALUES (129,60);
ERROR 23000: Duplicate entry '127' for key 'PRIMARY'
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
1 10
2 20
126 30
127 40
DROP TABLE t;
# Inserting a negative value that goes below minimum allowed value for an
# Auto Increment column (negative minimum)
CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='MyISAM' PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (-127,30);
INSERT INTO t VALUES (-128,40);
INSERT INTO t VALUES (-129,50);
ERROR 23000: Duplicate entry '-128' for key 'PRIMARY'
INSERT INTO t VALUES (-130,60);
ERROR 23000: Duplicate entry '-128' for key 'PRIMARY'
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-128 40
-127 30
1 10
2 20
DROP TABLE t;
# Updating the partition table with a negative Auto Increment value
CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='MyISAM' PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (-1,-10);
INSERT INTO t(c2) VALUES (30);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-1 -10
1 10
2 20
3 30
UPDATE t SET c1 = -6 WHERE c1 = 2;
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-6 20
-1 -10
1 10
3 30
INSERT INTO t(c2) VALUES (40);
INSERT INTO t(c2) VALUES (50);
UPDATE t SET c1 = -6 WHERE c1 = 2;
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-6 20
-1 -10
1 10
3 30
4 40
5 50
DROP TABLE t;
# Updating the partition table with a value that crosses the upper limits
# on both the positive and the negative side.
CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='MyISAM' PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (126,30);
INSERT INTO t VALUES (127,40);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
1 10
2 20
126 30
127 40
UPDATE t SET c1 = 130 where c1 = 127;
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
1 10
2 20
126 30
127 40
UPDATE t SET c1 = -140 where c1 = 126;
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-128 30
1 10
2 20
127 40
DROP TABLE t;
##############################################################################

View file

@ -846,3 +846,194 @@ c1
4
5
DROP TABLE t1;
#############################################################################
# Bug #45823 - Assertion failure in file row/row0mysql.c line 1386
# Bug #43988 - AUTO_INCREMENT errors with partitioned InnoDB tables in 5.1.31
##############################################################################
# Inserting negative autoincrement values into a partition table (partitions >= 4)
CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='NDB' PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (-1,-10);
INSERT INTO t(c2) VALUES (30);
INSERT INTO t(c2) VALUES (40);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-1 -10
1 10
2 20
3 30
4 40
DROP TABLE t;
# Reading from a partition table (partitions >= 2 ) after inserting a negative
# value into the auto increment column
CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='NDB' PARTITION BY HASH(c1) PARTITIONS 2;
INSERT INTO t VALUES (-2,-20);
INSERT INTO t(c2) VALUES (30);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-2 -20
1 30
DROP TABLE t;
# Inserting negative auto increment value into a partition table (partitions >= 2)
# auto increment value > 2.
CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='NDB' PARTITION BY HASH(c1) PARTITIONS 2;
INSERT INTO t VALUES (-4,-20);
INSERT INTO t(c2) VALUES (30);
INSERT INTO t(c2) VALUES (40);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-4 -20
1 30
2 40
DROP TABLE t;
# Inserting -1 into autoincrement column of a partition table (partition >= 4)
CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='NDB' PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (-1,-10);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-1 -10
1 10
2 20
INSERT INTO t(c2) VALUES (30);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-1 -10
1 10
2 20
3 30
DROP TABLE t;
# Deleting from an auto increment table after inserting negative values
CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='NDB' PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (-1,-10);
INSERT INTO t(c2) VALUES (30);
INSERT INTO t VALUES (-3,-20);
INSERT INTO t(c2) VALUES (40);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-3 -20
-1 -10
1 10
2 20
3 30
4 40
DELETE FROM t WHERE c1 > 1;
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-3 -20
-1 -10
1 10
DROP TABLE t;
# Inserting a positive value that exceeds maximum allowed value for an
# Auto Increment column (positive maximum)
CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='NDB' PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (126,30);
INSERT INTO t VALUES (127,40);
INSERT INTO t VALUES (128,50);
ERROR 23000: Duplicate entry '127' for key 'PRIMARY'
INSERT INTO t VALUES (129,60);
ERROR 23000: Duplicate entry '127' for key 'PRIMARY'
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
1 10
2 20
126 30
127 40
DROP TABLE t;
# Inserting a negative value that goes below minimum allowed value for an
# Auto Increment column (negative minimum)
CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='NDB' PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (-127,30);
INSERT INTO t VALUES (-128,40);
INSERT INTO t VALUES (-129,50);
ERROR 23000: Duplicate entry '-128' for key 'PRIMARY'
INSERT INTO t VALUES (-130,60);
ERROR 23000: Duplicate entry '-128' for key 'PRIMARY'
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-128 40
-127 30
1 10
2 20
DROP TABLE t;
# Updating the partition table with a negative Auto Increment value
CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='NDB' PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (-1,-10);
INSERT INTO t(c2) VALUES (30);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-1 -10
1 10
2 20
3 30
UPDATE t SET c1 = -6 WHERE c1 = 2;
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-6 20
-1 -10
1 10
3 30
INSERT INTO t(c2) VALUES (40);
INSERT INTO t(c2) VALUES (50);
UPDATE t SET c1 = -6 WHERE c1 = 2;
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-6 20
-1 -10
1 10
3 30
4 40
5 50
DROP TABLE t;
# Updating the partition table with a value that crosses the upper limits
# on both the positive and the negative side.
CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
c2 INT) ENGINE='NDB' PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t(c2) VALUES (10);
INSERT INTO t(c2) VALUES (20);
INSERT INTO t VALUES (126,30);
INSERT INTO t VALUES (127,40);
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
1 10
2 20
126 30
127 40
UPDATE t SET c1 = 130 where c1 = 127;
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
1 10
2 20
126 30
127 40
UPDATE t SET c1 = -140 where c1 = 126;
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
SELECT * FROM t ORDER BY c1 ASC;
c1 c2
-128 30
1 10
2 20
127 40
DROP TABLE t;
##############################################################################

View file

@ -30,6 +30,9 @@ let $skip_delete= 1;
let $skip_truncate= 1;
let $skip_update= 1;
let $only_ai_pk= 1;
# Bug#45823 Assertion failure in file row/row0mysql.c line 1386
# Archive does not handle negative autoincrement values correctly
let $skip_negative_auto_inc= 1;
##### Storage engine to be tested
let $engine= 'Archive';

View file

@ -25,6 +25,9 @@
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
--source include/have_blackhole.inc
# Bug#45823 Assertion failure in file row/row0mysql.c line 1386
# Blackhole does not handle negative autoincrement values correctly
let $skip_negative_auto_inc= 1;
##### Storage engine to be tested
let $engine= 'Blackhole';

View file

@ -244,3 +244,71 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
drop table t1;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=innodb;
CREATE TABLE t2 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=myisam;
SET SQL_MODE='';
INSERT INTO t1 VALUES(NULL);
INSERT INTO t2 VALUES(NULL);
SELECT * FROM t1;
id
1
SELECT * FROM t2;
id
1
INSERT INTO t1 VALUES();
INSERT INTO t2 VALUES();
SELECT * FROM t1;
id
1
2
SELECT * FROM t2;
id
1
2
INSERT INTO t1 VALUES(0);
INSERT INTO t2 VALUES(0);
SELECT * FROM t1;
id
1
2
3
SELECT * FROM t2;
id
1
2
3
SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
INSERT INTO t1 VALUES(0);
INSERT INTO t2 VALUES(0);
SELECT * FROM t1;
id
0
1
2
3
SELECT * FROM t2;
id
0
1
2
3
INSERT INTO t1 VALUES(4);
INSERT INTO t2 VALUES(4);
FLUSH LOGS;
Comparing tables master:test.t1 and slave:test.t1
Comparing tables master:test.t2 and slave:test.t2
DROP TABLE t1;
DROP TABLE t2;
Comparing tables master:test.t1 and slave:test.t1
Comparing tables master:test.t2 and slave:test.t2
DROP TABLE t1;
DROP TABLE t2;
SET SQL_MODE='';

View file

@ -29,5 +29,5 @@ 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 @ SYSTEM ONE TIME # NULL NULL NULL NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
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;

View file

@ -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

View file

@ -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';

View file

@ -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;

View file

@ -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

View file

@ -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;

View file

@ -4,21 +4,20 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create database if not exists mysqltest1;
DROP PROCEDURE IF EXISTS mysqltest1.p1;
DROP PROCEDURE IF EXISTS mysqltest1.p2;
DROP TABLE IF EXISTS mysqltest1.t2;
DROP TABLE IF EXISTS mysqltest1.t1;
CREATE TABLE IF NOT EXISTS mysqltest1.t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS mysqltest1.t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=InnoDB;
CREATE PROCEDURE mysqltest1.p1()
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p2;
CREATE TABLE IF NOT EXISTS t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=InnoDB;
CREATE PROCEDURE p1()
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE spa CHAR(16);
DECLARE spb INT;
DECLARE cur1 CURSOR FOR SELECT name,
(YEAR(CURDATE())-YEAR(birth))-(RIGHT(CURDATE(),5)<RIGHT(birth,5))
FROM mysqltest1.t1;
FROM t1;
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
OPEN cur1;
SET AUTOCOMMIT=0;
@ -26,21 +25,20 @@ REPEAT
FETCH cur1 INTO spa, spb;
IF NOT done THEN
START TRANSACTION;
INSERT INTO mysqltest1.t2 VALUES (spa,spb);
INSERT INTO t2 VALUES (spa,spb);
COMMIT;
END IF;
UNTIL done END REPEAT;
SET AUTOCOMMIT=1;
CLOSE cur1;
END|
CREATE PROCEDURE mysqltest1.p2()
CREATE PROCEDURE p2()
BEGIN
INSERT INTO mysqltest1.t1 VALUES ('MySQL','1993-02-04'),('ROCKS', '1990-08-27'),('Texas', '1999-03-30'),('kyle','2005-1-1');
INSERT INTO t1 VALUES ('MySQL','1993-02-04'),('ROCKS', '1990-08-27'),('Texas', '1999-03-30'),('kyle','2005-1-1');
END|
CALL mysqltest1.p2();
CALL mysqltest1.p1();
DROP PROCEDURE IF EXISTS mysqltest1.p1;
DROP PROCEDURE IF EXISTS mysqltest1.p2;
DROP TABLE IF EXISTS mysqltest1.t1;
DROP TABLE IF EXISTS mysqltest1.t2;
DROP DATABASE mysqltest1;
CALL p2();
CALL p1();
DROP TABLE t1;
DROP TABLE t2;
DROP PROCEDURE p1;
DROP PROCEDURE p2;

View 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;

View file

@ -129,6 +129,9 @@ CREATE DATABASE bug42217_db;
GRANT CREATE ROUTINE ON bug42217_db.* TO 'create_rout_db'@'localhost'
IDENTIFIED BY 'create_rout_db' WITH GRANT OPTION;
-- sync_slave_with_master
-- connection master
connect (create_rout_db_master, localhost, create_rout_db, create_rout_db, bug42217_db,$MASTER_MYPORT,);
connect (create_rout_db_slave, localhost, create_rout_db, create_rout_db, bug42217_db, $SLAVE_MYPORT,);

View file

@ -12,21 +12,25 @@ 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;
-- 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;

View file

@ -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;

View file

@ -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"

View file

@ -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

View 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

View file

@ -4,21 +4,20 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create database if not exists mysqltest1;
DROP PROCEDURE IF EXISTS mysqltest1.p1;
DROP PROCEDURE IF EXISTS mysqltest1.p2;
DROP TABLE IF EXISTS mysqltest1.t2;
DROP TABLE IF EXISTS mysqltest1.t1;
CREATE TABLE IF NOT EXISTS mysqltest1.t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=NDBCLUSTER;
CREATE TABLE IF NOT EXISTS mysqltest1.t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=NDBCLUSTER;
CREATE PROCEDURE mysqltest1.p1()
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p2;
CREATE TABLE IF NOT EXISTS t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=NDBCLUSTER;
CREATE TABLE IF NOT EXISTS t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=NDBCLUSTER;
CREATE PROCEDURE p1()
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE spa CHAR(16);
DECLARE spb INT;
DECLARE cur1 CURSOR FOR SELECT name,
(YEAR(CURDATE())-YEAR(birth))-(RIGHT(CURDATE(),5)<RIGHT(birth,5))
FROM mysqltest1.t1;
FROM t1;
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
OPEN cur1;
SET AUTOCOMMIT=0;
@ -26,21 +25,20 @@ REPEAT
FETCH cur1 INTO spa, spb;
IF NOT done THEN
START TRANSACTION;
INSERT INTO mysqltest1.t2 VALUES (spa,spb);
INSERT INTO t2 VALUES (spa,spb);
COMMIT;
END IF;
UNTIL done END REPEAT;
SET AUTOCOMMIT=1;
CLOSE cur1;
END|
CREATE PROCEDURE mysqltest1.p2()
CREATE PROCEDURE p2()
BEGIN
INSERT INTO mysqltest1.t1 VALUES ('MySQL','1993-02-04'),('ROCKS', '1990-08-27'),('Texas', '1999-03-30'),('kyle','2005-1-1');
INSERT INTO t1 VALUES ('MySQL','1993-02-04'),('ROCKS', '1990-08-27'),('Texas', '1999-03-30'),('kyle','2005-1-1');
END|
CALL mysqltest1.p2();
CALL mysqltest1.p1();
DROP PROCEDURE IF EXISTS mysqltest1.p1;
DROP PROCEDURE IF EXISTS mysqltest1.p2;
DROP TABLE IF EXISTS mysqltest1.t1;
DROP TABLE IF EXISTS mysqltest1.t2;
DROP DATABASE mysqltest1;
CALL p2();
CALL p1();
DROP TABLE t1;
DROP TABLE t2;
DROP PROCEDURE p1;
DROP PROCEDURE p2;

View file

@ -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

View file

@ -1599,3 +1599,27 @@ INSERT INTO t1 VALUES (NULL, NULL),(NULL, NULL);
FLUSH TABLE t1;
SELECT * FROM t1 ORDER BY a;
DROP TABLE t1;
#
# BUG#29203 - archive tables have weird values in show table status
#
CREATE TABLE t1(a INT, b BLOB) ENGINE=archive;
SELECT DATA_LENGTH, AVG_ROW_LENGTH FROM
INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test';
INSERT INTO t1 VALUES(1, 'sampleblob1'),(2, 'sampleblob2');
SELECT DATA_LENGTH, AVG_ROW_LENGTH FROM
INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test';
DROP TABLE t1;
#
# BUG#46961 - archive engine loses rows during self joining select!
#
SET @save_join_buffer_size= @@join_buffer_size;
SET @@join_buffer_size= 8228;
CREATE TABLE t1(a CHAR(255)) ENGINE=archive;
INSERT INTO t1 VALUES('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),
('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),
('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
SELECT COUNT(t1.a) FROM t1, t1 a, t1 b, t1 c, t1 d, t1 e;
DROP TABLE t1;
SET @@join_buffer_size= @save_join_buffer_size;

View file

@ -1198,6 +1198,23 @@ CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
DROP TABLE t1, t2;
--echo #
--echo # BUG#46384 - mysqld segfault when trying to create table with same
--echo # name as existing view
--echo #
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT);
INSERT INTO t1 VALUES (1),(2),(3);
INSERT INTO t2 VALUES (1),(2),(3);
CREATE VIEW v1 AS SELECT t1.a FROM t1, t2;
--error ER_TABLE_EXISTS_ERROR
CREATE TABLE v1 AS SELECT * FROM t1;
DROP VIEW v1;
DROP TABLE t1,t2;
--echo End of 5.0 tests

View file

@ -1,6 +1,7 @@
-- source include/have_binlog_format_mixed_or_statement.inc
-- source include/have_gbk.inc
RESET MASTER;
SET NAMES gbk;
--character_set gbk

View file

@ -573,4 +573,44 @@ SELECT DISTINCT a, b, d, c FROM t1;
DROP TABLE t1;
--echo #
--echo # Bug #46159: simple query that never returns
--echo #
# Set max_heap_table_size to the minimum value so that GROUP BY table in the
# SELECT query below gets converted to MyISAM
SET @old_max_heap_table_size = @@max_heap_table_size;
SET @@max_heap_table_size = 16384;
# Set sort_buffer_size to the mininum value so that remove_duplicates() calls
# remove_dup_with_compare()
SET @old_sort_buffer_size = @@sort_buffer_size;
SET @@sort_buffer_size = 32804;
CREATE TABLE t1(c1 int, c2 VARCHAR(20));
INSERT INTO t1 VALUES (1, '1'), (1, '1'), (2, '2'), (3, '1'), (3, '1'), (4, '4');
# Now we just need to pad the table with random data so we have enough unique
# values to force conversion of the GROUP BY table to MyISAM
INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
# First rows of the GROUP BY table that will be processed by
# remove_dup_with_compare()
SELECT c1, c2, COUNT(*) FROM t1 GROUP BY c1 LIMIT 4;
# The actual test case
SELECT DISTINCT c2 FROM t1 GROUP BY c1 HAVING COUNT(*) > 1;
# Cleanup
DROP TABLE t1;
SET @@sort_buffer_size = @old_sort_buffer_size;
SET @@max_heap_table_size = @old_max_heap_table_size;
--echo End of 5.1 tests

View file

@ -135,6 +135,17 @@ EXPLAIN EXTENDED SELECT COUNT(a) FROM t1 USE KEY(a);
DROP TABLE t1;
#
# Bug#45989 memory leak after explain encounters an error in the query
#
CREATE TABLE t1(a LONGTEXT);
INSERT INTO t1 VALUES (repeat('a',@@global.max_allowed_packet));
INSERT INTO t1 VALUES (repeat('b',@@global.max_allowed_packet));
--error ER_BAD_FIELD_ERROR
EXPLAIN SELECT DISTINCT 1 FROM t1,
(SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) as d1
WHERE t1.a = d1.a;
DROP TABLE t1;
# End of 5.0 tests.

View file

@ -1291,6 +1291,19 @@ INSERT INTO t1 VALUES ('aaaaaaaa');
SELECT LOAD_FILE(a) FROM t1;
DROP TABLE t1;
#
# Bug#46815 CONCAT_WS returning wrong data
#
CREATE TABLE t1 (f2 VARCHAR(20));
CREATE TABLE t2 (f2 VARCHAR(20));
INSERT INTO t1 VALUES ('MIN'),('MAX');
INSERT INTO t2 VALUES ('LOAD');
SELECT CONCAT_WS('_', (SELECT t2.f2 FROM t2), t1.f2) AS concat_name FROM t1;
DROP TABLE t1, t2;
--echo End of 5.0 tests

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -0,0 +1,2 @@
--lower-case-table-names=2
--tmpdir=$MYSQLTEST_VARDIR/tmp/MixedCase

View file

@ -0,0 +1,6 @@
# This test requires a non-lowercase tmpdir directory on a case-sensitive
# filesystem.
d="$MYSQLTEST_VARDIR/tmp/MixedCase"
test -d "$d" || mkdir "$d"
rm -f "$d"/*

View file

@ -0,0 +1,12 @@
--source include/have_lowercase2.inc
--source include/have_innodb.inc
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (id int) engine=InnoDB;
insert into t1 values (1);
create temporary table t2 engine=InnoDB select * from t1;
drop temporary table t2;
drop table t1;

View file

@ -5,8 +5,9 @@
-- source include/have_cp932.inc
-- source include/have_log_bin.inc
RESET MASTER;
# Bug#16217 (mysql client did not know how not switch its internal charset)
flush logs;
create table t3 (f text character set utf8);
create table t4 (f text character set cp932);
--exec $MYSQL --default-character-set=utf8 test -e "insert into t3 values(_utf8'ソ')"
@ -14,7 +15,7 @@ create table t4 (f text character set cp932);
flush logs;
rename table t3 to t03, t4 to t04;
let $MYSQLD_DATADIR= `select @@datadir`;
--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000002 | $MYSQL --default-character-set=utf8
--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001 | $MYSQL --default-character-set=utf8
# original and recovered data must be equal
select HEX(f) from t03;
select HEX(f) from t3;

View file

@ -5,6 +5,23 @@
drop table if exists t1;
--enable_warnings
#
# Bug#47029: Crash when reorganize partition with subpartition
#
create table t1 (a int not null,
b datetime not null,
primary key (a,b))
engine=innodb
partition by range (to_days(b))
subpartition by hash (a)
subpartitions 2
( partition p0 values less than (to_days('2009-01-01')),
partition p1 values less than (to_days('2009-02-01')),
partition p2 values less than (to_days('2009-03-01')),
partition p3 values less than maxvalue);
alter table t1 reorganize partition p1,p2 into
( partition p2 values less than (to_days('2009-03-01')));
drop table t1;
#
# Bug#40595: Non-matching rows not released with READ-COMMITTED on tables
# with partitions
@ -274,3 +291,15 @@ PARTITION BY RANGE (int_column)
(PARTITION p1 VALUES LESS THAN (5));
show create table t1;
drop table t1;
#
# BUG#46483 - drop table of partitioned table may leave extraneous file
# Note: was only repeatable with InnoDB plugin
#
CREATE TABLE t1 (a INT) ENGINE=InnoDB
PARTITION BY list(a) (PARTITION p1 VALUES IN (1));
CREATE INDEX i1 ON t1 (a);
DROP TABLE t1;
let $MYSQLD_DATADIR= `SELECT @@datadir`;
# Before the fix it should show extra file like #sql-2405_2.par
--list_files $MYSQLD_DATADIR/test/ *

View file

@ -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
#

View file

@ -2,6 +2,8 @@
--source include/not_embedded.inc
# Non-windows specific ps tests.
--source include/not_windows.inc
# requires dynamic loading
--source include/have_dynamic_loading.inc
#
# Bug #20665: All commands supported in Stored Procedures should work in

View file

@ -8242,6 +8242,28 @@ while ($tab_count)
DROP PROCEDURE p1;
DROP TABLE t1;
--echo #
--echo # Bug #46629: Item_in_subselect::val_int(): Assertion `0'
--echo # on subquery inside a SP
--echo #
CREATE TABLE t1(a INT);
CREATE TABLE t2(a INT, b INT PRIMARY KEY);
DELIMITER |;
CREATE PROCEDURE p1 ()
BEGIN
SELECT a FROM t1 A WHERE A.b IN (SELECT b FROM t2 AS B);
END|
DELIMITER ;|
--error ER_BAD_FIELD_ERROR
CALL p1;
--error ER_BAD_FIELD_ERROR
CALL p1;
DROP PROCEDURE p1;
DROP TABLE t1, t2;
--echo # ------------------------------------------------------------------
--echo # -- End of 5.1 tests
--echo # ------------------------------------------------------------------

View file

@ -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.
#

View file

@ -0,0 +1,32 @@
# General purpose bug fix tests go here : subselect.test too large
--echo #
--echo # Bug #46791: Assertion failed:(table->key_read==0),function unknown
--echo # function,file sql_base.cc
--echo #
CREATE TABLE t1 (a INT, b INT, KEY(a));
INSERT INTO t1 VALUES (1,1),(2,2);
CREATE TABLE t2 LIKE t1;
INSERT INTO t2 VALUES (1,1),(2,2);
CREATE TABLE t3 LIKE t1;
--echo # should have 1 impossible where and 2 dependent subqueries
EXPLAIN
SELECT 1 FROM t1
WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3))
ORDER BY count(*);
--echo # should not crash the next statement
SELECT 1 FROM t1
WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3))
ORDER BY count(*);
--echo # should not crash: the crash is caused by the previous statement
SELECT 1;
DROP TABLE t1,t2,t3;
--echo End of 5.0 tests.

View file

@ -436,4 +436,16 @@ SELECT * FROM t2 WHERE a = sequence();
DROP FUNCTION sequence;
DROP TABLE t1,t2;
--echo #
--echo # Bug#46259: 5.0.83 -> 5.1.36, query doesn't work
--echo #
CREATE TABLE t1 ( a INT );
INSERT INTO t1 VALUES (1), (2), (3);
SELECT IF( a = 1, a, a ) AS `b` FROM t1 ORDER BY field( `b` + 1, 1 );
SELECT IF( a = 1, a, a ) AS `b` FROM t1 ORDER BY field( `b`, 1 );
DROP TABLE t1;
--echo End of 5.0 tests.

View file

@ -225,4 +225,11 @@ insert into t2 values(@q);
drop table t1, t2;
#
# Bug#42364 SHOW ERRORS returns empty resultset after dropping non existent table
#
--error ER_BAD_TABLE_ERROR
DROP TABLE t1;
SHOW ERRORS;
--echo End of 5.0 tests

View file

@ -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);
}

View file

@ -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)

View file

@ -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

View file

@ -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));
@ -87,6 +88,13 @@ int my_copy(const char *from, const char *to, myf MyFlags)
goto err;
}
/* sync the destination file */
if (MyFlags & MY_SYNC)
{
if (my_sync(to_file, MyFlags))
goto err;
}
if (my_close(from_file,MyFlags) | my_close(to_file,MyFlags))
DBUG_RETURN(-1); /* Error on close */
@ -94,9 +102,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)

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