You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature Request: Support DuckDB 2.0 $variable syntax in DuckDB dialect #1010
SET VARIABLE my_var =30;
SELECT20+ $my_var AS total;
Currently, when using the duckdb dialect in SQL Formatter, this produces a parse error:
Parse error: Unexpected "$my_var AS" at line 2 column 13.
SQL dialect used: "duckdb".
The formatter should recognize $variable_name as a valid expression in the DuckDB dialect, the same way it already handles positional parameters like $1.
Why do you want this feature?
$variable is an official DuckDB 2.0 feature and is documented as the recommended shorthand for getvariable().
Users who write SQL against DuckDB 2.0+ cannot format their queries through this tool if they use the $variable syntax.
The getvariable('name') workaround is functionally equivalent but more verbose; users should be able to use the idiomatic syntax and still benefit from formatting.
The parser already supports $1-style positional parameters; extending this to named variables in the DuckDB dialect is a natural addition.
Activity
nene commentedon Nov 20, 2026
This is a known issue, but thanks for reporting.
The problem is, that this
$variablesyntax kinda conflicts with dollar-quoted strings$tag$string$tag$syntax.But I think I have a fix for this. I'll prioritize the tokenization of strings before these variables.
nene commentedon Nov 20, 2026
This should now be fixed in 15.10.0
gltjk commentedon Nov 20, 2026
Thanks for the quick fix! 🎉 Tested with 15.10.0 and it works perfectly.
Merge branch 'duckdb-params'