dbmate
dbmate copied to clipboard
Postgres COPY command not supported
trafficstars
Hi, I have the following migration :
-- migrate:up
COPY clients.business_types (id, label) FROM stdin delimiter ',';
ASS,Association
EARL,Entreprise agricole à responsabilité limitée
\.
-- migrate:down
I cant apply it, it gives me the following error :
postgres_1 | 2018-03-10 14:37:22.868 UTC [837] ERROR: syntax error at or near "ASS" at character 68
postgres_1 | 2018-03-10 14:37:22.868 UTC [837] STATEMENT:
postgres_1 | COPY clients.business_types (id, label) FROM stdin delimiter ',';
postgres_1 | ASS,Association
postgres_1 | EARL,Entreprise agricole à responsabilité limitée
postgres_1 | \.
Interesting bug, I managed to replicate this. It looks like this is a bug/missing feature in the golang postgres library we use (https://github.com/lib/pq/issues/213).
I'm not sure if there is a good quick fix for this, so for now I would recommend using bulk insert.