You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We were used to create sequences using uppercase name on changesets, as this is automatically transalted to lowercase for postgres. After switching Liquibase from 4.11 to 4.27 we noticed it fails to recognize existing sequences
Steps To Reproduce
Given a docker compose file creating a postgres db on ephemeral storage, and launching liquibase on it as follows
if the changeset creates a sequence having uppercase name and afterwards tests for its existence using the same uppercase name, it fails, as the sequence is by default translated to its lowercase counterpart by the db engine.
This fails with liquibase versions from 4.24 to 4.27, while with 4.23 it works
changelog.xml:
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLogxmlns="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 https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.4.xsd">
<changeSetauthor="me"id="test-foo">
<!-- create a new sequence -->
<createSequencesequenceName="SQ_TEST_FOO"/>
</changeSet>
<changeSetauthor="me"id="test-bar">
<preConditionsonFail="HALT">
<!-- fail if the just created sequence doesn't exist -->
<sequenceExistssequenceName="SQ_TEST_FOO"/>
</preConditions>
<createSequencesequenceName="SQ_TEST_BAR"/><!-- doesn't matter -->
</changeSet>
</databaseChangeLog>
Expected/Desired Behavior
The sequence created by liquibase should be found by the precondition with default settings, otherwise there's a breaking change preventing us to upgrade liquibase.
Liquibase Version
4.27
Database Vendor & Version
PostgreSQL 16.2
Liquibase Integration
CLI
Liquibase Extensions
No response
OS and/or Infrastructure Type/Provider
official docker image
Additional Context
It also sworks on Liquibase 4.11.
It probably fails also for Oracle, using lowercase names (not tested yet).
This case sensitivity issue possibly affects other checks, though we've not tested yet.
Are you willing to submit a PR?
I'm willing to submit a PR (Thank you!)
The text was updated successfully, but these errors were encountered:
I have been able to replicate the bug. The source of this seems to be that when creating the sequence, its name is automatically set to lowercase, but the precondition query doesn't do that.
A workaround is using the lowercase name in your preconditions.
We'll be leaving this issue open for the community to propose a fix for. Our develompent team will be available to provide guidance if necessary.
Please note it seems a regression, as it used to work with previous versions, and it possibly affects checks on other object types. That said, I can dissect history to find where and why the behavior changed, so that we understand which fix makes sense.
@tati-qalified after a quick check, I suppose the regression has been inadvertedly introduced with PR #4613, and specifically with the SQL query introduced as constant SQL_CHECK_POSTGRES_SEQUENCE_EXISTS
where the check for PostgreSQL switched to case-sensitive.
Search first
Description
We were used to create sequences using uppercase name on changesets, as this is automatically transalted to lowercase for postgres. After switching Liquibase from 4.11 to 4.27 we noticed it fails to recognize existing sequences
Steps To Reproduce
Given a docker compose file creating a postgres db on ephemeral storage, and launching liquibase on it as follows
compose.yml:
if the changeset creates a sequence having uppercase name and afterwards tests for its existence using the same uppercase name, it fails, as the sequence is by default translated to its lowercase counterpart by the db engine.
This fails with liquibase versions from 4.24 to 4.27, while with 4.23 it works
changelog.xml:
Expected/Desired Behavior
The sequence created by liquibase should be found by the precondition with default settings, otherwise there's a breaking change preventing us to upgrade liquibase.
Liquibase Version
4.27
Database Vendor & Version
PostgreSQL 16.2
Liquibase Integration
CLI
Liquibase Extensions
No response
OS and/or Infrastructure Type/Provider
official docker image
Additional Context
It also sworks on Liquibase 4.11.
It probably fails also for Oracle, using lowercase names (not tested yet).
This case sensitivity issue possibly affects other checks, though we've not tested yet.
Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: