npm / sql-formatter
sql-formatter
What changed in sql-formatter 4 to 15, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-20.
55 breaking39 new APIs and options4 performance28 behavior and defaults40 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initsql-formatter 1533 changes
Breaking changes 5
Removes multi-word function names from MySQL.
identifierCase no longer applies to function names.
keywordCase no longer applies to data types.
Some common table and field names in PostgreSQL are no longer treated as keywords.
Custom dialects must now provide the reservedDataType field in TokenizerOptions.
New APIs and options 8
The modulo operator is now supported in SingleStoreDB.
The parser now supports the pg_dump commands \restrict and \unrestrict.
Adds the missing OPENJSON Transact-SQL function.
sql-formatter supports the CORRESPONDING keyword on Trino set operations.
Clickhouse SQL dialect is now supported.
Adds support for PostgreSQL 18 UUID functions.
Added the dataTypeCase option.
Added the functionCase option.
Performance 1
Parsing long SQL expression lists avoids quadratic accumulation.
Behavior and default changes 10
Trino numeric literals can now contain underscores.
Formatting now keeps spaces around PostgreSQL OPERATOR() when denseOperators is enabled.
Formatting keeps the colon dense inside [] for DuckDB array slices.
A reserved word after AS is now treated as an alias.
BigQuery formatting now always keeps spaces around the
-operator.PostgreSQL formatting now supports keywords in CREATE CONSTRAINT TRIGGER.
SQLite formatting now supports Tcl-style $param(...) syntax.
CREATE TABLE statements use a new formatting style.
CREATE VIEW statements use a new formatting style.
PostgreSQL now allows type to be used as an identifier.
Fixes and other changes 9
Added support for several operators in Transact-SQL, Spark, DuckDB and Redhsift.
Formatting removes the extra space after BETWEEN _ AND _ expressions.
Formatting now keeps a space when densing - before a negative operand.
Fixed an idempotency issue with block-comment placement.
Fixes formatting of the
>^geometric operator.Adds missing PostgreSQL operators.
Properly formats TIMESTAMP WITH TIME ZONE in Trino.
Formats COMMENT ON as keywords in PostgreSQL.
MySQL GRANT statements now support the *.* syntax.
sql-formatter 1410 changes
Breaking changes 5
The deprecated commaPosition config option has been removed.
The db2 dialect now specifically targets DB2 for LUW, rather than mixing features from DB2 for IBM z and DB2 for LUW.
DialectOptions now requires a name field when implementing a custom dialect.
SqlLanguage is now a union of the builtin SQL dialect names instead of a plain string.
The deprecated tabulateAlias config option has been removed.
New APIs and options 1
A new experimental config option controls identifier casing similarly to keywordCase.
Behavior and default changes 2
Parser error messages were improved to help users self-diagnose the most common issues.
Snowflake data type names are now included in the keywords list and converted to uppercase when keywordCase: upper is used.
Fixes and other changes 2
Various tweaks and fixes were made for the DB2i dialect.
Formatting of TIMESTAMP() WITH TIME ZONE in PostgreSQL was fixed.
sql-formatter 135 changes
Breaking changes 2
COMMENT is no longer placed on a separate line in dialects like MariaDB; in dialects supporting COMMENT ON ..., it triggers a new line only when used together with ON.
With keywordCase: upper, words like user and name are no longer capitalized in MySQL, MariaDB, and SingleStoreDB because their keyword lists now contain only reserved words.
Fixes and other changes 3
Fixed a crash when formatting Transact-SQL containing goto labels.
Fixed formatting of the ON DUPLICATE KEY UPDATE clause in MariaDB-like dialects.
Fixed formatting of the VALUES function in MariaDB-like dialects.
sql-formatter 129 changes
Breaking changes 3
Custom dialects no longer need to extend the Formatter class; provide a DialectOptions object instead.
The language parameter no longer specifies a custom dialect; use formatDialect() instead.
Most simple SQL statements are now formatted more on one line, changing the output produced by the formatter.
New APIs and options 4
Custom dialect configuration now supports custom quote types.
New API for formatting with a specified dialect, enabling bundlers to eliminate unused dialect code and reduce bundle size.
Named function arguments using the => operator are now supported in Trino.
package.json was added to the package exports list.
Behavior and default changes 1
Nested CASE expressions are now supported.
Fixes and other changes 1
Formatting the MySQL USE keyword no longer causes a syntax error.
sql-formatter 116 changes
Breaking changes 1
The library is now exported as an ES module, affecting how developers import it.
New APIs and options 1
Added support for the Snowflake dialect.
Behavior and default changes 2
CASE expressions are formatted better.
The denseOperators config now also applies to the : operator.
Fixes and other changes 2
Inline block-comments are formatted better.
ON UPDATE/DELETE constraints are formatted better.
sql-formatter 104 changes
Breaking changes 3
The
extraParensconfig replaces theopenParensandcloseParensconfigs.Unbalanced parentheses, braces, or brackets now produce an error (#277).
Formatting SQL with braces or brackets in a dialect that does not support them now throws error #400.
Performance 1
Formatting is slower overall, which should only affect users formatting megabytes worth of SQL.
sql-formatter 924 changes
Breaking changes 5
The aliasAs configuration option was removed.
N1QL no longer supports CREATE TABLE.
Support for many questionable DB2 keywords was removed.
N1QL no longer supports DROP TABLE.
These keywords are no longer supported in any dialect.
New APIs and options 2
PL/SQL Q strings are now supported.
Trino is available as a new SQL dialect.
Behavior and default changes 5
The approach to matching function calls changed.
Supported joins and set operations were revised in multiple dialects.
Reserved keyword lists were revised in multiple dialects.
Additional variations in SELECT query clauses are supported, including WITH RECURSIVE.
Supported string types were revised in multiple dialects.
Fixes and other changes 12
Formatting in tabular style was fixed.
Support for various BigQuery DDL statements was improved.
Support for double-quoted strings in Spark was fixed.
Multiword commands now format correctly with keywordCase set to upper.
MySQL and MariaDB identifiers may now begin with a number.
Parameter substitution now works in BETWEEN expressions.
Redshift identifiers may now begin with #.
Formatting of SELECT DISTINCT was improved.
The semicolon-on-separate-line bug was fixed.
Formatting of PL/SQL tbl@dblink syntax was improved.
Formatting of Trino row patterns was improved.
The missing type-definition file when importing sql-formatter in TypeScript was fixed.
sql-formatter 83 changes
Breaking changes 3
The multilineLists config option was removed.
The newlineBeforeCloseParen config option was removed.
The newlineBeforeOpenParen config option was removed.
sql-formatter 733 changes
Breaking changes 13
Backtick-quoted identifiers are no longer supported in PL/SQL, DB2, PostgreSQL, Redshift, or Transact-SQL.
BigQuery identifiers no longer allow $ or @ characters.
BigQuery identifiers now handle dashes correctly; double dashes begin a comment.
DB2 no longer supports bracket-quoted identifiers.
SQLite no longer supports this parameter placeholder syntax.
DB2 identifiers no longer allow # or @ characters.
Spark no longer supports double-quoted identifiers.
Incorrect reserved keywords were removed from SQLite, affecting which words keywordCase changes.
PostgreSQL no longer supports this parameter placeholder syntax.
Periods are no longer allowed inside parameter placeholder names.
The params option is no longer supported for Hive and Spark; use ${name} variables instead.
PL/SQL parameter placeholder names no longer allow # or $ characters, or periods.
The unminified bundle was removed from dist; only the minified bundle and source map remain.
New APIs and options 11
PL/SQL now supports numbered :1 and :2 parameter placeholders.
N1QL now supports numbered $1 and $2 parameter placeholders.
Array literals are now supported in BigQuery.
PostgreSQL bit strings are now supported.
Hex strings are now supported in standard SQL, SQLite, Spark, PostgreSQL, MariaDB, and MySQL.
Oracle now supports &name substitution variables.
Hive and Spark now support ${name} variables.
BigQuery now supports @name named and quoted parameter placeholders.
DB2 now supports the N, G, GX, UX, and U& prefixed string types.
BigQuery now supports R, B, and RB prefixed strings.
BigQuery now supports triple-double-quoted and triple-single-quoted strings.
Performance 2
Formatting long SQL strings is much faster, addressing a long-standing performance problem.
Repeated calls are much faster because tokenizer construction is cached.
Behavior and default changes 4
DB2 parameters now support @, #, and $ characters.
PostgreSQL, MariaDB, MySQL, and Transact-SQL identifiers now support the $ character.
Oracle SQL function names are now recognized and affected by the keywordCase option.
SQLite function names are now recognized and affected by the keywordCase option.
Fixes and other changes 3
MySQL function names are now properly uppercased when keywordCase is set to upper.
Fixed incorrectly inserted spaces inside map keys.
Fixed incorrect string token regular expressions.
sql-formatter 623 changes
Breaking changes 6
Added an option to specify a JSON config file, replacing the removed formatting CLI options.
Removed in favor of configuring indentation in a JSON config file.
The library
indentoption was replaced by configuration options for indentation.Removed in favor of configuring lines between queries in a JSON config file.
Removed in favor of configuring keyword casing in a JSON config file.
The library
uppercaseoption was replaced by a configuration option for keyword casing.
New APIs and options 6
Added support for the Apache Hive SQL dialect.
Added support for the GCP BigQuery SQL dialect.
Added a config option to set keyword casing.
Added a config option to set the number of lines between queries.
Added a config option to set indentation width.
Added a config option to use tabs for indentation.
Behavior and default changes 4
Added support for DB2 hex literals.
Added support for PL/SQL
$$ ... $$quoted strings.Added support for Postgres C-style escaped strings.
Added support for scientific notation in numbers.
Fixes and other changes 7
Fixed formatting of
CHARACTER SET.Fixed command-line regressions.
Backtick-quoted identifiers and single-quoted strings are supported again with the default
language: "sql".Fixed various issues with operator handling.
The keyword is now properly recognized in Postgres, MariaDB, N1QL, and PL/SQL.
Fixed a Safari crash caused by regex look-behind.
Improved handling of standard output.
sql-formatter 416 changes
Breaking changes 9
The default export was removed; import the format function as a named export.
The CLI no longer accepts the -f / --file option; provide a file as a positional argument instead.
The format function is now available only as a named export.
The FORMATTERS export was removed.
The pl/sql alias was removed; use plsql instead.
Use plsql as the replacement for the removed pl/sql alias.
A file can now be supplied as a positional CLI argument instead of using the removed file option.
The standard SQL formatter now supports only standard SQL quotes, parameter placeholders, operators, and comments; use a dialect-specific language for other syntax.
Output line endings are always converted to UNIX LF, avoiding mixed UNIX and Windows line endings.
New APIs and options 6
MariaDB support is available as a formatter dialect.
MySQL support is available as a formatter dialect.
PostgreSQL support is available as a formatter dialect.
Additional operators are supported.
supportedDialects is available as a named export and is used by the CLI.
Transact-SQL support is available as a formatter dialect.
Fixes and other changes 1
Formatting of BETWEEN _ AND _ expressions is now proper.