Commit 88349678 authored by Marko Mäkelä's avatar Marko Mäkelä

Merge bb-10.2-ext into 10.3

parents eda14259 560b9895
......@@ -634,3 +634,10 @@ create temporary table s (i int);
drop temporary sequence s;
ERROR 42S02: Unknown SEQUENCE: 'test.s'
drop table s;
#
# MDEV-15115 Assertion failure in CREATE SEQUENCE...ROW_FORMAT=REDUNDANT
#
CREATE SEQUENCE seq1 ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
DROP SEQUENCE seq1;
CREATE TEMPORARY SEQUENCE seq1 ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
DROP TEMPORARY SEQUENCE seq1;
......@@ -450,3 +450,11 @@ create temporary table s (i int);
--error ER_UNKNOWN_SEQUENCES
drop temporary sequence s;
drop table s;
--echo #
--echo # MDEV-15115 Assertion failure in CREATE SEQUENCE...ROW_FORMAT=REDUNDANT
--echo #
CREATE SEQUENCE seq1 ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
DROP SEQUENCE seq1;
CREATE TEMPORARY SEQUENCE seq1 ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
DROP TEMPORARY SEQUENCE seq1;
......@@ -47,7 +47,7 @@ longlong TIME_to_longlong_time_packed(const MYSQL_TIME *ltime)
{
DBUG_ASSERT(ltime->year == 0);
DBUG_ASSERT(ltime->month == 0);
// Mix days with hours: "1 00:10:10" -> "24:00:10"
// Mix days with hours: "1 00:10:10" -> "24:10:10"
long hms= ((ltime->day * 24 + ltime->hour) << 12) |
(ltime->minute << 6) | ltime->second;
longlong tmp= MY_PACKED_TIME_MAKE(hms, ltime->second_part);
......
......@@ -5545,11 +5545,9 @@ void Field_temporal::set_warnings(Sql_condition::enum_warning_level trunc_level,
a DATE field and non-zero time part is thrown away.
*/
if (was_cut & MYSQL_TIME_WARN_TRUNCATED)
set_datetime_warning(trunc_level, WARN_DATA_TRUNCATED,
str, mysql_type_to_time_type(type()), 1);
set_datetime_warning(trunc_level, WARN_DATA_TRUNCATED, str, ts_type, 1);
if (was_cut & MYSQL_TIME_WARN_OUT_OF_RANGE)
set_datetime_warning(ER_WARN_DATA_OUT_OF_RANGE,
str, mysql_type_to_time_type(type()), 1);
set_datetime_warning(ER_WARN_DATA_OUT_OF_RANGE, str, ts_type, 1);
}
......@@ -5585,14 +5583,15 @@ int Field_temporal_with_date::store_TIME_with_warning(MYSQL_TIME *ltime,
}
else if (!MYSQL_TIME_WARN_HAVE_WARNINGS(was_cut) &&
(MYSQL_TIME_WARN_HAVE_NOTES(was_cut) ||
(mysql_type_to_time_type(type()) == MYSQL_TIMESTAMP_DATE &&
(type_handler()->mysql_timestamp_type() == MYSQL_TIMESTAMP_DATE &&
(ltime->hour || ltime->minute || ltime->second || ltime->second_part))))
{
trunc_level= Sql_condition::WARN_LEVEL_NOTE;
was_cut|= MYSQL_TIME_WARN_TRUNCATED;
ret= 3;
}
set_warnings(trunc_level, str, was_cut, mysql_type_to_time_type(type()));
set_warnings(trunc_level, str, was_cut,
type_handler()->mysql_timestamp_type());
store_TIME(ltime);
return was_cut ? ret : 0;
}
......@@ -5682,7 +5681,7 @@ my_decimal *Field_temporal::val_decimal(my_decimal *d)
if (get_date(&ltime, 0))
{
bzero(&ltime, sizeof(ltime));
ltime.time_type= mysql_type_to_time_type(type());
ltime.time_type= type_handler()->mysql_timestamp_type();
}
return TIME_to_my_decimal(&ltime, d);
}
......
......@@ -490,37 +490,6 @@ inline enum_field_types real_type_to_type(enum_field_types real_type)
}
static inline enum enum_mysql_timestamp_type
mysql_type_to_time_type(enum enum_field_types mysql_type)
{
switch(mysql_type) {
case MYSQL_TYPE_TIME2:
case MYSQL_TYPE_TIME: return MYSQL_TIMESTAMP_TIME;
case MYSQL_TYPE_TIMESTAMP2:
case MYSQL_TYPE_TIMESTAMP:
case MYSQL_TYPE_DATETIME2:
case MYSQL_TYPE_DATETIME: return MYSQL_TIMESTAMP_DATETIME;
case MYSQL_TYPE_NEWDATE:
case MYSQL_TYPE_DATE: return MYSQL_TIMESTAMP_DATE;
default: return MYSQL_TIMESTAMP_ERROR;
}
}
/**
Tests if field type is temporal, i.e. represents
DATE, TIME, DATETIME or TIMESTAMP types in SQL.
@param type Field type, as returned by field->type().
@retval true If field type is temporal
@retval false If field type is not temporal
*/
inline bool is_temporal_type(enum_field_types type)
{
return mysql_type_to_time_type(type) != MYSQL_TIMESTAMP_ERROR;
}
enum enum_vcol_info_type
{
VCOL_GENERATED_VIRTUAL, VCOL_GENERATED_STORED,
......
......@@ -357,19 +357,19 @@ static bool number_to_time_with_warn(bool neg, ulonglong nr, ulong sec_part,
{
int was_cut;
longlong res;
enum_field_types f_type;
enum_mysql_timestamp_type ts_type;
bool have_warnings;
if (fuzzydate & TIME_TIME_ONLY)
{
fuzzydate= TIME_TIME_ONLY; // clear other flags
f_type= MYSQL_TYPE_TIME;
ts_type= MYSQL_TIMESTAMP_TIME;
res= number_to_time(neg, nr, sec_part, ltime, &was_cut);
have_warnings= MYSQL_TIME_WARN_HAVE_WARNINGS(was_cut);
}
else
{
f_type= MYSQL_TYPE_DATETIME;
ts_type= MYSQL_TIMESTAMP_DATETIME;
if (neg)
{
res= -1;
......@@ -385,8 +385,7 @@ static bool number_to_time_with_warn(bool neg, ulonglong nr, ulong sec_part,
{
make_truncated_value_warning(current_thd,
Sql_condition::WARN_LEVEL_WARN, str,
res < 0 ? MYSQL_TIMESTAMP_ERROR
: mysql_type_to_time_type(f_type),
res < 0 ? MYSQL_TIMESTAMP_ERROR : ts_type,
field_name);
}
return res < 0;
......
......@@ -657,7 +657,7 @@ dict_tf_is_valid(
bit. For ROW_FORMAT=REDUNDANT, only the DATA_DIR flag
(which we cleared above) can be set. If any other flags
are set, the flags are invalid. */
return(flags == 0);
return(flags == 0 || flags == DICT_TF_MASK_NO_ROLLBACK);
}
return(dict_tf_is_valid_not_redundant(flags));
......
Markdown is supported
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