Commit 28f81366 authored by Otto Kekäläinen's avatar Otto Kekäläinen
Browse files

Merge tag 'upstream/5.5.58' into ubuntu-14.04

Upstream version 5.5.58

# gpg: Signature made la 30. joulukuuta 2017 17.55.25 EET
# gpg:                using RSA key BED8449FCEE8DA88
# gpg: Good signature from "Otto Kekäläinen <otto@seravo.fi>" [full]
# gpg:                 aka "Otto Kekäläinen <otto@kekalainen.net>" [full]
# gpg:                 aka "Otto Kekäläinen <otto@fsfe.org>" [full]
# gpg:                 aka "Otto Kekäläinen <otto@linux.com>" [full]
# gpg:                 aka "Otto Kekäläinen <otto.kekalainen@seravo.fi>" [full]
# gpg:                 aka "Otto Kekäläinen <otto@mariadb.org>" [undefined]
# gpg:                 aka "Otto Kekäläinen <otto@debian.org>" [undefined]
# gpg:                 aka "Otto Kekäläinen <otto@sange.fi>" [full]
parents d84cded3 fa5f29ea
...@@ -159,7 +159,7 @@ parse_arguments() ...@@ -159,7 +159,7 @@ parse_arguments()
# Try to find a specific file within --basedir which can either be a binary # Try to find a specific file within --basedir which can either be a binary
# release or installed source directory and return the path. # release or installed source directory and return the path.
find_in_basedir() find_in_dirs()
{ {
case "$1" in case "$1" in
--dir) --dir)
...@@ -171,13 +171,13 @@ find_in_basedir() ...@@ -171,13 +171,13 @@ find_in_basedir()
for dir in "$@" for dir in "$@"
do do
if test -f "$basedir/$dir/$file" if test -f "$dir/$file"
then then
if test -n "$return_dir" if test -n "$return_dir"
then then
echo "$basedir/$dir" echo "$dir"
else else
echo "$basedir/$dir/$file" echo "$dir/$file"
fi fi
break break
fi fi
...@@ -239,7 +239,7 @@ then ...@@ -239,7 +239,7 @@ then
print_defaults="$builddir/extra/my_print_defaults" print_defaults="$builddir/extra/my_print_defaults"
elif test -n "$basedir" elif test -n "$basedir"
then then
print_defaults=`find_in_basedir my_print_defaults bin extra` print_defaults=`find_in_dirs my_print_defaults $basedir/bin $basedir/extra`
if test -z "$print_defaults" if test -z "$print_defaults"
then then
cannot_find_file my_print_defaults $basedir/bin $basedir/extra cannot_find_file my_print_defaults $basedir/bin $basedir/extra
...@@ -265,41 +265,43 @@ if test -n "$srcdir" ...@@ -265,41 +265,43 @@ if test -n "$srcdir"
then then
basedir="$builddir" basedir="$builddir"
bindir="$basedir/client" bindir="$basedir/client"
extra_bindir="$basedir/extra" resolveip="$basedir/extra/resolveip"
mysqld="$basedir/sql/mysqld" mysqld="$basedir/sql/mysqld"
langdir="$basedir/sql/share/english" langdir="$basedir/sql/share/english"
pkgdatadir="$srcdir/scripts" pkgdatadir="$srcdir/scripts"
scriptdir="$srcdir/scripts"
elif test -n "$basedir" elif test -n "$basedir"
then then
bindir="$basedir/bin" bindir="$basedir/bin" # only used in the help text
extra_bindir="$bindir" resolveip=`find_in_dirs resolveip @resolveip_locations@`
mysqld=`find_in_basedir mysqld libexec sbin bin` if test -z "$resolveip"
then
cannot_find_file resolveip @resolveip_locations@
exit 1
fi
mysqld=`find_in_dirs mysqld @mysqld_locations@`
if test -z "$mysqld" if test -z "$mysqld"
then then
cannot_find_file mysqld $basedir/libexec $basedir/sbin $basedir/bin cannot_find_file mysqld @mysqld_locations@
exit 1 exit 1
fi fi
langdir=`find_in_basedir --dir errmsg.sys share/english share/mysql/english` langdir=`find_in_dirs --dir errmsg.sys @errmsg_locations@`
if test -z "$langdir" if test -z "$langdir"
then then
cannot_find_file errmsg.sys $basedir/share/english $basedir/share/mysql/english cannot_find_file errmsg.sys @errmsg_locations@
exit 1 exit 1
fi fi
pkgdatadir=`find_in_basedir --dir fill_help_tables.sql share share/mysql` pkgdatadir=`find_in_dirs --dir fill_help_tables.sql @pkgdata_locations@`
if test -z "$pkgdatadir" if test -z "$pkgdatadir"
then then
cannot_find_file fill_help_tables.sql $basedir/share $basedir/share/mysql cannot_find_file fill_help_tables.sql @pkgdata_locations@
exit 1 exit 1
fi fi
scriptdir="$basedir/scripts"
else else
basedir="@prefix@" basedir="@prefix@"
bindir="@bindir@" bindir="@bindir@"
extra_bindir="$bindir" resolveip="$bindir/resolveip"
mysqld="@libexecdir@/mysqld" mysqld="@libexecdir@/mysqld"
pkgdatadir="@pkgdatadir@" pkgdatadir="@pkgdatadir@"
scriptdir="@scriptdir@"
fi fi
# Set up paths to SQL scripts required for bootstrap # Set up paths to SQL scripts required for bootstrap
...@@ -342,14 +344,14 @@ hostname=`@HOSTNAME@` ...@@ -342,14 +344,14 @@ hostname=`@HOSTNAME@`
# Check if hostname is valid # Check if hostname is valid
if test "$cross_bootstrap" -eq 0 -a "$in_rpm" -eq 0 -a "$force" -eq 0 if test "$cross_bootstrap" -eq 0 -a "$in_rpm" -eq 0 -a "$force" -eq 0
then then
resolved=`"$extra_bindir/resolveip" $hostname 2>&1` resolved=`"$resolveip" $hostname 2>&1`
if test $? -ne 0 if test $? -ne 0
then then
resolved=`"$extra_bindir/resolveip" localhost 2>&1` resolved=`"$resolveip" localhost 2>&1`
if test $? -ne 0 if test $? -ne 0
then then
echo "Neither host '$hostname' nor 'localhost' could be looked up with" echo "Neither host '$hostname' nor 'localhost' could be looked up with"
echo "'$extra_bindir/resolveip'" echo "'$resolveip'"
echo "Please configure the 'hostname' command to return a correct" echo "Please configure the 'hostname' command to return a correct"
echo "hostname." echo "hostname."
echo "If you want to solve this at a later stage, restart this script" echo "If you want to solve this at a later stage, restart this script"
...@@ -357,7 +359,7 @@ then ...@@ -357,7 +359,7 @@ then
link_to_help link_to_help
exit 1 exit 1
fi fi
echo "WARNING: The host '$hostname' could not be looked up with resolveip." echo "WARNING: The host '$hostname' could not be looked up with $resolveip."
echo "This probably means that your libc libraries are not 100 % compatible" echo "This probably means that your libc libraries are not 100 % compatible"
echo "with this binary MariaDB version. The MariaDB daemon, mysqld, should work" echo "with this binary MariaDB version. The MariaDB daemon, mysqld, should work"
echo "normally with the exception that host name resolving will not work." echo "normally with the exception that host name resolving will not work."
...@@ -436,7 +438,7 @@ else ...@@ -436,7 +438,7 @@ else
echo "The problem could be conflicting information in an external" echo "The problem could be conflicting information in an external"
echo "my.cnf files. You can ignore these by doing:" echo "my.cnf files. You can ignore these by doing:"
echo echo
echo " shell> $scriptdir/scripts/mysql_install_db --defaults-file=~/.my.cnf" echo " shell> $0 --defaults-file=~/.my.cnf"
echo echo
echo "You can also try to start the mysqld daemon with:" echo "You can also try to start the mysqld daemon with:"
echo echo
......
...@@ -1276,6 +1276,7 @@ void mysql_read_default_options(struct st_mysql_options *options, ...@@ -1276,6 +1276,7 @@ void mysql_read_default_options(struct st_mysql_options *options,
break; break;
case OPT_pipe: case OPT_pipe:
options->protocol = MYSQL_PROTOCOL_PIPE; options->protocol = MYSQL_PROTOCOL_PIPE;
break;
case OPT_connect_timeout: case OPT_connect_timeout:
case OPT_timeout: case OPT_timeout:
if (opt_arg) if (opt_arg)
......
...@@ -185,8 +185,8 @@ Events::reconstruct_interval_expression(String *buf, interval_type interval, ...@@ -185,8 +185,8 @@ Events::reconstruct_interval_expression(String *buf, interval_type interval,
expr= tmp_expr - (tmp_expr/60)*60; expr= tmp_expr - (tmp_expr/60)*60;
/* the code after the switch will finish */ /* the code after the switch will finish */
}
break; break;
}
case INTERVAL_HOUR_SECOND: case INTERVAL_HOUR_SECOND:
{ {
ulonglong tmp_expr= expr; ulonglong tmp_expr= expr;
...@@ -202,8 +202,8 @@ Events::reconstruct_interval_expression(String *buf, interval_type interval, ...@@ -202,8 +202,8 @@ Events::reconstruct_interval_expression(String *buf, interval_type interval,
expr= tmp_expr - (tmp_expr/60)*60; expr= tmp_expr - (tmp_expr/60)*60;
/* the code after the switch will finish */ /* the code after the switch will finish */
}
break; break;
}
case INTERVAL_DAY_SECOND: case INTERVAL_DAY_SECOND:
{ {
ulonglong tmp_expr= expr; ulonglong tmp_expr= expr;
...@@ -225,8 +225,8 @@ Events::reconstruct_interval_expression(String *buf, interval_type interval, ...@@ -225,8 +225,8 @@ Events::reconstruct_interval_expression(String *buf, interval_type interval,
expr= tmp_expr - (tmp_expr/60)*60; expr= tmp_expr - (tmp_expr/60)*60;
/* the code after the switch will finish */ /* the code after the switch will finish */
}
break; break;
}
case INTERVAL_DAY_MICROSECOND: case INTERVAL_DAY_MICROSECOND:
case INTERVAL_HOUR_MICROSECOND: case INTERVAL_HOUR_MICROSECOND:
case INTERVAL_MINUTE_MICROSECOND: case INTERVAL_MINUTE_MICROSECOND:
...@@ -240,6 +240,8 @@ Events::reconstruct_interval_expression(String *buf, interval_type interval, ...@@ -240,6 +240,8 @@ Events::reconstruct_interval_expression(String *buf, interval_type interval,
break; break;
case INTERVAL_WEEK: case INTERVAL_WEEK:
expr/= 7; expr/= 7;
close_quote= FALSE;
break;
default: default:
close_quote= FALSE; close_quote= FALSE;
break; break;
......
/* /*
Copyright (c) 2000, 2013, Oracle and/or its affiliates. Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2008, 2013, Monty Program Ab Copyright (c) 2008, 2017, MariaDB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -7947,13 +7947,13 @@ String *Field_set::val_str(String *val_buffer, ...@@ -7947,13 +7947,13 @@ String *Field_set::val_str(String *val_buffer,
ulonglong tmp=(ulonglong) Field_enum::val_int(); ulonglong tmp=(ulonglong) Field_enum::val_int();
uint bitnr=0; uint bitnr=0;
if (tmp == 0)
{
/* /*
Some callers expect *val_buffer to contain the result, Some callers expect *val_buffer to contain the result,
so we assign to it, rather than doing 'return &empty_set_string. so we assign to it, rather than doing 'return &empty_set_string.
*/ */
*val_buffer= empty_set_string; *val_buffer= empty_set_string;
if (tmp == 0)
{
return val_buffer; return val_buffer;
} }
...@@ -9218,7 +9218,7 @@ bool Create_field::init(THD *thd, char *fld_name, enum_field_types fld_type, ...@@ -9218,7 +9218,7 @@ bool Create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
case MYSQL_TYPE_DATE: case MYSQL_TYPE_DATE:
/* We don't support creation of MYSQL_TYPE_DATE anymore */ /* We don't support creation of MYSQL_TYPE_DATE anymore */
sql_type= MYSQL_TYPE_NEWDATE; sql_type= MYSQL_TYPE_NEWDATE;
/* fall trough */ /* fall through */
case MYSQL_TYPE_NEWDATE: case MYSQL_TYPE_NEWDATE:
length= MAX_DATE_WIDTH; length= MAX_DATE_WIDTH;
break; break;
......
/* /*
Copyright (c) 2005, 2013, Oracle and/or its affiliates. Copyright (c) 2005, 2017, Oracle and/or its affiliates.
Copyright (c) 2009, 2017, MariaDB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -7331,6 +7332,7 @@ void ha_partition::print_error(int error, myf errflag) ...@@ -7331,6 +7332,7 @@ void ha_partition::print_error(int error, myf errflag)
m_err_rec= NULL; m_err_rec= NULL;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
/* fall through */
default: default:
{ {
if (!(thd->lex->alter_info.flags & ALTER_TRUNCATE_PARTITION)) if (!(thd->lex->alter_info.flags & ALTER_TRUNCATE_PARTITION))
......
...@@ -6004,7 +6004,7 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table, bool fixed_length) ...@@ -6004,7 +6004,7 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table, bool fixed_length)
collation.collation); collation.collation);
break; break;
} }
/* Fall through to make_string_field() */ /* fall through */
case MYSQL_TYPE_ENUM: case MYSQL_TYPE_ENUM:
case MYSQL_TYPE_SET: case MYSQL_TYPE_SET:
case MYSQL_TYPE_VAR_STRING: case MYSQL_TYPE_VAR_STRING:
...@@ -6726,6 +6726,7 @@ bool Item::cache_const_expr_analyzer(uchar **arg) ...@@ -6726,6 +6726,7 @@ bool Item::cache_const_expr_analyzer(uchar **arg)
*/ */
if (const_item() && if (const_item() &&
!(basic_const_item() || item->basic_const_item() || !(basic_const_item() || item->basic_const_item() ||
item->type() == Item::NULL_ITEM || /* Item_name_const hack */
item->type() == Item::FIELD_ITEM || item->type() == Item::FIELD_ITEM ||
item->type() == SUBSELECT_ITEM || item->type() == SUBSELECT_ITEM ||
/* /*
...@@ -6876,7 +6877,11 @@ class Dependency_marker: public Field_enumerator ...@@ -6876,7 +6877,11 @@ class Dependency_marker: public Field_enumerator
// Find which select the field is in. This is achieved by walking up // Find which select the field is in. This is achieved by walking up
// the select tree and looking for the table of interest. // the select tree and looking for the table of interest.
st_select_lex *sel; st_select_lex *sel;
for (sel= current_select; sel; sel= sel->outer_select()) for (sel= current_select;
sel ;
sel= (sel->context.outer_context ?
sel->context.outer_context->select_lex:
NULL))
{ {
List_iterator<TABLE_LIST> li(sel->leaf_tables); List_iterator<TABLE_LIST> li(sel->leaf_tables);
TABLE_LIST *tbl; TABLE_LIST *tbl;
...@@ -8071,7 +8076,6 @@ bool Item_direct_view_ref::send(Protocol *protocol, String *buffer) ...@@ -8071,7 +8076,6 @@ bool Item_direct_view_ref::send(Protocol *protocol, String *buffer)
bool Item_direct_view_ref::fix_fields(THD *thd, Item **reference) bool Item_direct_view_ref::fix_fields(THD *thd, Item **reference)
{ {
DBUG_ASSERT(1);
/* view fild reference must be defined */ /* view fild reference must be defined */
DBUG_ASSERT(*ref); DBUG_ASSERT(*ref);
/* (*ref)->check_cols() will be made in Item_direct_ref::fix_fields */ /* (*ref)->check_cols() will be made in Item_direct_ref::fix_fields */
...@@ -9955,7 +9959,7 @@ void Item_direct_view_ref::update_used_tables() ...@@ -9955,7 +9959,7 @@ void Item_direct_view_ref::update_used_tables()
table_map Item_direct_view_ref::used_tables() const table_map Item_direct_view_ref::used_tables() const
{ {
DBUG_ASSERT(null_ref_table); DBUG_ASSERT(fixed);
if (get_depended_from()) if (get_depended_from())
return OUTER_REF_TABLE_BIT; return OUTER_REF_TABLE_BIT;
......
#ifndef SQL_ITEM_INCLUDED #ifndef SQL_ITEM_INCLUDED
#define SQL_ITEM_INCLUDED #define SQL_ITEM_INCLUDED
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. /* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2009, 2016, MariaDB Copyright (c) 2009, 2017, MariaDB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
......
...@@ -863,6 +863,7 @@ void Item_func_num1::fix_length_and_dec() ...@@ -863,6 +863,7 @@ void Item_func_num1::fix_length_and_dec()
break; break;
case TIME_RESULT: case TIME_RESULT:
cached_result_type= DECIMAL_RESULT; cached_result_type= DECIMAL_RESULT;
/* fall through */
case DECIMAL_RESULT: case DECIMAL_RESULT:
decimals= args[0]->decimal_scale(); // Do not preserve NOT_FIXED_DEC decimals= args[0]->decimal_scale(); // Do not preserve NOT_FIXED_DEC
max_length= args[0]->max_length; max_length= args[0]->max_length;
...@@ -2038,6 +2039,7 @@ my_decimal *Item_func_mod::decimal_op(my_decimal *decimal_value) ...@@ -2038,6 +2039,7 @@ my_decimal *Item_func_mod::decimal_op(my_decimal *decimal_value)
return decimal_value; return decimal_value;
case E_DEC_DIV_ZERO: case E_DEC_DIV_ZERO:
signal_divide_by_null(); signal_divide_by_null();
/* fall through */
default: default:
null_value= 1; null_value= 1;
return 0; return 0;
......
...@@ -44,7 +44,14 @@ Item_row::Item_row(List<Item> &arg): ...@@ -44,7 +44,14 @@ Item_row::Item_row(List<Item> &arg):
//TODO: think placing 2-3 component items in item (as it done for function) //TODO: think placing 2-3 component items in item (as it done for function)
if ((arg_count= arg.elements)) if ((arg_count= arg.elements))
{
items= (Item**) sql_alloc(sizeof(Item*)*arg_count); items= (Item**) sql_alloc(sizeof(Item*)*arg_count);
if (!items)
{
arg_count= 0;
return;
}
}
else else
items= 0; items= 0;
List_iterator<Item> li(arg); List_iterator<Item> li(arg);
...@@ -57,6 +64,27 @@ Item_row::Item_row(List<Item> &arg): ...@@ -57,6 +64,27 @@ Item_row::Item_row(List<Item> &arg):
} }
} }
Item_row::Item_row(Item *item):
Item(),
used_tables_cache(0),
not_null_tables_cache(0),
arg_count(item->cols()),
const_item_cache(1),
with_null(0)
{
items= (Item**) sql_alloc(sizeof(Item*) * arg_count);
if (!items)
{
arg_count= 0;
return;
}
for (uint i= 0; i < arg_count; i++)
{
items[i]= item->element_index(i);
}
}
void Item_row::illegal_method_call(const char *method) void Item_row::illegal_method_call(const char *method)
{ {
DBUG_ENTER("Item_row::illegal_method_call"); DBUG_ENTER("Item_row::illegal_method_call");
......
...@@ -35,6 +35,7 @@ class Item_row: public Item ...@@ -35,6 +35,7 @@ class Item_row: public Item
const_item_cache(item->const_item_cache), const_item_cache(item->const_item_cache),
with_null(0) with_null(0)
{} {}
Item_row(Item *item);
enum Type type() const { return ROW_ITEM; }; enum Type type() const { return ROW_ITEM; };
void illegal_method_call(const char *); void illegal_method_call(const char *);
......
...@@ -4430,7 +4430,7 @@ bool Item_dyncol_get::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date) ...@@ -4430,7 +4430,7 @@ bool Item_dyncol_get::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
goto null; goto null;
case DYN_COL_INT: case DYN_COL_INT:
signed_value= 1; // For error message signed_value= 1; // For error message
/* fall_trough */ /* fall through */
case DYN_COL_UINT: case DYN_COL_UINT:
if (signed_value || val.x.ulong_value <= LONGLONG_MAX) if (signed_value || val.x.ulong_value <= LONGLONG_MAX)
{ {
...@@ -4443,7 +4443,7 @@ bool Item_dyncol_get::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date) ...@@ -4443,7 +4443,7 @@ bool Item_dyncol_get::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
} }
/* let double_to_datetime_with_warn() issue the warning message */ /* let double_to_datetime_with_warn() issue the warning message */
val.x.double_value= static_cast<double>(ULONGLONG_MAX); val.x.double_value= static_cast<double>(ULONGLONG_MAX);
/* fall_trough */ /* fall through */
case DYN_COL_DOUBLE: case DYN_COL_DOUBLE:
if (double_to_datetime_with_warn(val.x.double_value, ltime, fuzzy_date, if (double_to_datetime_with_warn(val.x.double_value, ltime, fuzzy_date,
0 /* TODO */)) 0 /* TODO */))
......
...@@ -1374,6 +1374,9 @@ Item_in_subselect::Item_in_subselect(Item * left_exp, ...@@ -1374,6 +1374,9 @@ Item_in_subselect::Item_in_subselect(Item * left_exp,
{ {
DBUG_ENTER("Item_in_subselect::Item_in_subselect"); DBUG_ENTER("Item_in_subselect::Item_in_subselect");
left_expr_orig= left_expr= left_exp; left_expr_orig= left_expr= left_exp;
/* prepare to possible disassembling the item in convert_subq_to_sj() */
if (left_exp->type() == Item::ROW_ITEM)
left_expr_orig= new Item_row(left_exp);
func= &eq_creator; func= &eq_creator;
init(select_lex, new select_exists_subselect(this)); init(select_lex, new select_exists_subselect(this));
max_columns= UINT_MAX; max_columns= UINT_MAX;
...@@ -1398,6 +1401,9 @@ Item_allany_subselect::Item_allany_subselect(Item * left_exp, ...@@ -1398,6 +1401,9 @@ Item_allany_subselect::Item_allany_subselect(Item * left_exp,
{ {
DBUG_ENTER("Item_allany_subselect::Item_allany_subselect"); DBUG_ENTER("Item_allany_subselect::Item_allany_subselect");
left_expr_orig= left_expr= left_exp; left_expr_orig= left_expr= left_exp;
/* prepare to possible disassembling the item in convert_subq_to_sj() */
if (left_exp->type() == Item::ROW_ITEM)
left_expr_orig= new Item_row(left_exp);
func= func_creator(all_arg); func= func_creator(all_arg);
init(select_lex, new select_exists_subselect(this)); init(select_lex, new select_exists_subselect(this));
max_columns= 1; max_columns= 1;
......
...@@ -1733,9 +1733,18 @@ bool Item_func_sec_to_time::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date) ...@@ -1733,9 +1733,18 @@ bool Item_func_sec_to_time::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
ltime->hour= TIME_MAX_HOUR+1; ltime->hour= TIME_MAX_HOUR+1;
check_time_range(ltime, decimals, &unused); check_time_range(ltime, decimals, &unused);
if (!err)
{
ErrConvInteger err2(sec, unsigned_flag);
make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
&err2, MYSQL_TIMESTAMP_TIME, NullS);
}
else
{
ErrConvString err2(err);
make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
err->ptr(), err->length(), &err2, MYSQL_TIMESTAMP_TIME, NullS);
MYSQL_TIMESTAMP_TIME, NullS); }
return 0; return 0;
} }
......
...@@ -500,8 +500,16 @@ class Item_temporal_func: public Item_func ...@@ -500,8 +500,16 @@ class Item_temporal_func: public Item_func
{ return val_decimal_from_date(decimal_value); } { return val_decimal_from_date(decimal_value); }
Field *tmp_table_field(TABLE *table) Field *tmp_table_field(TABLE *table)
{ return tmp_table_field_from_field_type(table, 0); } { return tmp_table_field_from_field_type(table, 0); }
#if MARIADB_VERSION_ID > 100300
#error This code should be removed in 10.3, to use the derived save_in_field()
#else
int save_in_field(Field *field, bool no_conversions) int save_in_field(Field *field, bool no_conversions)
{ return save_date_in_field(field); } {
return field_type() == MYSQL_TYPE_TIME ?
save_time_in_field(field) :
save_date_in_field(field);
}
#endif
void fix_length_and_dec(); void fix_length_and_dec();
}; };
......
...@@ -7261,8 +7261,10 @@ void TC_LOG_MMAP::close() ...@@ -7261,8 +7261,10 @@ void TC_LOG_MMAP::close()
mysql_cond_destroy(&COND_pool); mysql_cond_destroy(&COND_pool);
mysql_cond_destroy(&COND_active); mysql_cond_destroy(&COND_active);
mysql_cond_destroy(&COND_queue_busy); mysql_cond_destroy(&COND_queue_busy);
/* fall through */
case 5: case 5:
data[0]='A'; // garble the first (signature) byte, in case mysql_file_delete fails data[0]='A'; // garble the first (signature) byte, in case mysql_file_delete fails
/* fall through */
case 4: case 4:
for (i=0; i < npages; i++) for (i=0; i < npages; i++)
{ {
...@@ -7271,10 +7273,13 @@ void TC_LOG_MMAP::close() ...@@ -7271,10 +7273,13 @@ void TC_LOG_MMAP::close()
mysql_mutex_destroy(&pages[i].lock); mysql_mutex_destroy(&pages[i].lock);
mysql_cond_destroy(&pages[i].cond); mysql_cond_destroy(&pages[i].cond);
} }
/* fall through */
case 3: case 3:
my_free(pages); my_free(pages);
/* fall through */
case 2: case 2:
my_munmap((char*)data, (size_t)file_length); my_munmap((char*)data, (size_t)file_length);
/* fall through */
case 1: case 1:
mysql_file_close(fd, MYF(0)); mysql_file_close(fd, MYF(0));
} }
......
...@@ -6437,21 +6437,6 @@ User_var_log_event(const char* buf, uint event_len, ...@@ -6437,21 +6437,6 @@ User_var_log_event(const char* buf, uint event_len,
we keep the flags set to UNDEF_F. we keep the flags set to UNDEF_F.
*/ */
uint bytes_read= ((val + val_len) - start); uint bytes_read= ((val + val_len) - start);
#ifndef DBUG_OFF
bool old_pre_checksum_fd= description_event->is_version_before_checksum(
&description_event->server_version_split);
#endif
DBUG_ASSERT((bytes_read == data_written -
(old_pre_checksum_fd ||
(description_event->checksum_alg ==
BINLOG_CHECKSUM_ALG_OFF)) ?
0 : BINLOG_CHECKSUM_LEN)
||
(bytes_read == data_written -1 -
(old_pre_checksum_fd ||
(description_event->checksum_alg ==
BINLOG_CHECKSUM_ALG_OFF)) ?
0 : BINLOG_CHECKSUM_LEN));
if ((data_written - bytes_read) > 0) if ((data_written - bytes_read) > 0)
{ {
flags= (uint) *(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE + flags= (uint) *(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE +
......
...@@ -1609,6 +1609,7 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred) ...@@ -1609,6 +1609,7 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
sj-nest. sj-nest.
*/ */
st_select_lex *subq_lex= subq_pred->unit->first_select(); st_select_lex *subq_lex= subq_pred->unit->first_select();
DBUG_ASSERT(subq_lex->next_select() == NULL);
nested_join->join_list.empty(); nested_join->join_list.empty();
List_iterator_fast<TABLE_LIST> li(subq_lex->top_join_list); List_iterator_fast<TABLE_LIST> li(subq_lex->top_join_list);
TABLE_LIST *tl; TABLE_LIST *tl;
...@@ -1706,7 +1707,8 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred) ...@@ -1706,7 +1707,8 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
if (subq_pred->left_expr->cols() == 1) if (subq_pred->left_expr->cols() == 1)
{ {
nested_join->sj_outer_expr_list.push_back(subq_pred->left_expr); /* add left = select_list_element */
nested_join->sj_outer_expr_list.push_back(&subq_pred->left_expr);
/* /*
Create Item_func_eq. Note that Create Item_func_eq. Note that
1. this is done on the statement, not execution, arena 1. this is done on the statement, not execution, arena
...@@ -1718,24 +1720,61 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred) ...@@ -1718,24 +1720,61 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
*/ */
Item_func_eq *item_eq= Item_func_eq *item_eq=
new Item_func_eq(subq_pred->left_expr_orig, subq_lex->ref_pointer_array[0]); new Item_func_eq(subq_pred->left_expr_orig, subq_lex->ref_pointer_array[0]);
if (!item_eq)
DBUG_RETURN(TRUE);
if (subq_pred->left_expr_orig != subq_pred->left_expr) if (subq_pred->left_expr_orig != subq_pred->left_expr)
thd->change_item_tree(item_eq->arguments(), subq_pred->left_expr); thd->change_item_tree(item_eq->arguments(), subq_pred->left_expr);
item_eq->in_equality_no= 0; item_eq->in_equality_no= 0;
sj_nest->sj_on_expr= and_items(sj_nest->sj_on_expr, item_eq); sj_nest->sj_on_expr= and_items(sj_nest->sj_on_expr, item_eq);
} }
else else if (subq_pred->left_expr->type() == Item::ROW_ITEM)
{ {
/*
disassemple left expression and add
left1 = select_list_element1 and left2 = select_list_element2 ...
*/
for (uint i= 0; i < subq_pred->left_expr->cols(); i++) for (uint i= 0; i < subq_pred->left_expr->cols(); i++)
{ {
nested_join->sj_outer_expr_list.push_back(subq_pred->left_expr-> nested_join->sj_outer_expr_list.push_back(subq_pred->left_expr->
element_index(i)); addr(i));
Item_func_eq *item_eq= Item_func_eq *item_eq=
new Item_func_eq(subq_pred->left_expr->element_index(i), new Item_func_eq(subq_pred->left_expr_orig->element_index(i),
subq_lex->ref_pointer_array[i]); subq_lex->ref_pointer_array[i]);
if (!item_eq)
DBUG_RETURN(TRUE);
DBUG_ASSERT(subq_pred->left_expr->element_index(i)->fixed);
if (subq_pred->left_expr_orig->element_index(i) !=
subq_pred->left_expr->element_index(i))
thd->change_item_tree(item_eq->arguments(),
subq_pred->left_expr->element_index(i));
item_eq->in_equality_no= i; item_eq->in_equality_no= i;
sj_nest->sj_on_expr= and_items(sj_nest->sj_on_expr, item_eq); sj_nest->sj_on_expr= and_items(sj_nest->sj_on_expr, item_eq);
} }
} }
else
{
/*
add row operation
left = (select_list_element1, select_list_element2, ...)
*/
Item_row *row= new Item_row(subq_lex->pre_fix);
/* fix fields on subquery was call so they should be the same */
DBUG_ASSERT(subq_pred->left_expr->cols() == row->cols());
if (!row)
DBUG_RETURN(TRUE);
nested_join->sj_outer_expr_list.push_back(&subq_pred->left_expr);
Item_func_eq *item_eq=
new Item_func_eq(subq_pred->left_expr_orig, row);
if (!item_eq)
DBUG_RETURN(TRUE);
for (uint i= 0; i < row->cols(); i++)
{
if (row->element_index(i) != subq_lex->ref_pointer_array[i])
thd->change_item_tree(row->addr(i), subq_lex->ref_pointer_array[i]);
}
item_eq->in_equality_no= 0;
sj_nest->sj_on_expr= and_items(sj_nest->sj_on_expr, item_eq);
}
/* /*
Fix the created equality and AND Fix the created equality and AND
...@@ -3285,8 +3324,8 @@ void restore_prev_sj_state(const table_map remaining_tables, ...@@ -3285,8 +3324,8 @@ void restore_prev_sj_state(const table_map remaining_tables,
ulonglong get_bound_sj_equalities(TABLE_LIST *sj_nest, ulonglong get_bound_sj_equalities(TABLE_LIST *sj_nest,
table_map remaining_tables) table_map remaining_tables)
{ {
List_iterator<Item> li(sj_nest->nested_join->sj_outer_expr_list); List_iterator<Item_ptr> li(sj_nest->nested_join->sj_outer_expr_list);
Item *item; Item **item;
uint i= 0; uint i= 0;
ulonglong res= 0; ulonglong res= 0;
while ((item= li++)) while ((item= li++))
...@@ -3297,7 +3336,7 @@ ulonglong get_bound_sj_equalities(TABLE_LIST *sj_nest, ...@@ -3297,7 +3336,7 @@ ulonglong get_bound_sj_equalities(TABLE_LIST *sj_nest,
class and see if there is an element that is bound? class and see if there is an element that is bound?
(this is an optional feature) (this is an optional feature)
*/ */
if (!(item->used_tables() & remaining_tables)) if (!(item[0]->used_tables() & remaining_tables))
{ {
res |= 1ULL << i; res |= 1ULL << i;
} }
......
...@@ -1047,6 +1047,7 @@ static int maxmin_in_range(bool max_fl, Field* field, COND *cond) ...@@ -1047,6 +1047,7 @@ static int maxmin_in_range(bool max_fl, Field* field, COND *cond)
case Item_func::LT_FUNC: case Item_func::LT_FUNC:
case Item_func::LE_FUNC: case Item_func::LE_FUNC:
less_fl= 1; less_fl= 1;
/* fall through */
case Item_func::GT_FUNC: case Item_func::GT_FUNC:
case Item_func::GE_FUNC: case Item_func::GE_FUNC:
{ {
......
...@@ -34,8 +34,6 @@ ...@@ -34,8 +34,6 @@
partition_info *partition_info::get_clone() partition_info *partition_info::get_clone()
{ {
if (!this)
return 0;
List_iterator<partition_element> part_it(partitions); List_iterator<partition_element> part_it(partitions);
partition_element *part; partition_element *part;
partition_info *clone= new partition_info(); partition_info *clone= new partition_info();
......
...@@ -2341,7 +2341,6 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type) ...@@ -2341,7 +2341,6 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
thd->enable_slow_log= opt_log_slow_slave_statements; thd->enable_slow_log= opt_log_slow_slave_statements;
thd->variables.log_slow_filter= global_system_variables.log_slow_filter; thd->variables.log_slow_filter= global_system_variables.log_slow_filter;
set_slave_thread_options(thd); set_slave_thread_options(thd);
thd->client_capabilities = CLIENT_LOCAL_FILES;
mysql_mutex_lock(&LOCK_thread_count); mysql_mutex_lock(&LOCK_thread_count);
thd->thread_id= thd->variables.pseudo_thread_id= thread_id++; thd->thread_id= thd->variables.pseudo_thread_id= thread_id++;
mysql_mutex_unlock(&LOCK_thread_count); mysql_mutex_unlock(&LOCK_thread_count);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment