Overview
pg_strict intercepts queries at parse time and blocks operations that are likely to be mistakes. When enabled, it prevents accidental mass updates or deletes that could affect your entire table.pg_strict configuration only applies to connections established after the change. It does not impact existing connections, even if they would violate the newly-configured rules.
Enabling pg_strict
pg_strict is configured per-role when creating new roles in the dashboard. To add pg_strict to existing roles, see per-role configuration.1
From the PlanetScale organization dashboard, select the desired database
2
Navigate to Settings > Roles
3
Click New role
4
Configure the role permissions
5
Under pg_strict, select a mode for each setting
6
Click Create role
Modes
Each pg_strict setting supports three modes:| Mode | Behavior |
|---|---|
off | Disabled, standard PostgreSQL behavior |
warn | Log a warning but allow the query to run |
on | Block the query with an error |
What it blocks
We’re actively expanding pg_strict with additional safety checks. More configurations will be added soon to help prevent other common mistakes.
UPDATE without WHERE
When pg_strict.require_where_on_update is enabled, UPDATE statements must include a WHERE clause:
DELETE without WHERE
When pg_strict.require_where_on_delete is enabled, DELETE statements must include a WHERE clause:
Overriding for one-off operations
For intentional bulk operations, useSET LOCAL within a transaction to temporarily disable a specific check:

