• Aleksey Midenkov's avatar
    MDEV-28271 Assertion on TRUNCATE PARTITION for PARTITION BY SYSTEM_TIME · ea2f0997
    Aleksey Midenkov authored
    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.
    ea2f0997
partition.test 28.2 KB