pgloader/test/csv-filename-pattern.load
Dimitri Fontaine 2dc733c4d6 Fix corner case in creating indexes again.
When the option "drop indexes" is in use in loading data from a file, we
collect the indexes from the PostgreSQL catalogs and then issue DROP
commands against them before the load, then CREATE commands when it's
done.

The CREATE is done in parallel, and we create an lparallel kernel for
that. The kernel must have a worker-count of at least 1, and we where
not considering the case of 0 indexes on the target table.

Fix #484.
2016-11-20 17:17:15 +01:00

18 lines
478 B
Fish

load csv
from all filenames matching ~<matching.*csv$>
in directory 'data'
having fields (id, field)
into postgres:///pgloader?matching
with fields optionally enclosed by '"',
fields terminated by ',',
truncate,
disable triggers,
drop indexes
-- workers = 8,
-- concurrency = 1
before load do
$$ drop table if exists matching; $$,
$$ create table matching(id int, field text); $$;