automerge

This commit is contained in:
Vladislav Vaintroub 2009-11-13 13:26:16 +01:00
commit 2925dcd169
214 changed files with 4900 additions and 1559 deletions

View file

@ -202,6 +202,10 @@ test-bt-fast:
-cd mysql-test ; MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl --force --comment=stress --suite=stress $(EXP)
test-bt-fast:
-cd mysql-test ; MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl --force --comment=ps --ps-protocol --report-features
test-bt-debug:
-cd mysql-test ; MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl --comment=debug --force --timer \
@ -209,6 +213,8 @@ test-bt-debug:
test-bt-debug-fast:
test-bt-debug-fast:
# Keep these for a while
test-pl: test
test-full-pl: test-full

View file

@ -1281,21 +1281,35 @@ sig_handler handle_sigint(int sig)
MYSQL *kill_mysql= NULL;
/* terminate if no query being executed, or we already tried interrupting */
if (!executing_query || interrupted_query)
/* terminate if no query being executed, or we already tried interrupting */
if (!executing_query || (interrupted_query == 2))
{
tee_fprintf(stdout, "Ctrl-C -- exit!\n");
goto err;
}
kill_mysql= mysql_init(kill_mysql);
if (!mysql_real_connect(kill_mysql,current_host, current_user, opt_password,
"", opt_mysql_port, opt_mysql_unix_port,0))
{
tee_fprintf(stdout, "Ctrl-C -- sorry, cannot connect to server to kill query, giving up ...\n");
goto err;
}
interrupted_query++;
/* mysqld < 5 does not understand KILL QUERY, skip to KILL CONNECTION */
if ((interrupted_query == 1) && (mysql_get_server_version(&mysql) < 50000))
interrupted_query= 2;
/* kill_buffer is always big enough because max length of %lu is 15 */
sprintf(kill_buffer, "KILL /*!50000 QUERY */ %lu", mysql_thread_id(&mysql));
mysql_real_query(kill_mysql, kill_buffer, strlen(kill_buffer));
sprintf(kill_buffer, "KILL %s%lu",
(interrupted_query == 1) ? "QUERY " : "",
mysql_thread_id(&mysql));
tee_fprintf(stdout, "Ctrl-C -- sending \"%s\" to server ...\n", kill_buffer);
mysql_real_query(kill_mysql, kill_buffer, (uint) strlen(kill_buffer));
mysql_close(kill_mysql);
tee_fprintf(stdout, "Query aborted by Ctrl+C\n");
interrupted_query= 1;
tee_fprintf(stdout, "Ctrl-C -- query aborted.\n");
return;

View file

@ -78,6 +78,9 @@ static const char* host = 0;
static int port= 0;
static uint my_end_arg;
static const char* sock= 0;
#ifdef HAVE_SMEM
static char *shared_memory_base_name= 0;
#endif
static const char* user = 0;
static char* pass = 0;
static char *charset= 0;
@ -992,13 +995,13 @@ static struct my_option my_long_options[] =
/* 'unspec' is not mentioned because it is just a placeholder. */
"Determine when the output statements should be base64-encoded BINLOG "
"statements: 'never' disables it and works only for binlogs without "
"row-based events; 'auto' is the default and prints base64 only when "
"necessary (i.e., for row-based events and format description events); "
"'decode-rows' suppresses BINLOG statements for row events, but does "
"not exit as an error if a row event is found, unlike 'never'; "
"'always' prints base64 whenever possible. 'always' is for debugging "
"only and should not be used in a production system. The default is "
"'auto'. --base64-output is a short form for --base64-output=always."
"row-based events; 'decode-rows' decodes row events into commented SQL "
"statements if the --verbose option is also given; 'auto' prints base64 "
"only when necessary (i.e., for row-based events and format description "
"events); 'always' prints base64 whenever possible. 'always' is for "
"debugging only and should not be used in a production system. If this "
"argument is not given, the default is 'auto'; if it is given with no "
"argument, 'always' is used."
,(uchar**) &opt_base64_output_mode_str,
(uchar**) &opt_base64_output_mode_str,
0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
@ -1077,6 +1080,12 @@ static struct my_option my_long_options[] =
{"set-charset", OPT_SET_CHARSET,
"Add 'SET NAMES character_set' to the output.", (uchar**) &charset,
(uchar**) &charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
"Base name of shared memory.", (uchar**) &shared_memory_base_name,
(uchar**) &shared_memory_base_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"short-form", 's', "Just show regular queries: no extra info and no "
"row-based events. This is for testing only, and should not be used in "
"production systems. If you want to suppress base64-output, consider "
@ -1378,6 +1387,11 @@ static Exit_status safe_connect()
if (opt_protocol)
mysql_options(mysql, MYSQL_OPT_PROTOCOL, (char*) &opt_protocol);
#ifdef HAVE_SMEM
if (shared_memory_base_name)
mysql_options(mysql, MYSQL_SHARED_MEMORY_BASE_NAME,
shared_memory_base_name);
#endif
if (!mysql_real_connect(mysql, host, user, pass, 0, port, sock, 0))
{
error("Failed on connect: %s", mysql_error(mysql));

View file

@ -81,6 +81,9 @@ enum {
static int record= 0, opt_sleep= -1;
static char *opt_db= 0, *opt_pass= 0;
const char *opt_user= 0, *opt_host= 0, *unix_sock= 0, *opt_basedir= "./";
#ifdef HAVE_SMEM
static char *shared_memory_base_name=0;
#endif
const char *opt_logdir= "";
const char *opt_include= 0, *opt_charsets_dir;
static int opt_port= 0;
@ -281,7 +284,7 @@ enum enum_commands {
Q_SEND_QUIT, Q_CHANGE_USER, Q_MKDIR, Q_RMDIR,
Q_LIST_FILES, Q_LIST_FILES_WRITE_FILE, Q_LIST_FILES_APPEND_FILE,
Q_SEND_SHUTDOWN, Q_SHUTDOWN_SERVER,
Q_MOVE_FILE,
Q_MOVE_FILE, Q_SEND_EVAL,
Q_UNKNOWN, /* Unknown command. */
Q_COMMENT, /* Comments, ignored. */
@ -376,6 +379,7 @@ const char *command_names[]=
"send_shutdown",
"shutdown_server",
"move_file",
"send_eval",
0
};
@ -4858,6 +4862,8 @@ do_handle_error:
<opts> - options to use for the connection
* SSL - use SSL if available
* COMPRESS - use compression if available
* SHM - use shared memory if available
* PIPE - use named pipe if available
*/
@ -4866,6 +4872,7 @@ void do_connect(struct st_command *command)
int con_port= opt_port;
char *con_options;
my_bool con_ssl= 0, con_compress= 0;
my_bool con_pipe= 0, con_shm= 0;
struct st_connection* con_slot;
static DYNAMIC_STRING ds_connection_name;
@ -4876,6 +4883,9 @@ void do_connect(struct st_command *command)
static DYNAMIC_STRING ds_port;
static DYNAMIC_STRING ds_sock;
static DYNAMIC_STRING ds_options;
#ifdef HAVE_SMEM
static DYNAMIC_STRING ds_shm;
#endif
const struct command_arg connect_args[] = {
{ "connection name", ARG_STRING, TRUE, &ds_connection_name, "Name of the connection" },
{ "host", ARG_STRING, TRUE, &ds_host, "Host to connect to" },
@ -4903,6 +4913,11 @@ void do_connect(struct st_command *command)
die("Illegal argument for port: '%s'", ds_port.str);
}
#ifdef HAVE_SMEM
/* Shared memory */
init_dynamic_string(&ds_shm, ds_sock.str, 0, 0);
#endif
/* Sock */
if (ds_sock.length)
{
@ -4941,6 +4956,10 @@ void do_connect(struct st_command *command)
con_ssl= 1;
else if (!strncmp(con_options, "COMPRESS", 8))
con_compress= 1;
else if (!strncmp(con_options, "PIPE", 4))
con_pipe= 1;
else if (!strncmp(con_options, "SHM", 3))
con_shm= 1;
else
die("Illegal option to connect: %.*s",
(int) (end - con_options), con_options);
@ -4993,6 +5012,31 @@ void do_connect(struct st_command *command)
}
#endif
#ifdef __WIN__
if (con_pipe)
{
uint protocol= MYSQL_PROTOCOL_PIPE;
mysql_options(&con_slot->mysql, MYSQL_OPT_PROTOCOL, &protocol);
}
#endif
#ifdef HAVE_SMEM
if (con_shm)
{
uint protocol= MYSQL_PROTOCOL_MEMORY;
if (!ds_shm.length)
die("Missing shared memory base name");
mysql_options(&con_slot->mysql, MYSQL_SHARED_MEMORY_BASE_NAME, ds_shm.str);
mysql_options(&con_slot->mysql, MYSQL_OPT_PROTOCOL, &protocol);
}
else if(shared_memory_base_name)
{
mysql_options(&con_slot->mysql, MYSQL_SHARED_MEMORY_BASE_NAME,
shared_memory_base_name);
}
#endif
/* Use default db name */
if (ds_database.length == 0)
dynstr_set(&ds_database, opt_db);
@ -5025,6 +5069,9 @@ void do_connect(struct st_command *command)
dynstr_free(&ds_port);
dynstr_free(&ds_sock);
dynstr_free(&ds_options);
#ifdef HAVE_SMEM
dynstr_free(&ds_shm);
#endif
DBUG_VOID_RETURN;
}
@ -5691,6 +5738,12 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"server-file", 'F', "Read embedded server arguments from file.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
"Base name of shared memory.", (uchar**) &shared_memory_base_name,
(uchar**) &shared_memory_base_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
0, 0, 0},
#endif
{"silent", 's', "Suppress all normal output. Synonym for --quiet.",
(uchar**) &silent, (uchar**) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-safemalloc", OPT_SKIP_SAFEMALLOC,
@ -6742,10 +6795,8 @@ void run_query_stmt(MYSQL *mysql, struct st_command *command,
MYSQL_STMT *stmt;
DYNAMIC_STRING ds_prepare_warnings;
DYNAMIC_STRING ds_execute_warnings;
ulonglong affected_rows;
DBUG_ENTER("run_query_stmt");
DBUG_PRINT("query", ("'%-.60s'", query));
LINT_INIT(affected_rows);
/*
Init a new stmt if it's not already one created for this connection
@ -6880,6 +6931,7 @@ void run_query_stmt(MYSQL *mysql, struct st_command *command,
Fetch info before fetching warnings, since it will be reset
otherwise.
*/
if (!disable_info)
append_info(ds, mysql_stmt_affected_rows(stmt), mysql_info(mysql));
@ -6894,18 +6946,17 @@ void run_query_stmt(MYSQL *mysql, struct st_command *command,
ds_warnings->length)
{
dynstr_append_mem(ds, "Warnings:\n", 10);
if (ds_warnings->length)
dynstr_append_mem(ds, ds_warnings->str,
ds_warnings->length);
if (ds_prepare_warnings.length)
dynstr_append_mem(ds, ds_prepare_warnings.str,
ds_prepare_warnings.length);
if (ds_execute_warnings.length)
dynstr_append_mem(ds, ds_execute_warnings.str,
ds_execute_warnings.length);
if (ds_warnings->length)
dynstr_append_mem(ds, ds_warnings->str,
ds_warnings->length);
if (ds_prepare_warnings.length)
dynstr_append_mem(ds, ds_prepare_warnings.str,
ds_prepare_warnings.length);
if (ds_execute_warnings.length)
dynstr_append_mem(ds, ds_execute_warnings.str,
ds_execute_warnings.length);
}
}
}
end:
@ -7006,7 +7057,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
/*
Evaluate query if this is an eval command
*/
if (command->type == Q_EVAL)
if (command->type == Q_EVAL || command->type == Q_SEND_EVAL)
{
init_dynamic_string(&eval_query, "", command->query_len+256, 1024);
do_eval(&eval_query, command->query, command->end, FALSE);
@ -7644,6 +7695,11 @@ int main(int argc, char **argv)
}
#endif
#ifdef HAVE_SMEM
if (shared_memory_base_name)
mysql_options(&con->mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name);
#endif
if (!(con->name = my_strdup("default", MYF(MY_WME))))
die("Out of memory");
@ -7825,6 +7881,7 @@ int main(int argc, char **argv)
break;
}
case Q_SEND:
case Q_SEND_EVAL:
if (!*command->first_argument)
{
/*

View file

@ -10,7 +10,7 @@ AC_CANONICAL_SYSTEM
#
# When changing major version number please also check switch statement
# in client/mysqlbinlog.cc:check_master_version().
AM_INIT_AUTOMAKE(mysql, 5.5.0-beta)
AM_INIT_AUTOMAKE(mysql, 5.6.0-beta)
AM_CONFIG_HEADER([include/config.h:config.h.in])
PROTOCOL_VERSION=10

View file

@ -27,7 +27,6 @@
#include <time.h>
#if defined(_WIN32)
#define _WIN32_WINNT 0x0400
#include <windows.h>
#include <wincrypt.h>
#else

View file

@ -432,6 +432,10 @@ typedef struct st_mi_check_param
const char *db_name, *table_name;
const char *op_name;
enum_mi_stats_method stats_method;
#ifdef THREAD
pthread_mutex_t print_msg_mutex;
my_bool need_print_msg_lock;
#endif
} MI_CHECK;
typedef struct st_sort_ft_buf

View file

@ -459,6 +459,16 @@ unsigned long STDCALL mysql_real_escape_string(MYSQL *mysql,
char *to,const char *from,
unsigned long length);
void STDCALL mysql_debug(const char *debug);
char * STDCALL mysql_odbc_escape_string(MYSQL *mysql,
char *to,
unsigned long to_length,
const char *from,
unsigned long from_length,
void *param,
char *
(*extend_buffer)
(void *, char *to,
unsigned long *length));
void STDCALL myodbc_remove_escape(MYSQL *mysql,char *name);
unsigned int STDCALL mysql_thread_safe(void);
my_bool STDCALL mysql_embedded(void);

View file

@ -474,6 +474,16 @@ unsigned long mysql_real_escape_string(MYSQL *mysql,
char *to,const char *from,
unsigned long length);
void mysql_debug(const char *debug);
char * mysql_odbc_escape_string(MYSQL *mysql,
char *to,
unsigned long to_length,
const char *from,
unsigned long from_length,
void *param,
char *
(*extend_buffer)
(void *, char *to,
unsigned long *length));
void myodbc_remove_escape(MYSQL *mysql,char *name);
unsigned int mysql_thread_safe(void);
my_bool mysql_embedded(void);

View file

@ -44,7 +44,7 @@ enum enum_vio_type
Vio* vio_new(my_socket sd, enum enum_vio_type type, uint flags);
#ifdef __WIN__
Vio* vio_new_win32pipe(HANDLE hPipe);
Vio* vio_new_win32shared_memory(NET *net,HANDLE handle_file_map,
Vio* vio_new_win32shared_memory(HANDLE handle_file_map,
HANDLE handle_map,
HANDLE event_server_wrote,
HANDLE event_server_read,
@ -221,7 +221,11 @@ struct st_vio
HANDLE event_conn_closed;
size_t shared_memory_remain;
char *shared_memory_pos;
NET *net;
#endif /* HAVE_SMEM */
#ifdef _WIN32
OVERLAPPED pipe_overlapped;
DWORD read_timeout_millis;
DWORD write_timeout_millis;
#endif
};
#endif /* vio_violite_h_ */

View file

