1
1
drop table if exists t1, t2;
2
2
create table t1 (a date, b date, c date not null, d date);
3
3
load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',';
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
4
11
load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
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
10
19
load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
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
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
16
31
create table t1 (a text, b text);
17
32
load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
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'
40
|Field 5' ,'Field 6| NULL
23
41
|Field 6| | 'Field 7'|
25
43
create table t1 (a int, b char(10));
26
44
load data infile '../std_data_ln/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
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
58
load data infile '../std_data_ln/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
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
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);
79
SET @@SQL_MODE=@OLD_SQL_MODE;
36
81
create table t1 (a varchar(20), b varchar(20));
37
82
load data infile '../std_data_ln/loaddata_dq.dat' into table t1 fields terminated by ',' enclosed by '"' escaped by '"' (a,b);
158
212
ERROR HY000: Variable 'secure_file_priv' is a read only variable
159
213
truncate table t1;
160
214
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
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;
164
218
select load_file("DRIZZLE_TEST_DIR/t/loaddata.test");
165
219
load_file("DRIZZLE_TEST_DIR/t/loaddata.test")
167
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);
229
SET @@SQL_MODE=@OLD_SQL_MODE;
168
231
create table t1(f1 int, f2 timestamp not null default current_timestamp);
169
232
create table t2(f1 int);
170
233
insert into t2 values(1),(2);
171
ERROR 01000: Row 1 doesn't contain data for all columns
172
select f1 from t1 where f2 IS NOT NULL order by f1;
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;
175
ERROR 01000: Row 1 doesn't contain data for all columns
176
select f1 from t1 where f2 IS NOT NULL order by f1;
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;
178
249
drop table t1,t2;
179
250
CREATE TABLE t1 (c1 INT, c2 TIMESTAMP, c3 REAL, c4 DOUBLE);
180
251
INSERT INTO t1 (c1, c2, c3, c4) VALUES (10, '1970-02-01 01:02:03', 1.1E-100, 1.1E+100);
190
262
10 1970-02-01 01:02:03 1.1e-100 1.1e100
266
# -- Bug#35469: server crash with LOAD DATA INFILE to a VIEW.
269
DROP TABLE IF EXISTS t1;
270
DROP VIEW IF EXISTS v1;
271
DROP VIEW IF EXISTS v2;
272
DROP VIEW IF EXISTS v3;
274
CREATE TABLE t1(c1 INT, c2 VARCHAR(255));
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;
280
LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v1
281
FIELDS ESCAPED BY '\\'
284
LINES TERMINATED BY '\n' (c1, c2);
300
LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v2
301
FIELDS ESCAPED BY '\\'
304
LINES TERMINATED BY '\n' (c1, c2);
320
LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v2
321
FIELDS ESCAPED BY '\\'
324
LINES TERMINATED BY '\n' (c0, c2);
325
ERROR HY000: Invalid column reference (v2.c0) in LOAD DATA
327
LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v3
328
FIELDS ESCAPED BY '\\'
331
LINES TERMINATED BY '\n' (d1, d2);
332
ERROR HY000: The target table v3 of the LOAD is not updatable
339
# -- End of Bug#35469.
340
CREATE TABLE t1 (a int);
341
INSERT INTO t1 VALUES (1);
343
SET character_set_filesystem=filename;
344
select @@character_set_filesystem;
345
@@character_set_filesystem
347
SELECT * INTO OUTFILE 't-1' FROM t1;
349
LOAD DATA INFILE 't-1' INTO TABLE t1;
354
SET character_set_filesystem=latin1;
355
select @@character_set_filesystem;
356
@@character_set_filesystem
358
LOAD DATA INFILE 't@002d1' INTO TABLE t1;
363
SET character_set_filesystem=default;
364
select @@character_set_filesystem;
365
@@character_set_filesystem