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 v1.3.3 Protocol 3.2 First TLS + SCRAM + Pool Updated June 18, 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 1.3.3 Stable v1.3.3 release line with native vertical access policy, protocol validation, MERGE/source-query access checks, live PostgreSQL validation, and Flow Ledger production semantics.
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 stable release line is 1.3.3. It carries the native vertical access policy work from v1.3.0, the protocol/parser hardening from v1.3.1-v1.3.2, and the Flow Ledger production semantics and documentation clarity added in v1.3.3.

  • v1.3.3 release notes - workflow leases, idempotency, side-effect replay, timeout due-row discovery, and platform docs.
  • v1.3.0 release notes - native table/operation/column access policy, prepared statement cache safety, composite foreign-key verification, gateway numeric safety, workflow guards, and SDK route encoding.
  • Protocol 3.2 + PostgreSQL 18.3 blog - protocol and operations view.
  • Driver docs - full API, pool, pipeline, COPY, and auth details.

Implementation Tips

  • Treat qail-pg as a wire-level PostgreSQL driver, not an ORM layer.
  • For mixed fleets, validate startup behavior with protocol 3.2 first and explicit one-shot fallback to 3.0.
  • Use SCRAM-SHA-256, TLS/mTLS, and connection pooling defaults as baseline production posture.
  • Keep pooled connections on deterministic release/reset paths so tenant/session state never leaks between requests.