Re: Postgres 15 upgrades and template1 public schema

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruno Wolff III <bruno(at)wolff(dot)to>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Thomas Kellerer <shammat(at)gmx(dot)net>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Postgres 15 upgrades and template1 public schema
Date: 2022-10-19 23:59:52
Message-ID: 2949522.1666223992@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Bruno Wolff III <bruno(at)wolff(dot)to> writes:
> On Wed, Oct 19, 2022 at 23:30:58 +0200,
> Thomas Kellerer <shammat(at)gmx(dot)net> 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron 2022-10-20 00:58:44 pg_restore 12 "permission denied for schema" errors
Previous Message Tom Lane 2022-10-19 23:09:56 Re: Custom function ROWS hint ignored due to inlining?