Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COPY ... FROM stdin throws "missing data for column" error #1945

Closed
nireno opened this issue Mar 7, 2018 · 0 comments
Closed

COPY ... FROM stdin throws "missing data for column" error #1945

nireno opened this issue Mar 7, 2018 · 0 comments

Comments

@nireno
Copy link

@nireno nireno commented Mar 7, 2018

Which version and edition of Flyway are you using?

5.0.7

Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)

Command-line

Which database are you using (type & version)?

Postgres 9.5.11

Which operating system are you using?

Linux Mint 18.2 Sonya

What did you do?

On a fresh database I attempted to run flyway on a folder containing a single migration:
flyway -url=jdbc:postgresql://localhost:5432/mytest -user=myuser -password=mypass -locations=filesystem:/home/myuser/sql/migrations migrate

/home/myuser/sql/migrations/V1__initial_create:

CREATE TABLE test_table (
	id          SERIAL PRIMARY KEY,
	some_column TEXT
);

COPY test_table (id, some_column) FROM stdin;
1	
\.
What did you expect to see?

A "migration success" message.

What did you see instead?
ERROR: Migration of schema "public" to version 1 - initial create failed! Changes successfully rolled back.
ERROR: 
Migration V1__initial_create.sql failed
-----------------------------------------
SQL State  : 22P04
Error Code : 0
Message    : ERROR: missing data for column "some_column"
  Where: COPY test_table, line 1: "1"
Location   : /home/myuser/sql/migrations/V1__initial_create.sql (/home/myuser/sql/migrations/V1__initial_create.sql )
Line       : 6
Statement  : COPY test_table (id, some_column) FROM stdin;
1	
Other notes

Note that there is a trailing tab after the 1 in the COPY'd row. The migration seems to fail whenever the last row ends with a tab. The migration process succeeds if I add another that row does not end with a tab, like:

COPY test_table (id, some_column) FROM stdin;
1	
2	something
\.
@axelfontaine axelfontaine added this to the Flyway 5.1.0 milestone Mar 7, 2018
axelfontaine added a commit to flyway/flywaydb.org that referenced this issue Mar 14, 2018
dohrayme pushed a commit to dohrayme/flyway that referenced this issue Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.