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

"Delimiter changed inside statement" on delimiter change right after comment #2786

Closed
stapel opened this issue Apr 24, 2020 · 0 comments
Closed

Comments

@stapel
Copy link

stapel commented Apr 24, 2020

Which version and edition of Flyway are you using?

6.4.0

If this is not the latest version, can you reproduce the issue with the latest one as well?

Latest

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

Java-API

Which database are you using (type & version)?

MySQL 8.0.17

Which operating system are you using?

Linux

What did you do?

The following migration did suddenly stop working in 6.3.1 (works in 6.3.0):

-- -----------------------------------------------------
-- Function `UUID_FROM_BINARY`, `UUID_TO_BINARY`
-- -----------------------------------------------------
DELIMITER |

CREATE FUNCTION UUID_FROM_BINARY(b BINARY(16))
RETURNS CHAR(36) DETERMINISTIC
BEGIN
 DECLARE hex CHAR(32);
 SET hex = HEX(b);
 RETURN CONCAT(LEFT(hex, 8), '-', MID(hex, 9,4), '-', MID(hex, 13,4), '-', MID(hex, 17,4), '-', RIGHT(hex, 12));
END
|

CREATE FUNCTION UUID_TO_BINARY(s CHAR(36))
RETURNS BINARY(16) DETERMINISTIC
RETURN UNHEX(CONCAT(LEFT(s, 8), MID(s, 10, 4), MID(s, 15, 4), MID(s, 20, 4), RIGHT(s, 12)))
|

DELIMITER ;
...

The file goes on but it seems to take offense at the first comment. If I add an empty line between the comment and the DELIMITER-statement, it works.

What did you expect to see?

Flyway happily importing all our migrations.

What did you see instead?

Flyway emits the following error:

org.flywaydb.core.api.FlywayException: Unable to parse statement in db/migration/V00__CreateDB.sql at line 1 col 1: Delimiter changed inside statement at line 1 col 1: -- -----------------------------------------------------
-- Function `UUID_FROM_BINARY`, `UUID_TO_BINARY`
-- -----------------------------------------------------

	at org.flywaydb.core.internal.parser.Parser.getNextStatement(Parser.java:288)
	at org.flywaydb.core.internal.parser.Parser.access$000(Parser.java:41)
	at org.flywaydb.core.internal.parser.Parser$ParserSqlStatementIterator.<init>(Parser.java:703)
	at org.flywaydb.core.internal.parser.Parser.parse(Parser.java:109)
	at org.flywaydb.core.internal.sqlscript.ParserSqlScript.parse(ParserSqlScript.java:79)
	at org.flywaydb.core.internal.sqlscript.ParserSqlScript.validate(ParserSqlScript.java:127)
	at org.flywaydb.core.internal.sqlscript.ParserSqlScript.executeInTransaction(ParserSqlScript.java:196)
	at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.canExecuteInTransaction(SqlMigrationExecutor.java:93)
	at org.flywaydb.core.internal.command.DbMigrate.isExecuteGroupInTransaction(DbMigrate.java:312)
	at org.flywaydb.core.internal.command.DbMigrate.applyMigrations(DbMigrate.java:275)
	at org.flywaydb.core.internal.command.DbMigrate.migrateGroup(DbMigrate.java:244)
	at org.flywaydb.core.internal.command.DbMigrate.access$100(DbMigrate.java:54)
	at org.flywaydb.core.internal.command.DbMigrate$2.call(DbMigrate.java:162)
	at org.flywaydb.core.internal.command.DbMigrate$2.call(DbMigrate.java:159)
	at org.flywaydb.core.internal.database.mysql.MySQLNamedLockTemplate.execute(MySQLNamedLockTemplate.java:60)
	at org.flywaydb.core.internal.database.mysql.MySQLConnection.lock(MySQLConnection.java:161)
	at org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory.lock(JdbcTableSchemaHistory.java:140)
	at org.flywaydb.core.internal.command.DbMigrate.migrateAll(DbMigrate.java:159)
	at org.flywaydb.core.internal.command.DbMigrate.migrate(DbMigrate.java:137)
	at org.flywaydb.core.Flyway$1.execute(Flyway.java:199)
	at org.flywaydb.core.Flyway$1.execute(Flyway.java:159)
	at org.flywaydb.core.Flyway.execute(Flyway.java:530)
	at org.flywaydb.core.Flyway.migrate(Flyway.java:159)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants