mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
509 lines
15 KiB
Text
509 lines
15 KiB
Text
CREATE PROCEDURE get_index_id(IN tbl_id INT, IN idx_name char(100), OUT idx_id INT)
|
|
BEGIN
|
|
SELECT index_id into idx_id FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES WHERE
|
|
NAME=idx_name and TABLE_ID=tbl_id;
|
|
END|
|
|
CREATE PROCEDURE get_table_id(IN tbl_name char(100), OUT tbl_id INT)
|
|
BEGIN
|
|
SELECT table_id into tbl_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE
|
|
NAME = tbl_name;
|
|
END|
|
|
SET @tbl_id = 0;
|
|
SET @tbl1_id = 0;
|
|
SET @idx_id = 0;
|
|
SET @idx1_id = 0;
|
|
CREATE TABLE t1(f1 INT NOT NULL,
|
|
f2 VARCHAR(100) PRIMARY KEY)ENGINE=InnoDB;
|
|
CALL get_table_id("test/t1", @tbl_id);
|
|
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ALGORITHM=INSTANT;
|
|
CALL get_table_id("test/t1", @tbl1_id);
|
|
SELECT @tbl1_id = @tbl_id;
|
|
@tbl1_id = @tbl_id
|
|
1
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`f1` int(11) NOT NULL,
|
|
`f2` varchar(200) NOT NULL,
|
|
PRIMARY KEY (`f2`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1(f1 INT NOT NULL,
|
|
f2 VARCHAR(100),
|
|
INDEX idx(f2))ENGINE=InnoDB;
|
|
CALL get_table_id("test/t1", @tbl_id);
|
|
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ALGORITHM=INSTANT;
|
|
CALL get_table_id("test/t1", @tbl1_id);
|
|
SELECT @tbl1_id = @tbl_id;
|
|
@tbl1_id = @tbl_id
|
|
1
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`f1` int(11) NOT NULL,
|
|
`f2` varchar(200) DEFAULT NULL,
|
|
KEY `idx` (`f2`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100), f3 VARCHAR(100),
|
|
INDEX idx(f2, f3), index idx1(f3, f2))ENGINE=InnoDB;
|
|
CALL get_table_id("test/t1", @tbl_id);
|
|
CALL get_index_id(@tbl_id, "idx", @idx_id);
|
|
ALTER TABLE t1 MODIFY f2 VARCHAR(200), MODIFY f3 VARCHAR(150), ALGORITHM=INSTANT;
|
|
CALL get_table_id("test/t1", @tbl1_id);
|
|
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
|
|
SELECT @tbl1_id = @tbl_id;
|
|
@tbl1_id = @tbl_id
|
|
1
|
|
SELECT @idx1_id = @idx_id;
|
|
@idx1_id = @idx_id
|
|
1
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`f1` int(11) NOT NULL,
|
|
`f2` varchar(200) DEFAULT NULL,
|
|
`f3` varchar(150) DEFAULT NULL,
|
|
KEY `idx` (`f2`,`f3`),
|
|
KEY `idx1` (`f3`,`f2`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100),
|
|
INDEX idx(f2(40)))ENGINE=InnoDB;
|
|
CALL get_table_id("test/t1", @tbl_id);
|
|
CALL get_index_id(@tbl_id, "idx", @idx_id);
|
|
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ALGORITHM=INSTANT;
|
|
CALL get_table_id("test/t1", @tbl1_id);
|
|
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
|
|
SELECT @tbl1_id = @tbl_id;
|
|
@tbl1_id = @tbl_id
|
|
1
|
|
SELECT @idx1_id = @idx_id;
|
|
@idx1_id = @idx_id
|
|
1
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`f1` int(11) NOT NULL,
|
|
`f2` varchar(200) DEFAULT NULL,
|
|
KEY `idx` (`f2`(40))
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1(f1 INT NOT NULL,
|
|
f2 VARCHAR(100), FULLTEXT idx(f2))ENGINE=InnoDB;
|
|
CALL get_table_id("test/t1", @tbl_id);
|
|
CALL get_index_id(@tbl_id, "idx", @idx_id);
|
|
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ALGORITHM=INSTANT;
|
|
CALL get_table_id("test/t1", @tbl1_id);
|
|
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
|
|
SELECT @tbl1_id = @tbl_id;
|
|
@tbl1_id = @tbl_id
|
|
1
|
|
SELECT @idx1_id = @idx_id;
|
|
@idx1_id = @idx_id
|
|
1
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`f1` int(11) NOT NULL,
|
|
`f2` varchar(200) DEFAULT NULL,
|
|
FULLTEXT KEY `idx` (`f2`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1(f1 INT NOT NULL,
|
|
f2 VARCHAR(100),
|
|
f3 VARCHAR(50) as (f2) VIRTUAL,
|
|
INDEX idx(f3))ENGINE=InnoDB;
|
|
INSERT INTO t1(f1, f2) VALUES(1, repeat('a', 40));
|
|
CALL get_table_id("test/t1", @tbl_id);
|
|
CALL get_index_id(@tbl_id, "idx", @idx_id);
|
|
ALTER TABLE t1 MODIFY f2 VARCHAR(100), ALGORITHM=INSTANT;
|
|
CALL get_table_id("test/t1", @tbl1_id);
|
|
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
|
|
SELECT @tbl1_id = @tbl_id;
|
|
@tbl1_id = @tbl_id
|
|
1
|
|
SELECT @idx1_id = @idx_id;
|
|
@idx1_id = @idx_id
|
|
1
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`f1` int(11) NOT NULL,
|
|
`f2` varchar(100) DEFAULT NULL,
|
|
`f3` varchar(50) GENERATED ALWAYS AS (`f2`) VIRTUAL,
|
|
KEY `idx` (`f3`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1(f1 INT NOT NULL,
|
|
f2 VARCHAR(100),
|
|
INDEX idx(f2(10)),
|
|
INDEX idx1(f1))ENGINE=InnoDB;
|
|
CALL get_table_id("test/t1", @tbl_id);
|
|
CALL get_index_id(@tbl_id, "idx", @idx_id);
|
|
ALTER TABLE t1 MODIFY f2 VARCHAR(200), DROP INDEX idx1;
|
|
CALL get_table_id("test/t1", @tbl1_id);
|
|
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
|
|
SELECT @tbl1_id = @tbl_id;
|
|
@tbl1_id = @tbl_id
|
|
1
|
|
SELECT @idx1_id = @idx_id;
|
|
@idx1_id = @idx_id
|
|
1
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`f1` int(11) NOT NULL,
|
|
`f2` varchar(200) DEFAULT NULL,
|
|
KEY `idx` (`f2`(10))
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1(f1 INT NOT NULL,
|
|
f2 VARCHAR(100),
|
|
INDEX idx(f2(10)))ENGINE=InnoDB;
|
|
CALL get_table_id("test/t1", @tbl_id);
|
|
CALL get_index_id(@tbl_id, "idx", @idx_id);
|
|
ALTER TABLE t1 MODIFY f2 VARCHAR(200), DROP INDEX idx, ADD INDEX idx(f2(10)), ALGORITHM=INSTANT;
|
|
CALL get_table_id("test/t1", @tbl1_id);
|
|
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
|
|
SELECT @tbl1_id = @tbl_id;
|
|
@tbl1_id = @tbl_id
|
|
1
|
|
SELECT @idx1_id = @idx_id;
|
|
@idx1_id = @idx_id
|
|
1
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`f1` int(11) NOT NULL,
|
|
`f2` varchar(200) DEFAULT NULL,
|
|
KEY `idx` (`f2`(10))
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1(f1 INT NOT NULL,
|
|
f2 VARCHAR(100),
|
|
INDEX idx(f2(10)))ENGINE=InnoDB;
|
|
CALL get_table_id("test/t1", @tbl_id);
|
|
CALL get_index_id(@tbl_id, "idx", @idx_id);
|
|
ALTER TABLE t1 MODIFY f2 VARCHAR(200), DROP INDEX idx, ADD INDEX idx(f2(50));
|
|
CALL get_table_id("test/t1", @tbl1_id);
|
|
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
|
|
SELECT @tbl1_id = @tbl_id;
|
|
@tbl1_id = @tbl_id
|
|
1
|
|
SELECT @idx1_id = @idx_id;
|
|
@idx1_id = @idx_id
|
|
0
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`f1` int(11) NOT NULL,
|
|
`f2` varchar(200) DEFAULT NULL,
|
|
KEY `idx` (`f2`(50))
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1(f1 INT NOT NULL,
|
|
f2 VARCHAR(100),
|
|
INDEX idx(f2(100)))ENGINE=InnoDB;
|
|
CALL get_table_id("test/t1", @tbl_id);
|
|
CALL get_index_id(@tbl_id, "idx", @idx_id);
|
|
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ADD INDEX idx1(f1);
|
|
CALL get_table_id("test/t1", @tbl1_id);
|
|
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
|
|
SELECT @tbl1_id = @tbl_id;
|
|
@tbl1_id = @tbl_id
|
|
1
|
|
SELECT @idx1_id = @idx_id;
|
|
@idx1_id = @idx_id
|
|
1
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`f1` int(11) NOT NULL,
|
|
`f2` varchar(200) DEFAULT NULL,
|
|
KEY `idx` (`f2`),
|
|
KEY `idx1` (`f1`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1(f1 INT NOT NULL,
|
|
f2 VARCHAR(100),
|
|
INDEX idx(f2(10)))ENGINE=InnoDB;
|
|
CALL get_table_id("test/t1", @tbl_id);
|
|
CALL get_index_id(@tbl_id, "idx", @idx_id);
|
|
ALTER TABLE t1 MODIFY f2 VARCHAR(200), DROP INDEX idx, ADD INDEX idx(f2(6));
|
|
CALL get_table_id("test/t1", @tbl1_id);
|
|
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
|
|
SELECT @tbl1_id = @tbl_id;
|
|
@tbl1_id = @tbl_id
|
|
1
|
|
SELECT @idx1_id = @idx_id;
|
|
@idx1_id = @idx_id
|
|
0
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`f1` int(11) NOT NULL,
|
|
`f2` varchar(200) DEFAULT NULL,
|
|
KEY `idx` (`f2`(6))
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1(f1 INT NOT NULL,
|
|
f2 VARCHAR(100),
|
|
INDEX idx(f2))ENGINE=InnoDB;
|
|
CALL get_table_id("test/t1", @tbl_id);
|
|
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ADD COLUMN f3 INT, ALGORITHM=INSTANT;
|
|
CALL get_table_id("test/t1", @tbl1_id);
|
|
SELECT @tbl1_id = @tbl_id;
|
|
@tbl1_id = @tbl_id
|
|
1
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`f1` int(11) NOT NULL,
|
|
`f2` varchar(200) DEFAULT NULL,
|
|
`f3` int(11) DEFAULT NULL,
|
|
KEY `idx` (`f2`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100) PRIMARY KEY)ENGINE=InnoDB;
|
|
CALL get_table_id("test/t1", @tbl_id);
|
|
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ADD COLUMN f3 INT, ALGORITHM=INSTANT;
|
|
CALL get_table_id("test/t1", @tbl1_id);
|
|
SELECT @tbl1_id = @tbl_id;
|
|
@tbl1_id = @tbl_id
|
|
1
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`f1` int(11) NOT NULL,
|
|
`f2` varchar(200) NOT NULL,
|
|
`f3` int(11) DEFAULT NULL,
|
|
PRIMARY KEY (`f2`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100))ENGINE=INNODB;
|
|
CALL get_table_id("test/t1", @tbl_id);
|
|
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ADD FULLTEXT idx(f2);
|
|
CALL get_table_id("test/t1", @tbl1_id);
|
|
SELECT @tbl1_id = @tbl_id;
|
|
@tbl1_id = @tbl_id
|
|
0
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`f1` int(11) NOT NULL,
|
|
`f2` varchar(200) DEFAULT NULL,
|
|
FULLTEXT KEY `idx` (`f2`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1(f1 INT NOT NULL,
|
|
f2 CHAR(100) PRIMARY KEY)ENGINE=InnoDB;
|
|
CALL get_table_id("test/t1", @tbl_id);
|
|
ALTER TABLE t1 MODIFY f2 CHAR(200);
|
|
CALL get_table_id("test/t1", @tbl1_id);
|
|
SELECT @tbl1_id = @tbl_id;
|
|
@tbl1_id = @tbl_id
|
|
0
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`f1` int(11) NOT NULL,
|
|
`f2` char(200) NOT NULL,
|
|
PRIMARY KEY (`f2`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1(f1 INT NOT NULL,
|
|
f2 VARCHAR(100),
|
|
INDEX idx(f2(10)),
|
|
INDEX idx1(f1))ENGINE=InnoDB;
|
|
CALL get_table_id("test/t1", @tbl_id);
|
|
ALTER TABLE t1 MODIFY f2 VARCHAR(50);
|
|
CALL get_table_id("test/t1", @tbl1_id);
|
|
SELECT @tbl1_id = @tbl_id;
|
|
@tbl1_id = @tbl_id
|
|
0
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`f1` int(11) NOT NULL,
|
|
`f2` varchar(50) DEFAULT NULL,
|
|
KEY `idx` (`f2`(10)),
|
|
KEY `idx1` (`f1`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1(f1 INT NOT NULL,
|
|
f2 VARCHAR(100),
|
|
INDEX idx(f2(10)),
|
|
INDEX idx1(f1))ENGINE=InnoDB;
|
|
CALL get_table_id("test/t1", @tbl_id);
|
|
ALTER TABLE t1 MODIFY f2 VARCHAR(5), DROP INDEX idx1;
|
|
CALL get_table_id("test/t1", @tbl1_id);
|
|
SELECT @tbl1_id = @tbl_id;
|
|
@tbl1_id = @tbl_id
|
|
0
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`f1` int(11) NOT NULL,
|
|
`f2` varchar(5) DEFAULT NULL,
|
|
KEY `idx` (`f2`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1(f1 INT NOT NULL,
|
|
f2 VARCHAR(100), FULLTEXT idx(f2))ENGINE=InnoDB;
|
|
CALL get_table_id("test/t1", @tbl_id);
|
|
CALL get_index_id(@tbl_id, "idx", @idx_id);
|
|
ALTER TABLE t1 MODIFY f2 VARCHAR(50);
|
|
CALL get_table_id("test/t1", @tbl1_id);
|
|
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
|
|
SELECT @tbl1_id = @tbl_id;
|
|
@tbl1_id = @tbl_id
|
|
0
|
|
SELECT @idx1_id = @idx_id;
|
|
@idx1_id = @idx_id
|
|
0
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`f1` int(11) NOT NULL,
|
|
`f2` varchar(50) DEFAULT NULL,
|
|
FULLTEXT KEY `idx` (`f2`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1(f1 INT NOT NULL,
|
|
f2 VARCHAR(100),
|
|
INDEX idx(f2))ENGINE=InnoDB;
|
|
CALL get_table_id("test/t1", @tbl_id);
|
|
ALTER TABLE t1 MODIFY f2 CHAR(200);
|
|
CALL get_table_id("test/t1", @tbl1_id);
|
|
SELECT @tbl1_id = @tbl_id;
|
|
@tbl1_id = @tbl_id
|
|
0
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`f1` int(11) NOT NULL,
|
|
`f2` char(200) DEFAULT NULL,
|
|
KEY `idx` (`f2`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1(f1 INT NOT NULL,
|
|
f2 VARCHAR(100),
|
|
INDEX idx(f2(40)))ENGINE=InnoDB;
|
|
CALL get_table_id("test/t1", @tbl_id);
|
|
ALTER TABLE t1 MODIFY f2 TEXT;
|
|
CALL get_table_id("test/t1", @tbl1_id);
|
|
SELECT @tbl1_id = @tbl_id;
|
|
@tbl1_id = @tbl_id
|
|
0
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`f1` int(11) NOT NULL,
|
|
`f2` text DEFAULT NULL,
|
|
KEY `idx` (`f2`(40))
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1(f1 INT NOT NULL,
|
|
f2 VARCHAR(100),
|
|
INDEX idx(f2(40)))ENGINE=InnoDB;
|
|
CALL get_table_id("test/t1", @tbl_id);
|
|
ALTER TABLE t1 MODIFY f2 VARCHAR(300);
|
|
CALL get_table_id("test/t1", @tbl1_id);
|
|
SELECT @tbl1_id = @tbl_id;
|
|
@tbl1_id = @tbl_id
|
|
1
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`f1` int(11) NOT NULL,
|
|
`f2` varchar(300) DEFAULT NULL,
|
|
KEY `idx` (`f2`(40))
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1(f1 INT NOT NULL,
|
|
f2 VARCHAR(128),
|
|
INDEX idx(f2(40)))ENGINE=InnoDB;
|
|
CALL get_table_id("test/t1", @tbl_id);
|
|
ALTER TABLE t1 MODIFY f2 VARCHAR(300);
|
|
CALL get_table_id("test/t1", @tbl1_id);
|
|
SELECT @tbl1_id = @tbl_id;
|
|
@tbl1_id = @tbl_id
|
|
0
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`f1` int(11) NOT NULL,
|
|
`f2` varchar(300) DEFAULT NULL,
|
|
KEY `idx` (`f2`(40))
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1(f1 INT NOT NULL,
|
|
f2 VARCHAR(128),
|
|
INDEX idx(f2(40)))ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
|
|
CALL get_table_id("test/t1", @tbl_id);
|
|
ALTER TABLE t1 MODIFY f2 VARCHAR(300);
|
|
CALL get_table_id("test/t1", @tbl1_id);
|
|
SELECT @tbl1_id = @tbl_id;
|
|
@tbl1_id = @tbl_id
|
|
1
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`f1` int(11) NOT NULL,
|
|
`f2` varchar(300) DEFAULT NULL,
|
|
KEY `idx` (`f2`(40))
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1(f1 INT NOT NULL,
|
|
f2 VARCHAR(100),
|
|
INDEX idx(f2(40)))ENGINE=InnoDB;
|
|
CALL get_table_id("test/t1", @tbl_id);
|
|
ALTER TABLE t1 MODIFY f2 VARCHAR(200) CHARACTER SET UTF16;
|
|
CALL get_table_id("test/t1", @tbl1_id);
|
|
SELECT @tbl1_id = @tbl_id;
|
|
@tbl1_id = @tbl_id
|
|
0
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`f1` int(11) NOT NULL,
|
|
`f2` varchar(200) CHARACTER SET utf16 COLLATE utf16_general_ci DEFAULT NULL,
|
|
KEY `idx` (`f2`(40))
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1(f1 INT NOT NULL,
|
|
f2 VARCHAR(100),
|
|
f3 VARCHAR(50) as (f2) VIRTUAL,
|
|
INDEX idx(f3))ENGINE=InnoDB;
|
|
# If varchar virtual column extension is allowed in the future then
|
|
# InnoDB must rebuild the index
|
|
ALTER TABLE t1 MODIFY f3 VARCHAR(100);
|
|
ERROR HY000: This is not yet supported for generated columns
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`f1` int(11) NOT NULL,
|
|
`f2` varchar(100) DEFAULT NULL,
|
|
`f3` varchar(50) GENERATED ALWAYS AS (`f2`) VIRTUAL,
|
|
KEY `idx` (`f3`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
|
DROP TABLE t1;
|
|
DROP PROCEDURE get_index_id;
|
|
DROP PROCEDURE get_table_id;
|
|
create table t (a varchar(100)) engine=innodb;
|
|
select sc.name, sc.pos, sc.mtype, sc.prtype, sc.len
|
|
from information_schema.innodb_sys_columns sc
|
|
inner join information_schema.innodb_sys_tables st
|
|
on sc.table_id=st.table_id where st.name='test/t' and sc.name='a';
|
|
name pos mtype prtype len
|
|
a 0 1 524303 100
|
|
alter table t modify a varchar(110), algorithm=inplace;
|
|
select sc.name, sc.pos, sc.mtype, sc.prtype, sc.len
|
|
from information_schema.innodb_sys_columns sc
|
|
inner join information_schema.innodb_sys_tables st
|
|
on sc.table_id=st.table_id where st.name='test/t' and sc.name='a';
|
|
name pos mtype prtype len
|
|
a 0 1 524303 110
|
|
drop table t;
|
|
# End of 10.2 tests
|