mariadb/mysql-test/suite/parts/r/alter_table.result
Yuchen Pei 068d061454
MDEV-34813 A simple implementation of ha_partition::compare_key_parts
It is not clear that the three Compare_key enums form a hierarchy like
alter algorithms do. So on the safe side (in case MDEV-22168 gets
implemented without looking at this code) we should return NotEqual if
partition engines do not return the same enum value. There's a static
merge function that merges these enums, but it is used to merge the
Compare_keys of different key parts (horizontally), rather than
different partitions (vertically).
2025-01-22 11:16:56 +11:00

76 lines
2.9 KiB
Text

#
# MDEV-22649 SIGSEGV in ha_partition::create_partitioning_metadata on ALTER
#
set @save_alter_algorithm= @@session.alter_algorithm;
SET SESSION alter_algorithm=4;
CREATE TABLE t1(a INT) engine=myisam PARTITION BY RANGE(a) SUBPARTITION BY KEY(a) (PARTITION p0 VALUES LESS THAN (10) (SUBPARTITION s0,SUBPARTITION s1), PARTITION p1 VALUES LESS THAN (20) (SUBPARTITION s2,SUBPARTITION s3));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY RANGE (`a`)
SUBPARTITION BY KEY (`a`)
(PARTITION `p0` VALUES LESS THAN (10)
(SUBPARTITION `s0` ENGINE = MyISAM,
SUBPARTITION `s1` ENGINE = MyISAM),
PARTITION `p1` VALUES LESS THAN (20)
(SUBPARTITION `s2` ENGINE = MyISAM,
SUBPARTITION `s3` ENGINE = MyISAM))
ALTER TABLE t1 ADD COLUMN c INT;
ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=COPY
DROP table if exists t1;
set @@session.alter_algorithm= @save_alter_algorithm;
#
# MDEV-22804 SIGSEGV in ha_partition::create_partitioning_metadata |
# ERROR 1507 (HY000): Error in list of partitions to DROP
#
CREATE TABLE t1 (a INT) PARTITION BY RANGE(a) SUBPARTITION BY HASH(a) (PARTITION p VALUES LESS THAN (5) (SUBPARTITION sp, SUBPARTITION sp1), PARTITION p1 VALUES LESS THAN MAXVALUE (SUBPARTITION sp2, SUBPARTITION sp3));
ALTER TABLE t1 DROP PARTITION p;
DROP TABLE if exists t1;
#
# MDEV-23357 Server crashes in Sql_cmd_alter_table_exchange_partition::exchange_partition
#
CREATE TABLE t1 (i INT);
CREATE VIEW v1 as SELECT * FROM t1;
CREATE TABLE t2 (i INT);
ALTER TABLE v1 EXCHANGE PARTITION p2 WITH TABLE t2 ;
ERROR 42000: Can't open table
DROP VIEW v1;
DROP TABLE t1, t2;
#
# MDEV-25102 UNIQUE USING HASH error after ALTER ... DISABLE KEYS
#
create table t1 (i1 int primary key, i2 int, d1 date, key(i2))
partition by hash(i1) partitions 3;
insert into t1 values(0, 1, '2010-10-10');
select index_name, comment from information_schema.statistics where table_schema='test' and table_name='t1';
index_name comment
PRIMARY
i2
alter table t1 disable keys;
select index_name, comment from information_schema.statistics where table_schema='test' and table_name='t1';
index_name comment
PRIMARY
i2 disabled
alter table t1 add partition (partition p4);
select index_name, comment from information_schema.statistics where table_schema='test' and table_name='t1';
index_name comment
PRIMARY
i2 disabled
drop table t1;
#
# MDEV-34813 ALGORITHM=INSTANT does not work for partitioned tables on indexed column
#
CREATE TABLE `t1` (
`f1` datetime ,
`f2` VARCHAR(2) ,
`f3` VARCHAR(200) ,
`f4` VARCHAR(100) ,
INDEX `i3` (`f4`) )
PARTITION BY RANGE COLUMNS(`f2`)
(PARTITION `p_01` VALUES LESS THAN ('02') ENGINE = InnoDB,
PARTITION `p_31` VALUES LESS THAN (MAXVALUE) ENGINE = InnoDB);
ALTER online TABLE t1 MODIFY COLUMN `f4` VARCHAR(500) , ALGORITHM=INSTANT, LOCK=NONE;
drop table t1;
# End of 10.5 tests