Skip to content

MySQL: Gate DELETE LIMIT behind supports_delete_limit() - #2757

Open
ump45nose wants to merge 1 commit into
apache:mainfrom
ump45nose:fix/2615-delete-limit-dialect-gate
Open

ump45nose wants to merge 1 commit into
apache:mainfrom
ump45nose:fix/2615-delete-limit-dialect-gate

Conversation

@ump45nose

Copy link
Copy Markdown

Dialects: MySQL, SQLite, Generic, PostgreSQL, DuckDB

Summary

DELETE ... LIMIT n was accepted by every dialect, including GenericDialect.
Engines that use Generic (e.g. DataFusion) therefore parsed the LIMIT and then
silently ignored it.

Fix

  • Add Dialect::supports_delete_limit() (default false)
  • Enable for MySQL and SQLite (real engine support)
  • Parse LIMIT in DELETE only when the dialect opts in

Closes #2615.

Docs:

Test plan

  • cargo test --all-features
  • cargo fmt --all
  • cargo clippy --all-targets --all-features -- -D warnings
  • New: parse_delete_limit_dialect_gated (positive for supporting dialects, reject others)
  • Existing MySQL/SQLite DELETE LIMIT tests still pass
  • Fuzz seed: fuzz/fuzz_seeds/mysql_2615_delete_limit.sql

AI assistance

This change was developed with AI assistance (Cursor / Grok Bot). I reviewed
every line of the diff and the test output before opening this PR.

GenericDialect (and other dialects that do not support DELETE+LIMIT)
previously accepted `DELETE ... LIMIT n`, so engines like DataFusion
that use GenericDialect silently ignored the LIMIT.

Add Dialect::supports_delete_limit() (default false), enable it for
MySQL and SQLite, and only parse LIMIT in DELETE when the dialect
opts in. Closes apache#2615.

Signed-off-by: Vincent <ump45nose@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Should DELETE + LIMIT be supported by the generic dialect ?

1 participant