Skip to content

pg_circuit

Runtime observation, warnings and blocking for dangerous SQL statements

pg_circuit : Runtime observation, warnings and blocking for dangerous SQL statements

Overview

ID Extension Package Version Category License Language
5815 pg_circuit pg_circuit 0.1.0 ADMIN Apache-2.0 C
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
--sLd-- No Yes Yes Yes no no
Requires shared_preload_libraries and restart; Community runtime pressure is informational.

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT PIGSTY 0.1.0 18 17 16 15 14 pg_circuit -
RPM PIGSTY 0.1.0 18 17 16 15 14 pg_circuit_$v -
DEB PIGSTY 0.1.0 18 17 16 15 14 postgresql-$v-pg-circuit -
Linux / PG PG18 PG17 PG16 PG15 PG14
el8.x86_64 PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A N/A
el8.aarch64 PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A N/A
el9.x86_64 PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A N/A
el9.aarch64 PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A N/A
el10.x86_64 PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A N/A
el10.aarch64 PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A N/A
d12.x86_64 PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A N/A
d12.aarch64 PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A N/A
d13.x86_64 PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A N/A
d13.aarch64 PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A N/A
u22.x86_64 PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A N/A
u22.aarch64 PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A N/A
u24.x86_64 PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A N/A
u24.aarch64 PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A N/A
u26.x86_64 PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A N/A
u26.aarch64 PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A N/A
Package Version OS ORG SIZE File URL
pg_circuit_18 0.1.0 el8.x86_64 pigsty 102.7 KiB pg_circuit_18-0.1.0-1PGSTY.el8.x86_64.rpm
pg_circuit_18 0.1.0 el8.aarch64 pigsty 101.1 KiB pg_circuit_18-0.1.0-1PGSTY.el8.aarch64.rpm
pg_circuit_18 0.1.0 el9.x86_64 pigsty 100.9 KiB pg_circuit_18-0.1.0-1PGSTY.el9.x86_64.rpm
pg_circuit_18 0.1.0 el9.aarch64 pigsty 100.0 KiB pg_circuit_18-0.1.0-1PGSTY.el9.aarch64.rpm
pg_circuit_18 0.1.0 el10.x86_64 pigsty 101.3 KiB pg_circuit_18-0.1.0-1PGSTY.el10.x86_64.rpm
pg_circuit_18 0.1.0 el10.aarch64 pigsty 100.6 KiB pg_circuit_18-0.1.0-1PGSTY.el10.aarch64.rpm
postgresql-18-pg-circuit 0.1.0 d12.x86_64 pigsty 92.3 KiB postgresql-18-pg-circuit_0.1.0-1PGSTY~bookworm_amd64.deb
postgresql-18-pg-circuit 0.1.0 d12.aarch64 pigsty 91.3 KiB postgresql-18-pg-circuit_0.1.0-1PGSTY~bookworm_arm64.deb
postgresql-18-pg-circuit 0.1.0 d13.x86_64 pigsty 93.5 KiB postgresql-18-pg-circuit_0.1.0-1PGSTY~trixie_amd64.deb
postgresql-18-pg-circuit 0.1.0 d13.aarch64 pigsty 92.2 KiB postgresql-18-pg-circuit_0.1.0-1PGSTY~trixie_arm64.deb
postgresql-18-pg-circuit 0.1.0 u22.x86_64 pigsty 97.3 KiB postgresql-18-pg-circuit_0.1.0-1PGSTY~jammy_amd64.deb
postgresql-18-pg-circuit 0.1.0 u22.aarch64 pigsty 96.7 KiB postgresql-18-pg-circuit_0.1.0-1PGSTY~jammy_arm64.deb
postgresql-18-pg-circuit 0.1.0 u24.x86_64 pigsty 93.8 KiB postgresql-18-pg-circuit_0.1.0-1PGSTY~noble_amd64.deb
postgresql-18-pg-circuit 0.1.0 u24.aarch64 pigsty 93.6 KiB postgresql-18-pg-circuit_0.1.0-1PGSTY~noble_arm64.deb
postgresql-18-pg-circuit 0.1.0 u26.x86_64 pigsty 92.6 KiB postgresql-18-pg-circuit_0.1.0-1PGSTY~resolute_amd64.deb
postgresql-18-pg-circuit 0.1.0 u26.aarch64 pigsty 91.8 KiB postgresql-18-pg-circuit_0.1.0-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pg_circuit_17 0.1.0 el8.x86_64 pigsty 102.7 KiB pg_circuit_17-0.1.0-1PGSTY.el8.x86_64.rpm
pg_circuit_17 0.1.0 el8.aarch64 pigsty 101.1 KiB pg_circuit_17-0.1.0-1PGSTY.el8.aarch64.rpm
pg_circuit_17 0.1.0 el9.x86_64 pigsty 101.0 KiB pg_circuit_17-0.1.0-1PGSTY.el9.x86_64.rpm
pg_circuit_17 0.1.0 el9.aarch64 pigsty 100.1 KiB pg_circuit_17-0.1.0-1PGSTY.el9.aarch64.rpm
pg_circuit_17 0.1.0 el10.x86_64 pigsty 101.4 KiB pg_circuit_17-0.1.0-1PGSTY.el10.x86_64.rpm
pg_circuit_17 0.1.0 el10.aarch64 pigsty 100.6 KiB pg_circuit_17-0.1.0-1PGSTY.el10.aarch64.rpm
postgresql-17-pg-circuit 0.1.0 d12.x86_64 pigsty 92.2 KiB postgresql-17-pg-circuit_0.1.0-1PGSTY~bookworm_amd64.deb
postgresql-17-pg-circuit 0.1.0 d12.aarch64 pigsty 91.0 KiB postgresql-17-pg-circuit_0.1.0-1PGSTY~bookworm_arm64.deb
postgresql-17-pg-circuit 0.1.0 d13.x86_64 pigsty 93.4 KiB postgresql-17-pg-circuit_0.1.0-1PGSTY~trixie_amd64.deb
postgresql-17-pg-circuit 0.1.0 d13.aarch64 pigsty 92.2 KiB postgresql-17-pg-circuit_0.1.0-1PGSTY~trixie_arm64.deb
postgresql-17-pg-circuit 0.1.0 u22.x86_64 pigsty 109.3 KiB postgresql-17-pg-circuit_0.1.0-1PGSTY~jammy_amd64.deb
postgresql-17-pg-circuit 0.1.0 u22.aarch64 pigsty 109.0 KiB postgresql-17-pg-circuit_0.1.0-1PGSTY~jammy_arm64.deb
postgresql-17-pg-circuit 0.1.0 u24.x86_64 pigsty 93.8 KiB postgresql-17-pg-circuit_0.1.0-1PGSTY~noble_amd64.deb
postgresql-17-pg-circuit 0.1.0 u24.aarch64 pigsty 93.7 KiB postgresql-17-pg-circuit_0.1.0-1PGSTY~noble_arm64.deb
postgresql-17-pg-circuit 0.1.0 u26.x86_64 pigsty 92.7 KiB postgresql-17-pg-circuit_0.1.0-1PGSTY~resolute_amd64.deb
postgresql-17-pg-circuit 0.1.0 u26.aarch64 pigsty 92.0 KiB postgresql-17-pg-circuit_0.1.0-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pg_circuit_16 0.1.0 el8.x86_64 pigsty 102.8 KiB pg_circuit_16-0.1.0-1PGSTY.el8.x86_64.rpm
pg_circuit_16 0.1.0 el8.aarch64 pigsty 101.2 KiB pg_circuit_16-0.1.0-1PGSTY.el8.aarch64.rpm
pg_circuit_16 0.1.0 el9.x86_64 pigsty 101.0 KiB pg_circuit_16-0.1.0-1PGSTY.el9.x86_64.rpm
pg_circuit_16 0.1.0 el9.aarch64 pigsty 100.2 KiB pg_circuit_16-0.1.0-1PGSTY.el9.aarch64.rpm
pg_circuit_16 0.1.0 el10.x86_64 pigsty 101.4 KiB pg_circuit_16-0.1.0-1PGSTY.el10.x86_64.rpm
pg_circuit_16 0.1.0 el10.aarch64 pigsty 100.7 KiB pg_circuit_16-0.1.0-1PGSTY.el10.aarch64.rpm
postgresql-16-pg-circuit 0.1.0 d12.x86_64 pigsty 92.3 KiB postgresql-16-pg-circuit_0.1.0-1PGSTY~bookworm_amd64.deb
postgresql-16-pg-circuit 0.1.0 d12.aarch64 pigsty 91.1 KiB postgresql-16-pg-circuit_0.1.0-1PGSTY~bookworm_arm64.deb
postgresql-16-pg-circuit 0.1.0 d13.x86_64 pigsty 93.5 KiB postgresql-16-pg-circuit_0.1.0-1PGSTY~trixie_amd64.deb
postgresql-16-pg-circuit 0.1.0 d13.aarch64 pigsty 92.3 KiB postgresql-16-pg-circuit_0.1.0-1PGSTY~trixie_arm64.deb
postgresql-16-pg-circuit 0.1.0 u22.x86_64 pigsty 109.1 KiB postgresql-16-pg-circuit_0.1.0-1PGSTY~jammy_amd64.deb
postgresql-16-pg-circuit 0.1.0 u22.aarch64 pigsty 108.6 KiB postgresql-16-pg-circuit_0.1.0-1PGSTY~jammy_arm64.deb
postgresql-16-pg-circuit 0.1.0 u24.x86_64 pigsty 93.8 KiB postgresql-16-pg-circuit_0.1.0-1PGSTY~noble_amd64.deb
postgresql-16-pg-circuit 0.1.0 u24.aarch64 pigsty 93.7 KiB postgresql-16-pg-circuit_0.1.0-1PGSTY~noble_arm64.deb
postgresql-16-pg-circuit 0.1.0 u26.x86_64 pigsty 92.9 KiB postgresql-16-pg-circuit_0.1.0-1PGSTY~resolute_amd64.deb
postgresql-16-pg-circuit 0.1.0 u26.aarch64 pigsty 92.1 KiB postgresql-16-pg-circuit_0.1.0-1PGSTY~resolute_arm64.deb

