Skip to content

sql(mysql): accept any spelling of ON DUPLICATE KEY UPDATE in the update helper - #32040

Open
robobun wants to merge 2 commits into
mainfrom
farm/e95a5336/mysql-upsert-keyword-case
Open

sql(mysql): accept any spelling of ON DUPLICATE KEY UPDATE in the update helper#32040
robobun wants to merge 2 commits into
mainfrom
farm/e95a5336/mysql-upsert-keyword-case

sql(mysql): detect ON DUPLICATE KEY UPDATE case-insensitively in the …

4655783
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jun 12, 2026 in 11m 24s

Code review found 1 potential issue

Found 1 candidates, confirmed 1. See review comments for details.

Details

Severity Count
🔴 Important 0
🟡 Nit 0
🟣 Pre-existing 1
Severity File:Line Issue
🟣 Pre-existing src/js/internal/sql/mysql.ts:282-286 isUpsertUpdate still requires exact single-space whitespace between keywords

Annotations

Check notice on line 286 in src/js/internal/sql/mysql.ts

See this annotation in the file changed.

@claude claude / Claude Code Review

isUpsertUpdate still requires exact single-space whitespace between keywords

nit (pre-existing, non-blocking): this still requires exactly one ASCII space between each keyword. `detectCommand()` tokenizes on any whitespace, so `... ON DUPLICATE KEY\n  UPDATE ${sql(data)}` (or double spaces / tabs) is detected as `SQLCommand.update`, fails this 23-char tail match, and gets the same spurious ` SET ` this PR fixes for lowercase. Since this line is being rewritten anyway, testing the trimmed tail against `/on\s+duplicate\s+key\s+update$/i` would close the whole class — but t