sql-migrate icon indicating copy to clipboard operation
sql-migrate copied to clipboard

Postgres COPY command

Open fdelbos opened this issue 7 years ago • 0 comments

Hi, I need to populate the database with some data and I since i can have thousands upon thousands of rows I use the copy statement like this:

-- +migrate Up

-- +migrate StatementBegin
COPY clients.business_types (id, label) FROM stdin delimiter ',';
ASS,Association
EARL,Entreprise agricole à responsabilité limitée
\.
-- +migrate StatementEnd

-- +migrate Down

but it failed with the following error :

postgres_1  | 2018-03-10 13:39:25.151 UTC [668] ERROR:  syntax error at or near "ASS" at character 68
postgres_1  | 2018-03-10 13:39:25.151 UTC [668] 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  | 	\.

fdelbos avatar Mar 10 '18 13:03 fdelbos