Skip to content

ENGINE / SQL

SQL rules

12 deterministic checks, ordered by canonical rule ID.

12 rules

Rule Engine Category Default
add-constraint-requires-not-valid ADD CONSTRAINT (CHECK/FK) without NOT VALID blocks writes during full-table validation. SQL performance error
enforce-timestamptz TIMESTAMP without TIME ZONE — use TIMESTAMPTZ. SQL correctness error
idempotent-ddl DDL without IF [NOT] EXISTS — migrations must be safe to re-run. SQL correctness error
index-concurrently CREATE INDEX without CONCURRENTLY — locks the table against writes. SQL performance error
insert-requires-on-conflict INSERT without ON CONFLICT — migration data writes must be idempotent upserts. SQL correctness error
no-offset-pagination OFFSET pagination — use cursor pagination (WHERE id > :cursor). SQL performance error
no-pg-enum CREATE TYPE ... AS ENUM — use TEXT + CHECK constraint instead. SQL maintainability error
prefer-jsonb JSON column type or ::json cast — use JSONB. SQL performance error
prefer-text-over-varchar VARCHAR(n) — use TEXT (+ CHECK length if needed). SQL maintainability error
prefer-uuidv7-default `gen_random_uuid()` emits a random UUIDv4 — use `uuidv7()` so keys are time-ordered. SQL performance error
require-fk-index FOREIGN KEY column missing index — causes full-table scans and locks on parent row deletes. SQL performance error
require-lock-timeout DDL migration missing positive SET [LOCAL] lock_timeout or statement_timeout prior to DDL. SQL correctness error