Applies to:
- Liquibase Pro
- Liquibase Open Source (Community)
Conditions:
- Liquibase Pro or Liquibase Community
- Amazon Redshift
Issue Summary:
When attempting to run certain SQL statements via Liquibase, you will encounter an error message stating that the statement "cannot be run in a transaction block".
Error Message:
Reason: liquibase.exception.DatabaseException: ERROR: [SQL_CODE] cannot run inside a transaction block
Root Cause:
By default, Liquibase will deploy the changesets inside of a transaction block, and some SQL statements, such as GRANT ON DATASHARE, cannot be run inside of a transaction block.
Resolution:
In order to deploy this type of SQL statement via Liquibase, you will need to set the runInTransaction attribute to false.
Important: If runInTransaction is set to false and an error occurs part way through running a changeset that contains multiple statements, the Liquibase DATABASECHANGELOG table will be left in an invalid state.
It is recommended to run only the changesets that need this attribute set to false and then revert the setting back to the default value of true.
Comments
0 comments
Article is closed for comments.