Repository navigation
feat(mysql): ORDER BY and LIMIT on single-table UPDATE and DELETE - #154
Merged
Merged
Maple Review Bot / Maple / review
succeeded
Nov 25, 2026 in 3m 3s
Confidence 10/10 · No issues found
🟢 Confidence 10/10 · safe to merge. Clause rendering, dialect gating, limit validation and tenant scope are pinned by compile, type and live MySQL tests; only the two open info items (message wording, stale JSDoc) remain.
2 notes · tests covered · risk medium
Adds MySQL/MariaDB ORDER BY/LIMIT to single-table UPDATE and DELETE, gated to the mysql clause set and rendered after the WHERE, with the limit a validated literal. Logic, gating and the doc-example fix hold up; only the two open info notes stand.
orderBy/limitondeleteFrom/updatewrite MySQL's single-table ORDER BY ... LIMITWriteLimitClauserefuses the pair on Postgres, SQLite and ClickHouse, and withUPDATE ... FROM- A write's limit renders as a literal through
rowCount, so no param name can stand in - ORDER BY subqueries are recorded, widening a write's tenant scope
Still open from earlier reviews
- 🔵 Note · F1 ·
UPDATE ... FROMrefusal namesorderBy()even when onlylimit()was set ·src/ch/compile.ts:2660 - 🔵 Note · F3 ·
limitJSDoc says the count is bound as a parameter; it is a literal ·src/ch/update.ts:189
What was checked
- MariaDB inherits the clause by spreading
mysqlDialect(src/mysql/dialect.ts:148), so the type and run-time gates agree limit(undefined)is told apart from an absent limit viaObject.hasOwn, and the initial write state carries nolimitValuekey (src/ch/update.ts:359)- ORDER BY/LIMIT compile after the SET and WHERE, matching their textual position, so parameter order is unchanged (
src/ch/compile.ts:2703)
c93fa1f · Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.
Loading