Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions .changeset/brisk-clauses-return.md

This file was deleted.

23 changes: 0 additions & 23 deletions .changeset/calm-brackets-keep.md

This file was deleted.

16 changes: 0 additions & 16 deletions .changeset/quiet-parens-return.md

This file was deleted.

24 changes: 0 additions & 24 deletions .changeset/sharp-policies-hold.md

This file was deleted.

22 changes: 0 additions & 22 deletions .changeset/stout-grants-stay.md

This file was deleted.

10 changes: 0 additions & 10 deletions .changeset/tidy-endings-match.md

This file was deleted.

96 changes: 96 additions & 0 deletions packages/plugin-pgsql/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,101 @@
# prettier-plugin-postgresql

## 0.3.0

### Minor Changes

- b10a4ef: PostgreSQL: more clauses that were silently dropped are now kept.

- Queries: `ORDER BY … NULLS FIRST/LAST` and `USING <`, `GROUP BY DISTINCT`,
`LIKE` / `SIMILAR TO … ESCAPE`, `WITHIN GROUP (ORDER BY …)`, window
`EXCLUDE …` and base windows (`w2 AS (w …)`), `NATURAL LEFT/FULL JOIN`
(printed as an inner join), `JOIN … USING (…) AS j`, aliases on
parenthesized joins, and the parentheses around nested joins.
- Views: `OR REPLACE`, `TEMPORARY`, column lists, `WITH (…)` and
`WITH CHECK OPTION`.
- Indexes: `NULLS FIRST/LAST`, operator classes, `COLLATE`, `NULLS NOT DISTINCT`,
`WITH (…)`, `TABLESPACE`, `ON ONLY`, and parentheses around expression columns.
- Column `COLLATE`; sequence `AS`, `OWNED BY`, `TEMPORARY` and 64-bit bounds;
`DROP INDEX CONCURRENTLY`; CTE `[NOT] MATERIALIZED`.
- `EXPLAIN (analyze, …)` no longer crashes, and `COPY … csv header` no longer
prints `header ''`.

- 75e4e70: T-SQL: formatting no longer changes what SQL does.

- Bracketed reserved words keep their brackets (`[order]`, `ON [primary]`), and
bracketed index, constraint, cursor, window and other names are preserved.
- CLR and xml methods (`h.GetAncestor()`, `x.value()`) and user functions keep
their casing; only built-in functions follow `sqlKeywordCase`.
- `$action` and other pseudo-columns, `GROUP BY ALL`, `WITH ROLLUP`,
`INSERT TOP (n)`, and `EXEC … WITH RECOMPILE` are kept.
- `SET NOCOUNT, XACT_ABORT ON` no longer prints `XACTABORT`.
- `ALTER TABLE … DROP CONSTRAINT x, COLUMN y` keeps each keyword, so `y` is no
longer dropped as a constraint.
- `OUTPUT` is placed before `FROM` in `UPDATE` and multi-table `DELETE`;
`SET @v = col = expr` and `SET col.WRITE(…)` print valid SQL.
- `@variables` in hints (`OPTIMIZE FOR (@p = 1)`) keep their case.
- Compact density no longer deletes comments between WHERE predicates.

Both plugins can now be loaded in the same process (for example a Prettier config
listing both); previously whichever parsed second failed.

- 2b0cc80: PostgreSQL: formatting no longer changes what a query means.

- Parentheses are kept wherever operator precedence needs them. Previously every
parenthesis was dropped, so `(a + b) * c` became `a + b * c` and
`(x or y) and z` became `x or y and z`.
- Double-quoted identifiers keep their quotes. Previously `"My Table"` printed as
`My Table` (invalid SQL) and `"MixedCase"(1)` as `mixedcase(1)` (a different
function). Names are now quoted exactly when PostgreSQL requires it.
- `IS TRUE` / `IS NOT FALSE` / `IS UNKNOWN` no longer print as `is istrue` etc.

