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
15 changes: 0 additions & 15 deletions .changeset/pgsql-meaning-preserved.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/pgsql-qualified-operator-sublink.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/pgsql-values-ctes.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tsql-alter-add.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tsql-bracket-escape.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tsql-collate-any-expression.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tsql-comments-never-dropped.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tsql-create-schema-elements.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tsql-current-of.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tsql-cursor-global.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tsql-dml-option-merge.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tsql-double-negation.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tsql-drop-index.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tsql-execute-forms.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tsql-function-param-defaults.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tsql-inline-indexes.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tsql-inline-off.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tsql-method-case.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tsql-module-options.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tsql-nested-comment-once.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tsql-odbc-functions.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tsql-rebuild-partition.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tsql-same-line-comments.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tsql-select-into-on.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tsql-storage-clauses.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tsql-transaction-names.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tsql-view-cte.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tsql-waitfor-statement.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tsql-window-order.md

This file was deleted.

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

## 0.3.1

### Patch Changes

- bdd66bc: Fix formatting that changed what SQL means or produced SQL that doesn't parse:

- `UNION` / `INTERSECT` / `EXCEPT` kept their `WITH`, `ORDER BY`, `LIMIT` and locking clauses, and operands are parenthesized where needed.
- `ARRAY(subquery)`, `(f(x)).*`, `ROW(...)` and row comparisons with a subquery are preserved.
- Type names resolve as written (`float8`, `"char"`, `int[3]`, `pg_catalog.text`), and casts to `interval` of non-literals stay casts.
- Constraints keep every clause: `EXCLUDE`, `MATCH FULL`, `NO INHERIT`, `NOT VALID`, `INCLUDE` / `WITH` / `USING INDEX TABLESPACE`, `ON DELETE SET NULL (cols)`, identity options, table-level `DEFERRABLE`, and `USING INDEX`.
- `ON CONFLICT` keeps expression targets and the partial-index `WHERE`.
- `ALTER ... RENAME` works for every object kind, including `ALTER TYPE ... RENAME VALUE`, which had become `ADD VALUE`.
- `DROP TRIGGER / POLICY / RULE ... ON`, `DROP OPERATOR CLASS ... USING`, `DROP CAST` and `DROP TRANSFORM` are printed correctly.
- Kept: `COMMIT AND CHAIN`, `ALTER COLUMN ... TYPE ... USING`, `ALTER TYPE ... ADD / DROP / ALTER ATTRIBUTE`, VACUUM / ANALYZE option values, `current_timestamp(0)`-style precision, schema-qualified `OPERATOR(...)`, SQL/JSON `PASSING`, wrapper, quotes and `ON EMPTY` / `ON ERROR` clauses, and JSON aggregate `ORDER BY` / `FILTER` / `OVER`.
- Quotes in enum values are escaped, and `DO` blocks no longer gain a `LANGUAGE plpgsql`.

- 4750d81: A schema-qualified operator in `ANY` / `ALL` (`a OPERATOR(pg_catalog.=) ANY (...)`) is kept; it printed the schema name as the operator, which doesn't parse.
- c504901: A `VALUES` query keeps its `WITH` clause (`WITH c AS (...) VALUES (...)`); the CTEs were dropped.

## 0.3.0

### Minor 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.3.0",
"version": "0.3.1",
"description": "Prettier plugin for PostgreSQL using the official libpg_query parser",
"author": "Mike Schall",
"license": "MIT",
Expand Down
31 changes: 31 additions & 0 deletions packages/plugin-tsql/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
# prettier-plugin-tsql

## 0.9.1

### Patch Changes

- 385d3b5: `ALTER TABLE ... ADD` keeps `DEFAULT ... WITH VALUES` (which fills existing rows), `PERIOD FOR SYSTEM_TIME (...)` (it printed `add ;`) and `INDEX` definitions; a masking function containing a quote is escaped.
- 7d4fc53: Bracketed names containing `]` keep it escaped (`[a]]b]`); it was printed unescaped, which doesn't parse.
- d3d3ac0: `COLLATE` is kept after any expression — literals, variables, function calls, `CAST`, `CASE`, subqueries and parenthesized expressions. It was only kept after column names and silently dropped elsewhere, changing how comparisons and sorts behave.
- a84657d: Comments inside a statement are no longer dropped. A comment after the last select item, a table name, a join condition, a column definition, a CTE body or a `UNION` disappeared; every comment is now printed where it was, or at worst right after its statement. Line comments in fill-packed lists (`UPDATE ... SET`, compact lists) also end their line, instead of swallowing the items that followed.
- 918848b: `CREATE SCHEMA` keeps the tables, views and permissions created with it (`CREATE SCHEMA s CREATE TABLE ... GRANT ...`); they were dropped.
- bac1614: `UPDATE` / `DELETE ... WHERE CURRENT OF cursor` kept its `WHERE`: it was dropped, which turned a one-row change into one affecting every row.
- 7e2a4b4: `OPEN`, `FETCH`, `CLOSE` and `DEALLOCATE GLOBAL cursor` keep `GLOBAL` — without it a local cursor of the same name is used — and `DECLARE c INSENSITIVE SCROLL CURSOR` keeps its ISO form instead of becoming invalid.
- 55014c6: Kept clauses that were dropped from DML: `OPTION (...)` query hints on `INSERT`, `UPDATE`, `DELETE` and `MERGE`; column names on a derived table (`(SELECT ...) AS s (a, b)`); and `MERGE ... INSERT DEFAULT VALUES`, which printed as `insert values ()`.
- b365ff1: A double negation such as `- -a` printed as `--a`, which starts a comment and drops the rest of the line; it now prints `- -a`.
- 77efa73: `DROP INDEX` keeps its `WITH (ONLINE = ON, MOVE TO ...)` options, and the old `DROP INDEX table.index` form is supported (it printed `drop index ;`).
- 5b8d23b: `EXECUTE` keeps everything it was written with: `AS USER` / `AS LOGIN = 'name'`, pass-through parameters for `EXECUTE ('...', 1) AT server`, a bracketed linked-server name, a procedure number (`dbo.p;2`), and `WITH RESULT SETS` — which was found by searching the text, so a string containing those words produced broken output.
- 95e1522: Function parameters keep their defaults (`@a int = 1`) and `READONLY`; they were dropped.
- a64084f: Indexes declared in a table body are kept: column-level `INDEX ix` in `CREATE TABLE`, and `INDEX` definitions in table variables and table types, along with a table type's `WITH (MEMORY_OPTIMIZED = ON)`. All were dropped.
- a8d12f0: `WITH INLINE = OFF` on a function stays `OFF`; it printed as `INLINE`, which turns scalar UDF inlining on.
- 0729aa3: `SET @x.modify(...)` keeps the method name's case with `sqlKeywordCase: "upper"`: xml and CLR type methods are case-sensitive, so `@x.MODIFY(...)` failed to run.
- 6ec04eb: Triggers keep their `WITH` options (`EXECUTE AS`, `ENCRYPTION`, ...), procedures keep `FOR REPLICATION`, and an `EXECUTE AS 'principal'` containing a quote is escaped.
- b2057bd: A trailing comment on a statement inside `IF`, `WHILE` or another block is printed once; it was repeated after the block.
- 5b4f720: ODBC function escapes such as `{fn UCASE('a')}` keep their `{fn ...}` wrapper; without it the functions don't exist.
- 90e0963: `ALTER TABLE ... REBUILD` without a partition no longer prints an empty `PARTITION =`, and partition numbers given as variables (`REBUILD PARTITION = @p`, `SWITCH PARTITION @p`) are kept.
- 5546526: A comment at the end of a statement inside a block stays on that statement's line. A comment after the last statement of a `TRY` block moved to the top of the `CATCH` block.
- 08d5f5a: `SELECT ... INTO t ON filegroup` keeps its `ON filegroup`.
- 9dd2b7e: Storage clauses are kept on indexes and constraints: `ON scheme(column)` keeps its partitioning column, and `ON filegroup` / `FILESTREAM_ON` are no longer dropped from constraints, inline indexes, `CREATE INDEX` and columnstore indexes. Column-level `PRIMARY KEY` / `UNIQUE` also keep their `WITH (...)` options.
- 9ebdf20: Transaction statements keep everything they were written with: names and savepoints given as variables (`ROLLBACK TRAN @savepoint` had become a full `ROLLBACK`), `COMMIT ... WITH (DELAYED_DURABILITY = ON)`, and `WITH MARK` descriptions that are variables or contain quotes.
- 4b4f71c: A view whose body starts with `WITH` keeps its CTEs (and `XMLNAMESPACES`); they were dropped, leaving a view that referenced a missing name. View column names that need brackets keep them.
- 0924b2d: `WAITFOR (RECEIVE ...), TIMEOUT n` and `WAITFOR (GET CONVERSATION GROUP ...)` are kept; they printed as `waitfor delay ;`.
- 1093422: A `WINDOW` clause is printed before `ORDER BY`, where T-SQL requires it; after it, the output didn't parse.

## 0.9.0

### Minor 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.9.0",
"version": "0.9.1",
"description": "Prettier plugin for T-SQL (Microsoft SQL Server) using the official ScriptDom parser",
"author": "Mike Schall",
"license": "MIT",
Expand Down