moondb

waxing gibbous · a statute of moondb

moonpostgres

The PostgreSQL implementation of the Driver contract — extended query, a statement cache, server-side cursors, and COPY streamed in both directions.

Enactment

What it is

moonpostgres connects to a PostgreSQL server and implements Driver against it. It speaks the $1, $2, … placeholder token and binds parameters out-of-band.

i

Install

moon add moonbitstack/moonpostgres

ii

Placeholder

$1, $2, … positional — PostgreSQL's native numbered placeholders, bound server-side. A :name statement is rewritten to them at prepare time and the slot names are kept, so bind_named takes a map.

iii

Prepared statements

prepare sends Parse under a name cached by SQL text, so a repeated statement binds instead of re-parsing; Close reclaims it and drops the cache entry.

iv

Streaming

PgRowStream reads one response off the wire; PgCursor is a DECLARE/FETCH cursor the server holds open, a batch per round trip; copy_in_stream and copy_out_stream move COPY data one chunk at a time, so a 100 MB load never sits in memory.

v

Auth

trust cleartext MD5 SCRAM-SHA-256, with SASLprep, channel binding and server-signature verification TLS.

vi

Coverage

execute query transaction close query_stream (live) prepare dialect LISTEN/NOTIFY CancelRequest ping (default).

moonpostgres implements Driver placeholder $1 backend PostgreSQL
See the family The contract it obeys