Skip to content

Fix cell updates failing with "missing 'pk_col' parameter" - #2

Merged
traustitj merged 1 commit into
mainfrom
fix/pk-map-crud
Jul 28, 2026
Merged

traustitj merged 1 commit into
mainfrom
fix/pk-map-crud

Conversation

@debba

@debba debba commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Updating (or deleting) a row from the data grid always failed with:

Update failed: missing 'pk_col' parameter

The plugin read the primary key from the pk_col/pk_val parameters documented in the plugin guide, but the host actually sends a pk_map object (column → value), which also supports composite primary keys (src-tauri/src/plugins/driver.rs in the host).

Fix

  • update_record and delete_record now read pk_map first and fall back to the documented pk_col/pk_val pair for compatibility.
  • The WHERE clause is built from all key columns with bound parameters; NULL key values compare with IS NULL (a bound = NULL would never match).
  • Composite primary keys now work.

Testing

  • 4 new unit tests covering pk_map (composite), the legacy pk_col/pk_val fallback, NULL key handling, and missing-parameter errors.
  • Full suite passes: 45 tests.

The host sends the primary key as a pk_map object (column -> value,
supporting composite keys), while the plugin only read the pk_col/pk_val
pair documented in the plugin guide, so every cell update failed with
"missing 'pk_col' parameter". Accept pk_map first and fall back to
pk_col/pk_val; NULL key values compare with IS NULL.
@debba
debba force-pushed the fix/pk-map-crud branch from 4dd0f1c to 2856192 Compare July 24, 2026 13:54
@traustitj
traustitj merged commit f25e058 into main Jul 28, 2026
@traustitj
traustitj deleted the fix/pk-map-crud branch July 28, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants