Manual merge of mysql-5.1-bugteam into mysql-trunk-merge.

This commit is contained in:
Alexey Kopytov 2010-01-24 00:09:23 +03:00
commit 4a1b59b7ab
61 changed files with 3460 additions and 341 deletions

View file

@ -31,6 +31,15 @@
# endif
#endif
/* Version numbers for deprecation messages */
#define VER_CELOSIA "5.6"
#define WARN_DEPRECATED(Ver,Old,New) \
do { \
printf("Warning: The option '%s' is deprecated and will be removed " \
"in MySQL %s. Please use %s instead.\n", (Old), (Ver), (New)); \
} while(0);
enum options_client
{
OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET,
@ -49,7 +58,7 @@ enum options_client
OPT_SHARED_MEMORY_BASE_NAME, OPT_FRM, OPT_SKIP_OPTIMIZATION,
OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH,
OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_CREATE_OPTIONS, OPT_SERVER_ARG,
OPT_START_POSITION, OPT_STOP_POSITION, OPT_START_DATETIME, OPT_STOP_DATETIME,
OPT_POSITION, OPT_STOP_POSITION, OPT_START_DATETIME, OPT_STOP_DATETIME,
OPT_SIGINT_IGNORE, OPT_HEXBLOB, OPT_ORDER_BY_PRIMARY, OPT_COUNT,
#ifdef HAVE_NDBCLUSTER_DB
OPT_NDBCLUSTER, OPT_NDB_CONNECTSTRING,
@ -81,5 +90,6 @@ enum options_client
OPT_DEBUG_INFO, OPT_DEBUG_CHECK, OPT_COLUMN_TYPES, OPT_ERROR_LOG_FILE,
OPT_WRITE_BINLOG, OPT_DUMP_DATE,
OPT_INIT_COMMAND,
OPT_FIRST_SLAVE,
OPT_MAX_CLIENT_OPTION
};

View file

@ -54,6 +54,9 @@ static char *server_version= NULL;
/* Array of options to pass to libemysqld */
#define MAX_SERVER_ARGS 64
/* Version numbers for deprecation messages */
#define VER_CELOSIA "5.6"
void* sql_alloc(unsigned size); // Don't use mysqld alloc for these
void sql_element_free(void *ptr);
#include "sql_string.h"
@ -1344,7 +1347,7 @@ static struct my_option my_long_options[] =
(uchar**) &opt_rehash, (uchar**) &opt_rehash, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0,
0, 0},
{"no-auto-rehash", 'A',
"No automatic rehashing. One has to use 'rehash' to get table and field completion. This gives a quicker start of mysql and disables rehashing on reconnect. WARNING: options deprecated; use --disable-auto-rehash instead.",
"No automatic rehashing. One has to use 'rehash' to get table and field completion. This gives a quicker start of mysql and disables rehashing on reconnect.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"batch", 'B',
"Don't use history file. Disable interactive behavior. (Enables --silent)", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@ -1417,7 +1420,7 @@ static struct my_option my_long_options[] =
{"line-numbers", OPT_LINE_NUMBERS, "Write line numbers for errors.",
(uchar**) &line_numbers, (uchar**) &line_numbers, 0, GET_BOOL,
NO_ARG, 1, 0, 0, 0, 0, 0},
{"skip-line-numbers", 'L', "Don't write line number for errors. WARNING: -L is deprecated, use long version of this option instead.", 0, 0, 0, GET_NO_ARG,
{"skip-line-numbers", 'L', "Don't write line number for errors.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"unbuffered", 'n', "Flush buffer after each query.", (uchar**) &unbuffered,
(uchar**) &unbuffered, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
@ -1425,7 +1428,7 @@ static struct my_option my_long_options[] =
(uchar**) &column_names, (uchar**) &column_names, 0, GET_BOOL,
NO_ARG, 1, 0, 0, 0, 0, 0},
{"skip-column-names", 'N',
"Don't write column names in results. WARNING: -N is deprecated, use long version of this options instead.",
"Don't write column names in results.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"set-variable", 'O',
"Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
@ -1652,7 +1655,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
}
break;
case OPT_NOPAGER:
printf("WARNING: option deprecated; use --disable-pager instead.\n");
WARN_DEPRECATED(VER_CELOSIA, "--no-pager", "--disable-pager");
opt_nopager= 1;
break;
case OPT_MYSQL_PROTOCOL:
@ -1698,12 +1701,18 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
if (!(status.line_buff= batch_readline_command(status.line_buff, argument)))
return 1;
break;
case 'g':
WARN_DEPRECATED(VER_CELOSIA, "-g, --no-named-commands", "--skip-named-commands");
break;
case 'o':
if (argument == disabled_my_option)
one_database= 0;
else
one_database= skip_updates= 1;
break;
case 'O':
WARN_DEPRECATED(VER_CELOSIA, "-O, --set-variable", "--variable-name=value");
break;
case 'p':
if (argument == disabled_my_option)
argument= (char*) ""; // Don't require password

View file

@ -282,6 +282,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
charsets_dir = argument;
#endif
break;
case 'O':
WARN_DEPRECATED(VER_CELOSIA, "--set-variable", "--variable-name=value");
break;
case OPT_MYSQL_PROTOCOL:
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);

View file

@ -41,6 +41,7 @@
#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_LOCAL_FILES)
char server_version[SERVER_VERSION_LENGTH];
ulong server_id = 0;
@ -1060,7 +1061,7 @@ static struct my_option my_long_options[] =
"built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").",
(uchar**) &port, (uchar**) &port, 0, GET_INT, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"position", 'j', "Deprecated. Use --start-position instead.",
{"position", OPT_POSITION, "Deprecated. Use --start-position instead.",
(uchar**) &start_position, (uchar**) &start_position, 0, GET_ULL,
REQUIRED_ARG, BIN_LOG_HEADER_SIZE, BIN_LOG_HEADER_SIZE,
/* COM_BINLOG_DUMP accepts only 4 bytes for the position */
@ -1103,7 +1104,7 @@ static struct my_option my_long_options[] =
"(you should probably use quotes for your shell to set it properly).",
(uchar**) &start_datetime_str, (uchar**) &start_datetime_str,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"start-position", OPT_START_POSITION,
{"start-position", 'j',
"Start reading the binlog at position N. Applies to the first binlog "
"passed on the command line.",
(uchar**) &start_position, (uchar**) &start_position, 0, GET_ULL,
@ -1314,6 +1315,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case 'R':
remote_opt= 1;
break;
case OPT_POSITION:
WARN_DEPRECATED(VER_CELOSIA, "--position", "--start-position");
break;
case OPT_MYSQL_PROTOCOL:
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);

View file

@ -282,7 +282,7 @@ static struct my_option my_long_options[] =
(uchar**) &opt_enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0 ,0, 0},
{"fields-escaped-by", OPT_ESC, "Fields in the i.file are escaped by ...",
(uchar**) &escaped, (uchar**) &escaped, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"first-slave", 'x', "Deprecated, renamed to --lock-all-tables.",
{"first-slave", OPT_FIRST_SLAVE, "Deprecated, renamed to --lock-all-tables.",
(uchar**) &opt_lock_all_tables, (uchar**) &opt_lock_all_tables, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"flush-logs", 'F', "Flush logs file in server before starting dump. "
@ -366,8 +366,7 @@ static struct my_option my_long_options[] =
NO_ARG, 0, 0, 0, 0, 0, 0},
{"no-data", 'd', "No row information.", (uchar**) &opt_no_data,
(uchar**) &opt_no_data, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"no-set-names", 'N',
"Deprecated. Use --skip-set-charset instead.",
{"no-set-names", 'N',"Suppress the SET NAMES statement",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"opt", OPT_OPTIMIZE,
"Same as --add-drop-table, --add-locks, --create-options, --quick, --extended-insert, --lock-tables, --set-charset, and --disable-keys. Enabled by default, disable with --skip-opt.",
@ -760,6 +759,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case '?':
usage();
exit(0);
case 'O':
WARN_DEPRECATED(VER_CELOSIA, "--set-variable", "--variable-name=value");
break;
case (int) OPT_FIRST_SLAVE:
WARN_DEPRECATED(VER_CELOSIA, "--first-slave", "--lock-all-tables");
break;
case (int) OPT_MASTER_DATA:
if (!argument) /* work like in old versions */
opt_master_data= MYSQL_OPT_MASTER_DATA_EFFECTIVE_SQL;

View file

@ -0,0 +1,554 @@
################################################################################
# This is an auxiliary file used by rpl_mixing_engines.test, and that it
# executes SQL statements according to a format string, as specified in
# rpl_mixing_engines.test. In addition, it accepts the special format
# strings 'configure' and 'clean', used before and after everything else.
################################################################################
if (`SELECT HEX(@commands) = HEX('configure')`)
{
connection master;
SET SQL_LOG_BIN=0;
eval CREATE TABLE nt_1 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
eval CREATE TABLE nt_2 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
eval CREATE TABLE nt_3 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
eval CREATE TABLE nt_4 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
eval CREATE TABLE nt_5 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
eval CREATE TABLE nt_6 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
eval CREATE TABLE tt_1 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
eval CREATE TABLE tt_2 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
eval CREATE TABLE tt_3 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
eval CREATE TABLE tt_4 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
eval CREATE TABLE tt_5 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
eval CREATE TABLE tt_6 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
eval SET SQL_LOG_BIN=1;
connection slave;
SET SQL_LOG_BIN=0;
eval CREATE TABLE nt_1 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
eval CREATE TABLE nt_2 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
eval CREATE TABLE nt_3 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
eval CREATE TABLE nt_4 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
eval CREATE TABLE nt_5 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
eval CREATE TABLE nt_6 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
eval CREATE TABLE tt_1 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
eval CREATE TABLE tt_2 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
eval CREATE TABLE tt_3 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
eval CREATE TABLE tt_4 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
eval CREATE TABLE tt_5 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
eval CREATE TABLE tt_6 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
SET SQL_LOG_BIN=1;
connection master;
INSERT INTO nt_1(trans_id, stmt_id) VALUES(1,1);
INSERT INTO nt_2(trans_id, stmt_id) VALUES(1,1);
INSERT INTO nt_3(trans_id, stmt_id) VALUES(1,1);
INSERT INTO nt_4(trans_id, stmt_id) VALUES(1,1);
INSERT INTO nt_5(trans_id, stmt_id) VALUES(1,1);
INSERT INTO nt_6(trans_id, stmt_id) VALUES(1,1);
INSERT INTO tt_1(trans_id, stmt_id) VALUES(1,1);
INSERT INTO tt_2(trans_id, stmt_id) VALUES(1,1);
INSERT INTO tt_3(trans_id, stmt_id) VALUES(1,1);
INSERT INTO tt_4(trans_id, stmt_id) VALUES(1,1);
INSERT INTO tt_5(trans_id, stmt_id) VALUES(1,1);
INSERT INTO tt_6(trans_id, stmt_id) VALUES(1,1);
DELIMITER |;
CREATE PROCEDURE pc_i_tt_5_suc (IN p_trans_id INTEGER, IN p_stmt_id INTEGER)
BEGIN
DECLARE in_stmt_id INTEGER;
SELECT max(stmt_id) INTO in_stmt_id FROM tt_5 WHERE trans_id= p_trans_id;
SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id;
INSERT INTO tt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id);
INSERT INTO tt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1);
END|
CREATE PROCEDURE pc_i_nt_5_suc (IN p_trans_id INTEGER, IN p_stmt_id INTEGER)
BEGIN
DECLARE in_stmt_id INTEGER;
SELECT max(stmt_id) INTO in_stmt_id FROM nt_5 WHERE trans_id= p_trans_id;
SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id;
INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id);
INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1);
END|
CREATE FUNCTION fc_i_tt_5_suc (p_trans_id INTEGER, p_stmt_id INTEGER) RETURNS VARCHAR(64)
BEGIN
DECLARE in_stmt_id INTEGER;
SELECT max(stmt_id) INTO in_stmt_id FROM tt_5 WHERE trans_id= p_trans_id;
SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id;
INSERT INTO tt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id);
INSERT INTO tt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1);
RETURN "fc_i_tt_5_suc";
END|
CREATE FUNCTION fc_i_nt_5_suc (p_trans_id INTEGER, p_stmt_id INTEGER) RETURNS VARCHAR(64)
BEGIN
DECLARE in_stmt_id INTEGER;
SELECT max(stmt_id) INTO in_stmt_id FROM nt_5 WHERE trans_id= p_trans_id;
SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id;
INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id);
INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1);
RETURN "fc_i_nt_5_suc";
END|
CREATE TRIGGER tr_i_tt_3_to_nt_3 AFTER INSERT ON tt_3 FOR EACH ROW
BEGIN
DECLARE in_stmt_id INTEGER;
SELECT max(stmt_id) INTO in_stmt_id FROM nt_3 WHERE trans_id= NEW.trans_id;
SELECT COALESCE(greatest(in_stmt_id + 1, NEW.stmt_id), 1) INTO in_stmt_id;
INSERT INTO nt_3(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id);
INSERT INTO nt_3(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id + 1);
END|
CREATE TRIGGER tr_i_nt_4_to_tt_4 AFTER INSERT ON nt_4 FOR EACH ROW
BEGIN
DECLARE in_stmt_id INTEGER;
SELECT max(stmt_id) INTO in_stmt_id FROM tt_4 WHERE trans_id= NEW.trans_id;
SELECT COALESCE(greatest(in_stmt_id + 1, NEW.stmt_id), 1) INTO in_stmt_id;
INSERT INTO tt_4(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id);
INSERT INTO tt_4(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id + 1);
END|
CREATE TRIGGER tr_i_tt_5_to_tt_6 AFTER INSERT ON tt_5 FOR EACH ROW
BEGIN
DECLARE in_stmt_id INTEGER;
SELECT max(stmt_id) INTO in_stmt_id FROM tt_6 WHERE trans_id= NEW.trans_id;
SELECT COALESCE(greatest(in_stmt_id + 1, NEW.stmt_id, 1), 1) INTO in_stmt_id;
INSERT INTO tt_6(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id);
INSERT INTO tt_6(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id + 1);
END|
CREATE TRIGGER tr_i_nt_5_to_nt_6 AFTER INSERT ON nt_5 FOR EACH ROW
BEGIN
DECLARE in_stmt_id INTEGER;
SELECT max(stmt_id) INTO in_stmt_id FROM nt_6 WHERE trans_id= NEW.trans_id;
SELECT COALESCE(greatest(in_stmt_id + 1, NEW.stmt_id), 1) INTO in_stmt_id;
INSERT INTO nt_6(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id);
INSERT INTO nt_6(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id + 1);
END|
DELIMITER ;|
let $pos_trans_command= query_get_value("SHOW MASTER STATUS", Position, 1);
let $trans_id= 7;
let $tb_id= 1;
let $stmt_id= 1;
let $commands= '';
SET @commands= '';
}
if (`SELECT HEX(@commands) = HEX('clean')`)
{
connection master;
DROP TABLE tt_1;
DROP TABLE tt_2;
DROP TABLE tt_3;
DROP TABLE tt_4;
DROP TABLE tt_5;
DROP TABLE tt_6;
DROP TABLE nt_1;
DROP TABLE nt_2;
DROP TABLE nt_3;
DROP TABLE nt_4;
DROP TABLE nt_5;
DROP TABLE nt_6;
DROP PROCEDURE pc_i_tt_5_suc;
DROP PROCEDURE pc_i_nt_5_suc;
DROP FUNCTION fc_i_tt_5_suc;
DROP FUNCTION fc_i_nt_5_suc;
sync_slave_with_master;
SET @commands= '';
}
while (`SELECT HEX(@commands) != HEX('')`)
{
--disable_query_log
SET @command= SUBSTRING_INDEX(@commands, ' ', 1);
let $command= `SELECT @command`;
--eval SET @check_commands= '$commands'
if (`SELECT HEX(@check_commands) = HEX('''')`)
{
let $commands= `SELECT @commands`;
}
--echo -b-b-b-b-b-b-b-b-b-b-b- >> $command << -b-b-b-b-b-b-b-b-b-b-b-
let $pos_command= query_get_value("SHOW MASTER STATUS", Position, 1);
--enable_query_log
if (`SELECT HEX(@command) = HEX('B')`)
{
eval BEGIN;
}
if (`SELECT HEX(@command) = HEX('T')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval INSERT INTO tt_1(trans_id, stmt_id) VALUES ($trans_id, $stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('T-trig')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval INSERT INTO tt_5(trans_id, stmt_id) VALUES ($trans_id, $stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('T-func')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval SELECT fc_i_tt_5_suc ($trans_id, $stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('T-proc')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval CALL pc_i_tt_5_suc ($trans_id, $stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('eT')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
let $old_trans_id= `SELECT max(trans_id) from tt_1`;
let $old_stmt_id= `SELECT max(stmt_id) from tt_1 where trans_id= $old_trans_id`;
--error ER_DUP_ENTRY, ER_DUP_KEY
eval INSERT INTO tt_1(trans_id, stmt_id) VALUES ($old_trans_id, $old_stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('Te')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
let $old_trans_id= `SELECT max(trans_id) from tt_1`;
let $old_stmt_id= `SELECT max(stmt_id) from tt_1 where trans_id= $old_trans_id`;
--error ER_DUP_ENTRY, ER_DUP_KEY
eval INSERT INTO tt_1(trans_id, stmt_id) VALUES ($trans_id, $stmt_id), ($old_trans_id, $old_stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('Te-trig')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
let $old_trans_id= `SELECT max(trans_id) from tt_5`;
let $old_stmt_id= `SELECT max(stmt_id) from tt_5 where trans_id= $old_trans_id`;
--error ER_DUP_ENTRY, ER_DUP_KEY
eval INSERT INTO tt_5(trans_id, stmt_id) VALUES ($trans_id, $stmt_id), ($old_trans_id, $old_stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('Te-func')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
let $old_trans_id= `SELECT max(trans_id) from tt_1`;
let $old_stmt_id= `SELECT max(stmt_id) from tt_1 where trans_id= $old_trans_id`;
--error ER_DUP_ENTRY, ER_DUP_KEY
eval INSERT INTO tt_1(trans_id, stmt_id, info) VALUES ($trans_id, $stmt_id, ''), ($old_trans_id, $old_stmt_id, fc_i_tt_5_suc ($trans_id, $stmt_id));
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('N')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval INSERT INTO nt_1(trans_id, stmt_id) VALUES ($trans_id, $stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('N-trig')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval INSERT INTO nt_5(trans_id, stmt_id) VALUES ($trans_id, $stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('N-func')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval SELECT fc_i_nt_5_suc ($trans_id, $stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('N-proc')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval CALL pc_i_nt_5_suc ($trans_id, $stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('eN')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
let $old_trans_id= `SELECT max(trans_id) from nt_1`;
let $old_stmt_id= `SELECT max(stmt_id) from nt_1 where trans_id= $old_trans_id`;
--error ER_DUP_ENTRY, ER_DUP_KEY
eval INSERT INTO nt_1(trans_id, stmt_id) VALUES ($old_trans_id, $old_stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('Ne')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
let $old_trans_id= `SELECT max(trans_id) from nt_1`;
let $old_stmt_id= `SELECT max(stmt_id) from nt_1 where trans_id= $old_trans_id`;
--error ER_DUP_ENTRY, ER_DUP_KEY
eval INSERT INTO nt_1(trans_id, stmt_id) VALUES ($trans_id, $stmt_id), ($old_trans_id, $old_stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('Ne-trig')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
let $old_trans_id= `SELECT max(trans_id) from nt_5`;
let $old_stmt_id= `SELECT max(stmt_id) from nt_5 where trans_id= $old_trans_id`;
--error ER_DUP_ENTRY, ER_DUP_KEY
eval INSERT INTO nt_5(trans_id, stmt_id) VALUES ($trans_id, $stmt_id), ($old_trans_id, $old_stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('Ne-func')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
let $old_trans_id= `SELECT max(trans_id) from nt_1`;
let $old_stmt_id= `SELECT max(stmt_id) from nt_1 where trans_id= $old_trans_id`;
--error ER_DUP_ENTRY, ER_DUP_KEY
eval INSERT INTO nt_1(trans_id, stmt_id, info) VALUES ($trans_id, $stmt_id, ''), ($old_trans_id, $old_stmt_id, fc_i_nt_5_suc ($trans_id, $stmt_id));
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('tN')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval INSERT INTO nt_1(trans_id, stmt_id, info) SELECT $trans_id, $stmt_id, COUNT(*) FROM tt_1;
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('tNe')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
let $old_trans_id= `SELECT max(trans_id) from nt_1`;
let $old_stmt_id= `SELECT max(stmt_id) from nt_1 where trans_id= $old_trans_id`;
--error ER_DUP_ENTRY, ER_DUP_KEY
eval INSERT INTO nt_1(trans_id, stmt_id, info) SELECT $trans_id, $stmt_id, COUNT(*) FROM tt_1 UNION SELECT $old_trans_id, $old_stmt_id, COUNT(*) FROM tt_1;
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('nT')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval INSERT INTO tt_1(trans_id, stmt_id, info) SELECT $trans_id, $stmt_id, COUNT(*) FROM nt_1;
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('nTe')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
let $old_trans_id= `SELECT max(trans_id) from tt_1`;
let $old_stmt_id= `SELECT max(stmt_id) from tt_1 where trans_id= $old_trans_id`;
--error ER_DUP_ENTRY, ER_DUP_KEY
eval INSERT INTO tt_1(trans_id, stmt_id, info) SELECT $trans_id, $stmt_id, COUNT(*) FROM nt_1 UNION SELECT $old_trans_id, $old_stmt_id, COUNT(*) FROM nt_1;
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('NT')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval UPDATE nt_3, tt_3 SET nt_3.info= "new text $trans_id --> $stmt_id", tt_3.info= "new text $trans_id --> $stmt_id" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1;
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('NT-trig')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval INSERT INTO nt_4(trans_id, stmt_id) VALUES ($trans_id, $stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('NT-func')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval INSERT INTO nt_5(trans_id, stmt_id, info) VALUES ($trans_id, $stmt_id, fc_i_tt_5_suc($trans_id, $stmt_id));
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('NeT-trig')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
let $old_trans_id= `SELECT max(trans_id) from nt_4`;
let $old_stmt_id= `SELECT max(stmt_id) from nt_4 where trans_id= $old_trans_id`;
--error ER_DUP_ENTRY, ER_DUP_KEY
eval INSERT INTO nt_4(trans_id, stmt_id) VALUES ($trans_id, $stmt_id), ($old_trans_id, $old_stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('NeT-func')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
let $old_trans_id= `SELECT max(trans_id) from nt_5`;
let $old_stmt_id= `SELECT max(stmt_id) from nt_5 where trans_id= $old_trans_id`;
--error ER_DUP_ENTRY, ER_DUP_KEY
eval INSERT INTO nt_5(trans_id, stmt_id, info) VALUES ($trans_id, $stmt_id, ''), ($old_trans_id, $old_stmt_id, fc_i_tt_5_suc ($trans_id, $stmt_id));
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('TN')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval UPDATE tt_4, nt_4 SET tt_4.info= "new text $trans_id --> $stmt_id", nt_4.info= "new text $trans_id --> $stmt_id" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1;
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('TN-trig')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval INSERT INTO tt_3(trans_id, stmt_id) VALUES ($trans_id, $stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('TN-func')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval INSERT INTO tt_5(trans_id, stmt_id, info) VALUES ($trans_id, $stmt_id, fc_i_nt_5_suc($trans_id, $stmt_id));
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('TeN-trig')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
let $old_trans_id= `SELECT max(trans_id) from tt_3`;
let $old_stmt_id= `SELECT max(stmt_id) from tt_3 where trans_id= $old_trans_id`;
--error ER_DUP_ENTRY, ER_DUP_KEY
eval INSERT INTO tt_3(trans_id, stmt_id) VALUES ($trans_id, $stmt_id), ($old_trans_id, $old_stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('TeN-func')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
let $old_trans_id= `SELECT max(trans_id) from tt_5`;
let $old_stmt_id= `SELECT max(stmt_id) from tt_5 where trans_id= $old_trans_id`;
--error ER_DUP_ENTRY, ER_DUP_KEY
eval INSERT INTO tt_5(trans_id, stmt_id, info) VALUES ($trans_id, $stmt_id, ''), ($old_trans_id, $old_stmt_id, fc_i_nt_5_suc ($trans_id, $stmt_id));
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('CS-T->T')`)
{
--eval CREATE TABLE tt_xx_$tb_id (PRIMARY KEY(trans_id, stmt_id)) engine=$engine_type SELECT * FROM tt_1;
}
if (`SELECT HEX(@command) = HEX('CS-N->N')`)
{
--eval CREATE TABLE nt_xx_$tb_id (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM nt_1;
}
if (`SELECT HEX(@command) = HEX('CS-T->N')`)
{
--eval CREATE TABLE tt_xx_$tb_id (PRIMARY KEY(trans_id, stmt_id)) engine=$engine_type SELECT * FROM nt_1;
}
if (`SELECT HEX(@command) = HEX('CS-N->T')`)
{
--eval CREATE TABLE nt_xx_$tb_id (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM tt_1;
}
if (`SELECT HEX(@command) = HEX('CSe-T->T')`)
{
--error ER_DUP_ENTRY, ER_DUP_KEY
--eval CREATE TABLE tt_xx_$tb_id (PRIMARY KEY (stmt_id)) engine=$engine_type SELECT stmt_id FROM tt_1;
}
if (`SELECT HEX(@command) = HEX('CSe-N->N')`)
{
--error ER_DUP_ENTRY, ER_DUP_KEY
--eval CREATE TABLE nt_xx_$tb_id (PRIMARY KEY (stmt_id)) engine=MyIsam SELECT stmt_id FROM nt_1;
}
if (`SELECT HEX(@command) = HEX('CSe-T->N')`)
{
--error ER_DUP_ENTRY, ER_DUP_KEY
--eval CREATE TABLE tt_xx_$tb_id (PRIMARY KEY (stmt_id)) engine=$engine_type SELECT stmt_id FROM nt_1;
}
if (`SELECT HEX(@command) = HEX('CSe-N->T')`)
{
--error ER_DUP_ENTRY, ER_DUP_KEY
--eval CREATE TABLE nt_xx_$tb_id (PRIMARY KEY (stmt_id)) engine=MyIsam SELECT stmt_id FROM tt_1;
}
if (`SELECT HEX(@command) = HEX('CT')`)
{
--eval CREATE TEMPORARY TABLE tt_xx_$tb_id (a int) engine=$engine_type;
}
if (`SELECT HEX(@command) = HEX('IS-T<-N')`)
{
--eval INSERT INTO tt_xx_$tb_id(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM nt_1;
}
if (`SELECT HEX(@command) = HEX('ISe-T<-N')`)
{
--error ER_DUP_ENTRY, ER_DUP_KEY
--eval INSERT INTO tt_xx_$tb_id(trans_id, stmt_id, info) SELECT trans_id, trans_id, USER() FROM nt_1;
}
if (`SELECT HEX(@command) = HEX('IS-N<-T')`)
{
--eval INSERT INTO nt_xx_$tb_id(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM tt_1;
}
if (`SELECT HEX(@command) = HEX('ISe-N<-T')`)
{
--error ER_DUP_ENTRY, ER_DUP_KEY
--eval INSERT INTO nt_xx_$tb_id(trans_id, stmt_id, info) SELECT trans_id, trans_id, USER() FROM tt_1;
}
if (`SELECT HEX(@command) = HEX('IS-T<-T')`)
{
--eval INSERT INTO tt_xx_$tb_id(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM tt_1;
}
if (`SELECT HEX(@command) = HEX('ISe-T<-T')`)
{
--error ER_DUP_ENTRY, ER_DUP_KEY
--eval INSERT INTO tt_xx_$tb_id(trans_id, stmt_id, info) SELECT trans_id, trans_id, USER() FROM tt_1;
}
if (`SELECT HEX(@command) = HEX('IS-N<-N')`)
{
--eval INSERT INTO nt_xx_$tb_id(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM nt_1;
}
if (`SELECT HEX(@command) = HEX('ISe-N<-N')`)
{
--error ER_DUP_ENTRY, ER_DUP_KEY
--eval INSERT INTO nt_xx_$tb_id(trans_id, stmt_id, info) SELECT trans_id, trans_id, USER() FROM nt_1;
}
if (`SELECT HEX(@command) = HEX('trunc-CS-T')`)
{
eval TRUNCATE TABLE tt_xx_$tb_id;
}
if (`SELECT HEX(@command) = HEX('trunc-CS-N')`)
{
eval TRUNCATE TABLE nt_xx_$tb_id;
}
if (`SELECT HEX(@command) = HEX('trunc-CT')`)
{
eval TRUNCATE TABLE tt_xx_$tb_id;
}
if (`SELECT HEX(@command) = HEX('drop-CS')`)
{
--disable_warnings
eval DROP TABLE IF EXISTS tt_xx_$tb_id, nt_xx_$tb_id;
inc $tb_id;
--enable_warnings
}
if (`SELECT HEX(@command) = HEX('drop-CT')`)
{
--disable_warnings
eval DROP TEMPORARY TABLE IF EXISTS tt_xx_$tb_id;
inc $tb_id;
--enable_warnings
}
if (`SELECT HEX(@command) = HEX('C')`)
{
--error 0, ER_GET_ERRMSG
eval COMMIT;
}
if (`SELECT HEX(@command) = HEX('R')`)
{
--error 0, ER_GET_ERRMSG
eval ROLLBACK;
}
if (`SELECT HEX(@command) = HEX('S1')`)
{
eval SAVEPOINT s1;
}
if (`SELECT HEX(@command) = HEX('R1')`)
{
eval ROLLBACK TO s1;
}
--disable_query_log
SET @commands= LTRIM(SUBSTRING(@commands, LENGTH(@command) + 1));
inc $stmt_id;
let $binlog_start= $pos_command;
--source include/show_binlog_events.inc
--echo -e-e-e-e-e-e-e-e-e-e-e- >> $command << -e-e-e-e-e-e-e-e-e-e-e-
if (`SELECT HEX(@commands) = HEX('')`)
{
let $binlog_start= $pos_trans_command;
--echo -b-b-b-b-b-b-b-b-b-b-b- >> $commands << -b-b-b-b-b-b-b-b-b-b-b-
--source include/show_binlog_events.inc
--echo -e-e-e-e-e-e-e-e-e-e-e- >> $commands << -e-e-e-e-e-e-e-e-e-e-e-
--echo
let $pos_trans_command= query_get_value("SHOW MASTER STATUS", Position, 1);
let $stmt_id= 1;
inc $trans_id;
let $commands= '';
}
}

View file

@ -820,16 +820,13 @@ i
drop table t1;
create temporary table t1 (j int);
create table if not exists t1 select 1;
Warnings:
Note 1050 Table 't1' already exists
select * from t1;
j
1
drop temporary table t1;
select * from t1;
ERROR 42S02: Table 'test.t1' doesn't exist
1
1
drop table t1;
ERROR 42S02: Unknown table 't1'
create table t1 (i int);
insert into t1 values (1), (2);
lock tables t1 read;

View file

@ -682,7 +682,7 @@ select timestampadd(SQL_TSI_FRAC_SECOND, 1, date) from t1;
timestampadd(SQL_TSI_FRAC_SECOND, 1, date)
2003-01-02 00:00:00.000001
Warnings:
Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 6.2. Please use MICROSECOND instead
Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 5.6. Please use MICROSECOND instead
select timestampdiff(MONTH, '2001-02-01', '2001-05-01') as a;
a
3
@ -717,7 +717,7 @@ select timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05
a
7689538999999
Warnings:
Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 6.2. Please use MICROSECOND instead
Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 5.6. Please use MICROSECOND instead
select timestampdiff(SQL_TSI_DAY, '1986-02-01', '1986-03-01') as a1,
timestampdiff(SQL_TSI_DAY, '1900-02-01', '1900-03-01') as a2,
timestampdiff(SQL_TSI_DAY, '1996-02-01', '1996-03-01') as a3,
@ -1088,7 +1088,7 @@ timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 6.2. Please use MICROSECOND instead
Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 5.6. Please use MICROSECOND instead
Note 1003 select timestampdiff(WEEK,'2001-02-01','2001-05-01') AS `a1`,timestampdiff(SECOND_FRAC,'2001-02-01 12:59:59.120000','2001-05-01 12:58:58.119999') AS `a2`
select time_format('100:00:00', '%H %k %h %I %l');
time_format('100:00:00', '%H %k %h %I %l')
@ -1287,12 +1287,12 @@ SELECT TIMESTAMPADD(FRAC_SECOND, 1, '2008-02-18');
TIMESTAMPADD(FRAC_SECOND, 1, '2008-02-18')
2008-02-18 00:00:00.000001
Warnings:
Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 6.2. Please use MICROSECOND instead
Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 5.6. Please use MICROSECOND instead
SELECT TIMESTAMPDIFF(FRAC_SECOND, '2008-02-17', '2008-02-18');
TIMESTAMPDIFF(FRAC_SECOND, '2008-02-17', '2008-02-18')
86400000000
Warnings:
Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 6.2. Please use MICROSECOND instead
Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 5.6. Please use MICROSECOND instead
SELECT DATE_ADD('2008-02-18', INTERVAL 1 FRAC_SECOND);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FRAC_SECOND)' at line 1
SELECT DATE_SUB('2008-02-18', INTERVAL 1 FRAC_SECOND);

View file

@ -93,6 +93,7 @@ ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- --position --
Warning: The option '--position' is deprecated and will be removed in MySQL 5.6. Please use --start-position instead.
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@ -193,6 +194,7 @@ ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- --position --
Warning: The option '--position' is deprecated and will be removed in MySQL 5.6. Please use --start-position instead.
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@ -233,6 +235,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
Warning: The option '--position' is deprecated and will be removed in MySQL 5.6. Please use --start-position instead.
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;

View file

@ -303,3 +303,47 @@ CREATE TABLE t1 (a INT) ENGINE=InnoDB
PARTITION BY list(a) (PARTITION p1 VALUES IN (1));
CREATE INDEX i1 ON t1 (a);
DROP TABLE t1;
#
# Bug#47343: InnoDB fails to clean-up after lock wait timeout on
# REORGANIZE PARTITION
#
CREATE TABLE t1 (
a INT,
b DATE NOT NULL,
PRIMARY KEY (a, b)
) ENGINE=InnoDB
PARTITION BY RANGE (a) (
PARTITION pMAX VALUES LESS THAN MAXVALUE
) ;
INSERT INTO t1 VALUES (1, '2001-01-01'), (2, '2002-02-02'), (3, '2003-03-03');
START TRANSACTION;
SELECT * FROM t1 FOR UPDATE;
a b
1 2001-01-01
2 2002-02-02
3 2003-03-03
# Connection con1
ALTER TABLE t1 REORGANIZE PARTITION pMAX INTO
(PARTITION p3 VALUES LESS THAN (3),
PARTITION pMAX VALUES LESS THAN MAXVALUE);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SHOW WARNINGS;
Level Code Message
Error 1205 Lock wait timeout exceeded; try restarting transaction
ALTER TABLE t1 REORGANIZE PARTITION pMAX INTO
(PARTITION p3 VALUES LESS THAN (3),
PARTITION pMAX VALUES LESS THAN MAXVALUE);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SHOW WARNINGS;
Level Code Message
Error 1205 Lock wait timeout exceeded; try restarting transaction
t1.frm
t1.par
# Connection default
SELECT * FROM t1;
a b
1 2001-01-01
2 2002-02-02
3 2003-03-03
COMMIT;
DROP TABLE t1;

View file

@ -1,4 +1,614 @@
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
#
# Bug#49742: Partition Pruning not working correctly for RANGE
#
CREATE TABLE t1 (a INT PRIMARY KEY)
PARTITION BY RANGE (a) (
PARTITION p0 VALUES LESS THAN (1),
PARTITION p1 VALUES LESS THAN (2),
PARTITION p2 VALUES LESS THAN (3),
PARTITION p3 VALUES LESS THAN (4),
PARTITION p4 VALUES LESS THAN (5),
PARTITION p5 VALUES LESS THAN (6),
PARTITION max VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (-1),(0),(1),(2),(3),(4),(5),(6),(7),(8);
SELECT * FROM t1 WHERE a < 1;
a
-1
0
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 1;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0 index PRIMARY PRIMARY 4 NULL 2 Using where; Using index
SELECT * FROM t1 WHERE a < 2;
a
-1
0
1
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 2;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1 index PRIMARY PRIMARY 4 NULL 3 Using where; Using index
SELECT * FROM t1 WHERE a < 3;
a
-1
0
1
2
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 3;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1,p2 index PRIMARY PRIMARY 4 NULL 4 Using where; Using index
SELECT * FROM t1 WHERE a < 4;
a
-1
0
1
2
3
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 4;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1,p2,p3 index PRIMARY PRIMARY 4 NULL 5 Using where; Using index
SELECT * FROM t1 WHERE a < 5;
a
-1
0
1
2
3
4
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 5;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1,p2,p3,p4 index PRIMARY PRIMARY 4 NULL 6 Using where; Using index
SELECT * FROM t1 WHERE a < 6;
a
-1
0
1
2
3
4
5
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 6;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1,p2,p3,p4,p5 index PRIMARY PRIMARY 4 NULL 7 Using where; Using index
SELECT * FROM t1 WHERE a < 7;
a
-1
0
1
2
3
4
5
6
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 7;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max range PRIMARY PRIMARY 4 NULL 9 Using where; Using index
SELECT * FROM t1 WHERE a <= 1;
a
-1
0
1
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 1;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1 index PRIMARY PRIMARY 4 NULL 10 Using where; Using index
SELECT * FROM t1 WHERE a <= 2;
a
-1
0
1
2
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 2;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1,p2 index PRIMARY PRIMARY 4 NULL 10 Using where; Using index
SELECT * FROM t1 WHERE a <= 3;
a
-1
0
1
2
3
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 3;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1,p2,p3 index PRIMARY PRIMARY 4 NULL 10 Using where; Using index
SELECT * FROM t1 WHERE a <= 4;
a
-1
0
1
2
3
4
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 4;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1,p2,p3,p4 index PRIMARY PRIMARY 4 NULL 10 Using where; Using index
SELECT * FROM t1 WHERE a <= 5;
a
-1
0
1
2
3
4
5
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 5;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1,p2,p3,p4,p5 index PRIMARY PRIMARY 4 NULL 10 Using where; Using index
SELECT * FROM t1 WHERE a <= 6;
a
-1
0
1
2
3
4
5
6
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 6;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max range PRIMARY PRIMARY 4 NULL 9 Using where; Using index
SELECT * FROM t1 WHERE a <= 7;
a
-1
0
1
2
3
4
5
6
7
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 7;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max range PRIMARY PRIMARY 4 NULL 9 Using where; Using index
SELECT * FROM t1 WHERE a = 1;
a
1
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 1;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p1 system PRIMARY NULL NULL NULL 1
SELECT * FROM t1 WHERE a = 2;
a
2
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 2;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p2 system PRIMARY NULL NULL NULL 1
SELECT * FROM t1 WHERE a = 3;
a
3
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 3;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p3 system PRIMARY NULL NULL NULL 1
SELECT * FROM t1 WHERE a = 4;
a
4
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 4;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p4 system PRIMARY NULL NULL NULL 1
SELECT * FROM t1 WHERE a = 5;
a
5
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 5;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p5 system PRIMARY NULL NULL NULL 1
SELECT * FROM t1 WHERE a = 6;
a
6
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 6;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 max const PRIMARY PRIMARY 4 const 1 Using index
SELECT * FROM t1 WHERE a = 7;
a
7
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 7;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 max const PRIMARY PRIMARY 4 const 1 Using index
SELECT * FROM t1 WHERE a >= 1;
a
1
2
3
4
5
6
7
8
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 1;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p1,p2,p3,p4,p5,max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index
SELECT * FROM t1 WHERE a >= 2;
a
2
3
4
5
6
7
8
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 2;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p2,p3,p4,p5,max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index
SELECT * FROM t1 WHERE a >= 3;
a
3
4
5
6
7
8
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 3;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p3,p4,p5,max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index
SELECT * FROM t1 WHERE a >= 4;
a
4
5
6
7
8
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 4;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p4,p5,max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index
SELECT * FROM t1 WHERE a >= 5;
a
5
6
7
8
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 5;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p5,max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index
SELECT * FROM t1 WHERE a >= 6;
a
6
7
8
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 6;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index
SELECT * FROM t1 WHERE a >= 7;
a
7
8
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 7;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
SELECT * FROM t1 WHERE a > 1;
a
2
3
4
5
6
7
8
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 1;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p2,p3,p4,p5,max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index
SELECT * FROM t1 WHERE a > 2;
a
3
4
5
6
7
8
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 2;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p3,p4,p5,max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index
SELECT * FROM t1 WHERE a > 3;
a
4
5
6
7
8
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 3;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p4,p5,max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index
SELECT * FROM t1 WHERE a > 4;
a
5
6
7
8
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 4;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p5,max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index
SELECT * FROM t1 WHERE a > 5;
a
6
7
8
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 5;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index
SELECT * FROM t1 WHERE a > 6;
a
7
8
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 6;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
SELECT * FROM t1 WHERE a > 7;
a
8
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 7;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
DROP TABLE t1;
CREATE TABLE t1 (a INT PRIMARY KEY)
PARTITION BY RANGE (a) (
PARTITION p0 VALUES LESS THAN (1),
PARTITION p1 VALUES LESS THAN (2),
PARTITION p2 VALUES LESS THAN (3),
PARTITION p3 VALUES LESS THAN (4),
PARTITION p4 VALUES LESS THAN (5),
PARTITION max VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (-1),(0),(1),(2),(3),(4),(5),(6),(7);
SELECT * FROM t1 WHERE a < 1;
a
-1
0
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 1;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0 index PRIMARY PRIMARY 4 NULL 2 Using where; Using index
SELECT * FROM t1 WHERE a < 2;
a
-1
0
1
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 2;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1 index PRIMARY PRIMARY 4 NULL 3 Using where; Using index
SELECT * FROM t1 WHERE a < 3;
a
-1
0
1
2
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 3;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1,p2 index PRIMARY PRIMARY 4 NULL 4 Using where; Using index
SELECT * FROM t1 WHERE a < 4;
a
-1
0
1
2
3
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 4;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1,p2,p3 index PRIMARY PRIMARY 4 NULL 5 Using where; Using index
SELECT * FROM t1 WHERE a < 5;
a
-1
0
1
2
3
4
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 5;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1,p2,p3,p4 index PRIMARY PRIMARY 4 NULL 6 Using where; Using index
SELECT * FROM t1 WHERE a < 6;
a
-1
0
1
2
3
4
5
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 6;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1,p2,p3,p4,max range PRIMARY PRIMARY 4 NULL 8 Using where; Using index
SELECT * FROM t1 WHERE a <= 1;
a
-1
0
1
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 1;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1 index PRIMARY PRIMARY 4 NULL 9 Using where; Using index
SELECT * FROM t1 WHERE a <= 2;
a
-1
0
1
2
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 2;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1,p2 index PRIMARY PRIMARY 4 NULL 9 Using where; Using index
SELECT * FROM t1 WHERE a <= 3;
a
-1
0
1
2
3
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 3;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1,p2,p3 index PRIMARY PRIMARY 4 NULL 9 Using where; Using index
SELECT * FROM t1 WHERE a <= 4;
a
-1
0
1
2
3
4
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 4;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1,p2,p3,p4 index PRIMARY PRIMARY 4 NULL 9 Using where; Using index
SELECT * FROM t1 WHERE a <= 5;
a
-1
0
1
2
3
4
5
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 5;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1,p2,p3,p4,max range PRIMARY PRIMARY 4 NULL 8 Using where; Using index
SELECT * FROM t1 WHERE a <= 6;
a
-1
0
1
2
3
4
5
6
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 6;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1,p2,p3,p4,max range PRIMARY PRIMARY 4 NULL 8 Using where; Using index
SELECT * FROM t1 WHERE a = 1;
a
1
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 1;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p1 system PRIMARY NULL NULL NULL 1
SELECT * FROM t1 WHERE a = 2;
a
2
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 2;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p2 system PRIMARY NULL NULL NULL 1
SELECT * FROM t1 WHERE a = 3;
a
3
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 3;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p3 system PRIMARY NULL NULL NULL 1
SELECT * FROM t1 WHERE a = 4;
a
4
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 4;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p4 system PRIMARY NULL NULL NULL 1
SELECT * FROM t1 WHERE a = 5;
a
5
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 5;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 max const PRIMARY PRIMARY 4 const 1 Using index
SELECT * FROM t1 WHERE a = 6;
a
6
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 6;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 max const PRIMARY PRIMARY 4 const 1 Using index
SELECT * FROM t1 WHERE a >= 1;
a
1
2
3
4
5
6
7
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 1;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p1,p2,p3,p4,max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index
SELECT * FROM t1 WHERE a >= 2;
a
2
3
4
5
6
7
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 2;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p2,p3,p4,max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index
SELECT * FROM t1 WHERE a >= 3;
a
3
4
5
6
7
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 3;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p3,p4,max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index
SELECT * FROM t1 WHERE a >= 4;
a
4
5
6
7
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 4;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p4,max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index
SELECT * FROM t1 WHERE a >= 5;
a
5
6
7
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 5;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index
SELECT * FROM t1 WHERE a >= 6;
a
6
7
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 6;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
SELECT * FROM t1 WHERE a > 1;
a
2
3
4
5
6
7
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 1;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p2,p3,p4,max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index
SELECT * FROM t1 WHERE a > 2;
a
3
4
5
6
7
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 2;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p3,p4,max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index
SELECT * FROM t1 WHERE a > 3;
a
4
5
6
7
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 3;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p4,max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index
SELECT * FROM t1 WHERE a > 4;
a
5
6
7
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 4;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index
SELECT * FROM t1 WHERE a > 5;
a
6
7
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 5;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
SELECT * FROM t1 WHERE a > 6;
a
7
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 6;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
DROP TABLE t1;
# test of RANGE and index
CREATE TABLE t1 (a DATE, KEY(a))
PARTITION BY RANGE (TO_DAYS(a))
@ -2145,7 +2755,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 p0,p4 ALL NULL NULL NULL NULL 910 Using where
explain partitions select * from t2 where (a > 100 AND a < 600);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 p0,p1,p2,p3 ALL NULL NULL NULL NULL 910 Using where
1 SIMPLE t2 p0,p1,p2 ALL NULL NULL NULL NULL 910 Using where
explain partitions select * from t2 where b = 4;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 76 Using where

View file

@ -1695,23 +1695,23 @@ SUCCESS
drop table t2;
create temporary table t2 (a int);
execute stmt;
ERROR 42S01: Table 't2' already exists
call p_verify_reprepare_count(1);
SUCCESS
execute stmt;
ERROR 42S01: Table 't2' already exists
call p_verify_reprepare_count(0);
call p_verify_reprepare_count(1);
SUCCESS
drop temporary table t2;
execute stmt;
call p_verify_reprepare_count(1);
ERROR 42S01: Table 't2' already exists
call p_verify_reprepare_count(0);
SUCCESS
drop table t2;
execute stmt;
call p_verify_reprepare_count(0);
call p_verify_reprepare_count(1);
SUCCESS
drop table t2;

View file

@ -4602,4 +4602,17 @@ SELECT 1 FROM t1 GROUP BY
1
1
DROP TABLE t1;
#
# Bug #49512 : subquery with aggregate function crash
# subselect_single_select_engine::exec()
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES();
# should not crash
SELECT 1 FROM t1 WHERE a <> SOME
(
SELECT MAX((SELECT a FROM t1 LIMIT 1)) AS d
FROM t1,t1 a
);
1
DROP TABLE t1;
End of 5.1 tests.

View file

@ -566,7 +566,7 @@ set sql_log_bin=1;
set sql_log_off=1;
set sql_log_update=1;
Warnings:
Note 1315 The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been ignored
Note 1315 The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been ignored. This option will be removed in MySQL 5.6.
set sql_low_priority_updates=1;
set sql_max_join_size=200;
select @@sql_max_join_size,@@max_join_size;

View file

@ -31,3 +31,37 @@ SHOW EVENTS in mysqltest;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
mysqltest e root@localhost SYSTEM ONE TIME # NULL NULL NULL NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
DROP DATABASE IF EXISTS mysqltest;
-------------BUG#47418-------------
USE test;
DROP TABLE IF EXISTS t3;
CREATE TABLE t3(c1 INTEGER);
INSERT INTO t3 VALUES(33);
CREATE TEMPORARY TABLE t1(c1 INTEGER);
CREATE TEMPORARY TABLE t2(c1 INTEGER);
INSERT INTO t1 VALUES(1);
INSERT INTO t2 VALUES(1);
CREATE TABLE IF NOT EXISTS t1(c1 INTEGER) SELECT c1 FROM t3;
CREATE TABLE t2(c1 INTEGER) SELECT c1 FROM t3;
SELECT * FROM t1;
c1
1
SELECT * FROM t2;
c1
1
SELECT * FROM t1;
c1
33
SELECT * FROM t2;
c1
33
DROP TEMPORARY TABLE t1;
DROP TEMPORARY TABLE t2;
SELECT * FROM t1;
c1
33
SELECT * FROM t2;
c1
33
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;

View file

@ -1,24 +0,0 @@
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CREATE TABLE t1 (c1 BIT, c2 INT);
INSERT INTO `t1` VALUES ( 1, 1 );
UPDATE t1 SET c1=NULL where c2=1;
Comparing tables master:test.t1 and slave:test.t1
DELETE FROM t1 WHERE c2=1 LIMIT 1;
Comparing tables master:test.t1 and slave:test.t1
DROP TABLE t1;
CREATE TABLE t1 (c1 CHAR);
INSERT INTO t1 ( c1 ) VALUES ( 'w' ) ;
SELECT * FROM t1;
c1
w
# should trigger switch to row due to LIMIT
UPDATE t1 SET c1=NULL WHERE c1='w' LIMIT 2;
Comparing tables master:test.t1 and slave:test.t1
DELETE FROM t1 LIMIT 2;
Comparing tables master:test.t1 and slave:test.t1
DROP TABLE t1;

View file

@ -152,6 +152,7 @@ c1 c3 c4 c5
5 2006-02-22 00:00:00 Tested in Texas 11
--- Test 2 position test --
Warning: The option '--position' is deprecated and will be removed in MySQL 5.6. Please use --start-position instead.
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@ -314,6 +315,7 @@ ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- Test 7 reading stdin w/position --
Warning: The option '--position' is deprecated and will be removed in MySQL 5.6. Please use --start-position instead.
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;

View file

@ -195,7 +195,7 @@ set @old_log_bin_trust_routine_creators= @@global.log_bin_trust_routine_creators
set @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
set global log_bin_trust_routine_creators=1;
Warnings:
Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 6.0. Please use '@@log_bin_trust_function_creators' instead
Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.6. Please use '@@log_bin_trust_function_creators' instead
set global log_bin_trust_function_creators=0;
set global log_bin_trust_function_creators=1;
set @old_log_bin_trust_routine_creators= @@global.log_bin_trust_routine_creators;
@ -559,11 +559,11 @@ end
master-bin.000001 # Query # # use `mysqltest`; SELECT `mysqltest2`.`f1`()
set @@global.log_bin_trust_routine_creators= @old_log_bin_trust_routine_creators;
Warnings:
Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 6.0. Please use '@@log_bin_trust_function_creators' instead
Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.6. Please use '@@log_bin_trust_function_creators' instead
set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
set @@global.log_bin_trust_routine_creators= @old_log_bin_trust_routine_creators;
Warnings:
Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 6.0. Please use '@@log_bin_trust_function_creators' instead
Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.6. Please use '@@log_bin_trust_function_creators' instead
set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
drop database mysqltest;
drop database mysqltest2;

File diff suppressed because it is too large Load diff

View file

@ -67,4 +67,57 @@ SHOW EVENTS in mysqltest;
connection master;
DROP DATABASE IF EXISTS mysqltest;
#
# BUG#47418 RBR fails, failure with mixup of base/temporary/view TABLE DDL
#
# Before the patch for this bug, 'CREATE TABLE IF NOT EXIST ... SELECT'
# statement was binlogged as a TEMPORARY table if the object existed as
# a temporary table. This was caused by that the temporary table was opened
# and the results of the 'SELECT' was inserted into the temporary table if
# a temporary table existed with the same name.
#
# After the patch for this bug, the base table is created and the results of
# the 'SELECT' are inserted into it, even though a temporary table exists with
# the same name, and the statement is still binlogged as a base table.
#
echo -------------BUG#47418-------------;
connection master;
USE test;
DROP TABLE IF EXISTS t3;
--enable_warnings
CREATE TABLE t3(c1 INTEGER);
INSERT INTO t3 VALUES(33);
CREATE TEMPORARY TABLE t1(c1 INTEGER);
CREATE TEMPORARY TABLE t2(c1 INTEGER);
INSERT INTO t1 VALUES(1);
INSERT INTO t2 VALUES(1);
CREATE TABLE IF NOT EXISTS t1(c1 INTEGER) SELECT c1 FROM t3;
CREATE TABLE t2(c1 INTEGER) SELECT c1 FROM t3;
# In these two statements, t1 and t2 are the temporary table. there is only
# value '1' in them. The records of t2 are not inserted into them.
SELECT * FROM t1;
SELECT * FROM t2;
sync_slave_with_master;
# In these two statements, t1 and t2 are the base table. The recoreds of t2
# are inserted into it when CREATE TABLE ... SELECT was executed.
SELECT * FROM t1;
SELECT * FROM t2;
connection master;
DROP TEMPORARY TABLE t1;
DROP TEMPORARY TABLE t2;
#In these two statements, t1 and t2 are the base table.
SELECT * FROM t1;
SELECT * FROM t2;
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
source include/master-slave-end.inc;

View file

@ -1,53 +0,0 @@
# BUG#49481: RBR: MyISAM and bit fields may cause slave to stop on delete cant find record
# BUG#49482: RBR: Replication may break on deletes when MyISAM tables + char field are used
-- source include/master-slave.inc
-- source include/have_binlog_format_mixed_or_row.inc
-- connection master
CREATE TABLE t1 (c1 BIT, c2 INT);
INSERT INTO `t1` VALUES ( 1, 1 );
UPDATE t1 SET c1=NULL where c2=1;
-- sync_slave_with_master
-- let $diff_table_1=master:test.t1
-- let $diff_table_2=slave:test.t1
-- source include/diff_tables.inc
-- connection master
DELETE FROM t1 WHERE c2=1 LIMIT 1;
-- sync_slave_with_master
-- let $diff_table_1=master:test.t1
-- let $diff_table_2=slave:test.t1
-- source include/diff_tables.inc
-- connection master
DROP TABLE t1;
-- sync_slave_with_master
-- connection master
CREATE TABLE t1 (c1 CHAR);
INSERT INTO t1 ( c1 ) VALUES ( 'w' ) ;
SELECT * FROM t1;
-- echo # should trigger switch to row due to LIMIT
UPDATE t1 SET c1=NULL WHERE c1='w' LIMIT 2;
-- sync_slave_with_master
-- let $diff_table_1=master:test.t1
-- let $diff_table_2=slave:test.t1
-- source include/diff_tables.inc
-- connection master
DELETE FROM t1 LIMIT 2;
-- sync_slave_with_master
-- let $diff_table_1=master:test.t1
-- let $diff_table_2=slave:test.t1
-- source include/diff_tables.inc
-- connection master
DROP TABLE t1;
-- sync_slave_with_master

View file

@ -0,0 +1 @@
--binlog-direct-non-transactional-updates

View file

@ -0,0 +1,230 @@
################################################################################
# This test case checks if the option "binlog-direct-non-transactional-updates"
# makes non-transactional changes in the statement format to be written to the
# binary log as soon as the statement commits.
#
# In what follows, we use the include file rpl_mixing_engines.inc to generate
# sql commands from a format string. The format string consists of a sequence of
# 'codes' separated by spaces. Before it set of commands, we paste the expected
# sequence in the binary log. The following codes exist:
#
# - Define the scope of a transaction:
# B - Begin.
# C - Commit.
# R - Rollback.
#
# - Change only T-Tables:
# T - Updates a T-Table.
# T-trig - Updates T-Tables through a trigger.
# T-func - Updates T-Tables through a function.
# T-proc - Updates T-Tables through a procedure.
# eT - Fails while updating the first tuple in a T-Table.
# Te - Fails while updating an n-tuple (n > 1) in a T-Table.
# Te-trig - Fails while updating an n-tuple (n > 1) in a T-Table.
# Te-func - Fails while updating an n-tuple (n > 1) in a T-Table.
#
# - Change only N-Tables
# N - Updates a N-Table.
# N-trig - Updates N-Tables through a trigger.
# N-func - Updates N-Tables through a function.
# N-proc - Updates N-Tables through a procedure.
# eN - Fails while updating the first tuple in a N-Table.
# Ne - Fails while updating an n-tuple (n > 1) in a N-Table.
# Ne-trig - Fails while updating an n-tuple (n > 1) in a N-Table.
# Ne-func - Fails while updating an n-tuple (n > 1) in a N-Table.
################################################################################
--source include/have_binlog_format_statement.inc
--source include/master-slave.inc
--source include/have_innodb.inc
set @@session.binlog_direct_non_transactional_updates= TRUE;
--echo #########################################################################
--echo # CONFIGURATION
--echo #########################################################################
--let $engine_type= Innodb
SET @commands= 'configure';
--source extra/rpl_tests/rpl_mixing_engines.inc
--echo #########################################################################
--echo # 1 - BINLOG ORDER
--echo #########################################################################
connection master;
--echo
--echo
--echo
--echo
--echo #
--echo #3) Generates in the binlog what follows:
--echo # --> STMT "N B T C" entries, format S.
--echo #
SET @commands= 'B T N C';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T N-trig C';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T N-func C';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T N-proc C';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T-trig N C';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T-trig N-trig C';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T-trig N-func C';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T-trig N-proc C';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T-func N C';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T-func N-trig C';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T-func N-func C';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T-func N-proc C';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T-proc N C';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T-proc N-trig C';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T-proc N-func C';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T-proc N-proc C';
--source extra/rpl_tests/rpl_mixing_engines.inc
--echo
--echo
--echo
--echo
--echo #
--echo #3.e) Generates in the binlog what follows if T-* fails:
--echo # --> STMT "N" entry, format S.
--echo # Otherwise, what follows if N-* fails and a N-Table is changed:
--echo # --> STMT "N B T C" entries, format S.
--echo #
SET @commands= 'B eT N C';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B Te N C';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T eN C';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T Ne C';
--source extra/rpl_tests/rpl_mixing_engines.inc
--echo
--echo
--echo
--echo
--echo #
--echo #4) Generates in the binlog what follows:
--echo # --> STMT "N B T R" entries, format S.
--echo #
SET @commands= 'B T N R';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T N-trig R';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T N-func R';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T N-proc R';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T-trig N R';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T-trig N-trig R';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T-trig N-func R';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T-trig N-proc R';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T-func N R';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T-func N-trig R';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T-func N-func R';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T-func N-proc R';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T-proc N R';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T-proc N-trig R';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T-proc N-func R';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T-proc N-proc R';
--source extra/rpl_tests/rpl_mixing_engines.inc
--echo
--echo
--echo
--echo
--echo #
--echo #4.e) Generates in the binlog what follows if T* fails:
--echo # --> STMT "B N C" entry, format S.
--echo # Otherwise, what follows if N* fails and a N-Table is changed:
--echo # --> STMT "N" entries, format S.
--echo #
SET @commands= 'B eT N R';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B Te N R';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T eN R';
--source extra/rpl_tests/rpl_mixing_engines.inc
SET @commands= 'B T Ne R';
--source extra/rpl_tests/rpl_mixing_engines.inc
--echo ###################################################################################
--echo # CHECK CONSISTENCY
--echo ###################################################################################
connection master;
sync_slave_with_master;
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-nmt-master.sql
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-nmt-slave.sql
--diff_files $MYSQLTEST_VARDIR/tmp/test-nmt-master.sql $MYSQLTEST_VARDIR/tmp/test-nmt-slave.sql
--echo ###################################################################################
--echo # CLEAN
--echo ###################################################################################
SET @commands= 'clean';
--source extra/rpl_tests/rpl_mixing_engines.inc

View file

@ -721,16 +721,15 @@ drop table t1;
# Base vs temporary tables dillema (a.k.a. bug#24508 "Inconsistent
# results of CREATE TABLE ... SELECT when temporary table exists").
# In this situation we either have to create non-temporary table and
# insert data in it or insert data in temporary table without creation
# of permanent table. Since currently temporary tables always shadow
# permanent tables we adopt second approach.
# insert data in it or insert data in temporary table without creation of
# permanent table. After patch for Bug#47418, we create the base table and
# instert data into it, even though a temporary table exists with the same
# name.
create temporary table t1 (j int);
create table if not exists t1 select 1;
select * from t1;
drop temporary table t1;
--error ER_NO_SUCH_TABLE
select * from t1;
--error ER_BAD_TABLE_ERROR
drop table t1;

View file

@ -0,0 +1 @@
--innodb_lock_wait_timeout=1

View file

@ -5,6 +5,8 @@
drop table if exists t1;
--enable_warnings
let $MYSQLD_DATADIR= `SELECT @@datadir`;
#
# BUG#47774, Assertion failure in InnoDB using column list partitioning
#
@ -345,6 +347,47 @@ CREATE TABLE t1 (a INT) ENGINE=InnoDB
PARTITION BY list(a) (PARTITION p1 VALUES IN (1));
CREATE INDEX i1 ON t1 (a);
DROP TABLE t1;
let $MYSQLD_DATADIR= `SELECT @@datadir`;
# Before the fix it should show extra file like #sql-2405_2.par
--list_files $MYSQLD_DATADIR/test/ *
--echo #
--echo # Bug#47343: InnoDB fails to clean-up after lock wait timeout on
--echo # REORGANIZE PARTITION
--echo #
CREATE TABLE t1 (
a INT,
b DATE NOT NULL,
PRIMARY KEY (a, b)
) ENGINE=InnoDB
PARTITION BY RANGE (a) (
PARTITION pMAX VALUES LESS THAN MAXVALUE
) ;
INSERT INTO t1 VALUES (1, '2001-01-01'), (2, '2002-02-02'), (3, '2003-03-03');
START TRANSACTION;
SELECT * FROM t1 FOR UPDATE;
connect (con1, localhost, root,,);
--echo # Connection con1
--error ER_LOCK_WAIT_TIMEOUT
ALTER TABLE t1 REORGANIZE PARTITION pMAX INTO
(PARTITION p3 VALUES LESS THAN (3),
PARTITION pMAX VALUES LESS THAN MAXVALUE);
SHOW WARNINGS;
--error ER_LOCK_WAIT_TIMEOUT
ALTER TABLE t1 REORGANIZE PARTITION pMAX INTO
(PARTITION p3 VALUES LESS THAN (3),
PARTITION pMAX VALUES LESS THAN MAXVALUE);
SHOW WARNINGS;
#Contents of the 'test' database directory:
--list_files $MYSQLD_DATADIR/test
disconnect con1;
connection default;
--echo # Connection default
SELECT * FROM t1;
COMMIT;
DROP TABLE t1;

View file

@ -8,6 +8,166 @@
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
--enable_warnings
--echo #
--echo # Bug#49742: Partition Pruning not working correctly for RANGE
--echo #
CREATE TABLE t1 (a INT PRIMARY KEY)
PARTITION BY RANGE (a) (
PARTITION p0 VALUES LESS THAN (1),
PARTITION p1 VALUES LESS THAN (2),
PARTITION p2 VALUES LESS THAN (3),
PARTITION p3 VALUES LESS THAN (4),
PARTITION p4 VALUES LESS THAN (5),
PARTITION p5 VALUES LESS THAN (6),
PARTITION max VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (-1),(0),(1),(2),(3),(4),(5),(6),(7),(8);
SELECT * FROM t1 WHERE a < 1;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 1;
SELECT * FROM t1 WHERE a < 2;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 2;
SELECT * FROM t1 WHERE a < 3;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 3;
SELECT * FROM t1 WHERE a < 4;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 4;
SELECT * FROM t1 WHERE a < 5;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 5;
SELECT * FROM t1 WHERE a < 6;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 6;
SELECT * FROM t1 WHERE a < 7;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 7;
SELECT * FROM t1 WHERE a <= 1;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 1;
SELECT * FROM t1 WHERE a <= 2;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 2;
SELECT * FROM t1 WHERE a <= 3;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 3;
SELECT * FROM t1 WHERE a <= 4;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 4;
SELECT * FROM t1 WHERE a <= 5;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 5;
SELECT * FROM t1 WHERE a <= 6;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 6;
SELECT * FROM t1 WHERE a <= 7;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 7;
SELECT * FROM t1 WHERE a = 1;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 1;
SELECT * FROM t1 WHERE a = 2;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 2;
SELECT * FROM t1 WHERE a = 3;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 3;
SELECT * FROM t1 WHERE a = 4;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 4;
SELECT * FROM t1 WHERE a = 5;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 5;
SELECT * FROM t1 WHERE a = 6;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 6;
SELECT * FROM t1 WHERE a = 7;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 7;
SELECT * FROM t1 WHERE a >= 1;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 1;
SELECT * FROM t1 WHERE a >= 2;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 2;
SELECT * FROM t1 WHERE a >= 3;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 3;
SELECT * FROM t1 WHERE a >= 4;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 4;
SELECT * FROM t1 WHERE a >= 5;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 5;
SELECT * FROM t1 WHERE a >= 6;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 6;
SELECT * FROM t1 WHERE a >= 7;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 7;
SELECT * FROM t1 WHERE a > 1;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 1;
SELECT * FROM t1 WHERE a > 2;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 2;
SELECT * FROM t1 WHERE a > 3;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 3;
SELECT * FROM t1 WHERE a > 4;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 4;
SELECT * FROM t1 WHERE a > 5;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 5;
SELECT * FROM t1 WHERE a > 6;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 6;
SELECT * FROM t1 WHERE a > 7;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 7;
DROP TABLE t1;
CREATE TABLE t1 (a INT PRIMARY KEY)
PARTITION BY RANGE (a) (
PARTITION p0 VALUES LESS THAN (1),
PARTITION p1 VALUES LESS THAN (2),
PARTITION p2 VALUES LESS THAN (3),
PARTITION p3 VALUES LESS THAN (4),
PARTITION p4 VALUES LESS THAN (5),
PARTITION max VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (-1),(0),(1),(2),(3),(4),(5),(6),(7);
SELECT * FROM t1 WHERE a < 1;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 1;
SELECT * FROM t1 WHERE a < 2;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 2;
SELECT * FROM t1 WHERE a < 3;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 3;
SELECT * FROM t1 WHERE a < 4;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 4;
SELECT * FROM t1 WHERE a < 5;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 5;
SELECT * FROM t1 WHERE a < 6;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 6;
SELECT * FROM t1 WHERE a <= 1;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 1;
SELECT * FROM t1 WHERE a <= 2;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 2;
SELECT * FROM t1 WHERE a <= 3;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 3;
SELECT * FROM t1 WHERE a <= 4;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 4;
SELECT * FROM t1 WHERE a <= 5;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 5;
SELECT * FROM t1 WHERE a <= 6;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 6;
SELECT * FROM t1 WHERE a = 1;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 1;
SELECT * FROM t1 WHERE a = 2;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 2;
SELECT * FROM t1 WHERE a = 3;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 3;
SELECT * FROM t1 WHERE a = 4;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 4;
SELECT * FROM t1 WHERE a = 5;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 5;
SELECT * FROM t1 WHERE a = 6;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 6;
SELECT * FROM t1 WHERE a >= 1;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 1;
SELECT * FROM t1 WHERE a >= 2;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 2;
SELECT * FROM t1 WHERE a >= 3;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 3;
SELECT * FROM t1 WHERE a >= 4;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 4;
SELECT * FROM t1 WHERE a >= 5;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 5;
SELECT * FROM t1 WHERE a >= 6;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 6;
SELECT * FROM t1 WHERE a > 1;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 1;
SELECT * FROM t1 WHERE a > 2;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 2;
SELECT * FROM t1 WHERE a > 3;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 3;
SELECT * FROM t1 WHERE a > 4;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 4;
SELECT * FROM t1 WHERE a > 5;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 5;
SELECT * FROM t1 WHERE a > 6;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 6;
DROP TABLE t1;
#
# Bug#20577: Partitions: use of to_days() function leads to selection failures
#

View file

@ -1445,18 +1445,19 @@ call p_verify_reprepare_count(0);
drop table t2;
# Temporary table with name of table to be created exists
create temporary table t2 (a int);
# Temporary table and base table are not in the same name space.
execute stmt;
call p_verify_reprepare_count(1);
--error ER_TABLE_EXISTS_ERROR
execute stmt;
call p_verify_reprepare_count(1);
drop temporary table t2;
--error ER_TABLE_EXISTS_ERROR
execute stmt;
call p_verify_reprepare_count(0);
drop temporary table t2;
execute stmt;
call p_verify_reprepare_count(1);
drop table t2;
execute stmt;
call p_verify_reprepare_count(0);
call p_verify_reprepare_count(1);
drop table t2;
# View with name of table to be created exists
# Attention:

View file

@ -3585,4 +3585,19 @@ SELECT 1 FROM t1 GROUP BY
(SELECT LAST_INSERT_ID() FROM t1 ORDER BY MIN(a) ASC LIMIT 1);
DROP TABLE t1;
--echo #
--echo # Bug #49512 : subquery with aggregate function crash
--echo # subselect_single_select_engine::exec()
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES();
--echo # should not crash
SELECT 1 FROM t1 WHERE a <> SOME
(
SELECT MAX((SELECT a FROM t1 LIMIT 1)) AS d
FROM t1,t1 a
);
DROP TABLE t1;
--echo End of 5.1 tests.

View file

@ -171,6 +171,10 @@ int handle_options(int *argc, char ***argv,
{ /* --set-variable, or -O */
if (*cur_arg == 'O')
{
my_getopt_error_reporter(WARNING_LEVEL,
"%s: Option '-O' is deprecated. "
"Use --variable-name=value instead.",
my_progname);
must_be_var= 1;
if (!(*++cur_arg)) /* If not -Ovar=# */
@ -190,6 +194,11 @@ int handle_options(int *argc, char ***argv,
}
else if (!getopt_compare_strings(cur_arg, "-set-variable", 13))
{
my_getopt_error_reporter(WARNING_LEVEL,
"%s: Option '--set-variable' is deprecated. "
"Use --variable-name=value instead.",
my_progname);
must_be_var= 1;
if (cur_arg[13] == '=')
{

View file

@ -68,7 +68,10 @@ sub main
# than a correct --defaults-extra-file option
unshift @defaults_options, "--defaults-extra-file=$1";
print "WARNING: --config-file is deprecated and will be removed\n";
print "in MySQL 5.6. Please use --defaults-extra-file instead\n";
}
}
}
foreach (@defaults_options)

View file

@ -1403,7 +1403,7 @@ Event_job_data::execute(THD *thd, bool drop)
#endif
if (check_access(thd, EVENT_ACL, dbname.str,
0, 0, 0, is_schema_db(dbname.str)))
0, 0, 0, is_schema_db(dbname.str, dbname.length)))
{
/*
This aspect of behavior is defined in the worklog,

View file

@ -415,7 +415,8 @@ Events::create_event(THD *thd, Event_parse_data *parse_data,
DBUG_ASSERT(parse_data->expression || parse_data->execute_at);
if (check_access(thd, EVENT_ACL, parse_data->dbname.str, 0, 0, 0,
is_schema_db(parse_data->dbname.str)))
is_schema_db(parse_data->dbname.str,
parse_data->dbname.length)))
DBUG_RETURN(TRUE);
if (check_db_dir_existence(parse_data->dbname.str))
@ -526,7 +527,8 @@ Events::update_event(THD *thd, Event_parse_data *parse_data,
DBUG_RETURN(TRUE);
if (check_access(thd, EVENT_ACL, parse_data->dbname.str, 0, 0, 0,
is_schema_db(parse_data->dbname.str)))
is_schema_db(parse_data->dbname.str,
parse_data->dbname.length)))
DBUG_RETURN(TRUE);
if (new_dbname) /* It's a rename */
@ -548,7 +550,7 @@ Events::update_event(THD *thd, Event_parse_data *parse_data,
access it.
*/
if (check_access(thd, EVENT_ACL, new_dbname->str, 0, 0, 0,
is_schema_db(new_dbname->str)))
is_schema_db(new_dbname->str, new_dbname->length)))
DBUG_RETURN(TRUE);
/* Check that the target database exists */
@ -653,7 +655,7 @@ Events::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists)
DBUG_RETURN(TRUE);
if (check_access(thd, EVENT_ACL, dbname.str, 0, 0, 0,
is_schema_db(dbname.str)))
is_schema_db(dbname.str, dbname.length)))
DBUG_RETURN(TRUE);
/*
@ -811,7 +813,7 @@ Events::show_create_event(THD *thd, LEX_STRING dbname, LEX_STRING name)
DBUG_RETURN(TRUE);
if (check_access(thd, EVENT_ACL, dbname.str, 0, 0, 0,
is_schema_db(dbname.str)))
is_schema_db(dbname.str, dbname.length)))
DBUG_RETURN(TRUE);
/*
@ -869,7 +871,7 @@ Events::fill_schema_events(THD *thd, TABLE_LIST *tables, COND * /* cond */)
if (thd->lex->sql_command == SQLCOM_SHOW_EVENTS)
{
DBUG_ASSERT(thd->lex->select_lex.db);
if (!is_schema_db(thd->lex->select_lex.db) && // There is no events in I_S
if (!is_schema_db(thd->lex->select_lex.db) && // There is no events in I_S
check_access(thd, EVENT_ACL, thd->lex->select_lex.db, 0, 0, 0, 0))
DBUG_RETURN(1);
db= thd->lex->select_lex.db;

View file

@ -1272,17 +1272,28 @@ int ha_partition::prepare_new_partition(TABLE *tbl,
partition_element *p_elem)
{
int error;
bool create_flag= FALSE;
DBUG_ENTER("prepare_new_partition");
if ((error= set_up_table_before_create(tbl, part_name, create_info,
0, p_elem)))
goto error;
goto error_create;
if ((error= file->ha_create(part_name, tbl, create_info)))
goto error;
create_flag= TRUE;
{
/*
Added for safety, InnoDB reports HA_ERR_FOUND_DUPP_KEY
if the table/partition already exists.
If we return that error code, then print_error would try to
get_dup_key on a non-existing partition.
So return a more reasonable error code.
*/
if (error == HA_ERR_FOUND_DUPP_KEY)
error= HA_ERR_TABLE_EXIST;
goto error_create;
}
DBUG_PRINT("info", ("partition %s created", part_name));
if ((error= file->ha_open(tbl, part_name, m_mode, m_open_test_lock)))
goto error;
goto error_open;
DBUG_PRINT("info", ("partition %s opened", part_name));
/*
Note: if you plan to add another call that may return failure,
better to do it before external_lock() as cleanup_new_partition()
@ -1290,12 +1301,15 @@ int ha_partition::prepare_new_partition(TABLE *tbl,
Otherwise see description for cleanup_new_partition().
*/
if ((error= file->ha_external_lock(ha_thd(), m_lock_type)))
goto error;
goto error_external_lock;
DBUG_PRINT("info", ("partition %s external locked", part_name));
DBUG_RETURN(0);
error:
if (create_flag)
VOID(file->ha_delete_table(part_name));
error_external_lock:
VOID(file->close());
error_open:
VOID(file->ha_delete_table(part_name));
error_create:
DBUG_RETURN(error);
}
@ -1329,19 +1343,23 @@ error:
void ha_partition::cleanup_new_partition(uint part_count)
{
handler **save_m_file= m_file;
DBUG_ENTER("ha_partition::cleanup_new_partition");
if (m_added_file && m_added_file[0])
if (m_added_file)
{
m_file= m_added_file;
THD *thd= ha_thd();
handler **file= m_added_file;
while ((part_count > 0) && (*file))
{
(*file)->ha_external_lock(thd, F_UNLCK);
(*file)->close();
/* Leave the (*file)->ha_delete_table(part_name) to the ddl-log */
file++;
part_count--;
}
m_added_file= NULL;
external_lock(ha_thd(), F_UNLCK);
/* delete_table also needed, a bit more complex */
close();
m_file= save_m_file;
}
DBUG_VOID_RETURN;
}
@ -1647,7 +1665,15 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
part_elem->part_state= PART_TO_BE_DROPPED;
}
m_new_file= new_file_array;
DBUG_RETURN(copy_partitions(copied, deleted));
if ((error= copy_partitions(copied, deleted)))
{
/*
Close and unlock the new temporary partitions.
They will later be deleted through the ddl-log.
*/
cleanup_new_partition(part_count);
}
DBUG_RETURN(error);
}
@ -1736,6 +1762,7 @@ int ha_partition::copy_partitions(ulonglong * const copied,
}
DBUG_RETURN(FALSE);
error:
m_reorged_file[reorg_part]->ha_rnd_end();
DBUG_RETURN(result);
}

View file

@ -5305,7 +5305,7 @@ int Item::save_in_field(Field *field, bool no_conversions)
field->set_notnull();
error=field->store(nr, unsigned_flag);
}
return error;
return error ? error : (field->table->in_use->is_error() ? 2 : 0);
}

View file

@ -4306,12 +4306,20 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info)
#if defined(USING_TRANSACTIONS)
/*
Should we write to the binlog cache or to the binlog on disk?
Write to the binlog cache if:
- it is already not empty (meaning we're in a transaction; note that the
present event could be about a non-transactional table, but still we need
to write to the binlog cache in that case to handle updates to mixed
trans/non-trans table types the best possible in binlogging)
- or if the event asks for it (cache_stmt == TRUE).
1 - a transactional engine/table is updated (stmt_has_updated_trans_table == TRUE);
2 - or the event asks for it (cache_stmt == TRUE);
3 - or the cache is already not empty (meaning we're in a transaction;
note that the present event could be about a non-transactional table, but
still we need to write to the binlog cache in that case to handle updates
to mixed trans/non-trans table types).
Write to the binlog on disk if only a non-transactional engine is
updated and:
1 - the binlog cache is empty or;
2 - --binlog-direct-non-transactional-updates is set and we are about to
use the statement format. When using the row format (cache_stmt == TRUE).
*/
if (opt_using_transactions && thd)
{
@ -4322,8 +4330,9 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info)
(binlog_trx_data*) thd_get_ha_data(thd, binlog_hton);
IO_CACHE *trans_log= &trx_data->trans_log;
my_off_t trans_log_pos= my_b_tell(trans_log);
if (event_info->get_cache_stmt() || trans_log_pos != 0 ||
stmt_has_updated_trans_table(thd))
if (event_info->get_cache_stmt() || stmt_has_updated_trans_table(thd) ||
(!thd->variables.binlog_direct_non_trans_update &&
trans_log_pos != 0))
{
DBUG_PRINT("info", ("Using trans_log: cache: %d, trans_log_pos: %lu",
event_info->get_cache_stmt(),

View file

@ -8733,24 +8733,6 @@ static bool record_compare(TABLE *table)
}
}
/**
Check if we are using MyISAM.
If this is a myisam table, then we cannot do a memcmp
right away because some NULL fields can still contain
an old value in the row - they are not shown to the user
because the null bit is set, however, the contents are
not cleared. As such, plain memory comparison cannot be
assured to work. See: BUG#49482 and BUG#49481.
On top of this, we do not store field contents for null
fields in the binlog, so this is extra important when
comparing records fetched from binlog and from storage
engine.
*/
if (table->file->ht->db_type == DB_TYPE_MYISAM)
goto record_compare_field_by_field;
if (table->s->blob_fields + table->s->varchar_fields == 0)
{
result= cmp_record(table,record[1]);
@ -8766,33 +8748,14 @@ static bool record_compare(TABLE *table)
goto record_compare_exit;
}
record_compare_field_by_field:
/* Compare updated fields */
for (Field **ptr=table->field ; *ptr ; ptr++)
{
Field *f= *ptr;
/* if just one of the fields is null then there is no match */
if ((f->is_null_in_record(table->record[0])) ==
!(f->is_null_in_record(table->record[1])))
if ((*ptr)->cmp_binary_offset(table->s->rec_buff_length))
{
result= TRUE;
goto record_compare_exit;
}
/* if both fields are not null then we can compare */
if (!(f->is_null_in_record(table->record[0])) &&
!(f->is_null_in_record(table->record[1])))
{
if (f->cmp_binary_offset(table->s->rec_buff_length))
{
result= TRUE;
goto record_compare_exit;
}
}
/* if both fields are null then there is a match. compare next field */
}
record_compare_exit:

View file

@ -323,24 +323,6 @@ static bool record_compare(TABLE *table)
}
}
/**
Check if we are using MyISAM.
If this is a myisam table, then we cannot do a memcmp
right away because some NULL fields can still contain
an old value in the row - they are not shown to the user
because the null bit is set, however, the contents are
not cleared. As such, plain memory comparison cannot be
assured to work. See: BUG#49482 and BUG#49481.
On top of this, we do not store field contents for null
fields in the binlog, so this is extra important when
comparing records fetched from binlog and from storage
engine.
*/
if (table->file->ht->db_type == DB_TYPE_MYISAM)
goto record_compare_field_by_field;
if (table->s->blob_fields + table->s->varchar_fields == 0)
{
result= cmp_record(table,record[1]);
@ -356,33 +338,14 @@ static bool record_compare(TABLE *table)
goto record_compare_exit;
}
record_compare_field_by_field:
/* Compare updated fields */
for (Field **ptr=table->field ; *ptr ; ptr++)
{
Field *f= *ptr;
/* if just one of the fields is null then there is no match */
if ((f->is_null_in_record(table->record[0])) ==
!(f->is_null_in_record(table->record[1])))
if ((*ptr)->cmp_binary_offset(table->s->rec_buff_length))
{
result= TRUE;
goto record_compare_exit;
}
/* if both fields are not null then we can compare */
if (!(f->is_null_in_record(table->record[0])) &&
!(f->is_null_in_record(table->record[1])))
{
if (f->cmp_binary_offset(table->s->rec_buff_length))
{
result= TRUE;
goto record_compare_exit;
}
}
/* if both fields are null then there is a match. compare next field */
}
record_compare_exit:

