Skip to content

Releases: sql-formatter-org/sql-formatter

6.0.2

12 May 10:29
Compare
Choose a tag to compare

Minor enhancements:

  • Don't crash with default "sql" language when encountering "@" character #214
  • Better error message when tokenizer fails

6.0.1

12 May 09:45
Compare
Choose a tag to compare

Single bugfix:

  • Avoid breaking up ON UPDATE and ON DELETE #215

6.0.0

11 May 12:04
Compare
Choose a tag to compare

From 4.x to 6.x

This release is mostly a back-merge of the Prettier SQL fork.

The latest stable release of SQL Formatter was 4.0.2. Prettier SQL continued from that, releasing Prettier SQL 5.0 ... 5.1.1. Now back in SQL Formatter we're skipping the 5.x versions and going straight to 6.

Breaking changes since 4.x

Command line options --indent (-i), --tab-indent (-t), --uppercase (-u) and --lines-between-queries have been removed in favor of using a JSON config file which can be specified using --config (-c) option.

The equivalent options in a config file are as follows:

{
  "tabWidth": 4,
  "useTabs": true,
  "keywordCase": "upper",
  "linesBetweenQueries": 2
}

When used as a library, the indent and uppercase options have been replaced similarly.

New features

New SQL Dialects: GCP BigQuery, Apache Hive.

Lots of new configuration options. See the README for a full list.

Bugfixes and minor enhancements

  • Added support for DB2 hex literals #123
  • Added support for PL/SQL $$ ... $$ quoted strings #183
  • Added support for Postgres C-style escaped strings #198
  • Scientific notation now supported for numbers #153
  • Various fixes operator handling #125 #135 #150 #167 #176 #201
  • Backtick-quoted identifiers and single-quoted strings now supported again in default language: "sql" #139 #147 #192
  • Fixed formatting of CHARACTER SET #181
  • The RETURNING keyword is now properly recognized in Postgres, MariaDB, N1QL and PL/SQL #196
  • Improved STDOUT handling #194
  • Fixed CLI command regressions #209 #210
  • Fixed crash in Safary caused by regex look-behind inferrinizzard#84

6.0.0-beta.4

11 May 11:51
Compare
Choose a tag to compare
6.0.0-beta.4 Pre-release
Pre-release

6.0.0-beta.3

10 May 10:07
Compare
Choose a tag to compare
6.0.0-beta.3 Pre-release
Pre-release
  • Replace indent option with two options: tabWidth and useTabs
  • Throw ConfigError instead of plain Error to distinguish configuration errors.

6.0.0-beta.2

09 May 21:20
Compare
Choose a tag to compare
6.0.0-beta.2 Pre-release
Pre-release
  • Rename newline option to multilineLists, also changing the values:
    • newline: "never" to multilineLists: "avoid"
    • newline: "lineWidth" to multilineLists: "expressionWidth"
  • Rename lineWidth option to expressionWidth
  • Reference correct type definition file from package.json
  • Restore original formatting of WHEN ... THEN
  • Remove special handling of LATERAL

v6.0.0-beta.1

09 May 07:45
Compare
Choose a tag to compare
v6.0.0-beta.1 Pre-release
Pre-release
6.0.0-beta.1

prettier-sql v5.1.1

09 May 07:08
Compare
Choose a tag to compare

(Released under name prettier-sql)

Updated

  • restored itemCount setting for VScode extension
  • added JSDocs for all files
  • added conditional skips for Jest tests
  • added missing BigQuery, hive from demo page language dropdown

Fixed

  • fixed bug with CASE and Inline Block interaction
  • fixed bug with END not adding spacings before END
  • fixed bug with CommaPosition.before when the line had no preceding whitespace
  • fixed bug where AS in CAST functions would get deleted when AliasAs.never
  • fixed bug where AS would get deleted in CTE definition when AliasAs.never

prettier-sql v5.1.0

09 May 07:07
Compare
Choose a tag to compare

(Released under name prettier-sql)

Known Issues

  • newline: number does not work with [foo], [ and ] both count as 1 token each so [foo] would be 3 items
    • array[0] or map[key] do still work as they are parsed as WORD
  • BigQuery formatter fails a few tests (ALTER TABLE, tricky line comments) due to those tests not including valid BigQuery SQL, those tests are currently skipped

Added

Source:

  • consumed VSCode Extension as subrepo
  • added support for Hive language
  • added support for BigQuery language
  • added keyword dedupe on Formatter classes via Set

VSCode:

  • added command prettier-sql-vscode.format-selection
    • Formats SQL selections
  • added settings to override user/workspace tabSize and insertSpaces settings
  • added error message on format fail
  • added setting to override formatting language for sql files when SQL flavour does not have a VSCode language ID (Microsoft PostgreSQL and MSSQL Extensions)

Other:

  • demo page now deployed as git repo subtree, served from root/ (subtree of static/)

Updated

  • fixed handling of newline options
  • simplified NewlineMode config
  • fixed ; indentation when used with semicolonNewline and tenSpace configs
  • Formatter now uses numeric for loop to allow for index manipulation
  • updated linesBetweenQueries to add an extra newline (0 lines = 1 line break, no space in between)
  • renamed Formatter class files to <flavour>.formatter.ts
  • renamed test files to <flavour>.test.js

Removed

  • removed newline: hybrid config
    • newline: number now acts like hybrid

prettier-sql v5.0.1

09 May 07:06
Compare
Choose a tag to compare

(Released under name prettier-sql)

Updated

  • fixed bug when using SELECT * and denseOperators
  • fixed aliasAs option on demo page
  • fixed handling of tokens with aliasAs flag
  • demo page now prints stack trace in textarea on error