@ -1258,6 +1258,20 @@ mysql_real_escape_string(MYSQL *mysql, char *to,const char *from,
return (uint) escape_string_for_mysql(mysql->charset, to, 0, from, length);
}
char * STDCALL
mysql_odbc_escape_string(MYSQL *mysql __attribute__((unused)),
char *to __attribute__((unused)),
ulong to_length __attribute__((unused)),
const char *from __attribute__((unused)),
ulong from_length __attribute__((unused)),
void *param __attribute__((unused)),
char * (*extend_buffer)(void *, char *, ulong *)
__attribute__((unused)))
{
return NULL;
}
void STDCALL
myodbc_remove_escape(MYSQL *mysql,char *name)
{

View file

@ -78,6 +78,7 @@ EXPORTS
mysql_next_result
mysql_num_fields
mysql_num_rows
mysql_odbc_escape_string
mysql_options
mysql_stmt_param_count
mysql_stmt_param_metadata

View file

@ -48,6 +48,7 @@ EXPORTS
mysql_next_result
mysql_num_fields
mysql_num_rows
mysql_odbc_escape_string
mysql_options
mysql_ping
mysql_query

View file

@ -6,8 +6,6 @@ binlog.binlog_multi_engine # joro : NDB tests marked as experiment
funcs_1.charset_collation_1 # depends on compile-time decisions
innodb.innodb_information_schema # Bug#47449 2009-09-19 alik main.information_schema and innodb.innodb_information_schema fail sporadically
main.ctype_gbk_binlog @solaris # Bug#46010: main.ctype_gbk_binlog fails sporadically : Table 't2' already exists
main.information_schema # Bug#47449 2009-09-19 alik main.information_schema and innodb.innodb_information_schema fail sporadically
main.innodb-autoinc* # Bug#47809 2009-10-04 joro innodb-autoinc.test fails with valgrind errors with the innodb plugin
@ -17,11 +15,12 @@ main.log_tables # Bug#47924 2009-10-08 alik main.log_ta
main.plugin # Bug#47146 Linking problem with example plugin when dtrace enabled
main.plugin_load # Bug#47146
rpl.rpl_cross_version* # Bug #43913 2009-10-26 joro rpl_cross_version can't pass on conflicts complainig clash with --slave-load-tm
rpl.rpl_innodb_bug28430* # Bug#46029
rpl.rpl_innodb_bug30888* @solaris # Bug#47646 2009-09-25 alik rpl.rpl_innodb_bug30888 fails sporadically on Solaris
rpl.rpl_log_pos* # Bug#47743 2009-10-02 alik rpl.rpl_log_pos fails sporadically
rpl.rpl_plugin_load* @solaris # Bug#47146
rpl.rpl_row_create_table* # Bug#45576: rpl_row_create_table fails on PB2
rpl.rpl_log_pos* # Bug#47743 2009-10-02 alik rpl.rpl_log_pos fails sporadically
rpl.rpl_timezone* # Bug#47017 2009-10-27 alik rpl_timezone fails on PB-2 with mismatch error
rpl.rpl_trigger* # Bug#46656 2009-09-25 alik InnoDB plugin: memory leaks (Valgrind)
rpl.rpl_heartbeat_basic # BUG#43828 2009-10-22 luis fails sporadically

View file

@ -48,6 +48,16 @@ DROP TABLE IF EXISTS tmp2, t;
--enable_warnings
SELECT GET_LOCK("a",10);
#
# BUG48216 Replication fails on all slaves after upgrade to 5.0.86 on master
#
# When the session is closed, any temporary tables of the session are dropped
# and are binlogged. But it will be binlogged with a wrong database name when
# the length of the database name('drop-temp-table-test') is greater than the
# current database name('test').
#
USE test;
disconnect con1;
connection con2;

View file

@ -158,4 +158,65 @@ LOAD DATA INFILE "../../std_data/words.dat" INTO TABLE t1;
DROP TABLE IF EXISTS t1;
# BUG#48297: Schema name is ignored when LOAD DATA is written into binlog,
# replication aborts
-- source include/master-slave-reset.inc
-- let $db1= b48297_db1
-- let $db2= b42897_db2
-- connection master
-- disable_warnings
-- eval drop database if exists $db1
-- eval drop database if exists $db2
-- enable_warnings
-- eval create database $db1
-- eval create database $db2
-- eval use $db1
-- eval CREATE TABLE t1 (c1 VARCHAR(256)) engine=$engine_type;
-- eval use $db2
-- echo ### assertion: works with cross-referenced database
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-- eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE $db1.t1
-- eval use $db1
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-- echo ### assertion: works with fully qualified name on current database
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-- eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE $db1.t1
-- echo ### assertion: works without fully qualified name on current database
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-- eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE t1
-- echo ### create connection without default database
-- echo ### connect (conn2,localhost,root,,*NO-ONE*);
connect (conn2,localhost,root,,*NO-ONE*);
-- connection conn2
-- echo ### assertion: works without stating the default database
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-- eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE $db1.t1
-- echo ### disconnect and switch back to master connection
-- disconnect conn2
-- connection master
-- sync_slave_with_master
-- eval use $db1
let $diff_table_1=master:$db1.t1;
let $diff_table_2=slave:$db1.t1;
source include/diff_tables.inc;
-- connection master
-- eval DROP DATABASE $db1
-- eval DROP DATABASE $db2
-- sync_slave_with_master
# End of 4.1 tests

View file

@ -93,7 +93,7 @@ kill @id;
# We don't drop t3 as this is a temporary table
drop table t2;
connection master;
--error 1053,2013
--error 1317,2013
reap;
connection slave;
# The SQL slave thread should now have stopped because the query was killed on

View file

@ -0,0 +1,4 @@
--require r/case_insensitive_fs.require
--disable_query_log
show variables like 'lower_case_file_system';
--enable_query_log

View file

@ -7,6 +7,7 @@ use Carp;
use My::Config;
use My::Find;
use My::Platform;
use File::Basename;
@ -150,8 +151,9 @@ sub fix_secure_file_priv {
sub fix_std_data {
my ($self, $config, $group_name, $group)= @_;
my $basedir= $self->get_basedir($group);
return "$basedir/mysql-test/std_data";
return my_find_dir($self->get_basedir($group),
["share/mysql-test", "mysql-test"],
"std_data");
}
sub ssl_supported {
@ -227,7 +229,13 @@ my @mysqld_rules=
{ 'ssl-key' => \&fix_ssl_server_key },
);
if (IS_WINDOWS)
{
# For simplicity, we use the same names for shared memory and
# named pipes.
push(@mysqld_rules, {'shared-memory-base-name' => \&fix_socket});
}
sub fix_ndb_mgmd_port {
my ($self, $config, $group_name, $group)= @_;
my $hostname= $group->value('HostName');
@ -356,6 +364,16 @@ sub post_check_client_group {
}
$config->insert($client_group_name, $name_to, $option->value())
}
if (IS_WINDOWS)
{
# Shared memory base may or may not be defined (e.g not defined in embedded)
my $shm = $group_to_copy_from->option("shared-memory-base-name");
if (defined $shm)
{
$config->insert($client_group_name,"shared-memory-base-name", $shm->value());
}
}
}
@ -402,6 +420,7 @@ sub post_check_embedded_group {
(
'#log-error', # Embedded server writes stderr to mysqltest's log file
'slave-net-timeout', # Embedded server are not build with replication
'shared-memory-base-name', # No shared memory for embedded
);
foreach my $option ( $mysqld->options(), $first_mysqld->options() ) {

View file

@ -50,9 +50,6 @@
is killed.
*/
/* Requires Windows 2000 or higher */
#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <stdio.h>
#include <tlhelp32.h>

View file

@ -1330,6 +1330,14 @@ ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','a0','xx','a5','a6','a7','a8','a9',
affected rows: 2
info: Records: 2 Duplicates: 0 Warnings: 0
DROP TABLE t1;
CREATE TABLE t1 (f1 TIMESTAMP NULL DEFAULT NULL,
f2 INT(11) DEFAULT NULL) ENGINE=MYISAM DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES (NULL, NULL), ("2009-10-09 11:46:19", 2);
this should affect no rows as there is no real change
ALTER TABLE t1 CHANGE COLUMN f1 f1_no_real_change TIMESTAMP NULL DEFAULT NULL;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
DROP TABLE t1;
End of 5.1 tests
CREATE TABLE t1(c CHAR(10),
i INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY);

View file

@ -19,81 +19,10 @@ test.t1.empty_string 0 0 4 0 0.0000 NULL CHAR(0) NOT NULL
test.t1.bool N Y 1 1 0 0 1.0000 NULL ENUM('N','Y') NOT NULL
test.t1.d 2002-03-03 2002-03-05 10 10 0 0 10.0000 NULL ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
create table t2 select * from t1 procedure analyse();
select * from t2;
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
test.t1.i 1 7 1 1 0 0 4.0000 2.2361 ENUM('1','3','5','7') NOT NULL
test.t1.j 2 8 1 1 0 0 5.0000 2.2361 ENUM('2','4','6','8') NOT NULL
test.t1.empty_string 0 0 4 0 0.0000 NULL CHAR(0) NOT NULL
test.t1.bool N Y 1 1 0 0 1.0000 NULL ENUM('N','Y') NOT NULL
test.t1.d 2002-03-03 2002-03-05 10 10 0 0 10.0000 NULL ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
drop table t1,t2;
ERROR HY000: Incorrect usage of PROCEDURE and non-SELECT
drop table t1;
EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE();
ERROR HY000: Incorrect usage of PROCEDURE and subquery
create table t1 (a int not null);
create table t2 select * from t1 where 0=1 procedure analyse();
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`Field_name` varbinary(255) NOT NULL DEFAULT '',
`Min_value` varbinary(255) DEFAULT NULL,
`Max_value` varbinary(255) DEFAULT NULL,
`Min_length` bigint(11) NOT NULL DEFAULT '0',
`Max_length` bigint(11) NOT NULL DEFAULT '0',
`Empties_or_zeros` bigint(11) NOT NULL DEFAULT '0',
`Nulls` bigint(11) NOT NULL DEFAULT '0',
`Avg_value_or_avg_length` varbinary(255) NOT NULL DEFAULT '',
`Std` varbinary(255) DEFAULT NULL,
`Optimal_fieldtype` varbinary(64) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t1 where 0=1 procedure analyse();
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
insert into t1 values(1);
drop table t2;
create table t2 select * from t1 where 0=1 procedure analyse();
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`Field_name` varbinary(255) NOT NULL DEFAULT '',
`Min_value` varbinary(255) DEFAULT NULL,
`Max_value` varbinary(255) DEFAULT NULL,
`Min_length` bigint(11) NOT NULL DEFAULT '0',
`Max_length` bigint(11) NOT NULL DEFAULT '0',
`Empties_or_zeros` bigint(11) NOT NULL DEFAULT '0',
`Nulls` bigint(11) NOT NULL DEFAULT '0',
`Avg_value_or_avg_length` varbinary(255) NOT NULL DEFAULT '',
`Std` varbinary(255) DEFAULT NULL,
`Optimal_fieldtype` varbinary(64) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t2;
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
insert into t2 select * from t1 procedure analyse();
select * from t2;
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
test.t1.a 1 1 1 1 0 0 1.0000 0.0000 ENUM('1') NOT NULL
insert into t1 values(2);
drop table t2;
create table t2 select * from t1 where 0=1 procedure analyse();
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`Field_name` varbinary(255) NOT NULL DEFAULT '',
`Min_value` varbinary(255) DEFAULT NULL,
`Max_value` varbinary(255) DEFAULT NULL,
`Min_length` bigint(11) NOT NULL DEFAULT '0',
`Max_length` bigint(11) NOT NULL DEFAULT '0',
`Empties_or_zeros` bigint(11) NOT NULL DEFAULT '0',
`Nulls` bigint(11) NOT NULL DEFAULT '0',
`Avg_value_or_avg_length` varbinary(255) NOT NULL DEFAULT '',
`Std` varbinary(255) DEFAULT NULL,
`Optimal_fieldtype` varbinary(64) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t2;
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
insert into t2 select * from t1 procedure analyse();
select * from t2;
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
test.t1.a 1 2 1 1 0 0 1.5000 0.5000 ENUM('1','2') NOT NULL
drop table t1,t2;
create table t1 (v varchar(128));
insert into t1 values ('abc'),('abc\'def\\hij\"klm\0opq'),('\''),('\"'),('\\'),('a\0'),('b\''),('c\"'),('d\\'),('\'b'),('\"c'),('\\d'),('a\0\0\0b'),('a\'\'\'\'b'),('a\"\"\"\"b'),('a\\\\\\\\b'),('\'\0\\\"'),('\'\''),('\"\"'),('\\\\'),('The\ZEnd');
select * from t1 procedure analyse();
@ -157,3 +86,40 @@ SELECT * FROM (SELECT * FROM t1) d PROCEDURE ANALYSE();
ERROR HY000: Incorrect usage of PROCEDURE and subquery
DROP TABLE t1;
End of 4.1 tests
#
# Bug #48293: crash with procedure analyse, view with > 10 columns,
# having clause...
#
CREATE TABLE t1(a INT, b INT, c INT, d INT, e INT,
f INT, g INT, h INT, i INT, j INT,k INT);
INSERT INTO t1 VALUES (),();
CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
#should have a derived table
EXPLAIN SELECT * FROM v1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
2 DERIVED t1 ALL NULL NULL NULL NULL 2
#should not crash
SELECT * FROM v1 PROCEDURE analyse();
ERROR HY000: Incorrect usage of PROCEDURE and view
#should not crash
SELECT * FROM t1 a, v1, t1 b PROCEDURE analyse();
ERROR HY000: Incorrect usage of PROCEDURE and view
#should not crash
SELECT * FROM (SELECT * FROM t1 having a > 1) x PROCEDURE analyse();
ERROR HY000: Incorrect usage of PROCEDURE and subquery
#should not crash
SELECT * FROM t1 a, (SELECT * FROM t1 having a > 1) x, t1 b PROCEDURE analyse();
ERROR HY000: Incorrect usage of PROCEDURE and subquery
#should not crash
SELECT 1 FROM t1 group by a having a > 1 order by 1 PROCEDURE analyse();
ERROR HY000: Can't use ORDER clause with this procedure
DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1),(2);
# should not crash
CREATE TABLE t2 SELECT 1 FROM t1, t1 t3 GROUP BY t3.a PROCEDURE ANALYSE();
ERROR HY000: Incorrect usage of PROCEDURE and non-SELECT
DROP TABLE t1;
End of 5.0 tests

View file

@ -1,29 +0,0 @@
#
# Bug #40113: Embedded SELECT inside UPDATE or DELETE can timeout
# without error
#
CREATE TABLE t1 (a int, b int, PRIMARY KEY (a,b)) ENGINE=InnoDB;
INSERT INTO t1 (a,b) VALUES (1070109,99);
CREATE TABLE t2 (b int, a int, PRIMARY KEY (b)) ENGINE=InnoDB;
INSERT INTO t2 (b,a) VALUES (7,1070109);
SELECT * FROM t1;
a b
1070109 99
BEGIN;
SELECT b FROM t2 WHERE b=7 FOR UPDATE;
b
7
BEGIN;
SELECT b FROM t2 WHERE b=7 FOR UPDATE;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
INSERT INTO t1 (a) VALUES ((SELECT a FROM t2 WHERE b=7));
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
UPDATE t1 SET a='7000000' WHERE a=(SELECT a FROM t2 WHERE b=7);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
DELETE FROM t1 WHERE a=(SELECT a FROM t2 WHERE b=7);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SELECT * FROM t1;
a b
1070109 99
DROP TABLE t2, t1;
End of 5.0 tests

View file

@ -0,0 +1,2 @@
Variable_name Value
lower_case_file_system ON

View file

@ -548,6 +548,36 @@ SELECT * FROM t1 WHERE s2 = s3;
s1 s2 s3
a A A
DROP TABLE t1;
create table t1 (a varchar(1) character set latin1 collate latin1_general_ci);
insert into t1 values ('A'),('a'),('B'),('b'),('C'),('c');
select * from t1 where a > 'B' collate latin1_bin;
a
a
b
C
c
select * from t1 where a <> 'B' collate latin1_bin;
a
A
a
b
C
c
create index i on t1 (a);
select * from t1 where a > 'B' collate latin1_bin;
a
a
b
C
c
select * from t1 where a <> 'B' collate latin1_bin;
a
A
a
b
C
c
drop table t1;
SET NAMES latin1;
CREATE TABLE t1
(s1 char(10) COLLATE latin1_german1_ci,

Binary file not shown.

View file

@ -195,6 +195,22 @@ 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
#
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;
#
# Bug#30302: Tables that were optimized away are printed in the
# EXPLAIN EXTENDED warning.
#

View file

@ -1487,4 +1487,43 @@ MBRINTERSECTS(b, GEOMFROMTEXT('LINESTRING(1 1,1102219 2)') );
COUNT(*)
2
DROP TABLE t1;
#
# Bug #48258: Assertion failed when using a spatial index
#
CREATE TABLE t1(a LINESTRING NOT NULL, SPATIAL KEY(a));
INSERT INTO t1 VALUES
(GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)')),
(GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)'));
EXPLAIN SELECT 1 FROM t1 WHERE a = GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL a NULL NULL NULL 2 Using where
SELECT 1 FROM t1 WHERE a = GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
1
1
1
EXPLAIN SELECT 1 FROM t1 WHERE a < GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL a NULL NULL NULL 2 Using where
SELECT 1 FROM t1 WHERE a < GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
1
EXPLAIN SELECT 1 FROM t1 WHERE a <= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL a NULL NULL NULL 2 Using where
SELECT 1 FROM t1 WHERE a <= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
1
1
1
EXPLAIN SELECT 1 FROM t1 WHERE a > GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL a NULL NULL NULL 2 Using where
SELECT 1 FROM t1 WHERE a > GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
1
EXPLAIN SELECT 1 FROM t1 WHERE a >= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL a NULL NULL NULL 2 Using where
SELECT 1 FROM t1 WHERE a >= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
1
1
1
DROP TABLE t1;
End of 5.0 tests.

View file

@ -972,6 +972,18 @@ select min(`col002`) from t1 union select `col002` from t1;
min(`col002`)
NULL
drop table t1;
#
# Bug #47780: crash when comparing GIS items from subquery
#
CREATE TABLE t1(a INT, b MULTIPOLYGON);
INSERT INTO t1 VALUES
(0,
GEOMFROMTEXT(
'multipolygon(((1 2,3 4,5 6,7 8,9 8),(7 6,5 4,3 2,1 2,3 4)))'));
# must not crash
SELECT 1 FROM t1 WHERE a <> (SELECT GEOMETRYCOLLECTIONFROMWKB(b) FROM t1);
1
DROP TABLE t1;
End of 5.0 tests
create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime);
create view v1 as select * from t1;

View file

@ -1008,8 +1008,8 @@ DROP TABLE mysqltest1.t2;
SHOW GRANTS;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT SELECT, INSERT, CREATE, DROP, ALTER ON `mysqltest1`.`t2` TO 'mysqltest_1'@'localhost'
GRANT SELECT, INSERT, CREATE, DROP, ALTER ON `mysqltest1`.`t1` TO 'mysqltest_1'@'localhost'
GRANT SELECT, INSERT, CREATE, DROP, ALTER ON `mysqltest1`.`t2` TO 'mysqltest_1'@'localhost'
RENAME TABLE t1 TO t2;
RENAME TABLE t2 TO t1;
ALTER TABLE t1 RENAME TO t2;
@ -1019,8 +1019,8 @@ REVOKE DROP, INSERT ON mysqltest1.t2 FROM mysqltest_1@localhost;
SHOW GRANTS;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT SELECT, CREATE, ALTER ON `mysqltest1`.`t2` TO 'mysqltest_1'@'localhost'
GRANT SELECT, CREATE, ALTER ON `mysqltest1`.`t1` TO 'mysqltest_1'@'localhost'
GRANT SELECT, CREATE, ALTER ON `mysqltest1`.`t2` TO 'mysqltest_1'@'localhost'
RENAME TABLE t1 TO t2;
ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 't1'
ALTER TABLE t1 RENAME TO t2;

View file

@ -154,4 +154,42 @@ SELECT * FROM mysqltest_1.t1;
a
DROP USER 'mysqltest1'@'%';
DROP DATABASE mysqltest_1;
#
# Bug#41597 - After rename of user, there are additional grants
# when grants are reapplied.
#
CREATE DATABASE temp;
CREATE TABLE temp.t1(a INT, b VARCHAR(10));
INSERT INTO temp.t1 VALUES(1, 'name1');
INSERT INTO temp.t1 VALUES(2, 'name2');
INSERT INTO temp.t1 VALUES(3, 'name3');
CREATE USER 'user1'@'%';
RENAME USER 'user1'@'%' TO 'user2'@'%';
# Show privileges after rename and BEFORE grant
SHOW GRANTS FOR 'user2'@'%';
Grants for user2@%
GRANT USAGE ON *.* TO 'user2'@'%'
GRANT SELECT (a), INSERT (b) ON `temp`.`t1` TO 'user2'@'%';
# Show privileges after rename and grant
SHOW GRANTS FOR 'user2'@'%';
Grants for user2@%
GRANT USAGE ON *.* TO 'user2'@'%'
GRANT SELECT (a), INSERT (b) ON `temp`.`t1` TO 'user2'@'%'
# Connect as the renamed user
SHOW GRANTS;
Grants for user2@%
GRANT USAGE ON *.* TO 'user2'@'%'
GRANT SELECT (a), INSERT (b) ON `temp`.`t1` TO 'user2'@'%'
SELECT a FROM temp.t1;
a
1
2
3
# Check for additional privileges by accessing a
# non privileged column. We shouldn't be able to
# access this column.
SELECT b FROM temp.t1;
ERROR 42000: SELECT command denied to user 'user2'@'localhost' for column 'b' in table 't1'
DROP USER 'user2'@'%';
DROP DATABASE temp;
End of 5.0 tests

View file

@ -0,0 +1,16 @@
create database db1;
GRANT CREATE ON db1.* to user_1@localhost;
GRANT SELECT ON db1.* to USER_1@localhost;
CREATE TABLE t1(f1 int);
SELECT * FROM t1;
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't1'
SELECT * FROM t1;
f1
CREATE TABLE t2(f1 int);
ERROR 42000: CREATE command denied to user 'USER_1'@'localhost' for table 't2'
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM USER_1@localhost;
DROP USER user_1@localhost;
DROP USER USER_1@localhost;
DROP DATABASE db1;
use test;

View file

@ -867,6 +867,7 @@ INSERT INTO t2 SELECT NULL FROM t1;
Got one of the listed errors
DROP TABLE t1;
DROP TABLE t2;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (null);
INSERT INTO t1 VALUES (null);
@ -874,18 +875,254 @@ ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT;
SELECT * FROM t1;
d1
1
3
2
SELECT * FROM t1;
d1
1
3
2
INSERT INTO t1 VALUES(null);
Got one of the listed errors
ALTER TABLE t1 AUTO_INCREMENT = 3;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`d1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`d1`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES(null);
SELECT * FROM t1;
d1
1
2
3
4
DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SHOW VARIABLES LIKE "%auto_inc%";
Variable_name Value
auto_increment_increment 1
auto_increment_offset 1
CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (-1, 'innodb');
INSERT INTO t1 VALUES (-127, 'innodb');
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` tinyint(4) NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
SELECT * FROM t1;
c1 c2
-127 innodb
-1 innodb
1 NULL
2 NULL
DROP TABLE t1;
CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (-1, 'innodb');
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
INSERT INTO t1 VALUES (-127, 'innodb');
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
SELECT * FROM t1;
c1 c2
1 NULL
2 innodb
3 innodb
4 NULL
DROP TABLE t1;
CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (-1, 'innodb');
INSERT INTO t1 VALUES (-32767, 'innodb');
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` smallint(6) NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
SELECT * FROM t1;
c1 c2
-32767 innodb
-1 innodb
1 NULL
2 NULL
DROP TABLE t1;
CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (-1, 'innodb');
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
INSERT INTO t1 VALUES (-32757, 'innodb');
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
SELECT * FROM t1;
c1 c2
1 NULL
2 innodb
3 innodb
4 NULL
DROP TABLE t1;
CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (-1, 'innodb');
INSERT INTO t1 VALUES (-8388607, 'innodb');
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` mediumint(9) NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
SELECT * FROM t1;
c1 c2
-8388607 innodb
-1 innodb
1 NULL
2 NULL
DROP TABLE t1;
CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (-1, 'innodb');
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
INSERT INTO t1 VALUES (-8388607, 'innodb');
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
SELECT * FROM t1;
c1 c2
1 NULL
2 innodb
3 innodb
4 NULL
DROP TABLE t1;
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (-1, 'innodb');
INSERT INTO t1 VALUES (-2147483647, 'innodb');
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
SELECT * FROM t1;
c1 c2
-2147483647 innodb
-1 innodb
1 NULL
2 NULL
DROP TABLE t1;
CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (-1, 'innodb');
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
INSERT INTO t1 VALUES (-2147483647, 'innodb');
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(10) unsigned NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
SELECT * FROM t1;
c1 c2
1 NULL
2 innodb
3 innodb
4 NULL
DROP TABLE t1;
CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (-1, 'innodb');
INSERT INTO t1 VALUES (-9223372036854775807, 'innodb');
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` bigint(20) NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
SELECT * FROM t1;
c1 c2
-9223372036854775807 innodb
-1 innodb
1 NULL
2 NULL
DROP TABLE t1;
CREATE TABLE t1 (c1 BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (-1, 'innodb');
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
INSERT INTO t1 VALUES (-9223372036854775807, 'innodb');
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
SELECT * FROM t1;
c1 c2
1 NULL
2 innodb
3 innodb
4 NULL
DROP TABLE t1;
CREATE TABLE T1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB;
CREATE INDEX i1 on T1(c2);
SHOW CREATE TABLE T1;
Table Create Table
T1 CREATE TABLE `T1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `i1` (`c2`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1
INSERT INTO T1 (c2) values (0);
SELECT * FROM T1;
c1 c2
10 0
DROP TABLE T1;

View file

@ -1,17 +1,19 @@
create table bug46000(`id` int,key `GEN_CLUST_INDEX`(`id`))engine=innodb;
ERROR HY000: Can't create table 'test.bug46000' (errno: -1)
ERROR 42000: Incorrect index name 'GEN_CLUST_INDEX'
create table bug46000(`id` int, key `GEN_clust_INDEX`(`id`))engine=innodb;
ERROR HY000: Can't create table 'test.bug46000' (errno: -1)
show errors;
ERROR 42000: Incorrect index name 'GEN_CLUST_INDEX'
show warnings;
Level Code Message
Error 1005 Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index.
Warning 1280 Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index.
Error 1280 Incorrect index name 'GEN_CLUST_INDEX'
Error 1005 Can't create table 'test.bug46000' (errno: -1)
create table bug46000(id int) engine=innodb;
create index GEN_CLUST_INDEX on bug46000(id);
ERROR HY000: Can't create table '#sql-temporary' (errno: -1)
show errors;
ERROR 42000: Incorrect index name 'GEN_CLUST_INDEX'
show warnings;
Level Code Message
Error 1005 Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index.
Error 1005 Can't create table '#sql-temporary' (errno: -1)
Warning 1280 Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index.
Error 1280 Incorrect index name 'GEN_CLUST_INDEX'
Error 1030 Got error -1 from storage engine
create index idx on bug46000(id);
drop table bug46000;

View file

@ -0,0 +1,13 @@
create table bug47777(c2 linestring not null, primary key (c2(1))) engine=innodb;
insert into bug47777 values (geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)'));
select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
count(*)
1
update bug47777 set c2=GeomFromText('POINT(1 1)');
select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
count(*)
0
select count(*) from bug47777 where c2 = GeomFromText('POINT(1 1)');
count(*)
1
drop table bug47777;

View file

@ -0,0 +1,357 @@
#
# Bug #40113: Embedded SELECT inside UPDATE or DELETE can timeout
# without error
#
CREATE TABLE t1 (a int, b int, PRIMARY KEY (a,b)) ENGINE=InnoDB;
INSERT INTO t1 (a,b) VALUES (1070109,99);
CREATE TABLE t2 (b int, a int, PRIMARY KEY (b)) ENGINE=InnoDB;
INSERT INTO t2 (b,a) VALUES (7,1070109);
SELECT * FROM t1;
a b
1070109 99
BEGIN;
SELECT b FROM t2 WHERE b=7 FOR UPDATE;
b
7
BEGIN;
SELECT b FROM t2 WHERE b=7 FOR UPDATE;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
INSERT INTO t1 (a) VALUES ((SELECT a FROM t2 WHERE b=7));
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
UPDATE t1 SET a='7000000' WHERE a=(SELECT a FROM t2 WHERE b=7);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
DELETE FROM t1 WHERE a=(SELECT a FROM t2 WHERE b=7);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SELECT * FROM t1;
a b
1070109 99
DROP TABLE t2, t1;
# End of 5.0 tests
#
# Bug#46539 Various crashes on INSERT IGNORE SELECT + SELECT
# FOR UPDATE
#
drop table if exists t1;
create table t1 (a int primary key auto_increment,
b int, index(b)) engine=innodb;
insert into t1 (b) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
set autocommit=0;
begin;
select * from t1 where b=5 for update;
a b
5 5
insert ignore into t1 (b) select a as b from t1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
# Cleanup
#
commit;
set autocommit=default;
drop table t1;
#
# Bug#41756 Strange error messages about locks from InnoDB
#
drop table if exists t1;
# In the default transaction isolation mode, and/or with
# innodb_locks_unsafe_for_binlog=OFF, handler::unlock_row()
# in InnoDB does nothing.
# Thus in order to reproduce the condition that led to the
# warning, one needs to relax isolation by either
# setting a weaker tx_isolation value, or by turning on
# the unsafe replication switch.
# For testing purposes, choose to tweak the isolation level,
# since it's settable at runtime, unlike
# innodb_locks_unsafe_for_binlog, which is
# only a command-line switch.
#
set @@session.tx_isolation="read-committed";
# Prepare data. We need a table with a unique index,
# for join_read_key to be used. The other column
# allows to control what passes WHERE clause filter.
create table t1 (a int primary key, b int) engine=innodb;
# Let's make sure t1 has sufficient amount of rows
# to exclude JT_ALL access method when reading it,
# i.e. make sure that JT_EQ_REF(a) is always preferred.
insert into t1 values (1,1), (2,null), (3,1), (4,1),
(5,1), (6,1), (7,1), (8,1), (9,1), (10,1),
(11,1), (12,1), (13,1), (14,1), (15,1),
(16,1), (17,1), (18,1), (19,1), (20,1);
#
# Demonstrate that for the SELECT statement
# used later in the test JT_EQ_REF access method is used.
#
explain
select 1 from t1 natural join (select 2 as a, 1 as b union all
select 2 as a, 2 as b) as t2 for update;
id 1
select_type PRIMARY
table <derived2>
type ALL
possible_keys NULL
key NULL
key_len NULL
ref NULL
rows 2
Extra
id 1
select_type PRIMARY
table t1
type eq_ref
possible_keys PRIMARY
key PRIMARY
key_len 4
ref t2.a
rows 1
Extra Using where
id 2
select_type DERIVED
table NULL
type NULL
possible_keys NULL
key NULL
key_len NULL
ref NULL
rows NULL
Extra No tables used
id 3
select_type UNION
table NULL
type NULL
possible_keys NULL
key NULL
key_len NULL
ref NULL
rows NULL
Extra No tables used
id NULL
select_type UNION RESULT
table <union2,3>
type ALL
possible_keys NULL
key NULL
key_len NULL
ref NULL
rows NULL
Extra
#
# Demonstrate that the reported SELECT statement
# no longer produces warnings.
#
select 1 from t1 natural join (select 2 as a, 1 as b union all
select 2 as a, 2 as b) as t2 for update;
1
commit;
#
# Demonstrate that due to lack of inter-sweep "reset" function,
# we keep some non-matching records locked, even though we know
# we could unlock them.
# To do that, show that if there is only one distinct value
# for a in t2 (a=2), we will keep record (2,null) in t1 locked.
# But if we add another value for "a" to t2, say 6,
# join_read_key cache will be pruned at least once,
# and thus record (2, null) in t1 will get unlocked.
#
begin;
select 1 from t1 natural join (select 2 as a, 1 as b union all
select 2 as a, 2 as b) as t2 for update;
1
#
# Switching to connection con1
# We should be able to delete all records from t1 except (2, null),
# since they were not locked.
begin;
# Delete in series of 3 records so that full scan
# is not used and we're not blocked on record (2,null)
delete from t1 where a in (1,3,4);
delete from t1 where a in (5,6,7);
delete from t1 where a in (8,9,10);
delete from t1 where a in (11,12,13);
delete from t1 where a in (14,15,16);
delete from t1 where a in (17,18);
delete from t1 where a in (19,20);
#
# Record (2, null) is locked. This is actually unnecessary,
# because the previous select returned no rows.
# Just demonstrate the effect.
#
delete from t1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
rollback;
#
# Switching to connection default
#
# Show that the original contents of t1 is intact:
select * from t1;
a b
1 1
2 NULL
3 1
4 1
5 1
6 1
7 1
8 1
9 1
10 1
11 1
12 1
13 1
14 1
15 1
16 1
17 1
18 1
19 1
20 1
commit;
#
# Have a one more record in t2 to show that
# if join_read_key cache is purned, the current
# row under the cursor is unlocked (provided, this row didn't
# match the partial WHERE clause, of course).
# Sic: the result of this test dependent on the order of retrieval
# of records --echo # from the derived table, if !
# We use DELETE to disable the JOIN CACHE. This DELETE modifies no
# records. It also should leave no InnoDB row locks.
#
begin;
delete t1.* from t1 natural join (select 2 as a, 2 as b union all
select 0 as a, 0 as b) as t2;
# Demonstrate that nothing was deleted form t1
select * from t1;
a b
1 1
2 NULL
3 1
4 1
5 1
6 1
7 1
8 1
9 1
10 1
11 1
12 1
13 1
14 1
15 1
16 1
17 1
18 1
19 1
20 1
#
# Switching to connection con1
begin;
# Since there is another distinct record in the derived table
# the previous matching record in t1 -- (2,null) -- was unlocked.
delete from t1;
# We will need the contents of the table again.
rollback;
select * from t1;
a b
1 1
2 NULL
3 1
4 1
5 1
6 1
7 1
8 1
9 1
10 1
11 1
12 1
13 1
14 1
15 1
16 1
17 1
18 1
19 1
20 1
commit;
#
# Switching to connection default
rollback;
begin;
#
# Before this patch, we could wrongly unlock a record
# that was cached and later used in a join. Demonstrate that
# this is no longer the case.
# Sic: this test is also order-dependent (i.e. the
# the bug would show up only if the first record in the union
# is retreived and processed first.
#
# Verify that JT_EQ_REF is used.
explain
select 1 from t1 natural join (select 3 as a, 2 as b union all
select 3 as a, 1 as b) as t2 for update;
id 1
select_type PRIMARY
table <derived2>
type ALL
possible_keys NULL
key NULL
key_len NULL
ref NULL
rows 2
Extra
id 1
select_type PRIMARY
table t1
type eq_ref
possible_keys PRIMARY
key PRIMARY
key_len 4
ref t2.a
rows 1
Extra Using where
id 2
select_type DERIVED
table NULL
type NULL
possible_keys NULL
key NULL
key_len NULL
ref NULL
rows NULL
Extra No tables used
id 3
select_type UNION
table NULL
type NULL
possible_keys NULL
key NULL
key_len NULL
ref NULL
rows NULL
Extra No tables used
id NULL
select_type UNION RESULT
table <union2,3>
type ALL
possible_keys NULL
key NULL
key_len NULL
ref NULL
rows NULL
Extra
# Lock the record.
select 1 from t1 natural join (select 3 as a, 2 as b union all
select 3 as a, 1 as b) as t2 for update;
1
1
# Switching to connection con1
#
# We should not be able to delete record (3,1) from t1,
# (previously it was possible).
#
delete from t1 where a=3;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
# Switching to connection default
commit;
set @@session.tx_isolation=default;
drop table t1;
#
# End of 5.1 tests
#

View file

@ -2209,6 +2209,48 @@ EXPLAIN SELECT * FROM t1 FORCE INDEX(PRIMARY) WHERE b=1 AND c=1 ORDER BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 128 Using where
DROP TABLE t1;
#
# Bug #47963: Wrong results when index is used
#
CREATE TABLE t1(
a VARCHAR(5) NOT NULL,
b VARCHAR(5) NOT NULL,
c DATETIME NOT NULL,
KEY (c)
) ENGINE=InnoDB;
INSERT INTO t1 VALUES('TEST', 'TEST', '2009-10-09 00:00:00');
SELECT * FROM t1 WHERE a = 'TEST' AND
c >= '2009-10-09 00:00:00' AND c <= '2009-10-09 00:00:00';
a b c
TEST TEST 2009-10-09 00:00:00
SELECT * FROM t1 WHERE a = 'TEST' AND
c >= '2009-10-09 00:00:00.0' AND c <= '2009-10-09 00:00:00.0';
a b c
TEST TEST 2009-10-09 00:00:00
SELECT * FROM t1 WHERE a = 'TEST' AND
c >= '2009-10-09 00:00:00.0' AND c <= '2009-10-09 00:00:00';
a b c
TEST TEST 2009-10-09 00:00:00
SELECT * FROM t1 WHERE a = 'TEST' AND
c >= '2009-10-09 00:00:00' AND c <= '2009-10-09 00:00:00.0';
a b c
TEST TEST 2009-10-09 00:00:00
SELECT * FROM t1 WHERE a = 'TEST' AND
c >= '2009-10-09 00:00:00.000' AND c <= '2009-10-09 00:00:00.000';
a b c
TEST TEST 2009-10-09 00:00:00
SELECT * FROM t1 WHERE a = 'TEST' AND
c >= '2009-10-09 00:00:00.00' AND c <= '2009-10-09 00:00:00.001';
a b c
TEST TEST 2009-10-09 00:00:00
SELECT * FROM t1 WHERE a = 'TEST' AND
c >= '2009-10-09 00:00:00.001' AND c <= '2009-10-09 00:00:00.00';
a b c
EXPLAIN SELECT * FROM t1 WHERE a = 'TEST' AND
c >= '2009-10-09 00:00:00.001' AND c <= '2009-10-09 00:00:00.00';
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;
End of 5.1 tests
#
# Test for bug #39932 "create table fails if column for FK is in different

View file

@ -1063,6 +1063,60 @@ a b c d
127 NULL 127 NULL
128 NULL 128 NULL
DROP TABLE IF EXISTS t1,t2;
#
# Bug #42116: Mysql crash on specific query
#
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT);
CREATE TABLE t3 (a INT, INDEX (a));
CREATE TABLE t4 (a INT);
CREATE TABLE t5 (a INT);
CREATE TABLE t6 (a INT);
INSERT INTO t1 VALUES (1), (1), (1);
INSERT INTO t2 VALUES
(2), (2), (2), (2), (2), (2), (2), (2), (2), (2);
INSERT INTO t3 VALUES
(3), (3), (3), (3), (3), (3), (3), (3), (3), (3);
EXPLAIN
SELECT *
FROM
t1 JOIN t2 ON t1.a = t2.a
LEFT JOIN
(
(
t3 LEFT JOIN t4 ON t3.a = t4.a
)
LEFT JOIN
(
t5 LEFT JOIN t6 ON t5.a = t6.a
)
ON t4.a = t5.a
)
ON t1.a = t3.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
1 SIMPLE t3 ref a a 5 test.t1.a 2 Using index
1 SIMPLE t4 ALL NULL NULL NULL NULL 0
1 SIMPLE t5 ALL NULL NULL NULL NULL 0
1 SIMPLE t6 ALL NULL NULL NULL NULL 0
1 SIMPLE t2 ALL NULL NULL NULL NULL 10 Using where; Using join buffer
SELECT *
FROM
t1 JOIN t2 ON t1.a = t2.a
LEFT JOIN
(
(
t3 LEFT JOIN t4 ON t3.a = t4.a
)
LEFT JOIN
(
t5 LEFT JOIN t6 ON t5.a = t6.a
)
ON t4.a = t5.a
)
ON t1.a = t3.a;
a a a a a a
DROP TABLE t1,t2,t3,t4,t5,t6;
End of 5.0 tests.
CREATE TABLE t1 (f1 int);
CREATE TABLE t2 (f1 int);

View file

@ -58,11 +58,7 @@ select 1 as xml;
xml
1
create table t2(fl text);
LOAD XML LOCAL INFILE "$MYSQLTEST_VARDIR/tmp/loadxml-dump.xml" INTO TABLE t2 ROWS IDENTIFIED BY '<person>';;
show processlist;
Id User Host db Command Time State Info
# root localhost test Query # NULL show processlist
# root localhost test Query # Reading from net LOAD XML LOCAL INFILE "$MYSQLTEST_VARDIR/tmp/loadxml-dump.xml" INTO TABLE t2 ROWS IDENTIFIED BY '<p
LOAD XML LOCAL INFILE "MYSQLTEST_VARDIR/tmp/loadxml-dump.xml" INTO TABLE t2 ROWS IDENTIFIED BY '<person>';;
drop table t1;
drop table t2;
create table t1 (

View file

@ -63,4 +63,30 @@ SET lc_time_names=sr_RS;
SELECT format(123456.789, 3, 'sr_RS');
format(123456.789, 3, 'sr_RS')
123456.789
#
# Bug#43207 wrong LC_TIME names for romanian locale
#
SET NAMES utf8;
SET lc_time_names=ro_RO;
SELECT DATE_FORMAT('2001-01-01', '%w %a %W');
DATE_FORMAT('2001-01-01', '%w %a %W')
1 Lu Luni
SELECT DATE_FORMAT('2001-01-02', '%w %a %W');
DATE_FORMAT('2001-01-02', '%w %a %W')
2 Ma Marţi
SELECT DATE_FORMAT('2001-01-03', '%w %a %W');
DATE_FORMAT('2001-01-03', '%w %a %W')
3 Mi Miercuri
SELECT DATE_FORMAT('2001-01-04', '%w %a %W');
DATE_FORMAT('2001-01-04', '%w %a %W')
4 Jo Joi
SELECT DATE_FORMAT('2001-01-05', '%w %a %W');
DATE_FORMAT('2001-01-05', '%w %a %W')
5 Vi Vineri
SELECT DATE_FORMAT('2001-01-06', '%w %a %W');
DATE_FORMAT('2001-01-06', '%w %a %W')
6 Sâ Sâmbătă
SELECT DATE_FORMAT('2001-01-07', '%w %a %W');
DATE_FORMAT('2001-01-07', '%w %a %W')
0 Du Duminică
End of 5.4 tests

View file

@ -10,3 +10,48 @@ create database D1;
ERROR 42000: Access denied for user 'sample'@'localhost' to database 'D1'
drop user 'sample'@'localhost';
drop database if exists d1;
CREATE DATABASE d1;
USE d1;
CREATE TABLE T1(f1 INT);
CREATE TABLE t1(f1 INT);
GRANT SELECT ON T1 to user_1@localhost;
select * from t1;
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't1'
select * from T1;
f1
GRANT SELECT ON t1 to user_1@localhost;
select * from information_schema.table_privileges;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
'user_1'@'localhost' def d1 T1 SELECT NO
'user_1'@'localhost' def d1 t1 SELECT NO
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
DROP USER user_1@localhost;
DROP DATABASE d1;
USE test;
CREATE DATABASE db1;
USE db1;
CREATE PROCEDURE p1() BEGIN END;
CREATE FUNCTION f1(i INT) RETURNS INT RETURN i+1;
GRANT USAGE ON db1.* to user_1@localhost;
GRANT EXECUTE ON PROCEDURE db1.P1 to user_1@localhost;
GRANT EXECUTE ON FUNCTION db1.f1 to user_1@localhost;
GRANT UPDATE ON db1.* to USER_1@localhost;
call p1();
call P1();
select f1(1);
f1(1)
2
call p1();
ERROR 42000: execute command denied to user 'USER_1'@'localhost' for routine 'db1.p1'
call P1();
ERROR 42000: execute command denied to user 'USER_1'@'localhost' for routine 'db1.p1'
select f1(1);
ERROR 42000: execute command denied to user 'USER_1'@'localhost' for routine 'db1.f1'
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM USER_1@localhost;
DROP FUNCTION f1;
DROP PROCEDURE p1;
DROP USER user_1@localhost;
DROP USER USER_1@localhost;
DROP DATABASE db1;
use test;

View file

@ -2290,6 +2290,12 @@ Table Op Msg_type Msg_text
test.t1 repair error myisam_sort_buffer_size is too small
test.t1 repair warning Number of rows changed from 0 to 7168
test.t1 repair status OK
SET myisam_repair_threads=2;
REPAIR TABLE t1;
SET myisam_repair_threads=@@global.myisam_repair_threads;
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
End of 5.1 tests

View file

@ -15,31 +15,13 @@ SET SESSION debug="d,crash_before_flush_keys";
# Run the crashing query
FLUSH TABLE t1;
ERROR HY000: Lost connection to MySQL server during query
# Run MYISAMCHK tool to check the table t1 and repair
myisamchk: MyISAM file MYSQLD_DATADIR/test/t1
myisamchk: warning: 1 client is using or hasn't closed the table properly
myisamchk: error: Size of indexfile is: 1024 Should be: 3072
MYISAMCHK: Unknown error 126
myisamchk: error: Can't read indexpage from filepos: 1024
MyISAM-table 'MYSQLD_DATADIR/test/t1' is corrupted
Fix it using switch "-r" or "-o"
# Write file to make mysql-test-run.pl start the server
# Turn on reconnect
# Call script that will poll the server waiting for
# it to be back online again
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL DEFAULT '0',
`b` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`a`,`b`),
KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1
SELECT * FROM t1 FORCE INDEX (PRIMARY);
a b
1 2
2 3
3 4
4 5
5 6
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check warning 1 client is using or hasn't closed the table properly
test.t1 check error Size of indexfile is: 1024 Should be: 3072
test.t1 check error Corrupt
DROP TABLE t1;

View file

@ -733,4 +733,24 @@ SELECT 1 FROM t1 GROUP BY (DATE(NULL)) WITH ROLLUP;
1
1
DROP TABLE t1;
#
# Bug #48131: crash group by with rollup, distinct,
# filesort, with temporary tables
#
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY);
INSERT INTO t1 VALUES (1), (2);
CREATE TABLE t2 (b INT);
INSERT INTO t2 VALUES (100);
SELECT a, b FROM t1, t2 GROUP BY a, b WITH ROLLUP;
a b
1 100
1 NULL
2 100
2 NULL
NULL NULL
SELECT DISTINCT b FROM t1, t2 GROUP BY a, b WITH ROLLUP;
b
100
NULL
DROP TABLE t1, t2;
End of 5.0 tests

View file

@ -1,4 +1,54 @@
drop table if exists t1;
create table t1 (a varchar(1) character set latin1 collate latin1_general_ci)
partition by range columns(a)
( partition p0 values less than ('a'),
partition p1 values less than ('b'),
partition p2 values less than ('c'),
partition p3 values less than ('d'));
insert into t1 values ('A'),('a'),('B'),('b'),('C'),('c');
select * from t1 where a > 'B' collate latin1_bin;
a
a
b
C
c
select * from t1 where a <> 'B' collate latin1_bin;
a
A
a
b
C
c
alter table t1 remove partitioning;
select * from t1 where a > 'B' collate latin1_bin;
a
a
b
C
c
select * from t1 where a <> 'B' collate latin1_bin;
a
A
a
b
C
c
drop table t1;
create table t1 (a varchar(2) character set latin1,
b varchar(2) character set latin1)
partition by list columns(a,b)
(partition p0 values in (('a','a')));
insert into t1 values ('A','A');
select * from t1 where b <> 'a' collate latin1_bin AND
a = 'A' collate latin1_bin;
a b
A A
alter table t1 remove partitioning;
select * from t1 where b <> 'a' collate latin1_bin AND
a = 'A' collate latin1_bin;
a b
A A
drop table t1;
create table t1 (a varchar(5))
partition by list columns(a)
( partition p0 values in ('\''),
@ -110,7 +160,7 @@ a
NULL
explain partitions select * from t1 where a is null;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 10 Using where
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 2 Using where
select * from t1 where a <= 1;
a
1

View file

@ -1,4 +1,15 @@
drop table if exists t1;
create table t1 (a varchar(5), b int signed, c varchar(10), d datetime)
partition by range columns(b,c)
subpartition by hash(to_seconds(d))
( partition p0 values less than (2, 'b'),
partition p1 values less than (4, 'd'),
partition p2 values less than (10, 'za'));
insert into t1 values ('a', 3, 'w', '2001-10-27 04:34:00');
insert into t1 values ('r', 7, 'w', '2001-10-27 05:34:00');
insert into t1 values ('g', 10, 'w', '2001-10-27 06:34:00');
update t1 set a = 'c' where a > 'f';
drop table t1;
create table t1 (a varchar(5))
engine=memory
partition by range columns(a)

View file

@ -1601,10 +1601,9 @@ INSERT INTO t1 VALUES (1, '2009-01-01'), (2, NULL);
# test with an invalid date, which lead to item->null_value is set.
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-99' AS DATETIME);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p20090401 ALL NULL NULL NULL NULL 2 Using where
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
Warning 1292 Incorrect datetime value: '2009-04-99'
Warning 1292 Incorrect datetime value: '2009-04-99'
DROP TABLE t1;
CREATE TABLE t1
(a INT NOT NULL AUTO_INCREMENT,

View file

@ -32,19 +32,19 @@ identified by 'looser' ;
show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
drop table mysqltest.t9 ;
show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
prepare s_t1 from 'select a as my_col from t1' ;
execute s_t1 ;
my_col

View file

@ -1708,6 +1708,7 @@ Qcache_hits 2
DROP TABLE t1;
SET GLOBAL query_cache_size= default;
End of 5.0 tests
SET GLOBAL query_cache_size=1024*1024*512;
CREATE TABLE t1 (a ENUM('rainbow'));
INSERT INTO t1 VALUES (),(),(),(),();
SELECT 1 FROM t1 GROUP BY (SELECT 1 FROM t1 ORDER BY AVG(LAST_INSERT_ID()));
@ -1722,4 +1723,5 @@ SELECT 1 FROM t1 GROUP BY
1
1
DROP TABLE t1;
SET GLOBAL query_cache_size= default;
End of 5.1 tests

View file

@ -1398,3 +1398,209 @@ a < 10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 range a a 5 NULL 8 Using where; Using index
DROP TABLE t1, t2, t3;
#
# Bug #47123: Endless 100% CPU loop with STRAIGHT_JOIN
#
CREATE TABLE t1(a INT, KEY(a));
INSERT INTO t1 VALUES (1), (NULL);
SELECT * FROM t1 WHERE a <> NULL and (a <> NULL or a <= NULL);
a
DROP TABLE t1;
#
# Bug#47925: regression of range optimizer and date comparison in 5.1.39!
#
CREATE TABLE t1 ( a DATE, KEY ( a ) );
CREATE TABLE t2 ( a DATETIME, KEY ( a ) );
# Make optimizer choose range scan
INSERT INTO t1 VALUES ('2009-09-22'), ('2009-09-22'), ('2009-09-22');
INSERT INTO t1 VALUES ('2009-09-23'), ('2009-09-23'), ('2009-09-23');
INSERT INTO t2 VALUES ('2009-09-22 12:00:00'), ('2009-09-22 12:00:00'),
('2009-09-22 12:00:00');
INSERT INTO t2 VALUES ('2009-09-23 12:00:00'), ('2009-09-23 12:00:00'),
('2009-09-23 12:00:00');
# DATE vs DATE
EXPLAIN
SELECT * FROM t1 WHERE a >= '2009/09/23';
id select_type table type possible_keys key key_len ref rows Extra
X X X range a a X X X X
SELECT * FROM t1 WHERE a >= '2009/09/23';
a
2009-09-23
2009-09-23
2009-09-23
SELECT * FROM t1 WHERE a >= '20090923';
a
2009-09-23
2009-09-23
2009-09-23
SELECT * FROM t1 WHERE a >= 20090923;
a
2009-09-23
2009-09-23
2009-09-23
SELECT * FROM t1 WHERE a >= '2009-9-23';
a
2009-09-23
2009-09-23
2009-09-23
SELECT * FROM t1 WHERE a >= '2009.09.23';
a
2009-09-23
2009-09-23
2009-09-23
SELECT * FROM t1 WHERE a >= '2009:09:23';
a
2009-09-23
2009-09-23
2009-09-23
# DATE vs DATETIME
EXPLAIN
SELECT * FROM t2 WHERE a >= '2009/09/23';
id select_type table type possible_keys key key_len ref rows Extra
X X X range a a X X X X
SELECT * FROM t2 WHERE a >= '2009/09/23';
a
2009-09-23 12:00:00
2009-09-23 12:00:00
2009-09-23 12:00:00
SELECT * FROM t2 WHERE a >= '2009/09/23';
a
2009-09-23 12:00:00
2009-09-23 12:00:00
2009-09-23 12:00:00
SELECT * FROM t2 WHERE a >= '20090923';
a
2009-09-23 12:00:00
2009-09-23 12:00:00
2009-09-23 12:00:00
SELECT * FROM t2 WHERE a >= 20090923;
a
2009-09-23 12:00:00
2009-09-23 12:00:00
2009-09-23 12:00:00
SELECT * FROM t2 WHERE a >= '2009-9-23';
a
2009-09-23 12:00:00
2009-09-23 12:00:00
2009-09-23 12:00:00
SELECT * FROM t2 WHERE a >= '2009.09.23';
a
2009-09-23 12:00:00
2009-09-23 12:00:00
2009-09-23 12:00:00
SELECT * FROM t2 WHERE a >= '2009:09:23';
a
2009-09-23 12:00:00
2009-09-23 12:00:00
2009-09-23 12:00:00
# DATETIME vs DATETIME
EXPLAIN
SELECT * FROM t2 WHERE a >= '2009/09/23 12:00:00';
id select_type table type possible_keys key key_len ref rows Extra
X X X range a a X X X X
SELECT * FROM t2 WHERE a >= '2009/09/23 12:00:00';
a
2009-09-23 12:00:00
2009-09-23 12:00:00
2009-09-23 12:00:00
SELECT * FROM t2 WHERE a >= '20090923120000';
a
2009-09-23 12:00:00
2009-09-23 12:00:00
2009-09-23 12:00:00
SELECT * FROM t2 WHERE a >= 20090923120000;
a
2009-09-23 12:00:00
2009-09-23 12:00:00
2009-09-23 12:00:00
SELECT * FROM t2 WHERE a >= '2009-9-23 12:00:00';
a
2009-09-23 12:00:00
2009-09-23 12:00:00
2009-09-23 12:00:00
SELECT * FROM t2 WHERE a >= '2009.09.23 12:00:00';
a
2009-09-23 12:00:00
2009-09-23 12:00:00
2009-09-23 12:00:00
SELECT * FROM t2 WHERE a >= '2009:09:23 12:00:00';
a
2009-09-23 12:00:00
2009-09-23 12:00:00
2009-09-23 12:00:00
# DATETIME vs DATE
EXPLAIN
SELECT * FROM t1 WHERE a >= '2009/09/23 00:00:00';
id select_type table type possible_keys key key_len ref rows Extra
X X X range a a X X X X
SELECT * FROM t1 WHERE a >= '2009/09/23 00:00:00';
a
2009-09-23
2009-09-23
2009-09-23
SELECT * FROM t1 WHERE a >= '2009/09/23 00:00:00';
a
2009-09-23
2009-09-23
2009-09-23
SELECT * FROM t1 WHERE a >= '20090923000000';
a
2009-09-23
2009-09-23
2009-09-23
SELECT * FROM t1 WHERE a >= 20090923000000;
a
2009-09-23
2009-09-23
2009-09-23
SELECT * FROM t1 WHERE a >= '2009-9-23 00:00:00';
a
2009-09-23
2009-09-23
2009-09-23
SELECT * FROM t1 WHERE a >= '2009.09.23 00:00:00';
a
2009-09-23
2009-09-23
2009-09-23
SELECT * FROM t1 WHERE a >= '2009:09:23 00:00:00';
a
2009-09-23
2009-09-23
2009-09-23
# Test of the new get_date_from_str implementation
# Behavior differs slightly between the trunk and mysql-pe.
# The former may give errors for the truncated values, while the latter
# gives warnings. The purpose of this test is not to interfere, and only
# preserve existing behavior.
SELECT str_to_date('2007-10-00', '%Y-%m-%d') >= '' AND
str_to_date('2007-10-00', '%Y-%m-%d') <= '2007/10/20';
str_to_date('2007-10-00', '%Y-%m-%d') >= '' AND
str_to_date('2007-10-00', '%Y-%m-%d') <= '2007/10/20'
1
Warnings:
Warning 1292 Truncated incorrect date value: ''
SELECT str_to_date('2007-20-00', '%Y-%m-%d') >= '2007/10/20' AND
str_to_date('2007-20-00', '%Y-%m-%d') <= '';
str_to_date('2007-20-00', '%Y-%m-%d') >= '2007/10/20' AND
str_to_date('2007-20-00', '%Y-%m-%d') <= ''
NULL
Warnings:
Warning 1292 Truncated incorrect date value: ''
Warning 1411 Incorrect datetime value: '2007-20-00' for function str_to_date
Warning 1411 Incorrect datetime value: '2007-20-00' for function str_to_date
SELECT str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20';
str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20'
1
Warnings:
Warning 1292 Truncated incorrect datetime value: ''
SELECT str_to_date('2007-20-00', '%Y-%m-%d') BETWEEN '2007/10/20' AND '';
str_to_date('2007-20-00', '%Y-%m-%d') BETWEEN '2007/10/20' AND ''
NULL
Warnings:
Warning 1411 Incorrect datetime value: '2007-20-00' for function str_to_date
SELECT str_to_date('', '%Y-%m-%d');
str_to_date('', '%Y-%m-%d')
0000-00-00
DROP TABLE t1, t2;
End of 5.1 tests

View file

@ -4386,6 +4386,47 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = `test`.`t1`.`b`) and (`test`.`t1`.`a` > 1)) limit 2
DROP TABLE t1;
#
# Bug#47019: Assertion failed: 0, file .\rt_mbr.c, line 138 when
# forcing a spatial index
#
CREATE TABLE t1(a LINESTRING NOT NULL, SPATIAL KEY(a));
INSERT INTO t1 VALUES
(GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)')),
(GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)'));
EXPLAIN SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
1 SIMPLE t2 ALL a NULL NULL NULL 2
SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2;
1
1
1
1
1
EXPLAIN SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2 FORCE INDEX(a);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
1 SIMPLE t2 ALL a NULL NULL NULL 2
SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2 FORCE INDEX(a);
1
1
1
1
1
DROP TABLE t1;
#
# Bug #48291 : crash with row() operator,select into @var, and
# subquery returning multiple rows
#
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (2),(3);
# Should not crash
SELECT 1 FROM t1 WHERE a <> 1 AND NOT
ROW(a,a) <=> ROW((SELECT 1 FROM t1 WHERE 1=2),(SELECT 1 FROM t1))
INTO @var0;
ERROR 21000: Subquery returns more than 1 row
DROP TABLE t1;
End of 5.0 tests
create table t1(a INT, KEY (a));
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);

