MP046CRITICALAuto-fixableFree

require-concurrent-detach-partition

What It Detects

DETACH PARTITION without CONCURRENTLY acquires ACCESS EXCLUSIVE on PG 14+.

Why It's Dangerous

On PG 14+, DETACH PARTITION CONCURRENTLY detaches the partition without blocking concurrent queries. Without CONCURRENTLY, the parent table is locked with ACCESS EXCLUSIVE.

Bad Example

ALTER TABLE events DETACH PARTITION events_2024;

Good Example

ALTER TABLE events DETACH PARTITION events_2024 CONCURRENTLY;

Auto-fix

Run migrationpilot analyze file.sql --fix to automatically fix this violation.

Configuration

Disable this rule:

# .migrationpilotrc.yml
rules:
  MP046: false

Or change its severity:

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