Skip to main content

reddb_server/wire/postgres/
mod.rs

1//! PostgreSQL wire protocol compatibility layer (Phase 3.1 PG parity).
2//!
3//! Exposes a minimal subset of the PG v3 protocol so `psql`, JDBC drivers
4//! (pgjdbc), node-postgres, pgAdmin, DBeaver, and friends can connect to
5//! RedDB as if it were PostgreSQL.
6//!
7//! # Scope (Phase 3.1)
8//!
9//! * Startup message negotiation (protocol version 3.0 / 196608).
10//! * Authentication: `trust` only (no password). Clients that send an
11//!   actual password are accepted — the password is ignored.
12//! * Simple query protocol (`Q` frames): parse → execute → stream rows.
13//! * Extended query protocol (`Parse` / `Bind` / `Describe` / `Execute` /
14//!   `Close` / `Sync`), including prepared statements, portals,
15//!   `ParameterDescription`, and row-limited `Execute` with
16//!   `PortalSuspended`.
17//! * Minimal row description using a small OID mapping table.
18//! * ReadyForQuery + Command­Complete + ErrorResponse framing.
19//! * TLS: `SSLRequest` is answered with `'S'` and the connection is
20//!   upgraded via a rustls handshake when the listener carries TLS
21//!   material, sharing the native wire's cert/key config
22//!   (`PgWireConfig::tls`). Without TLS material `SSLRequest` is declined
23//!   with `'N'` and the client continues in plaintext. A cleartext
24//!   password is only challenged over an encrypted link or a loopback bind
25//!   (see `authenticate_startup`).
26//!
27//! Not in this phase (future 3.1.x):
28//! * SASL / SCRAM auth, GSSAPI encryption.
29//! * Function-call protocol.
30//! * COPY protocol.
31//! * NOTIFY / LISTEN.
32
33pub mod protocol;
34pub mod server;
35pub mod types;
36
37mod catalog_views;
38
39pub use protocol::{BackendMessage, FrontendMessage, PgWireError};
40pub use server::{start_pg_wire_listener, PgWireConfig};
41pub use types::{value_to_pg_wire_bytes, PgOid};