View file

@ -0,0 +1,47 @@
#
# Bug #47412: Valgrind warnings / user can read uninitalized memory
# using SP variables
#
CREATE SCHEMA testdb;
USE testdb;
CREATE FUNCTION f2 () RETURNS INTEGER
BEGIN
DECLARE CONTINUE HANDLER FOR SQLSTATE '42000' SET @aux = 1;
RETURN f_not_exists () ;
END|
CREATE PROCEDURE p3 ( arg1 VARCHAR(32) )
BEGIN
CALL p_not_exists ( );
END|
# should not return valgrind warnings
CALL p3 ( f2 () );
ERROR 42000: PROCEDURE testdb.p_not_exists does not exist
DROP SCHEMA testdb;
CREATE SCHEMA testdb;
USE testdb;
CREATE FUNCTION f2 () RETURNS INTEGER
BEGIN
DECLARE CONTINUE HANDLER FOR SQLSTATE '42000' SET @aux = 1;
RETURN f_not_exists () ;
END|
CREATE PROCEDURE p3 ( arg2 INTEGER )
BEGIN
CALL p_not_exists ( );
END|
# should not return valgrind warnings
CALL p3 ( f2 () );
ERROR 42000: PROCEDURE testdb.p_not_exists does not exist
DROP SCHEMA testdb;
CREATE SCHEMA testdb;
USE testdb;
CREATE FUNCTION f2 () RETURNS INTEGER
BEGIN
DECLARE CONTINUE HANDLER FOR SQLSTATE '42000' SET @aux = 1;
RETURN f_not_exists () ;
END|
# should not return valgrind warnings
SELECT f2 ();
f2 ()
NULL
DROP SCHEMA testdb;
End of 5.1 tests

