Sometimes when working in Postgres I like to reset my development database by deleting everything in it without dropping the actual database itself.
An easy way to achieve this is to just drop all database schema(s) with the
CASCADE option. By default, everything lives in the
DROP SCHEMA "public" CASCADE;
Postgres will output notices as it drop things with
CASCADE. These messages can be supressed by changing the log level temporarily.
SET client_min_messages TO WARNING; DROP SCHEMA "public" CASCADE; SET client_min_messages TO NOTICE;