Merge branch '5.5' into 10.0

This commit is contained in:
Sergei Golubchik 2017-04-21 18:34:06 +02:00
commit 8d75a7533e
57 changed files with 670 additions and 173 deletions

View File

@ -1,5 +1,5 @@
# Copyright (c) 2006, 2014, Oracle and/or its affiliates. # Copyright (c) 2006, 2017, Oracle and/or its affiliates.
# Copyright (c) 2008, 2014, Monty Program Ab # Copyright (c) 2008, 2017, MariaDB
# #
# 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
@ -241,12 +241,9 @@ IF (WITH_ASAN)
ENDIF() ENDIF()
ENDIF() ENDIF()
# Always enable debug sync for debug builds.
OPTION(ENABLE_DEBUG_SYNC "Enable debug sync (debug builds only)" ON) SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
IF(ENABLE_DEBUG_SYNC) SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
ENDIF()
OPTION(ENABLE_GCOV "Enable gcov (debug, Linux builds only)" OFF) OPTION(ENABLE_GCOV "Enable gcov (debug, Linux builds only)" OFF)
IF (ENABLE_GCOV AND NOT WIN32 AND NOT APPLE) IF (ENABLE_GCOV AND NOT WIN32 AND NOT APPLE)

View File

@ -117,4 +117,3 @@ enum options_client
Name of the performance schema database. Name of the performance schema database.
*/ */
#define PERFORMANCE_SCHEMA_DB_NAME "performance_schema" #define PERFORMANCE_SCHEMA_DB_NAME "performance_schema"

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2000, 2014, Oracle and/or its affiliates. Copyright (c) 2000, 2014, Oracle and/or its affiliates.
Copyright (c) 2009, 2016, MariaDB Copyright (c) 2009, 2017, MariaDB
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

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2006, 2013, Oracle and/or its affiliates. Copyright (c) 2006, 2013, Oracle and/or its affiliates.
Copyright (c) 2010, 2016, MariaDB Copyright (c) 2010, 2017, MariaDB
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
@ -1140,4 +1140,3 @@ end:
my_end(my_end_arg); my_end(my_end_arg);
exit(0); exit(0);
} }

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2000, 2014, Oracle and/or its affiliates. Copyright (c) 2000, 2014, Oracle and/or its affiliates.
Copyright (c) 2010, 2016, MariaDB Copyright (c) 2010, 2017, MariaDB
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

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2001, 2013, Oracle and/or its affiliates. Copyright (c) 2001, 2013, Oracle and/or its affiliates.
Copyright (c) 2010, 2016, MariaDB Copyright (c) 2010, 2017, MariaDB
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

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2000, 2013, Oracle and/or its affiliates. Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2010, 2016, MariaDB Copyright (c) 2010, 2017, MariaDB
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
@ -2179,7 +2179,6 @@ static void print_comment(FILE *sql_file, my_bool is_error, const char *format,
print_xml_comment(sql_file, strlen(comment_buff), comment_buff); print_xml_comment(sql_file, strlen(comment_buff), comment_buff);
} }
/* /*
create_delimiter create_delimiter
Generate a new (null-terminated) string that does not exist in query Generate a new (null-terminated) string that does not exist in query
@ -2524,7 +2523,7 @@ static uint dump_routines_for_db(char *db)
query_buff); query_buff);
print_comment(sql_file, 1, print_comment(sql_file, 1,
"-- does %s have permissions on mysql.proc?\n\n", "-- does %s have permissions on mysql.proc?\n\n",
current_user); fix_for_comment(current_user));
maybe_die(EX_MYSQLERR,"%s has insufficent privileges to %s!", maybe_die(EX_MYSQLERR,"%s has insufficent privileges to %s!",
current_user, query_buff); current_user, query_buff);
} }

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2000, 2015, Oracle and/or its affiliates. Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2011, 2016, MariaDB Copyright (c) 2011, 2017, MariaDB
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

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2000, 2015, Oracle and/or its affiliates. Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2010, 2016, MariaDB Copyright (c) 2010, 2017, MariaDB
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

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2005, 2015, Oracle and/or its affiliates. Copyright (c) 2005, 2015, Oracle and/or its affiliates.
Copyright (c) 2010, 2016, MariaDB Copyright (c) 2010, 2017, MariaDB
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

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. /* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2009, 2016, Monty Program Ab. Copyright (c) 2009, 2017, MariaDB
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
@ -1062,7 +1062,7 @@ void do_eval(DYNAMIC_STRING *query_eval, const char *query,
if (!(v= var_get(p, &p, 0, 0))) if (!(v= var_get(p, &p, 0, 0)))
{ {
report_or_die( "Bad variable in eval"); report_or_die( "Bad variable in eval");
return; DBUG_VOID_RETURN;
} }
dynstr_append_mem(query_eval, v->str_val, v->str_val_len); dynstr_append_mem(query_eval, v->str_val, v->str_val_len);
} }
@ -1777,7 +1777,7 @@ static int run_command(char* cmd,
if (!(res_file= popen(cmd, "r"))) if (!(res_file= popen(cmd, "r")))
{ {
report_or_die("popen(\"%s\", \"r\") failed", cmd); report_or_die("popen(\"%s\", \"r\") failed", cmd);
return -1; DBUG_RETURN(-1);
} }
while (fgets(buf, sizeof(buf), res_file)) while (fgets(buf, sizeof(buf), res_file))
@ -2685,7 +2685,7 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
report_or_die("Query '%s' didn't return a result set", ds_query.str); report_or_die("Query '%s' didn't return a result set", ds_query.str);
dynstr_free(&ds_query); dynstr_free(&ds_query);
eval_expr(var, "", 0); eval_expr(var, "", 0);
return; DBUG_VOID_RETURN;
} }
dynstr_free(&ds_query); dynstr_free(&ds_query);
@ -2876,7 +2876,7 @@ void var_set_query_get_value(struct st_command *command, VAR *var)
dynstr_free(&ds_query); dynstr_free(&ds_query);
dynstr_free(&ds_col); dynstr_free(&ds_col);
eval_expr(var, "", 0); eval_expr(var, "", 0);
return; DBUG_VOID_RETURN;
} }
{ {
@ -2901,7 +2901,7 @@ void var_set_query_get_value(struct st_command *command, VAR *var)
ds_col.str, ds_query.str); ds_col.str, ds_query.str);
dynstr_free(&ds_query); dynstr_free(&ds_query);
dynstr_free(&ds_col); dynstr_free(&ds_col);
return; DBUG_VOID_RETURN;
} }
DBUG_PRINT("info", ("Found column %d with name '%s'", DBUG_PRINT("info", ("Found column %d with name '%s'",
i, fields[i].name)); i, fields[i].name));
@ -3349,7 +3349,7 @@ void do_exec(struct st_command *command)
if (!*cmd) if (!*cmd)
{ {
report_or_die("Missing argument in exec"); report_or_die("Missing argument in exec");
return; DBUG_VOID_RETURN;
} }
command->last_argument= command->end; command->last_argument= command->end;
@ -3383,7 +3383,7 @@ void do_exec(struct st_command *command)
dynstr_free(&ds_cmd); dynstr_free(&ds_cmd);
if (command->abort_on_error) if (command->abort_on_error)
report_or_die("popen(\"%s\", \"r\") failed", command->first_argument); report_or_die("popen(\"%s\", \"r\") failed", command->first_argument);
return; DBUG_VOID_RETURN;
} }
ds_result= &ds_res; ds_result= &ds_res;
@ -3441,7 +3441,7 @@ void do_exec(struct st_command *command)
ds_cmd.str, error, status, errno, ds_cmd.str, error, status, errno,
ds_res.str); ds_res.str);
dynstr_free(&ds_cmd); dynstr_free(&ds_cmd);
return; DBUG_VOID_RETURN;
} }
DBUG_PRINT("info", DBUG_PRINT("info",
@ -3574,7 +3574,7 @@ void do_system(struct st_command *command)
if (strlen(command->first_argument) == 0) if (strlen(command->first_argument) == 0)
{ {
report_or_die("Missing arguments to system, nothing to do!"); report_or_die("Missing arguments to system, nothing to do!");
return; DBUG_VOID_RETURN;
} }
init_dynamic_string(&ds_cmd, 0, command->query_len + 64, 256); init_dynamic_string(&ds_cmd, 0, command->query_len + 64, 256);
@ -4561,7 +4561,7 @@ void do_perl(struct st_command *command)
if (command->abort_on_error) if (command->abort_on_error)
die("popen(\"%s\", \"r\") failed", buf); die("popen(\"%s\", \"r\") failed", buf);
dynstr_free(&ds_delimiter); dynstr_free(&ds_delimiter);
return; DBUG_VOID_RETURN;
} }
while (fgets(buf, sizeof(buf), res_file)) while (fgets(buf, sizeof(buf), res_file))

View File

@ -1423,4 +1423,3 @@ inline_mysql_file_sync(
/** @} (end of group File_instrumentation) */ /** @} (end of group File_instrumentation) */
#endif #endif

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2011, 2016, Oracle and/or its affiliates. /* Copyright (c) 2011, 2017, Oracle and/or its affiliates.
Copyright (c) 2011, 2016, MariaDB Copyright (c) 2011, 2017, MariaDB
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
@ -17,7 +17,7 @@
#ifndef _welcome_copyright_notice_h_ #ifndef _welcome_copyright_notice_h_
#define _welcome_copyright_notice_h_ #define _welcome_copyright_notice_h_
#define COPYRIGHT_NOTICE_CURRENT_YEAR "2016" #define COPYRIGHT_NOTICE_CURRENT_YEAR "2017"
/* /*
This define specifies copyright notice which is displayed by every MySQL This define specifies copyright notice which is displayed by every MySQL

View File

@ -12,7 +12,6 @@
tablespace : disabled in MariaDB (no TABLESPACE table attribute) tablespace : disabled in MariaDB (no TABLESPACE table attribute)
events_time_zone : Test is not predictable as it depends on precise timing. events_time_zone : Test is not predictable as it depends on precise timing.
read_many_rows_innodb : Bug#11748886 2010-11-15 mattiasj report already exists read_many_rows_innodb : Bug#11748886 2010-11-15 mattiasj report already exists
log_tables-big : Bug#11756699 2010-11-15 mattiasj report already exists
mysql_embedded : Bug#12561297 2011-05-14 Anitha Dependent on PB2 changes - eventum#41836 mysql_embedded : Bug#12561297 2011-05-14 Anitha Dependent on PB2 changes - eventum#41836
#show_explain : Psergey: random timeout in range-checked-for-each record query. #show_explain : Psergey: random timeout in range-checked-for-each record query.
ssl_crl_clients_valid : broken upstream ssl_crl_clients_valid : broken upstream

View File

@ -3222,13 +3222,10 @@ sub mysql_server_start($) {
if (! $opt_start_dirty) # If dirty, keep possibly grown system db if (! $opt_start_dirty) # If dirty, keep possibly grown system db
{ {
# Copy datadir from installed system db # Copy datadir from installed system db
for my $path ( "$opt_vardir", "$opt_vardir/..") { my $path= ($opt_parallel == 1) ? "$opt_vardir" : "$opt_vardir/..";
my $install_db= "$path/install.db"; my $install_db= "$path/install.db";
copytree($install_db, $datadir) copytree($install_db, $datadir) if -d $install_db;
if -d $install_db; mtr_error("Failed to copy system db to '$datadir'") unless -d $datadir;
}
mtr_error("Failed to copy system db to '$datadir'")
unless -d $datadir;
} }
} }
else else

View File

@ -1,10 +1,10 @@
drop database if exists events_test; drop database if exists events_test;
create database events_test; create database events_test;
use events_test; use events_test;
create event e_26 on schedule at '2027-01-01 00:00:00' disable do set @a = 5; create event e_26 on schedule at '2037-01-01 00:00:00' disable do set @a = 5;
select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event; select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event;
db name body definer convert_tz(execute_at, 'UTC', 'SYSTEM') on_completion db name body definer convert_tz(execute_at, 'UTC', 'SYSTEM') on_completion
events_test e_26 set @a = 5 root@localhost 2027-01-01 00:00:00 DROP events_test e_26 set @a = 5 root@localhost 2037-01-01 00:00:00 DROP
drop event e_26; drop event e_26;
create event e_26 on schedule at NULL disable do set @a = 5; create event e_26 on schedule at NULL disable do set @a = 5;
ERROR HY000: Incorrect AT value: 'NULL' ERROR HY000: Incorrect AT value: 'NULL'

View File

@ -432,7 +432,7 @@ WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON it.i=it.i WHERE it.pk-t1.i<10
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where
2 DEPENDENT SUBQUERY it eq_ref PRIMARY PRIMARY 4 func 1 Using where 2 DEPENDENT SUBQUERY it eq_ref PRIMARY PRIMARY 4 func 1 Using where
2 DEPENDENT SUBQUERY t2 index NULL PRIMARY 4 NULL 3 Using where; Using index; Using join buffer (flat, BNL join) 2 DEPENDENT SUBQUERY t2 index NULL PRIMARY 4 NULL 3 Using index; Using join buffer (flat, BNL join)
SELECT * FROM t1 SELECT * FROM t1
WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON it.i=it.i WHERE it.pk-t1.i<10); WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON it.i=it.i WHERE it.pk-t1.i<10);
pk i pk i

View File

@ -1745,7 +1745,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 2 100.00 Using where; Using index; Using temporary; Using filesort 1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 2 100.00 Using where; Using index; Using temporary; Using filesort
1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using where; Using index 1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t3 eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using where; Using index 2 DEPENDENT SUBQUERY t3 eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t4 eq_ref PRIMARY PRIMARY 4 test.t3.pk 1 100.00 Using where; Using index 2 DEPENDENT SUBQUERY t4 eq_ref PRIMARY PRIMARY 4 test.t3.pk 1 100.00 Using index
Warnings: Warnings:
Note 1276 Field or reference 'test.t2.pk' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t2.pk' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`t2`.`pk` AS `pk`,<expr_cache><`test`.`t2`.`pk`>((select (`test`.`t3`.`pk` + if(isnull(`test`.`t4`.`pk`),0,`test`.`t4`.`pk`)) from `test`.`t3` left join `test`.`t4` on((`test`.`t4`.`pk` = `test`.`t3`.`pk`)) where (`test`.`t3`.`pk` = (`test`.`t2`.`pk` + 1000)) limit 1)) AS `t` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`pk` = (`test`.`t1`.`pk` + 1000)) and (`test`.`t1`.`pk` > 1000)) group by `test`.`t2`.`pk` Note 1003 select `test`.`t2`.`pk` AS `pk`,<expr_cache><`test`.`t2`.`pk`>((select (`test`.`t3`.`pk` + if(isnull(`test`.`t4`.`pk`),0,`test`.`t4`.`pk`)) from `test`.`t3` left join `test`.`t4` on((`test`.`t4`.`pk` = `test`.`t3`.`pk`)) where (`test`.`t3`.`pk` = (`test`.`t2`.`pk` + 1000)) limit 1)) AS `t` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`pk` = (`test`.`t1`.`pk` + 1000)) and (`test`.`t1`.`pk` > 1000)) group by `test`.`t2`.`pk`

View File

@ -1756,7 +1756,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 2 100.00 Using where; Using index; Using temporary; Using filesort 1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 2 100.00 Using where; Using index; Using temporary; Using filesort
1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using where; Using index 1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t3 eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using where; Using index 2 DEPENDENT SUBQUERY t3 eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t4 eq_ref PRIMARY PRIMARY 4 test.t3.pk 1 100.00 Using where; Using index 2 DEPENDENT SUBQUERY t4 eq_ref PRIMARY PRIMARY 4 test.t3.pk 1 100.00 Using index
Warnings: Warnings:
Note 1276 Field or reference 'test.t2.pk' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t2.pk' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`t2`.`pk` AS `pk`,<expr_cache><`test`.`t2`.`pk`>((select (`test`.`t3`.`pk` + if(isnull(`test`.`t4`.`pk`),0,`test`.`t4`.`pk`)) from `test`.`t3` left join `test`.`t4` on((`test`.`t4`.`pk` = `test`.`t3`.`pk`)) where (`test`.`t3`.`pk` = (`test`.`t2`.`pk` + 1000)) limit 1)) AS `t` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`pk` = (`test`.`t1`.`pk` + 1000)) and (`test`.`t1`.`pk` > 1000)) group by `test`.`t2`.`pk` Note 1003 select `test`.`t2`.`pk` AS `pk`,<expr_cache><`test`.`t2`.`pk`>((select (`test`.`t3`.`pk` + if(isnull(`test`.`t4`.`pk`),0,`test`.`t4`.`pk`)) from `test`.`t3` left join `test`.`t4` on((`test`.`t4`.`pk` = `test`.`t3`.`pk`)) where (`test`.`t3`.`pk` = (`test`.`t2`.`pk` + 1000)) limit 1)) AS `t` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`pk` = (`test`.`t1`.`pk` + 1000)) and (`test`.`t1`.`pk` > 1000)) group by `test`.`t2`.`pk`

View File

@ -316,7 +316,7 @@ FIELDS ESCAPED BY '\\'
TERMINATED BY ',' TERMINATED BY ','
ENCLOSED BY '"' ENCLOSED BY '"'
LINES TERMINATED BY '\n' (c0, c2); LINES TERMINATED BY '\n' (c0, c2);
ERROR HY000: Invalid column reference (v2.c0) in LOAD DATA ERROR HY000: Column 'c0' is not updatable
LOAD DATA INFILE '../../std_data/bug35469.dat' INTO TABLE v3 LOAD DATA INFILE '../../std_data/bug35469.dat' INTO TABLE v3
FIELDS ESCAPED BY '\\' FIELDS ESCAPED BY '\\'

View File

@ -1,29 +1,31 @@
set @@global.log_output = 'TABLE';
set session long_query_time=10; set session long_query_time=10;
select get_lock('bug27638', 1); select get_lock('bug27638', 1);
get_lock('bug27638', 1) get_lock('bug27638', 1)
1 1
set session long_query_time=1; set session long_query_time=1;
truncate table mysql.slow_log;
select get_lock('bug27638', 2); select get_lock('bug27638', 2);
get_lock('bug27638', 2) get_lock('bug27638', 2)
0 0
select if (query_time between '00:00:01' and '00:00:10', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log; select if (query_time >= '00:00:01', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log
where sql_text = 'select get_lock(\'bug27638\', 2)';
qt sql_text qt sql_text
OK select get_lock('bug27638', 2) OK select get_lock('bug27638', 2)
truncate table mysql.slow_log;
select get_lock('bug27638', 60); select get_lock('bug27638', 60);
get_lock('bug27638', 60) get_lock('bug27638', 60)
0 0
select if (query_time between '00:00:59' and '00:01:10', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log; select if (query_time >= '00:00:59', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log
where sql_text = 'select get_lock(\'bug27638\', 60)';
qt sql_text qt sql_text
OK select get_lock('bug27638', 60) OK select get_lock('bug27638', 60)
truncate table mysql.slow_log;
select get_lock('bug27638', 101); select get_lock('bug27638', 101);
get_lock('bug27638', 101) get_lock('bug27638', 101)
0 0
select if (query_time between '00:01:40' and '00:01:50', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log; select if (query_time >= '00:01:40', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log
where sql_text = 'select get_lock(\'bug27638\', 101)';
qt sql_text qt sql_text
OK select get_lock('bug27638', 101) OK select get_lock('bug27638', 101)
select release_lock('bug27638'); select release_lock('bug27638');
release_lock('bug27638') release_lock('bug27638')
1 1
set @@global.log_output=default;

View File

@ -436,7 +436,7 @@ WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON it.i=it.i WHERE it.pk-t1.i<10
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where
2 DEPENDENT SUBQUERY it eq_ref PRIMARY PRIMARY 4 func 1 Using index condition 2 DEPENDENT SUBQUERY it eq_ref PRIMARY PRIMARY 4 func 1 Using index condition
2 DEPENDENT SUBQUERY t2 index NULL PRIMARY 4 NULL 3 Using where; Using index; Using join buffer (flat, BNL join) 2 DEPENDENT SUBQUERY t2 index NULL PRIMARY 4 NULL 3 Using index; Using join buffer (flat, BNL join)
SELECT * FROM t1 SELECT * FROM t1
WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON it.i=it.i WHERE it.pk-t1.i<10); WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON it.i=it.i WHERE it.pk-t1.i<10);
pk i pk i
@ -800,7 +800,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t ALL PRIMARY,c NULL NULL NULL 64 Using where 1 PRIMARY t ALL PRIMARY,c NULL NULL NULL 64 Using where
1 PRIMARY t2 ref g g 5 test.t.c 19 Using where 1 PRIMARY t2 ref g g 5 test.t.c 19 Using where
2 DEPENDENT SUBQUERY t1 index PRIMARY PRIMARY 4 NULL 64 Using where; Using index 2 DEPENDENT SUBQUERY t1 index PRIMARY PRIMARY 4 NULL 64 Using where; Using index
2 DEPENDENT SUBQUERY t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using index condition; Using where 2 DEPENDENT SUBQUERY t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where
SELECT COUNT(*) FROM t1 AS t, t2 SELECT COUNT(*) FROM t1 AS t, t2
WHERE c = g WHERE c = g
AND (EXISTS (SELECT * FROM t1, t2 WHERE a = f AND h <= t.e AND a > t.b) AND (EXISTS (SELECT * FROM t1, t2 WHERE a = f AND h <= t.e AND a > t.b)

View File

@ -5310,6 +5310,69 @@ a
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
DROP DATABASE db_20772273; DROP DATABASE db_20772273;
#
# Bug #25717383: MYSQLDUMP MAY EXECUTE ANY ARBITRARY QUERY
#
CREATE DATABASE bug25717383;
use bug25717383;
CREATE TABLE `tab
one` (a int);
CREATE VIEW `view
one` as SELECT * FROM `tab
one`;
CREATE PROCEDURE `proc
one`() SELECT * from `tab
one`;
CREATE TEMPORARY TABLE `temp
one` (id INT);
CREATE TRIGGER `trig
one` BEFORE INSERT ON `tab
one` FOR EACH ROW SET NEW.a = 1;
CREATE EVENT `event
one` ON SCHEDULE AT '2030-01-01 00:00:00' DO SET @a=5;
SHOW TABLES FROM bug25717383;
Tables_in_bug25717383
tab
one
view
one
SHOW TRIGGERS FROM bug25717383;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
trig
one INSERT tab
one SET NEW.a = 1 BEFORE NULL root@localhost utf8 utf8_general_ci latin1_swedish_ci
SHOW EVENTS FROM bug25717383;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
bug25717383 event
one root@localhost SYSTEM ONE TIME # NULL NULL NULL NULL ENABLED 1 utf8 utf8_general_ci latin1_swedish_ci
SELECT ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_SCHEMA='bug25717383' AND ROUTINE_TYPE= 'PROCEDURE'
ORDER BY ROUTINE_NAME;
ROUTINE_NAME
proc
one
SHOW TABLES FROM bug25717383;
Tables_in_bug25717383
tab
one
view
one
SHOW TRIGGERS FROM bug25717383;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
trig
one INSERT tab
one SET NEW.a = 1 BEFORE NULL root@localhost utf8 utf8_general_ci latin1_swedish_ci
SHOW EVENTS FROM bug25717383;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
bug25717383 event
one root@localhost SYSTEM ONE TIME # NULL NULL NULL NULL ENABLED 1 utf8 utf8_general_ci latin1_swedish_ci
SELECT ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_SCHEMA='bug25717383' AND ROUTINE_TYPE= 'PROCEDURE'
ORDER BY ROUTINE_NAME;
ROUTINE_NAME
proc
one
DROP DATABASE bug25717383;
Usage: mysqldump [OPTIONS] database [tables] Usage: mysqldump [OPTIONS] database [tables]
OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...] OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
OR mysqldump [OPTIONS] --all-databases [OPTIONS] OR mysqldump [OPTIONS] --all-databases [OPTIONS]

View File

@ -267,7 +267,7 @@ from t2;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00
2 DEPENDENT SUBQUERY t1 ref_or_null a a 5 func 2 100.00 Using where; Full scan on NULL key 2 DEPENDENT SUBQUERY t1 ref_or_null a a 5 func 2 100.00 Using where; Full scan on NULL key
2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 100 100.00 Using where; Using join buffer (flat, BNL join) 2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 100 100.00 Using join buffer (flat, BNL join)
Warnings: Warnings:
Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(select `test`.`t1`.`a`,`test`.`t1`.`b` from `test`.`t1` join `test`.`t4` where ((`test`.`t1`.`c` = `test`.`t2`.`oref`) and trigcond(trigcond(((<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`)))) and trigcond(trigcond(((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`b`) or isnull(`test`.`t1`.`b`))))) having (trigcond(<is_not_null_test>(`test`.`t1`.`a`)) and trigcond(<is_not_null_test>(`test`.`t1`.`b`)))))) AS `Z` from `test`.`t2` Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(select `test`.`t1`.`a`,`test`.`t1`.`b` from `test`.`t1` join `test`.`t4` where ((`test`.`t1`.`c` = `test`.`t2`.`oref`) and trigcond(trigcond(((<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`)))) and trigcond(trigcond(((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`b`) or isnull(`test`.`t1`.`b`))))) having (trigcond(<is_not_null_test>(`test`.`t1`.`a`)) and trigcond(<is_not_null_test>(`test`.`t1`.`b`)))))) AS `Z` from `test`.`t2`
@ -1241,19 +1241,19 @@ explain select * from t2 where a in (select straight_join A.a from t1 A, t1 B);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 10 Using where 1 PRIMARY t2 ALL NULL NULL NULL NULL 10 Using where
2 DEPENDENT SUBQUERY A ALL NULL NULL NULL NULL 10 Using where 2 DEPENDENT SUBQUERY A ALL NULL NULL NULL NULL 10 Using where
2 DEPENDENT SUBQUERY B ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) 2 DEPENDENT SUBQUERY B ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join)
explain select * from t2 where a in (select straight_join A.a from t1 A, t1 B); explain select * from t2 where a in (select straight_join A.a from t1 A, t1 B);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 10 Using where 1 PRIMARY t2 ALL NULL NULL NULL NULL 10 Using where
2 DEPENDENT SUBQUERY A ALL NULL NULL NULL NULL 10 Using where 2 DEPENDENT SUBQUERY A ALL NULL NULL NULL NULL 10 Using where
2 DEPENDENT SUBQUERY B ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) 2 DEPENDENT SUBQUERY B ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join)
explain select straight_join * from t2 X, t2 Y explain select straight_join * from t2 X, t2 Y
where X.a in (select straight_join A.a from t1 A, t1 B); where X.a in (select straight_join A.a from t1 A, t1 B);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY X ALL NULL NULL NULL NULL 10 Using where 1 PRIMARY X ALL NULL NULL NULL NULL 10 Using where
1 PRIMARY Y ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) 1 PRIMARY Y ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join)
2 DEPENDENT SUBQUERY A ALL NULL NULL NULL NULL 10 Using where 2 DEPENDENT SUBQUERY A ALL NULL NULL NULL NULL 10 Using where
2 DEPENDENT SUBQUERY B ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) 2 DEPENDENT SUBQUERY B ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join)
create table t0 (a int, b int); create table t0 (a int, b int);
insert into t0 values(1,1); insert into t0 values(1,1);
explain select * from t0, t3 where t3.a in (select a from t2) and (t3.a < 10 or t3.a >30); explain select * from t0, t3 where t3.a in (select a from t2) and (t3.a < 10 or t3.a >30);

View File

@ -277,7 +277,7 @@ from t2;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00
2 DEPENDENT SUBQUERY t1 ref_or_null a a 5 func 2 100.00 Using where; Full scan on NULL key 2 DEPENDENT SUBQUERY t1 ref_or_null a a 5 func 2 100.00 Using where; Full scan on NULL key
2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 100 100.00 Using where; Using join buffer (flat, BNL join) 2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 100 100.00 Using join buffer (flat, BNL join)
Warnings: Warnings:
Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(select `test`.`t1`.`a`,`test`.`t1`.`b` from `test`.`t1` join `test`.`t4` where ((`test`.`t1`.`c` = `test`.`t2`.`oref`) and trigcond(trigcond(((<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`)))) and trigcond(trigcond(((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`b`) or isnull(`test`.`t1`.`b`))))) having (trigcond(<is_not_null_test>(`test`.`t1`.`a`)) and trigcond(<is_not_null_test>(`test`.`t1`.`b`)))))) AS `Z` from `test`.`t2` Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(select `test`.`t1`.`a`,`test`.`t1`.`b` from `test`.`t1` join `test`.`t4` where ((`test`.`t1`.`c` = `test`.`t2`.`oref`) and trigcond(trigcond(((<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`)))) and trigcond(trigcond(((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`b`) or isnull(`test`.`t1`.`b`))))) having (trigcond(<is_not_null_test>(`test`.`t1`.`a`)) and trigcond(<is_not_null_test>(`test`.`t1`.`b`)))))) AS `Z` from `test`.`t2`
@ -1251,19 +1251,19 @@ explain select * from t2 where a in (select straight_join A.a from t1 A, t1 B);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 10 Using where 1 PRIMARY t2 ALL NULL NULL NULL NULL 10 Using where
2 DEPENDENT SUBQUERY A ALL NULL NULL NULL NULL 10 Using where 2 DEPENDENT SUBQUERY A ALL NULL NULL NULL NULL 10 Using where
2 DEPENDENT SUBQUERY B ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) 2 DEPENDENT SUBQUERY B ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join)
explain select * from t2 where a in (select straight_join A.a from t1 A, t1 B); explain select * from t2 where a in (select straight_join A.a from t1 A, t1 B);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 10 Using where 1 PRIMARY t2 ALL NULL NULL NULL NULL 10 Using where
2 DEPENDENT SUBQUERY A ALL NULL NULL NULL NULL 10 Using where 2 DEPENDENT SUBQUERY A ALL NULL NULL NULL NULL 10 Using where
2 DEPENDENT SUBQUERY B ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) 2 DEPENDENT SUBQUERY B ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join)
explain select straight_join * from t2 X, t2 Y explain select straight_join * from t2 X, t2 Y
where X.a in (select straight_join A.a from t1 A, t1 B); where X.a in (select straight_join A.a from t1 A, t1 B);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY X ALL NULL NULL NULL NULL 10 Using where 1 PRIMARY X ALL NULL NULL NULL NULL 10 Using where
1 PRIMARY Y ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) 1 PRIMARY Y ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join)
2 DEPENDENT SUBQUERY A ALL NULL NULL NULL NULL 10 Using where 2 DEPENDENT SUBQUERY A ALL NULL NULL NULL NULL 10 Using where
2 DEPENDENT SUBQUERY B ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) 2 DEPENDENT SUBQUERY B ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join)
create table t0 (a int, b int); create table t0 (a int, b int);
insert into t0 values(1,1); insert into t0 values(1,1);
explain select * from t0, t3 where t3.a in (select a from t2) and (t3.a < 10 or t3.a >30); explain select * from t0, t3 where t3.a in (select a from t2) and (t3.a < 10 or t3.a >30);

View File

@ -19,7 +19,7 @@ SELECT 1 FROM t1
WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3)) WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3))
ORDER BY count(*); ORDER BY count(*);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL a 5 NULL 2 Using where; Using index; Using temporary 1 PRIMARY t1 index NULL a 5 NULL 2 Using index; Using temporary
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
3 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 0 const row not found 3 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 0 const row not found
# should not crash the next statement # should not crash the next statement
@ -1405,7 +1405,7 @@ GROUP BY f9;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables 3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
SELECT COUNT(t2.f3), SELECT COUNT(t2.f3),
(SELECT COUNT(f3) FROM t1 WHERE t2.f1) AS f9 (SELECT COUNT(f3) FROM t1 WHERE t2.f1) AS f9
FROM t2 JOIN t1 ON t1.f3 FROM t2 JOIN t1 ON t1.f3
@ -1421,7 +1421,7 @@ ORDER BY f9;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables 3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
SELECT COUNT(t2.f3), SELECT COUNT(t2.f3),
(SELECT COUNT(f3) FROM t1 WHERE t2.f1) AS f9 (SELECT COUNT(f3) FROM t1 WHERE t2.f1) AS f9
FROM t2 JOIN t1 ON t1.f3 FROM t2 JOIN t1 ON t1.f3
@ -2431,9 +2431,11 @@ WHERE EXISTS (
)"; )";
EXECUTE stmt; EXECUTE stmt;
i i
4
6 6
EXECUTE stmt; EXECUTE stmt;
i i
4
6 6
drop table t1, t2, t3; drop table t1, t2, t3;
# #

View File

@ -314,7 +314,7 @@ EXPLAIN SELECT 1 FROM t1 WHERE NOT EXISTS
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 1 Using where 1 PRIMARY t1 ALL NULL NULL NULL NULL 1 Using where
2 DEPENDENT SUBQUERY t2 eq_ref PRIMARY,d PRIMARY 1 func 1 Using where 2 DEPENDENT SUBQUERY t2 eq_ref PRIMARY,d PRIMARY 1 func 1 Using where
3 DEPENDENT SUBQUERY t2 index NULL d 2 NULL 1 Using where; Using index 3 DEPENDENT SUBQUERY t2 index NULL d 2 NULL 1 Using index
DROP TABLE t2; DROP TABLE t2;
CREATE TABLE t2 (b INT, c INT, UNIQUE KEY (b), UNIQUE KEY (b, c )) ENGINE=INNODB; CREATE TABLE t2 (b INT, c INT, UNIQUE KEY (b), UNIQUE KEY (b, c )) ENGINE=INNODB;
INSERT INTO t2 VALUES (1, 1); INSERT INTO t2 VALUES (1, 1);

View File

@ -2163,6 +2163,117 @@ execute stmt;
a a
0 0
drop table t1; drop table t1;
#
# MDEV-12429: IN subquery used in WHERE of EXISTS subquery
#
set optimizer_switch='exists_to_in=off';
CREATE TABLE t1 (
pk INT, f1 INT NOT NULL, f2 VARCHAR(3), f3 INT NULL, PRIMARY KEY(pk)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,1,'foo',8), (2,5,'bar',7);
SELECT sq1.f2 FROM t1 AS sq1
WHERE EXISTS ( SELECT * FROM t1 AS sq2
WHERE sq1.`pk` IN ( SELECT f1 FROM t1 ) AND sq2.f1 = sq1.f1 );
f2
foo
EXPLAIN
SELECT sq1.f2 FROM t1 AS sq1
WHERE EXISTS ( SELECT * FROM t1 AS sq2
WHERE sq1.`pk` IN ( SELECT f1 FROM t1 ) AND sq2.f1 = sq1.f1 );
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY sq1 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1
2 DEPENDENT SUBQUERY sq2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 MATERIALIZED t1 ALL NULL NULL NULL NULL 2
# this checks the result set above
set @save_optimizer_switch= @@optimizer_switch;
set optimizer_switch= 'materialization=off,semijoin=off';
SELECT sq1.f2 FROM t1 AS sq1
WHERE EXISTS ( SELECT * FROM t1 AS sq2
WHERE sq1.`pk` IN ( SELECT f1 FROM t1 ) AND sq2.f1 = sq1.f1 );
f2
foo
set optimizer_switch= @save_optimizer_switch;
DROP TABLE t1;
#
# MDEV-12145: IN subquery used in WHERE of EXISTS subquery
#
set optimizer_switch='exists_to_in=off';
CREATE TABLE t1 (f1 INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (4),(6);
CREATE TABLE t2 (i2 INT, KEY(i2)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (8),(7),(1);
CREATE TABLE t3 (f3 INT, i3 INT, KEY(i3)) ENGINE=MyISAM;
INSERT INTO t3 VALUES (8,0),(6,3),(2,8),(3,8),(1,6),(0,0),(1,0),(1,5);
SELECT * FROM t1
WHERE EXISTS ( SELECT * FROM t2, t3
WHERE i3 = i2 AND f1 IN ( SELECT f3 FROM t3 ) );
f1
6
EXPLAIN EXTENDED
SELECT * FROM t1
WHERE EXISTS ( SELECT * FROM t2, t3
WHERE i3 = i2 AND f1 IN ( SELECT f3 FROM t3 ) );
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
2 DEPENDENT SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1 100.00
2 DEPENDENT SUBQUERY t2 index i2 i2 5 NULL 3 100.00 Using where; Using index; Using join buffer (flat, BNL join)
2 DEPENDENT SUBQUERY t3 ref i3 i3 5 test.t2.i2 2 100.00 Using index
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 8 100.00
Warnings:
Note 1276 Field or reference 'test.t1.f1' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`t1`.`f1` AS `f1` from `test`.`t1` where <expr_cache><`test`.`t1`.`f1`>(exists(select 1 from `test`.`t2` semi join (`test`.`t3`) join `test`.`t3` where ((`test`.`t3`.`i3` = `test`.`t2`.`i2`) and (`test`.`t1`.`f1` = `test`.`t3`.`f3`))))
# this checks the result set above
set @save_optimizer_switch= @@optimizer_switch;
set optimizer_switch= 'materialization=off,semijoin=off';
SELECT * FROM t1
WHERE EXISTS ( SELECT * FROM t2, t3
WHERE i3 = i2 AND f1 IN ( SELECT f3 FROM t3 ) );
f1
6
set optimizer_switch= @save_optimizer_switch;
DROP TABLE t1,t2,t3;
#
# MDEV-9686: IN subquery used in WHERE of a subquery from select list
#
CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT);
INSERT INTO t1 VALUES (1, 4),(2, 3),(3, 3),(4, 6),(5, 3);
CREATE TABLE t2 (f2 INT);
INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
# t1.pk is always IN ( SELECT f2 FROM t2 ),
# so the IN condition should be true for every row,
# and thus COUNT(*) should always return 5
SELECT pk, f1, ( SELECT COUNT(*) FROM t2
WHERE t1.pk IN ( SELECT f2 FROM t2 ) ) AS sq FROM t1;
pk f1 sq
1 4 5
2 3 5
3 3 5
4 6 5
5 3 5
EXPLAIN EXTENDED
SELECT pk, f1, ( SELECT COUNT(*) FROM t2
WHERE t1.pk IN ( SELECT f2 FROM t2 ) ) AS sq FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00
2 DEPENDENT SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1 100.00
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join)
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00
Warnings:
Note 1276 Field or reference 'test.t1.pk' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`f1` AS `f1`,<expr_cache><`test`.`t1`.`pk`>((select count(0) from `test`.`t2` semi join (`test`.`t2`) where (`test`.`t1`.`pk` = `test`.`t2`.`f2`))) AS `sq` from `test`.`t1`
# this checks the result set above
set @save_optimizer_switch= @@optimizer_switch;
set optimizer_switch= 'materialization=off,semijoin=off';
SELECT pk, f1, ( SELECT COUNT(*) FROM t2
WHERE t1.pk IN ( SELECT f2 FROM t2 ) ) AS sq FROM t1;
pk f1 sq
1 4 5
2 3 5
3 3 5
4 6 5
5 3 5
set optimizer_switch= @save_optimizer_switch;
DROP TABLE t1,t2;
# End of 5.5 tests # End of 5.5 tests
# #
# MDEV-7220: Materialization strategy is not used for REPLACE ... SELECT # MDEV-7220: Materialization strategy is not used for REPLACE ... SELECT

View File

@ -178,7 +178,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY m16 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) 2 DEPENDENT SUBQUERY m16 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
2 DEPENDENT SUBQUERY m17 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) 2 DEPENDENT SUBQUERY m17 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
2 DEPENDENT SUBQUERY m18 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) 2 DEPENDENT SUBQUERY m18 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
2 DEPENDENT SUBQUERY m19 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) 2 DEPENDENT SUBQUERY m19 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
select * from select * from
t1 left join t2 on (t2.a= t1.a and t2.a in (select pk from t10)) t1 left join t2 on (t2.a= t1.a and t2.a in (select pk from t10))
where t1.a < 5; where t1.a < 5;

View File

@ -191,7 +191,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY m16 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) 2 DEPENDENT SUBQUERY m16 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
2 DEPENDENT SUBQUERY m17 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) 2 DEPENDENT SUBQUERY m17 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
2 DEPENDENT SUBQUERY m18 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) 2 DEPENDENT SUBQUERY m18 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
2 DEPENDENT SUBQUERY m19 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (incremental, BNL join) 2 DEPENDENT SUBQUERY m19 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join)
select * from select * from
t1 left join t2 on (t2.a= t1.a and t2.a in (select pk from t10)) t1 left join t2 on (t2.a= t1.a and t2.a in (select pk from t10))
where t1.a < 5; where t1.a < 5;

View File

@ -2203,6 +2203,117 @@ execute stmt;
a a
0 0
drop table t1; drop table t1;
#
# MDEV-12429: IN subquery used in WHERE of EXISTS subquery
#
set optimizer_switch='exists_to_in=off';
CREATE TABLE t1 (
pk INT, f1 INT NOT NULL, f2 VARCHAR(3), f3 INT NULL, PRIMARY KEY(pk)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,1,'foo',8), (2,5,'bar',7);
SELECT sq1.f2 FROM t1 AS sq1
WHERE EXISTS ( SELECT * FROM t1 AS sq2
WHERE sq1.`pk` IN ( SELECT f1 FROM t1 ) AND sq2.f1 = sq1.f1 );
f2
foo
EXPLAIN
SELECT sq1.f2 FROM t1 AS sq1
WHERE EXISTS ( SELECT * FROM t1 AS sq2
WHERE sq1.`pk` IN ( SELECT f1 FROM t1 ) AND sq2.f1 = sq1.f1 );
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY sq1 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1
2 DEPENDENT SUBQUERY sq2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 MATERIALIZED t1 ALL NULL NULL NULL NULL 2
# this checks the result set above
set @save_optimizer_switch= @@optimizer_switch;
set optimizer_switch= 'materialization=off,semijoin=off';
SELECT sq1.f2 FROM t1 AS sq1
WHERE EXISTS ( SELECT * FROM t1 AS sq2
WHERE sq1.`pk` IN ( SELECT f1 FROM t1 ) AND sq2.f1 = sq1.f1 );
f2
foo
set optimizer_switch= @save_optimizer_switch;
DROP TABLE t1;
#
# MDEV-12145: IN subquery used in WHERE of EXISTS subquery
#
set optimizer_switch='exists_to_in=off';
CREATE TABLE t1 (f1 INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (4),(6);
CREATE TABLE t2 (i2 INT, KEY(i2)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (8),(7),(1);
CREATE TABLE t3 (f3 INT, i3 INT, KEY(i3)) ENGINE=MyISAM;
INSERT INTO t3 VALUES (8,0),(6,3),(2,8),(3,8),(1,6),(0,0),(1,0),(1,5);
SELECT * FROM t1
WHERE EXISTS ( SELECT * FROM t2, t3
WHERE i3 = i2 AND f1 IN ( SELECT f3 FROM t3 ) );
f1
6
EXPLAIN EXTENDED
SELECT * FROM t1
WHERE EXISTS ( SELECT * FROM t2, t3
WHERE i3 = i2 AND f1 IN ( SELECT f3 FROM t3 ) );
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
2 DEPENDENT SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1 100.00
2 DEPENDENT SUBQUERY t2 index i2 i2 5 NULL 3 100.00 Using where; Using index; Using join buffer (flat, BNL join)
2 DEPENDENT SUBQUERY t3 ref i3 i3 5 test.t2.i2 2 100.00 Using index
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 8 100.00
Warnings:
Note 1276 Field or reference 'test.t1.f1' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`t1`.`f1` AS `f1` from `test`.`t1` where <expr_cache><`test`.`t1`.`f1`>(exists(select 1 from `test`.`t2` semi join (`test`.`t3`) join `test`.`t3` where ((`test`.`t3`.`i3` = `test`.`t2`.`i2`) and (`test`.`t1`.`f1` = `test`.`t3`.`f3`))))
# this checks the result set above
set @save_optimizer_switch= @@optimizer_switch;
set optimizer_switch= 'materialization=off,semijoin=off';
SELECT * FROM t1
WHERE EXISTS ( SELECT * FROM t2, t3
WHERE i3 = i2 AND f1 IN ( SELECT f3 FROM t3 ) );
f1
6
set optimizer_switch= @save_optimizer_switch;
DROP TABLE t1,t2,t3;
#
# MDEV-9686: IN subquery used in WHERE of a subquery from select list
#
CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT);
INSERT INTO t1 VALUES (1, 4),(2, 3),(3, 3),(4, 6),(5, 3);
CREATE TABLE t2 (f2 INT);
INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
# t1.pk is always IN ( SELECT f2 FROM t2 ),
# so the IN condition should be true for every row,
# and thus COUNT(*) should always return 5
SELECT pk, f1, ( SELECT COUNT(*) FROM t2
WHERE t1.pk IN ( SELECT f2 FROM t2 ) ) AS sq FROM t1;
pk f1 sq
1 4 5
2 3 5
3 3 5
4 6 5
5 3 5
EXPLAIN EXTENDED
SELECT pk, f1, ( SELECT COUNT(*) FROM t2
WHERE t1.pk IN ( SELECT f2 FROM t2 ) ) AS sq FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00
2 DEPENDENT SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1 100.00
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join)
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00
Warnings:
Note 1276 Field or reference 'test.t1.pk' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`f1` AS `f1`,<expr_cache><`test`.`t1`.`pk`>((select count(0) from `test`.`t2` semi join (`test`.`t2`) where (`test`.`t1`.`pk` = `test`.`t2`.`f2`))) AS `sq` from `test`.`t1`
# this checks the result set above
set @save_optimizer_switch= @@optimizer_switch;
set optimizer_switch= 'materialization=off,semijoin=off';
SELECT pk, f1, ( SELECT COUNT(*) FROM t2
WHERE t1.pk IN ( SELECT f2 FROM t2 ) ) AS sq FROM t1;
pk f1 sq
1 4 5
2 3 5
3 3 5
4 6 5
5 3 5
set optimizer_switch= @save_optimizer_switch;
DROP TABLE t1,t2;
# End of 5.5 tests # End of 5.5 tests
# #
# MDEV-7220: Materialization strategy is not used for REPLACE ... SELECT # MDEV-7220: Materialization strategy is not used for REPLACE ... SELECT

View File

@ -213,3 +213,14 @@ t2 CREATE TABLE `t2` (
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop tables t1, t2; drop tables t1, t2;
#
# Test for bug #25514146 DB_NAME IS IGNORED WHEN CREATING TABLE
# WITH DATA DIRECTORY
#
# Make sure we have no current database
CREATE DATABASE x;
USE x;
DROP DATABASE x;
CREATE TABLE test.t1(id INT(11)) ENGINE MYISAM
DATA DIRECTORY "MYSQLTEST_VARDIR/tmp";
DROP TABLE test.t1;

View File

@ -438,7 +438,7 @@ WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON it.i=it.i WHERE it.pk-t1.i<10
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where
2 DEPENDENT SUBQUERY it eq_ref PRIMARY PRIMARY 4 func 1 Using index condition 2 DEPENDENT SUBQUERY it eq_ref PRIMARY PRIMARY 4 func 1 Using index condition
2 DEPENDENT SUBQUERY t2 index NULL PRIMARY 4 NULL 3 Using where; Using index; Using join buffer (flat, BNL join) 2 DEPENDENT SUBQUERY t2 index NULL PRIMARY 4 NULL 3 Using index; Using join buffer (flat, BNL join)
SELECT * FROM t1 SELECT * FROM t1
WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON it.i=it.i WHERE it.pk-t1.i<10); WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON it.i=it.i WHERE it.pk-t1.i<10);
pk i pk i
@ -802,7 +802,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t ALL PRIMARY,c NULL NULL NULL 64 Using where 1 PRIMARY t ALL PRIMARY,c NULL NULL NULL 64 Using where
1 PRIMARY t2 ref g g 5 test.t.c 19 Using where 1 PRIMARY t2 ref g g 5 test.t.c 19 Using where
2 DEPENDENT SUBQUERY t1 index PRIMARY PRIMARY 4 NULL 64 Using where; Using index 2 DEPENDENT SUBQUERY t1 index PRIMARY PRIMARY 4 NULL 64 Using where; Using index
2 DEPENDENT SUBQUERY t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using index condition; Using where 2 DEPENDENT SUBQUERY t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where
SELECT COUNT(*) FROM t1 AS t, t2 SELECT COUNT(*) FROM t1 AS t, t2
WHERE c = g WHERE c = g
AND (EXISTS (SELECT * FROM t1, t2 WHERE a = f AND h <= t.e AND a > t.b) AND (EXISTS (SELECT * FROM t1, t2 WHERE a = f AND h <= t.e AND a > t.b)

View File

@ -13,7 +13,7 @@ use events_test;
# mysql.event intact checking end # mysql.event intact checking end
# #
create event e_26 on schedule at '2027-01-01 00:00:00' disable do set @a = 5; create event e_26 on schedule at '2037-01-01 00:00:00' disable do set @a = 5;
select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event; select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event;
drop event e_26; drop event e_26;
--error ER_WRONG_VALUE --error ER_WRONG_VALUE

View File

@ -294,7 +294,7 @@ SELECT * FROM v2;
DELETE FROM t1; DELETE FROM t1;
--echo --echo
--error ER_LOAD_DATA_INVALID_COLUMN --error ER_NONUPDATEABLE_COLUMN
LOAD DATA INFILE '../../std_data/bug35469.dat' INTO TABLE v2 LOAD DATA INFILE '../../std_data/bug35469.dat' INTO TABLE v2
FIELDS ESCAPED BY '\\' FIELDS ESCAPED BY '\\'
TERMINATED BY ',' TERMINATED BY ','

View File

@ -7,6 +7,8 @@
# check that CSV engine was compiled in # check that CSV engine was compiled in
--source include/have_csv.inc --source include/have_csv.inc
set @@global.log_output = 'TABLE';
connect (con1,localhost,root,,); connect (con1,localhost,root,,);
connect (con2,localhost,root,,); connect (con2,localhost,root,,);
@ -18,18 +20,20 @@ set session long_query_time=10;
select get_lock('bug27638', 1); select get_lock('bug27638', 1);
connection con2; connection con2;
set session long_query_time=1; set session long_query_time=1;
truncate table mysql.slow_log;
select get_lock('bug27638', 2); select get_lock('bug27638', 2);
select if (query_time between '00:00:01' and '00:00:10', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log; select if (query_time >= '00:00:01', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log
truncate table mysql.slow_log; where sql_text = 'select get_lock(\'bug27638\', 2)';
select get_lock('bug27638', 60); select get_lock('bug27638', 60);
select if (query_time between '00:00:59' and '00:01:10', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log; select if (query_time >= '00:00:59', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log
truncate table mysql.slow_log; where sql_text = 'select get_lock(\'bug27638\', 60)';
select get_lock('bug27638', 101); select get_lock('bug27638', 101);
select if (query_time between '00:01:40' and '00:01:50', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log; select if (query_time >= '00:01:40', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log
where sql_text = 'select get_lock(\'bug27638\', 101)';
connection con1; connection con1;
select release_lock('bug27638'); select release_lock('bug27638');
connection default; connection default;
disconnect con1; disconnect con1;
disconnect con2; disconnect con2;
set @@global.log_output=default;

View File

@ -2483,6 +2483,56 @@ DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
DROP DATABASE db_20772273; DROP DATABASE db_20772273;
--echo #
--echo # Bug #25717383: MYSQLDUMP MAY EXECUTE ANY ARBITRARY QUERY
--echo #
CREATE DATABASE bug25717383;
use bug25717383;
CREATE TABLE `tab
one` (a int);
CREATE VIEW `view
one` as SELECT * FROM `tab
one`;
CREATE PROCEDURE `proc
one`() SELECT * from `tab
one`;
CREATE TEMPORARY TABLE `temp
one` (id INT);
CREATE TRIGGER `trig
one` BEFORE INSERT ON `tab
one` FOR EACH ROW SET NEW.a = 1;
CREATE EVENT `event
one` ON SCHEDULE AT '2030-01-01 00:00:00' DO SET @a=5;
SHOW TABLES FROM bug25717383;
SHOW TRIGGERS FROM bug25717383;
--replace_column 6 #
SHOW EVENTS FROM bug25717383;
SELECT ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_SCHEMA='bug25717383' AND ROUTINE_TYPE= 'PROCEDURE'
ORDER BY ROUTINE_NAME;
--exec $MYSQL_DUMP --triggers --events --routines --add-drop-database --databases bug25717383 > $MYSQLTEST_VARDIR/tmp/bug25717383.sql
SHOW TABLES FROM bug25717383;
SHOW TRIGGERS FROM bug25717383;
--replace_column 6 #
SHOW EVENTS FROM bug25717383;
SELECT ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_SCHEMA='bug25717383' AND ROUTINE_TYPE= 'PROCEDURE'
ORDER BY ROUTINE_NAME;
DROP DATABASE bug25717383;
# #
# MDEV-6091 mysqldump goes in a loop and segfaults if --dump-slave is specified and it cannot connect to the server # MDEV-6091 mysqldump goes in a loop and segfaults if --dump-slave is specified and it cannot connect to the server
# #

View File

@ -1857,6 +1857,95 @@ execute stmt;
drop table t1; drop table t1;
--echo #
--echo # MDEV-12429: IN subquery used in WHERE of EXISTS subquery
--echo #
set optimizer_switch='exists_to_in=off';
CREATE TABLE t1 (
pk INT, f1 INT NOT NULL, f2 VARCHAR(3), f3 INT NULL, PRIMARY KEY(pk)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,1,'foo',8), (2,5,'bar',7);
SELECT sq1.f2 FROM t1 AS sq1
WHERE EXISTS ( SELECT * FROM t1 AS sq2
WHERE sq1.`pk` IN ( SELECT f1 FROM t1 ) AND sq2.f1 = sq1.f1 );
EXPLAIN
SELECT sq1.f2 FROM t1 AS sq1
WHERE EXISTS ( SELECT * FROM t1 AS sq2
WHERE sq1.`pk` IN ( SELECT f1 FROM t1 ) AND sq2.f1 = sq1.f1 );
--echo # this checks the result set above
set @save_optimizer_switch= @@optimizer_switch;
set optimizer_switch= 'materialization=off,semijoin=off';
SELECT sq1.f2 FROM t1 AS sq1
WHERE EXISTS ( SELECT * FROM t1 AS sq2
WHERE sq1.`pk` IN ( SELECT f1 FROM t1 ) AND sq2.f1 = sq1.f1 );
set optimizer_switch= @save_optimizer_switch;
DROP TABLE t1;
--echo #
--echo # MDEV-12145: IN subquery used in WHERE of EXISTS subquery
--echo #
set optimizer_switch='exists_to_in=off';
CREATE TABLE t1 (f1 INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (4),(6);
CREATE TABLE t2 (i2 INT, KEY(i2)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (8),(7),(1);
CREATE TABLE t3 (f3 INT, i3 INT, KEY(i3)) ENGINE=MyISAM;
INSERT INTO t3 VALUES (8,0),(6,3),(2,8),(3,8),(1,6),(0,0),(1,0),(1,5);
SELECT * FROM t1
WHERE EXISTS ( SELECT * FROM t2, t3
WHERE i3 = i2 AND f1 IN ( SELECT f3 FROM t3 ) );
EXPLAIN EXTENDED
SELECT * FROM t1
WHERE EXISTS ( SELECT * FROM t2, t3
WHERE i3 = i2 AND f1 IN ( SELECT f3 FROM t3 ) );
--echo # this checks the result set above
set @save_optimizer_switch= @@optimizer_switch;
set optimizer_switch= 'materialization=off,semijoin=off';
SELECT * FROM t1
WHERE EXISTS ( SELECT * FROM t2, t3
WHERE i3 = i2 AND f1 IN ( SELECT f3 FROM t3 ) );
set optimizer_switch= @save_optimizer_switch;
DROP TABLE t1,t2,t3;
--echo #
--echo # MDEV-9686: IN subquery used in WHERE of a subquery from select list
--echo #
CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT);
INSERT INTO t1 VALUES (1, 4),(2, 3),(3, 3),(4, 6),(5, 3);
CREATE TABLE t2 (f2 INT);
INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
--echo # t1.pk is always IN ( SELECT f2 FROM t2 ),
--echo # so the IN condition should be true for every row,
--echo # and thus COUNT(*) should always return 5
SELECT pk, f1, ( SELECT COUNT(*) FROM t2
WHERE t1.pk IN ( SELECT f2 FROM t2 ) ) AS sq FROM t1;
EXPLAIN EXTENDED
SELECT pk, f1, ( SELECT COUNT(*) FROM t2
WHERE t1.pk IN ( SELECT f2 FROM t2 ) ) AS sq FROM t1;
--echo # this checks the result set above
set @save_optimizer_switch= @@optimizer_switch;
set optimizer_switch= 'materialization=off,semijoin=off';
SELECT pk, f1, ( SELECT COUNT(*) FROM t2
WHERE t1.pk IN ( SELECT f2 FROM t2 ) ) AS sq FROM t1;
set optimizer_switch= @save_optimizer_switch;
DROP TABLE t1,t2;
--echo # End of 5.5 tests --echo # End of 5.5 tests
--echo # --echo #
--echo # MDEV-7220: Materialization strategy is not used for REPLACE ... SELECT --echo # MDEV-7220: Materialization strategy is not used for REPLACE ... SELECT

View File

@ -298,3 +298,19 @@ show create table t1;
create table t2 like t1; create table t2 like t1;
show create table t2; show create table t2;
drop tables t1, t2; drop tables t1, t2;
--echo #
--echo # Test for bug #25514146 DB_NAME IS IGNORED WHEN CREATING TABLE
--echo # WITH DATA DIRECTORY
--echo #
--echo # Make sure we have no current database
CREATE DATABASE x;
USE x;
DROP DATABASE x;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE test.t1(id INT(11)) ENGINE MYISAM
DATA DIRECTORY "$MYSQLTEST_VARDIR/tmp";
DROP TABLE test.t1;

View File

@ -1,5 +1,5 @@
# Copyright (c) 2005, 2015, Oracle and/or its affiliates. # Copyright (c) 2005, 2015, Oracle and/or its affiliates.
# Copyright (c) 2008, 2016, MariaDB # Copyright (c) 2008, 2017, MariaDB
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public # modify it under the terms of the GNU Library General Public
@ -1386,4 +1386,3 @@
obj:*/libssl.so.0.9.8 obj:*/libssl.so.0.9.8
... ...
} }