View file

@ -1670,3 +1670,19 @@ NULL
SELECT non_existent (a) FROM t1 WHERE b = 999999;
ERROR 42000: FUNCTION test.non_existent does not exist
DROP TABLE t1;
#
# Bug #47788: Crash in TABLE_LIST::hide_view_error on UPDATE + VIEW +
# SP + MERGE + ALTER
#
CREATE TABLE t1 (pk INT, b INT, KEY (b));
CREATE ALGORITHM = TEMPTABLE VIEW v1 AS SELECT * FROM t1;
CREATE PROCEDURE p1 (a int) UPDATE IGNORE v1 SET b = a;
CALL p1(5);
ERROR HY000: The target table v1 of the UPDATE is not updatable
ALTER TABLE t1 CHANGE COLUMN b b2 INT;
CALL p1(7);
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
DROP PROCEDURE p1;
DROP VIEW v1;
DROP TABLE t1;
End of 5.1 tests

View file

@ -75,7 +75,7 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
ERROR HY000: Incorrect usage of PROCEDURE and subquery
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
ERROR HY000: Incorrect usage of PROCEDURE and subquery
ERROR HY000: Incorrect parameters to procedure 'ANALYSE'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
ERROR 42S22: Unknown column 'a' in 'field list'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;
@ -4403,8 +4403,7 @@ FROM t1
WHERE a = 230;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY st1 index NULL a 5 NULL 2 Using index
2 DEPENDENT SUBQUERY st2 index b b 5 NULL 2 Using where; Using index; Using join buffer
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
FROM t1
WHERE a = 230;
@ -4564,4 +4563,18 @@ id g v s
51 50 NULL l
61 60 NULL l
drop table t1, t2;
CREATE TABLE t1 (a ENUM('rainbow'));
INSERT INTO t1 VALUES (),(),(),(),();
SELECT 1 FROM t1 GROUP BY (SELECT 1 FROM t1 ORDER BY AVG(LAST_INSERT_ID()));
1
1
DROP TABLE t1;
CREATE TABLE t1 (a LONGBLOB);
INSERT INTO t1 SET a = 'aaaa';
INSERT INTO t1 SET a = 'aaaa';
SELECT 1 FROM t1 GROUP BY
(SELECT LAST_INSERT_ID() FROM t1 ORDER BY MIN(a) ASC LIMIT 1);
1
1
DROP TABLE t1;
End of 5.1 tests.

