Skip to main content

Wrap Context Regressions

Minimized repros for first-operand wrap bugs surfaced by the clickhouse statement battery during the Rust-port parity drive. Both were fixed by the WrapContext hardening in ClarifyStructure (NO_FIRST_WRAP / NO_FIRST_WRAP_STICKY + the transparent-opener rule).

EXPLAIN settings glued to the query paren

EXPLAIN PLAN <settings> (SELECT …) — the parenthesized query is the first operand of a nested sequence. Wrapping used to glue the last setting value to the open paren (pretty = 1(SELECT), which reparses differently and broke roundtripping.

EXPLAIN PLAN actions = 1, compact = 1, pretty = 1 (SELECT number FROM numbers(10) ORDER BY number)
explain PLAN actions = 1, compact = 1, pretty = 1 (select number from numbers (10) order by number)

view() table function keeps FUNCTION spacing

view(SELECT …) is a table function: the paren must stay glued to view. The formatter used to flap between view( and view ( across passes (reparse changed the production and the FUNCTION-kind promotion was lost), breaking idempotency.

SELECT * FROM view(SELECT 1)
select * from view (select 1)