T-SQL: `sqlKeywordCase` no longer recases the inside of double-quoted names.

- 8a001d9: PostgreSQL: more fixes for formatting that changed what SQL does.

- `CREATE POLICY … AS RESTRICTIVE` and the `TO role, …` list of `CREATE POLICY` /
`ALTER POLICY` were dropped, turning restrictive policies permissive and
role-scoped policies into policies for everyone.
- `ALTER TABLE IF EXISTS`, `DROP CONSTRAINT IF EXISTS`, and `CASCADE` on dropped
columns and constraints were dropped; `ADD COLUMN IF NOT EXISTS` printed as the
invalid `ADD COLUMN IF EXISTS`.
- `ONLY` was dropped from `SELECT`, `UPDATE`, `DELETE`, `ALTER TABLE`, `TRUNCATE`
and `LOCK`, so statements recursed into inheritance children and partitions.
- `ALTER VIEW` / `ALTER INDEX` / `ALTER MATERIALIZED VIEW` printed as `ALTER TABLE`,
and `ALTER TABLE s.t SET SCHEMA x` lost the table name.
- Unsupported `ALTER TABLE` subcommands (e.g. `OWNER TO`) now fail with a clear
error instead of printing invalid SQL such as `changeowner`.
- `SET` values: numbers were dropped (`set statement_timeout = ;`) and quoted
mixed-case values were lowercased (`search_path` `"MySchema"` → `myschema`).
- Role passwords were recased by `sqlKeywordCase` and weren't escaped.

Both plugins: `sqlKeywordCase` never recases the inside of single-quoted literals.

- d9fd592: PostgreSQL: DDL formatting no longer drops clauses that change what a statement does.

- `CREATE TEMP` / `UNLOGGED TABLE`, `ON COMMIT`, `IF NOT EXISTS`, `INHERITS`,
`USING`, `WITH (…)` and `TABLESPACE` are kept; `CREATE TABLE … AS` and
materialized views also keep their column lists and `WITH NO DATA`.
- `GRANT` / `REVOKE` keep column lists (`INSERT (a)`), `GRANT OPTION FOR` and
`GRANTED BY`; `CURRENT_USER` and similar grantees no longer print as nothing.
- `CREATE FUNCTION` keeps `OR REPLACE`, `SETOF`, parameter defaults and every
attribute (`SECURITY DEFINER`, `STRICT`, volatility, `PARALLEL`, `COST`, `SET`,
…); `CREATE PROCEDURE` no longer prints as `CREATE FUNCTION`; C functions keep
their link symbol; bodies containing `$$` get a safe dollar-quote tag.
- `ALTER FUNCTION … SECURITY DEFINER` no longer prints as `SECURITY INVOKER`.
- `CREATE TRIGGER` keeps `UPDATE OF` columns, function arguments, `OR REPLACE`,
constraint-trigger options and `REFERENCING` transition tables.
- Functions and `VALUES` lists in `FROM` format again, and alias column lists
(`AS g(n)`, `WITH c(a, b)`) are kept.
- `DROP`, `ALTER`, `COMMENT ON` and `GRANT` keep function and operator argument
types.

- 08b14d5: - `sqlKeywordCase: "preserve"` now follows the input: an upper-case file keeps
upper-case keywords and anything else is lower case. It previously behaved like
`"upper"`.
- T-SQL output now ends with a newline, like PostgreSQL output and Prettier's own
printers.

## 0.2.9

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-pgsql/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prettier-plugin-postgresql",
"version": "0.2.9",
"version": "0.3.0",
"description": "Prettier plugin for PostgreSQL using the official libpg_query parser",
"author": "Mike Schall",
"license": "MIT",
Expand Down
61 changes: 61 additions & 0 deletions packages/plugin-tsql/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,66 @@
# prettier-plugin-tsql

## 0.9.0

### Minor Changes

- 75e4e70: T-SQL: formatting no longer changes what SQL does.

