Skip to content

fix: deparser partition/FK fixes, enforced constraint builder default, walkSql body-error abort (#292 #346 #348 #349 #350 #351) - #352

Merged
pyramation merged 2 commits into
mainfrom
fix/deparser-issues-292-346-348-351
Sep 17, 2026
Merged

pyramation merged 2 commits into
mainfrom
fix/deparser-issues-292-346-348-351

Conversation

@pyramation

Copy link
Copy Markdown
Collaborator

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 (regenerated generated.json + __tests__/kitchen-sink/misc-issue-*.test.ts), so the round-trip tests are the spec.

Deparser (packages/deparser/src/deparser.ts)

@pgsql/utils (#346)asts.ts/wrapped.ts are generated, so src/index.ts now wraps ast.constraint / nodes.constraint:

if ((contype === 'CONSTR_CHECK' || contype === 'CONSTR_FOREIGN') && _p?.is_enforced === undefined)
  constraint.is_enforced = true;

Explicit is_enforced: false is 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.ts covers the issue's exact repro (... CHECK (x > 0) with no NOT ENFORCED, skip_validationNOT VALID).

plpgsql-parser (#351)parse() no longer silently downgrades a LANGUAGE plpgsql function whose body fails parsePlPgSQLSync/hydration to a plain statement. ParsedScript gains errors: ParsedScriptError[] ({ stmtIndex, message }), items/functions behave as before, and walkSql returns { aborted: true, reason, reasons } when walkFunctionBodies is on and any body failed. Non-throwing hydration errors[] 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

@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@pyramation
pyramation merged commit 0192055 into main Sep 17, 2026
15 checks passed
@pyramation

Copy link
Copy Markdown
Collaborator Author

published a new one!

Successfully published:
 - @pgsql/cli@18.2.7
 - @pgsql/lint@18.2.7
 - @pgsql/scripts@18.4.7
 - @pgsql/semantics@18.1.8
 - @pgsql/transform@18.17.7
 - @pgsql/transform-ast@18.4.9
 - @pgsql/traverse@18.7.9
 - @pgsql/utils@18.2.9
 - pgsql-deparser@18.3.7
 - pgsql-parse@18.2.7
 - pgsql-parser@18.2.7
 - pgsql-types@18.2.9
 - plpgsql-deparser@18.2.9
 - plpgsql-parse@18.2.9
 - plpgsql-parser@18.5.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deparser does not handle MergeWhenClause

1 participant