Partitions
ALTER TABLE ... ATTACH PARTITION on PostgreSQL 11 and earlier
PostgreSQL 11 and earlier
ALTER TABLE orders ATTACH PARTITION orders_2026_01 FOR VALUES FROM ('2026-01-01') TO ('2026-02-01'); What this does
Before PostgreSQL 12, ATTACH PARTITION takes ACCESS EXCLUSIVE on the parent as well as the partition, blocking all reads and writes on the parent table for the full validation scan, a materially worse outage than the PG12+ behavior.
Safe rewrite
Add a matching CHECK constraint on the partition first to skip the scan, or upgrade to PostgreSQL 12+
ALTER TABLE orders_2026_01 ADD CONSTRAINT orders_2026_01_check CHECK (...) NOT VALID;
ALTER TABLE orders_2026_01 VALIDATE CONSTRAINT orders_2026_01_check;
ALTER TABLE orders ATTACH PARTITION orders_2026_01 FOR VALUES FROM ('2026-01-01') TO ('2026-02-01');