pg_savior

pg_savior

pg_savior : Postgres extension to save OOPS mistakes

Overview

ID Extension Package Version Category License Language
5810
pg_savior
pg_savior
0.0.1
ADMIN
Apache-2.0
C
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
--s-d-r
No
Yes
No
Yes
yes
no
Relationships
See Also
pg_upless
safeupdate
pg_drop_events
pg_cheat_funcs
table_log
pg_snakeoil
pg_auditor
temporal_tables

-tuplestore_donestoring , breaks on pg18 @ el

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT
PIGSTY
0.0.1
18
17
16
15
14
pg_savior -
RPM
PIGSTY
0.0.1
18
17
16
15
14
pg_savior_$v -
DEB
PIGSTY
0.0.1
18
17
16
15
14
postgresql-$v-pg-savior -
Linux / PG PG18 PG17 PG16 PG15 PG14
el8.x86_64
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
el8.aarch64
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
el9.x86_64
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
el9.aarch64
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
el10.x86_64
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
el10.aarch64
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
d12.x86_64
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
d12.aarch64
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
d13.x86_64
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
d13.aarch64
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
u22.x86_64
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
u22.aarch64
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
u24.x86_64
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
u24.aarch64
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
PIGSTY 0.0.1
Package Version OS ORG SIZE File URL
pg_savior_18 0.0.1 el8.x86_64 pigsty 13.5 KiB pg_savior_18-0.0.1-2PIGSTY.el8.x86_64.rpm
pg_savior_18 0.0.1 el8.aarch64 pigsty 13.7 KiB pg_savior_18-0.0.1-2PIGSTY.el8.aarch64.rpm
pg_savior_18 0.0.1 el9.x86_64 pigsty 13.4 KiB pg_savior_18-0.0.1-2PIGSTY.el9.x86_64.rpm
pg_savior_18 0.0.1 el9.aarch64 pigsty 13.5 KiB pg_savior_18-0.0.1-2PIGSTY.el9.aarch64.rpm
pg_savior_18 0.0.1 el10.x86_64 pigsty 13.4 KiB pg_savior_18-0.0.1-2PIGSTY.el10.x86_64.rpm
pg_savior_18 0.0.1 el10.aarch64 pigsty 13.6 KiB pg_savior_18-0.0.1-2PIGSTY.el10.aarch64.rpm
postgresql-18-pg-savior 0.0.1 d12.x86_64 pigsty 15.7 KiB postgresql-18-pg-savior_0.0.1-1PIGSTY~bookworm_amd64.deb
postgresql-18-pg-savior 0.0.1 d12.aarch64 pigsty 15.6 KiB postgresql-18-pg-savior_0.0.1-1PIGSTY~bookworm_arm64.deb
postgresql-18-pg-savior 0.0.1 d13.x86_64 pigsty 15.7 KiB postgresql-18-pg-savior_0.0.1-1PIGSTY~trixie_amd64.deb
postgresql-18-pg-savior 0.0.1 d13.aarch64 pigsty 15.7 KiB postgresql-18-pg-savior_0.0.1-1PIGSTY~trixie_arm64.deb
postgresql-18-pg-savior 0.0.1 u22.x86_64 pigsty 16.7 KiB postgresql-18-pg-savior_0.0.1-1PIGSTY~jammy_amd64.deb
postgresql-18-pg-savior 0.0.1 u22.aarch64 pigsty 16.5 KiB postgresql-18-pg-savior_0.0.1-1PIGSTY~jammy_arm64.deb
postgresql-18-pg-savior 0.0.1 u24.x86_64 pigsty 16.6 KiB postgresql-18-pg-savior_0.0.1-1PIGSTY~noble_amd64.deb
postgresql-18-pg-savior 0.0.1 u24.aarch64 pigsty 16.2 KiB postgresql-18-pg-savior_0.0.1-1PIGSTY~noble_arm64.deb
Package Version OS ORG SIZE File URL
pg_savior_17 0.0.1 el8.x86_64 pigsty 13.5 KiB pg_savior_17-0.0.1-2PIGSTY.el8.x86_64.rpm
pg_savior_17 0.0.1 el8.aarch64 pigsty 13.7 KiB pg_savior_17-0.0.1-2PIGSTY.el8.aarch64.rpm
pg_savior_17 0.0.1 el9.x86_64 pigsty 13.5 KiB pg_savior_17-0.0.1-2PIGSTY.el9.x86_64.rpm
pg_savior_17 0.0.1 el9.aarch64 pigsty 13.5 KiB pg_savior_17-0.0.1-2PIGSTY.el9.aarch64.rpm
pg_savior_17 0.0.1 el10.x86_64 pigsty 13.4 KiB pg_savior_17-0.0.1-2PIGSTY.el10.x86_64.rpm
pg_savior_17 0.0.1 el10.aarch64 pigsty 13.7 KiB pg_savior_17-0.0.1-2PIGSTY.el10.aarch64.rpm
postgresql-17-pg-savior 0.0.1 d12.x86_64 pigsty 15.6 KiB postgresql-17-pg-savior_0.0.1-1PIGSTY~bookworm_amd64.deb
postgresql-17-pg-savior 0.0.1 d12.aarch64 pigsty 15.8 KiB postgresql-17-pg-savior_0.0.1-1PIGSTY~bookworm_arm64.deb
postgresql-17-pg-savior 0.0.1 d13.x86_64 pigsty 15.6 KiB postgresql-17-pg-savior_0.0.1-1PIGSTY~trixie_amd64.deb
postgresql-17-pg-savior 0.0.1 d13.aarch64 pigsty 15.9 KiB postgresql-17-pg-savior_0.0.1-1PIGSTY~trixie_arm64.deb
postgresql-17-pg-savior 0.0.1 u22.x86_64 pigsty 20.3 KiB postgresql-17-pg-savior_0.0.1-1PIGSTY~jammy_amd64.deb
postgresql-17-pg-savior 0.0.1 u22.aarch64 pigsty 20.0 KiB postgresql-17-pg-savior_0.0.1-1PIGSTY~jammy_arm64.deb
postgresql-17-pg-savior 0.0.1 u24.x86_64 pigsty 16.5 KiB postgresql-17-pg-savior_0.0.1-1PIGSTY~noble_amd64.deb
postgresql-17-pg-savior 0.0.1 u24.aarch64 pigsty 16.5 KiB postgresql-17-pg-savior_0.0.1-1PIGSTY~noble_arm64.deb
Package Version OS ORG SIZE File URL
pg_savior_16 0.0.1 el8.x86_64 pigsty 13.5 KiB pg_savior_16-0.0.1-2PIGSTY.el8.x86_64.rpm
pg_savior_16 0.0.1 el8.aarch64 pigsty 13.7 KiB pg_savior_16-0.0.1-2PIGSTY.el8.aarch64.rpm
pg_savior_16 0.0.1 el9.x86_64 pigsty 13.5 KiB pg_savior_16-0.0.1-2PIGSTY.el9.x86_64.rpm
pg_savior_16 0.0.1 el9.aarch64 pigsty 13.5 KiB pg_savior_16-0.0.1-2PIGSTY.el9.aarch64.rpm
pg_savior_16 0.0.1 el10.x86_64 pigsty 13.4 KiB pg_savior_16-0.0.1-2PIGSTY.el10.x86_64.rpm
pg_savior_16 0.0.1 el10.aarch64 pigsty 13.7 KiB pg_savior_16-0.0.1-2PIGSTY.el10.aarch64.rpm
postgresql-16-pg-savior 0.0.1 d12.x86_64 pigsty 15.6 KiB postgresql-16-pg-savior_0.0.1-1PIGSTY~bookworm_amd64.deb
postgresql-16-pg-savior 0.0.1 d12.aarch64 pigsty 15.8 KiB postgresql-16-pg-savior_0.0.1-1PIGSTY~bookworm_arm64.deb
postgresql-16-pg-savior 0.0.1 d13.x86_64 pigsty 15.6 KiB postgresql-16-pg-savior_0.0.1-1PIGSTY~trixie_amd64.deb
postgresql-16-pg-savior 0.0.1 d13.aarch64 pigsty 15.9 KiB postgresql-16-pg-savior_0.0.1-1PIGSTY~trixie_arm64.deb
postgresql-16-pg-savior 0.0.1 u22.x86_64 pigsty 19.8 KiB postgresql-16-pg-savior_0.0.1-1PIGSTY~jammy_amd64.deb
postgresql-16-pg-savior 0.0.1 u22.aarch64 pigsty 19.5 KiB postgresql-16-pg-savior_0.0.1-1PIGSTY~jammy_arm64.deb
postgresql-16-pg-savior 0.0.1 u24.x86_64 pigsty 16.5 KiB postgresql-16-pg-savior_0.0.1-1PIGSTY~noble_amd64.deb
postgresql-16-pg-savior 0.0.1 u24.aarch64 pigsty 16.5 KiB postgresql-16-pg-savior_0.0.1-1PIGSTY~noble_arm64.deb
Package Version OS ORG SIZE File URL
pg_savior_15 0.0.1 el8.x86_64 pigsty 13.5 KiB pg_savior_15-0.0.1-2PIGSTY.el8.x86_64.rpm
pg_savior_15 0.0.1 el8.aarch64 pigsty 13.7 KiB pg_savior_15-0.0.1-2PIGSTY.el8.aarch64.rpm
pg_savior_15 0.0.1 el9.x86_64 pigsty 13.5 KiB pg_savior_15-0.0.1-2PIGSTY.el9.x86_64.rpm
pg_savior_15 0.0.1 el9.aarch64 pigsty 13.6 KiB pg_savior_15-0.0.1-2PIGSTY.el9.aarch64.rpm
pg_savior_15 0.0.1 el10.x86_64 pigsty 13.5 KiB pg_savior_15-0.0.1-2PIGSTY.el10.x86_64.rpm
pg_savior_15 0.0.1 el10.aarch64 pigsty 13.7 KiB pg_savior_15-0.0.1-2PIGSTY.el10.aarch64.rpm
postgresql-15-pg-savior 0.0.1 d12.x86_64 pigsty 15.6 KiB postgresql-15-pg-savior_0.0.1-1PIGSTY~bookworm_amd64.deb
postgresql-15-pg-savior 0.0.1 d12.aarch64 pigsty 15.9 KiB postgresql-15-pg-savior_0.0.1-1PIGSTY~bookworm_arm64.deb
postgresql-15-pg-savior 0.0.1 d13.x86_64 pigsty 15.6 KiB postgresql-15-pg-savior_0.0.1-1PIGSTY~trixie_amd64.deb
postgresql-15-pg-savior 0.0.1 d13.aarch64 pigsty 15.9 KiB postgresql-15-pg-savior_0.0.1-1PIGSTY~trixie_arm64.deb
postgresql-15-pg-savior 0.0.1 u22.x86_64 pigsty 19.8 KiB postgresql-15-pg-savior_0.0.1-1PIGSTY~jammy_amd64.deb
postgresql-15-pg-savior 0.0.1 u22.aarch64 pigsty 19.5 KiB postgresql-15-pg-savior_0.0.1-1PIGSTY~jammy_arm64.deb
postgresql-15-pg-savior 0.0.1 u24.x86_64 pigsty 16.5 KiB postgresql-15-pg-savior_0.0.1-1PIGSTY~noble_amd64.deb
postgresql-15-pg-savior 0.0.1 u24.aarch64 pigsty 16.5 KiB postgresql-15-pg-savior_0.0.1-1PIGSTY~noble_arm64.deb
Package Version OS ORG SIZE File URL
pg_savior_14 0.0.1 el8.x86_64 pigsty 13.5 KiB pg_savior_14-0.0.1-2PIGSTY.el8.x86_64.rpm
pg_savior_14 0.0.1 el8.aarch64 pigsty 13.7 KiB pg_savior_14-0.0.1-2PIGSTY.el8.aarch64.rpm
pg_savior_14 0.0.1 el9.x86_64 pigsty 13.5 KiB pg_savior_14-0.0.1-2PIGSTY.el9.x86_64.rpm
pg_savior_14 0.0.1 el9.aarch64 pigsty 13.5 KiB pg_savior_14-0.0.1-2PIGSTY.el9.aarch64.rpm
pg_savior_14 0.0.1 el10.x86_64 pigsty 13.5 KiB pg_savior_14-0.0.1-2PIGSTY.el10.x86_64.rpm
pg_savior_14 0.0.1 el10.aarch64 pigsty 13.7 KiB pg_savior_14-0.0.1-2PIGSTY.el10.aarch64.rpm
postgresql-14-pg-savior 0.0.1 d12.x86_64 pigsty 15.6 KiB postgresql-14-pg-savior_0.0.1-1PIGSTY~bookworm_amd64.deb
postgresql-14-pg-savior 0.0.1 d12.aarch64 pigsty 15.9 KiB postgresql-14-pg-savior_0.0.1-1PIGSTY~bookworm_arm64.deb
postgresql-14-pg-savior 0.0.1 d13.x86_64 pigsty 15.6 KiB postgresql-14-pg-savior_0.0.1-1PIGSTY~trixie_amd64.deb
postgresql-14-pg-savior 0.0.1 d13.aarch64 pigsty 15.9 KiB postgresql-14-pg-savior_0.0.1-1PIGSTY~trixie_arm64.deb
postgresql-14-pg-savior 0.0.1 u22.x86_64 pigsty 18.6 KiB postgresql-14-pg-savior_0.0.1-1PIGSTY~jammy_amd64.deb
postgresql-14-pg-savior 0.0.1 u22.aarch64 pigsty 18.3 KiB postgresql-14-pg-savior_0.0.1-1PIGSTY~jammy_arm64.deb
postgresql-14-pg-savior 0.0.1 u24.x86_64 pigsty 16.4 KiB postgresql-14-pg-savior_0.0.1-1PIGSTY~noble_amd64.deb
postgresql-14-pg-savior 0.0.1 u24.aarch64 pigsty 16.5 KiB postgresql-14-pg-savior_0.0.1-1PIGSTY~noble_arm64.deb

