Commit 8fd3d711 authored by joerg@trift2's avatar joerg@trift2

Merge trift2.:/MySQL/M51/mysql-5.1

into  trift2.:/MySQL/M51/push-5.1
parents 6ed20348 0f36ce8f
...@@ -476,6 +476,9 @@ contrib/*.vcproj ...@@ -476,6 +476,9 @@ contrib/*.vcproj
core core
core.* core.*
core.2430 core.2430
cscope.in.out
cscope.out
cscope.po.out
db-*.*.* db-*.*.*
dbug/*.ds? dbug/*.ds?
dbug/*.vcproj dbug/*.vcproj
......
...@@ -105,7 +105,7 @@ if [ "x$warning_mode" != "xpedantic" ]; then ...@@ -105,7 +105,7 @@ if [ "x$warning_mode" != "xpedantic" ]; then
# Added unless --with-debug=full # Added unless --with-debug=full
debug_extra_cflags="-O1 -Wuninitialized" debug_extra_cflags="-O1 -Wuninitialized"
else else
warnings="-W -Wall -ansi -pedantic -Wno-long-long -D_POSIX_SOURCE" warnings="-W -Wall -ansi -pedantic -Wno-long-long -Wno-unused -D_POSIX_SOURCE"
c_warnings="$warnings" c_warnings="$warnings"
cxx_warnings="$warnings -std=c++98" cxx_warnings="$warnings -std=c++98"
# NOTE: warning mode should not influence optimize/debug mode. # NOTE: warning mode should not influence optimize/debug mode.
...@@ -207,3 +207,28 @@ then ...@@ -207,3 +207,28 @@ then
echo "$CC" | grep "ccache" > /dev/null || CC="ccache $CC" echo "$CC" | grep "ccache" > /dev/null || CC="ccache $CC"
echo "$CXX" | grep "ccache" > /dev/null || CXX="ccache $CXX" echo "$CXX" | grep "ccache" > /dev/null || CXX="ccache $CXX"
fi fi
# gcov
# The -fprofile-arcs and -ftest-coverage options cause GCC to instrument the
# code with profiling information used by gcov.
# The -DDISABLE_TAO_ASM is needed to avoid build failures in Yassl.
# The -DHAVE_gcov enables code to write out coverage info even when crashing.
gcov_compile_flags="-fprofile-arcs -ftest-coverage"
gcov_compile_flags="$gcov_compile_flags -DDISABLE_TAO_ASM"
gcov_compile_flags="$gcov_compile_flags -DMYSQL_SERVER_SUFFIX=-gcov -DHAVE_gcov"
# GCC4 needs -fprofile-arcs -ftest-coverage on the linker command line (as well
# as on the compiler command line), and this requires setting LDFLAGS for BDB.
gcov_link_flags="-fprofile-arcs -ftest-coverage"
gcov_configs="--disable-shared"
# gprof
gprof_compile_flags="-O2 -pg -g"
gprof_link_flags="--disable-shared $static_link"
#! /bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
# Need to disable ccache, or we loose the gcov-needed compiler output files.
CCACHE_DISABLE=1
export CCACHE_DISABLE
export LDFLAGS="$gcov_link_flags"
extra_flags="$amd64_cflags $debug_cflags $max_cflags $gcov_compile_flags"
c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_warnings $debug_extra_warnings"
extra_configs="$amd64_configs $debug_configs $gcov_configs $max_configs"
. "$path/FINISH.sh"
#! /bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$amd64_cflags $gprof_compile_flags"
extra_configs="$amd64_configs $debug_configs $gprof_link_flags"
. "$path/FINISH.sh"
...@@ -20,18 +20,11 @@ export CCACHE_GCOV_VERSION_ENABLED ...@@ -20,18 +20,11 @@ export CCACHE_GCOV_VERSION_ENABLED
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"
# GCC4 needs -fprofile-arcs -ftest-coverage on the linker command line (as well export LDFLAGS="$gcov_link_flags"
# as on the compiler command line), and this requires setting LDFLAGS for BDB.
export LDFLAGS="-fprofile-arcs -ftest-coverage"
# The -fprofile-arcs and -ftest-coverage options cause GCC to instrument the extra_flags="$pentium_cflags $debug_cflags $max_cflags $gcov_compile_flags"
# code with profiling information used by gcov.
# The -DDISABLE_TAO_ASM is needed to avoid build failures in Yassl.
# The -DHAVE_gcov enables code to write out coverage info even when crashing.
extra_flags="$pentium_cflags -fprofile-arcs -ftest-coverage -DDISABLE_TAO_ASM -DHAVE_MUTEX_THREAD_ONLY $debug_extra_flags $debug_cflags $max_cflags -DMYSQL_SERVER_SUFFIX=-gcov -DHAVE_gcov"
extra_configs="$pentium_configs $debug_configs --disable-shared $static_link"
extra_configs="$extra_configs $max_configs"
c_warnings="$c_warnings $debug_extra_warnings" c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_warnings $debug_extra_warnings" cxx_warnings="$cxx_warnings $debug_extra_warnings"
extra_configs="$pentium_configs $debug_configs $gcov_configs $max_configs"
. "$path/FINISH.sh" . "$path/FINISH.sh"
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"
extra_flags="$pentium_cflags -O2 -pg -g" extra_flags="$pentium_cflags $gprof_compile_flags"
extra_configs="$pentium_configs $debug_configs --disable-shared $static_link" extra_configs="$pentium_configs $debug_configs $gprof_link_flags"
. "$path/FINISH.sh" . "$path/FINISH.sh"
#! /bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
# Need to disable ccache, or we loose the gcov-needed compiler output files.
CCACHE_DISABLE=1
export CCACHE_DISABLE
export LDFLAGS="$gcov_link_flags"
extra_flags="$pentium64_cflags $debug_cflags $max_cflags $gcov_compile_flags"
c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_warnings $debug_extra_warnings"
extra_configs="$pentium64_configs $debug_configs $gcov_configs $max_configs"
. "$path/FINISH.sh"
#! /bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium64_cflags $gprof_compile_flags"
extra_configs="$pentium64_configs $debug_configs $gprof_link_flags"
. "$path/FINISH.sh"
...@@ -1263,6 +1263,7 @@ static bool add_line(String &buffer,char *line,char *in_string, ...@@ -1263,6 +1263,7 @@ static bool add_line(String &buffer,char *line,char *in_string,
char buff[80], *pos, *out; char buff[80], *pos, *out;
COMMANDS *com; COMMANDS *com;
bool need_space= 0; bool need_space= 0;
bool ss_comment= 0;
DBUG_ENTER("add_line"); DBUG_ENTER("add_line");
if (!line[0] && buffer.is_empty()) if (!line[0] && buffer.is_empty())
...@@ -1316,6 +1317,19 @@ static bool add_line(String &buffer,char *line,char *in_string, ...@@ -1316,6 +1317,19 @@ static bool add_line(String &buffer,char *line,char *in_string,
if ((*com->func)(&buffer,pos-1) > 0) if ((*com->func)(&buffer,pos-1) > 0)
DBUG_RETURN(1); // Quit DBUG_RETURN(1); // Quit
if (com->takes_params) if (com->takes_params)
{
if (ss_comment)
{
/*
If a client-side macro appears inside a server-side comment,
discard all characters in the comment after the macro (that is,
until the end of the comment rather than the next delimiter)
*/
for (pos++; *pos && (*pos != '*' || *(pos + 1) != '/'); pos++)
;
pos--;
}
else
{ {
for (pos++ ; for (pos++ ;
*pos && (*pos != *delimiter || *pos && (*pos != *delimiter ||
...@@ -1326,6 +1340,7 @@ static bool add_line(String &buffer,char *line,char *in_string, ...@@ -1326,6 +1340,7 @@ static bool add_line(String &buffer,char *line,char *in_string,
else else
pos+= delimiter_length - 1; // Point at last delim char pos+= delimiter_length - 1; // Point at last delim char
} }
}
out=line; out=line;
} }
else else
...@@ -1386,7 +1401,7 @@ static bool add_line(String &buffer,char *line,char *in_string, ...@@ -1386,7 +1401,7 @@ static bool add_line(String &buffer,char *line,char *in_string,
out=line; out=line;
} }
} }
else if (*ml_comment && inchar == '*' && *(pos + 1) == '/') else if (*ml_comment && !ss_comment && inchar == '*' && *(pos + 1) == '/')
{ {
pos++; pos++;
*ml_comment= 0; *ml_comment= 0;
...@@ -1394,6 +1409,11 @@ static bool add_line(String &buffer,char *line,char *in_string, ...@@ -1394,6 +1409,11 @@ static bool add_line(String &buffer,char *line,char *in_string,
} }
else else
{ // Add found char to buffer { // Add found char to buffer
if (!*in_string && inchar == '/' && *(pos + 1) == '*' &&
*(pos + 2) == '!')
ss_comment= 1;
else if (!*in_string && ss_comment && inchar == '*' && *(pos + 1) == '/')
ss_comment= 0;
if (inchar == *in_string) if (inchar == *in_string)
*in_string= 0; *in_string= 0;
else if (!*ml_comment && !*in_string && else if (!*ml_comment && !*in_string &&
......
...@@ -3039,6 +3039,18 @@ static void dump_table(char *table, char *db) ...@@ -3039,6 +3039,18 @@ static void dump_table(char *table, char *db)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
/*
Check --skip-events flag: it is not enough to skip creation of events
discarding SHOW CREATE EVENT statements generation. The myslq.event
table data should be skipped too.
*/
if (!opt_events && !my_strcasecmp(&my_charset_latin1, db, "mysql") &&
!my_strcasecmp(&my_charset_latin1, table, "event"))
{
verbose_msg("-- Skipping data table mysql.event, --skip-events was used\n");
DBUG_VOID_RETURN;
}
result_table= quote_name(table,table_buff, 1); result_table= quote_name(table,table_buff, 1);
opt_quoted_table= quote_name(table, table_buff2, 0); opt_quoted_table= quote_name(table, table_buff2, 0);
...@@ -3848,7 +3860,7 @@ int init_dumping_tables(char *qdatabase) ...@@ -3848,7 +3860,7 @@ int init_dumping_tables(char *qdatabase)
/* Old server version, dump generic CREATE DATABASE */ /* Old server version, dump generic CREATE DATABASE */
if (opt_drop_database) if (opt_drop_database)
fprintf(md_result_file, fprintf(md_result_file,
"\n/*!40000 DROP DATABASE IF EXISTS %s;*/\n", "\n/*!40000 DROP DATABASE IF EXISTS %s*/;\n",
qdatabase); qdatabase);
fprintf(md_result_file, fprintf(md_result_file,
"\nCREATE DATABASE /*!32312 IF NOT EXISTS*/ %s;\n", "\nCREATE DATABASE /*!32312 IF NOT EXISTS*/ %s;\n",
......
...@@ -1673,6 +1673,7 @@ static int ...@@ -1673,6 +1673,7 @@ static int
run_statements(MYSQL *mysql, statement *stmt) run_statements(MYSQL *mysql, statement *stmt)
{ {
statement *ptr; statement *ptr;
MYSQL_RES *result;
DBUG_ENTER("run_statements"); DBUG_ENTER("run_statements");
for (ptr= stmt; ptr && ptr->length; ptr= ptr->next) for (ptr= stmt; ptr && ptr->length; ptr= ptr->next)
...@@ -1683,6 +1684,11 @@ run_statements(MYSQL *mysql, statement *stmt) ...@@ -1683,6 +1684,11 @@ run_statements(MYSQL *mysql, statement *stmt)
my_progname, (uint)ptr->length, ptr->string, mysql_error(mysql)); my_progname, (uint)ptr->length, ptr->string, mysql_error(mysql));
exit(1); exit(1);
} }
if (mysql_field_count(mysql))
{
result= mysql_store_result(mysql);
mysql_free_result(result);
}
} }
DBUG_RETURN(0); DBUG_RETURN(0);
......
...@@ -562,12 +562,6 @@ int __void__; ...@@ -562,12 +562,6 @@ int __void__;
#define PURIFY_OR_LINT_INIT(var) #define PURIFY_OR_LINT_INIT(var)
#endif #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) #if !defined(HAVE_UINT)
#undef HAVE_UINT #undef HAVE_UINT
#define HAVE_UINT #define HAVE_UINT
...@@ -1508,4 +1502,10 @@ inline void operator delete[](void*, void*) { /* Do nothing */ } ...@@ -1508,4 +1502,10 @@ inline void operator delete[](void*, void*) { /* Do nothing */ }
/* Length of decimal number represented by INT64. */ /* Length of decimal number represented by INT64. */
#define MY_INT64_NUM_DECIMAL_DIGITS 21 #define MY_INT64_NUM_DECIMAL_DIGITS 21
/* Define some useful general macros (should be done after all headers). */
#if !defined(max)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif
#endif /* my_global_h */ #endif /* my_global_h */
...@@ -519,6 +519,7 @@ typedef struct st_my_pthread_fastmutex_t ...@@ -519,6 +519,7 @@ typedef struct st_my_pthread_fastmutex_t
pthread_mutex_t mutex; pthread_mutex_t mutex;
uint spins; uint spins;
} my_pthread_fastmutex_t; } my_pthread_fastmutex_t;
void fastmutex_global_init(void);
int my_pthread_fastmutex_init(my_pthread_fastmutex_t *mp, int my_pthread_fastmutex_init(my_pthread_fastmutex_t *mp,
const pthread_mutexattr_t *attr); const pthread_mutexattr_t *attr);
......
...@@ -785,5 +785,28 @@ void mysql_query_cache_invalidate4(MYSQL_THD thd, ...@@ -785,5 +785,28 @@ void mysql_query_cache_invalidate4(MYSQL_THD thd,
} }
#endif #endif
#ifdef __cplusplus
/**
Provide a handler data getter to simplify coding
*/
inline
void *
thd_get_ha_data(const MYSQL_THD thd, const struct handlerton *hton)
{
return *thd_ha_data(thd, hton);
}
/**
Provide a handler data setter to simplify coding
*/
inline
void
thd_set_ha_data(const MYSQL_THD thd, const struct handlerton *hton,
const void *ha_data)
{
*thd_ha_data(thd, hton)= (void*) ha_data;
}
#endif
#endif #endif
...@@ -43,6 +43,8 @@ dist-hook: ...@@ -43,6 +43,8 @@ dist-hook:
$(distdir)/std_data \ $(distdir)/std_data \
$(distdir)/std_data/ndb_backup50 \ $(distdir)/std_data/ndb_backup50 \
$(distdir)/std_data/ndb_backup51 \ $(distdir)/std_data/ndb_backup51 \
$(distdir)/std_data/ndb_backup51_data_be \
$(distdir)/std_data/ndb_backup51_data_le \
$(distdir)/lib $(distdir)/lib
-$(INSTALL_DATA) $(srcdir)/t/*.def $(distdir)/t -$(INSTALL_DATA) $(srcdir)/t/*.def $(distdir)/t
$(INSTALL_DATA) $(srcdir)/t/*.test $(distdir)/t $(INSTALL_DATA) $(srcdir)/t/*.test $(distdir)/t
...@@ -68,6 +70,8 @@ dist-hook: ...@@ -68,6 +70,8 @@ dist-hook:
$(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50/BACKUP* $(distdir)/std_data/ndb_backup50 $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50/BACKUP* $(distdir)/std_data/ndb_backup50
$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51/BACKUP* $(distdir)/std_data/ndb_backup51 $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51/BACKUP* $(distdir)/std_data/ndb_backup51
$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51_data_be/BACKUP* $(distdir)/std_data/ndb_backup51_data_be
$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51_data_le/BACKUP* $(distdir)/std_data/ndb_backup51_data_le
$(INSTALL_DATA) $(srcdir)/lib/*.pl $(distdir)/lib $(INSTALL_DATA) $(srcdir)/lib/*.pl $(distdir)/lib
-rm -rf `find $(distdir)/suite -type d -name SCCS` $(distdir)/suite/row_lock -rm -rf `find $(distdir)/suite -type d -name SCCS` $(distdir)/suite/row_lock
...@@ -81,6 +85,8 @@ install-data-local: ...@@ -81,6 +85,8 @@ install-data-local:
$(DESTDIR)$(testdir)/std_data \ $(DESTDIR)$(testdir)/std_data \
$(DESTDIR)$(testdir)/std_data/ndb_backup50 \ $(DESTDIR)$(testdir)/std_data/ndb_backup50 \
$(DESTDIR)$(testdir)/std_data/ndb_backup51 \ $(DESTDIR)$(testdir)/std_data/ndb_backup51 \
$(DESTDIR)$(testdir)/std_data/ndb_backup51_data_be \
$(DESTDIR)$(testdir)/std_data/ndb_backup51_data_le \
$(DESTDIR)$(testdir)/lib $(DESTDIR)$(testdir)/lib
$(INSTALL_DATA) $(srcdir)/README $(DESTDIR)$(testdir) $(INSTALL_DATA) $(srcdir)/README $(DESTDIR)$(testdir)
-$(INSTALL_DATA) $(srcdir)/t/*.def $(DESTDIR)$(testdir)/t -$(INSTALL_DATA) $(srcdir)/t/*.def $(DESTDIR)$(testdir)/t
...@@ -111,6 +117,8 @@ install-data-local: ...@@ -111,6 +117,8 @@ install-data-local:
$(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup50 $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup50
$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup51 $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup51
$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51_data_be/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup51_data_be
$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51_data_le/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup51_data_le
$(INSTALL_DATA) $(srcdir)/lib/*.pl $(DESTDIR)$(testdir)/lib $(INSTALL_DATA) $(srcdir)/lib/*.pl $(DESTDIR)$(testdir)/lib
for f in `(cd $(srcdir); find suite -type f | egrep -v 'SCCS|row_lock')`; \ for f in `(cd $(srcdir); find suite -type f | egrep -v 'SCCS|row_lock')`; \
do \ do \
......
...@@ -144,4 +144,29 @@ disconnect con1; ...@@ -144,4 +144,29 @@ disconnect con1;
disconnect con2; disconnect con2;
drop table t1, t2; drop table t1, t2;
# End of 4.1 tests --echo End of 4.1 tests
#
# Bug#25164 create table `a` as select * from `A` hangs
#
set storage_engine=innodb;
--disable_warnings
drop table if exists a;
drop table if exists A;
--enable_warnings
create table A (c int);
insert into A (c) values (0);
--error 0,ER_LOCK_DEADLOCK,ER_UPDATE_TABLE_USED
create table a as select * from A;
drop table A;
--disable_warnings
drop table if exists a;
--enable_warnings
set storage_engine=default;
--echo End of 5.0 tests.
...@@ -479,3 +479,22 @@ handler t1 open; ...@@ -479,3 +479,22 @@ handler t1 open;
--echo --> client 1 --echo --> client 1
connection default; connection default;
drop table t1; drop table t1;
#
# Bug#30632 HANDLER read failure causes hang
#
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (a int);
handler t1 open as t1_alias;
--error 1176
handler t1_alias read a next;
--error 1054
handler t1_alias READ a next where inexistent > 0;
--error 1176
handler t1_alias read a next;
--error 1054
handler t1_alias READ a next where inexistent > 0;
handler t1_alias close;
drop table t1;
...@@ -969,6 +969,33 @@ ROLLBACK; ...@@ -969,6 +969,33 @@ ROLLBACK;
ROLLBACK; ROLLBACK;
DROP TABLE t1; DROP TABLE t1;
#
# Bug#30596: GROUP BY optimization gives wrong result order
#
CREATE TABLE t1(
a INT,
b INT NOT NULL,
c INT NOT NULL,
d INT,
UNIQUE KEY (c,b)
) engine=innodb;
INSERT INTO t1 VALUES (1,1,1,50), (1,2,3,40), (2,1,3,4);
EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b,d;
SELECT c,b,d FROM t1 GROUP BY c,b,d;
EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b,d ORDER BY NULL;
SELECT c,b,d FROM t1 GROUP BY c,b,d ORDER BY NULL;
EXPLAIN SELECT c,b,d FROM t1 ORDER BY c,b,d;
SELECT c,b,d FROM t1 ORDER BY c,b,d;
EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b;
SELECT c,b,d FROM t1 GROUP BY c,b;
EXPLAIN SELECT c,b FROM t1 GROUP BY c,b;
SELECT c,b FROM t1 GROUP BY c,b;
DROP TABLE t1;
--echo End of 5.0 tests --echo End of 5.0 tests
# Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY # Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY
......
# Replication tests need binlog
source include/have_log_bin.inc;
connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,); connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,);
connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,); connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);
......
...@@ -275,5 +275,223 @@ drop table t1; ...@@ -275,5 +275,223 @@ drop table t1;
--echo ---- disconnect connection con1 ---- --echo ---- disconnect connection con1 ----
disconnect con1; disconnect con1;
#
# Bug #25843 Changing default database between PREPARE and EXECUTE of statement
# breaks binlog.
#
# There were actually two problems discovered by this bug:
#
# 1. Default (current) database is not fixed at the creation time.
# That leads to wrong output of DATABASE() function.
#
# 2. Database attributes (@@collation_database) are not fixed at the creation
# time. That leads to wrong resultset.
#
# Binlog breakage and Query Cache wrong output happened because of the first
# problem.
#
--echo ########################################################################
--echo #
--echo # BUG#25843: Changing default database between PREPARE and EXECUTE of
--echo # statement breaks binlog.
--echo #
--echo ########################################################################
###############################################################################
--echo
--echo #
--echo # Check that default database and its attributes are fixed at the
--echo # creation time.
--echo #
# Prepare data structures.
--echo
--disable_warnings
DROP DATABASE IF EXISTS mysqltest1;
DROP DATABASE IF EXISTS mysqltest2;
--enable_warnings
--echo
CREATE DATABASE mysqltest1 COLLATE utf8_unicode_ci;
CREATE DATABASE mysqltest2 COLLATE utf8_general_ci;
--echo
CREATE TABLE mysqltest1.t1(msg VARCHAR(255));
CREATE TABLE mysqltest2.t1(msg VARCHAR(255));
# - Create a prepared statement with mysqltest1 as default database;
--echo
use mysqltest1;
PREPARE stmt_a_1 FROM 'INSERT INTO t1 VALUES(DATABASE())';
PREPARE stmt_a_2 FROM 'INSERT INTO t1 VALUES(@@collation_database)';
# - Execute on mysqltest1.
--echo
EXECUTE stmt_a_1;
EXECUTE stmt_a_2;
# - Execute on mysqltest2.
--echo
use mysqltest2;
EXECUTE stmt_a_1;
EXECUTE stmt_a_2;
# - Check the results;
--echo
SELECT * FROM mysqltest1.t1;
--echo
SELECT * FROM mysqltest2.t1;
# - Drop prepared statements.
--echo
DROP PREPARE stmt_a_1;
DROP PREPARE stmt_a_2;
###############################################################################
--echo
--echo #
--echo # The Query Cache test case.
--echo #
--echo
DELETE FROM mysqltest1.t1;
DELETE FROM mysqltest2.t1;
--echo
INSERT INTO mysqltest1.t1 VALUES('mysqltest1.t1');
INSERT INTO mysqltest2.t1 VALUES('mysqltest2.t1');
--echo
use mysqltest1;
PREPARE stmt_b_1 FROM 'SELECT * FROM t1';
--echo
use mysqltest2;
PREPARE stmt_b_2 FROM 'SELECT * FROM t1';
--echo
EXECUTE stmt_b_1;
--echo
EXECUTE stmt_b_2;
--echo
use mysqltest1;
--echo
EXECUTE stmt_b_1;
--echo
EXECUTE stmt_b_2;
--echo
DROP PREPARE stmt_b_1;
DROP PREPARE stmt_b_2;
# Cleanup.
--echo
use test;
--echo
DROP DATABASE mysqltest1;
DROP DATABASE mysqltest2;
###############################################################################
--echo
--echo #
--echo # Check that prepared statements work properly when there is no current
--echo # database.
--echo #
--echo
CREATE DATABASE mysqltest1 COLLATE utf8_unicode_ci;
CREATE DATABASE mysqltest2 COLLATE utf8_general_ci;
--echo
use mysqltest1;
--echo
PREPARE stmt_c_1 FROM 'SELECT DATABASE(), @@collation_database';
--echo
use mysqltest2;
--echo
PREPARE stmt_c_2 FROM 'SELECT DATABASE(), @@collation_database';
--echo
DROP DATABASE mysqltest2;
--echo
SELECT DATABASE(), @@collation_database;
# -- Here we have: current db: NULL; stmt db: mysqltest1;
--echo
EXECUTE stmt_c_1;
--echo
SELECT DATABASE(), @@collation_database;
# -- Here we have: current db: NULL; stmt db: mysqltest2 (non-existent);
--echo
EXECUTE stmt_c_2;
--echo
SELECT DATABASE(), @@collation_database;
# -- Create prepared statement, which has no current database.
--echo
PREPARE stmt_c_3 FROM 'SELECT DATABASE(), @@collation_database';
# -- Here we have: current db: NULL; stmt db: NULL;
--echo
EXECUTE stmt_c_3;
--echo
use mysqltest1;
# -- Here we have: current db: mysqltest1; stmt db: mysqltest2 (non-existent);
--echo
EXECUTE stmt_c_2;
--echo
SELECT DATABASE(), @@collation_database;
# -- Here we have: current db: mysqltest1; stmt db: NULL;
--echo
EXECUTE stmt_c_3;
--echo
SELECT DATABASE(), @@collation_database;
--echo
DROP DATABASE mysqltest1;
--echo
use test;
--echo
--echo ########################################################################
###############################################################################
set @@global.query_cache_size=@initial_query_cache_size; set @@global.query_cache_size=@initial_query_cache_size;
flush status; # reset Qcache status variables for next tests flush status; # reset Qcache status variables for next tests
...@@ -36,3 +36,18 @@ select 1/*!999992*/; ...@@ -36,3 +36,18 @@ select 1/*!999992*/;
select 1 + /*!00000 2 */ + 3 /*!99999 noise*/ + 4; select 1 + /*!00000 2 */ + 3 /*!99999 noise*/ + 4;
1 + 2 + 3 + 4 1 + 2 + 3 + 4
10 10
drop table if exists table_28779;
create table table_28779 (a int);
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*' AND b = 'bar';";
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/*' AND b = 'bar'' at line 1
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*' AND b = 'bar';*";
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/*' AND b = 'bar';*' at line 1
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*! AND 2=2;";
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*! AND 2=2;*";
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ';*' at line 1
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*!98765' AND b = 'bar';";
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/*!98765' AND b = 'bar'' at line 1
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*!98765' AND b = 'bar';*";
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/*!98765' AND b = 'bar';*' at line 1
drop table table_28779;
...@@ -112,3 +112,14 @@ id x ...@@ -112,3 +112,14 @@ id x
commit; commit;
# Switch to connection default + disconnect con1 and con2 # Switch to connection default + disconnect con1 and con2
drop table t1, t2; drop table t1, t2;
End of 4.1 tests
set storage_engine=innodb;
drop table if exists a;
drop table if exists A;
create table A (c int);
insert into A (c) values (0);
create table a as select * from A;
drop table A;
drop table if exists a;
set storage_engine=default;
End of 5.0 tests.
...@@ -183,6 +183,17 @@ select @a; ...@@ -183,6 +183,17 @@ select @a;
@a @a
1 1
drop table t1; drop table t1;
CREATE TABLE t1 (
`date` date ,
`time` time ,
`seq` int(10) unsigned NOT NULL auto_increment,
PRIMARY KEY (`seq`),
KEY `seq` (`seq`),
KEY `time` (`time`),
KEY `date` (`date`)
);
DELETE FROM t1 ORDER BY date ASC, time ASC LIMIT 1;
drop table t1;
End of 4.1 tests End of 4.1 tests
CREATE TABLE t1 (a int not null,b int not null); CREATE TABLE t1 (a int not null,b int not null);
CREATE TABLE t2 (a int not null, b int not null, primary key (a,b)); CREATE TABLE t2 (a int not null, b int not null, primary key (a,b));
...@@ -223,3 +234,40 @@ ERROR 42S22: Unknown column 't2.x' in 'order clause' ...@@ -223,3 +234,40 @@ ERROR 42S22: Unknown column 't2.x' in 'order clause'
DELETE FROM t1 ORDER BY (SELECT x); DELETE FROM t1 ORDER BY (SELECT x);
ERROR 42S22: Unknown column 'x' in 'field list' ERROR 42S22: Unknown column 'x' in 'field list'
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (
a INT
);
CREATE TABLE t2 (
a INT
);
CREATE DATABASE db1;
CREATE TABLE db1.t1 (
a INT
);
INSERT INTO db1.t1 (a) SELECT * FROM t1;
CREATE DATABASE db2;
CREATE TABLE db2.t1 (
a INT
);
INSERT INTO db2.t1 (a) SELECT * FROM t2;
DELETE FROM t1 alias USING t1, t2 alias WHERE t1.a = alias.a;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'alias USING t1, t2 alias WHERE t1.a = alias.a' at line 1
DELETE FROM alias USING t1, t2 alias WHERE t1.a = alias.a;
DELETE FROM t1, alias USING t1, t2 alias WHERE t1.a = alias.a;
DELETE FROM t1, t2 USING t1, t2 alias WHERE t1.a = alias.a;
ERROR 42S02: Unknown table 't2' in MULTI DELETE
DELETE FROM db1.t1 alias USING db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'alias USING db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a' at line 1
DELETE FROM alias USING db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a;
ERROR 42S02: Unknown table 'alias' in MULTI DELETE
DELETE FROM db2.alias USING db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a;
DELETE FROM t1 USING t1 WHERE a = 1;
SELECT * FROM t1;
a
DELETE FROM t1 alias USING t1 alias WHERE a = 2;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'alias USING t1 alias WHERE a = 2' at line 1
SELECT * FROM t1;
a
DROP TABLE t1, t2;
DROP DATABASE db1;
DROP DATABASE db2;
...@@ -526,10 +526,10 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -526,10 +526,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 3 Using index 1 SIMPLE t1 index NULL PRIMARY 4 NULL 3 Using index
EXPLAIN SELECT a,b FROM t1 GROUP BY a,b; EXPLAIN SELECT a,b FROM t1 GROUP BY a,b;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort
EXPLAIN SELECT DISTINCT a,b FROM t1 GROUP BY a,b; EXPLAIN SELECT DISTINCT a,b FROM t1 GROUP BY a,b;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort
CREATE TABLE t2(a INT, b INT NOT NULL, c INT NOT NULL, d INT, CREATE TABLE t2(a INT, b INT NOT NULL, c INT NOT NULL, d INT,
PRIMARY KEY (a,b)); PRIMARY KEY (a,b));
INSERT INTO t2 VALUES (1,1,1,50), (1,2,3,40), (2,1,3,4); INSERT INTO t2 VALUES (1,1,1,50), (1,2,3,40), (2,1,3,4);
...@@ -554,7 +554,7 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -554,7 +554,7 @@ id select_type table type possible_keys key key_len ref rows Extra
CREATE UNIQUE INDEX c_b_unq ON t2 (c,b); CREATE UNIQUE INDEX c_b_unq ON t2 (c,b);
EXPLAIN SELECT DISTINCT a,b,d FROM t2 GROUP BY c,b,d; EXPLAIN SELECT DISTINCT a,b,d FROM t2 GROUP BY c,b,d;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using filesort
DROP TABLE t1,t2; DROP TABLE t1,t2;
create table t1 (id int, dsc varchar(50)); create table t1 (id int, dsc varchar(50));
insert into t1 values (1, "line number one"), (2, "line number two"), (3, "line number three"); insert into t1 values (1, "line number one"), (2, "line number two"), (3, "line number three");
......
...@@ -454,8 +454,11 @@ create event закачка on schedule every 10 hour do select get_lock("test_l ...@@ -454,8 +454,11 @@ create event закачка on schedule every 10 hour do select get_lock("test_l
select definer, name, db from mysql.event; select definer, name, db from mysql.event;
definer name db definer name db
root@localhost закачка events_test root@localhost закачка events_test
"Should be only 1 process" "Should be only 0 process"
select /*1*/ user, host, db, command, state, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info; select /*1*/ user, host, db, command, state, info
from information_schema.processlist
where (user='event_scheduler')
order by info;
user host db command state info user host db command state info
select release_lock("test_lock1"); select release_lock("test_lock1");
release_lock("test_lock1") release_lock("test_lock1")
...@@ -472,14 +475,15 @@ get_lock("test_lock2", 20) ...@@ -472,14 +475,15 @@ get_lock("test_lock2", 20)
1 1
"Create an event which tries to acquire a mutex. The event locks on the mutex" "Create an event which tries to acquire a mutex. The event locks on the mutex"
create event закачка on schedule every 10 hour do select get_lock("test_lock2", 20); create event закачка on schedule every 10 hour do select get_lock("test_lock2", 20);
"Let some time pass to the event starts"
"Should have only 2 processes: the scheduler and the locked event" "Should have only 2 processes: the scheduler and the locked event"
select /*2*/ user, host, db, command, state, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info; select /*2*/ user, host, db, command, state, info
from information_schema.processlist
where (info like "select get_lock%" OR user='event_scheduler')
order by info;
user host db command state info user host db command state info
event_scheduler localhost NULL Daemon Waiting for next activation NULL event_scheduler localhost NULL Daemon Waiting for next activation NULL
root localhost events_test Connect User lock select get_lock("test_lock2", 20) root localhost events_test Connect User lock select get_lock("test_lock2", 20)
"Release the mutex, the event worker should finish." "Release the mutex, the event worker should finish."
"Release the mutex, the event worker should finish."
select release_lock("test_lock2"); select release_lock("test_lock2");
release_lock("test_lock2") release_lock("test_lock2")
1 1
...@@ -489,16 +493,25 @@ select get_lock("test_lock2_1", 20); ...@@ -489,16 +493,25 @@ select get_lock("test_lock2_1", 20);
get_lock("test_lock2_1", 20) get_lock("test_lock2_1", 20)
1 1
create event закачка21 on schedule every 10 hour do select get_lock("test_lock2_1", 20); create event закачка21 on schedule every 10 hour do select get_lock("test_lock2_1", 20);
"Should have only 3 processes: the scheduler, our conn and the locked event" "Should have only 2 processes: the scheduler and the locked event"
select /*3*/ user, host, db, command, state, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info; select /*3*/ user, host, db, command, state, info
from information_schema.processlist
where (info like "select get_lock%" OR user='event_scheduler')
order by info;
user host db command state info user host db command state info
event_scheduler localhost NULL Daemon Waiting for next activation NULL event_scheduler localhost NULL Daemon Waiting for next activation NULL
root localhost events_test Connect User lock select get_lock("test_lock2_1", 20) root localhost events_test Connect User lock select get_lock("test_lock2_1", 20)
set global event_scheduler=off; set global event_scheduler=off;
"Should have only our process now:" "Should have only our process now:"
select /*4*/ user, host, db, command, state, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info; select /*4*/ user, host, db, command, state, info
from information_schema.processlist
where (info like "select get_lock%" OR user='event_scheduler')
order by info;
user host db command state info user host db command state info
root localhost events_test Connect User lock select get_lock("test_lock2_1", 20) root localhost events_test Connect User lock select get_lock("test_lock2_1", 20)
select release_lock("test_lock2_1");
release_lock("test_lock2_1")
1
drop event закачка21; drop event закачка21;
create table t_16 (s1 int); create table t_16 (s1 int);
create trigger t_16_bi before insert on t_16 for each row create event e_16 on schedule every 1 second do set @a=5; create trigger t_16_bi before insert on t_16 for each row create event e_16 on schedule every 1 second do set @a=5;
......
...@@ -52,7 +52,8 @@ do select 'events_logs_test' as inside_event, sleep(1.5); ...@@ -52,7 +52,8 @@ do select 'events_logs_test' as inside_event, sleep(1.5);
Nothing should be logged Nothing should be logged
select user_host, db, sql_text from mysql.slow_log where sql_text not like 'create event%'; select user_host, db, sql_text from mysql.slow_log
where sql_text like 'select \'events_logs_test\'%';
user_host db sql_text user_host db sql_text
set @@global.long_query_time=1; set @@global.long_query_time=1;
truncate mysql.slow_log; truncate mysql.slow_log;
...@@ -61,7 +62,8 @@ do select 'events_logs_test' as inside_event, sleep(1.5); ...@@ -61,7 +62,8 @@ do select 'events_logs_test' as inside_event, sleep(1.5);
Event sub-statement should be logged. Event sub-statement should be logged.
select user_host, db, sql_text from mysql.slow_log where sql_text not like 'create event%'; select user_host, db, sql_text from mysql.slow_log
where sql_text like 'select \'events_logs_test\'%';
user_host db sql_text user_host db sql_text
USER_HOST events_test select 'events_logs_test' as inside_event, sleep(1.5) USER_HOST events_test select 'events_logs_test' as inside_event, sleep(1.5)
drop database events_test; drop database events_test;
......
...@@ -1093,7 +1093,7 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -1093,7 +1093,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 144 1 SIMPLE t1 ALL NULL NULL NULL NULL 144
EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR GROUP BY (PRIMARY,i2) GROUP BY a; EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR GROUP BY (PRIMARY,i2) GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 144 Using index 1 SIMPLE t1 index NULL PRIMARY 4 NULL 144 Using index; Using filesort
EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY,i2) ORDER BY a; EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY,i2) ORDER BY a;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 144 Using index; Using filesort 1 SIMPLE t1 index NULL PRIMARY 4 NULL 144 Using index; Using filesort
...@@ -1129,7 +1129,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp ...@@ -1129,7 +1129,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
EXPLAIN SELECT a FROM t1 USE INDEX FOR JOIN (i2) EXPLAIN SELECT a FROM t1 USE INDEX FOR JOIN (i2)
USE INDEX FOR GROUP BY (i2) GROUP BY a; USE INDEX FOR GROUP BY (i2) GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL i2 9 NULL 144 Using index 1 SIMPLE t1 # NULL i2 # NULL # #
EXPLAIN SELECT a FROM t1 FORCE INDEX FOR JOIN (i2) EXPLAIN SELECT a FROM t1 FORCE INDEX FOR JOIN (i2)
FORCE INDEX FOR GROUP BY (i2) GROUP BY a; FORCE INDEX FOR GROUP BY (i2) GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
...@@ -1176,3 +1176,94 @@ old OFF ...@@ -1176,3 +1176,94 @@ old OFF
SET @@old = off; SET @@old = off;
ERROR HY000: Variable 'old' is a read only variable ERROR HY000: Variable 'old' is a read only variable
DROP TABLE t1, t2; DROP TABLE t1, t2;
CREATE TABLE t1(
a INT,
b INT NOT NULL,
c INT NOT NULL,
d INT,
UNIQUE KEY (c,b)
);
INSERT INTO t1 VALUES (1,1,1,50), (1,2,3,40), (2,1,3,4);
CREATE TABLE t2(
a INT,
b INT,
UNIQUE KEY(a,b)
);
INSERT INTO t2 VALUES (NULL, NULL), (NULL, NULL), (NULL, 1), (1, NULL), (1, 1), (1,2);
EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b,d;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort
SELECT c,b,d FROM t1 GROUP BY c,b,d;
c b d
1 1 50
3 1 4
3 2 40
EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b,d ORDER BY NULL;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
SELECT c,b,d FROM t1 GROUP BY c,b,d ORDER BY NULL;
c b d
1 1 50
3 2 40
3 1 4
EXPLAIN SELECT c,b,d FROM t1 ORDER BY c,b,d;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort
SELECT c,b,d FROM t1 ORDER BY c,b,d;
c b d
1 1 50
3 1 4
3 2 40
EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort
SELECT c,b,d FROM t1 GROUP BY c,b;
c b d
1 1 50
3 1 4
3 2 40
EXPLAIN SELECT c,b FROM t1 GROUP BY c,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL c 8 NULL 3 Using index
SELECT c,b FROM t1 GROUP BY c,b;
c b
1 1
3 1
3 2
EXPLAIN SELECT a,b from t2 ORDER BY a,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index NULL a 10 NULL 6 Using index
SELECT a,b from t2 ORDER BY a,b;
a b
NULL NULL
NULL NULL
NULL 1
1 NULL
1 1
1 2
EXPLAIN SELECT a,b from t2 GROUP BY a,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index NULL a 10 NULL 6 Using index
SELECT a,b from t2 GROUP BY a,b;
a b
NULL NULL
NULL 1
1 NULL
1 1
1 2
EXPLAIN SELECT a from t2 GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index NULL a 10 NULL 6 Using index
SELECT a from t2 GROUP BY a;
a
NULL
1
EXPLAIN SELECT b from t2 GROUP BY b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index NULL a 10 NULL 6 Using index; Using temporary; Using filesort
SELECT b from t2 GROUP BY b;
b
NULL
1
2
DROP TABLE t1;
...@@ -522,3 +522,16 @@ handler t1 open; ...@@ -522,3 +522,16 @@ handler t1 open;
ERROR HY000: Table storage engine for 't1' doesn't have this option ERROR HY000: Table storage engine for 't1' doesn't have this option
--> client 1 --> client 1
drop table t1; drop table t1;
drop table if exists t1;
create table t1 (a int);
handler t1 open as t1_alias;
handler t1_alias read a next;
ERROR 42000: Key 'a' doesn't exist in table 't1_alias'
handler t1_alias READ a next where inexistent > 0;
ERROR 42S22: Unknown column 'inexistent' in 'field list'
handler t1_alias read a next;
ERROR 42000: Key 'a' doesn't exist in table 't1_alias'
handler t1_alias READ a next where inexistent > 0;
ERROR 42S22: Unknown column 'inexistent' in 'field list'
handler t1_alias close;
drop table t1;
...@@ -522,3 +522,16 @@ handler t1 open; ...@@ -522,3 +522,16 @@ handler t1 open;
ERROR HY000: Table storage engine for 't1' doesn't have this option ERROR HY000: Table storage engine for 't1' doesn't have this option
--> client 1 --> client 1
drop table t1; drop table t1;
drop table if exists t1;
create table t1 (a int);
handler t1 open as t1_alias;
handler t1_alias read a next;
ERROR 42000: Key 'a' doesn't exist in table 't1_alias'
handler t1_alias READ a next where inexistent > 0;
ERROR 42S22: Unknown column 'inexistent' in 'field list'
handler t1_alias read a next;
ERROR 42000: Key 'a' doesn't exist in table 't1_alias'
handler t1_alias READ a next where inexistent > 0;
ERROR 42S22: Unknown column 'inexistent' in 'field list'
handler t1_alias close;
drop table t1;
...@@ -1141,6 +1141,55 @@ a b ...@@ -1141,6 +1141,55 @@ a b
ROLLBACK; ROLLBACK;
ROLLBACK; ROLLBACK;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1(
a INT,
b INT NOT NULL,
c INT NOT NULL,
d INT,
UNIQUE KEY (c,b)
) engine=innodb;
INSERT INTO t1 VALUES (1,1,1,50), (1,2,3,40), (2,1,3,4);
EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b,d;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort
SELECT c,b,d FROM t1 GROUP BY c,b,d;
c b d
1 1 50
3 1 4
3 2 40
EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b,d ORDER BY NULL;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
SELECT c,b,d FROM t1 GROUP BY c,b,d ORDER BY NULL;
c b d
1 1 50
3 1 4
3 2 40
EXPLAIN SELECT c,b,d FROM t1 ORDER BY c,b,d;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort
SELECT c,b,d FROM t1 ORDER BY c,b,d;
c b d
1 1 50
3 1 4
3 2 40
EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL c 8 NULL 3
SELECT c,b,d FROM t1 GROUP BY c,b;
c b d
1 1 50
3 1 4
3 2 40
EXPLAIN SELECT c,b FROM t1 GROUP BY c,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL c 8 NULL 3 Using index
SELECT c,b FROM t1 GROUP BY c,b;
c b
1 1
3 1
3 2
DROP TABLE t1;
End of 5.0 tests End of 5.0 tests
CREATE TABLE `t2` ( CREATE TABLE `t2` (
`k` int(11) NOT NULL auto_increment, `k` int(11) NOT NULL auto_increment,
......
...@@ -105,3 +105,22 @@ DROP VIEW view_target2; ...@@ -105,3 +105,22 @@ DROP VIEW view_target2;
DROP VIEW view_target3; DROP VIEW view_target3;
DROP USER user20989@localhost; DROP USER user20989@localhost;
DROP DATABASE meow; DROP DATABASE meow;
connection: default
set low_priority_updates=1;
drop table if exists t1;
create table t1 (a int, b int, unique key t1$a (a));
lock table t1 read;
connection: update
set low_priority_updates=1;
show variables like 'low_priority_updates';
Variable_name Value
low_priority_updates ON
insert into t1 values (1, 2) ON DUPLICATE KEY UPDATE b = 2;;
connection: select
select * from t1;
a b
connection: default
select * from t1;
a b
drop table t1;
set low_priority_updates=default;
...@@ -176,5 +176,7 @@ ERROR at line 1: DELIMITER cannot contain a backslash character ...@@ -176,5 +176,7 @@ ERROR at line 1: DELIMITER cannot contain a backslash character
ERROR at line 1: DELIMITER cannot contain a backslash character ERROR at line 1: DELIMITER cannot contain a backslash character
1 1
1 1
1
1
End of 5.0 tests End of 5.0 tests
WARNING: --server-arg option not supported in this configuration. WARNING: --server-arg option not supported in this configuration.
CREATE DATABASE mysqldump_30126;
USE mysqldump_30126;
CREATE TABLE t1 (c1 int);
DROP DATABASE mysqldump_30126;
...@@ -4177,5 +4177,18 @@ set names latin1; ...@@ -4177,5 +4177,18 @@ set names latin1;
# Cleanup. # Cleanup.
DROP DATABASE mysqldump_test_db; DROP DATABASE mysqldump_test_db;
# #
# BUG#29938: wrong behavior of mysqldump --skip-events
# with --all-databases
#
TRUNCATE mysql.event;
USE test;
CREATE event e29938 ON SCHEDULE AT '2035-12-31 20:01:23' DO SET @bug29938=29938;
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 e29938 root@localhost SYSTEM ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
TRUNCATE mysql.event;
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
#
# End of 5.1 tests # End of 5.1 tests
# #
This diff is collapsed.
...@@ -631,7 +631,7 @@ flush status; ...@@ -631,7 +631,7 @@ flush status;
delete from t2 where b > 5; delete from t2 where b > 5;
show status like 'Handler_read_rnd_next'; show status like 'Handler_read_rnd_next';
Variable_name Value Variable_name Value
Handler_read_rnd_next 1115 Handler_read_rnd_next 1215
show status like 'Handler_read_key'; show status like 'Handler_read_key';
Variable_name Value Variable_name Value
Handler_read_key 0 Handler_read_key 0
...@@ -645,7 +645,7 @@ flush status; ...@@ -645,7 +645,7 @@ flush status;
delete from t2 where b < 5 or b > 3; delete from t2 where b < 5 or b > 3;
show status like 'Handler_read_rnd_next'; show status like 'Handler_read_rnd_next';
Variable_name Value Variable_name Value
Handler_read_rnd_next 1115 Handler_read_rnd_next 1215
show status like 'Handler_read_key'; show status like 'Handler_read_key';
Variable_name Value Variable_name Value
Handler_read_key 0 Handler_read_key 0
......
...@@ -371,5 +371,163 @@ Variable_name Value ...@@ -371,5 +371,163 @@ Variable_name Value
Qcache_hits 21 Qcache_hits 21
drop table t1; drop table t1;
---- disconnect connection con1 ---- ---- disconnect connection con1 ----
########################################################################
#
# BUG#25843: Changing default database between PREPARE and EXECUTE of
# statement breaks binlog.
#
########################################################################
#
# Check that default database and its attributes are fixed at the
# creation time.
#
DROP DATABASE IF EXISTS mysqltest1;
DROP DATABASE IF EXISTS mysqltest2;
CREATE DATABASE mysqltest1 COLLATE utf8_unicode_ci;
CREATE DATABASE mysqltest2 COLLATE utf8_general_ci;
CREATE TABLE mysqltest1.t1(msg VARCHAR(255));
CREATE TABLE mysqltest2.t1(msg VARCHAR(255));
use mysqltest1;
PREPARE stmt_a_1 FROM 'INSERT INTO t1 VALUES(DATABASE())';
PREPARE stmt_a_2 FROM 'INSERT INTO t1 VALUES(@@collation_database)';
EXECUTE stmt_a_1;
EXECUTE stmt_a_2;
use mysqltest2;
EXECUTE stmt_a_1;
EXECUTE stmt_a_2;
SELECT * FROM mysqltest1.t1;
msg
mysqltest1
utf8_unicode_ci
mysqltest1
utf8_unicode_ci
SELECT * FROM mysqltest2.t1;
msg
DROP PREPARE stmt_a_1;
DROP PREPARE stmt_a_2;
#
# The Query Cache test case.
#
DELETE FROM mysqltest1.t1;
DELETE FROM mysqltest2.t1;
INSERT INTO mysqltest1.t1 VALUES('mysqltest1.t1');
INSERT INTO mysqltest2.t1 VALUES('mysqltest2.t1');
use mysqltest1;
PREPARE stmt_b_1 FROM 'SELECT * FROM t1';
use mysqltest2;
PREPARE stmt_b_2 FROM 'SELECT * FROM t1';
EXECUTE stmt_b_1;
msg
mysqltest1.t1
EXECUTE stmt_b_2;
msg
mysqltest2.t1
use mysqltest1;
EXECUTE stmt_b_1;
msg
mysqltest1.t1
EXECUTE stmt_b_2;
msg
mysqltest2.t1
DROP PREPARE stmt_b_1;
DROP PREPARE stmt_b_2;
use test;
DROP DATABASE mysqltest1;
DROP DATABASE mysqltest2;
#
# Check that prepared statements work properly when there is no current
# database.
#
CREATE DATABASE mysqltest1 COLLATE utf8_unicode_ci;
CREATE DATABASE mysqltest2 COLLATE utf8_general_ci;
use mysqltest1;
PREPARE stmt_c_1 FROM 'SELECT DATABASE(), @@collation_database';
use mysqltest2;
PREPARE stmt_c_2 FROM 'SELECT DATABASE(), @@collation_database';
DROP DATABASE mysqltest2;
SELECT DATABASE(), @@collation_database;
DATABASE() @@collation_database
NULL latin1_swedish_ci
EXECUTE stmt_c_1;
DATABASE() @@collation_database
mysqltest1 utf8_unicode_ci
SELECT DATABASE(), @@collation_database;
DATABASE() @@collation_database
NULL latin1_swedish_ci
EXECUTE stmt_c_2;
DATABASE() @@collation_database
NULL latin1_swedish_ci
Warnings:
Note 1049 Unknown database 'mysqltest2'
SELECT DATABASE(), @@collation_database;
DATABASE() @@collation_database
NULL latin1_swedish_ci
PREPARE stmt_c_3 FROM 'SELECT DATABASE(), @@collation_database';
EXECUTE stmt_c_3;
DATABASE() @@collation_database
NULL latin1_swedish_ci
use mysqltest1;
EXECUTE stmt_c_2;
DATABASE() @@collation_database
NULL latin1_swedish_ci
Warnings:
Note 1049 Unknown database 'mysqltest2'
SELECT DATABASE(), @@collation_database;
DATABASE() @@collation_database
mysqltest1 utf8_unicode_ci
EXECUTE stmt_c_3;
DATABASE() @@collation_database
NULL latin1_swedish_ci
SELECT DATABASE(), @@collation_database;
DATABASE() @@collation_database
mysqltest1 utf8_unicode_ci
DROP DATABASE mysqltest1;
use test;
########################################################################
set @@global.query_cache_size=@initial_query_cache_size; set @@global.query_cache_size=@initial_query_cache_size;
flush status; flush status;
...@@ -371,5 +371,163 @@ Variable_name Value ...@@ -371,5 +371,163 @@ Variable_name Value
Qcache_hits 19 Qcache_hits 19
drop table t1; drop table t1;
---- disconnect connection con1 ---- ---- disconnect connection con1 ----
########################################################################
#
# BUG#25843: Changing default database between PREPARE and EXECUTE of
# statement breaks binlog.
#
########################################################################
#
# Check that default database and its attributes are fixed at the
# creation time.
#
DROP DATABASE IF EXISTS mysqltest1;
DROP DATABASE IF EXISTS mysqltest2;
CREATE DATABASE mysqltest1 COLLATE utf8_unicode_ci;
CREATE DATABASE mysqltest2 COLLATE utf8_general_ci;
CREATE TABLE mysqltest1.t1(msg VARCHAR(255));
CREATE TABLE mysqltest2.t1(msg VARCHAR(255));
use mysqltest1;
PREPARE stmt_a_1 FROM 'INSERT INTO t1 VALUES(DATABASE())';
PREPARE stmt_a_2 FROM 'INSERT INTO t1 VALUES(@@collation_database)';
EXECUTE stmt_a_1;
EXECUTE stmt_a_2;
use mysqltest2;
EXECUTE stmt_a_1;
EXECUTE stmt_a_2;
SELECT * FROM mysqltest1.t1;
msg
mysqltest1
utf8_unicode_ci
mysqltest1
utf8_unicode_ci
SELECT * FROM mysqltest2.t1;
msg
DROP PREPARE stmt_a_1;
DROP PREPARE stmt_a_2;
#
# The Query Cache test case.
#
DELETE FROM mysqltest1.t1;
DELETE FROM mysqltest2.t1;
INSERT INTO mysqltest1.t1 VALUES('mysqltest1.t1');
INSERT INTO mysqltest2.t1 VALUES('mysqltest2.t1');
use mysqltest1;
PREPARE stmt_b_1 FROM 'SELECT * FROM t1';
use mysqltest2;
PREPARE stmt_b_2 FROM 'SELECT * FROM t1';
EXECUTE stmt_b_1;
msg
mysqltest1.t1
EXECUTE stmt_b_2;
msg
mysqltest2.t1
use mysqltest1;
EXECUTE stmt_b_1;
msg
mysqltest1.t1
EXECUTE stmt_b_2;
msg
mysqltest2.t1
DROP PREPARE stmt_b_1;
DROP PREPARE stmt_b_2;
use test;
DROP DATABASE mysqltest1;
DROP DATABASE mysqltest2;
#
# Check that prepared statements work properly when there is no current
# database.
#
CREATE DATABASE mysqltest1 COLLATE utf8_unicode_ci;
CREATE DATABASE mysqltest2 COLLATE utf8_general_ci;
use mysqltest1;
PREPARE stmt_c_1 FROM 'SELECT DATABASE(), @@collation_database';
use mysqltest2;
PREPARE stmt_c_2 FROM 'SELECT DATABASE(), @@collation_database';
DROP DATABASE mysqltest2;
SELECT DATABASE(), @@collation_database;
DATABASE() @@collation_database
NULL latin1_swedish_ci
EXECUTE stmt_c_1;
DATABASE() @@collation_database
mysqltest1 utf8_unicode_ci
SELECT DATABASE(), @@collation_database;
DATABASE() @@collation_database
NULL latin1_swedish_ci
EXECUTE stmt_c_2;
DATABASE() @@collation_database
NULL latin1_swedish_ci
Warnings:
Note 1049 Unknown database 'mysqltest2'
SELECT DATABASE(), @@collation_database;
DATABASE() @@collation_database
NULL latin1_swedish_ci
PREPARE stmt_c_3 FROM 'SELECT DATABASE(), @@collation_database';
EXECUTE stmt_c_3;
DATABASE() @@collation_database
NULL latin1_swedish_ci
use mysqltest1;
EXECUTE stmt_c_2;
DATABASE() @@collation_database
NULL latin1_swedish_ci
Warnings:
Note 1049 Unknown database 'mysqltest2'
SELECT DATABASE(), @@collation_database;
DATABASE() @@collation_database
mysqltest1 utf8_unicode_ci
EXECUTE stmt_c_3;
DATABASE() @@collation_database
NULL latin1_swedish_ci
SELECT DATABASE(), @@collation_database;
DATABASE() @@collation_database
mysqltest1 utf8_unicode_ci
DROP DATABASE mysqltest1;
use test;
########################################################################
set @@global.query_cache_size=@initial_query_cache_size; set @@global.query_cache_size=@initial_query_cache_size;
flush status; flush status;
...@@ -969,6 +969,18 @@ CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create user 'mysqltest ...@@ -969,6 +969,18 @@ CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create user 'mysqltest
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
CREATE FUNCTION bug_13627_f() returns int BEGIN create user 'mysqltest_1'; return 1; END | CREATE FUNCTION bug_13627_f() returns int BEGIN create user 'mysqltest_1'; return 1; END |
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
CREATE TRIGGER bug21975 BEFORE INSERT ON t1 FOR EACH ROW BEGIN grant select on t1 to 'mysqltest_1'; END |
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
CREATE FUNCTION bug21975() returns int BEGIN grant select on t1 to 'mysqltest_1'; return 1; END |
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
CREATE TRIGGER bug21975 BEFORE INSERT ON t1 FOR EACH ROW BEGIN revoke select on t1 from 'mysqltest_1'; END |
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
CREATE FUNCTION bug21975() returns int BEGIN revoke select on t1 from 'mysqltest_1'; return 1; END |
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
CREATE TRIGGER bug21975 BEFORE INSERT ON t1 FOR EACH ROW BEGIN revoke all privileges on *.* from 'mysqltest_1'; END |
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
CREATE FUNCTION bug21975() returns int BEGIN revoke all privileges on *.* from 'mysqltest_1'; return 1; END |
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop user 'mysqltest_1'; END | CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop user 'mysqltest_1'; END |
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
CREATE FUNCTION bug_13627_f() returns int BEGIN drop user 'mysqltest_1'; return 1; END | CREATE FUNCTION bug_13627_f() returns int BEGIN drop user 'mysqltest_1'; return 1; END |
......
...@@ -6546,4 +6546,78 @@ DROP VIEW v1; ...@@ -6546,4 +6546,78 @@ DROP VIEW v1;
DROP FUNCTION f1; DROP FUNCTION f1;
DROP FUNCTION f2; DROP FUNCTION f2;
DROP TABLE t1; DROP TABLE t1;
create function f1()
returns int(11)
not deterministic
contains sql
sql security definer
comment ''
begin
declare x int(11);
set x=-1;
return x;
end|
create view v1 as select 1 as one, f1() as days;
show create view test.v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select 1 AS `one`,`f1`() AS `days` latin1 latin1_swedish_ci
select column_name from information_schema.columns
where table_name='v1' and table_schema='test';
column_name
one
days
drop view v1;
drop function f1;
# Bug#13675.
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p2;
DROP TABLE IF EXISTS t1;
CREATE PROCEDURE p1(v DATETIME) CREATE TABLE t1 SELECT v;
CREATE PROCEDURE p2(v INT) CREATE TABLE t1 SELECT v;
CALL p1(NOW());
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`v` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CALL p1('text');
Warnings:
Warning 1264 Out of range value for column 'v' at row 1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`v` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CALL p2(10);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`v` bigint(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CALL p2('text');
Warnings:
Warning 1366 Incorrect integer value: 'text' for column 'v' at row 1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`v` bigint(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
DROP PROCEDURE p1;
DROP PROCEDURE p2;
End of 5.0 tests End of 5.0 tests
...@@ -208,3 +208,26 @@ GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION ...@@ -208,3 +208,26 @@ GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
drop user mysqltest_1@localhost; drop user mysqltest_1@localhost;
drop procedure 15298_1; drop procedure 15298_1;
drop procedure 15298_2; drop procedure 15298_2;
drop table if exists t1;
drop procedure if exists p1;
create table t1 (value varchar(15));
create procedure p1() update t1 set value='updated' where value='old';
call p1();
insert into t1 (value) values ("old");
select get_lock('b26162',120);
get_lock('b26162',120)
1
select 'rl_acquirer', value from t1 where get_lock('b26162',120);;
set session low_priority_updates=on;
call p1();;
select 'rl_contender', value from t1;
rl_contender value
rl_contender old
select release_lock('b26162');
release_lock('b26162')
1
rl_acquirer value
rl_acquirer old
drop procedure p1;
drop table t1;
set session low_priority_updates=default;
...@@ -87,6 +87,54 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_us ...@@ -87,6 +87,54 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_us
VARIABLE_NAME VARIABLE_VALUE VARIABLE_NAME VARIABLE_VALUE
MAX_USED_CONNECTIONS 4 MAX_USED_CONNECTIONS 4
SET GLOBAL thread_cache_size=@save_thread_cache_size; SET GLOBAL thread_cache_size=@save_thread_cache_size;
CREATE TABLE t1 ( a INT );
INSERT INTO t1 VALUES (1), (2);
SELECT a FROM t1 LIMIT 1;
a
1
SHOW SESSION STATUS LIKE 'Last_query_cost';
Variable_name Value
Last_query_cost 2.402418
EXPLAIN SELECT a FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
SHOW SESSION STATUS LIKE 'Last_query_cost';
Variable_name Value
Last_query_cost 2.402418
SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY a;
a
1
2
SHOW SESSION STATUS LIKE 'Last_query_cost';
Variable_name Value
Last_query_cost 0.000000
EXPLAIN SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
2 UNION t1 ALL NULL NULL NULL NULL 2
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL Using filesort
SHOW SESSION STATUS LIKE 'Last_query_cost';
Variable_name Value
Last_query_cost 0.000000
SELECT a IN (SELECT a FROM t1) FROM t1 LIMIT 1;
a IN (SELECT a FROM t1)
1
SHOW SESSION STATUS LIKE 'Last_query_cost';
Variable_name Value
Last_query_cost 0.000000
SELECT (SELECT a FROM t1 LIMIT 1) x FROM t1 LIMIT 1;
x
1
SHOW SESSION STATUS LIKE 'Last_query_cost';
Variable_name Value
Last_query_cost 0.000000
SELECT * FROM t1 a, t1 b LIMIT 1;
a a
1 1
SHOW SESSION STATUS LIKE 'Last_query_cost';
Variable_name Value
Last_query_cost 4.805836
DROP TABLE t1;
show status like 'com_show_status'; show status like 'com_show_status';
Variable_name Value Variable_name Value
Com_show_status 3 Com_show_status 3
......
...@@ -642,6 +642,21 @@ b+0 COUNT(DISTINCT a) ...@@ -642,6 +642,21 @@ b+0 COUNT(DISTINCT a)
1 1 1 1
3 2 3 2
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (b BIT);
INSERT INTO t1 (b) VALUES (1), (0);
SELECT DISTINCT b FROM t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 t1 b b 16 1 1 Y 32 0 63
b
#
#
SELECT b FROM t1 GROUP BY b;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 t1 b b 16 1 1 Y 32 0 63
b
#
#
DROP TABLE t1;
End of 5.0 tests End of 5.0 tests
create table t1(a bit(7)); create table t1(a bit(7));
insert into t1 values(0x40); insert into t1 values(0x40);
......
...@@ -141,6 +141,11 @@ DROP TABLE test.backup_info; ...@@ -141,6 +141,11 @@ DROP TABLE test.backup_info;
drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c; drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c;
ForceVarPart: 0 ForceVarPart: 0
ForceVarPart: 1 ForceVarPart: 1
select * from information_schema.columns where table_name = "t1_c";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT
NULL test t1_c capgoaledatta 1 NULL NO mediumint NULL NULL 7 0 NULL NULL mediumint(5) unsigned PRI auto_increment select,insert,update,references
NULL test t1_c goaledatta 2 NO char 2 2 NULL NULL latin1 latin1_swedish_ci char(2) PRI select,insert,update,references
NULL test t1_c maturegarbagefa 3 NO varchar 32 32 NULL NULL latin1 latin1_swedish_ci varchar(32) PRI select,insert,update,references
select count(*) from t1; select count(*) from t1;
count(*) count(*)
5 5
......
...@@ -111,4 +111,9 @@ SYSTEM_VALUES_ID VALUE ...@@ -111,4 +111,9 @@ SYSTEM_VALUES_ID VALUE
SELECT * FROM mysql.ndb_apply_status WHERE server_id=0; SELECT * FROM mysql.ndb_apply_status WHERE server_id=0;
server_id epoch log_name start_pos end_pos server_id epoch log_name start_pos end_pos
0 331 0 0 0 331 0 0
SELECT * FROM DESCRIPTION ORDER BY USERNAME;
USERNAME ADDRESS
Guangbao Ni Suite 503, 5F NCI Tower, A12 Jianguomenwai Avenue Chaoyang District, Beijing, 100022 PRC
USERNAME Varchar(255;latin1_swedish_ci) NULL AT=SHORT_VAR ST=MEMORY
ADDRESS Longvarchar(2002;latin1_swedish_ci) NULL AT=MEDIUM_VAR ST=MEMORY
DROP DATABASE BANK; DROP DATABASE BANK;
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
# Do not use any TAB characters for whitespace. # Do not use any TAB characters for whitespace.
# #
############################################################################## ##############################################################################
ndb_autodiscover : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog
ndb_autodiscover2 : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog
ndb_dd_sql_features : Bug#29102 ndb_dd_sql_features fails in pushbuild ndb_dd_sql_features : Bug#29102 ndb_dd_sql_features fails in pushbuild
ndb_load : BUG#17233 2006-05-04 tomas failed load data from infile causes mysqld dbug_assert, binlog not flushed ndb_load : BUG#17233 2006-05-04 tomas failed load data from infile causes mysqld dbug_assert, binlog not flushed
...@@ -21,5 +19,3 @@ ndb_partition_error2 : HF is not sure if the test can work as internded on all ...@@ -21,5 +19,3 @@ ndb_partition_error2 : HF is not sure if the test can work as internded on all
# the below testcase have been reworked to avoid the bug, test contains comment, keep bug open # the below testcase have been reworked to avoid the bug, test contains comment, keep bug open
#ndb_binlog_ddl_multi : BUG#18976 2006-04-10 kent CRBR: multiple binlog, second binlog may miss schema log events #ndb_binlog_ddl_multi : BUG#18976 2006-04-10 kent CRBR: multiple binlog, second binlog may miss schema log events
#ndb_binlog_discover : bug#21806 2006-08-24 #ndb_binlog_discover : bug#21806 2006-08-24
#ndb_autodiscover3 : bug#21806
#ndb_autodiscover3 : Bug#20872 2007-07-15 ingo master*.err: miscellaneous error messages
...@@ -180,6 +180,11 @@ drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c; ...@@ -180,6 +180,11 @@ drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c;
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t3_c | grep ForceVarPart --exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t3_c | grep ForceVarPart
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t2_c | grep ForceVarPart --exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t2_c | grep ForceVarPart
# Bug #30667
# ndb table discovery does not work correcly with information schema
# - prior to bug fix this would yeild no output and a warning
select * from information_schema.columns where table_name = "t1_c";
# random output order?? # random output order??
#show tables; #show tables;
......
...@@ -58,4 +58,10 @@ SELECT * FROM ACCOUNT ORDER BY ACCOUNT_ID; ...@@ -58,4 +58,10 @@ SELECT * FROM ACCOUNT ORDER BY ACCOUNT_ID;
SELECT COUNT(*) FROM TRANSACTION; SELECT COUNT(*) FROM TRANSACTION;
SELECT * FROM SYSTEM_VALUES ORDER BY SYSTEM_VALUES_ID; SELECT * FROM SYSTEM_VALUES ORDER BY SYSTEM_VALUES_ID;
SELECT * FROM mysql.ndb_apply_status WHERE server_id=0; SELECT * FROM mysql.ndb_apply_status WHERE server_id=0;
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 2 -n 1 -m -p 1 -s -r $MYSQL_TEST_DIR/std_data/ndb_backup50 >> $NDB_TOOLS_OUTPUT
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 2 -n 2 -p 1 -s -r $MYSQL_TEST_DIR/std_data/ndb_backup50 >> $NDB_TOOLS_OUTPUT
SELECT * FROM DESCRIPTION ORDER BY USERNAME;
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d BANK DESCRIPTION | grep SHORT_VAR
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d BANK DESCRIPTION | grep MEDIUM_VAR
DROP DATABASE BANK; DROP DATABASE BANK;
-- source include/have_ndb.inc
-- source include/ndb_default_cluster.inc
-- source include/not_embedded.inc
#
# Bug #27543 restore of backup from different endian does not work for blob column
# Bug #30024 restore of backup from different endian does not work for datetime column
# Bug #28674 backup will run forever if disk full and later write succes will kill ndb node
#
# The table structure and data list below
#
# CREATE TABLE t_num (
# t_pk INT PRIMARY KEY,
# t_bit BIT(64),
# t_tinyint TINYINT,
# t_bool BOOL,
# t_smallint SMALLINT,
# t_mediumint MEDIUMINT,
# t_int INT,
# t_bigint BIGINT,
# t_float FLOAT,
# t_double DOUBLE,
# t_decimal DECIMAL (37, 16)
# ) ENGINE=NDBCLUSTER;
#
# INSERT INTO t_num VALUE (
# 1,
# b'1010101010101010101010101010101010101010101010101010101010101010',
# 125,
# 1,
# 32765,
# 8388606,
# 2147483647,
# 9223372036854775807,
# 1e+20,
# 1e+150,
# '331.0000000000'
# );
#
# CREATE TABLE t_datetime (
# t_pk INT PRIMARY KEY,
# t_date DATE,
# t_datetime DATETIME,
# t_timestamp TIMESTAMP,
# t_time TIME,
# t_year YEAR
# ) ENGINE=NDBCLUSTER;
#
# INSERT INTO t_datetime VALUE (
# 1,
# '1998-01-01',
# '2006-08-10 10:11:12',
# 20021029165106,
# '19:38:34',
# 2155
# );
#
# CREATE TABLE t_string_1 (
# t_pk INT PRIMARY KEY,
# t_char CHAR(255),
# t_varchar VARCHAR(655),
# t_binary BINARY(255),
# t_varbinary VARBINARY(6553)
# ) ENGINE=NDBCLUSTER;
#
# CREATE TABLE t_string_2 (
# t_pk INT PRIMARY KEY,
# t_tinyblob TINYBLOB,
# t_tinytext TINYTEXT,
# t_blob BLOB,
# t_text TEXT,
# t_mediumblob MEDIUMBLOB,
# t_mediumtext MEDIUMTEXT,
# t_longblob LONGBLOB,
# t_longtext LONGTEXT,
# t_enum ENUM('001001','001004','001010','001018','001019','001020','001021','001027','001028','001029','001030','001031','001100','002003','002004','002005','002007')DEFAULT '001001' NOT NULL,
# t_set SET('a','B')
# ) ENGINE=NDBCLUSTER;
#
# INSERT INTO t_string_1 VALUE (
# 1,
# 'abcdefghijklmn',
# 'abcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmn',
# 0x612020,
# 0x4100
# );
#
# INSERT INTO t_string_2 VALUE (
# 1,
# 'abcdefghijklmnabcdefghijklmn',
# 'abcdefghijklmnabcdefghijklmn',
# 'a123456789b123456789c123456789d123456789e123456789f123456789g123456789',
# 'a123456789b123456789c123456789d123456789e123456789f123456789g123456789',
# 'a123456789b123456789c123456789d123456789e123456789f123456789g123456789',
# 'a123456789b123456789c123456789d123456789e123456789f123456789g123456789',
# 'a123456789b123456789c123456789d123456789e123456789f123456789g123456789',
# 'a123456789b123456789c123456789d123456789e123456789f123456789g123456789',
# '001001',
# 'a'
# );
#
# CREATE TABLE t_gis (
# t_pk INT PRIMARY KEY,
# t_point POINT,
# t_linestring LINESTRING,
# t_polygon POLYGON,
# t_multipoint MULTIPOINT,
# t_multilinestring MULTILINESTRING,
# t_multipolygon MULTIPOLYGON,
# t_geometrycollection GEOMETRYCOLLECTION,
# t_geometry GEOMETRY
# ) ENGINE=NDBCLUSTER;
#
# INSERT INTO t_gis VALUE (
# 1,
# PointFromText('POINT(10 10)'),
# LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)'),
# PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'),
# MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)'),
# MLineFromText('MULTILINESTRING((10 48,10 21,10 0))'),
# MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))'),
# GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))'),
# MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')
# );
#
# INSERT INTO t_gis VALUE (
# 2,
# PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))),
# LineStringFromWKB(LineString(Point(10, 10), Point(40, 10))),
# PolyFromWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)))),
# MPointFromWKB(MultiPoint(Point(3, 6), Point(4, 10))),
# MLineFromWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7)))),
# MPolyFromWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))))),
# GeometryFromWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))),
# GeometryFromWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9))))
# );
#
# Restore backup files (from little endian)
#
--disable_warnings
USE test;
DROP TABLE IF EXISTS t_num,t_datetime,t_string_1,t_string_2,t_gis;
--enable_warnings
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 1 -m -r $MYSQL_TEST_DIR/std_data/ndb_backup51_data_le >> $NDB_TOOLS_OUTPUT
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 2 -r $MYSQL_TEST_DIR/std_data/ndb_backup51_data_le >> $NDB_TOOLS_OUTPUT
SHOW TABLES;
SHOW CREATE TABLE t_num;
SHOW CREATE TABLE t_datetime;
SHOW CREATE TABLE t_string_1;
SHOW CREATE TABLE t_string_2;
SHOW CREATE TABLE t_gis;
SELECT * FROM t_datetime;
SELECT t_pk,hex(t_bit),t_tinyint,t_bool,t_smallint,t_mediumint,t_int,t_bigint,t_float,t_double,t_decimal FROM t_num;
SELECT t_pk,t_char,t_varchar,hex(t_binary),hex(t_varbinary) FROM t_string_1;
SELECT * FROM t_string_2;
SELECT AsText(t_point), AsText(t_linestring),AsText(t_polygon) FROM t_gis ORDER by t_pk;
SELECT AsText(t_multipoint), AsText(t_multilinestring),AsText(t_multipolygon) FROM t_gis ORDER by t_pk;
SELECT AsText(t_geometrycollection), AsText(t_geometry) FROM t_gis ORDER by t_pk;
#
# Restore backup files (from big endian)
#
DROP TABLE t_num,t_datetime,t_string_1,t_string_2,t_gis;
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 1 -m -r $MYSQL_TEST_DIR/std_data/ndb_backup51_data_be >> $NDB_TOOLS_OUTPUT
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 2 -r $MYSQL_TEST_DIR/std_data/ndb_backup51_data_be >> $NDB_TOOLS_OUTPUT
SHOW TABLES;
SHOW CREATE TABLE t_num;
SHOW CREATE TABLE t_datetime;
SHOW CREATE TABLE t_string_1;
SHOW CREATE TABLE t_string_2;
SHOW CREATE TABLE t_gis;
SELECT * FROM t_datetime;
SELECT t_pk,hex(t_bit),t_tinyint,t_bool,t_smallint,t_mediumint,t_int,t_bigint,t_float,t_double,t_decimal FROM t_num;
SELECT t_pk,t_char,t_varchar,hex(t_binary),hex(t_varbinary) FROM t_string_1;
SELECT * FROM t_string_2;
SELECT AsText(t_point), AsText(t_linestring),AsText(t_polygon) FROM t_gis ORDER by t_pk;
SELECT AsText(t_multipoint), AsText(t_multilinestring),AsText(t_multipolygon) FROM t_gis ORDER by t_pk;
SELECT AsText(t_geometrycollection), AsText(t_geometry) FROM t_gis ORDER by t_pk;
DROP TABLE t_num,t_datetime,t_string_1,t_string_2,t_gis;
##############################################################################
#
# List the test cases that are to be disabled temporarily.
#
# Separate the test case name and the comment with ':'.
#
# <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment>
#
# Do not use any TAB characters for whitespace.
#
##############################################################################
ndb_autodiscover : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog
ndb_autodiscover2 : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog
# the below testcase have been reworked to avoid the bug, test contains comment, keep bug open
#ndb_autodiscover3 : bug#21806
#ndb_autodiscover3 : Bug#20872 2007-07-15 ingo master*.err: miscellaneous error messages
drop database if exists d1;
create database d1;
use d1;
create table t (s1 int) engine=innodb;
set @@autocommit=0;
start transaction;
insert into t values (1);
grant select on t to x@y;
rollback;
show grants for x@y;
Grants for x@y
GRANT USAGE ON *.* TO 'x'@'y'
GRANT SELECT ON `d1`.`t` TO 'x'@'y'
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 106 Server ver: VERSION, Binlog ver: 4
master-bin.000001 106 Query 1 193 drop database if exists d1
master-bin.000001 193 Query 1 272 create database d1
master-bin.000001 272 Query 1 370 use `d1`; create table t (s1 int) engine=innodb
master-bin.000001 370 Query 1 436 use `d1`; BEGIN
master-bin.000001 436 Query 1 521 use `d1`; insert into t values (1)
master-bin.000001 521 Xid 1 548 COMMIT /* XID */
master-bin.000001 548 Query 1 633 use `d1`; grant select on t to x@y
start transaction;
insert into t values (2);
revoke select on t from x@y;
commit;
select * from t;
s1
1
2
show grants for x@y;
Grants for x@y
GRANT USAGE ON *.* TO 'x'@'y'
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 106 Server ver: VERSION, Binlog ver: 4
master-bin.000001 106 Query 1 193 drop database if exists d1
master-bin.000001 193 Query 1 272 create database d1
master-bin.000001 272 Query 1 370 use `d1`; create table t (s1 int) engine=innodb
master-bin.000001 370 Query 1 436 use `d1`; BEGIN
master-bin.000001 436 Query 1 521 use `d1`; insert into t values (1)
master-bin.000001 521 Xid 1 548 COMMIT /* XID */
master-bin.000001 548 Query 1 633 use `d1`; grant select on t to x@y
master-bin.000001 633 Query 1 699 use `d1`; BEGIN
master-bin.000001 699 Query 1 784 use `d1`; insert into t values (2)
master-bin.000001 784 Xid 1 811 COMMIT /* XID */
master-bin.000001 811 Query 1 899 use `d1`; revoke select on t from x@y
drop user x@y;
drop database d1;
...@@ -26,5 +26,55 @@ from-master-2-'', ...@@ -26,5 +26,55 @@ from-master-2-'',
from-var-from-master-3 from-var-from-master-3
drop table t1; drop table t1;
stop slave; stop slave;
########################################################################
#
# BUG#25843: Changing default database between PREPARE and EXECUTE of
# statement breaks binlog.
#
########################################################################
# Connection: slave
START SLAVE;
# Connection: master
CREATE DATABASE mysqltest1;
CREATE TABLE t1(db_name CHAR(32), db_col_name CHAR(32));
PREPARE stmt_d_1 FROM 'INSERT INTO t1 VALUES(DATABASE(), @@collation_database)';
EXECUTE stmt_d_1;
use mysqltest1;
EXECUTE stmt_d_1;
# Connection: slave
SELECT * FROM t1;
db_name db_col_name
test latin1_swedish_ci
test latin1_swedish_ci
# Connection: master
DROP DATABASE mysqltest1;
use test;
# Connection: slave
STOP SLAVE;
########################################################################
reset master; reset master;
reset slave; reset slave;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT, b INT);
INSERT INTO t1 SELECT 1;
INSERT INTO t1 VALUES (2),(3),(4),(5),(6);
INSERT INTO t2 SELECT 1, ROW_COUNT();
INSERT INTO t1 VALUES (2),(3),(4);
INSERT INTO t2 SELECT 2, ROW_COUNT();
SELECT b FROM t2 ORDER BY a;
b
1
3
SELECT b FROM t2 ORDER BY a;
b
1
3
DROP TABLE t1, t2;
-- source include/have_innodb.inc
-- source include/not_embedded.inc
-- source include/have_binlog_format_mixed_or_statement.inc
let $VERSION=`select version()`;
# Bug #21975: grant/revoke statements in transaction
# used to disappear from binlog upon rallback.
# Now GRANT/REVOKE do implicitly commit
# transaction
--disable_warnings
drop database if exists d1;
--enable_warnings
create database d1;
use d1;
create table t (s1 int) engine=innodb;
set @@autocommit=0;
start transaction;
insert into t values (1);
grant select on t to x@y;
#
# There is no active transaction here
#
rollback;
show grants for x@y;
--replace_result $VERSION VERSION
--replace_regex /\/\* xid=.* \*\//\/* XID *\//
show binlog events;
start transaction;
insert into t values (2);
revoke select on t from x@y;
#
# There is no active transaction here
#
commit;
select * from t;
show grants for x@y;
--replace_result $VERSION VERSION
--replace_regex /\/\* xid=.* \*\//\/* XID *\//
show binlog events;
drop user x@y;
drop database d1;
...@@ -46,6 +46,101 @@ stop slave; ...@@ -46,6 +46,101 @@ stop slave;
# End of 4.1 tests # End of 4.1 tests
#
# Bug #25843 Changing default database between PREPARE and EXECUTE of statement
# breaks binlog.
#
# There were actually two problems discovered by this bug:
#
# 1. Default (current) database is not fixed at the creation time.
# That leads to wrong output of DATABASE() function.
#
# 2. Database attributes (@@collation_database) are not fixed at the creation
# time. That leads to wrong resultset.
#
# Binlog breakage and Query Cache wrong output happened because of the first
# problem.
#
--echo
--echo ########################################################################
--echo #
--echo # BUG#25843: Changing default database between PREPARE and EXECUTE of
--echo # statement breaks binlog.
--echo #
--echo ########################################################################
###############################################################################
--echo
--echo # Connection: slave
--echo
--connection slave
--echo
START SLAVE;
--echo
--echo # Connection: master
--echo
--connection master
--echo
CREATE DATABASE mysqltest1;
CREATE TABLE t1(db_name CHAR(32), db_col_name CHAR(32));
--echo
PREPARE stmt_d_1 FROM 'INSERT INTO t1 VALUES(DATABASE(), @@collation_database)';
--echo
EXECUTE stmt_d_1;
--echo
use mysqltest1;
--echo
EXECUTE stmt_d_1;
--echo
--save_master_pos
--echo
--echo # Connection: slave
--echo
--connection slave
--sync_with_master
--echo
SELECT * FROM t1;
--echo
--echo # Connection: master
--echo
--connection master
--echo
DROP DATABASE mysqltest1;
--echo
use test;
--echo
--save_master_pos
--echo
--echo # Connection: slave
--echo
--connection slave
--sync_with_master
--echo
STOP SLAVE;
--echo
--echo ########################################################################
###############################################################################
reset master; reset master;
reset slave; reset slave;
disconnect master; disconnect master;
source include/master-slave.inc;
source include/have_binlog_format_mixed.inc;
#
# Bug #30244: row_count/found_rows does not replicate well
#
connection master;
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT, b INT);
INSERT INTO t1 SELECT 1;
connection master1;
INSERT INTO t1 VALUES (2),(3),(4),(5),(6);
connection master;
INSERT INTO t2 SELECT 1, ROW_COUNT();
INSERT INTO t1 VALUES (2),(3),(4);
INSERT INTO t2 SELECT 2, ROW_COUNT();
#must return 1 and 3
SELECT b FROM t2 ORDER BY a;
sync_slave_with_master;
#must return 1 and 3
SELECT b FROM t2 ORDER BY a;
connection master;
DROP TABLE t1, t2;
sync_slave_with_master;
connection master;
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
--source include/have_ndb.inc --source include/have_ndb.inc
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/have_binlog_format_mixed_or_row.inc --source include/have_binlog_format_mixed_or_row.inc
--source include/master-slave.inc --source include/ndb_master-slave.inc
# On master use NDB as storage engine. # On master use NDB as storage engine.
connection master; connection master;
......
--source include/have_ndb.inc --source include/have_ndb.inc
--source include/have_binlog_format_mixed_or_row.inc
--source include/ndb_master-slave.inc --source include/ndb_master-slave.inc
......
--source include/have_ndb.inc --source include/have_ndb.inc
--source include/have_binlog_format_mixed_or_row.inc
--source include/ndb_master-slave.inc --source include/ndb_master-slave.inc
# #
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
# code between engine tests # # code between engine tests #
################################# #################################
-- source include/have_ndb.inc -- source include/have_ndb.inc
-- source include/have_binlog_format_mixed_or_row.inc
-- source include/ndb_master-slave.inc -- source include/ndb_master-slave.inc
let $engine_type=NDBCLUSTER; let $engine_type=NDBCLUSTER;
-- source extra/rpl_tests/rpl_row_blob.test -- source extra/rpl_tests/rpl_row_blob.test
......
--source include/have_ndb.inc --source include/have_ndb.inc
--source include/have_binlog_format_mixed_or_row.inc
--source include/ndb_master-slave.inc --source include/ndb_master-slave.inc
# set up circular replication # set up circular replication
......
--source include/have_ndb.inc --source include/have_ndb.inc
--source include/have_binlog_format_mixed_or_row.inc
--source include/ndb_master-slave.inc --source include/ndb_master-slave.inc
connection master; connection master;
......
...@@ -6,6 +6,5 @@ ...@@ -6,6 +6,5 @@
##################################### #####################################
-- source include/have_ndb.inc -- source include/have_ndb.inc
-- source include/ndb_master-slave.inc -- source include/ndb_master-slave.inc
-- source include/have_log_bin.inc
let $engine_type=NDB; let $engine_type=NDB;
-- source extra/rpl_tests/rpl_commit_after_flush.test -- source extra/rpl_tests/rpl_commit_after_flush.test
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
# Share test code between engine tests # # Share test code between engine tests #
######################################### #########################################
--source include/have_ndb.inc --source include/have_ndb.inc
-- source include/have_binlog_format_mixed_or_row.inc
-- source include/ndb_master-slave.inc -- source include/ndb_master-slave.inc
let $engine_type=NDB; let $engine_type=NDB;
-- source extra/rpl_tests/rpl_delete_no_where.test -- source extra/rpl_tests/rpl_delete_no_where.test
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
########################################################## ##########################################################
--source include/have_ndb.inc --source include/have_ndb.inc
--source include/have_binlog_format_mixed_or_row.inc
--source include/ndb_master-slave.inc --source include/ndb_master-slave.inc
--disable_warnings --disable_warnings
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
########################################################## ##########################################################
--source include/have_ndb.inc --source include/have_ndb.inc
--source include/have_binlog_format_mixed_or_row.inc
--source include/ndb_master-slave.inc --source include/ndb_master-slave.inc
--disable_warnings --disable_warnings
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
# reduce test case code # # reduce test case code #
################################### ###################################
-- source include/have_ndb.inc -- source include/have_ndb.inc
-- source include/have_binlog_format_mixed_or_row.inc
-- source include/ndb_master-slave.inc -- source include/ndb_master-slave.inc
let $engine_type=NDB; let $engine_type=NDB;
-- source extra/rpl_tests/rpl_row_func003.test -- source extra/rpl_tests/rpl_row_func003.test
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
-- source include/have_ndb.inc -- source include/have_ndb.inc
-- source include/have_innodb.inc -- source include/have_innodb.inc
-- source include/ndb_master-slave.inc -- source include/ndb_master-slave.inc
-- source include/have_log_bin.inc
create table t1 (a int, unique(a)) engine=ndbcluster; create table t1 (a int, unique(a)) engine=ndbcluster;
create table t2 (a int, unique(a)) engine=innodb; create table t2 (a int, unique(a)) engine=innodb;
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
# Wrapper for rpl_insert_ignore.test# # Wrapper for rpl_insert_ignore.test#
##################################### #####################################
-- source include/have_ndb.inc -- source include/have_ndb.inc
-- source include/have_binlog_format_mixed_or_row.inc
-- source include/ndb_master-slave.inc -- source include/ndb_master-slave.inc
let $engine_type=NDB; let $engine_type=NDB;
let $engine_type2=myisam; let $engine_type2=myisam;
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
# to reuse test code between engine runs # # to reuse test code between engine runs #
############################################################ ############################################################
-- source include/have_ndb.inc -- source include/have_ndb.inc
-- source include/have_binlog_format_mixed_or_row.inc
-- source include/ndb_master-slave.inc -- source include/ndb_master-slave.inc
let $engine_type=NDB; let $engine_type=NDB;
-- source extra/rpl_tests/rpl_multi_update3.test -- source extra/rpl_tests/rpl_multi_update3.test
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
########################################################## ##########################################################
--source include/have_ndb.inc --source include/have_ndb.inc
--source include/have_binlog_format_mixed_or_row.inc
--source include/ndb_master-slave.inc --source include/ndb_master-slave.inc
--disable_warnings --disable_warnings
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
# By JBM 2005-02-15 Wrapped to allow reuse of test code# # By JBM 2005-02-15 Wrapped to allow reuse of test code#
######################################################## ########################################################
--source include/have_ndb.inc --source include/have_ndb.inc
-- source include/have_binlog_format_mixed_or_row.inc
-- source include/ndb_master-slave.inc -- source include/ndb_master-slave.inc
let $engine_type=NDB; let $engine_type=NDB;
-- source extra/rpl_tests/rpl_row_001.test -- source extra/rpl_tests/rpl_row_001.test
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
# For different engines # # For different engines #
################################# #################################
-- source include/have_ndb.inc -- source include/have_ndb.inc
-- source include/have_binlog_format_mixed_or_row.inc
-- source include/ndb_master-slave.inc -- source include/ndb_master-slave.inc
let $engine_type=NDBCLUSTER; let $engine_type=NDBCLUSTER;
-- source extra/rpl_tests/rpl_row_sp003.test -- source extra/rpl_tests/rpl_row_sp003.test
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
# For different engines # # For different engines #
################################# #################################
-- source include/have_ndb.inc -- source include/have_ndb.inc
-- source include/have_binlog_format_mixed_or_row.inc
-- source include/ndb_master-slave.inc -- source include/ndb_master-slave.inc
let $engine_type=NDBCLUSTER; let $engine_type=NDBCLUSTER;
-- source extra/rpl_tests/rpl_row_sp006.test -- source extra/rpl_tests/rpl_row_sp006.test
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment