@pgsql/lint
Lint Your SQL Before It Ships
A linter for SQL and PL/pgSQL that reads function definitions as ASTs, with no database connection. It flags search_path tricks, unqualified references and dynamic SQL in migrations, editors and CI.
No Database Needed
Pure AST analysis of the SQL text
Built for CI
Lint only the .sql files a branch changed
Waivers With Reasons
ESLint-style inline comments, kept as accepted risk
@pgsql/lint Features
Four rules for SQL that never depends on search_path
No search_path Tricks
Flags SET search_path clauses and set_config calls on search_path (C1).
Qualified References
Flags unqualified relations, so FROM users becomes FROM app_public.users (C3).
Dynamic SQL Is Exceptional
Flags EXECUTE in all its forms; a waiver must say why (C4).
No Ambiguity Overrides
Flags #variable_conflict directives instead of letting them hide name clashes (C2).
CLI and Config
pgsql-lint scans files or directories and reads .pgsqllintrc.json, with extends, ignores and severities.
Changed Files Only
--changed lints just what the branch touched against its merge base, so a CI gate takes seconds.
Run It Anywhere
Point pgsql-lint at files or directories. It exits 1 when an error-level finding remains, so it drops straight into CI.
Waive With a Reason
Suppress a finding in the function body itself. The comment survives pg_get_functiondef, and the finding is reported as acknowledged.