View File

@ -92,9 +92,13 @@ size_t sf_malloc_usable_size(void *ptr, my_bool *is_thread_specific);
void my_error_unregister_all(void); void my_error_unregister_all(void);
#if !defined(O_PATH) && defined(O_EXEC) /* FreeBSD */ #ifndef O_PATH /* not Linux */
#if defined(O_SEARCH) /* Illumos */
#define O_PATH O_SEARCH
#elif defined(O_EXEC) /* FreeBSD */
#define O_PATH O_EXEC #define O_PATH O_EXEC
#endif #endif
#endif
#ifdef O_PATH #ifdef O_PATH
#define HAVE_OPEN_PARENT_DIR_NOSYMLINKS #define HAVE_OPEN_PARENT_DIR_NOSYMLINKS

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# Copyright (c) 2002, 2012, Oracle and/or its affiliates. # Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
# #
# 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
@ -194,6 +194,20 @@ set_echo_compat() {
esac esac
} }
validate_reply () {
ret=0
if [ -z "$1" ]; then
reply=y
return $ret
fi
case $1 in
y|Y|yes|Yes|YES) reply=y ;;
n|N|no|No|NO) reply=n ;;
*) ret=1 ;;
esac
return $ret
}
prepare() { prepare() {
touch $config $command touch $config $command
chmod 600 $config $command chmod 600 $config $command
@ -407,15 +421,18 @@ echo "Setting the root password ensures that nobody can log into the MariaDB"
echo "root user without the proper authorisation." echo "root user without the proper authorisation."
echo echo
if [ $hadpass -eq 0 ]; then while true ; do
echo $echo_n "Set root password? [Y/n] $echo_c" if [ $hadpass -eq 0 ]; then
else echo $echo_n "Set root password? [Y/n] $echo_c"
echo "You already have a root password set, so you can safely answer 'n'." else
echo echo "You already have a root password set, so you can safely answer 'n'."
echo $echo_n "Change the root password? [Y/n] $echo_c" echo
fi echo $echo_n "Change the root password? [Y/n] $echo_c"
fi
read reply
validate_reply $reply && break
done
read reply
if [ "$reply" = "n" ]; then if [ "$reply" = "n" ]; then
echo " ... skipping." echo " ... skipping."
else else
@ -439,9 +456,11 @@ echo "go a bit smoother. You should remove them before moving into a"
echo "production environment." echo "production environment."
echo echo
echo $echo_n "Remove anonymous users? [Y/n] $echo_c" while true ; do
echo $echo_n "Remove anonymous users? [Y/n] $echo_c"
read reply read reply
validate_reply $reply && break
done
if [ "$reply" = "n" ]; then if [ "$reply" = "n" ]; then
echo " ... skipping." echo " ... skipping."
else else
@ -457,9 +476,11 @@ echo
echo "Normally, root should only be allowed to connect from 'localhost'. This" echo "Normally, root should only be allowed to connect from 'localhost'. This"
echo "ensures that someone cannot guess at the root password from the network." echo "ensures that someone cannot guess at the root password from the network."
echo echo
while true ; do
echo $echo_n "Disallow root login remotely? [Y/n] $echo_c" echo $echo_n "Disallow root login remotely? [Y/n] $echo_c"
read reply read reply
validate_reply $reply && break
done
if [ "$reply" = "n" ]; then if [ "$reply" = "n" ]; then
echo " ... skipping." echo " ... skipping."
else else
@ -477,8 +498,12 @@ echo "access. This is also intended only for testing, and should be removed"
echo "before moving into a production environment." echo "before moving into a production environment."
echo echo
echo $echo_n "Remove test database and access to it? [Y/n] $echo_c" while true ; do
read reply echo $echo_n "Remove test database and access to it? [Y/n] $echo_c"
read reply
validate_reply $reply && break
done
if [ "$reply" = "n" ]; then if [ "$reply" = "n" ]; then
echo " ... skipping." echo " ... skipping."
else else
@ -495,8 +520,12 @@ echo "Reloading the privilege tables will ensure that all changes made so far"
echo "will take effect immediately." echo "will take effect immediately."
echo echo
echo $echo_n "Reload privilege tables now? [Y/n] $echo_c" while true ; do
read reply echo $echo_n "Reload privilege tables now? [Y/n] $echo_c"
read reply
validate_reply $reply && break
done
if [ "$reply" = "n" ]; then if [ "$reply" = "n" ]; then
echo " ... skipping." echo " ... skipping."
else else

View File

@ -956,4 +956,3 @@ do
done done
log_notice "mysqld from pid file $pid_file ended" log_notice "mysqld from pid file $pid_file ended"

View File

@ -1678,8 +1678,8 @@ mysql_ssl_set(MYSQL *mysql __attribute__((unused)) ,
mysql_options(mysql, MYSQL_OPT_SSL_CAPATH, capath) | mysql_options(mysql, MYSQL_OPT_SSL_CAPATH, capath) |
mysql_options(mysql, MYSQL_OPT_SSL_CIPHER, cipher) ? mysql_options(mysql, MYSQL_OPT_SSL_CIPHER, cipher) ?
1 : 0); 1 : 0);
mysql->options.use_ssl= TRUE;
#endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */ #endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */
mysql->options.use_ssl= TRUE;
DBUG_RETURN(result); DBUG_RETURN(result);
} }
@ -2540,7 +2540,6 @@ static int send_client_reply_packet(MCPVIO_EXT *mpvio,
int3store(buff+2, net->max_packet_size); int3store(buff+2, net->max_packet_size);
end= buff+5; end= buff+5;
} }
#ifdef HAVE_OPENSSL
/* /*
If client uses ssl and client also has to verify the server If client uses ssl and client also has to verify the server
@ -2558,6 +2557,7 @@ static int send_client_reply_packet(MCPVIO_EXT *mpvio,
goto error; goto error;
} }
#ifdef HAVE_OPENSSL
if (mysql->client_flag & CLIENT_SSL) if (mysql->client_flag & CLIENT_SSL)
{ {
/* Do the SSL layering. */ /* Do the SSL layering. */

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2000, 2013, Oracle and/or its affiliates. Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2009, 2013, Monty Program Ab. Copyright (c) 2009, 2017, MariaDB
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
@ -3926,6 +3926,7 @@ String *Item_func_quote::val_str(String *str)
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
}; };
ulong max_allowed_packet= current_thd->variables.max_allowed_packet;
char *from, *to, *end, *start; char *from, *to, *end, *start;
String *arg= args[0]->val_str(str); String *arg= args[0]->val_str(str);
uint arg_length, new_length; uint arg_length, new_length;
@ -3944,11 +3945,14 @@ String *Item_func_quote::val_str(String *str)
new_length= arg_length + 2; /* for beginning and ending ' signs */ new_length= arg_length + 2; /* for beginning and ending ' signs */
for (from= (char*) arg->ptr(), end= from + arg_length; from < end; from++) for (from= (char*) arg->ptr(), end= from + arg_length; from < end; from++)
new_length+= get_esc_bit(escmask, (uchar) *from); new_length+= get_esc_bit(escmask, (uchar) *from);
if (new_length > max_allowed_packet)
goto toolong;
} }
else else
{ {
new_length= (arg_length * 2) + /* For string characters */ new_length= (arg_length * 2) + /* For string characters */
(2 * collation.collation->mbmaxlen); /* For quotes */ (2 * collation.collation->mbmaxlen); /* For quotes */
set_if_smaller(new_length, max_allowed_packet);
} }
if (tmp_value.alloc(new_length)) if (tmp_value.alloc(new_length))
@ -3964,7 +3968,7 @@ String *Item_func_quote::val_str(String *str)
/* Put leading quote */ /* Put leading quote */
if ((mblen= cs->cset->wc_mb(cs, '\'', (uchar *) to, to_end)) <= 0) if ((mblen= cs->cset->wc_mb(cs, '\'', (uchar *) to, to_end)) <= 0)
goto null; goto toolong;
to+= mblen; to+= mblen;
for (start= (char*) arg->ptr(), end= start + arg_length; start < end; ) for (start= (char*) arg->ptr(), end= start + arg_length; start < end; )
@ -3984,17 +3988,17 @@ String *Item_func_quote::val_str(String *str)
if (escape) if (escape)
{ {
if ((mblen= cs->cset->wc_mb(cs, '\\', (uchar*) to, to_end)) <= 0) if ((mblen= cs->cset->wc_mb(cs, '\\', (uchar*) to, to_end)) <= 0)
goto null; goto toolong;
to+= mblen; to+= mblen;
} }
if ((mblen= cs->cset->wc_mb(cs, wc, (uchar*) to, to_end)) <= 0) if ((mblen= cs->cset->wc_mb(cs, wc, (uchar*) to, to_end)) <= 0)
goto null; goto toolong;
to+= mblen; to+= mblen;
} }
/* Put trailing quote */ /* Put trailing quote */
if ((mblen= cs->cset->wc_mb(cs, '\'', (uchar *) to, to_end)) <= 0) if ((mblen= cs->cset->wc_mb(cs, '\'', (uchar *) to, to_end)) <= 0)
goto null; goto toolong;
to+= mblen; to+= mblen;
new_length= to - tmp_value.ptr(); new_length= to - tmp_value.ptr();
goto ret; goto ret;
@ -4038,6 +4042,11 @@ ret:
null_value= 0; null_value= 0;
return &tmp_value; return &tmp_value;
toolong:
push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_ALLOWED_PACKET_OVERFLOWED,
ER_THD(current_thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED),
func_name(), max_allowed_packet);
null: null:
null_value= 1; null_value= 1;
return 0; return 0;

