MP047CRITICALFree

ban-set-logged-unlogged

What It Detects

SET LOGGED/UNLOGGED rewrites the entire table under ACCESS EXCLUSIVE.

Why It's Dangerous

Changing a table between LOGGED and UNLOGGED requires physically rewriting every page, which holds ACCESS EXCLUSIVE for the entire duration.

Bad Example

ALTER TABLE users SET UNLOGGED;

Good Example

-- Consider creating a new unlogged table and migrating data
CREATE UNLOGGED TABLE users_new (LIKE users INCLUDING ALL);

Configuration

Disable this rule:

# .migrationpilotrc.yml
rules:
  MP047: false

Or change its severity:

# .migrationpilotrc.yml
rules:
  MP047:
    severity: warning