~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysql-test/r/loaddata.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
1
drop table if exists t1, t2;
2
2
create table t1 (a date, b date, c date not null, d date);
3
 
load data infile 'DRIZZLETEST_VARDIR/std_data_ln/loaddata1.dat' into table t1 fields terminated by ',';
4
 
load data infile 'DRIZZLETEST_VARDIR/std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
 
3
load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',';
 
4
Warnings:
 
5
Warning 1265    Data truncated for column 'a' at row 1
 
6
Warning 1265    Data truncated for column 'c' at row 1
 
7
Warning 1265    Data truncated for column 'd' at row 1
 
8
Warning 1265    Data truncated for column 'a' at row 2
 
9
Warning 1265    Data truncated for column 'b' at row 2
 
10
Warning 1265    Data truncated for column 'd' at row 2
 
11
load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
5
12
SELECT * from t1;
6
13
a       b       c       d
7
 
2003-02-03      2003-02-03      2003-02-03      NULL
 
14
0000-00-00      NULL    0000-00-00      0000-00-00
 
15
0000-00-00      0000-00-00      0000-00-00      0000-00-00
 
16
2003-03-03      2003-03-03      2003-03-03      NULL
8
17
2003-03-03      2003-03-03      2003-03-03      NULL
9
18
truncate table t1;
10
 
load data infile 'DRIZZLETEST_VARDIR/std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
 
19
load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
 
20
Warnings:
 
21
Warning 1265    Data truncated for column 'c' at row 1
 
22
Warning 1265    Data truncated for column 'd' at row 1
 
23
Warning 1265    Data truncated for column 'b' at row 2
 
24
Warning 1265    Data truncated for column 'd' at row 2
11
25
SELECT * from t1;
12
26
a       b       c       d
13
 
NULL    2003-02-03      2003-02-03      NULL
 
27
NULL    NULL    0000-00-00      0000-00-00
 
28
NULL    0000-00-00      0000-00-00      0000-00-00
14
29
NULL    2003-03-03      2003-03-03      NULL
15
30
drop table t1;
16
31
create table t1 (a text, b text);
17
 
load data infile 'DRIZZLETEST_VARDIR/std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
 
32
load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
 
33
Warnings:
 
34
Warning 1261    Row 3 doesn't contain data for all columns
18
35
select concat('|',a,'|'), concat('|',b,'|') from t1;
19
36
concat('|',a,'|')       concat('|',b,'|')
20
37
|Field A|       |Field B|
21
38
|Field 1|       |Field 2' 
22
 
'Field 5' ,'Field 6|
 
39
Field 3,'Field 4|
 
40
|Field 5' ,'Field 6|    NULL
23
41
|Field 6|       | 'Field 7'|
24
42
drop table t1;
25
43
create table t1 (a int, b char(10));
26
 
load data infile 'DRIZZLETEST_VARDIR/std_data_ln/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
 
44
load data infile '../std_data_ln/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
 
45
Warnings:
 
46
Warning 1366    Incorrect integer value: 'error      ' for column 'a' at row 3
 
47
Warning 1262    Row 3 was truncated; it contained more data than there were input columns
 
48
Warning 1366    Incorrect integer value: 'wrong end  ' for column 'a' at row 5
 
49
Warning 1262    Row 5 was truncated; it contained more data than there were input columns
27
50
select * from t1;
28
51
a       b
29
 
1       row 1     
30
 
2       row 2     
31
 
3       row 3     
 
52
1       row 1
 
53
2       row 2
 
54
0       1234567890
 
55
3       row 3
 
56
0       1234567890
32
57
truncate table t1;
 
58
load data infile '../std_data_ln/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
 
59
Warnings:
 
60
Warning 1366    Incorrect integer value: '
 
61
' for column 'a' at row 4
 
62
Warning 1261    Row 4 doesn't contain data for all columns
33
63
select * from t1;
34
64
a       b
 
65
1       row 1
 
66
2       row 2
 
67
3       row 3
 
68
0       
 
69
drop table t1;
 
70
SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
 
71
create table t1(id integer not null auto_increment primary key);
 
72
insert into t1 values(0);
 
73
select * from t1;
 
74
id
 
75
0
 
76
select * from t1;
 
77
id
 
78
0
 
79
SET @@SQL_MODE=@OLD_SQL_MODE;
35
80
drop table t1;
36
81
create table t1 (a varchar(20), b varchar(20));
37
 
