Simple way to list order of referential integrity in Postgres Is there a clean, simple, and preferably prepackaged (ready function?) way to list the order of referential integrity in a Postgres database, rather than trying to read the system tables to find that order manually, which is tedious and time consuming?

What I mean is, if the entity hierarchy is


  USER --> ACCOUNT --> TRANSACTION


meaning that a single user can have multiple accounts and that a single account can have multiple transactions, if I want to delete all the three tables without breaking any foreign keys, I would have to do it in the exact following order:

DELETE FROM TRANSACTION;
DELETE FROM ACCOUNT;
DELETE FROM USER;


Now this is a very simple and obvious example. But real life databases have a lot more tables and foreign keys. If I wanted to delete every table down to 0 rows, is there a quick way to obtain the exact order of referential integrity to do it in?
You can "dive" into the system tables and get all the tables that reference a specific table (and all those that reference them, etc). It will be a recursive query, not very difficult to write.

However, for the simple operation you want to to perform, there is a simple solution:
TRUNCATE with the magic option CASCADE:

truncate table a cascade ;


Tested at rextester.com