Repository navigation
fix: --prove reads a constant array cast whole or element by element alike - #154
Merged
Merged
Conversation
…alike
`kind IN ('web', 'shop')` on a varchar column is printed with the cast
on the whole array, but SQL written from that print can come back with
the cast on each element; both are stable from then on. A CHECK, index
or policy made from a previous sync's SQL never read like the source's,
so the proof refused correct migrations on it. Both spellings are now
read as one where the proof compares: for an array of constants,
casting the array and casting each element are the same.
Fixes #151
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
PostgreSQL prints
kind IN ('web', 'shop')on a varchar column with the cast on the whole array,(ARRAY['web'::character varying, …])::text[]. SQL written from that print can come back with the cast on each element instead,ARRAY[('web'::character varying)::text, …]. Both forms are stable from then on.A CHECK, index or policy made from a previous sync's SQL therefore never read like the source's, and
--proverefused correct migrations because of it. The proof now reads the two spellings as one: in its fingerprint comparison, and in constraint, index and policy definitions. Only arrays of quoted constants are rewritten; for those, casting the array and casting each element are the same.Tests:
sb17>pg17matrix pair, where this was found, now proves its drift phase on freshly started servers.Fixes #151
🤖 Generated with Claude Code