Skip to content

decode: show Bind result-column format codes - #8

Merged
sunng87 merged 1 commit into
mainfrom
feat/bind-result-format
Jul 11, 2026
Merged

sunng87 merged 1 commit into
mainfrom
feat/bind-result-format

Conversation

@sunng87

@sunng87 sunng87 commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Summary

Bind was the only extended-query message with an unrendered field —
result_column_format_codes, the text/binary format the client requested for the
result columns (i.e. the "format of output"). Parse already renders all its
fields.

Change (src/decode.rs)

  • New helper format_format_codes(&[i16]) → compact text / binary / [text, binary, …].
  • format_bind now appends it: … params: [...] result: <fmt>.

Example

An extended-query session (psql \bind) through the mitm proxy:

[F→B] Parse: <unnamed>  [param types: -]  SELECT $1::int AS n
[F→B] Bind: <unnamed>  <-  <unnamed>  params: [3431]  result: text
[F→B] Execute: <unnamed>
[B→F] DataRow: { n='41' }

Verification

  • cargo fmt / clippy -D warnings / test (4/4) clean; nix build and nix flake check pass.
  • End-to-end: a psql \bind session decodes with result: text present.

Note

This was originally committed straight onto main; per request it's moved onto this branch for proper review. (Unrelated side note, not changed here: in that trace the param renders as hex 3431 because psql's \bind flags the parameter as binary format — existing behaviour, happy to look at separately.)

Bind was the one extended-query message with an unrendered field —
result_column_format_codes (the text/binary format the client requested for the
result columns). Show it after the params as `result: text` / `binary` /
`[text, binary, ...]`. Parse already renders all its fields.

Verified end to end: a psql \bind session decodes as
  Bind: <unnamed>  <-  <unnamed>  params: [...]  result: text
@sunng87
sunng87 merged commit bf123b5 into main Jul 11, 2026
2 checks passed
@sunng87
sunng87 deleted the feat/bind-result-format branch July 11, 2026 05:39
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.

1 participant