How to change the maintenance database for Postgres?

I am running PostgreSQL version 9.0 on OSX version 10.6.6. Somehow one of my development databases became db support, not postgres (this db also exists). I can not find any documentation on how to change / set db back to postgres.

I cannot delete my development database due to this problem ...

+6
source share
4 answers

You do not quite understand this, but do you mean the "Maintenance DB" option in pgAdmin III?

Select a server in the "object browser" panel; right click -> Properties

Fifth Field - “Service Database”

+9
source

You can change db maintenance with pgAdmin , but you must be disconnected from the database engine in order to be able to do this.

First disconnect:

Then in the database server properties:

Select the desired maintenance database:

+18
source

enter image description here

The db service field is read-only, you cannot change it. Therefore, you must save your server properties somewhere and create a new server with these properties and install the db "postgres" service . Now you can delete the database.

+4
source

Command line option:

 psql -U intelison -c "UPDATE pg_database SET datistemplate=false, datallowconn=true WHERE datname = '<your_database_name>'" 
+3
source

Source: https://habr.com/ru/post/886099/


All Articles