You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[P1] [bug] getWhereColumns uses all columns in WHERE — fragile against NULL (compounds F1) #400
[P1] [bug] getWhereColumns uses ALL columns in WHERE when no PK — fragile against NULL/sparse columns (compounded with F1)
Context
When is_primary_key is unavailable, getWhereColumns falls back to using every column in the WHERE clause. Compounded with F1 (PK always false), this is the default path.
Problem
Per docs/audits/results.md F7.
WHERE clause becomes WHERE id=1 AND name='old' AND email=NULL AND .... Two failure modes: (a) if any column is NULL, the WHERE clause is unsatisfiable for that row — MySQL returns 0 rows updated; (b) if a column value was changed NULL→X, the original-NULL comparison fails. Save handler shows "Applied N change(s)" but nothing changed. No error to the user.
Files
src/lib/sql-generator.ts:70-83
src/lib/sql-generator.ts:14-19 (buildWhereClause)
Repro (if applicable)
Static analysis only.
Expected
Until F1 lands: refuse to generate UPDATE/DELETE if hasPrimaryKey === false — show blocking dialog "Cannot generate UPDATE/DELETE without a primary key". After F1: PK is always correct, this fallback never triggers.
Proposed fix
Scope M. (a) primary fix is F1. (b) Until F1 lands, add a blocking dialog in handleSave for the no-PK case. (c) Unit test for getWhereColumns with mixed NULL/non-NULL.
Acceptance
Editing a NULLable column on a table without PK shows the blocking dialog; user can apply via copy-as-UPDATE or cancel.
What remains: float and blob columns still compare badly in any fallback WHERE. That is now mitigated rather than fixed — the rows-affected check added in #529 will report a mismatch instead of silently claiming success.
Leaving open for the float/blob comparison, with the NULL half struck.
Activity
EVWorth commentedon Sep 4, 2026
Partial — recording what #529 verified, since the premise has drifted.
The issue says
getWhereClauseuses all columns and is fragile against NULL. Two halves:buildWhereClauseemitsIS NULLrather than= NULL. That part of the report is stale.information_schema, and refuses the save outright when the key is not among the selected columns.What remains: float and blob columns still compare badly in any fallback WHERE. That is now mitigated rather than fixed — the rows-affected check added in #529 will report a mismatch instead of silently claiming success.
Leaving open for the float/blob comparison, with the NULL half struck.
fix(grid): identify rows by the real key, before the edit not after (#…