Side by side
pgFormatter vs sqlfmt
Both stand on sql linters and formatters. Which one you can start free with, which one lets you read the code, and what each costs once you pay.
Free plan APILinuxSelf-hosted+1
pgFormatter offers configurable SQL formatting through console and CGI use, with editor and pre-commit options. The online demo has a query-length limit, and other databases may require custom function or keyword lists.
Visit pgFormatter Free plan APILinuxSelf-hosted+1
sqlfmt provides several ways to format PostgreSQL SQL, plus tools for working with EXPLAIN plans. Its stated best-effort areas matter if your SQL uses deep nesting or less common upsert and DDL forms.
Visit sqlfmtThe facts
| pgFormatter | sqlfmt | |
|---|---|---|
| Free plan | Yes | Yes |
| Open source | Not published | Not published |
| Runs on | API, Linux, Self-hosted, Web | API, Linux, Self-hosted, Web |
| Lowest paid plan | Free or on request | Free or on request |
| Plans published | 1 | 1 |
| Maker | Not published | Not published |
| Website | github.com | github.com |
| On sql linters and formatters | #4 of 26 | #8 of 26 |
pgFormatter: what it does well
- Free software under the PostgreSQL Licence.
- Offers case, indentation, wrapping, and comma controls.
- Can obscure query literals before formatting.
- Supports console, CGI, and JSON responses.
- Documents editor and pre-commit integrations.
What to know first
- Online demo limits queries to ten thousand characters.
- Other-database functions and keywords need custom lists.
sqlfmt: what it does well
- Formats PostgreSQL SQL in browser without installation.
- CLI supports in-place rewriting and unified diffs.
- EXPLAIN tools compare plan structures.
- Includes Emacs and Vim integrations.
- Released under the PostgreSQL Licence.
What to know first
- Supports PostgreSQL only.
- Nested subqueries remain best-effort formatting cases.
- Uncommon upsert or DDL forms remain best-effort.
- WebAssembly builds require tinygo and wasm-opt.
Alternatives to pgFormatter Alternatives to sqlfmt The whole list