Postgres COPY command
Open
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 3.4k
- Forks
- 292
- PR merge metrics
- No merged PRs in 30d
Description
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 | \.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the migration shown in the issue against PostgreSQL and inspect how sql-migrate executes COPY statements containing stdin data. Confirm the intended handling with maintainers, then verify that the migration succeeds and its down migration remains valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, postgresql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100