@@ -392,15 +392,18 @@ gate; the corpus harness exists before the first line of the lexer.
3923925 . ** DML.** ✅ * Landed 2026-08-16.* ` INSERT ` (` ON CONFLICT ` , ` OVERRIDING ` ),
393393 ` UPDATE ` , ` DELETE ` , ` MERGE ` , ` RETURNING ` , ` COPY ` , ` PREPARE ` /` EXECUTE ` ,
394394 cursors. See "As-built notes (milestone 5)".
395- 6 . ** DDL, part 1.** ` CREATE ` /` ALTER TABLE ` (the second-biggest grammar
396- region: constraints, partitioning, identity, storage options),
397- ` CREATE INDEX ` , views, sequences, schemas.
398- 7 . ** DDL, part 2 + utility.** The long tail of ~ 150 statement types:
399- functions/procedures, triggers, policies, roles/grants, types/domains,
400- FDWs, publications/subscriptions, ` EXPLAIN ` /` VACUUM ` /` SET ` /` SHOW ` , event
401- triggers, … ` SplitWithParser ` and ` IsUtilityStmt ` fall out here.
395+ 6 . ** DDL, part 1.** ✅ * Landed 2026-08-16.* ` CREATE ` /` ALTER TABLE ` (the
396+ second-biggest grammar region: constraints, partitioning, identity,
397+ storage options), ` CREATE INDEX ` , views, sequences, schemas. See
398+ "As-built notes (milestones 6–7)".
399+ 7 . ** DDL, part 2 + utility.** ✅ * Landed 2026-08-16.* The long tail of ~ 150
400+ statement types: functions/procedures, triggers, policies, roles/grants,
401+ types/domains, FDWs, publications/subscriptions,
402+ ` EXPLAIN ` /` VACUUM ` /` SET ` /` SHOW ` , event triggers, … ` SplitWithParser ` and
403+ ` IsUtilityStmt ` ship here.
402404 ** Gate for 4–7:** 100% of the regress corpus — trees, JSON bytes, error
403- messages, cursor positions.
405+ messages, cursor positions — met: the parse suite's todo list is empty
406+ (42,970 cases across every tier), as are scan and both split suites.
4044078 . ** Normalize + Fingerprint.** Port ` pg_query_normalize.c ` (constant
405408 locations → ` $n ` , ` NormalizeUtility ` ); generated fingerprint walk + the
406409 hand-written special cases. ** Gate:** all normalize/fingerprint goldens,
@@ -555,6 +558,46 @@ Measured at the pin, where the plan's estimates differ:
555558 and the ` -summary ` classifier shows no tree or error mismatches against
556559 any implemented statement.
557560
561+ ### As-built notes (milestones 6–7)
562+
563+ - Statement dispatch is a family of lookahead routers
564+ (` internal/parse/ddl_dispatch.go ` , ` ddl_alter_generic.go ` ): each
565+ CREATE/ALTER/DROP object-kind arm parses the object reference once, then
566+ the following token picks the production, mirroring how the LALR tables
567+ keep RenameStmt/AlterObjectSchemaStmt/AlterOwnerStmt/
568+ AlterObjectDependsStmt alive alongside each object's own ALTER statement.
569+ A shared ` parseAlterGenericTail ` implements the four generic tails with a
570+ per-kind support mask, so ` ALTER LANGUAGE x SET SCHEMA ` still fails at
571+ the token bison would reject.
572+ - The CreateStmt/CreateAsStmt ambiguity (` CREATE TABLE t (…) ` element list
573+ vs. ` create_as_target ` column list) is the one new bounded-backtracking
574+ site: the CTAS reading is tried first and commits only when its ` AS `
575+ arrives, else the position resets and the element list parses.
576+ - C's zero-valued enums surface as their proto-shifted spellings, which the
577+ goldens made explicit: every ` AlterTableCmd ` /` RenameStmt ` carries
578+ ` behavior: DROP_RESTRICT ` , ` RenameStmt.relationType ` defaults to
579+ ` OBJECT_ACCESS_METHOD ` , and ` AlterPublicationStmt.action ` to
580+ ` AP_AddObjects ` . Two NIL-vs-empty-list shapes matter: the zero-argument
581+ ` (*) ` aggregate stores a null list element in ` DefineStmt.args ` , and an
582+ empty ` BEGIN ATOMIC ` body stores ` [NIL] ` , not ` [[]] ` .
583+ - Support-function ereports carry their C call site's funcname
584+ (` processCASbits ` , ` SplitColQualList ` , ` makeOrderedSetArgs ` ,
585+ ` preprocess_pubobj_list ` , …), and ` ConstraintAttributeSpec ` 's own
586+ location is always -1 (PG's ` YYLLOC_DEFAULT ` gives empty productions -1
587+ and the left recursion propagates it), so ` processCASbits ` errors have no
588+ cursor position.
589+ - The ` base_yylex ` -merged ` *_LA ` tokens keep their first word's keyword
590+ classification in the lexer but are never identifiers in the grammar; the
591+ identifier-class helpers reject them (found via ` nulls first ` in
592+ ` index_elem ` , where ` NULLS_LA ` must not parse as an opclass name).
593+ - ` makeRangeVarFromAnyName ` builds via ` makeNode ` , so ` inh ` stays false —
594+ unlike ` makeRangeVar ` 's true — which the CompositeTypeStmt goldens pin.
595+ - ` cmd/difftodo ` (debug aid) prints input/want/got for a file's remaining
596+ parse todos; it drove the long-tail mismatch hunt to zero.
597+ - Corpus effect: all 19,787 remaining parse todos graduated, plus the 8
598+ ` split_parser ` cases. The remaining todo suites (deparse, fingerprint,
599+ normalize, normalize_utility) belong to milestones 8–9.
600+
558601## Regeneration (the PostgreSQL-upgrade story)
559602
560603Everything derived is derived by committed tooling from the pin:
0 commit comments