Skip to content

This is the multi-page printable view of this section. .

Return to the regular view of this page.

PIG 1.10.0 Documentation

Install, manage, and build PostgreSQL and its extensions with the pig CLI.

Current stable version: v1.10.0. Read the release notes.

PIG provides commands to find, install, and build PostgreSQL extension packages. It also manages PostgreSQL, Patroni, pgBackRest, and Pigsty workflows. Package installation uses the system’s apt, dnf, or yum.

Start here

Your taskPage
Install PostgreSQL and enable your first extensionGetting started
Learn what PIG does and which platforms it supportsIntroduction
Download, install, update, or remove PIGInstallation
Look up commands, options, and automation featuresCommand reference

Install PostgreSQL and extensions

On a Linux host with root or sudo access, run:

curl -fsSL https://repo.pigsty.io/pig | bash
sudo pig repo add pgsql --update
sudo pig install -v 18 pg18 vector

In mainland China, use https://repo.pigsty.cc/pig for the installer. These commands install PostgreSQL 18 and pgvector packages. Continue with Getting started to start a test instance and enable the extension with CREATE EXTENSION vector.

Command reference

TaskCommand
Configure APT/DNF repositoriespig repo
Query the catalog, install, or update extension packagespig ext, pig install
Build extension packages from sourcepig build
Manage local PostgreSQL instances and databasespig pg
Manage Patroni clusters through patronictlpig pt
Inspect or reload pg_exporterpig pe
Back up and restore with pgBackRestpig pb
Run point-in-time recoverypig pitr
Install and configure Pigsty, manage Grafanapig sty
Read, edit, and validate Pigsty inventorypig inventory
Run Pigsty administration playbookspig do
Collect host, database, and backup statuspig context

Run pig help <command> for command help. For automation, use pig -o json --help to inspect command capabilities, then select the relevant output and plan options.

Find more information

Press Ctrl with K (⌘ with K on macOS) to search the site. Press / for page actions. An AI assistant action sends the public page URL and a reading prompt to the selected service.

PIG is developed by Vonng and released under Apache 2.0. Pigsty provides PostgreSQL deployment, monitoring, backups, and high availability.

1 - Getting Started

Install PostgreSQL and pgvector, start an instance, and enable the extension

This tutorial installs PostgreSQL 18 and pgvector, starts a local test instance, and enables the extension in a database.

Use a supported Linux test host with internet access and curl installed. You need root or sudo access. Run the commands in order.

Install PIG

curl -fsSL https://repo.pigsty.io/pig | bash
pig version

In mainland China, use https://repo.pigsty.cc/pig instead. The installer selects the RPM or DEB package for your host. See Installation for other methods.

Check the host

pig status

Check the OS code, architecture, and detected PostgreSQL installations. This command also tests repository connectivity.

Add repositories

Add PGDG and Pigsty PostgreSQL repositories, then refresh package metadata:

sudo pig repo add pgsql --update

For China mirrors, add --mirror to this command.

Install PostgreSQL and pgvector

sudo pig install -v 18 pg18 vector

Review the package manager’s transaction and confirm it.

pg18 selects the PostgreSQL 18 packages. vector selects pgvector. The -v 18 option selects the extension’s PostgreSQL major version.

Check the installed extension files:

pig ext status -v 18

Start a test instance

This tutorial uses /pg/data-demo and port 15432 to avoid the default cluster on port 5432. Use an unused directory and port.

Create an empty data directory owned by the postgres operating-system user:

sudo install -d -m 700 -o postgres -g postgres /pg/data-demo
sudo pig pg init -v 18 -D /pg/data-demo

Start the instance on port 15432:

sudo pig pg start -v 18 -D /pg/data-demo -O '-p 15432'
sudo pig pg status -v 18 -D /pg/data-demo

Enable and test pgvector

Connect to the test instance:

sudo pig pg psql -v 18 -D /pg/data-demo

PIG reads the instance’s connection information from the specified data directory. At the psql prompt, run:

CREATE EXTENSION vector;
SELECT extname, extversion FROM pg_extension WHERE extname = 'vector';
SELECT '[1,2,3]'::vector <-> '[4,5,6]'::vector AS distance;

The first query returns the installed pgvector version. The second returns a distance of approximately 5.196. Exit psql with \q.

CREATE EXTENSION enables an extension in the connected database. Repeat it in each database that needs pgvector.

Stop the test instance when you finish:

sudo pig pg stop -v 18 -D /pg/data-demo

The data stays in /pg/data-demo. Run the start command again to reuse the instance. See PostgreSQL management for service configuration and other operations.

Find more extensions

pig ext list                 # List the catalog
pig ext list duckdb          # Search by name or description
pig ext info pg_duckdb       # Show metadata and setup requirements
pig ext avail pg_duckdb      # Show package availability

Before installing another extension, use info to check its setup requirements and avail to check package availability.

Select packages and versions

To use another PostgreSQL major version, replace 18 in the commands above. See extension installation for package groups, version selection, and existing installations.

Inspect and update

pig ext status -v 18 lists installed extension files. To list extensions enabled in a database, run \dx in psql. See extension updates when you need to upgrade a package and its database objects.

2 - Introduction

What PIG does, how package installation works, and which platforms it supports

PIG is a command-line tool for installing and managing PostgreSQL and its extensions. It maps extension names to RPM or DEB packages and uses apt, dnf, or yum to install them.

The catalog contains 603 extension entries. PIG selects package names for your PostgreSQL major version, operating system, and CPU architecture. It also provides commands for source builds, local PostgreSQL operations, backups, and Pigsty administration.

What you can do

TaskCommandReference
Find an extension and check package availabilitypig ext list, pig ext availExtensions
Add PGDG and Pigsty repositoriespig repo add pgsql -uRepositories
Install PostgreSQL 18 and pgvectorpig install -v 18 pg18 vectorGetting started
Build an extension package from sourcepig build pkg NAMEBuild
Start, inspect, or stop a local PostgreSQL instancepig pgPostgreSQL
Manage a Patroni clusterpig ptPatroni
Back up or restore an instancepig pb, pig pitrpgBackRest, PITR
Configure Pigsty and run its playbookspig sty, pig inventory, pig doPigsty

Start with the tutorial to install PostgreSQL and enable your first extension.

How package installation works

For example, this command installs pgvector for PostgreSQL 18:

sudo pig install vector -v 18

PIG resolves vector to pgvector_18 on EL or postgresql-18-pgvector on Debian and Ubuntu. The system package manager resolves dependencies and installs the files.

To enable the extension, connect to the intended database and run:

CREATE EXTENSION vector;

Some extensions also need a setting in shared_preload_libraries and a PostgreSQL restart. Use pig ext info NAME to check these requirements. See package and database operations for updates and removal.

PIG is needed only when you run its commands. PostgreSQL and installed extensions continue to work without it. You can also use the Pigsty repositories directly with apt or dnf.

Linux compatibility

The package repositories cover PostgreSQL 14–18 on these Linux releases. Each release has packages for x86_64 and aarch64.

OS codeDistributionRelease
el8RHEL, Rocky Linux, AlmaLinux8
el9RHEL, Rocky Linux, AlmaLinux9
el10RHEL, Rocky Linux, AlmaLinux10
d12Debian12
d13Debian13
u22Ubuntu22.04 LTS
u24Ubuntu24.04 LTS
u26Ubuntu26.04 LTS

Package availability varies by extension and target. On the target host, run:

pig ext avail vector

The 603 catalog entries include packaged SQL utilities and retained records for removed extensions. The website and CLI use this same catalog-entry count. Check the entry’s status and availability before selecting a package. EL 7 and Debian 11 are outside the current package matrix.

The macOS binary supports catalog queries and commands such as inventory editing. PostgreSQL package installation uses Linux package managers. See Installation for the binary downloads.

Choose a workflow

  • Use an existing host: add repositories with pig repo add pgsql -u, then install the required packages.
  • Configure all repositories on a new host: use pig repo set. It backs up and replaces the existing repository definitions.
  • Build a package: prepare a build host and use the maintained specifications with pig build.
  • Prepare an offline installation: collect packages with pig ext import, index them with pig repo create, and archive them with pig repo cache. See offline repositories.
  • Write a script or agent workflow: inspect pig -o json --help and use the supported output and plan options in the command reference.

The Design Records explain the main implementation decisions. The release notes describe changes in each published version.

3 - Installation

How to download and install the pig package manager

Install PIG with the Linux installer, a system package, or a release archive. The current version is v1.10.0. The download page lists all release files.

Script installation

On Linux, run:

curl -fsSL https://repo.pigsty.io/pig | bash

In mainland China, use:

curl -fsSL https://repo.pigsty.cc/pig | bash

The script detects the architecture, downloads the RPM or DEB package, and installs it with rpm or dpkg. Installation requires root or sudo access.

Check the installed version:

pig version

To select a published version, pass its version number:

curl -fsSL https://repo.pigsty.io/pig | bash -s 1.10.0

Download release artifacts

Choose a file for your operating system and architecture on the download page or GitHub release.

SystemFormatArchitecture names
ELRPMx86_64, aarch64
Debian, UbuntuDEBamd64, arm64
Linuxtar.gzamd64, arm64
macOStar.gzamd64 (Intel), arm64 (Apple Silicon)

For a release archive, extract it and install the pig executable in a directory on your PATH. For example, on Apple Silicon:

curl -fLO https://github.com/pgsty/pig/releases/download/v1.10.0/pig-v1.10.0.darwin-arm64.tar.gz
tar -xzf pig-v1.10.0.darwin-arm64.tar.gz
sudo mkdir -p /usr/local/bin
sudo install -m 0755 pig /usr/local/bin/pig
pig version

The release includes SHA-256 checksums. Use sha256sum on Linux or shasum -a 256 on macOS to compare your downloaded file with its listed hash.

The macOS binary supports catalog queries, inventory editing, and other commands that do not need Linux package managers. Install PostgreSQL packages on a supported Linux host.

Repository installation

To manage PIG with the system package manager, add the Pigsty Infra repository. Choose the tab for your host:

APT (Debian / Ubuntu)
sudo tee /etc/apt/sources.list.d/pigsty-infra.list > /dev/null <<EOF
deb [trusted=yes] https://repo.pigsty.io/apt/infra generic main
EOF

sudo apt update
sudo apt install -y pig
DNF (EL)
sudo tee /etc/yum.repos.d/pigsty-infra.repo > /dev/null <<-'EOF'
[pigsty-infra]
name=Pigsty Infra for $basearch
baseurl=https://repo.pigsty.io/yum/infra/$basearch
enabled=1
gpgcheck=0
module_hotfixes=1
EOF

sudo dnf makecache
sudo dnf install -y pig

These definitions disable signature checks for the Pigsty repository. For key handling and verification settings, see repository keys.

Update

On Linux, update the executable with:

sudo pig update

Use -m for the China mirror or -v 1.10.0 to select that version. For an archive installation on macOS, download the new archive and replace the installed executable.

Refresh the extension catalog separately:

pig ext reload

This updates catalog metadata, leaving installed packages unchanged.

Uninstall

Choose the command that matches your installation:

sudo apt remove pig              # Debian / Ubuntu package
sudo dnf remove pig              # EL package
sudo rm /usr/local/bin/pig        # Archive installed at this path

If you installed the archive elsewhere, remove that executable instead. PostgreSQL and its extensions continue to run without PIG.

Build from source

Install Git, Make, and the Go toolchain specified in the project’s go.mod. Build the current release:

git clone --branch v1.10.0 https://github.com/pgsty/pig.git
cd pig
go mod download
make build
./pig version

make build produces ./pig for the current platform. The release workflow uses GoReleaser to produce RPM, DEB, and tar.gz files.

Continue with Getting started to install PostgreSQL and enable an extension.

4 - Release

pig — PostgreSQL Package Manager Release Notes

The latest stable version is v1.10.0.

VersionDateSummaryGitHub
v1.10.02026-10-17603 catalog entries, PostgreSQL target and recovery safety, faithful Inventory, automation fixesv1.10.0
v1.9.02026-10-06600 catalog entries, Xray roles, repository keys, pgrx 0.19.3v1.9.0
v1.8.12026-09-03CLI/repository safety, debug packages by default, pgrx 0.19.2v1.8.1
v1.8.02026-08-14Native sty boot and sty conf, 575 packaged extensionsv1.8.0
v1.7.02026-08-12EL module policy, China mirrors, EL7 compatibility, 575 extensionsv1.7.0
v1.6.22026-08-11572 extensions, Grafana schema v2, SOW-first repository generationv1.6.2
v1.6.12026-07-30Catalog refresh and embedded Pigsty 4.5.0v1.6.1
v1.6.02026-07-28562 packaged extensions, patronictl passthrough, inventory & CMDB, Grafanav1.6.0
v1.5.12026-07-08PG kernel fork updates, mirror mode, bug fixesv1.5.1
v1.5.02026-07-04531 extensions, pigsty v4.4, pg/pt/pb/pitr rework, clone & forkv1.5.0
v1.4.22026-06-18524 extensions, PG19 beta, pgrx 0.18.1, Patroni fixesv1.4.2
v1.4.12026-05-01510 extensions, Ubuntu 26.04 support, repo calibrationv1.4.1
v1.4.02026-04-19510 extensions, pgrx 0.18.0, more building specsv1.4.0
v1.3.42026-04-14504 extensions refreshed, release checksums updatedv1.3.4
v1.3.32026-04-10481 extensions and Go 1.26.2 updatev1.3.3
v1.3.22026-03-23Routine metadata refresh, new pg tune, new build aliasesv1.3.2
v1.3.12026-03-05Retire PG13 defaults, unify PG14-18 support window, 464 extensionsv1.3.1
v1.3.02026-02-27Build pipeline hardening, 461 extensions, new pgedge/ivory supportv1.3.0
v1.2.02026-02-23Unified aliases, routine updates, plan mode, repo fixesv1.2.0
v1.1.12026-02-14Path, symlink, and build migration fixesv1.1.1
v1.1.02026-02-12451 extensions, Agent-Native CLI frameworkv1.1.0
v1.0.02026-01-26New pg/pt/pb/pitr commands, availability matrixv1.0.0
v0.9.02025-12-28Rename sty deploy and expand sty conf optionsv0.9.0
v0.8.12025-12-27Restore llvmjit to the pgsql-full aliasv0.8.1
v0.8.02025-12-26440 extensions, remove sysupdate repov0.8.0
v0.7.52025-12-12Routine extension update, fixed aliyun mirrorv0.7.5
v0.7.42025-12-01Update ivory/pgtde kernel and pgdg extrasv0.7.4
v0.7.32025-11-24Fix repo for el10 & debian13v0.7.3
v0.7.22025-11-20437 extensions, fix pig build issuev0.7.2
v0.7.12025-11-10New Website, improve in-docker experiencev0.7.1
v0.7.02025-11-05Build Enhancement and massive upgradev0.7.0
v0.6.22025-10-03PG 18 official Repov0.6.2
v0.6.12025-08-14CI/CD, el10 stub, PGDG CN Mirrorv0.6.1
v0.6.02025-07-17423 extension, percona pg_tde, mcp toolboxv0.6.0
v0.5.02025-06-30422 extension, new extension catalogv0.5.0
v0.4.22025-05-27421 extension, halo & oriole debv0.4.2
v0.4.12025-05-07414 extension, pg18 alias supportv0.4.1
v0.4.02025-05-01do & pt sub-cmd, halo & orioledbv0.4.0
v0.3.42025-04-05routine updatev0.3.4
v0.3.32025-03-25alias, repo, depsv0.3.3
v0.3.22025-03-21new extensionsv0.3.2
v0.3.12025-03-19minor bug fixv0.3.1
v0.3.02025-02-24new home page and extension catalogv0.3.0
v0.2.22025-02-22404 extensionsv0.2.2
v0.2.02025-02-14400 extensionsv0.2.0
v0.1.42025-02-12routine bugfixv0.1.4
v0.1.32025-01-23390 extensionsv0.1.3
v0.1.22025-01-12the anon extension and 350 other extv0.1.2
v0.1.12025-01-09Update Extension Listv0.1.1
v0.1.02024-12-29repo, ext, sty, and self-updatev0.1.0
v0.0.12024-12-23Genesis Releasev0.0.1

v1.10.0

Pig v1.10.0 strengthens the correctness and safety of existing commands. It verifies PostgreSQL targets before operations, preserves Inventory sources and YAML types, and makes repository, extension, and automation results match the work actually performed. The bundled catalog grows from 600 to 603 records. Embedded Pigsty remains 4.5.0; the default cargo-pgrx remains 0.19.3.

PostgreSQL targets and maintenance

  • An explicit -D binds psql, ps, kill, vacuum, analyze, freeze, and repack to the selected instance, including --all database enumeration. PIG validates the PID, data directory, port, socket, and process identity before starting the SQL client. Invalid, stale, copied, or uncertain runtime metadata causes failure instead of a fallback to another instance.
  • Without -D, those SQL commands retain native client connection defaults. pg clone and pg fork retain their own port options. Promotion timeline checks use the selected instance or its control data; an unresolved timeline is left unknown.
  • Plans and confirmation retry commands preserve the selected data directory, PostgreSQL version, operating-system user, and maintenance options. VACUUM FULL plans correctly require confirmation.
  • Maintenance operands are literal database names. Values containing = or beginning with postgres:// or postgresql:// are rejected before planning or execution, without echoing the value. Spaces and non-ASCII names remain supported. Generated commands put names after --, so a database named --all cannot become a command option.
  • vacuum, analyze, and freeze --all validate the complete database list before maintenance begins. Use native clients when a connection string or a database name rejected by this boundary is required.

See pig pg for target selection and maintenance commands for database-name rules.

Runtime state, recovery, and fork safety

  • Permission failures, malformed PID metadata, and unavailable process identity are reported as errors or unknown state. They cannot authorize forced initialization, restore, or fork replacement. pg status returns 130201 (exit 3) for permission failures and 130808 (exit 1) for other runtime-probe failures. Plans report an unresolved precondition as unknown.
  • Declining PITR confirmation or reaching EOF returns 161001 (exit 7) before any service stop, restore, or startup. An unknown state cannot supply a PID for forced termination or count as successful startup. Post-restore SQL checks require a verified target.
  • Replacing a nonempty unmanaged fork requires valid ownership metadata with a matching explicit target path. Missing, damaged, or mismatched metadata cannot authorize deletion. Existing protections for running targets and source/destination relationships remain in force.
  • Clone and fork path checks run as the selected database operating-system user when needed, supporting private 0700 data directories. An inaccessible or unresolved path cannot bypass validation. Managed orphan cleanup remains available through the managed fork name.
  • Files written as the database user use private sibling staging and exact-target replacement. The new file has 0600 permissions; directory or symlink targets are refused, and replacement does not overwrite the contents of another hard link to the old file.

The PITR reference explains the managed recovery workflow; pig pb restore remains a separate restore primitive.

Inventory and Pigsty

  • sty deploy and do pass the resolved Inventory path explicitly to Ansible. Flag and environment paths resolve from the caller’s working directory; quoted ~/ paths expand before resolution. A selected missing or invalid source does not silently fall back to another inventory.
  • pg_users[].roles preserves both role-name strings and structured grants, including grant state and optional admin, set, and inherit attributes.
  • Editing, serialization, and CMDB export retain strings that YAML consumers might otherwise interpret as numbers, dates, or timestamps. Existing timestamp scalars retain their original source representation. Independent PyYAML checks verify the emitted string types.
  • sty conf --proxy accepts uppercase and lowercase HTTP, HTTPS, ALL, and NO proxy variables. Missing HTTP and HTTPS values both fall back to ALL_PROXY. Version completion observes dotted version boundaries, so a request for 1.1 cannot select 1.10.

See Inventory source selection and pig sty.

Repositories and extensions

  • Repository commands validate the complete operand list before changing files. Empty values, empty comma-separated elements, and unsafe repository names fail before mutation. Only truly argument-free repo rm backs up all repository files; repo rm all expands the node, pgsql, and infra modules. Removal results preserve the original request and distinguish missing targets from removed files. --update also refreshes the cache after a full backup.
  • Repository creation retains documentation RPMs. Debug package suppression continues to use --nodbg; a -docs or -doc name alone does not make a package a debug package.
  • Default extension lists, availability summaries, and refresh results count all catalog records, including SQL utilities and retained lifecycle entries. The total describes catalog coverage, not how many extensions can be installed on one host or enabled with CREATE EXTENSION.
  • Text, JSON, and YAML share availability rules. On covered Linux platforms, package matrices take precedence and a missing matrix cell means unavailable. Architecture aliases are normalized. On macOS, the status describes declared PostgreSQL support without promising an RPM/DEB package. ext list -v selects the version used to evaluate status; unavailable records remain listed.
  • ext import reports failure if any requested package cannot be resolved or downloaded, while retaining successful downloads and reporting the completed and failed portions. APT virtual dependency markers are excluded from package download requests. Installed-library scanning also recognizes catalog entries without a control file.
  • The three new catalog records are pg_icu_parser, pg_vectorsearch, and textsearch_intl. Existing versions and platform metadata are refreshed as well. Use pig ext avail NAME to inspect a target before installing.

Details: pig repo, pig ext.

Builds and automation

  • Multi-version build dependency installation expands package names for every selected PostgreSQL major version and removes duplicates. Default build targets retain their metadata and local installation rules independently of package-matrix gaps.
  • Debian/Ubuntu builds preserve the inherited PATH order and append the current user’s ~/.cargo/bin when present, preserving an explicitly selected toolchain.
  • Xray setup recognizes complete legacy service definitions, including marker-free macOS plists generated by the previous renderer. A comment alone cannot prove ownership; changed or foreign definitions still require explicit replacement. Matching reruns preserve a running service.
  • JSON/YAML output and PIG_NON_INTERACTIVE=1 consistently disable prompt input and use non-interactive sudo in PIG-owned adapters. Explicit data-input channels remain available; native Patronictl forwarding retains its interaction and exit contract.
  • CMDB connection strings, legacy VMess credentials, and license keys are excluded from routine parameters and failure details. Explicit credential export and raw Inventory display retain their documented sensitive-output behavior.
  • Exporter HTTP 4xx/5xx responses now fail with the numeric status and standard description, without including response bodies or custom status text. Unsupported pig update platforms fail explicitly. Command help and bilingual references are aligned with these behaviors.
  • Go dependencies and validation tools are refreshed. CI includes Linux permission and instance boundary acceptance plus independent YAML consumer checks.

See pig build, pig pe, and global command behavior.

Upgrade notes

Existing command names and flags remain available. Automation should handle the corrected failure statuses for partial imports, HTTP errors, cancelled recovery, and indeterminate PostgreSQL state. Scripts must supply valid repository operands, explicit confirmation where required, and literal maintenance database names. When a name begins with -, place all options before -- and the name.

Upgrade with the installation instructions.

Release artifacts: v1.10.0


v1.9.0

Pig v1.9.0 adds one-command Xray client/server setup, automatic Pigsty repository-key preparation, and a refreshed 600-entry extension catalog. The default cargo-pgrx version is now 0.19.3; the embedded Pigsty version remains 4.5.0.

Xray clients and servers

  • pig build proxy installs or verifies Xray. pig build proxy client configures a VLESS/REALITY/Vision HTTP/SOCKS client; pig build proxy server configures a Linux server. Linux uses systemd; the macOS client uses a dedicated user LaunchAgent.
  • Client input accepts a standard VLESS URI, --from FILE/-, or explicit connection flags. The first client listener is 127.0.0.1:12345; the first direct server listener is 0.0.0.0:443. Repeated setup preserves existing listeners and server credentials.
  • Matching configuration, ownership, permissions, and service state avoid rewrites and restarts. Failed client connectivity checks restore prior managed files and service state. Replacing a different client requires --replace --yes; --plan previews either role.
  • server --export-only --host HOST --export - exports an existing connection without changing the deployment. File exports use mode 0600; explicit stdout export requires text output. Ordinary results and plans omit credentials. The historical VMess positional form remains available through V2Ray.
sudo pig build proxy server --host proxy.example.com --target www.sraoss.co.jp:443 --export ./client.uri
sudo pig build proxy client --from ./client.uri

Run the server command on the server, then transfer client.uri securely to the client and run the client command there. See pig build for prerequisites and macOS setup.

Repository keys

  • repo add, repo set, and sty boot prepare the embedded Pigsty public key when selected repositories need it. Existing regular key files are reused; missing defaults are installed offline at /etc/pki/rpm-gpg/RPM-GPG-KEY-pigsty or /etc/apt/keyrings/pigsty.asc.
  • Implicit default-key failure emits a warning and falls back only for selected Pigsty definitions. Default key references remain stable, including APT signed-by.
  • Explicit signing-key references are mandatory: invalid or unavailable keys fail before repository replacement or cache refresh. EL imports explicit references with rpm --import. Selecting unrelated repositories does not prepare the Pigsty key.

See pig repo for signature-enforcement defaults and the distinction between key preparation and metadata refresh.

Catalog and build defaults

  • The embedded catalog contains 600 entries, adding 22 entries to the v1.8.1 snapshot. New entries include edtf_postgres, plphp, pg_lexo, pg_money, istore, colnames, pg_statkit, pgtelemetry, pg_rusage, pgexporter_ext, pg_statvfs, and libx509pq. Package versions and platform-availability metadata are refreshed as well.
  • The catalog total includes retained lifecycle records. Installability depends on each extension’s state and OS/architecture/PostgreSQL matrix. Use pig ext avail NAME to check a target.
  • pig build pgrx defaults to cargo-pgrx 0.19.3. An explicit -v and extension-specific catalog metadata continue to select another required version.
  • Platform debug packages remain enabled by default, as in v1.8.1. Use --nodbg for RPM debuginfo/debugsource and DEB dbgsym suppression; -s|--symbol is a deprecated no-op.

Compatibility

No existing command or flag is removed. New Xray role commands use VLESS/REALITY/Vision; existing positional VMess commands retain their V2Ray behavior. Server setup checks the local listener and service. Configure the firewall, cloud security group, and any Nginx frontend for the chosen public port, then verify the connection from the client.

Release artifacts: v1.9.0

Verification

The verified v1.9.0 tag points to 9eb5488. The exact commit passed full CI, including randomized tests, command race regressions, vet, static analysis, vulnerability scanning, and a release snapshot. The Release workflow produced eight Linux/macOS archives and RPM/DEB packages. Published downloads were verified against SHA-256.

Checksums

Download asset
FileChecksum
pig-1.9.0-1.aarch64.rpm Linuxarm64SHA-256d0d80bd23a654308598f265ce4b4d4f78d6156c113ce6aa00f82bfc9519a180f
pig-1.9.0-1.x86_64.rpm Linuxamd64SHA-256e3b25640c9e528f2b883f7e5f4838640a8897857fa22dc1324aca69b72966a7c
pig-v1.9.0.darwin-amd64.tar.gz macOSamd64SHA-256d7eb266e1b8ab60d20ac582c6b0e3741b7e8516ce1a56df447c0285b3e5dcab9
pig-v1.9.0.darwin-arm64.tar.gz macOSarm64SHA-256096284577d0493ddba871b51e820654b358c7f4eb9c11175674a1d21b2718824
pig-v1.9.0.linux-amd64.tar.gz Linuxamd64SHA-256a4b5ffca540bc4f924f86398bcad6cb7221ac7520b54b1d3fd32c9877d9cafd2
pig-v1.9.0.linux-arm64.tar.gz Linuxarm64SHA-256ddfa80fbb34f6738dd68e0d04cd92355711330f6896cd650df7d71b012788def
pig_1.9.0-1_amd64.deb Linuxamd64SHA-2563d955a24a8ff805ee2b6da6428e2b882f97104e2fb597785225269443071d93a
pig_1.9.0-1_arm64.deb Linuxarm64SHA-256c175b37552147e64590309801800826a0075ae8285ed78178c2adcaec3741471

v1.8.1

Pig v1.8.1 is a safety, correctness, and maintenance release on top of v1.8.0. It hardens command initialization, privileged log access, repository and build workflows, release integrity, and structured-output redaction. It also refreshes the embedded extension catalog and moves the build toolchain to Go 1.27.1 and cargo-pgrx 0.19.2. The embedded Pigsty version remains 4.5.0.

CLI safety and correctness

  • Read-only and configuration-independent commands no longer require a writable HOME or create ~/.pig as a side effect. Leaf commands preserve their declared initialization policy.
  • pig pg log, pig pt log, and pig pb log preserve arguments through sudo execution as the database OS user and reject unsafe log-file links.
  • pig do validates Pigsty names and rejects reserved Ansible cluster targets before execution.
  • Native PostgreSQL role detection is bound to the selected instance rather than an unrelated local default.
  • Structured results redact credentials, license material, and build-proxy identifiers while retaining truthful command failure.

Repository and build hardening

  • Repository add and remove operations now fail when any requested operation fails, deduplicate module selections, and preserve replacement boundaries.
  • Offline cache bundles reject unsafe paths, links, special files, and incomplete inputs; archive extraction remains rooted and fail-closed. The obsolete exported cache wrapper was removed after production moved to the structured result path.
  • Build source and artifact validation rejects incomplete or unsafe inputs. pig build proxy uses the package-provided service contract, treats its operands as optional, and keeps secret identifiers out of structured output.
  • Self-update verifies release checksums, and release tooling refuses dirty or mismatched-tag publication and immutable artifact replacement.

Toolchain and catalog

  • pig build ext and pig build pkg keep platform debug packages enabled by default; use --nodbg to omit them. -s|--symbol remains a deprecated compatibility no-op.

  • Go is updated to 1.27.1; Logrus to 1.10.2; GoReleaser to 2.18.0; and golangci-lint to 2.13.2.

  • pig build pgrx now installs cargo-pgrx 0.19.2 by default. Use -v when an extension requires an older pgrx line recorded in its catalog metadata.

  • The embedded catalog is refreshed from the maintained pgext view. It adds acdat 0.1.0, marks the superseded pgcontext_pgvector entry removed, and updates package versions, repository ownership, PostgreSQL coverage, and availability matrices.

Verification

The release is built from source commit 1c6f524. The exact commit passed the full CI workflow, including randomized tests, command race regressions, vet, static analysis, dead-code detection, vulnerability scanning, and a GoReleaser snapshot. The tag then passed the Release workflow, which produced the published RPM, DEB, macOS, and Linux artifacts.

Compatibility notes

  • No CLI command or flag is removed in this release.
  • Scripts that previously depended on read-only commands creating local configuration should create that state explicitly instead.
  • The pgrx default changes to 0.19.2; extension-specific metadata remains authoritative when a build requires another pgrx version.

Checksums

