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 1u4jBj-006UZs-9r for pgsql-general@arkaria.postgresql.org; Tue, 15 Apr 2025 16:31:07 +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 1u4jBh-00DL7I-DE for pgsql-general@arkaria.postgresql.org; Tue, 15 Apr 2025 16:31:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u4jBg-00DL7A-C5 for pgsql-general@lists.postgresql.org; Tue, 15 Apr 2025 16:31:05 +0000 Received: from fout-b7-smtp.messagingengine.com ([202.12.124.150]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u4jBb-000FAn-26 for pgsql-general@lists.postgresql.org; Tue, 15 Apr 2025 16:31:04 +0000 Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id C5677114014C; Tue, 15 Apr 2025 12:30:57 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Tue, 15 Apr 2025 12:30:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1744734657; x=1744821057; bh=rBU18FZaTpio88tUM6HV7e0qDZR3+6urXVbwKgWas9k=; b= iqXodGp50+HdIHyPIjrtCpnLeQHWm16S3ycSzH62iWNWDG1WYeSAKkqoGCtc2O4S PEhfEKC7V1sDf/3d94vGTpX7pyb5A/J4qrWXIeXbwH+sTgJgOg9qXBHAx7W+dXsI k2XxC+DB9TWIVaVIGS90SnUE6A3sx8Eh0em1kYaA3Jm1XzIkLYKQ82E11/QvYPMR tuVvzw7FOM1NXKxj9/8XQmmpeyuH8CUxxB7d0bL8MMEsT/CgWxunsR121H/FAxCp ghpsWmQhQCNBNsjkJlJ4DTUpY53CUjQjrbYmYAcqZpCF94AuEjVmIf2qwZS+vmfh aVFxDC4k2Nclp9QIh9tYUA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1744734657; x=1744821057; bh=r BU18FZaTpio88tUM6HV7e0qDZR3+6urXVbwKgWas9k=; b=GPWUC6zxbMXt/f7g0 WKePMsTqd6UXwAVYS8NTbl+WpnSESwb4bntsYRSJfCcNtd196BaN1g3pIaoFWZNv CPHVhixjOM5TB/rsPHh1OPlQspO6GKbnrDPV08AmzLjnpRfpVdf/tXVqBD8YDyvh zxFfiaE4ppMAUMmxb3h9xEcwUtKnLgbOfhVfdAV2beCYTMRs6uLjX6wWQe1Is95/ ibBLxGA1jTyaprvrpPjFzxSNJeZWkaR3wvT/kuy07pntxolZyBiWddYSMMRpvHJp 8lL2YSHkzrrJEf1KsrdTD8wZnk1uoa6b/46ulJUhmN5nCtcyP8Woj3d0KxFh+45s AKYmg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvvdefleejucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhepkfffgggfuffvfhfhjggtgfesthekredttddv jeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvg hrsegrkhhlrghvvghrrdgtohhmqeenucggtffrrghtthgvrhhnpeelgeevkeekkeeuiefg tdevieeluefhfedufeetkeejffekjeeujeehgeehgeektdenucffohhmrghinhepphhosh htghhrvghsqhhlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehm rghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomhdpnh gspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepihhkohhr ohhttddusehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqghgvnhgvrhgrlh eslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 15 Apr 2025 12:30:56 -0400 (EDT) Message-ID: <817abeac-d628-4279-bfef-9e1e3aa1884b@aklaver.com> Date: Tue, 15 Apr 2025 09:30:56 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Fwd: Identify system databases To: Igor Korot , "pgsql-generallists.postgresql.org" References: Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 4/15/25 09:21, Igor Korot wrote: > > > Hi, David, > > On Tue, Apr 15, 2025 at 9:56 AM David G. Johnston > > wrote: > > On Tuesday, April 15, 2025, Igor Korot > wrote: > > Hi, ALL, > Is there a field in the pg_databases table which indicates that > particular DB is a system one? > > > What is a system database? > > > I consider system database a database that is created by default when > the server is run for the first time. Agreed. The fact that initdb creates the template0, template1 and postgres databases and you can't change that makes them system not user databases. Further from here: https://www.postgresql.org/docs/devel/app-initdb.html "The postgres database is a default database meant for use by users, utilities and third party applications" indicates that postgres is expected to be in a cluster(system). Lastly the CREATE DATABASE depends on template1 to be there to create at least the first user database. Also template0 is a "clean" template database that allows for using a new encoding in new database. It is also used by pg_dump/restore: CREATE DATABASE test WITH TEMPLATE = template0 ... > > Kind of a predefined set of databases… > > As an example - there is a database called Postgres. It is created when > the server runs for the first time, whether I as a user like it or not. > > Thank you. > > > David J. > -- Adrian Klaver adrian.klaver@aklaver.com