Introducing sqlfmt: an SQL gofmt-style formatter
sqlfmt is a new opinionated SQL formatter inspired by gofmt, implementing the 'river alignment' style from The Art of PostgreSQL. It right-pads all clause keywords (select, from, where, group by, etc.) to the same column at each nesting level, creating a vertical river with expressions flowing to the right. The tool uses a tokenizer rather than an AST for robustness and comment preservation. It ships with a CLI mirroring gofmt's interface (-w, -l, -d flags), editor plugins for Emacs and Vim/Neovim, and a WebAssembly-powered web formatter (~130 KB compressed). Install via `go install github.com/dimitri/sqlfmt/cmd/sqlfmt@latest`. The style enforces lowercase keywords, trailing commas, and and/or at line starts. A correctness oracle using pganalyze/pg_query_go verifies formatting never changes query semantics.