Tom Lane wrote:
> Now that you mention it, this is another reason why system tables for
> each database have to live in a separate tablespace directory: there's
> no other good way to do that final stage of DROP DATABASE. The
> DROP-each-table approach doesn't work for system tables (somewhere along
> about the point where you drop pg_attribute, DROP TABLE itself would
> stop working ;-)).
If drop table is extended to drop multiple tables at once, then you read
and cache everything you need before doing all the destruction in the
second stage.