SQL exception in COPY statement when the DELIMITER is set to a semicolon #1000
when using the following COPY statement in PostgreSQL 9.1:
COPY CSV_FILES FROM '/path/to/filename.csv' DELIMITER ';' CSV HEADER;
Flyway 3.2.1 throws the following exception:
Caused by: org.flywaydb.core.internal.dbsupport.FlywaySqlScriptException:
Switching to another DELIMITER like ',' works. It looks like the script parser thinks that the ';' after the DELIMITER keyword is the end of the statement. Since DELIMITER and a semicolon are both valid parts of a COPY statement, the script should check for the DELIMITER keyword and interpret the delimiter value correctly.
BTW: at least in Flyway 2.2.1 there was no problem with this COPY statement.
The text was updated successfully, but these errors were encountered:
Yes, it definitely worked with 2.2.1, I just double-checked again. A quick debug session with 2.2.1 shows that the whole COPY statement was treated as one single line by the script parser and therefore executed without problem.
I think "PostgreSQLDbSupport.executePgCopy()" should try to distinguish between a COPY statement that uses STDIN (with special handling of the DATA block which comes after the semicolon) and other COPY statements (which should be treated like normal statements, I guess). If I find some time the forthcoming days I can try to come up with a solution.