The PostgreSQL protocol (raftdb-pgwire)
The wire protocol crate: what it speaks, how it is tested.
Protocol#
Startup (protocol 3.0; 3.x minor versions get NegotiateProtocolVersion), SSLRequest, GSSENCRequest (refused with N), CancelRequest (accepted, see below), authentication trust, password, md5, scram-sha-256 (SHA-256, HMAC, PBKDF2, MD5 and Base64 are written out in the crate; no channel binding), simple query (several statements in one string run as one implicit transaction), extended query (Parse, Bind, Describe, Execute, Close, Sync, Flush; named and unnamed statements and portals; Execute with a row limit suspends the portal), text and binary formats of bool, int2, int4, int8, oid, float4, float8, numeric, text, varchar, bpchar, name, bytea, uuid, date, time, timestamp, timestamptz, json, jsonb (other types: their text), RowDescription with table OID and column number for plain columns, ParameterStatus, BackendKeyData, NoticeResponse, ErrorResponse with severity, SQLSTATE, message, detail, hint, position, CONTEXT, COPY FROM STDIN and COPY TO STDOUT (text format).
The crate raftdb-pgwire has no engine inside and no third-party dependency except raftdb-tls for TLS; the contract with the engine is an interface defined in the crate. The crate's tests run the protocol against a fake engine; the whole stack is compared with PostgreSQL by comparison scripts.