Flyway 5 regression when line in multi line string starts with single line comment #1927
What version of Flyway are you using?
Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin, SBT plugin, ANT tasks)
Command-line & Java API
What database are you using (type & version)?
MySQL 5.7, SQL Server, Oracle, DB2
What operating system are you using?
What did you do?
(Please include the content causing the issue, any relevant configuration settings, and the command you ran)
What did you expect to see?
What did you see instead?
My analysis and fix:
This is a regression caused in Flyway 5.0.x codebase.
Regression was introduced in this line: https://github.com/flyway/flyway/blob/flyway-5.0.7/flyway-core/src/main/java/org/flywaydb/core/internal/database/SqlStatementBuilder.java#L199
In 5.0.x code, code is checking if the line starts with line comment (--) and if it does, then Flyway is thinking the that line is not terminating line and amusing there would be following lines in the same statement. But it is not checking if that comment chars are inside a multi line string literal value, which is exactly our case.
I've fixed it by adding extra check endWithOpenMultilineStringLiteral() for isSingleLineComment(lineSimplified) condition check, like below:
The text was updated successfully, but these errors were encountered: