Repository navigation
fix: compatible-type foreign keys, search_path setting (4.0.5) - #19
Merged
Merged
Conversation
Foreign keys were rejected unless both columns had the identical type; postgres accepts any pair with an equality operator (varchar -> text, integer -> bigint). Key values are converted between the two numeric representations for the checks and cascades. Incompatible pairs use postgres' "cannot be implemented ... incompatible types" message. search_path has postgres' default and reads back through SHOW and current_setting; SET with a list value is stored. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 running the real coding agent (4-turn project-management app) on rapidnative-website's validator, then checking each rejection against PGlite.
Foreign keys (valid SQL was rejected)
varchar(255) -> text,text -> varchar(50),integer -> bigint,bigint -> integer,integer -> numericwere all rejected here, so a migration likeuser_id varchar(255) references users(id)failed validation.text -> uuid,text -> integer) still fail, with Postgres' reason:foreign key constraint "pr_id_fkey" cannot be implemented: key columns "id" and "id" are of incompatible types: text and uuid(wasForeign key column type mismatch).search_path
SHOW search_path/current_setting('search_path')were "unrecognized configuration parameter"; they return Postgres' default"$user", public.SET search_path TO public, extensions/TO DEFAULTread back as Postgres prints them (SET with a list value used to be ignored).Checks
bun test: 1355 pass, 0 fail (new cases incorpus-parity.spec.ts)Known, not changed:
SET a.b = ...(dotted custom setting names) does not parse — parser;set_config()works.Version 4.0.5.
🤖 Generated with Claude Code