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.
This commit is contained in:
Dimitri Fontaine 2017-03-04 15:51:34 +01:00
parent 3fac222432
commit ab7e77c2d0
2 changed files with 5 additions and 6 deletions

View File

@ -107,8 +107,7 @@
;; we expect the name of a COLUMN to be the same
;; as the name of its derived FIELD when we
;; don't have any transformation function
(or fn `(funcall ,(process-field name)
,(field-name-as-symbol name))))))
(or fn (field-name-as-symbol name)))))
`(lambda (row)
(declare (optimize speed) (type list row))
(destructuring-bind (&optional ,@args &rest extra) row

View File

@ -2,7 +2,7 @@ LOAD CSV
FROM inline
(
"row num",
ts [date format 'YYYY-MM-DD HH24-MI-SS.US'],
ts [date format 'MM-DD-YYYY HH24-MI-SS.US'],
hr [date format 'HH24:MI.SS']
)
INTO postgresql:///pgloader?dateformat ("row num", ts, hr)
@ -25,6 +25,6 @@ LOAD CSV
);
$$;
1,1999-10-02 00-33-12.123456,"00:05.02"
2,2014-10-02 00-33-13.123,"18:25.52"
3,2014-10-02 00-33-14.1234,13:14.15
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