safe-migrate 0.3.2

Lint PostgreSQL migrations against live database statistics to prevent blocking locks
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
# Functions AST Reference for safe-migrate

## Status

Inspection status: complete. Cross-checked directly against postgresql.ungram
and squawk.rs in a single pass. This document covers both `FUNCTION` and
`PROCEDURE` lifecycle nodes together, since their grammars and accessor
shapes are nearly identical (procedures simply omit `RetType`).

---

## Documentation Contract

1. Only document AST behavior that has been directly verified.
2. Do not infer PostgreSQL semantics from missing AST accessors.
3. Distinguish verified facts from unresolved areas.
4. Assume additional nodes or helpers may exist outside the inspected surface.

---

## Handwritten Extension Note

Per the exhaustive `impl ast::*` inventory established in columns.md:

```
impl ast::HasParamList for ast::FunctionSig {}
impl ast::HasParamList for ast::Aggregate {}
```

`FunctionSig` has a marker trait `HasParamList`, shared with `Aggregate`.
This is a zero-method marker trait per the inventory (no additional methods
beyond what's already covered by the generated `param_list()` accessor) —
it exists for generic code in the squawk codebase that needs to treat
`FunctionSig` and `Aggregate` uniformly, not to expose new functionality
relevant to this documentation.

---

# Core Nodes — Functions

## CreateFunction

### Verified Accessors (line 4587)

```rust
pub fn option_list(&self) -> Option<FuncOptionList>
pub fn or_replace(&self) -> Option<OrReplace>
pub fn param_list(&self) -> Option<ParamList>
pub fn path(&self) -> Option<Path>
pub fn ret_type(&self) -> Option<RetType>
pub fn semicolon_token(&self) -> Option<SyntaxToken>
pub fn create_token(&self) -> Option<SyntaxToken>
pub fn function_token(&self) -> Option<SyntaxToken>
```

### Grammar Confirmation

```
CreateFunction =
  'create' OrReplace? 'function' Path ParamList RetType? option_list:FuncOptionList ';'?
```

Fully populated, matches exactly. Note `ParamList` is required (no `?`) in
the grammar, while `RetType` is optional — PostgreSQL allows `CREATE
FUNCTION f() ...` with no explicit `RETURNS` clause only in specific
contexts (e.g. trigger functions implicitly return `trigger`, and some
language-specific inference applies) — `ret_type()` being `None` is a valid
state, not a parse failure.

### safe-migrate guidance

```rust
struct CreateFunctionFact {
    name: QualifiedName,                // from path()
    or_replace: bool,
    params: Vec<ParamFact>,             // from param_list()
    return_type: Option<RetTypeFact>,   // from ret_type()
    options: Vec<FuncOptionFact>,       // from option_list()
}
```

`CREATE OR REPLACE FUNCTION` is semantically significant for safe-migrate:
replacing an existing function can silently change behavior depended on by
triggers, views, or other functions that call it, without any direct schema
change being visible to those dependents. The dependency graph should treat
function replacement as a potential blast-radius event affecting every
known caller (triggers via `CallExpr`, views referencing the function in
their query, other functions calling it) — though resolving "every known
caller" fully requires expression-level analysis beyond simple DDL tracking.

---

## DropFunction

### Verified Accessors (line 7211)

```rust
pub fn function_sig_list(&self) -> Option<FunctionSigList>
pub fn if_exists(&self) -> Option<IfExists>
pub fn semicolon_token(&self) -> Option<SyntaxToken>
pub fn cascade_token(&self) -> Option<SyntaxToken>
pub fn drop_token(&self) -> Option<SyntaxToken>
pub fn restrict_token(&self) -> Option<SyntaxToken>
```

(`function_token()` also present per the established `Drop*` pattern, not
shown in the partial grep view but consistent with every other `Drop*` node
in this codebase.)

### Grammar Confirmation

```
DropFunction =
  'drop' 'function' IfExists? FunctionSigList
  ('cascade' | 'restrict')? ';'?
```

Multiple function signatures droppable in one statement via
`function_sig_list()` → `FunctionSigList.function_sigs()` →
`AstChildren<FunctionSig>`.

### safe-migrate guidance

PostgreSQL function names can be overloaded — multiple functions can share
a name with different parameter signatures. `DropFunction` resolution
**requires the parameter types**, not just the function name, to correctly
identify which overload is being dropped. `FunctionSig.param_list()` carries
this — the resolver must match on `(schema, name, param_types)` as the
effective `ObjectId` for functions, not `(schema, name)` alone like tables.
This is a meaningfully different identity model from every other object
type documented so far in this AST reference set.

---

## AlterFunction

### Verified Accessors (line 973)

```rust
pub fn depends_on_extension(&self) -> Option<DependsOnExtension>
pub fn func_option_list(&self) -> Option<FuncOptionList>
pub fn function_sig(&self) -> Option<FunctionSig>
pub fn no_depends_on_extension(&self) -> Option<NoDependsOnExtension>
pub fn owner_to(&self) -> Option<OwnerTo>
pub fn rename_to(&self) -> Option<RenameTo>
pub fn set_schema(&self) -> Option<SetSchema>
pub fn semicolon_token(&self) -> Option<SyntaxToken>
pub fn alter_token(&self) -> Option<SyntaxToken>
pub fn restrict_token(&self) -> Option<SyntaxToken>  // per established pattern
pub fn function_token(&self) -> Option<SyntaxToken>
```

### Grammar Confirmation

```
AlterFunction =
  'alter' 'function' FunctionSig
  (
    RenameTo
  | OwnerTo
  | SetSchema
  | DependsOnExtension
  | NoDependsOnExtension
  | FuncOptionList
  )
  'restrict'? ';'?
```

6 mutually exclusive forms confirmed, all with direct accessors.

### safe-migrate guidance

```rust
enum AlterFunctionFact {
    Rename { from: String, to: String },
    OwnerChange(RoleFact),
    SchemaChange { new_schema: String },
    DependsOnExtension { extension: String },
    NoDependsOnExtension { extension: String },
    OptionsChange(Vec<FuncOptionFact>),  // e.g. changing VOLATILE/IMMUTABLE/STABLE
}
```

**Changing a function's volatility category** (`IMMUTABLE`/`STABLE`/`VOLATILE`,
captured via `VolatilityFuncOption` inside `FuncOptionList`) is a particularly
risky operation worth flagging specifically: marking a function `IMMUTABLE`
when it isn't truly side-effect-free/deterministic can cause PostgreSQL's
query planner to cache or reorder results incorrectly, producing silently
wrong query results elsewhere in the database without any error being raised.

