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 137 recorded weekly downloads on npm, an increase of 552% over the past 30 days, ranking #2562 of 3,247 tracked listings.
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 explicitUnsupported …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) < (SELECT …)), LATERAL - CTEs — WITH / WITH RECURSIVE, data-modifying CTEs (WITH ... DELETE/INSERT/UPDATE)
- Window functions — OVER (PARTITION BY, ORDER BY, frame clauses: ROWS/RANGE/GROUPS BETWEEN)
- Aggregate functions — FILTER (WHERE ...), ORDER BY inside aggregate (e.g.
string_agg) - GROUP BY extensions — ROLLUP, CUBE, GROUPING SETS
- Locking — FOR UPDATE / FOR SHARE / FOR NO KEY UPDATE / FOR KEY SHARE with OF, NOWAIT, SKIP LOCKED
- INSERT — VALUES (single and multi-row), DEFAULT VALUES, ON CONFLICT DO NOTHING / DO UPDATE SET (conflict targets can be expressions, and a WHERE matches a partial unique index), RETURNING (with
old/newandRETURNING WITH (OLD AS o, NEW AS n), PostgreSQL 18), OVERRIDING USER/SYSTEM VALUE,DEFAULTin VALUES, subscript / field targets (insert into t (a.b)), WITH clause - UPDATE — SET (including multi-column
SET (a, b) = (…)/= (SELECT …),DEFAULT, and subscript / field targets likea[1] = 2), FROM, WHERE (includingWHERE CURRENT OF cursor), RETURNING (withold/new), WITH clause - DELETE — WHERE (including
CURRENT OF), RETURNING (withold/new), WITH clause - TRUNCATE — with RESTART IDENTITY and CASCADE
- Transaction control — BEGIN / START TRANSACTION / COMMIT / ROLLBACK (with AND CHAIN) / SAVEPOINT / RELEASE SAVEPOINT / ROLLBACK TO SAVEPOINT / SET TRANSACTION (isolation level, READ ONLY/WRITE, DEFERRABLE) / PREPARE TRANSACTION / COMMIT PREPARED / ROLLBACK PREPARED
- MERGE — WHEN MATCHED / WHEN NOT MATCHED / WHEN NOT MATCHED BY SOURCE; UPDATE SET, INSERT, DELETE, DO NOTHING actions; conditional AND clause; OVERRIDING in INSERT; RETURNING with
merge_action()andold/new - CALL — stored-procedure invocation
DDL
- CREATE TABLE — column definitions with full constraint support: NOT NULL (also named at table level,
CONSTRAINT n NOT NULL col), DEFAULT, PRIMARY KEY, FOREIGN KEY (column-level and table-level, with MATCH FULL/PARTIAL and ON UPDATE/DELETE actions, includingSET NULL (cols)), CHECK (with NO INHERIT), NOT ENFORCED / ENFORCED on CHECK and FOREIGN KEY, UNIQUE (with NULLS NOT DISTINCT), temporal keys (WITHOUT OVERLAPS,PERIOD), EXCLUDE (USING gist (col WITH op, …) WHERE (…)), GENERATED ALWAYS AS (…) STORED / VIRTUAL, GENERATED AS IDENTITY (with sequence options), named constraints, DEFERRABLE / INITIALLY DEFERRED; index parameters (INCLUDE, WITH (…), USING INDEX TABLESPACE);COLLATE, STORAGE and COMPRESSION column clauses, typed tables (OF typewithWITH OPTIONS), type modifiers (VARCHAR(100),NUMERIC(10,2); a modifier that is an expression is unsupported), array types (TEXT[],INT[3]). Types written with SQL keywords get their standard spelling (int→integer); internal names (int4,float8,"char") are kept as written - ALTER TABLE (and INDEX / VIEW / MATERIALIZED VIEW / FOREIGN TABLE / SEQUENCE) — every subcommand libpg_query produces: ADD / DROP COLUMN, ADD / DROP / VALIDATE / ALTER CONSTRAINT (deferrability,
[NOT] ENFORCED,[NO] INHERIT), ALTER COLUMN TYPE … COLLATE … USING, SET / DROP DEFAULT, SET / DROP NOT NULL, identity (ADD GENERATED,SET GENERATED,RESTART,DROP IDENTITY),DROP / SET EXPRESSION, SET STATISTICS / STORAGE / COMPRESSION, SET / RESET (options), trigger and rule enable / disable, row level security, CLUSTER ON, SET LOGGED / UNLOGGED, INHERIT, OF, REPLICA IDENTITY, ATTACH / DETACH PARTITION, OWNER TO, SET TABLESPACE, foreign table OPTIONS - ALTER … RENAME — every object kind: tables (IF EXISTS, ONLY), columns, constraints, indexes, views, sequences, schemas, databases, roles, triggers / policies / rules
ON table, type attributes, domain constraints, operator classesUSING method, functions, aggregates, and more - CREATE VIEW / CREATE MATERIALIZED VIEW
- CREATE TABLE AS —
CREATE TABLE foo AS SELECT ... - CREATE INDEX / CREATE UNIQUE INDEX
- CREATE FUNCTION / PROCEDURE — RETURNS, LANGUAGE, dollar-quoted
$$...$$body, SQL-standard bodies (RETURN expr,BEGIN ATOMIC … END), TRANSFORM FOR TYPE, parameter lists with modes (IN, OUT, INOUT, VARIADIC) and%TYPE - CREATE TYPE — composite (
AS (...)) and enum (AS ENUM (...)) - ALTER TYPE — ADD VALUE for enums (with BEFORE/AFTER placement, IF NOT EXISTS), RENAME VALUE; ADD / DROP / ALTER ATTRIBUTE for composite…
Description from the npm listing.
- prettier
- prettier-plugin
- sql
- postgresql
- postgres
- pgsql
- formatter
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
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.
Each band is one page of 20. Weekly downloads on a linear 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.
Recent observations
Full history (170)Similar npm Prettier plugins plugins
All 20 prettier-plugin-postgresql alternativesData 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 Dec 6, 2026. See the methodology.