Re: BUG #18281: Superuser can rename the schema with the prefix "pg_" (Applies to all versions of postgresql)

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "szyjek9302(at)gmail(dot)com" <szyjek9302(at)gmail(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #18281: Superuser can rename the schema with the prefix "pg_" (Applies to all versions of postgresql)
Date: 2024-01-10 13:59:45
Message-ID: CAKFQuwZWdpUZ7Q_O8zrc3Hge8HiJ95mpVYtjJTtKkC-K=URjvQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wednesday, January 10, 2024, PG Bug reporting form <
noreply(at)postgresql(dot)org> wrote:

> The following bug has been logged on the website:
>
> Bug reference: 18281
> Logged by: Maciej Szeliga
> Email address: szyjek9302(at)gmail(dot)com
> PostgreSQL version: 16.1
> Operating system: centos 8
> Description:
>
> Hi,
> 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.

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. Seems like there
should be a way, maybe with the alter catalogs GUC, to bypass the error.

David J.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Geoghegan 2024-01-10 15:11:49 Re: BUG #18279: Duplicate key violation and Deadlock when using ON CONFLICT/DO UPDATE with multiple unique indexes
Previous Message feichanghong 2024-01-10 13:56:00 Re:BUG #18280: logical decoding build wrong snapshot for subtransactions