sqlFile no longer has default schema set
See original GitHub issueEnvironment
Liquibase Version: Issue first reproducible with 4.5.0; confirmed to still exist in 4.6.1.
Liquibase Integration & Version: Spring Boot
Liquibase Extension(s) & Version: n/a
Database Vendor & Version: Postgresql 11
Operating System Type & Version: Linux / Fedora 35
Description
In Liquibase 4.5.0, the behavior of sqlFile
changed. In Liquibase <= 4.5.0, the current schema for the sql is set to the configured Liquibase default schema. Starting with commit https://github.com/liquibase/liquibase/pull/1864/commits/411f77a63c4a4c637f3f68556a6bebf53b549754 the schema is not changed, so the sql executes using the jdbc connection’s default schema.
Steps To Reproduce
Before Liquibase 4.5.0, this changeset xml would create tables in the liquibase configured default schema (ex, if spring.liquibase.default-schema: example_db
, then the tables would be in the example_db
schema):
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.6.xsd">
<changeSet id="spring-session" author="me">
<sqlFile path="org/springframework/session/jdbc/schema-postgresql.sql" dbms="postgresql" />
</changeSet>
org/springframework/session/jdbc/schema-postgresql.sql for reference.
Starting with Liquibase 4.5.0, specifically starting with commit https://github.com/liquibase/liquibase/pull/1864/commits/411f77a63c4a4c637f3f68556a6bebf53b549754 , that xml will create tables in a different schema. For example, on postgres, it will probably create them in the public
schema.
Actual Behavior
sqlFile
sql is executed with the current schema set to the jdbc connection’s default schema.
Expected/Desired Behavior
sqlFile
sql is executed with the current schema set to the Liquibase configured default schema.
Screenshots (if appropriate)
n/a
Additional Context
This regression was introduced in https://github.com/liquibase/liquibase/pull/1864
Issue Analytics
- State:
- Created 2 years ago
- Reactions:9
- Comments:12 (5 by maintainers)
Top GitHub Comments
I created a PR that should address this
Also a related problem: Schema based multi Tenancy based on MultiTenantSpringLiquibase seems also to be broken. I think it is because it configures the default schema via liquibase and not via the jdbc. Happend to me with a postgresql
13
.The workaround seems also to work with multi tenancy, but suffers from the same problem with the checksum.
Also latest working version is at the moment seems to be
4.4.3
. But projects that are stuck on this version should be aware of the following security vulnerability:CVE-2022-0839 <
4.8.0