diff options
author | Alexander Barkov <bar@mariadb.com> | 2022-10-25 11:53:39 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2022-10-25 17:34:25 +0400 |
commit | f1bbc1cd19d0d81fee5433efcb570a8845172241 (patch) | |
tree | 2e5a6b7808116456b4baea44ae15f69bbe1e24e8 /sql/sql_insert.cc | |
parent | 8c5d323326d9d527e9a5e08c69eb6085953eb130 (diff) | |
download | mariadb-git-f1bbc1cd19d0d81fee5433efcb570a8845172241.tar.gz |
MDEV-28545 MyISAM reorganize partition corrupt older table format
The ALTER related code cannot do at the same time both:
- modify partitions
- change column data types
Explicit changing of a column data type together with a partition change is
prohibited by the parter, so this is not allowed and returns a syntax error:
ALTER TABLE t MODIFY ts BIGINT, DROP PARTITION p1;
This fix additionally disables implicit data type upgrade
(e.g. from "MariaDB 5.3 TIME" to "MySQL 5.6 TIME", or the other way
around according to the current mysql56_temporal_format) in case of
an ALTER modifying partitions, e.g.:
ALTER TABLE t DROP PARTITION p1;
In such commands now only the partition change happens, while
the data types stay unchanged.
One can additionally run:
ALTER TABLE t FORCE;
either before or after the ALTER modifying partitions to
upgrade data types according to mysql56_temporal_format.
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r-- | sql/sql_insert.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index aeb39871025..76fd6385041 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -4346,6 +4346,16 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items, alter_info->create_list.push_back(cr_field, thd->mem_root); } + /* + Item*::type_handler() always returns pointers to + type_handler_{time2|datetime2|timestamp2} no matter what + the current mysql56_temporal_format says. + Let's convert them according to mysql56_temporal_format. + QQ: This perhaps should eventually be fixed to have Item*::type_handler() + respect mysql56_temporal_format, and remove the upgrade from here. + */ + Create_field::upgrade_data_types(alter_info->create_list); + if (create_info->check_fields(thd, alter_info, create_table->table_name, create_table->db, |