load data infile 'DRIZZLETEST_VARDIR/std_data_ln/loaddata_dq.dat' into table t1 fields terminated by ',' enclosed by '"' escaped by '"' (a,b);
 
82
load data infile '../std_data_ln/loaddata_dq.dat' into table t1 fields terminated by ',' enclosed by '"' escaped by '"' (a,b);
38
83
select * from t1;
39
84
a       b
40
85
field1  field2
72
117
14      .rr.
73
118
15      .rrr.
74
119
16      .rrrr.
75
 
SELECT * INTO OUTFILE 'DRIZZLETEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY 'r' FROM t1;
 
120
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY 'r' FROM t1;
76
121
r1r     rrrr
77
122
r2r     rrrrrr
78
123
r3r     rrrrrrrr
89
134
r14r    r.rrrr.r
90
135
r15r    r.rrrrrr.r
91
136
r16r    r.rrrrrrrr.r
92
 
LOAD DATA INFILE 'DRIZZLETEST_VARDIR/tmp/t1' INTO TABLE t2 FIELDS ENCLOSED BY 'r';
 
137
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1' INTO TABLE t2 FIELDS ENCLOSED BY 'r';
93
138
SELECT t1.id, c1, c2 FROM t1 LEFT  JOIN t2 ON t1.id=t2.id WHERE c1 != c2;
94
139
id      c1      c2
95
140
SELECT t1.id, c1, c2 FROM t1 RIGHT JOIN t2 ON t1.id=t2.id WHERE c1 != c2;
96
141
id      c1      c2
97
142
DROP TABLE t1,t2;
98
143
create table t1 (a int default 100, b int, c varchar(60));
99
 
load data infile 'DRIZZLETEST_VARDIR/std_data_ln/rpl_loaddata.dat' into table t1 (a, @b) set b=@b+10, c=concat("b=",@b);
 
144
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (a, @b) set b=@b+10, c=concat("b=",@b);
100
145
select * from t1;
101
146
a       b       c
102
147
NULL    20      b=10
103
148
NULL    25      b=15
104
149
truncate table t1;
105
 
load data infile 'DRIZZLETEST_VARDIR/std_data_ln/rpl_loaddata.dat' into table t1 (a, @b) set c= if(a is null,"oops",a);
 
150
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (a, @b) set c= if(a is null,"oops",a);
106
151
select * from t1;
107
152
a       b       c
108
153
NULL    NULL    oops
109
154
NULL    NULL    oops
110
155
truncate table t1;
111
156
set @c:=123;
112
 
load data infile 'DRIZZLETEST_VARDIR/std_data_ln/rpl_loaddata.dat' into table t1 (@a, b) set c= if(@a is null,@c,b);
 
157
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@a, b) set c= if(@a is null,@c,b);
113
158
select * from t1;
114
159
a       b       c
115
160
100     10      123
116
161
100     15      123
117
 
load data infile 'DRIZZLETEST_VARDIR/std_data_ln/rpl_loaddata.dat' into table t1 (@a, @b);
 
162
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@a, @b);
118
163
select * from t1;
119
164
a       b       c
120
165
100     10      123
125
170
@a      @b
126
171
NULL    15
127
172
truncate table t1;
128
 
load data infile 'DRIZZLETEST_VARDIR/std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c="Wow";
 
173
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 set c=b;
 
174
Warnings:
 
175
Warning 1261    Row 1 doesn't contain data for all columns
 
176
Warning 1261    Row 2 doesn't contain data for all columns
 
177
select * from t1;
 
178
a       b       c
 
179
NULL    10      10
 
180
NULL    15      15
 
181
truncate table t1;
 
182
load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c="Wow";
129
183
select * from t1;
130
184
a       b       c
131
185
1       2       Wow
132
186
3       4       Wow
133
187
5       6       Wow
134
188
truncate table t1;
135
 
load data infile 'DRIZZLETEST_VARDIR/std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c=concat(a,"+",b,"+",@c,"+",b,"+",if(c is null,"NIL",c));
 
189
load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c=concat(a,"+",b,"+",@c,"+",b,"+",if(c is null,"NIL",c));
136
190
select * from t1;
137
191
a       b       c
138
192
1       2       1+2+123+2+NIL
139
193
3       4       3+4+123+4+NIL
140
194
5       6       5+6+123+6+NIL
141
 
load data infile 'DRIZZLETEST_VARDIR/std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, @b);
 
