ReviewOS

stacks/bun-query-builder

upsert() with no mergeColumns builds an empty SET clause (syntax error)

#1035
Closed glennmichael123 opened this 22 days ago · 0 comments
22 days ago

Summary

When mergeColumns is omitted/empty, setCols is [], so the update list is empty, producing ... ON CONFLICT (cols) DO UPDATE SET (Postgres/SQLite) or ... ON DUPLICATE KEY UPDATE (MySQL) with a dangling empty SET — a syntax error.

Location

src/client.ts:~6160-6189.

Suggested fix

When mergeColumns is empty, fall back to DO NOTHING (or default to updating all non-conflict columns), and guard against an empty update list.

Severity: medium. Found via internal code audit.

Sign in to comment on this issue.