pgloader/test/csv-parse-date.load
Dimitri Fontaine ab7e77c2d0 Fix double transformation call in CSV projections.
In advanced projections it could be that we call the transformation function
for some input fields twice. This is a bug that manifest in particular when
the output of the transformation can't be used/parsed again by the same
function as shown in the bug reported.

Fix #523.
2017-03-04 15:55:08 +01:00

31 lines
804 B
Fish

LOAD CSV
FROM inline
(
"row num",
ts [date format 'MM-DD-YYYY HH24-MI-SS.US'],
hr [date format 'HH24:MI.SS']
)
INTO postgresql:///pgloader?dateformat ("row num", ts, hr)
WITH truncate,
fields optionally enclosed by '"',
fields escaped by double-quote,
fields terminated by ','
SET timezone to 'Europe/Paris',
work_mem to '12MB',
standard_conforming_strings to 'on'
BEFORE LOAD DO
$$ drop table if exists dateformat; $$,
$$ create table dateformat (
"row num" smallint,
ts timestamptz,
hr time
);
$$;
1,10-02-1999 00-33-12.123456,"00:05.02"
2,10-02-2014 00-33-13.123,"18:25.52"
3,10-02-2014 00-33-14.1234,13:14.15