Download asset
FileChecksum
pig-1.8.1-1.aarch64.rpm Linuxarm64SHA-2564154b3e49cb499e57d7c7b1ab4ae5e45d03d5d0c2ffe26d6ade64e46db6923cf
pig-1.8.1-1.x86_64.rpm Linuxamd64SHA-25635c398f409d9293b4f8c0cdf949b19c62d06016ec7e724472143d2327199869d
pig-v1.8.1.darwin-amd64.tar.gz macOSamd64SHA-2566c08b6a698191b8b6494a0f60880fb17cafa535bad12d5c544333e4625048455
pig-v1.8.1.darwin-arm64.tar.gz macOSarm64SHA-2560fb6c86cc18a29aeb74e9d12e717c104087c6ecf5a43250dfcc71cd7681fb868
pig-v1.8.1.linux-amd64.tar.gz Linuxamd64SHA-2569219e87433ebd239e0773ae7417fdd08e97bb511312e6747542bf46b6b1bbf2b
pig-v1.8.1.linux-arm64.tar.gz Linuxarm64SHA-256b30924880f21126ece3afc77ca75794a0ceb77964cdfd8bc20da72d9d3273078
pig_1.8.1-1_amd64.deb Linuxamd64SHA-2566fc304501671921b18439223c630c7d4635b10ac75493d5c12a5987ff80c618e
pig_1.8.1-1_arm64.deb Linuxarm64SHA-2561a70cd71f6c1f443812fe30535427891513c0ba03be219ac21f1a3d6fd450051

Release artifacts: v1.8.1

v1.8.0

Pig v1.8.0 updates native controller workflows from v1.7.0. Go implementations of pig sty boot and pig sty conf replace wrappers for the legacy bootstrap and configure shell scripts. The packaged PostgreSQL extension count remains 575. The embedded Pigsty version remains 4.5.0.

Highlights

  • pig sty boot can elevate once through sudo. It verifies Ansible and its actual Python runtime. It supports explicit local packages, HTTP(S) URLs, trusted automatic offline packages, committed local repositories, and regional online repositories. It backs up repository configuration before replacement and restores it on failure. It attempts to repair localhost SSH and a missing ~/pigsty, but repair is not guaranteed.
  • pig sty conf generates inventory natively from safe templates. It supports up to ten IP mappings, exact domain replacement, region and proxy settings, PostgreSQL-version selection, and random credentials. It validates the complete candidate, then writes it atomically with mode 0600.
  • Bootstrap download and extraction no longer require curl, wget, tar, or gzip. Offline operation uses only pigsty-local and requires the /www -> /data/nginx layout.
  • EL8 and newer consistently prefer DNF. Local RPM requirements resolve by provider capability. This release updates extension metadata and availability matrices, and moves the toolchain to Go 1.26.6.

Compatibility Notes

  • pig sty boot no longer runs <PIGSTY_HOME>/bootstrap. Automation that relied on script side effects must use the native command.
  • Removed pig sty conf --raw. --conf MODE and positional MODE are equivalent. --ip accepts up to ten addresses. You cannot combine it with --skip.
  • EL8 and newer use DNF. The limited EL7 compatibility catalog keeps its separate legacy YUM path.

Checksums

Artifacts: GitHub Release · checksums.txt

02fd2628810c1b00de730ece32b09dba1318be4c99a4ff1a0551740e32bf223b  pig-1.8.0-1.aarch64.rpm
72ba72a00af52a84b08b1346f85b42668b52bc097e315774ff9f501ca23ece8b  pig-1.8.0-1.x86_64.rpm
f023a5c9049dc532a057e932c73a8197683eaf4d97cb7a8f219492da1ad2a65f  pig-v1.8.0.darwin-amd64.tar.gz
e0ccf61c4d135dbc45359c207751092aeb6df788e826bb73eccc1a1ed8800998  pig-v1.8.0.darwin-arm64.tar.gz
a24a08c1b8d54adcdef5a99ed7b91caeedef1552a1440b1258eb4eb07fb20353  pig-v1.8.0.linux-amd64.tar.gz
9d23875804f87e78039498245059fd6b765831f027aacfc511ad0ac42711fa7b  pig-v1.8.0.linux-arm64.tar.gz
96259ff7584cd52254c91a9fd7d77bd577f23c55cb09f4bc995a3ca0fcbc7321  pig_1.8.0-1_amd64.deb
2e7370211514df6355ef96fb812670febe6ee1b85a28378432c33ebdaecb4b63  pig_1.8.0-1_arm64.deb

Release: https://github.com/pgsty/pig/releases/tag/v1.8.0


v1.7.0

Pig v1.7.0 updates repository compatibility and the catalog from v1.6.2. It makes China-mirror selection explicit and preserves native DNF module filtering by default. It restores a simplified EL7 repository catalog. The bundled extension snapshot grows from 572 to 575. The embedded Pigsty version remains 4.5.0.

Highlights

  • -m|--mirror directly selects the bundled china repository definitions. PGDG, Rocky Linux, Debian, Ubuntu, Docker, and other regional routes use the maintained mirror list. This replaces the former PGDG proxy rewrite at runtime.
  • EL repository definitions no longer receive module_hotfixes=1 globally. Pigsty and PGDG repositories explicitly enable it when they need to override module streams. BaseOS, AppStream, EPEL, and other repositories retain native DNF module filtering.
  • EL7 retains a limited compatibility catalog. It includes archived CentOS 7 Base/Updates/Extras/SCLo and EPEL definitions for x86_64, plus shared Pigsty and supported PGDG entries. EL7 YUM rendering removes the DNF-only module_hotfixes key.
  • If the catalog has no matching definitions, repository setup reports an unsupported platform. It no longer continues with an empty repository set.

Extension Catalog

  • Packaged extensions: 572 -> 575, with no removals.
  • Add pg_local_cache 1.2.0, pg_statviz 0.1.0, and pg_policy 0.1.0.
  • Refresh biscuit 3.0.0, pg_clickhouse 0.10.0, pg_search 0.25.2, pg_turbovec packages 1.29.0, pg_uuid_v8 1.1.0, and the Debian q3c 2.0.5 package.

Compatibility Notes

  • No commands or global flags are removed in this release.
  • -m|--mirror now explicitly selects the China region. It no longer rewrites the PGDG proxy. For a specific route, use --region=default|china|europe.
  • Custom EL repository definitions must set meta.module_hotfixes: 1 explicitly to override module streams. Ordinary OS repositories omit this setting. EL7 removes it.
  • EL7 is end-of-life and has only limited compatibility coverage. Prefer EL8 or newer for current PostgreSQL and extension packages.

Checksums

Artifacts: GitHub Release · checksums.txt

e3a339fefdd2203825d15438b52f18e729547eb88dae014212a46006a9bd47d1  pig-1.7.0-1.aarch64.rpm
34ce29d75ef9f669f3bf832cc812ae082abda7320ee2b2336ea61e701b9b67f8  pig-1.7.0-1.x86_64.rpm
d26803c685ba29c01cb8e6dfe50c6c1b0f004173be82015618fa8cdf6a329ba7  pig-v1.7.0.darwin-amd64.tar.gz
ea8120d48b93da936919f590ebbefeb72e73277e6bc133c1ef0bb1abc055d3ce  pig-v1.7.0.darwin-arm64.tar.gz
40295b64a2423094fa6f4e6d31da8d8ad5b26698c397d8916c0289591522d0bf  pig-v1.7.0.linux-amd64.tar.gz
7929091732957d85751ef3381285a1e5b0c3c7f82c0e00fc24ed085c496012d5  pig-v1.7.0.linux-arm64.tar.gz
41523c15f36a6c1acaf4af5c851d2626472fc15c21d25f91fc1e991fe8411072  pig_1.7.0-1_amd64.deb
adf7b2d9ce8fe42bad935428d16a9c998337df986b1065e0761dc167ce837ef5  pig_1.7.0-1_arm64.deb

Release: https://github.com/pgsty/pig/releases/tag/v1.7.0


v1.6.2

Pig v1.6.2 adds features and updates the catalog from v1.6.1. Packaged extensions increase from 562 to 572. This release adds native Grafana dashboard schema v2 support and improves local repository generation. The embedded Pigsty version remains 4.5.0.

Highlights

  • pig sty grafana accepts legacy dashboard JSON and native dashboard.grafana.app/v2 Dashboard resources. It loads v2 dashboards through the Grafana resource API to preserve tabs and section variables across loading and dumping. Dumps preserve an existing v2 destination. New dumps use the legacy format by default.
  • When SOW is available, pig repo create prefers sow create --pigsty --timeout 10m -- <dir>. It requires a repo_complete marker that is a regular file. On Linux, it can fall back to createrepo_c / dpkg-scanpackages.
  • Local repository creation works on macOS through SOW. On macOS, it defaults to the current directory and does not require sudo. The Linux default remains /www/pigsty.
  • Release metadata is bumped to 1.6.2; the embedded Pigsty version stays at 4.5.0.

Extension Catalog

  • Packaged extensions: 562 -> 572, with no removals.
  • 10 new extensions: pg_turbovec, pg_disorder, pg_mentat, plruby, jsonb_plruby, hstore_plruby, ltree_plruby, pg_describe, cat_tools, and pg_vault_tde.
  • 12 version refreshes: timescaledb 2.29.1, q3c 2.0.5, pgmnemo 0.16.1, pg_search 0.25.1, citus 14.2.0, citus_columnar 14.2.0, provsql 1.12.0, plpgsql_check 2.10.4, pg_rational 0.0.3, pgbson 2.1.0, pg_readme 0.7.1, and pg_readme_test_extension 0.7.1.
  • Package metadata and availability matrices are refreshed. Run pig ext reload to replace the embedded release snapshot with the latest online catalog.

Compatibility Notes

  • No commands or global flags are removed in this release.
  • With SOW installed, pig repo create prefers it over the legacy Linux generators. It checks for the completion marker before reporting success.
  • The catalog count does not guarantee package availability for every PostgreSQL / OS / architecture combination. Check the target host with pig ext avail NAME.

Checksums

Artifacts: GitHub Release · checksums.txt

6697a96bbf476e697a5c3da8b6c861719e4b7208e1e4fe927cf4b475ea1f162f  pig-1.6.2-1.aarch64.rpm
ad0b311867bc6cd689dd73e9a96b84f1fe0f49f6c0f1184abf9eb3232a07a184  pig-1.6.2-1.x86_64.rpm
bb167e04fceb6cebee5c8a2423279cefb4474f46301a5055c464ac98294dc9db  pig-v1.6.2.darwin-amd64.tar.gz
3de74e33321884a0c36596c1e7df9370be594a315395538e9ba5b775bbc1a79d  pig-v1.6.2.darwin-arm64.tar.gz
7b69214e115e6815e772b7e179aa4070bd8553e585b164ba3a0f69a1d53a0294  pig-v1.6.2.linux-amd64.tar.gz
b511e727642987867be5921d72e8019e9c6186b82e63ddc34ad653773abed5a8  pig-v1.6.2.linux-arm64.tar.gz
3d1a80b833c6179b84ac5cc590ad06695b187b2bb4a09f544b1a14f9684dc4bc  pig_1.6.2-1_amd64.deb
00e4c84cd6b07a98401c73fb58dedaafe34bc794d7604edbcb76c5de39b0fb44  pig_1.6.2-1_arm64.deb

Release: https://github.com/pgsty/pig/releases/tag/v1.6.2


v1.6.1

Pig v1.6.1 is a maintenance release. It updates the bundled extension catalog and sets the embedded Pigsty version to 4.5.0. It adds no commands and changes no flags.

Highlights

  • Regenerates the embedded extension.csv from Pigsty package repositories. New installations use current package metadata without first running pig ext reload.
  • Update the embedded Pigsty version reported by pig sty and pig status from 4.4.0 to 4.5.0.
  • Keep 562 packaged extensions across PostgreSQL 14-18, EL 8/9/10, Debian 12/13, and Ubuntu 22/24/26 on x86_64 and aarch64.

Checksums

Artifacts: Pigsty Mirror · checksums.txt

088e62bf7c64dbbe1d66cb54e6a6971e4d245e76ac0b9ab9de2280053b692e77  pig-1.6.1-1.aarch64.rpm
11b81f43754bcd7691752025ff0a95aa39745883d1cc17183e81fd357f50f5d3  pig-1.6.1-1.x86_64.rpm
f0512d26fd934a9ac7b0bf5aba22aba151991a4edcc8e995441f79f66fc6080a  pig-v1.6.1.darwin-amd64.tar.gz
595f122c210b1e5a5211de5b397bfcf2a803179f52a97aa38e68e8c567381533  pig-v1.6.1.darwin-arm64.tar.gz
d6c0ad7784c8df33539d60cb22259bb1b6f92a6fc26543f4384448dd630a83fd  pig-v1.6.1.linux-amd64.tar.gz
017fbae1c32858b5438514685e45959ceaeb6bf29ae11ecf0496b52d00908627  pig-v1.6.1.linux-arm64.tar.gz
571bc16bc8490190935ecb6d8dde9c5827e63eced0b7bbd05cfad1e4363e385b  pig_1.6.1-1_amd64.deb
54010b414aaf3971c435db714d5e1c0e039f30a11adf95a902040e177f911fa6  pig_1.6.1-1_arm64.deb

Release: https://github.com/pgsty/pig/releases/tag/v1.6.1


v1.6.0

Pig v1.6.0 is a major release. pig pt becomes a transparent patronictl launcher. The root-level pig inventory group adds lossless editing and validation of pigsty.yml, plus an experimental PostgreSQL CMDB bridge. pig sty grafana adds native Grafana dashboard management. The packaged extension catalog grows to 562.

Highlights

  • pig pt becomes a native patronictl launcher. All cluster commands (list, restart, switchover, failover, edit-config, …) forward directly with native flags, prompts, output, and exit codes. New patronictl features therefore work without a new pig release. Local helpers status, log, set, and service/svc remain. New options are -c/--config-file, -d/--dcs-url, and -k/--insecure. Use pig pt -- … to pass arguments directly.
  • Adds the root-level pig inventory command group (alias inv): status / list / show / edit / validate / check / diff. Its lossless YAML engine preserves comments, formatting, key order, and anchors byte-for-byte. edit validates before writing, then writes atomically. Invalid YAML cannot reach disk.
  • Adds experimental pig inventory cmdb subcommands: check / init / load / dump / enable / disable. They exchange inventory with the PostgreSQL Pigsty CMDB through a native driver. They use bounded timeouts and confirmation tied to a digest for destructive operations.
  • Adds pig sty grafana (alias gf) for native Grafana dashboard management over HTTP. Its commands are info / list / boot / load / init / dump / clean / lang / style. Removes sty edit / validate / check / cmdb / dashboard / release to simplify pig sty. Use pig inventory, pig sty grafana, and pig sty list / get instead.
  • Reliability improvements: repository, catalog, and download writes are atomic, preventing truncated files after interruption. Structured -o json|yaml output keeps only the result envelope on stdout and sends wrapped-tool output to stderr. More specific exit codes distinguish usage errors (2) from missing --yes confirmation (7). Ansible list variables use JSON encoding.
  • Repository updates: MySQL moves to 8.4 LTS, with new Percona XtraBackup (pxb84) and MySQL Tools repositories. Kubernetes moves to v1.36. LLVM APT coverage extends to Debian/Ubuntu 26. Percona TDE uses repo.percona.com directly. Removes the wiltondb repository.
  • Toolchain: Go 1.26.5, new native PostgreSQL driver (pgx v5), embedded Pigsty version 4.4.0.

Extension Catalog

  • Packaged extensions: 531 -> 562; the broader PGEXT.CLOUD directory contains 2,230 entries.
  • 33 new extensions, including the pg_lake family (pg_lake, pg_lake_table, pg_lake_engine, pg_lake_iceberg, pg_lake_copy), pg_jieba, pg_cjk_parser, pg_fts, pgmonitor, pgmemento, pg_tiktoken_c, online_advisor, pgsqlmock, and plx.
  • 2 removed: pg_analytics, spat; 58 version refreshes, including vector 0.8.5, timescaledb 2.28.3, pg_search 0.24.3, pg_tde 2.2.1, and powa 5.2.0.
  • Aligns package aliases with Pigsty. Renames kafka to kafka-stack. The Debian/Ubuntu postgresql alias maps only to postgresql-$v. For the full development set, use pgsql / pgsql-full.

Compatibility Notes

  • ⚠ pig pt failover <name> now treats the positional argument as the cluster, not the promotion candidate. Use pig pt failover CLUSTER --candidate MEMBER. Review failover automation before upgrading.
  • pig pt uses native cluster-first positional arguments (restart CLUSTER [MEMBER]). Forwarded commands return native patronictl exit codes and manage their own confirmation prompts. -y no longer controls those prompts. They no longer support -o json; use native --format json. pig pt set K=V and native show-config / edit-config replace pig pt config.
  • In structured output mode, wrapped-tool output goes to stderr. Stdout contains only the JSON/YAML envelope. Update scripts that parsed mixed output.
  • pig inventory edit tightens the inventory file mode to 0600 after a successful edit, since the file may contain credentials.

Checksums

6899e8a3e1c0adfe8c0c177c0632b0a00821b304ed5998fcbdf28d02660c6768  pig-1.6.0-1.aarch64.rpm
cabe593fe7f5c31cdbcd8d546ae4925b57f98f70c564452335568389f3f9737c  pig-1.6.0-1.x86_64.rpm
1f46d4a0b4710eed06b2cf8e7e17ee04b8d65331697c5c65afd513cc28282231  pig-v1.6.0.darwin-amd64.tar.gz
845decb95697fc68bc5e12bc80cecfd4c6d23160afee96568b699d82f2e9261d  pig-v1.6.0.darwin-arm64.tar.gz
4f1bb4fda8131db9f40db15e1575a6045b373dee609250cf5ee2bdedc2db89e2  pig-v1.6.0.linux-amd64.tar.gz
4384d11150e31d614ed4ac3de4d6bf7ee7fa111ac84f5575753bb9f2f31f4ed8  pig-v1.6.0.linux-arm64.tar.gz
e35ef0f2c76afe5f3512d34c0440abd8c0106c0e2775c5452e167ae3a4127e8e  pig_1.6.0-1_amd64.deb
c3bc6d04c6acd7e5c3164a33b7525b25a93e2de9822ce957c15c18ee0d551901  pig_1.6.0-1_arm64.deb

Release: https://github.com/pgsty/pig/releases/tag/v1.6.0


v1.5.1

Pig v1.5.1 updates PG kernel forks to the latest package names.

Highlights

  • Adds mirror/proxy mode to repository, build, sty, update, and extension update workflows. pig build rust -m also configures Cargo mirrors through rsproxy.cn.
  • Adds explicit PostgreSQL 19 beta build options: pig build repo --beta, pig build tool --beta, and pig build pgrx -b. PostgreSQL 18 and PG14-18 remain the stable defaults.
  • Refresh kernel and fork package aliases for IvorySQL, PolarDB, OrioleDB, OpenHaloDB, Babelfish, and the pgEdge suite.
  • Improve the Cloudberry package build flow for cloudberry, cloudberry-backup, and cloudberry-pxf.
  • Refresh source/package metadata for Cloudberry, Babelfish, OrioleDB, pgEdge, PolarDB, polarstore, zlog, libpgfeutils, and libfq.
  • Improve repository generation for newer EL release strings, including PGDG on EL9.6+ / EL10+ and EPEL’s EL10 10z stream.
  • Refresh extension versions including pg_ivm 1.15, spock 5.0.10, snowflake 2.5.0, pg_tde 2.2, decoderbufs 3.6.0, and IvorySQL 5.4 packages.

Checksums

bc83887d640ed299a967b4eda2ae6db621a985abfa022fccabf508f7ec7b98e3  pig-1.5.1-1.aarch64.rpm
f0eab8e638d9e00a9172751446db869d0fe6ca7f382c7d540a931e0764014c0a  pig-1.5.1-1.x86_64.rpm
b32d894dc444ef2b9ec00816d50d82b5834e64c35b3bb18f08b6286a7ca8e8e7  pig-v1.5.1.darwin-amd64.tar.gz
4d768829b7e93fac6c732e27f665d3ab3945ec8bc1c336e5b91980932e8c9932  pig-v1.5.1.darwin-arm64.tar.gz
69f4a016af52f1ee8f1a1ffc1e405bb3be551c3813b6d24f70ef8394330be5eb  pig-v1.5.1.linux-amd64.tar.gz
f49becb5fd556b36a9aa8de0c27bdbe210f7958f59254d780774828f2340e77b  pig-v1.5.1.linux-arm64.tar.gz
a0d15145409d8a2629a74d3071f7af593e470920f22d9af4bf6f96725dbb6d49  pig_1.5.1-1_amd64.deb
f05b9b5abef5992ed16cbb5b6a6e3e5e58230072e3665ecc57b9ce2df3edb9a6  pig_1.5.1-1_arm64.deb

Release: https://github.com/pgsty/pig/releases/tag/v1.5.1


v1.5.0

Pig v1.5.0 updates PostgreSQL operations for daily DBA work. It adds local database clone and fork workflows. It clarifies the roles of pg, pt, pb, and pitr. It also improves previews, confirmation, and structured output for high-risk operations.

Highlights

  • pig pg focuses on local PostgreSQL operations. pig pg clone makes quick database-level copies. pig pg fork creates temporary physical instance forks for local validation, recovery drills, and isolated experiments.
  • Recovery commands have clearer roles. pig pitr coordinates Patroni, PostgreSQL, and pgBackRest. pig pb restore remains the low-level pgBackRest restore command. Restore commands require an explicit target. They provide more specific plans and guidance for steps after recovery.
  • Patroni operations use more consistent behavior. High-risk actions such as pig pt restart, reinit, switchover, and failover use Pig-managed confirmation and plan output. When a restart is required, pig pt config pg directs operators to pig pt restart --pending.
  • Structured output no longer confirms destructive commands. High-risk execution requires explicit -y/--yes. --plan and next_actions provide more consistent workflows to preview an operation before execution.
  • Improves logs and status output for incident response. The pg, pb, and pt log commands support common latest / tail / show / grep workflows. Structured log snapshots use JSONL semantics.
  • Build and release defaults were refreshed: Pig is 1.5.0, embedded Pigsty is 4.4.0, and pig build pgrx defaults to cargo-pgrx 0.19.1.

Extension Catalog

  • Available extensions: 524 -> 531, with no removals.
  • New extensions: pg_ducklake, pgdisablelogerror, pg_stat_log, pg_stat_plans, passwordpolicy, db2fce, plpgsql_wrap.
  • Refreshed a batch of existing extension versions and package metadata, including timescaledb 2.28.2, postgis 3.6.4, vector 0.8.4, biscuit 2.4.1, citus 14.1.0, orioledb 1.8, documentdb 0.113, credcheck 5.0, and pgtt 4.5.
  • orioledb aliases no longer pin to PG17. They resolve against the requested PostgreSQL major version. EL9 ARM64 Patroni aliases now select noarch packages.

Compatibility Notes

  • For destructive operations in automation, use -y/--yes. Structured output mode no longer replaces human confirmation.
  • pig pb restore and pig pitr require exactly one explicit recovery target. For automatic promotion, use --target-action=promote.
  • Removed ambiguity in several short options. For log commands, -o json selects a JSONL snapshot. It does not apply to tail/follow streaming modes.

Checksums

9f83b78ed2eccedd55a86c634f88364f1945c3cefa1b23efdd72a7cf2062e1df  pig-1.5.0-1.aarch64.rpm
b792001498e9907d4659db46640f9c5164152b20689f90f93418f76fb4633e6e  pig-1.5.0-1.x86_64.rpm
ae1081dfbff8564ecdf713c85e8025c91bfd38e6575ea9ac99a92f968ab8a29d  pig-v1.5.0.darwin-amd64.tar.gz
6d69efcdcdc79fd90d2112e1e8042887020402aa037252d89d632243e7085dc6  pig-v1.5.0.darwin-arm64.tar.gz
8f914821b317cde73d3aec4ed311d5e90710bbc8cb372c1de3322083c31f4a85  pig-v1.5.0.linux-amd64.tar.gz
d4de9ef1c28d0a3661c4a4d47c469b7bfd5f5bddb610325796afb669ab162234  pig-v1.5.0.linux-arm64.tar.gz
35fd32affb4cb5bcca845d47a768782fb7005f06fcc1bcb5b7755d2627f96245  pig_1.5.0-1_amd64.deb
2be1df804d3f630560bc3ced0107c49ffad8bb52b004f72c7f8b4d09dc8d3e04  pig_1.5.0-1_arm64.deb

Release: https://github.com/pgsty/pig/releases/tag/v1.5.0


v1.4.2

  • Refresh the built-in extension catalog from 510 to 524 available extensions. This adds 14 extensions: pg_stl, pgmnemo, psql_bm25s, pg_orca, pg_sorted_heap, graph, pgrdf, fsm_core, jsonschema, pg_durable, pg_mockable, pg_uuid_v8, pg_stat_backtrace, and pg_projection.
  • Update package metadata for 48 existing extensions, including timescaledb 2.28.0, timescaledb_toolkit 1.23.0, pg_task 2.1.29, pg_search 0.24.0, pg_clickhouse 0.3.2, pg_graphql 1.6.1, documentdb 0.112, toastinfo 1.7, wrappers 0.6.1, and pgclone 4.3.2. No extensions were removed or demoted.
  • Add PostgreSQL 19 beta install/build/config support. PG19 is accepted as an explicit installable major, while PostgreSQL 18 remains the stable default for auto-detection, catalog display, and latest-version aliases.
  • Add pg19 package aliases and PG19 category alias resolution. PG19 category aliases borrow the PostgreSQL 18 visibility template and limit beta package expansion to PGDG-origin entries.
  • pig sty conf -v 19 enables the beta repository module if the template supports it. It warns if the template is not tuned for PG19 beta or cannot enable the beta repository automatically.
  • Fixes Patroni cluster operations by passing the resolved CLUSTER_NAME to patronictl restart, reinit, switchover, and failover. pig pt list also accepts an optional cluster name.
  • Bump the default pgrx version for pig build pgrx from 0.18.0 to 0.18.1.
  • Bump release metadata to v1.4.2, refresh Go module checksums, and add focused tests for PG19 aliases/config generation plus Patroni cluster-scope behavior.

Checksums

790afe4d6622cb041b06c622bc466cb1b2960a77487f368238027fb4a3a5ef93  pig-1.4.2-1.aarch64.rpm
ef918166b38a5eb1d108a928718c9e2cb8c3590e5a1f72effee942faca9b4bea  pig-1.4.2-1.x86_64.rpm
3e37ff22aed076cbdd453911dc89fcc9340b1a4faac62c0580094bc1eb2d6273  pig-v1.4.2.darwin-amd64.tar.gz
5eb7db776cb149331ebb33e3e6164e1cf711d0107941b92c6930a1d4c4b4eb23  pig-v1.4.2.darwin-arm64.tar.gz
c536c324e40a861217e31f4699ee5f0e6c2daeb4e6f0f0e8cc5f606da9d787eb  pig-v1.4.2.linux-amd64.tar.gz
8b2d5746264a95269535e5a426f78fe0020f73fa3391fcb613f274551c4786ab  pig-v1.4.2.linux-arm64.tar.gz
566e06f6da1fe9d635c41258d20cd9ff10de4e6e74b3b41ba2c6204ba22743c8  pig_1.4.2-1_amd64.deb
8c09e741975cb2f74b0f88c5995a8fa43d6c30a9a7ab7aaf0b8d83a7c66e1fc1  pig_1.4.2-1_arm64.deb

Release: https://github.com/pgsty/pig/releases/tag/v1.4.2


v1.4.1

  • 510 extensions, 3 new extensions, 20 updated.
  • Ubuntu 26.04 resolute support, drop support for Ubuntu 20.04 focal.
  • Bump el9.aarch64 ad hoc patroni to 4.1.2.
  • Bump pgEdge to PostgreSQL 18.
  • Calibrate upstream repo definition.

Checksums

cbfbb04b9640dcf39fcd9ccfa49e500dd0e65b72c0326c0d166e6f43e52b6dc3  pig-1.4.1-1.aarch64.rpm
c3325c7c68559b3149567eddd5963c4bc3bb4b39622740ca469f9d5d274e462b  pig-1.4.1-1.x86_64.rpm
c82e8a5e010aed198748576a3740479ac73eaa4a05f50cd4afc82fbcc9075d4d  pig-v1.4.1.darwin-amd64.tar.gz
a62e223a9f3fb6755cfeabfed2b9241d1be8aad42251917ddb2a4757fa5df6bd  pig-v1.4.1.darwin-arm64.tar.gz
65938e1158deb8a795c32ae99ff09178b7dec6b09743f8bdfbd9fd09a522e89f  pig-v1.4.1.linux-amd64.tar.gz
0fe4172dd1f03ac1b6ac73a28cdfe78b70c6613996252a230710b291faf8db58  pig-v1.4.1.linux-arm64.tar.gz
bdcc318ed50bff505f193f3a265d8fd2c7b093a104d5e5728b8c070e3580827e  pig_1.4.1-1_amd64.deb
1a1acb69d41bcfb9df8fb86c8d3c076050df5a242b639c1215833cd6394e112d  pig_1.4.1-1_arm64.deb

Release: https://github.com/pgsty/pig/releases/tag/v1.4.1


v1.4.0

  • Refresh the extension catalog and increase the total available extensions to 510, with version bumps such as timescaledb 2.26.3, decoderbufs 3.5.0, pgclone 4.0.0, and nominatim_fdw 1.3.
  • Bump the default pgrx version from 0.17.0 to 0.18.0 and align related Rust extension builds.
  • Updates authoritative source bundles for pig build get. These include Cloudberry / OrioleDB build inputs and bundled artifacts for RDKit and OneSparse packages.
  • Fix repo set flag isolation and correct schema maintenance SQL.
  • Bump patroni to 4.1.1 for el9.aarch64.

Checksums

c8d2f46ea1b25f7d4665ee0994f0cb403a59f1464f80b3ecfa575ac283e5ecd0  pig-1.4.0-1.aarch64.rpm
fb1fd2f4f1e71894779de7b11a42960c09261620dffa0b54ff7f84e60efbf976  pig-1.4.0-1.x86_64.rpm
aa08045a31c26b9a6bfb770753817581c819022a6ed899e44f7b5a31f57f1733  pig-v1.4.0.darwin-amd64.tar.gz
80e50dd2ccd08d4a4016e85518186e156498e00c56a898e65acb96466db339f0  pig-v1.4.0.darwin-arm64.tar.gz
e425bf35ab6cb7907e94caca802b4418e3baf4bb1642dd957ab4baaa9db9f583  pig-v1.4.0.linux-amd64.tar.gz
840a21695955d64af7df12f7157b49573b18586bb2bf9cc5e7079074b86d39b7  pig-v1.4.0.linux-arm64.tar.gz
401d91bae78b14e3dcc338aaac9e451e94282c79efbe9affabcfeb8b36ece587  pig_1.4.0-1_amd64.deb
d60515f72fb9f8963554dc5668d2398e5ecefd0153a7756a9d555de90115bcce  pig_1.4.0-1_arm64.deb

