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 1rNbhw-00DmQO-E5 for pgsql-bugs@arkaria.postgresql.org; Wed, 10 Jan 2024 16:45:36 +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 1rNbhv-005rx1-5J for pgsql-bugs@arkaria.postgresql.org; Wed, 10 Jan 2024 16:45:35 +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 1rNbhu-005rwt-TP for pgsql-bugs@lists.postgresql.org; Wed, 10 Jan 2024 16:45:34 +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.94.2) (envelope-from ) id 1rNbhs-000rx9-3T for pgsql-bugs@lists.postgresql.org; Wed, 10 Jan 2024 16:45:33 +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 40AGjTVT2434706; Wed, 10 Jan 2024 11:45:29 -0500 From: Tom Lane To: "David G. Johnston" cc: "szyjek9302@gmail.com" , "pgsql-bugs@lists.postgresql.org" Subject: Re: BUG #18281: Superuser can rename the schema with the prefix "pg_" (Applies to all versions of postgresql) In-reply-to: References: <18281-5b1b6c5991d345aa@postgresql.org> Comments: In-reply-to "David G. Johnston" message dated "Wed, 10 Jan 2024 06:59:45 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <2434704.1704905129.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Wed, 10 Jan 2024 11:45:29 -0500 Message-ID: <2434705.1704905129@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "David G. Johnston" writes: > On Wednesday, January 10, 2024, PG Bug reporting form < > noreply@postgresql.org> wrote: >> I renamed the schema pg_toast >> moja=# alter schema pg_toast rename to x_pg_toast >> moja-# ; >> ALTER SCHEMA >> and can't undo it because : >> moja=# alter schema x_pg_toast rename to pg_toast; >> ERROR: unacceptable schema name "pg_toast" >> DETAIL: The prefix "pg_" is reserved for system schemas. >> >> I think this is a serious problem that should be fixed by developers. The >> superuser should not be able to rename system schemas. > This isn’t a bug - there is very little effort spent on trying to prevent > the superuser from doing stuff, even stuff that directly breaks their > system. Indeed. Try something like "delete from pg_proc;" (not in a database you want to keep!). This is not significantly different from the fact that root privilege in Unix allows you to do unrecoverable stuff like "rm -rf /". The cost/benefit ratio just isn't there for trying to put training wheels on root, or on superusers. > I do agree that there seems to be some room for improvement here, at least > as far as recovering from the initial bad decision goes. A manual update on pg_namespace.nspname would be enough for getting out of this particular problem. regards, tom lane