Commit 4d305fb9 authored by Otto Kekäläinen's avatar Otto Kekäläinen
Browse files

Imported Upstream version 5.5.52

parent 95c6357a
commit: 12ae840375fe30da1c23647facaa0678858d6d92 commit: 0da39caceea7733a94d898427d63ba2670160af4
date: 2016-06-16 22:04:24 +0300 date: 2016-09-12 16:42:05 +0200
build-date: 2016-06-16 21:08:07 +0200 build-date: 2016-09-12 16:54:58 +0200
short: 12ae840 short: 0da39ca
branch: HEAD branch: HEAD
MySQL source 5.5.50 MySQL source 5.5.52
MYSQL_VERSION_MAJOR=5 MYSQL_VERSION_MAJOR=5
MYSQL_VERSION_MINOR=5 MYSQL_VERSION_MINOR=5
MYSQL_VERSION_PATCH=50 MYSQL_VERSION_PATCH=52
MYSQL_VERSION_EXTRA= MYSQL_VERSION_EXTRA=
...@@ -232,7 +232,7 @@ static int process_selected_tables(char *db, char **table_names, int tables); ...@@ -232,7 +232,7 @@ static int process_selected_tables(char *db, char **table_names, int tables);
static int process_all_tables_in_db(char *database); static int process_all_tables_in_db(char *database);
static int process_one_db(char *database); static int process_one_db(char *database);
static int use_db(char *database); static int use_db(char *database);
static int handle_request_for_tables(char *tables, size_t length, my_bool view); static int handle_request_for_tables(char *, size_t, my_bool, my_bool);
static int dbConnect(char *host, char *user,char *passwd); static int dbConnect(char *host, char *user,char *passwd);
static void dbDisconnect(char *host); static void dbDisconnect(char *host);
static void DBerror(MYSQL *mysql, const char *when); static void DBerror(MYSQL *mysql, const char *when);
...@@ -566,7 +566,7 @@ static int process_selected_tables(char *db, char **table_names, int tables) ...@@ -566,7 +566,7 @@ static int process_selected_tables(char *db, char **table_names, int tables)
} }
*--end = 0; *--end = 0;
handle_request_for_tables(table_names_comma_sep + 1, tot_length - 1, handle_request_for_tables(table_names_comma_sep + 1, tot_length - 1,
opt_do_views != 0); opt_do_views != 0, opt_all_in_1);
my_free(table_names_comma_sep); my_free(table_names_comma_sep);
} }
else else
...@@ -577,7 +577,7 @@ static int process_selected_tables(char *db, char **table_names, int tables) ...@@ -577,7 +577,7 @@ static int process_selected_tables(char *db, char **table_names, int tables)
view= is_view(table); view= is_view(table);
if (view < 0) if (view < 0)
continue; continue;
handle_request_for_tables(table, table_len, (view == 1)); handle_request_for_tables(table, table_len, view == 1, opt_all_in_1);
} }
DBUG_RETURN(0); DBUG_RETURN(0);
} /* process_selected_tables */ } /* process_selected_tables */
...@@ -605,14 +605,10 @@ static char *fix_table_name(char *dest, char *src) ...@@ -605,14 +605,10 @@ static char *fix_table_name(char *dest, char *src)
*dest++= '`'; *dest++= '`';
for (; *src; src++) for (; *src; src++)
{ {
switch (*src) { if (*src == '`')
case '`': /* escape backtick character */
*dest++= '`'; *dest++= '`';
/* fall through */
default:
*dest++= *src; *dest++= *src;
} }
}
*dest++= '`'; *dest++= '`';
DBUG_RETURN(dest); DBUG_RETURN(dest);
...@@ -700,9 +696,9 @@ static int process_all_tables_in_db(char *database) ...@@ -700,9 +696,9 @@ static int process_all_tables_in_db(char *database)
*--end = 0; *--end = 0;
*--views_end = 0; *--views_end = 0;
if (tot_length) if (tot_length)
handle_request_for_tables(tables + 1, tot_length - 1, FALSE); handle_request_for_tables(tables + 1, tot_length - 1, FALSE, opt_all_in_1);
if (tot_views_length) if (tot_views_length)
handle_request_for_tables(views + 1, tot_views_length - 1, TRUE); handle_request_for_tables(views + 1, tot_views_length - 1, TRUE, opt_all_in_1);
my_free(tables); my_free(tables);
my_free(views); my_free(views);
} }
...@@ -728,7 +724,7 @@ static int process_all_tables_in_db(char *database) ...@@ -728,7 +724,7 @@ static int process_all_tables_in_db(char *database)
!strcmp(row[0], "slow_log"))) !strcmp(row[0], "slow_log")))
continue; /* Skip logging tables */ continue; /* Skip logging tables */
handle_request_for_tables(row[0], fixed_name_length(row[0]), view); handle_request_for_tables(row[0], fixed_name_length(row[0]), view, opt_all_in_1);
} }
} }
mysql_free_result(res); mysql_free_result(res);
...@@ -756,7 +752,7 @@ static int fix_table_storage_name(const char *name) ...@@ -756,7 +752,7 @@ static int fix_table_storage_name(const char *name)
if (strncmp(name, "#mysql50#", 9)) if (strncmp(name, "#mysql50#", 9))
DBUG_RETURN(1); DBUG_RETURN(1);
my_snprintf(qbuf, sizeof(qbuf), "RENAME TABLE `%s` TO `%s`", my_snprintf(qbuf, sizeof(qbuf), "RENAME TABLE %`s TO %`s",
name, name + 9); name, name + 9);
rc= run_query(qbuf); rc= run_query(qbuf);
...@@ -773,7 +769,7 @@ static int fix_database_storage_name(const char *name) ...@@ -773,7 +769,7 @@ static int fix_database_storage_name(const char *name)
if (strncmp(name, "#mysql50#", 9)) if (strncmp(name, "#mysql50#", 9))
DBUG_RETURN(1); DBUG_RETURN(1);
my_snprintf(qbuf, sizeof(qbuf), "ALTER DATABASE `%s` UPGRADE DATA DIRECTORY " my_snprintf(qbuf, sizeof(qbuf), "ALTER DATABASE %`s UPGRADE DATA DIRECTORY "
"NAME", name); "NAME", name);
rc= run_query(qbuf); rc= run_query(qbuf);
if (verbose) if (verbose)
...@@ -787,13 +783,11 @@ static int rebuild_table(char *name) ...@@ -787,13 +783,11 @@ static int rebuild_table(char *name)
int rc= 0; int rc= 0;
DBUG_ENTER("rebuild_table"); DBUG_ENTER("rebuild_table");
query= (char*)my_malloc(sizeof(char) * (12 + fixed_name_length(name) + 6 + 1), query= (char*)my_malloc(sizeof(char) * (12 + strlen(name) + 6 + 1),
MYF(MY_WME)); MYF(MY_WME));
if (!query) if (!query)
DBUG_RETURN(1); DBUG_RETURN(1);
ptr= strmov(query, "ALTER TABLE "); ptr= strxmov(query, "ALTER TABLE ", name, " FORCE", NullS);
ptr= fix_table_name(ptr, name);
ptr= strxmov(ptr, " FORCE", NullS);
if (mysql_real_query(sock, query, (ulong)(ptr - query))) if (mysql_real_query(sock, query, (ulong)(ptr - query)))
{ {
fprintf(stderr, "Failed to %s\n", query); fprintf(stderr, "Failed to %s\n", query);
...@@ -849,7 +843,8 @@ static int disable_binlog() ...@@ -849,7 +843,8 @@ static int disable_binlog()
return run_query(stmt); return run_query(stmt);
} }
static int handle_request_for_tables(char *tables, size_t length, my_bool view) static int handle_request_for_tables(char *tables, size_t length,
my_bool view, my_bool dont_quote)
{ {
char *query, *end, options[100], message[100]; char *query, *end, options[100], message[100];
char table_name_buff[NAME_CHAR_LEN*2*2+1], *table_name; char table_name_buff[NAME_CHAR_LEN*2*2+1], *table_name;
...@@ -907,7 +902,7 @@ static int handle_request_for_tables(char *tables, size_t length, my_bool view) ...@@ -907,7 +902,7 @@ static int handle_request_for_tables(char *tables, size_t length, my_bool view)
if (!(query =(char *) my_malloc(query_size, MYF(MY_WME)))) if (!(query =(char *) my_malloc(query_size, MYF(MY_WME))))
DBUG_RETURN(1); DBUG_RETURN(1);
if (opt_all_in_1) if (dont_quote)
{ {
DBUG_ASSERT(strlen(op)+strlen(tables)+strlen(options)+8+1 <= query_size); DBUG_ASSERT(strlen(op)+strlen(tables)+strlen(options)+8+1 <= query_size);
...@@ -950,6 +945,13 @@ static int handle_request_for_tables(char *tables, size_t length, my_bool view) ...@@ -950,6 +945,13 @@ static int handle_request_for_tables(char *tables, size_t length, my_bool view)
DBUG_RETURN(0); DBUG_RETURN(0);
} }
static void insert_table_name(DYNAMIC_ARRAY *arr, char *in, size_t dblen)
{
char buf[NAME_LEN*2+2];
in[dblen]= 0;
my_snprintf(buf, sizeof(buf), "%`s.%`s", in, in + dblen + 1);
insert_dynamic(arr, (uchar*) buf);
}
static void print_result() static void print_result()
{ {
...@@ -957,16 +959,13 @@ static void print_result() ...@@ -957,16 +959,13 @@ static void print_result()
MYSQL_ROW row; MYSQL_ROW row;
char prev[(NAME_LEN+9)*3+2]; char prev[(NAME_LEN+9)*3+2];
char prev_alter[MAX_ALTER_STR_SIZE]; char prev_alter[MAX_ALTER_STR_SIZE];
char *db_name; size_t length_of_db= strlen(sock->db);
uint length_of_db;
uint i; uint i;
my_bool found_error=0, table_rebuild=0; my_bool found_error=0, table_rebuild=0;
DYNAMIC_ARRAY *array4repair= &tables4repair; DYNAMIC_ARRAY *array4repair= &tables4repair;
DBUG_ENTER("print_result"); DBUG_ENTER("print_result");
res = mysql_use_result(sock); res = mysql_use_result(sock);
db_name= sock->db;
length_of_db= strlen(db_name);
prev[0] = '\0'; prev[0] = '\0';
prev_alter[0]= 0; prev_alter[0]= 0;
...@@ -990,16 +989,10 @@ static void print_result() ...@@ -990,16 +989,10 @@ static void print_result()
if (prev_alter[0]) if (prev_alter[0])
insert_dynamic(&alter_table_cmds, (uchar*) prev_alter); insert_dynamic(&alter_table_cmds, (uchar*) prev_alter);
else else
{ insert_table_name(&tables4rebuild, prev, length_of_db);
char *table_name= prev + (length_of_db+1);
insert_dynamic(&tables4rebuild, (uchar*) table_name);
}
} }
else else
{ insert_table_name(array4repair, prev, length_of_db);
char *table_name= prev + (length_of_db+1);
insert_dynamic(array4repair, (uchar*) table_name);
}
} }
array4repair= &tables4repair; array4repair= &tables4repair;
found_error=0; found_error=0;
...@@ -1066,16 +1059,10 @@ static void print_result() ...@@ -1066,16 +1059,10 @@ static void print_result()
if (prev_alter[0]) if (prev_alter[0])
insert_dynamic(&alter_table_cmds, (uchar*) prev_alter); insert_dynamic(&alter_table_cmds, (uchar*) prev_alter);
else else
{ insert_table_name(&tables4rebuild, prev, length_of_db);
char *table_name= prev + (length_of_db+1);
insert_dynamic(&tables4rebuild, (uchar*) table_name);
}
} }
else else
{ insert_table_name(array4repair, prev, length_of_db);
char *table_name= prev + (length_of_db+1);
insert_dynamic(array4repair, (uchar*) table_name);
}
} }
mysql_free_result(res); mysql_free_result(res);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
...@@ -1209,7 +1196,7 @@ int main(int argc, char **argv) ...@@ -1209,7 +1196,7 @@ int main(int argc, char **argv)
for (i = 0; i < tables4repair.elements ; i++) for (i = 0; i < tables4repair.elements ; i++)
{ {
char *name= (char*) dynamic_array_ptr(&tables4repair, i); char *name= (char*) dynamic_array_ptr(&tables4repair, i);
handle_request_for_tables(name, fixed_name_length(name), FALSE); handle_request_for_tables(name, fixed_name_length(name), FALSE, TRUE);
} }
for (i = 0; i < tables4rebuild.elements ; i++) for (i = 0; i < tables4rebuild.elements ; i++)
rebuild_table((char*) dynamic_array_ptr(&tables4rebuild, i)); rebuild_table((char*) dynamic_array_ptr(&tables4rebuild, i));
...@@ -1220,7 +1207,7 @@ int main(int argc, char **argv) ...@@ -1220,7 +1207,7 @@ int main(int argc, char **argv)
for (i = 0; i < views4repair.elements ; i++) for (i = 0; i < views4repair.elements ; i++)
{ {
char *name= (char*) dynamic_array_ptr(&views4repair, i); char *name= (char*) dynamic_array_ptr(&views4repair, i);
handle_request_for_tables(name, fixed_name_length(name), TRUE); handle_request_for_tables(name, fixed_name_length(name), TRUE, TRUE);
} }
} }
ret= test(first_error); ret= test(first_error);
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
/* Global Thread counter */ /* Global Thread counter */
uint counter= 0; uint counter= 0;
pthread_mutex_t init_mutex;
pthread_mutex_t counter_mutex; pthread_mutex_t counter_mutex;
pthread_cond_t count_threshhold; pthread_cond_t count_threshhold;
...@@ -421,6 +422,17 @@ static MYSQL *db_connect(char *host, char *database, ...@@ -421,6 +422,17 @@ static MYSQL *db_connect(char *host, char *database,
MYSQL *mysql; MYSQL *mysql;
if (verbose) if (verbose)
fprintf(stdout, "Connecting to %s\n", host ? host : "localhost"); fprintf(stdout, "Connecting to %s\n", host ? host : "localhost");
if (opt_use_threads && !lock_tables)
{
pthread_mutex_lock(&init_mutex);
if (!(mysql= mysql_init(NULL)))
{
pthread_mutex_unlock(&init_mutex);
return 0;
}
pthread_mutex_unlock(&init_mutex);
}
else
if (!(mysql= mysql_init(NULL))) if (!(mysql= mysql_init(NULL)))
return 0; return 0;
if (opt_compress) if (opt_compress)
...@@ -605,7 +617,7 @@ pthread_handler_t worker_thread(void *arg) ...@@ -605,7 +617,7 @@ pthread_handler_t worker_thread(void *arg)
pthread_cond_signal(&count_threshhold); pthread_cond_signal(&count_threshhold);
pthread_mutex_unlock(&counter_mutex); pthread_mutex_unlock(&counter_mutex);
mysql_thread_end(); mysql_thread_end();
pthread_exit(0);
return 0; return 0;
} }
...@@ -629,15 +641,31 @@ int main(int argc, char **argv) ...@@ -629,15 +641,31 @@ int main(int argc, char **argv)
if (opt_use_threads && !lock_tables) if (opt_use_threads && !lock_tables)
{ {
pthread_t mainthread; /* Thread descriptor */ char **save_argv;
uint worker_thread_count= 0, table_count= 0, i= 0;
pthread_t *worker_threads; /* Thread descriptor */
pthread_attr_t attr; /* Thread attributes */ pthread_attr_t attr; /* Thread attributes */
pthread_attr_init(&attr); pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, pthread_attr_setdetachstate(&attr,
PTHREAD_CREATE_DETACHED); PTHREAD_CREATE_JOINABLE);
pthread_mutex_init(&init_mutex, NULL);
pthread_mutex_init(&counter_mutex, NULL); pthread_mutex_init(&counter_mutex, NULL);
pthread_cond_init(&count_threshhold, NULL); pthread_cond_init(&count_threshhold, NULL);
/* Count the number of tables. This number denotes the total number
of threads spawn.
*/
save_argv= argv;
for (table_count= 0; *argv != NULL; argv++)
table_count++;
argv= save_argv;
if (!(worker_threads= (pthread_t*) my_malloc(table_count *
sizeof(*worker_threads),
MYF(0))))
return -2;
for (counter= 0; *argv != NULL; argv++) /* Loop through tables */ for (counter= 0; *argv != NULL; argv++) /* Loop through tables */
{ {
pthread_mutex_lock(&counter_mutex); pthread_mutex_lock(&counter_mutex);
...@@ -652,15 +680,16 @@ int main(int argc, char **argv) ...@@ -652,15 +680,16 @@ int main(int argc, char **argv)
counter++; counter++;
pthread_mutex_unlock(&counter_mutex); pthread_mutex_unlock(&counter_mutex);
/* now create the thread */ /* now create the thread */
if (pthread_create(&mainthread, &attr, worker_thread, if (pthread_create(&worker_threads[worker_thread_count], &attr,
(void *)*argv) != 0) worker_thread, (void *)*argv) != 0)
{ {
pthread_mutex_lock(&counter_mutex); pthread_mutex_lock(&counter_mutex);
counter--; counter--;
pthread_mutex_unlock(&counter_mutex); pthread_mutex_unlock(&counter_mutex);
fprintf(stderr,"%s: Could not create thread\n", fprintf(stderr,"%s: Could not create thread\n", my_progname);
my_progname); continue;
} }
worker_thread_count++;
} }
/* /*
...@@ -675,9 +704,18 @@ int main(int argc, char **argv) ...@@ -675,9 +704,18 @@ int main(int argc, char **argv)
pthread_cond_timedwait(&count_threshhold, &counter_mutex, &abstime); pthread_cond_timedwait(&count_threshhold, &counter_mutex, &abstime);
} }
pthread_mutex_unlock(&counter_mutex); pthread_mutex_unlock(&counter_mutex);
pthread_mutex_destroy(&init_mutex);
pthread_mutex_destroy(&counter_mutex); pthread_mutex_destroy(&counter_mutex);
pthread_cond_destroy(&count_threshhold); pthread_cond_destroy(&count_threshhold);
pthread_attr_destroy(&attr); pthread_attr_destroy(&attr);
for(i= 0; i < worker_thread_count; i++)
{
if (pthread_join(worker_threads[i], NULL))
fprintf(stderr,"%s: Could not join worker thread.\n", my_progname);
}
my_free(worker_threads);
} }
else else
{ {
......
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. /* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2010, 2013, Monty Program Ab. Copyright (c) 2010, 2016, Monty Program Ab.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -246,7 +246,7 @@ extern my_bool my_use_symdir; ...@@ -246,7 +246,7 @@ extern my_bool my_use_symdir;
extern ulong my_default_record_cache_size; extern ulong my_default_record_cache_size;
extern my_bool my_disable_locking, my_disable_async_io, extern my_bool my_disable_locking, my_disable_async_io,
my_disable_flush_key_blocks, my_disable_symlinks; my_disable_flush_key_blocks, my_disable_symlinks;
extern my_bool my_disable_sync; extern my_bool my_disable_sync, my_disable_copystat_in_redel;
extern char wild_many,wild_one,wild_prefix; extern char wild_many,wild_one,wild_prefix;
extern const char *charsets_dir; extern const char *charsets_dir;
/* from default.c */ /* from default.c */
......
...@@ -341,6 +341,12 @@ static int emb_stmt_execute(MYSQL_STMT *stmt) ...@@ -341,6 +341,12 @@ static int emb_stmt_execute(MYSQL_STMT *stmt)
THD *thd; THD *thd;
my_bool res; my_bool res;
if (stmt->param_count && !stmt->bind_param_done)
{
set_stmt_error(stmt, CR_PARAMS_NOT_BOUND, unknown_sqlstate, NULL);
DBUG_RETURN(1);
}
int4store(header, stmt->stmt_id); int4store(header, stmt->stmt_id);
header[4]= (uchar) stmt->flags; header[4]= (uchar) stmt->flags;
thd= (THD*)stmt->mysql->thd; thd= (THD*)stmt->mysql->thd;
......
#
# show server variables
#
--disable_query_log
--echo ===== ENGINES =====
show engines;
--echo ===== VARIABLES =====
show variables;
--echo ===== STOP =====
--enable_query_log
exit;
...@@ -276,7 +276,6 @@ my $opt_port_base= $ENV{'MTR_PORT_BASE'} || "auto"; ...@@ -276,7 +276,6 @@ my $opt_port_base= $ENV{'MTR_PORT_BASE'} || "auto";
my $build_thread= 0; my $build_thread= 0;
my $opt_record; my $opt_record;
my $opt_report_features;
our $opt_resfile= $ENV{'MTR_RESULT_FILE'} || 0; our $opt_resfile= $ENV{'MTR_RESULT_FILE'} || 0;
...@@ -422,21 +421,6 @@ sub main { ...@@ -422,21 +421,6 @@ sub main {
my $tests= collect_test_cases($opt_reorder, $opt_suites, \@opt_cases, \@opt_skip_test_list); my $tests= collect_test_cases($opt_reorder, $opt_suites, \@opt_cases, \@opt_skip_test_list);
mark_time_used('collect'); mark_time_used('collect');
if ( $opt_report_features ) {
# Put "report features" as the first test to run
my $tinfo = My::Test->new
(
name => 'report_features',
# No result_file => Prints result
path => 'include/report-features.test',
template_path => "include/default_my.cnf",
master_opt => [],
slave_opt => [],
suite => 'main',
);
unshift(@$tests, $tinfo);
}
####################################################################### #######################################################################
my $num_tests= @$tests; my $num_tests= @$tests;
if ( $opt_parallel eq "auto" ) { if ( $opt_parallel eq "auto" ) {
...@@ -1203,7 +1187,6 @@ sub command_line_setup { ...@@ -1203,7 +1187,6 @@ sub command_line_setup {
'client-libdir=s' => \$path_client_libdir, 'client-libdir=s' => \$path_client_libdir,
# Misc # Misc
'report-features' => \$opt_report_features,
'comment=s' => \$opt_comment, 'comment=s' => \$opt_comment,
'fast' => \$opt_fast, 'fast' => \$opt_fast,
'force-restart' => \$opt_force_restart, 'force-restart' => \$opt_force_restart,
...@@ -6569,7 +6552,6 @@ Misc options ...@@ -6569,7 +6552,6 @@ Misc options
gprof Collect profiling information using gprof. gprof Collect profiling information using gprof.
experimental=<file> Refer to list of tests considered experimental; experimental=<file> Refer to list of tests considered experimental;
failures will be marked exp-fail instead of fail. failures will be marked exp-fail instead of fail.
report-features First run a "test" that reports mysql features
timestamp Print timestamp before each test report line timestamp Print timestamp before each test report line
timediff With --timestamp, also print time passed since timediff With --timestamp, also print time passed since
*previous* test started *previous* test started
......
...@@ -1269,6 +1269,9 @@ CHAR_LENGTH(TRIM(BOTH 0x61 FROM _utf32 0x00000061)) ...@@ -1269,6 +1269,9 @@ CHAR_LENGTH(TRIM(BOTH 0x61 FROM _utf32 0x00000061))
SELECT CHAR_LENGTH(TRIM(BOTH 0x00 FROM _utf32 0x00000061)); SELECT CHAR_LENGTH(TRIM(BOTH 0x00 FROM _utf32 0x00000061));
CHAR_LENGTH(TRIM(BOTH 0x00 FROM _utf32 0x00000061)) CHAR_LENGTH(TRIM(BOTH 0x00 FROM _utf32 0x00000061))
1 1
select hex(lower(cast(0xffff0000 as char character set utf32))) as c;
c
FFFF0000
# #
# End of 5.5 tests # End of 5.5 tests
# #
...@@ -2270,3 +2270,42 @@ t2_id GROUP_CONCAT(IF (t6.b, t6.f, t5.f) ORDER BY 1) ...@@ -2270,3 +2270,42 @@ t2_id GROUP_CONCAT(IF (t6.b, t6.f, t5.f) ORDER BY 1)
EXECUTE stmt; EXECUTE stmt;
t2_id GROUP_CONCAT(IF (t6.b, t6.f, t5.f) ORDER BY 1) t2_id GROUP_CONCAT(IF (t6.b, t6.f, t5.f) ORDER BY 1)
DROP TABLE t1,t2,t3,t4,t5,t6; DROP TABLE t1,t2,t3,t4,t5,t6;
#
# MDEV-10500 CASE/IF Statement returns multiple values and shifts further result values to the next column
#
CREATE TABLE t1 (
id int not null AUTO_INCREMENT,
active bool not null,
data1 bigint,
data2 bigint,
data3 bigint,
primary key (id)
);
INSERT INTO t1 (active,data1,data2,data3) VALUES (1,null,100,200);
SELECT
CASE WHEN active THEN SUM(data1) END AS C_1,
SUM(data2) AS C_2,
SUM(data3) AS C_3
FROM t1;
C_1 C_2 C_3
NULL 100 200
SELECT
IF(active, SUM(data1), 5) AS C_1,
SUM(data2) AS C_2,
SUM(data3) AS C_3
FROM t1;
C_1 C_2 C_3
NULL 100 200
DROP TABLE t1;
#
# MDEV-10468 Assertion `nr >= 0.0' failed in Item_sum_std::val_real()
#
SELECT STDDEV_POP(f) FROM (SELECT "1e+309" AS f UNION SELECT "-1e+309" AS f) tbl;
STDDEV_POP(f)
1.7976931348623157e308
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '1e+309'
Warning 1292 Truncated incorrect DOUBLE value: '-1e+309'
SELECT STDDEV(f) FROM (SELECT 1.7976931348623157e+308 AS f UNION SELECT -1.7976931348623157e+308 AS f) tbl;
STDDEV(f)
1.7976931348623157e308
...@@ -761,3 +761,15 @@ select 5 div 2.0; ...@@ -761,3 +761,15 @@ select 5 div 2.0;
select 5.9 div 2, 1.23456789e3 DIV 2, 1.23456789e9 DIV 2, 1.23456789e19 DIV 2; select 5.9 div 2, 1.23456789e3 DIV 2, 1.23456789e9 DIV 2, 1.23456789e19 DIV 2;
5.9 div 2 1.23456789e3 DIV 2 1.23456789e9 DIV 2 1.23456789e19 DIV 2 5.9 div 2 1.23456789e3 DIV 2 1.23456789e9 DIV 2 1.23456789e19 DIV 2
2 617 617283945 6172839450000000000 2 617 617283945 6172839450000000000
#
# MDEV-10467 Assertion `nr >= 0.0' failed in Item_sum_std::val_real()
#
CREATE TABLE t1 (i INT);
INSERT INTO t1 VALUES (1),(2);
SELECT STDDEV_SAMP(ROUND('0', 309)) FROM t1;
STDDEV_SAMP(ROUND('0', 309))
0
DROP TABLE t1;
#
# End of 5.5 tests
#
...@@ -574,3 +574,10 @@ drop table t1; ...@@ -574,3 +574,10 @@ drop table t1;
# #
# End of 5.5 tests # End of 5.5 tests
# #
SELECT NAME_CONST('a', -(1 OR 2)) OR 1;
ERROR HY000: Incorrect arguments to NAME_CONST
SELECT NAME_CONST('a', -(1 AND 2)) OR 1;
ERROR HY000: Incorrect arguments to NAME_CONST
SELECT NAME_CONST('a', -(1)) OR 1;
NAME_CONST('a', -(1)) OR 1
1
...@@ -286,3 +286,19 @@ F 28 28 ...@@ -286,3 +286,19 @@ F 28 28
F 29 29 F 29 29
F 30 30 F 30 30
DROP TABLE t0,t1,t2; DROP TABLE t0,t1,t2;
#
# MDEV-MariaDB daemon leaks memory with specific query
#
CREATE TABLE t1 (`voter_id` int(11) unsigned NOT NULL,
`language_id` int(11) unsigned NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE t2 (`voter_id` int(10) unsigned NOT NULL DEFAULT '0',
`serialized_c` mediumblob) ENGINE=InnoDB DEFAULT CHARSET=utf8;
insert into t2 values (1,repeat("a",1000)),(2,repeat("a",1000)),(3,repeat("b",1000)),(4,repeat("c",1000)),(4,repeat("b",1000));
SELECT GROUP_CONCAT(t1.language_id SEPARATOR ',') AS `translation_resources`, `d`.`serialized_c` FROM t2 AS `d` LEFT JOIN t1 ON `d`.`voter_id` = t1.`voter_id` GROUP BY `d`.`voter_id` ORDER BY 10-d.voter_id+RAND()*0;
translation_resources serialized_c
NULL cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
NULL bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
NULL aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
NULL aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
drop table t1,t2;
...@@ -507,7 +507,7 @@ DROP TABLE t1; ...@@ -507,7 +507,7 @@ DROP TABLE t1;
# Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U # Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U
# #
CREATE TABLE t1(f1 INT); CREATE TABLE t1(f1 INT);
SELECT 0xE1BB30 INTO OUTFILE 't1.dat'; SELECT 0xE1C330 INTO OUTFILE 't1.dat';
LOAD DATA INFILE 't1.dat' IGNORE INTO TABLE t1 CHARACTER SET utf8; LOAD DATA INFILE 't1.dat' IGNORE INTO TABLE t1 CHARACTER SET utf8;
DROP TABLE t1; DROP TABLE t1;
# #
...@@ -532,3 +532,27 @@ FIELDS TERMINATED BY 't' LINES TERMINATED BY ''; ...@@ -532,3 +532,27 @@ FIELDS TERMINATED BY 't' LINES TERMINATED BY '';
Got one of the listed errors Got one of the listed errors
SET @@sql_mode= @old_mode; SET @@sql_mode= @old_mode;
DROP TABLE t1; DROP TABLE t1;
#
# Bug#23080148 - Backport of Bug#20683959.
# Bug#20683959 LOAD DATA INFILE IGNORES A SPECIFIC ROW SILENTLY
# UNDER DB CHARSET IS UTF8.
#
CREATE DATABASE d1 CHARSET latin1;
USE d1;
CREATE TABLE t1 (val TEXT);
LOAD DATA INFILE '../../std_data/bug20683959loaddata.txt' INTO TABLE t1;
SELECT COUNT(*) FROM t1;
COUNT(*)
1
SELECT HEX(val) FROM t1;
HEX(val)
C38322525420406E696F757A656368756E3A20E98198E2889AF58081AEE7B99DE4B88AE383A3E7B99DE69690F58087B3E7B9A7EFBDA8E7B99DEFBDB3E7B99DE78999E880B3E7B8BAEFBDAAE7B9A7E89699E296A1E7B8BAE4BBA3EFBD8CE7B8BAEFBDA9E7B8B2E2889AE38184E7B99DEFBDB3E7B99DE4B88AE383A3E7B99DE69690F58087B3E7B9A7EFBDA8E7B99DEFBDB3E7B99DE5B3A8EFBD84E8ABA0EFBDA8E89C89F580948EE599AAE7B8BAEFBDAAE7B8BAE9A198EFBDA9EFBDB1E7B9A7E581B5E289A0E7B8BAEFBDBEE7B9A7E9A194EFBDA9E882B4EFBDA5EFBDB5E980A7F5808B96E28693E99EABE38287E58F99E7B8BAE58AB1E28691E7B8BAF5808B9AE7828AE98095EFBDB1E7B8BAEFBDAFE7B8B2E288ABE6A89FE89EB3E6BA98F58081ADE88EA0EFBDBAE98095E6BA98F58081AEE89D93EFBDBAE8AD9BEFBDACE980A7F5808B96E28693E7B8BAF580918EE288AAE7B8BAE4B88AEFBC9EE7B8BAE4B99DE28691E7B8BAF5808B96EFBCA0E88DB3E6A68AEFBDB9EFBDB3E981B2E5B3A8E296A1E7B8BAE7A4BCE7828AE88DB3E6A68AEFBDB0EFBDBDE7B8BAA0E7B8BAE88B93EFBDBEE5B899EFBC9E
CREATE DATABASE d2 CHARSET utf8;
USE d2;
CREATE TABLE t1 (val TEXT);
LOAD DATA INFILE '../../std_data/bug20683959loaddata.txt' INTO TABLE t1;
ERROR HY000: Invalid utf8 character string: '"RT @niouzechun: \9058\221A'
DROP TABLE d1.t1, d2.t1;
DROP DATABASE d1;
DROP DATABASE d2;
...@@ -3832,4 +3832,21 @@ test.m1 repair error Corrupt ...@@ -3832,4 +3832,21 @@ test.m1 repair error Corrupt
# Clean-up. # Clean-up.
drop tables m1, t1, t4; drop tables m1, t1, t4;
drop view t3; drop view t3;
#
# MDEV-10424 - Assertion `ticket == __null' failed in
# MDL_request::set_type
#
CREATE TABLE t1 (f1 INT) ENGINE=MyISAM;
CREATE TABLE tmerge (f1 INT) ENGINE=MERGE UNION=(t1);
PREPARE stmt FROM "ANALYZE TABLE tmerge, t1";
EXECUTE stmt;
Table Op Msg_type Msg_text
test.tmerge analyze note The storage engine for the table doesn't support analyze
test.t1 analyze status Table is already up to date
EXECUTE stmt;
Table Op Msg_type Msg_text
test.tmerge analyze note The storage engine for the table doesn't support analyze
test.t1 analyze status Table is already up to date
DEALLOCATE PREPARE stmt;
DROP TABLE t1, tmerge;
End of 5.5 tests End of 5.5 tests
CREATE TABLE t1 (
pk INT AUTO_INCREMENT,
i INT,
d DATE,
dt DATETIME,
v VARCHAR(1),
PRIMARY KEY (pk),
KEY (dt)
) ENGINE=MyISAM;
INSERT INTO t1 (i, d, dt, v) VALUES
(9, '2005-07-23', '2004-05-13 01:01:39', 't'),
(2, '2009-11-01', '2003-12-24 07:39:29', 'h'),
(6, NULL, '2008-07-03 05:32:22', 'l'),
(6, '2007-07-16', '2008-08-28 18:46:11', 'j'),
(5, NULL, '2001-07-12 21:27:00', 'h'),
(3, '2007-07-22', '1900-01-01 00:00:00', 'p'),
(2, '2000-11-21', '2007-05-25 11:58:54', 'g'),
(6, '1900-01-01', '2009-06-03 17:11:10', 'i'),
(2, '2008-02-10', '2001-06-15 16:20:07', 'p'),
(3, '2009-06-04', '1900-01-01 00:00:00', 'h'),
(9, '2007-04-25', '1900-01-01 00:00:00', 'e'),
(9, '2006-03-02', '1900-01-01 00:00:00', 'e'),
(1, '1900-01-01', '2002-11-08 09:33:27', 'u'),
(7, '2008-07-13', '2007-08-07 17:35:52', 'j'),
(0, '2004-11-12', '2006-05-01 00:00:00', 'e'),
(0, '1900-01-01', '2003-05-01 00:00:00', 'z'),
(1, '2009-09-02', '2007-02-12 09:30:49', 'w'),
(0, '2004-11-06', '1900-01-01 00:00:00', 't'),
(4, '2003-01-06', '2002-07-03 02:51:11', 'i'),
(6, '2006-01-14', '2008-02-26 04:57:32', 'i'),
(0, '2002-01-19', '2009-02-12 00:00:00', 'i'),
(8, '2007-02-12', '1900-01-01 00:00:00', 'b'),
(4, '1900-01-01', '2001-05-16 05:28:40', 'm'),
(2, '2005-07-16', NULL, 'j'),
(1, '2004-09-04', '2001-01-24 21:45:18', 'v'),
(3, '2009-07-01', NULL, NULL),
(2, '2009-07-21', '2002-07-24 00:00:00', 'h'),
(4, NULL, '2001-11-03 12:22:30', 'q'),
(1, '2002-06-22', '2008-06-17 03:17:59', 'f'),
(7, '2005-06-23', '2005-12-24 00:00:00', 'p'),
(6, '2001-05-20', '2008-10-23 00:00:00', NULL),
(3, '2001-10-01', '2000-10-12 16:32:35', 'o'),
(3, '2001-01-07', '2005-09-11 10:09:54', 'w'),
(6, '2007-11-02', '2009-09-10 01:44:18', 'l'),
(6, NULL, NULL, 'i'),
(9, NULL, '2002-05-18 15:21:55', 'd'),
(4, '2008-12-21', '2004-10-15 10:09:54', 'j'),
(6, '2003-10-05', '2009-07-13 03:51:02', 'e'),
(2, '2001-03-03', '1900-01-01 00:00:00', 'e'),
(2, '2007-04-04', '2001-11-08 21:14:52', 'q'),
(5, NULL, '2006-12-02 00:00:00', 'm'),
(0, '2009-01-04', '1900-01-01 00:00:00', NULL),
(8, '2008-04-03', '2005-01-01 11:55:18', 'q'),
(8, NULL, '2005-02-28 03:44:02', 'w'),
(0, '2003-08-22', NULL, 'c'),
(9, '1900-01-01', NULL, 'y'),
(NULL, NULL, '2006-08-25 16:28:09', 'g'),
(5, '2004-07-04', '2002-08-11 00:00:00', 'z'),
(1, '1900-01-01', '2007-07-22 21:19:18', 'm'),
(2, '2007-02-04', '2006-02-10 18:41:38', 't'),
(2, '1900-01-01', '2009-02-16 14:58:58', 'd'),
(7, '2001-03-14', '2007-08-14 00:00:00', 'h'),
(0, NULL, '1900-01-01 00:00:00', NULL),
(1, '2008-10-05', NULL, 'f'),
(6, '2001-11-25', '2008-12-03 06:59:23', 'l'),
(NULL, '2003-01-27', '2008-10-04 00:00:00', 'g'),
(8, '2008-08-08', '2009-07-07 07:00:21', 'v'),
(8, '2006-07-03', '2001-04-15 00:00:00', NULL),
(5, '2002-11-21', '2007-07-08 04:01:58', 'm'),
(5, '2006-04-08', '2007-09-23 00:01:35', 'i'),
(5, '2001-05-06', '2008-05-15 00:00:00', 'h'),
(7, '1900-01-01', '1900-01-01 00:00:00', 'u'),
(30, '2007-04-16', '2004-03-05 23:35:38', 'o'),
(NULL, '1900-01-01', '2007-08-25 01:32:47', 'z'),
(6, '2004-12-03', '1900-01-01 00:00:00', 'o'),
(8, '2001-06-23', '1900-01-01 00:00:00', 'f'),
(NULL, '2008-12-15', '2001-05-19 08:28:28', 'a'),
(9, '2000-02-15', '2009-09-03 06:07:22', 'd'),
(2, '2001-08-05', '2006-10-08 07:17:27', 'k'),
(5, '2004-01-17', '2003-09-06 20:36:01', 'd'),
(4, '2003-10-01', '2001-02-05 18:10:49', 'u'),
(4, '2003-07-28', '2001-01-07 16:11:37', 'h'),
(0, '1900-01-01', '2008-08-01 05:26:38', 'w'),
(9, '1900-01-01', '2001-05-08 00:00:00', 't'),
(1, '2000-04-17', '2008-07-10 21:26:28', 'i'),
(8, '2002-01-05', '2006-08-06 20:56:35', 'k'),
(9, '2001-04-10', '2003-02-17 00:00:00', 'z'),
(0, '2009-12-04', NULL, 'h'),
(7, NULL, '2004-10-27 00:29:57', 'h'),
(2, '2006-03-07', '2008-03-04 06:14:13', 'b'),
(0, '2001-10-15', '2001-03-17 00:00:00', 'm'),
(5, '1900-01-01', '2009-02-21 11:35:50', 'i'),
(4, NULL, '1900-01-01 00:00:00', 'w'),
(5, '2009-04-05', '1900-01-01 00:00:00', 'm'),
(6, '2001-03-19', '2001-04-12 00:00:00', 'q'),
(NULL, '2009-12-08', '2001-12-04 20:21:01', 'k'),
(2, '2005-02-09', '2001-05-27 08:41:01', 'l'),
(9, '2004-05-25', '2004-09-18 00:00:00', 'c'),
(3, '2005-01-17', '2002-09-12 11:18:48', 'd'),
(0, '2003-08-28', '1900-01-01 00:00:00', 'k'),
(6, '2006-10-11', '2003-10-28 03:31:02', 'a'),
(5, '1900-01-01', '2001-08-22 10:20:09', 'p'),
(8, '1900-01-01', '2008-04-24 00:00:00', 'o'),
(4, '2005-08-18', '2006-11-10 10:08:49', 'e'),
(NULL, '2007-03-12', '2007-10-16 00:00:00', 'n'),
(1, '2000-11-18', '2009-05-27 12:25:07', 't'),
(4, '2001-03-03', NULL, 'u'),
(3, '2003-09-11', '2001-09-10 18:10:10', 'f'),
(4, '2007-06-17', '1900-01-01 00:00:00', 't'),
(NULL, '2008-09-11', '2004-06-07 23:17:09', 'k');
ALTER TABLE t1 ADD UNIQUE KEY ind1 (pk, d, i, v);
ALTER TABLE t1 ADD UNIQUE KEY ind2 (d, v);
ERROR 23000: Duplicate entry '1900-01-01-m' for key 'ind2'
DROP TABLE t1;
...@@ -312,10 +312,37 @@ DROP TABLE bug47205; ...@@ -312,10 +312,37 @@ DROP TABLE bug47205;
# #
#MDEV-6128:[PATCH] mysqlcheck wrongly escapes '.' in table names #MDEV-6128:[PATCH] mysqlcheck wrongly escapes '.' in table names
# #
CREATE TABLE test.`t.1` (id int); create table `t.1` (id int);
create view `v.1` as select 1;
mysqlcheck test t.1 mysqlcheck test t.1
test.t.1 OK test.t.1 OK
drop table test.`t.1`; mysqlcheck --all-in-1 test t.1
test.t.1 OK
mysqlcheck --all-in-1 --databases --process-views test
test.t.1 OK
test.v.1 OK
create table `t.2`(a varchar(20) primary key) default character set utf8 collate utf8_general_ci engine=innodb;
flush table `t.2`;
mysqlcheck --check-upgrade --auto-repair test
test.t.1 OK
test.t.2
error : Table rebuild required. Please do "ALTER TABLE `t.2` FORCE" or dump/reload to fix it!
test.t.3 Needs upgrade
Repairing tables
test.t.3 OK
check table `t.1`, `t.2`, `t.3`;
Table Op Msg_type Msg_text
test.t.1 check status OK
test.t.2 check status OK
test.t.3 check status OK
check table `t.1`, `t.2`, `t.3` for upgrade;
Table Op Msg_type Msg_text
test.t.1 check status OK
test.t.2 check status OK
test.t.3 check status OK
drop view `v.1`;
drop table test.`t.1`, `t.2`, `t.3`;
create view v1 as select 1; create view v1 as select 1;
mysqlcheck --process-views test mysqlcheck --process-views test
test.v1 OK test.v1 OK
...@@ -339,3 +366,53 @@ Repairing views ...@@ -339,3 +366,53 @@ Repairing views
test.v1 OK test.v1 OK
drop view v1; drop view v1;
drop table t1; drop table t1;
create table `#mysql50#t1``1` (a int) engine=myisam;
show tables;
Tables_in_test
t1`1
drop table `t1``1`;
call mtr.add_suppression("ha_myisam");
call mtr.add_suppression("Checking table");
create database mysqltest1;
create table mysqltest1.t1 (a int) engine=myisam;
create table t2 (a int);
check table mysqltest1.t1;
Table Op Msg_type Msg_text
mysqltest1.t1 check warning Size of datafile is: 4 Should be: 0
mysqltest1.t1 check error got error: 0 when reading datafile at record: 0
mysqltest1.t1 check error Corrupt
mtr.global_suppressions Table is already up to date
mtr.test_suppressions Table is already up to date
mysql.columns_priv Table is already up to date
mysql.db Table is already up to date
mysql.event Table is already up to date
mysql.func Table is already up to date
mysql.help_category Table is already up to date
mysql.help_keyword Table is already up to date
mysql.help_relation Table is already up to date
mysql.help_topic Table is already up to date
mysql.host Table is already up to date
mysql.ndb_binlog_index Table is already up to date
mysql.plugin Table is already up to date
mysql.proc Table is already up to date
mysql.procs_priv Table is already up to date
mysql.proxies_priv Table is already up to date
mysql.servers Table is already up to date
mysql.tables_priv Table is already up to date
mysql.time_zone Table is already up to date
mysql.time_zone_leap_second Table is already up to date
mysql.time_zone_name Table is already up to date
mysql.time_zone_transition Table is already up to date
mysql.time_zone_transition_type Table is already up to date
mysql.user Table is already up to date
mysqltest1.t1
warning : Table is marked as crashed
warning : Size of datafile is: 4 Should be: 0
error : got error: 0 when reading datafile at record: 0
error : Corrupt
test.t2 Table is already up to date
Repairing tables
mysqltest1.t1 OK
drop table t2;
drop database mysqltest1;
...@@ -4072,4 +4072,35 @@ id value ...@@ -4072,4 +4072,35 @@ id value
deallocate prepare stmt; deallocate prepare stmt;
SET SESSION sql_mode = @save_sql_mode; SET SESSION sql_mode = @save_sql_mode;
DROP TABLE t1,t2; DROP TABLE t1,t2;
# End of 10.0 tests #
# MDEV-8833: Crash of server on prepared statement with
# conversion to semi-join
#
CREATE TABLE t1 (column1 INT);
INSERT INTO t1 VALUES (3),(9);
CREATE TABLE t2 (column2 INT);
INSERT INTO t2 VALUES (1),(4);
CREATE TABLE t3 (column3 INT);
INSERT INTO t3 VALUES (6),(8);
CREATE TABLE t4 (column4 INT);
INSERT INTO t4 VALUES (2),(5);
PREPARE stmt FROM "SELECT ( SELECT MAX( table1.column1 ) AS field1
FROM t1 AS table1
WHERE table3.column3 IN ( SELECT table2.column2 AS field2 FROM t2 AS table2 )
) AS sq
FROM t3 AS table3, t4 AS table4";
EXECUTE stmt;
sq
NULL
NULL
NULL
NULL
EXECUTE stmt;
sq
NULL
NULL
NULL
NULL
deallocate prepare stmt;
drop table t1,t2,t3,t4;
# End of 5.5 tests
...@@ -788,3 +788,5 @@ execute stmt1; ...@@ -788,3 +788,5 @@ execute stmt1;
1 1
drop prepare stmt1; drop prepare stmt1;
drop table t1; drop table t1;
select ?+1;
Got one of the listed errors
...@@ -2113,3 +2113,34 @@ a b ...@@ -2113,3 +2113,34 @@ a b
0 0 0 0
1 1 1 1
drop table t2; drop table t2;
#
# MDEV-10228: Delete missing rows with OR conditions
# (The example uses UPDATE, because UPDATE allows to use index hints
# and so it's possible to make an example that works with any storage
# engine)
#
CREATE TABLE t1 (
key1varchar varchar(14) NOT NULL,
key2int int(11) NOT NULL DEFAULT '0',
col1 int,
PRIMARY KEY (key1varchar,key2int),
KEY key1varchar (key1varchar),
KEY key2int (key2int)
) DEFAULT CHARSET=utf8;
insert into t1 values
('value1',0, 0),
('value1',1, 0),
('value1',1000685, 0),
('value1',1003560, 0),
('value1',1004807, 0);
update t1 force index (PRIMARY) set col1=12345
where (key1varchar='value1' AND (key2int <=1 OR key2int > 1));
# The following must show col1=12345 for all rows:
select * from t1;
key1varchar key2int col1
value1 0 12345
value1 1 12345
value1 1000685 12345
value1 1003560 12345
value1 1004807 12345
drop table t1;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment