AlterTableStatement.SQL() wrote multiple actions separated only by spaces
("ALTER TABLE t ADD COLUMN a INT DROP COLUMN b"), so the output re-parsed
differently or not at all. It now writes ", " between actions, matching
the compact formatter's visitor renderer. Found by the audit's FMT-1
verifier, which keeps AlterTable off the compact SQL() fast path until
this lands.
Tests reproduce the bug in all 11 parser dialects; differential checks
compare SQL() with the compact formatter output and a re-parse round trip
for 152 ALTER TABLE statements from the real-world corpora and 1,083
accepted parser-test input/dialect combinations.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
Summary
Correctness fix W5-02b from the 2026-11 performance audit. The FMT-1 verifier found it while routing statements through
SQL(). Codex implemented it; Opus reviewed it and ran the full gate.AlterTableStatement.SQL()separated multiple actions with spaces only, for exampleALTER TABLE t ADD COLUMN a INT DROP COLUMN b, so its output re-parsed as different SQL or failed to parse. It now writes,between actions. That matches the formatter's compact visitor output:ALTER TABLE t ADD COLUMN a INT, DROP COLUMN b. Single-action statements are unchanged.This PR is ready for review, not a draft, because it is a bug fix independent of the perf gate. Once it lands, AlterTable can join the compact
SQL()fast path in #904 in a follow-up.Test Plan
pkg/sql/ast/alter_table_sql_test.go:SQL()to equal the compact formatter output and to round-trip through a re-parse:testdata/realworld/*andtestdata/corpus/*;go run honnef.co/go/tools/cmd/staticcheck@latest ./pkg/sql/ast/...task checktask test:cbindinggo test -count=1 ./pkg/compatibility/...Breaking Changes
None to the API.
SQL()output for multi-action ALTER TABLE changes from invalid spacing to comma-separated actions, as recorded in the CHANGELOG under Fixed.🤖 Generated with Claude Code
https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2