Release: https://github.com/pgsty/pig/releases/tag/v1.4.0


v1.3.4

Increases total available extensions to 504.

Checksums

dc78def9a1e5eb483ac5df4c87f4ac0ef2018bb12b4bedff650d8ba4d58a05fd  pig-1.3.4-1.aarch64.rpm
998fcbdab1846c94c3155391d2100dad9b0fe338f48212022db38980bb11e696  pig-1.3.4-1.x86_64.rpm
031048c561abbeeeaa73fa3ac919b9fb89479b61c8a759bee5db2efba2e8a1df  pig-v1.3.4.darwin-amd64.tar.gz
e13c939330d32fa91819ce2da88d121fb02a1063240dbf6cc8fa7975960f8fd3  pig-v1.3.4.darwin-arm64.tar.gz
46aa321cf45fc9be635d91b38969b7f3602b7f226f43e5ee0e7614a030945c64  pig-v1.3.4.linux-amd64.tar.gz
f25c4f336edba5c9d2145368082f54e5b1a8b2d4261285b7a1721c088df4caa4  pig-v1.3.4.linux-arm64.tar.gz
563516047e37b25da01da9e25bcbada2c55642d1636b1bdab7d62488f9dcdfbb  pig_1.3.4-1_amd64.deb
81bb482892f7fd4be862d0f377cb37d01c925006c96998d81d94c770ed9652ba  pig_1.3.4-1_arm64.deb

Release: https://github.com/pgsty/pig/releases/tag/v1.3.4


v1.3.3

  • Refresh extension catalog and increase total available extensions to 481.
  • Bump Go toolchain from 1.26.0 to 1.26.2.

Extension Updates

ExtensionOldNewNotes
timescaledb2.25.22.26.2available, PG15-18
pg_background1.81.9.2DEB only, PG14-18
pg_ivm1.131.14upgraded, PG14-18
system_stats3.24.0upgraded, PG14-18
nominatim_fdw1.1.01.2upgraded, PG14-18
pg_textsearch0.5.01.0.0PG17-18
pg_clickhouse0.1.50.1.10available, PG14-18
pg_search0.22.20.22.6manual download, PG15-18
pg_store_plans1.91.10upgraded, PG14-18
pg_dispatch0.1.5new, PG14-18
pg_fsql1.1.0new, PG14-18
pg_liquid0.1.7new, PG14-18
pg_regresql2.0.0new, PG14-18
pg_slug_gen1.0.0new, PG15-18
pg_stat_ch0.3.3new, PG16-18
pg_variables1.2.5new, PG14-18
pgcalendar1.1.0new, PG14-18
pgclone2.2.0new, PG14-18
pgelog1.0.2new, PG14-18
pglock1.0.0new, PG14-18
pgproto0.2.1new, PG14-18
postgresbson2.0.2new, PG14-18
rdf_fdw2.4.0new, PG14-18
parray_gin1.4.0new, PG14-18

Checksums

e74418061ea975fbc3e8a89b31f274d7dc3617d12b9d681e5c8ef03584392088  pig-1.3.3-1.aarch64.rpm
8450e3e1076425fc8a10f24cc5fd833c3d2d880bab12baff5c10e59a31f62231  pig-1.3.3-1.x86_64.rpm
952a0e94b9020fca5add91f8e9a398fbedfda5d2e5c8736e59ddaa2b7152c826  pig-v1.3.3.darwin-amd64.tar.gz
c896b4fd44b19a250f4c3c47dc78643e10e92fde8cb6531b08cdc78e3623bb8a  pig-v1.3.3.darwin-arm64.tar.gz
d18a92f9aa05d6315c5e9bfde3245afc08fca93d200a8063aa20cb40feb8e85e  pig-v1.3.3.linux-amd64.tar.gz
62d020072360229b47f6c430b014344b912f2d9b58fd528154ae9c4ee805190a  pig-v1.3.3.linux-arm64.tar.gz
7a613a1f1c323ee78276b1733df026b8b0f415e0057b4cb8e509f771bfd3d614  pig_1.3.3-1_amd64.deb
f4c91ce86b787b6ab8cd584949d38c2ca87eb82d5e066bab91b80345252f43d8  pig_1.3.3-1_arm64.deb

Release: https://github.com/pgsty/pig/releases/tag/v1.3.3


v1.3.2

Routine maintenance release.

  • Refresh a batch of extension version metadata and catalog entries.
  • Add the pig pg tune subcommand to generate PostgreSQL tuning parameters from hardware resources and workload profiles.
  • Add pdu and pgdog source package aliases for pig build get.
  • Migrate extension catalog URLs from pgext.cloud to pigsty.io/ext.

Checksums

d760f47652ff3e2e4a61eb7b9a68ca68665b2b36c187c52f5eaf50d2f007d8f3  pig-1.3.2-1.aarch64.rpm
c2e02e62497f4c2055a9b448ddb3a24c618fcd488580c28b2b9a0e7cedacef55  pig-1.3.2-1.x86_64.rpm
b8d066ddefa4530946c74c30e7e4acdab6abf8da70a47dcfe2a77719b79e397f  pig-v1.3.2.darwin-amd64.tar.gz
a90e78d879fd720fd2865870c696aed7952558d5ae75591deced3121f2aab1f9  pig-v1.3.2.darwin-arm64.tar.gz
2fe3a9ffbb6383154dfd25ed79420b210828eabf6a96a8af6e8feb9d744b9559  pig-v1.3.2.linux-amd64.tar.gz
522290aaf14f98f0bae83ce75cc76749f2a4e72742eb5c3cba36a1d2fa4d12c2  pig-v1.3.2.linux-arm64.tar.gz
d6c1cf2c52962045f6bbfb2a669058e7f903088526591d6c939e7723f3928d30  pig_1.3.2-1_amd64.deb
4352385c629b26a1837054445a546da89591499848b557699c2fb70fde9377aa  pig_1.3.2-1_arm64.deb

Release: https://github.com/pgsty/pig/releases/tag/v1.3.2


v1.3.1

This is a small maintenance release from v1.3.0 to v1.3.1.

  • PG13 install/build support is removed because PGDG upstream has dropped PG13 archive/distribution.
  • Active supported PostgreSQL major versions are now 14-18.
  • Refresh extension catalog (461 -> 464), including pg_pinyin, pg_eviltransform, and qos.
  • Percona PPG upstream repo is bumped to 18.3.
  • Fix pig build dependency/build sync issues; rsync now uses --keep-dirlinks.
  • In YUM repos, Nginx is split out from infra into its own module index (nginx).

Checksums

196e57c7dd46cdedd90ab75965a766f74aabc3bc23ddc8fb757473647bed7b8f  pig-1.3.1-1.aarch64.rpm
e4bdd52ef635524d5aec95f6a5abd76bd49940584ecbb00bd309a4f9186292ac  pig-1.3.1-1.x86_64.rpm
4f3f9479344c158e1c5edc3003471be6b595c01b7d86104bf676b34f8faadce5  pig-v1.3.1.darwin-amd64.tar.gz
05ae2f550ef5062ab5714518a24bbf52f48079ca6d0190359fae5b8f4cb7f20d  pig-v1.3.1.darwin-arm64.tar.gz
940645497e907e56bfd387a478e580ac930aaa72593cc9d04225a08b37880ec4  pig-v1.3.1.linux-amd64.tar.gz
8b2c204fd6c933a1097cd1cd0ce491b02ba5c0025626a331a199684ceca3ab43  pig-v1.3.1.linux-arm64.tar.gz
1cfc23d147795cc4c1ea9596e6978d79ff1ec34c02850fbb224f7c2844548ea5  pig_1.3.1-1_amd64.deb
e495678ae1c762194a56e8c9969fd2109e7a59830f34a4747039fb978f7820cc  pig_1.3.1-1_arm64.deb

Release: https://github.com/pgsty/pig/releases/tag/v1.3.1


v1.3.0

This engineering update moves from v1.2.0 to v1.3.0. It contains 15 commits across 74 changed files, with +1184 / -236 LOC.

It improves the reliability of the pig build pipeline and extends catalog and alias coverage. Total extensions increase from 451 to 461.

Highlights

  • Build source download improvements (pig build get):
    • Parse multi-source Source fields (whitespace/newline/tab) and deduplicate entries.
    • Add source mappings for agensgraph / agentsgraph.
    • pgedge now downloads both postgresql-17.9.tar.gz and spock-5.0.5.tar.gz.
  • Dependency resolution and install improvements (pig build dep):
    • RPM dependencies can infer the PG major version from pgmajorversion in spec files. Missing spec/control files return explicit errors.
    • DEB dependency parsing now covers Build-Depends / Build-Depends-Arch / Build-Depends-Indep, including multiline fields, alternatives, arch qualifiers, and build-profile cleanup.
    • PGVERSION placeholders can be expanded from --pg, installed PG majors, or extension metadata.
    • Dependency install failures are downgraded to warnings so batch runs continue.
  • DEB build result semantics fixed (pig build ext/pkg):
    • A successful build command exit code determines success. Artifact discovery is best-effort and can only produce warnings.
    • Suppress empty package-list banners on successful no-artifact runs.
    • Partial artifacts are warnings, not failures.
    • Build logs now print real metadata source/version values instead of always composing name-version.
  • Better machine-readable ext operation output (pig ext rm/update):
    • After alias resolution, removed/updated now returns resolved package names instead of extension aliases.
  • Extension catalog and alias updates:
    • New aliases: agensgraph / agens, pgedge, babelfishpg.
    • openhalodb is aligned to PG14 package naming; ivorysqldb naming is aligned.
    • Fork metadata and availability matrix were refreshed in batch (including timescaledb, pgmq, orioledb, documentdb, pg_tde, and babelfishpg_* entries).
  • Engineering and release:
    • Updated the version to v1.3.0, including a v1.2.1 transition commit. Changed the copyright year to 2026. Updated the README for 461 extensions and current alias documentation.

Compatibility Notes

  • Structured removed/updated fields in pig ext rm/update now contain package names. Automation that matched extension aliases should update parsing logic.

New Extensions (451 -> 461)

ExtensionVersionNotes
aux_mysql1.5openHalo MySQL compatibility helper (PG14)
gb18030_20221.0IvorySQL charset conversion module
ivorysql_ora1.0IvorySQL Oracle compatibility extension
ora_btree_gin1.0Oracle datatype GIN indexing support
ora_btree_gist1.0Oracle datatype GiST indexing support
pg_get_functiondef1.0Function definition utility
plisql1.0PL/iSQL procedural language
snowflake2.4pgEdge Snowflake-style ID generator
spock5.0.5pgEdge multi-master logical replication extension
lolor1.2.2pgEdge logical-replication-friendly large objects

Full Commit List (v1.2.0..v1.3.0)

  • b8ecf8d bump version string to 1.2.1
  • 55df9a4 build/get: support multi-source parsing and pgedge spock tarball
  • da8e347 add agensgraph and pgedge alias
  • 86edbd7 ext: show resolved package names in rm/update results
  • ef3c905 build/dep: improve rpm/deb dependency resolution
  • 7144e09 ext/catalog: refresh fork metadata and matrix entries
  • befffbf build(deb): treat successful build command as authoritative result
  • 33fd517 build(deb): avoid empty package list banner on successful no-artifact runs
  • 3b450f2 avoid concat ext pkg name with version when download
  • 33847ab fix(ext): satisfy staticcheck S1011 in rm/update
  • b8b917d build(dep): treat dependency install failures as warnings
  • 8110c00 adjust ivorysqldb babelfishpg alias
  • fac9faf bump version to 1.3.0
  • 1f88f06 chore: update copyright year to 2026
  • c804757 v1.3.0

Checksums

196f32419886da095f303b1bcad2729b674abc03d412199e88a39390b2616534  pig-1.3.0-1.aarch64.rpm
a2dcc930dd47a08e85285c1fb7925e1355a1e67d458a265a7ef6d9666bc8e7ec  pig-1.3.0-1.x86_64.rpm
c7ebda6b9839408b12ffe1c8ea561f03e1793aae0732f9bbe2320a0d45160714  pig-v1.3.0.darwin-amd64.tar.gz
b717b485ed0a4a8c11dd8bf918400595b21df5ef43818836ec332f8518674c1a  pig-v1.3.0.darwin-arm64.tar.gz
40e6570c6ba0fe36c97950ff8de585eecb6bc1f862509a04f410a5f08ee90148  pig-v1.3.0.linux-amd64.tar.gz
d61430eeafc8005a22918a9aa60dea5c987916f9834331b5484f761b8235644f  pig-v1.3.0.linux-arm64.tar.gz
62c9a4fadc7dda393d6f28ab83b5f3d741e7d7f7de7abe40a5b89c393288519c  pig_1.3.0-1_amd64.deb
19261ae50e873a05a10a6ad500ab1b429b22e2612325c09f9cd5443dcd34308b  pig_1.3.0-1_arm64.deb

Release: https://github.com/pgsty/pig/releases/tag/v1.3.0


v1.2.0

  • Extension catalog and alias resolution enhancements:

    • Introduce dynamic PG category alias resolution by PG major version.
    • Adds OS-level alias overrides (ansible/bootstrap). Unknown distributions now fall back only to PGDG.
    • Add aliases such as node/infra and babelfish/cloudberry, and refresh extension metadata to reduce package resolution ambiguity.
  • Plan preview for high-risk operations:

    • Add pig install --plan with structured execution plan output.
    • Align preview semantics for pig pitr and pgBackRest repack/expire under --plan / --dry-run.
    • Add plan-flag consistency tests to keep subcommand behavior aligned.
  • Native sty configuration capability:

    • Add pig sty configure with full execution flow (preflight, argument handling, execution orchestration).
    • Unifies sty conf/configure behavior. The native implementation is the default, and --raw remains as a fallback.
    • Add tests for configure main flow, preflight, routing, and install integration to improve maintainability.
  • Repo/build/reliability fixes:

    • Fix nil dereference in repo cache on os.Stat error paths.
    • Align Ubuntu and Debian repo channel mapping, and add timeout control for mirror pulls during reload.
    • Harden repo rm for dotted module names with safe deletion and path validation.
    • Fix symlink preservation, cross-device migration, and target-directory handling in sty init and build flows.
    • Improve text output and matrix color rendering, and fix ext command validation for empty args/targets.
  • 35 commits, 66 files changed, LOC: +5006 / -379

  • PG extension and kernel package updates

PackageOldNewNotes
timescaledb2.25.02.25.1
citus14.0.0-314.0.0-4Rebuilt from the latest official upstream release
age1.7.01.7.0Add PG 17 support for version 1.7.0
pg_background-1.8DEB-only build; RPM package comes from PGDG
pgmq1.10.01.10.1This extension package is currently unavailable
pg_search0.21.60.21.8Used as direct download package
oriolepg17.1117.16OriolePG kernel update
orioledbbeta12beta14Matched with OriolePG 17.16
cloudberry-2.0.0New package
babelfishpg-5.5.0New BabelfishPG package group
babelfish-5.5.0New Babelfish compatibility package
antlr4-runtime413-4.13New runtime dependency for Babelfish

Checksums

344b77385fa9c3d4fe5e1961340e68716251e38d1cb8308f5af45ce8a03cd206  pig-1.2.0-1.aarch64.rpm
aa9cf1820a9045cc42f0d66689d5e8679cb71452042f3f01ddd4c3a518a2b757  pig-1.2.0-1.x86_64.rpm
f26e4d9e9fa76c39f7c591c18a09287ca3388e016d121c196302ee9eafb5b678  pig-v1.2.0.darwin-amd64.tar.gz
2ca41efc3495822305f6e6a3ae1825d57cc97e764f280581f833c72e6e5019a2  pig-v1.2.0.darwin-arm64.tar.gz
f7aa291b3534d92d0459b6e8301190e39c63db14a45a6c097d4c5d3062c35181  pig-v1.2.0.linux-amd64.tar.gz
38007ecd6d7a69bae0e3d8f7c78f1a4c8bbaead320b7ac319b0d94d6b53853f0  pig-v1.2.0.linux-arm64.tar.gz
e824716ddfbf3805dc0a1fd6d97917241b7780503657e9fd40a37beb6b398d7a  pig_1.2.0-1_amd64.deb
b67baa404d877b37004331041cb270c85b8f9a3f8a92a5083390a54d76553d2a  pig_1.2.0-1_arm64.deb

Release: https://github.com/pgsty/pig/releases/tag/v1.2.0


v1.1.1

Fixes

  • Preserve symlink semantics during build-tree migration and support cross-device moves.
  • Handle a PostgreSQL log directory configured as the filesystem root without resolving files outside the intended directory.
  • Allow pig repo rm to remove repository modules whose names contain dots while retaining safe-path validation.
  • Accept safe relative symlinks when pig sty init extracts a Pigsty release archive.

Checksums

Download asset
FileChecksum
pig-1.1.1-1.aarch64.rpm Linuxarm64SHA-25622fe5e951f09e7cfa46ab22781199b3209792992940eb5615ace4928e41a7429
pig-1.1.1-1.x86_64.rpm Linuxamd64SHA-2567f5a10bbefdc39e5d66a7e688fa78c5ba566c8140458b9f4b1536ff0d7ed457a
pig-v1.1.1.darwin-amd64.tar.gz macOSamd64SHA-256b90aec9dc559df81c46d32575a8d231fa6d7eeb8b25f4d2e0b6076cc0a9c0e59
pig-v1.1.1.darwin-arm64.tar.gz macOSarm64SHA-2563063e3a72e68371a082b4e629d12aafda46d96eddc22976beb2049881854f4ea
pig-v1.1.1.linux-amd64.tar.gz Linuxamd64SHA-256081ff8c81bf61108a35ca4cdc51007d4ddf1de8a041d8be087e58e7068e7e177
pig-v1.1.1.linux-arm64.tar.gz Linuxarm64SHA-2569a81e868699f92d73f8aeb7752206b6eaac8d42d1688089a1f543b12ee0d272d
pig_1.1.1-1_amd64.deb Linuxamd64SHA-25685ce861cfbff846be2ba912ba8dfc766121dad14a59937387d9c5e26b0b6f541
pig_1.1.1-1_arm64.deb Linuxarm64SHA-2563a108f0544af4d1f98acee55c06c5b5af3b856e3be2b18767e6db0b8a1cc664f

Release: https://github.com/pgsty/pig/releases/tag/v1.1.1


v1.1.0

This release upgrades the CLI architecture from v1.0.0 to v1.1.0, with 79 commits across 193 changed files. It extends pig from an interactive CLI to a CLI that agents can orchestrate.

Seven new extensions are added, bringing the total available extensions to 451.

New Features

  • Adds a unified output framework for agents. Global --output supports text/yaml/json/json-pretty. A common Result structure provides stable status codes and machine-readable output for ext/repo/pg/pt/pb/pitr/status/version/context.
  • Adds ANCS (Agent Native Command Schema) metadata, including type/volatility/parallel/risk/confirm/os_user/cost fields. In structured mode, help outputs a command capability tree. Agents can use it to identify capabilities and risks.
  • Adds the pig context (pig ctx) environment snapshot command. One call collects host, PostgreSQL, Patroni, pgBackRest, and extension information for direct use in agent workflows.
  • Extends plan support beyond PITR with pig ext add/rm --plan, pig pg stop/restart --plan, and pig pt switchover/failover --plan. These match pig pitr --plan/--dry-run in a common, reviewable format. Plans show actions, scope, risks, and expected results.
  • Extends structured results with native pgbackrest info JSON. Unifies structured return DTOs across Patroni/PostgreSQL/PITR/Repo/Ext for automation compatibility.
  • Adds legacy structured wrappers for command groups such as pg_exporter/pg_probe/do/sty. These retain existing interaction behavior while providing structured execution results and captured output.
  • Update pigsty to v4.1.0.

Extension Update

ExtensionOldNew
timescaledb2.24.02.25.0
citus14.0.0-214.0.0-3
pg_incremental1.2.01.4.1
pg_bigm1.2-202406061.2-20250903
pg_net0.20.00.20.2
pgmq1.9.01.10.0
pg_textsearch0.4.00.5.0
pljs1.0.41.0.5
sslutils1.4-11.4-2
table_version1.11.01.11.1
supautils3.0.23.1.0
pg_math1.01.1.0
pgsentinel1.3.11.4.0
pg_uri1.201512241.20251029
pgcollection1.1.01.1.1
pg_readonly1.0.31.0.4
timestamp91.4.0-11.4.0-2
pg_uint1281.1.11.2.0
pg_roaringbitmap0.5.51.1.0
plprql18.0.018.0.1
pglinter1.0.11.1.0
pg_jsonschema0.3.30.3.4
pg_anon2.5.13.0.1
vchord1.0.01.1.0
pg_search0.21.40.21.6/0.21.7
pg_graphql1.5.12-11.5.12-2
pg_summarize0.0.1-20.0.1-3
nominatim_fdw-1.1.0
pg_utl_smtp-1.0.0
pg_strict-1.0.2
pg_track_optimizer-0.9.1
pgmb-1.0.0

Bug Fixes

  • Security fix: resolve parsing panic in pig build proxy when receiving malformed proxy addresses.
  • Security fix: resolve path traversal risk in pig pg log, preventing access to files outside the log directory via ../../.
  • Security hardening: improve installer/repo path and quoting handling to reduce path injection and invalid-path misuse risks.
  • Build reliability fixes: pig build get/pkg/ext now propagates errors and returns non-zero exit codes when downloads or builds fail. Fixes false DEB build failures caused by a pg_ver mismatch.
  • Repository/catalog update fixes: adds quiet mirror fallback for ext/repo reload. Commands repo add/set/rm return the correct error status when cache updates fail.
  • Extension management fixes: ext update now uses explicit targets, and status drift issues are fixed. ext import downloads requested DEB resources to the specified repository directory.
  • Output/observability fixes: aligns structured-output exit codes with text mode. Improves permission handling and parsing stability in pg status.

Checksums

95245dc035270df2b02cdd5d19afac57ccf4949a61b07b1b806fffde3a3b780e  pig-1.1.0-1.aarch64.rpm
8b1a26f1b5dd002841a0b31904eea8ce94d1e6c4acde4704a78d9e121e1656f4  pig-1.1.0-1.x86_64.rpm
dbd079510513f1cd0521b0871cc6fe3eed8f7fa26f66c04c682568c43e24c456  pig-v1.1.0.darwin-amd64.tar.gz
3f3ba081b54569a7de4d9a8fce72c02c84d9e1cbeb53173567f970c7291af251  pig-v1.1.0.darwin-arm64.tar.gz
ad61384bf01cbb8346ce869da0bc893203ad316c516fb9420cb748f1519a005e  pig-v1.1.0.linux-amd64.tar.gz
7713632beea1e6ca5c3e2e7172c4adee13a2b1b256755f6c2898b6ca98ee1e00  pig-v1.1.0.linux-arm64.tar.gz
70cfc41b7b0aad48f29e12c22c34afd55b938bf50868ac8ab067b9cb62ccb867  pig_1.1.0-1_amd64.deb
fc5cf16671254f8f3495ff7e80c9d77d06b2328c1a247f90f96cf1e918e0ad0e  pig_1.1.0-1_arm64.deb

Release: https://github.com/pgsty/pig/releases/tag/v1.1.0


v1.0.0

This release adds three command groups: pig pg for PostgreSQL, pig pt for Patroni, and pig pb for pgBackRest. It also adds a coordinated PITR command and improves extension availability displays.

New Commands

  • pig pg - PostgreSQL instance management

    • pg init/start/stop/restart/reload/status - Control and manage PostgreSQL instances
    • pg role/promote - Detect and switch instance role (primary/replica)
    • pg psql/ps/kill - Connection and session management
    • pg vacuum/analyze/freeze/repack - Database maintenance operations
    • pg log - Log viewing (list/tail/cat/less)
  • pig pt - Patroni cluster management

    • pt list/config - View cluster status and configuration
    • pt restart/reload/reinit - Manage cluster members
    • pt switchover/failover - Cluster failover operations
    • pt pause/resume - Control automatic failover
    • pt start/stop/status/log - Patroni service management
  • pig pb - pgBackRest backup management

    • pb info/ls - View backup information
    • pb backup/restore/expire - Backup operations
    • pb create/upgrade/delete - Stanza management
    • pb check/start/stop/log - Control operations
  • pig pitr - Orchestrated Point-In-Time Recovery

    • Automatic Patroni/PostgreSQL coordination
    • Multiple recovery targets: time, LSN, XID, restore point
    • Dry-run mode and post-recovery guidance

New Features

  • Add availability matrix to pig ext avail and pig ext ls

Improvements

  • Unified command aliases across pg/pt/pb commands
  • Standardized error message format
  • Code refactoring and cleanup

Bug Fixes

  • Fix missing UTIL extension category

Checksums

306637079e942bcac9ccbc089cd09a80051898f8db1630269bb1acd3fbdaa872  pig-1.0.0-1.aarch64.rpm
d2b9440410f00efbca174d63b507c39d97fc55f402d8e9290ee054c1b1c6414c  pig-1.0.0-1.x86_64.rpm
c8a169e48a8168ee03db508ca2edc22b56ecf6997bae924e9023796ab7ae4e62  pig-v1.0.0.darwin-amd64.tar.gz
c0996037bfeffeae241b545e69d46c06e7fec2d7d456885229f3af9a7f9ea2f8  pig-v1.0.0.darwin-arm64.tar.gz
13837c6f2379edf965888bad9e373e69f70cb72e8428bca18c2c804e2bd879f6  pig-v1.0.0.linux-amd64.tar.gz
08207dfedd6f72745631596a3d3293de65cc12e1544956a643d1da2165d2c876  pig-v1.0.0.linux-arm64.tar.gz
a543882aa905713a0c50088d4e848951b6957a37a1594d7e9f3fe46453d5ce66  pig_1.0.0-1_amd64.deb
4cd6ec54261b09025c12e9c56bcc0cd3c11779ea0e8becdbd4f901cf2e7c8995  pig_1.0.0-1_arm64.deb

Release: https://github.com/pgsty/pig/releases/tag/v1.0.0


v0.9.0

Changes

  • Rename pig sty install to pig sty deploy so the command name reflects that it runs the Pigsty deployment playbook.
  • Add the -g, -p, and -o options to pig sty conf, aligning it with the configure script available in this release.
  • Keep llvmjit in the pgsql-full package alias.

Checksums

Download asset
FileChecksum
pig-0.9.0-1.aarch64.rpm Linuxarm64SHA-256ea0c098d0829720b6e364d2f2a91328876962c7f0ae94eee7bdcde0bd43313fa
pig-0.9.0-1.x86_64.rpm Linuxamd64SHA-256707f4e1fde76d3faa05165ac11e97969c22a8740c97ef84da52727d0328990cc
pig-v0.9.0.darwin-amd64.tar.gz macOSamd64SHA-25656aeb61674ddfb64368e6f5535e06a38b76f62e3d6c9536a63be7df6babed93e
pig-v0.9.0.darwin-arm64.tar.gz macOSarm64SHA-256a213d16817d6124ffa83d93ad880a040598b6ed3fe23a74d43420c095ed43de4
pig-v0.9.0.linux-amd64.tar.gz Linuxamd64SHA-2566a1a1836217fa723ca42bc2276ecf1453cd2ee0acacddfc313164701b24a452f
pig-v0.9.0.linux-arm64.tar.gz Linuxarm64SHA-2565e5728aa5922138c61c900a731f97cdc1b9653c14d7fe804b6753fb6f222b8b0
pig_0.9.0-1_amd64.deb Linuxamd64SHA-256e80d2cb3ceb5fd58fc0262ab4b39b44e8dcccb7712151c73a41ba50cb510353b
pig_0.9.0-1_arm64.deb Linuxarm64SHA-256ecb504efffde8d696b765579332fc0b3304751fa8077c4c0394e7f3c44aa0fe2

Release: https://github.com/pgsty/pig/releases/tag/v0.9.0


v0.8.1

Fix

  • Restore llvmjit to the pgsql-full package alias after it was removed in v0.8.0.

Checksums

Download asset
FileChecksum
pig-0.8.1-1.aarch64.rpm Linuxarm64SHA-256fd9291b15953e8e5f579de7e0256b88ca742e11fc0ed578bf181d2ce4cf5258c
pig-0.8.1-1.x86_64.rpm Linuxamd64SHA-256c2ec07d18eeae6ad831950da44d6bb797fad3ca4d0b1f7b0e82d715a22baedec
pig-v0.8.1.darwin-amd64.tar.gz macOSamd64SHA-256b07017d257089166377fb4deffe167c952ae1dcacb6203de26a11a89097dfc34
pig-v0.8.1.darwin-arm64.tar.gz macOSarm64SHA-256090889ba1447693e3ace0b18222f6852448738fc4baa4964a27acc87ce560501
pig-v0.8.1.linux-amd64.tar.gz Linuxamd64SHA-25664cfd28d98c41776c83949b2ffb3b789c66835ccb522a346ea1b53966e9f9544
pig-v0.8.1.linux-arm64.tar.gz Linuxarm64SHA-2566216612ab63c2c9006466834222bdbdcd9e7e8e112c52a6f17e26d0ebb24fbe4
pig_0.8.1-1_amd64.deb Linuxamd64SHA-25629a2109af6141fa990144f0ebcf3bbbe13030c75af6fb3c6bf89eb8da956d387
pig_0.8.1-1_arm64.deb Linuxarm64SHA-2567d8728658c942e57df259acd1da0d2655d9132ab7bffcc109527ed184784f882

Release: https://github.com/pgsty/pig/releases/tag/v0.8.1


v0.8.0

Extension Updates

  • Total extensions reached 440
  • New extension: pg_ai_query 0.1.1
  • New extension: pg_textsearch 0.1.0
  • New extension: pg_clickhouse 0.1.0
  • pg_biscuit upgraded from 1.0 to 2.0.1 (switched to new repo, renamed to biscuit)
  • pg_search upgraded from 0.20.3 to 0.20.5
  • pg_duckdb upgraded to official release 1.1.1
  • vchord_bm25 upgraded from 0.2.2 to 0.3.0
  • pg_semver upgraded from 0.40.0 to 0.41.0
  • pg_timeseries upgraded from 0.1.7 to 0.1.8
  • Fixed debian/ubuntu pg18 extension issues: supautils, pg_summarize, pg_vectorize, pg_tiktoken, pg_tzf, pglite_fusion, pgsmcrypto, pgx_ulid, plprql
  • Pigsty version synced to 4.0.0

Repository Updates

  • Removed pgdg yum sysupdate repo due to upstream changes
  • Removed pgdg yum llvmjit package due to upstream changes
  • Fixed patroni 3.0.4 duplicate package issue on el9.aarch64
  • Added priorities for EL repository definitions. Skips the Docker repository when it is unavailable.
  • Added epel 10 / pgdg 9/10 OS minor version hotfix

Checksums

e457832fb290e2f9975bf719966dc36e650bdcbf8505d319c9e0431f4c03bc9e  pig-0.8.0-1.aarch64.rpm
c97b1bfdd7541f0f464cab0ecc273e65535c8dd2603c38d5cf8dccbf7e95b523  pig-0.8.0-1.x86_64.rpm
d892f06d3d3b440671529f40e6cc7949686e0167e2a4758adc666b8a3d75254d  pig-v0.8.0.darwin-amd64.tar.gz
222413bafdf5a62dc682dac32ea1118cbc34ec3544e2a1b85076ec450b9cc7ae  pig-v0.8.0.darwin-arm64.tar.gz
d50aa9806bbab8fee5ad9228e104fc9e7ead48729228116b5bf889000791fedc  pig-v0.8.0.linux-amd64.tar.gz
d2f410f7b243a8323c8d479f462a0267ac72d217aa4a506c80b5a9927d12dff8  pig-v0.8.0.linux-arm64.tar.gz
4ccd330a995911d4f732e8c9d62aa0db479c21c9596f64c4bc129ec43f156abe  pig_0.8.0-1_amd64.deb
5cb9eccce659110f3ba58e502575564bd6befffd51992a43d84df5a17f8eb8a0  pig_0.8.0-1_arm64.deb

Release: https://github.com/pgsty/pig/releases/tag/v0.8.0


v0.7.5

Extension Updates

  • timescaledb 2.23.1 -> 2.24.0
  • pg_search 0.20.0 -> 0.20.3
  • convert 0.0.4 -> 0.0.5
  • pglinter 1.0.0 -> 1.0.1
  • pgdd 0.6.0 -> 0.6.1
  • pg_session_jwt 0.3.3 -> 0.4.0
  • pg_anon 2.4.1 -> 2.5.1
  • pg_enigma 0.4.0 -> 0.5.0
  • wrappers 0.5.6 -> 0.5.7
  • pg_vectorize 0.25.0 -> 0.26.0

Repository Updates

Uses the corrected Aliyun PGDG mirror repository.

Checksums

9de11ac1404fc4100074113f2a5d50e4ec42c353b6e122a0b29edc17e53feca6  pig-0.7.5-1.aarch64.rpm
071d655580f1cc63b33d41a8fb49368556b7b5a276318f4bd772a6ab50e22b34  pig-0.7.5-1.x86_64.rpm
befe0a8f786e5243669ed7219acde8156d13d9adb0a5c2fb88ccf0f614a51f9b  pig-v0.7.5.darwin-amd64.tar.gz
4766b4e9ba390a32a7115e9f2dd6b65cf158439e28f9c099bab5c7f2e588bae2  pig-v0.7.5.darwin-arm64.tar.gz
dc45726c5e7fccd502cacaffc94c659570844151cdc279f2cac6500836071ade  pig-v0.7.5.linux-amd64.tar.gz
1483cf967d4bc9c12d4c6724567644d6b88fcd2a93aaf1d317fc6ad4e1672c13  pig-v0.7.5.linux-arm64.tar.gz
0152b7bd254eccadd640e563845abd9fa62efa68f11c6b67a5f9f0eebfa2d92e  pig_0.7.5-1_amd64.deb
7d22116d26ca09c5e2b8afbf086bb1acb1aea1148905efcc38944c18908fb105  pig_0.7.5-1_arm64.deb

Release: https://github.com/pgsty/pig/releases/tag/v0.7.5


v0.7.4

  • Update extension metadata: pg_search, pgmq, pg_stat_monitor
  • Updates the PGDG repository URL. The extras directory moves to the parent directory.
  • Bump ivorysql to 5.0 (compatible with PG 18.0)
  • Bump Percona Postgres TDE Kernel to 18.1

Checksums

5769b0051f04dcda22dd92b30b8effc8ddfa40097308bded76ce2b38d012ce57  pig-0.7.4-1.aarch64.rpm
d15c829fa2e3ce8dcd1adc063c107607b8e70f2cf747646aaa2fa257cdbf979c  pig-0.7.4-1.x86_64.rpm
bb4c90e253a3d470e50316e633a41e90ed2d4a5c5a1fd3a8dbb68ee87d831d47  pig-v0.7.4.darwin-amd64.tar.gz
faaf7ac7b08390f5048c081bb7a78100714387e35dc890e26d9746fc1caef415  pig-v0.7.4.darwin-arm64.tar.gz
037cacddd0dc1283f13dd2c9bace87ad7f2c74ffc245e629f1420be94bbf93df  pig-v0.7.4.linux-amd64.tar.gz
2ce819b2c3686cfb9f86790fdf61acd30bf7798bd6cd3c4f589df22e273dc867  pig-v0.7.4.linux-arm64.tar.gz
97f62d62f1cca61ce6d335efed88e3855d94ea2cd4ed941f2755fbac73931fcd  pig_0.7.4-1_amd64.deb
d2b80af89ed42601716f6b41eda3f8bee16db34023527df9deef8a43aa25a498  pig_0.7.4-1_arm64.deb

Release: https://github.com/pgsty/pig/releases/tag/v0.7.4


v0.7.3

  • Add new command: pig repo reload to update repo metadata
  • Fixes the EL PGDG sysupdate aarch64 repository. The aarch64 repository is now ready.
  • Fix EL10.aarch64 PGDG repo renaming issue
  • Update extension versions
  • Bump Pigsty version to 3.7.0

Checksums

83e1b491b58793859caaccb0600a8ad7f7c0ea71dfcbc1dc348bf4666f7dc742  pig-0.7.3-1.aarch64.rpm
00671775c22918b6e92c8f39972fa2e6e78536ba0ca1e23f9bb9752a2910a974  pig-0.7.3-1.x86_64.rpm
d6ac6164a09a7b2aac210b898c8729df6cbcef6462207a896caf08b1511c9cdb  pig-v0.7.3.darwin-amd64.tar.gz
c595df851cc76b93fe2692e880909aed316db00cfdcd75c0c5667141915e49b7  pig-v0.7.3.darwin-arm64.tar.gz
baa875895623f073204d0ff8fbcb76bd37da6e5806e70aae43aaa2cb14355186  pig-v0.7.3.linux-amd64.tar.gz
b6d75f7e0474341990e2cf64b5006fb7b145839f8b54c12f70657c166bfeeb14  pig-v0.7.3.linux-arm64.tar.gz
5ddfd410c6d6c2546804bf948aab3b7978fa719d92c1477d7a33889e7b1006dd  pig_0.7.3-1_amd64.deb
2996c06fda272e01fea72bb8eec51dca8f4b9e8526d9833dcda1cf7549d1e01a  pig_0.7.3-1_arm64.deb

Release: https://github.com/pgsty/pig/releases/tag/v0.7.3


v0.7.2

  • Extension list update, + 6 new extensions, 437 total

  • Add PGDG EL10 Sysupdate repo

  • Add LLVM APT repo

  • Use local extension.csv catalog in pig build sub command

  • Updated extensions: vchord pg_later pgvectorscale pglite_fusion pgx_ulid pg_search citus timescaledb pg_profile pg_stat_monitor documentdb

  • New extensions: pglinter pg_typeid pg_enigma pg_retry pg_biscuit pg_weighted_statistics

Checksums

080dd93c33faf81e8f9d3b9d543b9949604b834ccd55331cce697df79049a9af  pig-0.7.2-1.aarch64.rpm
b91056230d3a790ab0190b3680fc5dbc3eb1306b7a1c2416fb6ef421bf48dcf7  pig-0.7.2-1.x86_64.rpm
9b294e58b8c3629066b905e25dda4f51eacc1eb4b6d5d87fab32d17fb13a9cb7  pig-v0.7.2.darwin-amd64.tar.gz
74f3276752d826c8130ca22a791da48548608378a453908e7cdd095c0564a1eb  pig-v0.7.2.darwin-arm64.tar.gz
0c9f6e6bf930e70206df2c6d58d1296f1a7a77ca7d89d27d47112bc44544cda4  pig-v0.7.2.linux-amd64.tar.gz
f62842217be958569ca09051e8cad0d674ee9446245e45655b91f9918927b340  pig-v0.7.2.linux-arm64.tar.gz
091d12d5d5c3c8e52b8b60ab180b88b7aeaff512aa344af0e039c7d4b73c75a0  pig_0.7.2-1_amd64.deb
53346bd96538a20b0bb3bb4161ba117bca7b5cf6633f5d3c357fe9e560b06ff5  pig_0.7.2-1_arm64.deb

Release: https://github.com/pgsty/pig/releases/tag/v0.7.2


v0.7.1

  • New PGEXT.CLOUD extension catalog.
  • Removes unnecessary sudo calls. Pig can now run inside Docker.
  • Allow using pg18, pg17 arg format in pig ext link command
  • Adds the environment variable PIG_NO_SUDO to prevent sudo use.
  • RPM Changelog: Add PG 18 support to almost all extensions
  • DEB Changelog: Add PG 18 support to almost all extensions
  • Infra Changelog: Routine update to the latest version

Checksums

a696c9ec784e2fc248e5f3d87cc8aae4116e890f78c5997957d30593f2c85ca6  pig-0.7.1-1.aarch64.rpm
f669538a99cd1dc592d3005b949628fcceb9e78114fc78862d7726b340ee194d  pig-0.7.1-1.x86_64.rpm
e42bdaaf93b720c5b76b32b57362320e4b447109740c76089aefe030b7c8b836  pig-v0.7.1.darwin-amd64.tar.gz
b4c240aadad34e785666ee0a755d9b7455724f790c2d088a1dd7c37ad3b2a457  pig-v0.7.1.darwin-arm64.tar.gz
ffc687add0ca71ac90cba5749c8a7a6075cf7618cba85584072831cf3eb182f7  pig-v0.7.1.linux-amd64.tar.gz
7b0d1f158150d0a40c525692f02b6bce9f5b4ac523a4e59278d702c334e222e1  pig-v0.7.1.linux-arm64.tar.gz
43e91a3bea273d7cacb2d7a58c0a5745501dbd06348b5cb3af971171fae70268  pig_0.7.1-1_amd64.deb
fc2a34aeb46e07cb0ae93611de47d6622c3bd46fe4c415ce4c9091840e0e08a2  pig_0.7.1-1_arm64.deb

Release: https://github.com/pgsty/pig/releases/tag/v0.7.1


v0.7.0

  • Add support for Debian 13 and EL 10 distributions
  • Updates many extensions to their latest versions with PostgreSQL 18 support.
  • Almost all Rust extensions now support PG 18 via pgrx 0.16.1
  • pig build command overhaul
    • pig build pkg <pkg> downloads source, prepares dependencies, and builds in one operation.
    • pig build pgrx is now separated from pig build rust
    • pig build pgrx [-v pgrx_version] can now use existing PG installation directly
    • pig build dep will now handle extension dependencies on both EL and Debian systems
    • pig build ext has more compact output. It can build RPM packages on EL without a build script.
    • pig build spec now supports downloading spec files directly from Pigsty repo
    • pig build repo / pig repo add / pig repo set now use node,pgsql,infra as default repo modules instead of node,pgdg,pigsty
  • Optimized error logging
  • Adds a catalog website based on Hugo and Hextra.

Checksums

ad60f9abcde954769e46eb23de61965e  pig_0.7.0-1_amd64.deb
aa15d7088d561528e38b2778fe8f7cf9  pig_0.7.0-1_arm64.deb
05549fe01008e04f8d5a59d4f2a5f0b8  pig-0.7.0-1.aarch64.rpm
0cc9e46c7c72d43c127a6ad115873b67  pig-0.7.0-1.x86_64.rpm
ddacfb052f3f3e5567a02e92fdb31cdd  pig-v0.7.0.darwin-amd64.tar.gz
17d25b565308d3d35513e4b0d824946b  pig-v0.7.0.darwin-arm64.tar.gz
ee7e055ceff638039956765fb747f80b  pig-v0.7.0.linux-amd64.tar.gz
284e674807b87447d4b33691fd7a420d  pig-v0.7.0.linux-arm64.tar.gz

Release: https://github.com/pgsty/pig/releases/tag/v0.7.0


v0.6.2

  • Use official PG 18 repo instead of testing repo
  • Add v prefix when specifying pigsty version string
  • Improved network connectivity check

Checksums

01f5b7dc20644226c762dbb229768347  pig_0.6.2-1_amd64.deb
ce4f00256adc12cbea91467b7f2241cd  pig_0.6.2-1_arm64.deb
cefc36ae8f348aede533b30836fba720  pig-0.6.2-1.aarch64.rpm
d04a287c6eb92b11ecbf99542c2db602  pig-0.6.2-1.x86_64.rpm
e637ca86a7f38866c67686b060223d9a  pig-v0.6.2.darwin-amd64.tar.gz
79749bc69c683586bd8d761bdf6af98e  pig-v0.6.2.darwin-arm64.tar.gz
ad4f02993c7d7d8eec142f0224551bb4  pig-v0.6.2.linux-amd64.tar.gz
9793affa4a0cb60e9753e65b7cba3dca  pig-v0.6.2.linux-arm64.tar.gz

Release: https://github.com/pgsty/pig/releases/tag/v0.6.2


v0.6.1

  • Add el10 and debian 13 trixie support stub
  • Dedicated PIG documentation website.
  • Rebuild with go 1.25 and CI/CD pipeline
  • Use PIGSTY PGDG mirror in mainland China
  • Remove unused pgdg-el10fix repo
  • Use Pigsty WiltonDB mirror
  • Add EL 10 dedicated epel repo
  • Version output includes the Go build environment.

Release: https://github.com/pgsty/pig/releases/tag/v0.6.1


v0.6.0

  • New extension catalog: https://ext.pgsty.com
  • New subcommand: pig install to simplify pig ext install
  • Add new kernel support: percona with pg_tde
  • Add new package: Google GenAI MCP toolbox for databases
  • Add new repo: percona repo and clickhouse repo
  • Change extension summary info links to https://ext.pgsty.com
  • Fixes OrioleDB on Debian/Ubuntu.
  • Fix epel repo on EL distributions
  • Bump golang to 1.24.5
  • Bump pigsty to v3.6.0

Checksums

1804766d235b9267701a08f95903bc3b  pig_0.6.0-1_amd64.deb
35f4efa35c1eaecdd12aa680d29eadcb  pig_0.6.0-1_arm64.deb
b523b54d9f2d7dcc5999bcc6bd046b1d  pig-0.6.0-1.aarch64.rpm
9434d9dca7fd9725ea574c5fae1a7f52  pig-0.6.0-1.x86_64.rpm
f635c12d9ad46a779aa7174552977d11  pig-v0.6.0.linux-amd64.tar.gz
165af4e63ec0031d303fe8b6c35c5732  pig-v0.6.0.linux-arm64.tar.gz

Release: https://github.com/pgsty/pig/releases/tag/v0.6.0


v0.5.0

  • Update the extension list to 422
  • New extension: pgactive from AWS
  • Bump timescaledb to 2.20.3
  • Bump citus to 13.1.0
  • Bump vchord to 0.4.3
  • Fixes pgvectorscale failures on Debian/Ubuntu with PG17.
  • Bump kubernetes repo to 1.33
  • Bump default pigsty version to 3.5.0

Checksums

9ec6f3caf3edbe867caab5de0e0ccb33  pig_0.5.0-1_amd64.deb
4fbb0a42cd8a88bce50b3c9d85745d77  pig_0.5.0-1_arm64.deb
9cf8208396b068cab438f72c90d39efe  pig-0.5.0-1.aarch64.rpm
d9a8d78c30f45e098b29c3d16471aa8d  pig-0.5.0-1.x86_64.rpm
761df804ff7b83965c41492700717674  pig-v0.5.0.linux-amd64.tar.gz
5d1830069d98030728f08835f883ea39  pig-v0.5.0.linux-arm64.tar.gz

Release: https://github.com/pgsty/pig/releases/tag/v0.5.0


v0.4.2

  • Update the extension list to 421
  • Add openhalo/orioledb support for Debian / Ubuntu
  • pgdd 0.6.0 (pgrx 0.14.1)
  • convert 0.0.4 (pgrx 0.14.1)
  • pg_idkit 0.3.0 (pgrx 0.14.1)
  • pg_tokenizer.rs 0.1.0 (pgrx 0.13.1)
  • pg_render 0.1.2 (pgrx 0.12.8)
  • pgx_ulid 0.2.0 (pgrx 0.12.7)
  • pg_ivm 1.11.0 for debian/ubuntu
  • orioledb 1.4.0 beta11
  • Add el7 repo back

Checksums

bbf83fa3e3ec9a4dca82eeed921ae90a  pig_0.4.2-1_amd64.deb
e45753335faf80a70d4f2ef1d3100d72  pig_0.4.2-1_arm64.deb
966d60bbc2025ba9cc53393011605f9f  pig-0.4.2-1.aarch64.rpm
1f31f54da144f10039fa026b7b6e75ad  pig-0.4.2-1.x86_64.rpm
1eec26c4e69b40921e209bcaa4fe257a  pig-v0.4.2.linux-amd64.tar.gz
768d43441917a3625c462ce9f2b9d4ef  pig-v0.4.2.linux-arm64.tar.gz

Release: https://github.com/pgsty/pig/releases/tag/v0.4.2


v0.4.1

  • Update the extension list to 414
  • Add citus_wal2json and citus_pgoutput to pig ext scan mapping
  • Add PG 18 beta repo
  • Add PG 18 package alias

Release: https://github.com/pgsty/pig/releases/tag/v0.4.1


v0.4.0

  • Updates the extension list to 407 available extensions.
  • Added pig do subcommand for executing Pigsty playbook tasks
  • Added pig pt subcommand for wrapping Patroni command-line tools
  • Added extension aliases: openhalo and orioledb
  • Added gitlab-ce / gitlab-ee repository distinction
  • Built with the latest Go 1.24.2 and upgraded dependency versions
  • Fixed pig ext status panic issue under specific conditions
  • Fixes pig ext scan matching for several extensions.

Release: https://github.com/pgsty/pig/releases/tag/v0.4.0


v0.3.4

curl https://repo.pigsty.io/pig | bash -s 0.3.4
  • Routine extension metadata update
  • Uses the Aliyun EPEL mirror to replace the broken Tsinghua TUNA mirror.
  • Bump pigsty version string
  • Add gitlab repo to the repo list

Release: https://github.com/pgsty/pig/releases/tag/v0.3.4


v0.3.3

  • Add pig build dep command to install extension build dependencies
  • Update default repo list
  • Use pigsty.io mirror for mssql module (wiltondb/babelfish)
  • Merge docker module into infra
  • Remove pg16/17 from el7 target
  • Allow installing extensions in el7
  • Update package alias

Release: https://github.com/pgsty/pig/releases/tag/v0.3.3


v0.3.2

Enhancement

  • New extensions
  • Use upx to reduce binary size
  • Remove embedded pigsty to reduce binary size

Release: https://github.com/pgsty/pig/releases/tag/v0.3.2


v0.3.1

Routine bugfix

  • Fix repo format string
  • Fix ext info links
  • Update pg_mooncake metadata

Release: https://github.com/pgsty/pig/releases/tag/v0.3.1


v0.3.0

This release introduced a PIG homepage alongside the PostgreSQL extension catalog.

Release: https://github.com/pgsty/pig/releases/tag/v0.3.0


v0.2.2

404 Extensions Available in Pig v0.2.2

Release: https://github.com/pgsty/pig/releases/tag/v0.2.2


v0.2.0

New extensions

Extension updates

  • citus 13.0.0 -> 13.0.1
  • pg_mooncake 0.1.0 -> 0.1.1
  • timescaledb 2.17.2 -> 2.18.1
  • supautils 2.5.0 -> 2.6.0
  • VectorChord 0.1.0 -> 0.2.0
  • pg_bulkload 3.1.22 (+pg17)
  • pg_store_plan 1.8 (+pg17)
  • pg_search 0.14 -> 0.15.1
  • pg_analytics 0.3.0 -> 0.3.2
  • pgroonga 3.2.5 -> 4.0.0
  • zhparser 2.2 -> 2.3
  • pg_vectorize 0.20.0 -> 0.21.1

Release: https://github.com/pgsty/pig/releases/tag/v0.2.0


v0.1.4

New extensions

Extension updates

  • citus 13.0.0 -> 13.0.1
  • pg_mooncake 0.1.0 -> 0.1.1
  • timescaledb 2.17.2 -> 2.18.1
  • supautils 2.5.0 -> 2.6.0
  • VectorChord 0.1.0 -> 0.2.0
  • pg_bulkload 3.1.22 (+pg17)
  • pg_store_plan 1.8 (+pg17)
  • pg_search 0.14 -> 0.15.1
  • pg_analytics 0.3.0 -> 0.3.2
  • pgroonga 3.2.5 -> 4.0.0
  • zhparser 2.2 -> 2.3
  • pg_vectorize 0.20.0 -> 0.21.1

Release: https://github.com/pgsty/pig/releases/tag/v0.1.4


v0.1.3

Version v0.1.3 is a routine update with 390 available extensions.

Release: https://github.com/pgsty/pig/releases/tag/v0.1.3


v0.1.2

Includes 351 PostgreSQL extensions, including postgresql-anonymizer 2.0.

Release: https://github.com/pgsty/pig/releases/tag/v0.1.2


v0.1.1

Update Extension List

Release: https://github.com/pgsty/pig/releases/tag/v0.1.1


v0.1.0

pig CLI v0.1 released

Release: https://github.com/pgsty/pig/releases/tag/v0.1.0


v0.0.1

Genesis Release

Release: https://github.com/pgsty/pig/releases/tag/v0.0.1

5 - pig

pig CLI command reference overview

pig manages PostgreSQL packages, local database services, and Pigsty deployments. Choose a command below for your task. Use pig COMMAND --help to see the options supported by your installed program.

  • pig repo: manage software repositories
  • pig ext: manage PostgreSQL extensions
  • pig build: build extensions from source
  • pig install: install packages with the native package manager and translate PostgreSQL aliases
  • pig sty: manage Pigsty installation and Grafana dashboards
  • pig inventory: inspect, edit, validate, and exchange the Pigsty inventory
  • pig do: run Pigsty administration playbook tasks
  • pig pe: access pg_exporter metrics and configuration
  • pig pg: manage local PostgreSQL servers
  • pig pt: run patronictl transparently with service and config helpers
  • pig pb: manage pgBackRest backup and restore
  • pig pitr: run the full PITR workflow
  • pig context: output an environment context snapshot for humans and agents
  • pig license: issue and verify Pigsty licenses
  • pig status / update / version: inspect environment status, upgrade pig, and print version information

Global options

OptionPurpose
-h, --helpShow help
-H, --home PATHSelect the Pigsty installation directory
-i, --inventory PATHSelect the inventory
-o, --output FORMATOutput format: text (default), json, yaml, or json-pretty
--debugEnable debug logging
--log-level LEVELLog level: debug, info (default), warn, error, fatal, or panic
--log-path PATHWrite logs to a file; the default is the terminal

PIG-owned results support structured output. Raw-content commands such as inventory show and passthrough commands such as pt list retain their native output. See the command reference for details.

Structured results keep diagnostics and wrapped-tool chatter on stderr. JSON/YAML output and PIG_NON_INTERACTIVE=1 disable prompt input in PIG-owned command adapters and use sudo -n; they do not supply destructive-operation confirmation. Pass --yes where required. Documented data input, such as pig pg psql -f -, remains available. Native Patronictl forwarding retains its own interaction and output contract and rejects PIG structured-output modes.

pig repo list
pig ext list vector -o json
pig help inventory edit

pig repo

Manage APT/YUM repositories for PostgreSQL packages. See pig repo for details.

pig repo list                    # list available repositories
pig repo info   pgdg             # show repository details
pig repo status                  # check current repository status
pig repo add    pgdg pigsty -u   # add repositories
pig repo rm     old-repo         # remove repository
pig repo update                  # update package cache
pig repo create /www/pigsty      # create local repository
pig repo cache                   # create offline package
pig repo boot                    # bootstrap from offline package

pig ext

Manage PostgreSQL extensions and kernel packages. See pig ext for details.

pig ext list    duck             # search extensions
pig ext info    pg_duckdb        # extension details
pig ext status                   # show installed extensions
pig ext add     pg_duckdb -y     # install extension
pig ext rm      old_extension    # remove extension
pig ext update  pg_duckdb        # update the named extension package
pig ext scan                     # scan installed extensions
pig ext import  pg_duckdb        # download for offline use
pig ext link    17               # link PG version into PATH
pig ext reload                   # refresh extension catalog

pig build

Build PostgreSQL extensions from source. See pig build for details.

# Environment setup
pig build spec                   # initialize build specs
pig build repo                   # configure repositories
pig build repo --beta            # configure repositories and add PostgreSQL 19 beta repo
pig build tool                   # install build tools
pig build tool --beta            # install build tools plus PG19 beta build packages
pig build rust -y                # force reinstall Rust (default does not reinstall)
pig build rust -m                # use China mirror mode and write Cargo mirror config
pig build pgrx                   # install PGRX framework
pig build pgrx -b                # include PostgreSQL 19 beta pg_config during auto-detection
pig build proxy                  # install or verify Xray
pig build proxy client --from ./client.uri
pig build proxy server --host proxy.example.com --target www.sraoss.co.jp:443 --export ./client.uri

# Build extensions
pig build pkg citus              # complete build pipeline = get + dep + ext
pig build get citus              # download source
pig build dep citus              # install dependencies
pig build ext citus              # build package

pig install

Install packages through the system’s native package manager and translate PostgreSQL kernel, extension, and common aliases into package names. Use -n/--no-translation when you need to pass raw system package names directly.

pig install pg_duckdb            # install extension and translate package name
pig install pg18                 # install PostgreSQL 18 kernel package group
pig install nginx htop vim       # install multiple system packages
pig install unknown-package -n   # disable translation and use raw package name
pig install pg18 --plan          # preview installation plan
pig install vector -y         # auto-confirm installation

pig sty

Install the Pigsty distribution. See pig sty for details.

pig sty init                     # install Pigsty to ~/pigsty
pig sty boot                     # install Ansible prerequisites
pig sty conf -g                  # generate configuration with random passwords
pig sty deploy                   # run deployment playbook
pig sty list                     # list available Pigsty releases
pig sty get 4.5.0                # download the embedded Pigsty release
pig sty grafana list             # manage Grafana dashboards (info/list/boot/load/init/dump/clean/lang/style)

pig inventory

Inspect, edit, validate, check, and exchange the Pigsty inventory (pigsty.yml) with the CMDB. Root-level command group with alias inv; see pig inventory for details.

pig inventory status             # inspect the active inventory source
pig inventory list               # list inventory topology and value kinds
pig inventory show               # show verbatim inventory YAML (may contain secrets)
pig inventory edit               # edit the inventory (or one fragment) in $EDITOR
pig inventory validate           # validate one complete static Pigsty inventory
pig inventory check              # check inventory and local controller readiness
pig inventory diff other.yml     # compare declarations without emitting values
pig inventory cmdb check         # check the PostgreSQL CMDB (experimental)

pig do

Run Pigsty administration tasks through the corresponding Ansible playbooks. See pig do for the command reference.

pig do pgsql-add  <cls> [ip...]       # add cluster or instances
pig do pgsql-rm   <cls> [ip...]       # remove cluster or instances
pig do pgsql-db   <cls> <dbname>      # create or update database
pig do pgsql-user <cls> <username>    # create or update user
pig do pgsql-ext  <cls> [ext...]      # install extensions
pig do node-pkg   <sel> [pkg...]      # install node packages

pig pe

Access PostgreSQL monitoring metrics exposed by pg_exporter. The default endpoint is 127.0.0.1:9630; see pig pe for endpoint and operation details.

pig pe list                    # list available metric types
pig pe get                     # get all pg_ prefixed metrics
pig pe stat                    # show exporter statistics
pig pe reload                  # reload pg_exporter configuration
pig pe --host 127.0.0.1 -p 9630 get

pig license

pig license issue <name> delivers the newly issued license to its caller. Text output includes the token; JSON/YAML preserve it in data.captured_output. Successful issuance is an explicit credential-delivery operation, so that result must be stored as a credential. The signing key is never included in arguments, parameters, or diagnostics returned in the result. Raw key-loading errors are replaced with fixed messages. Parameter errors and safe signing-key failure reasons remain available in text, JSON, and YAML. license status and license verify do not reveal tokens.

pig context

Output an environment context snapshot covering host, PostgreSQL, Patroni, pgBackRest, and installed extensions. This command is useful for troubleshooting and for automation scripts that need a quick view of the current node.

pig context                      # text output
pig context -o json              # JSON output
pig context -m postgres          # only output PostgreSQL module (host included by default)
pig context -m postgres,!host    # exclude host module

pig pg

Manage the local PostgreSQL server. See pig pg for details.

pig pg init                      # initialize data directory
pig pg start                     # start PostgreSQL
pig pg stop                      # stop PostgreSQL
pig pg status                    # check status
pig pg psql mydb                 # connect to database
pig pg ps                        # show current connections
pig pg vacuum mydb               # vacuum database
pig pg tune -p olap              # generate tuned parameters
pig pg fork dev                  # create a local one-off physical fork
pig pg fork list                 # list local forks
pig pg log tail                  # tail logs in real time

pig pt

Run patronictl transparently to manage Patroni HA clusters. See pig pt for details.

pig pt list pg-meta              # list cluster members (native passthrough)
pig pt show-config pg-meta       # show cluster dynamic config (native passthrough)
pig pt set ttl=60                # local sugar: update Patroni/PG settings
pig pt restart pg-test --pending # apply pending restarts (native passthrough)
pig pt status                    # local: combined service and cluster status
pig pt log -f                    # local: tail logs in real time

pig pb

Manage pgBackRest backup and restore. See pig pb for details.

pig pb info                      # show backup information
pig pb ls                        # list all backups
pig pb backup                    # create backup
pig pb backup full               # full backup
pig pb restore -d                # restore to latest
pig pb restore -t "2025-01-01"   # restore to a specific time
pig pb log tail                  # tail logs in real time

pig pitr

Run orchestrated point-in-time recovery (PITR). See pig pitr for details.

pig pitr -d                      # recover to latest data
pig pitr -t "2025-01-01 12:00:00+08"  # recover to a specific time
pig pitr -I                      # recover to backup consistency point
pig pitr -d --plan               # show execution plan without running
pig pitr -d -y                   # skip confirmation for automation

Helper Commands

pig status                       # show current environment status
pig status -o json               # structured status output
pig update                       # upgrade pig itself to the latest version
pig update -m                    # upgrade using the pigsty.cc mirror
pig update -v X.Y.Z              # upgrade to a version published by the configured repository
pig version                      # show pig version information
pig version -o json              # structured version output

