MG14 — ALTER COLUMN SET NOT NULL scans the table under a lock
Group: Migration safety · Auto-fixable: no
SET NOT NULL scans every existing row to verify the constraint while holding a lock. Add a CHECK (col IS NOT NULL) NOT VALID, VALIDATE it (a weaker lock), then SET NOT NULL — Postgres reuses the validated check and skips the scan.
Example
Section titled “Example”bad: ALTER TABLE t ALTER COLUMN c SET NOT NULL;Configure
Section titled “Configure”Disable this rule in banshee.toml:
[lint]exclude = ["MG14"]Or silence one line with -- noqa: MG14. See Linting.