View file

@ -895,3 +895,72 @@ t1.a < (select t4.a+10
from t4, t5 limit 2));
ERROR 21000: Subquery returns more than 1 row
drop table t0, t1, t2, t3, t4, t5;
#
# BUG#48177 - SELECTs with NOT IN subqueries containing NULL
# values return too many records
#
CREATE TABLE t1 (
i1 int DEFAULT NULL,
i2 int DEFAULT NULL
) ;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (2, 3);
INSERT INTO t1 VALUES (4, NULL);
INSERT INTO t1 VALUES (4, 0);
INSERT INTO t1 VALUES (NULL, NULL);
CREATE TABLE t2 (
i1 int DEFAULT NULL,
i2 int DEFAULT NULL
) ;
INSERT INTO t2 VALUES (4, NULL);
INSERT INTO t2 VALUES (5, 0);
Data in t1
SELECT i1, i2 FROM t1;
i1 i2
1 NULL
2 3
4 NULL
4 0
NULL NULL
Data in subquery (should be filtered out)
SELECT i1, i2 FROM t2 ORDER BY i1;
i1 i2
4 NULL
5 0
FLUSH STATUS;
SELECT i1, i2
FROM t1
WHERE (i1, i2)
NOT IN (SELECT i1, i2 FROM t2);
i1 i2
1 NULL
2 3
# Check that the subquery only has to be evaluated once
# for all-NULL values even though there are two (NULL,NULL) records
# Baseline:
SHOW STATUS LIKE '%Handler_read_rnd_next';
Variable_name Value
Handler_read_rnd_next 17
INSERT INTO t1 VALUES (NULL, NULL);
FLUSH STATUS;
SELECT i1, i2
FROM t1
WHERE (i1, i2)
NOT IN (SELECT i1, i2 FROM t2);
i1 i2
1 NULL
2 3
# Handler_read_rnd_next should be one more than baseline
# (read record from t1, but do not read from t2)
SHOW STATUS LIKE '%Handler_read_rnd_next';
Variable_name Value
Handler_read_rnd_next 18
DROP TABLE t1,t2;
End of 5.1 tests

View file

@ -162,7 +162,7 @@ procs_priv CREATE TABLE `procs_priv` (
`Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
`Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
`Routine_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`Routine_name` char(64) CHARACTER SET utf8 NOT NULL DEFAULT '',
`Routine_type` enum('FUNCTION','PROCEDURE') COLLATE utf8_bin NOT NULL,
`Grantor` char(77) COLLATE utf8_bin NOT NULL DEFAULT '',
`Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8 NOT NULL DEFAULT '',

View file

@ -1495,9 +1495,9 @@ CREATE TABLE t1 (a int DEFAULT NULL, b int DEFAULT NULL);
INSERT INTO t1 VALUES (3,30), (1,10), (2,10);
SELECT a+CAST(1 AS decimal(65,30)) AS aa, SUM(b) FROM t1 GROUP BY aa;
aa SUM(b)
2.00000000000000000000000000000 10
3.00000000000000000000000000000 10
4.00000000000000000000000000000 30
2.000000000000000000000000000000 10
3.000000000000000000000000000000 10
4.000000000000000000000000000000 30
SELECT a+CAST(1 AS decimal(65,31)) AS aa, SUM(b) FROM t1 GROUP BY aa;
ERROR 42000: Too big scale 31 specified for column '1'. Maximum is 30.
DROP TABLE t1;
@ -1521,13 +1521,13 @@ f1
DROP TABLE t1;
CREATE TABLE t1 SELECT 123451234512345123451234512345123451234512345.678906789067890678906789067890678906789067890 AS f1;
Warnings:
Note 1265 Data truncated for column 'f1' at row 1
Warning 1264 Out of range value for column 'f1' at row 1
DESC t1;
Field Type Null Key Default Extra
f1 decimal(65,20) NO 0.00000000000000000000
f1 decimal(65,30) NO 0.000000000000000000000000000000
SELECT f1 FROM t1;
f1
123451234512345123451234512345123451234512345.67890678906789067891
99999999999999999999999999999999999.999999999999999999999999999999
DROP TABLE t1;
select (1.20396873 * 0.89550000 * 0.68000000 * 1.08721696 * 0.99500000 *
1.01500000 * 1.01500000 * 0.99500000);
@ -1595,7 +1595,7 @@ Warnings:
Note 1265 Data truncated for column 'my_col' at row 1
DESCRIBE t1;
Field Type Null Key Default Extra
my_col decimal(32,30) NO 0.000000000000000000000000000000
my_col decimal(65,30) NO 0.000000000000000000000000000000
SELECT my_col FROM t1;
my_col
1.123456789123456789123456789123
@ -1625,212 +1625,8 @@ Warnings:
Note 1265 Data truncated for column 'my_col' at row 1
DESCRIBE t1;
Field Type Null Key Default Extra
my_col decimal(30,30) YES NULL
my_col decimal(65,30) YES NULL
SELECT my_col FROM t1;
my_col
0.012345687012345687012345687012
DROP TABLE t1;
#
# Bug#45261: Crash, stored procedure + decimal
#
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 SELECT
/* 81 */ 100000000000000000000000000000000000000000000000000000000000000000000000000000001
AS c1;
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
DESC t1;
Field Type Null Key Default Extra
c1 decimal(65,0) NO 0
SELECT * FROM t1;
c1
99999999999999999999999999999999999999999999999999999999999999999
DROP TABLE t1;
CREATE TABLE t1 SELECT
/* 81 */ 100000000000000000000000000000000000000000000000000000000000000000000000000000001.
AS c1;
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
DESC t1;
Field Type Null Key Default Extra
c1 decimal(65,0) NO 0
SELECT * FROM t1;
c1
99999999999999999999999999999999999999999999999999999999999999999
DROP TABLE t1;
CREATE TABLE t1 SELECT
/* 81 */ 100000000000000000000000000000000000000000000000000000000000000000000000000000001.1 /* 1 */
AS c1;
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
DESC t1;
Field Type Null Key Default Extra
c1 decimal(65,0) NO 0
SELECT * FROM t1;
c1
99999999999999999999999999999999999999999999999999999999999999999
DROP TABLE t1;
CREATE TABLE t1 SELECT
/* 82 */ 1000000000000000000000000000000000000000000000000000000000000000000000000000000001
AS c1;
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: ''
DESC t1;
Field Type Null Key Default Extra
c1 decimal(65,0) NO 0
SELECT * FROM t1;
c1
99999999999999999999999999999999999999999999999999999999999999999
DROP TABLE t1;
CREATE TABLE t1 SELECT
/* 40 */ 1000000000000000000000000000000000000001.1000000000000000000000000000000000000001 /* 40 */
AS c1;
DESC t1;
Field Type Null Key Default Extra
c1 decimal(65,25) NO 0.0000000000000000000000000
SELECT * FROM t1;
c1
1000000000000000000000000000000000000001.1000000000000000000000000
DROP TABLE t1;
CREATE TABLE t1 SELECT
/* 1 */ 1.10000000000000000000000000000000000000000000000000000000000000000000000000000001 /* 80 */
AS c1;
DESC t1;
Field Type Null Key Default Extra
c1 decimal(31,30) NO 0.000000000000000000000000000000
SELECT * FROM t1;
c1
1.100000000000000000000000000000
DROP TABLE t1;
CREATE TABLE t1 SELECT
/* 1 */ 1.100000000000000000000000000000000000000000000000000000000000000000000000000000001 /* 81 */
AS c1;
DESC t1;
Field Type Null Key Default Extra
c1 decimal(31,30) NO 0.000000000000000000000000000000
SELECT * FROM t1;
c1
1.100000000000000000000000000000
DROP TABLE t1;
CREATE TABLE t1 SELECT
.100000000000000000000000000000000000000000000000000000000000000000000000000000001 /* 81 */
AS c1;
Warnings:
Note 1265 Data truncated for column 'c1' at row 1
DESC t1;
Field Type Null Key Default Extra
c1 decimal(30,30) NO 0.000000000000000000000000000000
SELECT * FROM t1;
c1
0.100000000000000000000000000000
DROP TABLE t1;
CREATE TABLE t1 SELECT
/* 45 */ 123456789012345678901234567890123456789012345.123456789012345678901234567890123456789012345 /* 45 */
AS c1;
Warnings:
Note 1265 Data truncated for column 'c1' at row 1
DESC t1;
Field Type Null Key Default Extra
c1 decimal(65,20) NO 0.00000000000000000000
SELECT * FROM t1;
c1
123456789012345678901234567890123456789012345.12345678901234567890
DROP TABLE t1;
CREATE TABLE t1 SELECT
/* 65 */ 12345678901234567890123456789012345678901234567890123456789012345.1 /* 1 */
AS c1;
Warnings:
Note 1265 Data truncated for column 'c1' at row 1
DESC t1;
Field Type Null Key Default Extra
c1 decimal(65,0) NO 0
SELECT * FROM t1;
c1
12345678901234567890123456789012345678901234567890123456789012345
DROP TABLE t1;
CREATE TABLE t1 SELECT
/* 66 */ 123456789012345678901234567890123456789012345678901234567890123456.1 /* 1 */
AS c1;
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
DESC t1;
Field Type Null Key Default Extra
c1 decimal(65,0) NO 0
SELECT * FROM t1;
c1
99999999999999999999999999999999999999999999999999999999999999999
DROP TABLE t1;
CREATE TABLE t1 SELECT
.123456789012345678901234567890123456789012345678901234567890123456 /* 66 */
AS c1;
Warnings:
Note 1265 Data truncated for column 'c1' at row 1
DESC t1;
Field Type Null Key Default Extra
c1 decimal(30,30) NO 0.000000000000000000000000000000
SELECT * FROM t1;
c1
0.123456789012345678901234567890
DROP TABLE t1;
CREATE TABLE t1 AS SELECT 123.1234567890123456789012345678901 /* 31 */ AS c1;
Warnings:
Note 1265 Data truncated for column 'c1' at row 1
DESC t1;
Field Type Null Key Default Extra
c1 decimal(33,30) NO 0.000000000000000000000000000000
SELECT * FROM t1;
c1
123.123456789012345678901234567890
DROP TABLE t1;
CREATE TABLE t1 SELECT 1.1 + CAST(1 AS DECIMAL(65,30)) AS c1;
DESC t1;
Field Type Null Key Default Extra
c1 decimal(65,29) NO 0.00000000000000000000000000000
SELECT * FROM t1;
c1
2.10000000000000000000000000000
DROP TABLE t1;
#
# Test that the integer and decimal parts are properly calculated.
#
CREATE TABLE t1 (a DECIMAL(30,30));
INSERT INTO t1 VALUES (0.1),(0.2),(0.3);
CREATE TABLE t2 SELECT MIN(a + 0.0000000000000000000000000000001) AS c1 FROM t1;
Warnings:
Note 1265 Data truncated for column 'c1' at row 4
DESC t2;
Field Type Null Key Default Extra
c1 decimal(32,30) YES NULL
DROP TABLE t1,t2;
CREATE TABLE t1 (a DECIMAL(30,30));
INSERT INTO t1 VALUES (0.1),(0.2),(0.3);
CREATE TABLE t2 SELECT IFNULL(a + 0.0000000000000000000000000000001, NULL) AS c1 FROM t1;
Warnings:
Note 1265 Data truncated for column 'c1' at row 1
Note 1265 Data truncated for column 'c1' at row 2
Note 1265 Data truncated for column 'c1' at row 3
DESC t2;
Field Type Null Key Default Extra
c1 decimal(32,30) YES NULL
DROP TABLE t1,t2;
CREATE TABLE t1 (a DECIMAL(30,30));
INSERT INTO t1 VALUES (0.1),(0.2),(0.3);
CREATE TABLE t2 SELECT CASE a WHEN 0.1 THEN 0.0000000000000000000000000000000000000000000000000000000000000000001 END AS c1 FROM t1;
Warnings:
Note 1265 Data truncated for column 'c1' at row 1
DESC t2;
Field Type Null Key Default Extra
c1 decimal(31,30) YES NULL
DROP TABLE t1,t2;
#
# Test that variables get maximum precision.
#
SET @decimal= 1.1;
CREATE TABLE t1 SELECT @decimal AS c1;
DESC t1;
Field Type Null Key Default Extra
c1 decimal(65,30) YES NULL
SELECT * FROM t1;
c1
1.100000000000000000000000000000
DROP TABLE t1;

View file

@ -503,3 +503,14 @@ ERROR HY000: Recursive stored functions and triggers are not allowed.
DROP TABLE t1;
DROP FUNCTION f1;
End of 5.0 tests
#
# Bug #47919 assert in open_table during ALTER temporary table
#
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT, PRIMARY KEY (f1));
CREATE TEMPORARY TABLE t2 LIKE t1;
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1);
ALTER TABLE t2 COMMENT = 'ABC';
UPDATE t2, t1 SET t2.f1 = 2, t1.f1 = 9;
ALTER TABLE t2 COMMENT = 'DEF';
DROP TABLE t1, t2;

