~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/pbxt/insert.result

lp:drizzle + pbxt 1.1 + test results

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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));
 
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");
 
22
drop table t1;
 
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);
 
27
ERROR HY000: Received an invalid value '0' for a UNIX timestamp.
 
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
 
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;
 
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;
 
39
insert into t1 set a=default,t=default,c=default,i=default;
 
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
 
44
4       0       a       5
 
45
5       0       a       NULL
 
46
6       0       hello   NULL
 
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));
 
59
insert into t2 (t2) select distinct substring(email, locate('@', email)+1) from t1;
 
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;
 
80
select count(*) from t2;
 
81
count(*)
 
82
25500
 
83
drop table t1,t2,t3;
 
84
create table t1 (a int, b int);
 
85
insert into t1 (a,b) values (a,b);
 
86
insert into t1 SET a=1, b=a+1;
 
87
insert into t1 (a,b) select 1,2;
 
88
INSERT INTO t1 ( a ) SELECT 0 ON DUPLICATE KEY UPDATE a = a + VALUES (a);
 
89
replace into t1 (a,a) select 100, 'hundred';
 
90
ERROR 42000: Column 'a' specified twice
 
91
insert into t1 (a,b,b) values (1,1,1);
 
92
ERROR 42000: Column 'b' specified twice
 
93
insert into t1 (a,a) values (1,1,1);
 
94
ERROR 21S01: Column count doesn't match value count at row 1
 
95
insert into t1 (a,a) values (1,1);
 
96
ERROR 42000: Column 'a' specified twice
 
97
insert into t1 SET a=1,b=2,a=1;
 
98
ERROR 42000: Column 'a' specified twice
 
99
insert into t1 (b,b) select 1,2;
 
100
ERROR 42000: Column 'b' specified twice
 
101
INSERT INTO t1 (b,b) SELECT 0,0 ON DUPLICATE KEY UPDATE a = a + VALUES (a);
 
102
ERROR 42000: Column 'b' specified twice
 
103
drop table t1;
 
104
create table t1 (id int primary key, data int);
 
105
insert into t1 values (1, 1), (2, 2), (3, 3);
 
106
select row_count();
 
107
row_count()
 
108
3
 
109
insert ignore into t1 values (1, 1);
 
110
select row_count();
 
111
row_count()
 
112
0
 
113
replace into t1 values (1, 11);
 
114
select row_count();
 
115
row_count()
 
116
2
 
117
replace into t1 values (4, 4);
 
118
select row_count();
 
119
row_count()
 
120
1
 
121
insert into t1 values (2, 2) on duplicate key update data= data + 10;
 
122
select row_count();
 
123
row_count()
 
124
2
 
125
insert into t1 values (5, 5) on duplicate key update data= data + 10;
 
126
select row_count();
 
127
row_count()
 
128
1
 
129
drop table t1;
 
130
create table t1 (id int primary key auto_increment, data int, unique(data));
 
131
insert ignore into t1 values(NULL,100),(NULL,110),(NULL,120);
 
132
insert ignore into t1 values(NULL,10),(NULL,20),(NULL,110),(NULL,120),(NULL,100),(NULL,90);
 
133
insert ignore into t1 values(NULL,130),(NULL,140),(500,110),(550,120),(450,100),(NULL,150);
 
134
select * from t1 order by id;
 
135
id      data
 
136
1       100
 
137
2       110
 
138
3       120
 
139
4       10
 
140
5       20
 
141
6       90
 
142
7       130
 
143
8       140
 
144
551     150
 
145
drop table t1;
 
146
CREATE TABLE t1 (
 
147
a char(20) NOT NULL,
 
148
b char(7) DEFAULT NULL,
 
149
c char(4) DEFAULT NULL
 
150
);
 
151
INSERT INTO t1(a,b,c) VALUES (9.999999e+0, 9.999999e+0, 9.999e+0);
 
152
INSERT INTO t1(a,b) VALUES (1.225e-04, 1.225e-04);
 
153
INSERT INTO t1(a,b) VALUES (1.225e-01, 1.225e-01);
 
154
INSERT INTO t1(a,b) VALUES (1.225877e-01, 1.225877e-01);
 
155
INSERT INTO t1(a,b) VALUES (1.225e+01, 1.225e+01);
 
156
INSERT INTO t1(a,b,c) VALUES (1.225e+01, 1.225e+01, 1.225e+01);
 
157
INSERT INTO t1(a,b) VALUES (1.225e+05, 1.225e+05);
 
158
INSERT INTO t1(a,b) VALUES (1.225e+10, 1.225e+10);
 
159
INSERT INTO t1(a,b) VALUES (1.225e+15, 1.225e+15);
 
160
INSERT INTO t1(a,b) VALUES (5000000e+0, 5000000e+0);
 
161
INSERT INTO t1(a,b) VALUES (1.25e+78, 1.25e+78);
 
162
INSERT INTO t1(a,b) VALUES (1.25e-94, 1.25e-94);
 
163
INSERT INTO t1(a,b) VALUES (1.25e+203, 1.25e+203);
 
164
INSERT INTO t1(a,b) VALUES (1.25e-175, 1.25e-175);
 
165
INSERT INTO t1(a,c) VALUES (1.225e+0, 1.225e+0);
 
166
INSERT INTO t1(a,c) VALUES (1.37e+0, 1.37e+0);
 
167
INSERT INTO t1(a,c) VALUES (-1.37e+0, -1.37e+0);
 
168
INSERT INTO t1(a,c) VALUES (-1.87e-2, -1.87e-2);
 