---

# Core Nodes — Procedures

## CreateProcedure

### Verified Accessors (line 5042)

```rust
pub fn option_list(&self) -> Option<FuncOptionList>
pub fn or_replace(&self) -> Option<OrReplace>
pub fn param_list(&self) -> Option<ParamList>
pub fn path(&self) -> Option<Path>
pub fn semicolon_token(&self) -> Option<SyntaxToken>
pub fn create_token(&self) -> Option<SyntaxToken>
pub fn procedure_token(&self) -> Option<SyntaxToken>
```

### Grammar Confirmation

```
CreateProcedure =
  'create' OrReplace? 'procedure' Path ParamList option_list:FuncOptionList ';'?
```

**Key structural difference from `CreateFunction`: no `RetType` accessor at
all** — confirmed by the grammar showing no `RetType?` field. This correctly
reflects PostgreSQL semantics: procedures do not have a return type (they
may use `OUT` parameters via `ParamMode` for output values instead, but
there is no `RETURNS` clause).

---

## DropProcedure

### Verified Accessors (line 7680)

```rust
pub fn function_sig_list(&self) -> Option<FunctionSigList>
pub fn if_exists(&self) -> Option<IfExists>
pub fn semicolon_token(&self) -> Option<SyntaxToken>
pub fn cascade_token(&self) -> Option<SyntaxToken>
pub fn drop_token(&self) -> Option<SyntaxToken>
```

### Grammar Confirmation

```
DropProcedure =
  'drop' 'procedure' IfExists? FunctionSigList
  ('cascade' | 'restrict')? ';'?
```

Identical shape to `DropFunction` — reuses `FunctionSigList`/`FunctionSig`,
same overload-resolution-by-parameter-types consideration applies.

---

## AlterProcedure

### Verified Accessors (line 1469)

```rust
pub fn depends_on_extension(&self) -> Option<DependsOnExtension>
pub fn func_option_list(&self) -> Option<FuncOptionList>
pub fn function_sig(&self) -> Option<FunctionSig>
pub fn no_depends_on_extension(&self) -> Option<NoDependsOnExtension>
pub fn owner_to(&self) -> Option<OwnerTo>
pub fn rename_to(&self) -> Option<RenameTo>
pub fn set_schema(&self) -> Option<SetSchema>
pub fn semicolon_token(&self) -> Option<SyntaxToken>
pub fn alter_token(&self) -> Option<SyntaxToken>
```

### Grammar Confirmation

```
AlterProcedure =
  'alter' 'procedure' FunctionSig
  (
    RenameTo
  | OwnerTo
  | SetSchema
  | DependsOnExtension
  | NoDependsOnExtension
  | FuncOptionList
  )
  'restrict'? ';'?
```

