Skip to content

Releases: sql-formatter-org/sql-formatter

8.0.0

04 Jul 10:32
Compare
Choose a tag to compare

Breaking changes

  • Removed multilineLists config option
  • Removed newlineBeforeOpenParen config option
  • Removed newlineBeforeCloseParen config option

Internal changes

  • Moved all the syntax structure detection from formatter to parser.

7.0.4

03 Jul 11:35
Compare
Choose a tag to compare
  • Improve CREATE TABLE & CREATE VIEW formatting for BigQuery. #269
  • Upgrade dependencies. Notably switch from TypeScript 4.6.3 to 4.7.4. #271

7.0.3

01 Jul 06:47
Compare
Choose a tag to compare

Warnings and deprecations

A warning is now printed when params option values are not all strings. For now just a warning. In next major version non-string values will no more be accepted.

Deprecated the following config options:

  • multilineLists
  • newlineBeforeOpenParen
  • newlineBeforeCloseParen

These will get removed in next major version.

7.0.2

21 Jun 12:30
Compare
Choose a tag to compare

Bugfixes

  • Support array subscript operator in BigQuery #243

Internal changes

  • Move aliasAs processing out of formatting phase

7.0.1

16 Jun 08:08
Compare
Choose a tag to compare

Optimized tokenizer. With large inputs the formatter is now considerably faster.

7.0.0

14 Jun 09:40
Compare
Choose a tag to compare

This release contains a major rewrite of how strings, identifiers, variables and parameters are handled internally. What is and isn't supported regarding these things in various dialects was also re-evaluated, resulting in removal of support for various bits of syntax that shouldn't have been there in the first place, along with addition of missing bits of syntax.

Breaking changes

  • The params option is no more supported for Hive and Spark. These dialects don't actually have prepared statements - the values of which params option was meant to provide. Instead the params there was used to replace substitution variables ${var_name}, which however did not work correctly either (e.g. inside strings).
  • Dropped @".." parameter placeholder support from SQLite
  • Dropped :name parameter placeholders from PostgreSQL
  • No more allowing # and $ chars in PL/SQL parameter placeholder names.
  • No more allowing . inside parameter placeholder names.
  • No more allowing # and @ in DB2 identifiers.
  • No more allowing $ and @ in BigQuery identifiers.
  • Dropped `backtick quoted identifiers` from PL/SQL, DB2, PostgreSQL, Redshift, Transact-SQL.
  • Dropped "double quoted identifiers" from Spark.
  • Dropped [bracket quoted identifiers] from DB2.
  • Removed lots of incorrect reserved keywords from SQLite (this mainly affects keywordCase option).
  • Dropped the sql-formatter.js bundle from dist/ dir. Now only sql-formatter.min.js and sql-formatter.min.js.map are left there.

New features and improvements

  • Added names of Oracle SQL functions (which are now also effected by keywordCase option).
  • Added names of SQLite functions (which are now also effected by keywordCase option).
  • Added support for Array literals in BigQuery
  • Added support for @, #, $ characters in DB2 parameters
  • Added support for $ char in PostgreSQL, MariaDB, MySQL and Transact-SQL identifiers
  • Added support for Oracle &name substitution variables
  • Added ${name} variable support for Hive and Spark
  • Added support for @name named and quoted parameter placeholders to BigQuery
  • Added support for :1, :2 parameter placeholders to PL/SQL
  • Added support for $1, $2 parameter placeholders to N1QL
  • Implemented proper dashes support for BigQuery identifiers (e.g. my-little-ident is valid identifier, but my--little--ident is treated as my followed by comment).
  • Added triple-quoted strings support for BigQuery (e.g. """some string""" and '''some string''')
  • Added hex-strings support to standard SQL, SQLite, Spark, PostgreSQL, MariaDB and MySQL
  • Added support for PostgreSQL bit-strings.
  • Added several prefixed string types for DB2 (N'...', G'...', GX'...', UX'...', U&'...')
  • Added several prefixed strings to BigQuery (R"...", B"...", RB"...")

Bugfixes

  • Fixed incorrectly inserted spaces inside map keys #230
  • Fixed incorrect string token regexes #211
  • All MySQL function names are now properly uppercased with keywordCase:upper option.

Performance improvements

  • Formatting long SQL strings is now much faster, fixing a long-time performance problem. #70
  • Calling the format() function repeatedly is now also much faster as we're caching the construction of tokenizer.

6.1.5

09 Jun 15:23
Compare
Choose a tag to compare

Fixes error with absolute imports in 6.1.3 and 6.1.4.

6.1.4

09 Jun 14:28
Compare
Choose a tag to compare

Broken release. Tried to fix the previous release... didn't succeed :(

6.1.3

09 Jun 12:26
Compare
Choose a tag to compare

Mostly a changes related to repository transfer from github.com/zeroturnaround to github.com/sql-formatter-org.

  • Dropped . and @ characters support from PL/SQL identifiers (which weren't valid anyway).

  • Dropped support for TypeScript < 4.5.

Broken release because of internal import paths refactoring. Fixed in 6.1.5.

6.1.2

24 May 07:45
Compare
Choose a tag to compare

Bugfixes:

  • Add missing PostgreSQL JSON operators #> and #>> #217
  • Don't add extra newline before a lonely semicolon when using newlineBeforeSemicolon: true

Internals:

  • Rewrite of SQL string building logic
  • Remove ZWS-replacement hack from indentStyle: tabular* token formatting
  • Store both raw and clean values inside tokens