1
0
mirror of https://github.com/MariaDB/server.git synced 2025-11-27 05:41:41 +03:00

Merge tag 'mariadb-5.5.47' into 5.5-galera

This commit is contained in:
Nirbhay Choubey
2015-12-10 13:00:08 -05:00
122 changed files with 1962 additions and 749 deletions

View File

@@ -1,4 +1,4 @@
MYSQL_VERSION_MAJOR=5 MYSQL_VERSION_MAJOR=5
MYSQL_VERSION_MINOR=5 MYSQL_VERSION_MINOR=5
MYSQL_VERSION_PATCH=46 MYSQL_VERSION_PATCH=47
MYSQL_VERSION_EXTRA= MYSQL_VERSION_EXTRA=

View File

@@ -1,5 +1,5 @@
/* /*
Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -407,7 +407,7 @@ exit:
static void usage(void) static void usage(void)
{ {
PRINT_VERSION; PRINT_VERSION;
puts("Copyright (c) 2011, Oracle and/or its affiliates. " puts("Copyright (c) 2011, 2015, Oracle and/or its affiliates. "
"All rights reserved.\n"); "All rights reserved.\n");
puts("Enable or disable plugins."); puts("Enable or disable plugins.");
printf("\nUsage: %s [options] <plugin> ENABLE|DISABLE\n\nOptions:\n", printf("\nUsage: %s [options] <plugin> ENABLE|DISABLE\n\nOptions:\n",
@@ -758,6 +758,11 @@ static int check_options(int argc, char **argv, char *operation)
/* read the plugin config file and check for match against argument */ /* read the plugin config file and check for match against argument */
else else
{ {
if (strlen(argv[i]) + 4 + 1 > FN_REFLEN)
{
fprintf(stderr, "ERROR: argument is too long.\n");
return 1;
}
strcpy(plugin_name, argv[i]); strcpy(plugin_name, argv[i]);
strcpy(config_file, argv[i]); strcpy(config_file, argv[i]);
strcat(config_file, ".ini"); strcat(config_file, ".ini");
@@ -849,6 +854,7 @@ static int process_options(int argc, char *argv[], char *operation)
if (opt_basedir[i-1] != FN_LIBCHAR || opt_basedir[i-1] != FN_LIBCHAR2) if (opt_basedir[i-1] != FN_LIBCHAR || opt_basedir[i-1] != FN_LIBCHAR2)
{ {
char buff[FN_REFLEN]; char buff[FN_REFLEN];
memset(buff, 0, sizeof(buff));
strncpy(buff, opt_basedir, sizeof(buff) - 1); strncpy(buff, opt_basedir, sizeof(buff) - 1);
#ifdef __WIN__ #ifdef __WIN__

View File

@@ -1,6 +1,6 @@
/* /*
Copyright (c) 2006, 2013, Oracle and/or its affiliates. Copyright (c) 2006, 2013, Oracle and/or its affiliates.
Copyright (c) 2010, 2013, Monty Program Ab. Copyright (c) 2010, 2015, MariaDB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -53,6 +53,8 @@ static DYNAMIC_STRING conn_args;
static char *opt_password= 0; static char *opt_password= 0;
static char *opt_plugin_dir= 0, *opt_default_auth= 0; static char *opt_plugin_dir= 0, *opt_default_auth= 0;
static char *cnf_file_path= 0, defaults_file[FN_REFLEN + 32];
static my_bool tty_password= 0; static my_bool tty_password= 0;
static char opt_tmpdir[FN_REFLEN] = ""; static char opt_tmpdir[FN_REFLEN] = "";
@@ -109,6 +111,7 @@ static struct my_option my_long_options[]=
&opt_force, &opt_force, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, &opt_force, &opt_force, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", 0, {"host", 'h', "Connect to host.", 0,
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#define PASSWORD_OPT 12
{"password", 'p', {"password", 'p',
"Password to use when connecting to server. If password is not given," "Password to use when connecting to server. If password is not given,"
" it's solicited on the tty.", &opt_password,&opt_password, " it's solicited on the tty.", &opt_password,&opt_password,
@@ -146,6 +149,7 @@ static struct my_option my_long_options[]=
"do not try to upgrade the data.", "do not try to upgrade the data.",
&opt_systables_only, &opt_systables_only, 0, &opt_systables_only, &opt_systables_only, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#define USER_OPT (array_elements(my_long_options) - 6)
{"user", 'u', "User for login if not current user.", &opt_user, {"user", 'u', "User for login if not current user.", &opt_user,
&opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Display more output about the process.", {"verbose", 'v', "Display more output about the process.",
@@ -182,6 +186,8 @@ static void free_used_memory(void)
dynstr_free(&ds_args); dynstr_free(&ds_args);
dynstr_free(&conn_args); dynstr_free(&conn_args);
if (cnf_file_path)
my_delete(cnf_file_path, MYF(MY_WME));
} }
@@ -233,31 +239,32 @@ static void verbose(const char *fmt, ...)
this way we pass the same arguments on to mysql and mysql_check this way we pass the same arguments on to mysql and mysql_check
*/ */
static void add_one_option(DYNAMIC_STRING* ds, static void add_one_option_cmd_line(DYNAMIC_STRING *ds,
const struct my_option *opt, const struct my_option *opt,
const char* argument) const char* arg)
{ {
const char* eq= NullS; dynstr_append(ds, "--");
const char* arg= NullS; dynstr_append(ds, opt->name);
if (opt->arg_type != NO_ARG) if (arg)
{ {
eq= "="; dynstr_append(ds, "=");
switch (opt->var_type & GET_TYPE_MASK) { dynstr_append_os_quoted(ds, arg, NullS);
case GET_STR:
arg= argument;
break;
case GET_BOOL:
arg= (*(my_bool *)opt->value) ? "1" : "0";
break;
default:
die("internal error at %s: %d",__FILE__, __LINE__);
} }
}
dynstr_append_os_quoted(ds, "--", opt->name, eq, arg, NullS);
dynstr_append(ds, " "); dynstr_append(ds, " ");
} }
static void add_one_option_cnf_file(DYNAMIC_STRING *ds,
const struct my_option *opt,
const char* arg)
{
dynstr_append(ds, opt->name);
if (arg)
{
dynstr_append(ds, "=");
dynstr_append_os_quoted(ds, arg, NullS);
}
dynstr_append(ds, "\n");
}
static my_bool static my_bool
get_one_option(int optid, const struct my_option *opt, get_one_option(int optid, const struct my_option *opt,
@@ -288,16 +295,17 @@ get_one_option(int optid, const struct my_option *opt,
case 'p': case 'p':
if (argument == disabled_my_option) if (argument == disabled_my_option)
argument= (char*) ""; /* Don't require password */ argument= (char*) ""; /* Don't require password */
tty_password= 1;
add_option= FALSE; add_option= FALSE;
if (argument) if (argument)
{ {
/* Add password to ds_args before overwriting the arg with x's */ /* Add password to ds_args before overwriting the arg with x's */
add_one_option(&ds_args, opt, argument); add_one_option_cnf_file(&ds_args, opt, argument);
while (*argument) while (*argument)
*argument++= 'x'; /* Destroy argument */ *argument++= 'x'; /* Destroy argument */
tty_password= 0; tty_password= 0;
} }
else
tty_password= 1;
break; break;
case 't': case 't':
@@ -344,18 +352,18 @@ get_one_option(int optid, const struct my_option *opt,
case OPT_SHARED_MEMORY_BASE_NAME: /* --shared-memory-base-name */ case OPT_SHARED_MEMORY_BASE_NAME: /* --shared-memory-base-name */
case OPT_PLUGIN_DIR: /* --plugin-dir */ case OPT_PLUGIN_DIR: /* --plugin-dir */
case OPT_DEFAULT_AUTH: /* --default-auth */ case OPT_DEFAULT_AUTH: /* --default-auth */
add_one_option(&conn_args, opt, argument); add_one_option_cmd_line(&conn_args, opt, argument);
break; break;
} }
if (add_option) if (add_option)
{ {
/* /*
This is an option that is accpted by mysql_upgrade just so This is an option that is accepted by mysql_upgrade just so
it can be passed on to "mysql" and "mysqlcheck" it can be passed on to "mysql" and "mysqlcheck"
Save it in the ds_args string Save it in the ds_args string
*/ */
add_one_option(&ds_args, opt, argument); add_one_option_cnf_file(&ds_args, opt, argument);
} }
return 0; return 0;
} }
@@ -415,10 +423,7 @@ static int run_tool(char *tool_path, DYNAMIC_STRING *ds_res, ...)
while ((arg= va_arg(args, char *))) while ((arg= va_arg(args, char *)))
{ {
/* Options should be os quoted */ /* Options should already be os quoted */
if (strncmp(arg, "--", 2) == 0)
dynstr_append_os_quoted(&ds_cmdline, arg, NullS);
else
dynstr_append(&ds_cmdline, arg); dynstr_append(&ds_cmdline, arg);
dynstr_append(&ds_cmdline, " "); dynstr_append(&ds_cmdline, " ");
} }
@@ -566,8 +571,7 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res,
ret= run_tool(mysql_path, ret= run_tool(mysql_path,
ds_res, ds_res,
"--no-defaults", defaults_file,
ds_args.str,
"--database=mysql", "--database=mysql",
"--batch", /* Turns off pager etc. */ "--batch", /* Turns off pager etc. */
force ? "--force": "--skip-force", force ? "--force": "--skip-force",
@@ -756,8 +760,7 @@ static int run_mysqlcheck_upgrade(void)
print_conn_args("mysqlcheck"); print_conn_args("mysqlcheck");
retch= run_tool(mysqlcheck_path, retch= run_tool(mysqlcheck_path,
NULL, /* Send output from mysqlcheck directly to screen */ NULL, /* Send output from mysqlcheck directly to screen */
"--no-defaults", defaults_file,
ds_args.str,
"--check-upgrade", "--check-upgrade",
"--all-databases", "--all-databases",
"--auto-repair", "--auto-repair",
@@ -810,8 +813,7 @@ static int run_mysqlcheck_views(void)
print_conn_args("mysqlcheck"); print_conn_args("mysqlcheck");
return run_tool(mysqlcheck_path, return run_tool(mysqlcheck_path,
NULL, /* Send output from mysqlcheck directly to screen */ NULL, /* Send output from mysqlcheck directly to screen */
"--no-defaults", defaults_file,
ds_args.str,
"--all-databases", "--repair", "--all-databases", "--repair",
upgrade_views, upgrade_views,
"--skip-process-tables", "--skip-process-tables",
@@ -835,8 +837,7 @@ static int run_mysqlcheck_fixnames(void)
print_conn_args("mysqlcheck"); print_conn_args("mysqlcheck");
return run_tool(mysqlcheck_path, return run_tool(mysqlcheck_path,
NULL, /* Send output from mysqlcheck directly to screen */ NULL, /* Send output from mysqlcheck directly to screen */
"--no-defaults", defaults_file,
ds_args.str,
"--all-databases", "--all-databases",
"--fix-db-names", "--fix-db-names",
"--fix-table-names", "--fix-table-names",
@@ -1036,12 +1037,21 @@ int main(int argc, char **argv)
{ {
opt_password= get_tty_password(NullS); opt_password= get_tty_password(NullS);
/* add password to defaults file */ /* add password to defaults file */
dynstr_append_os_quoted(&ds_args, "--password=", opt_password, NullS); add_one_option_cnf_file(&ds_args, &my_long_options[PASSWORD_OPT], opt_password);
dynstr_append(&ds_args, " "); DBUG_ASSERT(strcmp(my_long_options[PASSWORD_OPT].name, "password") == 0);
} }
/* add user to defaults file */ /* add user to defaults file */
dynstr_append_os_quoted(&ds_args, "--user=", opt_user, NullS); add_one_option_cnf_file(&ds_args, &my_long_options[USER_OPT], opt_user);
dynstr_append(&ds_args, " "); DBUG_ASSERT(strcmp(my_long_options[USER_OPT].name, "user") == 0);
cnf_file_path= strmov(defaults_file, "--defaults-file=");
{
int fd= create_temp_file(cnf_file_path, opt_tmpdir[0] ? opt_tmpdir : NULL,
"mysql_upgrade-", O_CREAT | O_WRONLY, MYF(MY_FAE));
my_write(fd, USTRING_WITH_LEN( "[client]\n"), MYF(MY_FAE));
my_write(fd, (uchar*)ds_args.str, ds_args.length, MYF(MY_FAE));
my_close(fd, MYF(0));
}
/* Find mysql */ /* Find mysql */
find_tool(mysql_path, IF_WIN("mysql.exe", "mysql"), self_name); find_tool(mysql_path, IF_WIN("mysql.exe", "mysql"), self_name);

View File

@@ -1,6 +1,6 @@
/* /*
Copyright (c) 2001, 2011, Oracle and/or its affiliates. Copyright (c) 2001, 2011, Oracle and/or its affiliates.
Copyright (c) 2010, 2011, Monty Program Ab. Copyright (c) 2010, 2015, MariaDB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* /*
Copyright (c) 2000, 2013, Oracle and/or its affiliates. Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2010, 2013, Monty Program Ab. Copyright (c) 2010, 2015, Monty Program Ab.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -1116,16 +1116,14 @@ static int fetch_db_collation(const char *db_name,
int db_cl_size) int db_cl_size)
{ {
my_bool err_status= FALSE; my_bool err_status= FALSE;
char query[QUERY_LENGTH];
MYSQL_RES *db_cl_res; MYSQL_RES *db_cl_res;
MYSQL_ROW db_cl_row; MYSQL_ROW db_cl_row;
char quoted_database_buf[NAME_LEN*2+3];
char *qdatabase= quote_name(db_name, quoted_database_buf, 1);
my_snprintf(query, sizeof (query), "use %s", qdatabase); if (mysql_select_db(mysql, db_name))
{
if (mysql_query_with_error_report(mysql, NULL, query)) DB_error(mysql, "when selecting the database");
return 1; return 1; /* If --force */
}
if (mysql_query_with_error_report(mysql, &db_cl_res, if (mysql_query_with_error_report(mysql, &db_cl_res,
"select @@collation_database")) "select @@collation_database"))
@@ -2319,7 +2317,7 @@ static uint dump_routines_for_db(char *db)
/* Get database collation. */ /* Get database collation. */
if (fetch_db_collation(db_name_buff, db_cl_name, sizeof (db_cl_name))) if (fetch_db_collation(db, db_cl_name, sizeof (db_cl_name)))
DBUG_RETURN(1); DBUG_RETURN(1);
if (switch_character_set_results(mysql, "binary")) if (switch_character_set_results(mysql, "binary"))
@@ -2388,7 +2386,7 @@ static uint dump_routines_for_db(char *db)
if (mysql_num_fields(routine_res) >= 6) if (mysql_num_fields(routine_res) >= 6)
{ {
if (switch_db_collation(sql_file, db_name_buff, ";", if (switch_db_collation(sql_file, db, ";",
db_cl_name, row[5], &db_cl_altered)) db_cl_name, row[5], &db_cl_altered))
{ {
DBUG_RETURN(1); DBUG_RETURN(1);
@@ -2435,7 +2433,7 @@ static uint dump_routines_for_db(char *db)
if (db_cl_altered) if (db_cl_altered)
{ {
if (restore_db_collation(sql_file, db_name_buff, ";", db_cl_name)) if (restore_db_collation(sql_file, db, ";", db_cl_name))
DBUG_RETURN(1); DBUG_RETURN(1);
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
Copyright (c) 2000, 2012, Oracle and/or its affiliates. Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2010, 2012, Monty Program Ab Copyright (c) 2010, 2015, MariaDB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -369,7 +369,7 @@ list_dbs(MYSQL *mysql,const char *wild)
uint length, counter = 0; uint length, counter = 0;
ulong rowcount = 0L; ulong rowcount = 0L;
char tables[NAME_LEN+1], rows[NAME_LEN+1]; char tables[NAME_LEN+1], rows[NAME_LEN+1];
char query[255]; char query[NAME_LEN + 100];
MYSQL_FIELD *field; MYSQL_FIELD *field;
MYSQL_RES *result; MYSQL_RES *result;
MYSQL_ROW row= NULL, rrow; MYSQL_ROW row= NULL, rrow;
@@ -436,7 +436,8 @@ list_dbs(MYSQL *mysql,const char *wild)
MYSQL_ROW trow; MYSQL_ROW trow;
while ((trow = mysql_fetch_row(tresult))) while ((trow = mysql_fetch_row(tresult)))
{ {
sprintf(query,"SELECT COUNT(*) FROM `%s`",trow[0]); my_snprintf(query, sizeof(query),
"SELECT COUNT(*) FROM `%s`", trow[0]);
if (!(mysql_query(mysql,query))) if (!(mysql_query(mysql,query)))
{ {
MYSQL_RES *rresult; MYSQL_RES *rresult;
@@ -492,7 +493,7 @@ list_tables(MYSQL *mysql,const char *db,const char *table)
{ {
const char *header; const char *header;
uint head_length, counter = 0; uint head_length, counter = 0;
char query[255], rows[NAME_LEN], fields[16]; char query[NAME_LEN + 100], rows[NAME_LEN], fields[16];
MYSQL_FIELD *field; MYSQL_FIELD *field;
MYSQL_RES *result; MYSQL_RES *result;
MYSQL_ROW row, rrow; MYSQL_ROW row, rrow;
@@ -577,7 +578,8 @@ list_tables(MYSQL *mysql,const char *db,const char *table)
if (opt_verbose > 1) if (opt_verbose > 1)
{ {
/* Print the count of rows for each table */ /* Print the count of rows for each table */
sprintf(query,"SELECT COUNT(*) FROM `%s`",row[0]); my_snprintf(query, sizeof(query), "SELECT COUNT(*) FROM `%s`",
row[0]);
if (!(mysql_query(mysql,query))) if (!(mysql_query(mysql,query)))
{ {
if ((rresult = mysql_store_result(mysql))) if ((rresult = mysql_store_result(mysql)))
@@ -637,13 +639,15 @@ list_tables(MYSQL *mysql,const char *db,const char *table)
static int static int
list_table_status(MYSQL *mysql,const char *db,const char *wild) list_table_status(MYSQL *mysql,const char *db,const char *wild)
{ {
char query[1024],*end; char query[NAME_LEN + 100];
int len;
MYSQL_RES *result; MYSQL_RES *result;
MYSQL_ROW row; MYSQL_ROW row;
end=strxmov(query,"show table status from `",db,"`",NullS); len= sizeof(query);
if (wild && wild[0]) len-= my_snprintf(query, len, "show table status from `%s`", db);
strxmov(end," like '",wild,"'",NullS); if (wild && wild[0] && len)
strxnmov(query + strlen(query), len, " like '", wild, "'", NullS);
if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql))) if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql)))
{ {
fprintf(stderr,"%s: Cannot get status for db: %s, table: %s: %s\n", fprintf(stderr,"%s: Cannot get status for db: %s, table: %s: %s\n",
@@ -675,7 +679,8 @@ static int
list_fields(MYSQL *mysql,const char *db,const char *table, list_fields(MYSQL *mysql,const char *db,const char *table,
const char *wild) const char *wild)
{ {
char query[1024],*end; char query[NAME_LEN + 100];
int len;
MYSQL_RES *result; MYSQL_RES *result;
MYSQL_ROW row; MYSQL_ROW row;
ulong UNINIT_VAR(rows); ulong UNINIT_VAR(rows);
@@ -689,7 +694,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
if (opt_count) if (opt_count)
{ {
sprintf(query,"select count(*) from `%s`", table); my_snprintf(query, sizeof(query), "select count(*) from `%s`", table);
if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql))) if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql)))
{ {
fprintf(stderr,"%s: Cannot get record count for db: %s, table: %s: %s\n", fprintf(stderr,"%s: Cannot get record count for db: %s, table: %s: %s\n",
@@ -701,9 +706,11 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
mysql_free_result(result); mysql_free_result(result);
} }
end=strmov(strmov(strmov(query,"show /*!32332 FULL */ columns from `"),table),"`"); len= sizeof(query);
if (wild && wild[0]) len-= my_snprintf(query, len, "show /*!32332 FULL */ columns from `%s`",
strxmov(end," like '",wild,"'",NullS); table);
if (wild && wild[0] && len)
strxnmov(query + strlen(query), len, " like '", wild, "'", NullS);
if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql))) if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql)))
{ {
fprintf(stderr,"%s: Cannot list columns in db: %s, table: %s: %s\n", fprintf(stderr,"%s: Cannot list columns in db: %s, table: %s: %s\n",
@@ -724,7 +731,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
print_res_top(result); print_res_top(result);
if (opt_show_keys) if (opt_show_keys)
{ {
end=strmov(strmov(strmov(query,"show keys from `"),table),"`"); my_snprintf(query, sizeof(query), "show keys from `%s`", table);
if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql))) if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql)))
{ {
fprintf(stderr,"%s: Cannot list keys in db: %s, table: %s: %s\n", fprintf(stderr,"%s: Cannot list keys in db: %s, table: %s: %s\n",

View File

@@ -28,7 +28,7 @@ SET(CPACK_RPM_PACKAGE_NAME "MariaDB-Galera")
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${VERSION}-${RPM}-${CMAKE_SYSTEM_PROCESSOR}") SET(CPACK_PACKAGE_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${VERSION}-${RPM}-${CMAKE_SYSTEM_PROCESSOR}")
SET(CPACK_RPM_PACKAGE_RELEASE "1%{?dist}") SET(CPACK_RPM_PACKAGE_RELEASE "1%{?dist}")
SET(CPACK_RPM_PACKAGE_LICENSE "GPL") SET(CPACK_RPM_PACKAGE_LICENSE "GPLv2")
SET(CPACK_RPM_PACKAGE_RELOCATABLE FALSE) SET(CPACK_RPM_PACKAGE_RELOCATABLE FALSE)
SET(CPACK_RPM_PACKAGE_GROUP "Applications/Databases") SET(CPACK_RPM_PACKAGE_GROUP "Applications/Databases")
SET(CPACK_RPM_PACKAGE_URL "http://mariadb.org") SET(CPACK_RPM_PACKAGE_URL "http://mariadb.org")

View File

@@ -2,7 +2,7 @@
# flush-logs'd only once. # flush-logs'd only once.
# Else the binary logs would automatically increase by n times every day. # Else the binary logs would automatically increase by n times every day.
# - The error log is obsolete, messages go to syslog now. # - The error log is obsolete, messages go to syslog now.
/var/log/mysql.log /var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log { /var/log/mysql.log /var/log/mysql/mysql.log /var/log/mysql/mariadb-slow.log {
daily daily
rotate 7 rotate 7
missingok missingok

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -118,7 +118,7 @@ print_arrays_for(char *set)
{ {
FILE *f; FILE *f;
sprintf(buf, "%s.conf", set); snprintf(buf, sizeof(buf), "%s.conf", set);
if ((f = fopen(buf, "r")) == NULL) { if ((f = fopen(buf, "r")) == NULL) {
fprintf(stderr, "%s: can't read conf file for charset %s\n", prog, set); fprintf(stderr, "%s: can't read conf file for charset %s\n", prog, set);

View File

@@ -38,6 +38,9 @@ max_heap_table_size= 1M
loose-aria-pagecache-buffer-size=8M loose-aria-pagecache-buffer-size=8M
loose-feedback-user-info= mysql-test loose-feedback-user-info= mysql-test
loose-feedback-debug-startup-interval=20
loose-feedback-debug-first-interval=60
loose-feedback-debug-interval=60
loose-innodb_data_file_path= ibdata1:10M:autoextend loose-innodb_data_file_path= ibdata1:10M:autoextend
loose-innodb_buffer_pool_size= 8M loose-innodb_buffer_pool_size= 8M

View File

@@ -2477,3 +2477,9 @@ t1 CREATE TABLE `t1` (
`c` char(32) AS (convert(cast(n as char), char)) PERSISTENT `c` char(32) AS (convert(cast(n as char), char)) PERSISTENT
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
set @@session.collation_server=filename;
create table t1(a enum('',''));
Warnings:
Note 1291 Column 'a' has duplicated value '' in ENUM
drop table t1;
set @@session.collation_server=default;

View File

@@ -11,3 +11,6 @@ create table com1 (a int);
drop table com1; drop table com1;
create table `clock$` (a int); create table `clock$` (a int);
drop table `clock$`; drop table `clock$`;
select convert(convert(',' using filename) using binary);
convert(convert(',' using filename) using binary)
@002c

View File

@@ -5777,5 +5777,32 @@ SELECT (SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2);
ERROR 21000: Subquery returns more than 1 row ERROR 21000: Subquery returns more than 1 row
DROP TABLE t1, t2; DROP TABLE t1, t2;
# #
# MDEV-8630 Datetime value dropped in "INSERT ... SELECT ... ON DUPLICATE KEY"
#
SET NAMES utf8;
CREATE TABLE t1 (id2 int, ts timestamp);
INSERT INTO t1 VALUES (1,'2012-06-11 15:17:34'),(2,'2012-06-11 15:18:24');
CREATE TABLE t2 AS SELECT
COALESCE(ts, 0) AS c0,
GREATEST(COALESCE(ts, 0), COALESCE(ts, 0)) AS c1,
GREATEST(CASE WHEN 1 THEN ts ELSE 0 END, CASE WHEN 1 THEN ts ELSE 0 END) AS c2,
GREATEST(IFNULL(ts,0), IFNULL(ts,0)) AS c3,
GREATEST(IF(1,ts,0), IF(1,ts,0)) AS c4
FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`c0` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT '',
`c1` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT '',
`c2` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT '',
`c3` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT '',
`c4` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t2;
c0 c1 c2 c3 c4
2012-06-11 15:17:34 2012-06-11 15:17:34 2012-06-11 15:17:34 2012-06-11 15:17:34 2012-06-11 15:17:34
2012-06-11 15:18:24 2012-06-11 15:18:24 2012-06-11 15:18:24 2012-06-11 15:18:24 2012-06-11 15:18:24
DROP TABLE t2, t1;
#
# End of 5.5 tests # End of 5.5 tests
# #

View File

@@ -114,7 +114,7 @@ create table t_event3 (a int, b float);
drop event if exists event3; drop event if exists event3;
Warnings: Warnings:
Note 1305 Event event3 does not exist Note 1305 Event event3 does not exist
create event event3 on schedule every 50 + 10 minute starts date_add("20100101", interval 5 minute) ends date_add("20151010", interval 5 day) comment "portokala_comment" DO insert into t_event3 values (unix_timestamp(), rand()); create event event3 on schedule every 50 + 10 minute starts date_add(curdate(), interval 5 minute) ends date_add(curdate(), interval 5 day) comment "portokala_comment" DO insert into t_event3 values (unix_timestamp(), rand());
select count(*) from t_event3; select count(*) from t_event3;
count(*) count(*)
0 0

View File

@@ -551,7 +551,7 @@ MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE)
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1(a TEXT); CREATE TABLE t1(a TEXT);
SELECT GROUP_CONCAT(a) AS st FROM t1 HAVING MATCH(st) AGAINST('test' IN BOOLEAN MODE); SELECT GROUP_CONCAT(a) AS st FROM t1 HAVING MATCH(st) AGAINST('test' IN BOOLEAN MODE);
ERROR HY000: Incorrect arguments to AGAINST ERROR HY000: Incorrect arguments to MATCH
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1(a VARCHAR(64), FULLTEXT(a)); CREATE TABLE t1(a VARCHAR(64), FULLTEXT(a));
INSERT INTO t1 VALUES('awrd bwrd cwrd'),('awrd bwrd cwrd'),('awrd bwrd cwrd'); INSERT INTO t1 VALUES('awrd bwrd cwrd'),('awrd bwrd cwrd'),('awrd bwrd cwrd');

View File

@@ -102,7 +102,7 @@ ERROR: Missing --plugin_dir option.
# Show the help. # Show the help.
# #
mysql_plugin Ver V.V.VV Distrib XX.XX.XX mysql_plugin Ver V.V.VV Distrib XX.XX.XX
Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
Enable or disable plugins. Enable or disable plugins.

View File

@@ -36,7 +36,7 @@ Phase 4/4: Running 'mysql_fix_privilege_tables'
OK OK
Run it again - should say already completed Run it again - should say already completed
This installation of MySQL is already upgraded to VERSION, use --force if you still need to run mysql_upgrade This installation of MySQL is already upgraded to VERSION, use --force if you still need to run mysql_upgrade
Force should run it regardless of wether it's been run before Force should run it regardless of whether it has been run before
Phase 1/4: Fixing views Phase 1/4: Fixing views
Phase 2/4: Fixing table and database names Phase 2/4: Fixing table and database names
Phase 3/4: Checking and upgrading tables Phase 3/4: Checking and upgrading tables
@@ -298,6 +298,13 @@ test
Phase 4/4: Running 'mysql_fix_privilege_tables' Phase 4/4: Running 'mysql_fix_privilege_tables'
OK OK
# #
# Bug #21489398: MYSQL_UPGRADE: FATAL ERROR: UPGRADE FAILED - IMPROVE ERROR
#
Run mysql_upgrade with unauthorized access
Version check failed. Got the following error when calling the 'mysql' command line client
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
FATAL ERROR: Upgrade failed
#
# MDEV-4332 Increase username length from 16 characters # MDEV-4332 Increase username length from 16 characters
# MDEV-6068, MDEV-6178 mysql_upgrade breaks databases with long user names # MDEV-6068, MDEV-6178 mysql_upgrade breaks databases with long user names
# #

View File

@@ -5312,3 +5312,29 @@ Usage: mysqldump [OPTIONS] database [tables]
OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...] OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
OR mysqldump [OPTIONS] --all-databases [OPTIONS] OR mysqldump [OPTIONS] --all-databases [OPTIONS]
For more options, use mysqldump --help For more options, use mysqldump --help
#
# MDEV-9001 - [PATCH] Fix DB name quoting in mysqldump --routine
#
CREATE DATABASE `a\"'``b`;
USE `a\"'``b`;
CREATE PROCEDURE p1() BEGIN END;
ALTER DATABASE `a\"'``b` COLLATE utf8_general_ci;
ALTER DATABASE `a\"'``b` CHARACTER SET latin1 COLLATE latin1_swedish_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
BEGIN END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
ALTER DATABASE `a\"'``b` CHARACTER SET utf8 COLLATE utf8_general_ci ;
DROP DATABASE `a\"'``b`;

View File

@@ -4052,3 +4052,24 @@ SELECT 1 FROM t1 GROUP BY 0 OR 18446744073709551615+1;
ERROR 22003: BIGINT UNSIGNED value is out of range in '(18446744073709551615 + 1)' ERROR 22003: BIGINT UNSIGNED value is out of range in '(18446744073709551615 + 1)'
drop table t1; drop table t1;
# End of 5.3 tests # End of 5.3 tests
#
# MDEV-8756: MariaDB 10.0.21 crashes during PREPARE
#
CREATE TABLE t1 ( id INT(10), value INT(10) );
CREATE TABLE t2 ( id INT(10) );
SET @save_sql_mode= @@sql_mode;
SET SESSION sql_mode = 'ONLY_FULL_GROUP_BY';
PREPARE stmt FROM 'UPDATE t1 t1 SET value = (SELECT 1 FROM t2 WHERE id = t1.id)';
execute stmt;
insert into t1 values (1,10),(2,10),(3,10);
insert into t2 values (1),(2);
execute stmt;
select * from t1;
id value
1 1
2 1
3 NULL
deallocate prepare stmt;
SET SESSION sql_mode = @save_sql_mode;
DROP TABLE t1,t2;
# End of 10.0 tests

View File

@@ -0,0 +1,22 @@
#
# CHANGE MASTER TO doesn't work with prepared statements
#
CHANGE MASTER TO MASTER_HOST='host1', MASTER_USER='user1';
# Master_Host : host1
# Master_User : user1
SET @s := "CHANGE MASTER TO MASTER_HOST='host2'";
PREPARE stmt FROM @s;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
# Master_Host : host2
# Master_User : user1
SET @s := "CHANGE MASTER TO MASTER_USER='user2'";
PREPARE stmt FROM @s;
EXECUTE stmt;
EXECUTE stmt;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
# Master_Host : host2
# Master_User : user2
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root';
# End of test

View File

@@ -2100,3 +2100,16 @@ count(*)
40960 40960
drop table t1; drop table t1;
set names default; set names default;
create table t2 (a int, b int, c int, d int, key x(a, b));
insert into t2 values (2, 2, 2, 2), (3, 3, 3, 3), (4, 4, 4, 4), (5, 5, 5, 5),
(6, 6, 6, 6), (7, 7, 7, 7), (8, 8, 8, 8), (9, 9, 9, 9);
insert into t2 select * from t2;
insert into t2 values (0, 0, 0, 0), (1, 1, 1, 1);
analyze table t2;
Table Op Msg_type Msg_text
test.t2 analyze status OK
select a, b from t2 where (a, b) in ((0, 0), (1, 1));
a b
0 0
1 1
drop table t2;

View File

@@ -2102,4 +2102,17 @@ count(*)
40960 40960
drop table t1; drop table t1;
set names default; set names default;
create table t2 (a int, b int, c int, d int, key x(a, b));
insert into t2 values (2, 2, 2, 2), (3, 3, 3, 3), (4, 4, 4, 4), (5, 5, 5, 5),
(6, 6, 6, 6), (7, 7, 7, 7), (8, 8, 8, 8), (9, 9, 9, 9);
insert into t2 select * from t2;
insert into t2 values (0, 0, 0, 0), (1, 1, 1, 1);
analyze table t2;
Table Op Msg_type Msg_text
test.t2 analyze status OK
select a, b from t2 where (a, b) in ((0, 0), (1, 1));
a b
0 0
1 1
drop table t2;
set optimizer_switch=@mrr_icp_extra_tmp; set optimizer_switch=@mrr_icp_extra_tmp;

View File

@@ -0,0 +1,80 @@
create table test_table (
column_number_1 enum('1','2') not null,
column_number_2 enum('1','2','3','4','5','6','7','8','9','10','11','12') not null,
column_number_3 varchar(10) not null,
column_number_4 varchar(10) not null,
column_number_5 enum(
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa01',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa02',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa03',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa04',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa05',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa06',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa07',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa08',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa09',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa10',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa11',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa12',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa13',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa14',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa15',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa16',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa17',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa18',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa19',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa20',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa21',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa22',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa23',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa24',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa25',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa26',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa27',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa28',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa29',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa30',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa31',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa32',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa33',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa34',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa35',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa36',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa37',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa38',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa39',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa40',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa41',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa42',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa43',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa44',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa45',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa46',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa47',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa48',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa49',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa50',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa51',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa52'
) not null,
column_number_6 enum('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','65','66','67','68','69','70','71','72','73','74','75','76','77','78','79','80','81','82','83','84','85','86','87','88','89','90','91','92','93','94','95','96','97','98','99','100','101','102','103','104','105','106','107','108','109','110','111','112','113','114','115','116','117','118','119','120','121','122','123','124','125','126','127','128','129','130','131') not null,
column_number_7 enum('1','2','3','4','5','6','7') not null,
column_number_8 enum('8') not null,
column_number_9 enum('9') not null,
column_number_10 varchar(10) not null,
column_number_11 enum('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49') not null
) default charset=utf8mb4;
show columns from test_table;
Field Type Null Key Default Extra
column_number_1 enum('1','2') NO NULL
column_number_2 enum('1','2','3','4','5','6','7','8','9','10','11','12') NO NULL
column_number_3 varchar(10) NO NULL
column_number_4 varchar(10) NO NULL
column_number_5 enum('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa01','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa02','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa03','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa04','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa05','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa06','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa07','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa08','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa09','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa10','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa11','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa12','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa13','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa14','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa15','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa16','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa17','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa18','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa19','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa20','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa21','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa22','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa23','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa24','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa25','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa26','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa27','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa28','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa29','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa30','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa31','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa32','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa33','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa34','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa35','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa36','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa37','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa38','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa39','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa40','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa41','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa42','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa43','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa44','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa45','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa46','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa47','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa48','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa49','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa50','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa51','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa52') NO NULL
column_number_6 enum('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','65','66','67','68','69','70','71','72','73','74','75','76','77','78','79','80','81','82','83','84','85','86','87','88','89','90','91','92','93','94','95','96','97','98','99','100','101','102','103','104','105','106','107','108','109','110','111','112','113','114','115','116','117','118','119','120','121','122','123','124','125','126','127','128','129','130','131') NO NULL
column_number_7 enum('1','2','3','4','5','6','7') NO NULL
column_number_8 enum('8') NO NULL
column_number_9 enum('9') NO NULL
column_number_10 varchar(10) NO NULL
column_number_11 enum('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49') NO NULL
drop table test_table;

View File

@@ -0,0 +1,6 @@
create function sequence returns integer soname "UDF_EXAMPLE_LIB";
create table t1 (n int key not null auto_increment, msg int as (sequence()) virtual);
select * from t1;
n msg
drop table t1;
drop function sequence;

View File

@@ -618,3 +618,62 @@ Variable_name Value
Handler_update 5 Handler_update 5
ROLLBACK; ROLLBACK;
DROP TABLE t1, t2; DROP TABLE t1, t2;
#
# MDEV-8938: Server Crash on Update with joins
#
CREATE TABLE `t1` (
`name` varchar(255) NOT NULL,
`value` varchar(4095) DEFAULT NULL,
PRIMARY KEY (`name`)
);
UPDATE `t1` SET value = CONCAT("*.",(SELECT `temptable`.`value` FROM (SELECT * FROM `t1` WHERE `name`="consoleproxy.url.domain") AS `temptable` WHERE `temptable`.`name`="consoleproxy.url.domain")) WHERE `name`="consoleproxy.url.domain";
drop table t1;
CREATE TABLE `t1` (
`name` varchar(255) NOT NULL,
`value` varchar(4095) DEFAULT NULL,
PRIMARY KEY (`name`)
);
create table t2 (
`name` varchar(255) NOT NULL,
`value` varchar(4095) DEFAULT NULL,
PRIMARY KEY (`name`)
);
UPDATE t1
SET value = (SELECT value FROM t2 WHERE `name`= t1.name)
WHERE value is null ;
drop table t1,t2;
#
#MDEV-8701: Crash on derived query
#
CREATE TABLE t1 (
data_exit_entry_id int(11) NOT NULL,
data_entry_id int(11) NOT NULL,
data_entry_exit_id int(11) NOT NULL,
data_exit_entry_quantity double NOT NULL
) DEFAULT CHARSET=utf8;
CREATE TABLE t2 (
data_entry_id int(11) NOT NULL,
data_entry_cost double NOT NULL,
data_entry_quantity double NOT NULL
) DEFAULT CHARSET=utf8;
create algorithm=temptable view v1 as SELECT data_entry_exit_id, data_exit_entry_quantity, data_entry_cost
FROM t1 INNER JOIN t2 as dt ON dt.data_entry_id = t1.data_entry_id;
UPDATE t2
SET data_entry_cost
= ( ( SELECT SUM(data_exit_entry_quantity * data_entry_cost)
FROM
v1 AS query
WHERE data_entry_exit_id = t2.data_entry_id
)
);
UPDATE t2
SET data_entry_cost
= ( ( SELECT SUM(data_exit_entry_quantity * data_entry_cost)
FROM
( SELECT data_entry_exit_id, data_exit_entry_quantity, data_entry_cost
FROM t1 INNER JOIN t2 as dt ON dt.data_entry_id = t1.data_entry_id) AS query
WHERE data_entry_exit_id = t2.data_entry_id
)
);
drop view v1;
drop table t1, t2;

View File

@@ -5479,6 +5479,39 @@ UPDATE t1, t2 SET a = 1 WHERE a IN ( SELECT 0 FROM v3 );
EXECUTE stmt; EXECUTE stmt;
DROP TABLE t1, t2, t3; DROP TABLE t1, t2, t3;
DROP VIEW v3; DROP VIEW v3;
#
# MDEV-8632: Segmentation fault on INSERT
#
CREATE TABLE `t1` (
`id` int(10) unsigned NOT NULL,
`r` float NOT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
create view v1 as select id, if(r=r,1,2) as d from t1;
create view v2 as
select id,
d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d as p
from v1;
insert into t1 (id, r)
select id,p from
(
select id,
d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d as p
from (
select id, if(r=r,1,2) as d
from t1
) a
) b
on duplicate key update r=p;
insert into t1 (id, r)
select id,p from v2
on duplicate key update r=p;
prepare stmt from "insert into t1 (id, r) select id,p from v2 on duplicate key update r=p";
execute stmt;
execute stmt;
deallocate prepare stmt;
drop view v1,v2;
drop table `t1`;
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# -- End of 5.5 tests. # -- End of 5.5 tests.
# ----------------------------------------------------------------- # -----------------------------------------------------------------

View File

@@ -0,0 +1,27 @@
CREATE DATABASE federated;
CREATE DATABASE federated;
connection slave;
create table t1 (foo int, bar int);
connection master;
create server 's1' foreign data wrapper 'mysql' options
(HOST 'localhost',
DATABASE 'test',
USER 'root',
PASSWORD '',
SOCKET 'SLAVE_MYSOCK');
create table t1 (foo integer, bar integer) engine=federated
connection='s1';
select * from t1;
foo bar
connection slave;
connection master;
drop table t1;
drop server s1;
connection slave;
drop table t1;
connection master;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;
connection slave;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;

View File

@@ -0,0 +1,38 @@
#
# MDEV-8313 Got an error writing communication packets
#
source include/federated.inc;
enable_connect_log;
connection slave;
create table t1 (foo int, bar int);
connection master;
--replace_result $SLAVE_MYSOCK SLAVE_MYSOCK
eval create server 's1' foreign data wrapper 'mysql' options
(HOST 'localhost',
DATABASE 'test',
USER 'root',
PASSWORD '',
SOCKET '$SLAVE_MYSOCK');
eval create table t1 (foo integer, bar integer) engine=federated
connection='s1';
select * from t1;
connection slave;
source include/restart_mysqld.inc;
connection master;
drop table t1;
drop server s1;
connection slave;
drop table t1;
source include/federated_cleanup.inc;

View File

@@ -0,0 +1,9 @@
#
# Bug #19929435 DROP DATABASE HANGS WITH MALFORMED TABLE
#
set session default_storage_engine=innodb;
create database `b`;
use `b`;
create table `#mysql50#q.q` select 1;
ERROR 42000: Incorrect table name '#mysql50#q.q'
drop database `b`;

View File

@@ -585,7 +585,7 @@ auto_increment_increment 65535
auto_increment_offset 65535 auto_increment_offset 65535
wsrep_auto_increment_control ON wsrep_auto_increment_control ON
INSERT INTO t1 VALUES (NULL),(NULL); INSERT INTO t1 VALUES (NULL),(NULL);
ERROR 22003: Out of range value for column 'c1' at row 1 ERROR HY000: Failed to read auto-increment value from storage engine
SELECT * FROM t1; SELECT * FROM t1;
c1 c1
1 1
@@ -660,6 +660,18 @@ PRIMARY KEY (m)) ENGINE = InnoDB;
INSERT INTO t2 (n,o) VALUES INSERT INTO t2 (n,o) VALUES
(1 , 'true'), (1 , 'false'), (2 , 'true'), (2 , 'false'), (3 , 'true'), (1 , 'true'), (1 , 'false'), (2 , 'true'), (2 , 'false'), (3 , 'true'),
(3 , 'false'), (4 , 'true'), (4 , 'false'), (5 , 'true'), (5 , 'false'); (3 , 'false'), (4 , 'true'), (4 , 'false'), (5 , 'true'), (5 , 'false');
SELECT * FROM t2;
m n o
1 1 TRUE
2 1 FALSE
3 2 TRUE
4 2 FALSE
5 3 TRUE
6 3 FALSE
7 4 TRUE
8 4 FALSE
9 5 TRUE
10 5 FALSE
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
@@ -667,7 +679,7 @@ t2 CREATE TABLE `t2` (
`n` int(10) unsigned NOT NULL, `n` int(10) unsigned NOT NULL,
`o` enum('FALSE','TRUE') DEFAULT NULL, `o` enum('FALSE','TRUE') DEFAULT NULL,
PRIMARY KEY (`m`) PRIMARY KEY (`m`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1 ) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1
INSERT INTO t1 (b,c) SELECT n,o FROM t2 ; INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table

View File

@@ -24,7 +24,7 @@ create table t2(a int, constraint a foreign key a (a) references t1(a)) engine=i
ERROR HY000: Can't create table 'test.t2' (errno: 150) ERROR HY000: Can't create table 'test.t2' (errno: 150)
show warnings; show warnings;
Level Code Message Level Code Message
Warning 150 Create table '`test`.`t2`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns. Error close to foreign key a (a) references t1(a)) engine=innodb. Warning 150 Create table '`test`.`t2`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns near ' foreign key a (a) references t1(a)) engine=innodb'.
Error 1005 Can't create table 'test.t2' (errno: 150) Error 1005 Can't create table 'test.t2' (errno: 150)
drop table t1; drop table t1;
create table t1(a int not null primary key, b int) engine=innodb; create table t1(a int not null primary key, b int) engine=innodb;
@@ -33,14 +33,14 @@ constraint a foreign key a (a) references t1(b)) engine=innodb;
ERROR HY000: Can't create table 'test.t2' (errno: 150) ERROR HY000: Can't create table 'test.t2' (errno: 150)
show warnings; show warnings;
Level Code Message Level Code Message
Warning 150 Create table '`test`.`t2`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns. Error close to foreign key a (a) references t1(b)) engine=innodb. Warning 150 Create table '`test`.`t2`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns near ' foreign key a (a) references t1(b)) engine=innodb'.
Error 1005 Can't create table 'test.t2' (errno: 150) Error 1005 Can't create table 'test.t2' (errno: 150)
create table t2(a int, b int, constraint a foreign key a (a) references t1(a)) engine=innodb; create table t2(a int, b int, constraint a foreign key a (a) references t1(a)) engine=innodb;
alter table t2 add constraint b foreign key (b) references t2(b); alter table t2 add constraint b foreign key (b) references t2(b);
ERROR HY000: Can't create table '#sql-temporary' (errno: 150) ERROR HY000: Can't create table '#sql-temporary' (errno: 150)
show warnings; show warnings;
Level Code Message Level Code Message
Warning 150 Alter table '`test`.`t2`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns. Error close to foreign key (b) references t2(b). Warning 150 Alter table '`test`.`t2`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns near ' foreign key (b) references t2(b)'.
Error 1005 Can't create table '#sql-temporary' (errno: 150) Error 1005 Can't create table '#sql-temporary' (errno: 150)
drop table t2, t1; drop table t2, t1;
create table t1 (f1 integer primary key) engine=innodb; create table t1 (f1 integer primary key) engine=innodb;
@@ -48,7 +48,7 @@ alter table t1 add constraint c1 foreign key (f1) references t11(f1);
ERROR HY000: Can't create table '#sql-temporary' (errno: 150) ERROR HY000: Can't create table '#sql-temporary' (errno: 150)
show warnings; show warnings;
Level Code Message Level Code Message
Warning 150 Alter table `test`.`t1` with foreign key constraint failed. Referenced table `test`.`t11` not found in the data dictionary close to foreign key (f1) references t11(f1). Warning 150 Alter table `test`.`t1` with foreign key constraint failed. Referenced table `test`.`t11` not found in the data dictionary near ' foreign key (f1) references t11(f1)'.
Error 1005 Can't create table '#sql-temporary' (errno: 150) Error 1005 Can't create table '#sql-temporary' (errno: 150)
drop table t1; drop table t1;
create temporary table t1(a int not null primary key, b int, key(b)) engine=innodb; create temporary table t1(a int not null primary key, b int, key(b)) engine=innodb;
@@ -56,13 +56,13 @@ create temporary table t2(a int, foreign key(a) references t1(a)) engine=innodb;
ERROR HY000: Can't create table 'test.t2' (errno: 150) ERROR HY000: Can't create table 'test.t2' (errno: 150)
show warnings; show warnings;
Level Code Message Level Code Message
Warning 150 Create table `mysqld.1`.`t2` with foreign key constraint failed. Referenced table `mysqld.1`.`t1` not found in the data dictionary close to foreign key(a) references t1(a)) engine=innodb. Warning 150 Create table `mysqld.1`.`t2` with foreign key constraint failed. Referenced table `mysqld.1`.`t1` not found in the data dictionary near 'foreign key(a) references t1(a)) engine=innodb'.
Error 1005 Can't create table 'test.t2' (errno: 150) Error 1005 Can't create table 'test.t2' (errno: 150)
alter table t1 add foreign key(b) references t1(a); alter table t1 add foreign key(b) references t1(a);
ERROR HY000: Can't create table '#sql-temporary' (errno: 150) ERROR HY000: Can't create table '#sql-temporary' (errno: 150)
show warnings; show warnings;
Level Code Message Level Code Message
Warning 150 Alter table `mysqld.1`.`t1` with foreign key constraint failed. Referenced table `mysqld.1`.`t1` not found in the data dictionary close to foreign key(b) references t1(a). Warning 150 Alter table `mysqld.1`.`t1` with foreign key constraint failed. Referenced table `mysqld.1`.`t1` not found in the data dictionary near 'foreign key(b) references t1(a)'.
Error 1005 Can't create table '#sql-temporary' (errno: 150) Error 1005 Can't create table '#sql-temporary' (errno: 150)
drop table t1; drop table t1;
create table t1(a int not null primary key, b int, key(b)) engine=innodb; create table t1(a int not null primary key, b int, key(b)) engine=innodb;
@@ -70,7 +70,8 @@ alter table t1 add foreign key(a,b) references t1(a);
ERROR HY000: Can't create table '#sql-temporary' (errno: 150) ERROR HY000: Can't create table '#sql-temporary' (errno: 150)
show warnings; show warnings;
Level Code Message Level Code Message
Warning 150 Alter table `test`.`t1` with foreign key constraint failed. Foreign key constraint parse error in foreign key(a,b) references t1(a) close to ). Too few referenced columns, you have 1 when you should have 2. Warning 150 Alter table `test`.`t1` with foreign key constraint failed. Parse error in 'foreign key(a,b) references t1(a)' near ')'. Referencing column count 1 does not match referenced column count 2.
Error 1005 Can't create table '#sql-temporary' (errno: 150) Error 1005 Can't create table '#sql-temporary' (errno: 150)
drop table t1; drop table t1;
create table t1(a int not null primary key, b int, key(b)) engine=innodb; create table t1(a int not null primary key, b int, key(b)) engine=innodb;
@@ -78,7 +79,8 @@ alter table t1 add foreign key(a) references t1(a,b);
ERROR HY000: Can't create table '#sql-temporary' (errno: 150) ERROR HY000: Can't create table '#sql-temporary' (errno: 150)
show warnings; show warnings;
Level Code Message Level Code Message
Warning 150 Alter table `test`.`t1` with foreign key constraint failed. Foreign key constraint parse error in foreign key(a) references t1(a,b) close to ). Too few referenced columns, you have 2 when you should have 1. Warning 150 Alter table `test`.`t1` with foreign key constraint failed. Parse error in 'foreign key(a) references t1(a,b)' near ')'. Referencing column count 2 does not match referenced column count 1.
Error 1005 Can't create table '#sql-temporary' (errno: 150) Error 1005 Can't create table '#sql-temporary' (errno: 150)
drop table t1; drop table t1;
create table t1 (f1 integer not null primary key) engine=innodb; create table t1 (f1 integer not null primary key) engine=innodb;
@@ -86,13 +88,13 @@ alter table t1 add constraint c1 foreign key (f1) references t1(f1) on update se
ERROR HY000: Can't create table '#sql-temporary' (errno: 150) ERROR HY000: Can't create table '#sql-temporary' (errno: 150)
show warnings; show warnings;
Level Code Message Level Code Message
Warning 150 Alter table `test`.`t1` with foreign key constraint failed. You have defined a SET NULL condition but column f1 is defined as NOT NULL in foreign key (f1) references t1(f1) on update set null close to on update set null. Warning 150 Alter table `test`.`t1` with foreign key constraint failed. You have defined a SET NULL condition but column 'f1' is defined as NOT NULL in ' foreign key (f1) references t1(f1) on update set null' near ' on update set null'.
Error 1005 Can't create table '#sql-temporary' (errno: 150) Error 1005 Can't create table '#sql-temporary' (errno: 150)
create table t2(a int not null, foreign key(a) references t1(f1) on delete set null) engine=innodb; create table t2(a int not null, foreign key(a) references t1(f1) on delete set null) engine=innodb;
ERROR HY000: Can't create table 'test.t2' (errno: 150) ERROR HY000: Can't create table 'test.t2' (errno: 150)
show warnings; show warnings;
Level Code Message Level Code Message
Warning 150 Create table `test`.`t2` with foreign key constraint failed. You have defined a SET NULL condition but column a is defined as NOT NULL in foreign key(a) references t1(f1) on delete set null) engine=innodb close to on delete set null) engine=innodb. Warning 150 Create table `test`.`t2` with foreign key constraint failed. You have defined a SET NULL condition but column 'a' is defined as NOT NULL in 'foreign key(a) references t1(f1) on delete set null) engine=innodb' near ' on delete set null) engine=innodb'.
Error 1005 Can't create table 'test.t2' (errno: 150) Error 1005 Can't create table 'test.t2' (errno: 150)
drop table t1; drop table t1;
create table t1 (id int not null primary key, f1 int, f2 int, key(f1)) engine=innodb; create table t1 (id int not null primary key, f1 int, f2 int, key(f1)) engine=innodb;
@@ -100,6 +102,6 @@ create table t2(a char(20), key(a), foreign key(a) references t1(f1)) engine=inn
ERROR HY000: Can't create table 'test.t2' (errno: 150) ERROR HY000: Can't create table 'test.t2' (errno: 150)
show warnings; show warnings;
Level Code Message Level Code Message
Warning 150 Create table `test`.`t2` with foreign key constraint failed. Field type or character set for column a does not mach referenced column f1 close to foreign key(a) references t1(f1)) engine=innodb Warning 150 Create table `test`.`t2` with foreign key constraint failed. Field type or character set for column 'a' does not mach referenced column 'f1' near 'foreign key(a) references t1(f1)) engine=innodb'.
Error 1005 Can't create table 'test.t2' (errno: 150) Error 1005 Can't create table 'test.t2' (errno: 150)
drop table t1; drop table t1;

View File

@@ -50,8 +50,8 @@ CONSTRAINT fk3 FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE
ERROR HY000: Can't create table 'test.t2' (errno: 150) ERROR HY000: Can't create table 'test.t2' (errno: 150)
show warnings; show warnings;
Level Code Message Level Code Message
Warning 150 Create table `test`.`t2` with foreign key constraint failed. Referenced table `test`.`t3` not found in the data dictionary close to FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE Warning 150 Create table `test`.`t2` with foreign key constraint failed. Referenced table `test`.`t3` not found in the data dictionary near ' FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE
) ENGINE=InnoDB. ) ENGINE=InnoDB'.
Error 1005 Can't create table 'test.t2' (errno: 150) Error 1005 Can't create table 'test.t2' (errno: 150)
CREATE TABLE t2 ( CREATE TABLE t2 (
id int(11) NOT NULL AUTO_INCREMENT, id int(11) NOT NULL AUTO_INCREMENT,
@@ -64,7 +64,7 @@ ALTER TABLE t2 ADD CONSTRAINT fk3 FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE
ERROR HY000: Can't create table '#sql-temporary' (errno: 150) ERROR HY000: Can't create table '#sql-temporary' (errno: 150)
show warnings; show warnings;
Level Code Message Level Code Message
Warning 150 Alter table `test`.`t2` with foreign key constraint failed. Referenced table `test`.`t3` not found in the data dictionary close to FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE. Warning 150 Alter table `test`.`t2` with foreign key constraint failed. Referenced table `test`.`t3` not found in the data dictionary near ' FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE'.
Error 1005 Can't create table '#sql-temporary' (errno: 150) Error 1005 Can't create table '#sql-temporary' (errno: 150)
drop table t2; drop table t2;
drop table t1; drop table t1;

View File

@@ -0,0 +1,2 @@
CREATE TABLE t1 ENGINE=InnoDB AS SELECT * FROM mysql.help_topic;
DROP TABLE t1;

View File

@@ -0,0 +1,12 @@
--source include/have_innodb.inc
--echo #
--echo # Bug #19929435 DROP DATABASE HANGS WITH MALFORMED TABLE
--echo #
set session default_storage_engine=innodb;
create database `b`;
use `b`;
--error ER_WRONG_TABLE_NAME
create table `#mysql50#q.q` select 1;
drop database `b`;

View File

@@ -349,7 +349,7 @@ INSERT INTO t1 VALUES (18446744073709551610); #-- 2^64 - 2
SELECT * FROM t1; SELECT * FROM t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCREMENT_OFFSET=1152921504606846976; SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCREMENT_OFFSET=1152921504606846976;
SHOW VARIABLES LIKE "%auto_inc%"; SHOW VARIABLES LIKE "%auto_inc%";
--error 167 --error 1467
INSERT INTO t1 VALUES (NULL),(NULL); INSERT INTO t1 VALUES (NULL),(NULL);
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
@@ -401,6 +401,7 @@ CREATE TABLE t2 (
INSERT INTO t2 (n,o) VALUES INSERT INTO t2 (n,o) VALUES
(1 , 'true'), (1 , 'false'), (2 , 'true'), (2 , 'false'), (3 , 'true'), (1 , 'true'), (1 , 'false'), (2 , 'true'), (2 , 'false'), (3 , 'true'),
(3 , 'false'), (4 , 'true'), (4 , 'false'), (5 , 'true'), (5 , 'false'); (3 , 'false'), (4 , 'true'), (4 , 'false'), (5 , 'true'), (5 , 'false');
SELECT * FROM t2;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
INSERT INTO t1 (b,c) SELECT n,o FROM t2 ; INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;

View File

@@ -0,0 +1,29 @@
--loose-innodb_trx
--loose-innodb_locks
--loose-innodb_lock_waits
--loose-innodb_cmp
--loose-innodb_cmp_reset
--loose-innodb_cmp_per_index
--loose-innodb_cmp_per_index_reset
--loose-innodb_cmpmem
--loose-innodb_cmpmem_reset
--loose-innodb_buffer_page
--loose-innodb_buffer_page_lru
--loose-innodb_buffer_stats
--loose-innodb_sys_tables
--loose-innodb_sys_tablestats
--loose-innodb_sys_indexes
--loose-innodb_sys_columns
--loose-innodb_sys_fields
--loose-innodb_sys_foreign
--loose-innodb_sys_foreign_cols
--loose-innodb_changed_pages
--loose-innodb_rseg
--loose-innodb_undo_logs
--loose-innodb_sys_stats
--loose-innodb_table_stats
--loose-innodb_index_stats
--loose-innodb_admin_command
--loose-innodb_buffer_pool_pages
--loose-innodb_buffer_pool_pages_index
--loose-innodb_buffer_pool_pages_blob

View File

@@ -0,0 +1,64 @@
-- source include/have_innodb.inc
-- source include/not_embedded.inc
#
# MDEV-7762 InnoDB: Failing assertion: block->page.buf_fix_count > 0 in buf0buf.ic line 730
#
# Make sure that all supported information_schema tables are readable
# (actual result sets are not important).
#
CREATE TABLE t1 ENGINE=InnoDB AS SELECT * FROM mysql.help_topic;
--disable_query_log
--disable_result_log
BEGIN;
SELECT * FROM t1 FOR UPDATE;
SELECT * FROM INFORMATION_SCHEMA.INNODB_TRX;
SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS;
SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS;
SELECT * FROM INFORMATION_SCHEMA.INNODB_CMP;
SELECT * FROM INFORMATION_SCHEMA.INNODB_CMP_RESET;
SELECT * FROM INFORMATION_SCHEMA.INNODB_CMPMEM;
SELECT * FROM INFORMATION_SCHEMA.INNODB_CMPMEM_RESET;
SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE;
SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRU;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_STATS;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_RSEG;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_UNDO_LOGS;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_STATS;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLE_STATS;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_INDEX_STATS;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_ADMIN_COMMAND;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_POOL_PAGES;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_POOL_PAGES_INDEX;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_POOL_PAGES_BLOB;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES;
COMMIT;
--enable_query_log
--enable_result_log
DROP TABLE t1;

View File

@@ -3,7 +3,8 @@ select plugin_status from information_schema.plugins where plugin_name='feedback
plugin_status plugin_status
ACTIVE ACTIVE
select * from information_schema.feedback where variable_name like 'feed%' select * from information_schema.feedback where variable_name like 'feed%'
and variable_name not like '%_uid'; and variable_name not like '%_uid'
and variable_name not like '%debug%';
VARIABLE_NAME VARIABLE_VALUE VARIABLE_NAME VARIABLE_VALUE
FEEDBACK used 1 FEEDBACK used 1
FEEDBACK version 1.1 FEEDBACK version 1.1

View File

@@ -6,7 +6,8 @@ SELECT variable_value = @feedback_used + 1 FROM information_schema.feedback wher
variable_value = @feedback_used + 1 variable_value = @feedback_used + 1
1 1
select * from information_schema.feedback where variable_name like 'feed%' select * from information_schema.feedback where variable_name like 'feed%'
and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used'; and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used'
and variable_name not like '%debug%';
VARIABLE_NAME VARIABLE_VALUE VARIABLE_NAME VARIABLE_VALUE
FEEDBACK version 1.1 FEEDBACK version 1.1
FEEDBACK_SEND_RETRY_WAIT 60 FEEDBACK_SEND_RETRY_WAIT 60

View File

@@ -6,14 +6,14 @@ SELECT variable_value = @feedback_used + 1 FROM information_schema.feedback wher
variable_value = @feedback_used + 1 variable_value = @feedback_used + 1
1 1
select * from information_schema.feedback where variable_name like 'feed%' select * from information_schema.feedback where variable_name like 'feed%'
and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used'; and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used'
and variable_name not like '%debug%';
VARIABLE_NAME VARIABLE_VALUE VARIABLE_NAME VARIABLE_VALUE
FEEDBACK version 1.1 FEEDBACK version 1.1
FEEDBACK_SEND_RETRY_WAIT 60 FEEDBACK_SEND_RETRY_WAIT 60
FEEDBACK_SEND_TIMEOUT 60 FEEDBACK_SEND_TIMEOUT 60
FEEDBACK_URL http://mariadb.org/feedback_plugin/post FEEDBACK_URL http://mariadb.org/feedback_plugin/post
FEEDBACK_USER_INFO mysql-test FEEDBACK_USER_INFO mysql-test
feedback plugin: report to 'http://mariadb.org/feedback_plugin/post' was sent set global sql_mode=ONLY_FULL_GROUP_BY;
feedback plugin: server replied 'ok' 6: feedback plugin: report to 'http://mariadb.org/feedback_plugin/post' was sent
feedback plugin: report to 'http://mariadb.org/feedback_plugin/post' was sent 6: feedback plugin: server replied 'ok'
feedback plugin: server replied 'ok'

View File

@@ -10,6 +10,8 @@ select plugin_status from information_schema.plugins where plugin_name='feedback
--replace_result https http --replace_result https http
--sorted_result --sorted_result
select * from information_schema.feedback where variable_name like 'feed%' select * from information_schema.feedback where variable_name like 'feed%'
and variable_name not like '%_uid'; and variable_name not like '%_uid'
and variable_name not like '%debug%';
uninstall plugin feedback; uninstall plugin feedback;

View File

@@ -24,4 +24,5 @@ SELECT variable_value = @feedback_used + 1 FROM information_schema.feedback wher
--replace_result https http --replace_result https http
--sorted_result --sorted_result
select * from information_schema.feedback where variable_name like 'feed%' select * from information_schema.feedback where variable_name like 'feed%'
and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used'; and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used'
and variable_name not like '%debug%';

View File

@@ -13,7 +13,11 @@ if (!$MTR_FEEDBACK_PLUGIN) {
# Let's wait, and hope that mtr is started with --parallel and # Let's wait, and hope that mtr is started with --parallel and
# is doing some work in other workers. # is doing some work in other workers.
# #
sleep 310;
sleep 100;
set global sql_mode=ONLY_FULL_GROUP_BY;
sleep 210;
# The test expects that the plugin will send a report at least 2 times, # The test expects that the plugin will send a report at least 2 times,
# now (5 min after loading) and on server shutdown which happens below. # now (5 min after loading) and on server shutdown which happens below.
@@ -25,20 +29,15 @@ sleep 310;
--let $shutdown_timeout= 60 --let $shutdown_timeout= 60
source include/restart_mysqld.inc; source include/restart_mysqld.inc;
replace_result https http; replace_result https http 2 6;
perl; perl;
$log_error= $ENV{'MYSQLTEST_VARDIR'} . '/log/mysqld.1.err'; $log_error= $ENV{'MYSQLTEST_VARDIR'} . '/log/mysqld.1.err';
open(LOG, '<', $log_error) or die "open(< $log_error): $!"; open(LOG, '<', $log_error) or die "open(< $log_error): $!";
# Get the first few rows (as there may be different number rows in the log) %logg=();
$i= 0; while ($_=<LOG>) {
while ($_=<LOG>) $logg{$&}++ if /feedback plugin:.*/;
{
if (/feedback plugin:.*/)
{
print "$&\n";
break if ($i++ >= 3);
}
} }
print "$logg{$_}: $_\n" for sort keys %logg;
close LOG; close LOG;
EOF EOF

View File

@@ -2053,3 +2053,11 @@ select * from t1;
show create table t1; show create table t1;
drop table t1; drop table t1;
#
# MDEV-7050: MySQL#74603 - Assertion `comma_length > 0' failed in mysql_prepare_create_table
#
set @@session.collation_server=filename;
create table t1(a enum('',''));
drop table t1;
set @@session.collation_server=default;

View File

@@ -19,3 +19,6 @@ drop table com1;
create table `clock$` (a int); create table `clock$` (a int);
drop table `clock$`; drop table `clock$`;
select convert(convert(',' using filename) using binary);

View File

@@ -1631,6 +1631,22 @@ INSERT INTO t2 VALUES ('aaa');
SELECT (SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2); SELECT (SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2);
DROP TABLE t1, t2; DROP TABLE t1, t2;
--echo #
--echo # MDEV-8630 Datetime value dropped in "INSERT ... SELECT ... ON DUPLICATE KEY"
--echo #
SET NAMES utf8;
CREATE TABLE t1 (id2 int, ts timestamp);
INSERT INTO t1 VALUES (1,'2012-06-11 15:17:34'),(2,'2012-06-11 15:18:24');
CREATE TABLE t2 AS SELECT
COALESCE(ts, 0) AS c0,
GREATEST(COALESCE(ts, 0), COALESCE(ts, 0)) AS c1,
GREATEST(CASE WHEN 1 THEN ts ELSE 0 END, CASE WHEN 1 THEN ts ELSE 0 END) AS c2,
GREATEST(IFNULL(ts,0), IFNULL(ts,0)) AS c3,
GREATEST(IF(1,ts,0), IF(1,ts,0)) AS c4
FROM t1;
SHOW CREATE TABLE t2;
SELECT * FROM t2;
DROP TABLE t2, t1;
--echo # --echo #
--echo # End of 5.5 tests --echo # End of 5.5 tests

View File

@@ -125,7 +125,7 @@ drop event existant;
create table t_event3 (a int, b float); create table t_event3 (a int, b float);
drop event if exists event3; drop event if exists event3;
create event event3 on schedule every 50 + 10 minute starts date_add("20100101", interval 5 minute) ends date_add("20151010", interval 5 day) comment "portokala_comment" DO insert into t_event3 values (unix_timestamp(), rand()); create event event3 on schedule every 50 + 10 minute starts date_add(curdate(), interval 5 minute) ends date_add(curdate(), interval 5 day) comment "portokala_comment" DO insert into t_event3 values (unix_timestamp(), rand());
let $wait_condition=SELECT count(*)=0 from t_event3; let $wait_condition=SELECT count(*)=0 from t_event3;
--source include/wait_condition.inc --source include/wait_condition.inc
select count(*) from t_event3; select count(*) from t_event3;

View File

@@ -19,7 +19,7 @@ file_exists $MYSQLD_DATADIR/mysql_upgrade_info;
# It should have created a file in the MySQL Servers datadir # It should have created a file in the MySQL Servers datadir
file_exists $MYSQLD_DATADIR/mysql_upgrade_info; file_exists $MYSQLD_DATADIR/mysql_upgrade_info;
--echo Force should run it regardless of wether it's been run before --echo Force should run it regardless of whether it has been run before
--exec $MYSQL_UPGRADE --force 2>&1 --exec $MYSQL_UPGRADE --force 2>&1
# It should have created a file in the MySQL Servers datadir # It should have created a file in the MySQL Servers datadir
@@ -129,6 +129,13 @@ let $MYSQLD_DATADIR= `select @@datadir`;
# so the following command should never fail. # so the following command should never fail.
--remove_file $MYSQLD_DATADIR/mysql_upgrade_info --remove_file $MYSQLD_DATADIR/mysql_upgrade_info
--echo #
--echo # Bug #21489398: MYSQL_UPGRADE: FATAL ERROR: UPGRADE FAILED - IMPROVE ERROR
--echo #
--echo Run mysql_upgrade with unauthorized access
--error 1
--exec $MYSQL_UPGRADE --skip-verbose --user=root --password=wrong_password 2>&1
# 5.5-only test (involves manual modification of system tables) # 5.5-only test (involves manual modification of system tables)
--echo # --echo #

View File

@@ -2494,3 +2494,13 @@ DROP DATABASE db_20772273;
--exec $MYSQL_DUMP --user=foo 2>&1 > $MYSQLTEST_VARDIR/tmp/bug6056.out --exec $MYSQL_DUMP --user=foo 2>&1 > $MYSQLTEST_VARDIR/tmp/bug6056.out
--exec $MYSQL_DUMP --help > $MYSQLTEST_VARDIR/tmp/bug6056.out --exec $MYSQL_DUMP --help > $MYSQLTEST_VARDIR/tmp/bug6056.out
--echo #
--echo # MDEV-9001 - [PATCH] Fix DB name quoting in mysqldump --routine
--echo #
CREATE DATABASE `a\"'``b`;
USE `a\"'``b`;
CREATE PROCEDURE p1() BEGIN END;
ALTER DATABASE `a\"'``b` COLLATE utf8_general_ci;
--exec $MYSQL_DUMP --routines --compact a\\\"\'\`b 2>&1
DROP DATABASE `a\"'``b`;

View File

@@ -3633,3 +3633,25 @@ SELECT 1 FROM t1 GROUP BY 0 OR 18446744073709551615+1;
drop table t1; drop table t1;
--echo # End of 5.3 tests --echo # End of 5.3 tests
--echo #
--echo # MDEV-8756: MariaDB 10.0.21 crashes during PREPARE
--echo #
CREATE TABLE t1 ( id INT(10), value INT(10) );
CREATE TABLE t2 ( id INT(10) );
SET @save_sql_mode= @@sql_mode;
SET SESSION sql_mode = 'ONLY_FULL_GROUP_BY';
PREPARE stmt FROM 'UPDATE t1 t1 SET value = (SELECT 1 FROM t2 WHERE id = t1.id)';
execute stmt;
insert into t1 values (1,10),(2,10),(3,10);
insert into t2 values (1),(2);
execute stmt;
select * from t1;
deallocate prepare stmt;
SET SESSION sql_mode = @save_sql_mode;
DROP TABLE t1,t2;
--echo # End of 10.0 tests

View File

@@ -0,0 +1,45 @@
--source include/not_embedded.inc
--source include/have_log_bin.inc
--echo #
--echo # CHANGE MASTER TO doesn't work with prepared statements
--echo #
CHANGE MASTER TO MASTER_HOST='host1', MASTER_USER='user1';
let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
let $master_user= query_get_value(SHOW SLAVE STATUS, Master_User, 1);
--echo # Master_Host : $master_host
--echo # Master_User : $master_user
SET @s := "CHANGE MASTER TO MASTER_HOST='host2'";
PREPARE stmt FROM @s;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
let $master_user= query_get_value(SHOW SLAVE STATUS, Master_User, 1);
--echo # Master_Host : $master_host
--echo # Master_User : $master_user
SET @s := "CHANGE MASTER TO MASTER_USER='user2'";
PREPARE stmt FROM @s;
EXECUTE stmt;
# Multiple executions should not hurt.
EXECUTE stmt;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
let $master_user= query_get_value(SHOW SLAVE STATUS, Master_User, 1);
--echo # Master_Host : $master_host
--echo # Master_User : $master_user
# Reset
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root';
--echo # End of test

View File

@@ -1677,3 +1677,15 @@ select count(*) from t1 ignore index (ix_fd) where fd <'😁';
drop table t1; drop table t1;
set names default; set names default;
#
# Bug#17755540 VALGRIND ERROR WHEN SETTING UP ROW COMPARATORS
#
create table t2 (a int, b int, c int, d int, key x(a, b));
insert into t2 values (2, 2, 2, 2), (3, 3, 3, 3), (4, 4, 4, 4), (5, 5, 5, 5),
(6, 6, 6, 6), (7, 7, 7, 7), (8, 8, 8, 8), (9, 9, 9, 9);
insert into t2 select * from t2;
insert into t2 values (0, 0, 0, 0), (1, 1, 1, 1);
analyze table t2;
select a, b from t2 where (a, b) in ((0, 0), (1, 1));
drop table t2;

View File

@@ -0,0 +1,73 @@
#
# MDEV-9226 SHOW COLUMNS returns wrong column order for tables with large ENUMs
#
create table test_table (
column_number_1 enum('1','2') not null,
column_number_2 enum('1','2','3','4','5','6','7','8','9','10','11','12') not null,
column_number_3 varchar(10) not null,
column_number_4 varchar(10) not null,
column_number_5 enum(
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa01',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa02',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa03',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa04',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa05',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa06',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa07',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa08',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa09',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa10',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa11',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa12',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa13',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa14',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa15',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa16',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa17',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa18',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa19',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa20',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa21',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa22',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa23',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa24',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa25',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa26',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa27',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa28',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa29',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa30',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa31',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa32',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa33',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa34',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa35',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa36',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa37',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa38',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa39',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa40',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa41',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa42',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa43',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa44',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa45',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa46',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa47',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa48',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa49',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa50',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa51',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa52'
) not null,
column_number_6 enum('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','65','66','67','68','69','70','71','72','73','74','75','76','77','78','79','80','81','82','83','84','85','86','87','88','89','90','91','92','93','94','95','96','97','98','99','100','101','102','103','104','105','106','107','108','109','110','111','112','113','114','115','116','117','118','119','120','121','122','123','124','125','126','127','128','129','130','131') not null,
column_number_7 enum('1','2','3','4','5','6','7') not null,
column_number_8 enum('8') not null,
column_number_9 enum('9') not null,
column_number_10 varchar(10) not null,
column_number_11 enum('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49') not null
) default charset=utf8mb4;
# SHOW command must list columns in the table order
# (SELECT isn't required to do it, though)
show columns from test_table;
drop table test_table;

View File

@@ -0,0 +1,14 @@
--source include/not_embedded.inc
--source include/have_udf.inc
#
# MDEV-8644 Using a UDF in a virtual column causes a crash when stopping the server
#
--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
eval create function sequence returns integer soname "$UDF_EXAMPLE_SO";
create table t1 (n int key not null auto_increment, msg int as (sequence()) virtual);
select * from t1;
source include/restart_mysqld.inc;
drop table t1;
drop function sequence;

View File

@@ -559,3 +559,76 @@ SHOW STATUS LIKE 'HANDLER_UPDATE';
ROLLBACK; ROLLBACK;
DROP TABLE t1, t2; DROP TABLE t1, t2;
--echo #
--echo # MDEV-8938: Server Crash on Update with joins
--echo #
CREATE TABLE `t1` (
`name` varchar(255) NOT NULL,
`value` varchar(4095) DEFAULT NULL,
PRIMARY KEY (`name`)
);
UPDATE `t1` SET value = CONCAT("*.",(SELECT `temptable`.`value` FROM (SELECT * FROM `t1` WHERE `name`="consoleproxy.url.domain") AS `temptable` WHERE `temptable`.`name`="consoleproxy.url.domain")) WHERE `name`="consoleproxy.url.domain";
drop table t1;
CREATE TABLE `t1` (
`name` varchar(255) NOT NULL,
`value` varchar(4095) DEFAULT NULL,
PRIMARY KEY (`name`)
);
create table t2 (
`name` varchar(255) NOT NULL,
`value` varchar(4095) DEFAULT NULL,
PRIMARY KEY (`name`)
);
UPDATE t1
SET value = (SELECT value FROM t2 WHERE `name`= t1.name)
WHERE value is null ;
drop table t1,t2;
--echo #
--echo #MDEV-8701: Crash on derived query
--echo #
CREATE TABLE t1 (
data_exit_entry_id int(11) NOT NULL,
data_entry_id int(11) NOT NULL,
data_entry_exit_id int(11) NOT NULL,
data_exit_entry_quantity double NOT NULL
) DEFAULT CHARSET=utf8;
CREATE TABLE t2 (
data_entry_id int(11) NOT NULL,
data_entry_cost double NOT NULL,
data_entry_quantity double NOT NULL
) DEFAULT CHARSET=utf8;
create algorithm=temptable view v1 as SELECT data_entry_exit_id, data_exit_entry_quantity, data_entry_cost
FROM t1 INNER JOIN t2 as dt ON dt.data_entry_id = t1.data_entry_id;
UPDATE t2
SET data_entry_cost
= ( ( SELECT SUM(data_exit_entry_quantity * data_entry_cost)
FROM
v1 AS query
WHERE data_entry_exit_id = t2.data_entry_id
)
);
UPDATE t2
SET data_entry_cost
= ( ( SELECT SUM(data_exit_entry_quantity * data_entry_cost)
FROM
( SELECT data_entry_exit_id, data_exit_entry_quantity, data_entry_cost
FROM t1 INNER JOIN t2 as dt ON dt.data_entry_id = t1.data_entry_id) AS query
WHERE data_entry_exit_id = t2.data_entry_id
)
);
drop view v1;
drop table t1, t2;

View File

@@ -5445,6 +5445,41 @@ EXECUTE stmt;
DROP TABLE t1, t2, t3; DROP TABLE t1, t2, t3;
DROP VIEW v3; DROP VIEW v3;
--echo #
--echo # MDEV-8632: Segmentation fault on INSERT
--echo #
CREATE TABLE `t1` (
`id` int(10) unsigned NOT NULL,
`r` float NOT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
create view v1 as select id, if(r=r,1,2) as d from t1;
create view v2 as
select id,
d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d as p
from v1;
insert into t1 (id, r)
select id,p from
(
select id,
d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d as p
from (
select id, if(r=r,1,2) as d
from t1
) a
) b
on duplicate key update r=p;
insert into t1 (id, r)
select id,p from v2
on duplicate key update r=p;
prepare stmt from "insert into t1 (id, r) select id,p from v2 on duplicate key update r=p";
execute stmt;
execute stmt;
deallocate prepare stmt;
drop view v1,v2;
drop table `t1`;
--echo # ----------------------------------------------------------------- --echo # -----------------------------------------------------------------
--echo # -- End of 5.5 tests. --echo # -- End of 5.5 tests.
--echo # ----------------------------------------------------------------- --echo # -----------------------------------------------------------------

View File

@@ -1,6 +1,6 @@
/* /*
Copyright (c) 2002, 2013, Oracle and/or its affiliates Copyright (c) 2002, 2013, Oracle and/or its affiliates
Copyright (c) 2009, 2013, Monty Program Ab Copyright (c) 2009, 2015, MariaDB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

View File

@@ -301,6 +301,7 @@ Obsoletes: mysql-devel < %{version}-%{release}
Obsoletes: mariadb-devel Obsoletes: mariadb-devel
Provides: mysql-devel = %{version}-%{release} Provides: mysql-devel = %{version}-%{release}
Provides: mysql-devel%{?_isa} = %{version}-%{release} Provides: mysql-devel%{?_isa} = %{version}-%{release}
Conflicts: mysql-connector-c-devel < 6.2
%description devel %description devel
This package contains the development header files and libraries necessary This package contains the development header files and libraries necessary
@@ -323,6 +324,7 @@ Obsoletes: mysql-libs < %{version}-%{release}
Obsoletes: mariadb-libs Obsoletes: mariadb-libs
Provides: mysql-libs = %{version}-%{release} Provides: mysql-libs = %{version}-%{release}
Provides: mysql-libs%{?_isa} = %{version}-%{release} Provides: mysql-libs%{?_isa} = %{version}-%{release}
Conflicts: mysql-connector-c-shared < 6.2
%description libs %description libs
This package contains the shared libraries for MySQL client This package contains the shared libraries for MySQL client
@@ -620,7 +622,7 @@ rm -r $(readlink var) var
%pre server %pre server
/usr/sbin/groupadd -g 27 -o -r mysql >/dev/null 2>&1 || : /usr/sbin/groupadd -g 27 -o -r mysql >/dev/null 2>&1 || :
/usr/sbin/useradd -M -N -g mysql -o -r -d /var/lib/mysql -s /bin/bash \ /usr/sbin/useradd -M %{!?el5:-N} -g mysql -o -r -d /var/lib/mysql -s /bin/bash \
-c "MySQL Server" -u 27 mysql >/dev/null 2>&1 || : -c "MySQL Server" -u 27 mysql >/dev/null 2>&1 || :
%post server %post server
@@ -913,6 +915,9 @@ fi
%endif %endif
%changelog %changelog
* Tue Sep 29 2015 Balasubramanian Kandasamy <balasubramanian.kandasamy@oracle.com> - 5.5.47-1
- Added conflicts to mysql-connector-c-shared dependencies
* Tue Jul 22 2014 Balasubramanian Kandasamy <balasubramanian.kandasamy@oracle.com> - 5.5.39-5 * Tue Jul 22 2014 Balasubramanian Kandasamy <balasubramanian.kandasamy@oracle.com> - 5.5.39-5
- Provide mysql-compat-server dependencies - Provide mysql-compat-server dependencies

View File

@@ -1,4 +1,5 @@
/* Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights
reserved.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -46,7 +47,6 @@ pthread_handler_t mysql_heartbeat(void *p)
DBUG_ENTER("mysql_heartbeat"); DBUG_ENTER("mysql_heartbeat");
struct mysql_heartbeat_context *con= (struct mysql_heartbeat_context *)p; struct mysql_heartbeat_context *con= (struct mysql_heartbeat_context *)p;
char buffer[HEART_STRING_BUFFER]; char buffer[HEART_STRING_BUFFER];
unsigned int x= 0;
time_t result; time_t result;
struct tm tm_tmp; struct tm tm_tmp;
@@ -65,7 +65,6 @@ pthread_handler_t mysql_heartbeat(void *p)
tm_tmp.tm_min, tm_tmp.tm_min,
tm_tmp.tm_sec); tm_tmp.tm_sec);
my_write(con->heartbeat_file, (uchar*) buffer, strlen(buffer), MYF(0)); my_write(con->heartbeat_file, (uchar*) buffer, strlen(buffer), MYF(0));
x++;
} }
DBUG_RETURN(0); DBUG_RETURN(0);
@@ -174,6 +173,13 @@ static int daemon_example_plugin_deinit(void *p __attribute__ ((unused)))
tm_tmp.tm_min, tm_tmp.tm_min,
tm_tmp.tm_sec); tm_tmp.tm_sec);
my_write(con->heartbeat_file, (uchar*) buffer, strlen(buffer), MYF(0)); my_write(con->heartbeat_file, (uchar*) buffer, strlen(buffer), MYF(0));
/*
Need to wait for the hearbeat thread to terminate before closing
the file it writes to and freeing the memory it uses.
*/
pthread_join(con->heartbeat_thread, NULL);
my_close(con->heartbeat_file, MYF(0)); my_close(con->heartbeat_file, MYF(0));
my_free(con); my_free(con);

View File

@@ -22,6 +22,10 @@ extern ST_SCHEMA_TABLE schema_tables[];
namespace feedback { namespace feedback {
#ifndef DBUG_OFF
ulong debug_startup_interval, debug_first_interval, debug_interval;
#endif
char server_uid_buf[SERVER_UID_SIZE+1]; ///< server uid will be written here char server_uid_buf[SERVER_UID_SIZE+1]; ///< server uid will be written here
/* backing store for system variables */ /* backing store for system variables */
@@ -249,6 +253,18 @@ static int init(void *p)
prepare_linux_info(); prepare_linux_info();
#ifndef DBUG_OFF
if (startup_interval != debug_startup_interval ||
first_interval != debug_first_interval ||
interval != debug_interval)
{
startup_interval= debug_startup_interval;
first_interval= debug_first_interval;
interval= debug_interval;
user_info= const_cast<char*>("mysql-test");
}
#endif
url_count= 0; url_count= 0;
if (*url) if (*url)
{ {
@@ -347,12 +363,29 @@ static MYSQL_SYSVAR_ULONG(send_retry_wait, send_retry_wait, PLUGIN_VAR_RQCMDARG,
"Wait this many seconds before retrying a failed send.", "Wait this many seconds before retrying a failed send.",
NULL, NULL, 60, 1, 60*60*24, 1); NULL, NULL, 60, 1, 60*60*24, 1);
#ifndef DBUG_OFF
static MYSQL_SYSVAR_ULONG(debug_startup_interval, debug_startup_interval,
PLUGIN_VAR_RQCMDARG, "for debugging only",
NULL, NULL, startup_interval, 1, INT_MAX32, 1);
static MYSQL_SYSVAR_ULONG(debug_first_interval, debug_first_interval,
PLUGIN_VAR_RQCMDARG, "for debugging only",
NULL, NULL, first_interval, 1, INT_MAX32, 1);
static MYSQL_SYSVAR_ULONG(debug_interval, debug_interval,
PLUGIN_VAR_RQCMDARG, "for debugging only",
NULL, NULL, interval, 1, INT_MAX32, 1);
#endif
static struct st_mysql_sys_var* settings[] = { static struct st_mysql_sys_var* settings[] = {
MYSQL_SYSVAR(server_uid), MYSQL_SYSVAR(server_uid),
MYSQL_SYSVAR(user_info), MYSQL_SYSVAR(user_info),
MYSQL_SYSVAR(url), MYSQL_SYSVAR(url),
MYSQL_SYSVAR(send_timeout), MYSQL_SYSVAR(send_timeout),
MYSQL_SYSVAR(send_retry_wait), MYSQL_SYSVAR(send_retry_wait),
#ifndef DBUG_OFF
MYSQL_SYSVAR(debug_startup_interval),
MYSQL_SYSVAR(debug_first_interval),
MYSQL_SYSVAR(debug_interval),
#endif
NULL NULL
}; };

View File

@@ -58,6 +58,10 @@ class Url {
extern Url **urls; extern Url **urls;
extern uint url_count; extern uint url_count;
extern ulong startup_interval;
extern ulong first_interval;
extern ulong interval;
/* these are used to communicate with the background thread */ /* these are used to communicate with the background thread */
extern mysql_mutex_t sleep_mutex; extern mysql_mutex_t sleep_mutex;
extern mysql_cond_t sleep_condition; extern mysql_cond_t sleep_condition;

View File

@@ -25,9 +25,9 @@ static my_thread_id thd_thread_id; ///< its thread_id
static size_t needed_size= 20480; static size_t needed_size= 20480;
static const time_t startup_interval= 60*5; ///< in seconds (5 minutes) ulong startup_interval= 60*5; ///< in seconds (5 minutes)
static const time_t first_interval= 60*60*24; ///< in seconds (one day) ulong first_interval= 60*60*24; ///< in seconds (one day)
static const time_t interval= 60*60*24*7; ///< in seconds (one week) ulong interval= 60*60*24*7; ///< in seconds (one week)
/** /**
reads the rows from a table and puts them, concatenated, in a String reads the rows from a table and puts them, concatenated, in a String
@@ -124,6 +124,7 @@ static int prepare_for_fill(TABLE_LIST *tables)
if (!tables->table) if (!tables->table)
return 1; return 1;
tables->select_lex= thd->lex->current_select;
tables->table->pos_in_table_list= tables; tables->table->pos_in_table_list= tables;
return 0; return 0;
@@ -253,6 +254,7 @@ ret:
{ {
if (tables.table) if (tables.table)
free_tmp_table(thd, tables.table); free_tmp_table(thd, tables.table);
thd->cleanup_after_query();
/* /*
clean up, free the thd. clean up, free the thd.
reset all thread local status variables to minimize reset all thread local status variables to minimize

View File

@@ -425,7 +425,8 @@ char *should;
(sub.rm_so != -1 && sub.rm_eo == -1) || (sub.rm_so != -1 && sub.rm_eo == -1) ||
(sub.rm_so != -1 && sub.rm_so < 0) || (sub.rm_so != -1 && sub.rm_so < 0) ||
(sub.rm_eo != -1 && sub.rm_eo < 0) ) { (sub.rm_eo != -1 && sub.rm_eo < 0) ) {
sprintf(grump, "start %ld end %ld", (long)sub.rm_so, snprintf(grump, sizeof(grump),
"start %ld end %ld", (long)sub.rm_so,
(long)sub.rm_eo); (long)sub.rm_eo);
return(grump); return(grump);
} }
@@ -438,7 +439,8 @@ char *should;
/* check for in range */ /* check for in range */
if ((int) sub.rm_eo > (int) strlen(str)) { if ((int) sub.rm_eo > (int) strlen(str)) {
sprintf(grump, "start %ld end %ld, past end of string", snprintf(grump, sizeof(grump),
"start %ld end %ld, past end of string",
(long)sub.rm_so, (long)sub.rm_eo); (long)sub.rm_so, (long)sub.rm_eo);
return(grump); return(grump);
} }
@@ -449,13 +451,15 @@ char *should;
/* check for not supposed to match */ /* check for not supposed to match */
if (should == NULL) { if (should == NULL) {
sprintf(grump, "matched `%.*s'", len, p); snprintf(grump, sizeof(grump),
"matched `%.*s'", len, p);
return(grump); return(grump);
} }
/* check for wrong match */ /* check for wrong match */
if (len != shlen || strncmp(p, should, (size_t)shlen) != 0) { if (len != shlen || strncmp(p, should, (size_t)shlen) != 0) {
sprintf(grump, "matched `%.*s' instead", len, p); snprintf(grump, sizeof(grump),
"matched `%.*s' instead", len, p);
return(grump); return(grump);
} }
if (shlen > 0) if (shlen > 0)
@@ -468,7 +472,8 @@ char *should;
if (shlen == 0) if (shlen == 0)
shlen = 1; /* force check for end-of-string */ shlen = 1; /* force check for end-of-string */
if (strncmp(p, at, shlen) != 0) { if (strncmp(p, at, shlen) != 0) {
sprintf(grump, "matched null at `%.20s'", p); snprintf(grump, sizeof(grump),
"matched null at `%.20s'", p);
return(grump); return(grump);
} }
return(NULL); return(NULL);
@@ -501,7 +506,7 @@ char *name;
static char efbuf[100]; static char efbuf[100];
my_regex_t re; my_regex_t re;
sprintf(efbuf, "REG_%s", name); snprintf(efbuf, sizeof(efbuf), "REG_%s", name);
assert(strlen(efbuf) < sizeof(efbuf)); assert(strlen(efbuf) < sizeof(efbuf));
re.re_endp = efbuf; re.re_endp = efbuf;
(void) my_regerror(REG_ATOI, &re, efbuf, sizeof(efbuf)); (void) my_regerror(REG_ATOI, &re, efbuf, sizeof(efbuf));

View File

@@ -572,11 +572,9 @@ sub get_mysqladmin_options
return $com; return $com;
} }
#### # Return a list of option files which can be opened. Similar, but not
#### Return a list of option files which can be opened. Similar, but not # identical, to behavior of my_search_option_files()
#### identical, to behavior of my_search_option_files() # TODO implement and use my_print_defaults --list-groups instead
####
sub list_defaults_files sub list_defaults_files
{ {
my %opt; my %opt;
@@ -588,9 +586,7 @@ sub list_defaults_files
return ($opt{file}) if exists $opt{file}; return ($opt{file}) if exists $opt{file};
my %seen; # Don't list the same file more than once return ('/etc/my.cnf',
return grep { defined $_ and not $seen{$_}++ and -f $_ and -r $_ }
('/etc/my.cnf',
'/etc/mysql/my.cnf', '/etc/mysql/my.cnf',
'@sysconfdir@/my.cnf', '@sysconfdir@/my.cnf',
($ENV{MYSQL_HOME} ? "$ENV{MYSQL_HOME}/my.cnf" : undef), ($ENV{MYSQL_HOME} ? "$ENV{MYSQL_HOME}/my.cnf" : undef),
@@ -632,11 +628,12 @@ sub find_groups
} }
} }
my %seen;
my @defaults_files = list_defaults_files(); my @defaults_files = list_defaults_files();
#warn "@{[sort keys %gids]} -> @defaults_files\n"; while (@defaults_files)
foreach my $file (@defaults_files)
{ {
next unless open CONF, "< $file"; my $file = shift @defaults_files;
next unless defined $file and not $seen{$file}++ and open CONF, '<', $file;
while (<CONF>) while (<CONF>)
{ {
@@ -649,6 +646,14 @@ sub find_groups
push @groups, "$1$2"; push @groups, "$1$2";
} }
} }
elsif (/^\s*!include\s+(\S.*?)\s*$/)
{
push @defaults_files, $1;
}
elsif (/^\s*!includedir\s+(\S.*?)\s*$/)
{
push @defaults_files, <$1/*.cnf>;
}
} }
close CONF; close CONF;

View File

@@ -1885,8 +1885,11 @@ static int ssl_verify_server_cert(Vio *vio, const char* server_hostname, const c
{ {
SSL *ssl; SSL *ssl;
X509 *server_cert; X509 *server_cert;
char *cp1, *cp2; X509_NAME *x509sn;
char *buf; int cn_pos;
X509_NAME_ENTRY *cn_entry;
ASN1_STRING *cn_asn1;
const char *cn_str;
DBUG_ENTER("ssl_verify_server_cert"); DBUG_ENTER("ssl_verify_server_cert");
DBUG_PRINT("enter", ("server_hostname: %s", server_hostname)); DBUG_PRINT("enter", ("server_hostname: %s", server_hostname));
@@ -1920,34 +1923,32 @@ static int ssl_verify_server_cert(Vio *vio, const char* server_hostname, const c
are what we expect. are what we expect.
*/ */
buf= X509_NAME_oneline(X509_get_subject_name(server_cert), 0, 0); x509sn= X509_get_subject_name(server_cert);
if ((cn_pos= X509_NAME_get_index_by_NID(x509sn, NID_commonName, -1)) < 0)
goto err;
if (!(cn_entry= X509_NAME_get_entry(x509sn, cn_pos)))
goto err;
if (!(cn_asn1 = X509_NAME_ENTRY_get_data(cn_entry)))
goto err;
cn_str = (char *)ASN1_STRING_data(cn_asn1);
/* Make sure there is no embedded \0 in the CN */
if ((size_t)ASN1_STRING_length(cn_asn1) != strlen(cn_str))
goto err;
if (strcmp(cn_str, server_hostname))
goto err;
X509_free (server_cert); X509_free (server_cert);
if (!buf)
{
*errptr= "Out of memory";
DBUG_RETURN(1);
}
DBUG_PRINT("info", ("hostname in cert: %s", buf));
cp1= strstr(buf, "/CN=");
if (cp1)
{
cp1+= 4; /* Skip the "/CN=" that we found */
/* Search for next / which might be the delimiter for email */
cp2= strchr(cp1, '/');
if (cp2)
*cp2= '\0';
DBUG_PRINT("info", ("Server hostname in cert: %s", cp1));
if (!strcmp(cp1, server_hostname))
{
free(buf);
/* Success */
DBUG_RETURN(0); DBUG_RETURN(0);
}
} err:
X509_free(server_cert);
*errptr= "SSL certificate validation failure"; *errptr= "SSL certificate validation failure";
free(buf);
DBUG_RETURN(1); DBUG_RETURN(1);
} }

View File

@@ -349,7 +349,7 @@ public:
DBUG_ENTER("Field::pack_length_from_metadata"); DBUG_ENTER("Field::pack_length_from_metadata");
DBUG_RETURN(field_metadata); DBUG_RETURN(field_metadata);
} }
virtual uint row_pack_length() { return 0; } virtual uint row_pack_length() const { return 0; }
virtual int save_field_metadata(uchar *first_byte) virtual int save_field_metadata(uchar *first_byte)
{ return do_save_field_metadata(first_byte); } { return do_save_field_metadata(first_byte); }
@@ -757,7 +757,7 @@ public:
int store_decimal(const my_decimal *); int store_decimal(const my_decimal *);
my_decimal *val_decimal(my_decimal *); my_decimal *val_decimal(my_decimal *);
uint is_equal(Create_field *new_field); uint is_equal(Create_field *new_field);
uint row_pack_length() { return pack_length(); } uint row_pack_length() const { return pack_length(); }
uint32 pack_length_from_metadata(uint field_metadata) { uint32 pack_length_from_metadata(uint field_metadata) {
uint32 length= pack_length(); uint32 length= pack_length();
DBUG_PRINT("result", ("pack_length_from_metadata(%d): %u", DBUG_PRINT("result", ("pack_length_from_metadata(%d): %u",
@@ -940,7 +940,7 @@ public:
uint size_of() const { return sizeof(*this); } uint size_of() const { return sizeof(*this); }
uint32 pack_length() const { return (uint32) bin_size; } uint32 pack_length() const { return (uint32) bin_size; }
uint pack_length_from_metadata(uint field_metadata); uint pack_length_from_metadata(uint field_metadata);
uint row_pack_length() { return pack_length(); } uint row_pack_length() const { return pack_length(); }
bool compatible_field_size(uint field_metadata, Relay_log_info *rli, bool compatible_field_size(uint field_metadata, Relay_log_info *rli,
uint16 mflags, int *order_var); uint16 mflags, int *order_var);
uint is_equal(Create_field *new_field); uint is_equal(Create_field *new_field);
@@ -1189,7 +1189,7 @@ public:
int cmp(const uchar *,const uchar *); int cmp(const uchar *,const uchar *);
void sort_string(uchar *buff,uint length); void sort_string(uchar *buff,uint length);
uint32 pack_length() const { return sizeof(float); } uint32 pack_length() const { return sizeof(float); }
uint row_pack_length() { return pack_length(); } uint row_pack_length() const { return pack_length(); }
void sql_type(String &str) const; void sql_type(String &str) const;
private: private:
int do_save_field_metadata(uchar *first_byte); int do_save_field_metadata(uchar *first_byte);
@@ -1229,7 +1229,7 @@ public:
int cmp(const uchar *,const uchar *); int cmp(const uchar *,const uchar *);
void sort_string(uchar *buff,uint length); void sort_string(uchar *buff,uint length);
uint32 pack_length() const { return sizeof(double); } uint32 pack_length() const { return sizeof(double); }
uint row_pack_length() { return pack_length(); } uint row_pack_length() const { return pack_length(); }
void sql_type(String &str) const; void sql_type(String &str) const;
private: private:
int do_save_field_metadata(uchar *first_byte); int do_save_field_metadata(uchar *first_byte);
@@ -1718,7 +1718,7 @@ public:
} }
bool compatible_field_size(uint field_metadata, Relay_log_info *rli, bool compatible_field_size(uint field_metadata, Relay_log_info *rli,
uint16 mflags, int *order_var); uint16 mflags, int *order_var);
uint row_pack_length() { return field_length; } uint row_pack_length() const { return field_length; }
int pack_cmp(const uchar *a,const uchar *b,uint key_length, int pack_cmp(const uchar *a,const uchar *b,uint key_length,
bool insert_or_update); bool insert_or_update);
int pack_cmp(const uchar *b,uint key_length,bool insert_or_update); int pack_cmp(const uchar *b,uint key_length,bool insert_or_update);
@@ -1768,7 +1768,7 @@ public:
enum_field_types type() const { return MYSQL_TYPE_VARCHAR; } enum_field_types type() const { return MYSQL_TYPE_VARCHAR; }
bool match_collation_to_optimize_range() const { return TRUE; } bool match_collation_to_optimize_range() const { return TRUE; }
enum ha_base_keytype key_type() const; enum ha_base_keytype key_type() const;
uint row_pack_length() { return field_length; } uint row_pack_length() const { return field_length; }
bool zero_pack() const { return 0; } bool zero_pack() const { return 0; }
int reset(void) { bzero(ptr,field_length+length_bytes); return 0; } int reset(void) { bzero(ptr,field_length+length_bytes); return 0; }
uint32 pack_length() const { return (uint32) field_length+length_bytes; } uint32 pack_length() const { return (uint32) field_length+length_bytes; }
@@ -1893,7 +1893,7 @@ public:
*/ */
uint32 pack_length_no_ptr() const uint32 pack_length_no_ptr() const
{ return (uint32) (packlength); } { return (uint32) (packlength); }
uint row_pack_length() { return pack_length_no_ptr(); } uint row_pack_length() const { return pack_length_no_ptr(); }
uint32 sort_length() const; uint32 sort_length() const;
virtual uint32 max_data_length() const virtual uint32 max_data_length() const
{ {
@@ -2055,7 +2055,7 @@ public:
enum_field_types real_type() const { return MYSQL_TYPE_ENUM; } enum_field_types real_type() const { return MYSQL_TYPE_ENUM; }
uint pack_length_from_metadata(uint field_metadata) uint pack_length_from_metadata(uint field_metadata)
{ return (field_metadata & 0x00ff); } { return (field_metadata & 0x00ff); }
uint row_pack_length() { return pack_length(); } uint row_pack_length() const { return pack_length(); }
virtual bool zero_pack() const { return 0; } virtual bool zero_pack() const { return 0; }
bool optimize_range(uint idx, uint part) { return 0; } bool optimize_range(uint idx, uint part) { return 0; }
bool eq_def(Field *field); bool eq_def(Field *field);
@@ -2176,7 +2176,7 @@ public:
uint32 pack_length() const { return (uint32) (field_length + 7) / 8; } uint32 pack_length() const { return (uint32) (field_length + 7) / 8; }
uint32 pack_length_in_rec() const { return bytes_in_rec; } uint32 pack_length_in_rec() const { return bytes_in_rec; }
uint pack_length_from_metadata(uint field_metadata); uint pack_length_from_metadata(uint field_metadata);
uint row_pack_length() uint row_pack_length() const
{ return (bytes_in_rec + ((bit_len > 0) ? 1 : 0)); } { return (bytes_in_rec + ((bit_len > 0) ? 1 : 0)); }
bool compatible_field_size(uint metadata, Relay_log_info *rli, bool compatible_field_size(uint metadata, Relay_log_info *rli,
uint16 mflags, int *order_var); uint16 mflags, int *order_var);

View File

@@ -1891,6 +1891,8 @@ void Item::split_sum_func2(THD *thd, Item **ref_pointer_array,
*/ */
Item_aggregate_ref *item_ref; Item_aggregate_ref *item_ref;
uint el= fields.elements; uint el= fields.elements;
DBUG_ASSERT(fields.elements <=
thd->lex->current_select->ref_pointer_array_size);
/* /*
If this is an item_ref, get the original item If this is an item_ref, get the original item
This is a safety measure if this is called for things that is This is a safety measure if this is called for things that is
@@ -4887,9 +4889,25 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference)
As this is an outer field it should be added to the list of As this is an outer field it should be added to the list of
non aggregated fields of the outer select. non aggregated fields of the outer select.
*/ */
if (select->join)
{
marker= select->cur_pos_in_select_list; marker= select->cur_pos_in_select_list;
select->join->non_agg_fields.push_back(this); select->join->non_agg_fields.push_back(this);
} }
else
{
/*
join is absent if it is upper SELECT_LEX of non-select
command
*/
DBUG_ASSERT(select->master_unit()->outer_select() == NULL &&
(thd->lex->sql_command != SQLCOM_SELECT &&
thd->lex->sql_command != SQLCOM_UPDATE_MULTI &&
thd->lex->sql_command != SQLCOM_DELETE_MULTI &&
thd->lex->sql_command != SQLCOM_INSERT_SELECT &&
thd->lex->sql_command != SQLCOM_REPLACE_SELECT));
}
}
if (*from_field != view_ref_found) if (*from_field != view_ref_found)
{ {
prev_subselect_item->used_tables_cache|= (*from_field)->table->map; prev_subselect_item->used_tables_cache|= (*from_field)->table->map;
@@ -6719,6 +6737,7 @@ Item *Item_field::update_value_transformer(uchar *select_arg)
{ {
List<Item> *all_fields= &select->join->all_fields; List<Item> *all_fields= &select->join->all_fields;
Item **ref_pointer_array= select->ref_pointer_array; Item **ref_pointer_array= select->ref_pointer_array;
DBUG_ASSERT(all_fields->elements <= select->ref_pointer_array_size);
int el= all_fields->elements; int el= all_fields->elements;
Item_ref *ref; Item_ref *ref;

View File

@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. /* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2009, 2013, Monty Program Ab. Copyright (c) 2009, 2015, MariaDB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

View File

@@ -1,7 +1,7 @@
#ifndef ITEM_CMPFUNC_INCLUDED #ifndef ITEM_CMPFUNC_INCLUDED
#define ITEM_CMPFUNC_INCLUDED #define ITEM_CMPFUNC_INCLUDED
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. /* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2009, 2011, Monty Program Ab. Copyright (c) 2009, 2015, MariaDB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. /* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2009, 2015, MariaDB Copyright (c) 2009, 2015, MariaDB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
@@ -719,7 +719,7 @@ void Item_func::count_real_length()
bool Item_func::count_string_result_length(enum_field_types field_type, bool Item_func::count_string_result_length(enum_field_types field_type,
Item **items, uint nitems) Item **items, uint nitems)
{ {
if (agg_arg_charsets(collation, items, nitems, MY_COLL_ALLOW_CONV, 1)) if (agg_arg_charsets_for_string_result(collation, items, nitems, 1))
return true; return true;
if (is_temporal_type(field_type)) if (is_temporal_type(field_type))
count_datetime_length(items, nitems); count_datetime_length(items, nitems);
@@ -6292,9 +6292,7 @@ bool Item_func_match::fix_fields(THD *thd, Item **ref)
table= 0; table= 0;
for (uint i=1 ; i < arg_count ; i++) for (uint i=1 ; i < arg_count ; i++)
{ {
item=args[i]; item= args[i]= args[i]->real_item();
if (item->type() == Item::REF_ITEM)
args[i]= item= *((Item_ref *)item)->ref;
/* /*
When running in PS mode, some Item_field's can already be replaced When running in PS mode, some Item_field's can already be replaced
to Item_func_conv_charset during PREPARE time. This is possible to Item_func_conv_charset during PREPARE time. This is possible
@@ -6307,7 +6305,7 @@ bool Item_func_match::fix_fields(THD *thd, Item **ref)
if (!thd->stmt_arena->is_stmt_execute() && if (!thd->stmt_arena->is_stmt_execute() &&
item->type() != Item::FIELD_ITEM) item->type() != Item::FIELD_ITEM)
{ {
my_error(ER_WRONG_ARGUMENTS, MYF(0), "AGAINST"); my_error(ER_WRONG_ARGUMENTS, MYF(0), "MATCH");
return TRUE; return TRUE;
} }
/* /*

View File

@@ -1,5 +1,5 @@
/* Copyright (c) 2002, 2012, Oracle and/or its affiliates. /* Copyright (c) 2002, 2015, Oracle and/or its affiliates.
Copyright (c) 2010, 2012, Monty Program Ab Copyright (c) 2010, 2015, MariaDB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -1748,6 +1748,27 @@ Item_in_subselect::single_value_transformer(JOIN *join)
runtime created Ref item which is deleted at the end runtime created Ref item which is deleted at the end
of the statement. Thus one of 'substitution' arguments of the statement. Thus one of 'substitution' arguments
can be broken in case of PS. can be broken in case of PS.
@todo
Why do we use real_item()/substitutional_item() instead of the plain
left_expr?
Because left_expr might be a rollbackable item, and we fail to properly
rollback all copies of left_expr at end of execution, so we want to
avoid creating copies of left_expr as much as possible, so we use
real_item() instead.
Doing a proper rollback is difficult: the change was registered for the
original item which was the left argument of IN. Then this item was
copied to left_expr, which is copied below to substitution->args[0]. To
do a proper rollback, we would have to restore the content
of both copies as well as the original item. There might be more copies,
if AND items have been constructed.
The same applies to the right expression.
However, using real_item()/substitutional_item() brings its own
problems: for example, we lose information that the item is an outer
reference; the item can thus wrongly be considered for a Keyuse (causing
bug#17766653).
When WL#6570 removes the "rolling back" system, all
real_item()/substitutional_item() in this file should be removed.
*/ */
substitution= func->create(left_expr, where_item); substitution= func->create(left_expr, where_item);
have_to_be_excluded= 1; have_to_be_excluded= 1;
@@ -2034,6 +2055,9 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN *join,
} }
else else
{ {
/*
Grep for "WL#6570" to see the relevant comment about real_item.
*/
Item *item= (Item*) select_lex->item_list.head()->real_item(); Item *item= (Item*) select_lex->item_list.head()->real_item();
if (select_lex->table_list.elements) if (select_lex->table_list.elements)

View File

@@ -6440,11 +6440,13 @@ int MYSQL_BIN_LOG::wait_for_update_bin_log(THD* thd,
int ret= 0; int ret= 0;
DBUG_ENTER("wait_for_update_bin_log"); DBUG_ENTER("wait_for_update_bin_log");
thd_wait_begin(thd, THD_WAIT_BINLOG);
if (!timeout) if (!timeout)
mysql_cond_wait(&update_cond, &LOCK_log); mysql_cond_wait(&update_cond, &LOCK_log);
else else
ret= mysql_cond_timedwait(&update_cond, &LOCK_log, ret= mysql_cond_timedwait(&update_cond, &LOCK_log,
const_cast<struct timespec *>(timeout)); const_cast<struct timespec *>(timeout));
thd_wait_end(thd);
DBUG_RETURN(ret); DBUG_RETURN(ret);
} }

View File

@@ -1939,14 +1939,9 @@ void clean_up(bool print_message)
item_user_lock_free(); item_user_lock_free();
lex_free(); /* Free some memory */ lex_free(); /* Free some memory */
item_create_cleanup(); item_create_cleanup();
if (!opt_noacl)
{
#ifdef HAVE_DLOPEN
udf_free();
#endif
}
table_def_start_shutdown(); table_def_start_shutdown();
plugin_shutdown(); plugin_shutdown();
udf_free();
ha_end(); ha_end();
if (tc_log) if (tc_log)
tc_log->close(); tc_log->close();
@@ -5747,12 +5742,7 @@ int mysqld_main(int argc, char **argv)
if (!opt_bootstrap) if (!opt_bootstrap)
servers_init(0); servers_init(0);
if (!opt_noacl)
{
#ifdef HAVE_DLOPEN
udf_init(); udf_init();
#endif
}
init_status_vars(); init_status_vars();
if (opt_bootstrap) /* If running with bootstrap, do not start replication. */ if (opt_bootstrap) /* If running with bootstrap, do not start replication. */

View File

@@ -1,4 +1,5 @@
/* Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2006, 2015, Oracle and/or its affiliates.
Copyright (c) 2010, 2015, MariaDB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -339,6 +340,7 @@ extern mysql_mutex_t
LOCK_prepared_stmt_count, LOCK_error_messages, LOCK_connection_count; LOCK_prepared_stmt_count, LOCK_error_messages, LOCK_connection_count;
extern MYSQL_PLUGIN_IMPORT mysql_mutex_t LOCK_thread_count; extern MYSQL_PLUGIN_IMPORT mysql_mutex_t LOCK_thread_count;
#ifdef HAVE_OPENSSL #ifdef HAVE_OPENSSL
extern char* des_key_file;
extern mysql_mutex_t LOCK_des_key_file; extern mysql_mutex_t LOCK_des_key_file;
#endif #endif
extern mysql_mutex_t LOCK_server_started; extern mysql_mutex_t LOCK_server_started;

View File

@@ -7362,6 +7362,8 @@ acl_check_proxy_grant_access(THD *thd, const char *host, const char *user,
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
mysql_mutex_lock(&acl_cache->lock);
/* check for matching WITH PROXY rights */ /* check for matching WITH PROXY rights */
for (uint i=0; i < acl_proxy_users.elements; i++) for (uint i=0; i < acl_proxy_users.elements; i++)
{ {
@@ -7374,10 +7376,12 @@ acl_check_proxy_grant_access(THD *thd, const char *host, const char *user,
proxy->get_with_grant()) proxy->get_with_grant())
{ {
DBUG_PRINT("info", ("found")); DBUG_PRINT("info", ("found"));
mysql_mutex_unlock(&acl_cache->lock);
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
} }
mysql_mutex_unlock(&acl_cache->lock);
my_error(ER_ACCESS_DENIED_NO_PASSWORD_ERROR, MYF(0), my_error(ER_ACCESS_DENIED_NO_PASSWORD_ERROR, MYF(0),
thd->security_ctx->user, thd->security_ctx->user,
thd->security_ctx->host_or_ip); thd->security_ctx->host_or_ip);

View File

@@ -2003,7 +2003,7 @@ public:
*/ */
MDL_request grl_protection; MDL_request grl_protection;
Delayed_insert() Delayed_insert(SELECT_LEX *current_select)
:locks_in_memory(0), table(0),tables_in_use(0),stacked_inserts(0), :locks_in_memory(0), table(0),tables_in_use(0),stacked_inserts(0),
status(0), handler_thread_initialized(FALSE), group_count(0) status(0), handler_thread_initialized(FALSE), group_count(0)
{ {
@@ -2013,7 +2013,7 @@ public:
strmake_buf(thd.security_ctx->priv_user, thd.security_ctx->user); strmake_buf(thd.security_ctx->priv_user, thd.security_ctx->user);
thd.current_tablenr=0; thd.current_tablenr=0;
thd.command=COM_DELAYED_INSERT; thd.command=COM_DELAYED_INSERT;
thd.lex->current_select= 0; // for my_message_sql thd.lex->current_select= current_select;
thd.lex->sql_command= SQLCOM_INSERT; // For innodb::store_lock() thd.lex->sql_command= SQLCOM_INSERT; // For innodb::store_lock()
/* /*
Prevent changes to global.lock_wait_timeout from affecting Prevent changes to global.lock_wait_timeout from affecting
@@ -2190,7 +2190,7 @@ bool delayed_get_table(THD *thd, MDL_request *grl_protection_request,
*/ */
if (! (di= find_handler(thd, table_list))) if (! (di= find_handler(thd, table_list)))
{ {
if (!(di= new Delayed_insert())) if (!(di= new Delayed_insert(thd->lex->current_select)))
goto end_create; goto end_create;
mysql_mutex_lock(&LOCK_thread_count); mysql_mutex_lock(&LOCK_thread_count);
thread_count++; thread_count++;
@@ -2821,6 +2821,16 @@ pthread_handler_t handle_delayed_insert(void *arg)
if (di->open_and_lock_table()) if (di->open_and_lock_table())
goto err; goto err;
/*
INSERT DELAYED generally expects thd->lex->current_select to be NULL,
since this is not an attribute of the current thread. This can lead to
problems if the thread that spawned the current one disconnects.
current_select will then point to freed memory. But current_select is
required to resolve the partition function. So, after fulfilling that
requirement, we set the current_select to 0.
*/
thd->lex->current_select= NULL;
/* Tell client that the thread is initialized */ /* Tell client that the thread is initialized */
mysql_cond_signal(&di->cond_client); mysql_cond_signal(&di->cond_client);

View File

@@ -545,6 +545,16 @@ void lex_end(LEX *lex)
DBUG_ENTER("lex_end"); DBUG_ENTER("lex_end");
DBUG_PRINT("enter", ("lex: 0x%lx", (long) lex)); DBUG_PRINT("enter", ("lex: 0x%lx", (long) lex));
lex_end_stage1(lex);
lex_end_stage2(lex);
DBUG_VOID_RETURN;
}
void lex_end_stage1(LEX *lex)
{
DBUG_ENTER("lex_end_stage1");
/* release used plugins */ /* release used plugins */
if (lex->plugins.elements) /* No function call and no mutex if no plugins. */ if (lex->plugins.elements) /* No function call and no mutex if no plugins. */
{ {
@@ -556,6 +566,19 @@ void lex_end(LEX *lex)
delete lex->sphead; delete lex->sphead;
lex->sphead= NULL; lex->sphead= NULL;
DBUG_VOID_RETURN;
}
/*
MASTER INFO parameters (or state) is normally cleared towards the end
of a statement. But in case of PS, the state needs to be preserved during
its lifetime and should only be cleared on PS close or deallocation.
*/
void lex_end_stage2(LEX *lex)
{
DBUG_ENTER("lex_end_stage2");
/* Reset LEX_MASTER_INFO */
lex->mi.reset(); lex->mi.reset();
DBUG_VOID_RETURN; DBUG_VOID_RETURN;

View File

@@ -2940,6 +2940,8 @@ extern void lex_init(void);
extern void lex_free(void); extern void lex_free(void);
extern void lex_start(THD *thd); extern void lex_start(THD *thd);
extern void lex_end(LEX *lex); extern void lex_end(LEX *lex);
extern void lex_end_stage1(LEX *lex);
extern void lex_end_stage2(LEX *lex);
void end_lex_with_single_table(THD *thd, TABLE *table, LEX *old_lex); void end_lex_with_single_table(THD *thd, TABLE *table, LEX *old_lex);
int init_lex_with_single_table(THD *thd, TABLE *table, LEX *lex); int init_lex_with_single_table(THD *thd, TABLE *table, LEX *lex);
extern int MYSQLlex(union YYSTYPE *yylval, THD *thd); extern int MYSQLlex(union YYSTYPE *yylval, THD *thd);

View File

@@ -1,5 +1,5 @@
/* Copyright (c) 2002, 2013, Oracle and/or its affiliates. /* Copyright (c) 2002, 2015, Oracle and/or its affiliates.
Copyright (c) 2008, 2013, Monty Program Ab Copyright (c) 2008, 2015, MariaDB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -1408,7 +1408,8 @@ static int mysql_test_update(Prepared_statement *stmt,
(SELECT_ACL & ~table_list->table->grant.privilege); (SELECT_ACL & ~table_list->table->grant.privilege);
table_list->register_want_access(SELECT_ACL); table_list->register_want_access(SELECT_ACL);
#endif #endif
if (setup_fields(thd, 0, stmt->lex->value_list, MARK_COLUMNS_NONE, 0, 0)) if (setup_fields(thd, 0, stmt->lex->value_list, MARK_COLUMNS_NONE, 0, 0) ||
check_unique_table(thd, table_list))
goto error; goto error;
/* TODO: here we should send types of placeholders to the client. */ /* TODO: here we should send types of placeholders to the client. */
DBUG_RETURN(0); DBUG_RETURN(0);
@@ -3416,7 +3417,8 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
thd->mdl_context.release_transactional_locks(); thd->mdl_context.release_transactional_locks();
} }
lex_end(lex); /* Preserve CHANGE MASTER attributes */
lex_end_stage1(lex);
cleanup_stmt(); cleanup_stmt();
thd->restore_backup_statement(this, &stmt_backup); thd->restore_backup_statement(this, &stmt_backup);
thd->stmt_arena= old_stmt_arena; thd->stmt_arena= old_stmt_arena;
@@ -3797,8 +3799,8 @@ Prepared_statement::swap_prepared_statement(Prepared_statement *copy)
swap_variables(LEX_STRING, name, copy->name); swap_variables(LEX_STRING, name, copy->name);
/* Ditto */ /* Ditto */
swap_variables(char *, db, copy->db); swap_variables(char *, db, copy->db);
swap_variables(size_t, db_length, copy->db_length);
DBUG_ASSERT(db_length == copy->db_length);
DBUG_ASSERT(param_count == copy->param_count); DBUG_ASSERT(param_count == copy->param_count);
DBUG_ASSERT(thd == copy->thd); DBUG_ASSERT(thd == copy->thd);
last_error[0]= '\0'; last_error[0]= '\0';
@@ -4015,6 +4017,10 @@ void Prepared_statement::deallocate()
{ {
/* We account deallocate in the same manner as mysqld_stmt_close */ /* We account deallocate in the same manner as mysqld_stmt_close */
status_var_increment(thd->status_var.com_stmt_close); status_var_increment(thd->status_var.com_stmt_close);
/* It should now be safe to reset CHANGE MASTER parameters */
lex_end_stage2(lex);
/* Statement map calls delete stmt on erase */ /* Statement map calls delete stmt on erase */
thd->stmt_map.erase(this); thd->stmt_map.erase(this);
} }

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -26,6 +26,7 @@
#include "sql_repl.h" // reset_master, reset_slave #include "sql_repl.h" // reset_master, reset_slave
#include "rpl_mi.h" // Master_info::data_lock #include "rpl_mi.h" // Master_info::data_lock
#include "debug_sync.h" #include "debug_sync.h"
#include "des_key_file.h"
static void disable_checkpoints(THD *thd); static void disable_checkpoints(THD *thd);
@@ -312,7 +313,7 @@ bool reload_acl_and_cache(THD *thd, unsigned long options,
} }
} }
#endif #endif
#ifdef OPENSSL #ifdef HAVE_OPENSSL
if (options & REFRESH_DES_KEY_FILE) if (options & REFRESH_DES_KEY_FILE)
{ {
if (des_key_file && load_des_key_file(des_key_file)) if (des_key_file && load_des_key_file(des_key_file))

View File

@@ -427,6 +427,7 @@ fix_inner_refs(THD *thd, List<Item> &all_fields, SELECT_LEX *select,
if (ref_pointer_array && !ref->found_in_select_list) if (ref_pointer_array && !ref->found_in_select_list)
{ {
int el= all_fields.elements; int el= all_fields.elements;
DBUG_ASSERT(all_fields.elements <= select->ref_pointer_array_size);
ref_pointer_array[el]= item; ref_pointer_array[el]= item;
/* Add the field item to the select list of the current select. */ /* Add the field item to the select list of the current select. */
all_fields.push_front(item); all_fields.push_front(item);
@@ -832,6 +833,7 @@ JOIN::prepare(Item ***rref_pointer_array,
{ {
Item_field *field= new Item_field(thd, *(Item_field**)ord->item); Item_field *field= new Item_field(thd, *(Item_field**)ord->item);
int el= all_fields.elements; int el= all_fields.elements;
DBUG_ASSERT(all_fields.elements <= select_lex->ref_pointer_array_size);
ref_pointer_array[el]= field; ref_pointer_array[el]= field;
all_fields.push_front(field); all_fields.push_front(field);
ord->item= ref_pointer_array + el; ord->item= ref_pointer_array + el;
@@ -4112,6 +4114,17 @@ add_key_field(JOIN *join,
Field *field, bool eq_func, Item **value, uint num_values, Field *field, bool eq_func, Item **value, uint num_values,
table_map usable_tables, SARGABLE_PARAM **sargables) table_map usable_tables, SARGABLE_PARAM **sargables)
{ {
if (field->table->reginfo.join_tab == NULL)
{
/*
Due to a bug in IN-to-EXISTS (grep for real_item() in item_subselect.cc
for more info), an index over a field from an outer query might be
considered here, which is incorrect. Their query has been fully
optimized already so their reginfo.join_tab is NULL and we reject them.
*/
return;
}
uint optimize= 0; uint optimize= 0;
if (eq_func && if (eq_func &&
((join->is_allowed_hash_join_access() && ((join->is_allowed_hash_join_access() &&
@@ -14902,8 +14915,8 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
uint temp_pool_slot=MY_BIT_NONE; uint temp_pool_slot=MY_BIT_NONE;
uint fieldnr= 0; uint fieldnr= 0;
ulong reclength, string_total_length; ulong reclength, string_total_length;
bool using_unique_constraint= 0; bool using_unique_constraint= false;
bool use_packed_rows= 0; bool use_packed_rows= false;
bool not_all_columns= !(select_options & TMP_TABLE_ALL_COLUMNS); bool not_all_columns= !(select_options & TMP_TABLE_ALL_COLUMNS);
char *tmpname,path[FN_REFLEN]; char *tmpname,path[FN_REFLEN];
uchar *pos, *group_buff, *bitmaps; uchar *pos, *group_buff, *bitmaps;
@@ -14977,10 +14990,10 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
*/ */
(*tmp->item)->marker=4; // Store null in key (*tmp->item)->marker=4; // Store null in key
if ((*tmp->item)->too_big_for_varchar()) if ((*tmp->item)->too_big_for_varchar())
using_unique_constraint=1; using_unique_constraint= true;
} }
if (param->group_length >= MAX_BLOB_WIDTH) if (param->group_length >= MAX_BLOB_WIDTH)
using_unique_constraint=1; using_unique_constraint= true;
if (group) if (group)
distinct=0; // Can't use distinct distinct=0; // Can't use distinct
} }
@@ -15234,12 +15247,14 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
*blob_field++= fieldnr; *blob_field++= fieldnr;
blob_count++; blob_count++;
} }
if (new_field->real_type() == MYSQL_TYPE_STRING || if (new_field->real_type() == MYSQL_TYPE_STRING ||
new_field->real_type() == MYSQL_TYPE_VARCHAR) new_field->real_type() == MYSQL_TYPE_VARCHAR)
{ {
string_count++; string_count++;
string_total_length+= new_field->pack_length(); string_total_length+= new_field->pack_length();
} }
if (item->marker == 4 && item->maybe_null) if (item->marker == 4 && item->maybe_null)
{ {
group_null_items++; group_null_items++;
@@ -15292,7 +15307,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
if (group && if (group &&
(param->group_parts > table->file->max_key_parts() || (param->group_parts > table->file->max_key_parts() ||
param->group_length > table->file->max_key_length())) param->group_length > table->file->max_key_length()))
using_unique_constraint=1; using_unique_constraint= true;
} }
else else
{ {
@@ -15429,7 +15444,9 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
field->real_type() == MYSQL_TYPE_STRING && field->real_type() == MYSQL_TYPE_STRING &&
length >= MIN_STRING_LENGTH_TO_PACK_ROWS) length >= MIN_STRING_LENGTH_TO_PACK_ROWS)
recinfo->type= FIELD_SKIP_ENDSPACE; recinfo->type= FIELD_SKIP_ENDSPACE;
else if (field->real_type() == MYSQL_TYPE_VARCHAR) else if (use_packed_rows &&
field->real_type() == MYSQL_TYPE_VARCHAR &&
length >= MIN_STRING_LENGTH_TO_PACK_ROWS)
recinfo->type= FIELD_VARCHAR; recinfo->type= FIELD_VARCHAR;
else else
recinfo->type= FIELD_NORMAL; recinfo->type= FIELD_NORMAL;
@@ -16200,7 +16217,10 @@ bool create_internal_tmp_table(TABLE *table, KEY *keyinfo,
start_recinfo, start_recinfo,
share->uniques, &uniquedef, share->uniques, &uniquedef,
&create_info, &create_info,
HA_CREATE_TMP_TABLE))) HA_CREATE_TMP_TABLE |
((share->db_create_options & HA_OPTION_PACK_RECORD) ?
HA_PACK_RECORD : 0)
)))
{ {
table->file->print_error(error,MYF(0)); /* purecov: inspected */ table->file->print_error(error,MYF(0)); /* purecov: inspected */
table->db_stat=0; table->db_stat=0;
@@ -20596,6 +20616,8 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
return TRUE; /* Wrong field. */ return TRUE; /* Wrong field. */
uint el= all_fields.elements; uint el= all_fields.elements;
DBUG_ASSERT(all_fields.elements <=
thd->lex->current_select->ref_pointer_array_size);
all_fields.push_front(order_item); /* Add new field to field list. */ all_fields.push_front(order_item); /* Add new field to field list. */
ref_pointer_array[el]= order_item; ref_pointer_array[el]= order_item;
/* /*
@@ -20855,6 +20877,8 @@ create_distinct_group(THD *thd, Item **ref_pointer_array,
*/ */
Item_field *new_item= new Item_field(thd, (Item_field*)item); Item_field *new_item= new Item_field(thd, (Item_field*)item);
int el= all_fields.elements; int el= all_fields.elements;
DBUG_ASSERT(all_fields.elements <=
thd->lex->current_select->ref_pointer_array_size);
orig_ref_pointer_array[el]= new_item; orig_ref_pointer_array[el]= new_item;
all_fields.push_front(new_item); all_fields.push_front(new_item);
ord->item= orig_ref_pointer_array + el; ord->item= orig_ref_pointer_array + el;

View File

@@ -7388,11 +7388,12 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
tmp_table_param->field_count= field_count; tmp_table_param->field_count= field_count;
tmp_table_param->schema_table= 1; tmp_table_param->schema_table= 1;
SELECT_LEX *select_lex= thd->lex->current_select; SELECT_LEX *select_lex= thd->lex->current_select;
bool keep_row_order= sql_command_flags[thd->lex->sql_command] & CF_STATUS_COMMAND;
if (!(table= create_tmp_table(thd, tmp_table_param, if (!(table= create_tmp_table(thd, tmp_table_param,
field_list, (ORDER*) 0, 0, 0, field_list, (ORDER*) 0, 0, 0,
(select_lex->options | thd->variables.option_bits | (select_lex->options | thd->variables.option_bits |
TMP_TABLE_ALL_COLUMNS), TMP_TABLE_ALL_COLUMNS), HA_POS_ERROR,
HA_POS_ERROR, table_list->alias))) table_list->alias, false, keep_row_order)))
DBUG_RETURN(0); DBUG_RETURN(0);
my_bitmap_map* bitmaps= my_bitmap_map* bitmaps=
(my_bitmap_map*) thd->alloc(bitmap_buffer_size(field_count)); (my_bitmap_map*) thd->alloc(bitmap_buffer_size(field_count));

View File

@@ -2986,7 +2986,8 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
sql_field->interval_list); sql_field->interval_list);
List_iterator<String> int_it(sql_field->interval_list); List_iterator<String> int_it(sql_field->interval_list);
String conv, *tmp; String conv, *tmp;
char comma_buf[4]; /* 4 bytes for utf32 */ char comma_buf[5]; /* 5 bytes for 'filename' charset */
DBUG_ASSERT(sizeof(comma_buf) >= cs->mbmaxlen);
int comma_length= cs->cset->wc_mb(cs, ',', (uchar*) comma_buf, int comma_length= cs->cset->wc_mb(cs, ',', (uchar*) comma_buf,
(uchar*) comma_buf + (uchar*) comma_buf +
sizeof(comma_buf)); sizeof(comma_buf));

View File

@@ -142,7 +142,7 @@ void udf_init()
DBUG_ENTER("ufd_init"); DBUG_ENTER("ufd_init");
char db[]= "mysql"; /* A subject to casednstr, can't be constant */ char db[]= "mysql"; /* A subject to casednstr, can't be constant */
if (initialized) if (initialized || opt_noacl)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
#ifdef HAVE_PSI_INTERFACE #ifdef HAVE_PSI_INTERFACE
@@ -267,6 +267,8 @@ void udf_free()
{ {
/* close all shared libraries */ /* close all shared libraries */
DBUG_ENTER("udf_free"); DBUG_ENTER("udf_free");
if (opt_noacl)
DBUG_VOID_RETURN;
for (uint idx=0 ; idx < udf_hash.records ; idx++) for (uint idx=0 ; idx < udf_hash.records ; idx++)
{ {
udf_func *udf=(udf_func*) my_hash_element(&udf_hash,idx); udf_func *udf=(udf_func*) my_hash_element(&udf_hash,idx);

View File

@@ -143,5 +143,8 @@ udf_func *find_udf(const char *name, uint len=0,bool mark_used=0);
void free_udf(udf_func *udf); void free_udf(udf_func *udf);
int mysql_create_function(THD *thd,udf_func *udf); int mysql_create_function(THD *thd,udf_func *udf);
int mysql_drop_function(THD *thd,const LEX_STRING *name); int mysql_drop_function(THD *thd,const LEX_STRING *name);
#else
static inline void udf_init(void) { }
static inline void udf_free(void) { }
#endif #endif
#endif /* SQL_UDF_INCLUDED */ #endif /* SQL_UDF_INCLUDED */

View File

@@ -367,6 +367,9 @@ int mysql_update(THD *thd,
DBUG_RETURN(1); /* purecov: inspected */ DBUG_RETURN(1); /* purecov: inspected */
} }
if (check_unique_table(thd, table_list))
DBUG_RETURN(TRUE);
/* Apply the IN=>EXISTS transformation to all subqueries and optimize them. */ /* Apply the IN=>EXISTS transformation to all subqueries and optimize them. */
if (select_lex->optimize_unflattened_subqueries(false)) if (select_lex->optimize_unflattened_subqueries(false))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
@@ -1040,20 +1043,31 @@ bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
setup_ftfuncs(select_lex)) setup_ftfuncs(select_lex))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
/* Check that we are not using table that we are updating in a sub select */ select_lex->fix_prepare_information(thd, conds, &fake_conds);
{ DBUG_RETURN(FALSE);
}
/**
Check that we are not using table that we are updating in a sub select
@param thd Thread handle
@param table_list List of table with first to check
@retval TRUE Error
@retval FALSE OK
*/
bool check_unique_table(THD *thd, TABLE_LIST *table_list)
{
TABLE_LIST *duplicate; TABLE_LIST *duplicate;
DBUG_ENTER("check_unique_table");
if ((duplicate= unique_table(thd, table_list, table_list->next_global, 0))) if ((duplicate= unique_table(thd, table_list, table_list->next_global, 0)))
{ {
update_non_unique_table_error(table_list, "UPDATE", duplicate); update_non_unique_table_error(table_list, "UPDATE", duplicate);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
}
select_lex->fix_prepare_information(thd, conds, &fake_conds);
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
/*************************************************************************** /***************************************************************************
Update multiple tables from join Update multiple tables from join
***************************************************************************/ ***************************************************************************/

View File

@@ -27,6 +27,7 @@ typedef class st_select_lex_unit SELECT_LEX_UNIT;
bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list, bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
Item **conds, uint order_num, ORDER *order); Item **conds, uint order_num, ORDER *order);
bool check_unique_table(THD *thd, TABLE_LIST *table_list);
int mysql_update(THD *thd,TABLE_LIST *tables,List<Item> &fields, int mysql_update(THD *thd,TABLE_LIST *tables,List<Item> &fields,
List<Item> &values,COND *conds, List<Item> &values,COND *conds,
uint order_num, ORDER *order, ha_rows limit, uint order_num, ORDER *order, ha_rows limit,

View File

@@ -1520,6 +1520,11 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
*/ */
lex->sql_command= old_lex->sql_command; lex->sql_command= old_lex->sql_command;
lex->duplicates= old_lex->duplicates; lex->duplicates= old_lex->duplicates;
/* Fields in this view can be used in upper select in case of merge. */
if (table->select_lex)
table->select_lex->select_n_where_fields+=
lex->select_lex.select_n_where_fields;
} }
/* /*
This method has a dependency on the proper lock type being set, This method has a dependency on the proper lock type being set,

View File

@@ -9878,6 +9878,15 @@ table_factor:
sel->add_joined_table($$); sel->add_joined_table($$);
lex->pop_context(); lex->pop_context();
lex->nest_level--; lex->nest_level--;
/*
Fields in derived table can be used in upper select in
case of merge. We do not add HAVING fields because we do
not merge such derived. We do not add union because
also do not merge them
*/
if (!sel->next_select())
$2->select_n_where_fields+=
sel->select_n_where_fields;
} }
/*else if (($3->select_lex && /*else if (($3->select_lex &&
$3->select_lex->master_unit()->is_union() && $3->select_lex->master_unit()->is_union() &&

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. /* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2008, 2015, MariaDB Copyright (c) 2008, 2015, MariaDB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
@@ -2448,21 +2448,6 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
outparam->record[1]= outparam->record[0]; // Safety outparam->record[1]= outparam->record[0]; // Safety
} }
#ifdef HAVE_valgrind
/*
We need this because when we read var-length rows, we are not updating
bytes after end of varchar
*/
if (records > 1)
{
memcpy(outparam->record[0], share->default_values, share->rec_buff_length);
memcpy(outparam->record[1], share->default_values, share->null_bytes);
if (records > 2)
memcpy(outparam->record[1], share->default_values,
share->rec_buff_length);
}
#endif
if (!(field_ptr = (Field **) alloc_root(&outparam->mem_root, if (!(field_ptr = (Field **) alloc_root(&outparam->mem_root,
(uint) ((share->fields+1)* (uint) ((share->fields+1)*
sizeof(Field*))))) sizeof(Field*)))))

View File

@@ -1662,6 +1662,20 @@ int ha_federated::open(const char *name, int mode, uint test_if_locked)
DBUG_RETURN(0); DBUG_RETURN(0);
} }
class Net_error_handler : public Internal_error_handler
{
public:
Net_error_handler() {}
public:
bool handle_condition(THD *thd, uint sql_errno, const char* sqlstate,
MYSQL_ERROR::enum_warning_level level,
const char* msg, MYSQL_ERROR ** cond_hdl)
{
return sql_errno >= ER_ABORTING_CONNECTION &&
sql_errno <= ER_NET_WRITE_INTERRUPTED;
}
};
/* /*
Closes a table. We call the free_share() function to free any resources Closes a table. We call the free_share() function to free any resources
@@ -1683,18 +1697,15 @@ int ha_federated::close(void)
delete_dynamic(&results); delete_dynamic(&results);
/* Disconnect from mysql */ /* Disconnect from mysql */
THD *thd= ha_thd();
Net_error_handler err_handler;
if (thd)
thd->push_internal_handler(&err_handler);
mysql_close(mysql); mysql_close(mysql);
mysql= NULL; if (thd)
thd->pop_internal_handler();
/* mysql= NULL;
mysql_close() might return an error if a remote server's gone
for some reason. If that happens while removing a table from
the table cache, the error will be propagated to a client even
if the original query was not issued against the FEDERATED table.
So, don't propagate errors from mysql_close().
*/
if (table->in_use)
table->in_use->clear_error();
DBUG_RETURN(free_share(share)); DBUG_RETURN(free_share(share));
} }

View File

@@ -1639,6 +1639,7 @@ error:
} }
static federatedx_txn zero_txn;
static int free_server(federatedx_txn *txn, FEDERATEDX_SERVER *server) static int free_server(federatedx_txn *txn, FEDERATEDX_SERVER *server)
{ {
bool destroy; bool destroy;
@@ -1654,11 +1655,8 @@ static int free_server(federatedx_txn *txn, FEDERATEDX_SERVER *server)
MEM_ROOT mem_root; MEM_ROOT mem_root;
if (!txn) if (!txn)
{ txn= &zero_txn;
federatedx_txn tmp_txn;
tmp_txn.close(server);
}
else
txn->close(server); txn->close(server);
DBUG_ASSERT(server->io_count == 0); DBUG_ASSERT(server->io_count == 0);
@@ -1678,7 +1676,7 @@ static int free_server(federatedx_txn *txn, FEDERATEDX_SERVER *server)
free memory associated with it. free memory associated with it.
*/ */
static int free_share(federatedx_txn *txn, FEDERATEDX_SHARE *share) static void free_share(federatedx_txn *txn, FEDERATEDX_SHARE *share)
{ {
bool destroy; bool destroy;
DBUG_ENTER("free_share"); DBUG_ENTER("free_share");
@@ -1701,7 +1699,7 @@ static int free_share(federatedx_txn *txn, FEDERATEDX_SHARE *share)
free_server(txn, server); free_server(txn, server);
} }
DBUG_RETURN(0); DBUG_VOID_RETURN;
} }
@@ -1767,7 +1765,7 @@ int ha_federatedx::disconnect(handlerton *hton, MYSQL_THD thd)
int ha_federatedx::open(const char *name, int mode, uint test_if_locked) int ha_federatedx::open(const char *name, int mode, uint test_if_locked)
{ {
int error; int error;
THD *thd= current_thd; THD *thd= ha_thd();
DBUG_ENTER("ha_federatedx::open"); DBUG_ENTER("ha_federatedx::open");
if (!(share= get_share(name, table))) if (!(share= get_share(name, table)))
@@ -1797,6 +1795,20 @@ int ha_federatedx::open(const char *name, int mode, uint test_if_locked)
DBUG_RETURN(0); DBUG_RETURN(0);
} }
class Net_error_handler : public Internal_error_handler
{
public:
Net_error_handler() {}
public:
bool handle_condition(THD *thd, uint sql_errno, const char* sqlstate,
MYSQL_ERROR::enum_warning_level level,
const char* msg, MYSQL_ERROR ** cond_hdl)
{
return sql_errno >= ER_ABORTING_CONNECTION &&
sql_errno <= ER_NET_WRITE_INTERRUPTED;
}
};
/* /*
Closes a table. We call the free_share() function to free any resources Closes a table. We call the free_share() function to free any resources
@@ -1811,8 +1823,8 @@ int ha_federatedx::open(const char *name, int mode, uint test_if_locked)
int ha_federatedx::close(void) int ha_federatedx::close(void)
{ {
int retval= 0, error; int retval= 0;
THD *thd= current_thd; THD *thd= ha_thd();
DBUG_ENTER("ha_federatedx::close"); DBUG_ENTER("ha_federatedx::close");
/* free the result set */ /* free the result set */
@@ -1822,24 +1834,18 @@ int ha_federatedx::close(void)
/* Disconnect from mysql */ /* Disconnect from mysql */
if (!thd || !(txn= get_txn(thd, true))) if (!thd || !(txn= get_txn(thd, true)))
{ txn= &zero_txn;
federatedx_txn tmp_txn;
tmp_txn.release(&io);
DBUG_ASSERT(io == NULL);
if ((error= free_share(&tmp_txn, share)))
retval= error;
}
else
{
txn->release(&io); txn->release(&io);
DBUG_ASSERT(io == NULL); DBUG_ASSERT(io == NULL);
if ((error= free_share(txn, share))) Net_error_handler err_handler;
retval= error; if (thd)
} thd->push_internal_handler(&err_handler);
free_share(txn, share);
if (thd)
thd->pop_internal_handler();
DBUG_RETURN(retval); DBUG_RETURN(retval);
} }
@@ -1862,8 +1868,7 @@ int ha_federatedx::close(void)
0 otherwise 0 otherwise
*/ */
static inline uint field_in_record_is_null(TABLE *table, static inline uint field_in_record_is_null(TABLE *table, Field *field,
Field *field,
char *record) char *record)
{ {
int null_offset; int null_offset;
@@ -2203,7 +2208,7 @@ int ha_federatedx::end_bulk_insert()
*/ */
void ha_federatedx::update_auto_increment(void) void ha_federatedx::update_auto_increment(void)
{ {
THD *thd= current_thd; THD *thd= ha_thd();
DBUG_ENTER("ha_federatedx::update_auto_increment"); DBUG_ENTER("ha_federatedx::update_auto_increment");
ha_federatedx::info(HA_STATUS_AUTO); ha_federatedx::info(HA_STATUS_AUTO);
@@ -3058,7 +3063,7 @@ error:
int ha_federatedx::info(uint flag) int ha_federatedx::info(uint flag)
{ {
uint error_code; uint error_code;
THD *thd= current_thd; THD *thd= ha_thd();
federatedx_txn *tmp_txn; federatedx_txn *tmp_txn;
federatedx_io *tmp_io= 0, **iop= 0; federatedx_io *tmp_io= 0, **iop= 0;
DBUG_ENTER("ha_federatedx::info"); DBUG_ENTER("ha_federatedx::info");
@@ -3189,7 +3194,7 @@ int ha_federatedx::reset(void)
federatedx_io *tmp_io= 0, **iop; federatedx_io *tmp_io= 0, **iop;
// external_lock may not have been called so txn may not be set // external_lock may not have been called so txn may not be set
tmp_txn= get_txn(current_thd); tmp_txn= get_txn(ha_thd());
if (!*(iop= &io) && (error= tmp_txn->acquire(share, TRUE, (iop= &tmp_io)))) if (!*(iop= &io) && (error= tmp_txn->acquire(share, TRUE, (iop= &tmp_io))))
{ {
@@ -3364,7 +3369,7 @@ int ha_federatedx::create(const char *name, TABLE *table_arg,
HA_CREATE_INFO *create_info) HA_CREATE_INFO *create_info)
{ {
int retval; int retval;
THD *thd= current_thd; THD *thd= ha_thd();
FEDERATEDX_SHARE tmp_share; // Only a temporary share, to test the url FEDERATEDX_SHARE tmp_share; // Only a temporary share, to test the url
federatedx_txn *tmp_txn; federatedx_txn *tmp_txn;
federatedx_io *tmp_io= NULL; federatedx_io *tmp_io= NULL;

View File

@@ -1140,7 +1140,7 @@ dict_create_index_step(
>= DICT_TF_FORMAT_ZIP); >= DICT_TF_FORMAT_ZIP);
node->index = dict_index_get_if_in_cache_low(index_id); node->index = dict_index_get_if_in_cache_low(index_id);
ut_a(!node->index == (err != DB_SUCCESS)); ut_a(err == DB_SUCCESS ? node->index != NULL : node->index == NULL);
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {

View File

@@ -3648,13 +3648,13 @@ dict_foreign_push_index_error(
"%s table '%s' with foreign key constraint" "%s table '%s' with foreign key constraint"
" failed. There is no index in the referenced" " failed. There is no index in the referenced"
" table where the referenced columns appear" " table where the referenced columns appear"
" as the first columns. Error close to %s.\n", " as the first columns near '%s'.\n",
operation, create_name, latest_foreign); operation, create_name, latest_foreign);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT, ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table '%s' with foreign key constraint" "%s table '%s' with foreign key constraint"
" failed. There is no index in the referenced" " failed. There is no index in the referenced"
" table where the referenced columns appear" " table where the referenced columns appear"
" as the first columns. Error close to %s.", " as the first columns near '%s'.",
operation, create_name, latest_foreign); operation, create_name, latest_foreign);
break; break;
} }
@@ -3663,13 +3663,13 @@ dict_foreign_push_index_error(
"%s table '%s' with foreign key constraint" "%s table '%s' with foreign key constraint"
" failed. There is only prefix index in the referenced" " failed. There is only prefix index in the referenced"
" table where the referenced columns appear" " table where the referenced columns appear"
" as the first columns. Error close to %s.\n", " as the first columns near '%s'.\n",
operation, create_name, latest_foreign); operation, create_name, latest_foreign);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT, ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table '%s' with foreign key constraint" "%s table '%s' with foreign key constraint"
" failed. There is only prefix index in the referenced" " failed. There is only prefix index in the referenced"
" table where the referenced columns appear" " table where the referenced columns appear"
" as the first columns. Error close to %s.", " as the first columns near '%s'.",
operation, create_name, latest_foreign); operation, create_name, latest_foreign);
break; break;
} }
@@ -3677,12 +3677,12 @@ dict_foreign_push_index_error(
fprintf(ef, fprintf(ef,
"%s table %s with foreign key constraint" "%s table %s with foreign key constraint"
" failed. You have defined a SET NULL condition but " " failed. You have defined a SET NULL condition but "
"field %s on index is defined as NOT NULL close to %s\n", "column '%s' on index is defined as NOT NULL near '%s'.\n",
operation, create_name, columns[err_col], latest_foreign); operation, create_name, columns[err_col], latest_foreign);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT, ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint" "%s table %s with foreign key constraint"
" failed. You have defined a SET NULL condition but " " failed. You have defined a SET NULL condition but "
"field %s on index is defined as NOT NULL close to %s", "column '%s' on index is defined as NOT NULL near '%s'.",
operation, create_name, columns[err_col], latest_foreign); operation, create_name, columns[err_col], latest_foreign);
break; break;
} }
@@ -3695,13 +3695,13 @@ dict_foreign_push_index_error(
table, dict_col_get_no(field->col)); table, dict_col_get_no(field->col));
fprintf(ef, fprintf(ef,
"%s table %s with foreign key constraint" "%s table %s with foreign key constraint"
" failed. Field type or character set for column %s " " failed. Field type or character set for column '%s' "
"does not mach referenced column %s close to %s\n", "does not mach referenced column '%s' near '%s'.\n",
operation, create_name, columns[err_col], col_name, latest_foreign); operation, create_name, columns[err_col], col_name, latest_foreign);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT, ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint" "%s table %s with foreign key constraint"
" failed. Field type or character set for column %s " " failed. Field type or character set for column '%s' "
"does not mach referenced column %s close to %s", "does not mach referenced column '%s' near '%s'.",
operation, create_name, columns[err_col], col_name, latest_foreign); operation, create_name, columns[err_col], col_name, latest_foreign);
break; break;
} }
@@ -3993,14 +3993,14 @@ loop:
if (!success) { if (!success) {
dict_foreign_report_syntax_err( dict_foreign_report_syntax_err(
"%s table %s with foreign key constraint" "%s table %s with foreign key constraint"
" failed. Foreign key constraint parse error in %s" " failed. Parse error in '%s'"
" close to %s.\n", " near '%s'.\n",
operation, create_name, start_of_latest_foreign, orig); operation, create_name, start_of_latest_foreign, orig);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT, ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint" "%s table %s with foreign key constraint"
" failed. Foreign key constraint parse error in %s" " failed. Parse error in '%s'"
" close to %s.", " near '%s'.",
operation, create_name, start_of_latest_foreign, orig); operation, create_name, start_of_latest_foreign, orig);
return(DB_CANNOT_ADD_CONSTRAINT); return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4029,16 +4029,16 @@ col_loop1:
dict_foreign_error_report_low(ef, create_name); dict_foreign_error_report_low(ef, create_name);
fprintf(ef, fprintf(ef,
"%s table %s with foreign key constraint" "%s table %s with foreign key constraint"
" failed. Foreign key constraint parse error in %s" " failed. Parse error in '%s'"
" close to %s.\n", " near '%s'.\n",
operation, create_name, start_of_latest_foreign, orig); operation, create_name, start_of_latest_foreign, orig);
mutex_exit(&dict_foreign_err_mutex); mutex_exit(&dict_foreign_err_mutex);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT, ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint" "%s table %s with foreign key constraint"
" failed. Foreign key constraint parse error in %s" " failed. Parse error in '%s'"
" close to %s.", " near '%s'.",
operation, create_name, start_of_latest_foreign, orig); operation, create_name, start_of_latest_foreign, orig);
return(DB_CANNOT_ADD_CONSTRAINT); return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4058,14 +4058,14 @@ col_loop1:
if (!success) { if (!success) {
dict_foreign_report_syntax_err( dict_foreign_report_syntax_err(
"%s table %s with foreign key constraint" "%s table %s with foreign key constraint"
" failed. Foreign key constraint parse error in %s" " failed. Parse error in '%s'"
" close to %s.\n", " near '%s'.\n",
operation, create_name, start_of_latest_foreign, orig); operation, create_name, start_of_latest_foreign, orig);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT, ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint" "%s table %s with foreign key constraint"
" failed. Foreign key constraint parse error in %s" " failed. Parse error in '%s'"
" close to %s.", " near '%s'.",
operation, create_name, start_of_latest_foreign, orig); operation, create_name, start_of_latest_foreign, orig);
return(DB_CANNOT_ADD_CONSTRAINT); return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4101,14 +4101,14 @@ col_loop1:
if (!success || !my_isspace(cs, *ptr)) { if (!success || !my_isspace(cs, *ptr)) {
dict_foreign_report_syntax_err( dict_foreign_report_syntax_err(
"%s table %s with foreign key constraint" "%s table %s with foreign key constraint"
" failed. Foreign key constraint parse error in %s" " failed. Parse error in '%s'"
" close to %s.\n", " near '%s'.\n",
operation, create_name, start_of_latest_foreign, orig); operation, create_name, start_of_latest_foreign, orig);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT, ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint" "%s table %s with foreign key constraint"
" failed. Foreign key constraint parse error in %s" " failed. Parse error in '%s'"
" close to %s.", " near '%s'.",
operation, create_name, start_of_latest_foreign, orig); operation, create_name, start_of_latest_foreign, orig);
return(DB_CANNOT_ADD_CONSTRAINT); return(DB_CANNOT_ADD_CONSTRAINT);
} }
@@ -4168,7 +4168,7 @@ col_loop1:
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT, ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint failed. Referenced table %s not found in the data dictionary " "%s table %s with foreign key constraint failed. Referenced table %s not found in the data dictionary "
"close to %s.", "near '%s'.",
operation, create_name, buf, start_of_latest_foreign); operation, create_name, buf, start_of_latest_foreign);
dict_foreign_free(foreign); dict_foreign_free(foreign);
@@ -4177,7 +4177,7 @@ col_loop1:
dict_foreign_error_report_low(ef, create_name); dict_foreign_error_report_low(ef, create_name);
fprintf(ef, fprintf(ef,
"%s table %s with foreign key constraint failed. Referenced table %s not found in the data dictionary " "%s table %s with foreign key constraint failed. Referenced table %s not found in the data dictionary "
"close to %s.\n", "near '%s'.\n",
operation, create_name, buf, start_of_latest_foreign); operation, create_name, buf, start_of_latest_foreign);
mutex_exit(&dict_foreign_err_mutex); mutex_exit(&dict_foreign_err_mutex);
@@ -4192,14 +4192,14 @@ col_loop1:
dict_foreign_free(foreign); dict_foreign_free(foreign);
dict_foreign_report_syntax_err( dict_foreign_report_syntax_err(
"%s table %s with foreign key constraint" "%s table %s with foreign key constraint"
" failed. Foreign key constraint parse error in %s" " failed. Parse error in '%s'"
" close to %s.\n", " near '%s'.\n",
operation, create_name, start_of_latest_foreign, orig); operation, create_name, start_of_latest_foreign, orig);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT, ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint" "%s table %s with foreign key constraint"
" failed. Foreign key constraint parse error in %s" " failed. Parse error in '%s'"
" close to %s.", " near '%s'.",
operation, create_name, start_of_latest_foreign, orig); operation, create_name, start_of_latest_foreign, orig);
return(DB_CANNOT_ADD_CONSTRAINT); return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4221,16 +4221,16 @@ col_loop2:
dict_foreign_error_report_low(ef, create_name); dict_foreign_error_report_low(ef, create_name);
fprintf(ef, fprintf(ef,
"%s table %s with foreign key constraint" "%s table %s with foreign key constraint"
" failed. Foreign key constraint parse error in %s" " failed. Parse error in '%s'"
" close to %s.\n", " near '%s'.\n",
operation, create_name, start_of_latest_foreign, orig); operation, create_name, start_of_latest_foreign, orig);
mutex_exit(&dict_foreign_err_mutex); mutex_exit(&dict_foreign_err_mutex);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT, ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint" "%s table %s with foreign key constraint"
" failed. Foreign key constraint parse error in %s" " failed. Parse error in '%s'"
" close to %s.", " near '%s'.",
operation, create_name, start_of_latest_foreign, orig); operation, create_name, start_of_latest_foreign, orig);
return(DB_CANNOT_ADD_CONSTRAINT); return(DB_CANNOT_ADD_CONSTRAINT);
} }
@@ -4248,14 +4248,12 @@ col_loop2:
dict_foreign_report_syntax_err( dict_foreign_report_syntax_err(
"%s table %s with foreign key constraint" "%s table %s with foreign key constraint"
" failed. Foreign key constraint parse error in %s" " failed. Parse error in '%s' near '%s'. Referencing column count does not match referenced column count.\n",
" close to %s. Too few referenced columns.\n",
operation, create_name, start_of_latest_foreign, orig); operation, create_name, start_of_latest_foreign, orig);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT, ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint" "%s table %s with foreign key constraint"
" failed. Foreign key constraint parse error in %s" " failed. Parse error in '%s' near '%s'. Referencing column count %d does not match referenced column count %d.\n",
" close to %s. Too few referenced columns, you have %d when you should have %d.",
operation, create_name, start_of_latest_foreign, orig, i, foreign->n_fields); operation, create_name, start_of_latest_foreign, orig, i, foreign->n_fields);
dict_foreign_free(foreign); dict_foreign_free(foreign);
@@ -4288,14 +4286,14 @@ scan_on_conditions:
dict_foreign_report_syntax_err( dict_foreign_report_syntax_err(
"%s table %s with foreign key constraint" "%s table %s with foreign key constraint"
" failed. Foreign key constraint parse error in %s" " failed. Parse error in '%s'"
" close to %s.\n", " near '%s'.\n",
operation, create_name, start_of_latest_foreign, start_of_latest_set); operation, create_name, start_of_latest_foreign, start_of_latest_set);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT, ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint" "%s table %s with foreign key constraint"
" failed. Foreign key constraint parse error in %s" " failed. Parse error in '%s'"
" close to %s.", " near '%s'.",
operation, create_name, start_of_latest_foreign, start_of_latest_set); operation, create_name, start_of_latest_foreign, start_of_latest_set);
return(DB_CANNOT_ADD_CONSTRAINT); return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4336,14 +4334,14 @@ scan_on_conditions:
dict_foreign_free(foreign); dict_foreign_free(foreign);
dict_foreign_report_syntax_err( dict_foreign_report_syntax_err(
"%s table %s with foreign key constraint" "%s table %s with foreign key constraint"
" failed. Foreign key constraint parse error in %s" " failed. Parse error in '%s'"
" close to %s.\n", " near '%s'.\n",
operation, create_name, start_of_latest_foreign, start_of_latest_set); operation, create_name, start_of_latest_foreign, start_of_latest_set);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT, ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint" "%s table %s with foreign key constraint"
" failed. Foreign key constraint parse error in %s" " failed. Parse error in '%s'"
" close to %s.", " near '%s'.",
operation, create_name, start_of_latest_foreign, start_of_latest_set); operation, create_name, start_of_latest_foreign, start_of_latest_set);
return(DB_CANNOT_ADD_CONSTRAINT); return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4365,14 +4363,14 @@ scan_on_conditions:
dict_foreign_free(foreign); dict_foreign_free(foreign);
dict_foreign_report_syntax_err( dict_foreign_report_syntax_err(
"%s table %s with foreign key constraint" "%s table %s with foreign key constraint"
" failed. Foreign key constraint parse error in %s" " failed. Parse error in '%s'"
" close to %s.\n", " near '%s'.\n",
operation, create_name, start_of_latest_foreign, start_of_latest_set); operation, create_name, start_of_latest_foreign, start_of_latest_set);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT, ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint" "%s table %s with foreign key constraint"
" failed. Foreign key constraint parse error in %s" " failed. Parse error in '%s'"
" close to %s.", " near '%s'.",
operation, create_name, start_of_latest_foreign, start_of_latest_set); operation, create_name, start_of_latest_foreign, start_of_latest_set);
return(DB_CANNOT_ADD_CONSTRAINT); return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4385,14 +4383,14 @@ scan_on_conditions:
dict_foreign_free(foreign); dict_foreign_free(foreign);
dict_foreign_report_syntax_err( dict_foreign_report_syntax_err(
"%s table %s with foreign key constraint" "%s table %s with foreign key constraint"
" failed. Foreign key constraint parse error in %s" " failed. Parse error in '%s'"
" close to %s.\n", " near '%s'.\n",
operation, create_name, start_of_latest_foreign, start_of_latest_set); operation, create_name, start_of_latest_foreign, start_of_latest_set);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT, ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint" "%s table %s with foreign key constraint"
" failed. Foreign key constraint parse error in %s" " failed. Parse error in '%s'"
" close to %s.", " near '%s'.",
operation, create_name, start_of_latest_foreign, start_of_latest_set); operation, create_name, start_of_latest_foreign, start_of_latest_set);
return(DB_CANNOT_ADD_CONSTRAINT); return(DB_CANNOT_ADD_CONSTRAINT);
} }
@@ -4412,16 +4410,16 @@ scan_on_conditions:
dict_foreign_error_report_low(ef, create_name); dict_foreign_error_report_low(ef, create_name);
fprintf(ef, fprintf(ef,
"%s table %s with foreign key constraint" "%s table %s with foreign key constraint"
" failed. You have defined a SET NULL condition but column %s is defined as NOT NULL" " failed. You have defined a SET NULL condition but column '%s' is defined as NOT NULL"
" in %s close to %s.\n", " in '%s' near '%s'.\n",
operation, create_name, col_name, start_of_latest_foreign, start_of_latest_set); operation, create_name, col_name, start_of_latest_foreign, start_of_latest_set);
mutex_exit(&dict_foreign_err_mutex); mutex_exit(&dict_foreign_err_mutex);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT, ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint" "%s table %s with foreign key constraint"
" failed. You have defined a SET NULL condition but column %s is defined as NOT NULL" " failed. You have defined a SET NULL condition but column '%s' is defined as NOT NULL"
" in %s close to %s.", " in '%s' near '%s'.",
operation, create_name, col_name, start_of_latest_foreign, start_of_latest_set); operation, create_name, col_name, start_of_latest_foreign, start_of_latest_set);
dict_foreign_free(foreign); dict_foreign_free(foreign);
@@ -4447,14 +4445,14 @@ try_find_index:
fprintf(ef, fprintf(ef,
"%s table %s with foreign key constraint" "%s table %s with foreign key constraint"
" failed. You have more than one on delete or on update clause" " failed. You have more than one on delete or on update clause"
" in %s close to %s.\n", " in '%s' near '%s'.\n",
operation, create_name, start_of_latest_foreign, start_of_latest_set); operation, create_name, start_of_latest_foreign, start_of_latest_set);
mutex_exit(&dict_foreign_err_mutex); mutex_exit(&dict_foreign_err_mutex);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT, ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint" "%s table %s with foreign key constraint"
" failed. You have more than one on delete or on update clause" " failed. You have more than one on delete or on update clause"
" in %s close to %s.", " in '%s' near '%s'.",
operation, create_name, start_of_latest_foreign, start_of_latest_set); operation, create_name, start_of_latest_foreign, start_of_latest_set);
dict_foreign_free(foreign); dict_foreign_free(foreign);
return(DB_CANNOT_ADD_CONSTRAINT); return(DB_CANNOT_ADD_CONSTRAINT);

