fix(db): paren-insensitive constraint-drift comparison - #113
Merged
Conversation
pg_get_constraintdef's AND-chain grouping changed between Postgres minors: 17.4 prints left-associated parentheses, 17.6 flattens the chain. The pinned definitions came from the 17.4 production dump, so the drift check false-fired on a fresh 17.6 project (and would fire on production after its next minor upgrade). Comparing both sides with parentheses stripped keeps the check's purpose — operator, literal, and regex changes still surface.
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.
Found by the fresh-project e2e's final target assertion:
pg_get_constraintdefprints AND-chains left-associated on PG 17.4 (where the pinned definitions were dumped) but flattened on 17.6 (fresh Supabase projects today) — semantically identical, textually different, so the drift check false-fired. Also future-proofs production's own eventual minor upgrade.Both sides of the comparison are now parenthesis-stripped; operator/literal/regex weakening still surfaces, which is what the check exists to catch.
Verification notes
pnpm lint/pnpm typecheck/pnpm turbo build --force/pnpm deadcode/pnpm architecture:check