pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Ian Lawrence Barwick <barwick@gmail.com>
To: Igor Korot <ikorot01@gmail.com>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: List user databases
Date: Wed, 9 Nov 2022 21:16:40 -0800
Message-ID: <70f8bec0-ff5e-1c9b-b8a4-c0bdf56a4cbb@aklaver.com> (raw)
In-Reply-To: <CAB8KJ=hhVTwj4eF3GnnQ0eYLqzakc6xj9mdn1AjSiAfWTA0s9A@mail.gmail.com>
References: <CA+FnnTz0G0bwk1MpUYMkkCtAPWv3rXwJHrV=KKvNsh9erFUQNA@mail.gmail.com>
	<CAB8KJ=hhVTwj4eF3GnnQ0eYLqzakc6xj9mdn1AjSiAfWTA0s9A@mail.gmail.com>

On 11/9/22 20:57, Ian Lawrence Barwick wrote:
> 2022年11月10日(木) 13:41 Igor Korot <ikorot01@gmail.com>:
>>
>> Hi, ALL,
>> According to https://chartio.com/resources/tutorials/how-to-list-databases-and-tables-in-postgresql-using-psql/,
>> there are generally 3 system DBs.
>>
>> However I'm confused with the word general.
>> How many system databases can be made on a PG server?
> 
> template0 and template1 are the mandatory system databases which
> cannot be dropped.

Actually that is not strictly true:

https://www.postgresql.org/docs/current/manage-ag-templatedbs.html

"
Note

template1 and template0 do not have any special status beyond the fact 
that the name template1 is the default source database name for CREATE 
DATABASE. For example, one could drop template1 and recreate it from 
template0 without any ill effects. This course of action might be 
advisable if one has carelessly added a bunch of junk in template1. (To 
delete template1, it must have pg_database.datistemplate = false.)

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.
"

> 
> "postgres" is created by default for operational convenience, but is
> not essential and can
> be removed if you really want to.
> 
> Regards
> 
> Ian Barwick
> 
> 

-- 
Adrian Klaver
adrian.klaver@aklaver.com






view thread (5+ messages)  latest in thread

Message-ID: <70f8bec0-ff5e-1c9b-b8a4-c0bdf56a4cbb@aklaver.com>
Permalink:  ../70f8bec0-ff5e-1c9b-b8a4-c0bdf56a4cbb@aklaver.com/
Also on:    postgresql.org/message-id/70f8bec0-ff5e-1c9b-b8a4-c0bdf56a4cbb@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, barwick@gmail.com, ikorot01@gmail.com
  Subject: Re: List user databases
  In-Reply-To: <70f8bec0-ff5e-1c9b-b8a4-c0bdf56a4cbb@aklaver.com>
  References: <CA+FnnTz0G0bwk1MpUYMkkCtAPWv3rXwJHrV=KKvNsh9erFUQNA@mail.gmail.com> <CAB8KJ=hhVTwj4eF3GnnQ0eYLqzakc6xj9mdn1AjSiAfWTA0s9A@mail.gmail.com> <70f8bec0-ff5e-1c9b-b8a4-c0bdf56a4cbb@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox