mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 18:41:56 +01:00
34 lines
1.2 KiB
Text
34 lines
1.2 KiB
Text
CREATE TABLE t1 (
|
|
id INT NOT NULL,
|
|
name VARCHAR(30))ENGINE=InnoDB ROW_FORMAT=COMPACT CHARACTER SET=latin1
|
|
PARTITION BY RANGE (id) (
|
|
PARTITION p0 VALUES LESS THAN (50),
|
|
PARTITION p1 VALUES LESS THAN (MAXVALUE)
|
|
);
|
|
INSERT INTO t1(id, name) VALUES(16, 'Me'), (337, 'ROFL');
|
|
# Add and drop 31 Instant columns
|
|
CREATE TABLE t2 LIKE t1;
|
|
SHOW CREATE TABLE t2;
|
|
Table Create Table
|
|
t2 CREATE TABLE `t2` (
|
|
`id` int(11) NOT NULL,
|
|
`name` varchar(30) DEFAULT NULL
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
|
|
PARTITION BY RANGE (`id`)
|
|
(PARTITION `p0` VALUES LESS THAN (50) ENGINE = InnoDB,
|
|
PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
|
|
ALTER TABLE t2 REMOVE PARTITIONING;
|
|
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
|
|
SHOW CREATE TABLE t2;
|
|
Table Create Table
|
|
t2 CREATE TABLE `t2` (
|
|
`id` int(11) NOT NULL,
|
|
`name` varchar(30) DEFAULT NULL
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
|
|
SET ALTER_ALGORITHM=INSTANT;
|
|
ALTER TABLE t1 ADD COLUMN col1 VARCHAR(255) NOT NULL DEFAULT repeat('a', 255);
|
|
ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACE
|
|
SET ALTER_ALGORITHM=INPLACE;
|
|
ALTER TABLE t1 ADD COLUMN col1 VARCHAR(255) NOT NULL DEFAULT repeat('a', 255);
|
|
DROP TABLE t1, t2;
|
|
SET ALTER_ALGORITHM=DEFAULT;
|