summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-02-06 17:12:17 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2018-02-06 17:12:17 +0200
commit883496782f37cd53acd10d90527af97aca3fd34f (patch)
tree36c2d3a7cf10df47651a2dc35144afd475beeabe
parenteda142590f385b3d79e7b6a6e0cc13ba8fd25961 (diff)
parent560b9895d413bdfedda0a0ca871a635858990c05 (diff)
downloadmariadb-git-883496782f37cd53acd10d90527af97aca3fd34f.tar.gz
Merge bb-10.2-ext into 10.3
-rw-r--r--mysql-test/suite/sql_sequence/create.result7
-rw-r--r--mysql-test/suite/sql_sequence/create.test8
-rw-r--r--sql/compat56.cc2
-rw-r--r--sql/field.cc13
-rw-r--r--sql/field.h31
-rw-r--r--sql/sql_time.cc9
-rw-r--r--storage/innobase/include/dict0dict.ic2
7 files changed, 27 insertions, 45 deletions
diff --git a/mysql-test/suite/sql_sequence/create.result b/mysql-test/suite/sql_sequence/create.result
index 20d16822575..6af43a3faa4 100644
--- a/mysql-test/suite/sql_sequence/create.result
+++ b/mysql-test/suite/sql_sequence/create.result
@@ -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;
diff --git a/mysql-test/suite/sql_sequence/create.test b/mysql-test/suite/sql_sequence/create.test
index 91411bebfde..65c0641eab9 100644
--- a/mysql-test/suite/sql_sequence/create.test
+++ b/mysql-test/suite/sql_sequence/create.test
@@ -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;
diff --git a/sql/compat56.cc b/sql/compat56.cc
index f2be7da8934..16c25924d6e 100644
--- a/sql/compat56.cc
+++ b/sql/compat56.cc
@@ -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);
diff --git a/sql/field.cc b/sql/field.cc
index d9534021a0d..19bca942082 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -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);
}
diff --git a/sql/field.h b/sql/field.h
index d5d49bed551..cf8b4d05f14 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -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,
diff --git a/sql/sql_time.cc b/sql/sql_time.cc
index 0dfb1c4d88b..751a8926f33 100644
--- a/sql/sql_time.cc
+++ b/sql/sql_time.cc
@@ -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;
diff --git a/storage/innobase/include/dict0dict.ic b/storage/innobase/include/dict0dict.ic
index 26918251d8b..4497d52ab6d 100644
--- a/storage/innobase/include/dict0dict.ic
+++ b/storage/innobase/include/dict0dict.ic
@@ -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));