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

Null placeholder value no longer works for H2 database running in MySql mode #2512

elieabichar-wk opened this issue Sep 23, 2019 · 4 comments


Copy link

@elieabichar-wk elieabichar-wk commented Sep 23, 2019

Which version and edition of Flyway are you using?


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

Java API

Which database are you using (type & version)?

H2 with MySql compatibility mode

Which operating system are you using?

Mac OS

What did you do?

When updating Flyway from 5.2.4 to 6.0.4 we started hitting a NullPointerException due to supplying a null placeholder value.

The null placeholder value used to work in 5.2.4 and still works on a MySql database but seems broken for H2 running with MySql compatibility mode.

As a workaround, we're able to supply empty quotes which behave well on both MySql and H2.


java.lang.NullPointerException: null
at org.flywaydb.core.internal.parser.PlaceholderReplacingReader.<init>(
at org.flywaydb.core.internal.parser.Parser.replacePlaceholders(
at org.flywaydb.core.internal.parser.Parser.parse(
at org.flywaydb.core.internal.sqlscript.ParserSqlScript.parse(
at org.flywaydb.core.internal.sqlscript.ParserSqlScript.validate(
at org.flywaydb.core.internal.sqlscript.ParserSqlScript.getSqlStatements(
at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.execute(
at org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory$1$
at org.flywaydb.core.internal.jdbc.TransactionTemplate.execute(
at org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory$
at org.flywaydb.core.internal.database.base.Connection$
at org.flywaydb.core.internal.jdbc.TransactionTemplate.execute(
at org.flywaydb.core.internal.database.base.Connection.lock(
at org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory.create(
at org.flywaydb.core.Flyway$1.execute(
at org.flywaydb.core.Flyway$1.execute(
at org.flywaydb.core.Flyway.execute(
at org.flywaydb.core.Flyway.migrate(
What did you expect to see?

Migration to pass as it used to in 5.2.4

What did you see instead?

provided stacktrace

Copy link

@juliahayward juliahayward commented Sep 24, 2019

Would you be able to supply a sample script that we can test with, please? Also, are you supplying the null parameter via config file, Java API, environment variable ...?

@juliahayward juliahayward added this to the Flyway 6.0.5 milestone Sep 24, 2019
Copy link

@elieabichar-wk elieabichar-wk commented Sep 24, 2019

Here's a sample sql script.

CREATE TABLE test (test INT) ${createTableOptions}; 

We are supplying the placeholders parameters via Java API. The code below works with Flyway 5.2.4 but it is broken in 6.0.4

 params.put("createTableOptions", null); 

Copy link

@juliahayward juliahayward commented Sep 25, 2019

That's very helpful, thankyou! I thought that would be the case but always good to confirm. We will have this and #2511 fixed in v6.0.5.

Copy link

@alextercete alextercete commented Oct 2, 2019

Fixed by fad9a03.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

3 participants