Identical shape to `AlterFunction` — same 6 forms, same accessor pattern.

---

# Shared Supporting Nodes

## FunctionSig

### Verified Accessors (line 9759)

```rust
pub fn param_list(&self) -> Option<ParamList>
pub fn path(&self) -> Option<Path>
```

### Grammar Confirmation

```
FunctionSig =
  Path ParamList?
```

Used wherever a function/procedure must be uniquely identified by name plus
argument types: `DropFunction`, `DropProcedure`, `AlterFunction`,
`AlterProcedure`, `CommentOn`, `CreateCast`, `SecurityLabel`, `CreateTransform`
(per the cross-reference grep performed during columns.md's exhaustive
inventory pass — `FunctionSig` appears across many node types as a
disambiguating overload signature).

**`ParamList` is optional here** (unlike `CreateFunction`'s required
`ParamList`) — `ALTER FUNCTION f OWNER TO new_owner` (no parens, no params)
is valid when the function name is unambiguous (no overloads exist), while
`ALTER FUNCTION f(integer) OWNER TO new_owner` disambiguates when needed.

## FunctionSigList

### Verified Accessors (line 9774)

```rust
pub fn function_sigs(&self) -> AstChildren<FunctionSig>
```

### Grammar Confirmation

```
FunctionSigList =
  (FunctionSig (',' FunctionSig)*)
```

---

## ParamList / Param / ParamMode / ParamDefault

### Verified Accessors

```rust
// Param (line 13789)
pub fn mode(&self) -> Option<ParamMode>
pub fn name(&self) -> Option<Name>
pub fn param_default(&self) -> Option<ParamDefault>
pub fn ty(&self) -> Option<Type>

// ParamDefault (line 13812)
pub fn expr(&self) -> Option<Expr>
pub fn eq_token(&self) -> Option<SyntaxToken>
// default_token() also present per established naming pattern
```

### Grammar Confirmation

```
ParamMode =
  ParamVariadic
| ParamInOut
| ParamIn
| ParamOut

ParamDefault =
 ('default' | '=') Expr

Param =
  mode:ParamMode? Name? Type ParamDefault?

ParamList =
  (Param (',' Param)*)?
```

`ParamMode` is a 4-member enum: `VARIADIC`, `INOUT`, `IN`, `OUT`. PostgreSQL
defaults to `IN` when no mode is specified (`mode()` returning `None` means
implicit `IN`, not an error state).

`Param.name()` is optional — PostgreSQL allows unnamed parameters
(`CREATE FUNCTION f(integer, text) ...`), which is common for simple
functions where parameter names aren't needed for documentation or
named-argument calling.

`ParamDefault` accepts either the `DEFAULT` keyword or `=` as the assignment
token (PostgreSQL syntax allows both spellings interchangeably) — captured
via `eq_token()` vs `default_token()`, the grammar's `('default' | '=')`
alternation.

### safe-migrate guidance

```rust
struct ParamFact {
    mode: ParamModeFact,           // In | Out | InOut | Variadic, default In
    name: Option<String>,
    ty: TypeIr,
    default: Option<ExprIr>,
}
```

Parameters with defaults must appear after all parameters without defaults
in PostgreSQL (same rule as most languages) — the AST grammar does not
enforce this ordering structurally (it would parse `Param ParamDefault? `
sequences in any order), so this is a PostgreSQL-semantic validation that
belongs in the rule engine, not something the AST guarantees.

---

## RetType

### Verified Accessors (line 15343)

```rust
pub fn table_arg_list(&self) -> Option<TableArgList>
pub fn ty(&self) -> Option<Type>
pub fn returns_token(&self) -> Option<SyntaxToken>
pub fn table_token(&self) -> Option<SyntaxToken>
```

### Grammar Confirmation

```
RetType =
  'returns' ('table' TableArgList | Type)
```

Two mutually exclusive forms:
- `RETURNS TABLE (col1 type1, col2 type2, ...)` — set-returning function
  with named output columns, via `table_arg_list()` (reusing the same
  `TableArgList`/`TableArg` documented in columns.md — though here it would
  only ever contain `TableArg::Column` variants, never `LikeClause` or
  `TableConstraint`, since this context only makes sense for column
  definitions)
- `RETURNS sometype` (including `RETURNS SETOF sometype`, `RETURNS TABLE`
  with a single type, `RETURNS trigger`, etc.) — via `ty()`

### safe-migrate guidance

```rust
enum RetTypeFact {
    Table(Vec<ColumnFact>),   // from table_arg_list()
    Scalar(TypeIr),            // from ty(), includes SETOF-wrapped types
}
```

