Transaction & Policy Checks

Beyond DDL, pgfence enforces operational best practices that prevent silent production incidents.

Transaction Checks

#PatternSeverity
25NOT VALID + VALIDATE CONSTRAINT in the same transactionerror
26Multiple ACCESS EXCLUSIVE statements compoundingwarning
27CREATE INDEX CONCURRENTLY inside a transactionerror
28Bulk UPDATE without WHERE in migrationwarning
29Wide lock window: ACCESS EXCLUSIVE on multiple tables in same transactionwarning

Policy Checks

  • Missing SET lock_timeout: prevents lock queue death spirals
  • Missing SET statement_timeout: safety net for long operations
  • Missing SET application_name: enables pg_stat_activity visibility
  • Missing SET idle_in_transaction_session_timeout: prevents orphaned locks
  • lock_timeout set after dangerous DDL: ordering violation, timeout must be set before any statement that acquires a dangerous lock
  • lock_timeout / statement_timeout value exceeds threshold: warns when timeout values are too permissive (defaults: lock_timeout > 5s, statement_timeout > 10min)

Inline Ignore

Suppress a specific check on a statement with a comment directive:

sql
-- pgfence-ignore: add-column-not-null-no-default
ALTER TABLE users ADD COLUMN status TEXT NOT NULL;

-- pgfence-ignore
DROP TABLE legacy_sessions;  -- suppress all checks

See Configuration → Inline Ignore for full syntax reference.