forked from stoneatom/stonedb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(hander): support alter talbe with charset stoneatom#1670
[summary] 1. backport code 2. fix no txn version for table not commited by transaction.
- Loading branch information
Showing
5 changed files
with
133 additions
and
10 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 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, | ||
`c_varchar` char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, | ||
`c_text` char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci 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 COLLATE gbk_chinese_ci DEFAULT NULL, | ||
`c_varchar` char(10) CHARACTER SET gbk COLLATE gbk_chinese_ci DEFAULT NULL, | ||
`c_text` char(10) CHARACTER SET gbk COLLATE gbk_chinese_ci 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
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