View file

@ -121,6 +121,10 @@ char* query_table_status(THD *thd,const char *db,const char *table_name);
#define PREV_BITS(type,A) ((type) (((type) 1 << (A)) -1))
#define all_bits_set(A,B) ((A) & (B) != (B))
/* Version numbers for deprecation messages */
#define VER_BETONY "5.5"
#define VER_CELOSIA "5.6"
#define WARN_DEPRECATED(Thd,Ver,Old,New) \
do { \
DBUG_ASSERT(strncmp(Ver, MYSQL_SERVER_VERSION, sizeof(Ver)-1) > 0); \
@ -1365,8 +1369,18 @@ bool get_schema_tables_result(JOIN *join,
enum enum_schema_table_state executed_place);
enum enum_schema_tables get_schema_table_idx(ST_SCHEMA_TABLE *schema_table);
#define is_schema_db(X) \
!my_strcasecmp(system_charset_info, INFORMATION_SCHEMA_NAME.str, (X))
inline bool is_schema_db(const char *name, size_t len)
{
return (INFORMATION_SCHEMA_NAME.length == len &&
!my_strcasecmp(system_charset_info,
INFORMATION_SCHEMA_NAME.str, name));
}
inline bool is_schema_db(const char *name)
{
return !my_strcasecmp(system_charset_info,
INFORMATION_SCHEMA_NAME.str, name);
}
/* sql_handler.cc */
bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen);

