Merge from 5.1 up to rev 3392
This commit is contained in:
commit
d5f2972628
@ -147,8 +147,8 @@ test-bt:
|
||||
-if [ -e bin/ndbd -o -e storage/ndb/src/kernel/ndbd ] ; then \
|
||||
cd mysql-test ; \
|
||||
MTR_BUILD_THREAD=auto \
|
||||
@PERL@ ./mysql-test-run.pl --comment=ndb+rpl_ndb+ps --force --timer \
|
||||
--ps-protocol --mysqld=--binlog-format=row --suite=ndb,rpl_ndb ; \
|
||||
@PERL@ ./mysql-test-run.pl --comment=ndb+ps --force --timer \
|
||||
--ps-protocol --mysqld=--binlog-format=row --suite=ndb ; \
|
||||
MTR_BUILD_THREAD=auto \
|
||||
@PERL@ ./mysql-test-run.pl --comment=ndb --force --timer \
|
||||
--with-ndbcluster-only ; \
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2000-2008 MySQL AB
|
||||
/* Copyright 2000, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -13,6 +13,11 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#define COPYRIGHT_NOTICE "\
|
||||
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.\n\
|
||||
This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\
|
||||
and you are welcome to modify and redistribute it under the GPL v2 license\n"
|
||||
|
||||
/* mysql command tool
|
||||
* Commands compatible with mSQL by David J. Hughes
|
||||
*
|
||||
@ -1166,6 +1171,8 @@ int main(int argc,char *argv[])
|
||||
mysql_thread_id(&mysql), server_version_string(&mysql));
|
||||
put_info((char*) glob_buffer.ptr(),INFO_INFO);
|
||||
|
||||
put_info(COPYRIGHT_NOTICE, INFO_INFO);
|
||||
|
||||
#ifdef HAVE_READLINE
|
||||
initialize_readline((char*) my_progname);
|
||||
if (!status.batch && !quick && !opt_html && !opt_xml)
|
||||
@ -1208,13 +1215,11 @@ int main(int argc,char *argv[])
|
||||
sprintf(histfile_tmp, "%s.TMP", histfile);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
sprintf(buff, "%s",
|
||||
#ifndef NOT_YET
|
||||
"Type 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\n");
|
||||
#else
|
||||
"Type 'help [[%]function name[%]]' to get help on usage of function.\n");
|
||||
#endif
|
||||
put_info(buff,INFO_INFO);
|
||||
status.exit_status= read_and_execute(!status.batch);
|
||||
if (opt_outfile)
|
||||
@ -1568,10 +1573,7 @@ static void usage(int version)
|
||||
|
||||
if (version)
|
||||
return;
|
||||
printf("\
|
||||
Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.\n\
|
||||
This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\
|
||||
and you are welcome to modify and redistribute it under the GPL license\n");
|
||||
printf("%s", COPYRIGHT_NOTICE);
|
||||
printf("Usage: %s [OPTIONS] [database]\n", my_progname);
|
||||
my_print_help(my_long_options);
|
||||
print_defaults("my", load_default_groups);
|
||||
|
@ -44,7 +44,7 @@ static DYNAMIC_STRING conn_args;
|
||||
static char *opt_password= 0;
|
||||
static my_bool tty_password= 0;
|
||||
|
||||
static char opt_tmpdir[FN_REFLEN];
|
||||
static char opt_tmpdir[FN_REFLEN] = "";
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
static char *default_dbug_option= (char*) "d:t:O,/tmp/mysql_upgrade.trace";
|
||||
@ -459,7 +459,8 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res,
|
||||
|
||||
DBUG_ENTER("run_query");
|
||||
DBUG_PRINT("enter", ("query: %s", query));
|
||||
if ((fd= create_temp_file(query_file_path, opt_tmpdir,
|
||||
if ((fd= create_temp_file(query_file_path,
|
||||
opt_tmpdir[0] ? opt_tmpdir : NULL,
|
||||
"sql", O_CREAT | O_SHARE | O_RDWR,
|
||||
MYF(MY_WME))) < 0)
|
||||
die("Failed to create temporary file for defaults");
|
||||
|
@ -730,9 +730,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||
|
||||
switch (ev_type) {
|
||||
case QUERY_EVENT:
|
||||
if (strncmp(((Query_log_event*)ev)->query, "BEGIN", 5) &&
|
||||
strncmp(((Query_log_event*)ev)->query, "COMMIT", 6) &&
|
||||
strncmp(((Query_log_event*)ev)->query, "ROLLBACK", 8) &&
|
||||
if (!((Query_log_event*)ev)->is_trans_keyword() &&
|
||||
shall_skip_database(((Query_log_event*)ev)->db))
|
||||
goto end;
|
||||
if (opt_base64_output_mode == BASE64_OUTPUT_ALWAYS)
|
||||
@ -832,7 +830,11 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||
print_event_info->common_header_len=
|
||||
glob_description_event->common_header_len;
|
||||
ev->print(result_file, print_event_info);
|
||||
ev->temp_buf= 0; // as the event ref is zeroed
|
||||
if (!remote_opt)
|
||||
ev->free_temp_buf(); // free memory allocated in dump_local_log_entries
|
||||
else
|
||||
// disassociate but not free dump_remote_log_entries time memory
|
||||
ev->temp_buf= 0;
|
||||
/*
|
||||
We don't want this event to be deleted now, so let's hide it (I
|
||||
(Guilhem) should later see if this triggers a non-serious Valgrind
|
||||
@ -1362,7 +1364,6 @@ static int parse_args(int *argc, char*** argv)
|
||||
int ho_error;
|
||||
|
||||
result_file = stdout;
|
||||
load_defaults("my",load_default_groups,argc,argv);
|
||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||
exit(ho_error);
|
||||
if (debug_info_flag)
|
||||
@ -2019,8 +2020,10 @@ int main(int argc, char** argv)
|
||||
|
||||
my_init_time(); // for time functions
|
||||
|
||||
if (load_defaults("my", load_default_groups, &argc, &argv))
|
||||
exit(1);
|
||||
defaults_argv= argv;
|
||||
parse_args(&argc, (char***)&argv);
|
||||
defaults_argv=argv;
|
||||
|
||||
if (!argc)
|
||||
{
|
||||
|
@ -1262,7 +1262,7 @@ void die(const char *fmt, ...)
|
||||
Help debugging by displaying any warnings that might have
|
||||
been produced prior to the error
|
||||
*/
|
||||
if (cur_con)
|
||||
if (cur_con && !cur_con->pending)
|
||||
show_warnings_before_error(&cur_con->mysql);
|
||||
|
||||
cleanup_and_exit(1);
|
||||
|
@ -12,7 +12,7 @@ dnl
|
||||
dnl When changing the major version number please also check the switch
|
||||
dnl statement in mysqlbinlog::check_master_version(). You may also need
|
||||
dnl to update version.c in ndb.
|
||||
AC_INIT([MySQL Server], [5.1.46], [], [mysql])
|
||||
AC_INIT([MySQL Server], [5.1.47], [], [mysql])
|
||||
|
||||
AC_CONFIG_SRCDIR([sql/mysqld.cc])
|
||||
AC_CANONICAL_SYSTEM
|
||||
|
@ -455,6 +455,13 @@ static void DbugParse(CODE_STATE *cs, const char *control)
|
||||
rel= control[0] == '+' || control[0] == '-';
|
||||
if ((!rel || (!stack->out_file && !stack->next)))
|
||||
{
|
||||
/*
|
||||
We need to free what's already in init_settings, because unlike
|
||||
the thread related stack frames there's a chance that something
|
||||
is in these variables already.
|
||||
*/
|
||||
if (stack == &init_settings)
|
||||
FreeState(cs, stack, 0);
|
||||
stack->flags= 0;
|
||||
stack->delay= 0;
|
||||
stack->maxdepth= 0;
|
||||
|
@ -751,7 +751,7 @@ typedef SOCKET_SIZE_TYPE size_socket;
|
||||
#endif
|
||||
#define MY_NFILE 64 /* This is only used to save filenames */
|
||||
#ifndef OS_FILE_LIMIT
|
||||
#define OS_FILE_LIMIT 65535
|
||||
#define OS_FILE_LIMIT UINT_MAX
|
||||
#endif
|
||||
|
||||
/* #define EXT_IN_LIBNAME */
|
||||
|
@ -950,7 +950,7 @@ extern my_bool resolve_charset(const char *cs_name,
|
||||
extern my_bool resolve_collation(const char *cl_name,
|
||||
CHARSET_INFO *default_cl,
|
||||
CHARSET_INFO **cl);
|
||||
|
||||
extern void free_charsets(void);
|
||||
extern char *get_charsets_dir(char *buf);
|
||||
extern my_bool my_charset_same(CHARSET_INFO *cs1, CHARSET_INFO *cs2);
|
||||
extern my_bool init_compiled_charsets(myf flags);
|
||||
|
@ -396,12 +396,12 @@ struct st_mysql_plugin
|
||||
int type; /* the plugin type (a MYSQL_XXX_PLUGIN value) */
|
||||
void *info; /* pointer to type-specific plugin descriptor */
|
||||
const char *name; /* plugin name */
|
||||
const char *author; /* plugin author (for SHOW PLUGINS) */
|
||||
const char *descr; /* general descriptive text (for SHOW PLUGINS ) */
|
||||
const char *author; /* plugin author (for I_S.PLUGINS) */
|
||||
const char *descr; /* general descriptive text (for I_S.PLUGINS) */
|
||||
int license; /* the plugin license (PLUGIN_LICENSE_XXX) */
|
||||
int (*init)(void *); /* the function to invoke when plugin is loaded */
|
||||
int (*deinit)(void *);/* the function to invoke when plugin is unloaded */
|
||||
unsigned int version; /* plugin version (for SHOW PLUGINS) */
|
||||
unsigned int version; /* plugin version (for I_S.PLUGINS) */
|
||||
struct st_mysql_show_var *status_vars;
|
||||
struct st_mysql_sys_var **system_vars;
|
||||
void * __reserved1; /* reserved for dependency checking */
|
||||
@ -801,30 +801,37 @@ void mysql_query_cache_invalidate4(MYSQL_THD thd,
|
||||
const char *key, unsigned int key_length,
|
||||
int using_trx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#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);
|
||||
}
|
||||
void *thd_get_ha_data(const MYSQL_THD thd, const struct handlerton *hton);
|
||||
|
||||
|
||||
/**
|
||||
Provide a handler data setter to simplify coding
|
||||
|
||||
@details
|
||||
Set ha_data pointer (storage engine per-connection information).
|
||||
|
||||
To avoid unclean deactivation (uninstall) of storage engine plugin
|
||||
in the middle of transaction, additional storage engine plugin
|
||||
lock is acquired.
|
||||
|
||||
If ha_data is not null and storage engine plugin was not locked
|
||||
by thd_set_ha_data() in this connection before, storage engine
|
||||
plugin gets locked.
|
||||
|
||||
If ha_data is null and storage engine plugin was locked by
|
||||
thd_set_ha_data() in this connection before, storage engine
|
||||
plugin lock gets released.
|
||||
|
||||
If handlerton::close_connection() didn't reset ha_data, server does
|
||||
it immediately after calling handlerton::close_connection().
|
||||
*/
|
||||
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;
|
||||
void thd_set_ha_data(MYSQL_THD thd, const struct handlerton *hton,
|
||||
const void *ha_data);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -137,3 +137,6 @@ void thd_get_xid(const void* thd, MYSQL_XID *xid);
|
||||
void mysql_query_cache_invalidate4(void* thd,
|
||||
const char *key, unsigned int key_length,
|
||||
int using_trx);
|
||||
void *thd_get_ha_data(const void* thd, const struct handlerton *hton);
|
||||
void thd_set_ha_data(void* thd, const struct handlerton *hton,
|
||||
const void *ha_data);
|
||||
|
@ -277,6 +277,16 @@ typedef struct st_net {
|
||||
/** Client library sqlstate buffer. Set along with the error message. */
|
||||
char sqlstate[SQLSTATE_LENGTH+1];
|
||||
void *extension;
|
||||
#if defined(MYSQL_SERVER) && !defined(EMBEDDED_LIBRARY)
|
||||
/*
|
||||
Controls whether a big packet should be skipped.
|
||||
|
||||
Initially set to FALSE by default. Unauthenticated sessions must have
|
||||
this set to FALSE so that the server can't be tricked to read packets
|
||||
indefinitely.
|
||||
*/
|
||||
my_bool skip_big_packet;
|
||||
#endif
|
||||
} NET;
|
||||
|
||||
|
||||
|
@ -211,6 +211,7 @@ void STDCALL mysql_server_end()
|
||||
}
|
||||
else
|
||||
{
|
||||
free_charsets();
|
||||
mysql_thread_end();
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,11 @@ TEST_DIRS = t r include std_data std_data/parts collections \
|
||||
suite/ndb suite/ndb/t suite/ndb/r \
|
||||
suite/rpl_ndb suite/rpl_ndb/t suite/rpl_ndb/r \
|
||||
suite/parts suite/parts/t suite/parts/r suite/parts/inc \
|
||||
suite/innodb suite/innodb/t suite/innodb/r suite/innodb/include
|
||||
suite/innodb suite/innodb/t suite/innodb/r suite/innodb/include \
|
||||
suite/engines suite/engines/funcs suite/engines/iuds suite/engines/rr_trx \
|
||||
suite/engines/funcs/r suite/engines/funcs/t suite/engines/iuds/r \
|
||||
suite/engines/iuds/t suite/engines/rr_trx/include suite/engines/rr_trx/r \
|
||||
suite/engines/rr_trx/t
|
||||
|
||||
# Used by dist-hook and install-data-local to copy all
|
||||
# test files into either dist or install directory
|
||||
@ -130,12 +134,12 @@ uninstall-local:
|
||||
# mtr - a shortcut for executing mysql-test-run.pl
|
||||
mtr:
|
||||
$(RM) -f mtr
|
||||
$(LN_S) $(srcdir)/mysql-test-run.pl mtr
|
||||
$(LN_S) mysql-test-run.pl mtr
|
||||
|
||||
# mysql-test-run - a shortcut for executing mysql-test-run.pl
|
||||
mysql-test-run:
|
||||
$(RM) -f mysql-test-run
|
||||
$(LN_S) $(srcdir)/mysql-test-run.pl mysql-test-run
|
||||
$(LN_S) mysql-test-run.pl mysql-test-run
|
||||
|
||||
# Don't update the files from bitkeeper
|
||||
%::SCCS/s.%
|
||||
|
@ -1 +1,7 @@
|
||||
perl mysql-test-run.pl --timer --force --comment=rpl_ndb_row --vardir=var-rpl_ndb_row --suite=rpl_ndb,ndb --mysqld=--binlog-format=row --experimental=collections/default.experimental
|
||||
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=embedded --vardir=var-emebbed --embedded --experimental=collections/default.experimental
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --suite=rpl,binlog --mysqld=--binlog-format=row --experimental=collections/default.experimental
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1 --experimental=collections/default.experimental
|
||||
|
@ -1,5 +1,5 @@
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=embedded --vardir=var-emebbed --embedded --experimental=collections/default.experimental
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --suite=rpl,binlog --mysqld=--binlog-format=row --experimental=collections/default.experimental
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1 --experimental=collections/default.experimental
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental --skip-ndb
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-ndb
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=embedded --vardir=var-emebbed --embedded --experimental=collections/default.experimental --skip-ndb
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --suite=rpl,binlog --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-ndb
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1 --experimental=collections/default.experimental --skip-ndb
|
||||
|
@ -214,7 +214,7 @@ CREATE TABLE t5 (a int, PRIMARY KEY (a)) ENGINE=InnoDB;
|
||||
|
||||
# execute
|
||||
--error ER_DUP_ENTRY
|
||||
UPDATE t3,t4 SET t3.a=t4.a + bug27417(1);
|
||||
UPDATE t3,t4 SET t3.a = t4.a + bug27417(1) where t3.a = 1;
|
||||
|
||||
# check
|
||||
select count(*) from t1 /* must be 1 */;
|
||||
|
@ -3,26 +3,53 @@
|
||||
# The common part of the "rpl_get_master_version_and_clock" test.
|
||||
# Restart slave under network disconnection between slave and master
|
||||
# following the steps:
|
||||
# 1 - Got DBUG_SYNC_POINT lock
|
||||
# 2 - Set DBUG_SYNC_POINT before call mysql_real_query(...) function in get_master_version_and_clock(...) function and hang here
|
||||
# 3 - shutdown master server for simulating network disconnection
|
||||
# 4 - Release DBUG_SYNC_POINT lock
|
||||
# 5 - Check if the slave I/O thread tries to reconnect to master.
|
||||
# 0 - Set DEBUG_SYNC_ACTION to wait
|
||||
# before call mysql_real_query(...) function in get_master_version_and_clock(...)
|
||||
# function and hang here
|
||||
# 1 - activate a sync-point through the $dbug_sync_point argument of the test
|
||||
# 2 - shutdown master server for simulating network disconnection
|
||||
# 3 - signal to the IO thread through $debug_sync_action to unhold from the sync-point
|
||||
# 4 - check if the slave I/O thread tries to reconnect to master.
|
||||
#
|
||||
# Note: Please make sure initialize the $debug_lock when call the test script.
|
||||
# Note: make sure to initialize the $debug_sync_action and $dbug_sync_point
|
||||
# before calling the test script.
|
||||
#
|
||||
# Pattern of usage:
|
||||
#
|
||||
# The caller test supplies the DBUG_EXECUTE_IF name
|
||||
#
|
||||
# let $dbug_sync_point = 'dbug_execute_if_name';
|
||||
#
|
||||
# as well as the action list for DEBUG_SYNC
|
||||
#
|
||||
# let $debug_sync_action= 'now signal signal_name';
|
||||
#
|
||||
# The $dbug_sync_point becomes the value of @@global.debug generating
|
||||
# a newly started IO-slave thread's session value.
|
||||
# Notice incremental operations to add and remove dbug_execute_if_name
|
||||
# from the global variable allows propagation more dbug arguments
|
||||
# out of mtr.
|
||||
# The action list is to fire at proper time according to test logics
|
||||
# (see pp 0-4 above).
|
||||
#
|
||||
|
||||
connection slave;
|
||||
if (`SELECT '$debug_lock' = ''`)
|
||||
if (`SELECT $debug_sync_action = ''`)
|
||||
{
|
||||
--die Cannot continue. Please set value for $debug_lock.
|
||||
--die Cannot continue. Please set value for debug_sync_action.
|
||||
}
|
||||
|
||||
# Restart slave
|
||||
--disable_warnings
|
||||
stop slave;
|
||||
source include/wait_for_slave_to_stop.inc;
|
||||
|
||||
eval SET @@global.debug= "+d,$dbug_sync_point";
|
||||
|
||||
start slave;
|
||||
source include/wait_for_slave_to_start.inc;
|
||||
--echo slave is going to hang in get_master_version_and_clock
|
||||
|
||||
connection master;
|
||||
# Write file to make mysql-test-run.pl expect the "crash", but don't start
|
||||
# it until it's told to
|
||||
@ -35,7 +62,9 @@ EOF
|
||||
shutdown_server 10;
|
||||
|
||||
connection slave;
|
||||
eval SELECT RELEASE_LOCK($debug_lock);
|
||||
--echo slave is unblocked
|
||||
|
||||
eval SET DEBUG_SYNC=$debug_sync_action;
|
||||
|
||||
# Show slave last IO errno
|
||||
connection slave;
|
||||
@ -53,6 +82,12 @@ if (`SELECT '$last_io_errno' = '2013' || # CR_SERVER_LOST
|
||||
--echo NETWORK ERROR
|
||||
}
|
||||
|
||||
# deactivate the sync point of get_master_version_and_clock()
|
||||
# now to avoid restarting IO-thread to re-enter it.
|
||||
# There will be a new IO thread forked out with its @@session.debug
|
||||
# unset.
|
||||
eval set @@global.debug = "-d,$dbug_sync_point";
|
||||
|
||||
# Write file to make mysql-test-run.pl start up the server again
|
||||
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
restart
|
||||
|
68
mysql-test/extra/rpl_tests/rpl_record_compare.test
Normal file
68
mysql-test/extra/rpl_tests/rpl_record_compare.test
Normal file
@ -0,0 +1,68 @@
|
||||
|
||||
#
|
||||
# BUG#52868: Wrong handling of NULL value during update, replication out of sync
|
||||
#
|
||||
-- echo ## case #1 - last_null_bit_pos==0 in record_compare without X bit
|
||||
|
||||
-- source include/master-slave-reset.inc
|
||||
-- connection master
|
||||
|
||||
-- eval CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bigint(20) DEFAULT 0, c3 bigint(20) DEFAULT 0, c4 varchar(1) DEFAULT '', c5 bigint(20) DEFAULT 0, c6 bigint(20) DEFAULT 0, c7 bigint(20) DEFAULT 0, c8 bigint(20) DEFAULT 0) ENGINE=$engine DEFAULT CHARSET=latin1
|
||||
|
||||
INSERT INTO t1 ( c5, c6 ) VALUES ( 1 , 35 );
|
||||
INSERT INTO t1 ( c5, c6 ) VALUES ( NULL, 35 );
|
||||
-- disable_warnings
|
||||
UPDATE t1 SET c5 = 'a';
|
||||
-- enable_warnings
|
||||
-- sync_slave_with_master
|
||||
|
||||
-- let $diff_table_1= master:test.t1
|
||||
-- let $diff_table_2= slave:test.t1
|
||||
-- source include/diff_tables.inc
|
||||
|
||||
--connection master
|
||||
DROP TABLE t1;
|
||||
-- sync_slave_with_master
|
||||
|
||||
-- echo ## case #1.1 - last_null_bit_pos==0 in record_compare with X bit
|
||||
-- echo ## (1 column less and no varchar)
|
||||
-- source include/master-slave-reset.inc
|
||||
-- connection master
|
||||
|
||||
-- eval CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bigint(20) DEFAULT 0, c3 bigint(20) DEFAULT 0, c4 bigint(20) DEFAULT 0, c5 bigint(20) DEFAULT 0, c6 bigint(20) DEFAULT 0, c7 bigint(20) DEFAULT 0) ENGINE=$engine DEFAULT CHARSET=latin1
|
||||
|
||||
INSERT INTO t1 ( c5, c6 ) VALUES ( 1 , 35 );
|
||||
INSERT INTO t1 ( c5, c6 ) VALUES ( NULL, 35 );
|
||||
-- disable_warnings
|
||||
UPDATE t1 SET c5 = 'a';
|
||||
-- enable_warnings
|
||||
-- sync_slave_with_master
|
||||
|
||||
-- let $diff_table_1= master:test.t1
|
||||
-- let $diff_table_2= slave:test.t1
|
||||
-- source include/diff_tables.inc
|
||||
|
||||
--connection master
|
||||
DROP TABLE t1;
|
||||
-- sync_slave_with_master
|
||||
|
||||
-- echo ## case #2 - X bit is wrongly set.
|
||||
|
||||
-- source include/master-slave-reset.inc
|
||||
-- connection master
|
||||
|
||||
-- eval CREATE TABLE t1 (c1 int, c2 varchar(1) default '') ENGINE=$engine DEFAULT CHARSET= latin1
|
||||
INSERT INTO t1(c1) VALUES (10);
|
||||
INSERT INTO t1(c1) VALUES (NULL);
|
||||
UPDATE t1 SET c1= 0;
|
||||
-- sync_slave_with_master
|
||||
|
||||
-- let $diff_table_1= master:test.t1
|
||||
-- let $diff_table_2= slave:test.t1
|
||||
-- source include/diff_tables.inc
|
||||
|
||||
-- connection master
|
||||
DROP TABLE t1;
|
||||
-- sync_slave_with_master
|
||||
|
||||
|
4
mysql-test/include/have_innodb_plugin.inc
Normal file
4
mysql-test/include/have_innodb_plugin.inc
Normal file
@ -0,0 +1,4 @@
|
||||
disable_query_log;
|
||||
--require r/true.require
|
||||
SELECT (plugin_library LIKE 'ha_innodb_plugin%') AS `TRUE` FROM information_schema.plugins WHERE LOWER(plugin_name) = 'innodb' AND LOWER(plugin_status) = 'active';
|
||||
enable_query_log;
|
51
mysql-test/include/min_null_cond.inc
Normal file
51
mysql-test/include/min_null_cond.inc
Normal file
@ -0,0 +1,51 @@
|
||||
--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a = NULL;
|
||||
SELECT MIN( a ) FROM t1 WHERE a = NULL;
|
||||
|
||||
--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a <> NULL;
|
||||
SELECT MIN( a ) FROM t1 WHERE a <> NULL;
|
||||
|
||||
--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a > NULL;
|
||||
SELECT MIN( a ) FROM t1 WHERE a > NULL;
|
||||
|
||||
--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a < NULL;
|
||||
SELECT MIN( a ) FROM t1 WHERE a < NULL;
|
||||
|
||||
if (!$skip_null_safe_test)
|
||||
{
|
||||
--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a <=> NULL;
|
||||
SELECT MIN( a ) FROM t1 WHERE a <=> NULL;
|
||||
}
|
||||
--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND 10;
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND 10;
|
||||
|
||||
--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND NULL;
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND NULL;
|
||||
|
||||
--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN 10 AND NULL;
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN 10 AND NULL;
|
||||
|
||||
--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
|
||||
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
|
||||
|
||||
--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a IS NULL;
|
||||
SELECT MIN( a ) FROM t1 WHERE a IS NULL;
|
@ -182,6 +182,8 @@ INSERT INTO global_suppressions VALUES
|
||||
("==[0-9]*== For more details"),
|
||||
/* This comes with innodb plugin tests */
|
||||
("==[0-9]*== Warning: set address range perms: large range"),
|
||||
/* valgrind-3.5.0 dumps this */
|
||||
("==[0-9]*== Command: "),
|
||||
|
||||
/* valgrind warnings: invalid file descriptor -1 in syscall
|
||||
write()/read(). Bug #50414 */
|
||||
|
@ -22,7 +22,7 @@ eval $test_insert;
|
||||
|
||||
connection slave;
|
||||
START SLAVE;
|
||||
wait_for_slave_to_stop;
|
||||
--source include/wait_for_slave_sql_to_stop.inc
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
|
||||
--query_vertical SHOW SLAVE STATUS
|
||||
|
25
mysql-test/include/view_alias.inc
Normal file
25
mysql-test/include/view_alias.inc
Normal file
@ -0,0 +1,25 @@
|
||||
# Routine to be called by t/view.inc
|
||||
#
|
||||
# The variable $after_select must be set before calling this routine.
|
||||
|
||||
eval CREATE VIEW v1 AS SELECT $after_select;
|
||||
SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1';
|
||||
#
|
||||
# Extract the VIEW's SELECT from INFORMATION_SCHEMA.VIEWS
|
||||
let $query1 = `SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1'`;
|
||||
#
|
||||
# Extract the VIEW's SELECT from SHOW CREATE VIEW
|
||||
# SHOW CREATE VIEW v1
|
||||
# View Create View character_set_client collation_connection
|
||||
# v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select '<--- .....
|
||||
let $value= query_get_value(SHOW CREATE VIEW v1, Create View, 1);
|
||||
let $query2 = `SELECT SUBSTR("$value",INSTR("$value",' as select ') + CHAR_LENGTH(' as '))`;
|
||||
DROP VIEW v1;
|
||||
|
||||
# Recreate the view based on SELECT from INFORMATION_SCHEMA.VIEWS
|
||||
eval CREATE VIEW v1 AS $query1;
|
||||
DROP VIEW v1;
|
||||
# Recreate the view based on SHOW CREATE VIEW
|
||||
eval CREATE VIEW v1 AS $query2;
|
||||
DROP VIEW v1;
|
||||
|
@ -70,11 +70,20 @@ my $skip_test_reg;
|
||||
|
||||
# Related to adding InnoDB plugin combinations
|
||||
my $lib_innodb_plugin;
|
||||
my $do_innodb_plugin;
|
||||
|
||||
# If "Quick collect", set to 1 once a test to run has been found.
|
||||
my $some_test_found;
|
||||
|
||||
sub find_innodb_plugin {
|
||||
$lib_innodb_plugin=
|
||||
my_find_file($::basedir,
|
||||
["storage/innodb_plugin", "storage/innodb_plugin/.libs",
|
||||
"lib/mysql/plugin", "lib/plugin"],
|
||||
["ha_innodb_plugin.dll", "ha_innodb_plugin.so",
|
||||
"ha_innodb_plugin.sl"],
|
||||
NOT_REQUIRED);
|
||||
}
|
||||
|
||||
sub init_pattern {
|
||||
my ($from, $what)= @_;
|
||||
return undef unless defined $from;
|
||||
@ -107,16 +116,7 @@ sub collect_test_cases ($$$) {
|
||||
$do_test_reg= init_pattern($do_test, "--do-test");
|
||||
$skip_test_reg= init_pattern($skip_test, "--skip-test");
|
||||
|
||||
$lib_innodb_plugin=
|
||||
my_find_file($::basedir,
|
||||
["storage/innodb_plugin", "storage/innodb_plugin/.libs",
|
||||
"lib/mysql/plugin", "lib/plugin"],
|
||||
["ha_innodb_plugin.dll", "ha_innodb_plugin.so",
|
||||
"ha_innodb_plugin.sl"],
|
||||
NOT_REQUIRED);
|
||||
$do_innodb_plugin= ($::mysql_version_id >= 50100 &&
|
||||
!(IS_WINDOWS && $::opt_embedded_server) &&
|
||||
$lib_innodb_plugin);
|
||||
&find_innodb_plugin;
|
||||
|
||||
# If not reordering, we also shouldn't group by suites, unless
|
||||
# no test cases were named.
|
||||
@ -504,70 +504,6 @@ sub collect_one_suite($)
|
||||
}
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Testing InnoDB plugin.
|
||||
# ----------------------------------------------------------------------
|
||||
if ($do_innodb_plugin)
|
||||
{
|
||||
my @new_cases;
|
||||
my $sep= (IS_WINDOWS) ? ';' : ':';
|
||||
|
||||
foreach my $test (@cases)
|
||||
{
|
||||
next if (!$test->{'innodb_test'});
|
||||
# If skipped due to no builtin innodb, we can still run it with plugin
|
||||
next if ($test->{'skip'} && $test->{comment} ne "No innodb support");
|
||||
# Exceptions
|
||||
next if ($test->{'name'} eq 'main.innodb'); # Failed with wrong errno (fk)
|
||||
next if ($test->{'name'} eq 'main.index_merge_innodb'); # Explain diff
|
||||
# innodb_file_per_table is rw with innodb_plugin
|
||||
next if ($test->{'name'} eq 'sys_vars.innodb_file_per_table_basic');
|
||||
# innodb_lock_wait_timeout is rw with innodb_plugin
|
||||
next if ($test->{'name'} eq 'sys_vars.innodb_lock_wait_timeout_basic');
|
||||
# Diff around innodb_thread_concurrency variable
|
||||
next if ($test->{'name'} eq 'sys_vars.innodb_thread_concurrency_basic');
|
||||
# Can't work with InnoPlug. Test framework needs to be re-designed.
|
||||
next if ($test->{'name'} eq 'main.innodb_bug46000');
|
||||
# Fails with innodb plugin
|
||||
next if ($test->{'name'} eq 'main.innodb-autoinc');
|
||||
# Fails with innodb plugin: r6185 Testcases changes not included
|
||||
next if ($test->{'name'} eq 'main.innodb_bug44369');
|
||||
# Copy test options
|
||||
my $new_test= My::Test->new();
|
||||
while (my ($key, $value) = each(%$test))
|
||||
{
|
||||
if (ref $value eq "ARRAY")
|
||||
{
|
||||
push(@{$new_test->{$key}}, @$value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$new_test->{$key}= $value unless ($key eq 'skip');
|
||||
}
|
||||
}
|
||||
my $plugin_filename= basename($lib_innodb_plugin);
|
||||
my $plugin_list= "innodb=$plugin_filename" . $sep . "innodb_locks=$plugin_filename";
|
||||
push(@{$new_test->{master_opt}}, '--ignore-builtin-innodb');
|
||||
push(@{$new_test->{master_opt}}, '--plugin-dir=' . dirname($lib_innodb_plugin));
|
||||
push(@{$new_test->{master_opt}}, "--plugin_load=$plugin_list");
|
||||
push(@{$new_test->{slave_opt}}, '--ignore-builtin-innodb');
|
||||
push(@{$new_test->{slave_opt}}, '--plugin-dir=' . dirname($lib_innodb_plugin));
|
||||
push(@{$new_test->{slave_opt}}, "--plugin_load=$plugin_list");
|
||||
if ($new_test->{combination})
|
||||
{
|
||||
$new_test->{combination}.= '+innodb_plugin';
|
||||
}
|
||||
else
|
||||
{
|
||||
$new_test->{combination}= 'innodb_plugin';
|
||||
}
|
||||
push(@new_cases, $new_test);
|
||||
}
|
||||
push(@cases, @new_cases);
|
||||
}
|
||||
# ----------------------------------------------------------------------
|
||||
# End of testing InnoDB plugin.
|
||||
# ----------------------------------------------------------------------
|
||||
optimize_cases(\@cases);
|
||||
#print_testcases(@cases);
|
||||
|
||||
@ -1002,11 +938,38 @@ sub collect_one_test_case {
|
||||
{
|
||||
# innodb is not supported, skip it
|
||||
$tinfo->{'skip'}= 1;
|
||||
# This comment is checked for running with innodb plugin (see above),
|
||||
# please keep that in mind if changing the text.
|
||||
$tinfo->{'comment'}= "No innodb support";
|
||||
# But continue processing if we may run it with innodb plugin
|
||||
return $tinfo unless $do_innodb_plugin;
|
||||
return $tinfo;
|
||||
}
|
||||
}
|
||||
elsif ( $tinfo->{'innodb_plugin_test'} )
|
||||
{
|
||||
# This is a test that needs the innodb plugin
|
||||
if (!&find_innodb_plugin)
|
||||
{
|
||||
# innodb plugin is not supported, skip it
|
||||
$tinfo->{'skip'}= 1;
|
||||
$tinfo->{'comment'}= "No innodb plugin support";
|
||||
return $tinfo;
|
||||
}
|
||||
|
||||
my $sep= (IS_WINDOWS) ? ';' : ':';
|
||||
my $plugin_filename= basename($lib_innodb_plugin);
|
||||
my $plugin_list=
|
||||
"innodb=$plugin_filename$sep" .
|
||||
"innodb_trx=$plugin_filename$sep" .
|
||||
"innodb_locks=$plugin_filename$sep" .
|
||||
"innodb_lock_waits=$plugin_filename$sep" .
|
||||
"innodb_cmp=$plugin_filename$sep" .
|
||||
"innodb_cmp_reset=$plugin_filename$sep" .
|
||||
"innodb_cmpmem=$plugin_filename$sep" .
|
||||
"innodb_cmpmem_reset=$plugin_filename";
|
||||
|
||||
foreach my $k ('master_opt', 'slave_opt')
|
||||
{
|
||||
push(@{$tinfo->{$k}}, '--ignore-builtin-innodb');
|
||||
push(@{$tinfo->{$k}}, '--plugin-dir=' . dirname($lib_innodb_plugin));
|
||||
push(@{$tinfo->{$k}}, "--plugin-load=$plugin_list");
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1134,6 +1097,7 @@ my @tags=
|
||||
["include/have_log_bin.inc", "need_binlog", 1],
|
||||
|
||||
["include/have_innodb.inc", "innodb_test", 1],
|
||||
["include/have_innodb_plugin.inc", "innodb_plugin_test", 1],
|
||||
["include/big_test.inc", "big_test", 1],
|
||||
["include/have_debug.inc", "need_debug", 1],
|
||||
["include/have_ndb.inc", "ndb_test", 1],
|
||||
|
@ -122,8 +122,8 @@ $opt_threads=1;
|
||||
$pid_file="mysql_stress_test.pid";
|
||||
$opt_mysqltest= ($^O =~ /mswin32/i) ? "mysqltest.exe" : "mysqltest";
|
||||
$opt_check_tests_file="";
|
||||
# OBM adding a setting for 'max-connect-retries=7' the default of 500 is to high
|
||||
@mysqltest_args=("--silent", "-v", "--skip-safemalloc", "--max-connect-retries=7");
|
||||
# OBM adding a setting for 'max-connect-retries=20' the default of 500 is to high
|
||||
@mysqltest_args=("--silent", "-v", "--skip-safemalloc", "--max-connect-retries=20");
|
||||
|
||||
# Client ip address
|
||||
$client_ip=inet_ntoa((gethostbyname(hostname()))[4]);
|
||||
@ -150,7 +150,12 @@ $client_ip=~ s/\.//g;
|
||||
|
||||
%error_strings = ( 'Failed in mysql_real_connect()' => S1,
|
||||
'Can\'t connect' => S1,
|
||||
'not found (Errcode: 2)' => S1 );
|
||||
'not found (Errcode: 2)' => S1,
|
||||
'does not exist' => S1,
|
||||
'Could not open connection \'default\' after \d+ attempts' => S1,
|
||||
'wrong errno ' => S3,
|
||||
'Result length mismatch' => S4,
|
||||
'Result content mismatch' => S4);
|
||||
|
||||
%error_codes = ( 1012 => S2, 1015 => S2, 1021 => S2,
|
||||
1027 => S2, 1037 => S2, 1038 => S2,
|
||||
|
@ -12737,3 +12737,22 @@ SELECT * FROM t1;
|
||||
ERROR HY000: Can't find file: 't1' (errno: 2)
|
||||
DROP TABLE t1;
|
||||
ERROR 42S02: Unknown table 't1'
|
||||
#
|
||||
# BUG#46565 - repair of partition fail for archive engine
|
||||
#
|
||||
# Installing corrupted table files for t1.
|
||||
SELECT * FROM t1;
|
||||
ERROR HY000: Table 't1' is marked as crashed and should be repaired
|
||||
REPAIR TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair error Corrupt
|
||||
SELECT * FROM t1;
|
||||
ERROR HY000: Table 't1' is marked as crashed and should be repaired
|
||||
REPAIR TABLE t1 EXTENDED;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair status OK
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
DROP TABLE t1;
|
||||
|
8
mysql-test/r/bug46261.result
Normal file
8
mysql-test/r/bug46261.result
Normal file
@ -0,0 +1,8 @@
|
||||
#
|
||||
# Bug#46261 Plugins can be installed with --skip-grant-tables
|
||||
#
|
||||
INSTALL PLUGIN example SONAME 'ha_example.so';
|
||||
ERROR HY000: The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
|
||||
UNINSTALL PLUGIN example;
|
||||
ERROR HY000: The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
|
||||
End of 5.1 tests
|
@ -88,7 +88,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,(select count(0) AS `COUNT(*)` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t2`.`a`) and (concat(`test`.`t1`.`b`,`test`.`t1`.`c`) = concat('0',`test`.`t2`.`a`,'01')))) AS `x` from `test`.`t2` order by `test`.`t2`.`a`
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,(select count(0) from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t2`.`a`) and (concat(`test`.`t1`.`b`,`test`.`t1`.`c`) = concat('0',`test`.`t2`.`a`,'01')))) AS `x` from `test`.`t2` order by `test`.`t2`.`a`
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (a TIMESTAMP);
|
||||
INSERT INTO t1 VALUES (NOW()),(NOW()),(NOW());
|
||||
|
@ -49,6 +49,15 @@ SELECT * FROM t1 WHERE LOWER(a)=LOWER('N');
|
||||
a
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#51976 LDML collations issue (cyrillic example)
|
||||
#
|
||||
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_test_ci);
|
||||
INSERT INTO t1 (a) VALUES ('Hello');
|
||||
SELECT a, UPPER(a), LOWER(a) FROM t1;
|
||||
a UPPER(a) LOWER(a)
|
||||
Hello HELLO hello
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#43827 Server closes connections and restarts
|
||||
#
|
||||
CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_test_ci);
|
||||
|
@ -1230,4 +1230,12 @@ SELECT HEX(DAYNAME(19700101));
|
||||
HEX(DAYNAME(19700101))
|
||||
0427043504420432043504400433
|
||||
SET character_set_connection=latin1;
|
||||
#
|
||||
# Bug#52120 create view cause Assertion failed: 0, file .\item_subselect.cc, line 817
|
||||
#
|
||||
CREATE TABLE t1 (a CHAR(1) CHARSET ascii, b CHAR(1) CHARSET latin1);
|
||||
CREATE VIEW v1 AS SELECT 1 from t1
|
||||
WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1'));
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
|
@ -349,4 +349,13 @@ END |
|
||||
DELETE IGNORE FROM t1;
|
||||
ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug #53450: Crash/assertion
|
||||
# "virtual int ha_myisam::index_first(uchar*)") at assert.c:81
|
||||
#
|
||||
CREATE TABLE t1 (a INT, b INT, c INT,
|
||||
INDEX(a), INDEX(b), INDEX(c));
|
||||
INSERT INTO t1 VALUES (1,2,3), (4,5,6), (7,8,9);
|
||||
DELETE FROM t1 WHERE a = 10 OR b = 20 ORDER BY c LIMIT 1;
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
@ -18,3 +18,26 @@ SELECT MAX(a) FROM t1 GROUP BY a,b;
|
||||
ERROR 23000: Can't write; duplicate key in table 'tmp_table'
|
||||
set tmp_table_size=default;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug #50946: fast index creation still seems to copy the table
|
||||
#
|
||||
CREATE TABLE t1 (a INT(100) NOT NULL);
|
||||
INSERT INTO t1 VALUES (1), (0), (2);
|
||||
SET SESSION debug='+d,alter_table_only_index_change';
|
||||
ALTER TABLE t1 ADD INDEX a(a);
|
||||
SET SESSION debug=DEFAULT;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(100) NOT NULL,
|
||||
KEY `a` (`a`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
0
|
||||
1
|
||||
2
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 5.1 tests
|
||||
#
|
||||
|
@ -82,5 +82,24 @@ DROP TABLE table_1;
|
||||
DROP TABLE table_2;
|
||||
DROP TABLE table_3;
|
||||
DROP TABLE table_4;
|
||||
|
||||
Bug #50087 Interval arithmetic for Event_queue_element is not portable.
|
||||
|
||||
CREATE TABLE t1(a int);
|
||||
CREATE EVENT e1 ON SCHEDULE EVERY 1 MONTH
|
||||
STARTS NOW() - INTERVAL 1 MONTH
|
||||
ENDS NOW() + INTERVAL 2 MONTH
|
||||
ON COMPLETION PRESERVE
|
||||
DO
|
||||
INSERT INTO t1 VALUES (1);
|
||||
CREATE EVENT e2 ON SCHEDULE EVERY 1 MONTH
|
||||
STARTS NOW()
|
||||
ENDS NOW() + INTERVAL 11 MONTH
|
||||
ON COMPLETION PRESERVE
|
||||
DO
|
||||
INSERT INTO t1 VALUES (1);
|
||||
DROP TABLE t1;
|
||||
DROP EVENT e1;
|
||||
DROP EVENT e2;
|
||||
DROP DATABASE events_test;
|
||||
SET GLOBAL event_scheduler=@event_scheduler;
|
||||
|
@ -168,6 +168,23 @@ WHERE t1.a = d1.a;
|
||||
ERROR 42S22: Unknown column 'd1.a' in 'where clause'
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#48295:
|
||||
# explain extended crash with subquery and ONLY_FULL_GROUP_BY sql_mode
|
||||
#
|
||||
CREATE TABLE t1 (f1 INT);
|
||||
SELECT @@session.sql_mode INTO @old_sql_mode;
|
||||
SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
|
||||
EXPLAIN EXTENDED SELECT 1 FROM t1
|
||||
WHERE f1 > ALL( SELECT t.f1 FROM t1,t1 AS t );
|
||||
ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1140 Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <not>(<exists>(...))
|
||||
SET SESSION sql_mode=@old_sql_mode;
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests.
|
||||
#
|
||||
# Bug#37870: Usage of uninitialized value caused failed assertion.
|
||||
#
|
||||
create table t1 (dt datetime not null, t time not null);
|
||||
@ -195,19 +212,30 @@ dt
|
||||
2001-01-01 01:01:01
|
||||
drop tables t1, t2;
|
||||
#
|
||||
# Bug#48295:
|
||||
# explain extended crash with subquery and ONLY_FULL_GROUP_BY sql_mode
|
||||
# Bug#47669: Query showed by EXPLAIN EXTENDED gives different result from original query
|
||||
#
|
||||
CREATE TABLE t1 (f1 INT);
|
||||
SELECT @@session.sql_mode INTO @old_sql_mode;
|
||||
SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
|
||||
EXPLAIN EXTENDED SELECT 1 FROM t1
|
||||
WHERE f1 > ALL( SELECT t.f1 FROM t1,t1 AS t );
|
||||
ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1140 Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <not>(<exists>(...))
|
||||
SET SESSION sql_mode=@old_sql_mode;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c int);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
CREATE TABLE t2 (d int);
|
||||
INSERT INTO t2 VALUES (NULL), (0);
|
||||
EXPLAIN EXTENDED SELECT (SELECT 1 FROM t2 WHERE d = c) FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.c' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select (select 1 from `test`.`t2` where (`test`.`t2`.`d` = NULL)) AS `(SELECT 1 FROM t2 WHERE d = c)` from `test`.`t1`
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# Bug #48419: another explain crash..
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE TABLE t2 (b BLOB, KEY b(b(100)));
|
||||
INSERT INTO t2 VALUES ('1'), ('2'), ('3');
|
||||
FLUSH TABLES;
|
||||
EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT 1 FROM t1 t JOIN t2 WHERE b <= 1 AND t.a);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
DROP TABLE t1, t2;
|
||||
End of 5.1 tests.
|
||||
|
@ -631,4 +631,17 @@ CREATE TABLE t1(a CHAR(1),FULLTEXT(a));
|
||||
SELECT 1 FROM t1 WHERE MATCH(a) AGAINST ('') AND ROW(a,a) > ROW(1,1);
|
||||
1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# BUG#51866 - crash with repair by sort and fulltext keys
|
||||
#
|
||||
CREATE TABLE t1(a CHAR(4), FULLTEXT(a));
|
||||
INSERT INTO t1 VALUES('aaaa');
|
||||
SET myisam_sort_buffer_size=4;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect myisam_sort_buffer_size value: '4'
|
||||
REPAIR TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair status OK
|
||||
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
@ -130,4 +130,22 @@ SELECT @query;
|
||||
@query
|
||||
abcde,0,1234
|
||||
DROP PROCEDURE p1;
|
||||
#
|
||||
# Bug #40625: Concat fails on DOUBLE values in a Stored Procedure,
|
||||
# while DECIMAL works
|
||||
#
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
DECLARE v1 DOUBLE(10,3);
|
||||
SET v1= 100;
|
||||
SET @s = CONCAT('########################################', 40 , v1);
|
||||
SELECT @s;
|
||||
END;//
|
||||
CALL p1();
|
||||
@s
|
||||
########################################40100.000
|
||||
CALL p1();
|
||||
@s
|
||||
########################################40100.000
|
||||
DROP PROCEDURE p1;
|
||||
# End of 5.1 tests
|
||||
|
@ -995,4 +995,19 @@ SELECT 1 FROM
|
||||
1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug #52397: another crash with explain extended and group_concat
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (0), (0);
|
||||
EXPLAIN EXTENDED SELECT 1 FROM
|
||||
(SELECT GROUP_CONCAT(t1.a ORDER BY t1.a ASC) FROM
|
||||
t1 t2, t1 GROUP BY t1.a) AS d;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 1 100.00
|
||||
2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using join buffer
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from (select group_concat(`test`.`t1`.`a` order by `test`.`t1`.`a` ASC separator ',') AS `GROUP_CONCAT(t1.a ORDER BY t1.a ASC)` from `test`.`t1` `t2` join `test`.`t1` group by `test`.`t1`.`a`) `d`
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
|
@ -1307,12 +1307,12 @@ explain extended select encode(f1,'zxcv') as 'enc' from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select encode('','zxcv') AS `enc` from `test`.`t1`
|
||||
Note 1003 select encode(NULL,'zxcv') AS `enc` from `test`.`t1`
|
||||
explain extended select decode(f1,'zxcv') as 'enc' from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select decode('','zxcv') AS `enc` from `test`.`t1`
|
||||
Note 1003 select decode(NULL,'zxcv') AS `enc` from `test`.`t1`
|
||||
drop table t1;
|
||||
create table t1 (a bigint not null)engine=myisam;
|
||||
insert into t1 set a = 1024*1024*1024*4;
|
||||
@ -2587,3 +2587,17 @@ FROM t2 WHERE t2.b = 1 GROUP BY t2.b;
|
||||
DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b LIMIT 1), t2.a)
|
||||
secret
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# Bug#52164 Assertion failed: param.sort_length, file .\filesort.cc, line 149
|
||||
#
|
||||
CREATE TABLE t1 (a LONGBLOB NOT NULL);
|
||||
INSERT INTO t1 VALUES (''),('');
|
||||
SELECT 1 FROM t1, t1 t2
|
||||
ORDER BY QUOTE(t1.a);
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
@ -1526,4 +1526,26 @@ SELECT 1 FROM t1 WHERE a >= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1
|
||||
1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug #51357: crash when using handler commands on spatial indexes
|
||||
#
|
||||
CREATE TABLE t1(a GEOMETRY NOT NULL,SPATIAL INDEX a(a));
|
||||
HANDLER t1 OPEN;
|
||||
HANDLER t1 READ a FIRST;
|
||||
a
|
||||
HANDLER t1 READ a NEXT;
|
||||
a
|
||||
HANDLER t1 READ a PREV;
|
||||
a
|
||||
HANDLER t1 READ a LAST;
|
||||
a
|
||||
HANDLER t1 CLOSE;
|
||||
HANDLER t1 OPEN;
|
||||
HANDLER t1 READ a FIRST;
|
||||
a
|
||||
INSERT INTO t1 VALUES (GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
|
||||
# should not crash
|
||||
HANDLER t1 READ a NEXT;
|
||||
HANDLER t1 CLOSE;
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests.
|
||||
|
@ -1413,3 +1413,19 @@ DROP USER 'user1';
|
||||
DROP USER 'user1'@'localhost';
|
||||
DROP USER 'user2';
|
||||
DROP DATABASE db1;
|
||||
CREATE DATABASE db1;
|
||||
CREATE DATABASE db2;
|
||||
GRANT SELECT ON db1.* to 'testbug'@localhost;
|
||||
USE db2;
|
||||
CREATE TABLE t1 (a INT);
|
||||
USE test;
|
||||
SELECT * FROM `../db2/tb2`;
|
||||
ERROR 42S02: Table 'db1.../db2/tb2' doesn't exist
|
||||
SELECT * FROM `../db2`.tb2;
|
||||
ERROR 42000: SELECT command denied to user 'testbug'@'localhost' for table 'tb2'
|
||||
SELECT * FROM `#mysql50#/../db2/tb2`;
|
||||
ERROR 42S02: Table 'db1.#mysql50#/../db2/tb2' doesn't exist
|
||||
DROP USER 'testbug'@localhost;
|
||||
DROP TABLE db2.t1;
|
||||
DROP DATABASE db1;
|
||||
DROP DATABASE db2;
|
||||
|
@ -1742,7 +1742,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select (select `test`.`t1`.`a` AS `a`) AS `aa`,count(distinct `test`.`t1`.`b`) AS `COUNT(DISTINCT b)` from `test`.`t1` group by ((select `test`.`t1`.`a` AS `a`) + 0)
|
||||
Note 1003 select (select `test`.`t1`.`a`) AS `aa`,count(distinct `test`.`t1`.`b`) AS `COUNT(DISTINCT b)` from `test`.`t1` group by ((select `test`.`t1`.`a`) + 0)
|
||||
EXPLAIN EXTENDED
|
||||
SELECT (SELECT t1.a) aa, COUNT(DISTINCT b) FROM t1 GROUP BY -aa;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
@ -1750,7 +1750,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select (select `test`.`t1`.`a` AS `a`) AS `aa`,count(distinct `test`.`t1`.`b`) AS `COUNT(DISTINCT b)` from `test`.`t1` group by -((select `test`.`t1`.`a` AS `a`))
|
||||
Note 1003 select (select `test`.`t1`.`a`) AS `aa`,count(distinct `test`.`t1`.`b`) AS `COUNT(DISTINCT b)` from `test`.`t1` group by -((select `test`.`t1`.`a`))
|
||||
# should return only one record
|
||||
SELECT (SELECT tt.a FROM t1 tt LIMIT 1) aa, COUNT(DISTINCT b) FROM t1
|
||||
GROUP BY aa;
|
||||
@ -1790,4 +1790,24 @@ aa b COUNT( b)
|
||||
1 10 1
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# Bug#52051: Aggregate functions incorrectly returns NULL from outer
|
||||
# join query
|
||||
#
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY);
|
||||
CREATE TABLE t2 (a INT PRIMARY KEY);
|
||||
INSERT INTO t2 VALUES (1), (2);
|
||||
EXPLAIN SELECT MIN(t2.a) FROM t2 LEFT JOIN t1 ON t2.a = t1.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
SELECT MIN(t2.a) FROM t2 LEFT JOIN t1 ON t2.a = t1.a;
|
||||
MIN(t2.a)
|
||||
1
|
||||
EXPLAIN SELECT MAX(t2.a) FROM t2 LEFT JOIN t1 ON t2.a = t1.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
SELECT MAX(t2.a) FROM t2 LEFT JOIN t1 ON t2.a = t1.a;
|
||||
MAX(t2.a)
|
||||
2
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# End of 5.1 tests
|
||||
|
@ -2537,4 +2537,234 @@ a
|
||||
1
|
||||
2
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#47762: Incorrect result from MIN() when WHERE tests NOT NULL column
|
||||
# for NULL
|
||||
#
|
||||
## Test for NULLs allowed
|
||||
CREATE TABLE t1 ( a INT, KEY (a) );
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a = NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a = NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a <> NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a <> NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a > NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a > NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a < NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a < NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a <=> NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x No matching min/max row
|
||||
SELECT MIN( a ) FROM t1 WHERE a <=> NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND 10;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN 10 AND NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN 10 AND NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
x x x x x x x x x Using where; Using index
|
||||
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a IS NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x No matching min/max row
|
||||
SELECT MIN( a ) FROM t1 WHERE a IS NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
INSERT INTO t1 VALUES (NULL), (NULL);
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a = NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a = NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a <> NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a <> NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a > NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a > NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a < NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a < NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a <=> NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Select tables optimized away
|
||||
SELECT MIN( a ) FROM t1 WHERE a <=> NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND 10;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN 10 AND NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN 10 AND NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
x x x x x x x x x Using where; Using index
|
||||
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a IS NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Select tables optimized away
|
||||
SELECT MIN( a ) FROM t1 WHERE a IS NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
DROP TABLE t1;
|
||||
## Test for NOT NULLs
|
||||
CREATE TABLE t1 ( a INT NOT NULL PRIMARY KEY);
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
#
|
||||
# NULL-safe operator test disabled for non-NULL indexed columns.
|
||||
#
|
||||
# See bugs
|
||||
#
|
||||
# - Bug#52173: Reading NULL value from non-NULL index gives
|
||||
# wrong result in embedded server
|
||||
#
|
||||
# - Bug#52174: Sometimes wrong plan when reading a MAX value from
|
||||
# non-NULL index
|
||||
#
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a = NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a = NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a <> NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a <> NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a > NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a > NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a < NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a < NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND 10;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN 10 AND NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN 10 AND NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
x x x x x x x x x Using where; Using index
|
||||
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a IS NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE
|
||||
SELECT MIN( a ) FROM t1 WHERE a IS NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
@ -756,4 +756,17 @@ TRUNCATE t1;
|
||||
HANDLER t1 READ FIRST;
|
||||
ERROR 42S02: Unknown table 't1' in HANDLER
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# BUG#51877 - HANDLER interface causes invalid memory read
|
||||
#
|
||||
CREATE TABLE t1(a INT, KEY(a));
|
||||
HANDLER t1 OPEN;
|
||||
HANDLER t1 READ a FIRST;
|
||||
a
|
||||
INSERT INTO t1 VALUES(1);
|
||||
HANDLER t1 READ a NEXT;
|
||||
a
|
||||
1
|
||||
HANDLER t1 CLOSE;
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
@ -12,7 +12,7 @@ explain extended select count(a) as b from t1 where a=0 having b >=0;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
Warnings:
|
||||
Note 1003 select count('0') AS `b` from `test`.`t1` where 0 having (`b` >= 0)
|
||||
Note 1003 select count(NULL) AS `b` from `test`.`t1` where 0 having (`b` >= 0)
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
raw_id int(10) NOT NULL default '0',
|
||||
@ -450,4 +450,83 @@ HAVING amount > 0
|
||||
ORDER BY t1.id1;
|
||||
id1 amount
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#48916 Server incorrectly processing HAVING clauses with an ORDER BY clause
|
||||
#
|
||||
CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT, f3 INT);
|
||||
INSERT INTO t1 VALUES (2,7,9), (4,7,9), (6,2,9), (17,0,9);
|
||||
SELECT table1.f1, table2.f2
|
||||
FROM t1 AS table1
|
||||
JOIN t1 AS table2 ON table1.f3 = table2.f3
|
||||
WHERE table2.f1 = 2
|
||||
GROUP BY table1.f1, table2.f2
|
||||
HAVING (table2.f2 = 8 AND table1.f1 >= 6);
|
||||
f1 f2
|
||||
EXPLAIN EXTENDED
|
||||
SELECT table1.f1, table2.f2
|
||||
FROM t1 AS table1
|
||||
JOIN t1 AS table2 ON table1.f3 = table2.f3
|
||||
WHERE table2.f1 = 2
|
||||
GROUP BY table1.f1, table2.f2
|
||||
HAVING (table2.f2 = 8 AND table1.f1 >= 6);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING noticed after reading const tables
|
||||
Warnings:
|
||||
Note 1003 select `test`.`table1`.`f1` AS `f1`,'7' AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where ((`test`.`table1`.`f3` = '9')) group by `test`.`table1`.`f1`,'7' having 0
|
||||
EXPLAIN EXTENDED
|
||||
SELECT table1.f1, table2.f2
|
||||
FROM t1 AS table1
|
||||
JOIN t1 AS table2 ON table1.f3 = table2.f3
|
||||
WHERE table2.f1 = 2
|
||||
GROUP BY table1.f1, table2.f2
|
||||
HAVING (table2.f2 = 8);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING noticed after reading const tables
|
||||
Warnings:
|
||||
Note 1003 select `test`.`table1`.`f1` AS `f1`,'7' AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where ((`test`.`table1`.`f3` = '9')) group by `test`.`table1`.`f1`,'7' having 0
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#52336 Segfault / crash in 5.1 copy_fields (param=0x9872980) at sql_select.cc:15355
|
||||
#
|
||||
CREATE TABLE t1(f1 INT, f2 INT);
|
||||
INSERT INTO t1 VALUES (10,8);
|
||||
CREATE TABLE t2 (f1 INT);
|
||||
INSERT INTO t2 VALUES (5);
|
||||
SELECT COUNT(f1) FROM t2
|
||||
HAVING (7, 9) IN (SELECT f1, MIN(f2) FROM t1);
|
||||
COUNT(f1)
|
||||
DROP TABLE t1, t2;
|
||||
CREATE TABLE t1 (f1 INT, f2 VARCHAR(1));
|
||||
INSERT INTO t1 VALUES (16,'f');
|
||||
INSERT INTO t1 VALUES (16,'f');
|
||||
CREATE TABLE t2 (f1 INT, f2 VARCHAR(1));
|
||||
INSERT INTO t2 VALUES (13,'f');
|
||||
INSERT INTO t2 VALUES (20,'f');
|
||||
CREATE TABLE t3 (f1 INT, f2 VARCHAR(1));
|
||||
INSERT INTO t3 VALUES (7,'f');
|
||||
SELECT t1.f2 FROM t1
|
||||
STRAIGHT_JOIN (t2 JOIN t3 ON t3.f2 = t2.f2 ) ON t3 .f2 = t2 .f2
|
||||
HAVING ('v', 'i') NOT IN (SELECT f2, MIN(f2) FROM t1)
|
||||
ORDER BY f2;
|
||||
f2
|
||||
f
|
||||
f
|
||||
f
|
||||
f
|
||||
DROP TABLES t1,t2,t3;
|
||||
#
|
||||
# Bug#52340 Segfault: read_cached_record (tab=0x94a2634) at sql_select.cc:14411
|
||||
#
|
||||
CREATE TABLE t1 (f1 INT, f2 VARCHAR(1));
|
||||
INSERT INTO t1 VALUES (16,'d');
|
||||
CREATE TABLE t2 (f1 INT, f2 VARCHAR(1));
|
||||
INSERT INTO t2 VALUES (13,'e');
|
||||
INSERT INTO t2 VALUES (20,'d');
|
||||
SELECT MAX(t2.f2) FROM t2 JOIN t1 ON t1.f2
|
||||
HAVING ('e' , 'd') IN
|
||||
(SELECT ts1.f2, ts2.f2 FROM t2 ts1 JOIN t2 ts2 ON ts1.f1)
|
||||
ORDER BY t1.f2;
|
||||
MAX(t2.f2)
|
||||
NULL
|
||||
DROP TABLE t1,t2;
|
||||
End of 5.0 tests
|
||||
|
@ -2295,4 +2295,117 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ref f1 f1 4 test.t1.f1 1 Using index
|
||||
drop table t1,t2;
|
||||
#
|
||||
#
|
||||
# Bug #39653: find_shortest_key in sql_select.cc does not consider
|
||||
# clustered primary keys
|
||||
#
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT, d INT, e INT, f INT,
|
||||
KEY (b,c)) ENGINE=INNODB;
|
||||
INSERT INTO t1 VALUES (1,1,1,1,1,1), (2,2,2,2,2,2), (3,3,3,3,3,3),
|
||||
(4,4,4,4,4,4), (5,5,5,5,5,5), (6,6,6,6,6,6),
|
||||
(7,7,7,7,7,7), (8,8,8,8,8,8), (9,9,9,9,9,9),
|
||||
(11,11,11,11,11,11);
|
||||
EXPLAIN SELECT COUNT(*) FROM t1;
|
||||
id 1
|
||||
select_type SIMPLE
|
||||
table t1
|
||||
type index
|
||||
possible_keys NULL
|
||||
key b
|
||||
key_len 10
|
||||
ref NULL
|
||||
rows 10
|
||||
Extra Using index
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug #49838: DROP INDEX and ADD UNIQUE INDEX for same index may
|
||||
# corrupt definition at engine
|
||||
#
|
||||
CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, KEY k (a,b))
|
||||
ENGINE=InnoDB;
|
||||
ALTER TABLE t1 DROP INDEX k, ADD UNIQUE INDEX k (a,b);
|
||||
SHOW INDEXES FROM t1;;
|
||||
Table t1
|
||||
Non_unique 0
|
||||
Key_name k
|
||||
Seq_in_index 1
|
||||
Column_name a
|
||||
Collation A
|
||||
Cardinality 0
|
||||
Sub_part NULL
|
||||
Packed NULL
|
||||
Null
|
||||
Index_type BTREE
|
||||
Comment
|
||||
Table t1
|
||||
Non_unique 0
|
||||
Key_name k
|
||||
Seq_in_index 2
|
||||
Column_name b
|
||||
Collation A
|
||||
Cardinality 0
|
||||
Sub_part NULL
|
||||
Packed NULL
|
||||
Null
|
||||
Index_type BTREE
|
||||
Comment
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug #47453: InnoDB incorrectly changes TIMESTAMP columns when
|
||||
# JOINed during an UPDATE
|
||||
#
|
||||
CREATE TABLE t1 (d INT) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (a INT, b INT,
|
||||
c TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
ON UPDATE CURRENT_TIMESTAMP) ENGINE=InnoDB;
|
||||
set up our data elements
|
||||
INSERT INTO t1 (d) VALUES (1);
|
||||
INSERT INTO t2 (a,b) VALUES (1,1);
|
||||
SELECT SECOND(c) INTO @bug47453 FROM t2;
|
||||
SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
|
||||
SECOND(c)-@bug47453
|
||||
0
|
||||
UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1;
|
||||
SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
|
||||
SECOND(c)-@bug47453
|
||||
0
|
||||
SELECT SLEEP(1);
|
||||
SLEEP(1)
|
||||
0
|
||||
UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1;
|
||||
#should be 0
|
||||
SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
|
||||
SECOND(c)-@bug47453
|
||||
0
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# Bug #53334: wrong result for outer join with impossible ON condition
|
||||
# (see the same test case for MyISAM in join.test)
|
||||
#
|
||||
CREATE TABLE t1 (id INT PRIMARY KEY);
|
||||
CREATE TABLE t2 (id INT);
|
||||
INSERT INTO t1 VALUES (75);
|
||||
INSERT INTO t1 VALUES (79);
|
||||
INSERT INTO t1 VALUES (78);
|
||||
INSERT INTO t1 VALUES (77);
|
||||
REPLACE INTO t1 VALUES (76);
|
||||
REPLACE INTO t1 VALUES (76);
|
||||
INSERT INTO t1 VALUES (104);
|
||||
INSERT INTO t1 VALUES (103);
|
||||
INSERT INTO t1 VALUES (102);
|
||||
INSERT INTO t1 VALUES (101);
|
||||
INSERT INTO t1 VALUES (105);
|
||||
INSERT INTO t1 VALUES (106);
|
||||
INSERT INTO t1 VALUES (107);
|
||||
INSERT INTO t2 VALUES (107),(75),(1000);
|
||||
SELECT t1.id,t2.id FROM t2 LEFT JOIN t1 ON t1.id>=74 AND t1.id<=0
|
||||
WHERE t2.id=75 AND t1.id IS NULL;
|
||||
id id
|
||||
NULL 75
|
||||
EXPLAIN SELECT t1.id,t2.id FROM t2 LEFT JOIN t1 ON t1.id>=74 AND t1.id<=0
|
||||
WHERE t2.id=75 AND t1.id IS NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 const PRIMARY NULL NULL NULL 1 Impossible ON condition
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
|
||||
DROP TABLE t1,t2;
|
||||
End of 5.1 tests
|
||||
|
@ -1117,6 +1117,45 @@ ON t4.a = t5.a
|
||||
ON t1.a = t3.a;
|
||||
a a a a a a
|
||||
DROP TABLE t1,t2,t3,t4,t5,t6;
|
||||
#
|
||||
# Bug#48483: crash in get_best_combination()
|
||||
#
|
||||
CREATE TABLE t1(f1 INT);
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
CREATE VIEW v1 AS SELECT 1 FROM t1 LEFT JOIN t1 AS t2 on 1=1;
|
||||
EXPLAIN EXTENDED
|
||||
SELECT 1 FROM v1 right join v1 AS v2 ON RAND();
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` left join `test`.`t1` `t2` on((1 = 1)) left join (`test`.`t1` left join `test`.`t1` `t2` on((1 = 1))) on(rand()) where 1
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#52177 crash with explain, row comparison, join, text field
|
||||
#
|
||||
CREATE TABLE t1 (a TINYINT, b TEXT, KEY (a));
|
||||
INSERT INTO t1 VALUES (0,''),(0,'');
|
||||
FLUSH TABLES;
|
||||
EXPLAIN SELECT 1 FROM t1 LEFT JOIN t1 a ON 1
|
||||
WHERE ROW(t1.a, 1111.11) = ROW(1111.11, 1111.11) AND
|
||||
ROW(t1.b, 1111.11) <=> ROW('','');
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug #50335: Assertion `!(order->used & map)' in eq_ref_table
|
||||
#
|
||||
CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, PRIMARY KEY (a,b));
|
||||
INSERT INTO t1 VALUES (0,0), (1,1);
|
||||
SELECT * FROM t1 STRAIGHT_JOIN t1 t2 ON t1.a=t2.a AND t1.a=t2.b ORDER BY t2.a, t1.a;
|
||||
a b a b
|
||||
0 0 0 0
|
||||
1 1 1 1
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests.
|
||||
CREATE TABLE t1 (f1 int);
|
||||
CREATE TABLE t2 (f1 int);
|
||||
@ -1145,14 +1184,4 @@ NULL
|
||||
NULL
|
||||
1
|
||||
DROP TABLE t1, t2, mm1;
|
||||
#
|
||||
# Bug #50335: Assertion `!(order->used & map)' in eq_ref_table
|
||||
#
|
||||
CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, PRIMARY KEY (a,b));
|
||||
INSERT INTO t1 VALUES (0,0), (1,1);
|
||||
SELECT * FROM t1 STRAIGHT_JOIN t1 t2 ON t1.a=t2.a AND t1.a=t2.b ORDER BY t2.a, t1.a;
|
||||
a b a b
|
||||
0 0 0 0
|
||||
1 1 1 1
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
@ -1289,3 +1289,53 @@ a COUNT( t2.b ) SUM( t2.b ) MAX( t2.b )
|
||||
1 3 6 3
|
||||
NULL 3 6 3
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# Bug#51598 Inconsistent behaviour with a COALESCE statement inside an IN comparison
|
||||
#
|
||||
CREATE TABLE t1(f1 INT, f2 INT, f3 INT);
|
||||
INSERT INTO t1 VALUES (1, NULL, 3);
|
||||
CREATE TABLE t2(f1 INT, f2 INT);
|
||||
INSERT INTO t2 VALUES (2, 1);
|
||||
EXPLAIN EXTENDED SELECT * FROM t1 LEFT JOIN t2 ON t1.f2 = t2.f2
|
||||
WHERE (COALESCE(t1.f1, t2.f1), f3) IN ((1, 3), (2, 2));
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
|
||||
1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00
|
||||
Warnings:
|
||||
Note 1003 select '1' AS `f1`,NULL AS `f2`,'3' AS `f3`,NULL AS `f1`,NULL AS `f2` from `test`.`t1` left join `test`.`t2` on(multiple equal(NULL)) where ((coalesce('1',NULL),'3') in ((1,3),(2,2)))
|
||||
SELECT * FROM t1 LEFT JOIN t2 ON t1.f2 = t2.f2
|
||||
WHERE (COALESCE(t1.f1, t2.f1), f3) IN ((1, 3), (2, 2));
|
||||
f1 f2 f3 f1 f2
|
||||
1 NULL 3 NULL NULL
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# Bug#52357: Assertion failed: join->best_read in greedy_search
|
||||
# optimizer_search_depth=0
|
||||
#
|
||||
CREATE TABLE t1( a INT );
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
SET optimizer_search_depth = 0;
|
||||
# Should not core dump on query preparation
|
||||
EXPLAIN
|
||||
SELECT 1
|
||||
FROM t1 tt3 LEFT OUTER JOIN t1 tt4 ON 1
|
||||
LEFT OUTER JOIN t1 tt5 ON 1
|
||||
LEFT OUTER JOIN t1 tt6 ON 1
|
||||
LEFT OUTER JOIN t1 tt7 ON 1
|
||||
LEFT OUTER JOIN t1 tt8 ON 1
|
||||
RIGHT OUTER JOIN t1 tt2 ON 1
|
||||
RIGHT OUTER JOIN t1 tt1 ON 1
|
||||
STRAIGHT_JOIN t1 tt9 ON 1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tt1 ALL NULL NULL NULL NULL 2
|
||||
1 SIMPLE tt2 ALL NULL NULL NULL NULL 2
|
||||
1 SIMPLE tt3 ALL NULL NULL NULL NULL 2
|
||||
1 SIMPLE tt4 ALL NULL NULL NULL NULL 2
|
||||
1 SIMPLE tt5 ALL NULL NULL NULL NULL 2
|
||||
1 SIMPLE tt6 ALL NULL NULL NULL NULL 2
|
||||
1 SIMPLE tt7 ALL NULL NULL NULL NULL 2
|
||||
1 SIMPLE tt8 ALL NULL NULL NULL NULL 2
|
||||
1 SIMPLE tt9 ALL NULL NULL NULL NULL 2 Using join buffer
|
||||
SET optimizer_search_depth = DEFAULT;
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
@ -202,12 +202,6 @@ select * from t1;
|
||||
a b c
|
||||
10 NULL Ten
|
||||
15 NULL Fifteen
|
||||
show variables like "secure_file_pri%";
|
||||
Variable_name Value
|
||||
secure_file_priv MYSQLTEST_VARDIR/
|
||||
select @@secure_file_priv;
|
||||
@@secure_file_priv
|
||||
MYSQLTEST_VARDIR/
|
||||
set @@secure_file_priv= 0;
|
||||
ERROR HY000: Variable 'secure_file_priv' is a read only variable
|
||||
truncate table t1;
|
||||
@ -456,6 +450,13 @@ LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt")
|
||||
|
||||
set session sql_mode=@OLD_SQL_MODE;
|
||||
DROP TABLE t1,t2;
|
||||
#
|
||||
# Bug #51893: crash with certain characters given to load_file
|
||||
# function on windows
|
||||
#
|
||||
select load_file(0x0A9FB76C661B409C4BEC88098C5DD71B1072F9691F2E827D7EC8F092B299868A3CE196C04F0FB18CAB4E1557EB72331D812379DE7A75CA21C32E7C722C59E5CC33EF262EF04187B0F0EE756FA984DF2EAD37B1E4ADB064C3C5038F2E3B2D661B1C1150AAEB5425512E14D7506166D92D4533872E662F4B2D1428AAB5CCA72E75AA2EF325E196A5A02E2E8278873C64375845994B0F39BE2FF7B478332A7B0AA5E48877C47B6F513E997848AF8CCB8A899F3393AB35333CF0871E36698193862D486B4B9078B70C0A0A507B8A250F3F876F5A067632D5E65193E4445A1EC3A2C9B4C6F07AC334F0F62BC33357CB502E9B1C19D2398B6972AEC2EF21630F8C9134C4F7DD662D8AD7BDC9E19C46720F334B66C22D4BF32ED275144E20E7669FFCF6FC143667C9F02A577F32960FA9F2371BE1FA90E49CBC69C01531F140556854D588DD0E55E1307D78CA38E975CD999F9AEA604266329EE62BFB5ADDA67F549E211ECFBA906C60063696352ABB82AA782D25B17E872EA587871F450446DB1BAE0123D20404A8F2D2698B371002E986C8FCB969A99FF0E150A2709E2ED7633D02ADA87D5B3C9487D27B2BD9D21E2EC3215DCC3CDCD884371281B95A2E9987AAF82EB499C058D9C3E7DC1B66635F60DB121C72F929622DD47B6B2E69F59FF2AE6B63CC2EC60FFBA20EA50569DBAB5DAEFAEB4F03966C9637AB55662EDD28439155A82D053A5299448EDB2E7BEB0F62889E2F84E6C7F34B3212C9AAC32D521D5AB8480993F1906D5450FAB342A0FA6ED223E178BAC036B81E15783604C32A961EA1EF20BE2EBB93D34ED37BC03142B7583303E4557E48551E4BD7CBDDEA146D5485A5D212C35189F0BD6497E66912D2780A59A53B532E12C0A5ED1EC0445D96E8F2DD825221CFE4A65A87AA21DC8750481B9849DD81694C3357A0ED9B78D608D8EDDE28FAFBEC17844DE5709F41E121838DB55639D77E32A259A416D7013B2EB1259FDE1B498CBB9CAEE1D601DF3C915EA91C69B44E6B72062F5F4B3C73F06F2D5AD185E1692E2E0A01E7DD5133693681C52EE13B2BE42D03BDCF48E4E133CF06662339B778E1C3034F9939A433E157449172F7969ACCE1F5D2F65A4E09E4A5D5611EBEDDDBDB0C0C0A);
|
||||
load_file(0x0A9FB76C661B409C4BEC88098C5DD71B1072F9691F2E827D7EC8F092B299868A3CE196C04F0FB18CAB4E1557EB72331D812379DE7A75CA21C32E7C722C59E5CC33EF262EF04187B0F0EE756FA984DF2EAD37B1E4ADB064C3C5038F2E3B2D661B1C1150AAEB5425512E14D7506166D92D4533872E662F4B2D142
|
||||
NULL
|
||||
End of 5.0 tests
|
||||
CREATE TABLE t1 (a int);
|
||||
INSERT INTO t1 VALUES (1);
|
||||
@ -484,4 +485,15 @@ SET character_set_filesystem=default;
|
||||
select @@character_set_filesystem;
|
||||
@@character_set_filesystem
|
||||
binary
|
||||
#
|
||||
# Bug #51850: crash/memory overlap when using load data infile and set
|
||||
# col equal to itself!
|
||||
#
|
||||
CREATE TABLE t1(col0 LONGBLOB);
|
||||
SELECT 'test' INTO OUTFILE 't1.txt';
|
||||
LOAD DATA INFILE 't1.txt' IGNORE INTO TABLE t1 SET col0=col0;
|
||||
SELECT * FROM t1;
|
||||
col0
|
||||
test
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
@ -308,8 +308,41 @@ SET @@global.general_log = @old_general_log;
|
||||
SET @@global.general_log_file = @old_general_log_file;
|
||||
SET @@global.slow_query_log = @old_slow_query_log;
|
||||
SET @@global.slow_query_log_file = @old_slow_query_log_file;
|
||||
#
|
||||
# Bug #49756 Rows_examined is always 0 in the slow query log
|
||||
# for update statements
|
||||
#
|
||||
SET @old_log_output = @@global.log_output;
|
||||
SET GLOBAL log_output = "TABLE";
|
||||
SET GLOBAL slow_query_log = ON;
|
||||
SET GLOBAL long_query_time = 0.001;
|
||||
TRUNCATE TABLE mysql.slow_log;
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE TABLE t2 (b INT, PRIMARY KEY (b));
|
||||
INSERT INTO t2 VALUES (3),(4);
|
||||
INSERT INTO t1 VALUES (1+sleep(.01)),(2);
|
||||
INSERT INTO t1 SELECT b+sleep(.01) from t2;
|
||||
UPDATE t1 SET a=a+sleep(.01) WHERE a>2;
|
||||
UPDATE t1 SET a=a+sleep(.01) ORDER BY a DESC;
|
||||
UPDATE t2 set b=b+sleep(.01) limit 1;
|
||||
UPDATE t1 SET a=a+sleep(.01) WHERE a in (SELECT b from t2);
|
||||
DELETE FROM t1 WHERE a=a+sleep(.01) ORDER BY a LIMIT 2;
|
||||
SELECT rows_examined,sql_text FROM mysql.slow_log;
|
||||
rows_examined sql_text
|
||||
0 INSERT INTO t1 VALUES (1+sleep(.01)),(2)
|
||||
2 INSERT INTO t1 SELECT b+sleep(.01) from t2
|
||||
4 UPDATE t1 SET a=a+sleep(.01) WHERE a>2
|
||||
8 UPDATE t1 SET a=a+sleep(.01) ORDER BY a DESC
|
||||
2 UPDATE t2 set b=b+sleep(.01) limit 1
|
||||
4 UPDATE t1 SET a=a+sleep(.01) WHERE a in (SELECT b from t2)
|
||||
6 DELETE FROM t1 WHERE a=a+sleep(.01) ORDER BY a LIMIT 2
|
||||
DROP TABLE t1,t2;
|
||||
TRUNCATE TABLE mysql.slow_log;
|
||||
# end of bug#49756
|
||||
End of 5.1 tests
|
||||
# Close connection con1
|
||||
SET GLOBAL long_query_time = DEFAULT;
|
||||
SET GLOBAL log_output = @old_log_output;
|
||||
SET global general_log = @old_general_log;
|
||||
SET global general_log_file = @old_general_log_file;
|
||||
SET global slow_query_log = @old_slow_query_log;
|
||||
|
47
mysql-test/r/log_tables_upgrade.result
Normal file
47
mysql-test/r/log_tables_upgrade.result
Normal file
@ -0,0 +1,47 @@
|
||||
#
|
||||
# Bug#49823: mysql_upgrade fatal error due to general_log / slow_low CSV NULL
|
||||
#
|
||||
USE test;
|
||||
SET @saved_general_log = @@GLOBAL.general_log;
|
||||
SET GLOBAL general_log = OFF;
|
||||
USE mysql;
|
||||
FLUSH TABLES;
|
||||
REPAIR TABLE test.bug49823;
|
||||
Table Op Msg_type Msg_text
|
||||
test.bug49823 repair status OK
|
||||
RENAME TABLE general_log TO renamed_general_log;
|
||||
RENAME TABLE test.bug49823 TO general_log;
|
||||
mtr.global_suppressions OK
|
||||
mtr.test_suppressions OK
|
||||
mysql.columns_priv OK
|
||||
mysql.db OK
|
||||
mysql.event OK
|
||||
mysql.func OK
|
||||
mysql.general_log
|
||||
Error : You can't use locks with log tables.
|
||||
status : OK
|
||||
mysql.help_category OK
|
||||
mysql.help_keyword OK
|
||||
mysql.help_relation OK
|
||||
mysql.help_topic OK
|
||||
mysql.host OK
|
||||
mysql.ndb_binlog_index OK
|
||||
mysql.plugin OK
|
||||
mysql.proc OK
|
||||
mysql.procs_priv OK
|
||||
mysql.renamed_general_log OK
|
||||
mysql.servers OK
|
||||
mysql.slow_log
|
||||
Error : You can't use locks with log tables.
|
||||
status : OK
|
||||
mysql.tables_priv OK
|
||||
mysql.time_zone OK
|
||||
mysql.time_zone_leap_second OK
|
||||
mysql.time_zone_name OK
|
||||
mysql.time_zone_transition OK
|
||||
mysql.time_zone_transition_type OK
|
||||
mysql.user OK
|
||||
DROP TABLE general_log;
|
||||
RENAME TABLE renamed_general_log TO general_log;
|
||||
SET GLOBAL general_log = @saved_general_log;
|
||||
USE test;
|
@ -2219,4 +2219,83 @@ Trigger sql_mode SQL Original Statement character_set_client collation_connectio
|
||||
tr1 CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER INSERT ON t3 FOR EACH ROW CALL foo() latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
DROP TRIGGER tr1;
|
||||
DROP TABLE t1, t2, t3;
|
||||
#
|
||||
# BUG#48265 - MRG_MYISAM problem (works in 5.0.85, does't work in 5.1.40)
|
||||
#
|
||||
CREATE DATABASE `test/1`;
|
||||
CREATE TABLE `test/1`.`t/1`(a INT);
|
||||
CREATE TABLE m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`);
|
||||
SELECT * FROM m1;
|
||||
a
|
||||
SHOW CREATE TABLE m1;
|
||||
Table Create Table
|
||||
m1 CREATE TABLE `m1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`test/1`.`t/1`)
|
||||
DROP TABLE m1;
|
||||
CREATE TABLE `test/1`.m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`);
|
||||
SELECT * FROM `test/1`.m1;
|
||||
a
|
||||
SHOW CREATE TABLE `test/1`.m1;
|
||||
Table Create Table
|
||||
m1 CREATE TABLE `m1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t/1`)
|
||||
DROP TABLE `test/1`.m1;
|
||||
DROP TABLE `test/1`.`t/1`;
|
||||
CREATE TEMPORARY TABLE `test/1`.`t/1`(a INT);
|
||||
CREATE TEMPORARY TABLE m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`);
|
||||
SELECT * FROM m1;
|
||||
a
|
||||
SHOW CREATE TABLE m1;
|
||||
Table Create Table
|
||||
m1 CREATE TEMPORARY TABLE `m1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`test/1`.`t/1`)
|
||||
DROP TABLE m1;
|
||||
CREATE TEMPORARY TABLE `test/1`.m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`);
|
||||
SELECT * FROM `test/1`.m1;
|
||||
a
|
||||
SHOW CREATE TABLE `test/1`.m1;
|
||||
Table Create Table
|
||||
m1 CREATE TEMPORARY TABLE `m1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t/1`)
|
||||
DROP TABLE `test/1`.m1;
|
||||
DROP TABLE `test/1`.`t/1`;
|
||||
DROP DATABASE `test/1`;
|
||||
CREATE TABLE `t@1`(a INT);
|
||||
SELECT * FROM m1;
|
||||
a
|
||||
SHOW CREATE TABLE m1;
|
||||
Table Create Table
|
||||
m1 CREATE TABLE `m1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t@1`)
|
||||
DROP TABLE `t@1`;
|
||||
CREATE DATABASE `test@1`;
|
||||
CREATE TABLE `test@1`.`t@1`(a INT);
|
||||
FLUSH TABLE m1;
|
||||
SELECT * FROM m1;
|
||||
a
|
||||
SHOW CREATE TABLE m1;
|
||||
Table Create Table
|
||||
m1 CREATE TABLE `m1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`test@1`.`t@1`)
|
||||
DROP TABLE m1;
|
||||
DROP TABLE `test@1`.`t@1`;
|
||||
DROP DATABASE `test@1`;
|
||||
#
|
||||
# Bug#51494c rash with join, explain and 'sounds like' operator
|
||||
#
|
||||
CREATE TABLE t1 (a INT) ENGINE=MYISAM;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
CREATE TABLE t2 (b INT NOT NULL,c INT,d INT,e BLOB NOT NULL,
|
||||
KEY idx0 (d, c)) ENGINE=MERGE;
|
||||
EXPLAIN SELECT * FROM t1 NATURAL RIGHT JOIN
|
||||
t2 WHERE b SOUNDS LIKE e AND d = 1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
DROP TABLE t2, t1;
|
||||
End of 5.1 tests
|
||||
|
@ -198,4 +198,15 @@ def IF(i, d, d) IF(i, d, d) 10 10 10 Y 128 0 63
|
||||
def IFNULL(d, d) IFNULL(d, d) 10 10 10 Y 128 0 63
|
||||
def LEAST(d, d) LEAST(d, d) 10 10 10 Y 128 0 63
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#41788 mysql_fetch_field returns org_table == table by a view
|
||||
#
|
||||
CREATE TABLE t1 (f1 INT);
|
||||
CREATE VIEW v1 AS SELECT f1 FROM t1;
|
||||
SELECT f1 FROM v1 va;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def test v1 va f1 f1 3 11 0 Y 32768 0 63
|
||||
f1
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
|
@ -2313,6 +2313,8 @@ INSERT INTO t1 SELECT a+1280,b FROM t1;
|
||||
INSERT INTO t1 SELECT a+2560,b FROM t1;
|
||||
INSERT INTO t1 SELECT a+5120,b FROM t1;
|
||||
SET myisam_sort_buffer_size=4;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect myisam_sort_buffer_size value: '4'
|
||||
REPAIR TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair error myisam_sort_buffer_size is too small
|
||||
@ -2339,4 +2341,75 @@ CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#51304: checksum table gives different results
|
||||
# for same data when using bit fields
|
||||
#
|
||||
CREATE TABLE t1(a INT, b BIT(1));
|
||||
INSERT INTO t1 VALUES(1, 0), (2, 1);
|
||||
CREATE TABLE t2 SELECT * FROM t1;
|
||||
CHECKSUM TABLE t1 EXTENDED;
|
||||
Table Checksum
|
||||
test.t1 3775188275
|
||||
CHECKSUM TABLE t2 EXTENDED;
|
||||
Table Checksum
|
||||
test.t2 3775188275
|
||||
CHECKSUM TABLE t3 EXTENDED;
|
||||
Table Checksum
|
||||
test.t3 3775188275
|
||||
DROP TABLE t1, t2, t3;
|
||||
#
|
||||
# BUG#51307 - widespread corruption with partitions and insert...select
|
||||
#
|
||||
CREATE TABLE t1(a CHAR(255), KEY(a));
|
||||
SELECT * FROM t1, t1 AS a1;
|
||||
a a
|
||||
SET myisam_sort_buffer_size=4;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect myisam_sort_buffer_size value: '4'
|
||||
INSERT INTO t1 VALUES
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0');
|
||||
Warnings:
|
||||
Error 1034 myisam_sort_buffer_size is too small
|
||||
Error 1034 Number of rows changed from 0 to 157
|
||||
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
|
||||
INSERT INTO t1 VALUES('1');
|
||||
SELECT * FROM t1, t1 AS a1 WHERE t1.a=1 AND a1.a=1;
|
||||
a a
|
||||
1 1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# BUG#47444 - --myisam_repair_threads>1can result in all index
|
||||
# cardinalities=1
|
||||
#
|
||||
SET myisam_repair_threads=2;
|
||||
SET myisam_sort_buffer_size=4096;
|
||||
CREATE TABLE t1(a CHAR(255), KEY(a), KEY(a), KEY(a));
|
||||
INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(0),(1),(2),(3);
|
||||
REPAIR TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair status OK
|
||||
SELECT CARDINALITY FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
|
||||
CARDINALITY
|
||||
14
|
||||
14
|
||||
14
|
||||
DROP TABLE t1;
|
||||
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
|
||||
SET myisam_repair_threads=@@global.myisam_repair_threads;
|
||||
End of 5.1 tests
|
||||
|
@ -479,7 +479,7 @@ FLUSH LOGS;
|
||||
RESET MASTER;
|
||||
FLUSH LOGS;
|
||||
#
|
||||
# Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified is exist
|
||||
# Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified exists
|
||||
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
||||
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
||||
DELIMITER /*!*/;
|
||||
@ -532,7 +532,7 @@ DELIMITER ;
|
||||
ROLLBACK /* added by mysqlbinlog */;
|
||||
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
||||
#
|
||||
# Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified is not exist
|
||||
# Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified does not exist
|
||||
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
||||
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
||||
DELIMITER /*!*/;
|
||||
@ -565,5 +565,76 @@ DELIMITER ;
|
||||
# End of log file
|
||||
ROLLBACK /* added by mysqlbinlog */;
|
||||
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
||||
#
|
||||
# Test if the 'SAVEPOINT', 'ROLLBACK TO' are output if the database specified exists
|
||||
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
||||
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
||||
DELIMITER /*!*/;
|
||||
SET TIMESTAMP=1266652094/*!*/;
|
||||
SET @@session.pseudo_thread_id=999999999/*!*/;
|
||||
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
|
||||
SET @@session.sql_mode=0/*!*/;
|
||||
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
|
||||
/*!\C latin1 *//*!*/;
|
||||
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
||||
SET @@session.lc_time_names=0/*!*/;
|
||||
SET @@session.collation_database=DEFAULT/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
use test/*!*/;
|
||||
SET TIMESTAMP=1266652094/*!*/;
|
||||
SavePoint mixed_cases
|
||||
/*!*/;
|
||||
use db1/*!*/;
|
||||
SET TIMESTAMP=1266652094/*!*/;
|
||||
INSERT INTO db1.t2 VALUES("in savepoint mixed_cases")
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1266652094/*!*/;
|
||||
INSERT INTO db1.t1 VALUES(40)
|
||||
/*!*/;
|
||||
use test/*!*/;
|
||||
SET TIMESTAMP=1266652094/*!*/;
|
||||
ROLLBACK TO mixed_cases
|
||||
/*!*/;
|
||||
use db1/*!*/;
|
||||
SET TIMESTAMP=1266652094/*!*/;
|
||||
INSERT INTO db1.t2 VALUES("after rollback to")
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1266652094/*!*/;
|
||||
INSERT INTO db1.t1 VALUES(50)
|
||||
/*!*/;
|
||||
COMMIT/*!*/;
|
||||
DELIMITER ;
|
||||
# End of log file
|
||||
ROLLBACK /* added by mysqlbinlog */;
|
||||
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
||||
#
|
||||
# Test if the 'SAVEPOINT', 'ROLLBACK TO' are output if the database specified does not exist
|
||||
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
||||
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
||||
DELIMITER /*!*/;
|
||||
SET TIMESTAMP=1266652094/*!*/;
|
||||
SET @@session.pseudo_thread_id=999999999/*!*/;
|
||||
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
|
||||
SET @@session.sql_mode=0/*!*/;
|
||||
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
|
||||
/*!\C latin1 *//*!*/;
|
||||
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
||||
SET @@session.lc_time_names=0/*!*/;
|
||||
SET @@session.collation_database=DEFAULT/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
use test/*!*/;
|
||||
SET TIMESTAMP=1266652094/*!*/;
|
||||
SavePoint mixed_cases
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1266652094/*!*/;
|
||||
ROLLBACK TO mixed_cases
|
||||
/*!*/;
|
||||
COMMIT/*!*/;
|
||||
DELIMITER ;
|
||||
# End of log file
|
||||
ROLLBACK /* added by mysqlbinlog */;
|
||||
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
||||
End of 5.0 tests
|
||||
End of 5.1 tests
|
||||
|
@ -2365,7 +2365,7 @@ BEGIN
|
||||
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
|
||||
### INSERT INTO test.t1
|
||||
### SET
|
||||
### @1=b'00000000' /* BIT(8) meta=256 nullable=1 is_null=0 */
|
||||
### @1=b'0' /* BIT(1) meta=1 nullable=1 is_null=0 */
|
||||
### @2=b'0000000000000000000000000000000000000000000000000000000000000000' /* BIT(64) meta=2048 nullable=1 is_null=0 */
|
||||
### @3=-128 (128) /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
@ -2458,7 +2458,7 @@ BEGIN
|
||||
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
|
||||
### INSERT INTO test.t1
|
||||
### SET
|
||||
### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
|
||||
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
|
||||
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
|
||||
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
### @4=-1 (255) /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
@ -2553,7 +2553,7 @@ BEGIN
|
||||
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
|
||||
### INSERT INTO test.t1
|
||||
### SET
|
||||
### @1=NULL /* type=16 meta=256 nullable=1 is_null=1 */
|
||||
### @1=NULL /* type=16 meta=1 nullable=1 is_null=1 */
|
||||
### @2=NULL /* type=16 meta=2048 nullable=1 is_null=1 */
|
||||
### @3=NULL /* type=1 meta=0 nullable=1 is_null=1 */
|
||||
### @4=NULL /* type=1 meta=0 nullable=1 is_null=1 */
|
||||
@ -2634,7 +2634,7 @@ BEGIN
|
||||
### @79=3 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### INSERT INTO test.t1
|
||||
### SET
|
||||
### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
|
||||
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
|
||||
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
|
||||
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
@ -2727,7 +2727,7 @@ BEGIN
|
||||
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
|
||||
### UPDATE test.t1
|
||||
### WHERE
|
||||
### @1=b'00000000' /* BIT(8) meta=256 nullable=1 is_null=0 */
|
||||
### @1=b'0' /* BIT(1) meta=1 nullable=1 is_null=0 */
|
||||
### @2=b'0000000000000000000000000000000000000000000000000000000000000000' /* BIT(64) meta=2048 nullable=1 is_null=0 */
|
||||
### @3=-128 (128) /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
@ -2807,7 +2807,7 @@ BEGIN
|
||||
### @78=b'00000000' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */
|
||||
### @79=1 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
|
||||
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
|
||||
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
|
||||
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
### @4=-1 (255) /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
@ -2900,7 +2900,7 @@ BEGIN
|
||||
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
|
||||
### UPDATE test.t1
|
||||
### WHERE
|
||||
### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
|
||||
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
|
||||
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
|
||||
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
### @4=-1 (255) /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
@ -2980,7 +2980,7 @@ BEGIN
|
||||
### @78=b'00000111' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */
|
||||
### @79=2 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=b'00000000' /* BIT(8) meta=256 nullable=1 is_null=0 */
|
||||
### @1=b'0' /* BIT(1) meta=1 nullable=1 is_null=0 */
|
||||
### @2=b'0000000000000000000000000000000000000000000000000000000000000000' /* BIT(64) meta=2048 nullable=1 is_null=0 */
|
||||
### @3=-128 (128) /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
@ -3073,7 +3073,7 @@ BEGIN
|
||||
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
|
||||
### UPDATE test.t1
|
||||
### WHERE
|
||||
### @1=NULL /* type=16 meta=256 nullable=1 is_null=1 */
|
||||
### @1=NULL /* type=16 meta=1 nullable=1 is_null=1 */
|
||||
### @2=NULL /* type=16 meta=2048 nullable=1 is_null=1 */
|
||||
### @3=NULL /* type=1 meta=0 nullable=1 is_null=1 */
|
||||
### @4=NULL /* type=1 meta=0 nullable=1 is_null=1 */
|
||||
@ -3153,7 +3153,7 @@ BEGIN
|
||||
### @78=NULL /* TIMESTAMP meta=63489 nullable=1 is_null=1 */
|
||||
### @79=3 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
|
||||
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
|
||||
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
|
||||
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
@ -3246,7 +3246,7 @@ BEGIN
|
||||
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
|
||||
### UPDATE test.t1
|
||||
### WHERE
|
||||
### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
|
||||
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
|
||||
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
|
||||
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
@ -3326,7 +3326,7 @@ BEGIN
|
||||
### @78=b'00000110' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */
|
||||
### @79=4 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=NULL /* type=16 meta=256 nullable=1 is_null=1 */
|
||||
### @1=NULL /* type=16 meta=1 nullable=1 is_null=1 */
|
||||
### @2=NULL /* type=16 meta=2048 nullable=1 is_null=1 */
|
||||
### @3=NULL /* type=1 meta=0 nullable=1 is_null=1 */
|
||||
### @4=NULL /* type=1 meta=0 nullable=1 is_null=1 */
|
||||
@ -3419,7 +3419,7 @@ BEGIN
|
||||
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
|
||||
### DELETE FROM test.t1
|
||||
### WHERE
|
||||
### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
|
||||
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
|
||||
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
|
||||
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
### @4=-1 (255) /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
@ -3512,7 +3512,7 @@ BEGIN
|
||||
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
|
||||
### DELETE FROM test.t1
|
||||
### WHERE
|
||||
### @1=b'00000000' /* BIT(8) meta=256 nullable=1 is_null=0 */
|
||||
### @1=b'0' /* BIT(1) meta=1 nullable=1 is_null=0 */
|
||||
### @2=b'0000000000000000000000000000000000000000000000000000000000000000' /* BIT(64) meta=2048 nullable=1 is_null=0 */
|
||||
### @3=-128 (128) /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
@ -3605,7 +3605,7 @@ BEGIN
|
||||
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
|
||||
### DELETE FROM test.t1
|
||||
### WHERE
|
||||
### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
|
||||
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
|
||||
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
|
||||
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
@ -3698,7 +3698,7 @@ BEGIN
|
||||
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
|
||||
### DELETE FROM test.t1
|
||||
### WHERE
|
||||
### @1=NULL /* type=16 meta=256 nullable=1 is_null=1 */
|
||||
### @1=NULL /* type=16 meta=1 nullable=1 is_null=1 */
|
||||
### @2=NULL /* type=16 meta=2048 nullable=1 is_null=1 */
|
||||
### @3=NULL /* type=1 meta=0 nullable=1 is_null=1 */
|
||||
### @4=NULL /* type=1 meta=0 nullable=1 is_null=1 */
|
||||
|
@ -4561,5 +4561,20 @@ a b c
|
||||
SET NAMES default;
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# Bug #53088: mysqldump with -T & --default-character-set set
|
||||
# truncates text/blob to 766 chars
|
||||
#
|
||||
# Also see outfile_loaddata.test
|
||||
#
|
||||
CREATE TABLE t1 (a BLOB) CHARSET latin1;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
INSERT INTO t1 VALUES (REPEAT('.', 800));
|
||||
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET latin1;
|
||||
# should be 800
|
||||
SELECT LENGTH(a) FROM t2;
|
||||
LENGTH(a)
|
||||
800
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# End of 5.1 tests
|
||||
#
|
||||
|
@ -239,4 +239,24 @@ a b c
|
||||
2 NULL NULL
|
||||
SET NAMES default;
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# Bug #53088: mysqldump with -T & --default-character-set set
|
||||
# truncates text/blob to 766 chars
|
||||
#
|
||||
# Also see mysqldump.test
|
||||
#
|
||||
CREATE TABLE t1 (a BLOB) CHARSET latin1;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
INSERT INTO t1 VALUES (REPEAT('.', 800));
|
||||
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug53088.txt' CHARACTER SET latin1 FROM t1;
|
||||
# should be greater than 800
|
||||
SELECT LENGTH(LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug53088.txt'));
|
||||
LENGTH(LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug53088.txt'))
|
||||
801
|
||||
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug53088.txt' INTO TABLE t2;
|
||||
# should be 800
|
||||
SELECT LENGTH(a) FROM t2;
|
||||
LENGTH(a)
|
||||
800
|
||||
DROP TABLE t1, t2;
|
||||
# End of 5.1 tests.
|
||||
|
@ -2088,4 +2088,15 @@ SELECT 1 FROM t1 JOIN t1 AS t2 USING (a) FOR UPDATE;
|
||||
1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# BUG#51868 - crash with myisam_use_mmap and partitioned myisam tables
|
||||
#
|
||||
SET GLOBAL myisam_use_mmap=1;
|
||||
CREATE TABLE t1(a INT) PARTITION BY HASH(a) PARTITIONS 1;
|
||||
INSERT INTO t1 VALUES(0);
|
||||
FLUSH TABLE t1;
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 VALUES(0);
|
||||
DROP TABLE t1;
|
||||
SET GLOBAL myisam_use_mmap=default;
|
||||
End of 5.1 tests
|
||||
|
@ -1,4 +1,46 @@
|
||||
drop table if exists t1;
|
||||
#
|
||||
# Bug#50392: insert_id is not reset for partitioned tables
|
||||
# auto_increment on duplicate entry
|
||||
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY);
|
||||
SET INSERT_ID= 13;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SET INSERT_ID= 12;
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
ERROR 23000: Duplicate entry '13' for key 'PRIMARY'
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
12
|
||||
13
|
||||
14
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) PARTITION BY KEY(a);
|
||||
SET INSERT_ID= 13;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SET INSERT_ID= 12;
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
ERROR 23000: Duplicate entry '13' for key 'PRIMARY'
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1
|
||||
/*!50100 PARTITION BY KEY (a) */
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
12
|
||||
13
|
||||
14
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INTEGER NOT NULL, PRIMARY KEY (a));
|
||||
INSERT INTO t1 VALUES (1),(1);
|
||||
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
|
@ -1,4 +1,73 @@
|
||||
drop table if exists t1;
|
||||
drop table if exists t1, t2;
|
||||
#
|
||||
# Bug#51830: Incorrect partition pruning on range partition (regression)
|
||||
#
|
||||
CREATE TABLE t1 (a INT NOT NULL)
|
||||
ENGINE = InnoDB
|
||||
PARTITION BY RANGE(a)
|
||||
(PARTITION p10 VALUES LESS THAN (10),
|
||||
PARTITION p30 VALUES LESS THAN (30),
|
||||
PARTITION p50 VALUES LESS THAN (50),
|
||||
PARTITION p70 VALUES LESS THAN (70),
|
||||
PARTITION p90 VALUES LESS THAN (90));
|
||||
INSERT INTO t1 VALUES (10),(30),(50);
|
||||
INSERT INTO t1 VALUES (70);
|
||||
INSERT INTO t1 VALUES (80);
|
||||
INSERT INTO t1 VALUES (89);
|
||||
INSERT INTO t1 VALUES (90);
|
||||
ERROR HY000: Table has no partition for value 90
|
||||
INSERT INTO t1 VALUES (100);
|
||||
ERROR HY000: Table has no partition for value 100
|
||||
insert INTO t1 VALUES (110);
|
||||
ERROR HY000: Table has no partition for value 110
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p90 ALL NULL NULL NULL NULL 7 Using where
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p90 ALL NULL NULL NULL NULL 7 Using where
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 100;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 100;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 100;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#50104: Partitioned table with just 1 partion works with fk
|
||||
#
|
||||
CREATE TABLE t2 (
|
||||
id INT,
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE=InnoDB ;
|
||||
CREATE TABLE t1 (
|
||||
id INT NOT NULL AUTO_INCREMENT,
|
||||
parent_id INT DEFAULT NULL,
|
||||
PRIMARY KEY (id),
|
||||
KEY parent_id (parent_id)
|
||||
) ENGINE=InnoDB;
|
||||
ALTER TABLE t1 PARTITION BY HASH (id) PARTITIONS 1;
|
||||
ALTER TABLE t1 ADD CONSTRAINT test_ibfk_1 FOREIGN KEY (parent_id) REFERENCES t2 (id);
|
||||
ERROR HY000: Foreign key clause is not yet supported in conjunction with partitioning
|
||||
ALTER TABLE t1 PARTITION BY HASH (id) PARTITIONS 2;
|
||||
ALTER TABLE t1 ADD CONSTRAINT test_ibfk_1 FOREIGN KEY (parent_id) REFERENCES t2 (id);
|
||||
ERROR HY000: Foreign key clause is not yet supported in conjunction with partitioning
|
||||
DROP TABLE t1, t2;
|
||||
create table t1 (a int not null,
|
||||
b datetime not null,
|
||||
primary key (a,b))
|
||||
|
@ -270,7 +270,7 @@ a
|
||||
8
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 7;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
|
||||
1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index
|
||||
SELECT * FROM t1 WHERE a > 1;
|
||||
a
|
||||
2
|
||||
@ -327,13 +327,13 @@ a
|
||||
8
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 6;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
|
||||
1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index
|
||||
SELECT * FROM t1 WHERE a > 7;
|
||||
a
|
||||
8
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 7;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
|
||||
1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY)
|
||||
PARTITION BY RANGE (a) (
|
||||
@ -556,7 +556,7 @@ a
|
||||
7
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 6;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
|
||||
1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index
|
||||
SELECT * FROM t1 WHERE a > 1;
|
||||
a
|
||||
2
|
||||
@ -601,13 +601,13 @@ a
|
||||
7
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 5;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
|
||||
1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index
|
||||
SELECT * FROM t1 WHERE a > 6;
|
||||
a
|
||||
7
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 6;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
|
||||
1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index
|
||||
DROP TABLE t1;
|
||||
# test of RANGE and index
|
||||
CREATE TABLE t1 (a DATE, KEY(a))
|
||||
@ -757,10 +757,10 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 5 Using where; Using index
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31';
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 pNULL,p2001-01-01 range a a 4 NULL 2 Using where; Using index
|
||||
1 SIMPLE t1 pNULL,p2001-01-01 index a a 4 NULL 7 Using where; Using index
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1999-02-31';
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 pNULL,p2001-01-01 range a a 4 NULL 2 Using where; Using index
|
||||
1 SIMPLE t1 pNULL,p2001-01-01 index a a 4 NULL 7 Using where; Using index
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1999-02-31';
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 pNULL ref a a 4 const 1 Using where; Using index
|
||||
@ -1086,10 +1086,10 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31';
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p2001-01-01,pNULL range a a 4 NULL 2 Using where; Using index
|
||||
1 SIMPLE t1 p2001-01-01,pNULL index a a 4 NULL 7 Using where; Using index
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1999-02-31';
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p2001-01-01,pNULL range a a 4 NULL 2 Using where; Using index
|
||||
1 SIMPLE t1 p2001-01-01,pNULL index a a 4 NULL 7 Using where; Using index
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1999-02-31';
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 pNULL ref a a 4 const 1 Using where; Using index
|
||||
@ -1101,7 +1101,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00';
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 pNULL,p1001-01-01 range a a 4 NULL 2 Using where; Using index
|
||||
1 SIMPLE t1 pNULL,p1001-01-01 index a a 4 NULL 7 Using where; Using index
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01';
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p0001-01-01,pNULL,p1001-01-01 range a a 4 NULL 3 Using where; Using index
|
||||
@ -2101,6 +2101,21 @@ insert into t7 values (10),(30),(50);
|
||||
explain partitions select * from t7 where a < 5;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a < 9;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a <= 9;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a = 9;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a >= 9;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a > 9;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a < 10;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
@ -2110,9 +2125,33 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
explain partitions select * from t7 where a = 10;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p30 system NULL NULL NULL NULL 1
|
||||
explain partitions select * from t7 where a >= 10;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a > 10;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a < 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a <= 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a = 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a > 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a >= 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a < 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a <= 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a = 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
@ -2122,6 +2161,9 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
explain partitions select * from t7 where a >= 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a > 91;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a > 11 and a < 29;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
@ -2137,6 +2179,21 @@ insert into t7 values (10),(30),(50);
|
||||
explain partitions select * from t7 where a < 5;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a < 9;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a <= 9;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a = 9;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a >= 9;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a > 9;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a < 10;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
@ -2146,9 +2203,33 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
explain partitions select * from t7 where a = 10;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p30 system NULL NULL NULL NULL 1
|
||||
explain partitions select * from t7 where a >= 10;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a > 10;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a < 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a <= 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a = 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a > 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a >= 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a < 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a <= 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a = 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
@ -2158,6 +2239,9 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
explain partitions select * from t7 where a >= 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a > 91;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a > 11 and a < 29;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
|
@ -1,4 +1,18 @@
|
||||
drop table if exists t1, t2;
|
||||
#
|
||||
# Bug#48229: group by performance issue of partitioned table
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
a INT,
|
||||
b INT,
|
||||
KEY a (a,b)
|
||||
)
|
||||
PARTITION BY HASH (a) PARTITIONS 1;
|
||||
INSERT INTO t1 VALUES (0, 580092), (3, 894076), (4, 805483), (4, 913540), (6, 611137), (8, 171602), (9, 599495), (9, 746305), (10, 272829), (10, 847519), (12, 258869), (12, 929028), (13, 288970), (15, 20971), (15, 105839), (16, 788272), (17, 76914), (18, 827274), (19, 802258), (20, 123677), (20, 587729), (22, 701449), (25, 31565), (25, 230782), (25, 442887), (25, 733139), (25, 851020);
|
||||
EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10, 100, 3) GROUP BY a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range a a 5 NULL 4 Using where; Using index
|
||||
DROP TABLE t1;
|
||||
create table t1 (a int)
|
||||
partition by range (a)
|
||||
( partition p0 values less than (maxvalue));
|
||||
|
10
mysql-test/r/plugin_not_embedded.result
Normal file
10
mysql-test/r/plugin_not_embedded.result
Normal file
@ -0,0 +1,10 @@
|
||||
#
|
||||
# Bug#51770: UNINSTALL PLUGIN requires no privileges
|
||||
#
|
||||
GRANT INSERT ON mysql.plugin TO bug51770@localhost;
|
||||
INSTALL PLUGIN example SONAME 'ha_example.so';
|
||||
UNINSTALL PLUGIN example;
|
||||
ERROR 42000: DELETE command denied to user 'bug51770'@'localhost' for table 'plugin'
|
||||
GRANT DELETE ON mysql.plugin TO bug51770@localhost;
|
||||
UNINSTALL PLUGIN example;
|
||||
DROP USER bug51770@localhost;
|
@ -155,24 +155,24 @@ execute stmt1 ;
|
||||
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
|
||||
6 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
5 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
4 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
5 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
4 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
execute stmt1 ;
|
||||
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
|
||||
6 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
5 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
4 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
5 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
4 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain SELECT (SELECT SUM(c1 + c12 + 0.0) FROM t2 where (t1.c2 - 0e-3) = t2.c2 GROUP BY t1.c15 LIMIT 1) as scalar_s, exists (select 1.0e+0 from t2 where t2.c3 * 9.0000000000 = t1.c4) as exists_s, c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s, (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s FROM t1, (select c25 x, c32 y from t2) tt WHERE x * 1 = c25;
|
||||
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
|
||||
6 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
5 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
4 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
5 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
4 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
deallocate prepare stmt1;
|
||||
@ -1786,7 +1786,7 @@ prepare stmt from "create view v1 (c,d,e,f) as select a,b,a in (select a+2 from
|
||||
execute stmt;
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `c`,`t1`.`b` AS `d`,`t1`.`a` in (select (`t1`.`a` + 2) AS `a+2` from `t1`) AS `e`,`t1`.`a` = all (select `t1`.`a` AS `a` from `t1`) AS `f` from `t1` latin1 latin1_swedish_ci
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `c`,`t1`.`b` AS `d`,`t1`.`a` in (select (`t1`.`a` + 2) from `t1`) AS `e`,`t1`.`a` = all (select `t1`.`a` from `t1`) AS `f` from `t1` latin1 latin1_swedish_ci
|
||||
select * from v1;
|
||||
c d e f
|
||||
drop view v1;
|
||||
@ -1794,7 +1794,7 @@ execute stmt;
|
||||
deallocate prepare stmt;
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `c`,`t1`.`b` AS `d`,`t1`.`a` in (select (`t1`.`a` + 2) AS `a+2` from `t1`) AS `e`,`t1`.`a` = all (select `t1`.`a` AS `a` from `t1`) AS `f` from `t1` latin1 latin1_swedish_ci
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `c`,`t1`.`b` AS `d`,`t1`.`a` in (select (`t1`.`a` + 2) from `t1`) AS `e`,`t1`.`a` = all (select `t1`.`a` from `t1`) AS `f` from `t1` latin1 latin1_swedish_ci
|
||||
select * from v1;
|
||||
c d e f
|
||||
drop view v1;
|
||||
@ -2988,4 +2988,17 @@ select @plaintext;
|
||||
bcd
|
||||
deallocate prepare encode;
|
||||
deallocate prepare decode;
|
||||
#
|
||||
# Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings
|
||||
#
|
||||
CREATE TABLE t1 (a DATETIME NOT NULL, b TINYINT);
|
||||
INSERT INTO t1 VALUES (0, 0),(0, 0);
|
||||
PREPARE stmt FROM "SELECT 1 FROM t1 WHERE
|
||||
ROW(a, b) >= ROW('1', (SELECT 1 FROM t1 WHERE a > 1234))";
|
||||
EXECUTE stmt;
|
||||
1
|
||||
EXECUTE stmt;
|
||||
1
|
||||
DEALLOCATE PREPARE stmt;
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests.
|
||||
|
@ -193,4 +193,17 @@ show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 2
|
||||
drop table t1;
|
||||
#
|
||||
# Bug46615 Assertion in Query_cache::invalidate in INSERT in a VIEW of a MERGE table
|
||||
#
|
||||
CREATE TABLE t1 (c1 INT, c2 INT);
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
SET AUTOCOMMIT=OFF;
|
||||
CREATE VIEW t1_view AS SELECT c1 FROM t1 NATURAL JOIN t2 ;
|
||||
INSERT INTO t1_view (c1, c2) SELECT c1, c2 FROM t1;
|
||||
ERROR 42S22: Unknown column 'c2' in 'field list'
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP VIEW t1_view;
|
||||
SET AUTOCOMMIT=DEFAULT;
|
||||
set GLOBAL query_cache_size=default;
|
||||
|
@ -1653,4 +1653,48 @@ a b
|
||||
0 0
|
||||
1 1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#50939: Loose Index Scan unduly relies on engine to remember range
|
||||
# endpoints
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
a INT,
|
||||
b INT,
|
||||
KEY ( a, b )
|
||||
) PARTITION BY HASH (a) PARTITIONS 1;
|
||||
CREATE TABLE t2 (
|
||||
a INT,
|
||||
b INT,
|
||||
KEY ( a, b )
|
||||
);
|
||||
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
|
||||
INSERT INTO t1 SELECT a + 5, b + 5 FROM t1;
|
||||
INSERT INTO t1 SELECT a + 10, b + 10 FROM t1;
|
||||
INSERT INTO t1 SELECT a + 20, b + 20 FROM t1;
|
||||
INSERT INTO t1 SELECT a + 40, b + 40 FROM t1;
|
||||
INSERT INTO t2 SELECT * FROM t1;
|
||||
# plans should be identical
|
||||
EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10,100) GROUP BY a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index for group-by
|
||||
EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 range a a 5 NULL 2 Using where; Using index for group-by
|
||||
FLUSH status;
|
||||
SELECT a, MAX(b) FROM t1 WHERE a IN (10, 100) GROUP BY a;
|
||||
a MAX(b)
|
||||
10 10
|
||||
# Should be no more than 4 reads.
|
||||
SHOW status LIKE 'handler_read_key';
|
||||
Variable_name Value
|
||||
Handler_read_key 4
|
||||
FLUSH status;
|
||||
SELECT a, MAX(b) FROM t2 WHERE a IN (10, 100) GROUP BY a;
|
||||
a MAX(b)
|
||||
10 10
|
||||
# Should be no more than 4 reads.
|
||||
SHOW status LIKE 'handler_read_key';
|
||||
Variable_name Value
|
||||
Handler_read_key 4
|
||||
DROP TABLE t1, t2;
|
||||
End of 5.1 tests
|
||||
|
@ -457,3 +457,12 @@ abc 1 abc 1
|
||||
select host,user from mysql.user where (host,user) = ('localhost','test');
|
||||
host user
|
||||
drop table t1,t2;
|
||||
#
|
||||
# Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings
|
||||
#
|
||||
CREATE TABLE t1 (a DATETIME NOT NULL, b TINYINT);
|
||||
INSERT INTO t1 VALUES (0, 0),(0, 0);
|
||||
SELECT 1 FROM t1 WHERE ROW(a, b) >=
|
||||
ROW('1', (SELECT 1 FROM t1 WHERE a > 1234));
|
||||
1
|
||||
DROP TABLE t1;
|
||||
|
@ -4050,10 +4050,10 @@ join_0.c1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
Warnings:
|
||||
Note 1003 select '0' AS `c1` from `test`.`t1` `join_0` join `test`.`t1` `join_1` join `test`.`t1` `join_2` join `test`.`t1` `join_3` join `test`.`t1` `join_4` join `test`.`t1` `join_5` join `test`.`t1` `join_6` join `test`.`t1` `join_7` where 0 group by '0','0','0','0','0'
|
||||
Note 1003 select NULL AS `c1` from `test`.`t1` `join_0` join `test`.`t1` `join_1` join `test`.`t1` `join_2` join `test`.`t1` `join_3` join `test`.`t1` `join_4` join `test`.`t1` `join_5` join `test`.`t1` `join_6` join `test`.`t1` `join_7` where 0 group by NULL,NULL,NULL,NULL,NULL
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Note 1003 select '0' AS `c1` from `test`.`t1` `join_0` join `test`.`t1` `join_1` join `test`.`t1` `join_2` join `test`.`t1` `join_3` join `test`.`t1` `join_4` join `test`.`t1` `join_5` join `test`.`t1` `join_6` join `test`.`t1` `join_7` where 0 group by '0','0','0','0','0'
|
||||
Note 1003 select NULL AS `c1` from `test`.`t1` `join_0` join `test`.`t1` `join_1` join `test`.`t1` `join_2` join `test`.`t1` `join_3` join `test`.`t1` `join_4` join `test`.`t1` `join_5` join `test`.`t1` `join_6` join `test`.`t1` `join_7` where 0 group by NULL,NULL,NULL,NULL,NULL
|
||||
DROP TABLE t1;
|
||||
SELECT 1 AS ` `;
|
||||
|
||||
@ -4648,17 +4648,17 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND c=c) OR b > 20;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select '0' AS `a`,'0' AS `b`,'0' AS `c` from `test`.`t1` where 1
|
||||
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
|
||||
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a AND b=b) OR b > 20;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select '0' AS `a`,'0' AS `b`,'0' AS `c` from `test`.`t1` where 1
|
||||
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
|
||||
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND a=a) OR b > 20;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select '0' AS `a`,'0' AS `b`,'0' AS `c` from `test`.`t1` where 1
|
||||
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#45266: Uninitialized variable lead to an empty result.
|
||||
|
@ -9,3 +9,30 @@ SELECT USER();
|
||||
USER()
|
||||
#
|
||||
SHOW PROCESSLIST;
|
||||
#
|
||||
# Bug #37168: Missing variable - skip_name_resolve
|
||||
#
|
||||
SHOW VARIABLES LIKE 'skip_name_resolve';
|
||||
Variable_name Value
|
||||
skip_name_resolve ON
|
||||
SHOW GLOBAL VARIABLES LIKE 'skip_name_resolve';
|
||||
Variable_name Value
|
||||
skip_name_resolve ON
|
||||
SHOW SESSION VARIABLES LIKE 'skip_name_resolve';
|
||||
Variable_name Value
|
||||
skip_name_resolve ON
|
||||
SELECT @@skip_name_resolve;
|
||||
@@skip_name_resolve
|
||||
1
|
||||
SELECT @@LOCAL.skip_name_resolve;
|
||||
ERROR HY000: Variable 'skip_name_resolve' is a GLOBAL variable
|
||||
SELECT @@GLOBAL.skip_name_resolve;
|
||||
@@GLOBAL.skip_name_resolve
|
||||
1
|
||||
SET @@skip_name_resolve=0;
|
||||
ERROR HY000: Variable 'skip_name_resolve' is a read only variable
|
||||
SET @@LOCAL.skip_name_resolve=0;
|
||||
ERROR HY000: Variable 'skip_name_resolve' is a read only variable
|
||||
SET @@GLOBAL.skip_name_resolve=0;
|
||||
ERROR HY000: Variable 'skip_name_resolve' is a read only variable
|
||||
End of 5.1 tests
|
||||
|
@ -32,7 +32,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1249 Select 2 was reduced during optimization
|
||||
Note 1003 select (select 0 AS `0` union select 0 AS `0`) AS `(SELECT (SELECT 0 UNION SELECT 0))`
|
||||
Note 1003 select (select 0 union select 0) AS `(SELECT (SELECT 0 UNION SELECT 0))`
|
||||
SELECT (SELECT 1 FROM (SELECT 1) as b HAVING a=1) as a;
|
||||
ERROR 42S22: Reference 'a' not supported (forward reference in item list)
|
||||
SELECT (SELECT 1 FROM (SELECT 1) as b HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) as c HAVING a=1) as b;
|
||||
@ -50,7 +50,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select 1 AS `1` from (select 1 AS `a`) `b` having ((select '1' AS `a`) = 1)
|
||||
Note 1003 select 1 AS `1` from (select 1 AS `a`) `b` having ((select '1') = 1)
|
||||
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
|
||||
1
|
||||
1
|
||||
@ -187,7 +187,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
4 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00
|
||||
NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = (select `test`.`t3`.`a` AS `a` from `test`.`t3` order by 1 desc limit 1))) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where (`test`.`t4`.`b` = (select (max(`test`.`t2`.`a`) * 4) AS `max(t2.a)*4` from `test`.`t2`)) order by `a`)
|
||||
Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = (select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1))) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where (`test`.`t4`.`b` = (select (max(`test`.`t2`.`a`) * 4) from `test`.`t2`)) order by `a`)
|
||||
select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2;
|
||||
(select a from t3 where a<t2.a*4 order by 1 desc limit 1) a
|
||||
3 1
|
||||
@ -203,7 +203,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select (select `test`.`t3`.`a` AS `a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,'2' AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`a` > 1)) `tt`
|
||||
Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,'2' AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`a` > 1)) `tt`
|
||||
select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1);
|
||||
a
|
||||
2
|
||||
@ -224,7 +224,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t4`.`b` AS `b`,(select avg((`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) AS `min(t3.a)` from `test`.`t3` where (`test`.`t3`.`a` >= `test`.`t4`.`a`)))) AS `avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a))` from `test`.`t2`) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
|
||||
Note 1003 select `test`.`t4`.`b` AS `b`,(select avg((`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) from `test`.`t3` where (`test`.`t3`.`a` >= `test`.`t4`.`a`)))) from `test`.`t2`) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
|
||||
select * from t3 where exists (select * from t2 where t2.b=t3.a);
|
||||
a
|
||||
7
|
||||
@ -314,7 +314,7 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select (select '2' AS `a` from `test`.`t1` where ('2' = `test`.`t2`.`a`) union select `test`.`t5`.`a` AS `a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
|
||||
Note 1003 select (select '2' from `test`.`t1` where ('2' = `test`.`t2`.`a`) union select `test`.`t5`.`a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
|
||||
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
|
||||
@ -332,7 +332,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1 100.00 Using index
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where exists(select 1 AS `Not_used` from `test`.`t7` where (`test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`))
|
||||
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where exists(select 1 from `test`.`t7` where (`test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`))
|
||||
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
|
||||
ERROR 23000: Column 'a' in field list is ambiguous
|
||||
drop table t1,t2,t3;
|
||||
@ -367,7 +367,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00
|
||||
3 SUBQUERY t8 const PRIMARY PRIMARY 37 1 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select 'joce' AS `pseudo`,(select 'test' AS `email` from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
|
||||
Note 1003 select 'joce' AS `pseudo`,(select 'test' from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
|
||||
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
|
||||
t8 WHERE pseudo='joce');
|
||||
ERROR 21000: Operand should contain 1 column(s)
|
||||
@ -399,7 +399,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select (select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
|
||||
Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
|
||||
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
|
||||
date
|
||||
2002-08-03
|
||||
@ -743,7 +743,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 AS `1` having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(1)) union select 3 AS `3` having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(3))))
|
||||
Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(1)) union select 3 having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(3))))
|
||||
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3);
|
||||
id
|
||||
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
|
||||
@ -906,7 +906,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 100.00 Using where; Using index
|
||||
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t2`.`a`) and ((<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`) or isnull(`test`.`t2`.`a`))) having <is_not_null_test>(`test`.`t2`.`a`))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t2`.`a`) and ((<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`) or isnull(`test`.`t2`.`a`))) having <is_not_null_test>(`test`.`t2`.`a`))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
|
||||
drop table t1,t2,t3;
|
||||
create table t1 (a float);
|
||||
select 10.5 IN (SELECT * from t1 LIMIT 1);
|
||||
@ -1018,19 +1018,19 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select (select rand() AS `RAND()` from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1`
|
||||
Note 1003 select (select rand() from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1`
|
||||
EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select (select encrypt('test') AS `ENCRYPT('test')` from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1`
|
||||
Note 1003 select (select encrypt('test') from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1`
|
||||
EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select (select benchmark(1,1) AS `BENCHMARK(1,1)` from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1`
|
||||
Note 1003 select (select benchmark(1,1) from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1`
|
||||
drop table t1;
|
||||
CREATE TABLE `t1` (
|
||||
`mot` varchar(30) character set latin1 NOT NULL default '',
|
||||
@ -1125,7 +1125,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00
|
||||
3 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,(select (select rand() AS `rand()` from `test`.`t1` limit 1) AS `(select rand() from t1 limit 1)` from `test`.`t1` limit 1) AS `(select (select rand() from t1 limit 1) from t1 limit 1)` from `test`.`t1`
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,(select (select rand() from `test`.`t1` limit 1) from `test`.`t1` limit 1) AS `(select (select rand() from t1 limit 1) from t1 limit 1)` from `test`.`t1`
|
||||
drop table t1;
|
||||
select t1.Continent, t2.Name, t2.Population from t1 LEFT JOIN t2 ON t1.Code = t2.Country where t2.Population IN (select max(t2.Population) AS Population from t2, t1 where t2.Country = t1.Code group by Continent);
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
@ -1179,7 +1179,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
Warnings:
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 AS `Not_used` from `test`.`t1` `a` where 0)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where 0)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
INSERT INTO t1 (pseudo) VALUES ('test1');
|
||||
SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
0 IN (SELECT 1 FROM t1 a)
|
||||
@ -1189,7 +1189,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
Warnings:
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 AS `Not_used` from `test`.`t1` `a` where 0)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where 0)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
drop table t1;
|
||||
CREATE TABLE `t1` (
|
||||
`i` int(11) NOT NULL default '0',
|
||||
@ -1234,7 +1234,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) AS `MAX(salary)` from `test`.`t1`))
|
||||
Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`))
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
ID int(10) unsigned NOT NULL auto_increment,
|
||||
@ -1317,7 +1317,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 func 1 100.00
|
||||
2 DEPENDENT SUBQUERY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select 1 from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))
|
||||
drop table t1, t2, t3;
|
||||
create table t1 (a int, b int, index a (a,b));
|
||||
create table t2 (a int, index a (a));
|
||||
@ -1356,7 +1356,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t1 ref a a 5 func 1001 100.00 Using where; Using index
|
||||
2 DEPENDENT SUBQUERY t3 index a a 5 NULL 3 100.00 Using where; Using index; Using join buffer
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select 1 from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))
|
||||
insert into t1 values (3,31);
|
||||
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
|
||||
a
|
||||
@ -1496,7 +1496,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` < (select max('0') from `test`.`t2`)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` < (select max(NULL) from `test`.`t2`)))
|
||||
select * from t3 where a >= some (select b from t2);
|
||||
a
|
||||
explain extended select * from t3 where a >= some (select b from t2);
|
||||
@ -1504,7 +1504,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>((`test`.`t3`.`a` >= (select min('0') from `test`.`t2`)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>((`test`.`t3`.`a` >= (select min(NULL) from `test`.`t2`)))
|
||||
select * from t3 where a >= all (select b from t2 group by 1);
|
||||
a
|
||||
6
|
||||
@ -1515,7 +1515,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` < <max>(select '0' AS `b` from `test`.`t2` group by 1)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` < <max>(select NULL from `test`.`t2` group by 1)))
|
||||
select * from t3 where a >= some (select b from t2 group by 1);
|
||||
a
|
||||
explain extended select * from t3 where a >= some (select b from t2 group by 1);
|
||||
@ -1523,7 +1523,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>((`test`.`t3`.`a` >= <min>(select '0' AS `b` from `test`.`t2` group by 1)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>((`test`.`t3`.`a` >= <min>(select NULL from `test`.`t2` group by 1)))
|
||||
select * from t3 where NULL >= any (select b from t2);
|
||||
a
|
||||
explain extended select * from t3 where NULL >= any (select b from t2);
|
||||
@ -1566,7 +1566,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` <= <max>(select max(`test`.`t2`.`b`) AS `max(b)` from `test`.`t2` group by `test`.`t2`.`a`)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` <= <max>(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`)))
|
||||
drop table t2, t3;
|
||||
CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ;
|
||||
INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now());
|
||||
@ -1743,7 +1743,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(exists(select `test`.`t1`.`id` AS `id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null))))
|
||||
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null))))
|
||||
insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001');
|
||||
create table t2 (id int not null, text varchar(20) not null default '', primary key (id));
|
||||
insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10');
|
||||
@ -2279,7 +2279,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.up.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where exists(select 1 AS `Not_used` from `test`.`t1` where (`test`.`t1`.`a` = `test`.`up`.`a`))
|
||||
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where exists(select 1 from `test`.`t1` where (`test`.`t1`.`a` = `test`.`up`.`a`))
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (t1_a int);
|
||||
INSERT INTO t1 VALUES (1);
|
||||
@ -2820,19 +2820,19 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`)))) having (trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`)))) having (trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
|
||||
explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 Using where
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where ((`test`.`t2`.`flag` = 'N') and (<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) and (<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`))))
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = 'N') and (<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) and (<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`))))
|
||||
explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where (`test`.`t2`.`flag` = '0') group by `test`.`t2`.`one`,`test`.`t2`.`two` having (trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))) and trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where (`test`.`t2`.`flag` = '0') group by `test`.`t2`.`one`,`test`.`t2`.`two` having (trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))) and trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (a char(5), b char(5));
|
||||
INSERT INTO t1 VALUES (NULL,'aaa'), ('aaa','aaa');
|
||||
@ -4275,7 +4275,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select 2 AS `2` from `test`.`t1` where exists(select 1 AS `1` from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`))
|
||||
Note 1003 select 2 AS `2` from `test`.`t1` where exists(select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`))
|
||||
EXPLAIN EXTENDED
|
||||
SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION
|
||||
(SELECT 1 FROM t2 WHERE t1.a = t2.a));
|
||||
@ -4353,13 +4353,13 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,<exists>(select 1 AS `1` from `test`.`t1` group by `test`.`t1`.`a` having (<cache>(1) = <ref_null_helper>(1))))
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,<exists>(select 1 from `test`.`t1` group by `test`.`t1`.`a` having (<cache>(1) = <ref_null_helper>(1))))
|
||||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 WHERE a > 3 GROUP BY a);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,<exists>(select 1 AS `1` from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` having (<cache>(1) = <ref_null_helper>(1))))
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,<exists>(select 1 from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` having (<cache>(1) = <ref_null_helper>(1))))
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#45061: Incorrectly market field caused wrong result.
|
||||
@ -4628,3 +4628,92 @@ WHERE t1.a = d1.a;
|
||||
ERROR 42S22: Unknown column 'd1.a' in 'where clause'
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests.
|
||||
Set up test tables.
|
||||
CREATE TABLE t1 (
|
||||
t1_id INT UNSIGNED,
|
||||
PRIMARY KEY(t1_id)
|
||||
) Engine=MyISAM;
|
||||
INSERT INTO t1 (t1_id) VALUES (1), (2), (3), (4), (5);
|
||||
CREATE TABLE t2 SELECT * FROM t1;
|
||||
CREATE TABLE t3 (
|
||||
t3_id INT UNSIGNED AUTO_INCREMENT,
|
||||
t1_id INT UNSIGNED,
|
||||
amount DECIMAL(16,2),
|
||||
PRIMARY KEY(t3_id),
|
||||
KEY(t1_id)
|
||||
) Engine=MyISAM;
|
||||
INSERT INTO t3 (t1_id, t3_id, amount)
|
||||
VALUES (1, 1, 100.00), (2, 2, 200.00), (4, 4, 400.00);
|
||||
This is the 'inner query' running by itself.
|
||||
Produces correct results.
|
||||
SELECT
|
||||
t1.t1_id,
|
||||
IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
|
||||
FROM
|
||||
t1
|
||||
LEFT JOIN t2 ON t2.t1_id=t1.t1_id
|
||||
GROUP BY
|
||||
t1.t1_id
|
||||
;
|
||||
t1_id total_amount
|
||||
1 100.00
|
||||
2 200.00
|
||||
3 0.00
|
||||
4 400.00
|
||||
5 0.00
|
||||
SELECT * FROM (the same inner query)
|
||||
Produces correct results.
|
||||
SELECT * FROM (
|
||||
SELECT
|
||||
t1.t1_id,
|
||||
IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
|
||||
FROM
|
||||
t1
|
||||
LEFT JOIN t2 ON t2.t1_id=t1.t1_id
|
||||
GROUP BY
|
||||
t1.t1_id
|
||||
) AS t;
|
||||
t1_id total_amount
|
||||
1 100.00
|
||||
2 200.00
|
||||
3 0.00
|
||||
4 400.00
|
||||
5 0.00
|
||||
Now make t2.t1_id part of a key.
|
||||
ALTER TABLE t2 ADD PRIMARY KEY(t1_id);
|
||||
Same inner query by itself.
|
||||
Still correct results.
|
||||
SELECT
|
||||
t1.t1_id,
|
||||
IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
|
||||
FROM
|
||||
t1
|
||||
LEFT JOIN t2 ON t2.t1_id=t1.t1_id
|
||||
GROUP BY
|
||||
t1.t1_id;
|
||||
t1_id total_amount
|
||||
1 100.00
|
||||
2 200.00
|
||||
3 0
|
||||
4 400.00
|
||||
5 0
|
||||
SELECT * FROM (the same inner query), now with indexes on the LEFT JOIN
|
||||
SELECT * FROM (
|
||||
SELECT
|
||||
t1.t1_id,
|
||||
IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
|
||||
FROM
|
||||
t1
|
||||
LEFT JOIN t2 ON t2.t1_id=t1.t1_id
|
||||
GROUP BY
|
||||
t1.t1_id
|
||||
) AS t;
|
||||
t1_id total_amount
|
||||
1 100.00
|
||||
2 200.00
|
||||
3 0.00
|
||||
4 400.00
|
||||
5 0.00
|
||||
DROP TABLE t3;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
|
@ -30,7 +30,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<in_optimizer>(`test`.`t2`.`a`,<exists>(select max(`test`.`t1`.`ie`) AS `max(ie)` from `test`.`t1` where (`test`.`t1`.`oref` = `test`.`t2`.`oref`) group by `test`.`t1`.`grp` having trigcond((<cache>(`test`.`t2`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))) AS `Z` from `test`.`t2`
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<in_optimizer>(`test`.`t2`.`a`,<exists>(select max(`test`.`t1`.`ie`) from `test`.`t1` where (`test`.`t1`.`oref` = `test`.`t2`.`oref`) group by `test`.`t1`.`grp` having trigcond((<cache>(`test`.`t2`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))) AS `Z` from `test`.`t2`
|
||||
explain extended
|
||||
select a, oref from t2
|
||||
where a in (select max(ie) from t1 where oref=t2.oref group by grp);
|
||||
@ -39,7 +39,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select max(`test`.`t1`.`ie`) AS `max(ie)` from `test`.`t1` where (`test`.`t1`.`oref` = `test`.`t2`.`oref`) group by `test`.`t1`.`grp` having (<cache>(`test`.`t2`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select max(`test`.`t1`.`ie`) from `test`.`t1` where (`test`.`t1`.`oref` = `test`.`t2`.`oref`) group by `test`.`t1`.`grp` having (<cache>(`test`.`t2`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))
|
||||
select a, oref, a in (
|
||||
select max(ie) from t1 where oref=t2.oref group by grp union
|
||||
select max(ie) from t1 where oref=t2.oref group by grp
|
||||
@ -68,7 +68,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select <in_optimizer>(`test`.`t3`.`a`,<exists>(select max(`test`.`t1`.`ie`) AS `max(ie)` from `test`.`t1` where (`test`.`t1`.`oref` = 4) group by `test`.`t1`.`grp` having trigcond((<cache>(`test`.`t3`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))) AS `a in (select max(ie) from t1 where oref=4 group by grp)` from `test`.`t3`
|
||||
Note 1003 select <in_optimizer>(`test`.`t3`.`a`,<exists>(select max(`test`.`t1`.`ie`) from `test`.`t1` where (`test`.`t1`.`oref` = 4) group by `test`.`t1`.`grp` having trigcond((<cache>(`test`.`t3`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))) AS `a in (select max(ie) from t1 where oref=4 group by grp)` from `test`.`t3`
|
||||
drop table t1, t2, t3;
|
||||
create table t1 (a int, oref int, key(a));
|
||||
insert into t1 values
|
||||
@ -157,7 +157,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t2 ref a a 5 test.t1.b 1 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t3.oref' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<in_optimizer>(`test`.`t3`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t2`.`b` = `test`.`t3`.`oref`) and trigcond(((<cache>(`test`.`t3`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`)))) having trigcond(<is_not_null_test>(`test`.`t1`.`a`)))) AS `Z` from `test`.`t3`
|
||||
Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<in_optimizer>(`test`.`t3`.`a`,<exists>(select 1 from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t2`.`b` = `test`.`t3`.`oref`) and trigcond(((<cache>(`test`.`t3`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`)))) having trigcond(<is_not_null_test>(`test`.`t1`.`a`)))) AS `Z` from `test`.`t3`
|
||||
drop table t1, t2, t3;
|
||||
create table t1 (a int NOT NULL, b int NOT NULL, key(a));
|
||||
insert into t1 values
|
||||
@ -185,7 +185,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t2 ref a a 4 test.t1.b 1 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t3.oref' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<in_optimizer>(`test`.`t3`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t2`.`b` = `test`.`t3`.`oref`) and trigcond((<cache>(`test`.`t3`.`a`) = `test`.`t1`.`a`))))) AS `Z` from `test`.`t3`
|
||||
Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<in_optimizer>(`test`.`t3`.`a`,<exists>(select 1 from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t2`.`b` = `test`.`t3`.`oref`) and trigcond((<cache>(`test`.`t3`.`a`) = `test`.`t1`.`a`))))) AS `Z` from `test`.`t3`
|
||||
drop table t1,t2,t3;
|
||||
create table t1 (oref int, grp int);
|
||||
insert into t1 (oref, grp) values
|
||||
@ -209,7 +209,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1276 Field or reference 't2.oref' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<in_optimizer>(`test`.`t2`.`a`,<exists>(select count(0) AS `count(*)` from `test`.`t1` group by `test`.`t1`.`grp` having ((`test`.`t1`.`grp` = `test`.`t2`.`oref`) and trigcond((<cache>(`test`.`t2`.`a`) = <ref_null_helper>(count(0))))))) AS `Z` from `test`.`t2`
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<in_optimizer>(`test`.`t2`.`a`,<exists>(select count(0) from `test`.`t1` group by `test`.`t1`.`grp` having ((`test`.`t1`.`grp` = `test`.`t2`.`oref`) and trigcond((<cache>(`test`.`t2`.`a`) = <ref_null_helper>(count(0))))))) AS `Z` from `test`.`t2`
|
||||
drop table t1, t2;
|
||||
create table t1 (a int, b int, primary key (a));
|
||||
insert into t1 values (1,1), (3,1),(100,1);
|
||||
@ -258,7 +258,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 100 100.00 Using where; Using join buffer
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` join `test`.`t4` where ((`test`.`t1`.`c` = `test`.`t2`.`oref`) and trigcond(((<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`))) and trigcond(((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`b`) or isnull(`test`.`t1`.`b`)))) having (trigcond(<is_not_null_test>(`test`.`t1`.`a`)) and trigcond(<is_not_null_test>(`test`.`t1`.`b`))))) AS `Z` from `test`.`t2`
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(select `test`.`t1`.`a`,`test`.`t1`.`b` from `test`.`t1` join `test`.`t4` where ((`test`.`t1`.`c` = `test`.`t2`.`oref`) and trigcond(((<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`))) and trigcond(((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`b`) or isnull(`test`.`t1`.`b`)))) having (trigcond(<is_not_null_test>(`test`.`t1`.`a`)) and trigcond(<is_not_null_test>(`test`.`t1`.`b`))))) AS `Z` from `test`.`t2`
|
||||
select a,b, oref,
|
||||
(a,b) in (select a,b from t1,t4 where c=t2.oref) Z
|
||||
from t2;
|
||||
@ -703,7 +703,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using index
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`b` = `test`.`t1`.`a`) and (not(<in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t1` where ((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`)) having <is_not_null_test>(`test`.`t1`.`a`))))))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`b` = `test`.`t1`.`a`) and (not(<in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 from `test`.`t1` where ((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`)) having <is_not_null_test>(`test`.`t1`.`a`))))))
|
||||
SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1));
|
||||
a
|
||||
SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1 WHERE a > 4));
|
||||
@ -864,7 +864,7 @@ Level Code Message
|
||||
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2
|
||||
Note 1276 Field or reference 'test.t1.c' of SELECT #3 was resolved in SELECT #2
|
||||
Error 1054 Unknown column 'c' in 'field list'
|
||||
Note 1003 select `c` AS `c` from (select (select count(`test`.`t1`.`a`) AS `COUNT(a)` from (select count(`test`.`t1`.`b`) AS `COUNT(b)` from `test`.`t1`) `x` group by `c`) AS `(SELECT COUNT(a) FROM
|
||||
Note 1003 select `c` AS `c` from (select (select count(`test`.`t1`.`a`) from (select count(`test`.`t1`.`b`) AS `COUNT(b)` from `test`.`t1`) `x` group by `c`) AS `(SELECT COUNT(a) FROM
|
||||
(SELECT COUNT(b) FROM t1) AS x GROUP BY c
|
||||
)` from `test`.`t1` group by `test`.`t1`.`b`) `y`
|
||||
DROP TABLE t1;
|
||||
|
@ -168,4 +168,16 @@ Warning 1618 <DATA DIRECTORY> option ignored
|
||||
Warning 1618 <INDEX DIRECTORY> option ignored
|
||||
DROP TABLE t1;
|
||||
SET @@SQL_MODE=@OLD_SQL_MODE;
|
||||
#
|
||||
# BUG#40980 - Drop table can remove another MyISAM table's
|
||||
# data and index files
|
||||
#
|
||||
CREATE TABLE user(a INT) DATA DIRECTORY='MYSQL_TMP_DIR/mysql'
|
||||
INDEX DIRECTORY='MYSQL_TMP_DIR/mysql';
|
||||
FLUSH TABLE user;
|
||||
# Symlinking mysql database to tmpdir
|
||||
FLUSH TABLE mysql.user;
|
||||
DROP TABLE user;
|
||||
FLUSH TABLE mysql.user;
|
||||
SELECT * FROM mysql.user;
|
||||
End of 5.1 tests
|
||||
|
@ -2087,4 +2087,68 @@ ERROR 42S02: Table 'test.a_nonextisting_table' doesn't exist
|
||||
SELECT * FROM t2;
|
||||
a b
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# Bug#51650 crash with user variables and triggers
|
||||
#
|
||||
DROP TRIGGER IF EXISTS trg1;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
CREATE TABLE t1 (b VARCHAR(50) NOT NULL);
|
||||
CREATE TABLE t2 (a VARCHAR(10) NOT NULL DEFAULT '');
|
||||
CREATE TRIGGER trg1 AFTER INSERT ON t2
|
||||
FOR EACH ROW BEGIN
|
||||
SELECT 1 FROM t1 c WHERE
|
||||
(@bug51650 IS NULL OR @bug51650 != c.b) AND c.b = NEW.a LIMIT 1 INTO @foo;
|
||||
END//
|
||||
SET @bug51650 = 1;
|
||||
INSERT IGNORE INTO t2 VALUES();
|
||||
Warnings:
|
||||
Warning 1329 No data - zero rows fetched, selected, or processed
|
||||
INSERT IGNORE INTO t1 SET b = '777';
|
||||
INSERT IGNORE INTO t2 SET a = '111';
|
||||
Warnings:
|
||||
Warning 1329 No data - zero rows fetched, selected, or processed
|
||||
SET @bug51650 = 1;
|
||||
INSERT IGNORE INTO t2 SET a = '777';
|
||||
DROP TRIGGER trg1;
|
||||
DROP TABLE t1, t2;
|
||||
CREATE TABLE t1 (id INT NOT NULL);
|
||||
CREATE TABLE t2 (id INT NOT NULL);
|
||||
INSERT t1 VALUES (1),(2),(3);
|
||||
UPDATE t1 SET id=NULL;
|
||||
Warnings:
|
||||
Warning 1048 Column 'id' cannot be null
|
||||
Warning 1048 Column 'id' cannot be null
|
||||
Warning 1048 Column 'id' cannot be null
|
||||
CREATE TRIGGER t1_bu BEFORE UPDATE ON t1 FOR EACH ROW
|
||||
INSERT INTO t2 VALUES (3);
|
||||
UPDATE t1 SET id=NULL;
|
||||
Warnings:
|
||||
Warning 1048 Column 'id' cannot be null
|
||||
Warning 1048 Column 'id' cannot be null
|
||||
Warning 1048 Column 'id' cannot be null
|
||||
DROP TRIGGER t1_bu;
|
||||
DROP TABLE t1,t2;
|
||||
#
|
||||
# Bug#50755: Crash if stored routine def contains version comments
|
||||
#
|
||||
DROP DATABASE IF EXISTS db1;
|
||||
DROP TRIGGER IF EXISTS trg1;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
CREATE DATABASE db1;
|
||||
USE db1;
|
||||
CREATE TABLE t1 (b INT);
|
||||
CREATE TABLE t2 (a INT);
|
||||
CREATE TRIGGER trg1 BEFORE INSERT ON t2 FOR EACH ROW INSERT/*!INTO*/t1 VALUES (1);
|
||||
# Used to crash
|
||||
SHOW TRIGGERS IN db1;
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
|
||||
Warnings:
|
||||
Warning 1064 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 'VALUES (1)' at line 1
|
||||
INSERT INTO t2 VALUES (1);
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VALUES (1)' at line 1
|
||||
SELECT * FROM t1;
|
||||
b
|
||||
# Work around Bug#45235
|
||||
DROP DATABASE db1;
|
||||
USE test;
|
||||
End of 5.1 tests.
|
||||
|
@ -275,4 +275,25 @@ select * from t1 where a between '0000-00-01' and '0000-00-02';
|
||||
a
|
||||
0000-00-01
|
||||
drop table t1;
|
||||
#
|
||||
# Bug#50918: Date columns treated differently in Views than in Base
|
||||
# Tables
|
||||
#
|
||||
CREATE TABLE t1 ( the_date DATE, the_time TIME );
|
||||
INSERT INTO t1 VALUES ( '2010-01-01', '01:01:01' );
|
||||
SELECT * FROM t1 t11 JOIN t1 t12 ON addtime( t11.the_date, t11.the_time ) =
|
||||
addtime( t12.the_date, t12.the_time );
|
||||
the_date the_time the_date the_time
|
||||
2010-01-01 01:01:01 2010-01-01 01:01:01
|
||||
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||
SELECT * FROM t1 JOIN v1 ON addtime( t1.the_date, t1.the_time ) =
|
||||
addtime( v1.the_date, v1.the_time );
|
||||
the_date the_time the_date the_time
|
||||
2010-01-01 01:01:01 2010-01-01 01:01:01
|
||||
SELECT * FROM t1 JOIN v1 ON addtime( t1.the_date, t1.the_time ) =
|
||||
addtime( cast(v1.the_date AS DATETIME), v1.the_time );
|
||||
the_date the_time the_date the_time
|
||||
2010-01-01 01:01:01 2010-01-01 01:01:01
|
||||
DROP TABLE t1;
|
||||
DROP VIEW v1;
|
||||
End of 5.1 tests
|
||||
|
@ -517,7 +517,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.cur_date' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select '1' AS `id`,'2007-04-25 18:30:22' AS `cur_date` from `test`.`t1` where <in_optimizer>('1',<exists>(select 1 AS `Not_used` from `test`.`t1` `x1` where 0))
|
||||
Note 1003 select '1' AS `id`,'2007-04-25 18:30:22' AS `cur_date` from `test`.`t1` where <in_optimizer>('1',<exists>(select 1 from `test`.`t1` `x1` where 0))
|
||||
select * from t1
|
||||
where id in (select id from t1 as x1 where (t1.cur_date is null));
|
||||
id cur_date
|
||||
@ -529,7 +529,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t2.cur_date' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select '1' AS `id`,'2007-04-25' AS `cur_date` from `test`.`t2` where <in_optimizer>('1',<exists>(select 1 AS `Not_used` from `test`.`t2` `x1` where 0))
|
||||
Note 1003 select '1' AS `id`,'2007-04-25' AS `cur_date` from `test`.`t2` where <in_optimizer>('1',<exists>(select 1 from `test`.`t2` `x1` where 0))
|
||||
select * from t2
|
||||
where id in (select id from t2 as x1 where (t2.cur_date is null));
|
||||
id cur_date
|
||||
@ -543,7 +543,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY x1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.cur_date' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`cur_date` AS `cur_date` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`id`,<exists>(select 1 AS `Not_used` from `test`.`t1` `x1` where ((`test`.`t1`.`cur_date` = 0) and (<cache>(`test`.`t1`.`id`) = `test`.`x1`.`id`))))
|
||||
Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`cur_date` AS `cur_date` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`id`,<exists>(select 1 from `test`.`t1` `x1` where ((`test`.`t1`.`cur_date` = 0) and (<cache>(`test`.`t1`.`id`) = `test`.`x1`.`id`))))
|
||||
select * from t1
|
||||
where id in (select id from t1 as x1 where (t1.cur_date is null));
|
||||
id cur_date
|
||||
@ -555,7 +555,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY x1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t2.cur_date' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t2`.`id` AS `id`,`test`.`t2`.`cur_date` AS `cur_date` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 AS `Not_used` from `test`.`t2` `x1` where ((`test`.`t2`.`cur_date` = 0) and (<cache>(`test`.`t2`.`id`) = `test`.`x1`.`id`))))
|
||||
Note 1003 select `test`.`t2`.`id` AS `id`,`test`.`t2`.`cur_date` AS `cur_date` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 from `test`.`t2` `x1` where ((`test`.`t2`.`cur_date` = 0) and (<cache>(`test`.`t2`.`id`) = `test`.`x1`.`id`))))
|
||||
select * from t2
|
||||
where id in (select id from t2 as x1 where (t2.cur_date is null));
|
||||
id cur_date
|
||||
|
@ -309,4 +309,36 @@ yyyy c4
|
||||
2069 2069
|
||||
DROP TABLE t2, t4;
|
||||
#
|
||||
# Bug #49910: Behavioural change in SELECT/WHERE on YEAR(4) data type
|
||||
#
|
||||
CREATE TABLE t1 (y YEAR NOT NULL, s VARCHAR(4));
|
||||
INSERT INTO t1 (s) VALUES ('bad');
|
||||
Warnings:
|
||||
Warning 1364 Field 'y' doesn't have a default value
|
||||
INSERT INTO t1 (y, s) VALUES (0, 0), (2000, 2000), (2001, 2001);
|
||||
SELECT * FROM t1 ta, t1 tb WHERE ta.y = tb.y;
|
||||
y s y s
|
||||
0000 bad 0000 bad
|
||||
0000 0 0000 bad
|
||||
0000 bad 0000 0
|
||||
0000 0 0000 0
|
||||
2000 2000 2000 2000
|
||||
2001 2001 2001 2001
|
||||
SELECT * FROM t1 WHERE t1.y = 0;
|
||||
y s
|
||||
0000 bad
|
||||
0000 0
|
||||
SELECT * FROM t1 WHERE t1.y = 2000;
|
||||
y s
|
||||
2000 2000
|
||||
SELECT ta.y AS ta_y, ta.s, tb.y AS tb_y, tb.s FROM t1 ta, t1 tb HAVING ta_y = tb_y;
|
||||
ta_y s tb_y s
|
||||
0000 bad 0000 bad
|
||||
0000 0 0000 bad
|
||||
0000 bad 0000 0
|
||||
0000 0 0000 0
|
||||
2000 2000 2000 2000
|
||||
2001 2001 2001 2001
|
||||
DROP TABLE t1;
|
||||
#
|
||||
End of 5.1 tests
|
||||
|
@ -38,8 +38,6 @@ ERROR HY000: Can't initialize function 'reverse_lookup'; Wrong number of argumen
|
||||
select reverse_lookup("127.0.0.1");
|
||||
select reverse_lookup(127,0,0,1);
|
||||
select reverse_lookup("localhost");
|
||||
reverse_lookup("localhost")
|
||||
NULL
|
||||
select avgcost();
|
||||
ERROR HY000: Can't initialize function 'avgcost'; wrong number of arguments: AVGCOST() requires two arguments
|
||||
select avgcost(100,23.76);
|
||||
|
@ -1585,7 +1585,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 UNION t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort
|
||||
Warnings:
|
||||
Note 1003 select '0' AS `a` from `test`.`t1` union select '0' AS `a` from `test`.`t1` order by `a`
|
||||
Note 1003 select NULL AS `a` from `test`.`t1` union select NULL AS `a` from `test`.`t1` order by `a`
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
#
|
||||
@ -1636,7 +1636,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` union select `test`.`t1`.`a` AS `a` from `test`.`t1` order by (select `test`.`t1`.`a` AS `a` from `test`.`t2` where (`test`.`t2`.`b` = 12))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` union select `test`.`t1`.`a` AS `a` from `test`.`t1` order by (select `test`.`t1`.`a` from `test`.`t2` where (`test`.`t2`.`b` = 12))
|
||||
# Should not crash
|
||||
SELECT * FROM t1 UNION SELECT * FROM t1
|
||||
ORDER BY (SELECT a FROM t2 WHERE b = 12);
|
||||
|
@ -514,3 +514,16 @@ ALTER TABLE t2 COMMENT = 'ABC';
|
||||
UPDATE t2, t1 SET t2.f1 = 2, t1.f1 = 9;
|
||||
ALTER TABLE t2 COMMENT = 'DEF';
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# Bug#50545: Single table UPDATE IGNORE crashes on join view in
|
||||
# sql_safe_updates mode.
|
||||
#
|
||||
CREATE TABLE t1 ( a INT, KEY( a ) );
|
||||
INSERT INTO t1 VALUES (0), (1);
|
||||
CREATE VIEW v1 AS SELECT t11.a, t12.a AS b FROM t1 t11, t1 t12;
|
||||
SET SESSION sql_safe_updates = 1;
|
||||
UPDATE IGNORE v1 SET a = 1;
|
||||
ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
|
||||
SET SESSION sql_safe_updates = DEFAULT;
|
||||
DROP TABLE t1;
|
||||
DROP VIEW v1;
|
||||
|
@ -523,6 +523,8 @@ select @@max_user_connections;
|
||||
100
|
||||
set global max_write_lock_count=100;
|
||||
set myisam_sort_buffer_size=100;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect myisam_sort_buffer_size value: '100'
|
||||
set global net_buffer_length=100;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect net_buffer_length value: '100'
|
||||
@ -1493,4 +1495,13 @@ SELECT @@GLOBAL.max_binlog_cache_size;
|
||||
@@GLOBAL.max_binlog_cache_size
|
||||
5368709120
|
||||
SET GLOBAL max_binlog_cache_size = @old_max_binlog_cache_size;
|
||||
#
|
||||
# Bug #37168 : Missing variable - skip_name_resolve
|
||||
#
|
||||
SELECT @@skip_name_resolve;
|
||||
@@skip_name_resolve
|
||||
0
|
||||
SHOW VARIABLES LIKE 'skip_name_resolve';
|
||||
Variable_name Value
|
||||
skip_name_resolve OFF
|
||||
End of 5.1 tests
|
||||
|
@ -1,3 +1,4 @@
|
||||
SET @old_debug = @@GLOBAL.debug;
|
||||
set debug= 'T';
|
||||
select @@debug;
|
||||
@@debug
|
||||
@ -10,3 +11,17 @@ set debug= '-P';
|
||||
select @@debug;
|
||||
@@debug
|
||||
T
|
||||
#
|
||||
# Bug #52629: memory leak from sys_var_thd_dbug in
|
||||
# binlog.binlog_write_error
|
||||
#
|
||||
SET GLOBAL debug='d,injecting_fault_writing';
|
||||
SELECT @@global.debug;
|
||||
@@global.debug
|
||||
d,injecting_fault_writing
|
||||
SET GLOBAL debug='';
|
||||
SELECT @@global.debug;
|
||||
@@global.debug
|
||||
|
||||
SET GLOBAL debug=@old_debug;
|
||||
End of 5.1 tests
|
||||
|
@ -717,7 +717,7 @@ create view v1 as select a from t1;
|
||||
create view v2 as select a from t2 where a in (select a from v1);
|
||||
show create view v2;
|
||||
View Create View character_set_client collation_connection
|
||||
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where `t2`.`a` in (select `v1`.`a` AS `a` from `v1`) latin1 latin1_swedish_ci
|
||||
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where `t2`.`a` in (select `v1`.`a` from `v1`) latin1 latin1_swedish_ci
|
||||
drop view v2, v1;
|
||||
drop table t1, t2;
|
||||
CREATE VIEW `v 1` AS select 5 AS `5`;
|
||||
@ -2982,7 +2982,7 @@ SHOW WARNINGS;
|
||||
Level Code Message
|
||||
SHOW CREATE VIEW v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`pk` AS `pk` from (`t1` join `t2` on(((`t2`.`fk` = `t1`.`pk`) and (`t2`.`ver` = (select max(`t`.`ver`) AS `MAX(t.ver)` from `t2` `t` where (`t`.`org` = `t2`.`org`)))))) latin1 latin1_swedish_ci
|
||||
v1 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`pk` AS `pk` from (`t1` join `t2` on(((`t2`.`fk` = `t1`.`pk`) and (`t2`.`ver` = (select max(`t`.`ver`) from `t2` `t` where (`t`.`org` = `t2`.`org`)))))) latin1 latin1_swedish_ci
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1, t2;
|
||||
DROP FUNCTION IF EXISTS f1;
|
||||
@ -3874,6 +3874,14 @@ CREATE VIEW v1 AS SELECT 1 FROM t1 WHERE
|
||||
ROW(1,1) >= ROW(1, (SELECT 1 FROM t1 WHERE f1 >= ANY ( SELECT '1' )));
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#52120 create view cause Assertion failed: 0, file .\item_subselect.cc, line 817
|
||||
#
|
||||
CREATE TABLE t1 (a CHAR(1) CHARSET latin1, b CHAR(1) CHARSET utf8);
|
||||
CREATE VIEW v1 AS SELECT 1 from t1
|
||||
WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1'));
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
# -----------------------------------------------------------------
|
||||
# -- End of 5.1 tests.
|
||||
# -----------------------------------------------------------------
|
||||
|
111
mysql-test/r/view_alias.result
Normal file
111
mysql-test/r/view_alias.result
Normal file
@ -0,0 +1,111 @@
|
||||
#
|
||||
# Bug#40277 SHOW CREATE VIEW returns invalid SQL
|
||||
# Bug#41999 SHOW CREATE VIEW returns invalid SQL if subquery is used in SELECT list
|
||||
#
|
||||
# 65 characters exceed the maximum length of a column identifier. The system cannot derive the name from statement.
|
||||
# Constant with length = 65 . Expect to get the identifier 'Name_exp_1'.
|
||||
CREATE VIEW v1 AS SELECT '<--- 65 char including the arrows --->';
|
||||
SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1';
|
||||
COLUMN_NAME
|
||||
Name_exp_1
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select '<--- 65 char including the arrows --->' AS `Name_exp_1`;
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select '<--- 65 char including the arrows --->' AS `Name_exp_1`;
|
||||
DROP VIEW v1;
|
||||
# Subquery with length = 65 . Expect to get the identifier 'Name_exp_1'.
|
||||
# Attention: Identifier for the column within the subquery will be not generated.
|
||||
CREATE VIEW v1 AS SELECT (SELECT '<--- 54 char including the arrows (+ 11 outside) -->');
|
||||
SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1';
|
||||
COLUMN_NAME
|
||||
Name_exp_1
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select (select '<--- 54 char including the arrows (+ 11 outside) -->') AS `Name_exp_1`;
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select (select '<--- 54 char including the arrows (+ 11 outside) -->') AS `Name_exp_1`;
|
||||
DROP VIEW v1;
|
||||
# -----------------------------------------------------------------------------------------------------------------
|
||||
# 64 characters are the maximum length of a column identifier. The system can derive the name from the statement.
|
||||
CREATE VIEW v1 AS SELECT '<--- 64 char including the arrows --->';
|
||||
SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1';
|
||||
COLUMN_NAME
|
||||
<--- 64 char including the arrows --->
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select '<--- 64 char including the arrows --->' AS `<--- 64 char including the arrows --->`;
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select '<--- 64 char including the arrows --->' AS `<--- 64 char including the arrows --->`;
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS SELECT (SELECT '<--- 53 char including the arrows (+ 11 outside) --->');
|
||||
SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1';
|
||||
COLUMN_NAME
|
||||
(SELECT '<--- 53 char including the arrows (+ 11 outside) --->')
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select (select '<--- 53 char including the arrows (+ 11 outside) --->') AS `(SELECT '<--- 53 char including the arrows (+ 11 outside) --->')`;
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select (select '<--- 53 char including the arrows (+ 11 outside) --->') AS `(SELECT '<--- 53 char including the arrows (+ 11 outside) --->')`;
|
||||
DROP VIEW v1;
|
||||
# -----------------------------------------------------------------------------------------------------------------
|
||||
# Identifiers must not have trailing spaces. The system cannot derive the name from a constant with trailing space.
|
||||
# Generated identifiers have at their end the position within the select column list.
|
||||
# 'c2 ' -> 'Name_exp_1' , ' c4 ' -> 'Name_exp_2'
|
||||
CREATE VIEW v1 AS SELECT 'c1', 'c2 ', ' c3', ' c4 ';
|
||||
SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1';
|
||||
COLUMN_NAME
|
||||
c1
|
||||
Name_exp_2
|
||||
c3
|
||||
Name_exp_4
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select 'c1' AS `c1`,'c2 ' AS `Name_exp_2`,' c3' AS `c3`,' c4 ' AS `Name_exp_4`;
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select 'c1' AS `c1`,'c2 ' AS `Name_exp_2`,' c3' AS `c3`,' c4 ' AS `Name_exp_4`;
|
||||
DROP VIEW v1;
|
||||
#
|
||||
# Bug#40277 SHOW CREATE VIEW returns invalid SQL
|
||||
#
|
||||
DROP VIEW IF EXISTS v1;
|
||||
DROP TABLE IF EXISTS t1,t2;
|
||||
# Column name exceeds the maximum length.
|
||||
CREATE VIEW v1 AS SELECT '0000000000 1111111111 2222222222 3333333333 4444444444 5555555555';
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select '0000000000 1111111111 2222222222 3333333333 4444444444 5555555555' AS `Name_exp_1`;
|
||||
DROP VIEW v1;
|
||||
# Column names with leading trailing spaces.
|
||||
CREATE VIEW v1 AS SELECT 'c1', 'c2 ', ' c3', ' c4 ';
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select 'c1' AS `c1`,'c2 ' AS `Name_exp_2`,' c3' AS `c3`,' c4 ' AS `Name_exp_4`;
|
||||
DROP VIEW v1;
|
||||
# Column name conflicts with a auto-generated one.
|
||||
CREATE VIEW v1 AS SELECT 'c1', 'c2 ', ' c3', ' c4 ', 'Name_exp_2';
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select 'c1' AS `c1`,'c2 ' AS `Name_exp_2`,' c3' AS `c3`,' c4 ' AS `Name_exp_4`,'Name_exp_2' AS `My_exp_Name_exp_2`;
|
||||
DROP VIEW v1;
|
||||
# Invalid conlumn name in subquery.
|
||||
CREATE VIEW v1 AS SELECT (SELECT ' c1 ');
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select (select ' c1 ') AS `(SELECT ' c1 ')`;
|
||||
DROP VIEW v1;
|
||||
CREATE TABLE t1(a INT);
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
# Test alias in subquery
|
||||
CREATE VIEW v1 AS SELECT a FROM t1 WHERE EXISTS (SELECT 1 FROM t2 AS b WHERE b.a = 0);
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select `test`.`t1`.`a` AS `a` from `test`.`t1` where exists(select 1 from `test`.`t2` `b` where (`b`.`a` = 0));
|
||||
DROP VIEW v1;
|
||||
# Test column alias in subquery
|
||||
CREATE VIEW v1 AS SELECT a FROM t1 WHERE EXISTS (SELECT a AS alias FROM t1 GROUP BY alias);
|
||||
SHOW CREATE VIEW v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where exists(select `t1`.`a` AS `alias` from `t1` group by `t1`.`a`) latin1 latin1_swedish_ci
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select `test`.`t1`.`a` AS `a` from `test`.`t1` where exists(select `test`.`t1`.`a` AS `alias` from `test`.`t1` group by `test`.`t1`.`a`);
|
||||
DROP VIEW v1;
|
||||
# Alias as the expression column name.
|
||||
CREATE VIEW v1 AS SELECT a FROM t1 WHERE EXISTS (SELECT ' a ' AS alias FROM t1 GROUP BY alias);
|
||||
SHOW CREATE VIEW v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where exists(select ' a ' AS `alias` from `t1` group by ' a ') latin1 latin1_swedish_ci
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select `test`.`t1`.`a` AS `a` from `test`.`t1` where exists(select ' a ' AS `alias` from `test`.`t1` group by ' a ');
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1, t2;
|
@ -74,6 +74,23 @@ ERROR XA102: XA_RBDEADLOCK: Transaction branch was rolled back: deadlock was det
|
||||
xa rollback 'a','c';
|
||||
xa start 'a','c';
|
||||
drop table t1;
|
||||
#
|
||||
# BUG#51342 - more xid crashing
|
||||
#
|
||||
CREATE TABLE t1(a INT) ENGINE=InnoDB;
|
||||
XA START 'x';
|
||||
SET SESSION autocommit=0;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
SET SESSION autocommit=1;
|
||||
ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the ACTIVE state
|
||||
SELECT @@autocommit;
|
||||
@@autocommit
|
||||
0
|
||||
INSERT INTO t1 VALUES(1);
|
||||
XA END 'x';
|
||||
XA COMMIT 'x' ONE PHASE;
|
||||
DROP TABLE t1;
|
||||
SET SESSION autocommit=1;
|
||||
End of 5.0 tests
|
||||
xa start 'a';
|
||||
xa end 'a';
|
||||
|
BIN
mysql-test/std_data/binlog_savepoint.000001
Normal file
BIN
mysql-test/std_data/binlog_savepoint.000001
Normal file
Binary file not shown.
BIN
mysql-test/std_data/bug46565.ARZ
Normal file
BIN
mysql-test/std_data/bug46565.ARZ
Normal file
Binary file not shown.
BIN
mysql-test/std_data/bug46565.frm
Normal file
BIN
mysql-test/std_data/bug46565.frm
Normal file
Binary file not shown.
BIN
mysql-test/std_data/bug48265.frm
Normal file
BIN
mysql-test/std_data/bug48265.frm
Normal file
Binary file not shown.
BIN
mysql-test/std_data/bug49823.CSM
Normal file
BIN
mysql-test/std_data/bug49823.CSM
Normal file
Binary file not shown.
1
mysql-test/std_data/bug49823.CSV
Normal file
1
mysql-test/std_data/bug49823.CSV
Normal file
@ -0,0 +1 @@
|
||||
"2010-02-26 13:32:26","root[root] @ localhost []",2,1,"Query","SELECT 1"
|
|
BIN
mysql-test/std_data/bug49823.frm
Normal file
BIN
mysql-test/std_data/bug49823.frm
Normal file
Binary file not shown.
@ -29,3 +29,32 @@ master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
drop table t1;
|
||||
RESET MASTER;
|
||||
CREATE TABLE t1 ( c1 int , primary key (c1)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS t2 LIKE t1;
|
||||
TRUNCATE TABLE t2;
|
||||
DROP TABLE t1;
|
||||
###############################################
|
||||
### assertion: No event for 'TRUNCATE TABLE t2'
|
||||
###############################################
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 ( c1 int , primary key (c1)) ENGINE=InnoDB
|
||||
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 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE t1
|
||||
###############################################
|
||||
RESET MASTER;
|
||||
CREATE TEMPORARY TABLE t1 (c1 int) Engine=InnoDB;
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
TRUNCATE t1;
|
||||
DROP TEMPORARY TABLE t1;
|
||||
###############################################
|
||||
### assertion: No event for 'TRUNCATE TABLE t1'
|
||||
###############################################
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
###############################################
|
||||
|
@ -48,12 +48,12 @@ Log_name Pos Event_type Server_id End_log_pos Info
|
||||
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 # # use `test`; savepoint my_savepoint
|
||||
master-bin.000001 # Query # # SAVEPOINT my_savepoint
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t2)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # use `test`; rollback to savepoint my_savepoint
|
||||
master-bin.000001 # Query # # ROLLBACK TO my_savepoint
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
@ -77,12 +77,12 @@ Log_name Pos Event_type Server_id End_log_pos Info
|
||||
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 # # use `test`; savepoint my_savepoint
|
||||
master-bin.000001 # Query # # SAVEPOINT my_savepoint
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t2)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # use `test`; rollback to savepoint my_savepoint
|
||||
master-bin.000001 # Query # # ROLLBACK TO my_savepoint
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
@ -413,7 +413,6 @@ 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 # # use `test`; TRUNCATE table t2
|
||||
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
|
||||
@ -880,11 +879,11 @@ delete from t4;
|
||||
insert into t3 values (1,1),(2,2);
|
||||
insert into t4 values (1,1),(2,2);
|
||||
reset master;
|
||||
UPDATE t3,t4 SET t3.a=t4.a + bug27417(1);
|
||||
UPDATE t3,t4 SET t3.a = t4.a + bug27417(1) where t3.a = 1;
|
||||
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
|
||||
select count(*) from t1 /* must be 1 */;
|
||||
count(*)
|
||||
2
|
||||
1
|
||||
drop table t4;
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
|
@ -44,10 +44,10 @@ 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 t1 values(3)
|
||||
master-bin.000001 # Query # # use `test`; savepoint my_savepoint
|
||||
master-bin.000001 # Query # # SAVEPOINT my_savepoint
|
||||
master-bin.000001 # Query # # use `test`; insert into t1 values(4)
|
||||
master-bin.000001 # Query # # use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 # Query # # use `test`; rollback to savepoint my_savepoint
|
||||
master-bin.000001 # Query # # ROLLBACK TO my_savepoint
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
@ -70,10 +70,10 @@ 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 t1 values(5)
|
||||
master-bin.000001 # Query # # use `test`; savepoint my_savepoint
|
||||
master-bin.000001 # Query # # SAVEPOINT my_savepoint
|
||||
master-bin.000001 # Query # # use `test`; insert into t1 values(6)
|
||||
master-bin.000001 # Query # # use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 # Query # # use `test`; rollback to savepoint my_savepoint
|
||||
master-bin.000001 # Query # # ROLLBACK TO my_savepoint
|
||||
master-bin.000001 # Query # # use `test`; insert into t1 values(7)
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
delete from t1;
|
||||
@ -802,7 +802,7 @@ delete from t4;
|
||||
insert into t3 values (1,1),(2,2);
|
||||
insert into t4 values (1,1),(2,2);
|
||||
reset master;
|
||||
UPDATE t3,t4 SET t3.a=t4.a + bug27417(1);
|
||||
UPDATE t3,t4 SET t3.a = t4.a + bug27417(1) where t3.a = 1;
|
||||
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
|
||||
select count(*) from t1 /* must be 1 */;
|
||||
count(*)
|
||||
|
@ -29,3 +29,14 @@ a
|
||||
6
|
||||
8
|
||||
drop table foo;
|
||||
RESET MASTER;
|
||||
create database b51226;
|
||||
use b51226;
|
||||
create temporary table t1(i int);
|
||||
use b51226;
|
||||
create temporary table t1(i int);
|
||||
create temporary table t1(i int);
|
||||
ERROR 42S01: Table 't1' already exists
|
||||
insert into t1 values(1);
|
||||
DROP DATABASE b51226;
|
||||
FLUSH LOGS;
|
||||
|
@ -40,3 +40,40 @@ commit;
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# BUG#51251
|
||||
#
|
||||
# The test case checks if truncating a temporary table created with
|
||||
# engine InnoDB will not cause the truncate statement to be binlogged.
|
||||
|
||||
# Before patch for BUG#51251, the TRUNCATE statements below would be
|
||||
# binlogged, which would cause the slave to fail with "table does not
|
||||
# exist".
|
||||
|
||||
RESET MASTER;
|
||||
|
||||
CREATE TABLE t1 ( c1 int , primary key (c1)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS t2 LIKE t1;
|
||||
TRUNCATE TABLE t2;
|
||||
DROP TABLE t1;
|
||||
|
||||
-- echo ###############################################
|
||||
-- echo ### assertion: No event for 'TRUNCATE TABLE t2'
|
||||
-- echo ###############################################
|
||||
-- source include/show_binlog_events.inc
|
||||
-- echo ###############################################
|
||||
|
||||
RESET MASTER;
|
||||
|
||||
CREATE TEMPORARY TABLE t1 (c1 int) Engine=InnoDB;
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
TRUNCATE t1;
|
||||
DROP TEMPORARY TABLE t1;
|
||||
|
||||
-- echo ###############################################
|
||||
-- echo ### assertion: No event for 'TRUNCATE TABLE t1'
|
||||
-- echo ###############################################
|
||||
-- source include/show_binlog_events.inc
|
||||
-- echo ###############################################
|
||||
|
@ -202,7 +202,7 @@ eval kill query $ID;
|
||||
rollback;
|
||||
|
||||
connection con2;
|
||||
--error 0,ER_QUERY_INTERRUPTED
|
||||
--error 0,ER_QUERY_INTERRUPTED,ER_LOCK_WAIT_TIMEOUT
|
||||
reap;
|
||||
# todo 1,2 above
|
||||
rollback;
|
||||
|
@ -82,3 +82,69 @@ select * from foo;
|
||||
|
||||
# clean up
|
||||
drop table foo;
|
||||
|
||||
#################################################################
|
||||
# BUG#51226
|
||||
#################################################################
|
||||
|
||||
RESET MASTER;
|
||||
|
||||
-- let $dbname=b51226
|
||||
|
||||
connect (con1,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||
connect (con2,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||
|
||||
#
|
||||
# action: on con1 create the database and the tmp table
|
||||
#
|
||||
-- connection con1
|
||||
-- eval create database $dbname
|
||||
-- eval use $dbname
|
||||
create temporary table t1(i int);
|
||||
|
||||
#
|
||||
# action: on con1 create the tmp table
|
||||
#
|
||||
-- connection con2
|
||||
-- eval use $dbname
|
||||
create temporary table t1(i int);
|
||||
|
||||
# action: at this point, the last event binlogged contains the
|
||||
# pseudo_thread_id from con2. So now we switch to con1, issue
|
||||
# a statement that fails and close the connection (which logs
|
||||
# implicitely a DROP TEMPORARY TABLE).
|
||||
#
|
||||
# Before the patch this would not log con1's pseudo_thread_id
|
||||
# because the failing statement would reset THD context
|
||||
# (unsetting the thread_specific_used flag, and consequently,
|
||||
# causing the DROP event to be logged without pseudo_thread_id
|
||||
# in its header).
|
||||
|
||||
-- connection con1
|
||||
-- error 1050
|
||||
create temporary table t1(i int);
|
||||
-- disconnect con1
|
||||
|
||||
-- connection default
|
||||
-- let $wait_binlog_event= DROP
|
||||
-- source include/wait_for_binlog_event.inc
|
||||
|
||||
# action: insert in the t1. This would cause the the test to fail,
|
||||
# because when replaying the binlog the previous implicit drop
|
||||
# temp table would have been executed under the wrong
|
||||
# pseudo_thread_id, dropping the tmp table on con2.
|
||||
-- connection con2
|
||||
insert into t1 values(1);
|
||||
-- disconnect con2
|
||||
|
||||
-- connection default
|
||||
-- let $wait_binlog_event= DROP
|
||||
-- source include/wait_for_binlog_event.inc
|
||||
|
||||
-- eval DROP DATABASE $dbname
|
||||
FLUSH LOGS;
|
||||
|
||||
# assertion: assert that when replaying the binary log will succeed,
|
||||
# instead of failing with "Table 'XXX.YYY' doesn't exist"
|
||||
-- let $MYSQLD_DATADIR= `select @@datadir`
|
||||
-- exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 | $MYSQL
|
||||
|
71
mysql-test/suite/engines/README
Normal file
71
mysql-test/suite/engines/README
Normal file
@ -0,0 +1,71 @@
|
||||
|
||||
|
||||
|
||||
This directory includes a set of three test suites aimed as testing functionality
|
||||
in an engine independent way, that is - the tests should work identically against
|
||||
different engines.
|
||||
|
||||
|
||||
The following suites are included:
|
||||
|
||||
1) 'funcs' suite
|
||||
-------------
|
||||
A collection of functional tests covering basic engine and server functionality that can be run
|
||||
against iany engine.
|
||||
|
||||
To run the test suite:
|
||||
cd INSTALL_DIR/mysql-test
|
||||
run: perl ./mysql-test-run.pl --suite=engines/funcs --mysqld=--default-storage-engine=<engine>
|
||||
|
||||
2) 'iuds' suite
|
||||
------------
|
||||
Similar to the above focused on insert/update/delete operations of different different data types.
|
||||
|
||||
To run the test suite:
|
||||
cd INSTALL_DIR/mysql-test
|
||||
run: perl ./mysql-test-run.pl --suite=engines/iuds --mysqld=--default-storage-engine=<engine>
|
||||
|
||||
3) 'rr_trx' suite (transactional engines only)
|
||||
--------------
|
||||
A scenario of multiple client connections verifying transactions with repeatable read isolation level
|
||||
|
||||
To run the test suite with innodb:
|
||||
cd INSTALL_DIR/mysql-test
|
||||
run: perl ./suite/engines/rr_trx/run_stress_tx_rr.pl --engine=<engine> [--duration=<nn>]
|
||||
[--threads=<nn>] [--try] [--help]
|
||||
|
||||
This test is can be run against any transactional engine. However scripts need to be modified in order
|
||||
to support such engines (current scripts support only InnoDB).
|
||||
In order to add support for a new engine, you will need to modify scripts as follows:
|
||||
1) cd to INSTALL_DIR/mysql-test/suite/engines/rr_trx
|
||||
2) Modify the 'run_stress_rr.pl' file by adding an 'elsif' section for your engine and have it
|
||||
include specific values required to be passed as startup parameters to the MySQL server by
|
||||
specifying them using "--mysqld" options (see InnoDB example).
|
||||
3) Copy the 'init_innodb.txt' file to 'init_<engine>.txt file and change its content to be "init_<engine>".
|
||||
4) In the 't' directory copy the "init_innodb.test" file to "init_<engine>.test" and change the value of
|
||||
the '$engine' variable to <engine>.
|
||||
5) In the 'r' directory copy "the init_innodb.result" file to "init_<engine>.result" and change refrences
|
||||
to 'InnoDB' to <engine>.
|
||||
|
||||
|
||||
Known Issues
|
||||
------------
|
||||
1) The folowing tests in the 'iuds' suite:
|
||||
- delete_decimal
|
||||
- insert_decimal
|
||||
- update_decimal
|
||||
will return a 'Warning 1264 - Out of range value...' warning if run in a 32-bit environment.
|
||||
Add the '--force' option to prevent the test run from aborting.
|
||||
|
||||
2) The following tests in the 'funcs' suite will fail when run against the innodb_plugin:
|
||||
- crash_manycolumns_string (bug 50495)
|
||||
- ix_unique_lob (bug 52056, masked by an 'Out of memory error' on some 32-bit platforms)
|
||||
- ix_unique_string_length (bug 52056, masked by an 'Out of memory error' on some 32-bit platforms)
|
||||
Add the '--force' option to prevent the test run from aborting.
|
||||
|
||||
3) Some of the rpl_xxx tests in the 'funcs' suite require a secific binlog_forat setting and will be
|
||||
skipped otherwise.
|
||||
|
||||
4) Some of the rpl_xxx tests in the 'funcs' suite will report a 'Statement unsafe for replication' warning
|
||||
when run againsr a server configured to use statement based replication.
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user