pig update uses the native package manager on supported Linux distributions. On macOS, download the new archive and replace the executable as described in Installation.

If ~/.pig/config.yml has a syntax error, fix it before running commands that read configuration, such as pig status. pig version and the pig pe HTTP commands remain available because they do not read this file.

Design records

6 - pig repo

Manage software repositories with pig repo

pig repo manages Linux package repositories. Use it to add or remove APT/YUM/DNF sources, refresh indexes, and create or extract offline bundles. repo create also supports macOS through SOW.

CommandDescriptionNotes
repo listPrint available repositories and modules
repo infoShow repository details
repo statusShow current repository status
repo addAdd repositoriesRequires sudo or root
repo setClear, overwrite, and update repositoriesRequires sudo or root
repo rmRemove repositoriesRequires sudo or root
repo updateUpdate repository cacheRequires sudo or root
repo createCreate local YUM/APT repositoryLinux: sudo/root; macOS: current user
repo cacheCreate offline package from local repoRequires sudo or root
repo bootBootstrap repository from offline packageRequires sudo or root
repo reloadRefresh repository catalog

Quick Start

On a host with working OS repositories, add the PostgreSQL repositories and refresh their indexes:

pig repo add pgsql -u

To use the China-region mirrors, add -m:

pig repo add pgsql -m -u

To replace the host’s repository configuration, use set. It backs up the existing definitions, adds node, infra, and pgsql, then refreshes the indexes:

pig repo set

Use pig repo info pgsql to inspect repository definitions. Use pig repo status to inspect the host’s current configuration.

Modules

In pig, APT/YUM repositories are organized as modules: groups of repositories serving a specific purpose.

ModuleDescriptionRepository List
allAll core modules required to install PGnode + infra + pgsql
pgsqlPGDG + Pigsty PG extensionspigsty-pgsql + pgdg
pigstyPigsty Infra + PGSQL repositoriespigsty-infra, pigsty-pgsql
pgdgPGDG official repositoriesEL: pgdg-common, pgdg14-18; APT: pgdg
nodeLinux system repositoriesbase, updates, extras, epel, baseos, appstream…
infraInfrastructure component repositorypigsty-infra
nginxNginx repositorynginx
dockerDocker repositorydocker-ce
betaPostgreSQL 19 beta repositoriespgdg19-beta, pgdg-beta
extraPGDG non-free and third-party extensionspgdg-extras, timescaledb, citus
groongaPGroonga repositorygroonga
perconaPercona PG + PG_TDEpercona
llvmLLVM toolchain repositoryllvm
kubeKubernetes repositorykubernetes
grafanaGrafana repositorygrafana
haproxyHAProxy repositorieshaproxyd, haproxyu
redisRedis repositoryredis
mongoMongoDB repositorymongo
mysqlMySQL repositorymysql
clickClickHouse repositoryclickhouse
gitlabGitLab repositorygitlab-ce, gitlab-ee

PIG filters each module by the current operating system and architecture. Run pig repo list to see the available entries.

If the host already has working OS repositories, add pgsql for PGDG and Pigsty extension packages. infra supplies infrastructure tools and some PostgreSQL fork packages. all combines node, infra, and pgsql. Both repo add and repo set select all when no module is given.

repo add, repo set, and repo info accept comma-separated names and surrounding whitespace. Explicit empty names, including an empty argument or node,, reject the whole request before repository operations. An empty argument is not equivalent to omitting the arguments. For repo add and repo set, module names may contain only ASCII letters, digits, underscores, and hyphens. An unsafe name such as ../escape rejects the whole request before key installation or repository changes. A syntactically valid but unknown module retains the existing behavior: repo add adds valid modules and returns failure for unknown ones; repo set and repo add --remove reject the whole request.

Repository Definitions

The full repository definition bundled with Pigsty is in cli/repo/assets/repo.yml.

Create ~/.pig/repo.yml to override the embedded catalog. Use the source file above as the format reference. repo reload updates this file, so save custom changes before a refresh.

--region selects a regional URL from baseurl. If that region is absent, PIG uses default. -m selects china, including the Pigsty China mirror and other mirrors defined in the catalog.

Trust and configuration ownership

repo add writes the selected module files and preserves other files. repo set and repo add --remove back up and replace the existing definitions. If Ansible or another tool manages these files, keep the definitions in that tool’s configuration so its next run preserves your changes.

Pigsty signing key

When a module includes pigsty-infra or pigsty-pgsql, PIG reuses the existing public-key file or installs its embedded key with mode 0644:

PlatformPublic-key path
EL/etc/pki/rpm-gpg/RPM-GPG-KEY-pigsty
Debian / Ubuntu/etc/apt/keyrings/pigsty.asc

This step works offline. Selecting only other repositories, such as pgdg or node, does not prepare the Pigsty key.

Built-in repository definitions do not enforce package signatures by default: EL uses gpgcheck=0; Debian/Ubuntu uses trusted=yes. Ordinary repo add/set preserves these settings. pig sty boot enables Pigsty signature checks when key preparation succeeds. To require signatures, configure a trusted key and enable verification in the repository metadata.

If implicit key installation fails, the command warns and continues. The selected Pigsty definitions use trusted=yes, or gpgcheck=0 with repo_gpgcheck=0, and retain their default key reference. Structured results include the warning in data.warnings. APT may retain old indexes in this case; check the cache-update output.

An explicit key reference makes preparation mandatory:

  • On Debian/Ubuntu, signed-by names existing regular keyring files by absolute path. Separate multiple paths with commas.
  • On EL, gpgkey contains paths or literal URLs, which PIG passes to rpm --import.
  • PIG can install an explicitly referenced default Pigsty key from its embedded copy.

If preparation of an explicit key fails, repository configuration stops. Implicit installation prepares only the file and repository reference; explicit EL gpgkey also imports the key into RPM. See the design record for the rationale.

EL repositories retain DNF module filtering. Definitions with module_hotfixes=1, including Pigsty and PGDG, bypass module streams. PIG omits this key in EL7 configuration.

repo list

pig repo list lists all repository modules available on the current system.

pig repo list                # list repositories available on current system
pig repo list all            # list all repositories without filtering

repo info

Show detailed information for specific repositories or modules, including URLs, metadata, regional mirrors, and .repo / .list repository file content.

pig repo info pgdg               # show pgdg module information
pig repo info pigsty pgdg        # show multiple modules
pig repo info all                # show all modules

repo status

Show current repository configuration on the system.

pig repo status

repo add

Add repository configuration files to the system. Requires root/sudo privileges.

pig repo add pgdg                # add PGDG repository
pig repo add pgdg pigsty         # add multiple repositories
pig repo add all                 # add all required repositories (pgdg + pigsty + node)
pig repo add pigsty -u           # add and update cache
pig repo add all -r              # remove existing repos before adding
pig repo add all -ru             # remove, add, and update (full reset)
pig repo add pgdg --region=china # use China mirror
pig repo add pgsql -m            # explicitly select the China-region mirrors

Options:

  • -r|--remove: remove existing repositories before adding new ones
  • -u|--update: run package cache update after adding repositories
  • -m|--mirror: explicitly select the bundled china repository definitions
  • --region <region>: use regional mirror repositories (default / china / europe)
PlatformModule Location
EL/etc/yum.repos.d/<module>.repo
Debian/etc/apt/sources.list.d/<module>.list

repo set

Back up and remove existing repository definitions, write the selected modules, then refresh package metadata. This is equivalent to repo add --remove --update. If you omit the modules, PIG uses all.

pig repo set                     # replace with default repositories
pig repo set pgdg pigsty         # replace with selected repositories and update
pig repo set all --region=china  # use China mirror
pig repo set -m                  # explicitly select the China-region mirrors

repo set supports the same --region and -m|--mirror options as repo add.

repo rm

With truly no operands, move all repository definitions to the existing backup directory. Explicit module operands remove only those module files; all expands to node, pgsql, and infra, and does not mean every file. Empty strings, whitespace-only operands, empty comma items, and unsafe names fail before any repository or cache operation, even in a mixed list. -u updates the cache after either a successful full backup or module removal. Backup and restore behavior is unchanged. Removing an already absent module remains successful. The summary reports how many module files are now absent, without claiming that every request deleted an existing file. Custom module names remain supported within the repository directory. If a full backup finds no repository files, the summary reports that there is nothing to back up. Structured results retain the original operands in requested_modules, including all and comma-separated arguments; removed_repos lists the expanded modules and their individual outcomes.

pig repo rm                      # remove all repositories
pig repo rm pgdg                 # remove selected repository
pig repo rm pgdg pigsty -u       # remove and update cache
PlatformBackup Location
EL/etc/yum.repos.d/backup/
Debian/etc/apt/sources.list.d/backup/

repo update

Update package-manager cache to reflect repository changes.

pig repo update                  # update package cache
PlatformEquivalent Command
ELdnf makecache (yum makecache on EL7)
Debianapt-get update

repo create

Create a local package repository for offline installation.

pig repo create                  # Linux: /www/pigsty; macOS: current directory
pig repo create /srv/repo        # create at custom location

The current implementation prefers sow when it is available in PATH. On Linux, the SOW backend runs the equivalent of the following with sudo for every target directory:

sow create --pigsty --timeout 10m -- /absolute/repository/path

On macOS, install SOW first. It runs without sudo, and the default target is the current directory.

On Linux, if SOW is absent, PIG uses createrepo_c on EL or dpkg-scanpackages from dpkg-dev on Debian/Ubuntu. If SOW runs and fails, PIG returns the error. The 10m timeout limits the wait for SOW’s directory lock.

SOW’s --pigsty mode:

  1. Scans only top-level regular .rpm and .deb files—no recursion and no symlink following.
  2. Removes DEB packages for i386, and RPM/DEB packages named patroni with upstream version 3.0.4.
  3. Generates RPM/DEB metadata and writes repo_complete last. The marker contains SHA-256 hashes for remaining top-level packages, sorted by basename.

Documentation packages such as annobin-docs are retained unless another cleanup rule applies; a filename containing docs is not a reason to delete a package.

SOW preserves non-package files and directories. It stops if a package cannot be parsed or package coordinates conflict. The legacy backend uses different cleanup rules and records MD5 hashes in repo_complete. PIG checks that this file exists; it does not check its hashes. Use the list to verify package integrity before distributing an offline bundle.

repo cache

Create a compressed tarball of repository contents for offline distribution.

pig repo cache                   # default: /www to /tmp/pkg.tgz
pig repo cache -d /srv           # custom source directory
pig repo cache pigsty docker     # include multiple top-level repositories

Options:

  • -d, --dir: source directory, default /www/
  • -p, --path: output path, default /tmp/pkg.tgz

An offline bundle must include pigsty and a regular pigsty/repo_complete marker. Missing requested repositories are skipped and reported separately from the repositories actually included. Symbolic links are rejected because the native boot extractor accepts only directories and regular files. A failed cache leaves an existing output package unchanged.

repo boot

Extract and set up a local repository from an offline package.

pig repo boot                    # default: /tmp/pkg.tgz to /www
pig repo boot -p /mnt/pkg.tgz    # custom package path
pig repo boot -d /srv            # custom target directory

Options:

  • -p, --path: package path, default /tmp/pkg.tgz
  • -d, --dir: target directory, default /www/

The command extracts into a staging directory, checks target paths, then moves the repositories into place. It moves additional repositories first and pigsty last.

  • If a completed pigsty/repo_complete already exists at the target, PIG reuses that repository. It does not inspect the archive or import its additional repositories. Structured output sets reused: true.
  • A conflicting target path stops extraction. After an interrupted run, inspect and move any conflicting directories before retrying.
  • The archive must contain a regular pigsty/repo_complete file. PIG checks its presence, not its contents.

repo reload

Download the latest repository catalog from the Pigsty repository sites.

pig repo reload                  # refresh repository catalog

The updated file is placed in ~/.pig/repo.yml.

7 - pig ext

Manage PostgreSQL extensions with pig ext

pig ext searches the extension catalog and installs, updates, or removes PostgreSQL extension packages on the host. It also supports PostgreSQL server packages. After installing a package, apply the SQL and configuration required by the extension.

CommandDescriptionNotes
ext listSearch extensions
ext infoShow extension details
ext availShow extension availability matrix
ext statusShow host-visible extension files/packagesDoes not query every database
ext scanScan installed control/library filesDoes not query every database
ext addInstall extensionsRequires sudo or root
ext rmRemove extensionsRequires sudo or root
ext updateUpdate extensionsRequires sudo or root
ext importDownload extensions for offline useRequires sudo or root
ext linkLink a PG version into PATHRequires sudo or root
ext reloadRefresh extension catalog

Quick Start

This example uses a running PostgreSQL 18 instance. To install and start one, follow Getting Started.

Add the PostgreSQL repositories, inspect the extension, then install its package:

pig repo add pgsql -u
pig ext list vector
pig ext info vector
pig ext add vector -v 18

Enable the extension in the target database. For example:

CREATE EXTENSION vector;

See the extension list for other extensions. If an extension requires preloading or other configuration, complete the steps from pig ext info NAME before enabling it.

Select a PostgreSQL installation

  • -v, --version 18: select a PostgreSQL major version.
  • -p, --path /path/to/pg_config: select an installation by its pg_config path.
  • Use one option at a time. When neither is supplied, PIG attempts local PostgreSQL detection. Set -v explicitly in automation.

The default PGDG paths are /usr/pgsql-18/bin/pg_config on EL and /usr/lib/postgresql/18/bin/pg_config on Debian/Ubuntu. The package manager resolves RPM/DEB dependencies. -y confirms package operations automatically.

Package and database operations

TaskPIG operationDatabase operation
Installext add NAMEConfigure preloading if required, then run CREATE EXTENSION
Upgradeext update NAMEFollow the extension’s upgrade instructions and run ALTER EXTENSION ... UPDATE
Removeext rm NAMERemove or migrate dependencies in affected databases before uninstalling the package
Inspectext status / ext scan inspect host filesQuery pg_extension for enabled database extensions
Refresh catalogext reload updates extension metadataNone

pg_available_extensions lists extensions available to the server. pg_extension lists extensions enabled in the current database.

ext list

List or search extensions in the extension catalog.

pig ext list                     # list all extensions
pig ext list duck                # search extensions containing "duck"
pig ext list -v 18               # evaluate availability for PG 18
pig ext ls olap                  # list OLAP category extensions
pig ext ls gis -v 16             # list GIS entries with PG 16 availability
pig ext ls rag                   # list RAG category extensions

Category filtering is done by passing the category name as the query. Supported categories include: time, gis, rag, fts, olap, feat, lang, type, func, util, admin, stat, sec, fdw, sim, and etl.

Options:

  • -v|--version: select the PG version used to evaluate availability; unavailable entries remain in the list
  • --pkg: show package names instead of extension names, listing only leading extensions

Status column:

  • installed: extension is installed
  • available: extension is available but not installed
  • not avail: extension is not available on the current system

Availability and text/JSON/YAML summaries use the same platform, architecture, and PostgreSQL version. For platforms covered by a package matrix, that matrix takes precedence; a missing cell is unavailable. Catalog entries without a matrix retain RPM/DEB metadata and platform-exception fallbacks. amd64/x86_64 and arm64/aarch64 are equivalent. On macOS, this status describes declared PostgreSQL version support, not the availability of an RPM/DEB package.

Catalog count

The website and CLI count every catalog record, including packaged SQL utilities such as pg_relation_sql and retained records for removed extensions. The bundled catalog currently contains 603 entries. This total does not mean that every entry supports CREATE EXTENSION or is available on every platform.

The unfiltered list includes every record. Its text row count and JSON/YAML data.count describe the rows returned; a search counts its matches, and --pkg counts leading package records. The global ext avail text summary uses the full catalog total. ext reload reports the number of records in the downloaded catalog through data.extension_count.

The counting decision explains this shared definition. The default extension catalog is defined in cli/ext/assets/extension.csv.

Use pig ext reload to refresh to the latest catalog. The downloaded catalog is stored at ~/.pig/extension.csv; the latest online catalog is also published at repo.pigsty.io/ext/data/extension.csv.

ext info

Show detailed information for selected extensions.

pig ext info postgis        # show PostGIS details
pig ext info timescaledb    # show TimescaleDB details
pig ext info vector postgis # show multiple extensions

ext avail

Show the extension availability matrix across operating systems, architectures, and PostgreSQL versions.

pig ext avail                     # show package availability on current system
pig ext avail timescaledb         # show timescaledb availability matrix
pig ext avail postgis pg_duckdb   # show multiple extensions
pig ext av pgvector               # show pgvector availability
pig ext matrix citus              # alias for avail

The matrix shows availability across operating systems (EL8/9/10, Debian 12/13, Ubuntu 22/24/26), architectures (x86_64/aarch64), and PostgreSQL versions (14-18).

ext status

Show extension files/packages visible to the selected PostgreSQL installation on this host.

pig ext status              # show installed extensions
pig ext status -c           # include contrib extensions
pig ext status -v 16        # show installed extensions for PG 16

Options:

  • -c|--contrib: include contrib extensions in the result

ext scan

Scan the selected PostgreSQL installation’s extension directories.

pig ext scan [-v version]

The command reads control files and related installation paths for the selected PostgreSQL installation. It also matches shared-library names against catalog metadata, so a catalog entry without a control file can still be reported as installed. This does not imply CREATE EXTENSION support.

ext add

Install one or more PostgreSQL extensions. Aliases for pig ext add include pig ext install, pig ext ins, and pig ext a. The top-level pig install command also accepts extension aliases and general OS packages.

pig ext add pg_duckdb            # install pg_duckdb
pig ext add pg_duckdb -v 18      # install for PG 18
pig ext add pg_duckdb -y         # auto-confirm installation
pig ext add vector postgis       # install multiple extensions
pig ext add postgis --plan       # preview install plan without executing

# Top-level package installer
pig install pg_duckdb
pig install pg_duckdb -v 18 -y

# Install PostgreSQL packages
pig ext add pg18                 # install PostgreSQL 18
pig ext add pg18-client          # install client tools only

Use these aliases to select a PostgreSQL package group:

AliasPackages
pg18Server, client, contrib modules, and procedural languages
pg18-serverServer and contrib modules
pg18-clientClient tools
pg18-develDevelopment files
pg18-basicpg_repack, wal2json, and pgvector

Replace 18 with the required major version. You can also use pgsql with -v 18. To select a specific package version, use NAME=VERSION with a version available in the configured repository.

Options:

  • -v|--version: specify PG major version
  • -y|--yes: auto-confirm installation
  • --plan: preview the install plan without running package-manager commands

Successful installation only makes the extension files available on the host. Follow the extension’s ext info hints for preload, restart, and CREATE EXTENSION steps.

ext rm

Remove one or more PostgreSQL extensions.

pig ext rm pg_duckdb             # remove pg_duckdb
pig ext rm pg_duckdb -v 18       # remove PG 18 package
pig ext rm pgvector -y           # auto-confirm removal
pig ext rm pgvector --plan       # preview remove plan without executing

Options:

  • -v|--version: specify PG major version
  • -y|--yes: auto-confirm removal
  • --plan: preview the remove plan without running package-manager commands

This removes an OS package, not database objects. Drop or migrate dependent extensions in every affected database before removing the shared files.

ext update

Update the named packages to the versions available from the configured repositories. With no arguments, the command makes no changes.

pig ext update                   # no-op: explicit targets are required
pig ext update pg_duckdb         # update one extension
pig ext update postgis timescaledb  # update multiple extensions
pig ext update pg_duckdb -y      # auto-confirm update
pig ext update pg_duckdb -m      # refresh the catalog from the China mirror first

Options:

  • -v|--version: specify PG major version
  • -y|--yes: auto-confirm update
  • -m|--mirror: refresh the extension catalog from the pigsty.cc mirror before updating packages; package downloads still use the configured OS repositories

The command does not run SQL migrations. After the package upgrade, follow the extension’s release notes and run ALTER EXTENSION ... UPDATE in each database where appropriate.

ext import

Download extension packages into a local repository for offline installation.

pig ext import postgis                # import PostGIS packages
pig ext import timescaledb pg_cron    # import multiple extension packages
pig ext import pg16                   # import PostgreSQL 16 packages
pig ext import pgsql-common           # import common utility packages
pig ext import -d /www/pigsty postgis # import to a selected path

Options:

  • -d|--repo: local repository directory (default: /www/pigsty)

If some names cannot be resolved, successfully resolved packages are still downloaded, but the command exits with failure. Structured output preserves requested, resolved packages, confirmed downloaded packages, and unresolved failed names. A native download failure can also leave files in the destination; it does not imply rollback or a complete download.

On Debian/Ubuntu, virtual dependency markers such as <virtual-package> are excluded from the package download list; real package dependencies remain eligible.

JSON/YAML output and PIG_NON_INTERACTIVE=1 use non-interactive sudo. If privilege escalation requires a password, the command fails instead of waiting for input; configure suitable sudo access first.

Link a selected PG version into the system PATH.

pig ext link 18                  # link PG 18 to PATH
pig ext link pg17                # strip the pg prefix and link PG 17
pig ext link 16                  # link PG 16 to /usr/pgsql
pig ext link /usr/pgsql-16       # link from a selected path to /usr/pgsql
pig ext link polar               # link PolarDB / PolarPG installation
pig ext link /usr/polar-17       # link from a selected PolarDB path
pig ext link null                # remove current PostgreSQL link
pig ext link none                # null / none / nil / nop / no all remove the link

This command creates the /usr/pgsql symlink and writes /etc/profile.d/pgsql.sh. Load the profile in your current shell:

. /etc/profile.d/pgsql.sh

ext reload

Refresh extension metadata.

pig ext reload                   # refresh extension catalog

The updated catalog is stored at ~/.pig/extension.csv.

8 - pig build

Build PostgreSQL extensions from source with pig build

pig build downloads sources, installs dependencies, and produces RPM/DEB packages using Pigsty build recipes. Use it on an EL, Debian, or Ubuntu build host. Rust, pgrx, and the Xray client also support their respective macOS workflows.

CommandDescriptionNotes
build specInitialize build specification directory
build repoInitialize required repositoriesRequires sudo or root
build toolInitialize build toolsRequires sudo or root
build rustInstall Rust toolchainCurrent user
build pgrxInstall and initialize pgrxCurrent user
build proxySet up Xray clients and serversLinux: root; macOS client: regular user
build getDownload source tarballs
build depInstall extension build dependenciesRequires sudo or root
build extBuild extension packagesCurrent user
build pkgComplete pipeline: get, dep, extRequires sudo or root

Quick Start

If the build host needs package repositories, run pig build repo. This backs up and replaces existing repository definitions. Skip this step if suitable repositories are already configured.

Then install the build tools, download the recipes, and build an extension:

pig build tool                  # install build tools and PostgreSQL development packages
pig build spec                  # download recipes and prepare directories
pig build pkg citus --pg 18     # download, install dependencies, and build for PG 18

Packages are written under ~/ext/pkg/; RPM outputs may be in architecture subdirectories.

To run each build stage separately:

pig build get citus
pig build dep citus --pg 18
pig build ext citus --pg 18

build pkg combines these three stages. It does not install the general build tools or download build recipes.

Build Infrastructure

Directory Layout

PIG build directories

  • ~/ext/
    • pkg/
    • src/
    • log/
    • tmp/
  • ~/rpmbuild/
    • RPMS -> ~/ext/pkg
    • SOURCES -> ~/ext/src
    • SPECS/
    • BUILD/
    • BUILDROOT/
    • SRPMS/
  • ~/debbuild/
    • DEBS -> ~/ext/pkg
    • SOURCES -> ~/ext/src
    • SPECS/
    • BUILD/

~/ext/ is the real working directory: pkg stores built packages, src stores source tarballs, and log / tmp hold build logs and temporary files. The platform-specific trees link their output and source directories back into it.

Build output locations:

  • EL systems: ~/ext/pkg/, also accessible through ~/rpmbuild/RPMS/
  • Debian systems: ~/ext/pkg/, also accessible through ~/debbuild/DEBS/

build spec

Set up build specifications and directory layout.

pig build spec                   # initialize ~/ext at the default location
pig build spec -f                # force re-download of the build spec tarball
pig build spec -m                # prefer the pigsty.cc China mirror

What it does:

  1. Downloads the RPM or DEB build specification tarball.
  2. Creates ~/ext/{pkg,src,log,tmp} and the platform build directory.
  3. Links RPMS/DEBS and SOURCES to ~/ext/pkg and ~/ext/src.
  4. Syncs makefiles, specs, and Debian packaging files with incremental rsync.

Working directory: ~/ext/ stores sources, packages, logs, and temporary files. The platform packaging directory is ~/rpmbuild/ or ~/debbuild/.

build repo

Initialize package repositories required for building extensions.

pig build repo                   # equivalent to: pig repo set
pig build repo -m                # select the bundled China-region mirrors
pig build repo --beta            # also enable the PostgreSQL 19 beta repo module

What it does: initializes build repositories with pig repo set: remove old repositories, add required repositories, and refresh package caches. --beta/-b appends the beta module for explicit PostgreSQL 19 beta builds; the stable default path still uses PG14-18.

Options:

  • -b|--beta: additionally enable PostgreSQL beta repository modules
  • -m|--mirror: select the bundled china repository definitions

build tool

Install development tools and compilers.

pig build tool                   # install default toolset
pig build tool mini              # minimal toolset
pig build tool full              # full toolset
pig build rust                   # install Rust separately
pig build tool --beta            # add PG19 beta build dependencies

Toolsets:

  • Minimal (mini): build tools and libraries, with PostgreSQL and PGDG packages removed from the install list.
  • Default / full: Make, CMake, development libraries, packaging tools, and PostgreSQL build dependencies. EL selects PG14-18 server/devel packages; Debian/Ubuntu uses postgresql-all and postgresql-server-dev-all.
  • --beta: adds explicit PG19 beta server/devel packages. mini still excludes PostgreSQL packages.

build rust

Install the Rust toolchain required by Rust-based extensions.

pig build rust                   # install if Cargo is absent
pig build rust -y                # force reinstall Rust toolchain
pig build rust -m                # use China mirror mode and write Cargo mirror config

PIG installs Rust through rustup for the current user, without an interactive prompt. If ~/.cargo/bin/cargo exists, it skips installation unless -y is set. -m uses rsproxy.cn for rustup and writes Cargo mirror configuration, including when Rust is already installed.

build pgrx

Install and initialize PGRX, the PostgreSQL extension framework for Rust.

pig build pgrx                   # install default version (0.19.3)
pig build pgrx -v 0.19.3         # install a specific pgrx version
pig build pgrx --pg 18,17,16     # initialize pgrx for selected PG versions
pig build pgrx --pg init         # run cargo pgrx init without PG arguments
pig build pgrx -b                # include PostgreSQL 19 beta pg_config during auto-detection

Prerequisites: Rust toolchain and PostgreSQL development headers must be installed first. Default auto-detection only covers stable PG14-18; use -b|--beta, or explicitly pass --pg 19, when PG19 beta is required.

build proxy

A matching macOS LaunchAgent generated by the older source without a management comment can upgrade without --replace. Recognition compares the complete generated plist; a comment alone does not grant ownership. Foreign or edited service files require --replace --yes. After the one-time comment migration, identical execution leaves the service running without a restart. This compatibility statement covers the verified old source format, not every released binary.

Set up Xray clients and servers for build environments with restricted internet access. The x alias is retained. With no arguments, pig build proxy installs or verifies Xray only. See the Xray design record for the design rationale.

Client

One command installs Xray if needed, writes the client configuration, starts its service, and checks HTTPS through both HTTP and SOCKS. The first listener defaults to 127.0.0.1:12345, with HTTP and SOCKS sharing that port. An omitted --listen preserves the listener of an existing supported client. The protocol is VLESS over RAW/TCP, REALITY, and xtls-rprx-vision, with a Chrome fingerprint and multiplexing disabled.

pig build proxy client 'vless://[email protected]:443?encryption=none&security=reality&type=tcp&flow=xtls-rprx-vision&sni=www.sraoss.co.jp&fp=chrome&pbk=PUBLIC_KEY&sid=SHORT_ID&pqv=VERIFY_KEY'
pig build proxy client --server proxy.example.com:443 --id UUID --sni www.sraoss.co.jp --public-key PUBLIC_KEY --short-id SHORT_ID --pqv VERIFY_KEY
pig build proxy client --from ./client.uri
pig build proxy client --from ./client.uri --listen 127.0.0.1:8888
pig build proxy client --from ./client.uri --plan

Choose one connection input: a positional URI, direct connection flags, or --from FILE/-. client.uri is simply a text file containing one standard vless:// URI, with an optional trailing newline; its name is arbitrary. --from - reads stdin. Do not mix input forms. --pqv supplies ML-DSA-65 verification when enabled on the server. Unsupported transports, duplicate URI parameters, and ambiguous inputs are rejected before setup.

On Linux, run setup as root or with sudo, with systemd running and a repository providing the Pigsty xray package configured first, for example sudo pig repo add infra -u. Setup uses /etc/xray.json with mode 0640 and ownership root:xray, the xray service account, and a PIG-owned systemd drop-in. On macOS, run as your regular user with Homebrew available. Setup uses ~/.config/xray/pig-proxy.json with mode 0600 and its own com.pigsty.xray-proxy LaunchAgent.

For an existing server, pass its connection URI directly to client setup:

# Linux client: the remote command only reads and exports the existing server connection.
ssh [email protected] 'pig build proxy server --host proxy.example.com --export-only --export -' | sudo pig build proxy client --from -
# macOS client: omit sudo.
ssh [email protected] 'pig build proxy server --host proxy.example.com --export-only --export -' | pig build proxy client --from -

Repeated setup reuses matching configuration and service state. To replace a different client configuration, use --replace --yes. Use --plan to preview the operation.

After setup, PIG requests https://www.google.com/generate_204 through both HTTP and SOCKS and requires HTTP 204. If the checks fail, PIG restores the previous configuration and service state. Any installed package remains.

The generated shell file defines po, px, and pck. To enable proxy variables in the calling shell:

# Linux
source /etc/profile.d/proxy.sh
po
# macOS
source ~/.config/xray/proxy.sh
po

Server

Server setup supports Linux with the same package, root, and systemd requirements. Require the advertised public --host and REALITY camouflage --target host:port. The first direct listener defaults to 0.0.0.0:443; --port changes the advertised public port and first direct listener. --listen sets an independent bind endpoint. The target must support TLS 1.3 and HTTP/2.

# Direct public listener; explicitly export a protected client URI file.
sudo pig build proxy server --host proxy.example.com --target www.sraoss.co.jp:443 --export ./client.uri
# Backend behind an already configured trusted PROXY-protocol ingress: 127.0.0.1:9443.
sudo pig build proxy server --host proxy.example.com --target www.sraoss.co.jp:443 --proxy-protocol --export ./client.uri
# Read an existing supported server and print its connection without changing the deployment.
sudo pig build proxy server --host proxy.example.com --export-only --export -

