mirror of
https://github.com/dimitri/pgloader.git
synced 2025-08-09 07:47:00 +02:00
PostgreSQL COPY format is not really CSV but something way easier to parse. Funnily enough, parsing it as CSV is not that easy, so we add here a special simple parser for the COPY format. It should be quite useful too try loading again reject data files from pgloader after manual fixing, too. It's still missing some documentation without any good excuse for that, will add soon.
29 lines
741 B
Fish
29 lines
741 B
Fish
LOAD COPY
|
|
FROM copy://./data/track.copy
|
|
(
|
|
trackid, track, album, media, genre, composer,
|
|
milliseconds, bytes, unitprice
|
|
)
|
|
INTO postgresql:///pgloader?track_full
|
|
|
|
WITH truncate
|
|
|
|
SET client_encoding to 'latin1',
|
|
work_mem to '14MB',
|
|
standard_conforming_strings to 'on'
|
|
|
|
BEFORE LOAD DO
|
|
$$ drop table if exists track_full; $$,
|
|
$$ create table track_full (
|
|
trackid bigserial,
|
|
track text,
|
|
album text,
|
|
media text,
|
|
genre text,
|
|
composer text,
|
|
milliseconds bigint,
|
|
bytes bigint,
|
|
unitprice numeric
|
|
);
|
|
$$;
|