How do I change the maintenance database for Postgres?
I'm running PostgreSQL version 9.0 on OSX version 10.6.6. Somehow one of my development databases has become the maintenance db, not postgres (this db also exists). I can't find any documentation on how to change/set the maintenance db back to postgres.
I can't drop my development database because of this issue...
You're not entirely clear on this, but do you mean the "Maintenance DB" selection in pgAdmin III?
Select the server in your "object browser" pane; right click -> Properties
The fifth field is "Maintenance DB"
You can change maintenance db from pgAdmin but you have to be disconnected from the database engine to be able to do that.
Then in the database server properties:
Choose the desired maintenance database:
Maintenance db field is read-only , you can't change it.So you should keep your server properties somewhere and create new server with these properties and set maintenance db "postgres". Now you are able to drop database.
The command line option is :
psql -U intelison -c "UPDATE pg_database SET datistemplate=false, datallowconn=true WHERE datname = '<your_database_name>'"