docs(adr): ADR 005 — functions and triggers as typed code (#91) - #190
Merged
Merged
Conversation
Frames the response to #91: two-phase rollout. Phase 1 ships CREATE FUNCTION with a typed expression body + CREATE TRIGGER DDL, both PG-only. Phase 2 is the procedural plpgsql control flow (IF/LOOP/RAISE) — sketched here, deferred to its own implementation. The ADR's main argument: a raw-SQL body half-measure declares victory at the easy half. The issue is asking for type safety over the body, so Phase 1 commits to the typed surface even at the cost of refusing control flow (which would land in Phase 2 additively). Includes the AST shape, builder API, printer plan, and call-site inference design — enough for the implementation PR to follow. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4 tasks
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
Frames the response to #91 (@deslunes — "Functions and triggers as code"). Two-phase rollout:
Why typed body, not raw SQL
The ADR argues against the half-measure of raw-SQL function bodies: it ships DDL ergonomics without the type safety the issue is actually asking for. The expression body is small enough to do right in Phase 1; control flow is the hard part and goes to Phase 2.
The issue author's own framing — "partially implement it, with guardrails so that it stays simple" — maps cleanly onto this split.
Test plan
Doc-only PR. CI will run.
🤖 Generated with Claude Code