1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

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)
This commit is contained in:
Sergei Golubchik
2022-01-02 12:26:38 +01:00
parent ddbb3d1447
commit aea076dc21
3 changed files with 33 additions and 1 deletions

View File

@ -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
#

View File

@ -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 #

View File

@ -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;