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
fix(grid): staged result-grid edits can hit the wrong row when a column is aliased to a primary key name #1772
`sqlResultGridSaveEnabled` (lib/core/database/sql_table_target_extractor.dart) enables saving when every primary key name appears among the result column names. It compares names only, so `SELECT number AS id, name FROM t` counts as keyed. Editing `name` builds `UPDATE t SET name = ... WHERE id = `. If exactly one row has that `id`, the safety check (`expectDmlMatchedRows`, exactly one row) passes and a different row is changed silently.
Related: `TableMutationEngine._hasMatchingPrimaryKey` (feeds `plan.hasPrimaryKey`) uses `any` where `every` is needed for a composite key, so the preview does not warn when only part of a key is selected. The save itself is protected by the one-row check.
Fix
Track in the result metadata which output columns come straight from a table column of the target (not an expression or an alias of another column); enable editing and the key lookup only for those.
Use `every` in `_hasMatchingPrimaryKey`.
Tests: aliased column, expression column, composite key with one column selected.
Activity
Merge pull request #1803 from QueryaHub/fix/grid-aliased-pk
ZhuchkaTriplesix commentedon Oct 25, 2026
Fixed on dev in #1803 (merged). Closing by hand: the PRs target dev, so GitHub would only close this when dev is merged into main.