View file

@ -1218,3 +1218,22 @@ Warnings:
Note 1449 The user specified as a definer ('no_such_user'@'no_such_host') does not exist
DROP TABLE t1;
DROP VIEW v1;
#
# Bug #46019: ERROR 1356 When selecting from within another
# view that has Group By
#
CREATE DATABASE mysqltest1;
USE mysqltest1;
CREATE TABLE t1 (a INT);
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT a FROM t1 GROUP BY a;
CREATE SQL SECURITY INVOKER VIEW v2 AS SELECT a FROM v1;
CREATE USER mysqluser1;
GRANT SELECT ON TABLE t1 TO mysqluser1;
GRANT SELECT, SHOW VIEW ON TABLE v1 TO mysqluser1;
GRANT SELECT, SHOW VIEW ON TABLE v2 TO mysqluser1;
SELECT a FROM v1;
a
SELECT a FROM v2;
a
DROP USER mysqluser1;
DROP DATABASE mysqltest1;

View file

@ -89,3 +89,28 @@ xa start 'a';
xa end 'a';
xa prepare 'a';
xa commit 'a';
CREATE TABLE t1(a INT, KEY(a)) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1),(2);
BEGIN;
UPDATE t1 SET a=3 WHERE a=1;
BEGIN;
UPDATE t1 SET a=4 WHERE a=2;
UPDATE t1 SET a=5 WHERE a=2;
UPDATE t1 SET a=5 WHERE a=1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
ROLLBACK;
ROLLBACK;
BEGIN;
UPDATE t1 SET a=3 WHERE a=1;
XA START 'xid1';
UPDATE t1 SET a=4 WHERE a=2;
UPDATE t1 SET a=5 WHERE a=2;
UPDATE t1 SET a=5 WHERE a=1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
XA END 'xid1';
ERROR XA102: XA_RBDEADLOCK: Transaction branch was rolled back: deadlock was detected
XA ROLLBACK 'xid1';
XA START 'xid1';
XA END 'xid1';
XA ROLLBACK 'xid1';
DROP TABLE t1;

View file

@ -0,0 +1,50 @@
RESET MASTER;
CREATE TABLE t1 (a int);
### assertion: index file contains regular entries
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index');
SELECT @index;
@index
master-bin.000001
### assertion: show original binlogs
show binary logs;
Log_name File_size
master-bin.000001 #
### assertion: binlog contents from regular entries
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 (a int)
FLUSH LOGS;
### assertion: index file contains renamed binlog and the new one
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index');
SELECT @index;
@index
master-bin-b34582.000001
master-bin.000002
### assertion: original binlog content still exists, despite we
### renamed and changed the index file
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin-b34582.000001 # Query # # use `test`; CREATE TABLE t1 (a int)
### assertion: user changed binlog index shows correct entries
show binary logs;
Log_name File_size
master-bin-b34582.000001 #
master-bin.000002 #
DROP TABLE t1;
### assertion: purging binlogs up to binlog created after instrumenting index file should work
PURGE BINARY LOGS TO 'master-bin.000002';
### assertion: show binary logs should only contain latest binlog
show binary logs;
Log_name File_size
master-bin.000002 #
### assertion: assert that binlog files were indeed purged (using file_exists calls)
### assertion: assert that not purged binlog file exists
### assertion: show index file contents and these should match show binary logs issued above
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index');
SELECT @index;
@index
master-bin.000002
RESET MASTER;

View file

@ -19,6 +19,7 @@ DROP TABLE IF EXISTS tmp2, t;
SELECT GET_LOCK("a",10);
GET_LOCK("a",10)
1
USE test;
SELECT GET_LOCK("a",10);
GET_LOCK("a",10)
1

View file

@ -0,0 +1,42 @@
SET @old_isolation_level= @@session.tx_isolation;
SET @@session.tx_isolation= 'READ-COMMITTED';
CREATE DATABASE b42829;
use b42829;
CREATE TABLE t1 (x int, y int) engine=InnoDB;
CREATE TABLE t2 (x int, y int) engine=InnoDB;
CREATE DATABASE b42829_filtered;
use b42829_filtered;
CREATE TABLE t1 (x int, y int) engine=InnoDB;
CREATE TABLE t2 (x int, y int) engine=InnoDB;
SET @@session.sql_log_bin= 0;
INSERT INTO b42829_filtered.t1 VALUES (100,100);
INSERT INTO b42829.t1 VALUES (100,100);
SET @@session.sql_log_bin= 1;
### assertion: the inserts will not raise log error because
### binlog-do-db is filtering used database
INSERT INTO t2 VALUES (1,2), (1,3), (1,4);
INSERT INTO t1 SELECT * FROM t2;
### assertion: assert that despite updating a not filtered
### database this wont trigger an error as the
### used database is the filtered one.
UPDATE b42829_filtered.t1 ft1, b42829.t1 nft1 SET ft1.x=1, nft1.x=2;
use b42829;
### assertion: the statements *will* raise log error because
### binlog-do-db is not filtering used database
BEGIN;
INSERT INTO t2 VALUES (1,2), (1,3), (1,4);
ERROR HY000: Binary logging not possible. Message: Transaction level 'READ-COMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT'
UPDATE b42829_filtered.t1 ft1, b42829.t1 nft1 SET ft1.x=1, nft1.x=2;
ERROR HY000: Binary logging not possible. Message: Transaction level 'READ-COMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT'
INSERT INTO t1 SELECT * FROM t2;
ERROR HY000: Binary logging not possible. Message: Transaction level 'READ-COMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT'
COMMIT;
### assertion: filtered events did not make into the binlog
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # CREATE DATABASE b42829
master-bin.000001 # Query # # use `b42829`; CREATE TABLE t1 (x int, y int) engine=InnoDB
master-bin.000001 # Query # # use `b42829`; CREATE TABLE t2 (x int, y int) engine=InnoDB
DROP DATABASE b42829;
DROP DATABASE b42829_filtered;
SET @@session.tx_isolation= @old_isolation_level;

View file

@ -19,6 +19,7 @@ DROP TABLE IF EXISTS tmp2, t;
SELECT GET_LOCK("a",10);
GET_LOCK("a",10)
1
USE test;
SELECT GET_LOCK("a",10);
GET_LOCK("a",10)
1

View file

@ -0,0 +1,114 @@
# BUG#34582: FLUSH LOGS does not close and reopen the binlog index
# file
#
# WHAT
# ====
#
# We want to test that FLUSH LOGS closes and reopens binlog index
# file.
#
# HOW
# ===
#
# PREPARE:
# 1. create some binlog events
# 2. show index content, binlog events and binlog contents
# for mysql-bin.000001
# 3. copy the mysql-bin.000001 to mysql-bin-b34582.000001
# 4. change the index file so that mysql-bin.000001 is replaced
# with mysql-bin-b34582.000001
# 5. FLUSH the logs so that new index is closed and reopened
#
# ASSERTIONS:
# 1. index file contents shows mysql-bin-b34582.000001 and
# mysql-bin.000002
# 1. show binary logs shows current index entries
# 2. binlog contents for mysql-bin-b34582.000001 are displayed
# 3. Purge binlogs up to the latest one succeeds
# 4. SHOW BINARY LOGS presents the latest one only after purging
# 5. Purged binlogs files don't exist in the filesystem
# 6. Not purged binlog file exists in the filesystem
#
# CLEAN UP:
# 1. RESET MASTER
#
-- source include/have_log_bin.inc
RESET MASTER;
-- let $datadir= `SELECT @@datadir`
-- let $index=$datadir/master-bin.index
-- chmod 0644 $index
# action: issue one command so that binlog gets some event
CREATE TABLE t1 (a int);
-- echo ### assertion: index file contains regular entries
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-- eval SET @index=LOAD_FILE('$index')
-- replace_regex /\.[\\\/]master/master/
SELECT @index;
--echo ### assertion: show original binlogs
-- source include/show_binary_logs.inc
--echo ### assertion: binlog contents from regular entries
-- source include/show_binlog_events.inc
# action: copy binlogs to other names and change entries in index file
-- copy_file $datadir/master-bin.000001 $datadir/master-bin-b34582.000001
let INDEX_FILE=$index;
perl;
$file= $ENV{'INDEX_FILE'};
open(FILE, ">$file") || die "Unable to open $file.";
truncate(FILE,0);
close ($file);
EOF
-- append_file $index
master-bin-b34582.000001
EOF
# action: should cause rotation, and creation of new binlogs
FLUSH LOGS;
# file is not used anymore - remove it (mysql closed on flush logs).
-- remove_file $datadir/master-bin.000001
-- echo ### assertion: index file contains renamed binlog and the new one
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-- eval SET @index=LOAD_FILE('$index')
-- replace_regex /\.[\\\/]master/master/
SELECT @index;
-- echo ### assertion: original binlog content still exists, despite we
-- echo ### renamed and changed the index file
-- source include/show_binlog_events.inc
-- echo ### assertion: user changed binlog index shows correct entries
-- source include/show_binary_logs.inc
DROP TABLE t1;
-- echo ### assertion: purging binlogs up to binlog created after instrumenting index file should work
-- let $current_binlog= query_get_value(SHOW MASTER STATUS, File, 1)
-- eval PURGE BINARY LOGS TO '$current_binlog'
-- echo ### assertion: show binary logs should only contain latest binlog
-- source include/show_binary_logs.inc
-- echo ### assertion: assert that binlog files were indeed purged (using file_exists calls)
-- error 1
-- file_exists $datadir/master-bin-b34852.000001
-- echo ### assertion: assert that not purged binlog file exists
-- file_exists $datadir/$current_binlog
-- echo ### assertion: show index file contents and these should match show binary logs issued above
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-- eval SET @index=LOAD_FILE('$index')
-- replace_regex /\.[\\\/]master/master/
SELECT @index;
RESET MASTER;

View file

@ -0,0 +1 @@
--binlog-do-db=b42829

View file

@ -0,0 +1,90 @@
# BUG#42829: binlogging enabled for all schemas regardless of
# binlog-db-db / binlog-ignore-db
#
# WHAT
# ====
#
# We want to test whether filtered events from binlog will cause
# raising an error mentioning that statement is unable to be logged or
# not, when:
#
# 1. isolation level READ-COMMITTED; AND
#
# 2. using InnoDB engine; AND
#
# 3. using SBL (in which case InnoDB will only allow RBL).
#
# HOW
# ===
#
# The test is implemented as follows:
#
# i) set tx_isolation to read-committed.
#
# ii) create two databases (one filtered other not - using
# binlog-do-db)
#
# iii) Create statements that are to be filtered on filtered db
#
# - At this point, before fix, an error would be raised
#
# iv) do the same thing for not the filtered database and check
# that events throw an error:
#
# - Error: ER_BINLOG_STMT_MODE_AND_ROW_ENGINE
#
-- source include/have_log_bin.inc
-- source include/have_innodb.inc
-- source include/have_binlog_format_statement.inc
SET @old_isolation_level= @@session.tx_isolation;
SET @@session.tx_isolation= 'READ-COMMITTED';
-- let $engine= InnoDB
-- let $filtered= b42829_filtered
-- let $not_filtered= b42829
-- eval CREATE DATABASE $not_filtered
-- eval use $not_filtered
-- eval CREATE TABLE t1 (x int, y int) engine=$engine
-- eval CREATE TABLE t2 (x int, y int) engine=$engine
-- eval CREATE DATABASE $filtered
-- eval use $filtered
-- eval CREATE TABLE t1 (x int, y int) engine=$engine
-- eval CREATE TABLE t2 (x int, y int) engine=$engine
SET @@session.sql_log_bin= 0;
-- eval INSERT INTO $filtered.t1 VALUES (100,100)
-- eval INSERT INTO $not_filtered.t1 VALUES (100,100)
SET @@session.sql_log_bin= 1;
-- echo ### assertion: the inserts will not raise log error because
-- echo ### binlog-do-db is filtering used database
INSERT INTO t2 VALUES (1,2), (1,3), (1,4);
INSERT INTO t1 SELECT * FROM t2;
-- echo ### assertion: assert that despite updating a not filtered
-- echo ### database this wont trigger an error as the
-- echo ### used database is the filtered one.
-- eval UPDATE $filtered.t1 ft1, $not_filtered.t1 nft1 SET ft1.x=1, nft1.x=2
-- eval use $not_filtered
-- echo ### assertion: the statements *will* raise log error because
-- echo ### binlog-do-db is not filtering used database
BEGIN;
-- error ER_BINLOG_LOGGING_IMPOSSIBLE
INSERT INTO t2 VALUES (1,2), (1,3), (1,4);
-- error ER_BINLOG_LOGGING_IMPOSSIBLE
-- eval UPDATE $filtered.t1 ft1, $not_filtered.t1 nft1 SET ft1.x=1, nft1.x=2
-- error ER_BINLOG_LOGGING_IMPOSSIBLE
INSERT INTO t1 SELECT * FROM t2;
COMMIT;
-- echo ### assertion: filtered events did not make into the binlog
source include/show_binlog_events.inc;
-- eval DROP DATABASE $not_filtered
-- eval DROP DATABASE $filtered
SET @@session.tx_isolation= @old_isolation_level;

View file

@ -130,7 +130,7 @@ def mysql procs_priv Db 2 NO char 64 192 NULL NULL utf8 utf8_bin char(64) PRI
def mysql procs_priv Grantor 6 NO char 77 231 NULL NULL utf8 utf8_bin char(77) MUL select,insert,update,references
def mysql procs_priv Host 1 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references
def mysql procs_priv Proc_priv 7 NO set 27 81 NULL NULL utf8 utf8_general_ci set('Execute','Alter Routine','Grant') select,insert,update,references
def mysql procs_priv Routine_name 4 NO char 64 192 NULL NULL utf8 utf8_bin char(64) PRI select,insert,update,references
def mysql procs_priv Routine_name 4 NO char 64 192 NULL NULL utf8 utf8_general_ci char(64) PRI select,insert,update,references
def mysql procs_priv Routine_type 5 NULL NO enum 9 27 NULL NULL utf8 utf8_bin enum('FUNCTION','PROCEDURE') PRI select,insert,update,references
def mysql procs_priv Timestamp 8 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references
def mysql procs_priv User 3 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references
@ -413,7 +413,7 @@ NULL mysql proc modified timestamp NULL NULL NULL NULL timestamp
3.0000 mysql procs_priv Host char 60 180 utf8 utf8_bin char(60)
3.0000 mysql procs_priv Db char 64 192 utf8 utf8_bin char(64)
3.0000 mysql procs_priv User char 16 48 utf8 utf8_bin char(16)
3.0000 mysql procs_priv Routine_name char 64 192 utf8 utf8_bin char(64)
3.0000 mysql procs_priv Routine_name char 64 192 utf8 utf8_general_ci char(64)
3.0000 mysql procs_priv Routine_type enum 9 27 utf8 utf8_bin enum('FUNCTION','PROCEDURE')
3.0000 mysql procs_priv Grantor char 77 231 utf8 utf8_bin char(77)
3.0000 mysql procs_priv Proc_priv set 27 81 utf8 utf8_general_ci set('Execute','Alter Routine','Grant')

View file

@ -214,8 +214,8 @@ def db_datadict_2 t4 0 db_datadict_2 PRIMARY 1 f1 NULL 0 NULL NULL HASH
SHOW GRANTS FOR 'testuser1'@'localhost';
Grants for testuser1@localhost
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
GRANT SELECT (f5, f1) ON `db_datadict_2`.`t3` TO 'testuser1'@'localhost'
GRANT SELECT ON `db_datadict`.`t1` TO 'testuser1'@'localhost' WITH GRANT OPTION
GRANT SELECT (f5, f1) ON `db_datadict_2`.`t3` TO 'testuser1'@'localhost'
SHOW GRANTS FOR 'testuser2'@'localhost';
Grants for testuser2@localhost
GRANT USAGE ON *.* TO 'testuser2'@'localhost'
@ -233,8 +233,8 @@ def db_datadict_2 t3 0 db_datadict_2 PRIMARY 1 f1 NULL 0 NULL NULL HASH
SHOW GRANTS FOR 'testuser1'@'localhost';
Grants for testuser1@localhost
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
GRANT SELECT (f5, f1) ON `db_datadict_2`.`t3` TO 'testuser1'@'localhost'
GRANT SELECT ON `db_datadict`.`t1` TO 'testuser1'@'localhost' WITH GRANT OPTION
GRANT SELECT (f5, f1) ON `db_datadict_2`.`t3` TO 'testuser1'@'localhost'
SHOW GRANTS FOR 'testuser2'@'localhost';
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'mysql'
# Switch to connection testuser2

View file