Source

pig build pkg pg_circuit;		# 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_circuit;		# install via package name, for the active PG version

pig install pg_circuit -v 18;   # install for PG 18
pig install pg_circuit -v 17;   # install for PG 17
pig install pg_circuit -v 16;   # install for PG 16

Config this extension to shared_preload_libraries:

shared_preload_libraries = 'pg_circuit';

Create this extension with:

CREATE EXTENSION pg_circuit;

Usage

Sources:

pg_circuit inspects potentially dangerous DML and DDL on PostgreSQL 16–18. The Community edition can observe, warn or block statements. Add it to shared_preload_libraries, restart PostgreSQL, then create the extension as a superuser.

Basic protection

shared_preload_libraries = 'pg_circuit'
CREATE EXTENSION pg_circuit;
CREATE TABLE circuit_demo (id integer);
INSERT INTO circuit_demo VALUES (1);
SET pg_circuit.mode = 'enforce';
DELETE FROM circuit_demo; -- blocked
DELETE FROM circuit_demo WHERE id = 1;
SELECT * FROM pg_circuit_status();

Configuration and diagnostics

pg_circuit.mode defaults to warn; observe collects risk without warnings, and enforce blocks scores at or above the configured threshold. pg_circuit_runtime_state() reports pressure signals and pg_circuit_events() exposes recent events.

Community always reports effective runtime mode NORMAL. Pressure readings do not automatically escalate enforcement. This is a policy aid; application transactions, authorization and backups still determine data protection. Review rules and thresholds on representative queries before enabling enforcement.