First setup generates a UUID, X25519 key pair, short ID, and ML-DSA-65 seed and verification key. SNI defaults to the --target hostname. Repeated setup preserves these credentials. If you omit --listen, it also preserves the listener; specify --listen to change it. Matching configuration does not restart the service. Conflicting targets or unsupported existing configurations produce an error.

Connection export options:

OptionPurpose
--export FILEWrite a client URI with mode 0600; identical content can be exported again, but different content is not overwritten
--export -Print the complete client URI on stdout and diagnostics on stderr
--export-onlyRead and export existing configuration without changing files or services; requires --export
--planPreview setup

Export requires text output. The URI contains client credentials, so pass it through a file or stdin. It does not contain the server’s private key or seed. When exporting an existing server, --host and --port specify the public endpoint the client reaches, not the backend listener.

After setup, test connectivity from a real client. Open the required firewall or cloud security-group rules. --proxy-protocol requires an existing trusted frontend and a loopback listener. PIG does not stop another service that occupies the port or remove an existing V2Ray installation.

Historical VMess form

The historical positional grammar keeps its V2Ray/VMess behavior and first client port 12345:

pig build proxy user@host:8080
pig build proxy user@host:8080 127.0.0.1:1080

This Linux compatibility path still needs a repository providing vray, writes /etc/v2ray.json and /etc/profile.d/proxy.sh, and restarts v2ray. It requires root or sudo; a failed HTTPS check returns nonzero. The remote user ID is a credential and is redacted from ordinary results.

build get

Download extension source tarballs.

pig build get citus              # single extension
pig build get citus pgvector     # multiple extensions
pig build get pdu pgdog          # use built-in source aliases
pig build get citus -f           # re-download even if the file already exists
pig build get citus -m           # prefer the pigsty.cc China mirror

Arguments to pig build get are extension names, package names, or source filenames. Unknown names are treated as source filenames. It does not expand all or std into built-in package sets; list the target package names explicitly for batch downloads.

Some source packages do not map directly to extension names, so pig build get includes special aliases for direct source downloads.

pig build get pdu                # download pdu-3.0.25.12.tar.gz
pig build get pgdog              # download pgdog-0.1.32.tar.gz
pig build get pgedge             # download both PostgreSQL and spock sources
pig build get onesparse          # download onesparse, graphblas, and lagraph

Common special source aliases include: babelfish, agensgraph, orioledb, cloudberry, pgedge, pdu, pgdog, rdkit, onesparse, and libpgfeutils.

build dep

Install dependencies required to build extensions.

pig build dep citus              # single extension
pig build dep citus pgvector     # multiple extensions
pig build dep citus --pg 17,16   # for selected PG versions

Options:

  • --pg: specify one or more PostgreSQL major versions. If omitted, pig infers versions from extension metadata or local PostgreSQL installations.

For a list such as --pg 17,16, version-specific dependency names are expanded for every selected major version and duplicates are removed before installation. The same dependency step is used by build pkg.

build ext

Compile extensions and create installation packages.

For build ext and build pkg, omitting --pg retains version selection from extension metadata and platform exceptions; Debian/Ubuntu also consider locally installed PG versions. Package-matrix gaps do not remove build targets. An explicit --pg selects the requested versions. Debian/Ubuntu builds preserve the inherited PATH order and append the current user’s ~/.cargo/bin when that directory exists, so an explicitly selected toolchain keeps precedence.

Debug packages are enabled by default. Compiled RPM builds normally add debuginfo and debugsource packages, while Debhelper-based builds normally add a dbgsym package. Pure SQL, architecture-independent, or recipe-specific builds may have no debug payload to split. A package recipe can also make a narrower explicit choice; PIG does not rewrite spec files or debian/rules.

pig build ext citus              # build one extension
pig build ext citus pgvector     # build multiple extensions
pig build ext citus --pg 17      # build for a selected PG version
pig build ext citus --nodbg      # explicitly omit automatic debug packages

Options:

  • --pg: specify one or more PostgreSQL major versions.
  • --nodbg: disable automatic debuginfo / debugsource packages on RPM builds and dbgsym packages on DEB builds.

build pkg

Download sources, install dependencies, then build each requested package. A source-download failure stops that package. A dependency-install failure produces a warning and the build still runs, because the dependencies may already be present.

pig build pkg citus              # build one extension
pig build pkg citus pgvector     # build multiple extensions
pig build pkg citus --pg 17,16   # build for multiple PG versions
pig build pkg citus --nodbg      # explicitly omit automatic debug packages
pig build pkg citus -m           # prefer the pigsty.cc China mirror for sources

Options:

  • --pg: specify one or more PostgreSQL major versions.
  • --nodbg: disable automatic debuginfo / debugsource packages on RPM builds and dbgsym packages on DEB builds.
  • -m|--mirror: prefer the pigsty.cc mirror when downloading source files.

Common Workflows

Build and install a local package

After preparing the environment in Quick Start, build for the target PostgreSQL version:

pig build pkg pg_partman --pg 18
find ~/ext/pkg -type f -name '*partman*'

Select the package that matches the target PostgreSQL version and architecture, then install it with the system package manager. Replace these placeholder paths with the actual package path:

sudo dnf install /absolute/path/to/package.rpm   # EL
sudo apt install /absolute/path/to/package.deb   # Debian / Ubuntu

pig ext add NAME installs from configured repositories. Use a file path as shown above to install the package you just built.

Build a Rust extension

In a prepared build environment, install Rust and the pgrx version required by the recipe for the current user:

pig build rust
pig build pgrx --pg 18
pig build pkg pgmq --pg 18

Add -m to build rust to use China mirrors. If the recipe requires a specific pgrx version, run pig build pgrx -v VERSION --pg 18. Install the local package as described above.

Build for multiple PostgreSQL versions

pig build pkg citus --pg 15,16,17

PIG produces packages for each major version. Each version needs matching development packages and recipe support.

Build for PostgreSQL 19 beta

pig build repo --beta
pig build tool --beta
pig build pgrx -b                # only for Rust/pgrx extensions
pig build pkg EXTENSION --pg 19

Replace EXTENSION with one that supports the selected version. The beta version comes from PIG’s current embedded configuration.

Troubleshooting

ProblemAction
Missing build toolsRun pig build tool; install any additional compiler required by the recipe
Missing extension dependenciesRun pig build dep NAME --pg MAJOR; check the reported packages and repositories
PostgreSQL headers not foundRun pig ext add pg18-devel, then select the matching target with --pg 18
Wrong pgrx versionRun pig build pgrx -v VERSION --pg MAJOR with the version required by the recipe
Stale source archiveRun pig build get NAME -f; first check that the catalog’s source version matches the recipe

Build logs are in ~/ext/log/. Build time depends on the recipe, CPU, memory, parallelism, and caches. PostGIS, pg_duckdb, and Rust extensions usually need more resources.

9 - pig sty

Manage Pigsty installation with pig sty

pig sty installs Pigsty, prepares the controller, generates configuration, and runs deployment playbooks. It also manages dashboards through the Grafana HTTP API.

CommandPurpose
sty initDownload and extract Pigsty into an installation directory
sty bootInstall Ansible dependencies and prepare the controller
sty confGenerate and validate an inventory from a template
sty deployRun the deployment playbook
sty list / sty getList or download Pigsty releases
sty grafanaManage Grafana dashboards, language, and theme; alias gf

Quick Start

Run these commands on the controller:

pig sty init                     # download Pigsty
pig sty boot                     # prepare Ansible and the controller
pig sty conf -g                  # generate configuration with random passwords
pig inventory edit              # review target hosts and deployment settings
pig sty deploy                   # run the deployment

deploy starts the playbook immediately and changes the hosts selected by the inventory. See the Pigsty installation guide for the full procedure.

boot also attempts to initialize a missing ~/pigsty directory. Run init first to select a version or path. Use pig inventory to edit and validate an existing configuration.

sty init

Download and install the Pigsty distribution into ~/pigsty.

pig sty init                   # install latest version to ~/pigsty
pig sty init -f                # install and overwrite existing pigsty directory
pig sty init -m                # prefer the pigsty.cc mirror for downloads
pig sty init -p /tmp/pigsty    # install to selected directory /tmp/pigsty
pig sty init -v 4.5.0       # install this documented Pigsty version
pig sty init 4                 # install the latest release in the 4.x series

Options:

  • -p|--path: target installation directory, default ~/pigsty
  • -f|--force: force overwrite of existing pigsty directory
  • -m|--mirror: prefer the pigsty.cc mirror
  • -v|--version: Pigsty version
  • -d|--dir: download directory, default /tmp
  • --accept-eula: accept the Pigsty Pro EULA without an interactive prompt; applies to Pro releases

sty boot

Prepare Ansible and its Python dependencies, configure online or offline repositories, and check localhost SSH and the Pigsty directory.

pig sty boot                         # online bootstrap with the default region
pig sty boot -r china                # use China-region repositories
pig sty boot -m                      # equivalent to --region china
pig sty boot -k                      # preserve existing repository definitions
pig sty boot -p /path/to/pkg.tgz     # use an explicit offline package
pig sty boot -p https://host/pkg.tgz # download and use an offline package
pig sty boot -o json                 # machine-readable result and warnings

You may invoke the command without sudo. Pig resolves and downloads an explicit source first, then re-executes itself through sudo once when root access is required. Set PIG_NO_SUDO=1 to disable automatic elevation. JSON/YAML output and PIG_NON_INTERACTIVE=1 make sudo non-interactive; if elevation requires a password, the command fails without waiting for input.

Bootstrap stages

  1. On Debian 12/13, check and attempt to repair the en_US.UTF-8 locale.
  2. Check that Ansible runs and that its Python environment provides yaml, jmespath, and either cryptography or OpenSSL.
  3. Prepare the selected offline repository. If Ansible is unusable, install controller dependencies and check it again.
  4. Check helper tools, prepare key-based SSH to 127.0.0.1 for the invoking administrator, and attempt to initialize a missing ~/pigsty.

PIG prepares a selected or discovered offline repository even when Ansible already works. Use this command to stage offline packages on a ready controller.

Source selection and modes

The result records one of four bootstrap modes:

ModeMeaning
readyAnsible was already usable and no offline source needed preparation.
offlineAn explicit, discovered, or existing offline repository was selected.
onlineRegional online repositories were configured to repair the controller.
existingAn online refresh failed under --keep, and existing repository definitions were successfully used as a fallback.

PIG selects a source as follows:

  • --path accepts a local archive or an HTTP(S) URL. URL credentials are rejected, and a bad explicit source is a hard error rather than an online fallback.
  • An automatically discovered /tmp/pkg.tgz must be a regular, non-group/world-writable file owned by root or the invoking sudo user. Unsafe candidates are ignored with a warning.
  • A complete /www/pigsty repository takes precedence over a selected package. If both exist, the existing repository is reused and the package is left untouched with a warning.
  • Archives are downloaded and extracted by Pig itself. If /www does not exist, Pig creates /data/nginx and the expected /www -> /data/nginx symbolic link before committing content.

Offline mode enables only the strict pigsty-local repository. Online mode configures the selected region and installs the node and pigsty controller modules. It reuses or installs Pigsty’s embedded signing key and enables signature checks when key preparation succeeds. If implicit-key preparation fails, it records a warning and continues with the selected Pigsty repositories’ signature checks disabled. With explicit gpgkey or signed-by metadata, failure to prepare the referenced key is fatal; see pig repo.

Repository replacement and recovery

By default, PIG backs up existing definitions before writing new ones. If repository setup or package installation fails, it attempts to restore the backup and reports the result. --keep preserves existing definitions and allows a fallback to them if an online refresh fails.

Ansible installation or validation failure makes the command fail. Incomplete SSH, locale, or Pigsty-directory setup produces warnings.

Options:

  • -r|--region: region, such as default, china, europe
  • -m|--mirror: equivalent to --region china; mutually exclusive with --region
  • -p|--path: offline package file or HTTP(S) URL; an invalid explicit source is a hard error
  • -k|--keep: preserve existing repositories instead of replacing them

Structured output

-o json or -o yaml returns a pig.sty.boot/v2 result with Ansible state, mode, sources, repository recovery results, localhost SSH, Pigsty directory status, and warnings.

See Pigsty offline installation for the offline procedure.

sty conf

Generate an inventory from a template under <PIGSTY_HOME>/conf. The command edits the YAML configuration, validates the complete result, and writes the output atomically with mode 0600.

pig sty conf                         # use conf/meta.yml and write pigsty.yml
pig sty conf -g                      # generate random passwords (recommended)
pig sty conf rich                    # positional mode selects conf/rich.yml
pig sty conf -c ha/full              # equivalent flag form; do not combine both forms
pig sty conf ha/trio --ip 10.0.0.10,10.0.0.11,10.0.0.12
pig sty conf --domain infra.example.com
pig sty conf rich -v 18              # request PostgreSQL 18 for a generic template
pig sty conf -r china -s             # China region, placeholder IP, no admin preflight
pig sty conf -x                       # materialize proxy environment variables
pig sty conf ha/full -g -O ha.yml       # custom owner-only output file
pig sty conf -n --ip 10.0.0.10 -o json

The default mode is meta; pig sty c and pig sty configure are command aliases. Note that -O selects the Inventory output file, while the global lowercase -o selects text, JSON, or YAML command output.

Template and output paths

Template names are relative to <PIGSTY_HOME>/conf. The .yml suffix is optional; for example, use ha/full. Use a relative name without ...

Relative output paths resolve under <PIGSTY_HOME>. Absolute paths are also accepted. The output must be a different file from the template and cannot be a symlink. A parsing, transformation, or validation error leaves the existing output unchanged.

Structural mutations

The command applies these changes to the template:

InputConfiguration change
--ip A,B,...Replaces 10.10.10.10 through 10.10.10.19 with up to ten distinct addresses, in order. Replacements are simultaneous; other VIPs remain unchanged.
no --ipDetects local interfaces. Interactive mode asks when selection is ambiguous; --non-interactive or closed stdin fails with guidance to pass --ip.
--domain NAMEReplaces only the exact i.pigsty token, not names such as cli.pigsty or i.pigsty.cc; NAME must be a valid DNS domain.
small controllerWhen detected CPU count is below four, rewrites node_tune: oltp and pg_conf: oltp.yml to their tiny profiles.
--region REGIONUpdates all.vars.region for non-default regions. china also activates template-provided Docker and pip mirrors, using values already present in the template.
--proxyReads HTTP_PROXY, HTTPS_PROXY, ALL_PROXY, and NO_PROXY, each falling back to its lowercase spelling. Missing HTTP/HTTPS values fall back to ALL_PROXY. Writes non-empty values to all.vars.proxy_env and supplies a default no-proxy list when needed.
--version MAJORUpdates generic templates for PostgreSQL 14-18, or explicit 19 beta, and selects the matching locale. Version-pinned mssql, polar, and pgNN modes keep their template version and report a warning.
--generateGenerates one 24-character value per known credential identifier and consistently replaces its active values and documented placeholders.

An IP mapping that creates a duplicate key fails. PIG warns if a supplied address has no matching placeholder in the template.

For PostgreSQL 19 beta, Pig also enables the beta repository after pgsql when the template contains the expected repository list. Modes below conf/build/ intentionally bypass IP mapping and controller-admin preflight so build templates remain portable.

Active password identifiers are grafana_admin_password, pg_admin_password, pg_monitor_password, pg_replication_password, patroni_password, haproxy_admin_password, minio_secret_key, and etcd_root_password. Generation also covers the documented DBUser.Meta, DBUser.Viewer, S3User.Backup, S3User.Meta, S3User.Data, DBUser.Supa, and Vibe.Coding placeholders. Repeated occurrences of one identifier receive the same generated value.

Options:

  • -c|--conf: template mode, equivalent to positional [mode]; the two forms are exclusive
  • --ip: up to ten distinct comma-separated IPv4 addresses
  • --domain: replace the exact i.pigsty placeholder with a valid DNS domain
  • -v|--version: PostgreSQL major version, 18/17/16/15/14; 19 beta can be specified explicitly
  • -r|--region: upstream repository region, such as default/china/europe
  • -m|--mirror: equivalent to --region china; mutually exclusive with --region
  • -O|--output-file: output config file path, default pigsty.yml
  • -s|--skip: keep the placeholder IP and skip admin SSH/sudo preflight; exclusive with --ip
  • -p|--port: SSH port
  • -x|--proxy: write non-empty proxy environment variables into all.vars.proxy_env
  • -n|--non-interactive: refuse ambiguous IP selection instead of prompting
  • -g|--generate: replace known demo credentials with random 24-character values

Preflight and validation

PIG checks the operating system, package manager, controller resources, SSH, sudo, and Ansible. --port selects the SSH check port. --skip bypasses administrator SSH/sudo preflight and preserves placeholder IPs; other checks still run.

The output must pass inventory validation. If ansible-inventory is available, PIG also uses it to parse the result. Argument, template, and validation errors prevent writing. Issues that allow configuration to continue are reported as warnings.

Structured output

-o json or -o yaml returns pig.sty.configure/v1, including the template, output path, region, IPs, domain, SSH port, PostgreSQL versions, and warnings. Generated passwords are written only to the inventory; the result lists their identifiers.

See the Pigsty configuration guide for the procedure.

sty deploy

sty deploy uses the Inventory source already selected by configuration. -i and PIGSTY_INVENTORY relative paths resolve from the invoking directory; quoted ~/ expands from the user’s home. The selected absolute path is passed with -i, including the default source, while Ansible runs in Pigsty home. A missing source fails without fallback. Deploy still requires a regular file; dynamic source execution remains Ansible’s responsibility.

Deploy Pigsty with the deploy.yml playbook.

pig sty deploy       # run deploy.yml, falling back to install.yml if not found
pig sty d            # short alias
pig sty de           # short alias

This command runs the deploy.yml playbook from your Pigsty installation directory. For backward compatibility, if deploy.yml does not exist but install.yml exists, install.yml is used instead.

The playbook starts immediately, without a confirmation prompt. Review the selected inventory before running it.

sty list

List available Pigsty versions.

pig sty list                     # list recent versions
pig sty list all                 # list all available versions
pig sty list 4                   # list from the latest stable 4.x version onward

A version prefix selects the highest matching stable version as the starting point, using the same completion rule as sty get. Matching respects component boundaries (1.1 does not match 1.10). Exact versions, including prereleases, and latest keep their existing meaning.

sty get

Download the Pigsty source tarball.

pig sty get                      # download latest version
pig sty get 4.5.0       # download the documented Pigsty version
pig sty get -m                   # prefer the pigsty.cc mirror

sty grafana

pig sty grafana (alias gf) manages dashboards through the HTTP API. The optional PATH selects a Grafana root directory, one direct subdirectory, or one dashboard JSON file. The default is <PIGSTY_HOME>/files/grafana.

pig sty grafana info             # check Grafana health, authentication, and basic info
pig sty grafana list             # list all dashboards in the active organization
pig sty grafana boot             # bootstrap Grafana around the existing pigsty dashboards
pig sty grafana init             # load the complete dashboard corpus, then bootstrap
pig sty grafana load [PATH]      # load dashboards selected by a local path
pig sty grafana dump [PATH]      # export remote dashboards into a local path
pig sty grafana clean [PATH]     # delete dashboards selected by a path (--dry-run/--yes)
pig sty grafana lang zh-Hans     # set the organization and current-user language
pig sty grafana style dark       # set the organization and current-user visual style

Select the operation scope

  • list shows all dashboards in the current organization.
  • load creates or updates dashboards by UID from local files and preserves other remote dashboards.
  • boot renames the current organization to Pigsty, stars the existing pigsty dashboard, and makes it the organization and current-user home.
  • init loads the complete dashboard root, then runs boot. Use load for a single folder or file.
  • dump -d DIR exports to a chosen directory. --dir and positional PATH are mutually exclusive.
  • clean PATH deletes remote dashboards declared by that local path. clean --all deletes every dashboard and folder in the current organization.
  • style accepts dark, light, or auto.

Preview the deletion scope, then confirm it:

pig sty grafana clean --dry-run
pig sty grafana clean --yes

Connection and credentials:

