Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u4jAi-006UJL-EN for pgsql-general@arkaria.postgresql.org; Tue, 15 Apr 2025 16:30:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1u4jAf-00DHi6-9U for pgsql-general@arkaria.postgresql.org; Tue, 15 Apr 2025 16:30:02 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u4jAe-00DHdp-Ty for pgsql-general@lists.postgresql.org; Tue, 15 Apr 2025 16:30:01 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u4jAd-000Do9-19 for pgsql-general@lists.postgresql.org; Tue, 15 Apr 2025 16:30:00 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 53FGTuU01699116; Tue, 15 Apr 2025 12:29:56 -0400 From: Tom Lane To: Adrian Klaver cc: Igor Korot , "pgsql-generallists.postgresql.org" Subject: Re: Identify system databases In-reply-to: References: Comments: In-reply-to Adrian Klaver message dated "Tue, 15 Apr 2025 08:07:57 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1699114.1744734596.1@sss.pgh.pa.us> Date: Tue, 15 Apr 2025 12:29:56 -0400 Message-ID: <1699115.1744734596@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Adrian Klaver 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