View File

@ -3442,7 +3442,7 @@ Item_func_group_concat::fix_fields(THD *thd, Item **ref)
args[i]->fix_fields(thd, args + i)) || args[i]->fix_fields(thd, args + i)) ||
args[i]->check_cols(1)) args[i]->check_cols(1))
return TRUE; return TRUE;
with_subselect|= args[i]->with_subselect; with_subselect|= args[i]->with_subselect;
} }
/* skip charset aggregation for order columns */ /* skip charset aggregation for order columns */

View File

@ -1,4 +1,5 @@
/* Copyright (c) 2005, 2013, Oracle and/or its affiliates. /* Copyright (c) 2005, 2016, Oracle and/or its affiliates.
Copyright (c) 2009, 2017, MariaDB
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
@ -2751,9 +2752,9 @@ int xml_enter(MY_XML_PARSER *st,const char *attr, size_t len)
node.parent= data->parent; // Set parent for the new node to old parent node.parent= data->parent; // Set parent for the new node to old parent
data->parent= numnodes; // Remember current node as new parent data->parent= numnodes; // Remember current node as new parent
DBUG_ASSERT(data->level <= MAX_LEVEL); DBUG_ASSERT(data->level < MAX_LEVEL);
data->pos[data->level]= numnodes; data->pos[data->level]= numnodes;
if (data->level < MAX_LEVEL) if (data->level < MAX_LEVEL - 1)
node.level= data->level++; node.level= data->level++;
else else
return MY_XML_ERROR; return MY_XML_ERROR;

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2002, 2015, Oracle and/or its affiliates. Copyright (c) 2002, 2016, Oracle and/or its affiliates.
Copyright (c) 2009, 2015, MariaDB Copyright (c) 2009, 2017, MariaDB
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

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2000, 2015, Oracle and/or its affiliates. Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2008, 2016, MariaDB Copyright (c) 2008, 2017, MariaDB
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

View File

@ -69,6 +69,7 @@
#define RAND_TABLE_BIT (((table_map) 1) << (sizeof(table_map)*8-1)) #define RAND_TABLE_BIT (((table_map) 1) << (sizeof(table_map)*8-1))
#define PSEUDO_TABLE_BITS (PARAM_TABLE_BIT | OUTER_REF_TABLE_BIT | \ #define PSEUDO_TABLE_BITS (PARAM_TABLE_BIT | OUTER_REF_TABLE_BIT | \
RAND_TABLE_BIT) RAND_TABLE_BIT)
#define CONNECT_STRING_MAXLEN 65535 /* stored in 2 bytes in .frm */
#define MAX_FIELDS 4096 /* Limit in the .frm file */ #define MAX_FIELDS 4096 /* Limit in the .frm file */
#define MAX_PARTITIONS 8192 #define MAX_PARTITIONS 8192

