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
Flyway is throwing an MySQLSyntaxErrorException when I try to run the following script.
DROP TABLE IF EXISTS `bug_test`;
CREATE TABLE `bug_test` (
`description` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `bug_test` VALUES (' X');
--comment here
I get the following stack trace:
Exception in thread "main" com.googlecode.flyway.core.api.FlywayException: Migration of schema `gdb-test` to version 2013.0.0.0.1 failed! Please restore backups and roll back database and code!
at com.googlecode.flyway.core.command.DbMigrate.migrate(DbMigrate.java:199)
at com.googlecode.flyway.core.Flyway$1.execute(Flyway.java:872)
at com.googlecode.flyway.core.Flyway$1.execute(Flyway.java:1)
at com.googlecode.flyway.core.Flyway.execute(Flyway.java:1200)
at com.googlecode.flyway.core.Flyway.migrate(Flyway.java:819)
at com.cmt.test.utils.ConfigUtils.runFlyway(ConfigUtils.java:103)
at com.cmt.test.utils.ConfigUtils.main(ConfigUtils.java:381)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '--comment here' at line 3
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.Util.getInstance(Util.java:386)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1053)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4074)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4006)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2468)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2629)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2713)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2663)
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:888)
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:730)
at com.googlecode.flyway.core.dbsupport.JdbcTemplate.executeStatement(JdbcTemplate.java:230)
at com.googlecode.flyway.core.dbsupport.SqlScript.execute(SqlScript.java:89)
at com.googlecode.flyway.core.resolver.sql.SqlMigrationExecutor.execute(SqlMigrationExecutor.java:72)
at com.googlecode.flyway.core.command.DbMigrate$2.doInTransaction(DbMigrate.java:252)
at com.googlecode.flyway.core.command.DbMigrate$2.doInTransaction(DbMigrate.java:1)
at com.googlecode.flyway.core.util.jdbc.TransactionTemplate.execute(TransactionTemplate.java:56)
at com.googlecode.flyway.core.command.DbMigrate.applyMigration(DbMigrate.java:250)
at com.googlecode.flyway.core.command.DbMigrate.access$7(DbMigrate.java:237)
at com.googlecode.flyway.core.command.DbMigrate$1.doInTransaction(DbMigrate.java:189)
at com.googlecode.flyway.core.command.DbMigrate$1.doInTransaction(DbMigrate.java:1)
at com.googlecode.flyway.core.util.jdbc.TransactionTemplate.execute(TransactionTemplate.java:56)
at com.googlecode.flyway.core.command.DbMigrate.migrate(DbMigrate.java:138)
... 6 more
When I turned on debug I noticed that Flyway was trying to execute more than just the statement:
...
[2013-08-29 15:55:05,782] DEBUG SqlScript : Found statement at line 1: DROP TABLE IF EXISTS `bug_test`
[2013-08-29 15:55:05,783] DEBUG SqlScript : Found statement at line 3: CREATE TABLE `bug_test` (
`description` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
[2013-08-29 15:55:05,784] DEBUG SqlScript : Executing SQL: DROP TABLE IF EXISTS `bug_test`
[2013-08-29 15:55:05,784] DEBUG SqlScript : Executing SQL: CREATE TABLE `bug_test` (
`description` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
[2013-08-29 15:55:05,848] DEBUG SqlScript : Executing SQL: INSERT INTO `bug_test` VALUES (' X');
--comment here
[2013-08-29 15:55:05,850] DEBUG TransactionTemplate : Rolling back transaction...
[2013-08-29 15:55:05,850] DEBUG TransactionTemplate : Transaction rolled back
...
This behavior works if the string literal ends with a [space]X|B'
My guess it is is related to recent changes to
protected String extractAlternateOpenQuote(String token) {
if (token.startsWith("\"")) {
return "\"";
}
if (token.startsWith("B'")) {
return "B'";
}
if (token.startsWith("X'")) {
return "X'";
}
return null;
}
Note: this behavior was not happening in v2.1.1.
The text was updated successfully, but these errors were encountered:
Using Flyway API for v2.2.1.
Flyway is throwing an
MySQLSyntaxErrorException
when I try to run the following script.I get the following stack trace:
When I turned on debug I noticed that Flyway was trying to execute more than just the statement:
This behavior works if the string literal ends with a [space]X|B'
My guess it is is related to recent changes to
Note: this behavior was not happening in v2.1.1.
The text was updated successfully, but these errors were encountered: