pgloader/test/csv-non-printable.load
Dimitri Fontaine c2c98b8b42 Allow any character in a quoted CSV field name.
We used to force overly strict rules for a quoted field name in a CSV
load file, now accept any character but a quote to be part of the field
name.

Fixes #416.
2016-08-07 20:35:37 +02:00

33 lines
808 B
Fish
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

--
-- From https://github.com/dimitri/pgloader/issues/275
--
LOAD CSV
FROM inline with encoding 'LATIN1'
HAVING FIELDS ("Some-Field", c2, c3)
INTO postgresql:///pgloader?tab_csv
(
c1 text using "Some-Field", c2, c3
)
WITH truncate,
skip header = 0,
fields terminated by ',',
fields optionally enclosed by '"'
BEFORE LOAD DO
$$ drop table if exists tab_csv; $$,
$$ create table tab_csv
(c1 varchar(100),
c2 varchar(100),
c3 varchar(100));
$$
;
col1, 45, "005 45 works"
col1, 44, "006 44 Fails 0xa5"
col1, 45, "006 45 Fails 0xa6"
col1, "45", "006 45 Fails using escape 0xa6"
col1, 46, "006 46 Fails 0xa7"
col1, 47, "006 47 Fails 0xa8"
col1, 4T works, "006 followed by 4 works ? why"