How to explain/introspect what locks a DDL operation will need (Postgres) I would like to have some way of inspecting what locks a DDL operation will need to acquire.

Preferably something generic enough that I don't need to personally know/encode knowledge of all of the Postgres locking rules.

Something like EXPLAIN but specific to DDL operations.

I don't want to run the command and then look at any locks that are blocking... I want to know in advance what locks the DDL operation will need to acquire (e.g. ACCESS EXCLUSIVE on tables x, y, z), taking into account existing foreign key constraints etc.
What I do is BEGIN the transaction, run the DDL, then look at the pg_locks table to see what locks are held (not blocked, but held).  I do this on the test server, so there is nothing to block it or be blocked by it. But the knowledge generally transfers to production.  Some DDL can't be run in transactions, those generally require special handling.