195
load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, @b);
142
196
ERROR HY000: Can't load value from file with fixed size rows to variable
143
197
create table t2 (num int primary key, str varchar(10));
144
198
insert into t2 values (10,'Ten'), (15,'Fifteen');
145
199
truncate table t1;
146
 
load data infile 'DRIZZLETEST_VARDIR/std_data_ln/rpl_loaddata.dat' into table t1 (@dummy,@n) set a= @n, c= (select str from t2 where num=@n);
 
200
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@dummy,@n) set a= @n, c= (select str from t2 where num=@n);
147
201
select * from t1;
148
202
a       b       c
149
203
10      NULL    Ten
150
 
15      NULL    Ten
 
204
15      NULL    Fifteen
151
205
show variables like "secure_file_pri%";
152
206
Variable_name   Value
153
 
secure_file_priv        DRIZZLETEST_VARDIR
 
207
secure_file_priv        MYSQLTEST_VARDIR/
154
208
select @@secure_file_priv;
155
209
@@secure_file_priv
156
 
DRIZZLETEST_VARDIR
 
210
MYSQLTEST_VARDIR/
157
211
set @@secure_file_priv= 0;
158
212
ERROR HY000: Variable 'secure_file_priv' is a read only variable
159
213
truncate table t1;
160
 
load data infile 'DRIZZLE_TEST_DIR/t/loaddata.test' into table t1;
161
 
ERROR HY000: The Drizzle server is running with the --secure-file-priv option so it cannot execute this statement
 
214
load data infile 'MYSQL_TEST_DIR/t/loaddata.test' into table t1;
 
215
ERROR HY000: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
162
216
select * from t1;
163
217
a       b       c
164
 
select load_file("DRIZZLE_TEST_DIR/t/loaddata.test");
165
 
ERROR HY000: The Drizzle server is running with the --secure-file-priv option so it cannot execute this statement
 
218
select load_file("MYSQL_TEST_DIR/t/loaddata.test");
 
219
load_file("MYSQL_TEST_DIR/t/loaddata.test")
 
220
NULL
166
221
drop table t1, t2;
 
222
create table t1(f1 int);
 
223
insert into t1 values(1),(null);
 
224
create table t2(f2 int auto_increment primary key);
 
225
select * from t2;
 
226
f2
 
227
1
 
228
2
 
229
SET @@SQL_MODE=@OLD_SQL_MODE;
 
230
drop table t1,t2;
167
231
create table t1(f1 int, f2 timestamp not null default current_timestamp);
168
232
create table t2(f1 int);
169
233
insert into t2 values(1),(2);
170
 
ERROR 01000: Row 1 doesn't contain data for all columns
171
 
select f1 from t1 where f2 IS NOT NULL order by f1;
 
234
Warnings:
 
235
Warning 1261    Row 1 doesn't contain data for all columns
 
236
Warning 1261    Row 2 doesn't contain data for all columns
 
237
select f1 from t1 where f2 <> '0000-00-00 00:00:00' order by f1;
172
238
f1
 
239
1
 
240
2
173
241
delete from t1;
174
 
ERROR 01000: Row 1 doesn't contain data for all columns
175
 
select f1 from t1 where f2 IS NOT NULL order by f1;
 
242
Warnings:
 
243
Warning 1261    Row 1 doesn't contain data for all columns
 
244
Warning 1261    Row 2 doesn't contain data for all columns
 
245
select f1 from t1 where f2 <> '0000-00-00 00:00:00' order by f1;
176
246
f1
 
247
1
 
248
2
177
249
drop table t1,t2;
178
250
CREATE TABLE t1 (c1 INT, c2 TIMESTAMP, c3 REAL, c4 DOUBLE);
179
251
INSERT INTO t1 (c1, c2, c3, c4) VALUES (10, '1970-02-01 01:02:03', 1.1E-100, 1.1E+100);
180
252
SELECT * FROM t1;
181
253
c1      c2      c3      c4
182
254
10      1970-02-01 01:02:03     1.1e-100        1.1e100
183
 
SELECT * INTO OUTFILE 'DRIZZLETEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY '-' FROM t1;
 
255
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY '-' FROM t1;
 
256
-10-    -1970\-02\-01 01:02:03- -1.1e\-100-     -1.1e100-
184
257
EOF
185
258
TRUNCATE t1;
186
 
