Skip to content

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

Open
SAY-5 wants to merge 1 commit into
sql-formatter-org:masterfrom
SAY-5:fix-sqlite-tcl-param
Open

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

Conversation

@SAY-5
Copy link
Copy Markdown

@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.

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

1 participant