Inheritance

ALTER TABLE ... INHERIT

Lock mode ACCESS EXCLUSIVE
Risk HIGH
Blocks reads, writes, other DDL
pgfence rule inherit
ALTER TABLE orders_archive INHERIT orders;

What this does

A catalog-bound inheritance change that takes ACCESS EXCLUSIVE on both the child and parent while validating inherited table metadata.

Safe rewrite

Schedule in a maintenance window with an explicit lock_timeout

SET lock_timeout = '2s';
ALTER TABLE orders_archive INHERIT orders;

Read more

More in Inheritance