10.0-base -> 10.0-monty

This commit is contained in:
Sergei Golubchik 2012-10-19 20:38:59 +02:00
commit e1f681c99b
1113 changed files with 65345 additions and 8576 deletions

View File

@ -1096,7 +1096,6 @@ CPackSourceConfig.cmake
Docs/INFO_BIN
Docs/INFO_SRC
tags
sql/.empty
Testing
info_macros.cmake
VERSION.dep
@ -1136,6 +1135,7 @@ plugin/handler_socket/perl-Net-HandlerSocket/Makefile.PL
libmysqld/libmysqld_exports_file.cc
libmysqld/gcalc_slicescan.cc
libmysqld/gcalc_tools.cc
libmysqld/my_apc.cc
sql/share/errmsg.sys
sql/share/mysql
install_manifest.txt

View File

@ -21,6 +21,12 @@ extra_configs="$extra_configs $local_infile_configs $EXTRA_CONFIGS"
configure="./configure $base_configs $extra_configs"
if test "$just_print" = "1" -a "$just_configure" = "1"
then
just_print=""
configure="$configure --print"
fi
commands="\
/bin/rm -rf configure;
/bin/rm -rf CMakeCache.txt CMakeFiles/

View File

@ -139,7 +139,7 @@ else
# C warnings
c_warnings="$warnings"
# C++ warnings
cxx_warnings="$warnings -Wno-unused-parameter"
cxx_warnings="$warnings -Wno-unused-parameter -Wno-invalid-offsetof"
# cxx_warnings="$cxx_warnings -Woverloaded-virtual -Wsign-promo"
cxx_warnings="$cxx_warnings -Wnon-virtual-dtor"
debug_extra_cflags="-O0 -g3 -gdwarf-2"

View File

@ -285,6 +285,7 @@ IF(WITH_UNIT_TESTS)
ADD_SUBDIRECTORY(unittest/strings)
ADD_SUBDIRECTORY(unittest/examples)
ADD_SUBDIRECTORY(unittest/mysys)
ADD_SUBDIRECTORY(unittest/sql)
ENDIF()
IF(NOT WITHOUT_SERVER)
@ -300,14 +301,16 @@ ADD_SUBDIRECTORY(vio)
ADD_SUBDIRECTORY(regex)
ADD_SUBDIRECTORY(mysys)
ADD_SUBDIRECTORY(libmysql)
ADD_SUBDIRECTORY(client)
ADD_SUBDIRECTORY(extra)
ADD_SUBDIRECTORY(libservices)
ADD_SUBDIRECTORY(scripts)
ADD_SUBDIRECTORY(sql/share)
ADD_SUBDIRECTORY(support-files)
IF(NOT WITHOUT_SERVER)
ADD_SUBDIRECTORY(tests)
ADD_SUBDIRECTORY(client)
ADD_SUBDIRECTORY(sql)
ADD_SUBDIRECTORY(sql/share)
ADD_SUBDIRECTORY(libservices)
OPTION (WITH_EMBEDDED_SERVER "Compile MySQL with embedded server" OFF)
IF(WITH_EMBEDDED_SERVER)
ADD_SUBDIRECTORY(libmysqld)
@ -316,12 +319,11 @@ IF(NOT WITHOUT_SERVER)
ADD_SUBDIRECTORY(mysql-test)
ADD_SUBDIRECTORY(mysql-test/lib/My/SafeProcess)
ADD_SUBDIRECTORY(support-files)
ADD_SUBDIRECTORY(scripts)
ADD_SUBDIRECTORY(sql-bench)
IF(UNIX)
ADD_SUBDIRECTORY(man)
ENDIF()
ENDIF()
IF(UNIX)
ADD_SUBDIRECTORY(man)
ENDIF()
INCLUDE(cmake/abi_check.cmake)

View File

@ -23,10 +23,6 @@
#include <m_string.h>
#include <m_ctype.h>
#if defined(HAVE_BROKEN_GETPASS) && !defined(HAVE_GETPASSPHRASE)
#undef HAVE_GETPASS
#endif
#ifdef HAVE_GETPASS
#ifdef HAVE_PWD_H
#include <pwd.h>

View File

