HomeQuery LabExpressionsDocsDriversBlogStatusRoadmapChangelog GitHub
Rust PostgreSQL Driver

qail-pg: Main Mature PG Driver for Rust

This is the dedicated page for postgres rust driver, rust postgres driver, pg rust driver, and rust pg driver intent. qail-pg is the core Rust-native PostgreSQL driver behind QAIL execution paths.

Main Mature Driver qail-pg v0.26.6 Protocol 3.2 First TLS + SCRAM + Pool Updated March 24, 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, 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.26.6 Aligned with the current QAIL workspace crate release line.
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.

Keyword Entry Points for PG Driver Searches

We map common PostgreSQL + Rust keyword combinations to this canonical route so search readers land on a dedicated Rust driver page, not a generic repository root.

Search Variant Reader Intent Canonical Route
postgres rust driver Find a mature PostgreSQL driver in Rust /rust
rust postgres driver Compare Rust PostgreSQL driver capabilities /rust
pg rust driver Look for low-level PG wire driver /rust
rust pg driver Need install steps and quick start /rust

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 affected = conn.pipeline_ast_fast(&commands).await?;
conn.release().await;

Recent Release Context

The current release line is 0.26.6. Protocol 3.2 negotiation work landed in 0.26.2 and remains part of the current 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.