Skip to content

SQLite: Tokenize parameters the way SQLite does - #2559

Open
LucaCappelletti94 wants to merge 4 commits into
apache:mainfrom
LucaCappelletti94:sqlite-variable-tokens
Open

LucaCappelletti94 wants to merge 4 commits into
apache:mainfrom
LucaCappelletti94:sqlite-variable-tokens

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Contributor

This PR makes SQLiteDialect tokenize $, @, : and # parameters with SQLite's rules. Names may start with a digit (except after #), contain $ and any non-ASCII character, and carry the TCL style :: namespace and (...) suffix.

SELECT #a, @2t, :9c, :a(), @a$, @::b, $a(x);
-- Previously: Expected: an expression, found: #

The parameter forms are documented under parameters.

@LucaCappelletti94 LucaCappelletti94 added bug Something isn't working fuzzer A bug found by the fuzzer labels Sep 23, 2026
@LucaCappelletti94
LucaCappelletti94 marked this pull request as ready for review September 23, 2026 13:46
@codecov-commenter

codecov-commenter commented Sep 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.53%. Comparing base (424378c) to head (f33b435).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2559      +/-   ##
==========================================
+ Coverage   81.52%   81.53%   +0.01%     
==========================================
  Files          42       42              
  Lines       34205    34253      +48     
  Branches    34205    34253      +48     
==========================================
+ Hits        27885    27929      +44     
- Misses       2770     2773       +3     
- Partials     3550     3551       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

LucaCappelletti94 added a commit to LucaCappelletti94/sqlparser-rs that referenced this pull request Oct 1, 2026
LucaCappelletti94 added a commit to LucaCappelletti94/sqlparser-rs that referenced this pull request Oct 2, 2026
LucaCappelletti94 added a commit to LucaCappelletti94/sqlparser-rs that referenced this pull request Oct 2, 2026
@LucaCappelletti94
LucaCappelletti94 force-pushed the sqlite-variable-tokens branch 2 times, most recently from 44ced5f to c329836 Compare October 17, 2026 08:16

@sabir-akhadov-localstack sabir-akhadov-localstack left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Needs a rebase: tests/sqlparser_sqlite.rs conflicts with main, and see inline for a silent one.

Comment thread src/dialect/sqlite.rs Outdated
ch == '`' || ch == '"' || ch == '['
}

fn get_next_precedence(&self, parser: &Parser) -> Option<Result<u8, ParserError>> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

#2683 already added get_next_precedence to this impl (&/| at Precedence::Ampersand); git auto-merges both without a marker and the result has two definitions, so fold the Token::Colon arm into that match.

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

Labels

bug Something isn't working fuzzer A bug found by the fuzzer SQLite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants