Skip to content

Commit 8834967

Browse files
committed
Merge bb-10.2-ext into 10.3
2 parents eda1425 + 560b989 commit 8834967

File tree

7 files changed

+27
-45
lines changed

7 files changed

+27
-45
lines changed

mysql-test/suite/sql_sequence/create.result

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,3 +634,10 @@ create temporary table s (i int);
634634
drop temporary sequence s;
635635
ERROR 42S02: Unknown SEQUENCE: 'test.s'
636636
drop table s;
637+
#
638+
# MDEV-15115 Assertion failure in CREATE SEQUENCE...ROW_FORMAT=REDUNDANT
639+
#
640+
CREATE SEQUENCE seq1 ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
641+
DROP SEQUENCE seq1;
642+
CREATE TEMPORARY SEQUENCE seq1 ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
643+
DROP TEMPORARY SEQUENCE seq1;

mysql-test/suite/sql_sequence/create.test

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,3 +450,11 @@ create temporary table s (i int);
450450
--error ER_UNKNOWN_SEQUENCES
451451
drop temporary sequence s;
452452
drop table s;
453+
454+
--echo #
455+
--echo # MDEV-15115 Assertion failure in CREATE SEQUENCE...ROW_FORMAT=REDUNDANT
456+
--echo #
457+
CREATE SEQUENCE seq1 ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
458+
DROP SEQUENCE seq1;
459+
CREATE TEMPORARY SEQUENCE seq1 ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
460+
DROP TEMPORARY SEQUENCE seq1;

sql/compat56.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ longlong TIME_to_longlong_time_packed(const MYSQL_TIME *ltime)
4747
{
4848
DBUG_ASSERT(ltime->year == 0);
4949
DBUG_ASSERT(ltime->month == 0);
50-
// Mix days with hours: "1 00:10:10" -> "24:00:10"
50+
// Mix days with hours: "1 00:10:10" -> "24:10:10"
5151
long hms= ((ltime->day * 24 + ltime->hour) << 12) |
5252
(ltime->minute << 6) | ltime->second;
5353
longlong tmp= MY_PACKED_TIME_MAKE(hms, ltime->second_part);

sql/field.cc

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5545,11 +5545,9 @@ void Field_temporal::set_warnings(Sql_condition::enum_warning_level trunc_level,
55455545
a DATE field and non-zero time part is thrown away.
55465546
*/
55475547
if (was_cut & MYSQL_TIME_WARN_TRUNCATED)
5548-
set_datetime_warning(trunc_level, WARN_DATA_TRUNCATED,
5549-
str, mysql_type_to_time_type(type()), 1);
5548+
set_datetime_warning(trunc_level, WARN_DATA_TRUNCATED, str, ts_type, 1);
55505549
if (was_cut & MYSQL_TIME_WARN_OUT_OF_RANGE)
5551-
set_datetime_warning(ER_WARN_DATA_OUT_OF_RANGE,
5552-
str, mysql_type_to_time_type(type()), 1);
5550+
set_datetime_warning(ER_WARN_DATA_OUT_OF_RANGE, str, ts_type, 1);
55535551
}
55545552

55555553

@@ -5585,14 +5583,15 @@ int Field_temporal_with_date::store_TIME_with_warning(MYSQL_TIME *ltime,
55855583
}
55865584
else if (!MYSQL_TIME_WARN_HAVE_WARNINGS(was_cut) &&
55875585
(MYSQL_TIME_WARN_HAVE_NOTES(was_cut) ||
5588-
(mysql_type_to_time_type(type()) == MYSQL_TIMESTAMP_DATE &&
5586+
(type_handler()->mysql_timestamp_type() == MYSQL_TIMESTAMP_DATE &&
55895587
(ltime->hour || ltime->minute || ltime->second || ltime->second_part))))
55905588
{
55915589
trunc_level= Sql_condition::WARN_LEVEL_NOTE;
55925590
was_cut|= MYSQL_TIME_WARN_TRUNCATED;
55935591
ret= 3;
55945592
}
5595-
set_warnings(trunc_level, str, was_cut, mysql_type_to_time_type(type()));
5593+
set_warnings(trunc_level, str, was_cut,
5594+
type_handler()->mysql_timestamp_type());
55965595
store_TIME(ltime);
55975596
return was_cut ? ret : 0;
55985597
}
@@ -5682,7 +5681,7 @@ my_decimal *Field_temporal::val_decimal(my_decimal *d)
56825681
if (get_date(&ltime, 0))
56835682
{
56845683
bzero(&ltime, sizeof(ltime));
5685-
ltime.time_type= mysql_type_to_time_type(type());
5684+
ltime.time_type= type_handler()->mysql_timestamp_type();
56865685
}
56875686
return TIME_to_my_decimal(&ltime, d);
56885687
}

