Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
DB2Parser struggles with block depth count #2379
Which version and edition of Flyway are you using?
Cloned from git, most recent commit is
If this is not the latest version, can you reproduce the issue with the latest one as well?
(Many bugs are fixed in newer releases and upgrading will often resolve the issue)
Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)
Which database are you using (type & version)?
Which operating system are you using?
What did you do?
(Please include the content causing the issue, any relevant configuration settings, the SQL statement that failed (if relevant) and the command you ran.)
After upgrade to the current version i ran a
What did you expect to see?
The usual migration list with status success for the migrations applied before
What did you see instead?
Flyway Community Edition 5.2.3 by Boxfuse
Rerunning the command with the -X flag produced the following stacktrace:
org.flywaydb.core.api.FlywayException: Unable to parse statement in TEST\R__0.0.1_foo.sql at line 2 col 1: Flyway parsing bug: unable to decrease block depth below 0
The migration in question is a stored procedure definition, one of many. Previous migrations with other stored procedures went through without a problem. One difference between the migration is that this one contains a construct like this:
INSERT INTO FOO(ID, X_CODE, Y_CODE) SELECT S.ID, CASE S.IS_X WHEN 1 THEN S.CODE ELSE NULL END, CASE S.IS_Y WHEN 1 THEN S.CODE ELSE NULL END FROM SOURCE S WHERE S.ID = IDENTIFIER;
In the source i see that DB2Parser increases the block depth counter on
"CASE".equals(token.getText()) && !"END".equals(previousToken.getText())
Wouldn't this break in the case above when a CASE is immediately preceeded by the END of the previous clause?
6.0.0-beta is telling me: DB2 10.5 is no longer supported by Flyway Community Edition, But I believe the version I tested is already using the new parser and the adjustBlockDepth method in DB2Parser seems to be identical. Von: Axel Fontaine [mailto:email@example.com] Gesendet: Mittwoch, 8. Mai 2019 17:11 An: flyway/flyway Cc: Ernst-Udo Wallenborn; Author Betreff: Re: [flyway/flyway] DB2Parser struggles with block depth count (#2379) Please try again with 6.0.0-beta. The parser was rewritten from the ground up and this change eliminated entire classes of errors. Did this fix the issue? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub<#2379 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AAH3N4FOHMAPPVWMB7MWY23PULURZANCNFSM4HLSSVNA>.
Thank you. Von: Axel Fontaine [mailto:firstname.lastname@example.org] Gesendet: Freitag, 10. Mai 2019 11:20 An: flyway/flyway Cc: Ernst-Udo Wallenborn; Author Betreff: Re: [flyway/flyway] DB2Parser struggles with block depth count (#2379) Closed #2379<#2379> via a57842a<a57842a>. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub<#2379 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AAH3N4D3WJPKWEAH6HGEKZLPUU43FANCNFSM4HLSSVNA>.