Repository navigation
Predicates added to an existing PostgreSQL table keep their parentheses and casts - #144
Merged
Merged
Conversation
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.
Adding a CHECK, partial-index predicate or RLS policy to a table that already exists rewrote the predicate before creating it.
(a > 0 OR b > 0) AND c > 0was created asa > 0 OR (b > 0 AND c > 0),(a + b) * c > 10asa + (b * c) > 10, and(a::numeric / b) > 0.5lost its cast, and the run still reported success. Regrouping a predicate in the YAML was also reported as up to date. v0.11.0-beta.1 rejected these predicates as drifted instead of installing the wrong one.The canonical renderer now writes parentheses back wherever operator precedence would regroup the expression, and keeps every cast except the
text/varchar/custom-type casts PostgreSQL adds itself.Migrate_PredicatesAddedToExistingTableKeepGroupingAndRegroupingIsAppliedadds the three predicates to an existing table on real PostgreSQL, checks the catalog definitions, reruns clean, then regroups them and checks the change is applied.Also here:
public(Migrate_RolesOnlySchemaMigratesAndRerunsClean).Not changed: custom-type casts (enums, domains) are still stripped from the canonical form, as before.