Re: Identify system databases - Mailing list pgsql-general

From Tom Lane
Subject Re: Identify system databases
Date
Msg-id 1699115.1744734596@sss.pgh.pa.us
Whole thread Raw
In response to Re: Identify system databases  (Adrian Klaver <adrian.klaver@aklaver.com>)
List pgsql-general
Adrian Klaver <adrian.klaver@aklaver.com> writes:
> On 4/15/25 07:48, Igor Korot wrote:
>> Is there a field in the pg_databases table which indicates that 
>> particular DB is a system one?

> No there is not. As a practical matter they are no different then any 
> user created database, other then template0 is created with datallowconn 
>   set to false.

Yeah; in a very real sense there isn't such a thing as a "system
database" in Postgres.  There are pre-created databases that have
specific uses (such as being the default template for CREATE
DATABASE), but those uses are identified by name not by OID.
You can drop template1, and the only thing that will be unhappy
is CREATE DATABASE, and if you make a new DB that is named
template1 then CREATE DATABASE will be happy again.

            regards, tom lane



pgsql-general by date:

Previous
From: Igor Korot
Date:
Subject: Fwd: Identify system databases
Next
From: Adrian Klaver
Date:
Subject: Re: Fwd: Identify system databases