Skip to content

Milestone 5: DML — INSERT, UPDATE, DELETE, MERGE, COPY, PREPARE/EXECUTE, cursors - #5

Merged
kyleconroy merged 1 commit into
mainfrom
claude/next-milestone-planning-1thx4t
Aug 16, 2026
Merged

Milestone 5: DML — INSERT, UPDATE, DELETE, MERGE, COPY, PREPARE/EXECUTE, cursors#5
kyleconroy merged 1 commit into
mainfrom
claude/next-milestone-planning-1thx4t

Conversation

@kyleconroy

Copy link
Copy Markdown
Contributor

Ports the gram.y DML productions to internal/parse (new dml.go, each production tagged with its gram.y rule):

  • INSERTinsert_rest in all five forms, ON CONFLICT (inference with full index_params including collation/opclass/reloptions, and ON CONSTRAINT), OVERRIDING {USER|SYSTEM} VALUE, RETURNING
  • UPDATE / DELETEset_clause_list with multi-assignment (SET (a,b) = …MultiAssignRef), FROM/USING, WHERE CURRENT OF
  • MERGE — all match kinds (NOT MATCHED BY SOURCE/TARGET) and action forms
  • COPY — both directions, legacy (WITH NULL AS …, USING DELIMITERS) and generic option syntax, COPY (query) TO, and the two action ereports with bison's empty-production error-location chaining
  • PREPARE / EXECUTE / DEALLOCATECREATE TABLE AS EXECUTE deliberately deferred to milestone 6 with the rest of the CREATE machinery
  • CursorsDECLARE (all option flags), FETCH/MOVE with the complete fetch_args direction set, CLOSE

The five opt_with_clause statements (SELECT, INSERT, UPDATE, DELETE, MERGE) share one WITH-prefixed entry point, and PreparableStmt (CTE bodies, COPY (query), PREPARE … AS) now accepts the full statement set. The unreserved-keyword ambiguities — FETCH direction vs a cursor named next/forward/…, DEALLOCATE prepare, WHERE CURRENT OF vs a column named current, insert column list vs parenthesized sub-select, bare SET alias in relation_expr_opt_alias — each resolve by the same single token of lookahead the LALR tables use.

Corpus: 7,337 parse todos and 73 deparse error-path todos graduate (sidecar diffs included). The difftest -summary classifier reports no tree or error mismatches against any implemented statement — every remaining parse todo starts with, or embeds, a milestone 6–7 statement type. go test ./... is green; PLAN.md gets the milestone-5 ✅ and as-built notes.

🤖 Generated with Claude Code

https://claude.ai/code/session_016okPsjeaUU3xf6qGrrEhRK


Generated by Claude Code

…TE, cursors

Port the gram.y DML productions to internal/parse: InsertStmt (insert_rest,
ON CONFLICT with index_params/reloptions, OVERRIDING, RETURNING), UpdateStmt
and DeleteStmt (set_clause_list with multi-assignment, USING, WHERE CURRENT
OF), MergeStmt (merge_when_list and all action forms), CopyStmt (legacy and
generic option syntax, PROGRAM/STDIN checks with bison's empty-production
error locations), PrepareStmt/ExecuteStmt/DeallocateStmt, and the cursor
statements (DECLARE, FETCH/MOVE with the full fetch_args direction set,
CLOSE).

The five opt_with_clause statements share one WITH-prefixed entry point, and
PreparableStmt (CTE bodies, COPY (query), PREPARE ... AS) accepts the full
statement set. The unreserved-keyword ambiguities (FETCH direction vs cursor
name, DEALLOCATE PREPARE, WHERE CURRENT OF, insert column list vs
parenthesized select, bare SET alias) resolve by the same one-token
lookahead the LALR tables use. CREATE TABLE AS EXECUTE stays with milestone
6's CREATE machinery.

Corpus: 7,337 parse todos and 73 deparse error-path todos graduate; the
difftest classifier reports no tree or error mismatches against implemented
statements.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016okPsjeaUU3xf6qGrrEhRK
@kyleconroy
kyleconroy merged commit 528d8b4 into main Aug 16, 2026
2 checks passed
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.

2 participants