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

Fixes snapshot of case-sensitive views #3329

Merged
merged 3 commits into from
Nov 17, 2022

Conversation

filipelautert
Copy link
Collaborator

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

When a view is created using objectQuotingStrategy="QUOTE_ALL_OBJECTS" , the name is saved as defined (ie: "MyView" ) - otherwise it is all upcase (MYVIEW) . As the default strategy for h2 is LEGACY, it fails on subsequent changesets unless QUOTE_ALL_OBJECTS is specified (tested on H2 and postgres: H2 failed, postgresql not).
It fails using the "update" command - if we execute the command "snapshot" , the strategy is already set by default to QUOTE_ALL_OBJECTS so it works.

This PR changes the strategy to QUOTE_ALL_OBJECTS, snapshots the views and then sets it back to what it was before (as it is done in some others parts of the code).

Things to be aware of

Things to worry about

Additional Context

…cated when it is created with objectQuotingStrategy="QUOTE_ALL_OBJECTS" and evaluated without
@github-actions
Copy link

github-actions bot commented Sep 30, 2022

Unit Test Results

  4 752 files  ±0    4 752 suites  ±0   38m 20s ⏱️ +8s
  4 717 tests ±0    4 484 ✔️ ±0     233 💤 ±0  0 ±0 
55 620 runs  ±0  50 306 ✔️ ±0  5 314 💤 ±0  0 ±0 

Results for commit af16f97. ± Comparison against base commit db8424d.

♻️ This comment has been updated with latest results.

@nvoxland nvoxland changed the title Fixes problem of view snapshot evaluation as metadata is not being located when it is created with objectQuotingStrategy="QUOTE_ALL_OBJECTS" and evaluated without it Fixes snapshot of case-sensitive views Oct 4, 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:

  • I was wondering if the ViewSnapshotGenerator was the place to put the change, since there are times users specify the view name and may be specifying with the wrong case. But the only spot that does that is the viewExists precondition and that code already corrects the case before passing it to this function. So the change is good and is best-handling it at the lowest spot.
  • Test exposes a separate potential issue in that generated changests don't include any object quoting. Unsure if that's a feature or a bug, and nobody has ever asked about it that I remember so I won't worry about it now.
  • Includes new integration test in h2 that tests this specifically for case sensitivity. It uses "tableExists" since the issue used that, but the root cause is view snapshot since h2 ends up snapshotting views as part of table snapshot.

Things to worry about:

  • Nothing, my one worry was handled

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.

This PR fixes an H2 bug caused by differences in the Liquibase setting for OBJECT_QUOTING_STRATEGY during object creation and the default OBJECT_QUOTING_STRATEGY when preconditions are evaluated.

  • New integration test added.
  • Functional test failure unrelated to fix.
  • No additional testing required.

APPROVED

@filipelautert filipelautert merged commit 2db192c into master Nov 17, 2022
@filipelautert filipelautert deleted the 2659-precondition-tableexists-crashes-h2-ok branch November 17, 2022 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Precondition tableExists crashes on H2 with objectQuotingStrategy=LEGACY, if a camelCaseView already exists.
4 participants