prettier-plugin-postgresql weekly downloads statistics
By schallm (2 listings) · npm · Prettier plugins
Prettier plugin for PostgreSQL using the official libpg_query parser
prettier-plugin-postgresql has 300 recorded weekly downloads on npm, an increase of 1665% over the past 30 days.
It ranks #1546 of 2,251 tracked npm listings by weekly downloads.
Over 90 days, weekly downloads changed by +97.4%.
PluginStats has 121 daily observations since Jun 19, 2026; the latest is from Oct 17, 2026.
About prettier-plugin-postgresql
prettier-plugin-postgresql
Beta — covers the core PostgreSQL DML and DDL statement set. A number of uncommon top-level statements (e.g. CREATE CAST, ALTER DOMAIN, CREATE CONVERSION, CREATE STATISTICS, CREATE TEXT SEARCH …, CREATE OPERATOR CLASS, ALTER DEFAULT PRIVILEGES, CREATE / ALTER / DROP DATABASE, CREATE FOREIGN DATA WRAPPER) have no printer yet and are kept exactly as written (case and spacing included) instead. Inside a statement the formatter has a printer for, a construct it can't print raises an explicit Unsupported … error (for example a type modifier that is an expression, foo(1 + 1)) — it never silently drops or changes anything. The test suite enforces this by comparing the PostgreSQL parse tree before and after formatting.
A Prettier plugin for PostgreSQL SQL. Parses SQL with libpg_query (the actual PostgreSQL parser, from PostgreSQL 18) and formats it using Prettier's document IR for consistent, readable output.
Features
DML
• SELECT — column lists, table aliases, all JOIN types (INNER, LEFT, RIGHT, FULL, CROSS, NATURAL), WHERE, GROUP BY / HAVING, ORDER BY, LIMIT / OFFSET, FETCH FIRST … WITH TIES, DISTINCT, DISTINCT ON • Set operations — UNION / UNION ALL / INTERSECT / EXCEPT, with WITH / ORDER BY / LIMIT applying to the whole result, and operands parenthesized where they need to be • VALUES — standalone, with WITH, ORDER BY and LIMIT • Subqueries — correlated subqueries, EXISTS, scalar sublinks, ARRAY(subquery), row comparisons ((a, b) value), func(VARIADIC arr) • Ordered-set aggregates — percentile_cont(0.5) WITHIN GROUP (ORDER BY x) • Conditional — CASE / WHEN / THEN / ELSE, COALESCE, NULLIF, GREATEST, LEAST • XML functions — XMLELEMENT (with XMLATTRIBUTES), XMLFOREST, XMLCONCAT, XMLPI, XMLAGG, XMLEXISTS, IS DOCUMENT • XMLTABLE — tabular XML query in the FROM clause; XMLNAMESPACES, alias column lists, PASSING, COLUMNS with PATH, DEFAULT, NOT NULL, FOR ORDINALITY • SQL/JSON functions — JSON_QUERY, JSON_EXISTS, JSON_VALUE with FORMAT JSON, PASSING, RETURNING, WITH / WITHOUT WRAPPER, KEEP / OMIT QUOTES, and … ON EMPTY / … ON ERROR (including DEFAULT expr) — PostgreSQL 16+ • SQL/JSON constructors and predicates — x IS [NOT] JSON [VALUE | ARRAY | OBJECT | SCALAR] [WITH UNIQUE KEYS], JSON, JSON_SCALAR, JSON_SERIALIZE, JSON_OBJECT, JSON_ARRAY (also JSON_ARRAY(SELECT …)), JSON_OBJECTAGG, JSON_ARRAYAGG with FORMAT JSON values, ABSENT / NULL ON NULL, WITH UNIQUE KEYS, RETURNING, and aggregate ORDER BY / FILTER / OVER — PostgreSQL 16+ • JSON_TABLE — tabular JSON query in the FROM clause; PASSING, PATH, EXISTS PATH, FORMAT JSON PATH, NESTED PATH … AS name, FOR ORDINALITY, wrapper and quotes options, ON EMPTY/ON ERROR — PostgreSQL 16+ • Predicates — IN / NOT IN, BETWEEN / NOT BETWEEN, LIKE / NOT LIKE, ILIKE / NOT ILIKE, SIMILAR TO, IS NULL / IS NOT NULL, IS DISTINCT FROM, ANY / ALL • SQL value functions — CURRENT_DATE, CURRENT_TIMESTAMP, CURRENT_USER, SESSION_USER, LOCALTIME, LOCALTIMESTAMP, and others, with precision (CURRENT_TIMESTAMP(0)) • GROUPING() — GROUPING(col) predicate used alongside GROUPING SETS
DML (continued)
• SET / SHOW / RESET — SET search_path = myschema, SET TIME ZONE INTERVAL '1' HOUR TO MINUTE, SHOW work_mem, RESET ALL • ALTER SYSTEM — ALTER SYSTEM SET param = value, ALTER SYSTEM RESET [ALL] — writes to postgresql.conf • DISCARD — DISCARD ALL, DISCARD PLANS, DISCARD SEQUENCES, DISCARD TEMP • SELECT INTO — SELECT ... INTO [TEMP | UNLOGGED] table • COPY — COPY table FROM/TO, COPY (query) TO; program and option list • EXPLAIN — EXPLAIN, EXPLAIN ANALYZE, EXPLAIN (ANALYZE, VERBOSE, FORMAT JSON) stmt • PREPARE / EXECUTE / DEALLOCATE — server-side prepared statements • LISTEN / UNLISTEN / NOTIFY — async pub/sub with optional payload • LOCK TABLE — LOCK TABLE t IN ACCESS EXCLUSIVE MODE [NOWAIT] • Cursors — DECLARE CURSOR, FETCH, MOVE, CLOSE • Comment preservation — a script made only of comments is kept; line comments (-- ...) and block comments (/* ... */) are preserved: leading comments before a statement stay before it; inline trailing comments stay on the statement's final line • Meaning preserved — the test suite checks that formatting never changes what a statement means: every fixture's PostgreSQL parse tree must be the same before and after
DDL (continued)
• ALTER GROUP / ALTER LARGE OBJECT — ADD USER / DROP USER members, large object OIDs, OWNER TO current_user • ALTER FUNCTION — SET COST, SET ROWS, SET VOLATILE/STABLE/IMMUTABLE, RENAME TO, OWNER TO, SET SCHEMA • REFRESH MATERIALIZED VIEW — with CONCURRENTLY • CREATE RULE — BEFORE/AFTER/INSTEAD, INSERT/UPDATE/DELETE/SELECT, DO ALSO/INSTEAD • Row Security Policies — CREATE / ALTER POLICY with USING and WITH CHECK • REASSIGN OWNED — REASSIGN OWNED BY old_role TO new_role • DROP OWNED — DROP OWNED BY roles [CASCADE]
Pending Implementation
| Feature | Notes |
| PL/pgSQL | Full procedural language (IF/ELSIF, LOOP, RETURN, EXCEPTION, DECLARE) — out of scope for a SQL formatter |
Requirements
| Requirement | Version |
| Node.js | 20 or later | | .NET Runtime | 8.0 or later | | Prettier | 3.x |
Installation
Then add the plugin to your Prettier configuration:
See Getting Started for VS Code setup and build-from-source instructions.
Quick Example
Input (unformatted):
Output (default options — lowercase keywords, standard density, trailing commas):
Configuration
Three formatting options are available. See Options for full details and examples.
| Option | Values | Default | Description |
| sqlKeywordCase | lower \| upper \| preserve | lower | Case for SQL keywords | | sqlDensity | compact \| standard \| spacious | standard | Whitespace density | | sqlCommaStyle | trailing \| leading | trailing | Comma placement in lists |
Documentation
• Getting Started — installation, VS Code setup, building from source • Options — all formatting options with examples • Examples — before/after formatting examples for common patterns • Formatting Reference — comprehensive formatting rules by statement type
Description from the npm listing.
- prettier
- prettier-plugin
- sql
- postgresql
- postgres
- pgsql
- formatter
Where prettier-plugin-postgresql sits in the listing
Each band is one page of 20. Weekly downloads on a log scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Recent observations
Full history (121)Similar npm Prettier plugins plugins
Data source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/prettier-plugin-postgresql. First seen Oct 16, 2026; last successful collection Oct 18, 2026. See the methodology.