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

canExecuteInTransaction is not respected by JavaMigration #2236

logicbomb opened this issue Dec 7, 2018 · 3 comments

canExecuteInTransaction is not respected by JavaMigration #2236

logicbomb opened this issue Dec 7, 2018 · 3 comments


Copy link

Which version and edition of Flyway are you using?


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)

Java API

Which database are you using (type & version)?


Which operating system are you using?

Ubuntu 18.10

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.)
Write a java migration that must execute outside of a transaction - alter type public.my_type add value 'new_value';

What did you expect to see?

No error

What did you see instead?

A postgres error

The issue comes from the fact that the JavaMigrationExecutor doesn't forward the migration's canExecuteInTransaction value, which can be seen here:

The method should be

    public boolean canExecuteInTransaction() {
        return this.javaMigration.canExecuteInTransaction();

Also, I had a tough time debugging it b/c the reflection code that instantiates the migration hides inner exceptions, and is difficult to find. I'm working on a PR that fixes the issue, and makes reflection errors easier to detect.

Copy link

Copy link

Thanks for catching this and investigating. Truly appreciated! Fixed.

Copy link

pjroth commented Mar 20, 2019

Is it possible to get a 5.X.Y release including this fix since 6.X.Y isn't yet ready for production?

dohrayme pushed a commit to dohrayme/flyway that referenced this issue Feb 3, 2020
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