Skip to content

Commit d4258f3

Browse files
committed
MDEV-22178 Assertion `info->alias.str' failed in partition_info::check_partition_info instead of ER_VERS_WRONG_PARTS
Assign create_info->alias for ALTER TABLE since it is NULL and later accessed for printing error message.
1 parent c742346 commit d4258f3

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

mysql-test/suite/versioning/r/partition.result

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,4 +683,11 @@ create table t1 (a int) with system versioning partition by system_time
683683
alter table t1 add partition (partition p2);
684684
ERROR HY000: Wrong partitioning type, expected type: `SYSTEM_TIME`
685685
drop table t1;
686+
#
687+
# MDEV-22178 Assertion `info->alias.str' failed in partition_info::check_partition_info instead of ER_VERS_WRONG_PARTS
688+
#
689+
create or replace table t1 (a int) with system versioning;
690+
alter table t1 partition by system_time (partition pn current);
691+
ERROR HY000: Wrong partitions for `t1`: must have at least one HISTORY and exactly one last CURRENT
692+
drop table t1;
686693
# End of 10.3 tests

mysql-test/suite/versioning/t/partition.test

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,15 @@ alter table t1 add partition (partition p2);
652652
# Cleanup
653653
drop table t1;
654654

655+
--echo #
656+
--echo # MDEV-22178 Assertion `info->alias.str' failed in partition_info::check_partition_info instead of ER_VERS_WRONG_PARTS
657+
--echo #
658+
create or replace table t1 (a int) with system versioning;
659+
--error ER_VERS_WRONG_PARTS
660+
alter table t1 partition by system_time (partition pn current);
661+
# Cleanup
662+
drop table t1;
663+
655664
--echo # End of 10.3 tests
656665

657666
--source suite/versioning/common_finish.inc

sql/sql_table.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9850,6 +9850,7 @@ do_continue:;
98509850

98519851
tmp_disable_binlog(thd);
98529852
create_info->options|=HA_CREATE_TMP_ALTER;
9853+
create_info->alias= alter_ctx.table_name;
98539854
error= create_table_impl(thd,
98549855
&alter_ctx.db, &alter_ctx.table_name,
98559856
&alter_ctx.new_db, &alter_ctx.tmp_name,

0 commit comments

Comments
 (0)