Skip to content

pg_living_assertions

Executable SQL checks with verdict dates and assertion history

pg_living_assertions · Executable SQL checks with verdict dates and assertion history

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
5300pg_living_assertionspg_living_assertions0.5.11ADMINApache-2.0SQL
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
----d--NoNoNoYesnono
Relationships
Schemasliving_assertions
Need Bypg_grammar_guard
On-demand SQL checks run in a read-only subtransaction that is always rolled back; not per-write SQL ASSERTION constraints.

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXTPIGSTY0.5.1119 18 17 16 15pg_living_assertions-
RPMPIGSTY0.5.1119 18 17 16 15pg_living_assertions_$v-
DEBPIGSTY0.5.1119 18 17 16 15postgresql-$v-pg-living-assertions-
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 0.5.10PIGSTY 0.5.10PIGSTY 0.5.10PIGSTY 0.5.10
el8.aarch64N/APIGSTY 0.5.10PIGSTY 0.5.10PIGSTY 0.5.10PIGSTY 0.5.10
el9.x86_64PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11
el9.aarch64PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11
el10.x86_64PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11
el10.aarch64PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11
d12.x86_64PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11
d12.aarch64PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11
d13.x86_64PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11
d13.aarch64PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11
u22.x86_64PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11
u22.aarch64PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11
u24.x86_64PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11
u24.aarch64PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11
u26.x86_64PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11
u26.aarch64PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11PIGSTY 0.5.11
PackageVersionOSORGSIZEFile URL
pg_living_assertions_190.5.11el9.x86_64pigsty45.4 KiBpg_living_assertions_19-0.5.11-1PGSTY.el9.noarch.rpm
pg_living_assertions_190.5.11el9.aarch64pigsty45.4 KiBpg_living_assertions_19-0.5.11-1PGSTY.el9.noarch.rpm
pg_living_assertions_190.5.11el10.x86_64pigsty45.5 KiBpg_living_assertions_19-0.5.11-1PGSTY.el10.noarch.rpm
pg_living_assertions_190.5.11el10.aarch64pigsty45.5 KiBpg_living_assertions_19-0.5.11-1PGSTY.el10.noarch.rpm
postgresql-19-pg-living-assertions0.5.11d12.x86_64pigsty40.1 KiBpostgresql-19-pg-living-assertions_0.5.11-1PGSTY~bookworm_all.deb
postgresql-19-pg-living-assertions0.5.11d12.aarch64pigsty40.1 KiBpostgresql-19-pg-living-assertions_0.5.11-1PGSTY~bookworm_all.deb
postgresql-19-pg-living-assertions0.5.11d13.x86_64pigsty40.1 KiBpostgresql-19-pg-living-assertions_0.5.11-1PGSTY~trixie_all.deb
postgresql-19-pg-living-assertions0.5.11d13.aarch64pigsty40.1 KiBpostgresql-19-pg-living-assertions_0.5.11-1PGSTY~trixie_all.deb
postgresql-19-pg-living-assertions0.5.11u22.x86_64pigsty36.7 KiBpostgresql-19-pg-living-assertions_0.5.11-1PGSTY~jammy_all.deb
postgresql-19-pg-living-assertions0.5.11u22.aarch64pigsty36.7 KiBpostgresql-19-pg-living-assertions_0.5.11-1PGSTY~jammy_all.deb
postgresql-19-pg-living-assertions0.5.11u24.x86_64pigsty36.5 KiBpostgresql-19-pg-living-assertions_0.5.11-1PGSTY~noble_all.deb
postgresql-19-pg-living-assertions0.5.11u24.aarch64pigsty36.5 KiBpostgresql-19-pg-living-assertions_0.5.11-1PGSTY~noble_all.deb
postgresql-19-pg-living-assertions0.5.11u26.x86_64pigsty36.5 KiBpostgresql-19-pg-living-assertions_0.5.11-1PGSTY~resolute_all.deb
postgresql-19-pg-living-assertions0.5.11u26.aarch64pigsty36.5 KiBpostgresql-19-pg-living-assertions_0.5.11-1PGSTY~resolute_all.deb
PackageVersionOSORGSIZEFile URL
pg_living_assertions_180.5.10el8.x86_64pigsty45.9 KiBpg_living_assertions_18-0.5.10-1PGSTY.el8.noarch.rpm
pg_living_assertions_180.5.10el8.aarch64pigsty45.9 KiBpg_living_assertions_18-0.5.10-1PGSTY.el8.noarch.rpm
pg_living_assertions_180.5.11el9.x86_64pigsty45.4 KiBpg_living_assertions_18-0.5.11-1PGSTY.el9.noarch.rpm
pg_living_assertions_180.5.11el9.aarch64pigsty45.4 KiBpg_living_assertions_18-0.5.11-1PGSTY.el9.noarch.rpm
pg_living_assertions_180.5.11el10.x86_64pigsty45.5 KiBpg_living_assertions_18-0.5.11-1PGSTY.el10.noarch.rpm
pg_living_assertions_180.5.11el10.aarch64pigsty45.5 KiBpg_living_assertions_18-0.5.11-1PGSTY.el10.noarch.rpm
postgresql-18-pg-living-assertions0.5.11d12.x86_64pigsty40.1 KiBpostgresql-18-pg-living-assertions_0.5.11-1PGSTY~bookworm_all.deb
postgresql-18-pg-living-assertions0.5.11d12.aarch64pigsty40.1 KiBpostgresql-18-pg-living-assertions_0.5.11-1PGSTY~bookworm_all.deb
postgresql-18-pg-living-assertions0.5.11d13.x86_64pigsty40.1 KiBpostgresql-18-pg-living-assertions_0.5.11-1PGSTY~trixie_all.deb
postgresql-18-pg-living-assertions0.5.11d13.aarch64pigsty40.1 KiBpostgresql-18-pg-living-assertions_0.5.11-1PGSTY~trixie_all.deb
postgresql-18-pg-living-assertions0.5.11u22.x86_64pigsty36.7 KiBpostgresql-18-pg-living-assertions_0.5.11-1PGSTY~jammy_all.deb
postgresql-18-pg-living-assertions0.5.11u22.aarch64pigsty36.7 KiBpostgresql-18-pg-living-assertions_0.5.11-1PGSTY~jammy_all.deb
postgresql-18-pg-living-assertions0.5.11u24.x86_64pigsty36.5 KiBpostgresql-18-pg-living-assertions_0.5.11-1PGSTY~noble_all.deb
postgresql-18-pg-living-assertions0.5.11u24.aarch64pigsty36.5 KiBpostgresql-18-pg-living-assertions_0.5.11-1PGSTY~noble_all.deb
postgresql-18-pg-living-assertions0.5.11u26.x86_64pigsty36.5 KiBpostgresql-18-pg-living-assertions_0.5.11-1PGSTY~resolute_all.deb
postgresql-18-pg-living-assertions0.5.11u26.aarch64pigsty36.5 KiBpostgresql-18-pg-living-assertions_0.5.11-1PGSTY~resolute_all.deb
PackageVersionOSORGSIZEFile URL
pg_living_assertions_170.5.10el8.x86_64pigsty45.9 KiBpg_living_assertions_17-0.5.10-1PGSTY.el8.noarch.rpm
pg_living_assertions_170.5.10el8.aarch64pigsty45.9 KiBpg_living_assertions_17-0.5.10-1PGSTY.el8.noarch.rpm
pg_living_assertions_170.5.11el9.x86_64pigsty45.4 KiBpg_living_assertions_17-0.5.11-1PGSTY.el9.noarch.rpm
pg_living_assertions_170.5.11el9.aarch64pigsty45.4 KiBpg_living_assertions_17-0.5.11-1PGSTY.el9.noarch.rpm
pg_living_assertions_170.5.11el10.x86_64pigsty45.5 KiBpg_living_assertions_17-0.5.11-1PGSTY.el10.noarch.rpm
pg_living_assertions_170.5.11el10.aarch64pigsty45.5 KiBpg_living_assertions_17-0.5.11-1PGSTY.el10.noarch.rpm
postgresql-17-pg-living-assertions0.5.11d12.x86_64pigsty40.1 KiBpostgresql-17-pg-living-assertions_0.5.11-1PGSTY~bookworm_all.deb
postgresql-17-pg-living-assertions0.5.11d12.aarch64pigsty40.1 KiBpostgresql-17-pg-living-assertions_0.5.11-1PGSTY~bookworm_all.deb
postgresql-17-pg-living-assertions0.5.11d13.x86_64pigsty40.1 KiBpostgresql-17-pg-living-assertions_0.5.11-1PGSTY~trixie_all.deb
postgresql-17-pg-living-assertions0.5.11d13.aarch64pigsty40.1 KiBpostgresql-17-pg-living-assertions_0.5.11-1PGSTY~trixie_all.deb
postgresql-17-pg-living-assertions0.5.11u22.x86_64pigsty36.7 KiBpostgresql-17-pg-living-assertions_0.5.11-1PGSTY~jammy_all.deb
postgresql-17-pg-living-assertions0.5.11u22.aarch64pigsty36.7 KiBpostgresql-17-pg-living-assertions_0.5.11-1PGSTY~jammy_all.deb
postgresql-17-pg-living-assertions0.5.11u24.x86_64pigsty36.5 KiBpostgresql-17-pg-living-assertions_0.5.11-1PGSTY~noble_all.deb
postgresql-17-pg-living-assertions0.5.11u24.aarch64pigsty36.5 KiBpostgresql-17-pg-living-assertions_0.5.11-1PGSTY~noble_all.deb
postgresql-17-pg-living-assertions0.5.11u26.x86_64pigsty36.5 KiBpostgresql-17-pg-living-assertions_0.5.11-1PGSTY~resolute_all.deb
postgresql-17-pg-living-assertions0.5.11u26.aarch64pigsty36.5 KiBpostgresql-17-pg-living-assertions_0.5.11-1PGSTY~resolute_all.deb
PackageVersionOSORGSIZEFile URL
pg_living_assertions_160.5.10el8.x86_64pigsty45.9 KiBpg_living_assertions_16-0.5.10-1PGSTY.el8.noarch.rpm
pg_living_assertions_160.5.10el8.aarch64pigsty45.9 KiBpg_living_assertions_16-0.5.10-1PGSTY.el8.noarch.rpm
pg_living_assertions_160.5.11el9.x86_64pigsty45.4 KiBpg_living_assertions_16-0.5.11-1PGSTY.el9.noarch.rpm
pg_living_assertions_160.5.11el9.aarch64pigsty45.4 KiBpg_living_assertions_16-0.5.11-1PGSTY.el9.noarch.rpm
pg_living_assertions_160.5.11el10.x86_64pigsty45.5 KiBpg_living_assertions_16-0.5.11-1PGSTY.el10.noarch.rpm
pg_living_assertions_160.5.11el10.aarch64pigsty45.5 KiBpg_living_assertions_16-0.5.11-1PGSTY.el10.noarch.rpm
postgresql-16-pg-living-assertions0.5.11d12.x86_64pigsty40.1 KiBpostgresql-16-pg-living-assertions_0.5.11-1PGSTY~bookworm_all.deb
postgresql-16-pg-living-assertions0.5.11d12.aarch64pigsty40.1 KiBpostgresql-16-pg-living-assertions_0.5.11-1PGSTY~bookworm_all.deb
postgresql-16-pg-living-assertions0.5.11d13.x86_64pigsty40.1 KiBpostgresql-16-pg-living-assertions_0.5.11-1PGSTY~trixie_all.deb
postgresql-16-pg-living-assertions0.5.11d13.aarch64pigsty40.1 KiBpostgresql-16-pg-living-assertions_0.5.11-1PGSTY~trixie_all.deb
postgresql-16-pg-living-assertions0.5.11u22.x86_64pigsty36.7 KiBpostgresql-16-pg-living-assertions_0.5.11-1PGSTY~jammy_all.deb
postgresql-16-pg-living-assertions0.5.11u22.aarch64pigsty36.7 KiBpostgresql-16-pg-living-assertions_0.5.11-1PGSTY~jammy_all.deb
postgresql-16-pg-living-assertions0.5.11u24.x86_64pigsty36.5 KiBpostgresql-16-pg-living-assertions_0.5.11-1PGSTY~noble_all.deb
postgresql-16-pg-living-assertions0.5.11u24.aarch64pigsty36.5 KiBpostgresql-16-pg-living-assertions_0.5.11-1PGSTY~noble_all.deb
postgresql-16-pg-living-assertions0.5.11u26.x86_64pigsty36.5 KiBpostgresql-16-pg-living-assertions_0.5.11-1PGSTY~resolute_all.deb
postgresql-16-pg-living-assertions0.5.11u26.aarch64pigsty36.5 KiBpostgresql-16-pg-living-assertions_0.5.11-1PGSTY~resolute_all.deb
PackageVersionOSORGSIZEFile URL
pg_living_assertions_150.5.10el8.x86_64pigsty45.9 KiBpg_living_assertions_15-0.5.10-1PGSTY.el8.noarch.rpm
pg_living_assertions_150.5.10el8.aarch64pigsty45.9 KiBpg_living_assertions_15-0.5.10-1PGSTY.el8.noarch.rpm
pg_living_assertions_150.5.11el9.x86_64pigsty45.4 KiBpg_living_assertions_15-0.5.11-1PGSTY.el9.noarch.rpm
pg_living_assertions_150.5.11el9.aarch64pigsty45.4 KiBpg_living_assertions_15-0.5.11-1PGSTY.el9.noarch.rpm
pg_living_assertions_150.5.11el10.x86_64pigsty45.5 KiBpg_living_assertions_15-0.5.11-1PGSTY.el10.noarch.rpm
pg_living_assertions_150.5.11el10.aarch64pigsty45.5 KiBpg_living_assertions_15-0.5.11-1PGSTY.el10.noarch.rpm
postgresql-15-pg-living-assertions0.5.11d12.x86_64pigsty40.1 KiBpostgresql-15-pg-living-assertions_0.5.11-1PGSTY~bookworm_all.deb
postgresql-15-pg-living-assertions0.5.11d12.aarch64pigsty40.1 KiBpostgresql-15-pg-living-assertions_0.5.11-1PGSTY~bookworm_all.deb
postgresql-15-pg-living-assertions0.5.11d13.x86_64pigsty40.1 KiBpostgresql-15-pg-living-assertions_0.5.11-1PGSTY~trixie_all.deb
postgresql-15-pg-living-assertions0.5.11d13.aarch64pigsty40.1 KiBpostgresql-15-pg-living-assertions_0.5.11-1PGSTY~trixie_all.deb
postgresql-15-pg-living-assertions0.5.11u22.x86_64pigsty36.7 KiBpostgresql-15-pg-living-assertions_0.5.11-1PGSTY~jammy_all.deb
postgresql-15-pg-living-assertions0.5.11u22.aarch64pigsty36.7 KiBpostgresql-15-pg-living-assertions_0.5.11-1PGSTY~jammy_all.deb
postgresql-15-pg-living-assertions0.5.11u24.x86_64pigsty36.5 KiBpostgresql-15-pg-living-assertions_0.5.11-1PGSTY~noble_all.deb
postgresql-15-pg-living-assertions0.5.11u24.aarch64pigsty36.5 KiBpostgresql-15-pg-living-assertions_0.5.11-1PGSTY~noble_all.deb
postgresql-15-pg-living-assertions0.5.11u26.x86_64pigsty36.5 KiBpostgresql-15-pg-living-assertions_0.5.11-1PGSTY~resolute_all.deb
postgresql-15-pg-living-assertions0.5.11u26.aarch64pigsty36.5 KiBpostgresql-15-pg-living-assertions_0.5.11-1PGSTY~resolute_all.deb

