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

When using script config executeInTransaction=false and script contains syntax error, error is "ERROR: Unable to release PostgreSQL advisory lock" instead of the actual error. #2800

LHCGreg opened this issue May 1, 2020 · 3 comments


Copy link

LHCGreg commented May 1, 2020

Which version and edition of Flyway are you using?

Flyway Community Edition 6.4.1

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)
This is the latest version.

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


Which database are you using (type & version)?

PostgreSQL 12.2

Which operating system are you using?

Flyway is running on Windows, PostgreSQL is running on the postgres:12.2 docker image.

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





  thing_id int NOT NULL PRIMARY KEY, -- trailing comma after last column is a syntax error




I ran

C:\projects\flyway_test_1>flyway -url="jdbc:postgresql://localhost:6543/flyway_test" -user=postgres -password=postgres_pw migrate
What did you expect to see?

I expected to see an error message about the syntax error in the script.

What did you see instead?
C:\projects\flyway_test_1>flyway -url="jdbc:postgresql://localhost:6543/flyway_test" -user=postgres -password=postgres_pw migrate
Flyway Community Edition 6.4.1 by Redgate
Database: jdbc:postgresql://localhost:6543/flyway_test (PostgreSQL 12.2)
Successfully validated 1 migration (execution time 00:00.018s)
Creating Schema History table "public"."flyway_schema_history" ...
Current version of schema "public": << Empty Schema >>
Migrating schema "public" to version 1 - initial schema [non-transactional]
ERROR: Migration of schema "public" to version 1 - initial schema [non-transactional] failed! Please restore backups and roll back database and code!
ERROR: Unable to release PostgreSQL advisory lock
Copy link

The problem is the command line is only reporting the top-level error message; we'll add a fix for 6.4.2 that tracks through nested exceptions and reports the ultimate root cause. This should be only a few days away. In the meantime, the -X option does log the full error stack and reveals the syntax error.

Copy link

atejano commented Jul 6, 2020

Any workaround to resolve this issue in my current flyway migrate?

Copy link

Have you tried updating to the latest version? 6.5.0 is now released.

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

5 participants