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

Postgresql: Fix for case when current search_path is an empty string #3233

Merged

Conversation

gadget
Copy link

@gadget gadget commented Sep 1, 2022

Impact

  • Bug fix (non-breaking change which fixes expected existing functionality)
  • Enhancement/New feature (adds functionality without impacting existing logic)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

In certain cases the search path in a postgres database can be empty (not null, but an empty string). For us it happens when running postgres with testcontainers for IT tests, probably on rollbacks (as you call initializeDatabase for every rollback to reset default schema). In case searchPath is empty we should not try and process it, just re-set the default schema.

…us when running postgres with testcontainers for IT tests)
@nvoxland nvoxland added the SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions label Sep 2, 2022
Copy link
Contributor

@nvoxland nvoxland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review and test results:

Things to be aware of:

  • Changes make sense to me, it's keeping an invalid search_path with a trailing , from being made
  • Probably not a code path that gets hit in our code's setup, and not something that is easy to write a test for at this point. But existing tests should catch anything surprising it breaks.
  • Functional test failures are unrelated to this change

Things to worry about:

  • Nothing

@github-actions
Copy link

github-actions bot commented Sep 2, 2022

Unit Test Results

  4 620 files  ±0    4 620 suites  ±0   37m 0s ⏱️ + 1m 10s
  4 619 tests ±0    4 404 ✔️ ±0     215 💤 ±0  0 ±0 
54 600 runs  ±0  49 580 ✔️ ±0  5 020 💤 ±0  0 ±0 

Results for commit ff9225b. ± Comparison against base commit 98e7a36.

@nvoxland nvoxland changed the title fix for case when current searchPath is an empty string (happens for us when running postgres with testcontainers for IT tests) fix for case when current search_path is an empty string (happens for us when running postgres with testcontainers for IT tests) Sep 19, 2022
@nvoxland nvoxland changed the title fix for case when current search_path is an empty string (happens for us when running postgres with testcontainers for IT tests) Postgresql: Fix for case when current search_path is an empty string Sep 19, 2022
Copy link
Contributor

@XDelphiGrl XDelphiGrl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR fixes a bug to prevent empty Postgres SEARCH_PATH values from being set. In the case where the SEARCH_PATH is empty, Liquibase will use the default schema as the SEARCH_PATH.

APPROVED

Note: Functional test failures on DB2 LUW and MariaDB are due to test validations out of sync with current Liquibase master; this is not related to this PR (which only impacts Postgres, which is passing).

@nvoxland nvoxland merged commit ae98b6c into liquibase:master Sep 19, 2022
@kataggart kataggart added this to the NEXT milestone Sep 20, 2022
@tabbyf00
Copy link

Thanks for your PR submission! We just finished reviewing and merging it into the 4.17.0 release on October 10, 2022. When you get a chance, could you please Star the Liquibase project? The star button is in the upper right corner of the screen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autocandidate DBPostgres SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions sprint2022-34 TypeBug
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

6 participants