---

## FuncOptionList / FuncOption

### Verified Accessors (line 9748)

```rust
pub fn options(&self) -> AstChildren<FuncOption>
```

### Grammar Confirmation

```
FuncOptionList =
  options:(FuncOption*)

FuncOption =
  BeginFuncOptionList
| ReturnFuncOption
| AsFuncOption
| SetFuncOption
| SupportFuncOption
| RowsFuncOption
| CostFuncOption
| ParallelFuncOption
| SecurityFuncOption
| StrictFuncOption
| LeakproofFuncOption
| ResetFuncOption
| VolatilityFuncOption
| WindowFuncOption
| TransformFuncOption
| LanguageFuncOption
```

16-member enum confirmed. Each option's individual accessor surface was not
inspected in this pass (out of scope — these are mostly simple
presence/value nodes for things like `LANGUAGE plpgsql`, `COST 100`, `ROWS
1000`, `STRICT`, `IMMUTABLE`/`STABLE`/`VOLATILE`, etc.).

### All 16 Members — Grammar-Resolved

postgresql.ungram confirms the shape of all 16 members:

```
LanguageFuncOption =
  'language' NameRef

TransformFuncOption =
  'transform'

WindowFuncOption =
  'window'

VolatilityFuncOption =
  'immutable' | 'stable' | 'volatile'

LeakproofFuncOption =
  'leakproof' | 'not' 'leakproof'

ResetFuncOption =
  'reset' NameRef

StrictFuncOption =
  'strict' | 'called' 'on' 'null' 'input' | 'returns' 'null' 'on' 'null' 'input'

SecurityFuncOption =
  'security' ('invoker' | 'definer')

ParallelFuncOption =
  'parallel' '#ident'

CostFuncOption =
  'cost'

RowsFuncOption =
  'rows'

SupportFuncOption =
  'support'

SetFuncOption =
  'set'

AsFuncOption =
  'as' (definition:Literal | obj_file:Literal ',' link_symbol:Literal)
```