- Bracketed reserved words keep their brackets (`[order]`, `ON [primary]`), and
bracketed index, constraint, cursor, window and other names are preserved.
- CLR and xml methods (`h.GetAncestor()`, `x.value()`) and user functions keep
their casing; only built-in functions follow `sqlKeywordCase`.
- `$action` and other pseudo-columns, `GROUP BY ALL`, `WITH ROLLUP`,
`INSERT TOP (n)`, and `EXEC … WITH RECOMPILE` are kept.
- `SET NOCOUNT, XACT_ABORT ON` no longer prints `XACTABORT`.
- `ALTER TABLE … DROP CONSTRAINT x, COLUMN y` keeps each keyword, so `y` is no
longer dropped as a constraint.
- `OUTPUT` is placed before `FROM` in `UPDATE` and multi-table `DELETE`;
`SET @v = col = expr` and `SET col.WRITE(…)` print valid SQL.
- `@variables` in hints (`OPTIMIZE FOR (@p = 1)`) keep their case.
- Compact density no longer deletes comments between WHERE predicates.

Both plugins can now be loaded in the same process (for example a Prettier config
listing both); previously whichever parsed second failed.

- 2b0cc80: PostgreSQL: formatting no longer changes what a query means.

- Parentheses are kept wherever operator precedence needs them. Previously every
parenthesis was dropped, so `(a + b) * c` became `a + b * c` and
`(x or y) and z` became `x or y and z`.
- Double-quoted identifiers keep their quotes. Previously `"My Table"` printed as
`My Table` (invalid SQL) and `"MixedCase"(1)` as `mixedcase(1)` (a different
function). Names are now quoted exactly when PostgreSQL requires it.
- `IS TRUE` / `IS NOT FALSE` / `IS UNKNOWN` no longer print as `is istrue` etc.

T-SQL: `sqlKeywordCase` no longer recases the inside of double-quoted names.

- 8a001d9: PostgreSQL: more fixes for formatting that changed what SQL does.

- `CREATE POLICY … AS RESTRICTIVE` and the `TO role, …` list of `CREATE POLICY` /
`ALTER POLICY` were dropped, turning restrictive policies permissive and
role-scoped policies into policies for everyone.
- `ALTER TABLE IF EXISTS`, `DROP CONSTRAINT IF EXISTS`, and `CASCADE` on dropped
columns and constraints were dropped; `ADD COLUMN IF NOT EXISTS` printed as the
invalid `ADD COLUMN IF EXISTS`.
- `ONLY` was dropped from `SELECT`, `UPDATE`, `DELETE`, `ALTER TABLE`, `TRUNCATE`
and `LOCK`, so statements recursed into inheritance children and partitions.
- `ALTER VIEW` / `ALTER INDEX` / `ALTER MATERIALIZED VIEW` printed as `ALTER TABLE`,
and `ALTER TABLE s.t SET SCHEMA x` lost the table name.
- Unsupported `ALTER TABLE` subcommands (e.g. `OWNER TO`) now fail with a clear
error instead of printing invalid SQL such as `changeowner`.
- `SET` values: numbers were dropped (`set statement_timeout = ;`) and quoted
mixed-case values were lowercased (`search_path` `"MySchema"` → `myschema`).
- Role passwords were recased by `sqlKeywordCase` and weren't escaped.

Both plugins: `sqlKeywordCase` never recases the inside of single-quoted literals.

- 08b14d5: - `sqlKeywordCase: "preserve"` now follows the input: an upper-case file keeps
upper-case keywords and anything else is lower case. It previously behaved like
`"upper"`.
- T-SQL output now ends with a newline, like PostgreSQL output and Prettier's own
printers.

## 0.8.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-tsql/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prettier-plugin-tsql",
"version": "0.8.1",
"version": "0.9.0",
"description": "Prettier plugin for T-SQL (Microsoft SQL Server) using the official ScriptDom parser",
"author": "Mike Schall",
"license": "MIT",
Expand Down