pgloader/test/csv-header.load
Dimitri Fontaine 38712d98e0 Fix regression testing.
Previous patch made regression failures obvious that were hidden by strange
bugs with CCL.

One such regression was introduced in commit
ab7e77c2d0 where we played with the complex
code generation for field projection, where the following two cases weren't
cleanly processed anymore:

  column text using "constant"
  column text using "field-name"

In the first case we want to load a user-defined constant in the column, in
the second case we want to load the value of the field "field-name" in the
column --- we just have different source and target names.

Another regression was introduced in the recent commit
01e5c23763 where the create-table function was
called too early, before we have fetched *pgsql-reserved-keywords*. As a
consequence table names weren't always properly quoted as shown in the
test/csv-header.load file which targets a table named "group".

Finally, skip the test/dbf.load regression test when using CCL as this
environment doesn't have the necessary CP850 code page / encoding.
2017-09-09 00:51:07 +02:00

26 lines
546 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 text
)
$$;
somefields,rekplcode,repl$grpid,repl$id,another,fields
a,b,c,d,e,f
foo,bar,baz,quux,foobar,fizzbuzz