Skip to content

Building from Source

Prerequisites

Platform Requirements
Linux (RHEL/Rocky/AlmaLinux 8 or 9) dnf install postgresql18-devel make gcc
Linux (Ubuntu 24.04 / Debian 12) apt install postgresql-server-dev-18 make gcc
macOS xcode-select --install and Homebrew postgresql@18
Windows No make — use the PowerShell installer script instead

Go (the programming language pg_relay's Processor is written in) 1.23 or newer is required. Install it from go.dev/dl, or use your system's package manager.

Building the extension

git clone https://gitlab.com/pebble-it/pg_relay.git
cd pg_relay

# Install extension files to PostgreSQL's share/extension directory:
sudo make install PG_CONFIG=/usr/pgsql-18/bin/pg_config

# Uninstall:
sudo make uninstall PG_CONFIG=/usr/pgsql-18/bin/pg_config

Building the Processor binary

# Current platform, output to dist/pg_relay:
make build

# All five platforms (cross-compile, CGO_ENABLED=0):
make build-all

CGO_ENABLED=0 tells the Go toolchain to build a fully self-contained binary with no dependency on the local C library — this is what makes cross-compiling to other platforms possible from one machine.

Cross-compiled outputs:

File OS Architecture
dist/pg_relay-linux-x86_64 Linux amd64
dist/pg_relay-linux-arm64 Linux arm64
dist/pg_relay-mac-x86_64 macOS amd64
dist/pg_relay-mac-arm64 macOS arm64 (Apple Silicon)
dist/pg_relay-windows-x86_64.exe Windows amd64

Running tests

# Go unit tests (no live database needed):
make test-go

# SQL regression tests (requires a running PostgreSQL database):
PGHOST=localhost PGPORT=5432 PGDATABASE=relay_dev PGUSER=postgres make test-sql

# Both:
PGHOST=localhost PGPORT=5432 PGDATABASE=relay_dev PGUSER=postgres make test

The SQL tests install the extension fresh into the target database and verify every function, permission, and behaviour. They require a superuser connection (PGUSER=postgres or equivalent).

Go module

The Go module path is gitlab.com/pebble-it/pg_relay. Install the latest release directly with:

go install gitlab.com/pebble-it/pg_relay/cmd/pg_relay@latest

Continue to Platform Support for the full list of tested PostgreSQL versions, operating systems, and paths.