pgloader/test/csv-header.load
Dimitri Fontaine dae5dec03c Allow fields/columns projections when parsing header.
When using a CSV header, we might find fields in a different order than the
target table columns, and maybe not all of the fields are going to be read.
Take account of the header we read rather than expecting the header to look
like the target table definition.

Fix #888.
2019-01-15 22:39:08 +01:00

26 lines
542 B
Fish

LOAD CSV
FROM INLINE
INTO postgresql:///pgloader?"group"
WITH truncate,
fields terminated by ',',
csv header
BEFORE LOAD DO
$$ drop table if exists "group"; $$,
$$ CREATE TABLE "group"
(
somefields text,
rekplcode text,
"repl$grpid" text,
"repl$id" text,
another text,
fields integer
)
$$;
somefields,rekplcode,repl$grpid,repl$id,fields,another
a,b,c,d,1,e
foo,bar,baz,quux,2,foobar