Skip to content

Commit

Permalink
fix(mtr): add mtr for ALTER TABLE prompt information is incorrect.(#1142
Browse files Browse the repository at this point in the history
)

Add test cases for ALTER TABLE when exception occurs by inplace algorithm
  • Loading branch information
DandreChen authored and mergify[bot] committed Jan 5, 2023
1 parent f88fde8 commit aa5fc11
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
22 changes: 21 additions & 1 deletion mysql-test/suite/tianmu/r/alter_column.result
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ description VARCHAR(200) NULL,
PRIMARY KEY (task_id)
);
ALTER TABLE st1 ADD COLUMN test numeric(20,10);
ERROR HY000: Unable to inplace alter table
ERROR HY000: Precision must be less than or equal to 18.
ALTER TABLE st1 ADD COLUMN test1 numeric(8,2);
SHOW CREATE TABLE st1;
Table Create Table
Expand All @@ -61,4 +61,24 @@ st1 CREATE TABLE `st1` (
`test1` decimal(8,2) DEFAULT NULL,
PRIMARY KEY (`task_id`)
) ENGINE=TIANMU DEFAULT CHARSET=latin1
CREATE TABLE st2 (
task_id INT NOT NULL,
subject VARCHAR(45) NULL,
start_date DATE NULL,
end_date DATE NULL,
description VARCHAR(200) NULL,
PRIMARY KEY (task_id)
);
ALTER TABLE st2 ADD COLUMN col_name3 int auto_increment;
ERROR HY000: AUTO_INCREMENT can be only declared on primary key column!
SHOW CREATE TABLE st2;
Table Create Table
st2 CREATE TABLE `st2` (
`task_id` int(11) NOT NULL,
`subject` varchar(45) DEFAULT NULL,
`start_date` date DEFAULT NULL,
`end_date` date DEFAULT NULL,
`description` varchar(200) DEFAULT NULL,
PRIMARY KEY (`task_id`)
) ENGINE=TIANMU DEFAULT CHARSET=latin1
DROP DATABASE alter_colunm;
22 changes: 21 additions & 1 deletion mysql-test/suite/tianmu/t/alter_column.test
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,25 @@ ALTER TABLE st1 ADD COLUMN test1 numeric(8,2);

SHOW CREATE TABLE st1;

# Clean UP
#################
# ADD COLUMEN WARNING INFO
#################

CREATE TABLE st2 (
task_id INT NOT NULL,
subject VARCHAR(45) NULL,
start_date DATE NULL,
end_date DATE NULL,
description VARCHAR(200) NULL,
PRIMARY KEY (task_id)
);

--error 6
ALTER TABLE st2 ADD COLUMN col_name3 int auto_increment;

SHOW CREATE TABLE st2;

#################
# CLEAR UP
#################
DROP DATABASE alter_colunm;

0 comments on commit aa5fc11

Please sign in to comment.