~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
drop table if exists t1,t2,t3;
2
create table t1 (a int not null);
3
insert into t1 values (1);
4
insert into t1 values (a+2);
5
insert into t1 values (a+3),(a+4);
6
insert into t1 values (5),(a+6);
7
select * from t1;
8
a
9
1
10
2
11
3
12
4
13
5
14
6
15
drop table t1;
16
create table t1 (id int not null auto_increment primary key, username varchar(32) not null, unique (username));
1008.3.2 by Stewart Smith
Make sql_mode=NO_AUTO_VALUE_ON_ZERO default for Drizzle.
17
insert into t1 values (NULL,"mysql");
18
insert into t1 values (NULL,"mysql ab");
19
insert into t1 values (NULL,"mysql a");
20
insert into t1 values (NULL,"r1manic");
21
insert into t1 values (NULL,"r1man");
1 by brian
clean slate
22
drop table t1;
907.1.7 by Jay Pipes
Merged in remove-timezone work
23
create table t1 (a int not null auto_increment, primary key (a), t timestamp null, c char(10) default "hello", i int);
24
insert into t1 values (default,default,default,default);
25
insert into t1 values (default,default,default,default);
26
insert into t1 values (4,0,"a",5);
2069.2.4 by Brian Aker
Fix issue with return value from unix_timestamp(). Also clean up error
27
ERROR HY000: Received an invalid timestamp value '0'.
907.1.7 by Jay Pipes
Merged in remove-timezone work
28
insert into t1 values (default,default,default,default);
29
select a,t is not null,c,i from t1;
30
a	t is not null	c	i
31
1	0	hello	NULL
32
2	0	hello	NULL
33
3	0	hello	NULL
1 by brian
clean slate
34
truncate table t1;
35
insert into t1 set a=default,t=default,c=default;
36
insert into t1 set a=default,t=default,c=default,i=default;
907.1.7 by Jay Pipes
Merged in remove-timezone work
37
insert into t1 set a=4,t= NULL,c="a",i=5;
38
insert into t1 set a=5,t= NULL,c="a",i=null;
1 by brian
clean slate
39
insert into t1 set a=default,t=default,c=default,i=default;
907.1.7 by Jay Pipes
Merged in remove-timezone work
40
select a,t is not null,c,i from t1;
41
a	t is not null	c	i
42
1	0	hello	NULL
43
2	0	hello	NULL
1 by brian
clean slate
44
4	0	a	5
45
5	0	a	NULL
907.1.7 by Jay Pipes
Merged in remove-timezone work
46
6	0	hello	NULL
1 by brian
clean slate
47
drop table t1;
48
create table t1 (id int NOT NULL DEFAULT 8);
49
insert into t1 values(NULL);
50
ERROR 23000: Column 'id' cannot be null
51
insert into t1 values (1), (NULL), (2);
52
ERROR 23000: Column 'id' cannot be null
53
select * from t1;
54
id
55
drop table t1;
56
create table t1 (email varchar(50));
57
insert into t1 values ('sasha@mysql.com'),('monty@mysql.com'),('foo@hotmail.com'),('foo@aol.com'),('bar@aol.com');
58
create table t2(id int not null auto_increment primary key, t2 varchar(50), unique(t2));
1008.1.2 by Brian Aker
Removed old DELAYED keyword from parser (plus cleaned up tests). Also
59
insert into t2 (t2) select distinct substring(email, locate('@', email)+1) from t1;
1 by brian
clean slate
60
select * from t2;
61
id	t2
62
1	mysql.com
63
2	hotmail.com
64
3	aol.com
65
drop table t1,t2;
66
drop database if exists mysqltest;
67
create database mysqltest;
68
use mysqltest;
69
create table t1 (c int);
70
insert into mysqltest.t1 set mysqltest.t1.c = '1';
71
drop database mysqltest;
72
use test;
73
create table t1(id1 int not null auto_increment primary key, t char(12));
74
create table t2(id2 int not null, t char(12));
75
create table t3(id3 int not null, t char(12), index(id3));
76
select count(*) from t2;
77
count(*)
78
500
79
insert into  t2 select t1.* from t1, t2 t, t3 where  t1.id1 = t.id2 and t.id2 = t3.id3;
1487.1.1 by Brian Aker
There is room for improvement around this. We should be using rows as well
80
ERROR HY000: Temporary table too large, rerun with SQL_BIG_RESULT.
81
insert into  t2 select SQL_BIG_RESULT t1.* from t1, t2 t, t3 where  t1.id1 = t.id2 and t.id2 = t3.id3;
1 by brian
clean slate
82
select count(*) from t2;
83
count(*)
84
25500
1890.2.15 by Stewart Smith
make insert test use an explicit commit instead of an implicit one in DROP TABLE
85
COMMIT;
1 by brian
clean slate
86
drop table t1,t2,t3;
87
create table t1 (a int, b int);
88
insert into t1 (a,b) values (a,b);
89
insert into t1 SET a=1, b=a+1;
90
insert into t1 (a,b) select 1,2;
91
INSERT INTO t1 ( a ) SELECT 0 ON DUPLICATE KEY UPDATE a = a + VALUES (a);
92
replace into t1 (a,a) select 100, 'hundred';
93
ERROR 42000: Column 'a' specified twice
94
insert into t1 (a,b,b) values (1,1,1);
95
ERROR 42000: Column 'b' specified twice
96
insert into t1 (a,a) values (1,1,1);
97
ERROR 21S01: Column count doesn't match value count at row 1
98
insert into t1 (a,a) values (1,1);
99
ERROR 42000: Column 'a' specified twice
100
insert into t1 SET a=1,b=2,a=1;
101
ERROR 42000: Column 'a' specified twice
102
insert into t1 (b,b) select 1,2;
103
ERROR 42000: Column 'b' specified twice
104
INSERT INTO t1 (b,b) SELECT 0,0 ON DUPLICATE KEY UPDATE a = a + VALUES (a);
105
ERROR 42000: Column 'b' specified twice
106
drop table t1;
107
create table t1 (id int primary key, data int);
108
insert into t1 values (1, 1), (2, 2), (3, 3);
109
select row_count();
110
row_count()
111
3
112
insert ignore into t1 values (1, 1);
113
select row_count();
114
row_count()
115
0
116
replace into t1 values (1, 11);
117
select row_count();
118
row_count()
119
2
120
replace into t1 values (4, 4);
121
select row_count();
122
row_count()
123
1
124
insert into t1 values (2, 2) on duplicate key update data= data + 10;
125
select row_count();
126
row_count()
127
2
128
insert into t1 values (5, 5) on duplicate key update data= data + 10;
129
select row_count();
130
row_count()
131
1
132
drop table t1;
133
create table t1 (id int primary key auto_increment, data int, unique(data));
134
insert ignore into t1 values(NULL,100),(NULL,110),(NULL,120);
135
insert ignore into t1 values(NULL,10),(NULL,20),(NULL,110),(NULL,120),(NULL,100),(NULL,90);
136
insert ignore into t1 values(NULL,130),(NULL,140),(500,110),(550,120),(450,100),(NULL,150);
137
select * from t1 order by id;
138
id	data
139
1	100
140
2	110
141
3	120
142
4	10
143
5	20
144
6	90
201 by Brian Aker
Convert default engine to Innodb
145
10	130
146
11	140
147
12	150
1 by brian
clean slate
148
drop table t1;
149
CREATE TABLE t1 (
150
a char(20) NOT NULL,
151
b char(7) DEFAULT NULL,
152
c char(4) DEFAULT NULL
153
);
154
INSERT INTO t1(a,b,c) VALUES (9.999999e+0, 9.999999e+0, 9.999e+0);
155
INSERT INTO t1(a,b) VALUES (1.225e-04, 1.225e-04);
156
INSERT INTO t1(a,b) VALUES (1.225e-01, 1.225e-01);
157
INSERT INTO t1(a,b) VALUES (1.225877e-01, 1.225877e-01);
158
INSERT INTO t1(a,b) VALUES (1.225e+01, 1.225e+01);
159
INSERT INTO t1(a,b,c) VALUES (1.225e+01, 1.225e+01, 1.225e+01);
160
INSERT INTO t1(a,b) VALUES (1.225e+05, 1.225e+05);
161
INSERT INTO t1(a,b) VALUES (1.225e+10, 1.225e+10);
162
INSERT INTO t1(a,b) VALUES (1.225e+15, 1.225e+15);
163
INSERT INTO t1(a,b) VALUES (5000000e+0, 5000000e+0);
164
INSERT INTO t1(a,b) VALUES (1.25e+78, 1.25e+78);
165
INSERT INTO t1(a,b) VALUES (1.25e-94, 1.25e-94);
166
INSERT INTO t1(a,b) VALUES (1.25e+203, 1.25e+203);
167
INSERT INTO t1(a,b) VALUES (1.25e-175, 1.25e-175);
168
INSERT INTO t1(a,c) VALUES (1.225e+0, 1.225e+0);
169
INSERT INTO t1(a,c) VALUES (1.37e+0, 1.37e+0);
170
INSERT INTO t1(a,c) VALUES (-1.37e+0, -1.37e+0);
171
INSERT INTO t1(a,c) VALUES (-1.87e-2, -1.87e-2);
172
INSERT INTO t1(a,c) VALUES (5000e+0, 5000e+0);
173
INSERT INTO t1(a,c) VALUES (-5000e+0, -5000e+0);
174
SELECT * FROM t1;
175
a	b	c
176
9.999999	10	10
177
0.0001225	1.22e-4	NULL
178
0.1225	0.1225	NULL
179
0.1225877	0.12259	NULL
180
12.25	12.25	NULL
181
12.25	12.25	12.2
182
122500	122500	NULL
183
12250000000	1.22e10	NULL
184
1.225e15	1.22e15	NULL
185
5000000	5000000	NULL
186
1.25e78	1.25e78	NULL
187
1.25e-94	1.2e-94	NULL
188
1.25e203	1.2e203	NULL
189
1.25e-175	1e-175	NULL
190
1.225	NULL	1.23
191
1.37	NULL	1.37
192
-1.37	NULL	-1.4
193
-0.0187	NULL	0
194
5000	NULL	5000
195
-5000	NULL	-5e3
196
DROP TABLE t1;
197
CREATE TABLE t1 (
198
a char(20) NOT NULL,
199
b char(7) DEFAULT NULL,
200
c char(5)
201
);
202
INSERT INTO t1(a,b,c) VALUES (9.999999e+0, 9.999999e+0, 9.999e+0);
203
INSERT INTO t1(a,b,c) VALUES (1.225e-05, 1.225e-05, 1.225e-05);
204
INSERT INTO t1(a,b) VALUES (1.225e-04, 1.225e-04);
205
INSERT INTO t1(a,b) VALUES (1.225e-01, 1.225e-01);
206
INSERT INTO t1(a,b) VALUES (1.225877e-01, 1.225877e-01);
207
INSERT INTO t1(a,b) VALUES (1.225e+01, 1.225e+01);
208
INSERT INTO t1(a,b,c) VALUES (1.225e+01, 1.225e+01, 1.225e+01);
209
INSERT INTO t1(a,b) VALUES (1.225e+05, 1.225e+05);
210
INSERT INTO t1(a,b) VALUES (1.225e+10, 1.225e+10);
211
INSERT INTO t1(a,b) VALUES (1.225e+15, 1.225e+15);
212
INSERT INTO t1(a,b) VALUES (5000000e+0, 5000000e+0);
213
INSERT INTO t1(a,b) VALUES (1.25e+78, 1.25e+78);
214
INSERT INTO t1(a,b) VALUES (1.25e-94, 1.25e-94);
215
INSERT INTO t1(a,b) VALUES (1.25e+203, 1.25e+203);
216
INSERT INTO t1(a,b) VALUES (1.25e-175, 1.25e-175);
217
INSERT INTO t1(a,c) VALUES (1.225e+0, 1.225e+0);
218
INSERT INTO t1(a,c) VALUES (1.37e+0, 1.37e+0);
219
INSERT INTO t1(a,c) VALUES (-1.37e+0, -1.37e+0);
220
INSERT INTO t1(a,c) VALUES (1.87e-3, 1.87e-3);
221
INSERT INTO t1(a,c) VALUES (-1.87e-2, -1.87e-2);
222
INSERT INTO t1(a,c) VALUES (5000e+0, 5000e+0);
223
INSERT INTO t1(a,c) VALUES (-5000e+0, -5000e+0);
224
SELECT * FROM t1;
225
a	b	c
226
9.999999	10	9.999
227
0.00001225	1.22e-5	1e-5
228
0.0001225	1.22e-4	NULL
229
0.1225	0.1225	NULL
230
0.1225877	0.12259	NULL
231
12.25	12.25	NULL
232
12.25	12.25	12.25
233
122500	122500	NULL
234
12250000000	1.22e10	NULL
235
1.225e15	1.22e15	NULL
236
5000000	5000000	NULL
237
1.25e78	1.25e78	NULL
238
1.25e-94	1.2e-94	NULL
239
1.25e203	1.2e203	NULL
240
1.25e-175	1e-175	NULL
241
1.225	NULL	1.225
242
1.37	NULL	1.37
243
-1.37	NULL	-1.37
244
0.00187	NULL	0.002
245
-0.0187	NULL	-0.02
246
5000	NULL	5000
247
-5000	NULL	-5000
248
DROP TABLE t1;
249
CREATE TABLE t (a CHAR(10),b INT);
250
INSERT INTO t VALUES (),(),();
251
INSERT INTO t(a) SELECT rand() FROM t;
252
DROP TABLE t;
253
CREATE TABLE t1 (c1 INT NOT NULL);
254
INSERT INTO t1 VALUES(4188.32999999999992724042385816574096679687500),
255
('4188.32999999999992724042385816574096679687500'), (4188);
256
SELECT * FROM t1;
257
c1
258
4188
259
4188
260
4188
261
CREATE TABLE t2 (c1 BIGINT);
262
INSERT INTO t2 VALUES('15449237462.0000000000');
263
SELECT * FROM t2;
264
c1
265
15449237462
266
DROP TABLE t1, t2;
267
End of 5.0 tests.