fix: deparser partition/FK fixes, enforced constraint builder default, walkSql body-error abort (#292 #346 #348 #349 #350 #351) - #352
Merged
Conversation
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This was referenced Sep 17, 2026
Collaborator
Author
|
published a new one! |
This was referenced Sep 17, 2026
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.
Summary
Fixes #292, #346, #348, #349, #350, #351 in one PR. Each deparser issue gets a kitchen-sink fixture under
__fixtures__/kitchen-sink/misc/issue-*.sql(regeneratedgenerated.json+__tests__/kitchen-sink/misc-issue-*.test.ts), so the round-trip tests are the spec.Deparser (
packages/deparser/src/deparser.ts)PartitionCmd.nameis a bareRangeVar, not a wrapped node, sothis.visit(node.name)emitted nothing and schema-qualifiedATTACH/DETACH PARTITION public.xlost its target. Nowthis.RangeVar(node.name, ...). Also movedCONCURRENTLYafter the name (DETACH PARTITION x CONCURRENTLYis the grammar).remainder: 0, sostrategy === 'h'bounds withREMAINDER 0lost the wholeFOR VALUES WITH (...). Now onlymodulusis required,remainder ?? 0, and emitted uppercaseMODULUS/REMAINDERlike theCREATE TABLE ... PARTITION OFpath.ON DELETE SET NULL|SET DEFAULT (cols)now rendersfk_del_set_cols(pretty and non-pretty).MergeWhenClausewas already handled on main (added in df814d2); fixture added to lock it in.@pgsql/utils(#346) —asts.ts/wrapped.tsare generated, sosrc/index.tsnow wrapsast.constraint/nodes.constraint:Explicit
is_enforced: falseis preserved; other contypes untouched. Deparser logic (absent ⇒NOT ENFORCED) is unchanged because it's correct for libpg-query output — the builder now matches that convention.packages/utils/__test__/constraint-defaults.test.tscovers the issue's exact repro (... CHECK (x > 0)with noNOT ENFORCED,skip_validation⇒NOT VALID).plpgsql-parser(#351) —parse()no longer silently downgrades aLANGUAGE plpgsqlfunction whose body failsparsePlPgSQLSync/hydration to a plain statement.ParsedScriptgainserrors: ParsedScriptError[]({ stmtIndex, message }), items/functions behave as before, andwalkSqlreturns{ aborted: true, reason, reasons }whenwalkFunctionBodiesis on and any body failed. Non-throwing hydrationerrors[]are intentionally not treated as aborts (0 occurrences across existing fixtures).PG17 note: pg17 published deparser is pinned separately in
config/versions.json; these fixes ship to pg17 only via a versioned release. #346 is PG18-only by nature.Link to Devin session: https://app.devin.ai/sessions/cc91c8b766d6493a9b10e82d2f08d01a
Open in Devin Desktop: https://app.devin.ai/desktop/session/cc91c8b766d6493a9b10e82d2f08d01a?variant=devin
Requested by: @pyramation