@ -196,13 +196,15 @@ drop table t1;
set innodb_strict_mode = on;
create table t1 (id int primary key) engine = innodb key_block_size = 0;
ERROR HY000: Can't create table 'test.t1' (errno: 1478)
show errors;
show warnings;
Level Code Message
Warning 1478 InnoDB: invalid KEY_BLOCK_SIZE = 0. Valid values are [1, 2, 4, 8, 16]
Error 1005 Can't create table 'test.t1' (errno: 1478)
create table t2 (id int primary key) engine = innodb key_block_size = 9;
ERROR HY000: Can't create table 'test.t2' (errno: 1478)
show errors;
show warnings;
Level Code Message
Warning 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
Error 1005 Can't create table 'test.t2' (errno: 1478)
create table t3 (id int primary key) engine = innodb key_block_size = 1;
create table t4 (id int primary key) engine = innodb key_block_size = 2;
@ -231,26 +233,30 @@ key_block_size = 8 row_format = compressed;
create table t2 (id int primary key) engine = innodb
key_block_size = 8 row_format = redundant;
ERROR HY000: Can't create table 'test.t2' (errno: 1478)
show errors;
show warnings;
Level Code Message
Warning 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE.
Error 1005 Can't create table 'test.t2' (errno: 1478)
create table t3 (id int primary key) engine = innodb
key_block_size = 8 row_format = compact;
ERROR HY000: Can't create table 'test.t3' (errno: 1478)
show errors;
show warnings;
Level Code Message
Warning 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
Error 1005 Can't create table 'test.t3' (errno: 1478)
create table t4 (id int primary key) engine = innodb
key_block_size = 8 row_format = dynamic;
ERROR HY000: Can't create table 'test.t4' (errno: 1478)
show errors;
show warnings;
Level Code Message
Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
Error 1005 Can't create table 'test.t4' (errno: 1478)
create table t5 (id int primary key) engine = innodb
key_block_size = 8 row_format = default;
ERROR HY000: Can't create table 'test.t5' (errno: 1478)
show errors;
show warnings;
Level Code Message
Warning 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
Error 1005 Can't create table 'test.t5' (errno: 1478)
SELECT table_schema, table_name, row_format
FROM information_schema.tables WHERE engine='innodb';
@ -260,20 +266,26 @@ drop table t1;
create table t1 (id int primary key) engine = innodb
key_block_size = 9 row_format = redundant;
ERROR HY000: Can't create table 'test.t1' (errno: 1478)
show errors;
show warnings;
Level Code Message
Warning 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
Warning 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE.
Error 1005 Can't create table 'test.t1' (errno: 1478)
create table t2 (id int primary key) engine = innodb
key_block_size = 9 row_format = compact;
ERROR HY000: Can't create table 'test.t2' (errno: 1478)
show errors;
show warnings;
Level Code Message
Warning 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
Warning 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
Error 1005 Can't create table 'test.t2' (errno: 1478)
create table t2 (id int primary key) engine = innodb
key_block_size = 9 row_format = dynamic;
ERROR HY000: Can't create table 'test.t2' (errno: 1478)
show errors;
show warnings;
Level Code Message
Warning 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
Error 1005 Can't create table 'test.t2' (errno: 1478)
SELECT table_schema, table_name, row_format
FROM information_schema.tables WHERE engine='innodb';
@ -281,38 +293,45 @@ table_schema table_name row_format
set global innodb_file_per_table = off;
create table t1 (id int primary key) engine = innodb key_block_size = 1;
ERROR HY000: Can't create table 'test.t1' (errno: 1478)
show errors;
show warnings;
Level Code Message
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
Error 1005 Can't create table 'test.t1' (errno: 1478)
create table t2 (id int primary key) engine = innodb key_block_size = 2;
ERROR HY000: Can't create table 'test.t2' (errno: 1478)
show errors;
show warnings;
Level Code Message
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
Error 1005 Can't create table 'test.t2' (errno: 1478)
create table t3 (id int primary key) engine = innodb key_block_size = 4;
ERROR HY000: Can't create table 'test.t3' (errno: 1478)
show errors;
show warnings;
Level Code Message
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
Error 1005 Can't create table 'test.t3' (errno: 1478)
create table t4 (id int primary key) engine = innodb key_block_size = 8;
ERROR HY000: Can't create table 'test.t4' (errno: 1478)
show errors;
show warnings;
Level Code Message
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
Error 1005 Can't create table 'test.t4' (errno: 1478)
create table t5 (id int primary key) engine = innodb key_block_size = 16;
ERROR HY000: Can't create table 'test.t5' (errno: 1478)
show errors;
show warnings;
Level Code Message
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
Error 1005 Can't create table 'test.t5' (errno: 1478)
create table t6 (id int primary key) engine = innodb row_format = compressed;
ERROR HY000: Can't create table 'test.t6' (errno: 1478)
show errors;
show warnings;
Level Code Message
Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table.
Error 1005 Can't create table 'test.t6' (errno: 1478)
create table t7 (id int primary key) engine = innodb row_format = dynamic;
ERROR HY000: Can't create table 'test.t7' (errno: 1478)
show errors;
show warnings;
Level Code Message
Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table.
Error 1005 Can't create table 'test.t7' (errno: 1478)
create table t8 (id int primary key) engine = innodb row_format = compact;
create table t9 (id int primary key) engine = innodb row_format = redundant;
@ -326,38 +345,45 @@ set global innodb_file_per_table = on;
set global innodb_file_format = `0`;
create table t1 (id int primary key) engine = innodb key_block_size = 1;
ERROR HY000: Can't create table 'test.t1' (errno: 1478)
show errors;
show warnings;
Level Code Message
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
Error 1005 Can't create table 'test.t1' (errno: 1478)
create table t2 (id int primary key) engine = innodb key_block_size = 2;
ERROR HY000: Can't create table 'test.t2' (errno: 1478)
show errors;
show warnings;
Level Code Message
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
Error 1005 Can't create table 'test.t2' (errno: 1478)
create table t3 (id int primary key) engine = innodb key_block_size = 4;
ERROR HY000: Can't create table 'test.t3' (errno: 1478)
show errors;
show warnings;
Level Code Message
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
Error 1005 Can't create table 'test.t3' (errno: 1478)
create table t4 (id int primary key) engine = innodb key_block_size = 8;
ERROR HY000: Can't create table 'test.t4' (errno: 1478)
show errors;
show warnings;
Level Code Message
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
Error 1005 Can't create table 'test.t4' (errno: 1478)
create table t5 (id int primary key) engine = innodb key_block_size = 16;
ERROR HY000: Can't create table 'test.t5' (errno: 1478)
show errors;
show warnings;
Level Code Message
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
Error 1005 Can't create table 'test.t5' (errno: 1478)
create table t6 (id int primary key) engine = innodb row_format = compressed;
ERROR HY000: Can't create table 'test.t6' (errno: 1478)
show errors;
show warnings;
Level Code Message
Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope.
Error 1005 Can't create table 'test.t6' (errno: 1478)
create table t7 (id int primary key) engine = innodb row_format = dynamic;
ERROR HY000: Can't create table 'test.t7' (errno: 1478)
show errors;
show warnings;
Level Code Message
Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
Error 1005 Can't create table 'test.t7' (errno: 1478)
create table t8 (id int primary key) engine = innodb row_format = compact;
create table t9 (id int primary key) engine = innodb row_format = redundant;

View file

@ -1,2 +1 @@
innodb-index : Bug#47563 2009-06-11 svoj InnoDB: Error: table `test`.`t1#1` already exists in InnoDB internal
innodb_information_schema : Bug#47808 joro : innodb_information_schema.test fails when run under valgrind

View file

@ -11,6 +11,7 @@
-- disable_result_log
-- enable_warnings
let $sample_pages=`select @@innodb_stats_sample_pages`;
SET GLOBAL innodb_stats_sample_pages=0;
# check that the value has been adjusted to 1
@ -61,5 +62,4 @@ SET GLOBAL innodb_stats_sample_pages=16;
ANALYZE TABLE innodb_analyze;
DROP TABLE innodb_analyze;
SET GLOBAL innodb_stats_sample_pages=DEFAULT;
EVAL SET GLOBAL innodb_stats_sample_pages=$sample_pages;

View file

@ -174,11 +174,11 @@ set innodb_strict_mode = on;
--error ER_CANT_CREATE_TABLE
create table t1 (id int primary key) engine = innodb key_block_size = 0;
show errors;
show warnings;
--error ER_CANT_CREATE_TABLE
create table t2 (id int primary key) engine = innodb key_block_size = 9;
show errors;
show warnings;
create table t3 (id int primary key) engine = innodb key_block_size = 1;
@ -204,22 +204,22 @@ key_block_size = 8 row_format = compressed;
--error ER_CANT_CREATE_TABLE
create table t2 (id int primary key) engine = innodb
key_block_size = 8 row_format = redundant;
show errors;
show warnings;
--error ER_CANT_CREATE_TABLE
create table t3 (id int primary key) engine = innodb
key_block_size = 8 row_format = compact;
show errors;
show warnings;
--error ER_CANT_CREATE_TABLE
create table t4 (id int primary key) engine = innodb
key_block_size = 8 row_format = dynamic;
show errors;
show warnings;
--error ER_CANT_CREATE_TABLE
create table t5 (id int primary key) engine = innodb
key_block_size = 8 row_format = default;
show errors;
show warnings;
SELECT table_schema, table_name, row_format
FROM information_schema.tables WHERE engine='innodb';
@ -229,17 +229,17 @@ drop table t1;
--error ER_CANT_CREATE_TABLE
create table t1 (id int primary key) engine = innodb
key_block_size = 9 row_format = redundant;
show errors;
show warnings;
--error ER_CANT_CREATE_TABLE
create table t2 (id int primary key) engine = innodb
key_block_size = 9 row_format = compact;
show errors;
show warnings;
--error ER_CANT_CREATE_TABLE
create table t2 (id int primary key) engine = innodb
key_block_size = 9 row_format = dynamic;
show errors;
show warnings;
SELECT table_schema, table_name, row_format
FROM information_schema.tables WHERE engine='innodb';
@ -249,25 +249,25 @@ set global innodb_file_per_table = off;
--error ER_CANT_CREATE_TABLE
create table t1 (id int primary key) engine = innodb key_block_size = 1;
show errors;
show warnings;
--error ER_CANT_CREATE_TABLE
create table t2 (id int primary key) engine = innodb key_block_size = 2;
show errors;
show warnings;
--error ER_CANT_CREATE_TABLE
create table t3 (id int primary key) engine = innodb key_block_size = 4;
show errors;
show warnings;
--error ER_CANT_CREATE_TABLE
create table t4 (id int primary key) engine = innodb key_block_size = 8;
show errors;
show warnings;
--error ER_CANT_CREATE_TABLE
create table t5 (id int primary key) engine = innodb key_block_size = 16;
show errors;
show warnings;
--error ER_CANT_CREATE_TABLE
create table t6 (id int primary key) engine = innodb row_format = compressed;
show errors;
show warnings;
--error ER_CANT_CREATE_TABLE
create table t7 (id int primary key) engine = innodb row_format = dynamic;
show errors;
show warnings;
create table t8 (id int primary key) engine = innodb row_format = compact;
create table t9 (id int primary key) engine = innodb row_format = redundant;
@ -281,25 +281,25 @@ set global innodb_file_format = `0`;
--error ER_CANT_CREATE_TABLE
create table t1 (id int primary key) engine = innodb key_block_size = 1;
show errors;
show warnings;
--error ER_CANT_CREATE_TABLE
create table t2 (id int primary key) engine = innodb key_block_size = 2;
show errors;
show warnings;
--error ER_CANT_CREATE_TABLE
create table t3 (id int primary key) engine = innodb key_block_size = 4;
show errors;
show warnings;
--error ER_CANT_CREATE_TABLE
create table t4 (id int primary key) engine = innodb key_block_size = 8;
show errors;
show warnings;
--error ER_CANT_CREATE_TABLE
create table t5 (id int primary key) engine = innodb key_block_size = 16;
show errors;
show warnings;
--error ER_CANT_CREATE_TABLE
create table t6 (id int primary key) engine = innodb row_format = compressed;
show errors;
show warnings;
--error ER_CANT_CREATE_TABLE
create table t7 (id int primary key) engine = innodb row_format = dynamic;
show errors;
show warnings;
create table t8 (id int primary key) engine = innodb row_format = compact;
create table t9 (id int primary key) engine = innodb row_format = redundant;

View file

@ -5,6 +5,8 @@
-- source include/have_innodb.inc
let $file_format=`select @@innodb_file_format`;
let $file_per_table=`select @@innodb_file_per_table`;
SET GLOBAL innodb_file_format='Barracuda';
SET GLOBAL innodb_file_per_table=ON;
@ -1153,6 +1155,5 @@ DROP TABLE IF EXISTS table4;
DROP TABLE IF EXISTS table5;
DROP TABLE IF EXISTS table6;
SET GLOBAL innodb_file_per_table=DEFAULT;
SET GLOBAL innodb_file_format='Antelope';
SET GLOBAL innodb_file_format_check='Antelope';
EVAL SET GLOBAL innodb_file_format=$file_format;
EVAL SET GLOBAL innodb_file_per_table=$file_per_table;

View file

@ -14,6 +14,9 @@ SET storage_engine=InnoDB;
-- disable_query_log
-- disable_result_log
let $file_format=`select @@innodb_file_format`;
let $file_format_check=`select @@innodb_file_format_check`;
let $file_per_table=`select @@innodb_file_per_table`;
SET GLOBAL innodb_file_format='Barracuda';
SET GLOBAL innodb_file_per_table=on;
@ -24,7 +27,6 @@ CHECK TABLE table0 EXTENDED;
INSERT IGNORE INTO `table0` SET `col19` = '19940127002709', `col20` = 2383927.9055146948, `col21` = 4293243420.5621204000, `col22` = '20511211123705', `col23` = 4289899778.6573381000, `col24` = 4293449279.0540481000, `col25` = 'emphysemic', `col26` = 'dentally', `col27` = '2347406', `col28` = 'eruct', `col30` = 1222, `col31` = 4294372994.9941406000, `col32` = 4291385574.1173744000, `col33` = 'borrowing\'s', `col34` = 'septics', `col35` = 'ratter\'s', `col36` = 'Kaye', `col37` = 'Florentia', `col38` = 'allium', `col39` = 'barkeep', `col40` = '19510407003441', `col41` = 4293559200.4215522000, `col42` = 22482, `col43` = 'decussate', `col44` = 'Brom\'s', `col45` = 'violated', `col46` = 4925506.4635456400, `col47` = 930549, `col48` = '51296066', `col49` = 'voluminously', `col50` = '29306676', `col51` = -88, `col52` = -2153690, `col53` = 4290250202.1464887000, `col54` = 'expropriation', `col55` = 'Aberdeen\'s', `col56` = 20343, `col58` = '19640415171532', `col59` = 'extern', `col60` = 'Ubana', `col61` = 4290487961.8539081000, `col62` = '2147', `col63` = -24271, `col64` = '20750801194548', `col65` = 'Cunaxa\'s', `col66` = 'pasticcio', `col67` = 2795817, `col68` = 'Indore\'s', `col70` = 6864127, `col71` = '1817832', `col72` = '20540506114211', `col73` = '20040101012300', `col74` = 'rationalized', `col75` = '45522', `col76` = 'indene', `col77` = -6964559, `col78` = 4247535.5266884370, `col79` = '20720416124357', `col80` = '2143', `col81` = 4292060102.4466386000, `col82` = 'striving', `col83` = 'boneblack\'s', `col84` = 'redolent', `col85` = 6489697.9009369183, `col86` = 4287473465.9731131000, `col87` = 7726015, `col88` = 'perplexed', `col89` = '17153791', `col90` = 5478587.1108127078, `col91` = 4287091404.7004304000, `col92` = 'Boulez\'s', `col93` = '2931278';
CHECK TABLE table0 EXTENDED;
DROP TABLE table0;
SET GLOBAL innodb_file_per_table=DEFAULT;
SET GLOBAL innodb_file_format='Antelope';
SET GLOBAL innodb_file_format_check='Antelope';
EVAL SET GLOBAL innodb_file_format=$file_format;
EVAL SET GLOBAL innodb_file_format_check=$file_format_check;
EVAL SET GLOBAL innodb_file_per_table=$file_per_table;

View file

@ -109,14 +109,18 @@ SELECT * FROM ```t'\"_str` WHERE c1 = '3' FOR UPDATE;
-- send
SELECT * FROM ```t'\"_str` WHERE c1 = '4' FOR UPDATE;
# Give time to the above 2 queries to execute before continuing.
# Without this sleep it sometimes happens that the SELECT from innodb_locks
# executes before some of them, resulting in less than expected number
# of rows being selected from innodb_locks.
-- sleep 0.1
-- enable_result_log
-- connection con_verify_innodb_locks
# Wait for the above queries to execute before continuing.
# Without this, it sometimes happens that the SELECT from innodb_locks
# executes before some of them, resulting in less than expected number
# of rows being selected from innodb_locks. If there is a bug and there
# are no 14 rows in innodb_locks then this test will fail with timeout.
let $count = 14;
let $table = INFORMATION_SCHEMA.INNODB_LOCKS;
-- source include/wait_until_rows_count.inc
# the above enables the query log, re-disable it
-- disable_query_log
SELECT lock_mode, lock_type, lock_table, lock_index, lock_rec, lock_data
FROM INFORMATION_SCHEMA.INNODB_LOCKS ORDER BY lock_data;

View file

@ -4,8 +4,10 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
call mtr.add_suppression("Slave I/O: .* failed with error: Lost connection to MySQL server at 'reading initial communication packet'");
call mtr.add_suppression("Get master clock failed with error: ");
call mtr.add_suppression("Get master SERVER_ID failed with error: ");
call mtr.add_suppression("Slave I/O: Master command COM_REGISTER_SLAVE failed: failed registering on master, reconnecting to try again");
call mtr.add_suppression("Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; .*");
SELECT IS_FREE_LOCK("debug_lock.before_get_UNIX_TIMESTAMP");
IS_FREE_LOCK("debug_lock.before_get_UNIX_TIMESTAMP")
1

View file

@ -200,3 +200,32 @@ CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB;
LOAD DATA INFILE "../../std_data/words.dat" INTO TABLE t1;
ERROR 23000: Duplicate entry 'Aarhus' for key 'PRIMARY'
DROP TABLE IF EXISTS t1;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
drop database if exists b48297_db1;
drop database if exists b42897_db2;
create database b48297_db1;
create database b42897_db2;
use b48297_db1;
CREATE TABLE t1 (c1 VARCHAR(256)) engine=MyISAM;;
use b42897_db2;
### assertion: works with cross-referenced database
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE b48297_db1.t1;
use b48297_db1;
### assertion: works with fully qualified name on current database
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE b48297_db1.t1;
### assertion: works without fully qualified name on current database
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE t1;
### create connection without default database
### connect (conn2,localhost,root,,*NO-ONE*);
### assertion: works without stating the default database
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE b48297_db1.t1;
### disconnect and switch back to master connection
use b48297_db1;
Comparing tables master:b48297_db1.t1 and slave:b48297_db1.t1
DROP DATABASE b48297_db1;
DROP DATABASE b42897_db2;

View file

@ -50,7 +50,7 @@ kill @id;
drop table t2,t3;
insert into t4 values (3),(4);
connection master;
--error 0,1053,2013
--error 0,1317,2013
reap;
connection master1;
save_master_pos;

View file

@ -0,0 +1 @@
--master-retry-count=60

View file

