58

pgAdmin's Register - Server dialog for adding new database connections asks for a "Maintenance database". In order to be able to connect, I set it to the database I want to connect (and also, I have the rights to connect).

So, why is that field named "Maintenance DB" instead of just "DB" or "Database"?

jgomo3
  • 714
  • 1
  • 5
  • 10

2 Answers2

29

You are free to define any existing database in the DB cluster as "Maintenance database". You are not limited to the options suggested by the interface, which are just typical defaults.

This is particularly useful for users with limited permissions or read-only access. Access to a single DB is simpler with the same DB as "Maintenance database". Related:

The manual for pgAdmin4 has this to say about the "Maintenance database":

Use the Maintenance database field to specify the name of the initial database to which the client will connect. If you will be using pgAgent or adminpack objects, the pgAgent schema and adminpack objects should be installed on that database.

A standard Postgres installation creates a "default database" named postgres for every DB cluster, which is a common choice for pgAdmin's "maintenance db". The manual:

The postgres database is also created when a database cluster is initialized. This database is meant as a default database for users and applications to connect to. It is simply a copy of template1 and can be dropped and recreated if necessary.

Erwin Brandstetter
  • 185,527
  • 28
  • 463
  • 633
20

From the docs:

Use the Maintenance database field to specify the name of the initial database to which the client will connect. If you will be using pgAgent or adminpack objects, the pgAgent schema and adminpack objects should be installed on that database.

I'd add that once you are connected, it will give you list of other databases on that server you can also connect to. But until you connect to at least one database on the server, you can't fetch that list.

If it was just called "DB", that would suggest it is the only database on that server you can connect to, rather than one of (potentially) several.

Michael Green
  • 25,255
  • 13
  • 54
  • 100
jjanes
  • 42,332
  • 3
  • 44
  • 54