Skip to content

User-defined functions and table-valued functions have an extra space  #444

Open
@Prinzhorn

Description

@Prinzhorn

It appears there is an internal list of known SQLite functions and virtual tables used to format. I rely heavily on user-defined functions and table-valued functions. These custom functions have an extra space before the opening parenthesis.

Input data

SELECT
  foo('unknown'),
  substr('known'),
  bar('unknown')
FROM
  foo_bar(foo('unknown')),
  json_each()

Expected Output

SELECT
  foo('unknown'),
  substr('known'),
  bar('unknown')
FROM
  foo_bar(foo('unknown')),
  json_each()

Actual Output

SELECT
  foo ('unknown'), -- Extra space
  substr('known'),
  bar ('unknown') -- Extra space
FROM
  foo_bar (foo ('unknown')), -- Two extra spaces
  json_each()

Usage

=> https://sql-formatter-org.github.io/sql-formatter/ with SQLite language

I don't think any of the other formatting options matter in this case. The formatter should not need to keep a list of SQLite functions/tables but infer the formatting from the token (I have no idea how this library is actually implemented).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions