Home Expressions
Docs
Drivers Gateway SDKs Benchmarks
Changelog
GitHub
Blog Status Roadmap
Rust PostgreSQL Driver

qail-pg: Main Mature PG Driver for Rust

A high-performance, AST-native wire protocol driver for PostgreSQL. Built to power the core QAIL execution paths with protocol 3.2 negotiation, robust pooling, and native pipeline operations.

Main Mature Driver qail-pg v0.28.0 Protocol 3.2 First TLS + SCRAM + Pool Updated April 27, 2026

Rust Driver Capability Matrix

qail-pg is positioned as the production Rust driver in the QAIL stack: AST-native execution, PostgreSQL wire protocol control, enterprise auth options, panic-safe builder contracts, and high-throughput runtime paths.

Capability Current Data Notes
Primary positioning Main mature PostgreSQL driver in QAIL qail-pg is the Rust-native reference implementation used by QAIL runtime surfaces.
Current crate release 0.28.0 Breaking cleanup release aligned with the current QAIL workspace crate line.
API contract Canonical fallible builders and encoders Redundant try_* compatibility aliases were removed; runtime paths now use the surviving fallible APIs directly.
Protocol negotiation PostgreSQL 3.2 first, one-shot fallback to 3.0 Requests startup protocol 3.2 by default, then downgrades only on explicit protocol rejection.
Security/auth SCRAM-SHA-256, MD5, cleartext server flows, TLS, mTLS Supports enterprise auth policy controls and channel-binding mode selection.
Execution path AST-native wire protocol Compiles QAIL AST into PostgreSQL protocol frames and typed bind values.
Pooling model PgPool + deterministic release Connection reset and return flow designed for tenant/RLS-safe reuse.
Throughput tools Pipeline methods + COPY protocol Supports high-volume batch paths and bulk insert/export operations.
Linux backend Optional native io_uring Feature-gated Linux transport path with backend introspection support.

Why Teams Pick This Rust Postgres Driver

Protocol-Aware Runtime

Startup negotiation requests protocol 3.2 by default and only falls back to 3.0 on explicit version rejection, which supports mixed-version PostgreSQL fleets safely.

Security + Auth Controls

Supports SCRAM-SHA-256, MD5, cleartext server flows, TLS/mTLS modes, and enterprise auth policy settings for stricter production enforcement.

Operational Throughput Paths

Built-in pipeline methods and COPY protocol support enable high-volume mutation and ingest workloads without leaving the Rust driver path.

Install and Start in Rust

1. Add Crates

Use the driver crate and AST core crate together in your Rust project.

cargo add qail-pg qail-core

2. Connect and Query

Basic password auth connection and AST-native fetch path.

use qail_core::Qail;
use qail_pg::PgDriver;

let mut driver = PgDriver::connect_with_password(
    "localhost", 5432, "postgres", "mydb", "password"
).await?;

let cmd = Qail::get("users").select_all().limit(10);
let rows = driver.fetch_all(&cmd).await?;

3. Move to Pooling + Pipeline for Production

Use PgPool for multi-connection workloads and pipeline/COPY paths for high-throughput workloads. Keep release semantics deterministic on pooled connections.

let pool = qail_pg::PgPool::connect(config).await?;
let mut conn = pool.acquire().await?;

let results = conn.pipeline_execute_rows_ast(&commands).await?;
conn.release().await;

Recent Release Context

The current release line is 0.28.0. This is a breaking cleanup release that removes redundant compatibility APIs, keeps builder and encoder failures on structured fallible paths, and preserves protocol 3.2 negotiation as part of the mature driver path.

FAQ

Is qail-pg an ORM?

No. qail-pg is a wire-level PostgreSQL driver that sends protocol frames from typed AST/query inputs.

How does protocol 3.2 compatibility work in mixed server fleets?

The driver starts with protocol 3.2 and falls back once to 3.0 only after explicit server rejection, keeping negotiation deterministic.

Which security and auth paths are built in?

qail-pg supports SCRAM-SHA-256, MD5, TLS/mTLS, and pooling paths designed for production service environments.

How is connection reuse kept safe for tenant workloads?

Pool release behavior includes reset safeguards so session state is not retained when a connection is returned to the pool.