Source

github.com/Manuelreyesbravo/pg_living_assertions

pig build pkg pg_living_assertions;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install pg_living_assertions;		# install by package name

pig install pg_living_assertions -v 19;   # install for PG 19
pig install pg_living_assertions -v 18;   # install for PG 18
pig install pg_living_assertions -v 17;   # install for PG 17
pig install pg_living_assertions -v 16;   # install for PG 16
pig install pg_living_assertions -v 15;   # install for PG 15

Create this extension with:

CREATE EXTENSION pg_living_assertions;

Usage

Sources:

pg_living_assertions 0.5.11 stores named SQL assertions, results and replacement history. Checks run on demand; they are not constraints evaluated on every write. This pure SQL extension needs no preload.

Core Workflow

CREATE EXTENSION pg_living_assertions;
SELECT living_assertions.declare(
  'simple_check', 'one equals one',
  $$SELECT 1 = 1 AS holds, 'arithmetic check'::text AS detail$$);
SELECT living_assertions.run('simple_check');
SELECT name, state, age FROM living_assertions.status;

Operational Boundaries

A check returns one boolean holds and optional text detail. living_assertions.run_all() evaluates the registry; living_assertions.state(), living_assertions.status and living_assertions.stale() distinguish failures, unknown/erroring results and stale or absent checks. living_assertions.declare_unchanged() fingerprints a canonicalized expression; a value disappearing to NULL is broken. Checks run as their recorded author in a read-only, rolled-back subtransaction with the author search path and temporary schemas last. The caller must be allowed to SET ROLE to that author. Session advisory locks acquired during evaluation are released, but external effects and temporary-sequence changes are not a sandboxed resource. Only trusted authors should register SQL. Registration and checks are server-dated, tables reject TRUNCATE, and retirement/replacement is restricted to the author or an authorized role. Upgrade through the complete matching SQL chain; old assertions retain their existing fingerprint algorithm. Current releases use Apache-2.0; releases through 0.5.3 retain their original PostgreSQL License.

Role Isolation in 0.5.10

Version 0.5.10 evaluates a check in a temporary SECURITY DEFINER function owned by its recorded author when role isolation is needed. PostgreSQL then refuses attempts to reset the role or session authorization inside that frame; the frame is created and rolled back with the read-only check. The author needs TEMP on the database when a frame is required, and the caller still needs authority to act as that author. A SECURITY DEFINER caller can now run another author’s checks under that authority. This closes the role-reset escape in 0.5.8/0.5.9; it does not make external effects safe.

Current Compatibility

Version 0.5.11 updates documentation and tested compatibility without changing SQL objects. Upstream records PostgreSQL 11–19 coverage. The supplied 0.5.10-to-0.5.11 SQL update advances the extension version only; keep the earlier role and dependency requirements above.

Table reader