Skip to content

Releases

v0.3.0

Choose a tag to compare

@github-actions github-actions released this 22 Nov 00:27

Install

curl -fsSL https://github.com/barddoo/pgzx/releases/download/v0.3.0/install.sh | sh

Use this release in a Zig project

zig fetch --save=pgzx https://github.com/barddoo/pgzx/archive/refs/tags/v0.3.0.tar.gz

Package hash: pgzx-0.3.0-PsG6MO95CQD-8zZH6uYPk4c_5E3uInHauhAv1zHLEVkO

Full Changelog: v0.2.0...v0.3.0

v0.2.0

Choose a tag to compare

@github-actions github-actions released this 21 Nov 17:25

Install

curl -fsSL https://github.com/barddoo/pgzx/releases/download/v0.2.0/install.sh | sh

Use this release in a Zig project

zig fetch --save=pgzx https://github.com/barddoo/pgzx/archive/refs/tags/v0.2.0.tar.gz

Package hash: pgzx-0.1.0-PsG6MCw_CQCaGtx-7KM7XrR8SD9fkZ0qkxdm5giwB9Z9

Full Changelog: v0.1.0...v0.2.0

v0.1.0

Choose a tag to compare

@github-actions github-actions released this 14 Oct 01:43

pgzx v0.1.0 - PostgreSQL extensions in Zig

pgzx is a library for building PostgreSQL extensions in Zig. It wraps the Postgres C API with idiomatic Zig utilities - error handling, memory allocators, function registration - and ships a development environment that makes building, installing, and testing extensions ergonomic.

This is the initial release. The API is broad and already proven by the bundled examples, but it is not stable: expect breaking changes between releases while the project is under active development.

Highlights

  • SQL/DDL generation - describe your SQL objects in a comptime pgzx_sql declaration and let zig build render the versioned extension script, deriving SQL types from your Zig signatures.
  • Function manager - register functions for SQL with PG_FUNCTION_V1, with automatic (de)serialization of arguments via pgzx.datum converters.
  • Error handling - idiomatic Zig wrappers over Postgres error reporting, plus pgzx.err.Context / pg_try for error-safe FFI (a Zig-native alternative to PG_TRY that keeps defer/errdefer working).
  • Memory context allocators - expose Postgres memory contexts as Zig Allocators, with reset/delete callbacks.
  • Types & data structures - base and composite types, arrays ([]T, text[], IntList/OidList), HeapTuple/TupleDesc, and slist/dlist/htab wrappers.
  • SPI - queries, cursors, prepared/saved plans, and subtransactions.
  • GUCs - DefineCustom*Variable wrappers with assign/show hooks.
  • Concurrency primitives - atomics, spinlocks, LWLocks, shared memory, and background workers.
  • Operators, casts, opclasses - btree/hash opclasses so custom types are indexable and work with GROUP BY.
  • Set-returning functions - SetOf/Table iterators with SETOF/TABLE DDL.
  • Testing - a reusable PGBuild harness with pg_regress and in-server unit tests, plus a nix flake template to bootstrap a new extension.

Requirements

  • Zig 0.17.0
  • PostgreSQL 15 - 18 (PostgreSQL 14 is not yet supported)

Example extensions

A growing set of samples, ordered simple to complex, covering functions, custom types with opclasses, arrays, SPI, set-returning functions, GUCs, background workers, hooks, and backend-safe file I/O - see examples/.

Use this release

zig fetch --save=pgzx https://github.com/barddoo/pgzx/archive/refs/tags/v0.1.0.tar.gz
Package hash: pgzx-0.1.0-PsG6MNSEBwBroeMEwVm3CeTPD588lJoU8WFUaUAIPvys
Then add pgzx as a dependency in your build.zig.zon and import it from build.zig. See the reference docs for the full API.
Learn more
- Documentation: https://xataio.github.io/pgzx/
- Examples: https://github.com/barddoo/pgzx/tree/v0.1.0/examples
- Roadmap: https://github.com/barddoo/pgzx/blob/v0.1.0/ROADMAP.md

Full Changelog: https://github.com/barddoo/pgzx/commits/v0.1.0