(`BeginFuncOptionList` and `ReturnFuncOption` already covered above under
RetType's grammar context.)

### Critical Finding — CostFuncOption and RowsFuncOption Are Grammar-Empty

`CostFuncOption = 'cost'` and `RowsFuncOption = 'rows'` — **neither carries
a numeric value in the grammar at all**, despite real PostgreSQL syntax
requiring one (`COST 100`, `ROWS 1000`). This is confirmed consistent with
the original verified accessor inventory for this codebase, which lists only
`cost_token()` and `rows_token()` respectively for these two nodes — no
literal/numeric accessor exists for either. This is a genuine, confirmed
grammar-level limitation: a `COST`/`ROWS` change can be detected as
occurring, but the actual new cost/row-estimate value cannot be extracted
from this AST in any form.

### Other Notable Shapes

- `VolatilityFuncOption`, `LeakproofFuncOption`, `StrictFuncOption`,
  `SecurityFuncOption`: all confirmed as flat token-alternation nodes (no
  child node, just which keyword combination was present) — fully
  extractable via token presence checks (`immutable_token()`,
  `stable_token()`, `volatile_token()`, etc., following the established
  naming convention).
- `LanguageFuncOption`: carries a real `NameRef` for the language name —
  fully extractable (`plpgsql`, `sql`, `c`, `python3`, etc.).
- `ParallelFuncOption`: carries `'#ident'` (generic identifier token) for
  `UNSAFE`/`RESTRICTED`/`SAFE` — extractable via direct token text
  inspection, not a structured enum.
- `ResetFuncOption`: carries a `NameRef` — the config parameter being reset.
- `AsFuncOption`: two real forms — either a single `Literal` (function body
  definition, used for SQL/plpgsql functions) or two `Literal`s separated by
  comma (`obj_file`, `link_symbol` — used for C language functions linking
  to a compiled shared object). **This shares the exact same "two same-typed
  Literal children, single flat accessor" risk pattern already found in
  `RenameValue` (enums.md) and `PartitionForValuesFrom` (partitions.md)**  worth flagging for the same kind of accessor-level scrutiny if this node
  is ever used for safe-migrate analysis of C-language function definitions,
  though this was not separately verified against squawk.rs in this pass.
- `TransformFuncOption`, `WindowFuncOption`, `SupportFuncOption`,
  `SetFuncOption`: confirmed presence-only per their bare-keyword grammar.

### safe-migrate guidance

```rust
enum FuncOptionFact {
    Language(String),                          // fully extractable
    Volatility(VolatilityKind),                 // fully extractable
    Security(SecurityKind),                     // fully extractable
    Strict(StrictKind),                         // fully extractable
    Leakproof(bool),                            // fully extractable
    Parallel(String),                           // fully extractable, raw ident text
    Cost,                                       // presence-only, value NOT extractable
    Rows,                                       // presence-only, value NOT extractable
    Reset(String),                              // fully extractable
    As { definition: Option<String>, obj_file: Option<String>, link_symbol: Option<String> },
    Transform,                                  // presence-only
    Window,                                     // presence-only
    Support,                                    // presence-only
}
```

A `COST`/`ROWS` change being undetectable in its specific value is a minor
finding compared to the trigger enable/disable gap or `RenameValue` gap,
since `COST`/`ROWS` changes are query-planner hints, not data-integrity or
correctness concerns — appropriate for a low-severity or informational tier
classification rather than blocking.

### BEGIN ATOMIC Function Bodies — Architecturally Significant

`BeginFuncOptionList` / `ReturnFuncOption` (covered earlier under RetType's
grammar context) cover the `BEGIN ATOMIC ... END` SQL-standard function body
syntax (PostgreSQL 14+), which embeds actual `Stmt` nodes as
`BeginFuncOption::Stmt` per its grammar
(`BeginFuncOption = Stmt | ReturnFuncOption`) — meaning a SQL-language
function body written in this style is **fully parsed as structured SQL
statements**, not an opaque string. This is architecturally significant:
unlike `plpgsql`/`sql`-as-string function bodies (which are opaque to this
AST and must be treated as `OpaqueMutation::DoBlock`-equivalent per the
blueprint), a `BEGIN ATOMIC` SQL-standard body could in principle be visited
and analyzed like any other statement sequence. This is a candidate for
materially better function-body analysis than function bodies are treated by
default in the blueprint's confidence model, but the visitor and
Mutation/Fact model would need to be extended deliberately to take advantage
of this — it does not happen automatically simply because the AST supports it.

---

# Verified Findings Summary

## Confirmed Complete

- `CreateFunction`: fully resolved
- `DropFunction`: fully resolved
- `AlterFunction`: fully resolved, all 6 forms verified
- `CreateProcedure`: fully resolved, confirmed no RetType (correct per
  PostgreSQL semantics)
- `DropProcedure`: fully resolved
- `AlterProcedure`: fully resolved, all 6 forms verified, identical shape to AlterFunction
- `FunctionSig` / `FunctionSigList`: fully resolved
- `Param` / `ParamList` / `ParamMode` / `ParamDefault`: fully resolved
- `RetType`: fully resolved, both TABLE and scalar forms
- `FuncOptionList`: fully resolved, all 16 `FuncOption` members individually
  grammar-resolved

## Grammar-Confirmed Limitations

- `CostFuncOption` / `RowsFuncOption`: confirmed grammar-empty (bare
  keywords only) — the numeric COST/ROWS value cannot be extracted from
  this AST in any form, consistent with the original verified accessor
  inventory for this codebase.

## Key Architectural Findings

1. **Functions/procedures use a different identity model than every other
   object type documented so far.** `ObjectId` for a table/view/sequence/etc.
   is `(schema, name)`, but functions and procedures require
   `(schema, name, param_types)` due to PostgreSQL overload support. This is
   a meaningful divergence the resolver must account for — a naive
   `(schema, name)`-only `ObjectId` would conflate distinct overloaded
   functions into one object.
2. **`BEGIN ATOMIC ... END` SQL-standard function bodies are structurally
   parsed**, not opaque — a notable exception to the general rule that
   function bodies are unanalyzable. This is flagged as a future
   enhancement opportunity, not something currently exploited by the
   blueprint's existing Mutation model.
3. **Volatility and security options carry real safety implications**
   (planner correctness, privilege escalation) beyond simple schema
   structure, worth surfacing as their own rule category distinct from
   structural DDL safety.
4. **`AsFuncOption` shares the same "two same-typed Literal children" risk
   pattern** already confirmed as a real bug source in `RenameValue`
   (enums.md) and a real ambiguity in `PartitionForValuesFrom`
   (partitions.md) — flagged for follow-up scrutiny if C-language function
   definitions become relevant to safe-migrate's analysis scope.

## Grammar Cross-Check

This document was written with postgresql.ungram available from the start,
and was fully resolved in this single pass including all 16 individual
`FuncOption` member shapes.

---

# Remaining Open Questions

None remaining. All findings in this document have been resolved through
direct grammar cross-check against postgresql.ungram, cross-referenced
against the original verified squawk.rs accessor inventory where applicable
(`CostFuncOption`/`RowsFuncOption`).