Question

When I log in to see my remote PostgreSQL databases with pgAdmin or Navicat, I can connect without any problems, and the first three databases in the list below show up fine. But for some reason I can't get the last two databases ("template0" and "template1") to show up with the others. Also, when I ssh into the server's database, I can run a "SELECT * FROM a_table_in_template1_database;" and it shows all of the contents of the table with no issues, so I know everything is okay with the database and the tables within it. How can I get the "template1" database to show up in this list and work? Here is PostgreSQL's the output from the terminal when I run "\list":

template1=# \list
                                List of databases
     Name      |  Owner   | Encoding | Collation | Ctype |   Access privileges   
---------------+----------+----------+-----------+-------+-----------------------
 mygigline     | jball037 | LATIN1   | en_US     | en_US | 
 mygiglinemain | postgres | LATIN1   | en_US     | en_US | 
 postgres      | postgres | LATIN1   | en_US     | en_US | 
 template0     | postgres | LATIN1   | en_US     | en_US | =c/postgres
 template1     | postgres | LATIN1   | en_US     | en_US | =CTc/postgres
                                                         : postgres=CTc/postgres
(5 rows)

It LOOKS like there might be something with "Access Privileges" that is causing this. However, I have done things like "GRANT ALL ON DATABASE template1 TO postgres" but that doesn't seem to help.

Another useful piece of info: When I log in with Navicat and the three databases show up, I can click the option to "Open Database", then I type in "template1", and it will show up on the left panel along with the other three databases, but I can't click on it or do anything with it.

I just want to be able to show all 5 of my databases show up in either Navicat or pgAdmin and be able to access all of them :) Any help would be much appreciated!

Was it helpful?

Solution

These tools tend to hide databases where pg_database.datistemplate is true, as they're considered "internal" databases rather than ordinary user databases.

The client application(s) may offer a setting to unhide these DBs, or you may be able to open them directly by name.

Note that template0 is typically a read-only database that you cannot modify, so there's very little point to accessing it in a management UI. template1 can be connected to and modified, but whatever you do to template1 will be copied when you create a new database (without an explicit TEMPLATE option) so you usually don't want to change it.

I strongly recommend that you ignore template0 and template1. Pretend that they do not exist.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top