(Go: >> BACK << -|- >> HOME <<)

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

Checksum calculation different since 4.25.1 #5960

Open
1 of 2 tasks
erik-meuwese-topicus opened this issue May 30, 2024 · 1 comment
Open
1 of 2 tasks

Checksum calculation different since 4.25.1 #5960

erik-meuwese-topicus opened this issue May 30, 2024 · 1 comment

Comments

@erik-meuwese-topicus
Copy link
Contributor

Search first

  • I searched and no similar issues were found

Description

This change set worked from 2018 with versions up to 4.25.1. From4.26.0 the checksum calculation changed.

        <changeSet id="example-1" author="example" contextFilter="schema-set-name">
		<comment>Example</comment>
		<sqlFile path="example.sql" relativeToChangelogFile="true"/>

		<modifySql>
			<regExpReplace replace="(\s)${schemaname}\b" with="$1${schemaname}"/>
		</modifySql>
	</changeSet>

example.sql

CREATE FUNCTION ${schemaname}.example(...) 
     RETURNS TABLE
     (...) AS $$ .... $$

Before the checksum was calculated over the change set and every schema had the same checksum.

I looks like that after 4 .25.1 the property values are replaced in or with the value and then the checksums are calculated. Which results in a different checksum for every database schema.

To fix this. A <validCheckSum> needs to be added for every schema. Or the checksum needs to be removed from the databasechangelog table for these change sets in every schema.

Steps To Reproduce

Run the changeset where the propertie ${schemaname} is filled with the datbase schema name for multiple schemas with 4.25.1 and then rerun with 4.26.0 and it will fail on validation because the checksum is different for every schema.

And example.sql is some CREATE FUNCTION ${schemaname}.example() AS $$ .... $$

        <changeSet id="example-1" author="example" contextFilter="schema-set-name">
		<comment>Example</comment>
		<sqlFile path="example.sql" relativeToChangelogFile="true"/>

		<modifySql>
			<regExpReplace replace="(\s)${schemaname}\b" with="$1${schemaname}"/>
		</modifySql>
	</changeSet>

Expected/Desired Behavior

Liquibase should do a checksum upgrade when the method of calculation changes

Liquibase Version

4.26.0

Database Vendor & Version

PostgreSQL 16

Liquibase Integration

Spring

Liquibase Extensions

No response

OS and/or Infrastructure Type/Provider

No response

Additional Context

We extend SpringLiquibase to set the schemaname based on the contextFilter. For some context the change set would run multiple times every time for a different schema

Are you willing to submit a PR?

  • I'm willing to submit a PR (Thank you!)
@tati-qalified
Copy link
Contributor

Hi @erik-meuwese-topicus, thank you for reporting this issue.

I need some more information in order to test it more effectively.

  1. What version(s) of Spring are you using?
  2. Could you share the portion of code where you're setting the schema name based on the context filter?

Thank you,
Tatiana

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants