diff options
author | Aleksey Midenkov <midenok@gmail.com> | 2022-04-24 00:28:54 +0300 |
---|---|---|
committer | Aleksey Midenkov <midenok@gmail.com> | 2022-04-29 13:31:41 +0300 |
commit | ea2f09979fc74a8fa7fb1e74c874e00df757c6db (patch) | |
tree | d6ba349e9977ffe31c7a821b11d272d38f3d15d2 /sql | |
parent | add5137d84a41c3f45f18b149bd90099e7256cb7 (diff) | |
download | mariadb-git-ea2f09979fc74a8fa7fb1e74c874e00df757c6db.tar.gz |
MDEV-28271 Assertion on TRUNCATE PARTITION for PARTITION BY SYSTEM_TIME
Like in MDEV-27217 vers_set_hist_part() for LIMIT depends on all
partitions selected in read_partitions. That bugfix just disabled
partition selection for DELETE with this check:
if (table->pos_in_table_list &&
table->pos_in_table_list->partition_names)
{
return HA_ERR_PARTITION_LIST;
}
ALTER TABLE TRUNCATE PARTITION is a different story. First, it doesn't
update pos_in_table_list->partition_names, but
thd->lex->alter_info.partition_names. But we cannot depend on that
since alter_info will be stale for DML. Second, we should not disable
TRUNCATE PARTITION for that to be consistent with TRUNCATE TABLE
behavior.
Now we don't do vers_set_hist_part() for ALTER TABLE as this command
is not DML, so it does not produce history.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/ha_partition.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index b4bb3e7e61e..b1645a9c4a7 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -4034,6 +4034,7 @@ int ha_partition::external_lock(THD *thd, int lock_type) only for versioned DML. */ thd->lex->sql_command != SQLCOM_SELECT && thd->lex->sql_command != SQLCOM_INSERT_SELECT && + thd->lex->sql_command != SQLCOM_ALTER_TABLE && (error= m_part_info->vers_set_hist_part(thd))) goto err_handler; } |