Side by side
PgSanity vs SQL Formatter
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 LinuxSelf-hosted
Choose PgSanity if you need a free, MIT-licensed way to check PostgreSQL SQL files from a command line or pre-commit workflow. Its use requires Python 3.9 or later and ecpg, so another option may suit environments that cannot provide those dependencies or need a different SQL dialect.
Visit PgSanity Free plan ExtensionLinuxMac+2
SQL Formatter offers broad dialect coverage and several ways to apply consistent query formatting. Its limitations around stored procedures, delimiters, and templates matter for projects that rely on those constructs.
Visit SQL FormatterThe facts
| PgSanity | SQL Formatter | |
|---|---|---|
| Free plan | Yes | Yes |
| Open source | Not published | Not published |
| Runs on | Linux, Self-hosted | Extension, Linux, Mac, Web, Windows |
| Lowest paid plan | Free or on request | Free or on request |
| Plans published | 1 | 1 |
| Maker | Not published | Not published |
| Website | github.com | sql-formatter-org.github.io |
| On sql linters and formatters | #6 of 26 | #10 of 26 |
PgSanity: what it does well
- Checks one or multiple SQL filenames and identifies errors by file and line.
- Reads SQL from standard input when no filenames are provided.
- Returns distinct exit statuses for clean syntax and errors.
- Includes a pre-commit hook named pgsanity_lint.
- Installable with pip or uv, and available through FreeBSD ports.
What to know first
- Requires Python 3.9 or later and ecpg.
- Supports PostgreSQL SQL only.
- Designed for Linux and self-hosted use.
SQL Formatter: what it does well
- Free and released under the MIT license.
- Supports a wide range of SQL dialects.
- CLI can update a file in place.
- Offers VS Code and Vim extensions.
- Can replace placeholders with supplied values.
What to know first
- Stored procedures are not supported.
- Delimiter changes from semicolons are unsupported.
- Templating syntax is not directly supported.
- Maintainer says new features are unlikely.
Alternatives to PgSanity Alternatives to SQL Formatter The whole list
