Skip to content

Commit b108056

Browse files
authored
Merge pull request #625 from hustjieke/feature_complete_create_intergration_#613
intergration: complete create.test #613
2 parents 2ca1bc4 + 331d8cc commit b108056

File tree

3 files changed

+495
-1
lines changed

3 files changed

+495
-1
lines changed

intergration/radon-test/mtr.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ do
2222
# record every sql executed to tmp file
2323
echo $sqlWithoutSemi";" >> $tmpFile
2424
# execute and record result to tmp file
25-
mysql --line-numbers=0 -uroot -P3308 -h127.0.0.1 -e "$sqlWithoutSemi" >> $tmpFile 2>&1
25+
mysql --show-warnings=true --line-numbers=0 -uroot -P3308 -h127.0.0.1 -e "$sqlWithoutSemi" >> $tmpFile 2>&1
2626
else
2727
echo "empty sql, skip and continue"
2828
fi
Lines changed: 341 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,341 @@
1+
create database integrate_test DEFAULT CHARSET=utf8;
2+
3+
4+
create table integrate_test.t1 (b char(0)) partition by hash(b) DEFAULT CHARSET=utf8;
5+
6+
insert into integrate_test.t1(b) values (""),(null);
7+
ERROR 1105 (HY000): unsupported: shardkey[b].type.canot.be[*sqlparser.NullVal]
8+
9+
select * from integrate_test.t1;
10+
11+
drop table if exists integrate_test.t1;
12+
13+
14+
create table integrate_test.t1 (b char(0) not null) partition by hash(b) DEFAULT CHARSET=utf8;
15+
16+
create table if not exists integrate_test.t1 (b char(0) not null) DEFAULT CHARSET=utf8;
17+
18+
insert into integrate_test.t1(b) values (""),(null);
19+
ERROR 1105 (HY000): unsupported: shardkey[b].type.canot.be[*sqlparser.NullVal]
20+
21+
select * from integrate_test.t1;
22+
23+
drop table integrate_test.t1;
24+
25+
26+
create table integrate_test.t1 (a bigint not null auto_increment,primary key (a)) engine=innodb DEFAULT CHARSET=utf8;
27+
28+
drop table integrate_test.t1;
29+
30+
31+
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;
32+
ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it must be defined as a key
33+
34+
35+
create table not_existing_database.test (a int) partition by hash(a) DEFAULT CHARSET=utf8;
36+
ERROR 1046 (3D000): No database selected
37+
38+
39+
create table integrate_test.t1 (a bigint default 100 auto_increment key) DEFAULT CHARSET=utf8;
40+
ERROR 1067 (42000): Invalid default value for 'a'
41+
42+
create table integrate_test.t1 (a tinyint default 1000 key) DEFAULT CHARSET=utf8;
43+
ERROR 1067 (42000): Invalid default value for 'a'
44+
45+
create table integrate_test.t1 (a varchar(5) default 'abcdef' key) DEFAULT CHARSET=utf8;
46+
ERROR 1067 (42000): Invalid default value for 'a'
47+
48+
49+
create table integrate_test.t1 (a varchar(5) default 'abcde' key) DEFAULT CHARSET=utf8;
50+
51+
select * from integrate_test.t1;
52+
53+
drop table integrate_test.t1;
54+
55+
56+
create table integrate_test.`1ea10` (`1a20` int,`1e` int key) DEFAULT CHARSET=utf8;
57+
58+
insert into integrate_test.`1ea10`(`1a20`, `1e`) values(1,1);
59+
60+
select `1ea10`.`1a20`,`1e`+ 1e+10 from integrate_test.`1ea10`;
61+
1a20 `1e` + 1e+10
62+
1 10000000001
63+
64+
drop table integrate_test.`1ea10`;
65+
66+
67+
create table integrate_test.`$test1` (`a$1` int, `$b` int, `c$` int) partition by hash(`a$1`) num=8 DEFAULT CHARSET=utf8;
68+
69+
insert into integrate_test.`$test1`(`a$1`, `$b`, `c$`) values (1,2,3);
70+
71+
select `a$1`, `$b`, `c$` from integrate_test.`$test1`;
72+
a$1 $b c$
73+
1 2 3
74+
75+
create table integrate_test.`test2$` (a int key) partition by hash(a) num=8 DEFAULT CHARSET=utf8;
76+
77+
drop table integrate_test.`test2$`;
78+
79+
80+
create table integrate_test.`` (a int key) DEFAULT CHARSET=utf8;
81+
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
82+
83+
drop table if exists integrate_test.``;
84+
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
85+
86+
create table integrate_test.t1 (`` int) DEFAULT CHARSET=utf8;
87+
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
88+
89+
create table integrate_test.t1 (i int key, index `` (i)) DEFAULT CHARSET=utf8;
90+
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
91+
92+
93+
create table integrate_test.t1 ( k1 varchar(2), k2 int, primary key(k1,k2)) partition by hash(k1) num=8 DEFAULT CHARSET=utf8;
94+
95+
insert into integrate_test.t1(k1, k2) values ("a", 1), ("b", 2);
96+
97+
insert into integrate_test.t1(k1, k2) values ("c", NULL);
98+
ERROR 1048 (23000): Column 'k2' cannot be null
99+
100+
insert into integrate_test.t1(k1, k2) values (NULL, 3);
101+
ERROR 1105 (HY000): unsupported: shardkey[k1].type.canot.be[*sqlparser.NullVal]
102+
103+
insert into integrate_test.t1(k1, k2) values (NULL, NULL);
104+
ERROR 1105 (HY000): unsupported: shardkey[k1].type.canot.be[*sqlparser.NullVal]
105+
106+
drop table integrate_test.t1;
107+
108+
109+
create table integrate_test.t1 (a int,) partition by hash(a) num=8 DEFAULT CHARSET=utf8;
110+
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
111+
112+
create table integrate_test.t1 (a int,,b int) partition by hash(a) num=8 DEFAULT CHARSET=utf8;
113+
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
114+
115+
create table integrate_test.t1 (,b int key) DEFAULT CHARSET=utf8;
116+
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
117+
118+
119+
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;
120+
121+
insert into integrate_test.t1(a)values(1);
122+
123+
insert into integrate_test.t1(a,b,c,d,e,f,g,h)
124+
values(2,-2,2,'1825-12-14','a','2003-1-1 3:2:1','4:3:2','binary data');
125+
126+
select * from integrate_test.t1;
127+
a b c d e f g h
128+
1 NULL NULL NULL NULL NULL NULL NULL
129+
2 -2 2 1825-12-14 a 2003-01-01 03:02:01 04:03:02 binary data
130+
131+
select a,
132+
ifnull(b,cast(-7 as signed)) as b,
133+
ifnull(c,cast(7 as unsigned)) as c,
134+
ifnull(d,cast('2000-01-01' as date)) as d,
135+
ifnull(e,cast('b' as char)) as e,
136+
ifnull(f,cast('2000-01-01' as datetime)) as f,
137+
ifnull(g,cast('5:4:3' as time)) as g,
138+
ifnull(h,cast('yet another binary data' as binary)) as h,
139+
addtime(cast('1:0:0' as time),cast('1:0:0' as time)) as dd
140+
from integrate_test.t1;
141+
a b c d e f g h dd
142+
1 -7 7 2000-01-01 b 2000-01-01 00:00:00 05:04:03 yet another binary data 02:00:00
143+
2 -2 2 1825-12-14 a 2003-01-01 03:02:01 04:03:02 binary data 02:00:00
144+
145+
drop table integrate_test.t1;
146+
147+
148+
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;
149+
150+
show create table integrate_test.t1\G
151+
drop table integrate_test.t1;
152+
*************************** 1. row ***************************
153+
Table: t1
154+
Create Table: CREATE TABLE `t1` (
155+
`a` tinyint(4) DEFAULT NULL,
156+
`b` smallint(6) DEFAULT NULL,
157+
`c` mediumint(9) DEFAULT NULL,
158+
`d` int(11) DEFAULT NULL,
159+
`e` bigint(20) DEFAULT NULL,
160+
`f` float(3,2) DEFAULT NULL,
161+
`g` double(4,3) DEFAULT NULL,
162+
`h` decimal(5,4) DEFAULT NULL,
163+
`i` year(4) DEFAULT NULL,
164+
`j` date DEFAULT NULL,
165+
`k` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
166+
`l` datetime DEFAULT NULL,
167+
`m` enum('a','b') DEFAULT NULL,
168+
`o` char(10) DEFAULT NULL
169+
) ENGINE=InnoDB DEFAULT CHARSET=utf8
170+
/*!50100 PARTITION BY HASH(a) */
171+
172+
173+
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;
174+
175+
insert into integrate_test.t1(str, strnull, intg, rel) values ('','',0,0.0);
176+
177+
show columns from integrate_test.t1;
178+
Field Type Null Key Default Extra
179+
str varchar(10) YES def
180+
strnull varchar(10) YES NULL
181+
intg int(11) YES 10
182+
rel double YES 3.14
183+
184+
drop table integrate_test.t1;
185+
186+
187+
create table integrate_test.t1(name varchar(10), age smallint default 1) partition by hash(name) num=8 DEFAULT CHARSET=utf8;
188+
189+
show columns from integrate_test.t1;
190+
Field Type Null Key Default Extra
191+
name varchar(10) YES NULL
192+
age smallint(6) YES 1
193+
194+
create table integrate_test.t2(name varchar(10), age smallint default 1) partition by hash(name) num=8 DEFAULT CHARSET=utf8;
195+
196+
show columns from integrate_test.t2;
197+
Field Type Null Key Default Extra
198+
name varchar(10) YES NULL
199+
age smallint(6) YES 1
200+
201+
drop table integrate_test.t1, integrate_test.t2;
202+
203+
204+
create table integrate_test.t1(cenum enum('a')) single DEFAULT CHARSET=utf8;
205+
206+
create table integrate_test.t2(cenum enum('a','a')) global DEFAULT CHARSET=utf8;
207+
ERROR 1291 (HY000): Column 'cenum' has duplicated value 'a' in ENUM
208+
209+
create table integrate_test.t3(cenum enum('a','A','a','c','c')) global DEFAULT CHARSET=utf8;
210+
ERROR 1291 (HY000): Column 'cenum' has duplicated value 'a' in ENUM
211+
212+
drop table integrate_test.t1;
213+
214+
215+
CREATE TABLE integrate_test.t1(id varchar(10) NOT NULL PRIMARY KEY, dsc longtext) partition by hash(id) num=8 DEFAULT CHARSET=utf8;
216+
217+
INSERT INTO integrate_test.t1(id, dsc) VALUES ('5000000001', NULL),('5000000003', 'Test'),('5000000004', NULL);
218+
219+
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;
220+
221+
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');
222+
223+
drop table integrate_test.t1, integrate_test.t2;
224+
225+
226+
create table integrate_test.t1(column.name int) single DEFAULT CHARSET=utf8;
227+
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'
228+
229+
create table integrate_test.t1(test.column.name int) single DEFAULT CHARSET=utf8;
230+
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
231+
232+
create table integrate_test.t1(xyz.t1.name int) single DEFAULT CHARSET=utf8;
233+
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
234+
235+
create table integrate_test.t1(`t1.name` int) single DEFAULT CHARSET=utf8;
236+
237+
create table integrate_test.t2(`test.t2.name` int) single DEFAULT CHARSET=utf8;
238+
239+
drop table integrate_test.t1,integrate_test.t2;
240+
241+
242+
create database mysqltest DEFAULT CHARSET=utf8;
243+
244+
create database if not exists mysqltest character set latin2 DEFAULT CHARSET=utf8;
245+
246+
show create database mysqltest;
247+
Database Create Database
248+
mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET utf8 */
249+
250+
drop database mysqltest;
251+
252+
use integrate_test;
253+
254+
create table integrate_test.t1 (a int) partition by hash(a) num=8 DEFAULT CHARSET=utf8;
255+
256+
create table if not exists integrate_test.t1 (a int) partition by hash(a) num=8 DEFAULT CHARSET=utf8;
257+
258+
drop table integrate_test.t1;
259+
260+
261+
create table integrate_test.t1 (upgrade int key) DEFAULT CHARSET=utf8;
262+
263+
drop table integrate_test.t1;
264+
265+
266+
CREATE TABLE integrate_test.t1 (a bigint AUTO_INCREMENT PRIMARY KEY, b INTEGER NOT NULL) partition by hash(a) num=8 DEFAULT CHARSET=utf8;
267+
268+
INSERT IGNORE INTO integrate_test.t1 (b) VALUES (5);
269+
270+
DROP TABLE integrate_test.t1;
271+
272+
273+
DROP TABLE IF EXISTS integrate_test.t1;
274+
275+
DROP TABLE IF EXISTS integrate_test.t2;
276+
277+
278+
CREATE TABLE integrate_test.t1(
279+
c1 INT DEFAULT 12 COMMENT 'column1',
280+
c2 INT NULL COMMENT 'column2',
281+
c3 INT NOT NULL COMMENT 'column3',
282+
c4 VARCHAR(255) CHARACTER SET utf8 NOT NULL DEFAULT 'a',
283+
c5 VARCHAR(255) NULL DEFAULT 'b',
284+
c6 VARCHAR(255))
285+
partition by hash(c1) num=8 DEFAULT CHARSET=utf8;
286+
287+
288+
SHOW CREATE TABLE integrate_test.t1\G
289+
DROP TABLE integrate_test.t1;
290+
*************************** 1. row ***************************
291+
Table: t1
292+
Create Table: CREATE TABLE `t1` (
293+
`c1` int(11) DEFAULT '12' COMMENT 'column1',
294+
`c2` int(11) DEFAULT NULL COMMENT 'column2',
295+
`c3` int(11) NOT NULL COMMENT 'column3',
296+
`c4` varchar(255) NOT NULL DEFAULT 'a',
297+
`c5` varchar(255) DEFAULT 'b',
298+
`c6` varchar(255) DEFAULT NULL
299+
) ENGINE=InnoDB DEFAULT CHARSET=utf8
300+
/*!50100 PARTITION BY HASH(c1) */
301+
302+
303+
CREATE TABLE integrate_test.t1(c1 YEAR DEFAULT 2008, c2 YEAR DEFAULT 0) partition by hash(c1) num=8 DEFAULT CHARSET=utf8;
304+
305+
SHOW CREATE TABLE integrate_test.t1\G
306+
DROP TABLE integrate_test.t1;
307+
*************************** 1. row ***************************
308+
Table: t1
309+
Create Table: CREATE TABLE `t1` (
310+
`c1` year(4) DEFAULT '2008',
311+
`c2` year(4) DEFAULT '0000'
312+
) ENGINE=InnoDB DEFAULT CHARSET=utf8
313+
/*!50100 PARTITION BY HASH(c1) */
314+
315+
316+
create table integrate_test.`me:i`(id int key) DEFAULT CHARSET=utf8;
317+
318+
drop table integrate_test.`me:i`;
319+
320+
321+
drop table if exists integrate_test.t1,integrate_test.t2,integrate_test.t3;
322+
323+
create table integrate_test.t1 (a int) transactional=0 DEFAULT CHARSET=utf8;
324+
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'
325+
326+
create table integrate_test.t2 (a int) page_checksum=1 DEFAULT CHARSET=utf8;
327+
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'
328+
329+
create table integrate_test.t3 (a int) row_format=page DEFAULT CHARSET=utf8;
330+
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'
331+
332+
drop table if exists integrate_test.t1,integrate_test.t2,integrate_test.t3;
333+
334+
335+
CREATE TABLE integrate_test.t1 (v varchar(65535) key) DEFAULT CHARSET=utf8;
336+
ERROR 1074 (42000): Column length too big for column 'v' (max = 21845); use BLOB or TEXT instead
337+
338+
DROP TABLE IF EXISTS integrate_test.t1;
339+
340+
341+
drop database integrate_test;

0 commit comments

Comments
 (0)