View File

@ -1060,7 +1060,7 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
{ {
uint length; uint length;
uchar *pos; uchar *pos;
Item *real_item; Item_field *real_item;
if (read_info.read_field()) if (read_info.read_field())
break; break;
@ -1072,16 +1072,26 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
pos=read_info.row_start; pos=read_info.row_start;
length=(uint) (read_info.row_end-pos); length=(uint) (read_info.row_end-pos);
real_item= item->real_item(); real_item= item->field_for_view_update();
if ((!read_info.enclosed && if ((!read_info.enclosed &&
(enclosed_length && length == 4 && (enclosed_length && length == 4 &&
!memcmp(pos, STRING_WITH_LEN("NULL")))) || !memcmp(pos, STRING_WITH_LEN("NULL")))) ||
(length == 1 && read_info.found_null)) (length == 1 && read_info.found_null))
{ {
if (real_item->type() == Item::FIELD_ITEM) if (item->type() == Item::STRING_ITEM)
{ {
Field *field= ((Item_field *)real_item)->field; ((Item_user_var_as_out_param *)item)->set_null_value(
read_info.read_charset);
}
else if (!real_item)
{
my_error(ER_NONUPDATEABLE_COLUMN, MYF(0), item->name);
DBUG_RETURN(1);
}
else
{
Field *field= real_item->field;
if (field->reset()) if (field->reset())
{ {
my_error(ER_WARN_NULL_TO_NOTNULL, MYF(0), field->field_name, my_error(ER_WARN_NULL_TO_NOTNULL, MYF(0), field->field_name,
@ -1104,23 +1114,23 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
/* Do not auto-update this field. */ /* Do not auto-update this field. */
field->set_has_explicit_value(); field->set_has_explicit_value();
} }
else if (item->type() == Item::STRING_ITEM)
{
((Item_user_var_as_out_param *)item)->set_null_value(
read_info.read_charset);
}
else
{
my_error(ER_LOAD_DATA_INVALID_COLUMN, MYF(0), item->full_name());
DBUG_RETURN(1);
}
continue; continue;
} }
if (real_item->type() == Item::FIELD_ITEM) if (item->type() == Item::STRING_ITEM)
{ {
Field *field= ((Item_field *)real_item)->field; ((Item_user_var_as_out_param *)item)->set_value((char*) pos, length,
read_info.read_charset);
}
else if (!real_item)
{
my_error(ER_NONUPDATEABLE_COLUMN, MYF(0), item->name);
DBUG_RETURN(1);
}
else
{
Field *field= real_item->field;
field->set_notnull(); field->set_notnull();
read_info.row_end[0]=0; // Safe to change end marker read_info.row_end[0]=0; // Safe to change end marker
if (field == table->next_number_field) if (field == table->next_number_field)
@ -1128,16 +1138,6 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
field->store((char*) pos, length, read_info.read_charset); field->store((char*) pos, length, read_info.read_charset);
field->set_has_explicit_value(); field->set_has_explicit_value();
} }
else if (item->type() == Item::STRING_ITEM)
{
((Item_user_var_as_out_param *)item)->set_value((char*) pos, length,
read_info.read_charset);
}
else
{
my_error(ER_LOAD_DATA_INVALID_COLUMN, MYF(0), item->full_name());
DBUG_RETURN(1);
}
} }
if (thd->is_error()) if (thd->is_error())
@ -1157,10 +1157,20 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
break; break;
for (; item ; item= it++) for (; item ; item= it++)
{ {
Item *real_item= item->real_item(); Item_field *real_item= item->field_for_view_update();
if (real_item->type() == Item::FIELD_ITEM) if (item->type() == Item::STRING_ITEM)
{ {
Field *field= ((Item_field *)real_item)->field; ((Item_user_var_as_out_param *)item)->set_null_value(
read_info.read_charset);
}
else if (!real_item)
{
my_error(ER_NONUPDATEABLE_COLUMN, MYF(0), item->name);
DBUG_RETURN(1);
}
else
{
Field *field= real_item->field;
if (field->reset()) if (field->reset())
{ {
my_error(ER_WARN_NULL_TO_NOTNULL, MYF(0),field->field_name, my_error(ER_WARN_NULL_TO_NOTNULL, MYF(0),field->field_name,
@ -1182,16 +1192,6 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
ER(ER_WARN_TOO_FEW_RECORDS), ER(ER_WARN_TOO_FEW_RECORDS),
thd->get_stmt_da()->current_row_for_warning()); thd->get_stmt_da()->current_row_for_warning());
} }
else if (item->type() == Item::STRING_ITEM)
{
((Item_user_var_as_out_param *)item)->set_null_value(
read_info.read_charset);
}
else
{
my_error(ER_LOAD_DATA_INVALID_COLUMN, MYF(0), item->full_name());
DBUG_RETURN(1);
}
} }
} }

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. /* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2008, 2015, MariaDB Copyright (c) 2008, 2017, MariaDB
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

View File

@ -9520,7 +9520,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
It solve problem with select like SELECT * FROM t1 WHERE rand() > 0.5 It solve problem with select like SELECT * FROM t1 WHERE rand() > 0.5
*/ */
if (tab == join->join_tab + join->top_join_tab_count - 1) if (tab == join->join_tab + join->top_join_tab_count - 1)
current_map|= OUTER_REF_TABLE_BIT | RAND_TABLE_BIT; current_map|= RAND_TABLE_BIT;
used_tables|=current_map; used_tables|=current_map;
if (tab->type == JT_REF && tab->quick && if (tab->type == JT_REF && tab->quick &&

View File

@ -3252,6 +3252,21 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
bool tmp_table= create_table_mode == C_ALTER_TABLE; bool tmp_table= create_table_mode == C_ALTER_TABLE;
DBUG_ENTER("mysql_prepare_create_table"); DBUG_ENTER("mysql_prepare_create_table");
LEX_STRING* connect_string = &create_info->connect_string;
if (connect_string->length != 0 &&
connect_string->length > CONNECT_STRING_MAXLEN &&
(system_charset_info->cset->charpos(system_charset_info,
connect_string->str,
(connect_string->str +
connect_string->length),
CONNECT_STRING_MAXLEN)
< connect_string->length))
{
my_error(ER_WRONG_STRING_LENGTH, MYF(0),
connect_string->str, "CONNECTION", CONNECT_STRING_MAXLEN);
DBUG_RETURN(TRUE);
}
select_field_pos= alter_info->create_list.elements - select_field_count; select_field_pos= alter_info->create_list.elements - select_field_count;
null_fields=blob_columns=0; null_fields=blob_columns=0;
create_info->varchar= 0; create_info->varchar= 0;

View File

@ -38,11 +38,9 @@ int mi_delete_table(const char *name)
mysql_file_delete_with_symlink(mi_key_file_dfile, name, MI_NAME_DEXT, MYF(MY_WME))) mysql_file_delete_with_symlink(mi_key_file_dfile, name, MI_NAME_DEXT, MYF(MY_WME)))
DBUG_RETURN(my_errno); DBUG_RETURN(my_errno);
// optionally present: // optionally present:
mysql_file_delete_with_symlink(mi_key_file_dfile, name, ".OLD", MYF(0)); mysql_file_delete_with_symlink(mi_key_file_dfile, name, ".OLD", MYF(0));
mysql_file_delete_with_symlink(mi_key_file_dfile, name, ".TMD", MYF(0)); mysql_file_delete_with_symlink(mi_key_file_dfile, name, ".TMD", MYF(0));
DBUG_RETURN(0); DBUG_RETURN(0);
} }

View File

@ -1,5 +1,5 @@
# Copyright (c) 2006, 2014, Oracle and/or its affiliates. # Copyright (c) 2006, 2016, Oracle and/or its affiliates.
# Copyright (c) 2012, 2014, SkySQL Ab. # Copyright (c) 2012, 2017, MariaDB
# #
# 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

View File

@ -151,8 +151,7 @@ parse_server_arguments() {
# Get arguments from the my.cnf file, # Get arguments from the my.cnf file,
# the only group, which is read from now on is [mysqld] # the only group, which is read from now on is [mysqld]
if test -x $bindir/my_print_defaults if test -x "$bindir/my_print_defaults"; then
then
print_defaults="$bindir/my_print_defaults" print_defaults="$bindir/my_print_defaults"
else else
# Try to find basedir in /etc/my.cnf # Try to find basedir in /etc/my.cnf
@ -170,11 +169,6 @@ else
print_defaults="$d/bin/my_print_defaults" print_defaults="$d/bin/my_print_defaults"
break break
fi fi
if test -x "$d/bin/mysql_print_defaults"
then
print_defaults="$d/bin/mysql_print_defaults"
break
fi
done done
fi fi
@ -376,7 +370,7 @@ case "$mode" in
fi fi
else else
# Try to find appropriate mysqld process # Try to find appropriate mysqld process
mysqld_pid=`pidof $libexecdir/mysqld` mysqld_pid=`pgrep $libexecdir/mysqld`
# test if multiple pids exist # test if multiple pids exist
pid_count=`echo $mysqld_pid | wc -w` pid_count=`echo $mysqld_pid | wc -w`