Skip to main content

Crate corium_pgwire

Crate corium_pgwire 

Source
Expand description

A PostgreSQL wire-protocol front end for read-only Corium SQL.

serve accepts PostgreSQL client connections and answers their queries by running them through corium_sql::SqlSession against an immutable corium_db::Db value obtained from a DbCatalog. Because every query goes through SqlSession, the same read-only guarantee holds: DDL, DML, and session-mutating statements are rejected.

One server exposes every database the catalog offers (subject to the catalog’s own whitelist). A connection selects its database with the standard startup database parameter and can switch at any time with USE <database>; SHOW DATABASES lists what is available. The catalog is expected to open and cache databases lazily and share them across connections.

Both the simple and extended query sub-protocols are supported, in the text wire format. Bound parameters and the binary format are not supported and are reported as errors. A handful of stateless control statements (BEGIN, COMMIT, ROLLBACK, SET, RESET, DISCARD) are accepted as no-ops so ordinary clients and drivers connect cleanly.

Structs§

PgWireConfig
Server-wide configuration for the PostgreSQL front end.

Enums§

CatalogError
A database the catalog cannot hand back.

Traits§

DbCatalog
Supplies the databases the server exposes.

Functions§

serve
Serves the PostgreSQL wire protocol until shutdown resolves.