Source

pig build pkg pg_savior;# 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_savior;# install via package name, for the active PG version  pig install pg_savior -v 18; # install for PG 18 pig install pg_savior -v 17; # install for PG 17 pig install pg_savior -v 16; # install for PG 16 pig install pg_savior -v 15; # install for PG 15 pig install pg_savior -v 14; # install for PG 14

Create this extension with:

CREATE EXTENSION pg_savior;

Usage

pg_savior: Postgres extension to save OOPS mistakes

The pg_savior extension intercepts query execution to prevent accidental data deletion. It hooks into the executor to detect dangerous DELETE operations and block them.

How It Works

When a DELETE statement is processed, pg_savior checks for:

  • Missing WHERE clauses on DELETE commands
  • Index scan operations in DELETE query plans
  • Complex queries involving CTEs and subqueries in DELETE operations

When a risky DELETE is detected, the extension prevents execution and returns an informational message with zero rows affected.

Example

CREATE EXTENSION pg_savior;  -- Attempting a DELETE without WHERE clause DELETE FROM emp; -- INFO: pg_savior: DELETE statement detected -- INFO: pg_savior: WHERE clause is mandatory for a DELETE statement -- DELETE 0 (no rows affected, data preserved)  -- Normal DELETE with WHERE clause works as expected DELETE FROM emp WHERE id = 42; -- DELETE 1

Notes

  • The extension operates through PostgreSQL executor hooks, requiring no changes to application code
  • Only DELETE statements are currently intercepted; UPDATE operations are not affected
  • Planned features include preventing CREATE INDEX without CONCURRENTLY and blocking DROP DATABASE
Last updated on