-
-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tianmu): support 'ALTER TABLE t1 CHARACTER SET = ...' clause. (#848
) [summary] 1 add implement in check_if_supported_inplace_alter of tianmu handler; 2 add implement in inplace_alter_table of tianmu handler; 3 add implement in commit_inplace_alter_table of tianmu handler;
- Loading branch information
1 parent
ca2d68f
commit cf1c98c
Showing
4 changed files
with
131 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
create database test_issue848; | ||
use test_issue848; | ||
CREATE TABLE `t1` ( | ||
`c_char` char(10) DEFAULT NULL COMMENT 'char', | ||
`c_varchar` varchar(10) DEFAULT NULL COMMENT 'varchar', | ||
`c_text` text COMMENT 'text') | ||
ENGINE=TIANMU DEFAULT CHARSET=GBK; | ||
show create table t1; | ||
Table Create Table | ||
t1 CREATE TABLE `t1` ( | ||
`c_char` char(10) DEFAULT NULL COMMENT 'char', | ||
`c_varchar` varchar(10) DEFAULT NULL COMMENT 'varchar', | ||
`c_text` text COMMENT 'text' | ||
) ENGINE=TIANMU DEFAULT CHARSET=gbk | ||
insert into t1(c_char,c_varchar,c_text) values(x'D6D0B9FA',x'D5E3BDAD',x'BABCD6DD'); | ||
ALTER TABLE t1 DEFAULT CHARACTER SET gbk; | ||
show create table t1; | ||
Table Create Table | ||
t1 CREATE TABLE `t1` ( | ||
`c_char` char(10) DEFAULT NULL COMMENT 'char', | ||
`c_varchar` varchar(10) DEFAULT NULL COMMENT 'varchar', | ||
`c_text` text COMMENT 'text' | ||
) ENGINE=TIANMU DEFAULT CHARSET=gbk | ||
ALTER TABLE t1 CHARACTER SET latin1; | ||
show create table t1; | ||
Table Create Table | ||
t1 CREATE TABLE `t1` ( | ||
`c_char` char(10) CHARACTER SET gbk DEFAULT NULL COMMENT 'char', | ||
`c_varchar` varchar(10) CHARACTER SET gbk DEFAULT NULL COMMENT 'varchar', | ||
`c_text` text CHARACTER SET gbk COMMENT 'text' | ||
) ENGINE=TIANMU DEFAULT CHARSET=latin1 | ||
alter table t1 add column ex_column char(30); | ||
show create table t1; | ||
Table Create Table | ||
t1 CREATE TABLE `t1` ( | ||
`c_char` char(10) CHARACTER SET gbk DEFAULT NULL COMMENT 'char', | ||
`c_varchar` varchar(10) CHARACTER SET gbk DEFAULT NULL COMMENT 'varchar', | ||
`c_text` text CHARACTER SET gbk COMMENT 'text', | ||
`ex_column` char(30) DEFAULT NULL | ||
) ENGINE=TIANMU DEFAULT CHARSET=latin1 | ||
ALTER TABLE t1 MODIFY c_char char(10) CHARACTER SET UTF8MB4; | ||
ALTER TABLE t1 MODIFY c_varchar char(10) CHARACTER SET UTF8MB4; | ||
ALTER TABLE t1 MODIFY c_text char(10) CHARACTER SET UTF8MB4; | ||
show create table t1; | ||
Table Create Table | ||
t1 CREATE TABLE `t1` ( | ||
`c_char` char(10) CHARACTER SET utf8mb4 DEFAULT NULL, | ||
`c_varchar` char(10) CHARACTER SET utf8mb4 DEFAULT NULL, | ||
`c_text` char(10) CHARACTER SET utf8mb4 DEFAULT NULL, | ||
`ex_column` char(30) DEFAULT NULL | ||
) ENGINE=TIANMU DEFAULT CHARSET=latin1 | ||
select hex(c_char),hex(c_varchar),hex(c_text) from t1; | ||
hex(c_char) hex(c_varchar) hex(c_text) | ||
E4B8ADE59BBD E6B599E6B19F E69DADE5B79E | ||
ALTER TABLE t1 CHANGE c_char c_char char(10) CHARACTER SET GBK; | ||
ALTER TABLE t1 CHANGE c_varchar c_varchar char(10) CHARACTER SET GBK; | ||
ALTER TABLE t1 CHANGE c_text c_text char(10) CHARACTER SET GBK; | ||
select hex(c_char),hex(c_varchar),hex(c_text) from t1; | ||
hex(c_char) hex(c_varchar) hex(c_text) | ||
D6D0B9FA D5E3BDAD BABCD6DD | ||
show create table t1; | ||
Table Create Table | ||
t1 CREATE TABLE `t1` ( | ||
`c_char` char(10) CHARACTER SET gbk DEFAULT NULL, | ||
`c_varchar` char(10) CHARACTER SET gbk DEFAULT NULL, | ||
`c_text` char(10) CHARACTER SET gbk DEFAULT NULL, | ||
`ex_column` char(30) DEFAULT NULL | ||
) ENGINE=TIANMU DEFAULT CHARSET=latin1 | ||
drop table t1; | ||
drop database test_issue848; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--source include/have_tianmu.inc | ||
create database test_issue848; | ||
use test_issue848; | ||
CREATE TABLE `t1` ( | ||
`c_char` char(10) DEFAULT NULL COMMENT 'char', | ||
`c_varchar` varchar(10) DEFAULT NULL COMMENT 'varchar', | ||
`c_text` text COMMENT 'text') | ||
ENGINE=TIANMU DEFAULT CHARSET=GBK; | ||
show create table t1; | ||
|
||
insert into t1(c_char,c_varchar,c_text) values(x'D6D0B9FA',x'D5E3BDAD',x'BABCD6DD'); | ||
ALTER TABLE t1 DEFAULT CHARACTER SET gbk; | ||
show create table t1; | ||
|
||
ALTER TABLE t1 CHARACTER SET latin1; | ||
show create table t1; | ||
|
||
alter table t1 add column ex_column char(30); | ||
show create table t1; | ||
|
||
ALTER TABLE t1 MODIFY c_char char(10) CHARACTER SET UTF8MB4; | ||
ALTER TABLE t1 MODIFY c_varchar char(10) CHARACTER SET UTF8MB4; | ||
ALTER TABLE t1 MODIFY c_text char(10) CHARACTER SET UTF8MB4; | ||
show create table t1; | ||
select hex(c_char),hex(c_varchar),hex(c_text) from t1; | ||
|
||
ALTER TABLE t1 CHANGE c_char c_char char(10) CHARACTER SET GBK; | ||
ALTER TABLE t1 CHANGE c_varchar c_varchar char(10) CHARACTER SET GBK; | ||
ALTER TABLE t1 CHANGE c_text c_text char(10) CHARACTER SET GBK; | ||
select hex(c_char),hex(c_varchar),hex(c_text) from t1; | ||
show create table t1; | ||
|
||
drop table t1; | ||
drop database test_issue848; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters