pg_strict
Prevent dangerous UPDATE and DELETE without WHERE clause
pg_strict : Prevent dangerous UPDATE and DELETE without WHERE clause
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 5830 | pg_strict | pg_strict | 1.0.5 |
ADMIN | MIT | Rust |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --sLd-- | No | Yes | Yes | Yes | no | no |
| Relationships | |
|---|---|
| See Also | safeupdate pg_savior pg_drop_events table_log block_copy_command pg_kpart plan_filter |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.0.5 |
18 17 16 15 14 | pg_strict |
- |
| RPM | PIGSTY | 1.0.5 |
18 17 16 15 14 | pg_strict_$v |
- |
| DEB | PIGSTY | 1.0.5 |
18 17 16 15 14 | postgresql-$v-pg-strict |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 |
| el8.aarch64 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 |
| el9.x86_64 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 |
| el9.aarch64 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 |
| el10.x86_64 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 |
| el10.aarch64 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 |
| d12.x86_64 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 |
| d12.aarch64 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 |
| d13.x86_64 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 |
| d13.aarch64 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 |
| u22.x86_64 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 |
| u22.aarch64 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 |
| u24.x86_64 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 |
| u24.aarch64 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 |
| u26.x86_64 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 |
| u26.aarch64 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 | PIGSTY 1.0.5 |
Source
github.com/spa5k/pg_strict
pg_strict-1.0.5.tar.gz
Install
Make sure PGDG and PIGSTY repo available:
Install this extension with pig:
Config this extension to shared_preload_libraries:
Create this extension with:
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.