@ -19,6 +19,9 @@ source include/have_debug.inc;
call mtr.add_suppression("Slave I/O: .* failed with error: Lost connection to MySQL server at 'reading initial communication packet'");
call mtr.add_suppression("Slave I/O: Master command COM_REGISTER_SLAVE failed: failed registering on master, reconnecting to try again");
call mtr.add_suppression("Get master clock failed with error: ");
call mtr.add_suppression("Get master SERVER_ID failed with error: ");
call mtr.add_suppression("Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; .*");
#Test case 1: Try to get the value of the UNIX_TIMESTAMP from master under network disconnection
connection slave;

View file

@ -1046,6 +1046,21 @@ ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','a0','xx','a5','a6','a7','a8','a9',
--disable_info
DROP TABLE t1;
#
# Bug#43508: Renaming timestamp or date column triggers table copy
#
CREATE TABLE t1 (f1 TIMESTAMP NULL DEFAULT NULL,
f2 INT(11) DEFAULT NULL) ENGINE=MYISAM DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES (NULL, NULL), ("2009-10-09 11:46:19", 2);
--echo this should affect no rows as there is no real change
--enable_info
ALTER TABLE t1 CHANGE COLUMN f1 f1_no_real_change TIMESTAMP NULL DEFAULT NULL;
--disable_info
DROP TABLE t1;
--echo End of 5.1 tests
#

View file

@ -10,36 +10,13 @@ insert into t1 values (1,2,"","Y","2002-03-03"), (3,4,"","N","2002-03-04"), (5,6
select count(*) from t1 procedure analyse();
select * from t1 procedure analyse();
select * from t1 procedure analyse(2);
--error ER_WRONG_USAGE
create table t2 select * from t1 procedure analyse();
select * from t2;
drop table t1,t2;
drop table t1;
--error ER_WRONG_USAGE
EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE();
#
# Test with impossible where
#
create table t1 (a int not null);
create table t2 select * from t1 where 0=1 procedure analyse();
show create table t2;
select * from t1 where 0=1 procedure analyse();
insert into t1 values(1);
drop table t2;
create table t2 select * from t1 where 0=1 procedure analyse();
show create table t2;
select * from t2;
insert into t2 select * from t1 procedure analyse();
select * from t2;
insert into t1 values(2);
drop table t2;
create table t2 select * from t1 where 0=1 procedure analyse();
show create table t2;
select * from t2;
insert into t2 select * from t1 procedure analyse();
select * from t2;
drop table t1,t2;
#
# Bug#2813 - analyse does not quote string values in enums from string
#
@ -113,3 +90,46 @@ SELECT * FROM (SELECT * FROM t1) d PROCEDURE ANALYSE();
DROP TABLE t1;
--echo End of 4.1 tests
--echo #
--echo # Bug #48293: crash with procedure analyse, view with > 10 columns,
--echo # having clause...
--echo #
CREATE TABLE t1(a INT, b INT, c INT, d INT, e INT,
f INT, g INT, h INT, i INT, j INT,k INT);
INSERT INTO t1 VALUES (),();
CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
--echo #should have a derived table
EXPLAIN SELECT * FROM v1;
--echo #should not crash
--error ER_WRONG_USAGE
SELECT * FROM v1 PROCEDURE analyse();
--echo #should not crash
--error ER_WRONG_USAGE
SELECT * FROM t1 a, v1, t1 b PROCEDURE analyse();
--echo #should not crash
--error ER_WRONG_USAGE
SELECT * FROM (SELECT * FROM t1 having a > 1) x PROCEDURE analyse();
--echo #should not crash
--error ER_WRONG_USAGE
SELECT * FROM t1 a, (SELECT * FROM t1 having a > 1) x, t1 b PROCEDURE analyse();
--echo #should not crash
--error ER_ORDER_WITH_PROC
SELECT 1 FROM t1 group by a having a > 1 order by 1 PROCEDURE analyse();
DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1),(2);
--echo # should not crash
--error ER_WRONG_USAGE
CREATE TABLE t2 SELECT 1 FROM t1, t1 t3 GROUP BY t3.a PROCEDURE ANALYSE();
DROP TABLE t1;
--echo End of 5.0 tests

View file

@ -1,46 +0,0 @@
--source include/have_innodb.inc
--echo #
--echo # Bug #40113: Embedded SELECT inside UPDATE or DELETE can timeout
--echo # without error
--echo #
CREATE TABLE t1 (a int, b int, PRIMARY KEY (a,b)) ENGINE=InnoDB;
INSERT INTO t1 (a,b) VALUES (1070109,99);
CREATE TABLE t2 (b int, a int, PRIMARY KEY (b)) ENGINE=InnoDB;
INSERT INTO t2 (b,a) VALUES (7,1070109);
SELECT * FROM t1;
BEGIN;
SELECT b FROM t2 WHERE b=7 FOR UPDATE;
CONNECT (addconroot, localhost, root,,);
CONNECTION addconroot;
BEGIN;
--error ER_LOCK_WAIT_TIMEOUT
SELECT b FROM t2 WHERE b=7 FOR UPDATE;
--error ER_LOCK_WAIT_TIMEOUT
INSERT INTO t1 (a) VALUES ((SELECT a FROM t2 WHERE b=7));
--error ER_LOCK_WAIT_TIMEOUT
UPDATE t1 SET a='7000000' WHERE a=(SELECT a FROM t2 WHERE b=7);
--error ER_LOCK_WAIT_TIMEOUT
DELETE FROM t1 WHERE a=(SELECT a FROM t2 WHERE b=7);
SELECT * FROM t1;
CONNECTION default;
DISCONNECT addconroot;
DROP TABLE t2, t1;
--echo End of 5.0 tests

View file

@ -172,6 +172,18 @@ DROP TABLE t1;
#
# Test that optimizer doesn't use indexes with wrong collation
#
#
# BUG#48447, Delivering too few records with indexes using collate syntax
#
create table t1 (a varchar(1) character set latin1 collate latin1_general_ci);
insert into t1 values ('A'),('a'),('B'),('b'),('C'),('c');
select * from t1 where a > 'B' collate latin1_bin;
select * from t1 where a <> 'B' collate latin1_bin;
create index i on t1 (a);
select * from t1 where a > 'B' collate latin1_bin;
select * from t1 where a <> 'B' collate latin1_bin;
drop table t1;
SET NAMES latin1;
CREATE TABLE t1
(s1 char(10) COLLATE latin1_german1_ci,

View file

@ -37,6 +37,14 @@ UPDATE t1 SET col2=col1;
SELECT * FROM t1 WHERE col1=col2 ORDER BY col1;
DROP TABLE t1;
--echo #
--echo # Bug#45645 Mysql server close all connection and restart using lower function
--echo #
CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET utf8 COLLATE utf8_test_ci;
INSERT INTO t1 (a) VALUES ('hello!');
SELECT * FROM t1 WHERE LOWER(a)=LOWER('N');
DROP TABLE t1;
--echo #
--echo # Bug#43827 Server closes connections and restarts
--echo #

View file

@ -10,8 +10,8 @@
#
##############################################################################
kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild.
innodb_bug39438 : Bug#42383 2009-01-28 lsoares "This fails in embedded and on windows. Note that this test is not run on windows and on embedded in PB for main trees currently"
query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically
partition_innodb_builtin : Bug#32430 2009-09-25 mattiasj Waiting for push of Innodb changes
partition_innodb_plugin : Bug#32430 2009-09-25 mattiasj Waiting for push of Innodb changes
innodb_bug46000 : Bug#47860 2009-10-16 satyab Test fails for innodb plugin 1.0.5
innodb-autoinc : Bug#48482 2009-11-02 svoj innodb-autoinc.test fails with results difference
rpl_killed_ddl : Bug#45520: rpl_killed_ddl fails sporadically in pb2

View file

@ -167,6 +167,25 @@ flush tables;
SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN ( SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.t < '2005-11-13 7:41:31' );
drop tables t1, t2;
--echo #
--echo # Bug#48295:
--echo # explain extended crash with subquery and ONLY_FULL_GROUP_BY sql_mode
--echo #
CREATE TABLE t1 (f1 INT);
SELECT @@session.sql_mode INTO @old_sql_mode;
SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
# EXPLAIN EXTENDED (with subselect). used to crash. should give NOTICE.
--error ER_MIX_OF_GROUP_FUNC_AND_FIELDS
EXPLAIN EXTENDED SELECT 1 FROM t1
WHERE f1 > ALL( SELECT t.f1 FROM t1,t1 AS t );
SHOW WARNINGS;
SET SESSION sql_mode=@old_sql_mode;
DROP TABLE t1;
--echo #
--echo # Bug#30302: Tables that were optimized away are printed in the
@ -179,4 +198,5 @@ insert into t2 values(1),(2);
explain extended select * from t1 where f1=1;
explain extended select * from t1 join t2 on f1=f2 where f1=1;
drop table t1,t2;
--echo End of 5.1 tests.

View file

@ -57,7 +57,7 @@ connection con1;
# debug build running without our --debug=make_global..., will be
# error 0 (no error). The only important thing to test is that on
# debug builds with our --debug=make_global... we don't hang forever.
--error 0,1053,2013
--error 0,1317,2013
reap;
connection con2;

View file

@ -881,4 +881,25 @@ SELECT COUNT(*) FROM t1 IGNORE INDEX (b) WHERE
DROP TABLE t1;
--echo #
--echo # Bug #48258: Assertion failed when using a spatial index
--echo #
CREATE TABLE t1(a LINESTRING NOT NULL, SPATIAL KEY(a));
INSERT INTO t1 VALUES
(GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)')),
(GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)'));
EXPLAIN SELECT 1 FROM t1 WHERE a = GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
SELECT 1 FROM t1 WHERE a = GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
EXPLAIN SELECT 1 FROM t1 WHERE a < GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
SELECT 1 FROM t1 WHERE a < GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
EXPLAIN SELECT 1 FROM t1 WHERE a <= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
SELECT 1 FROM t1 WHERE a <= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
EXPLAIN SELECT 1 FROM t1 WHERE a > GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
SELECT 1 FROM t1 WHERE a > GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
EXPLAIN SELECT 1 FROM t1 WHERE a >= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
SELECT 1 FROM t1 WHERE a >= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
DROP TABLE t1;
--echo End of 5.0 tests.

View file

@ -655,6 +655,22 @@ insert into t1 values (),(),();
select min(`col002`) from t1 union select `col002` from t1;
drop table t1;
--echo #
--echo # Bug #47780: crash when comparing GIS items from subquery
--echo #
CREATE TABLE t1(a INT, b MULTIPOLYGON);
INSERT INTO t1 VALUES
(0,
GEOMFROMTEXT(
'multipolygon(((1 2,3 4,5 6,7 8,9 8),(7 6,5 4,3 2,1 2,3 4)))'));
--echo # must not crash
SELECT 1 FROM t1 WHERE a <> (SELECT GEOMETRYCOLLECTIONFROMWKB(b) FROM t1);
DROP TABLE t1;
--echo End of 5.0 tests

View file

@ -163,6 +163,41 @@ connection default;
DROP USER 'mysqltest1'@'%';
DROP DATABASE mysqltest_1;
--echo #
--echo # Bug#41597 - After rename of user, there are additional grants
--echo # when grants are reapplied.
--echo #
CREATE DATABASE temp;
CREATE TABLE temp.t1(a INT, b VARCHAR(10));
INSERT INTO temp.t1 VALUES(1, 'name1');
INSERT INTO temp.t1 VALUES(2, 'name2');
INSERT INTO temp.t1 VALUES(3, 'name3');
CREATE USER 'user1'@'%';
RENAME USER 'user1'@'%' TO 'user2'@'%';
--echo # Show privileges after rename and BEFORE grant
SHOW GRANTS FOR 'user2'@'%';
GRANT SELECT (a), INSERT (b) ON `temp`.`t1` TO 'user2'@'%';
--echo # Show privileges after rename and grant
SHOW GRANTS FOR 'user2'@'%';
--echo # Connect as the renamed user
connect (conn1, localhost, user2,,);
connection conn1;
SHOW GRANTS;
SELECT a FROM temp.t1;
--echo # Check for additional privileges by accessing a
--echo # non privileged column. We shouldn't be able to
--echo # access this column.
--error ER_COLUMNACCESS_DENIED_ERROR
SELECT b FROM temp.t1;
disconnect conn1;
connection default;
DROP USER 'user2'@'%';
DROP DATABASE temp;
--echo End of 5.0 tests

View file

@ -0,0 +1,30 @@
-- source include/have_case_insensitive_fs.inc
-- source include/not_embedded.inc
#
# Bug#41049 does syntax "grant" case insensitive?
#
create database db1;
GRANT CREATE ON db1.* to user_1@localhost;
GRANT SELECT ON db1.* to USER_1@localhost;
connect (con1,localhost,user_1,,db1);
CREATE TABLE t1(f1 int);
--error 1142
SELECT * FROM t1;
connect (con2,localhost,USER_1,,db1);
SELECT * FROM t1;
--error 1142
CREATE TABLE t2(f1 int);
connection default;
disconnect con1;
disconnect con2;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM USER_1@localhost;
DROP USER user_1@localhost;
DROP USER USER_1@localhost;
DROP DATABASE db1;
use test;

View file

@ -479,9 +479,10 @@ INSERT INTO t2 SELECT NULL FROM t1;
DROP TABLE t1;
DROP TABLE t2;
#
# BUG#44030: Error: (1500) Couldn't read the MAX(ID) autoinc value from
# 44030: Error: (1500) Couldn't read the MAX(ID) autoinc value from
# the index (PRIMARY)
# This test requires a restart of the server
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (null);
INSERT INTO t1 VALUES (null);
@ -495,6 +496,123 @@ SELECT * FROM t1;
-- error ER_AUTOINC_READ_FAILED,1467
INSERT INTO t1 VALUES(null);
ALTER TABLE t1 AUTO_INCREMENT = 3;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES(null);
SELECT * FROM t1;
DROP TABLE t1;
# If the user has specified negative values for an AUTOINC column then
# InnoDB should ignore those values when setting the table's max value.
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SHOW VARIABLES LIKE "%auto_inc%";
# TINYINT
CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (-1, 'innodb');
INSERT INTO t1 VALUES (-127, 'innodb');
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (-1, 'innodb');
INSERT INTO t1 VALUES (-127, 'innodb');
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
#
# SMALLINT
#
CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (-1, 'innodb');
INSERT INTO t1 VALUES (-32767, 'innodb');
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (-1, 'innodb');
INSERT INTO t1 VALUES (-32757, 'innodb');
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
#
# MEDIUMINT
#
CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (-1, 'innodb');
INSERT INTO t1 VALUES (-8388607, 'innodb');
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (-1, 'innodb');
INSERT INTO t1 VALUES (-8388607, 'innodb');
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
#
# INT
#
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (-1, 'innodb');
INSERT INTO t1 VALUES (-2147483647, 'innodb');
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (-1, 'innodb');
INSERT INTO t1 VALUES (-2147483647, 'innodb');
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
#
# BIGINT
#
CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (-1, 'innodb');
INSERT INTO t1 VALUES (-9223372036854775807, 'innodb');
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (c1 BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (-1, 'innodb');
INSERT INTO t1 VALUES (-9223372036854775807, 'innodb');
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
#
# End negative number check
##
# 47125: auto_increment start value is ignored if an index is created
# and engine=innodb
#
CREATE TABLE T1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB;
CREATE INDEX i1 on T1(c2);
SHOW CREATE TABLE T1;
INSERT INTO T1 (c2) values (0);
SELECT * FROM T1;
DROP TABLE T1;

View file

@ -1317,7 +1317,6 @@ drop table t1;
# Test for testable InnoDB status variables. This test
# uses previous ones(pages_created, rows_deleted, ...).
# We get one of 511 or 512 randomly
--replace_result 511 512
SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total';
SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size';

View file

@ -9,6 +9,10 @@
-- source include/have_innodb.inc
--disable_query_log
call mtr.add_suppression("InnoDB: Error: table 'test/bug39438'");
--enable_query_log
SET storage_engine=InnoDB;
# we care only that the following SQL commands do not crash the server

View file

@ -13,15 +13,9 @@ create table bug44369 (DB_ROW_ID int) engine=innodb;
--error ER_CANT_CREATE_TABLE
create table bug44369 (db_row_id int) engine=innodb;
# TODO: after Bug#47233 is fixed, 'show warning' should be replaced by 'show
# errors' again.
# show errors;
show warnings;
--error ER_CANT_CREATE_TABLE
create table bug44369 (db_TRX_Id int) engine=innodb;
# TODO: after Bug#47233 is fixed, 'show warning' should be replaced by 'show
# errors' again.
# show errors;
show warnings;

View file

@ -7,24 +7,22 @@
# This 'create table' operation should fail because of
# using the reserve name as its index name.
--error ER_CANT_CREATE_TABLE
--error ER_WRONG_NAME_FOR_INDEX
create table bug46000(`id` int,key `GEN_CLUST_INDEX`(`id`))engine=innodb;
# Mixed upper/lower case of the reserved key words
--error ER_CANT_CREATE_TABLE
--error ER_WRONG_NAME_FOR_INDEX
create table bug46000(`id` int, key `GEN_clust_INDEX`(`id`))engine=innodb;
show errors;
show warnings;
create table bug46000(id int) engine=innodb;
# This 'create index' operation should fail.
--replace_regex /'[^']*test.#sql-[0-9a-f_]*'/'#sql-temporary'/
--error ER_CANT_CREATE_TABLE
--error ER_WRONG_NAME_FOR_INDEX
create index GEN_CLUST_INDEX on bug46000(id);
--replace_regex /'[^']*test.#sql-[0-9a-f_]*'/'#sql-temporary'/
show errors;
show warnings;
# This 'create index' operation should succeed, no
# temp table left from last failed create index

View file

@ -0,0 +1,24 @@
# This is the test for bug 47777. GEOMETRY
# data is treated as BLOB data in innodb.
# Consequently, its key value generation/storing
# should follow the process for the BLOB
# datatype as well.
--source include/have_innodb.inc
create table bug47777(c2 linestring not null, primary key (c2(1))) engine=innodb;
insert into bug47777 values (geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)'));
# Verify correct row get inserted.
select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
# Update table bug47777 should be successful.
update bug47777 set c2=GeomFromText('POINT(1 1)');
# Verify the row get updated successfully. The original
# c2 value should be changed to GeomFromText('POINT(1 1)').
select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
select count(*) from bug47777 where c2 = GeomFromText('POINT(1 1)');
drop table bug47777;

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