-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #625 from hustjieke/feature_complete_create_interg…
…ration_#613 intergration: complete create.test #613
- Loading branch information
Showing
3 changed files
with
495 additions
and
1 deletion.
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
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,341 @@ | ||
create database integrate_test DEFAULT CHARSET=utf8; | ||
|
||
|
||
create table integrate_test.t1 (b char(0)) partition by hash(b) DEFAULT CHARSET=utf8; | ||
|
||
insert into integrate_test.t1(b) values (""),(null); | ||
ERROR 1105 (HY000): unsupported: shardkey[b].type.canot.be[*sqlparser.NullVal] | ||
|
||
select * from integrate_test.t1; | ||
|
||
drop table if exists integrate_test.t1; | ||
|
||
|
||
create table integrate_test.t1 (b char(0) not null) partition by hash(b) DEFAULT CHARSET=utf8; | ||
|
||
create table if not exists integrate_test.t1 (b char(0) not null) DEFAULT CHARSET=utf8; | ||
|
||
insert into integrate_test.t1(b) values (""),(null); | ||
ERROR 1105 (HY000): unsupported: shardkey[b].type.canot.be[*sqlparser.NullVal] | ||
|
||
select * from integrate_test.t1; | ||
|
||
drop table integrate_test.t1; | ||
|
||
|
||
create table integrate_test.t1 (a bigint not null auto_increment,primary key (a)) engine=innodb DEFAULT CHARSET=utf8; | ||
|
||
drop table integrate_test.t1; | ||
|
||
|
||
create table integrate_test.t1 (ordid bigint(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) engine=innodb partition by hash(ordid) DEFAULT CHARSET=utf8; | ||
ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it must be defined as a key | ||
|
||
|
||
create table not_existing_database.test (a int) partition by hash(a) DEFAULT CHARSET=utf8; | ||
ERROR 1046 (3D000): No database selected | ||
|
||
|
||
create table integrate_test.t1 (a bigint default 100 auto_increment key) DEFAULT CHARSET=utf8; | ||
ERROR 1067 (42000): Invalid default value for 'a' | ||
|
||
create table integrate_test.t1 (a tinyint default 1000 key) DEFAULT CHARSET=utf8; | ||
ERROR 1067 (42000): Invalid default value for 'a' | ||
|
||
create table integrate_test.t1 (a varchar(5) default 'abcdef' key) DEFAULT CHARSET=utf8; | ||
ERROR 1067 (42000): Invalid default value for 'a' | ||
|
||
|
||
create table integrate_test.t1 (a varchar(5) default 'abcde' key) DEFAULT CHARSET=utf8; | ||
|
||
select * from integrate_test.t1; | ||
|
||
drop table integrate_test.t1; | ||
|
||
|
||
create table integrate_test.`1ea10` (`1a20` int,`1e` int key) DEFAULT CHARSET=utf8; | ||
|
||
insert into integrate_test.`1ea10`(`1a20`, `1e`) values(1,1); | ||
|
||
select `1ea10`.`1a20`,`1e`+ 1e+10 from integrate_test.`1ea10`; | ||
1a20 `1e` + 1e+10 | ||
1 10000000001 | ||
|
||
drop table integrate_test.`1ea10`; | ||
|
||
|
||
create table integrate_test.`$test1` (`a$1` int, `$b` int, `c$` int) partition by hash(`a$1`) num=8 DEFAULT CHARSET=utf8; | ||
|
||
insert into integrate_test.`$test1`(`a$1`, `$b`, `c$`) values (1,2,3); | ||
|
||
select `a$1`, `$b`, `c$` from integrate_test.`$test1`; | ||
a$1 $b c$ | ||
1 2 3 | ||
|
||
create table integrate_test.`test2$` (a int key) partition by hash(a) num=8 DEFAULT CHARSET=utf8; | ||
|
||
drop table integrate_test.`test2$`; | ||
|
||
|
||
create table integrate_test.`` (a int key) DEFAULT CHARSET=utf8; | ||
ERROR 1149 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use, syntax error at position 31 | ||
|
||
drop table if exists integrate_test.``; | ||
ERROR 1149 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use, syntax error at position 39 | ||
|
||
create table integrate_test.t1 (`` int) DEFAULT CHARSET=utf8; | ||
ERROR 1149 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use, syntax error at position 35 | ||
|
||
create table integrate_test.t1 (i int key, index `` (i)) DEFAULT CHARSET=utf8; | ||
ERROR 1149 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use, syntax error at position 52 | ||
|
||
|
||
create table integrate_test.t1 ( k1 varchar(2), k2 int, primary key(k1,k2)) partition by hash(k1) num=8 DEFAULT CHARSET=utf8; | ||
|
||
insert into integrate_test.t1(k1, k2) values ("a", 1), ("b", 2); | ||
|
||
insert into integrate_test.t1(k1, k2) values ("c", NULL); | ||
ERROR 1048 (23000): Column 'k2' cannot be null | ||
|
||
insert into integrate_test.t1(k1, k2) values (NULL, 3); | ||
ERROR 1105 (HY000): unsupported: shardkey[k1].type.canot.be[*sqlparser.NullVal] | ||
|
||
insert into integrate_test.t1(k1, k2) values (NULL, NULL); | ||
ERROR 1105 (HY000): unsupported: shardkey[k1].type.canot.be[*sqlparser.NullVal] | ||
|
||
drop table integrate_test.t1; | ||
|
||
|
||
create table integrate_test.t1 (a int,) partition by hash(a) num=8 DEFAULT CHARSET=utf8; | ||
ERROR 1149 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use, syntax error at position 40 | ||
|
||
create table integrate_test.t1 (a int,,b int) partition by hash(a) num=8 DEFAULT CHARSET=utf8; | ||
ERROR 1149 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use, syntax error at position 40 | ||
|
||
create table integrate_test.t1 (,b int key) DEFAULT CHARSET=utf8; | ||
ERROR 1149 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use, syntax error at position 34 | ||
|
||
|
||
create table integrate_test.t1(a int,b int,c int unsigned,d date,e char,f datetime,g time,h blob) partition by hash(a) num=8 DEFAULT CHARSET=utf8; | ||
|
||
insert into integrate_test.t1(a)values(1); | ||
|
||
insert into integrate_test.t1(a,b,c,d,e,f,g,h) | ||
values(2,-2,2,'1825-12-14','a','2003-1-1 3:2:1','4:3:2','binary data'); | ||
|
||
select * from integrate_test.t1; | ||
a b c d e f g h | ||
1 NULL NULL NULL NULL NULL NULL NULL | ||
2 -2 2 1825-12-14 a 2003-01-01 03:02:01 04:03:02 binary data | ||
|
||
select a, | ||
ifnull(b,cast(-7 as signed)) as b, | ||
ifnull(c,cast(7 as unsigned)) as c, | ||
ifnull(d,cast('2000-01-01' as date)) as d, | ||
ifnull(e,cast('b' as char)) as e, | ||
ifnull(f,cast('2000-01-01' as datetime)) as f, | ||
ifnull(g,cast('5:4:3' as time)) as g, | ||
ifnull(h,cast('yet another binary data' as binary)) as h, | ||
addtime(cast('1:0:0' as time),cast('1:0:0' as time)) as dd | ||
from integrate_test.t1; | ||
a b c d e f g h dd | ||
1 -7 7 2000-01-01 b 2000-01-01 00:00:00 05:04:03 yet another binary data 02:00:00 | ||
2 -2 2 1825-12-14 a 2003-01-01 03:02:01 04:03:02 binary data 02:00:00 | ||
|
||
drop table integrate_test.t1; | ||
|
||
|
||
create table integrate_test.t1 (a tinyint, b smallint, c mediumint, d int, e bigint, f float(3,2), g double(4,3), h decimal(5,4), i year, j date, k timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, l datetime, m enum('a','b'), o char(10)) partition by hash(a) DEFAULT CHARSET=utf8; | ||
|
||
show create table integrate_test.t1\G | ||
drop table integrate_test.t1; | ||
*************************** 1. row *************************** | ||
Table: t1 | ||
Create Table: CREATE TABLE `t1` ( | ||
`a` tinyint(4) DEFAULT NULL, | ||
`b` smallint(6) DEFAULT NULL, | ||
`c` mediumint(9) DEFAULT NULL, | ||
`d` int(11) DEFAULT NULL, | ||
`e` bigint(20) DEFAULT NULL, | ||
`f` float(3,2) DEFAULT NULL, | ||
`g` double(4,3) DEFAULT NULL, | ||
`h` decimal(5,4) DEFAULT NULL, | ||
`i` year(4) DEFAULT NULL, | ||
`j` date DEFAULT NULL, | ||
`k` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | ||
`l` datetime DEFAULT NULL, | ||
`m` enum('a','b') DEFAULT NULL, | ||
`o` char(10) DEFAULT NULL | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 | ||
/*!50100 PARTITION BY HASH(a) */ | ||
|
||
|
||
create table integrate_test.t1(str varchar(10) default 'def',strnull varchar(10),intg int default '10',rel double default '3.14') partition by hash(intg) num=8 DEFAULT CHARSET=utf8; | ||
|
||
insert into integrate_test.t1(str, strnull, intg, rel) values ('','',0,0.0); | ||
|
||
show columns from integrate_test.t1; | ||
Field Type Null Key Default Extra | ||
str varchar(10) YES def | ||
strnull varchar(10) YES NULL | ||
intg int(11) YES 10 | ||
rel double YES 3.14 | ||
|
||
drop table integrate_test.t1; | ||
|
||
|
||
create table integrate_test.t1(name varchar(10), age smallint default 1) partition by hash(name) num=8 DEFAULT CHARSET=utf8; | ||
|
||
show columns from integrate_test.t1; | ||
Field Type Null Key Default Extra | ||
name varchar(10) YES NULL | ||
age smallint(6) YES 1 | ||
|
||
create table integrate_test.t2(name varchar(10), age smallint default 1) partition by hash(name) num=8 DEFAULT CHARSET=utf8; | ||
|
||
show columns from integrate_test.t2; | ||
Field Type Null Key Default Extra | ||
name varchar(10) YES NULL | ||
age smallint(6) YES 1 | ||
|
||
drop table integrate_test.t1, integrate_test.t2; | ||
|
||
|
||
create table integrate_test.t1(cenum enum('a')) single DEFAULT CHARSET=utf8; | ||
|
||
create table integrate_test.t2(cenum enum('a','a')) global DEFAULT CHARSET=utf8; | ||
ERROR 1291 (HY000): Column 'cenum' has duplicated value 'a' in ENUM | ||
|
||
create table integrate_test.t3(cenum enum('a','A','a','c','c')) global DEFAULT CHARSET=utf8; | ||
ERROR 1291 (HY000): Column 'cenum' has duplicated value 'a' in ENUM | ||
|
||
drop table integrate_test.t1; | ||
|
||
|
||
CREATE TABLE integrate_test.t1(id varchar(10) NOT NULL PRIMARY KEY, dsc longtext) partition by hash(id) num=8 DEFAULT CHARSET=utf8; | ||
|
||
INSERT INTO integrate_test.t1(id, dsc) VALUES ('5000000001', NULL),('5000000003', 'Test'),('5000000004', NULL); | ||
|
||
CREATE TABLE integrate_test.t2(id varchar(15) NOT NULL, proc varchar(100) NOT NULL, runID varchar(16) NOT NULL, `start` datetime NOT NULL, PRIMARY KEY (id,proc,runID,`start`)) partition by hash(id) num=8 DEFAULT CHARSET=utf8; | ||
|
||
INSERT INTO integrate_test.t2(id, proc, runID, `start`) VALUES ('5000000001', 'proc01', '20031029090650', '2003-10-29 13:38:40'),('5000000001', 'proc02', '20031029090650', '2003-10-29 13:38:51'),('5000000001', 'proc03', '20031029090650', '2003-10-29 13:38:11'),('5000000002', 'proc09', '20031024013310', '2003-10-24 01:33:11'),('5000000002', 'proc09', '20031024153537', '2003-10-24 15:36:04'),('5000000004', 'proc01', '20031024013641', '2003-10-24 01:37:29'),('5000000004', 'proc02', '20031024013641', '2003-10-24 01:37:39'); | ||
|
||
drop table integrate_test.t1, integrate_test.t2; | ||
|
||
|
||
create table integrate_test.t1(column.name int) single DEFAULT CHARSET=utf8; | ||
ERROR 1149 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use, syntax error at position 38 near 'column' | ||
|
||
create table integrate_test.t1(test.column.name int) single DEFAULT CHARSET=utf8; | ||
ERROR 1149 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use, syntax error at position 37 | ||
|
||
create table integrate_test.t1(xyz.t1.name int) single DEFAULT CHARSET=utf8; | ||
ERROR 1149 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use, syntax error at position 36 | ||
|
||
create table integrate_test.t1(`t1.name` int) single DEFAULT CHARSET=utf8; | ||
|
||
create table integrate_test.t2(`test.t2.name` int) single DEFAULT CHARSET=utf8; | ||
|
||
drop table integrate_test.t1,integrate_test.t2; | ||
|
||
|
||
create database mysqltest DEFAULT CHARSET=utf8; | ||
|
||
create database if not exists mysqltest character set latin2 DEFAULT CHARSET=utf8; | ||
|
||
show create database mysqltest; | ||
Database Create Database | ||
mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET utf8 */ | ||
|
||
drop database mysqltest; | ||
|
||
use integrate_test; | ||
|
||
create table integrate_test.t1 (a int) partition by hash(a) num=8 DEFAULT CHARSET=utf8; | ||
|
||
create table if not exists integrate_test.t1 (a int) partition by hash(a) num=8 DEFAULT CHARSET=utf8; | ||
|
||
drop table integrate_test.t1; | ||
|
||
|
||
create table integrate_test.t1 (upgrade int key) DEFAULT CHARSET=utf8; | ||
|
||
drop table integrate_test.t1; | ||
|
||
|
||
CREATE TABLE integrate_test.t1 (a bigint AUTO_INCREMENT PRIMARY KEY, b INTEGER NOT NULL) partition by hash(a) num=8 DEFAULT CHARSET=utf8; | ||
|
||
INSERT IGNORE INTO integrate_test.t1 (b) VALUES (5); | ||
|
||
DROP TABLE integrate_test.t1; | ||
|
||
|
||
DROP TABLE IF EXISTS integrate_test.t1; | ||
|
||
DROP TABLE IF EXISTS integrate_test.t2; | ||
|
||
|
||
CREATE TABLE integrate_test.t1( | ||
c1 INT DEFAULT 12 COMMENT 'column1', | ||
c2 INT NULL COMMENT 'column2', | ||
c3 INT NOT NULL COMMENT 'column3', | ||
c4 VARCHAR(255) CHARACTER SET utf8 NOT NULL DEFAULT 'a', | ||
c5 VARCHAR(255) NULL DEFAULT 'b', | ||
c6 VARCHAR(255)) | ||
partition by hash(c1) num=8 DEFAULT CHARSET=utf8; | ||
|
||
|
||
SHOW CREATE TABLE integrate_test.t1\G | ||
DROP TABLE integrate_test.t1; | ||
*************************** 1. row *************************** | ||
Table: t1 | ||
Create Table: CREATE TABLE `t1` ( | ||
`c1` int(11) DEFAULT '12' COMMENT 'column1', | ||
`c2` int(11) DEFAULT NULL COMMENT 'column2', | ||
`c3` int(11) NOT NULL COMMENT 'column3', | ||
`c4` varchar(255) NOT NULL DEFAULT 'a', | ||
`c5` varchar(255) DEFAULT 'b', | ||
`c6` varchar(255) DEFAULT NULL | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 | ||
/*!50100 PARTITION BY HASH(c1) */ | ||
|
||
|
||
CREATE TABLE integrate_test.t1(c1 YEAR DEFAULT 2008, c2 YEAR DEFAULT 0) partition by hash(c1) num=8 DEFAULT CHARSET=utf8; | ||
|
||
SHOW CREATE TABLE integrate_test.t1\G | ||
DROP TABLE integrate_test.t1; | ||
*************************** 1. row *************************** | ||
Table: t1 | ||
Create Table: CREATE TABLE `t1` ( | ||
`c1` year(4) DEFAULT '2008', | ||
`c2` year(4) DEFAULT '0000' | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 | ||
/*!50100 PARTITION BY HASH(c1) */ | ||
|
||
|
||
create table integrate_test.`me:i`(id int key) DEFAULT CHARSET=utf8; | ||
|
||
drop table integrate_test.`me:i`; | ||
|
||
|
||
drop table if exists integrate_test.t1,integrate_test.t2,integrate_test.t3; | ||
|
||
create table integrate_test.t1 (a int) transactional=0 DEFAULT CHARSET=utf8; | ||
ERROR 1149 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use, syntax error at position 53 near 'transactional' | ||
|
||
create table integrate_test.t2 (a int) page_checksum=1 DEFAULT CHARSET=utf8; | ||
ERROR 1149 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use, syntax error at position 53 near 'page_checksum' | ||
|
||
create table integrate_test.t3 (a int) row_format=page DEFAULT CHARSET=utf8; | ||
ERROR 1149 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use, syntax error at position 50 near 'row_format' | ||
|
||
drop table if exists integrate_test.t1,integrate_test.t2,integrate_test.t3; | ||
|
||
|
||
CREATE TABLE integrate_test.t1 (v varchar(65535) key) DEFAULT CHARSET=utf8; | ||
ERROR 1074 (42000): Column length too big for column 'v' (max = 21845); use BLOB or TEXT instead | ||
|
||
DROP TABLE IF EXISTS integrate_test.t1; | ||
|
||
|
||
drop database integrate_test; |
Oops, something went wrong.