Repository navigation
PostgreSQL predicates are created exactly as declared - #145
Open
MelbourneDeveloper wants to merge 1 commit into
Open
MelbourneDeveloper wants to merge 1 commit into
MelbourneDeveloper wants to merge 1 commit into
Conversation
…form is only a comparison key
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A CHECK, partial-index predicate or RLS policy added to an existing table was created from the canonical comparison text instead of the declared text. That text drops
::textcasts and spelled some operators as parser token names, so:a::text < b::textwas created asa < b(a different comparison) and the run reported success, for both CHECKs and RLS policies.LIKE,->>,->,@>or&failed with a syntax error such asnear "PGLikeMatch". These worked in v0.11.0-beta.1.Now a declared predicate takes the canonical form only when the live object already has that exact canonical form, which is what makes the diff see no change. Every other predicate keeps its declared text, so DDL is always generated from what the YAML says. The renderer also spells LIKE, JSON, containment and bitwise operators as SQL, because the canonical text is parsed by PostgreSQL again when the live side is compared.
Migrate_PredicatesAddedToExistingTableKeepGroupingAndRegroupingIsAppliednow also adds a text-cast CHECK and text-cast, LIKE and JSON policies to an existing table and asserts the catalog definitions.I also ran 52 predicate shapes as a CHECK and as a policy, on a new and on an existing table, through v0.11.0-beta.1 and this branch, comparing the catalog definition with what PostgreSQL stores for the same expression directly. This branch produced no wrong definition and no case that the old release handled and this one does not.
Still failing, loudly and as in v0.11.0-beta.1: a CHECK comparing a text cast to a text column (
a::text = d,(a + b)::text = d) andlength(d::varchar) > a.