pgguard

pgguard 0.1.0 · 17 rules

Rule reference

Every rule says what it found, how dangerous it is on a table that is already live, and what to write instead. A finding on a table created in the same migration is dropped to low: an empty table has nothing to lock, rewrite or break.

All 17

worst first in a scan, in order here
RuleDefault severityWhat it catches
PG001criticalADD COLUMN NOT NULL without a DEFAULT
PG002highCREATE INDEX without CONCURRENTLY
PG003criticalCONCURRENTLY inside a transaction block
PG004highALTER COLUMN TYPE rewrites the table
PG005mediumDROP COLUMN
PG006highDROP TABLE
PG007highRENAME breaks deployed code
PG008highADD FOREIGN KEY without NOT VALID
PG009mediumVALIDATE CONSTRAINT in the same transaction as NOT VALID
PG010mediumADD CHECK constraint without NOT VALID
PG011criticalVACUUM FULL or CLUSTER
PG012highSET NOT NULL on an existing column
PG013highADD PRIMARY KEY or UNIQUE without a pre-built index
PG014mediumNo lock_timeout set before blocking DDL
PG015highADD COLUMN with a volatile DEFAULT rewrites the table
PG016mediumA data migration runs inside the migration transaction
PG017mediumAddField fills existing rows with the field type’s implicit default