Here we go through many different ways to fix PostgreSQL problems.
To see what queries ran inside Postgresql for the last 10 seconds you can run.
SELECT * FROM pg_stat_activity where query_start > now() - INTERVAL '10 seconds'
This can often help you debug and find problems.
Run the following command to see schemaname, tablename, tableowner, tablespace, hasindexes, hasrules, hastriggers, and rowsecurity.
SELECT * FROM pg_tables;
Sometimes the simplest way is to start from scratch. Instead of purging the existing database, you can make a query that drops all tables:
SELECT 'drop table "' || tablename || '" cascade;' FROM pg_tables;