pg_strict
Prevent dangerous UPDATE and DELETE without WHERE clause
Repository
spa5k/pg_strict
https://github.com/spa5k/pg_strict
Source
pg_strict-1.0.5.tar.gz
pg_strict-1.0.5.tar.gz
Overview
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 5830 | pg_strict | No | Yes | Yes | Yes | No | No | - |
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.0.5 | 1817161514 | pg_strict | - |
| RPM | PIGSTY | 1.0.5 | 1817161514 | pg_strict_$v | - |
| DEB | PIGSTY | 1.0.5 | 1817161514 | postgresql-$v-pg-strict | - |
Build
You can build the RPM / DEB packages for pg_strict using pig build:
Install
You can install pg_strict directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Install
pig
dnf
apt
Preload:
Create Extension:
Usage
Source: README, Release v1.0.5, API source
pg_strict blocks or warns on UPDATE and DELETE statements that omit a WHERE clause. It installs a post_parse_analyze_hook, so it must be loaded from shared_preload_libraries.
Required setup
GUCs
pg_strict.require_where_on_updatepg_strict.require_where_on_delete
Each setting supports off, warn, and on.
Helper functions
pg_strict_set_update_mode(mode)andpg_strict_set_delete_mode(mode)provide generic mode setters.SET LOCALworks for one-off bulk operations inside a transaction.
Caveats
- Enforcement is presence-based, not intent-based: any non-null
WHEREclause satisfies the rule. - Only
UPDATEandDELETEare checked. - Current upstream release is
1.0.5; upstream documents PostgreSQL 13 through 18, while the Pigsty package row indb/extension.csvcovers PostgreSQL 14 through 18. - The Pigsty note about
pgrx0.17.0 is packaging/build metadata, not a documented user-facing feature change.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)