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 1u4qZa-0088Sg-OX for pgsql-general@arkaria.postgresql.org; Wed, 16 Apr 2025 00:24:15 +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 1u4qZX-002AB8-VW for pgsql-general@arkaria.postgresql.org; Wed, 16 Apr 2025 00:24:12 +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 1u4qZW-002AAp-UU for pgsql-general@lists.postgresql.org; Wed, 16 Apr 2025 00:24:12 +0000 Received: from fout-b4-smtp.messagingengine.com ([202.12.124.147]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u4qZR-000IjD-2m for pgsql-general@lists.postgresql.org; Wed, 16 Apr 2025 00:24:11 +0000 Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id 5491411401EB; Tue, 15 Apr 2025 20:24:04 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Tue, 15 Apr 2025 20:24:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc: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=1744763044; x=1744849444; bh=Pv5tvyJMP/nhD8DXZVstn4pt4JdQsgAMfO6J6ahSUDg=; b= TDOEo4SL2fTMaiK/oX4/z8fG8zXdWLIrXrpWuaieEgb9RoJfpsEotKs/qNlg1/5w eHH4FL/lhAbBq5DIOL7ETNf/bu0ay4HhO63FyqjrMYBdl+34+N2DJbu+0jXM5dNq 0Qfepy3+cydzmlji8sUddX3PaxoDKAixR9wAR+KIFLc7l0zGlv/G8Dx5BSTrUHeR JfSos9RFeXMwUbpknaxLzc77pomTEFnC3h4znZTRVLvqeRAX+E/4I3ALdVYA1ENv c3SUJf2jojHjWk4fE70ca5FxoEZAwhlLmoaBjlCluRBA8kBJtAyLhepF/T+2AB90 Y8RfnKQQTy7IReTgmYMOvA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=1744763044; x= 1744849444; bh=Pv5tvyJMP/nhD8DXZVstn4pt4JdQsgAMfO6J6ahSUDg=; b=s Q9CSOKtZ58gVltaiSdEYEJC3RgcT4ZvF68Tjl1vAVQMCVJeiYd9xLwLNdP+L8K6X vKamN55Vi5NoF2MhD4A5HR+kYjh2QiAtS5oYKi/A0g0ffewz0yA1+hhyicrt5hJR GzMZ4l+5v8lSPpnsU4s/96wcxuHnH1SzutJXhyApMl1VWVAQxyU7vmWk5S1X1Z4j K/rXQ4FSuFIxPL6Kf96EQymWVeGMkS89g3HKuWVLio61PKwEFtS3L5G9or0DmqzF EsCtDTRrxhA20TnEDVJ9oUVMfc6yuQ4XJj2RHBd4yw8yD0Xaqv0MdTAzmZFusH0e 7u83GvZ0SDwIbYNHtmkCg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvvdegledvucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddt vdejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvh gvrhesrghklhgrvhgvrhdrtghomheqnecuggftrfgrthhtvghrnhepgfdufeekhfevfeel veeiueevhedvuddukeduvddvlefhueeuieejtdeuvdevvdeunecuffhomhgrihhnpehpoh hsthhgrhgvshhqlhdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhep mhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmpd hnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegurghv ihgurdhgrdhjohhhnhhsthhonhesghhmrghilhdrtghomhdprhgtphhtthhopehikhhorh hothdtudesghhmrghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhgvghnvghrrghl sehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 15 Apr 2025 20:24:03 -0400 (EDT) Message-ID: Date: Tue, 15 Apr 2025 17:24:02 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Fwd: Identify system databases To: "David G. Johnston" Cc: Igor Korot , "pgsql-generallists.postgresql.org" References: <817abeac-d628-4279-bfef-9e1e3aa1884b@aklaver.com> <25b6cd49-f871-47fe-bf3b-5416637736ca@aklaver.com> 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 11:35, David G. Johnston wrote: > On Tue, Apr 15, 2025 at 11:20 AM Adrian Klaver > > wrote: > > 1) Try connecting(not using single user mode) to a cluster without them. > > First I have had this discussion before and was not successful and I expect the same outcome this time, but I am half Dutch so that is not a concern. > I did.  Here, the full test. > -- freshly initdb cluster exists and is running > > ❯ cat ~/Downloads/test-drops.bash > createdb mydb From Postgres log: CREATE DATABASE mydb; From here: https://www.postgresql.org/docs/current/sql-createdatabase.html "template The name of the template from which to create the new database, or DEFAULT to use the default template (template1). " I know I can use --template=template with createdb, but that still means there has to be a database existing in the initial cluster to use as a template. You can't get around that fact. > 2) Trying creating a database or databases to replace them without them > existing in the first place. > > > Why? See above. It boils down to, there has to be 'seed'(system) databases extant in the cluster created by initdb for a user to move forward. > > > If what you say is true why does initdb lack an option to not create > them on creating a cluster? > > > Well, it has to create one database because it is not possible to > connect to the cluster without naming a specific database. Exactly, the cluster needs a database created by the system to function. > > initdb could allow the user to specify the initial database name and > only create that single database.  It would work. From an earlier post of mine in this thread: "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 ... " It would be possible to do as you say, but then you would need to make the system nature of the process explicit by updating pg_database to include information on what the default template database, the 'clean' template and the 'default connection database' are. As it it stands now it is implicit in the naming and the use of those names by the server code and outside code. > > By creating the initial three databases the system is more usable due to > having established conventions.  They are conventional databases, not > system ones. Then remove them or rename them and see how long it takes the mail server to start glowing with posts to --general and --bugs. The bottom line is the Postgres project has built an infrastructure around those names that the community is plugged into. > > Plus, it leaves the cluster in a state that is generally much more > user-friendly.  And, as shown, people who dislike the convention can > rearrange things into whatever form they desire. > > David J. > -- Adrian Klaver adrian.klaver@aklaver.com