169
INSERT INTO t1(a,c) VALUES (5000e+0, 5000e+0);
 
170
INSERT INTO t1(a,c) VALUES (-5000e+0, -5000e+0);
 
171
SELECT * FROM t1;
 
172
a       b       c
 
173
9.999999        10      10
 
174
0.0001225       1.22e-4 NULL
 
175
0.1225  0.1225  NULL
 
176
0.1225877       0.12259 NULL
 
177
12.25   12.25   NULL
 
178
12.25   12.25   12.2
 
179
122500  122500  NULL
 
180
12250000000     1.22e10 NULL
 
181
1.225e15        1.22e15 NULL
 
182
5000000 5000000 NULL
 
183
1.25e78 1.25e78 NULL
 
184
1.25e-94        1.2e-94 NULL
 
185
1.25e203        1.2e203 NULL
 
186
1.25e-175       1e-175  NULL
 
187
1.225   NULL    1.23
 
188
1.37    NULL    1.37
 
189
-1.37   NULL    -1.4
 
190
-0.0187 NULL    0
 
191
5000    NULL    5000
 
192
-5000   NULL    -5e3
 
193
DROP TABLE t1;
 
194
CREATE TABLE t1 (
 
195
a char(20) NOT NULL,
 
196
b char(7) DEFAULT NULL,
 
197
c char(5)
 
198
);
 
199
INSERT INTO t1(a,b,c) VALUES (9.999999e+0, 9.999999e+0, 9.999e+0);
 
200
INSERT INTO t1(a,b,c) VALUES (1.225e-05, 1.225e-05, 1.225e-05);
 
201
INSERT INTO t1(a,b) VALUES (1.225e-04, 1.225e-04);
 
202
INSERT INTO t1(a,b) VALUES (1.225e-01, 1.225e-01);
 
203
INSERT INTO t1(a,b) VALUES (1.225877e-01, 1.225877e-01);
 
204
INSERT INTO t1(a,b) VALUES (1.225e+01, 1.225e+01);
 
205
INSERT INTO t1(a,b,c) VALUES (1.225e+01, 1.225e+01, 1.225e+01);
 
206
INSERT INTO t1(a,b) VALUES (1.225e+05, 1.225e+05);
 
207
INSERT INTO t1(a,b) VALUES (1.225e+10, 1.225e+10);
 
208
INSERT INTO t1(a,b) VALUES (1.225e+15, 1.225e+15);
 
209
INSERT INTO t1(a,b) VALUES (5000000e+0, 5000000e+0);
 
210
INSERT INTO t1(a,b) VALUES (1.25e+78, 1.25e+78);
 
211
INSERT INTO t1(a,b) VALUES (1.25e-94, 1.25e-94);
 
212
INSERT INTO t1(a,b) VALUES (1.25e+203, 1.25e+203);
 
213
INSERT INTO t1(a,b) VALUES (1.25e-175, 1.25e-175);
 
214
INSERT INTO t1(a,c) VALUES (1.225e+0, 1.225e+0);
 
215
INSERT INTO t1(a,c) VALUES (1.37e+0, 1.37e+0);
 
216
INSERT INTO t1(a,c) VALUES (-1.37e+0, -1.37e+0);
 
217
INSERT INTO t1(a,c) VALUES (1.87e-3, 1.87e-3);
 
218
INSERT INTO t1(a,c) VALUES (-1.87e-2, -1.87e-2);
 
219
INSERT INTO t1(a,c) VALUES (5000e+0, 5000e+0);
 
220
INSERT INTO t1(a,c) VALUES (-5000e+0, -5000e+0);
 
221
SELECT * FROM t1;
 
222
a       b       c
 
223
9.999999        10      9.999
 
224
0.00001225      1.22e-5 1e-5
 
225
0.0001225       1.22e-4 NULL
 
226
0.1225  0.1225  NULL
 
227
0.1225877       0.12259 NULL
 
228
12.25   12.25   NULL
 
229
12.25   12.25   12.25
 
230
122500  122500  NULL
 
231
12250000000     1.22e10 NULL
 
232
1.225e15        1.22e15 NULL
 
233
5000000 5000000 NULL
 
234
1.25e78 1.25e78 NULL
 
235
1.25e-94        1.2e-94 NULL
 
236
1.25e203        1.2e203 NULL
 
237
1.25e-175       1e-175  NULL
 
238
1.225   NULL    1.225
 
239
1.37    NULL    1.37
 
240
-1.37   NULL    -1.37
 
241
0.00187 NULL    0.002
 
242
-0.0187 NULL    -0.02
 
243
5000    NULL    5000
 
244
-5000   NULL    -5000
 
245
DROP TABLE t1;
 
246
CREATE TABLE t (a CHAR(10),b INT);
 
247
INSERT INTO t VALUES (),(),();
 
248
INSERT INTO t(a) SELECT rand() FROM t;
 
249
DROP TABLE t;
 
250
CREATE TABLE t1 (c1 INT NOT NULL);
 
251
INSERT INTO t1 VALUES(4188.32999999999992724042385816574096679687500),
 
252
('4188.32999999999992724042385816574096679687500'), (4188);
 
253
SELECT * FROM t1;
 
254
c1
 
255
4188
 
256
4188
 
257
4188
 
258
CREATE TABLE t2 (c1 BIGINT);
 
259
INSERT INTO t2 VALUES('15449237462.0000000000');
 
260
SELECT * FROM t2;
 
261
c1
 
262
15449237462
 
263
DROP TABLE t1, t2;
 
264
End of 5.0 tests.