pg_regresql
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_regresql | 2.0.0 | LANG | BSD-2-Clause | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 3230 | pg_regresql | No | Yes | Yes | Yes | No | Yes | - |
| Related | pg_hint_plan hypopg plan_filter auto_explain |
|---|
Activate it with LOAD pg_regresql or session_preload_libraries.
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 2.0.0 | 1817161514 | pg_regresql | - |
| RPM | PIGSTY | 2.0.0 | 1817161514 | pg_regresql_$v | - |
| DEB | PIGSTY | 2.0.0 | 1817161514 | postgresql-$v-pg-regresql | - |
Build
You can build the RPM / DEB packages for pg_regresql using pig build:
pig build pkg pg_regresql # build RPM / DEB packages
Install
You can install pg_regresql directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
pig repo add pgsql -u # Add repo and update cache
Install the extension using pig or apt/yum/dnf:
pig install pg_regresql; # Install for current active PG version
pig ext install -y pg_regresql -v 18 # PG 18
pig ext install -y pg_regresql -v 17 # PG 17
pig ext install -y pg_regresql -v 16 # PG 16
pig ext install -y pg_regresql -v 15 # PG 15
pig ext install -y pg_regresql -v 14 # PG 14
dnf install -y pg_regresql_18 # PG 18
dnf install -y pg_regresql_17 # PG 17
dnf install -y pg_regresql_16 # PG 16
dnf install -y pg_regresql_15 # PG 15
dnf install -y pg_regresql_14 # PG 14
apt install -y postgresql-18-pg-regresql # PG 18
apt install -y postgresql-17-pg-regresql # PG 17
apt install -y postgresql-16-pg-regresql # PG 16
apt install -y postgresql-15-pg-regresql # PG 15
apt install -y postgresql-14-pg-regresql # PG 14
Preload:
shared_preload_libraries = 'pg_regresql';
Create Extension:
CREATE EXTENSION pg_regresql;
Usage
Syntax:
regresql init postgres://localhost/mydb regresql add src/sql/ regresql update regresql testSources: README, Product page
RegreSQL is documented upstream as a language-agnostic SQL regression testing tool for PostgreSQL, not as a CREATE EXTENSION-style in-database module. It discovers .sql files, runs them against PostgreSQL, snapshots expected output, and tracks query plan changes.
Quick Start
The README’s basic workflow is:
regresql init postgres://localhost/mydb
regresql discover
regresql add src/sql/
regresql update
regresql test
This initializes a test suite, discovers query files, creates plan definitions, captures expected output, and runs regression checks.
What It Tracks
The upstream docs emphasize:
- expected query output snapshots
EXPLAINplan baselines- sequential scan warnings
- migration-related query regressions
- CI-oriented output formats such as
junit,json,pgtap, andgithub-actions
Query Files and Plans
RegreSQL works with normal SQL files and supports multiple queries per file using -- name: annotations:
-- name: get-user-by-id
SELECT * FROM users WHERE id = :id;
Plan files provide test parameters:
"1":
id: 42
"2":
id: 100
Snapshots and Migrations
The tool can build and restore database snapshots and compare query behavior across migrations:
regresql snapshot build
regresql snapshot restore
regresql migrate --script db/migrations/001_add_column.sql
Installation
The README documents installation via Homebrew or Go:
brew tap boringsql/boringsql
brew install regresql
or
go install github.com/boringsql/regresql@latest
PostgreSQL client tools such as pg_dump, pg_restore, and psql are required for snapshot commands.
Feedback
Was this page helpful?
Thanks for the feedback! Please let us know how we can improve.
Sorry to hear that. Please let us know how we can improve.