-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Fix create index on Postgresql and MSSQL using wrong column names when generating a changelog #3366
Fix create index on Postgresql and MSSQL using wrong column names when generating a changelog #3366
Conversation
…ILTER_CONDITION field when snapshoting indexes (as both support partial indexes, FILTER_CONDITION brings the filter and not the function value)
…ith-cli-generate-changelog-command
…ith-cli-generate-changelog-command
…ith-cli-generate-changelog-command
break; | ||
} | ||
} | ||
Assert.assertTrue("There should be a sequence column starting with function \"" + function + "\"", found); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because "sequence" is a datatype, and we are not checking anything related to sequences, this assertion would be more clear if it was changed to something like "There should be a computed column ...".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR fixes a bug that caused indexes created with WHERE
clauses to use the WHERE
clause instead of the column name in a generated createIndex
changeset. The bug, and fix, are specific to Postgres and SQL Server.
- New integration test added.
- Internal functional tests to change test to match new/correct behavior.
- No additional testing required.
APPROVED
Note: The wording in the integration test assertion could be updated, but I will not block the PR from approval based on that. If you can make the change before merging, @filipelautert, that would be very helpful.
Impact
Description
Postgresql and MSSQL server support conditional indexes (a WHERE when creating the index). When a conditional index is exported by generate-changelog, liquibase is replacing the columns by the where condition. This fix makes sure that the columns are corrected exported.
As discussed with Nathan, implementing the "where" condition would be too specific for those databases and is currently not supported by Liquibase, thus it's being ignored.
This fix makes sure that Postgresql and MSSQL use the column name instead of FILTER_CONDITION field when snapshoting indexes (as both support partial indexes, FILTER_CONDITION brings the filter and not the function value)
Things to be aware of
Things to worry about
Additional Context