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

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

Comments

@elieabichar-wk
Copy link

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

Which version and edition of Flyway are you using?

6.0.4

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.

Exception

java.lang.NullPointerException: null
at org.flywaydb.core.internal.parser.PlaceholderReplacingReader.<init>(PlaceholderReplacingReader.java:56)
at org.flywaydb.core.internal.parser.Parser.replacePlaceholders(Parser.java:130)
at org.flywaydb.core.internal.parser.Parser.parse(Parser.java:111)
at org.flywaydb.core.internal.sqlscript.ParserSqlScript.parse(ParserSqlScript.java:76)
at org.flywaydb.core.internal.sqlscript.ParserSqlScript.validate(ParserSqlScript.java:124)
at org.flywaydb.core.internal.sqlscript.ParserSqlScript.getSqlStatements(ParserSqlScript.java:130)
at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.execute(DefaultSqlScriptExecutor.java:97)
at org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory$1$1.call(JdbcTableSchemaHistory.java:113)
at org.flywaydb.core.internal.jdbc.TransactionTemplate.execute(TransactionTemplate.java:74)
at org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory$1.call(JdbcTableSchemaHistory.java:106)
at org.flywaydb.core.internal.database.base.Connection$1.call(Connection.java:131)
at org.flywaydb.core.internal.jdbc.TransactionTemplate.execute(TransactionTemplate.java:74)
at org.flywaydb.core.internal.database.base.Connection.lock(Connection.java:127)
at org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory.create(JdbcTableSchemaHistory.java:97)
at org.flywaydb.core.Flyway$1.execute(Flyway.java:178)
at org.flywaydb.core.Flyway$1.execute(Flyway.java:143)
at org.flywaydb.core.Flyway.execute(Flyway.java:507)
at org.flywaydb.core.Flyway.migrate(Flyway.java:143)
What did you expect to see?

Migration to pass as it used to in 5.2.4

What did you see instead?

provided stacktrace

@juliahayward

This comment has been minimized.

Copy link
Member

@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
@elieabichar-wk

This comment has been minimized.

Copy link
Author

@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); 
@juliahayward

This comment has been minimized.

Copy link
Member

@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.

@alextercete

This comment has been minimized.

Copy link
Member

@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
Projects
None yet
3 participants
You can’t perform that action at this time.