sql/field.h

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -490,37 +490,6 @@ inline enum_field_types real_type_to_type(enum_field_types real_type)
490490
}
491491

492492

493-
static inline enum enum_mysql_timestamp_type
494-
mysql_type_to_time_type(enum enum_field_types mysql_type)
495-
{
496-
switch(mysql_type) {
497-
case MYSQL_TYPE_TIME2:
498-
case MYSQL_TYPE_TIME: return MYSQL_TIMESTAMP_TIME;
499-
case MYSQL_TYPE_TIMESTAMP2:
500-
case MYSQL_TYPE_TIMESTAMP:
501-
case MYSQL_TYPE_DATETIME2:
502-
case MYSQL_TYPE_DATETIME: return MYSQL_TIMESTAMP_DATETIME;
503-
case MYSQL_TYPE_NEWDATE:
504-
case MYSQL_TYPE_DATE: return MYSQL_TIMESTAMP_DATE;
505-
default: return MYSQL_TIMESTAMP_ERROR;
506-
}
507-
}
508-
509-
510-
/**
511-
Tests if field type is temporal, i.e. represents
512-
DATE, TIME, DATETIME or TIMESTAMP types in SQL.
513-
514-
@param type Field type, as returned by field->type().
515-
@retval true If field type is temporal
516-
@retval false If field type is not temporal
517-
*/
518-
inline bool is_temporal_type(enum_field_types type)
519-
{
520-
return mysql_type_to_time_type(type) != MYSQL_TIMESTAMP_ERROR;
521-
}
522-
523-
524493
enum enum_vcol_info_type
525494
{
526495
VCOL_GENERATED_VIRTUAL, VCOL_GENERATED_STORED,

sql/sql_time.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -357,19 +357,19 @@ static bool number_to_time_with_warn(bool neg, ulonglong nr, ulong sec_part,
357357
{
358358
int was_cut;
359359
longlong res;
360-
enum_field_types f_type;
360+
enum_mysql_timestamp_type ts_type;
361361
bool have_warnings;
362362

363363
if (fuzzydate & TIME_TIME_ONLY)
364364
{
365365
fuzzydate= TIME_TIME_ONLY; // clear other flags
366-
f_type= MYSQL_TYPE_TIME;
366+
ts_type= MYSQL_TIMESTAMP_TIME;
367367
res= number_to_time(neg, nr, sec_part, ltime, &was_cut);
368368
have_warnings= MYSQL_TIME_WARN_HAVE_WARNINGS(was_cut);
369369
}
370370
else
371371
{
372-
f_type= MYSQL_TYPE_DATETIME;
372+
ts_type= MYSQL_TIMESTAMP_DATETIME;
373373
if (neg)
374374
{
375375
res= -1;
@@ -385,8 +385,7 @@ static bool number_to_time_with_warn(bool neg, ulonglong nr, ulong sec_part,
385385
{
386386
make_truncated_value_warning(current_thd,
387387
Sql_condition::WARN_LEVEL_WARN, str,
388-
res < 0 ? MYSQL_TIMESTAMP_ERROR
389-
: mysql_type_to_time_type(f_type),
388+
res < 0 ? MYSQL_TIMESTAMP_ERROR : ts_type,
390389
field_name);
391390
}
392391
return res < 0;

storage/innobase/include/dict0dict.ic

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ dict_tf_is_valid(
657657
bit. For ROW_FORMAT=REDUNDANT, only the DATA_DIR flag
658658
(which we cleared above) can be set. If any other flags
659659
are set, the flags are invalid. */
660-
return(flags == 0);
660+
return(flags == 0 || flags == DICT_TF_MASK_NO_ROLLBACK);
661661
}
662662

663663
return(dict_tf_is_valid_not_redundant(flags));

0 commit comments

Comments
 (0)