View File

@@ -1561,10 +1561,11 @@ innobase_next_autoinc(
if (next_value == 0) { if (next_value == 0) {
ulonglong next; ulonglong next;
if (current > offset) { if (current >= offset) {
next = (current - offset) / step; next = (current - offset) / step;
} else { } else {
next = (offset - current) / step; next = 0;
block -= step;
} }
ut_a(max_value > next); ut_a(max_value > next);
@@ -4143,7 +4144,7 @@ ha_innobase::open(
} }
ib_table = dict_table_get( ib_table = dict_table_get(
par_case_name, FALSE, ignore_err); par_case_name, TRUE, ignore_err);
} }
if (ib_table) { if (ib_table) {
#ifndef __WIN__ #ifndef __WIN__
@@ -7709,7 +7710,8 @@ create_table_def(
/* MySQL does the name length check. But we do additional check /* MySQL does the name length check. But we do additional check
on the name length here */ on the name length here */
if (strlen(table_name) > MAX_FULL_NAME_LEN) { const size_t table_name_len = strlen(table_name);
if (table_name_len > MAX_FULL_NAME_LEN) {
push_warning_printf( push_warning_printf(
(THD*) trx->mysql_thd, MYSQL_ERROR::WARN_LEVEL_WARN, (THD*) trx->mysql_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TABLE_NAME, ER_TABLE_NAME,
@@ -7718,6 +7720,15 @@ create_table_def(
DBUG_RETURN(ER_TABLE_NAME); DBUG_RETURN(ER_TABLE_NAME);
} }
if (table_name[table_name_len - 1] == '/') {
push_warning_printf(
(THD*) trx->mysql_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TABLE_NAME,
"InnoDB: Table name is empty");
DBUG_RETURN(ER_WRONG_TABLE_NAME);
}
n_cols = form->s->fields; n_cols = form->s->fields;
/* We pass 0 as the space id, and determine at a lower level the space /* We pass 0 as the space id, and determine at a lower level the space
@@ -11513,10 +11524,7 @@ ha_innobase::get_auto_increment(
current = *first_value; current = *first_value;
/* If the increment step of the auto increment column if (prebuilt->autoinc_increment != increment) {
decreases then it is not affecting the immediate
next value in the series. */
if (prebuilt->autoinc_increment > increment) {
#ifdef WITH_WSREP #ifdef WITH_WSREP
WSREP_DEBUG("autoinc decrease: %llu -> %llu\n" WSREP_DEBUG("autoinc decrease: %llu -> %llu\n"
@@ -11534,7 +11542,7 @@ ha_innobase::get_auto_increment(
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
current = innobase_next_autoinc( current = innobase_next_autoinc(
current, 1, increment, 1, col_max_value); current, 1, increment, offset, col_max_value);
dict_table_autoinc_initialize(prebuilt->table, current); dict_table_autoinc_initialize(prebuilt->table, current);

View File

@@ -1,6 +1,6 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1997, 2010, Innobase Oy. All Rights Reserved. Copyright (c) 1997, 2015, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under 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 the Free Software the terms of the GNU General Public License as published by the Free Software
@@ -736,6 +736,10 @@ not_consistent:
fprintf(stderr, fprintf(stderr,
"InnoDB: No valid checkpoint found.\n" "InnoDB: No valid checkpoint found.\n"
"InnoDB: If you are attempting downgrade"
" from MySQL 5.7.9 or later,\n"
"InnoDB: please refer to " REFMAN
"upgrading-downgrading.html\n"
"InnoDB: If this error appears when you are" "InnoDB: If this error appears when you are"
" creating an InnoDB database,\n" " creating an InnoDB database,\n"
"InnoDB: the problem may be that during" "InnoDB: the problem may be that during"
@@ -1763,7 +1767,7 @@ loop:
goto loop; goto loop;
} }
ut_ad(!allow_ibuf == mutex_own(&log_sys->mutex)); ut_ad(allow_ibuf == FALSE ? mutex_own(&log_sys->mutex) : !mutex_own(&log_sys->mutex));
if (!allow_ibuf) { if (!allow_ibuf) {
recv_no_ibuf_operations = TRUE; recv_no_ibuf_operations = TRUE;

View File

@@ -1,5 +1,6 @@
/* /*
Copyright (c) 2000, 2011, Oracle and/or its affiliates Copyright (c) 2000, 2015, Oracle and/or its affiliates
Copyright (c) 2010, 2015, MariaDB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -473,7 +474,6 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
key_del[i]=HA_OFFSET_ERROR; key_del[i]=HA_OFFSET_ERROR;
unique_key_parts=0; unique_key_parts=0;
offset=reclength-uniques*MI_UNIQUE_HASH_LENGTH;
for (i=0, uniquedef=uniquedefs ; i < uniques ; i++ , uniquedef++) for (i=0, uniquedef=uniquedefs ; i < uniques ; i++ , uniquedef++)
{ {
uniquedef->key=keys+i; uniquedef->key=keys+i;
@@ -739,7 +739,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
#endif #endif
} }
/* Create extra keys for unique definitions */ /* Create extra keys for unique definitions */
offset=reclength-uniques*MI_UNIQUE_HASH_LENGTH; offset=real_reclength - uniques * MI_UNIQUE_HASH_LENGTH;
bzero((char*) &tmp_keydef,sizeof(tmp_keydef)); bzero((char*) &tmp_keydef,sizeof(tmp_keydef));
bzero((char*) &tmp_keyseg,sizeof(tmp_keyseg)); bzero((char*) &tmp_keyseg,sizeof(tmp_keyseg));
for (i=0; i < uniques ; i++) for (i=0; i < uniques ; i++)

View File

@@ -3140,189 +3140,3 @@ static uint32_t pack_key_from_desc(
return (uint32_t)(packed_key_pos - buf); // return (uint32_t)(packed_key_pos - buf); //
} }
static bool fields_have_same_name(Field* a, Field* b) {
return strcmp(a->field_name, b->field_name) == 0;
}
static bool fields_are_same_type(Field* a, Field* b) {
bool retval = true;
enum_field_types a_mysql_type = a->real_type();
enum_field_types b_mysql_type = b->real_type();
TOKU_TYPE a_toku_type = mysql_to_toku_type(a);
TOKU_TYPE b_toku_type = mysql_to_toku_type(b);
// make sure have same names
// make sure have same types
if (a_mysql_type != b_mysql_type) {
retval = false;
goto cleanup;
}
// Thanks to MariaDB 5.5, we can have two fields
// be the same MySQL type but not the same toku type,
// This is an issue introduced with MariaDB's fractional time
// implementation
if (a_toku_type != b_toku_type) {
retval = false;
goto cleanup;
}
// make sure that either both are nullable, or both not nullable
if ((a->null_bit && !b->null_bit) || (!a->null_bit && b->null_bit)) {
retval = false;
goto cleanup;
}
switch (a_mysql_type) {
case MYSQL_TYPE_TINY:
case MYSQL_TYPE_SHORT:
case MYSQL_TYPE_INT24:
case MYSQL_TYPE_LONG:
case MYSQL_TYPE_LONGLONG:
// length, unsigned, auto increment
if (a->pack_length() != b->pack_length() ||
(a->flags & UNSIGNED_FLAG) != (b->flags & UNSIGNED_FLAG) ||
(a->flags & AUTO_INCREMENT_FLAG) != (b->flags & AUTO_INCREMENT_FLAG)) {
retval = false;
goto cleanup;
}
break;
case MYSQL_TYPE_DOUBLE:
case MYSQL_TYPE_FLOAT:
// length, unsigned, auto increment
if (a->pack_length() != b->pack_length() ||
(a->flags & UNSIGNED_FLAG) != (b->flags & UNSIGNED_FLAG) ||
(a->flags & AUTO_INCREMENT_FLAG) != (b->flags & AUTO_INCREMENT_FLAG)) {
retval = false;
goto cleanup;
}
break;
case MYSQL_TYPE_NEWDECIMAL:
// length, unsigned
if (a->pack_length() != b->pack_length() ||
(a->flags & UNSIGNED_FLAG) != (b->flags & UNSIGNED_FLAG)) {
retval = false;
goto cleanup;
}
break;
case MYSQL_TYPE_ENUM: {
Field_enum *a_enum = static_cast<Field_enum *>(a);
if (!a_enum->eq_def(b)) {
retval = false;
goto cleanup;
}
break;
}
case MYSQL_TYPE_SET: {
Field_set *a_set = static_cast<Field_set *>(a);
if (!a_set->eq_def(b)) {
retval = false;
goto cleanup;
}
break;
}
case MYSQL_TYPE_BIT:
// length
if (a->pack_length() != b->pack_length()) {
retval = false;
goto cleanup;
}
break;
case MYSQL_TYPE_DATE:
case MYSQL_TYPE_DATETIME:
case MYSQL_TYPE_YEAR:
case MYSQL_TYPE_NEWDATE:
case MYSQL_TYPE_TIME:
case MYSQL_TYPE_TIMESTAMP:
#if (50600 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699) || \
(50700 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50799) || \
(100000 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 100099)
case MYSQL_TYPE_DATETIME2:
case MYSQL_TYPE_TIMESTAMP2:
case MYSQL_TYPE_TIME2:
#endif
// length
if (a->pack_length() != b->pack_length()) {
retval = false;
goto cleanup;
}
break;
case MYSQL_TYPE_TINY_BLOB:
case MYSQL_TYPE_MEDIUM_BLOB:
case MYSQL_TYPE_BLOB:
case MYSQL_TYPE_LONG_BLOB:
// test the charset
if (a->charset()->number != b->charset()->number) {
retval = false;
goto cleanup;
}
if (a->row_pack_length() != b->row_pack_length()) {
retval = false;
goto cleanup;
}
break;
case MYSQL_TYPE_STRING:
if (a->pack_length() != b->pack_length()) {
retval = false;
goto cleanup;
}
// if both are binary, we know have same pack lengths,
// so we can goto end
if (a->binary() && b->binary()) {
// nothing to do, we are good
}
else if (!a->binary() && !b->binary()) {
// test the charset
if (a->charset()->number != b->charset()->number) {
retval = false;
goto cleanup;
}
}
else {
// one is binary and the other is not, so not the same
retval = false;
goto cleanup;
}
break;
case MYSQL_TYPE_VARCHAR:
if (a->field_length != b->field_length) {
retval = false;
goto cleanup;
}
// if both are binary, we know have same pack lengths,
// so we can goto end
if (a->binary() && b->binary()) {
// nothing to do, we are good
}
else if (!a->binary() && !b->binary()) {
// test the charset
if (a->charset()->number != b->charset()->number) {
retval = false;
goto cleanup;
}
}
else {
// one is binary and the other is not, so not the same
retval = false;
goto cleanup;
}
break;
//
// I believe these are old types that are no longer
// in any 5.1 tables, so tokudb does not need
// to worry about them
// Putting in this assert in case I am wrong.
// Do not support geometry yet.
//
case MYSQL_TYPE_GEOMETRY:
case MYSQL_TYPE_DECIMAL:
case MYSQL_TYPE_VAR_STRING:
case MYSQL_TYPE_NULL:
assert(false);
}
cleanup:
return retval;
}
static bool are_two_fields_same(Field* a, Field* b) {
return fields_have_same_name(a, b) && fields_are_same_type(a, b);
}

View File

@@ -208,10 +208,6 @@ static bool is_variable_field(KEY_AND_COL_INFO *kcinfo, uint field_num) {
return kcinfo->field_types[field_num] == KEY_AND_COL_INFO::TOKUDB_VARIABLE_FIELD; return kcinfo->field_types[field_num] == KEY_AND_COL_INFO::TOKUDB_VARIABLE_FIELD;
} }
static bool is_blob_field(KEY_AND_COL_INFO *kcinfo, uint field_num) {
return kcinfo->field_types[field_num] == KEY_AND_COL_INFO::TOKUDB_BLOB_FIELD;
}
static bool field_valid_for_tokudb_table(Field* field); static bool field_valid_for_tokudb_table(Field* field);
static void get_var_field_info( static void get_var_field_info(
@@ -472,20 +468,5 @@ static uint32_t pack_key_from_desc(
const DBT* pk_val const DBT* pk_val
); );
static bool fields_have_same_name(
Field* a,
Field* b
);
static bool fields_are_same_type(
Field* a,
Field* b
);
static bool are_two_fields_same(
Field* a,
Field* b
);
#endif #endif

View File

@@ -193,10 +193,6 @@ static MYSQL_THDVAR_BOOL(disable_slow_alter,
false false
); );
static bool get_disable_slow_alter(THD* thd) {
return (THDVAR(thd, disable_slow_alter) != 0);
}
static MYSQL_THDVAR_BOOL(disable_hot_alter, static MYSQL_THDVAR_BOOL(disable_hot_alter,
0, 0,
"if on, hot alter table is disabled", "if on, hot alter table is disabled",
@@ -205,10 +201,6 @@ static MYSQL_THDVAR_BOOL(disable_hot_alter,
false false
); );
static bool get_disable_hot_alter(THD* thd) {
return THDVAR(thd, disable_hot_alter) != 0;
}
static MYSQL_THDVAR_BOOL(create_index_online, static MYSQL_THDVAR_BOOL(create_index_online,
0, 0,
"if on, create index done online", "if on, create index done online",

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