
Jul You can do drop cluster and create cluster which will automtically erase all databases. Erase all data in you $PGDATA directory and reinit . Nov More from stackoverflow. Use IF EXISTS to prevent an error from removing a non-existent database. Only the owner of the database , or a superuser, can drop a database.

Dropping a database removes all objects that were contained within the database. PostgreSQL will issue a notice instead. Feb Hi, Just joined the list, and this is first time foray into SQL databases , so apologies for the (most likely) lame questions. Dec How to delete all rows from all tables in postgresql ? Jul postgres how to drop all the table in a schema.
Oct More from dba. To remove all tables from a database (but keep the database itself), you have two options. This command drops a database.
You also need to run some grants to interact with the database : GRANT ALL ON SCHEMA public TO postgres. It removes the catalog entries for the database and deletes the directory containing the data. GitHub Gist: instantly share code, notes, and snippets. The user who executes this command must be a database superuser or the owner of the database. To delete the database files, manually delete the . RESTRICTrefuses to drop table if there is any object depends DROP.

