Skip to content

MG30 — DETACH PARTITION without CONCURRENTLY holds an exclusive lock

Group: Migration safety · Auto-fixable: no

ALTER TABLE … DETACH PARTITION without CONCURRENTLY takes an exclusive lock on the parent table for the whole operation. Use DETACH PARTITION … CONCURRENTLY (Postgres 14+).

bad: ALTER TABLE t DETACH PARTITION p;
good: ALTER TABLE t DETACH PARTITION p CONCURRENTLY;

Disable this rule in banshee.toml:

[lint]
exclude = ["MG30"]

Or silence one line with -- noqa: MG30. See Linting.