Skip to content

fix(pgwire): answer kv writes with one INSERT tag - #326

Closed
EnRaiha wants to merge 1 commit into
NodeDB-Lab:mainfrom
EnRaiha:fix/kv-insert-tag
Closed

EnRaiha wants to merge 1 commit into
NodeDB-Lab:mainfrom
EnRaiha:fix/kv-insert-tag

Conversation

@EnRaiha

@EnRaiha EnRaiha commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Why

Key-value writes answered a bare OK command tag: an INSERT or PUT against a kv collection reported no affected count, so drivers saw an empty tag where INSERT 0 1 is expected. The count-bearing tag semantics are the kv half of #297.

What

  • data/executor/handlers/kv/crud/write_basic.rs: kv Put and Insert answer through response_affected(task, 1) — the write reports the row it wrote instead of a bare OK.
  • response_shape/types/plan_kind.rs: KvOp::Insert, KvOp::Put, and KvOp::BatchPut classify as DmlResult("INSERT"), so the routed response renders INSERT 0 1 rather than an execution tag.
  • The wire case extends sql_dml_affected_counts with the kv INSERT/PUT counts.

Refs #297.

Validation

  • cargo check -p nodedb --all-targets — clean (rebased on current main).
  • cargo test -p nodedb --test wire sql_dml_affected_counts — 16 passed.
  • Repository preflight passes.

Notes

Copilot AI lite review requested due to automatic review settings September 16, 2026 06:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

The kv engine answered its writes with a bare OK command tag, so a driver parsing the tag read 0 affected rows for a write that landed. The tag now reports the row the write affected: INSERT and PUT answer INSERT 0 1, matching the document engine's point insert. A kv multi-key delete already reported its matched keys.
@farhan-syah

Copy link
Copy Markdown
Member

Superseded by #356, which carries the kv INSERT/PUT tag and count fix along with the rest of #297 (one folded tag per statement, real counts on every engine and protocol, transaction overlays, and the cluster fold). Closing this one; thanks for the groundwork.

@EnRaiha
EnRaiha deleted the fix/kv-insert-tag branch September 20, 2026 14:45
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.

3 participants