1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
# name: test/sql/copy/csv/test_max_line_size.test_slow
# description: Test lines that exceed the maximum line size
# group: [csv]
statement ok
pragma enable_verification;
# generate CSV file with some long strings some exceeding the maximum line size
statement ok
CREATE TABLE test_base (a INT, b VARCHAR, c INT);
statement ok
INSERT INTO test_base VALUES
(10, REPEAT('a', 1504857), 20),
(10, REPEAT('a', 10485760), 20),
statement ok
COPY test_base TO '__TEST_DIR__/test.csv' (HEADER 0)
# value is too big for loading
statement ok
CREATE TABLE test (a INTEGER, b VARCHAR, c INTEGER);
# Error is thrown when line does not fit maximum lines size: note that it may not always throw for exceeding the line
# size by a small margin as the calculation is an estimate based on reads before parsing.
statement error
COPY test FROM '__TEST_DIR__/test.csv';
----
Possible Solution: Change the maximum length size, e.g., max_line_size=10485769
# we can override the max line size
statement ok
COPY test FROM '__TEST_DIR__/test.csv' (max_line_size 10485770);
# also in the read_csv call
statement ok
INSERT INTO test SELECT * FROM read_csv_auto('__TEST_DIR__/test.csv', max_line_size=10485770);
|