2

I went through a re-installation of postgresql on a mac using brew and I'm not sure about some default vs user created databases.

After the installation I see 2 users:

  • postgres
  • dan (being my osx user).

These should be ok, normally they are created during installation.

Listing the databases I see:

  • postgres (ok, default)
  • template1 (ok, default)
  • dan (not sure about this)

So my questions are:

  1. what happened to template0 database? Did I deleted by accident or it's normal that postgres doesn't install it by default all the time? In case I've deleted what can I do to restore it? What's used for?

  2. did postgres installed the dan databases for storing info on my dan user or did I create it in the past (and forgot)? In this case I can delete it (it has no tables). How can I be sure who created this?

3
  • 3
    What mechanism are you using to list the databases? Perhaps that mechanism intentionally excludes template0 from the list.
    – jjanes
    Commented Apr 24, 2019 at 15:46
  • 1
    You can see the true list of the databases using the query select * from pg_database;.
    – Sahap Asci
    Commented Apr 24, 2019 at 20:13
  • @jjanes you are right. I was using pgadmin and template0 was not visible. By using \list from the cli or select * from pg_database; I can see it. What's used for?
    – Leonardo
    Commented Apr 24, 2019 at 22:55

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.