summaryrefslogtreecommitdiff
path: root/mysql-test/main/partition_alter.test
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2022-10-07 00:45:21 +0300
committerAleksey Midenkov <midenok@gmail.com>2022-10-07 00:46:38 +0300
commitfa0cada95baeb9fad5a2d6dad687bb13c93da9b6 (patch)
treec1de46f46eac097370e86a1ed9169de2cd40d245 /mysql-test/main/partition_alter.test
parent74fe1c44aa118fe6a0a86be0f0d236af25853b27 (diff)
downloadmariadb-git-fa0cada95baeb9fad5a2d6dad687bb13c93da9b6.tar.gz
MDEV-28576 RENAME COLUMN with NOCOPY algorithm leads to corrupt partitioned table
10.5 part: test cases and comments. The code is in the merge commit 74fe1c44aa1 When f.ex. table is partitioned by HASH(a) and we rename column `a' to `b' partitioning filter stays unchanged: HASH(a). That's the wrong behavior. The patch updates partitioning filter in accordance to the new columns names. That includes partition/subpartition expression and partition/subpartition field list.
Diffstat (limited to 'mysql-test/main/partition_alter.test')
-rw-r--r--mysql-test/main/partition_alter.test41
1 files changed, 41 insertions, 0 deletions
diff --git a/mysql-test/main/partition_alter.test b/mysql-test/main/partition_alter.test
index ded6fde4794..4f17b520489 100644
--- a/mysql-test/main/partition_alter.test
+++ b/mysql-test/main/partition_alter.test
@@ -204,3 +204,44 @@ delete from t order by b limit 1;
drop table t;
--echo # End of 10.3 tests
+
+--echo #
+--echo # MDEV-28576 RENAME COLUMN with NOCOPY algorithm leads to corrupt partitioned table
+--echo #
+create table t (a int)
+partition by list (a)
+subpartition by hash(a) subpartitions 2
+(partition p0 values in (1));
+alter table t rename column a to b, algorithm=nocopy;
+show create table t;
+alter table t rename column b to c, algorithm=copy;
+show create table t;
+drop table t;
+
+create table t (d int, e int)
+partition by list columns (d, e)
+subpartition by key (d, e)
+(partition p0 values in ((2, 3)));
+alter table t rename column d to f, rename column e to g, algorithm=nocopy;
+show create table t;
+alter table t rename column f to h, rename column g to i, algorithm=copy;
+show create table t;
+drop table t;
+
+create table t (k int, l int)
+partition by range (k)
+subpartition by hash(l) subpartitions 4
+(partition p0 values less than (5));
+alter table t rename column k to l, rename column l to k;
+show create table t;
+drop table t;
+
+create table t (a int, b int) partition by list (b) (partition p1 values in (1, 2));
+insert into t values (0, 1), (2, 2);
+alter table t rename column b to f, rename column a to b, algorithm=nocopy;
+check table t;
+delete from t order by b limit 1;
+# cleanup
+drop table t;
+
+--echo # End of 10.5 tests