~linuxjedi/drizzle/trunk-bug-667053

« back to all changes in this revision

Viewing changes to mysql-test/r/insert.result

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

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