Commit aea076dc authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-27393 Timezone tables cannot have descending indexes

replace the assert with an if().

asserts should not be used on the input (even without DESC indexes
the table could've been corrupted)
parent ddbb3d14
......@@ -62,3 +62,16 @@ NULL NULL NULL
#
# End of 4.1 tests
#
#
# MDEV-27393 Timezone tables cannot have descending indexes
#
call mtr.add_suppression('mysql.time_zone_transition_type table is incorrectly defined or corrupted');
alter table mysql.time_zone_transition_type drop primary key;
alter table mysql.time_zone_transition_type add primary key (time_zone_id,transition_type_id desc);
SET @@time_zone='Japan';
ERROR HY000: Unknown or incorrect time zone: 'Japan'
alter table mysql.time_zone_transition_type drop primary key;
alter table mysql.time_zone_transition_type add primary key (time_zone_id,transition_type_id);
#
# End of 10.8 tests
#
......@@ -59,3 +59,18 @@ select unix_timestamp('1969-12-31 23:59:59'), unix_timestamp('1970-01-01 00:00:0
--echo #
--echo # End of 4.1 tests
--echo #
--echo #
--echo # MDEV-27393 Timezone tables cannot have descending indexes
--echo #
call mtr.add_suppression('mysql.time_zone_transition_type table is incorrectly defined or corrupted');
alter table mysql.time_zone_transition_type drop primary key;
alter table mysql.time_zone_transition_type add primary key (time_zone_id,transition_type_id desc);
--error ER_UNKNOWN_TIME_ZONE
SET @@time_zone='Japan';
alter table mysql.time_zone_transition_type drop primary key;
alter table mysql.time_zone_transition_type add primary key (time_zone_id,transition_type_id);
--echo #
--echo # End of 10.8 tests
--echo #
......@@ -2004,7 +2004,11 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
#endif
/* ttid is increasing because we are reading using index */
DBUG_ASSERT(ttid >= tmp_tz_info.typecnt);
if (ttid < tmp_tz_info.typecnt)
{
sql_print_error("mysql.time_zone_transition_type table is incorrectly defined or corrupted");
goto end;
}
tmp_tz_info.typecnt= ttid + 1;
......
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