Reset postgresql
I want to bring postgresql back to its original empty state.
On Ubuntu:
$ sudo service postgresql stop
$ sudo apt-get purge postgresql*
Followed by
$ sudo apt-get install postgresql
Does what I want, but is there any less brutal way of doing the same thing?
What I actually want to do is to check that I can re-create my database from scratch.
Use initdb, creates a new PostgreSQL database cluster. That includes postgresql.conf and pg_hba.conf as well.
First, I have to guess what you mean by "reset"!
If you mean the data, you can just drop all databases using the known SQL statement drop database
.
If you mean the configuration, I think it is a good way to remove and re-install it with a fresh config files unless you have an old backup.