Milestone 5: DML — INSERT, UPDATE, DELETE, MERGE, COPY, PREPARE/EXECUTE, cursors - #5
Merged
Merged
Conversation
…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
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.
Ports the gram.y DML productions to
internal/parse(newdml.go, each production tagged with itsgram.yrule):insert_restin all five forms,ON CONFLICT(inference with fullindex_paramsincluding collation/opclass/reloptions, andON CONSTRAINT),OVERRIDING {USER|SYSTEM} VALUE,RETURNINGset_clause_listwith multi-assignment (SET (a,b) = …→MultiAssignRef),FROM/USING,WHERE CURRENT OFNOT MATCHED BY SOURCE/TARGET) and action formsWITH NULL AS …,USING DELIMITERS) and generic option syntax,COPY (query) TO, and the two action ereports with bison's empty-production error-location chainingCREATE TABLE AS EXECUTEdeliberately deferred to milestone 6 with the rest of the CREATE machineryDECLARE(all option flags),FETCH/MOVEwith the completefetch_argsdirection set,CLOSEThe five
opt_with_clausestatements (SELECT, INSERT, UPDATE, DELETE, MERGE) share one WITH-prefixed entry point, andPreparableStmt(CTE bodies,COPY (query),PREPARE … AS) now accepts the full statement set. The unreserved-keyword ambiguities — FETCH direction vs a cursor namednext/forward/…,DEALLOCATE prepare,WHERE CURRENT OFvs a column namedcurrent, insert column list vs parenthesized sub-select, bareSETalias inrelation_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 -summaryclassifier 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