@ -897,6 +897,7 @@ static COMMANDS commands[] = {
{ "LAST_INSERT_ID", 0, 0, 0, ""},
{ "ISSIMPLE", 0, 0, 0, ""},
{ "LAST_DAY", 0, 0, 0, ""},
{ "LAST_VALUE", 0, 0, 0, ""},
{ "LCASE", 0, 0, 0, ""},
{ "LEAST", 0, 0, 0, ""},
{ "LENGTH", 0, 0, 0, ""},

View File

@ -23,7 +23,7 @@
#include <mysql.h>
#include <sql_common.h>
#define ADMIN_VERSION "9.0"
#define ADMIN_VERSION "9.1"
#define MAX_MYSQL_VAR 512
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
#define MAX_TRUNC_LENGTH 3
@ -97,6 +97,7 @@ enum commands {
ADMIN_FLUSH_HOSTS, ADMIN_FLUSH_TABLES, ADMIN_PASSWORD,
ADMIN_PING, ADMIN_EXTENDED_STATUS, ADMIN_FLUSH_STATUS,
ADMIN_FLUSH_PRIVILEGES, ADMIN_START_SLAVE, ADMIN_STOP_SLAVE,
ADMIN_START_ALL_SLAVES, ADMIN_STOP_ALL_SLAVES,
ADMIN_FLUSH_THREADS, ADMIN_OLD_PASSWORD, ADMIN_FLUSH_SLOW_LOG,
ADMIN_FLUSH_TABLE_STATISTICS, ADMIN_FLUSH_INDEX_STATISTICS,
ADMIN_FLUSH_USER_STATISTICS, ADMIN_FLUSH_CLIENT_STATISTICS,
@ -110,6 +111,7 @@ static const char *command_names[]= {
"flush-hosts", "flush-tables", "password",
"ping", "extended-status", "flush-status",
"flush-privileges", "start-slave", "stop-slave",
"start-all-slaves", "stop-all-slaves",
"flush-threads", "old-password", "flush-slow-log",
"flush-table-statistics", "flush-index-statistics",
"flush-user-statistics", "flush-client-statistics",
@ -1117,26 +1119,67 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
}
case ADMIN_START_SLAVE:
if (mysql_query(mysql, "START SLAVE"))
case ADMIN_START_ALL_SLAVES:
{
my_bool many_slaves= 0;
const char *query= "START SLAVE";
if (command == ADMIN_START_ALL_SLAVES && mariadb_connection(mysql) &&
mysql_get_server_version(mysql) >= 100000)
{
query="START ALL SLAVES";
many_slaves= 1;
}
if (mysql_query(mysql, query))
{
my_printf_error(0, "Error starting slave: %s", error_flags,
mysql_error(mysql));
return -1;
}
else if (!many_slaves || mysql_warning_count(mysql) > 0)
{
if (!option_silent)
puts("Slave('s) started");
}
else
puts("Slave started");
{
if (!option_silent)
puts("No slaves to start");
}
break;
}
case ADMIN_STOP_SLAVE:
if (mysql_query(mysql, "STOP SLAVE"))
case ADMIN_STOP_ALL_SLAVES:
{
const char *query= "STOP SLAVE";
my_bool many_slaves= 0;
if (command == ADMIN_STOP_ALL_SLAVES && mariadb_connection(mysql) &&
mysql_get_server_version(mysql) >= 100000)
{
query="STOP ALL SLAVES";
many_slaves= 1;
}
if (mysql_query(mysql, query))
{
my_printf_error(0, "Error stopping slave: %s", error_flags,
mysql_error(mysql));
return -1;
}
else if (!many_slaves || mysql_warning_count(mysql) > 0)
{
/* We can't detect if there was any slaves to stop with STOP SLAVE */
if (many_slaves && !option_silent)
puts("Slave('s) stopped");
}
else
puts("Slave stopped");
{
if (!option_silent)
puts("All slaves was already stopped");
}
break;
}
case ADMIN_PING:
mysql->reconnect=0; /* We want to know of reconnects */
if (!mysql_ping(mysql))

View File

@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2011, Oracle and/or its affiliates.
Copyright (c) 2012, Monty Program Ab
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
Copyright (c) 2009, 2012, Monty Program Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -743,7 +743,7 @@ print_use_stmt(PRINT_EVENT_INFO* pinfo, const Query_log_event *ev)
return;
// In case of rewrite rule print USE statement for db_to
fprintf(result_file, "use %s%s\n", db_to, pinfo->delimiter);
my_fprintf(result_file, "use %`s%s\n", db_to, pinfo->delimiter);
// Copy the *original* db to pinfo to suppress emiting
// of USE stmts by log_event print-functions.
@ -844,6 +844,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
DBUG_ENTER("process_event");
print_event_info->short_form= short_form;
Exit_status retval= OK_CONTINUE;
IO_CACHE *const head= &print_event_info->head_cache;
/*
Format events are not concerned by --offset and such, we always need to
@ -923,6 +924,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
print_skip_replication_statement(print_event_info, ev);
ev->print(result_file, print_event_info);
}
if (head->error == -1)
goto err;
break;
}
@ -955,8 +958,9 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
{
print_skip_replication_statement(print_event_info, ev);
ce->print(result_file, print_event_info, TRUE);
if (head->error == -1)
goto err;
}
// If this binlog is not 3.23 ; why this test??
if (glob_description_event->binlog_version >= 3)
{
@ -978,6 +982,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
output of Append_block_log_event::print is only a comment.
*/
ev->print(result_file, print_event_info);
if (head->error == -1)
goto err;
if ((retval= load_processor.process((Append_block_log_event*) ev)) !=
OK_CONTINUE)
goto end;
@ -986,6 +992,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
case EXEC_LOAD_EVENT:
{
ev->print(result_file, print_event_info);
if (head->error == -1)
goto err;
Execute_load_log_event *exv= (Execute_load_log_event*)ev;
Create_file_log_event *ce= load_processor.grab_event(exv->file_id);
/*
@ -1003,6 +1011,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
ce->print(result_file, print_event_info, TRUE);
my_free((void*)ce->fname);
delete ce;
if (head->error == -1)
goto err;
}
else
warning("Ignoring Execute_load_log_event as there is no "
@ -1015,6 +1025,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
print_event_info->common_header_len=
glob_description_event->common_header_len;
ev->print(result_file, print_event_info);
if (head->error == -1)
goto err;
if (!remote_opt)
{
ev->free_temp_buf(); // free memory allocated in dump_local_log_entries
@ -1044,6 +1056,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
break;
case BEGIN_LOAD_QUERY_EVENT:
ev->print(result_file, print_event_info);
if (head->error == -1)
goto err;
if ((retval= load_processor.process((Begin_load_query_log_event*) ev)) !=
OK_CONTINUE)
goto end;
@ -1061,6 +1075,12 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
convert_path_to_forward_slashes(fname);
print_skip_replication_statement(print_event_info, ev);
exlq->print(result_file, print_event_info, fname);
if (head->error == -1)
{
if (fname)
my_free(fname);
goto err;
}
}
else
warning("Ignoring Execute_load_query since there is no "
@ -1191,6 +1211,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
default:
print_skip_replication_statement(print_event_info, ev);
ev->print(result_file, print_event_info);
if (head->error == -1)
goto err;
}
}
@ -1354,7 +1376,7 @@ static struct my_option my_options[] =
"Stop reading the binlog at position N. Applies to the last binlog "
"passed on the command line.",
&stop_position, &stop_position, 0, GET_ULL,
REQUIRED_ARG, (ulonglong)(~(my_off_t)0), BIN_LOG_HEADER_SIZE,
REQUIRED_ARG, (longlong)(~(my_off_t)0), BIN_LOG_HEADER_SIZE,
(ulonglong)(~(my_off_t)0), 0, 0, 0},
{"to-last-log", 't', "Requires -R. Will not stop at the end of the \
requested binlog but rather continue printing until the end of the last \
@ -1785,6 +1807,19 @@ static Exit_status check_master_version()
"Master returned '%s'", mysql_error(mysql));
goto err;
}
/*
Announce our capabilities to the server, so it will send us all the events
that we know about.
*/
if (mysql_query(mysql, "SET @mariadb_slave_capability="
STRINGIFY_ARG(MARIA_SLAVE_CAPABILITY_MINE)))
{
error("Could not inform master about capability. Master returned '%s'",
mysql_error(mysql));
goto err;
}
delete glob_description_event;
switch (version) {
case 3:
@ -2324,7 +2359,13 @@ err:
end:
if (fd >= 0)
my_close(fd, MYF(MY_WME));
end_io_cache(file);
/*
Since the end_io_cache() writes to the
file errors may happen.
*/
if (end_io_cache(file))
retval= ERROR_STOP;
return retval;
}

View File

@ -2615,6 +2615,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
if (strcmp(field->name, "View") == 0)
{
char *scv_buff= NULL;
my_ulonglong n_cols;
verbose_msg("-- It's a view, create dummy table for view\n");
@ -2629,8 +2630,8 @@ static uint get_table_structure(char *table, char *db, char *table_type,
the same name in order to satisfy views that depend on this view.
The table will be removed when the actual view is created.
The properties of each column, aside from the data type, are not
preserved in this temporary table, because they are not necessary.
The properties of each column, are not preserved in this temporary
table, because they are not necessary.
This will not be necessary once we can determine dependencies
between views and can simply dump them in the appropriate order.
@ -2657,8 +2658,23 @@ static uint get_table_structure(char *table, char *db, char *table_type,
else
my_free(scv_buff);
if (mysql_num_rows(result))
n_cols= mysql_num_rows(result);
if (0 != n_cols)
{
/*
The actual formula is based on the column names and how the .FRM
files are stored and is too volatile to be repeated here.
Thus we simply warn the user if the columns exceed a limit we
know works most of the time.
*/
if (n_cols >= 1000)
fprintf(stderr,
"-- Warning: Creating a stand-in table for view %s may"
" fail when replaying the dump file produced because "
"of the number of columns exceeding 1000. Exercise "
"caution when replaying the produced dump file.\n",
table);
if (opt_drop)
{
/*
@ -2685,14 +2701,19 @@ static uint get_table_structure(char *table, char *db, char *table_type,
row= mysql_fetch_row(result);
fprintf(sql_file, " %s %s", quote_name(row[0], name_buff, 0),
row[1]);
/*
The actual column type doesn't matter anyway, since the table will
be dropped at run time.
We do tinyint to avoid hitting the row size limit.
*/
fprintf(sql_file, " %s tinyint NOT NULL",
quote_name(row[0], name_buff, 0));
while((row= mysql_fetch_row(result)))
{
/* col name, col type */
fprintf(sql_file, ",\n %s %s",
quote_name(row[0], name_buff, 0), row[1]);
fprintf(sql_file, ",\n %s tinyint NOT NULL",
quote_name(row[0], name_buff, 0));
}
/*
@ -4164,6 +4185,7 @@ static int dump_all_databases()
if (dump_all_tables_in_db(row[0]))
result=1;
}
mysql_free_result(tableres);
if (seen_views)
{
if (mysql_query(mysql, "SHOW DATABASES") ||
@ -4186,6 +4208,7 @@ static int dump_all_databases()
if (dump_all_views_in_db(row[0]))
result=1;
}
mysql_free_result(tableres);
}
return result;
}
@ -4314,8 +4337,6 @@ static int init_dumping(char *database, int init_func(char*))
check_io(md_result_file);
}
}
if (extended_insert)
init_dynamic_string_checked(&extended_row, "", 1024, 1024);
return 0;
} /* init_dumping */
@ -5592,6 +5613,9 @@ int main(int argc, char **argv)
if (opt_alltspcs)
dump_all_tablespaces();
if (extended_insert)
init_dynamic_string_checked(&extended_row, "", 1024, 1024);
if (opt_alldbs)
{
if (!opt_alltspcs && !opt_notspcs)

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
Copyright (c) 2009-2012 Monty Program Ab.
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
Copyright (c) 2009, 2012, Monty Program Ab.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -84,6 +84,8 @@ static my_bool non_blocking_api_enabled= 0;
#define QUERY_SEND_FLAG 1
#define QUERY_REAP_FLAG 2
#define QUERY_PRINT_ORIGINAL_FLAG 4
#ifndef HAVE_SETENV
static int setenv(const char *name, const char *value, int overwrite);
#endif
@ -253,6 +255,8 @@ static void init_re(void);
static int match_re(my_regex_t *, char *);
static void free_re(void);
static char *get_string(char **to_ptr, char **from_ptr,
struct st_command *command);
static int replace(DYNAMIC_STRING *ds_str,
const char *search_str, ulong search_len,
const char *replace_str, ulong replace_len);
@ -342,7 +346,8 @@ enum enum_commands {
Q_ERROR,
Q_SEND, Q_REAP,
Q_DIRTY_CLOSE, Q_REPLACE, Q_REPLACE_COLUMN,
Q_PING, Q_EVAL,
Q_PING, Q_EVAL,
Q_EVALP,
Q_EVAL_RESULT,
Q_ENABLE_QUERY_LOG, Q_DISABLE_QUERY_LOG,
Q_ENABLE_RESULT_LOG, Q_DISABLE_RESULT_LOG,
@ -408,6 +413,7 @@ const char *command_names[]=
"replace_column",
"ping",
"eval",
"evalp",
"eval_result",
/* Enable/disable that the _query_ is logged to result file */
"enable_query_log",
@ -621,6 +627,8 @@ void free_all_replace(){
free_replace_column();
}
void var_set_int(const char* name, int value);
class LogFile {
FILE* m_file;
@ -1275,6 +1283,8 @@ void handle_command_error(struct st_command *command, uint error,
{
DBUG_ENTER("handle_command_error");
DBUG_PRINT("enter", ("error: %d", error));
var_set_int("$sys_errno",sys_errno);
var_set_int("$errno",error);
if (error != 0)
{
int i;
@ -1285,7 +1295,7 @@ void handle_command_error(struct st_command *command, uint error,
"errno: %d",
command->first_word_len, command->query, error, my_errno,
sys_errno);
return;
DBUG_VOID_RETURN;
}
i= match_expected_error(command, error, NULL);
@ -4576,7 +4586,8 @@ void do_wait_for_slave_to_stop(struct st_command *c __attribute__((unused)))
}
void do_sync_with_master2(struct st_command *command, long offset)
void do_sync_with_master2(struct st_command *command, long offset,
const char *connection_name)
{
MYSQL_RES *res;
MYSQL_ROW row;
@ -4587,8 +4598,9 @@ void do_sync_with_master2(struct st_command *command, long offset)
if (!master_pos.file[0])
die("Calling 'sync_with_master' without calling 'save_master_pos'");
sprintf(query_buf, "select master_pos_wait('%s', %ld, %d)",
master_pos.file, master_pos.pos + offset, timeout);
sprintf(query_buf, "select master_pos_wait('%s', %ld, %d, '%s')",
master_pos.file, master_pos.pos + offset, timeout,
connection_name);
if (mysql_query(mysql, query_buf))
die("failed in '%s': %d: %s", query_buf, mysql_errno(mysql),
@ -4648,16 +4660,32 @@ void do_sync_with_master(struct st_command *command)
long offset= 0;
char *p= command->first_argument;
const char *offset_start= p;
char *start, *buff= 0;
start= (char*) "";
if (*offset_start)
{
for (; my_isdigit(charset_info, *p); p++)
offset = offset * 10 + *p - '0';
if(*p && !my_isspace(charset_info, *p))
if (*p && !my_isspace(charset_info, *p) && *p != ',')
die("Invalid integer argument \"%s\"", offset_start);
while (*p && my_isspace(charset_info, *p))
p++;
if (*p == ',')
{
p++;
while (*p && my_isspace(charset_info, *p))
p++;
start= buff= (char*)my_malloc(strlen(p)+1,MYF(MY_WME | MY_FAE));
get_string(&buff, &p, command);
}
command->last_argument= p;
}
do_sync_with_master2(command, offset);
do_sync_with_master2(command, offset, start);
if (buff)
my_free(start);
return;
}
@ -5144,7 +5172,7 @@ typedef struct
static st_error global_error_names[] =
{
{ "<No error>", (uint) -1, "" },
{ "<No error>", -1U, "" },
#include <mysqld_ername.h>
{ 0, 0, 0 }
};
@ -5201,15 +5229,32 @@ const char *get_errname_from_code (uint error_code)
void do_get_errcodes(struct st_command *command)
{
struct st_match_err *to= saved_expected_errors.err;
char *p= command->first_argument;
uint count= 0;
char *next;
DBUG_ENTER("do_get_errcodes");
if (!*p)
if (!*command->first_argument)
die("Missing argument(s) to 'error'");
/* TODO: Potentially, there is a possibility of variables
being expanded twice, e.g.
let $errcodes = 1,\$a;
let $a = 1051;
error $errcodes;
DROP TABLE unknown_table;
...
Got one of the listed errors
But since it requires manual escaping, it does not seem
particularly dangerous or error-prone.
*/
DYNAMIC_STRING ds;
init_dynamic_string(&ds, 0, command->query_len + 64, 256);
do_eval(&ds, command->first_argument, command->end, !is_windows);
char *p= ds.str;
uint count= 0;
char *next;
do
{
char *end;
@ -5265,7 +5310,7 @@ void do_get_errcodes(struct st_command *command)
{
die("The sqlstate definition must start with an uppercase S");
}
else if (*p == 'E')
else if (*p == 'E' || *p == 'W')
{
/* Error name string */
@ -5274,9 +5319,9 @@ void do_get_errcodes(struct st_command *command)
to->type= ERR_ERRNO;
DBUG_PRINT("info", ("ERR_ERRNO: %d", to->code.errnum));
}
else if (*p == 'e')
else if (*p == 'e' || *p == 'w')
{
die("The error name definition must start with an uppercase E");
die("The error name definition must start with an uppercase E or W");
}
else
{
@ -5319,11 +5364,15 @@ void do_get_errcodes(struct st_command *command)
} while (*p);
command->last_argument= p;
command->last_argument= command->first_argument;
while (*command->last_argument)
command->last_argument++;
to->type= ERR_EMPTY; /* End of data */
DBUG_PRINT("info", ("Expected errors: %d", count));
saved_expected_errors.count= count;
dynstr_free(&ds);
DBUG_VOID_RETURN;
}
@ -5335,8 +5384,8 @@ void do_get_errcodes(struct st_command *command)
If string is a '$variable', return the value of the variable.
*/
char *get_string(char **to_ptr, char **from_ptr,
struct st_command *command)
static char *get_string(char **to_ptr, char **from_ptr,
struct st_command *command)
{
char c, sep;
char *to= *to_ptr, *from= *from_ptr, *start=to;
@ -7687,6 +7736,8 @@ void run_query_normal(struct st_connection *cn, struct st_command *command,
*/
if ((counter==0) && do_read_query_result(cn))
{
/* we've failed to collect the result set */
cn->pending= TRUE;
handle_error(command, mysql_errno(mysql), mysql_error(mysql),
mysql_sqlstate(mysql), ds);
goto end;
@ -8271,7 +8322,8 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
/*
Evaluate query if this is an eval command
*/
if (command->type == Q_EVAL || command->type == Q_SEND_EVAL)
if (command->type == Q_EVAL || command->type == Q_SEND_EVAL ||
command->type == Q_EVALP)
{
init_dynamic_string(&eval_query, "", command->query_len+256, 1024);
do_eval(&eval_query, command->query, command->end, FALSE);
@ -8303,10 +8355,20 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
*/
if (!disable_query_log && (flags & QUERY_SEND_FLAG))
{
replace_dynstr_append_mem(ds, query, query_len);
char *print_query= query;
int print_len= query_len;
if (flags & QUERY_PRINT_ORIGINAL_FLAG)
{
print_query= command->query;
print_len= command->end - command->query;
}
replace_dynstr_append_mem(ds, print_query, print_len);
dynstr_append_mem(ds, delimiter, delimiter_length);
dynstr_append_mem(ds, "\n", 1);
}
/* We're done with this flag */
flags &= ~QUERY_PRINT_ORIGINAL_FLAG;
/*
Write the command to the result file before we execute the query
@ -9169,6 +9231,7 @@ int main(int argc, char **argv)
case Q_EVAL_RESULT:
die("'eval_result' command is deprecated");
case Q_EVAL:
case Q_EVALP:
case Q_QUERY_VERTICAL:
case Q_QUERY_HORIZONTAL:
if (command->query == command->query_buf)
@ -9196,6 +9259,9 @@ int main(int argc, char **argv)
flags= QUERY_REAP_FLAG;
}
if (command->type == Q_EVALP)
flags |= QUERY_PRINT_ORIGINAL_FLAG;
/* Check for special property for this query */
display_result_vertically|= (command->type == Q_QUERY_VERTICAL);
@ -9265,7 +9331,7 @@ int main(int argc, char **argv)
select_connection(command);
else
select_connection_name("slave");
do_sync_with_master2(command, 0);
do_sync_with_master2(command, 0, "");
break;
}
case Q_COMMENT:

View File

@ -25,6 +25,7 @@ my $cmakeargs = "";
# Assume this script is in <srcroot>/cmake
my $srcdir = dirname(dirname(abs_path($0)));
my $cmake_install_prefix="";
my $just_print= 0;
# Sets installation directory, bindir, libdir, libexecdir etc
# the equivalent CMake variables are given without prefix
@ -113,6 +114,11 @@ foreach my $option (@ARGV)
system("cmake ${srcdir} -LH");
exit(0);
}
if ($option =~ /print/)
{
$just_print=1;
next;
}
if($option =~ /with-plugins=/)
{
my @plugins= split(/,/, substr($option,13));
@ -223,6 +229,7 @@ foreach my $option (@ARGV)
}
print("configure.pl : calling cmake $srcdir $cmakeargs\n");
exit(0) if ($just_print);
unlink("CMakeCache.txt");
my $rc = system("cmake $srcdir $cmakeargs");
exit($rc);

View File

@ -65,6 +65,7 @@ SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}
SET(CPACK_RPM_PACKAGE_REQUIRES "MariaDB-common")
SET(CPACK_RPM_server_USER_FILELIST "%ignore /etc" "%ignore /etc/init.d")
SET(CPACK_RPM_common_USER_FILELIST "%config(noreplace) /etc/my.cnf")
SET(CPACK_RPM_client_PACKAGE_OBSOLETES "mysql-client MySQL-client MySQL-OurDelta-client")
SET(CPACK_RPM_client_PACKAGE_PROVIDES "MariaDB-client MySQL-client mysql-client")

View File

@ -18,7 +18,7 @@ INCLUDE(CheckCCompilerFlag)
# Setup GCC (GNU C compiler) warning options.
MACRO(SET_MYSQL_MAINTAINER_GNU_C_OPTIONS)
SET(MY_MAINTAINER_WARNINGS
"-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -DFORCE_INIT_OF_VARS")
"-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Wno-invalid-offsetof -DFORCE_INIT_OF_VARS")
CHECK_C_COMPILER_FLAG("-Wno-missing-field-initializers"
HAVE_NO_MISSING_FIELD_INITIALIZERS)

View File

@ -364,4 +364,7 @@ SET(HAVE_SOCKADDR_IN_SIN_LEN CACHE INTERNAL "")
SET(HAVE_SOCKADDR_IN6_SIN6_LEN CACHE INTERNAL "")
SET(HAVE_VALGRIND CACHE INTERNAL "")
SET(HAVE_EVENT_H CACHE INTERNAL "")
SET(HAVE_LINUX_UNISTD_H CACHE INTERNAL "")
SET(HAVE_SYS_UTSNAME_H CACHE INTERNAL "")
SET(HAVE_PTHREAD_ATTR_GETGUARDSIZE CACHE INTERNAL "")
ENDIF()

View File

@ -109,6 +109,8 @@ MACRO (FIND_CURSES)
ENDIF()
ENDIF()
ENDIF()
CHECK_LIBRARY_EXISTS(${CURSES_LIBRARY} setupterm "" HAVE_SETUPTERM)
CHECK_LIBRARY_EXISTS(${CURSES_LIBRARY} vidattr "" HAVE_VIDATTR)
ENDMACRO()
MACRO (MYSQL_USE_BUNDLED_READLINE)

View File

@ -46,6 +46,7 @@
#cmakedefine HAVE_IEEEFP_H 1
#cmakedefine HAVE_INTTYPES_H 1
#cmakedefine HAVE_LIMITS_H 1
#cmakedefine HAVE_LINUX_UNISTD_H 1
#cmakedefine HAVE_LOCALE_H 1
#cmakedefine HAVE_MALLOC_H 1
#cmakedefine HAVE_MEMORY_H 1
@ -83,6 +84,7 @@
#cmakedefine HAVE_SYS_SHM_H 1
#cmakedefine HAVE_SYS_SOCKET_H 1
#cmakedefine HAVE_SYS_SOCKIO_H 1
#cmakedefine HAVE_SYS_UTSNAME_H 1
#cmakedefine HAVE_SYS_STAT_H 1
#cmakedefine HAVE_SYS_STREAM_H 1
#cmakedefine HAVE_SYS_TERMCAP_H 1
@ -130,6 +132,7 @@
#cmakedefine FIONREAD_IN_SYS_FILIO 1
/* Functions we may want to use. */
#cmakedefine HAVE_ACCESS 1
#cmakedefine HAVE_AIOWAIT 1
#cmakedefine HAVE_ALARM 1
#cmakedefine HAVE_ALLOCA 1
@ -151,6 +154,7 @@
#cmakedefine HAVE_FCONVERT 1
#cmakedefine HAVE_FDATASYNC 1
#cmakedefine HAVE_DECL_FDATASYNC 1
#cmakedefine HAVE_FEDISABLEEXCEPT 1
#cmakedefine HAVE_FESETROUND 1
#cmakedefine HAVE_FINITE 1
#cmakedefine HAVE_FP_EXCEPT 1
@ -175,6 +179,7 @@
#cmakedefine HAVE_GETWD 1
#cmakedefine HAVE_GMTIME_R 1
#cmakedefine gmtime_r @gmtime_r@
#cmakedefine HAVE_IN_ADDR_T 1
#cmakedefine HAVE_INITGROUPS 1
#cmakedefine HAVE_ISSETUGID 1
#cmakedefine HAVE_GETUID 1
@ -215,6 +220,7 @@
#cmakedefine HAVE_RDTSCLL 1
#cmakedefine HAVE_READ_REAL_TIME 1
#cmakedefine HAVE_PTHREAD_ATTR_CREATE 1
#cmakedefine HAVE_PTHREAD_ATTR_GETGUARDSIZE 1
#cmakedefine HAVE_PTHREAD_ATTR_GETSTACKSIZE 1
#cmakedefine HAVE_PTHREAD_ATTR_SETPRIO 1
#cmakedefine HAVE_PTHREAD_ATTR_SETSCHEDPARAM 1
@ -247,6 +253,7 @@
#cmakedefine HAVE_SETFD 1
#cmakedefine HAVE_SETENV 1
#cmakedefine HAVE_SETLOCALE 1
#cmakedefine HAVE_SETUPTERM 1
#cmakedefine HAVE_SIGADDSET 1
#cmakedefine HAVE_SIGEMPTYSET 1
#cmakedefine HAVE_SIGHOLD 1
@ -284,6 +291,7 @@
#cmakedefine HAVE_TIME 1
#cmakedefine HAVE_TIMES 1
#cmakedefine HAVE_VALLOC 1
#cmakedefine HAVE_VIDATTR 1
#define HAVE_VIO_READ_BUFF 1
#cmakedefine HAVE_VASPRINTF 1
#cmakedefine HAVE_VPRINTF 1

View File

@ -56,10 +56,10 @@ ENDIF()
# Always enable -Wall for gnu C/C++
IF(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_CXX_FLAGS MATCHES ".*-Wall.*")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-unused-parameter")
SET(CMAKE_CXX_FLAGS "-Wall ${CMAKE_CXX_FLAGS} -Wall -Wno-unused-parameter")
ENDIF()
IF(CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_C_FLAGS MATCHES ".*-Wall.*")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
SET(CMAKE_C_FLAGS "-Wall ${CMAKE_C_FLAGS} -Wall")
ENDIF()
@ -195,6 +195,7 @@ CHECK_INCLUDE_FILES (grp.h HAVE_GRP_H)
CHECK_INCLUDE_FILES (ieeefp.h HAVE_IEEEFP_H)
CHECK_INCLUDE_FILES (inttypes.h HAVE_INTTYPES_H)
CHECK_INCLUDE_FILES (langinfo.h HAVE_LANGINFO_H)
CHECK_INCLUDE_FILES (linux/unistd.h HAVE_LINUX_UNISTD_H)
CHECK_INCLUDE_FILES (limits.h HAVE_LIMITS_H)
CHECK_INCLUDE_FILES (locale.h HAVE_LOCALE_H)
CHECK_INCLUDE_FILES (malloc.h HAVE_MALLOC_H)
@ -254,6 +255,7 @@ CHECK_INCLUDE_FILES (vis.h HAVE_VIS_H)
CHECK_INCLUDE_FILES (wchar.h HAVE_WCHAR_H)
CHECK_INCLUDE_FILES (wctype.h HAVE_WCTYPE_H)
CHECK_INCLUDE_FILES (sys/sockio.h HAVE_SYS_SOCKIO_H)
CHECK_INCLUDE_FILES (sys/utsname.h HAVE_SYS_UTSNAME_H)
IF(BFD_H_EXISTS)
IF(NOT_FOR_DISTRIBUTION)
@ -319,6 +321,7 @@ ENDIF()
#
# Tests for functions
#
CHECK_FUNCTION_EXISTS (access HAVE_ACCESS)
#CHECK_FUNCTION_EXISTS (aiowait HAVE_AIOWAIT)
CHECK_FUNCTION_EXISTS (aio_read HAVE_AIO_READ)
CHECK_FUNCTION_EXISTS (alarm HAVE_ALARM)
@ -547,6 +550,10 @@ IF(NOT SIZEOF_MODE_T)
SET(mode_t int)
ENDIF()
IF(HAVE_NETINET_IN_H)
SET(CMAKE_EXTRA_INCLUDE_FILES netinet/in.h)
MY_CHECK_TYPE_SIZE(in_addr_t IN_ADDR_T)
ENDIF(HAVE_NETINET_IN_H)
IF(HAVE_STDINT_H)
SET(CMAKE_EXTRA_INCLUDE_FILES stdint.h)

View File

@ -284,9 +284,6 @@ static int DoTrace(CODE_STATE *cs);
/* Test to see if file is writable */
#if defined(HAVE_ACCESS)
static BOOLEAN Writable(const char *pathname);
/* Change file owner and group */
static void ChangeOwner(CODE_STATE *cs, char *pathname);
/* Allocate memory for runtime support */
#endif
static void DoPrefix(CODE_STATE *cs, uint line);

View File

@ -1,14 +1,3 @@
#ifdef DBUG_OFF /* We are testing dbug */
int factorial(register int value) {
if(value > 1) {
value *= factorial(value-1);
}
return value;
}
#else
#include <my_global.h>
int factorial (
@ -22,6 +11,3 @@ register int value)
DBUG_PRINT ("result", ("result is %d", value));
DBUG_RETURN (value);
}
#endif

View File

@ -65,7 +65,7 @@ max_heap_table_size = 32M
myisam_recover = BACKUP
key_buffer_size = 128M
#open-files-limit = 2000
table_cache = 400
table_open_cache = 400
myisam_sort_buffer_size = 512M
concurrent_insert = 2
read_buffer_size = 2M

View File

@ -37,6 +37,11 @@ case "${CODENAME}" in
*) LIBREADLINE_DEV=libreadline-gplv2-dev ;;
esac
case "${CODENAME}" in
etch|lenny|hardy|intrepid|jaunty|karmic) CMAKE_DEP='' ;;
*) CMAKE_DEP='cmake (>= 2.7), ' ;;
esac
# Clean up build file symlinks that are distro-specific. First remove all, then set
# new links.
DISTRODIRS="$(ls ./debian/dist)"
@ -53,7 +58,9 @@ echo "Copying distribution specific build files for ${DISTRO}"
DISTROFILES="$(ls ./debian/dist/${DISTRO})"
for distrofile in ${DISTROFILES}; do
rm -f "./debian/${distrofile}"
sed -e "s/\\\${LIBREADLINE_DEV}/${LIBREADLINE_DEV}/g" < "./debian/dist/${DISTRO}/${distrofile}" > "./debian/${distrofile}"
sed -e "s/\\\${LIBREADLINE_DEV}/${LIBREADLINE_DEV}/g" \
-e "s/\\\${CMAKE_DEP}/${CMAKE_DEP}/g" \
< "./debian/dist/${DISTRO}/${distrofile}" > "./debian/${distrofile}"
chmod --reference="./debian/dist/${DISTRO}/${distrofile}" "./debian/${distrofile}"
done;

View File

@ -4,7 +4,7 @@ Priority: optional
Maintainer: MariaDB Developers <maria-developers@lists.launchpad.net>
XSBC-Original-Maintainer: Maria Developers <maria-developers@lists.launchpad.net>
Uploaders: MariaDB Developers <maria-developers@lists.launchpad.net>
Build-Depends: libtool (>= 1.4.2-7), procps | hurd, debhelper, file (>= 3.28), libncurses5-dev (>= 5.0-6), perl (>= 5.6.0), libwrap0-dev (>= 7.6-8.3), zlib1g-dev (>= 1:1.1.3-5), ${LIBREADLINE_DEV}, libevent-dev, libssl-dev, libpam0g-dev, psmisc, po-debconf, chrpath, automake1.9, doxygen, texlive-latex-base, ghostscript | gs-gpl, dpatch, gawk, bison, lsb-release, hardening-wrapper
Build-Depends: libtool (>= 1.4.2-7), procps | hurd, debhelper, file (>= 3.28), libncurses5-dev (>= 5.0-6), perl (>= 5.6.0), libwrap0-dev (>= 7.6-8.3), zlib1g-dev (>= 1:1.1.3-5), ${LIBREADLINE_DEV}, libevent-dev, libssl-dev, libpam0g-dev, psmisc, po-debconf, chrpath, automake1.9, doxygen, texlive-latex-base, ghostscript | gs-gpl, dpatch, gawk, bison, lsb-release, hardening-wrapper, ${CMAKE_DEP}libaio-dev
Standards-Version: 3.8.3
Homepage: http://mariadb.org/
Vcs-Browser: http://bazaar.launchpad.net/~maria-captains/maria/5.5/files

View File

@ -21,7 +21,7 @@ invoke() {
fi
}
MYSQL_BOOTSTRAP="/usr/sbin/mysqld --bootstrap --user=mysql --skip-grant-tables --loose-innodb=OFF --loose-pbxt=OFF --default-storage-engine=myisam"
MYSQL_BOOTSTRAP="/usr/sbin/mysqld --bootstrap --user=mysql --skip-grant-tables --loose-innodb=OFF --default-storage-engine=myisam"
test_mysql_access() {
mysql --no-defaults -u root -h localhost </dev/null >/dev/null 2>&1
@ -212,7 +212,7 @@ EOF
# admin might already have chosen to remove one or more plugins. Newlines are necessary.
install_plugins=`/bin/echo -e \
"USE mysql;\n" \
"CREATE TABLE plugin (name char(64) COLLATE utf8_bin NOT NULL DEFAULT '', " \
"CREATE TABLE IF NOT EXISTS plugin (name char(64) COLLATE utf8_bin NOT NULL DEFAULT '', " \
" dl char(128) COLLATE utf8_bin NOT NULL DEFAULT '', " \
" PRIMARY KEY (name)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='MySQL plugins';" `

View File

@ -4,7 +4,7 @@ Priority: optional
Maintainer: MariaDB Developers <maria-developers@lists.launchpad.net>
XSBC-Original-Maintainer: Maria Developers <maria-developers@lists.launchpad.net>
Uploaders: MariaDB Developers <maria-developers@lists.launchpad.net>
Build-Depends: libtool (>= 1.4.2-7), procps | hurd, debhelper, file (>= 3.28), libncurses5-dev (>= 5.0-6), perl (>= 5.6.0), libwrap0-dev (>= 7.6-8.3), zlib1g-dev (>= 1:1.1.3-5), ${LIBREADLINE_DEV}, libevent-dev, libssl-dev, libpam0g-dev, psmisc, po-debconf, chrpath, automake1.9, doxygen, texlive-latex-base, ghostscript | gs-gpl, dpatch, gawk, bison, lsb-release, hardening-wrapper
Build-Depends: libtool (>= 1.4.2-7), procps | hurd, debhelper, file (>= 3.28), libncurses5-dev (>= 5.0-6), perl (>= 5.6.0), libwrap0-dev (>= 7.6-8.3), zlib1g-dev (>= 1:1.1.3-5), ${LIBREADLINE_DEV}, libevent-dev, libssl-dev, libpam0g-dev, psmisc, po-debconf, chrpath, automake1.9, doxygen, texlive-latex-base, ghostscript | gs-gpl, dpatch, gawk, bison, lsb-release, hardening-wrapper, ${CMAKE_DEP}libaio-dev
Standards-Version: 3.8.2
Homepage: http://mariadb.org/
Vcs-Browser: http://bazaar.launchpad.net/~maria-captains/maria/5.5/files

View File

@ -21,7 +21,7 @@ invoke() {
fi
}
MYSQL_BOOTSTRAP="/usr/sbin/mysqld --bootstrap --user=mysql --skip-grant-tables --loose-innodb=OFF --loose-pbxt=OFF --default-storage-engine=myisam"
MYSQL_BOOTSTRAP="/usr/sbin/mysqld --bootstrap --user=mysql --skip-grant-tables --loose-innodb=OFF --default-storage-engine=myisam"
test_mysql_access() {
mysql --no-defaults -u root -h localhost </dev/null >/dev/null 2>&1

View File

@ -11,6 +11,7 @@ usr/bin/mysqlimport
usr/bin/mysqlreport
usr/bin/mysqlshow
usr/bin/mysqlslap
usr/bin/mytop
usr/bin/mysql_waitpid
usr/share/lintian/overrides/mariadb-client-5.5
usr/share/man/man1/innotop.1

View File

@ -109,7 +109,7 @@ case "${1:-''}" in
/usr/bin/mysqld_safe > /dev/null 2>&1 &
# 6s was reported in #352070 to be too few when using ndbcluster
for i in $(seq 1 "${MYSQLD_STARTUP_TIMEOUT:-14}"); do
for i in $(seq 1 "${MYSQLD_STARTUP_TIMEOUT:-30}"); do
sleep 1
if mysqld_status check_alive nowarn ; then break; fi
log_progress_msg "."
@ -142,7 +142,7 @@ case "${1:-''}" in
log_daemon_msg "Killing MariaDB database server by signal" "mysqld"
killall -15 mysqld
server_down=
for i in 1 2 3 4 5 6 7 8 9 10; do
for i in 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10; do
sleep 1
if mysqld_status check_dead nowarn; then server_down=1; break; fi
done

View File

@ -25,9 +25,7 @@
#ifndef WIN32
# include <sys/types.h>
# include <sys/socket.h>
# ifndef HAVE_BROKEN_NETINET_INCLUDES
# include <netinet/in.h>
# endif
# include <netinet/in.h>
# include <arpa/inet.h>
# include <netdb.h>
#endif

View File

@ -766,6 +766,10 @@ void CertDecoder::GetName(NameType nt)
while (source_.get_index() < length) {
GetSet();
if (source_.GetError().What() == SET_E) {
source_.SetError(NO_ERROR_E); // extensions may only have sequence
source_.prev();
}
GetSequence();
byte b = source_.next();

View File

@ -184,7 +184,7 @@ word32 DSA_Signer::Sign(const byte* sha_digest, byte* sig,
s_ = (kInv * (H + x*r_)) % q;
if (!(!!r_ && !!s_))
return -1;
return (word32) -1;
int rSz = r_.ByteCount();

View File

@ -52,6 +52,7 @@ SET(HEADERS
m_ctype.h
my_attribute.h
my_compiler.h
handler_state.h
)
INSTALL(FILES ${HEADERS} DESTINATION ${INSTALL_INCLUDEDIR} COMPONENT Development)

View File

@ -36,7 +36,7 @@
choose the Solaris implementation on Solaris (mainly for SunStudio
compilers).
*/
# if defined(_MSV_VER)
# if defined(_MSC_VER)
# include "generic-msvc.h"
# elif __GNUC__
# if defined(HAVE_SOLARIS_ATOMIC)

21
include/handler_state.h Normal file
View File

@ -0,0 +1,21 @@
/*
Map handler error message to sql states. Note that this list MUST be in
increasing order!
See sql_state.c for usage
*/
{ HA_ERR_KEY_NOT_FOUND, "02000", "" },
{ HA_ERR_FOUND_DUPP_KEY, "23000", "" },
{ HA_ERR_WRONG_COMMAND, "0A000", "" },
{ HA_ERR_UNSUPPORTED, "0A000", "" },
{ HA_WRONG_CREATE_OPTION, "0A000", "" },
{ HA_ERR_FOUND_DUPP_UNIQUE, "23000", "" },
{ HA_ERR_UNKNOWN_CHARSET, "0A000", "" },
{ HA_ERR_READ_ONLY_TRANSACTION, "25000", "" },
{ HA_ERR_LOCK_DEADLOCK, "40001", "" },
{ HA_ERR_NO_REFERENCED_ROW, "23000", "" },
{ HA_ERR_ROW_IS_REFERENCED, "23000", "" },
{ HA_ERR_TABLE_EXIST, "42S01", "" },
{ HA_ERR_FOREIGN_DUPLICATE_KEY, "23000", "" },
{ HA_ERR_TABLE_READONLY, "25000", "" },
{ HA_ERR_AUTOINC_ERANGE, "22003", "" },

View File

@ -95,7 +95,7 @@ nolock_wrap(lf_dynarray_iterate, int,
*/
#define LF_PINBOX_PINS 4
#define LF_PURGATORY_SIZE 10
#define LF_PURGATORY_SIZE 100
typedef void lf_pinbox_free_func(void *, void *, void*);

View File

@ -62,13 +62,9 @@
# define bmove_align(A,B,C) memcpy((A),(B),(C))
#if !defined(HAVE_BCMP)
# define bcmp(A,B,C) memcmp((A),(B),(C))
#endif
#if !defined(bzero) && (!defined(HAVE_BZERO) || !HAVE_DECL_BZERO || defined(_AIX))
/* See autoconf doku: "HAVE_DECL_symbol" will be defined after configure, to 0 or 1 */
/* AIX has bzero() as a function, but the declaration prototype is strangely hidden */
#if !defined(bzero)
# define bzero(A,B) memset((A),0,(B))
#endif

View File

@ -1,5 +1,5 @@
/*
Copyright (c) 2002, 2011, Oracle and/or its affiliates.
Copyright (c) 2002, 2012, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -79,7 +79,7 @@ struct my_option
enum get_opt_arg_type arg_type; /**< e.g. REQUIRED_ARG or OPT_ARG */
longlong def_value; /**< Default value */
longlong min_value; /**< Min allowed value (for numbers) */
longlong max_value; /**< Max allowed value (for numbers) */
ulonglong max_value; /**< Max allowed value (for numbers) */
longlong sub_size; /**< Unused */
long block_size; /**< Value should be a mult. of this (for numbers) */
void *app_type; /**< To be used by an application */

View File

@ -218,11 +218,6 @@
#include <sys/types.h>
#endif
#ifdef HAVE_THREADS_WITHOUT_SOCKETS
/* MIT pthreads does not work with unix sockets */
#undef HAVE_SYS_UN_H
#endif
#define __EXTENSIONS__ 1 /* We want some extension */
#ifndef __STDC_EXT__
#define __STDC_EXT__ 1 /* To get large file support on hpux */
@ -295,18 +290,6 @@ inline double my_ulonglong2double(unsigned long long A) { return (double A); }
C_MODE_END
#endif /* _AIX */
#ifdef HAVE_BROKEN_SNPRINTF /* HPUX 10.20 don't have this defined */
#undef HAVE_SNPRINTF
#endif
#ifdef HAVE_BROKEN_PREAD
/*
pread()/pwrite() are not 64 bit safe on HP-UX 11.0 without
installing the kernel patch PHKL_20349 or greater
*/
#undef HAVE_PREAD
#undef HAVE_PWRITE
#endif
#ifdef UNDEF_HAVE_INITGROUPS /* For AIX 4.3 */
#undef HAVE_INITGROUPS
#endif
@ -812,18 +795,7 @@ inline unsigned long long my_double2ulonglong(double d)
#endif
#ifdef HAVE_ISINF
/* Check if C compiler is affected by GCC bug #39228 */
#if !defined(__cplusplus) && defined(HAVE_BROKEN_ISINF)
/* Force store/reload of the argument to/from a 64-bit double */
static inline double my_isinf(double x)
{
volatile double t= x;
return isinf(t);
}
#else
/* System-provided isinf() is available and safe to use */
#define my_isinf(X) isinf(X)
#endif
#else /* !HAVE_ISINF */
#define my_isinf(X) (!finite(X) && !isnan(X))
#endif

View File

@ -43,7 +43,7 @@ C_MODE_START
#include <sys/ioctl.h>
#endif
#if !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES)
#if !defined(__WIN__)
#include <netinet/in_systm.h>
#include <netinet/in.h>
#include <netinet/ip.h>

View File

@ -201,28 +201,13 @@ extern int my_pthread_create_detached;
int sigwait(sigset_t *set, int *sig);
#endif
#ifndef HAVE_NONPOSIX_SIGWAIT
#define my_sigwait(A,B) sigwait((A),(B))
#else
int my_sigwait(const sigset_t *set,int *sig);
#endif
#ifdef HAVE_NONPOSIX_PTHREAD_MUTEX_INIT
#ifndef SAFE_MUTEX
#define pthread_mutex_init(a,b) my_pthread_mutex_noposix_init((a),(b))
extern int my_pthread_mutex_noposix_init(pthread_mutex_t *mp,
const pthread_mutexattr_t *attr);
#endif /* SAFE_MUTEX */
#define pthread_cond_init(a,b) my_pthread_cond_noposix_init((a),(b))
extern int my_pthread_cond_noposix_init(pthread_cond_t *mp,
const pthread_condattr_t *attr);
#endif /* HAVE_NONPOSIX_PTHREAD_MUTEX_INIT */
#if defined(HAVE_SIGTHREADMASK) && !defined(HAVE_PTHREAD_SIGMASK)
#define pthread_sigmask(A,B,C) sigthreadmask((A),(B),(C))
#endif
#if !defined(HAVE_SIGWAIT) && !defined(HAVE_rts_threads) && !defined(sigwait) && !defined(alpha_linux_port) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS) && !defined(_AIX)
#if !defined(HAVE_SIGWAIT) && !defined(HAVE_rts_threads) && !defined(sigwait) && !defined(alpha_linux_port) && !defined(_AIX)
int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */
#endif
@ -248,24 +233,12 @@ int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */
#define my_sigset(A,B) signal((A),(B))
#endif
#if !defined(HAVE_PTHREAD_ATTR_SETSCOPE) || defined(HAVE_DEC_3_2_THREADS)
#if !defined(HAVE_PTHREAD_ATTR_SETSCOPE)
#define pthread_attr_setscope(A,B)
#undef HAVE_GETHOSTBYADDR_R /* No definition */
#endif
#if defined(HAVE_BROKEN_PTHREAD_COND_TIMEDWAIT) && !defined(SAFE_MUTEX)
extern int my_pthread_cond_timedwait(pthread_cond_t *cond,
pthread_mutex_t *mutex,
struct timespec *abstime);
#define pthread_cond_timedwait(A,B,C) my_pthread_cond_timedwait((A),(B),(C))
#endif
#if !defined( HAVE_NONPOSIX_PTHREAD_GETSPECIFIC)
#define my_pthread_getspecific(A,B) ((A) pthread_getspecific(B))
#else
#define my_pthread_getspecific(A,B) ((A) my_pthread_getspecific_imp(B))
void *my_pthread_getspecific_imp(pthread_key_t key);
#endif
#ifndef HAVE_LOCALTIME_R
struct tm *localtime_r(const time_t *clock, struct tm *res);
@ -286,34 +259,7 @@ struct tm *gmtime_r(const time_t *clock, struct tm *res);
#define pthread_key_delete(A) pthread_dummy(0)
#endif
#ifdef HAVE_CTHREADS_WRAPPER /* For MacOSX */
#define pthread_cond_destroy(A) pthread_dummy(0)
#define pthread_mutex_destroy(A) pthread_dummy(0)
#define pthread_attr_delete(A) pthread_dummy(0)
#define pthread_condattr_delete(A) pthread_dummy(0)
#define pthread_attr_setstacksize(A,B) pthread_dummy(0)
#define pthread_equal(A,B) ((A) == (B))
#define pthread_cond_timedwait(a,b,c) pthread_cond_wait((a),(b))
#define pthread_attr_init(A) pthread_attr_create(A)
#define pthread_attr_destroy(A) pthread_attr_delete(A)
#define pthread_attr_setdetachstate(A,B) pthread_dummy(0)
#define pthread_create(A,B,C,D) pthread_create((A),*(B),(C),(D))
#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C))
#define pthread_kill(A,B) pthread_dummy((A) ? 0 : ESRCH)
#undef pthread_detach_this_thread
#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); }
#endif
#ifdef HAVE_DARWIN5_THREADS
#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C))
#define pthread_kill(A,B) pthread_dummy((A) ? 0 : ESRCH)
#define pthread_condattr_init(A) pthread_dummy(0)
#define pthread_condattr_destroy(A) pthread_dummy(0)
#undef pthread_detach_this_thread
#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(tmp); }
#endif
#if ((defined(HAVE_PTHREAD_ATTR_CREATE) && !defined(HAVE_SIGWAIT)) || defined(HAVE_DEC_3_2_THREADS)) && !defined(HAVE_CTHREADS_WRAPPER)
#if defined(HAVE_PTHREAD_ATTR_CREATE) && !defined(HAVE_SIGWAIT)
/* This is set on AIX_3_2 and Siemens unix (and DEC OSF/1 3.2 too) */
#define pthread_key_create(A,B) \
pthread_keycreate(A,(B) ?\
@ -353,7 +299,7 @@ void my_pthread_attr_getstacksize(pthread_attr_t *attrib, size_t *size);
int my_pthread_mutex_trylock(pthread_mutex_t *mutex);
#endif
#if !defined(HAVE_PTHREAD_YIELD_ONE_ARG) && !defined(HAVE_PTHREAD_YIELD_ZERO_ARG)
#if !defined(HAVE_PTHREAD_YIELD_ZERO_ARG)
/* no pthread_yield() available */
#ifdef HAVE_SCHED_YIELD
#define pthread_yield() sched_yield()
@ -514,12 +460,6 @@ int my_pthread_fastmutex_lock(my_pthread_fastmutex_t *mp);
/* READ-WRITE thread locking */
#ifdef HAVE_BROKEN_RWLOCK /* For OpenUnix */
#undef HAVE_PTHREAD_RWLOCK_RDLOCK
#undef HAVE_RWLOCK_INIT
#undef HAVE_RWLOCK_T
#endif
#if defined(USE_MUTEX_INSTEAD_OF_RW_LOCKS)
/* use these defs for simple mutex locking */
#define rw_lock_t pthread_mutex_t

View File

@ -85,6 +85,7 @@ typedef struct my_aio_result {
#define MY_THREADSAFE 2048 /* my_seek(): lock fd mutex */
#define MY_SYNC 4096 /* my_copy(): sync dst file */
#define MY_SYNC_DIR 32768 /* my_create/delete/rename: sync directory */
#define MY_SYNC_FILESIZE 65536 /* my_sync(): safe sync when file is extended */
#define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */
#define MY_GIVE_INFO 2 /* Give time info about process*/
@ -634,6 +635,7 @@ extern FILE *my_freopen(const char *path, const char *mode, FILE *stream);
extern int my_fclose(FILE *fd,myf MyFlags);
extern int my_vfprintf(FILE *stream, const char* format, va_list args);
extern void my_strerror(char *buf, size_t len, int nr);
extern int my_fprintf(FILE *stream, const char* format, ...);
extern File my_fileno(FILE *fd);
extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags);
extern int my_chmod(const char *name, mode_t mode, myf my_flags);
@ -682,6 +684,7 @@ extern my_bool has_path(const char *name);
extern char *convert_dirname(char *to, const char *from, const char *from_end);
extern void to_unix_path(char * name);
extern char * fn_ext(const char *name);
extern char * fn_ext2(const char *name);
extern char * fn_same(char * toname,const char *name,int flag);
extern char * fn_format(char * to,const char *name,const char *dir,
const char *form, uint flag);
@ -717,6 +720,7 @@ extern int flush_write_cache(RECORD_CACHE *info);
extern void handle_recived_signals(void);
extern sig_handler my_set_alarm_variable(int signo);
extern my_bool radixsort_is_appliccable(uint n_items, size_t size_of_element);
extern void my_string_ptr_sort(uchar *base,uint items,size_t size);
extern void radixsort_for_str_ptr(uchar* base[], uint number_of_elements,
size_t size_of_element,uchar *buffer[]);
@ -758,6 +762,8 @@ extern size_t my_b_fill(IO_CACHE *info);
extern void my_b_seek(IO_CACHE *info,my_off_t pos);
extern size_t my_b_gets(IO_CACHE *info, char *to, size_t max_length);
extern my_off_t my_b_filelength(IO_CACHE *info);
extern size_t my_b_write_backtick_quote(IO_CACHE *info, const char *str,
size_t len);
extern size_t my_b_printf(IO_CACHE *info, const char* fmt, ...);
extern size_t my_b_vprintf(IO_CACHE *info, const char* fmt, va_list ap);
extern my_bool open_cached_file(IO_CACHE *cache,const char *dir,

View File

@ -167,7 +167,7 @@ enum enum_mysql_show_type
SHOW_UNDEF, SHOW_BOOL, SHOW_UINT, SHOW_ULONG,
SHOW_ULONGLONG, SHOW_CHAR, SHOW_CHAR_PTR,
SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE,
SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG,
SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG, SHOW_SIMPLE_FUNC,
SHOW_always_last
};

View File

@ -94,7 +94,7 @@ enum enum_mysql_show_type
SHOW_UNDEF, SHOW_BOOL, SHOW_UINT, SHOW_ULONG,
SHOW_ULONGLONG, SHOW_CHAR, SHOW_CHAR_PTR,
SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE,
SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG,
SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG, SHOW_SIMPLE_FUNC,
SHOW_always_last
};
struct st_mysql_show_var {

View File

@ -94,7 +94,7 @@ enum enum_mysql_show_type
SHOW_UNDEF, SHOW_BOOL, SHOW_UINT, SHOW_ULONG,
SHOW_ULONGLONG, SHOW_CHAR, SHOW_CHAR_PTR,
SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE,
SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG,
SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG, SHOW_SIMPLE_FUNC,
SHOW_always_last
};
struct st_mysql_show_var {

View File

@ -94,7 +94,7 @@ enum enum_mysql_show_type
SHOW_UNDEF, SHOW_BOOL, SHOW_UINT, SHOW_ULONG,
SHOW_ULONGLONG, SHOW_CHAR, SHOW_CHAR_PTR,
SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE,
SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG,
SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG, SHOW_SIMPLE_FUNC,
SHOW_always_last
};
struct st_mysql_show_var {

View File

@ -1,7 +1,7 @@
#ifndef SQL_COMMON_INCLUDED
#define SQL_COMMON_INCLUDED
/* Copyright (c) 2003, 2010, Oracle and/or its affiliates.
Copyright (c) 2010, 2011, Monty Program Ab
/* Copyright (c) 2003, 2012, Oracle and/or its affiliates.
Copyright (c) 2010, 2012, Monty Program Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -82,8 +82,9 @@ typedef struct st_mysql_methods
0, arg, length, 1, stmt)
extern CHARSET_INFO *default_client_charset_info;
MYSQL_FIELD *unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
my_bool default_value, uint server_capabilities);
MYSQL_FIELD *unpack_fields(MYSQL *mysql, MYSQL_DATA *data,MEM_ROOT *alloc,
uint fields, my_bool default_value,
uint server_capabilities);
void free_rows(MYSQL_DATA *cur);
void free_old_query(MYSQL *mysql);
void end_server(MYSQL *mysql);

View File

@ -17,7 +17,6 @@ INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/libmysql
${CMAKE_SOURCE_DIR}/regex
${CMAKE_SOURCE_DIR}/sql
${CMAKE_SOURCE_DIR}/strings
${SSL_INCLUDE_DIRS}
${SSL_INTERNAL_INCLUDE_DIRS}

View File

@ -26,10 +26,6 @@
#include <m_string.h>
#include <m_ctype.h>
#if defined(HAVE_BROKEN_GETPASS) && !defined(HAVE_GETPASSPHRASE)
#undef HAVE_GETPASS
#endif
#ifdef HAVE_GETPASS
#ifdef HAVE_PWD_H
#include <pwd.h>

View File

@ -1,4 +1,5 @@
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates
Copyright (c) 2009, 2012, Monty Program Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -811,7 +812,7 @@ MYSQL_FIELD *cli_list_fields(MYSQL *mysql)
return NULL;
mysql->field_count= (uint) query->rows;
return unpack_fields(query,&mysql->field_alloc,
return unpack_fields(mysql, query,&mysql->field_alloc,
mysql->field_count, 1, mysql->server_capabilities);
}
@ -871,7 +872,7 @@ mysql_list_processes(MYSQL *mysql)
if (!(fields = (*mysql->methods->read_rows)(mysql,(MYSQL_FIELD*) 0,
protocol_41(mysql) ? 7 : 5)))
DBUG_RETURN(NULL);
if (!(mysql->fields=unpack_fields(fields,&mysql->field_alloc,field_count,0,
if (!(mysql->fields=unpack_fields(mysql, fields,&mysql->field_alloc,field_count,0,
mysql->server_capabilities)))
DBUG_RETURN(0);
mysql->status=MYSQL_STATUS_GET_RESULT;
@ -1456,7 +1457,7 @@ my_bool cli_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
if (!(fields_data= (*mysql->methods->read_rows)(mysql,(MYSQL_FIELD*)0,7)))
DBUG_RETURN(1);
if (!(stmt->fields= unpack_fields(fields_data,&stmt->mem_root,
if (!(stmt->fields= unpack_fields(mysql, fields_data,&stmt->mem_root,
field_count,0,
mysql->server_capabilities)))
DBUG_RETURN(1);

View File

@ -44,6 +44,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql-common/client_plugin.c ../sql-common/mysql_async.c
../sql/password.c ../sql/discover.cc ../sql/derror.cc
../sql/field.cc ../sql/field_conv.cc
../sql/filesort_utils.cc
../sql/filesort.cc ../sql/gstream.cc ../sql/slave.cc
../sql/signal_handler.cc
../sql/handler.cc ../sql/hash_filo.cc ../sql/hostname.cc
@ -96,6 +97,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/create_options.cc ../sql/rpl_utility.cc
../sql/rpl_reporting.cc
../sql/sql_expression_cache.cc
../sql/my_apc.cc ../sql/my_apc.h
${GEN_SOURCES}
${MYSYS_LIBWRAP_SOURCE}
)

View File

@ -15,9 +15,9 @@
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/libmysqld/include
${CMAKE_SOURCE_DIR}/regex
${CMAKE_SOURCE_DIR}/regex
${CMAKE_SOURCE_DIR}/sql
${MY_READLINE_INCLUDE_DIR}
${MY_READLINE_INCLUDE_DIR}
)

View File

@ -21,7 +21,7 @@ SET(MAN1_SERVER innochecksum.1 my_print_defaults.1 myisam_ftdump.1 myisamchk.1
mysql_tzinfo_to_sql.1 mysql_upgrade.1 mysql_zap.1
mysqld_multi.1 mysqld_safe.1 mysqldumpslow.1 mysqlhotcopy.1
mysqlman.1 mysqltest.1 perror.1 replace.1 resolve_stack_dump.1
resolveip.1)
resolveip.1 mysqlbug.1)
SET(MAN8_SERVER mysqld.8 mysqlmanager.8)
SET(MAN1_CLIENT msql2mysql.1 mysql.1 mysql_find_rows.1 mysql_waitpid.1
mysqlaccess.1 mysqladmin.1 mysqlbinlog.1 mysqlcheck.1

View File

@ -205,16 +205,55 @@ DROP PROCEDURE p4;
--echo End of 5.0 tests
# Test of a too big SET INSERT_ID: see if the truncated value goes
# into binlog (right), or the too big value (wrong); we look at the
# binlog further down with SHOW BINLOG EVENTS.
# Test of a too big SET INSERT_ID.
# This should generate an error and should not be put in binlog
# We look at the binlog further down with SHOW BINLOG EVENTS.
reset master;
create table t1 (id tinyint auto_increment primary key);
insert into t1 values(5);
set insert_id=128;
insert into t1 values(null);
--error 167
insert into t1 values(null) /* Not binlogged */;
# The followin insert ignore will be put in binlog
set insert_id=128;
insert ignore into t1 values(null) /* Insert 128 */;
# Insert with duplicate key error should not go into binglo
set insert_id=5;
--error ER_DUP_ENTRY
insert into t1 values(null) /* Not binlogged */;
# Insert with autogenerated key + duplicate key error should go into binlog
set insert_id=5;
insert ignore into t1 values(null) /* Insert 5 */;
select * from t1;
drop table t1;
# Same tests but with 2 rows inserted at a time
create table t1 (id tinyint auto_increment primary key) engine=myisam;
set insert_id=128;
--error 167
insert into t1 values(5),(null) /* Insert_id 128 */;
# The followin insert ignore will be put in binlog
set insert_id=128;
insert ignore into t1 values (4),(null) /* Insert_id 128 */;
# Insert with duplicate key error should not go into binglo
set insert_id=5;
--error ER_DUP_ENTRY
insert into t1 values(3),(null) /* Insert_id 5 */;
# Insert with autogenerated key + duplicate key error should go into binlog
set insert_id=5;
insert ignore into t1 values(2),(null) /* Insert_id 5 */;
select * from t1 order by id;
drop table t1;
# bug#22027
create table t1 (a int);
create table if not exists t2 select * from t1;

View File

@ -28,6 +28,7 @@
# BUG#20627: INSERT DELAYED does not honour auto_increment_* variables
# Bug in this test: BUG#38068: binlog_stm_binlog fails sporadically in pushbuild
reset master;
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;

View File

@ -318,8 +318,8 @@ connection con4;
select get_lock("a",10); # wait for rollback to finish
if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
{
--let $binlog_rollback= query_get_value(SHOW BINLOG EVENTS, Pos, 7)
--let $binlog_query= query_get_value(SHOW BINLOG EVENTS, Info, 7)
--let $binlog_rollback= query_get_value(SHOW BINLOG EVENTS, Pos, 8)
--let $binlog_query= query_get_value(SHOW BINLOG EVENTS, Info, 8)
if ($binlog_query != ROLLBACK) {
--echo Wrong query from SHOW BINLOG EVENTS. Expected ROLLBACK, got '$binlog_query'
--source include/show_rpl_debug_info.inc

View File

@ -325,7 +325,8 @@ if ($CRC_RET_stmt_sidef) {
SHOW BINLOG EVENTS;
--die Wrong number of warnings.
}
--let $binlog_event= query_get_value(SHOW BINLOG EVENTS, Event_type, 2)
# There should be no events after format description and binlog checkpoint.
--let $binlog_event= query_get_value(SHOW BINLOG EVENTS, Event_type, 3)
if ($binlog_event != No such row) {
--enable_query_log
--echo ******** Failure! Something was written to the binlog despite SQL_LOG_BIN=0 ********
@ -345,23 +346,23 @@ if ($CRC_RET_stmt_sidef) {
SHOW BINLOG EVENTS;
--die Warnings printed
}
--let $event_type= query_get_value(SHOW BINLOG EVENTS, Event_type, 3)
# The first event is format_description, the second is
# Query_event('BEGIN'), and the third should be our Query
--let $event_type= query_get_value(SHOW BINLOG EVENTS, Event_type, 4)
# The first event is format_description, the second is Binlog_checkpoint,
# the third Query_event('BEGIN'), and the fourth should be our Query
# for 'INSERT DELAYED' unsafe_type 3, which is safe after
# the fix of bug#54579.
if (`SELECT $unsafe_type = 3 AND '$event_type' != 'Query'`) {
--enable_query_log
--echo ******** Failure! Event number 3 was a '$event_type', not a 'Query'. ********
--echo ******** Failure! Event number 4 was a '$event_type', not a 'Query'. ********
SHOW BINLOG EVENTS;
--die Wrong events in binlog.
}
# The first event is format_description, the second is
# Query_event('BEGIN'), and the third should be our Table_map
# The first event is format_description, the second is Binlog_checkpoint,
# the third is Query_event('BEGIN'), and the fourth should be our Table_map
# for unsafe statement.
if (`SELECT $unsafe_type != 3 AND '$event_type' != 'Table_map'`) {
--enable_query_log
--echo ******** Failure! Event number 3 was a '$event_type', not a 'Table_map'. ********
--echo ******** Failure! Event number 4 was a '$event_type', not a 'Table_map'. ********
SHOW BINLOG EVENTS;
--die Wrong events in binlog.
}

View File

@ -111,7 +111,7 @@ set auto_increment_increment=11;
set auto_increment_offset=4;
insert into t1 values(null);
insert into t1 values(null);
--error ER_DUP_ENTRY
--error 167
insert into t1 values(null);
select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t1 order by a;
@ -120,6 +120,8 @@ create table t2 (a tinyint unsigned not null auto_increment primary key) engine=
set auto_increment_increment=10;
set auto_increment_offset=1;
set insert_id=1000;
insert into t2 values(10);
--error 167
insert into t2 values(null);
select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t2 order by a;
@ -127,6 +129,7 @@ select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t2 orde
create table t3 like t1;
set auto_increment_increment=1000;
set auto_increment_offset=700;
--error 167
insert into t3 values(null);
select * from t3 order by a;
sync_slave_with_master;

View File

@ -34,7 +34,7 @@ INSERT INTO t3 VALUES (3);
COMMIT;
save_master_pos;
# Save BEGIN event into variable
let $master_pos_begin= query_get_value(SHOW BINLOG EVENTS, Pos, 5);
let $master_pos_begin= query_get_value(SHOW BINLOG EVENTS, Pos, 6);
--echo
# 1) Test deadlock

View File

@ -102,7 +102,9 @@ CREATE TABLE t1(a int, UNIQUE(a));
--let $_start= query_get_value(SHOW MASTER STATUS, Position, 1)
INSERT DELAYED IGNORE INTO t1 VALUES(1);
--disable_warnings
INSERT DELAYED IGNORE INTO t1 VALUES(1);
--enable_warnings
flush table t1; # to wait for INSERT DELAYED to be done
if (`SELECT @@global.binlog_format = 'STATEMENT'`)
{
@ -133,7 +135,7 @@ if (`SELECT @@global.binlog_format = 'STATEMENT'`)
{
#must show two INSERT DELAYED
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_limit= 1,6
--let $binlog_limit= 2,6
--source include/show_binlog_events.inc
}
select * from t1;

View File

@ -34,7 +34,7 @@ reset slave;
--echo # Test 1
--echo #
set @my_max_binlog_size= @@global.max_binlog_size;
set @my_max_binlog_size= @@global.max_binlog_size, @my_max_relay_log_size=@@global.max_relay_log_size;
set global max_binlog_size=8192;
set global max_relay_log_size=8192-1; # mapped to 4096
select @@global.max_relay_log_size;
@ -110,6 +110,7 @@ source include/show_master_status.inc;
# Restore max_binlog_size
connection slave;
set global max_binlog_size= @my_max_binlog_size;
set global max_relay_log_size= @my_max_relay_log_size;
--echo #
--echo # End of 4.1 tests

View File

@ -15,14 +15,14 @@
# 1 /* Checksum algorithm */ +
# 4 /* CRC32 length */
#
# With current number of events = 160,
# With current number of events = 161,
#
# binlog_start_pos = 4 + 19 + 57 + 160 + 1 + 4 = 245.
# binlog_start_pos = 4 + 19 + 57 + 161 + 1 + 4 = 246.
#
##############################################################################
let $binlog_start_pos=245;
let $binlog_start_pos=246;
--disable_query_log
SET @binlog_start_pos=245;
SET @binlog_start_pos=246;
--enable_query_log

View File

@ -343,6 +343,7 @@ alter table t1 add index i3(key3);
update t1 set key2=key1,key3=key1;
# to test the bug, the following must use "sort_union":
--replace_column 9 REF
explain select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40);
select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40);
drop table t1;

View File

@ -225,6 +225,8 @@ INSERT INTO global_suppressions VALUES
("Slave I/O: The slave I/O thread stops because a fatal error is encountered when it tried to SET @master_binlog_checksum on master.*"),
("Slave I/O: Get master BINLOG_CHECKSUM failed with error.*"),
("Slave I/O: Notifying master by SET @master_binlog_checksum= @@global.binlog_checksum failed with error.*"),
("Slave I/O: Setting master-side filtering of @@skip_replication failed with error:.*"),
("Slave I/O: Setting @mariadb_slave_capability failed with error:.*"),
("THE_LAST_SUPPRESSION")||

View File

@ -0,0 +1,34 @@
#############################################
# checks if mysqlbinlog is debug compiled
# this "cannot" be done simply by using
# have_debug.inc
#############################################
--disable_query_log
--let $temp_out_help_file=$MYSQL_TMP_DIR/mysqlbinlog_help.tmp
--exec $MYSQL_BINLOG --help>$temp_out_help_file
let log_tmp=$temp_out_help_file;
--let $temp_inc=$MYSQL_TMP_DIR/temp.inc
let inc_tmp=$temp_inc;
--perl
use strict;
my $tmp_file= $ENV{'log_tmp'} or die "log_tmp not set";
open(FILE, "$tmp_file") or die("Unable to open $tmp_file: $!\n");
my $count = () = grep(/Output debug log/g,<FILE>);
close FILE;
my $temp_inc= $ENV{'inc_tmp'} or die "temp_inc not set";
open(FILE_INC,">", "$temp_inc") or die("can't open file \"$temp_inc\": $!");
print FILE_INC '--let $is_debug= '.$count;
close FILE_INC;
EOF
--source $temp_inc
if (!$is_debug)
{
--skip mysqlbinlog needs to be debug compiled
}
--remove_file $temp_out_help_file
--remove_file $temp_inc
--enable_query_log

View File

@ -0,0 +1,126 @@
# include/query_cache_partitions.inc
#
# The variables
# $engine_type -- storage engine to be tested
# have to be set before sourcing this script.
eval SET SESSION STORAGE_ENGINE = $engine_type;
# Initialise
--disable_warnings
drop table if exists t1;
--enable_warnings
set @save_query_cache_size = @@global.query_cache_size;
--echo # Test that partitions works with query cache
flush query cache;
SET GLOBAL query_cache_size=1024*1024*512;
CREATE TABLE `t1` (
`id` int(11) NOT NULL ,
`created_at` datetime NOT NULL,
`cool` tinyint default 0
);
ALTER TABLE t1 PARTITION BY RANGE (TO_DAYS(created_at)) (
PARTITION month_2010_4 VALUES LESS THAN (734258),
PARTITION month_2010_5 VALUES LESS THAN (734289),
PARTITION month_max VALUES LESS THAN MAXVALUE
);
show create table t1;
INSERT INTO t1 VALUES (1, now(), 0);
flush status;
show status like "Qcache_queries_in_cache";
show status like "Qcache_hits";
SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
show status like "Qcache_queries_in_cache";
show status like "Qcache_hits";
drop table t1;
--echo # Test that sub-partitions works with query cache
flush query cache;
SET GLOBAL query_cache_size=1024*1024*512;
CREATE TABLE `t1` (
`id` int(11) NOT NULL ,
`created_at` datetime NOT NULL,
`cool` tinyint default 0
)
PARTITION BY RANGE (TO_DAYS(created_at))
subpartition by hash(cool) subpartitions 3 (
PARTITION month_2010_4 VALUES LESS THAN (734258),
PARTITION month_2010_5 VALUES LESS THAN (734289),
PARTITION month_max VALUES LESS THAN MAXVALUE
);
show create table t1;
INSERT INTO t1 VALUES (1, now(), 0);
flush status;
show status like "Qcache_queries_in_cache";
show status like "Qcache_hits";
SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
show status like "Qcache_queries_in_cache";
show status like "Qcache_hits";
drop table t1;
--echo #
--echo # MySQL bug#53775 Query on partitioned table returns cached result
--echo # from previous transaction
--echo #
flush query cache;
flush status;
SET GLOBAL query_cache_size=1024*1024*512;
CREATE TABLE `t1` (
`id` int(11) NOT NULL ,
`created_at` datetime NOT NULL,
`cool` tinyint default 0
);
ALTER TABLE t1 PARTITION BY RANGE (TO_DAYS(created_at)) (
PARTITION month_2010_4 VALUES LESS THAN (734258),
PARTITION month_2010_5 VALUES LESS THAN (734289),
PARTITION month_max VALUES LESS THAN MAXVALUE
);
INSERT INTO t1 VALUES (1, now(), 0);
show status like "Qcache_queries_in_cache";
show status like "Qcache_hits";
BEGIN;
UPDATE `t1` SET `cool` = 1 WHERE `id` = 1;
SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
ROLLBACK;
SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
BEGIN;
SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
ROLLBACK;
SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1;
show status like "Qcache_queries_in_cache";
show status like "Qcache_hits";
drop table t1;
set @@global.query_cache_size = @save_query_cache_size;

View File

@ -74,7 +74,6 @@ let $_fake_relay_index= $_fake_datadir/$_fake_filename.index;
let $_fake_relay_log_purge= `SELECT @@global.relay_log_purge`;
RESET SLAVE;
let $_orphan_relay_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1);
# Create relay log file.
--copy_file $fake_relay_log $_fake_relay_log
@ -103,8 +102,5 @@ let $_orphan_relay_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1);
# Setup replication from existing relay log.
eval CHANGE MASTER TO MASTER_HOST='dummy.localdomain', RELAY_LOG_FILE='$_fake_filename-fake.000001', RELAY_LOG_POS=4;
# remove the orphan log file (became spurious)
-- remove_file $_fake_datadir/$_orphan_relay_file
--let $include_filename= setup_fake_relay_log.inc
--source include/end_include_file.inc

View File

@ -20,7 +20,7 @@
#
# $binlog_start
# Position for the 'FROM' clause of SHOW BINLOG EVENTS. If none
# given, starts right after the Format_description_log_event.
# given, starts right after the Binlog_checkpoint_log_even.
#
# $binlog_limit
# Limit for the 'LIMIT' clause of SHOW BINLOG EVENTS, i.e.:

View File

@ -1,5 +1,16 @@
--let $binlog_start=245
--replace_result $binlog_start <binlog_start>
if ($binlog_start)
{
--let $_binlog_start=$binlog_start
}
if (!$binlog_start)
{
--let $_binlog_start=246
}
if ($binlog_file)
{
--let $_in_binlog_file=in '$binlog_file'
}
--replace_result $_binlog_start <binlog_start>
--replace_column 2 # 5 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
--eval show binlog events from $binlog_start
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/
--eval show binlog events $_in_binlog_file from $_binlog_start

View File

@ -10,13 +10,28 @@
--let $include_filename= show_events.inc
--source include/begin_include_file.inc
# Do not modify $binlog_start - if we did, it could wrongly persist until a
# later call of show_events.inc.
if ($binlog_start)
{
--let $_binlog_start= $binlog_start
}
if (!$binlog_start)
{
# If $binlog_start is not set, we will set it as the second event's
# position. The first event(Description Event) is always ignored. For
# description event's length might be changed because of adding new events,
# 'SHOW BINLOG EVENTS LIMIT 1' is used to get the right value.
--let $binlog_start= query_get_value(SHOW BINLOG EVENTS LIMIT 1, End_log_pos, 1)
# If $binlog_start is not set, we will set it as the third event's
# position (second in relay log which has not Binlog Checkpoing event).
# The first two events (Description Event and Binlog Checkpoint
# event) are always ignored. For description event's length might be changed
# because of adding new events, 'SHOW BINLOG EVENTS LIMIT 2' is used to get
# the right value.
if ($is_relay_log)
{
--let $_binlog_start= query_get_value(SHOW BINLOG EVENTS LIMIT 1, End_log_pos, 1)
}
if (!$is_relay_log)
{
--let $_binlog_start= query_get_value(SHOW BINLOG EVENTS LIMIT 2, End_log_pos, 2)
}
}
--let $_se_old_statement= $statement
@ -44,7 +59,7 @@ if ($binlog_file)
--let $statement= $statement in '$_binlog_file'
}
--let $statement= $statement from $binlog_start
--let $statement= $statement from $_binlog_start
if ($binlog_limit != '')
{

View File

@ -19,11 +19,12 @@ select count(*) from t1;
set auto_increment_increment=1000;
set auto_increment_offset=700;
--error ER_WARN_DATA_OUT_OF_RANGE
--error 167
insert into t1 values(null);
select count(*) from t1;
set @@sql_mode=@org_mode;
--error 167
insert into t1 values(null);
select * from t1;

View File

@ -472,11 +472,13 @@ sub process_suite {
else
{
my @combs;
@combs = combinations_from_file($parent, "$suitedir/combinations")
unless $suite->{skip};
my $from = "$suitedir/combinations";
@combs = combinations_from_file($parent, $from) unless $suite->{skip};
$suite->{combinations} = [ @combs ];
# in overlays it's a union of parent's and overlay's files.
unshift @{$suite->{combinations}}, @{$parent->{combinations}} if $parent;
unshift @{$suite->{combinations}},
grep { not $skip_combinations{"$from => $_->{name}"} }
@{$parent->{combinations}} if $parent;
}
# suite.opt
@ -1039,8 +1041,11 @@ sub get_tags_from_file($$) {
$suite = load_suite_for_file($comb_file) if $prefix[0] eq '';
my @comb;
unless ($suite->{skip}) {
@comb = combinations_from_file($over, "$prefix[0]$comb_file");
push @comb, combinations_from_file(undef, "$prefix[1]$comb_file") if $over;
my $from = "$prefix[0]$comb_file";
@comb = combinations_from_file($over, $from);
push @comb,
grep { not $skip_combinations{"$from => $_->{name}"} }
combinations_from_file(undef, "$prefix[1]$comb_file") if $over;
}
push @combinations, [ @comb ];

View File

@ -174,6 +174,7 @@ my $DEFAULT_SUITES= join(',', map { "$_-" } qw(
heap
innodb
maria
multi_source
optimizer_unfixed_bugs
oqgraph
parts
@ -1147,7 +1148,6 @@ sub command_line_setup {
'start-from=s' => \&collect_option,
'big-test+' => \$opt_big_test,
'combination=s' => \@opt_combinations,
'skip-combinations' => \&collect_option,
'experimental=s' => \@opt_experimentals,
# skip-im is deprecated and silently ignored
'skip-im' => \&ignore_option,
@ -6265,7 +6265,6 @@ Options to control what engine/variation to run
all generated configs
combination=<opt> Use at least twice to run tests with specified
options to mysqld
skip-combinations Ignore combination file (or options)
Options to control directories to use
tmpdir=DIR The directory where temporary files are stored

View File

@ -0,0 +1,10 @@
create table t1 (d date);
insert into t1 values ('2012-00-00');
select * from t1;
d
2012-00-00
update t1 set d = adddate(d, interval 1 day);
select * from t1;
d
NULL
drop table t1;

View File

@ -150,7 +150,7 @@ select last_insert_id();
last_insert_id()
255
insert into t1 set i = null;
ERROR 23000: Duplicate entry '255' for key 'PRIMARY'
ERROR 22003: Out of range value for column 'i' at row 1
select last_insert_id();
last_insert_id()
255
@ -162,8 +162,7 @@ select last_insert_id();
last_insert_id()
255
insert into t1 set i = null;
Warnings:
Warning 1264 Out of range value for column 'i' at row 1
ERROR 22003: Out of range value for column 'i' at row 1
select last_insert_id();
last_insert_id()
255
@ -487,7 +486,7 @@ SELECT @@SESSION.AUTO_INCREMENT_OFFSET;
@@SESSION.AUTO_INCREMENT_OFFSET
1
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
ERROR 22003: Out of range value for column 't1' at row 167
ERROR 22003: Out of range value for column 'c1' at row 2
SELECT * FROM t1;
c1
1

View File

@ -0,0 +1,266 @@
set default_storage_engine=innodb;
drop table if exists t1;
#
# Testing ranges with smallint
#
create table t1 (a smallint primary key auto_increment);
insert into t1 values(32767);
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
truncate table t1;
insert into t1 values(32767-1);
insert into t1 values(NULL);
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
select * from t1;
a
32766
32767
truncate table t1;
insert into t1 values(32767),(NULL);
ERROR 22003: Out of range value for column 'a' at row 2
select * from t1;
a
truncate table t1;
insert into t1 values(32767-1),(NULL),(NULL);
ERROR 22003: Out of range value for column 'a' at row 3
truncate table t1;
insert into t1 values(32767+1);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
a
32767
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
drop table t1;
#
# Testing ranges with unsigned smallint
#
create table t1 (a smallint unsigned primary key auto_increment);
insert into t1 values(65535);
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
truncate table t1;
insert into t1 values(65535-1);
insert into t1 values(NULL);
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
select * from t1;
a
65534
65535
truncate table t1;
insert into t1 values(65535),(NULL);
ERROR 22003: Out of range value for column 'a' at row 2
select * from t1;
a
truncate table t1;
insert into t1 values(65535-1),(NULL),(NULL);
ERROR 22003: Out of range value for column 'a' at row 3
truncate table t1;
insert into t1 values(65535+1);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
a
65535
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
drop table t1;
#
# Testing ranges with integer
#
create table t1 (a int primary key auto_increment);
insert into t1 values(2147483647);
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
truncate table t1;
insert into t1 values(2147483647-1);
insert into t1 values(NULL);
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
select * from t1;
a
2147483646
2147483647
truncate table t1;
insert into t1 values(2147483647),(NULL);
ERROR 22003: Out of range value for column 'a' at row 2
select * from t1;
a
truncate table t1;
insert into t1 values(2147483647-1),(NULL),(NULL);
ERROR 22003: Out of range value for column 'a' at row 3
truncate table t1;
insert into t1 values(2147483647+1);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
a
2147483647
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
drop table t1;
#
# Testing ranges with unsigned integer
#
create table t1 (a int unsigned primary key auto_increment);
insert into t1 values(4294967295);
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
truncate table t1;
insert into t1 values(4294967295-1);
insert into t1 values(NULL);
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
select * from t1;
a
4294967294
4294967295
truncate table t1;
insert into t1 values(4294967295),(NULL);
ERROR 22003: Out of range value for column 'a' at row 2
select * from t1;
a
truncate table t1;
insert into t1 values(4294967295-1),(NULL),(NULL);
ERROR 22003: Out of range value for column 'a' at row 3
truncate table t1;
insert into t1 values(4294967295+1);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
a
4294967295
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
drop table t1;
#
# Testing ranges with bigint
#
create table t1 (a bigint primary key auto_increment);
insert into t1 values(cast(9223372036854775807 as unsigned));
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
truncate table t1;
insert into t1 values(cast(9223372036854775807 as unsigned)-1);
insert into t1 values(NULL);
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
select * from t1;
a
9223372036854775806
9223372036854775807
truncate table t1;
insert into t1 values(cast(9223372036854775807 as unsigned)),(NULL);
ERROR 22003: Out of range value for column 'a' at row 2
select * from t1;
a
truncate table t1;
insert into t1 values(cast(9223372036854775807 as unsigned)-1),(NULL),(NULL);
ERROR 22003: Out of range value for column 'a' at row 3
truncate table t1;
insert into t1 values(cast(9223372036854775807 as unsigned)+1);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
a
9223372036854775807
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
drop table t1;
#
# Testing ranges with unsigned bigint
#
create table t1 (a bigint unsigned primary key auto_increment);
insert into t1 values(18446744073709551615-1);
insert into t1 values(NULL);
ERROR HY000: Failed to read auto-increment value from storage engine
insert into t1 values(NULL);
ERROR HY000: Failed to read auto-increment value from storage engine
truncate table t1;
insert into t1 values(18446744073709551615-1);
insert into t1 values(NULL);
ERROR HY000: Failed to read auto-increment value from storage engine
insert into t1 values(NULL);
ERROR HY000: Failed to read auto-increment value from storage engine
select * from t1;
a
18446744073709551614
truncate table t1;
insert into t1 values(18446744073709551615),(NULL);
ERROR HY000: Failed to read auto-increment value from storage engine
select * from t1;
a
truncate table t1;
insert into t1 values(18446744073709551615-1),(NULL),(NULL);
ERROR HY000: Failed to read auto-increment value from storage engine
drop table t1;
#
# Test IGNORE and strict mode
#
create table t1 (a smallint primary key auto_increment);
insert ignore into t1 values(32766),(NULL),(NULL),(1);
Warnings:
Warning 167 Out of range value for column 'a' at row 3
select * from t1;
a
1
32766
32767
truncate table t1;
set @org_mode=@@sql_mode;
set @@sql_mode='ansi,traditional';
insert ignore into t1 values(32766),(NULL),(NULL);
Warnings:
Warning 167 Out of range value for column 'a' at row 3
truncate table t1;
insert into t1 values(32766),(NULL),(NULL);
ERROR 22003: Out of range value for column 'a' at row 3
set @@sql_mode=@org_mode;
drop table t1;
#
# Test auto increment with negative numbers
#
CREATE TABLE t1 (a INTEGER AUTO_INCREMENT, PRIMARY KEY (a));
INSERT INTO t1 VALUES (NULL), (2), (-5), (NULL);
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t1;
a
-5
1
2
3
5
TRUNCATE TABLE t1;
INSERT INTO t1 VALUES (-5), (NULL);
SELECT * FROM t1;
a
-5
1
DROP TABLE t1;
#
# Test inserting a value out-of-range into an auto increment column
#
CREATE TABLE t1 (a smallint AUTO_INCREMENT, PRIMARY KEY (a));
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (32768);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
INSERT INTO t1 VALUES (NULL);
ERROR 22003: Out of range value for column 'a' at row 1
SELECT * FROM t1;
a
2
32767
DROP TABLE t1;
#
# Test old behaviour
#
create table t1 (a smallint primary key auto_increment);
insert into t1 values(32766),(NULL);
delete from t1 where a=32767;
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
drop table t1;

View File

@ -0,0 +1,272 @@
set default_storage_engine=MYISAM;
drop table if exists t1;
#
# Testing ranges with smallint
#
create table t1 (a smallint primary key auto_increment);
insert into t1 values(32767);
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
truncate table t1;
insert into t1 values(32767-1);
insert into t1 values(NULL);
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
select * from t1;
a
32766
32767
truncate table t1;
insert into t1 values(32767),(NULL);
ERROR 22003: Out of range value for column 'a' at row 2
select * from t1;
a
32767
truncate table t1;
insert into t1 values(32767-1),(NULL),(NULL);
ERROR 22003: Out of range value for column 'a' at row 3
truncate table t1;
insert into t1 values(32767+1);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
a
32767
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
drop table t1;
#
# Testing ranges with unsigned smallint
#
create table t1 (a smallint unsigned primary key auto_increment);
insert into t1 values(65535);
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
truncate table t1;
insert into t1 values(65535-1);
insert into t1 values(NULL);
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
select * from t1;
a
65534
65535
truncate table t1;
insert into t1 values(65535),(NULL);
ERROR 22003: Out of range value for column 'a' at row 2
select * from t1;
a
65535
truncate table t1;
insert into t1 values(65535-1),(NULL),(NULL);
ERROR 22003: Out of range value for column 'a' at row 3
truncate table t1;
insert into t1 values(65535+1);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
a
65535
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
drop table t1;
#
# Testing ranges with integer
#
create table t1 (a int primary key auto_increment);
insert into t1 values(2147483647);
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
truncate table t1;
insert into t1 values(2147483647-1);
insert into t1 values(NULL);
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
select * from t1;
a
2147483646
2147483647
truncate table t1;
insert into t1 values(2147483647),(NULL);
ERROR 22003: Out of range value for column 'a' at row 2
select * from t1;
a
2147483647
truncate table t1;
insert into t1 values(2147483647-1),(NULL),(NULL);
ERROR 22003: Out of range value for column 'a' at row 3
truncate table t1;
insert into t1 values(2147483647+1);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
a
2147483647
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
drop table t1;
#
# Testing ranges with unsigned integer
#
create table t1 (a int unsigned primary key auto_increment);
insert into t1 values(4294967295);
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
truncate table t1;
insert into t1 values(4294967295-1);
insert into t1 values(NULL);
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
select * from t1;
a
4294967294
4294967295
truncate table t1;
insert into t1 values(4294967295),(NULL);
ERROR 22003: Out of range value for column 'a' at row 2
select * from t1;
a
4294967295
truncate table t1;
insert into t1 values(4294967295-1),(NULL),(NULL);
ERROR 22003: Out of range value for column 'a' at row 3
truncate table t1;
insert into t1 values(4294967295+1);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
a
4294967295
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
drop table t1;
#
# Testing ranges with bigint
#
create table t1 (a bigint primary key auto_increment);
insert into t1 values(cast(9223372036854775807 as unsigned));
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
truncate table t1;
insert into t1 values(cast(9223372036854775807 as unsigned)-1);
insert into t1 values(NULL);
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
select * from t1;
a
9223372036854775806
9223372036854775807
truncate table t1;
insert into t1 values(cast(9223372036854775807 as unsigned)),(NULL);
ERROR 22003: Out of range value for column 'a' at row 2
select * from t1;
a
9223372036854775807
truncate table t1;
insert into t1 values(cast(9223372036854775807 as unsigned)-1),(NULL),(NULL);
ERROR 22003: Out of range value for column 'a' at row 3
truncate table t1;
insert into t1 values(cast(9223372036854775807 as unsigned)+1);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
a
9223372036854775807
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
drop table t1;
#
# Testing ranges with unsigned bigint
#
create table t1 (a bigint unsigned primary key auto_increment);
insert into t1 values(18446744073709551615-1);
insert into t1 values(NULL);
ERROR HY000: Failed to read auto-increment value from storage engine
insert into t1 values(NULL);
ERROR HY000: Failed to read auto-increment value from storage engine
truncate table t1;
insert into t1 values(18446744073709551615-1);
insert into t1 values(NULL);
ERROR HY000: Failed to read auto-increment value from storage engine
insert into t1 values(NULL);
ERROR HY000: Failed to read auto-increment value from storage engine
select * from t1;
a
18446744073709551614
truncate table t1;
insert into t1 values(18446744073709551615),(NULL);
ERROR HY000: Failed to read auto-increment value from storage engine
select * from t1;
a
18446744073709551615
truncate table t1;
insert into t1 values(18446744073709551615-1),(NULL),(NULL);
ERROR HY000: Failed to read auto-increment value from storage engine
drop table t1;
#
# Test IGNORE and strict mode
#
create table t1 (a smallint primary key auto_increment);
insert ignore into t1 values(32766),(NULL),(NULL),(1);
Warnings:
Warning 167 Out of range value for column 'a' at row 3
select * from t1;
a
1
32766
32767
truncate table t1;
set @org_mode=@@sql_mode;
set @@sql_mode='ansi,traditional';
insert ignore into t1 values(32766),(NULL),(NULL);
Warnings:
Warning 167 Out of range value for column 'a' at row 3
truncate table t1;
insert into t1 values(32766),(NULL),(NULL);
ERROR 22003: Out of range value for column 'a' at row 3
set @@sql_mode=@org_mode;
drop table t1;
#
# Test auto increment with negative numbers
#
CREATE TABLE t1 (a INTEGER AUTO_INCREMENT, PRIMARY KEY (a));
INSERT INTO t1 VALUES (NULL), (2), (-5), (NULL);
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t1;
a
-5
1
2
3
4
TRUNCATE TABLE t1;
INSERT INTO t1 VALUES (-5), (NULL);
SELECT * FROM t1;
a
-5
1
DROP TABLE t1;
#
# Test inserting a value out-of-range into an auto increment column
#
CREATE TABLE t1 (a smallint AUTO_INCREMENT, PRIMARY KEY (a));
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (32768);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
INSERT INTO t1 VALUES (NULL);
ERROR 22003: Out of range value for column 'a' at row 1
SELECT * FROM t1;
a
2
32767
DROP TABLE t1;
#
# Test old behaviour
#
create table t1 (a smallint primary key auto_increment);
insert into t1 values(32766),(NULL);
delete from t1 where a=32767;
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
drop table t1;

View File

@ -220,6 +220,10 @@ a d
3 11120436154190595086
drop table t1, t2;
End of 5.0 tests
CREATE TABLE t1(a YEAR);
SELECT 1 FROM t1 WHERE a=1 AND CASE 1 WHEN a THEN 1 ELSE 1 END;
1
DROP TABLE t1;
create table t1 (f1 time);
insert t1 values ('00:00:00'),('00:01:00');
select case t1.f1 when '00:00:00' then 1 end from t1;

View File

@ -529,6 +529,8 @@ SUCCESS
# 13. Read-write statement: INSERT IGNORE, change 0 rows.
#
insert ignore t1 set a=2;
Warnings:
Warning 1062 Duplicate entry '2' for key 'a'
call p_verify_status_increment(2, 2, 1, 0);
SUCCESS

View File

@ -96,3 +96,7 @@ SELECT * FROM t1 WHERE a > '2008-01-01' AND a = '0000-00-00';
a
DROP TABLE t1;
End of 5.0 tests
CREATE TABLE t1(a INT ZEROFILL);
SELECT 1 FROM t1 WHERE t1.a IN (1, t1.a) AND t1.a=2;
1
DROP TABLE t1;

View File

@ -53,8 +53,8 @@ set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
set debug_sync='now WAIT_FOR parked';
alter table t3 rename to t1;
ERROR 42S01: Table 't1' already exists
set debug_sync='now SIGNAL go';
ERROR 42S01: Table 't1' already exists
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@ -65,8 +65,8 @@ set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
set debug_sync='now WAIT_FOR parked';
alter table t3 rename to t1, add k int;
ERROR 42S01: Table 't1' already exists
set debug_sync='now SIGNAL go';
ERROR 42S01: Table 't1' already exists
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (

View File

@ -2396,6 +2396,8 @@ a b
drop table t1;
create table if not exists t1 (a int unique, b int)
ignore select 1 as a, 1 as b union select 1 as a, 2 as b;
Warnings:
Warning 1062 Duplicate entry '1' for key 'a'
select * from t1;
a b
1 1

View File

@ -2039,6 +2039,8 @@ hex(concat(a)) a
30303030303030303030303030303031303030302E31 00000000000000010000.1
drop table t1;
create table t1 (a year(2));
Warnings:
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
insert into t1 values (1);
select hex(concat(a)) from t1;
hex(concat(a))
@ -2352,6 +2354,8 @@ hex(a)
drop table t1;
drop view v1;
create table t1 (a year(2));
Warnings:
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
insert into t1 values (1);
create view v1(a) as select concat(a) from t1;
show columns from v1;

View File

@ -2431,6 +2431,8 @@ hex(concat(a)) a
30303030303030303030303030303031303030302E31 00000000000000010000.1
drop table t1;
create table t1 (a year(2));
Warnings:
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
insert into t1 values (1);
select hex(concat(a)) from t1;
hex(concat(a))
@ -2744,6 +2746,8 @@ hex(a)
drop table t1;
drop view v1;
create table t1 (a year(2));
Warnings:
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
insert into t1 values (1);
create view v1(a) as select concat(a) from t1;
show columns from v1;

View File

@ -2458,6 +2458,8 @@ hex(concat(a)) a
30303030303030303030303030303031303030302E31 00000000000000010000.1
drop table t1;
create table t1 (a year(2));
Warnings:
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
insert into t1 values (1);
select hex(concat(a)) from t1;
hex(concat(a))
@ -2771,6 +2773,8 @@ hex(a)
drop table t1;
drop view v1;
create table t1 (a year(2));
Warnings:
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
insert into t1 values (1);
create view v1(a) as select concat(a) from t1;
show columns from v1;

View File

@ -3341,6 +3341,8 @@ hex(concat(a)) a
00300030003000300030003000300030003000300030003000300030003000310030003000300030002E0031 00000000000000010000.1
drop table t1;
create table t1 (a year(2));
Warnings:
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
insert into t1 values (1);
select hex(concat(a)) from t1;
hex(concat(a))
@ -3654,6 +3656,8 @@ hex(a)
drop table t1;
drop view v1;
create table t1 (a year(2));
Warnings:
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
insert into t1 values (1);
create view v1(a) as select concat(a) from t1;
show columns from v1;

View File

@ -1182,5 +1182,11 @@ a 256
Warnings:
Warning 1260 Row 1 was cut by GROUP_CONCAT()
#
# incorrect charset for val_str_ascii
#
SELECT '2010-10-10 10:10:10' + INTERVAL GeometryType(GeomFromText('POINT(1 1)')) hour_second;
'2010-10-10 10:10:10' + INTERVAL GeometryType(GeomFromText('POINT(1 1)')) hour_second
2010-10-10 10:10:10
#
# End of 5.5 tests
#

View File

@ -4197,6 +4197,8 @@ hex(concat(a)) a
30303030303030303030303030303031303030302E31 00000000000000010000.1
drop table t1;
create table t1 (a year(2));
Warnings:
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
insert into t1 values (1);
select hex(concat(a)) from t1;
hex(concat(a))
@ -4510,6 +4512,8 @@ hex(a)
drop table t1;
drop view v1;
create table t1 (a year(2));
Warnings:
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
insert into t1 values (1);
create view v1(a) as select concat(a) from t1;
show columns from v1;

View File

@ -0,0 +1,8 @@
create table t1 (d datetime);
insert t1 values (addtime('9999-12-31 23:59:59', '00:00:01')),
(from_days(3652499));
select * from t1;
d
NULL
NULL
drop table t1;

View File

@ -1687,7 +1687,6 @@ SELECT t.b, t.c, t1.a
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
WHERE t.b AND t.c = t1.a;
b c a
8 c c
EXPLAIN EXTENDED
SELECT t.b, t.c, t1.a
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
@ -1702,7 +1701,6 @@ SELECT t.b, t.c, t1.a
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
WHERE t.b <> 0 AND t.c = t1.a;
b c a
8 c c
INSERT INTO t3 VALUES (100), (200);
EXPLAIN EXTENDED
SELECT t.b, t.c, t1.a
@ -1718,7 +1716,7 @@ SELECT t.b, t.c, t1.a
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
WHERE t.b AND t.c = t1.a;
b c a
8 c c
NULL NULL c
EXPLAIN EXTENDED
SELECT t.b, t.c, t1.a
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
@ -1733,7 +1731,7 @@ SELECT t.b, t.c, t1.a
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
WHERE t.b <> 0 AND t.c = t1.a;
b c a
8 c c
NULL NULL c
SET optimizer_switch=@save_optimizer_switch;
DROP TABLE t1,t2,t3;
#

View File

@ -160,3 +160,11 @@ ERROR 42S22: Unknown column '' in 'VALUES() function'
INSERT INTO t2(a,b) VALUES (1,0) ON DUPLICATE KEY UPDATE
b=(SELECT VALUES(a)+2 FROM t1);
DROP TABLE t1, t2;
#
# MDEV-492: incorrect error check before sending OK in mysql_update
#
CREATE TABLE t1 (a CHAR(3), b BLOB);
UPDATE t1 SET a = 'new'
WHERE COLUMN_CREATE( 1, 'v', 1, 'w' ) IS NULL;
ERROR 22007: Illegal value used as argument of dynamic column function
drop table t1;

View File

@ -287,7 +287,7 @@ WHERE t1.f1 GROUP BY t1.f1));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1
2 SUBQUERY a system NULL NULL NULL NULL 1
2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1
2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1 Using where
PREPARE stmt FROM
'EXPLAIN SELECT 1 FROM t1
WHERE 1 > ALL((SELECT t1.f1 FROM t1 RIGHT OUTER JOIN t1 a
@ -297,12 +297,12 @@ EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1
2 SUBQUERY a system NULL NULL NULL NULL 1
2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1
2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1 Using where
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1
2 SUBQUERY a system NULL NULL NULL NULL 1
2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1
2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1 Using where
DEALLOCATE PREPARE stmt;
PREPARE stmt FROM
'EXPLAIN SELECT 1 FROM t1
@ -313,12 +313,12 @@ EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1
2 SUBQUERY a system NULL NULL NULL NULL 1
2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1
2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1 Using where
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1
2 SUBQUERY a system NULL NULL NULL NULL 1
2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1
2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1 Using where
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
End of 5.1 tests.

View File

@ -0,0 +1,140 @@
drop table if exists t1;
show status like "feature%";
Variable_name Value
Feature_dynamic_columns 0
Feature_fulltext 0
Feature_gis 0
Feature_locale 0
Feature_subquery 0
Feature_timezone 0
Feature_trigger 0
Feature_xml 0
#
# Feature GIS
#
CREATE TABLE t1 (g POINT);
SHOW FIELDS FROM t1;
Field Type Null Key Default Extra
g point YES NULL
INSERT INTO t1 VALUES
(PointFromText('POINT(10 10)')),
(PointFromText('POINT(20 10)')),
(PointFromText('POINT(20 20)')),
(PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
drop table t1;
show status like "feature_gis";
Variable_name Value
Feature_gis 3
#
# Feature dynamic columns
#
set @a= COLUMN_CREATE(1, 1212 AS int);
set @b= column_add(@a, 2, 1212 as integer);
select column_get(@b, 2 as integer);
column_get(@b, 2 as integer)
1212
show status like "feature_dynamic_columns";
Variable_name Value
Feature_dynamic_columns 2
#
# Feature fulltext
#
CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b)) engine=myisam;
INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),
('Full-text indexes', 'are called collections'),
('Only MyISAM tables','support collections'),
('Function MATCH ... AGAINST()','is used to do a search'),
('Full-text search in MySQL', 'implements vector space model');
select * from t1 where MATCH(a,b) AGAINST ("collections");
a b
Only MyISAM tables support collections
Full-text indexes are called collections
select * from t1 where MATCH(a,b) AGAINST ("indexes");
a b
Full-text indexes are called collections
drop table t1;
show status like "feature_fulltext";
Variable_name Value
Feature_fulltext 2
#
# Feature locale
#
SET lc_messages=sr_RS;
SET lc_messages=en_US;
show status like "feature_locale";
Variable_name Value
Feature_locale 2
#
# Feature subquery
#
select (select 2);
(select 2)
2
SELECT (SELECT 1) UNION SELECT (SELECT 2);
(SELECT 1)
1
2
create table t1 (a int);
insert into t1 values (2);
select (select a from t1 where t1.a=t2.a), a from t1 as t2;
(select a from t1 where t1.a=t2.a) a
2 2
drop table t1;
show status like "feature_subquery";
Variable_name Value
Feature_subquery 4
#
# Feature timezone
#
SELECT FROM_UNIXTIME(unix_timestamp()) > "1970-01-01";
FROM_UNIXTIME(unix_timestamp()) > "1970-01-01"
1
set time_zone="+03:00";
SELECT FROM_UNIXTIME(unix_timestamp()) > "1970-01-01";
FROM_UNIXTIME(unix_timestamp()) > "1970-01-01"
1
set time_zone= @@global.time_zone;
show status like "feature_timezone";
Variable_name Value
Feature_timezone 1
#
# Feature triggers
#
create table t1 (i int);
# let us test some very simple trigger
create trigger trg before insert on t1 for each row set @a:=1;
set @a:=0;
select @a;
@a
0
insert into t1 values (1),(2);
select @a;
@a
1
SHOW TRIGGERS IN test like 't1';
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
trg INSERT t1 set @a:=1 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
drop trigger trg;
drop table t1;
show status like "%trigger%";
Variable_name Value
Com_create_trigger 1
Com_drop_trigger 1
Com_show_create_trigger 0
Com_show_triggers 1
Executed_triggers 2
Feature_trigger 2
#
# Feature xml
#
SET @xml='<a aa1="aa1" aa2="aa2">a1<b ba1="ba1">b1<c>c1</c>b2</b>a2</a>';
SELECT extractValue(@xml,'/a');
extractValue(@xml,'/a')
a1 a2
select updatexml('<div><div><span>1</span><span>2</span></div></div>',
'/','<tr><td>1</td><td>2</td></tr>') as upd1;
upd1
<tr><td>1</td><td>2</td></tr>
show status like "feature_xml";
Variable_name Value
Feature_xml 2

View File

@ -4,7 +4,7 @@ SET @old_debug= @@session.debug;
#
CREATE TABLE t1(f0 int auto_increment primary key, f1 int);
INSERT INTO t1(f1) VALUES (0),(1),(2),(3),(4),(5);
SET session debug_dbug= '+d,make_sort_keys_alloc_fail';
SET session debug_dbug= '+d,alloc_sort_buffer_fail';
CALL mtr.add_suppression("Out of sort memory");
SELECT * FROM t1 ORDER BY f1 ASC, f0;
ERROR HY001: Out of sort memory, consider increasing server sort buffer size

View File

@ -489,3 +489,10 @@ UNLOCK TABLES;
# Switching to connection 'default'.
COMMIT;
DROP TABLE t1;
#
# Test flushing slave or relay logs twice
#
flush relay logs,relay logs;
ERROR HY000: Incorrect usage of FLUSH and RELAY LOGS
flush slave,slave;
ERROR HY000: Incorrect usage of FLUSH and SLAVE

View File

@ -1527,6 +1527,8 @@ DROP TABLE t1;
# Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
#
create table t1 (f1 year(2), f2 year(4), f3 date, f4 datetime);
Warnings:
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
insert into t1 values
(98,1998,19980101,"1998-01-01 00:00:00"),
(00,2000,20000101,"2000-01-01 00:00:01"),
@ -1838,7 +1840,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 range a a 4 NULL 4 100.00 Using where; Using index
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select max(`test`.`t1`.`a`) AS `MAX(a)` from `test`.`t1` where (<expr_cache><<cache>(1),<cache>(2)>(<in_optimizer>(<cache>((1,2)),<exists>(select 3,4 having (((1 = 3) or isnull(3)) and ((2 = 4) or isnull(4)) and <is_not_null_test>(3) and <is_not_null_test>(4))))) and (`test`.`t1`.`a` < 10))
Note 1003 select max(`test`.`t1`.`a`) AS `MAX(a)` from `test`.`t1` where (<cache>(<in_optimizer>((1,2),<exists>(select 3,4 having (((1 = 3) or isnull(3)) and ((2 = 4) or isnull(4)) and <is_not_null_test>(3) and <is_not_null_test>(4))))) and (`test`.`t1`.`a` < 10))
SELECT MAX(a) FROM t1 WHERE (1,2) IN (SELECT 3,4) AND a<10;
MAX(a)
NULL

View File

@ -146,19 +146,6 @@ count(*) min(7) max(7)
0 NULL NULL
drop table t1m, t1i, t2m, t2i;
#
# Bug#13723054 CRASH WITH MIN/MAX AFTER QUICK_GROUP_MIN_MAX_SELECT::NEXT_MIN
#
CREATE TABLE t1(a BLOB, b VARCHAR(255) CHARSET LATIN1, c INT,
KEY(b, c, a(765))) ENGINE=INNODB;
INSERT INTO t1(a, b, c) VALUES ('', 'a', 0), ('', 'a', null), ('', 'a', 0);
SELECT MIN(c) FROM t1 GROUP BY b;
MIN(c)
0
EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL b 263 NULL 4 Using index for group-by
DROP TABLE t1;
#
# Bug #57954: BIT_AND function returns incorrect results when
# semijoin=on
CREATE TABLE c (
@ -230,4 +217,18 @@ SELECT member_id_to, COUNT(*) FROM t1 WHERE r_date =
member_id_to COUNT(*)
518491 2
DROP TABLE t1;
# End of test BUG#12713907
#
# Bug#13723054 CRASH WITH MIN/MAX AFTER QUICK_GROUP_MIN_MAX_SELECT::NEXT_MIN
#
CREATE TABLE t1(a BLOB, b VARCHAR(255) CHARSET LATIN1, c INT,
KEY(b, c, a(765))) ENGINE=INNODB;
INSERT INTO t1(a, b, c) VALUES ('', 'a', 0), ('', 'a', null), ('', 'a', 0);
SELECT MIN(c) FROM t1 GROUP BY b;
MIN(c)
0
EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL b 263 NULL 4 Using index for group-by
DROP TABLE t1;
End of 5.5 tests

View File

@ -1023,11 +1023,11 @@ MAKETIME(CAST(-1 AS UNSIGNED), 0, 0)
Warnings:
Note 1105 Cast to unsigned converted negative integer to it's positive complement
Warning 1292 Truncated incorrect time value: '18446744073709551615:00:00'
SELECT EXTRACT(HOUR FROM '100000:02:03');
EXTRACT(HOUR FROM '100000:02:03')
SELECT EXTRACT(HOUR FROM '10000:02:03');
EXTRACT(HOUR FROM '10000:02:03')
838
Warnings:
Warning 1292 Truncated incorrect time value: '100000:02:03'
Warning 1292 Truncated incorrect time value: '10000:02:03'
CREATE TABLE t1(f1 TIME);
INSERT INTO t1 VALUES('916:00:00 a');
Warnings:
@ -1922,3 +1922,5 @@ cast(greatest(cast("0-0-0" as date), cast("10:20:05" as time)) as datetime(6))
select microsecond('12:00:00.123456'), microsecond('2009-12-31 23:59:59.000010');
microsecond('12:00:00.123456') microsecond('2009-12-31 23:59:59.000010')
123456 10
select now(258);
ERROR 42000: Too big precision 258 specified for 'now'. Maximum is 6.

View File

@ -1428,6 +1428,29 @@ WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
count(*)
1
DROP DATABASE gis_ogs;
#
# BUG #1043845 st_distance() results are incorrect depending on variable order
#
select st_distance(geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
-95.9673057475387 36.1344478941074,
-95.9673063519371 36.134484524621,
-95.9673049102515 36.1343976584193)'),
geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)')) ;
st_distance(geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
-95.9673057475387 36.1344478941074,
-95.9673063519371 36.134484524621,
0.008148695928146028
select st_distance(geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)'),
geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
-95.9673057475387 36.1344478941074,
-95.9673063519371 36.134484524621,
-95.9673049102515 36.1343976584193) ')) ;
st_distance(geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)'),
geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
-95.9673057475387 36.1344478941074,
-95.9673063519371 36.
0.008148695928146028
USE test;
#
# BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS

View File

@ -2149,3 +2149,48 @@ f1 MIN(f2) MAX(f2)
4 00:25:00 00:25:00
DROP TABLE t1;
#End of test#49771
#
# Bug #58782
# Missing rows with SELECT .. WHERE .. IN subquery
# with full GROUP BY and no aggr
#
CREATE TABLE t1 (
pk INT NOT NULL,
col_int_nokey INT,
PRIMARY KEY (pk)
);
INSERT INTO t1 VALUES (10,7);
INSERT INTO t1 VALUES (11,1);
INSERT INTO t1 VALUES (12,5);
INSERT INTO t1 VALUES (13,3);
SELECT pk AS field1, col_int_nokey AS field2
FROM t1
WHERE col_int_nokey > 0
GROUP BY field1, field2;
field1 field2
10 7
11 1
12 5
13 3
CREATE TABLE where_subselect
SELECT pk AS field1, col_int_nokey AS field2
FROM t1
WHERE col_int_nokey > 0
GROUP BY field1, field2
;
SELECT *
FROM where_subselect
WHERE (field1, field2) IN (
SELECT pk AS field1, col_int_nokey AS field2
FROM t1
WHERE col_int_nokey > 0
GROUP BY field1, field2
);
field1 field2
10 7
11 1
12 5
13 3
DROP TABLE t1;
DROP TABLE where_subselect;
# End of Bug #58782

View File

@ -2403,7 +2403,7 @@ EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY t1 index NULL a 10 NULL 15 Using index
2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by
EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
a IN (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
id select_type table type possible_keys key key_len ref rows Extra
@ -2421,7 +2421,7 @@ AND t1_outer1.b = t1_outer2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1_outer1 ref a a 5 const 1 Using where; Using index
1 PRIMARY t1_outer2 index NULL a 10 NULL 15 Using where; Using index; Using join buffer (flat, BNL join)
2 SUBQUERY t1 index NULL a 10 NULL 15 Using index
2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by
EXPLAIN SELECT (SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x
FROM t1 AS t1_outer) x2 FROM t1 AS t1_outer2;
id select_type table type possible_keys key key_len ref rows Extra
@ -2757,7 +2757,7 @@ EXPLAIN
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
id select_type table type possible_keys key key_len ref rows Extra
x x x x x x x x x Impossible WHERE noticed after reading const tables
x x x x x x x x x Using index
x x x x x x x x x Using where; Using index
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
MIN( a )
NULL
@ -2829,7 +2829,7 @@ EXPLAIN
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
id select_type table type possible_keys key key_len ref rows Extra
x x x x x x x x x Impossible WHERE noticed after reading const tables
x x x x x x x x x Using index
x x x x x x x x x Using where; Using index
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
MIN( a )
NULL
@ -2908,7 +2908,7 @@ EXPLAIN
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
id select_type table type possible_keys key key_len ref rows Extra
x x x x x x x x x Impossible WHERE noticed after reading const tables
x x x x x x x x x Using index
x x x x x x x x x Using where; Using index
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
MIN( a )
NULL

View File

@ -313,7 +313,7 @@ alter table t1 add index i3(key3);
update t1 set key2=key1,key3=key1;
explain select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge i2,i3 i3,i2 4,4 NULL 9 Using sort_union(i3,i2); Using where
1 SIMPLE t1 index_merge i2,i3 i3,i2 4,4 NULL REF Using sort_union(i3,i2); Using where
select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40);
key1 key2 key3
31 31 31
@ -777,4 +777,19 @@ commit;
select * from t1 where t1.zone_id=830 AND modified=9;
pk zone_id modified
drop table t0, t1;
#
# MDEV-376: Wrong result (missing rows) with index_merge+index_merge_intersection, join
#
CREATE TABLE t1 (
a INT, b CHAR(1), c CHAR(1), KEY(a), KEY(b)
) ENGINE=InnoDB;
INSERT INTO t1 VALUES (8,'v','v'),(8,'m','m'),(9,'d','d');
SELECT ta.* FROM t1 AS ta, t1 AS tb
WHERE ( tb.b != ta.b OR tb.a = ta.a )
AND ( tb.b = ta.c OR tb.b = ta.b );
a b c
8 v v
8 m m
9 d d
DROP TABLE t1;
set optimizer_switch= @optimizer_switch_save;

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