Suggestions appear as you type. Use the up and down arrows to choose one and Enter to open it.

This page's audience our own tag's counts — open to see them
–Visits
–Page views
–Clicks to vendors
–Time on page
–Reading now
Clicks to vendors, by tool
  • –
Top countries
  • –
Devices
  • –

– · visits, page views and clicks counted by our own tag, which counts more than our checked analytics; every figure rounded down · how we count

PgSanity

Free#23 of 25 in SQL Linters and Formatters

PgSanity: A focused PostgreSQL syntax checker for command-line and pre-commit workflows. Ranked #23 of 25 in SQL Linters and Formatters by our editors (6.3/10); pricing: Free plan; best for postgreSQL syntax checks in pre-commit.

6.3/10Editor score
PgSanity6.3 Visit PgSanity

At a glance

  • Editor score
    6.3 / 10
  • Pricing
    Free plan
  • Best for
    PostgreSQL syntax checks in pre-commit
  • Free plan
    Yes
  • Paid from
    Free
  • Supported SQL dialects
    PostgreSQL
  • Facts checked
    20 Sep 2026
PgSanity screenshot
  • Where it wins

    • Uses PostgreSQL’s parser for focused syntax checks
    • Accepts multiple files or SQL from standard input
    • Reports error locations and works as a pre-commit hook
  • Where it doesn't

    • Supports PostgreSQL syntax rather than multiple SQL dialects
    • Requires Python and ecpg for installation and operation
    • Does not provide verified formatting, autofix, editor, or CI breadth

Our verdict on PgSanity

PgSanity is an open-source command-line utility for checking PostgreSQL SQL syntax. It is aimed at developers and teams that want a focused validation step for SQL files, scripts, or pre-commit workflows. The tool uses ecpg, which relies on PostgreSQL’s parser, to identify syntax errors and report their locations and messages. It accepts one or multiple filenames, or reads SQL from standard input when no filenames are supplied. PgSanity runs on Linux and is distributed through pip or uv.

Its main strength is parser alignment: checks use PostgreSQL’s own parsing path rather than a generic SQL interpretation. That makes the tool a focused fit for PostgreSQL repositories where syntax validation matters more than a broad database-linting feature set. Exit status 0 indicates valid syntax, while status 1 indicates that errors were found, giving command-line workflows a clear result to act on. The pre-commit integration also places checks directly into a source-control workflow, while standard input support can suit pipelines and generated SQL.

Setup is oriented toward command-line environments and requires Python and ecpg, so teams should account for those dependencies when preparing development systems or automation. PgSanity stays narrow: it checks syntax but does not provide verified SQL formatting or autofix, and its published positioning does not extend to editor or broader CI capabilities. Choose it when PostgreSQL-only syntax checks, file handling, standard input, and pre-commit integration are the priority. Choose a broader SQL tool instead when formatting, automatic corrections, editor integration, or wider workflow coverage are central requirements.

Your product? Our editors can test PgSanity in depth and publish a review, labelled as paid · from $149/mo →

PgSanity pricing

Plans Free planFree Free to use — no paid tier required for the core job.
See plans on github.com

PgSanity fact sheet

Free planYes
Paid fromFree
Supported SQL dialectsPostgreSQL
Automatic fixesNot verified
Custom rulesNot verified
Editor extensionsNot verified
CI/CD integrationNot verified
Configuration fileNot verified
DeploymentSelf-hosted
PlatformsLinux
SupportCommunity, Docs
Built forSolo, Small business, Mid-market, Enterprise (editorial estimate)
Integrations1 integrations: pre-commit
PricingFree plan
Websitegithub.com
Facts checked20 Sep 2026

PgSanity integrations

PgSanity lists 1 integrations on its own site.

  • pre-commit

Alternatives to PgSanity

See all PgSanity alternatives →

Used PgSanity? Be the first to review it

The editor score above is our own research. What this page doesn't have yet is a reader's view — what you used PgSanity for, what worked and what didn't. No stars are seeded and no review is paid for; an editor reads every one before it appears.

Write a reviewTwo minutes · verified accounts only · read by an editor before it appears

Reviews come only from verified accounts. Sign in or create an account first — your e-mail is never shown.

Your rating

0 characters · at least 80, up to 3,000

Posted from your verified account. Reviews appear after an editor reads them, usually within two working days.

Featured on iTechGuides

Featured on iTechGuides — PgSanity 6.3/10

PgSanity is listed in our SQL Linters and Formatters directory. Add the badge to your site — it links back to this page.

<a href="https://www.itechguides.com/products/pgsanity/"><img src="https://www.itechguides.com/best/badge/pgsanity.svg" alt="Featured on iTechGuides" width="230" height="46"></a>

Reviewed by iTechGuides Editors · Editorial team · Updated Oct 2026

Advertiser disclosure: iTechGuides is reader-supported. Vendors can pay for top positions in our rankings and for a place on other products' pages, and we may earn a commission when you click some links. Bought places stand at the number bought; this page and our disclosure say so. Paying vendors may get a fuller, more detailed review from our editors, and that review can change their score. How we rank.

Last updated · How we research and update