LOAD DATA INFILE 'DRIZZLETEST_VARDIR/tmp/t1' INTO TABLE t1 FIELDS ENCLOSED BY '-';
 
259
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1' INTO TABLE t1 FIELDS ENCLOSED BY '-';
187
260
SELECT * FROM t1;
188
261
c1      c2      c3      c4
189
262
10      1970-02-01 01:02:03     1.1e-100        1.1e100
190
263
DROP TABLE t1;
 
264
 
 
265
# --
 
266
# -- Bug#35469: server crash with LOAD DATA INFILE to a VIEW.
 
267
# --
 
268
 
 
269
DROP TABLE IF EXISTS t1;
 
270
DROP VIEW IF EXISTS v1;
 
271
DROP VIEW IF EXISTS v2;
 
272
DROP VIEW IF EXISTS v3;
 
273
 
 
274
CREATE TABLE t1(c1 INT, c2 VARCHAR(255));
 
275
 
 
276
CREATE VIEW v1 AS SELECT * FROM t1;
 
277
CREATE VIEW v2 AS SELECT 1 + 2 AS c0, c1, c2 FROM t1;
 
278
CREATE VIEW v3 AS SELECT 1 AS d1, 2 AS d2;
 
279
 
 
280
LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v1
 
281
FIELDS ESCAPED BY '\\'
 
282
  TERMINATED BY ','
 
283
  ENCLOSED BY '"'
 
284
  LINES TERMINATED BY '\n' (c1, c2);
 
285
 
 
286
SELECT * FROM t1;
 
287
c1      c2
 
288
1        "string1"
 
289
2        "string2"
 
290
3        "string3"
 
291
 
 
292
SELECT * FROM v1;
 
293
c1      c2
 
294
1        "string1"
 
295
2        "string2"
 
296
3        "string3"
 
297
 
 
298
DELETE FROM t1;
 
299
 
 
300
LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v2
 
301
FIELDS ESCAPED BY '\\'
 
302
  TERMINATED BY ','
 
303
  ENCLOSED BY '"'
 
304
  LINES TERMINATED BY '\n' (c1, c2);
 
305
 
 
306
SELECT * FROM t1;
 
307
c1      c2
 
308
1        "string1"
 
309
2        "string2"
 
310
3        "string3"
 
311
 
 
312
SELECT * FROM v2;
 
313
c0      c1      c2
 
314
3       1        "string1"
 
315
3       2        "string2"
 
316
3       3        "string3"
 
317
 
 
318
DELETE FROM t1;
 
319
 
 
320
LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v2
 
321
FIELDS ESCAPED BY '\\'
 
322
  TERMINATED BY ','
 
323
  ENCLOSED BY '"'
 
324
  LINES TERMINATED BY '\n' (c0, c2);
 
325
ERROR HY000: Invalid column reference (v2.c0) in LOAD DATA
 
326
 
 
327
LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v3
 
328
FIELDS ESCAPED BY '\\'
 
329
  TERMINATED BY ','
 
330
  ENCLOSED BY '"'
 
331
  LINES TERMINATED BY '\n' (d1, d2);
 
332
ERROR HY000: The target table v3 of the LOAD is not updatable
 
333
 
 
334
DROP TABLE t1;
 
335
DROP VIEW v1;
 
336
DROP VIEW v2;
 
337
DROP VIEW v3;
 
338
 
 
339
# -- End of Bug#35469.
 
340
CREATE TABLE t1 (a int);
 
341
INSERT INTO t1 VALUES (1);
 
342
SET NAMES latin1;
 
343
SET character_set_filesystem=filename;
 
344
select @@character_set_filesystem;
 
345
@@character_set_filesystem
 
346
filename
 
347
SELECT * INTO OUTFILE 't-1' FROM t1;
 
348
DELETE FROM t1;
 
349
LOAD DATA INFILE 't-1' INTO TABLE t1;
 
350
SELECT * FROM t1;
 
351
a
 
352
1
 
353
DELETE FROM t1;
 
354
SET character_set_filesystem=latin1;
 
355
select @@character_set_filesystem;
 
356
@@character_set_filesystem
 
357
latin1
 
358
LOAD DATA INFILE 't@002d1' INTO TABLE t1;
 
359
SELECT * FROM t1;
 
360
a
 
361
1
 
362
DROP TABLE t1;
 
363
SET character_set_filesystem=default;
 
364
select @@character_set_filesystem;
 
365
@@character_set_filesystem
 
366
binary