Skip to content

Add ordered bind placeholder dialect metadata - #2457

Open
LucaCappelletti94 wants to merge 2 commits into
apache:mainfrom
LucaCappelletti94:ordered-bind-placeholder-style
Open

LucaCappelletti94 wants to merge 2 commits into
apache:mainfrom
LucaCappelletti94:ordered-bind-placeholder-style

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Contributor

This PR adds Dialect::ordered_bind_placeholder_style() to provide the information of whether a Dialect's ordered bind placeholders should be written as ? or $1.

@LucaCappelletti94
LucaCappelletti94 marked this pull request as ready for review August 25, 2026 14:18
@LucaCappelletti94
LucaCappelletti94 force-pushed the ordered-bind-placeholder-style branch from 0c0d081 to 1f82e56 Compare September 8, 2026 16:10
LucaCappelletti94 added a commit to LucaCappelletti94/sqlparser-rs that referenced this pull request Oct 2, 2026
@codecov-commenter

codecov-commenter commented Oct 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.69767% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.33%. Comparing base (dcbc923) to head (115c7bf).
⚠️ Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
src/dialect/mod.rs 87.09% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2457      +/-   ##
==========================================
+ Coverage   81.23%   81.33%   +0.09%     
==========================================
  Files          42       42              
  Lines       33891    34015     +124     
  Branches    33891    34015     +124     
==========================================
+ Hits        27533    27666     +133     
+ Misses       2793     2785       -8     
+ Partials     3565     3564       -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
LucaCappelletti94 force-pushed the ordered-bind-placeholder-style branch from 83fd8c3 to 68428c3 Compare October 2, 2026 16:14
@LucaCappelletti94
LucaCappelletti94 force-pushed the ordered-bind-placeholder-style branch from 68428c3 to e7952a1 Compare October 16, 2026 21:52

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

Two non-blocking comments inline.

Comment thread src/dialect/mod.rs Outdated
/// Returns true if this dialect allows SQLite-style named dollar placeholders,
/// for example `SELECT $name`.
///
/// This does not describe PostgreSQL-style ordered binds such as `SELECT $1`.

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.

This hook does not gate $name placeholders: $name and $1 tokenize as Placeholder in every dialect (see the $1 tests in sqlparser_postgres.rs and $123 in sqlparser_mssql.rs, both with the flag off). What it actually toggles is whether $$…$$ / $tag$…$tag$ is dollar-quoting (false) or a placeholder with $ allowed inside (true, SQLite); the doc should say that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated

Comment thread src/dialect/postgresql.rs
}

fn ordered_bind_placeholder_style(&self) -> Option<BindPlaceholderStyle> {
Some(BindPlaceholderStyle::DollarNumbered)

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.

Redshift uses the same $1 positional syntax (https://docs.aws.amazon.com/redshift/latest/dg/r_PREPARE.html, "refer to the parameters by position using the notation $1, $2"), so RedshiftSqlDialect should return DollarNumbered too rather than falling through to None.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok, added Redshift also now.

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.

3 participants