Commit ab477e9
sql: parenthesize quantified-subquery receivers of
`write_dot_receiver` listed `AnySubquery`/`AllSubquery` as safe `.` receivers,
but they print as `<expr> <op> ANY/ALL (<query>)` — the trailing `(<query>)`
is only a sub-part of the expression, so a following `.x`/`.*` binds to that
inner subquery rather than the whole quantified comparison. Printed bare, a
`Nested`-stripped `FieldAccess`/`WildcardAccess` over one of these re-associated
on reparse (`(a = ANY (SELECT b FROM t)).c` -> `a = ANY (SELECT b FROM t).c`),
which also surfaced inside `BETWEEN` bounds as an `Expected AND` parse error.
Drop both from the safe set so they are parenthesized. The single-primary
subquery forms (`Subquery`, `ArraySubquery`, `ListSubquery`, `MapSubquery`)
stay safe: they are one `(…)`/`ARRAY(…)` token sequence, so a trailing dot
attaches to the whole thing. The parser only builds these accesses over a
parenthesized receiver (wrapped in `Expr::Nested`), so the change is
churn-free and the datadriven suites are unchanged.
Tests: extends `postfix_access_receiver_reparenthesized_after_nested_stripped`
with the quantified-subquery receiver cases (incl. one inside a `BETWEEN`
bound).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>.field/.*
1 parent 96fda3f commit ab477e9
2 files changed
Lines changed: 13 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
572 | 572 | | |
573 | 573 | | |
574 | 574 | | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
575 | 582 | | |
576 | 583 | | |
577 | 584 | | |
| |||
584 | 591 | | |
585 | 592 | | |
586 | 593 | | |
587 | | - | |
588 | | - | |
589 | 594 | | |
590 | 595 | | |
591 | 596 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1027 | 1027 | | |
1028 | 1028 | | |
1029 | 1029 | | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
1030 | 1036 | | |
1031 | 1037 | | |
1032 | 1038 | | |
| |||
0 commit comments