include-catalog-in-specification parameter

The include-catalog-in-specification parameter defines whether Liquibase includes the catalog name when determining equality between the compared databases. The default value is false because you may want to compare the objects across two databases even though the catalogs are named differently in different environments.

Uses

If you run the diff command or the diffChangeLog command with the include-catalog-in-specification parameter set to true, Liquibase will identify objects using both their object name and the catalog name.

Let’s say you have:

  • database1 and catalog1, which has the table table1
  • database2 and catalog2, which has the table table1

This way, Liquibase shows that there is a difference in the catalog name when executing the diff command with include-catalog-in-specification set to true. For example, an object of catalog1.my_schema.my_table is seen as a different object than catalog2.my_schema.my_table.

However, if you run the diff command and do not specify include-catalog-in-specification, Liquibase will not see any differences and identify only the database objects without checking if the catalog is the same.

Setting the include-catalog-in-specification parameter

You can set the include-catalog-in-specification parameter in one of the following ways:

include-catalog-in-specification as a Java system property

You can set the include-catalog-in-specification parameter as a Java system property by using the JAVA_OPTS Environment Variable in your command line:

The syntax for Mac/Linux:

JAVA_OPTS=-Dliquibase.includeCatalogInSpecification=<true|false>

The syntax for Windows, which requires the set command:

set JAVA_OPTS=-Dliquibase.includeCatalogInSpecification=<true|false>

include-catalog-in-specification in the liquibase.properties file

You can set the include-catalog-in-specification parameter by adding the following to your liquibase.properties file:

liquibase.includeCatalogInSpecification: <true|false>

include-catalog-in-specification as a CLI global parameter

You can use include-catalog-in-specification as a global parameter in your command line with a Liquibase command, such as diff:

liquibase --include-catalog-in-specification=<true|false> diff

include-catalog-in-specification as an environment variable

If you use Liquibase Pro, you can set include-catalog-in-specification as an environment variable.

The syntax for Mac/Linux:

LIQUIBASE_INCLUDE_CATALOG_IN_SPECIFICATION=<true|false>

The syntax for Windows, which requires the set command:

set LIQUIBASE_INCLUDE_CATALOG_IN_SPECIFICATION=<true|false>

Note: The commands shown above only apply to the current shell. If you need to pass an environment variable to a child process without affecting the parent process, you can use the export command on Mac/Linux or the setx command on Windows.