Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1olIyj-00031B-PE for pgsql-general@arkaria.postgresql.org; Thu, 20 Oct 2022 00:00:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1olIyi-000074-0G for pgsql-general@arkaria.postgresql.org; Thu, 20 Oct 2022 00:00:04 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1olIyh-00005o-M1 for pgsql-general@lists.postgresql.org; Thu, 20 Oct 2022 00:00:03 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1olIyf-0002vz-9J for pgsql-general@lists.postgresql.org; Thu, 20 Oct 2022 00:00:02 +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 29JNxqIU2949523; Wed, 19 Oct 2022 19:59:52 -0400 From: Tom Lane To: Bruno Wolff III cc: Bruce Momjian , Thomas Kellerer , pgsql-general@lists.postgresql.org Subject: Re: Postgres 15 upgrades and template1 public schema In-reply-to: <20221019224828.GA11721@wolff.to> References: <20221019203602.GA6563@wolff.to> <54d740ed-1158-c8d4-4cae-15c06e95c9e6@gmx.net> <20221019224828.GA11721@wolff.to> Comments: In-reply-to Bruno Wolff III message dated "Wed, 19 Oct 2022 17:48:28 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2949521.1666223992.1@sss.pgh.pa.us> Date: Wed, 19 Oct 2022 19:59:52 -0400 Message-ID: <2949522.1666223992@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Bruno Wolff III writes: > On Wed, Oct 19, 2022 at 23:30:58 +0200, > Thomas Kellerer wrote: >> This is explained in the release notes: >> >> The change applies to new database clusters and to newly-created >> databases in existing clusters. >> Upgrading a cluster or restoring a database dump will preserve >> public's existing permissions. > How do new databases in pre-existing clusters get the new public schema > security if it doesn't come from template1? The release notes could probably use some tweaking here. It looks to me like pg_dumpall (and hence pg_upgrade) will adjust the ownership and permissions of template1's public schema to match what was in the old installation, but it doesn't touch template0. Hence, whether a "newly-created database in an existing cluster" has the old or new properties of the public schema will depend on whether you clone it from template1 or template0. That definitely needs explained, and maybe we should recommend that DBAs consider manually changing what's in template1. regards, tom lane