OptionDescription
--endpointGrafana origin and optional path prefix (default http://i.pigsty/ui)
--usernameGrafana API username
--passwordGrafana API password (insecure: visible in process arguments and shell history)
--password-fileOwner-only file containing the password (recommended)

Choose --password or --password-file; they are mutually exclusive. Without either option, PIG uses GRAFANA_PASSWORD, then all.vars.grafana_admin_password from the inventory. The HTTP client enforces timeouts and response-size limits, refuses redirects, and verifies TLS certificates by default.

Legacy dashboards and schema v2 resources

load and init accept both classic Grafana dashboard JSON and the resource form whose identity is exactly:

{"apiVersion":"dashboard.grafana.app/v2","kind":"Dashboard","metadata":{"name":"pgsql-overview","namespace":"default"},"spec":{}}

Each format uses its corresponding API:

  • Classic JSON takes its UID from top-level uid and uses the legacy dashboard API.
  • Schema v2 takes its UID from metadata.name, defaults a missing namespace to default, requires an object-valued spec, and uses Grafana’s dashboard resource API.
  • The JSON filename (without .json) must match the resolved UID. Only one local folder layer is allowed; its directory name becomes the Grafana folder UID.
  • For schema v2, PIG preserves spec and the grafana.app/message annotation, sets grafana.app/folder from the local folder, and deliberately removes server-managed metadata/status before upsert.
  • dump preserves schema v2 only when the target file already exists locally in v2 form; it then fetches the native v2 resource using that file’s namespace. A new dump target defaults to classic JSON. Local-only files are never deleted by dump.

Other dashboard.grafana.app/* versions are unsupported. To preserve v2 format during export, keep the existing local v2 file.

Design records

10 - pig inventory

Inspect, edit, validate, check, and exchange the Pigsty Inventory

pig inventory (alias pig inv) inspects, edits, and validates the Pigsty inventory, pigsty.yml. It also checks deployment prerequisites and exchanges configuration with PostgreSQL through the experimental cmdb commands.

When you edit a fragment, PIG preserves the YAML content and formatting outside that fragment. Before saving, it parses the complete file again. If parsing fails or another process has changed the original file, PIG keeps the original and reports an error.

CommandAliasDescription
inv statusInspect the active inventory source (without executing)
inv listlsList inventory topology and value kinds (--depth)
inv showShow verbatim inventory YAML (may contain secrets)
inv editeEdit the inventory or one fragment in $EDITOR
inv validatevValidate one complete static Pigsty inventory
inv checkckCheck inventory, controller, and target readiness
inv diffCompare declarations of two inventories (value-free)
inv cmdbExchange with the PostgreSQL CMDB (experimental)

Use global -i, --inventory to select the inventory or -H, --home to select the Pigsty directory. Without these options, PIG resolves the source from its configuration and the Pigsty directory. Commands support structured results with -o json or -o yaml, except show, which always prints the selected YAML verbatim.

Source selection

PIG selects the first configured source in this order. If a selected source is missing or invalid, PIG reports that problem instead of falling through to another inventory.

PrioritySourceBase for a relative path
1-i, --inventory PATHCurrent working directory
2PIGSTY_INVENTORYCurrent working directory
3inventory in ~/.pig/config.ymlResolved Pigsty home
4[defaults] inventory in the Pigsty home’s ansible.cfgDirectory containing ansible.cfg
5pigsty.ymlResolved Pigsty home

PIG expands ~/ before resolving the path, including a quoted path in ansible.cfg. pig inv status reports the selected source without executing it. Static Inventory operations require a supported YAML source. pig do can forward a directory or executable inventory to Ansible; pig sty deploy requires a regular file. Both pass the resolved path explicitly to Ansible, so it cannot silently select a different default.

Quick Start

pig inventory status                     # which inventory source is active?
pig inventory list                       # browse the inventory topology
pig inventory edit pg-meta               # edit only the pg-meta cluster fragment
pig inventory validate                   # full validation
pig inventory check -p ssh --sudo        # add SSH/sudo readiness probes
pig inventory diff /path/other.yml       # compare declarations with another file

inv status / list / show

pig inv status                          # show the active path and source type
pig inv list --depth 2                  # limit topology depth
pig inv list pg-meta                    # inspect one cluster's structure
pig inv show pg-meta                    # print the cluster YAML verbatim

status inspects the source without executing a dynamic inventory. list shows groups, hosts, keys, and value types. show prints actual values, including any passwords in the selected configuration. Adding -o json does not change its YAML output.

Selectors

list / show / edit accept an optional selector that addresses one fragment:

pig inv e                                # the whole inventory
pig inv e vars                           # all.vars global parameters
pig inv e pg-meta                        # one cluster group
pig inv e pg-meta.vars.pg_databases      # a nested key path
pig inv e 'pg-meta.hosts["10.10.10.10"]' # dotted keys (e.g. IPs) via quoted brackets

inv edit

Open the selected fragment in $EDITOR. After you save and exit, PIG restores the indentation and newline style, parses the complete document, checks for concurrent changes, and replaces the original file atomically. If parsing fails, PIG keeps the temporary file so you can correct it.

pig inventory edit                       # edit the whole inventory
pig inv e pg-meta                        # edit one fragment
pig inv e vars --from vars.yml           # replace the fragment from a file (or stdin: -)
OptionDescription
--fromReplace the selected fragment from a regular file or stdin (-), skipping the editor

The saved file belongs to the current user. PIG removes group and other permissions, usually producing mode 0600, and preserves stricter owner-only permissions. The structured result’s mode_tightened field reports this change.

inv validate

Validates one complete static Pigsty inventory: YAML structure, Ansible conventions, and Pigsty semantics (such as admin_ip, the infra group, and IPv4 host keys) are checked layer by layer; diagnostics never echo sensitive values.

pig inventory validate                   # validate the active inventory
pig inv v ./pigsty.yml                   # validate a specific file
pig inv v --strict                       # treat warnings as failures
pig inv v --ansible                      # cross-check with ansible-inventory
pig inv v --strict -o json               # structured output (CI-friendly)
OptionDescription
--strictTreat validation warnings as failures
--ansibleAlso parse with ansible-inventory
--timeoutTimeout for --ansible compatibility validation (default 10s)

Validation follows Pigsty’s configuration rules, including requirements for admin_ip, the infra group, and host addresses. The file must contain one YAML document with no duplicate keys. These parsing rules also apply to show and edit.

pg_users[].roles accepts role names and objects containing name, optional state (grant, revoke, absent), and nullable boolean admin, set, and inherit. Editing, serialization, and CMDB YAML export preserve strings that look like YAML 1.1 scalars, including "1:30", "010", dates, and timestamps supplied as strings. Necessary quotes prevent downstream YAML consumers from changing their types. Existing unquoted or explicitly tagged timestamps retain their source bytes and use the opaque unknown scalar kind; quote them when a string is intended. show and explicit CMDB exports retain their raw-data contract.

inv check

Readiness checks on top of static validation: by default only the inventory and local controller conditions are checked; add probes with --profile.

pig inventory check                      # inventory + controller basics
pig inv ck -p ansible                    # add ansible environment checks
pig inv ck -p network                    # add network reachability probes
pig inv ck -p ssh --user admin           # add SSH login probes
pig inv ck -p ssh --sudo                 # SSH probes plus sudo -n validation
OptionShortDescription
--profile-pAdditional probes: ansible / network / ssh
--userExplicit SSH user (defaults to the controller user)
--portTCP/SSH target port (default 22)
--sudoWith the ssh profile, also observe sudo -n true

--user and --port use explicit arguments or the defaults above. They do not infer effective SSH variables from the inventory. Combine profiles with commas, for example --profile ansible,ssh.

inv diff

Compare the active inventory with another file. The result lists added, removed, and changed declarations by path and value type, without configuration values:

pig inv diff other.yml
pig inv diff other.yml -o json

inv cmdb (experimental)

pig inventory cmdb exchanges the inventory with Pigsty’s existing CMDB schema (files/cmdb.sql, the pigsty / pglog schemas) over a native PostgreSQL driver. Connection resolution: -d/--database (database name, URI, or libpq conninfo) → METADB_URL environment variable → service=meta.

SubcommandDescription
checkRead-only: verify CMDB projections, optionally against the static inventory
initApply the cmdb.sql baseline (confirmation required over existing schemas; --plan previews)
loadReplace all CMDB declaration rows from the static inventory (one transaction; confirmation required; --plan/--strict)
dumpExport the CMDB as a static inventory file (--force to overwrite a differing target)
enableSwitch the ansible.cfg inventory to the CMDB (inventory.sh)
disableSwitch back to the static pigsty.yml (both support --plan)
pig inventory cmdb check                 # verify CMDB state
pig inventory cmdb init --plan           # preview the init plan
pig inventory cmdb load -y               # load the static inventory into the CMDB
pig inventory cmdb dump -f pigsty.yml    # export the CMDB as a static inventory
pig inventory cmdb enable                # switch the ansible inventory source to the CMDB
pig inventory cmdb disable               # switch back to the static pigsty.yml

init runs cmdb.sql and replaces existing pigsty / pglog schemas. Back up data you need to retain before running it. load replaces all declaration rows in one transaction. Interactive mode asks you to confirm the target; use --yes for automation and structured output. Use --plan to inspect the operation first.

Design records

11 - pig do

Run Pigsty administration tasks with pig do

pig do runs administration playbooks from the selected Pigsty directory. It uses the inventory to add clusters, create databases and users, install packages, or remove services.

Define the target configuration in the inventory first, then run the corresponding command. The commands invoke Ansible directly. This command group has no general --plan mode.

pig do pgsql-add  pg-test 10.10.10.12     # add one PostgreSQL instance
pig do pgsql-rm   pg-test 10.10.10.12     # remove one PostgreSQL instance
pig do pgsql-db   pg-meta app             # create or update a database
pig do pgsql-user pg-meta dbuser_app      # create or update a user
pig do node-pkg   pg-meta restic          # install a package on selected nodes
pig do redis-add  redis-meta              # initialize a Redis cluster

Inventory selection is shared with sty deploy. PIG passes the resolved source to Ansible without interpreting it again relative to Pigsty home. Missing explicit, environment, or default sources fail before playbook execution. Existing directory and executable Inventory sources remain Ansible inputs; static Inventory commands do not execute them.

Command overview

CommandPurposeRequired arguments
pgsql-addAdd a PostgreSQL cluster or instancescluster, optional IPs
pgsql-rmRemove a PostgreSQL cluster or instancescluster, optional IPs
pgsql-dbApply a database declarationcluster, database
pgsql-userApply a user declarationcluster, user
pgsql-extInstall extensions through Pigstycluster, optional extensions
pgsql-hbaRefresh PostgreSQL HBA rulescluster
pgsql-svcRefresh PostgreSQL service definitionscluster
pgmon-add / pgmon-rmAdd or remove a remote monitoring targetcluster
node-add / node-rmAdd or remove selected nodesone or more selectors
node-repoConfigure repository modules on selected nodesoptional selector and modules
node-pkgInstall or update packages on selected nodesselector, optional packages
repo-buildRebuild the Pigsty infrastructure repositorynone
redis-add / redis-rmAdd or remove Redis clusters, nodes, or instancesselector, optional ports

Run pig do COMMAND --help for the aliases and exact examples of one operation.

PostgreSQL operations

pig do pgsql-add pg-meta                  # initialize the declared cluster
pig do pgsql-add pg-test 10.10.10.12      # add one declared replica
pig do pgsql-rm pg-test 10.10.10.13       # remove one instance
pig do pgsql-rm pg-test --uninstall       # also uninstall packages during removal
pig do pgsql-db pg-meta meta              # create or update database meta
pig do pgsql-user pg-meta dbuser_view     # create or update a user
pig do pgsql-ext pg-meta postgis vector   # install extension packages
pig do pgsql-hba pg-meta                  # refresh pg_hba rules
pig do pgsql-svc pg-meta                  # refresh PostgreSQL services

pgsql-db and pgsql-user apply existing pg_databases and pg_users declarations. They do not edit the inventory. pgsql-rm --uninstall also removes packages. Omit this option if the host still needs those packages.

Name rules

ObjectAccepted names
PostgreSQL clusterLetters, digits, and hyphens; start with a letter or digit. root, all, and ungrouped are reserved.
PostgreSQL userUp to 63 characters; start with a lowercase letter or _, then use lowercase letters, digits, _, @, ., or -. postgres is reserved.
DatabaseUp to 63 characters; start with a letter or _, then use letters, digits, _, @, ., or -.

These rules apply to arguments that require a cluster, user, or database name. Selector arguments support the target-selection forms below.

Node and repository operations

Selectors may be cluster names, host names, IP addresses, or another selector form supported by the Pigsty playbook. Their meaning comes from the active Inventory.

pig do node-add pg-test                    # add nodes selected by cluster
pig do node-rm 10.10.10.13                 # remove one selected node
pig do node-repo pg-meta node,infra        # configure selected repo modules
pig do node-pkg pg-meta openssh restic     # install or update packages
pig do repo-build                          # rebuild the infra repository

With no selector, node-repo applies to every host targeted by node.yml. With no module, it uses the Inventory setting. Repository modules come from the installed Pigsty release, such as local, infra, pgsql, node, and extra. Check that the required repositories are available to the target nodes before installing packages.

Redis operations

pig do redis-add redis-meta                # initialize a declared Redis cluster
pig do redis-add 10.10.10.11 6379 6380     # add selected instances
pig do redis-rm 10.10.10.11 6379           # remove one selected instance
pig do redis-rm redis-test --uninstall     # remove and uninstall packages

redis-rm --uninstall also removes packages during node or cluster removal.

Configuration and output

pig do uses the global PIG options:

OptionPurpose
-H, --homeSelect the Pigsty home directory
-i, --inventorySelect the Pigsty Inventory
-o, --outputChoose text, JSON, YAML, or pretty JSON result wrapping
--log-level, --log-pathConfigure PIG diagnostics

Structured mode reports the requested operation and captured execution result. The underlying Ansible and playbook behavior is still determined by the installed Pigsty release.

See the Pigsty documentation for full playbook variables and procedures.

12 - pig postgres

Manage local PostgreSQL server with pig postgres subcommand

pig postgres (alias pig pg) manages local PostgreSQL instances and databases. Use it to initialize or control an instance, run SQL, maintain tables, and create database copies. Use pig pt for Patroni cluster operations and pig pitr for recovery with pgBackRest.

Commands run as the PostgreSQL operating-system user, normally postgres. Install PostgreSQL first. For a new data directory, make its parent writable by that user or create an empty directory with the correct ownership before running pg init.

Command Overview

Instance control:

CommandAliasDescriptionNotes
pg initinitdb, iInitialize data directoryWraps initdb
pg startboot, upStart PostgreSQLWraps pg_ctl start
pg stophalt, downStop PostgreSQLWraps pg_ctl stop
pg restartrebootRestart PostgreSQLWraps pg_ctl restart
pg reloadhupReload configurationWraps pg_ctl reload
pg statusst, statShow service statusShows processes & related services
pg promoteproPromote replica to primaryWraps pg_ctl promote
pg rolerDetect instance roleOutputs primary/replica

Connection & Query:

CommandAliasDescriptionNotes
pg psqlsql, connectConnect to databaseWraps psql
pg psactivity, actShow current connectionsQueries pg_stat_activity
pg killkTerminate connectionsDefault dry-run mode
pg cloneClone a single databaseCREATE DATABASE ... TEMPLATE ...

Database Maintenance:

CommandAliasDescriptionNotes
pg vacuumvac, vcVacuum tablesRuns SQL VACUUM
pg analyzeana, azAnalyze tablesRuns SQL ANALYZE
pg freezeFreeze vacuumRuns SQL VACUUM (FREEZE)
pg repackrpOnline table repackingRequires pg_repack extension

Parameter Tuning:

CommandAliasDescriptionNotes
pg tunetuningGenerate PostgreSQL tuning parametersAuto-detects hardware and supports structured output

Instance Fork:

CommandAliasDescriptionNotes
pg forkShortcut for fork initCreates a managed fork by default, does not start it
pg fork initcreateCreate a local one-off physical copyDefault /pg/data-<name>
pg fork listList managed forksScans /pg/data-*
pg fork startStart an existing forkSupports managed names or unmanaged --dst-data directories
pg fork stopStop an existing forkSupports shutdown mode
pg fork rmremove, deleteRemove a forkRunning forks require --stop

Log Tools:

CommandAliasDescriptionNotes
pg loglLog managementParent command
pg log listlsList log files
pg log tailt, fReal-time log viewingtail -f
pg log showcat, cOutput log content
pg log lessvi, vView with less
pg log grepg, searchSearch logs

Service Subcommand (pg svc, also pg service or pg s):

CommandAliasDescription
pg svc startboot, upStart postgres service
pg svc stophalt, dn, downStop postgres service
pg svc restartreboot, rtRestart postgres service
pg svc reloadrl, hupReload postgres service
pg svc statusst, statShow service status

Connect to an instance

For a running instance at /pg/data, check its status and connect:

pig pg status -D /pg/data
pig pg psql -D /pg/data

Use the instance’s actual data directory. In psql, run SQL commands, then type \q to exit. To install PostgreSQL and create a test instance, follow Getting Started.

Global Options

These options apply to all pig pg subcommands:

OptionShortDefaultDescription
--version-vauto-detectPostgreSQL major version
--data-D/pg/data for instance operationsData directory path
--dbsu-UpostgresPostgreSQL operating-system user; $PIG_DBSU overrides the default

Use pig pg svc ... to control the postgres systemd unit. Use the instance commands (start, stop, and so on) to operate on -D with pg_ctl, defaulting to /pg/data. An explicit empty or whitespace-only -D / --data is a parameter error; it does not select a default target.

When -D is explicitly supplied, psql, ps, kill, vacuum, analyze, freeze, and repack connect to that directory’s instance, including database enumeration for --all. Before using its recorded port and socket, PIG verifies that the PID is live and identifies a PostgreSQL process. Missing, stale, invalid, or mismatched metadata and unknown process identity fail before a SQL client runs, without falling back to another connection target. Without -D, these SQL commands retain native client connection defaults and any PGHOST/PGPORT visible to the client; PIG does not add host or port arguments or bind the connection to /pg/data. To explicitly target a TCP-only instance, use the native client with connection options. pg clone and pg fork retain their separate port options.

Plans, confirmation retries, and verification commands for promote, vacuum, and repack preserve the selected data directory, PostgreSQL version, and operating-system user. This includes an explicit -D /pg/data; omitting -D continues to preserve native SQL connection defaults. VACUUM FULL plans report confirmation as required, matching execution. Generated maintenance commands put the database name after --, so a name such as --all cannot become an option when the command is copied and executed.

PIG_NON_INTERACTIVE=1 and JSON/YAML output disable prompt stdin and use non-interactive sudo. Native passthrough retains its interaction contract; explicit data input such as psql -f - remains available.

Version Detection Logic:

  1. If -v specified, use that version
  2. Otherwise read from PG_VERSION file in data directory
  3. Otherwise use the default PostgreSQL installation found by PIG.

Service Control Commands

pg init

Initialize PostgreSQL data directory. Wraps initdb.

  • Use an empty directory, or a path that the database operating-system user can create.
  • Data checksums are enabled. Use -K to disable them.
  • Encoding is UTF8. PostgreSQL 17+ uses the built-in C.UTF-8 locale. Earlier versions use the system C.UTF-8 locale when available, otherwise C.
  • An initialized directory requires --force, which removes its existing data after confirmation. A running instance cannot be overwritten. If its running state cannot be verified, initialization fails before removal and reports the probe error instead of claiming that PostgreSQL is running.
  • Put extra initdb arguments after --. To choose another locale or encoding, run initdb directly.
pig pg init                       # Initialize with defaults
pig pg init -v 18                 # Specify PostgreSQL 18
pig pg init -D /data/pg18         # Specify data directory
pig pg init -K                    # Disable data checksums
pig pg init -f                    # Force init (remove existing data)
pig pg init -- --waldir=/wal      # Pass extra args to initdb

Options:

OptionShortDefaultDescription
--no-data-checksums-KfalseDisable data checksums
--force-ffalseRemove an initialized directory and initialize it again
--yes-yfalseSkip overwrite confirmation when used with --force

pg start

Start PostgreSQL with pg_ctl start. For a Patroni-managed instance, prefer pig pt start so PostgreSQL starts under Patroni. For a systemd-managed PostgreSQL service, use pig pg svc start.

pig pg start                      # Start with defaults
pig pg start -D /data/pg18        # Specify data directory
pig pg start -l /pg/log/pg.log    # Redirect output to log file
pig pg start -O "-p 5433"         # Pass options to postgres
pig pg start -o json              # Structured JSON output

Options:

OptionShortDescription
--log-lStartup log; default /tmp/pig-pg-start.log
--timeout-tWait timeout: $PGCTLTIMEOUT, then 60 seconds
--no-waitDon’t wait for startup completion
--options-OOptions to pass to postgres

If PostgreSQL is already running, the command prints the existing postmaster PID and returns successfully.

pg stop

Stop PostgreSQL with pg_ctl stop.

On a Patroni-managed instance, stopping PostgreSQL directly can make Patroni restart it or initiate failover. Use pig pt svc stop to stop the manager first, then check the PostgreSQL state.

pig pg stop                       # Fast shutdown (default)
pig pg stop -m smart              # Wait for clients to disconnect
pig pg stop -m immediate          # Immediate shutdown
pig pg stop --plan                # Preview stop plan

Options:

OptionShortDefaultDescription
--mode-mfastShutdown mode: smart/fast/immediate
--timeout-t60Wait timeout in seconds; $PGCTLTIMEOUT overrides the default
--no-waitfalseDon’t wait for shutdown completion
--planfalsePreview local pg_ctl stop plan only

Shutdown Modes:

ModeDescription
smartWait for all clients to disconnect
fastRollback active transactions, disconnect clients, clean shutdown
immediateTerminate all processes immediately, requires recovery on next start

pg restart

Restart PostgreSQL server.

pig pg restart                    # Fast restart
pig pg restart -m immediate       # Immediate restart
pig pg restart -O "-p 5433"       # Restart with new options
pig pg restart --plan             # Preview restart plan

Options: Same as pg stop, plus --options (-O) to pass to postgres.

pg reload

Reload PostgreSQL configuration. Sends SIGHUP signal to server.

pig pg reload                     # Reload configuration
pig pg reload -D /data/pg18       # Specify data directory

pg status

Show the selected instance’s state:

pig pg status
pig pg status -D /data/pg18
pig pg status -D /data/pg18 -o json

Text output includes pg_ctl status, a compact pg_controldata summary, processes owned by the database operating-system user, and related services. The postgres row reflects the selected instance’s process state. Service rows cover patroni, pgbouncer, vip-manager, and haproxy.

Structured output describes the selected instance, including its data directory, version, PID, port, and available control-file information.

A missing process or a PID independently identified as a different executable is stale. EPERM alone never proves that PostgreSQL has stopped. If process identity cannot be established, the state remains unknown and cannot authorize forced initialization or PITR restore. Plans report an indeterminate running-state check as unknown, without a usable PID or a passed precondition. pg status returns 130201 (exit 3) for permission failures and 130808 (exit 1) for other status-probe failures, such as invalid PID metadata or unavailable process identity. These results have success: false; their partial data does not establish that PostgreSQL is stopped. Stale PIDs no longer make PIG report an unrelated process as PostgreSQL; pg_ctl and PostgreSQL retain their own lock-file checks and may still require operator cleanup after a crash. A PID file copied from another directory does not identify the selected instance.

pg promote

Timeline reporting uses the selected instance’s port and socket. If its PID metadata cannot be resolved, PIG reads that directory’s control data or leaves the timeline unknown. This does not change promotion execution or its primary-role success check.

Promote a standby or a paused recovery instance to a writable primary. Use --plan to inspect the action. Text mode requests confirmation; structured execution requires --yes.

pig pg promote                    # Promote replica
pig pg promote -D /data/pg18      # Specify data directory
pig pg promote --plan             # Preview promotion plan
pig pg promote -y                 # Skip confirmation prompt

Options:

OptionShortDescription
--timeout-tWait timeout: $PGCTLTIMEOUT, then 60 seconds
--no-waitDon’t wait for promotion completion
--planPreview promotion plan only
--yes-ySkip confirmation prompt

pg role

Detect PostgreSQL instance role (primary or replica).

pig pg role                       # Output: primary, replica, or unknown
pig pg role -V                    # Verbose output, show detection process
pig pg role -D /data/pg18         # Specify data directory

Options:

OptionShortDescription
--verbose-VShow detailed detection process

Output:

  • primary: Current instance is primary
  • replica: Current instance is replica
  • unknown: Cannot determine instance role

Detection Strategy (by priority):

  1. Target process detection: Read the selected postmaster.pid, then inspect only that postmaster’s process tree
  2. Bound SQL query: Use the selected instance’s port/socket and verify data_directory before trusting pg_is_in_recovery()
  3. Data directory check: Check for standby.signal, recovery.signal, recovery.conf files

File-based role detection does not establish whether PostgreSQL is running. A stopped instance can still report its configured role, but a stale PID file never makes it appear alive. If the running-state probe fails, the command returns an error instead of reporting a role as verified.

Connection & Query Commands

pg psql

Connect to PostgreSQL database via psql.

pig pg psql                       # Connect to postgres database
pig pg psql mydb                  # Connect to specific database
pig pg psql mydb -c "SELECT 1"    # Execute single command
pig pg psql -f script.sql         # Execute SQL script file

Options:

OptionShortDescription
--command-cExecute single SQL command
--file-fExecute SQL script file

With -D, PIG reads that directory’s postmaster.pid as the selected operating-system user. It verifies the live process before connecting to the recorded port and Unix socket. A stopped or uncertain target returns an error. Without -D, psql retains its native connection defaults and any PGHOST/PGPORT visible to it.

For -o json or -o yaml, specify -c or -f; interactive psql uses text mode.

pg ps

Show PostgreSQL current connections. Queries pg_stat_activity view.

pig pg ps                         # Show client connections
pig pg ps -a                      # Show all connections (including system)
pig pg ps -u admin                # Filter by user
pig pg ps -d mydb                 # Filter by database

Options:

OptionShortDescription
--all-aShow all connections (including system)
--user-uFilter by user
--database-dFilter by database

pg kill

Terminate PostgreSQL connections. Default is dry-run mode, requires -x to execute.

pig pg kill                       # Show connections to be terminated (dry-run)
pig pg kill -x                    # Actually terminate connections
pig pg kill --pid 12345 -x        # Terminate specific PID
pig pg kill -u admin -x           # Terminate user's connections
pig pg kill -d mydb -x            # Terminate database connections
pig pg kill -s idle -x            # Terminate idle connections
pig pg kill --cancel -x           # Cancel queries instead of terminating
pig pg kill --watch 5 -x          # Repeat every 5 seconds
pig pg kill --plan                # Preview connection termination plan

Options:

OptionShortDescription
--execute-xActually execute (default is dry-run)
--pidTerminate specific PID
--user-uFilter by user
--database-dFilter by database
--state-sFilter by state (idle/active/idle in transaction)
--query-qFilter by query pattern
--all-aInclude non-client background processes
--cancel-cCancel queries instead of terminating
--watchRepeat every N seconds
--planPreview execution plan without terminating connections

--state accepts known connection states, including idle in transaction (quote values with spaces). --query matches query text without case sensitivity. A positive --pid selects that process and takes precedence over other filters. Without filters, the command selects other client sessions; --all also includes non-client backends.

pg clone

Create a database copy in the same instance. The command terminates sessions on the source database before copying, so schedule it when that interruption is acceptable. It uses CREATE DATABASE ... TEMPLATE; PostgreSQL 15+ adds STRATEGY FILE_COPY. PostgreSQL 14 is also supported with its default copy strategy.

pig pg clone meta                       # Clone meta as meta_1/meta_2/...
pig pg clone meta meta_fork            # Clone to a specific database name
pig pg clone meta meta_fork --owner dba # Try to change new database owner
pig pg clone meta meta_fork --port 5433 # Connect to a specific local port
pig pg clone meta meta_fork --plan      # Preview clone plan

Options:

OptionShortDescription
--portPostgreSQL port, default 5432 or $PG_PORT
--conn-dbConnection database: postgres, or template1 when cloning postgres
--ownerTry to change the owner of the cloned database
--conn-limitConnection limit for the new database (-1 unlimited, 0 disallow connections)
--planShow execution plan only
--yes-ySkip confirmation prompt

On PostgreSQL 18+ with file_copy_method=clone and a compatible filesystem, the copy can use copy-on-write (CoW). Otherwise it uses an ordinary copy. Use pg fork to copy an entire instance. Filesystem preflight runs as the selected database system user, including for a private 0700 data directory. Text mode requests confirmation; structured execution requires --yes.

Database Maintenance Commands

The [dbname] operand of vacuum, analyze, freeze, and repack accepts a database name. Values containing = or starting with postgres:// or postgresql:// are rejected as connection strings before planning, confirmation, or execution; errors do not echo the value. With --all, vacuum, analyze, and freeze validate the full database list before any maintenance runs. Use the native client when you need a connection string. Spaces and non-ASCII database names remain supported. For names beginning with -, put all options first and use -- before the name, for example pig pg vacuum --full --plan -- --all previews the single database named --all.

pg vacuum

Run SQL VACUUM through psql. The default database is postgres.

pig pg vacuum                     # Vacuum the postgres database
pig pg vacuum mydb                # Vacuum specific database
pig pg vacuum -a                  # Vacuum all databases
pig pg vacuum mydb -t mytable     # Vacuum specific table
pig pg vacuum mydb --schema myschema -t mytable  # Vacuum one table in a schema
pig pg vacuum mydb --full         # VACUUM FULL (requires exclusive lock)

Options:

OptionShortDescription
--all-aProcess all databases
--schemaSpecify schema
--table-tSpecify table
--verbose-VVerbose output
--full-FVACUUM FULL (requires exclusive lock)
--planShow the operation without executing it
--yes-ySkip VACUUM FULL confirmation

For vacuum and freeze, combine --schema with --table to select a table. To process a whole schema, use native vacuumdb --schema SCHEMA.

--full rewrites tables and needs an exclusive lock. Text mode asks for confirmation; structured execution requires --yes.

pg analyze

Run SQL ANALYZE through psql to update planner statistics. The default database is postgres.

pig pg analyze                    # Analyze the postgres database
pig pg ana                        # Alias
pig pg analyze mydb               # Analyze specific database
pig pg analyze -a                 # Analyze all databases
pig pg analyze mydb -t mytable    # Analyze specific table

Options:

OptionShortDescription
--all-aProcess all databases
--schemaSpecify schema
--table-tSpecify table
--verbose-VVerbose output

pg freeze

Run SQL VACUUM (FREEZE) through psql to freeze old transaction IDs. The default database is postgres.

pig pg freeze                     # Freeze the postgres database
pig pg freeze mydb                # Freeze specific database
pig pg freeze -a                  # Freeze all databases

Options: Same as pg analyze.

pg repack

Rebuild tables with pg_repack. Install the executable and the extension in each target database. The default database is postgres.

pig pg repack mydb                # Repack all tables in database
pig pg repack -a                  # Repack all databases
pig pg repack mydb -t mytable     # Repack specific table
pig pg repack mydb --schema myschema  # Repack tables in schema
pig pg repack mydb -j 4           # Use 4 parallel jobs
pig pg repack mydb --plan         # Preview target and command without running pg_repack

Options:

OptionShortDescription
--all-aProcess all databases
--schemaSpecify schema
--table-tSpecify table
--verbose-VVerbose output
--jobs-jNumber of parallel jobs (default 1)
--planShow tables to be repacked

Parameter Tuning Commands

pg tune

Generate starting values for memory, parallelism, and WAL settings. PIG uses the PostgreSQL version, CPU count, memory, disk capacity, and selected workload profile. The storage formulas assume SSDs. The command prints recommendations; it does not edit configuration files.

pig pg tune                       # auto-detect hardware, use oltp profile
pig pg tuning                     # alias
pig pg tune -p olap               # use OLAP profile
pig pg tune -p tiny               # for small instances
pig pg tune -c 8 -m 32768 -d 500  # override hardware detection
pig pg tune -C 500                # override max_connections
pig pg tune -R 0.30               # adjust shared_buffers ratio
pig pg tune -o json               # structured JSON output
pig pg tune -o yaml               # structured YAML output

Options:

OptionShortDefaultDescription
--profile-poltpTuning profile: oltp / olap / tiny / crit
--cpu-c0CPU cores, 0 means auto-detect
--mem-m0Total memory in MB, 0 means auto-detect
--disk-d0Data disk size in GB, 0 means auto-detect
--max-conn-C0Override max_connections, 0 uses profile default
--shmem-ratio-R0.25Fraction of memory used for shared_buffers, range 0.1 ~ 0.4

Profiles:

ProfileBest forCharacteristics
oltpGeneral transactional workloadsBalanced connection count, cache, and parallelism
olapAnalytical workloadsMore aggressive parallelism and work memory
tinySmall instancesConstrained memory footprint and parallelism
critLatency-sensitive workloadsRestricts parallel gather and favors stable response time

Notes:

  • Generated parameters are automatically gated by PostgreSQL major version. For example, io_workers is only emitted for PG 18+.
  • Text output includes a success message. Copy only the parameter assignments into your configuration; do not redirect the complete output into a PostgreSQL config file.
  • For scripts, use -o json and read data.parameters. Review the values, apply them through your configuration workflow, then reload or restart PostgreSQL as required.

Instance Fork

pg fork

Create a local one-off PostgreSQL physical copy for temporary analysis, troubleshooting, recovery validation, and development testing. Managed forks are written to /pg/data-<name> by default and are not registered with Pigsty, systemd, or Patroni. When --dst-data is specified explicitly, the command creates an unmanaged fork that is not enumerated by fork list.

pig pg fork dev                       # Create /pg/data-dev, do not start
pig pg fork init dev --start          # Create and start, probing ports from 15432
pig pg fork init dev -s --dst-port 15433    # Create and start on specified port
pig pg fork init dev -D /pg/data2 --src-port 15431  # Specify source dir and source port
pig pg fork init dev --dst-data /tmp/dev    # Create unmanaged fork
pig pg fork list                      # List managed forks
pig pg fork start dev                 # Start existing managed fork
pig pg fork stop dev                  # Stop existing managed fork
pig pg fork rm dev --stop             # Stop and remove a running fork
pig pg fork init dev --plan           # Show execution plan only

Create Options:

OptionShortDefaultDescription
--dst-data/pg/data-<name>Unmanaged target data directory
--dst-portauto-detectTarget port, probes free ports starting at 15432
--src-data/pg/data or $PG_DATASource data directory; can also be set globally with pg -D/--data
--src-port5432 or $PG_PORTSource port
--start-sfalseStart the fork after creation
--force-ffalseOverwrite an existing stopped target directory and skip confirmation
--timeout-t60Startup wait timeout in seconds
--yes-yfalseSkip confirmation prompt
--planfalseShow execution plan only

Management Commands:

CommandCommon OptionsDescription
pig pg fork list-o json/yamlList managed forks with optional structured output
pig pg fork start <name> or --dst-data <dir>--dst-data, --dst-port, -t/--timeout, --planStart existing fork
pig pg fork stop <name> or --dst-data <dir>--dst-data, -m/--mode, -t/--timeout, --planStop existing fork
pig pg fork rm <name> or --dst-data <dir>--dst-data, --stop, -m/--mode, -t/--timeout, -f/--force, -y/--yes, --planRemove fork; running forks require --stop

Behavior Notes:

  • When the source instance is running, the command uses PostgreSQL low-level backup APIs to create a consistent physical copy; when the source is stopped, it can perform a cold copy.
  • The command prefers CoW/reflink. If only ordinary copy is available, interactive mode warns about disk-space risk and waits for confirmation.
  • The target cannot be /, /pg, source PGDATA, or a parent/child of source PGDATA. Symlinks are resolved before checking the source/destination relationship. /pg/data follows the same ownership, relationship, and runtime checks as other data directories.
  • Replacing a nonempty unmanaged target requires valid unmanaged pg_fork metadata in fork.json with an explicitly recorded target.data matching the directory. An arbitrary directory without PG_VERSION is not eligible for deletion. Missing, damaged, incomplete, or mismatched metadata is refused. An empty directory remains usable with --force. Managed forks must be replaced by name. A running or uncertain destination cannot be replaced. Forced removal by name still permits cleanup of a managed orphan under /pg/data-<name>.
  • Path validation resolves private directories as DBSU when the caller cannot traverse them; unresolved paths and source/destination aliases are refused.
  • Unmanaged fork removal checks an inaccessible target as the selected DBSU. The target must be a real directory; a symlink or failed check still prevents removal.
  • After copy, runtime and replication state is cleaned from the fork and fork.json is written. The new instance starts only when -s|--start is specified.
  • Managed forks must be managed by name. Unmanaged forks require --dst-data when starting, stopping, or removing.

List Forks:

pig pg fork list scans /pg/data-*, reads fork.json, and refreshes each managed fork’s runtime state. Text output shows NAME, PORT, STATE, PID, AGE, SOURCE, COPY, and DATA; state is reported as running, stopped, orphan, or unknown. Unknown state sets runtime_unknown: true in structured output without claiming that the fork has started. Lifecycle operations fail without rewriting metadata in that state.

JSON and YAML put fork records in the result’s data array. Records include source and target endpoints, copy and backup metadata, management commands, and PIG build metadata.

Structured Output:

pig pg fork init dev --plan -o yaml
pig pg fork list -o json

Log Commands

Log commands view PostgreSQL log files. Default log directory is /pg/log/postgres, can be changed via --log-dir.

Log Command Global Options:

OptionDescription
--log-dirLog directory path (default: /pg/log/postgres)
--lines / -nNumber of lines to show, default 50
--follow / -fFollow latest log, only on parent pg log

If the log directory is not readable, PIG retries through sudo. Use pg log -o json or pg log show -o json for JSONL snapshots. Snapshots do not support YAML or json-pretty; tail, less, and grep use text output.

pg log

Show the latest log snapshot; with -f, follow the latest log.

pig pg log                        # Show latest 50 lines
pig pg log -n 100                 # Show latest 100 lines
pig pg log -f                     # Follow latest log

pg log list

List log files in log directory.

pig pg log list                              # List logs in default directory
pig pg log list --log-dir /var/log/postgres  # List logs in specified directory

pg log tail

Real-time log viewing (like tail -f). Default views latest CSV log file.

pig pg log tail                   # View latest log
pig pg log t                      # Alias
pig pg log f                      # Alias
pig pg log tail postgresql.csv    # View specific log file
pig pg log tail -n 100            # Show last 100 lines then follow
pig pg log tail --log-dir /var/log/postgres  # Use custom directory

Options:

OptionShortDefaultDescription
--lines-n50Number of lines to show
--follow-ffalseAccepted for compatibility; tail always follows

pg log show

Output log file content.

pig pg log show                   # Output latest log
pig pg log cat                    # Alias for show
pig pg log c                      # Alias for show
pig pg log show -n 100            # Output last 100 lines
pig pg log show postgresql.csv    # Output specific log file

Options:

OptionShortDefaultDescription
--lines-n50Number of lines to show

pg log less

Open log file with less. Defaults to end of file (+G).

pig pg log less                   # Open latest log with less
pig pg log vi                     # Alias
pig pg log v                      # Alias
pig pg log less postgresql.csv    # Open specific log file

pg log grep

Search log file content.

pig pg log grep ERROR             # Search for ERROR
pig pg log grep --ignore-case error  # Ignore case
pig pg log grep -C 3 ERROR        # Show context
pig pg log grep ERROR pg.csv      # Search specific log file

Options:

OptionShortDescription
--ignore-caseIgnore case
--context-CShow context lines

pg svc Subcommand

pg svc (also pg service or pg s) controls the postgres systemd unit used by Pigsty. It requires that unit to exist. For distribution units such as postgresql-18 or postgresql@18-main, use systemctl with the actual unit name.

pig pg svc start                 # Start postgres service
pig pg svc stop                  # Stop postgres service
pig pg svc restart               # Restart postgres service
pig pg svc reload                # Reload postgres service
pig pg svc status                # Show service status

Alias Reference:

CommandAlias
pg svc startboot, up
pg svc stophalt, dn, down
pg svc restartreboot, rt
pg svc reloadrl, hup
pg svc statusst, stat

Tools and privileges

PIG uses initdb to initialize data, pg_ctl to control instances, psql for SQL and maintenance, pg_repack to rebuild tables, and system tools to read logs. Use those tools directly for options that this command does not expose.

PostgreSQL commands run directly when you are the selected database operating-system user. From root, PIG uses su; from another account, it uses sudo -H -u. Service management uses root privileges. These commands target Linux; service management requires systemd.

Design records

13 - pig patroni

Run patronictl transparently, with Pigsty service, config, and log helpers

pig patroni (alias pig pt) runs the installed patronictl command. Use it to inspect cluster members, change cluster configuration, and switch the primary. PIG selects the configuration file and provides local service, status, and log commands. Other commands use patronictl’s arguments, prompts, output, and exit codes.

Install Patroni and configure access to its cluster before running cluster operations. Use pig pt COMMAND --help for native command help, or pig pt -- --help for patronictl root help. Running pig pt alone shows PIG’s help.

Command Overview

Forwarded commands (native patronictl):

ExampleDescription
pig pt list [CLUSTER]List cluster members (native output, --format json)
pig pt restart CLUSTER [MEMBER]Restart PostgreSQL of a cluster / member (native prompt)
pig pt reload CLUSTERReload PostgreSQL configuration
pig pt reinit CLUSTER MEMBERReinitialize a member (resync from primary)
pig pt switchover CLUSTER [--candidate X]Planned switchover
pig pt failover CLUSTER --candidate MEMBERManual failover (cluster name comes first)
pig pt pause CLUSTER / pig pt resume CLUSTEREnter / leave maintenance mode
pig pt show-config CLUSTER / pig pt edit-config CLUSTERShow / edit cluster dynamic configuration
pig pt query -c 'select 1'Native query (-c here is query’s own SQL option)

Put the cluster name before member names. These commands use the installed patronictl interface.

Local commands (implemented by PIG):

CommandAliasDescription
pt setUpdate PostgreSQL params or scalar Patroni settings
pt statusstCombined status: systemd + processes + cluster
pt servicesvcManage the local patroni systemd service
pt startupShortcut for pt svc start
pt stopdnShortcut for pt svc stop
pt loglView local Patroni logs (show / tail / grep)

Use pig pt restart CLUSTER to restart PostgreSQL through Patroni. Use pig pt svc restart to restart the local Patroni daemon.

Inspect a cluster

On a configured Patroni node, inspect the cluster members and dynamic configuration. Replace pg-meta with your cluster name:

pig pt list pg-meta
pig pt show-config pg-meta

Use pig pt status to inspect the local service and pig pt log -f to follow its logs.

PIG options

These PIG options must precede the native command; once the native command token appears, all remaining tokens belong to patronictl:

OptionShortDescription
--config-file-cExplicit Patroni/patronictl configuration file
--dbsuOS user used to execute patronictl (default $PIG_DBSU or postgres)
--dcs-url-dOverride the Patroni DCS URL (--dcs is an alias)
--insecure-kAllow TLS without certificate verification
pig pt -c /path/patroni.yml list pg-meta   # PIG -c: config file
pig pt query -c 'select 1'                 # native query -c: SQL

Use the full --dbsu option; pig pt has no -U shorthand.

Config-File Resolution

PIG selects the patronictl configuration file in this order:

  1. explicit -c/--config-file given before the command;
  2. non-empty PATRONICTL_CONFIG_FILE environment variable;
  3. /etc/patroni/patroni.yml (exists and readable as the DBSU);
  4. /infra/conf/patronictl.yml (exists and readable as the DBSU);
  5. otherwise /etc/patroni/patroni.yml; patronictl reports a missing file.

PIG uses an explicit path or environment path even if the file is missing or unreadable. It resolves relative paths before switching operating-system user. It checks the two conventional paths as the selected user. Service commands and native help do not need a configuration file.

Command dispatch and output

PIG handles the local commands listed above. It forwards any other command and every argument after that command to patronictl. Put PIG options before the native command:

pig pt -c /etc/patroni/patroni.yml list pg-meta
pig pt list pg-meta --format json

Native commands keep interactive prompts, editor sessions, streamed output, and exit codes. Use the native --format json option for JSON. PIG’s -o json and -o yaml cannot format these commands and are rejected before the native command token.

Use pig pt -- COMMAND ... to forward a command whose name matches a local command. The local set, status, and service commands support PIG structured output. Log output has the formats described below.

pt set

pt set updates the cluster selected by the configuration file:

pig pt set KEY=VALUE [KEY=VALUE ...] [--yes] [--plan]

Key classification:

  • These scalar Patroni dynamic keys translate to native --set: loop_wait, ttl, retry_timeout, primary_race_backoff, maximum_lag_on_failover, maximum_lag_on_syncnode, max_timelines_history, primary_start_timeout, primary_stop_timeout, synchronous_mode, synchronous_mode_strict, synchronous_node_count, failsafe_mode, check_timeline, member_slots_ttl (pause is deliberately excluded — use native pause/resume);
  • every other key is treated as a PostgreSQL parameter and translates to native --pg (including dotted custom GUCs like timescaledb.telemetry_level);
  • structural keys starting with postgresql., standby_cluster., slots., or ignore_slots. are rejected, pointing to native pig pt edit-config --set.

All pairs merge into one native edit-config call in input order — one configuration diff and one confirmation:

pig pt set ttl=60 max_connections=200 synchronous_mode=on
# equivalent: patronictl -c <selected> edit-config --set ttl=60 --pg max_connections=200 --set synchronous_mode=on
  • --yes/-y appends native --force to skip confirmation; otherwise patronictl shows the diff and owns confirmation;
  • --plan mutates nothing and renders the selected config plus the translated native command (including the values you supplied);
  • in structured output mode, execution requires an explicit --yes;
  • values parse as YAML: both KEY=null and KEY= remove a key, passed unchanged;
  • after changing restart-required PostgreSQL parameters, PIG suggests the follow-up: first pig pt list, then pig pt restart CLUSTER --pending (explicit cluster required).

Service Management

pt service (alias pt svc) manages the local patroni systemd unit:

CommandAliasDescription
pt service startpt svc upStart the Patroni service
pt service stoppt svc dnStop the Patroni service
pt service restartpt svc rsRestart the Patroni service
pt service reloadpt svc rlReload the Patroni service
pt service statuspt svc stShow service status

pt start / pt stop (aliases up / dn) call the same service actions. Stopping the Patroni service may also stop PostgreSQL on this node (depending on Patroni configuration).

pt status

Shows combined status: systemd service state, Patroni process info, and cluster members from patronictl.

pig pt status
pig pt st -o json                # structured output

pt log

View local Patroni logs. The log directory comes from log.dir in the selected config, falling back to /pg/log/patroni, or set it explicitly with --log-dir. Only pt log and pt log show support -o json (JSONL snapshot); -f, tail, and grep use text output. Log snapshots do not support YAML or json-pretty.

pig pt log                     # show last 50 lines
pig pt log -f                  # follow log output
pig pt log -n 100              # show last 100 lines
pig pt log show -o json        # JSONL snapshot
pig pt log tail -n 100         # follow logs
pig pt log grep ERROR          # search logs
SubcommandAliasesDescription
showcat, c, sPrint recent Patroni logs
tailt, f, followFollow Patroni logs
grepg, searchSearch Patroni logs
OptionShortDefaultDescription
--follow-ffalseFollow log output
--lines-n50Lines for show/tail; grep searches all lines unless -n is set
--log-dirautoLog directory

Migrating from v1.5.x

When upgrading from v1.5.x, update older scripts to use patronictl syntax:

v1.5.x usagev1.6.0 usage
pig pt failover <candidate>pig pt failover CLUSTER --candidate MEMBER (the positional is now the cluster)
pig pt restart [member] (auto scope)pig pt restart CLUSTER [MEMBER] (explicit cluster)
pig pt list -o jsonpig pt list --format json (native JSON, different schema)
pig pt config showpig pt show-config
pig pt config editpig pt edit-config
pig pt config set K=V / pg K=Vpig pt set K=V
pig pt restart -y (PIG confirmation)native patronictl confirmation; pt set -y still works
pig pt list -W / -w 5native pig pt list --watch (patronictl semantics)
aliases ls/rs/rl/ri/so/fo/p/r/cremoved — use full native command names
--dbsu -U--dbsu (-U shorthand removed)

Requirements and privileges

Service commands require Linux and systemd. Log commands need readable Patroni log files. PIG runs patronictl as the operating-system user selected by --dbsu, then $PIG_DBSU, then postgres. It executes directly as that user, uses su from root, or uses sudo -H -u from another account. Service management uses root privileges.

Design record

Let Patronictl Speak for Itself records why PIG stopped mirroring the upstream command tree and which local responsibilities remain.

14 - pig pe

Read PostgreSQL metrics and reload pg_exporter configuration

Use pig pe to read metrics from a running pg_exporter and reload its configuration. The full command name is pig pg_exporter. Aliases are pe, pgexp, and pgexporter.

pig pe get                     # Show PostgreSQL metrics
pig pe list                    # List PostgreSQL metric families
pig pe stat                    # Show exporter statistics
pig pe reload                  # Reload exporter configuration

Select an exporter

The default endpoint is http://127.0.0.1:9630. Use these options to select another instance:

OptionDefaultDescription
--host127.0.0.1Host name or IPv4 address
-p, --port9630HTTP port
pig pe --host pg-meta -p 9630 stat
pig pe --host 10.10.10.10 get

PIG uses HTTP and the standard /metrics, /stat, and /reload paths. For HTTPS, authentication, client certificates, or a custom path, use an HTTP client such as curl.

pe get

Read /metrics. Print samples whose names start with pg_, plus their Prometheus HELP and TYPE lines.

pig pe get
pig pe --host pg-meta get

To include process and runtime metrics that do not start with pg_, read the complete endpoint:

curl -fsS http://127.0.0.1:9630/metrics

pe list

Read /metrics. Print one HELP line for each pg_ metric family in the response. The list reflects the exporter’s current configuration.

pig pe list

pe stat

Read /stat and print its response. The response format depends on the installed pg_exporter version.

pig pe stat

pe reload

After editing the exporter’s configuration, request a reload through /reload:

pig pe reload

Output and errors

Use -o json or -o yaml for a PIG result that contains the command’s text output. Prometheus metrics remain text inside that result.

Network errors, response-read errors, and HTTP 4xx/5xx responses return a nonzero exit code. HTTP error details contain the status code and standard description, without the response body. Successful responses retain the filtering or raw text behavior described above.

To install pg_exporter, use pig ext add pg-exporter. Configure and start the exporter before using pig pe; these commands access its HTTP API.

15 - pig pgbackrest

Create, inspect, restore, and expire pgBackRest backups

pig pgbackrest (alias pig pb) creates backups, restores data, and manages pgBackRest stanzas. It runs pgBackRest as the PostgreSQL operating-system user, selected by --dbsu or $PIG_DBSU (default postgres).

Before the first backup, install pgBackRest and configure the stanza and repository in pgbackrest.conf. A stanza groups the backup configuration for one PostgreSQL cluster. In PostgreSQL, enable archive_mode and set archive_command to call pgBackRest.

Use pig pitr when recovery must also stop Patroni and PostgreSQL, then restart PostgreSQL. Use pig pb restore when you manage those steps yourself.

Command Overview

Information Query:

CommandAliasDescriptionImplementation
pb infoiShow backup repository infopgbackrest info
pb listlsList backup sets, repos, and stanzaspgbackrest info and configuration

Backup & Restore:

CommandAliasDescriptionImplementation
pb backupbCreate backuppgbackrest backup
pb restorerRestore backup filespgbackrest restore
pb expireeClean up expired backupspgbackrest expire

Stanza Management:

CommandAliasDescriptionImplementation
pb createcCreate stanza (first-time setup)pgbackrest stanza-create
pb upgradeuUpgrade stanza after PG major upgradepgbackrest stanza-upgrade
pb deletedDelete stanza and its backupspgbackrest stanza-delete

Control Commands:

CommandAliasDescriptionImplementation
pb checkckCheck stanza configuration and WAL archivingpgbackrest check
pb startupEnable pgBackRest operationspgbackrest start
pb stopdwDisable pgBackRest operationspgbackrest stop
pb loglView logslatest log snapshot / tail

Create the first backup

After configuring pgBackRest and WAL archiving, create the stanza and check the configuration:

pig pb create
pig pb check

If the check succeeds, create a full backup and inspect it:

pig pb backup full
pig pb info

Global Options

These options apply to all pig pb subcommands:

OptionShortDescription
--stanza-spgBackRest stanza name (auto-detected)
--config-cConfig file path
--repo-rRepository number (multi-repo scenario)
--dbsu-UPostgreSQL operating-system user (default: $PIG_DBSU or postgres)

Stanza Auto-Detection:

If -s is not specified, PIG detects the stanza name from the config file:

  1. Read the config file (default /etc/pgbackrest/pgbackrest.conf)
  2. Find sections that do not start with [global*]
  3. Use the first stanza found

If the config file contains multiple stanzas, PIG emits a warning and uses the first one. In that case, specify --stanza explicitly.

Multi-Repo Support:

pgBackRest supports multiple repositories (repo1, repo2, etc.). Use -r to choose the target repository:

pig pb backup -r 1                   # Backup to repo1
pig pb backup -r 2                   # Backup to repo2
pig pb info -r 2                     # View repo2 backup info

Information Commands

pb info

Show detailed backup repository information, including all backup sets and WAL archive status.

pig pb info                          # Show all backup info
pig pb info --raw --raw-output json  # Raw JSON output
pig pb info --set 20250101-120000F   # Show details for a specific backup set

Options:

OptionShortDescription
--raw-RRaw output mode (passes through pgBackRest output)
--raw-outputRaw output format: text, json (only in --raw mode)
--setShow details for a specific backup set

pb ls

List resources in the backup repository.

pig pb ls                            # List all backups (default)
pig pb ls backup                     # List all backups (explicit)
pig pb ls repo                       # List configured repos
pig pb ls stanza                     # List all stanzas

Types:

TypeDescriptionData Source
backupList all backup sets (default)pgbackrest info
repoList configured reposParse pgbackrest.conf
stanzaList all stanzasParse pgbackrest.conf

Backup Commands

pb backup

Create a physical backup. PIG checks that the local instance is a primary before running pgBackRest.

pig pb backup                        # Auto mode
pig pb backup full                   # Full backup
pig pb backup diff                   # Differential backup
pig pb backup incr                   # Incremental backup
pig pb backup --force                # Skip primary role check

Options:

OptionShortDescription
--force-fSkip primary role check

Backup Types:

TypeDescription
(empty)Use pgBackRest configuration; by default, incremental, or full when no full backup exists
fullFull backup: backup all data
diffDifferential backup: changes since the last full backup
incrIncremental backup: changes since the last backup of any type

A replica, stopped instance, or unknown role fails this check. Use --force only when you intend to delegate role handling to your pgBackRest configuration. It skips the PIG check; pgBackRest still applies its own backup requirements.

pb expire

Remove backups and WAL archives according to the configured retention policy. Use an exact backup label with --set; this also expires backups that depend on that set. WAL retention still applies during this operation. See the pgBackRest expire reference.

pig pb expire                        # Clean up per policy
pig pb expire --set 20250101-120000F       # Delete a specific backup set
pig pb expire --set 20250101-120000F -y    # Skip confirmation when deleting backup set
pig pb expire --plan                 # Preview cleanup plan only, do not delete

Options:

OptionShortDescription
--setDelete a specific backup set
--planPreview cleanup plan only, do not delete backups
--yes-ySkip confirmation prompt when used with --set

--plan runs a pgBackRest dry run. With structured output, the PIG plan includes the dry-run output when it is available. Review that output to see the affected backups.

Retention Policy:

Retention policy is configured in pgbackrest.conf:

[global]
repo1-retention-full=2               # Full backups to retain
repo1-retention-diff=4               # Differential backups to retain
repo1-retention-archive=2            # WAL archive retention policy

Restore Commands

pb restore

Restore backup files into the target data directory. PostgreSQL must be stopped. Select exactly one recovery target: -d, -I, -t, --name, --lsn, or --xid. A missing target returns an error; text mode also shows help.

# Recovery target (mutually exclusive options)
pig pb restore -d                    # Restore to latest (explicit)
pig pb restore -I                    # Restore to backup consistency point
pig pb restore -t "2025-01-01 12:00:00+08"  # Restore to specific time
pig pb restore -t "2025-01-01"       # Restore to date (00:00:00 that day)
pig pb restore -t "12:00:00"         # Restore to time (today)
pig pb restore --name my-savepoint   # Restore to named restore point
pig pb restore --lsn "0/7C82CB8"     # Restore to LSN
pig pb restore --xid 12345           # Restore to transaction ID

# Backup set selection (must combine with a recovery target)
pig pb restore -b 20251225-120000F -d  # Restore from specific backup set to latest

# Other options
pig pb restore -t "2025-01-01 12:00:00+08" -X           # Exclusive mode (stop before target)
pig pb restore -t "2025-01-01 12:00:00+08" --target-action=promote  # Promote after reaching target
pig pb restore -t "2025-01-01 12:00:00+08" -T current   # Recover along current timeline
pig pb restore -d --plan             # Preview restore plan only
pig pb restore -d -y                 # Skip interactive y/yes confirmation
pig pb restore -d -- --delta         # Pass native pgBackRest restore args after --

Recovery Target Options:

OptionShortDescription
--default-dRestore to end of WAL stream (latest data)
--immediate-IRestore to backup consistency point
--time-tRestore to specific timestamp
--nameRestore to named restore point
--lsnRestore to specific LSN
--xidRestore to specific transaction ID

Backup Set and Other Options:

OptionShortDescription
--set-bRestore from a specific backup set (can combine with target)
--data-DTarget data directory
--exclusive-XExclusive mode: stop before target
--target-actionAction after reaching recovery target: pause/promote/shutdown
--target-timeline-TRecovery timeline: latest/current/N/0xN
--planPreview restore plan only, do not execute
--yes-ySkip interactive y/yes confirmation
Native args after --Pass through pgBackRest restore args, for example -- --delta

Combination Rules: --target-action cannot be used with --default, because --default already means recovery to the end of the WAL stream. --exclusive/-X must be used with an explicit stop target: --time, --lsn, or --xid.

Set the target, data directory, stanza, repository, and config through PIG options. PIG rejects native arguments that would override them, including --repoN-* and --recovery-option. Pass other restore options after --, for example --delta, --tablespace-map, --link-map, or --link-all. Use -- --delta to restore over an existing data directory with checksum-based file reuse.

Time Formats:

Supports multiple time formats and auto-completes timezones (including non-integer-hour zones such as +05:30):

FormatExampleDescription
Full format2025-01-01 12:00:00+08Complete timestamp with timezone
Date only2025-01-01Auto-completes to 00:00:00 that day (current timezone)
Time only12:00:00Auto-completes to today (current timezone)

Restore Flow:

  1. Validate parameters and environment
  2. Check that PostgreSQL is stopped
  3. Show restore plan and wait for interactive y/yes confirmation
  4. Execute pgbackrest restore
  5. Provide post-restore guidance

For a standalone instance at /pg/data, inspect the plan, stop the instance, then restore:

pig pb restore -D /pg/data -t "2025-01-01 12:00:00+08" --plan
pig pg stop -D /pg/data
pig pb restore -D /pg/data -t "2025-01-01 12:00:00+08" -- --delta
pig pg start -D /pg/data
pig pg psql -D /pg/data

For another path, pass the same -D to each command. Verify the recovered data before promotion. When Patroni is active for the managed directory, pb restore refuses the operation; use pig pitr.

Text mode asks for y or yes before restore. In scripts with -o json or -o yaml, add --yes to execute, or use --plan to inspect the operation.

Stanza Management Commands

pb create

Initialize a new stanza. Must run before the first backup.

pig pb create                        # Create stanza
pig pb create --no-online            # Create when PostgreSQL is not running
pig pb create --force                # Force create

Options:

OptionShortDescription
--no-onlineCreate when PostgreSQL is not running
--force-fForce create

pb upgrade

Update stanza after a PostgreSQL major version upgrade.

pig pb upgrade                       # Upgrade stanza
pig pb upgrade --no-online           # Upgrade when PostgreSQL is not running

Options:

OptionDescription
--no-onlineUpgrade when PostgreSQL is not running

Use Case:

After a PostgreSQL major version upgrade (for example, 16 -> 17), run this command to update stanza metadata.

pb delete

Delete a stanza and all its backups.

pig pb delete                        # Delete stanza (interactive y/N confirmation)
pig pb delete --yes                  # Skip interactive y/yes confirmation
pig pb delete --plan                 # Preview delete plan

Options:

OptionShortDescription
--planPreview delete plan only, do not execute
--yes-ySkip interactive y/yes confirmation

Deletion permanently removes the selected stanza’s backups. In text mode, enter y or yes to confirm, or use --yes. Structured execution requires --yes. When the configuration has several stanzas, select one with --stanza.

Control Commands

pb check

Check stanza configuration, repository access, and WAL archiving.

pig pb check                         # Check configuration and archiving

This command checks:

  • WAL archive configuration correctness
  • Repository accessibility
  • Stanza configuration validity

check does not read every backup file to verify its contents. Use pgBackRest verify when you need backup and archive checksum verification.

pb start

Enable pgBackRest operations.

pig pb start                         # Enable operations

Use this command after pb stop to resume normal operations.

pb stop

Disable pgBackRest operations for maintenance.

pig pb stop                          # Disable operations
pig pb stop --force                  # Terminate running operations

Options:

OptionShortDescription
--force-fTerminate running operations

Use Case:

Use this command during system maintenance to prevent new backup operations from starting.

Log Commands

pb log

View pgBackRest log files. The log directory is read from pgBackRest config log-path first, and falls back to /pg/log/pgbackrest/ when not configured. The parent command shows the latest log snapshot by default; use tail or -f for live follow. Only pb log and pb log show support -o json JSONL output; log snapshots do not support yaml or json-pretty, and follow/tail does not support structured output.

pig pb log                           # Show latest log lines
pig pb log list                      # List log files
pig pb log tail                      # Real-time view latest log
pig pb log tail -n 100               # Show last 100 lines and follow
pig pb log show                      # Show latest log content
pig pb log show -n 50                # Show last 50 lines
pig pb log cat                       # Alias for show

Subcommands:

SubcommandAliasesDescription
listlsList log files
showcat, cShow latest log content
tailt, f, followReal-time follow latest log

Options:

OptionShortDefaultDescription
--lines-n50Number of lines to show
--follow-ffalseFollow with pb log; pb log tail always follows

Permission Handling:

If the current user does not have permission to read the log directory, the command automatically retries with sudo.

Paths and privileges

SettingDefault
Configuration file/etc/pgbackrest/pgbackrest.conf
Log directoryConfigured log-path, then /pg/log/pgbackrest
Restore data directory--data, configured pg1-path, $PGDATA, then /pg/data

PIG runs pgBackRest directly when the current user is the selected database operating-system user. From root, it uses su; from another account, it uses sudo -H -u. The user must be able to read the configuration and access the data and repository paths.

These commands use Linux and Pigsty defaults. Set the configuration path and stanza explicitly for other layouts. For pgBackRest operations without a PIG command, run pgbackrest directly.

Design record

PIG’s Operations CLI Safety Contract explains the boundary between the low-level pb restore primitive and the orchestrated pig pitr workflow.

16 - pig pitr

Restore PostgreSQL to a selected recovery target with pgBackRest

Use pig pitr to restore a local PostgreSQL instance from pgBackRest backups. For a managed restore, PIG stops services as needed and restores the data. By default, it then starts PostgreSQL and leaves Patroni stopped for you to verify the recovered database.

Recovery replaces data in the target directory. Start with --plan to check the directory, backup source, recovery target, and service actions.

Before recovery

You need an installed pgBackRest, a readable configuration file, a usable backup, and the archived WAL needed to reach the target. The default config path is /etc/pgbackrest/pgbackrest.conf. Select another file with -c and a stanza with -s.

Run the commands on the host that contains the target data directory. PIG runs PostgreSQL and pgBackRest operations as --dbsu, then $PIG_DBSU, then postgres. Service operations require root privileges, directly or through sudo.

Taskpig pitrpig pb restore
Stop Patroni for a managed restoreAutomatic if activeOperator stops it
Stop PostgreSQLChecks and stops itRequires it to be stopped
Restore backup filespgBackRestpgBackRest
Start PostgreSQLAutomatic unless --no-restartOperator starts it
Return the instance to PatroniOperator verifies and resumes managementOperator handles it

Use pig pb restore when you want to manage service shutdown and startup yourself.

Quick start

This example restores an existing managed data directory to a chosen time. Replace the timestamp with your recovery target:

# Inspect available backups
pig pb info

# Check the recovery plan
pig pitr -t "2025-01-15 09:30:00+08" --plan -- --delta

# Restore the data and start PostgreSQL
pig pitr -t "2025-01-15 09:30:00+08" -- --delta

# Connect to the recovered instance; use its actual data directory
pig pg psql -D /pg/data

--delta lets pgBackRest restore over an existing directory by comparing file checksums. PIG asks for y or yes before recovery. Use --yes for execution without a prompt.

For a time, name, LSN, transaction ID, or immediate target, PostgreSQL normally pauses when it reaches the target. Inspect the data before promotion. See post-recovery actions.

Parameters

Recovery target

Choose exactly one target. Without a target, PIG returns an error and shows help in text mode.

OptionShortDescription
--default-dRecover to the end of available WAL
--immediate-IRecover to the backup consistency point
--time-tRecover to a timestamp
--nameRecover to a named restore point
--lsnRecover to an LSN, such as 0/7C82CB8
--xidRecover to a positive transaction ID

--set selects a backup; it does not select a recovery target.

Backup and target options

OptionShortDescription
--set-bBackup label from pig pb info
--target-actionAction at the target: pause, promote, or shutdown
--target-timeline-TTimeline: latest, current, a positive integer, or 0xHEX
--exclusive-XStop before a time, LSN, or transaction ID target

Use --no-restart with --target-action=shutdown. Start PostgreSQL manually when you are ready for WAL replay; it will shut down after reaching the target.

--target-action cannot be combined with --default. --exclusive requires --time, --lsn, or --xid.

Flow control

OptionShortDefaultDescription
--no-restartfalseLeave PostgreSQL stopped after restoring files
--planfalseInspect the plan without changing data or services
--yes-yfalseSkip confirmation
--timeout120Startup and recovery wait timeout, in seconds
--force-stopfalseAllow immediate shutdown and process termination if fast shutdown fails

Configuration

OptionShortDefault or source
--stanza-sFirst stanza in the config file; specify it when several exist
--config-c/etc/pgbackrest/pgbackrest.conf
--repo-rRepository selected by pgBackRest
--dbsu-UPostgreSQL operating-system user: $PIG_DBSU, then postgres
--data-DTarget directory; configured pg1-path, then $PGDATA, then /pg/data

Native restore options

Put extra pgBackRest arguments after --:

pig pitr -d -- --delta

Use PIG flags for the recovery target, data directory, config, stanza, and repository. Arguments that override these settings are rejected, including --repoN-* and --recovery-option. Other restore options, such as --delta, --tablespace-map, --link-map, and --link-all, can be forwarded.

Time format

PIG fills in missing date or timezone fields using the local date and timezone:

FormatExampleInterpretation
Full timestamp2025-01-01 12:00:00+08Explicit date, time, and timezone
No timezone2025-01-01 12:00:00Local timezone; a T separator also works
Date only2025-01-01Midnight on that date
Time only12:00:00That time today

Use a full timestamp with timezone in scripts. Plans and suggested follow-up commands expand short forms to a full timestamp so that rerunning the command keeps the same target.

Managed directory and side restore

The managed directory comes from pg1-path in the selected stanza, then $PGDATA, then /pg/data. It must already contain an initialized PostgreSQL instance. An explicit -D that resolves to this same path is still a managed restore, including a symlink to it.

An explicit -D that resolves to a different path selects a side restore. PIG leaves Patroni and the managed instance alone. The side directory must exist, belong to the selected operating-system user, and be writable by that user. It can be empty.

The -D option selects only the data directory. If the backup contains tablespaces or external links, map them to separate paths. Add pgBackRest’s --tablespace-map and --link-map options after -- in the restore command.

A side restore requires --no-restart. The restored configuration retains the original port; start it manually with a free port:

# Prepare the directory as root or through sudo
sudo install -d -m 700 -o postgres -g postgres /tmp/pg-restore

# Restore backup files into the side directory
pig pitr -d -D /tmp/pg-restore --no-restart

# Start the side instance on a free port
pig pg start -D /tmp/pg-restore -O "-p 5433"
pig pg psql -D /tmp/pg-restore

pig pg psql -D reads the restored directory’s postmaster.pid to select its port and socket. It returns an error if it cannot resolve that instance.

Execution flow

  1. Validate options, configuration, target directory, stanza health, and available backups. If --set is given, check that the backup label exists.
  2. Show the operation and request confirmation, unless --yes is given.
  3. For a managed restore, stop an active Patroni service.
  4. Wait for PostgreSQL to stop, then retry fast shutdown if needed. Use --force-stop to allow immediate shutdown and a final process-termination attempt.
  5. Run pgbackrest restore.
  6. Start PostgreSQL unless --no-restart is given. For --default or --target-action=promote, wait until pg_is_in_recovery() is false. For other targets, verify recovery progress yourself.
  7. Print commands for data verification and the remaining recovery steps.

Declining confirmation or reaching EOF returns CodePITRConfirmationRequired (161001, exit status 7) before stopping Patroni or PostgreSQL, restoring data, or starting PostgreSQL.

An indeterminate PostgreSQL runtime state is an error, not proof that the instance is stopped. PIG will not restore over an unverified instance or use an unverified PID for forced termination. After restoration, an unknown runtime state cannot count as successful startup and prevents follow-up SQL checks against an unverified connection target.

--plan runs the prechecks and returns the planned actions. It needs access to the configuration, data directory, and backup repository, but does not stop services or restore data.

More examples

Run one recovery command for the target you need:

# Latest available state, restoring over an existing directory
pig pitr -d -- --delta

# Backup consistency point
pig pitr -I -- --delta

# Use a specific backup label
pig pitr -d -b 20251225-120000F -- --delta

# Restore files, then inspect them before starting PostgreSQL
pig pitr -d --no-restart -- --delta

# Promote automatically after a time target
pig pitr -t "2025-01-15 09:30:00+08" --target-action=promote -- --delta

Post-recovery actions

  1. Connect to the restored instance. Use its actual data directory:

    pig pg psql -D /pg/data
  2. Check recovery state, then verify the tables and records you need:

    SELECT pg_is_in_recovery() AS recovering,
           CASE WHEN pg_is_in_recovery() THEN pg_is_wal_replay_paused() END AS paused;
  3. If recovery is paused at the intended target and you want a writable primary, promote it:

    pig pg promote -D /pg/data
  4. For a Patroni-managed cluster, reconcile the restored instance with the cluster’s recovery plan, then resume Patroni with pig pt svc start. Handle other members and application routing as part of that plan.

If a managed restore fails after stopping Patroni, Patroni stays stopped. The target directory can contain a partial restore. Inspect PostgreSQL and pgBackRest logs, fix the failure, and complete recovery before starting Patroni. A startup timeout also needs investigation; it does not undo the restored files.

Structured output

Use --plan -o json to inspect a structured plan. Use --yes -o json to execute without interaction. YAML is also available.

Successful results include requested_data_dir, effective_data_dir, managed_data_dir, and side_restore in data. Follow-up commands are in the result’s top-level next_actions field.

Design record

PIG’s Operations CLI Safety Contract explains the separate roles of pig pb restore and pig pitr.