Skip to content

format-requirements#18

Merged
general-kroll-4-life merged 1 commit intomainfrom
feature/format-requirements-compact
Apr 4, 2026
Merged

format-requirements#18
general-kroll-4-life merged 1 commit intomainfrom
feature/format-requirements-compact

Conversation

@general-kroll-4-life
Copy link
Copy Markdown
Contributor

Extended query protocol support with error recovery

Summary

  • Implement full extended query protocol (Parse, Bind, Describe, Execute, Close, Sync, Flush) with proper wire message parsing and serialization
  • Add IExtendedQueryBackend interface with opt-in support via type assertion; DefaultExtendedQueryBackend delegates to simple query path for backwards compat
  • Restructure command loop: ReadyForQuery sent once initially, then only after SimpleQuery completion and Sync (per PostgreSQL protocol spec)
  • Add error state tracking: after extended query failure, discard messages until Sync, then send ReadyForQuery('E') matching PostgreSQL behavior
  • Fix ClientClose ('C') to close prepared statements/portals, not the connection; connection close moved to ClientTerminate ('X') where it belongs
  • Add text format bypass in Column.Write: string/[]byte sources write raw bytes directly, preserving exact backend representation (e.g. sqlite "t"/"f" for bools)
  • Thread resultFormats from Bind through to RowDescription and data encoding, supporting per-column text/binary format selection per protocol spec
  • Per-connection PreparedStatement and Portal caches
  • Enable previously disabled pgx query test
  • Add comprehensive test coverage: extended query happy path, error recovery (Parse/Bind/Describe/Execute errors), statement/portal lifecycle, multiple Sync recovery, simple query after extended query error, text bypass preservation, resolveResultFormat protocol rules, sqlbackend unit tests
  • Soft linting.
  • Better doco.

Extended query protocol support with error recovery

Summary:

- Implement full extended query protocol (Parse, Bind, Describe, Execute,
  Close, Sync, Flush) with proper wire message parsing and serialization
- Add IExtendedQueryBackend interface with opt-in support via type assertion;
  DefaultExtendedQueryBackend delegates to simple query path for backwards compat
- Restructure command loop: ReadyForQuery sent once initially, then only after
  SimpleQuery completion and Sync (per PostgreSQL protocol spec)
- Add error state tracking: after extended query failure, discard messages until
  Sync, then send ReadyForQuery('E') matching PostgreSQL behavior
- Fix ClientClose ('C') to close prepared statements/portals, not the connection;
  connection close moved to ClientTerminate ('X') where it belongs
- Add text format bypass in Column.Write: string/[]byte sources write raw bytes
  directly, preserving exact backend representation (e.g. sqlite "t"/"f" for bools)
- Thread resultFormats from Bind through to RowDescription and data encoding,
  supporting per-column text/binary format selection per protocol spec
- Per-connection PreparedStatement and Portal caches
- Enable previously disabled pgx query test
- Add comprehensive test coverage: extended query happy path, error recovery
  (Parse/Bind/Describe/Execute errors), statement/portal lifecycle, multiple
  Sync recovery, simple query after extended query error, text bypass
  preservation, resolveResultFormat protocol rules, sqlbackend unit tests
- Soft linting.
- Better doco.
@general-kroll-4-life general-kroll-4-life merged commit 0ffa5f2 into main Apr 4, 2026
5 checks passed
@general-kroll-4-life general-kroll-4-life deleted the feature/format-requirements-compact branch April 4, 2026 05:23
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