You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the Bug
I'm trying to apply a migration with COPY ... FROM STDIN command inside and get a syntax error. But actually, there is no problem with SQL syntax, because I can apply the same migration manually or with other tools like FlyWay.
Steps to Reproduce
An environment described below present in this archive: test.tar.gz.
Put these migration files into sql folder near the docker-compose manifest:
1_schema.up.sql:
create table sample (
id int primary key,
text varchar(64) not null unique
);
2_data.up.sql:
COPY sample (id, text) FROM stdin;
10 Some text 1
20 Some text 2
30 Some text 3
\.
Run the docker-compose up -d command and see logs from the migrate container: docker-compose logs migrate and you will see the next error:
Attaching to migrate
migrate | 1/u schema (25.207327ms)
migrate | error: migration failed: syntax error at or near "10" (column 1) in line 2: COPY sample (id, text) FROM stdin;
migrate | 10 Some text 1
migrate | 20 Some text 2
migrate | 30 Some text 3
migrate | \.
migrate | (details: pq: syntax error at or near "10")
Expected Behavior
Migration file with COPY ... FROM STDIN should be applied successfully.
Migrate Version
v4.14.1
Loaded Source Drivers
go-bindata
godoc-vfs
gcs
file
bitbucket
github
github-ee
gitlab, s3
Loaded Database Drivers
mongodb
mysql
sqlserver
stub
clickhouse
crdb-postgres
firebird
postgresql
redshift
cassandra
postgres
cockroach
cockroachdb
mongodb+srv
neo4j
spanner
Go Version
There is no Go installed inside the official Docker image used.
Stacktrace
There are no stacktraces.
Additional context
There is no additional context.
Is it a bug or I do something wrong in migrate usage?
The text was updated successfully, but these errors were encountered:
I'm not sure how flyway works with stdin and migration files. It looks like the migration data is being passed as a "statement". Unfortunately, the migrate postgres db driver doesn't support multiple statements, so if my understanding is correct, COPY ... FROM STDIN won't work.
Feel free to open a PR to add support for x-multi-statement. You can use the neo4j, cassandra, and clickhouse db drivers as examples.
Describe the Bug
I'm trying to apply a migration with
COPY ... FROM STDIN
command inside and get a syntax error. But actually, there is no problem with SQL syntax, because I can apply the same migration manually or with other tools likeFlyWay
.Steps to Reproduce
An environment described below present in this archive: test.tar.gz.
Use this docker-compose manifest:
Put these migration files into
sql
folder near the docker-compose manifest:Run the
docker-compose up -d
command and see logs from themigrate
container:docker-compose logs migrate
and you will see the next error:Expected Behavior
Migration file with
COPY ... FROM STDIN
should be applied successfully.Migrate Version
v4.14.1
Loaded Source Drivers
Loaded Database Drivers
Go Version
There is no Go installed inside the official Docker image used.
Stacktrace
There are no stacktraces.
Additional context
There is no additional context.
Is it a bug or I do something wrong in
migrate
usage?The text was updated successfully, but these errors were encountered: