Expand description
PostgreSQL wire protocol compatibility layer (Phase 3.1 PG parity).
Exposes a minimal subset of the PG v3 protocol so psql, JDBC drivers
(pgjdbc), node-postgres, pgAdmin, DBeaver, and friends can connect to
RedDB as if it were PostgreSQL.
§Scope (Phase 3.1)
- Startup message negotiation (protocol version 3.0 / 196608).
- Authentication:
trustonly (no password). Clients that send an actual password are accepted — the password is ignored. - Simple query protocol (
Qframes): parse → execute → stream rows. - Extended query protocol (
Parse/Bind/Describe/Execute). - Minimal row description using a small OID mapping table.
- ReadyForQuery + CommandComplete + ErrorResponse framing.
Not in this phase (future 3.1.x):
- SASL / SCRAM auth, TLS.
- Function-call protocol.
- COPY protocol.
- NOTIFY / LISTEN.
Modules§
- protocol
- PostgreSQL v3 wire protocol message framing (Phase 3.1 PG parity).
- server
- PostgreSQL wire-protocol listener (Phase 3.1 PG parity).
- types
- PostgreSQL type OID mapping (Phase 3.1 PG parity).
Structs§
- PgWire
Config - Startup-tuned configuration for the PG wire listener.
Enums§
- Backend
Message - Backend (server → client) messages we emit.
- Frontend
Message - Frontend (client → server) messages we parse.
- PgOid
- A subset of PG type OIDs that cover every case we need to encode.
- PgWire
Error - Error type surfaced by the framing layer. Wraps IO errors plus structural validation failures (bad message tag, truncated frame).
Functions§
- start_
pg_ wire_ listener - Spawn the PG wire listener. Blocks until the listener errors out. Each connection is handled in its own tokio task.
- value_
to_ pg_ wire_ bytes - Encode a
Valueas the UTF-8 text representation PG’s text-mode protocol expects. Binary format is opt-in via a flag in the client’sBindmessage — we don’t advertise binary support yet, so simple text encoding is sufficient for every supported client.