Skip to content

fix(sqlite): support Tcl-style $param(...) syntax#944

Merged
nene merged 1 commit into
sql-formatter-org:masterfrom
SAY-5:fix-sqlite-tcl-param
May 12, 2026
Merged

fix(sqlite): support Tcl-style $param(...) syntax#944
nene merged 1 commit into
sql-formatter-org:masterfrom
SAY-5:fix-sqlite-tcl-param

Conversation

@SAY-5
Copy link
Copy Markdown
Contributor

@SAY-5 SAY-5 commented May 12, 2026

Closes #943.

SQLite's $-prefixed parameter follows Tcl variable syntax, which allows one or more ::-separated suffixes and an optional (...) trailer. Previously the formatter only accepted a bare identifier after $, so inputs like $p(x=y) were tokenized as $p followed by a parenthesized expression and re-emitted with an unwanted space.

This moves SQLite's $-parameter into a dialect-specific custom rule that matches the full Tcl syntax, while : and @ continue to use the default named-parameter path.

Before

> format('select $p(x=y);', { language: 'sqlite' });
'select\n  $p (x = y);'

After

> format('select $p(x=y);', { language: 'sqlite' });
'select\n  $p(x=y);'

Tests cover the existing $name behaviour as well as $p(x=y) and $foo::bar(extra).

SQLite's $-prefixed placeholder follows Tcl variable syntax, allowing one
or more '::'-separated suffixes and an optional '(...)' trailer.

Closes sql-formatter-org#943
@codesandbox-ci
Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link
Copy Markdown
Collaborator

@nene nene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

@nene nene merged commit 1729b55 into sql-formatter-org:master May 12, 2026
2 checks passed
@nene
Copy link
Copy Markdown
Collaborator

nene commented May 12, 2026

Released in v15.7.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problem with $p() syntax in SQLite

2 participants