View file

@ -5633,6 +5633,7 @@ enum options_mysqld
OPT_DISCONNECT_SLAVE_EVENT_COUNT, OPT_TC_HEURISTIC_RECOVER,
OPT_ABORT_SLAVE_EVENT_COUNT,
OPT_LOG_BIN_TRUST_FUNCTION_CREATORS,
OPT_LOG_BIN_TRUST_FUNCTION_CREATORS_OLD,
OPT_ENGINE_CONDITION_PUSHDOWN, OPT_NDB_CONNECTSTRING,
OPT_NDB_USE_EXACT_COUNT, OPT_NDB_USE_TRANSACTIONS,
OPT_NDB_FORCE_SEND, OPT_NDB_AUTOINCREMENT_PREFETCH_SZ,
@ -5714,6 +5715,7 @@ enum options_mysqld
OPT_EXPIRE_LOGS_DAYS,
OPT_GROUP_CONCAT_MAX_LEN,
OPT_DEFAULT_COLLATION,
OPT_DEFAULT_COLLATION_OLD,
OPT_CHARACTER_SET_CLIENT_HANDSHAKE,
OPT_CHARACTER_SET_FILESYSTEM,
OPT_LC_ERROR_MESSAGES,
@ -5763,7 +5765,8 @@ enum options_mysqld
OPT_IGNORE_BUILTIN_INNODB,
OPT_SYNC_RELAY_LOG,
OPT_SYNC_RELAY_LOG_INFO,
OPT_SYNC_MASTER_INFO
OPT_SYNC_MASTER_INFO,
OPT_BINLOG_DIRECT_NON_TRANS_UPDATE
};
@ -5892,7 +5895,7 @@ struct my_option my_long_options[] =
{"default-character-set", 'C', "Set the default character set (deprecated option, use --character-set-server instead).",
(uchar**) &default_character_set_name, (uchar**) &default_character_set_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{"default-collation", OPT_DEFAULT_COLLATION, "Set the default collation (deprecated option, use --collation-server instead).",
{"default-collation", OPT_DEFAULT_COLLATION_OLD, "Set the default collation (deprecated option, use --collation-server instead).",
(uchar**) &default_collation_name, (uchar**) &default_collation_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{"default-storage-engine", OPT_STORAGE_ENGINE,
@ -6032,7 +6035,7 @@ each time the SQL thread starts.",
compatibility; the behaviour was also changed to apply only to functions
(and triggers). In a future release this old name could be removed.
*/
{"log-bin-trust-routine-creators", OPT_LOG_BIN_TRUST_FUNCTION_CREATORS,
{"log-bin-trust-routine-creators", OPT_LOG_BIN_TRUST_FUNCTION_CREATORS_OLD,
"(deprecated) Use log-bin-trust-function-creators.",
(uchar**) &trust_function_creators, (uchar**) &trust_function_creators, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
@ -7138,6 +7141,10 @@ The minimum value for this variable is 4096.",
(uchar**) &max_system_variables.net_wait_timeout, 0, GET_ULONG,
REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, IF_WIN(INT_MAX32/1000, LONG_TIMEOUT),
0, 1, 0},
{"binlog-direct-non-transactional-updates", OPT_BINLOG_DIRECT_NON_TRANS_UPDATE,
"Causes updates to non-transactional engines using statement format to be written directly to binary log. Before using this option make sure that there are no dependencies between transactional and non-transactional tables such as in the statement INSERT INTO t_myisam SELECT * FROM t_innodb; otherwise, slaves may diverge from the master.",
(uchar**) &global_system_variables.binlog_direct_non_trans_update, (uchar**) &max_system_variables.binlog_direct_non_trans_update, 0, GET_BOOL, NO_ARG, 0,
0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@ -8001,6 +8008,9 @@ mysqld_get_one_option(int optid,
#endif
opt_endinfo=1; /* unireg: memory allocation */
break;
case '0':
WARN_DEPRECATED(NULL, VER_CELOSIA, "--log-long-format", "--log-short-format");
break;
case 'a':
global_system_variables.sql_mode= fix_sql_mode(MODE_ANSI);
global_system_variables.tx_isolation= ISO_SERIALIZABLE;
@ -8009,6 +8019,7 @@ mysqld_get_one_option(int optid,
strmake(mysql_home,argument,sizeof(mysql_home)-1);
break;
case 'C':
WARN_DEPRECATED(NULL, VER_CELOSIA, "--default-character-set", "--character-set-server");
if (default_collation_name == compiled_default_collation_name)
default_collation_name= 0;
break;
@ -8031,6 +8042,9 @@ mysqld_get_one_option(int optid,
case 'L':
strmake(lc_messages_dir, argument, sizeof(lc_messages_dir)-1);
break;
case 'O':
WARN_DEPRECATED(NULL, VER_CELOSIA, "--set-variable", "--variable-name=value");
break;
#ifdef HAVE_REPLICATION
case OPT_SLAVE_SKIP_ERRORS:
init_slave_skip_errors(argument);
@ -8065,6 +8079,15 @@ mysqld_get_one_option(int optid,
test_flags= argument ? (uint) atoi(argument) : 0;
opt_endinfo=1;
break;
case (int) OPT_DEFAULT_COLLATION_OLD:
WARN_DEPRECATED(NULL, VER_CELOSIA, "--default-collation", "--collation-server");
break;
case (int) OPT_SAFE_SHOW_DB:
WARN_DEPRECATED(NULL, VER_CELOSIA, "--safe-show-database", "GRANT SHOW DATABASES");
break;
case (int) OPT_LOG_BIN_TRUST_FUNCTION_CREATORS_OLD:
WARN_DEPRECATED(NULL, VER_CELOSIA, "--log-bin-trust-routine-creators", "--log-bin-trust-function-creators");
break;
case (int) OPT_BIG_TABLES:
thd_startup_options|=OPTION_BIG_TABLES;
break;

View file

@ -183,6 +183,8 @@ static sys_var_long_ptr sys_binlog_cache_size(&vars, "binlog_cache_size",
&binlog_cache_size);
static sys_var_thd_binlog_format sys_binlog_format(&vars, "binlog_format",
&SV::binlog_format);
static sys_var_thd_bool sys_binlog_direct_non_trans_update(&vars, "binlog_direct_non_transactional_updates",
&SV::binlog_direct_non_trans_update);
static sys_var_thd_ulong sys_bulk_insert_buff_size(&vars, "bulk_insert_buffer_size",
&SV::bulk_insert_buff_size);
static sys_var_const_os sys_character_sets_dir(&vars,
@ -4282,7 +4284,7 @@ bool process_key_caches(process_key_cache_t func)
void sys_var_trust_routine_creators::warn_deprecated(THD *thd)
{
WARN_DEPRECATED(thd, "6.0", "@@log_bin_trust_routine_creators",
WARN_DEPRECATED(thd, VER_CELOSIA, "@@log_bin_trust_routine_creators",
"'@@log_bin_trust_function_creators'");
}

View file

@ -5132,11 +5132,11 @@ ER_SP_BADSTATEMENT 0A000
eng "%s is not allowed in stored procedures"
ger "%s ist in gespeicherten Prozeduren nicht erlaubt"
ER_UPDATE_LOG_DEPRECATED_IGNORED 42000
eng "The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been ignored"
ger "Das Update-Log ist veraltet und wurde durch das Binär-Log ersetzt. SET SQL_LOG_UPDATE wird ignoriert"
eng "The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been ignored. This option will be removed in MySQL 5.6."
ger "Das Update-Log ist veraltet und wurde durch das Binär-Log ersetzt. SET SQL_LOG_UPDATE wird ignoriert. Diese Option wird in MySQL 5.6 entfernt."
ER_UPDATE_LOG_DEPRECATED_TRANSLATED 42000
eng "The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN"
ger "Das Update-Log ist veraltet und wurde durch das Binär-Log ersetzt. SET SQL_LOG_UPDATE wurde in SET SQL_LOG_BIN übersetzt"
eng "The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN. This option will be removed in MySQL 5.6."
ger "Das Update-Log ist veraltet und wurde durch das Binär-Log ersetzt. SET SQL_LOG_UPDATE wurde in SET SQL_LOG_BIN übersetzt. Diese Option wird in MySQL 5.6 entfernt."
ER_QUERY_INTERRUPTED 70100
eng "Query execution was interrupted"
ger "Ausführung der Abfrage wurde unterbrochen"

View file

@ -5132,11 +5132,11 @@ ER_SP_BADSTATEMENT 0A000
eng "%s is not allowed in stored procedures"
ger "%s ist in gespeicherten Prozeduren nicht erlaubt"
ER_UPDATE_LOG_DEPRECATED_IGNORED 42000
eng "The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been ignored"
ger "Das Update-Log ist veraltet und wurde durch das Binär-Log ersetzt. SET SQL_LOG_UPDATE wird ignoriert"
eng "The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been ignored. This option will be removed in MySQL 5.6."
ger "Das Update-Log ist veraltet und wurde durch das Binär-Log ersetzt. SET SQL_LOG_UPDATE wird ignoriert. Diese Option wird in MySQL 5.6 entfernt."
ER_UPDATE_LOG_DEPRECATED_TRANSLATED 42000
eng "The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN"
ger "Das Update-Log ist veraltet und wurde durch das Binär-Log ersetzt. SET SQL_LOG_UPDATE wurde in SET SQL_LOG_BIN übersetzt"
eng "The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN. This option will be removed in MySQL 5.6."
ger "Das Update-Log ist veraltet und wurde durch das Binär-Log ersetzt. SET SQL_LOG_UPDATE wurde in SET SQL_LOG_BIN übersetzt. Diese Option wird in MySQL 5.6 entfernt."
ER_QUERY_INTERRUPTED 70100
eng "Query execution was interrupted"
ger "Ausführung der Abfrage wurde unterbrochen"
@ -6240,7 +6240,8 @@ ER_UNKNOWN_LOCALE
ER_SLAVE_IGNORE_SERVER_IDS
eng "The requested server id %d clashes with the slave startup option --replicate-same-server-id"
ER_QUERY_CACHE_DISABLED
eng "Query cache is disabled; restart the server with query_cache_type=1 to enable it"
ER_SAME_NAME_PARTITION_FIELD
eng "Duplicate partition field name '%-.192s'"
ER_PARTITION_COLUMN_LIST_ERROR

View file

@ -384,6 +384,7 @@ struct system_variables
ulong ndb_index_stat_cache_entries;
ulong ndb_index_stat_update_freq;
ulong binlog_format; // binlog format for this thd (see enum_binlog_format)
my_bool binlog_direct_non_trans_update;
/*
In slave thread we need to know in behalf of which
thread the query is being run to replicate temp tables properly

View file

@ -619,7 +619,7 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
DBUG_ENTER("mysql_create_db");
/* do not create 'information_schema' db */
if (!my_strcasecmp(system_charset_info, db, INFORMATION_SCHEMA_NAME.str))
if (is_schema_db(db))
{
my_error(ER_DB_CREATE_EXISTS, MYF(0), db);
DBUG_RETURN(-1);
@ -1558,8 +1558,7 @@ bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch)
}
}
if (my_strcasecmp(system_charset_info, new_db_name->str,
INFORMATION_SCHEMA_NAME.str) == 0)
if (is_schema_db(new_db_name->str, new_db_name->length))
{
/* Switch the current database to INFORMATION_SCHEMA. */

View file

@ -1324,8 +1324,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
table_list.alias= table_list.table_name= conv_name.str;
packet= arg_end + 1;
if (!my_strcasecmp(system_charset_info, table_list.db,
INFORMATION_SCHEMA_NAME.str))
if (is_schema_db(table_list.db, table_list.db_length))
{
ST_SCHEMA_TABLE *schema_table= find_schema_table(thd, table_list.alias);
if (schema_table)
@ -1387,7 +1386,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
break;
}
if (check_access(thd, CREATE_ACL, db.str , 0, 1, 0,
is_schema_db(db.str)))
is_schema_db(db.str, db.length)))
break;
general_log_print(thd, command, "%.*s", db.length, db.str);
bzero(&create_info, sizeof(create_info));
@ -1406,7 +1405,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
my_error(ER_WRONG_DB_NAME, MYF(0), db.str ? db.str : "NULL");
break;
}
if (check_access(thd, DROP_ACL, db.str, 0, 1, 0, is_schema_db(db.str)))
if (check_access(thd, DROP_ACL, db.str, 0, 1, 0,
is_schema_db(db.str, db.length)))
break;
if (thd->locked_tables || thd->active_transaction())
{
@ -2703,6 +2703,8 @@ case SQLCOM_PREPARE:
{
lex->link_first_table_back(create_table, link_to_local);
create_table->create= TRUE;
/* Base table and temporary table are not in the same name space. */
create_table->skip_temporary= 1;
}
if (!(res= open_and_lock_tables(thd, lex->query_tables)))
@ -3727,7 +3729,7 @@ end_with_restore_list:
}
#endif
if (check_access(thd,CREATE_ACL,lex->name.str, 0, 1, 0,
is_schema_db(lex->name.str)))
is_schema_db(lex->name.str, lex->name.length)))
break;
res= mysql_create_db(thd,(lower_case_table_names == 2 ? alias :
lex->name.str), &create_info, 0);
@ -3762,7 +3764,7 @@ end_with_restore_list:
}
#endif
if (check_access(thd,DROP_ACL,lex->name.str,0,1,0,
is_schema_db(lex->name.str)))
is_schema_db(lex->name.str, lex->name.length)))
break;
if (thd->locked_tables || thd->active_transaction())
{
@ -3796,9 +3798,12 @@ end_with_restore_list:
my_error(ER_WRONG_DB_NAME, MYF(0), db->str);
break;
}
if (check_access(thd, ALTER_ACL, db->str, 0, 1, 0, is_schema_db(db->str)) ||
check_access(thd, DROP_ACL, db->str, 0, 1, 0, is_schema_db(db->str)) ||
check_access(thd, CREATE_ACL, db->str, 0, 1, 0, is_schema_db(db->str)))
if (check_access(thd, ALTER_ACL, db->str, 0, 1, 0,
is_schema_db(db->str, db->length)) ||
check_access(thd, DROP_ACL, db->str, 0, 1, 0,
is_schema_db(db->str, db->length)) ||
check_access(thd, CREATE_ACL, db->str, 0, 1, 0,
is_schema_db(db->str, db->length)))
{
res= 1;
break;
@ -3841,7 +3846,8 @@ end_with_restore_list:
break;
}
#endif
if (check_access(thd, ALTER_ACL, db->str, 0, 1, 0, is_schema_db(db->str)))
if (check_access(thd, ALTER_ACL, db->str, 0, 1, 0,
is_schema_db(db->str, db->length)))
break;
if (thd->locked_tables || thd->active_transaction())
{
@ -3997,7 +4003,8 @@ end_with_restore_list:
first_table ? &first_table->grant.privilege : 0,
first_table ? 0 : 1, 0,
first_table ? (bool) first_table->schema_table :
select_lex->db ? is_schema_db(select_lex->db) : 0))
select_lex->db ?
is_schema_db(select_lex->db) : 0))
goto error;
if (thd->security_ctx->user) // If not replication
@ -4340,7 +4347,8 @@ end_with_restore_list:
}
if (check_access(thd, CREATE_PROC_ACL, lex->sphead->m_db.str, 0, 0, 0,
is_schema_db(lex->sphead->m_db.str)))
is_schema_db(lex->sphead->m_db.str,
lex->sphead->m_db.length)))
goto create_sp_error;
if (end_active_trans(thd))
@ -6502,8 +6510,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
ptr->force_index= test(table_options & TL_OPTION_FORCE_INDEX);
ptr->ignore_leaves= test(table_options & TL_OPTION_IGNORE_LEAVES);
ptr->derived= table->sel;
if (!ptr->derived && !my_strcasecmp(system_charset_info, ptr->db,
INFORMATION_SCHEMA_NAME.str))
if (!ptr->derived && is_schema_db(ptr->db, ptr->db_length))
{
ST_SCHEMA_TABLE *schema_table;
if (ptr->updating &&
@ -7208,7 +7215,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
/*
If the query was killed then this function must fail.
*/
return result || thd->killed;
return result || (thd ? thd->killed : 0);
}

View file

@ -3326,16 +3326,13 @@ int get_partition_id_range(partition_info *part_info,
part_func_value-= 0x8000000000000000ULL;
while (max_part_id > min_part_id)
{
loc_part_id= (max_part_id + min_part_id + 1) >> 1;
loc_part_id= (max_part_id + min_part_id) / 2;
if (range_array[loc_part_id] <= part_func_value)
min_part_id= loc_part_id + 1;
else
max_part_id= loc_part_id - 1;
max_part_id= loc_part_id;
}
loc_part_id= max_part_id;
if (part_func_value >= range_array[loc_part_id])
if (loc_part_id != max_partition)
loc_part_id++;
*part_id= (uint32)loc_part_id;
if (loc_part_id == max_partition &&
part_func_value >= range_array[loc_part_id] &&
@ -3409,6 +3406,7 @@ uint32 get_partition_id_range_for_endpoint(partition_info *part_info,
bool include_endpoint)
{
longlong *range_array= part_info->range_int_array;
longlong part_end_val;
uint max_partition= part_info->num_parts - 1;
uint min_part_id= 0, max_part_id= max_partition, loc_part_id;
/* Get the partitioning function value for the endpoint */
@ -3442,46 +3440,45 @@ uint32 get_partition_id_range_for_endpoint(partition_info *part_info,
}
}
if (unsigned_flag)
part_func_value-= 0x8000000000000000ULL;
if (left_endpoint && !include_endpoint)
part_func_value++;
/*
Search for the partition containing part_func_value
(including the right endpoint).
*/
while (max_part_id > min_part_id)
{
loc_part_id= (max_part_id + min_part_id + 1) >> 1;
if (range_array[loc_part_id] <= part_func_value)
loc_part_id= (max_part_id + min_part_id) / 2;
if (range_array[loc_part_id] < part_func_value)
min_part_id= loc_part_id + 1;
else
max_part_id= loc_part_id - 1;
max_part_id= loc_part_id;
}
loc_part_id= max_part_id;
if (loc_part_id < max_partition &&
part_func_value >= range_array[loc_part_id+1])
{
loc_part_id++;
}
/* Adjust for endpoints */
part_end_val= range_array[loc_part_id];
if (left_endpoint)
{
longlong bound= range_array[loc_part_id];
/*
In case of PARTITION p VALUES LESS THAN MAXVALUE
the maximum value is in the current partition.
*/
if (part_func_value > bound ||
(part_func_value == bound &&
(!part_info->defined_max_value || loc_part_id < max_partition)))
if (part_func_value == part_end_val &&
(loc_part_id < max_partition || !part_info->defined_max_value))
loc_part_id++;
}
else
{
if (loc_part_id < max_partition)
{
if (part_func_value == range_array[loc_part_id])
loc_part_id += test(include_endpoint);
else if (part_func_value > range_array[loc_part_id])
loc_part_id++;
}
/* if 'WHERE <= X' and partition is LESS THAN (X) include next partition */
if (include_endpoint && loc_part_id < max_partition &&
part_func_value == part_end_val)
loc_part_id++;
/* Right endpoint, set end after correct partition */
loc_part_id++;
}
DBUG_RETURN(loc_part_id);
@ -6043,8 +6040,7 @@ static bool write_log_drop_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
part_info->first_log_entry= NULL;
build_table_filename(path, sizeof(path) - 1, lpt->db,
lpt->table_name, "", 0);
build_table_filename(tmp_path, sizeof(tmp_path) - 1, lpt->db,
lpt->table_name, "#", 0);
build_table_shadow_filename(tmp_path, sizeof(tmp_path) - 1, lpt);
pthread_mutex_lock(&LOCK_gdl);
if (write_log_dropped_partitions(lpt, &next_entry, (const char*)path,
FALSE))
@ -6100,8 +6096,7 @@ static bool write_log_add_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
build_table_filename(path, sizeof(path) - 1, lpt->db,
lpt->table_name, "", 0);
build_table_filename(tmp_path, sizeof(tmp_path) - 1, lpt->db,
lpt->table_name, "#", 0);
build_table_shadow_filename(tmp_path, sizeof(tmp_path) - 1, lpt);
pthread_mutex_lock(&LOCK_gdl);
if (write_log_dropped_partitions(lpt, &next_entry, (const char*)path,
FALSE))
@ -6326,7 +6321,7 @@ void handle_alter_part_error(ALTER_PARTITION_PARAM_TYPE *lpt,
partition_info *part_info= lpt->part_info;
DBUG_ENTER("handle_alter_part_error");
if (!part_info->first_log_entry &&
if (part_info->first_log_entry &&
execute_ddl_log_entry(current_thd,
part_info->first_log_entry->entry_pos))
{

View file

@ -1674,6 +1674,8 @@ static bool mysql_test_create_table(Prepared_statement *stmt)
{
lex->link_first_table_back(create_table, link_to_local);
create_table->create= TRUE;
/* Base table and temporary table are not in the same name space. */
create_table->skip_temporary= true;
}
if (open_normal_and_derived_tables(stmt->thd, lex->query_tables, 0))

View file

@ -946,6 +946,7 @@ JOIN::optimize()
DBUG_PRINT("info",("Select tables optimized away"));
zero_result_cause= "Select tables optimized away";
tables_list= 0; // All tables resolved
const_tables= tables;
/*
Extract all table-independent conditions and replace the WHERE
clause with them. All other conditions were computed by opt_sum_query

View file

@ -718,6 +718,12 @@ public:
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table,
table->write_set);
int res= item->save_in_field(to_field, 1);
/*
Item::save_in_field() may call Item::val_xxx(). And if this is a subquery
we need to check for errors executing it and react accordingly
*/
if (!res && table->in_use->is_error())
res= 2;
dbug_tmp_restore_column_map(table->write_set, old_map);
null_key= to_field->is_null() || item->null_value;
return (err != 0 || res > 2 ? STORE_KEY_FATAL : (store_key_result) res);
@ -751,6 +757,12 @@ protected:
if (!err)
err= res;
}
/*
Item::save_in_field() may call Item::val_xxx(). And if this is a subquery
we need to check for errors executing it and react accordingly
*/
if (!err && to_field->table->in_use->is_error())
err= 2;
}
null_key= to_field->is_null() || item->null_value;
return (err > 2 ? STORE_KEY_FATAL : (store_key_result) err);

View file

@ -748,8 +748,7 @@ bool mysqld_show_create_db(THD *thd, char *dbname,
DBUG_RETURN(TRUE);
}
#endif
if (!my_strcasecmp(system_charset_info, dbname,
INFORMATION_SCHEMA_NAME.str))
if (is_schema_db(dbname))
{
dbname= INFORMATION_SCHEMA_NAME.str;
create.default_table_charset= system_charset_info;
@ -2703,8 +2702,8 @@ int make_db_list(THD *thd, List<LEX_STRING> *files,
*/
if (lookup_field_vals->db_value.str)
{
if (!my_strcasecmp(system_charset_info, INFORMATION_SCHEMA_NAME.str,
lookup_field_vals->db_value.str))
if (is_schema_db(lookup_field_vals->db_value.str,
lookup_field_vals->db_value.length))
{
*with_i_schema= 1;
if (files->push_back(i_s_name_copy))
@ -5333,7 +5332,7 @@ copy_event_to_schema_table(THD *thd, TABLE *sch_table, TABLE *event_table)
*/
if (thd->lex->sql_command != SQLCOM_SHOW_EVENTS &&
check_access(thd, EVENT_ACL, et.dbname.str, 0, 0, 1,
is_schema_db(et.dbname.str)))
is_schema_db(et.dbname.str, et.dbname.length)))
DBUG_RETURN(0);
sch_table->field[ISE_EVENT_CATALOG]->store(STRING_WITH_LEN("def"), scs);

View file

@ -647,7 +647,7 @@ static bool read_ddl_log_file_entry(uint entry_no)
Write one entry from ddl log file
SYNOPSIS
write_ddl_log_file_entry()
entry_no Entry number to read
entry_no Entry number to write
RETURN VALUES
TRUE Error
FALSE Success
@ -748,10 +748,10 @@ static uint read_ddl_log_header()
else
successful_open= TRUE;
}
entry_no= uint4korr(&file_entry_buf[DDL_LOG_NUM_ENTRY_POS]);
global_ddl_log.name_len= uint4korr(&file_entry_buf[DDL_LOG_NAME_LEN_POS]);
if (successful_open)
{
entry_no= uint4korr(&file_entry_buf[DDL_LOG_NUM_ENTRY_POS]);
global_ddl_log.name_len= uint4korr(&file_entry_buf[DDL_LOG_NAME_LEN_POS]);
global_ddl_log.io_size= uint4korr(&file_entry_buf[DDL_LOG_IO_SIZE_POS]);
DBUG_ASSERT(global_ddl_log.io_size <=
sizeof(global_ddl_log.file_entry_buf));
@ -832,6 +832,7 @@ static bool init_ddl_log()
goto end;
global_ddl_log.io_size= IO_SIZE;
global_ddl_log.name_len= FN_LEN;
create_ddl_log_file_name(file_name);
if ((global_ddl_log.file_id= my_create(file_name,
CREATE_MODE,
@ -884,6 +885,13 @@ static int execute_ddl_log_action(THD *thd, DDL_LOG_ENTRY *ddl_log_entry)
{
DBUG_RETURN(FALSE);
}
DBUG_PRINT("ddl_log",
("execute type %c next %u name '%s' from_name '%s' handler '%s'",
ddl_log_entry->action_type,
ddl_log_entry->next_entry,
ddl_log_entry->name,
ddl_log_entry->from_name,
ddl_log_entry->handler_name));
handler_name.str= (char*)ddl_log_entry->handler_name;
handler_name.length= strlen(ddl_log_entry->handler_name);
init_sql_alloc(&mem_root, TABLE_ALLOC_BLOCK_SIZE, 0);
@ -1091,6 +1099,15 @@ bool write_ddl_log_entry(DDL_LOG_ENTRY *ddl_log_entry,
DBUG_RETURN(TRUE);
}
error= FALSE;
DBUG_PRINT("ddl_log",
("write type %c next %u name '%s' from_name '%s' handler '%s'",
(char) global_ddl_log.file_entry_buf[DDL_LOG_ACTION_TYPE_POS],
ddl_log_entry->next_entry,
(char*) &global_ddl_log.file_entry_buf[DDL_LOG_NAME_POS],
(char*) &global_ddl_log.file_entry_buf[DDL_LOG_NAME_POS
+ FN_LEN],
(char*) &global_ddl_log.file_entry_buf[DDL_LOG_NAME_POS
+ (2*FN_LEN)]));
if (write_ddl_log_file_entry((*active_entry)->entry_pos))
{
error= TRUE;

View file

@ -268,11 +268,11 @@ bool create_view_precheck(THD *thd, TABLE_LIST *tables, TABLE_LIST *view,
table (i.e. user will not get some privileges by view creation)
*/
if ((check_access(thd, CREATE_VIEW_ACL, view->db, &view->grant.privilege,
0, 0, is_schema_db(view->db)) ||
0, 0, is_schema_db(view->db, view->db_length)) ||
check_grant(thd, CREATE_VIEW_ACL, view, FALSE, 1, FALSE)) ||
(mode != VIEW_CREATE_NEW &&
(check_access(thd, DROP_ACL, view->db, &view->grant.privilege,
0, 0, is_schema_db(view->db)) ||
0, 0, is_schema_db(view->db, view->db_length)) ||
check_grant(thd, DROP_ACL, view, FALSE, 1, FALSE))))
goto err;

View file

@ -9282,25 +9282,24 @@ interval:
;
interval_time_stamp:
interval_time_st {}
| FRAC_SECOND_SYM
{
$$=INTERVAL_MICROSECOND;
/*
FRAC_SECOND was mistakenly implemented with
a wrong resolution. According to the ODBC
standard it should be nanoseconds, not
microseconds. Changing it to nanoseconds
in MySQL would mean making TIMESTAMPDIFF
and TIMESTAMPADD to return DECIMAL, since
the return value would be too big for BIGINT
Hence we just deprecate the incorrect
implementation without changing its
resolution.
*/
WARN_DEPRECATED(yythd, "6.2", "FRAC_SECOND", "MICROSECOND");
}
;
interval_time_st {}
| FRAC_SECOND_SYM {
$$=INTERVAL_MICROSECOND;
/*
FRAC_SECOND was mistakenly implemented with
a wrong resolution. According to the ODBC
standard it should be nanoseconds, not
microseconds. Changing it to nanoseconds
in MySQL would mean making TIMESTAMPDIFF
and TIMESTAMPADD to return DECIMAL, since
the return value would be too big for BIGINT
Hence we just deprecate the incorrect
implementation without changing its
resolution.
*/
WARN_DEPRECATED(yythd, VER_CELOSIA, "FRAC_SECOND", "MICROSECOND");
}
;
interval_time_st:
DAY_SYM { $$=INTERVAL_DAY; }

View file

@ -212,10 +212,7 @@ TABLE_CATEGORY get_table_category(const LEX_STRING *db, const LEX_STRING *name)
DBUG_ASSERT(db != NULL);
DBUG_ASSERT(name != NULL);
if ((db->length == INFORMATION_SCHEMA_NAME.length) &&
(my_strcasecmp(system_charset_info,
INFORMATION_SCHEMA_NAME.str,
db->str) == 0))
if (is_schema_db(db->str, db->length))
{
return TABLE_CATEGORY_INFORMATION;
}

View file

@ -1513,7 +1513,7 @@ int ha_archive::info(uint flag)
stats.create_time= (ulong) file_stat.st_ctime;
stats.update_time= (ulong) file_stat.st_mtime;
stats.mean_rec_length= stats.records ?
stats.data_file_length / stats.records : table->s->reclength;
ulong(stats.data_file_length / stats.records) : table->s->reclength;
stats.max_data_file_length= MAX_FILE_SIZE;
}
stats.delete_length= 0;

View file

@ -178,22 +178,22 @@ public:
/**
* Check if table name has changed, for event TE_ALTER
*/
const bool tableNameChanged() const;
bool tableNameChanged() const;
/**
* Check if table frm has changed, for event TE_ALTER
*/
const bool tableFrmChanged() const;
bool tableFrmChanged() const;
/**
* Check if table fragmentation has changed, for event TE_ALTER
*/
const bool tableFragmentationChanged() const;
bool tableFragmentationChanged() const;
/**
* Check if table range partition list name has changed, for event TE_ALTER
*/
const bool tableRangeListChanged() const;
bool tableRangeListChanged() const;
/**
* Retrieve the GCI of the latest retrieved event

View file

@ -779,7 +779,7 @@ public:
/**
* Get the type of access for this operation
*/
const Type getType() const;
Type getType() const;
/** @} *********************************************************************/
@ -1135,7 +1135,7 @@ Return Value Return the Type.
Remark: Gets type of access.
******************************************************************************/
inline
const NdbOperation::Type
NdbOperation::Type
NdbOperation::getType() const
{
return m_type;

View file

@ -96,22 +96,22 @@ NdbEventOperation::hasError() const
return m_impl.m_has_error;
}
const bool NdbEventOperation::tableNameChanged() const
bool NdbEventOperation::tableNameChanged() const
{
return m_impl.tableNameChanged();
}
const bool NdbEventOperation::tableFrmChanged() const
bool NdbEventOperation::tableFrmChanged() const
{
return m_impl.tableFrmChanged();
}
const bool NdbEventOperation::tableFragmentationChanged() const
bool NdbEventOperation::tableFragmentationChanged() const
{
return m_impl.tableFragmentationChanged();
}
const bool NdbEventOperation::tableRangeListChanged() const
bool NdbEventOperation::tableRangeListChanged() const
{
return m_impl.tableRangeListChanged();
}

View file

@ -658,22 +658,22 @@ NdbEventOperationImpl::stop()
DBUG_RETURN(r);
}
const bool NdbEventOperationImpl::tableNameChanged() const
bool NdbEventOperationImpl::tableNameChanged() const
{
return (bool)AlterTableReq::getNameFlag(m_change_mask);
}
const bool NdbEventOperationImpl::tableFrmChanged() const
bool NdbEventOperationImpl::tableFrmChanged() const
{
return (bool)AlterTableReq::getFrmFlag(m_change_mask);
}
const bool NdbEventOperationImpl::tableFragmentationChanged() const
bool NdbEventOperationImpl::tableFragmentationChanged() const
{
return (bool)AlterTableReq::getFragDataFlag(m_change_mask);
}
const bool NdbEventOperationImpl::tableRangeListChanged() const
bool NdbEventOperationImpl::tableRangeListChanged() const
{
return (bool)AlterTableReq::getRangeListFlag(m_change_mask);
}

View file

@ -361,10 +361,10 @@ public:
NdbBlob *getBlobHandle(const NdbColumnImpl *, int n);
int readBlobParts(char* buf, NdbBlob* blob, Uint32 part, Uint32 count);
int receive_event();
const bool tableNameChanged() const;
const bool tableFrmChanged() const;
const bool tableFragmentationChanged() const;
const bool tableRangeListChanged() const;
bool tableNameChanged() const;
bool tableFrmChanged() const;
bool tableFragmentationChanged() const;
bool tableRangeListChanged() const;
Uint64 getGCI();
Uint32 getAnyValue() const;
Uint64 getLatestGCI();