pg-wire: Pure Haskell PostgreSQL wire protocol driver

[ bsd3, database, library ] [ Propose Tags ] [ Report a vulnerability ]

A complete implementation of the PostgreSQL v3 wire protocol in pure Haskell. Includes connection management, authentication (SCRAM-SHA-256, MD5, cleartext), TLS, connection pooling, and binary format type classes. No dependency on libpq or any C library.


[Skip to Readme]

Flags

Manual Flags

NameDescriptionDefault
werror

Enable -Werror for development builds.

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.2.0.0
Change log CHANGELOG.md
Dependencies async (>=2.2 && <2.3), base (>=4.17 && <5), base64-bytestring (>=1.2 && <1.3), bytestring (>=0.11 && <0.13), containers (>=0.6 && <0.8), cryptohash-md5 (>=0.11 && <0.12), crypton (>=0.34 && <1.1), crypton-x509-store (>=1.6 && <1.7), crypton-x509-system (>=1.6 && <1.7), deepseq (>=1.4 && <1.6), directory (>=1.3 && <1.4), hashable (>=1.4 && <1.6), memory (>=0.18 && <0.19), network (>=3.1 && <3.3), nothunks (>=0.1 && <0.3), pg-wire, random (>=1.2 && <1.4), stm (>=2.5 && <2.6), text (>=2.0 && <2.2), time (>=1.12 && <1.15), tls (>=1.7 && <2.2), vector (>=0.13 && <0.14) [details]
Tested with ghc ==9.10.3
License BSD-3-Clause
Author Josh Burgess
Maintainer joshburgess.webdev@gmail.com
Uploaded by joshburgess at 2026-04-30T12:27:11Z
Category Database
Home page https://github.com/joshburgess/valiant
Bug tracker https://github.com/joshburgess/valiant/issues
Source repo head: git clone https://github.com/joshburgess/valiant(wire)
Distributions
Reverse Dependencies 5 direct, 4 indirect [details]
Downloads 6 total (6 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2026-04-30 [all 1 reports]

Readme for pg-wire-0.2.0.0

[back to package description]

pg-wire

Pure-Haskell driver for the PostgreSQL v3 wire protocol. No libpq, no C dependencies.

What you get

  • Connection setup: TCP and Unix sockets, TLS 1.2/1.3, MD5 and SCRAM-SHA-256 auth, multi-host failover (target_session_attrs, load_balance_hosts), startup parameters.
  • Connection pool: idle reaping, health checks, jittered max-life, queue mode (LIFO/FIFO), recycling modes (always/on-error), lifecycle hooks, nothunks invariants.
  • Wire frames: extended query (parse / bind / describe / execute), simple query, COPY in/out, large objects, LISTEN/NOTIFY, query cancellation.
  • Binary format type classes: PgEncode, PgDecode, OID metadata. Codecs for individual types live in the valiant runtime library.
  • Errors: 8 structured error constructors (ConnectionError, AuthError, ProtocolError, QueryError, DecodeError, PoolTimeout, PoolClosed, ConnectionDead).

When to use this directly

pg-wire is the transport layer. Most users want the higher-level valiant runtime, which re-exports everything from pg-wire and adds compile-time SQL safety via the valiant-plugin GHC source plugin.

Use pg-wire directly only when you want raw wire-protocol access without the compile-time validation layer (e.g. for building a different ORM or for testing the protocol itself).

Installation

cabal install pg-wire

Documentation

License

BSD-3-Clause. See LICENSE.