pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #18281: Superuser can rename the schema with the prefix "pg_" (Applies to all versions of postgresql)
3+ messages / 3 participants
[nested] [flat]

* BUG #18281: Superuser can rename the schema with the prefix "pg_" (Applies to all versions of postgresql)
@ 2024-01-10 13:41  PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 3+ messages in thread

From: PG Bug reporting form @ 2024-01-10 13:41 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: szyjek9302@gmail.com

The following bug has been logged on the website:

Bug reference:      18281
Logged by:          Maciej Szeliga
Email address:      szyjek9302@gmail.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.

Regards
Maciej



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #18281: Superuser can rename the schema with the prefix "pg_" (Applies to all versions of postgresql)
@ 2024-01-10 13:59  David G. Johnston <david.g.johnston@gmail.com>
  parent: PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 3+ messages in thread

From: David G. Johnston @ 2024-01-10 13:59 UTC (permalink / raw)
  To: szyjek9302@gmail.com <szyjek9302@gmail.com>; pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>

On Wednesday, January 10, 2024, PG Bug reporting form <
noreply@postgresql.org> wrote:

> The following bug has been logged on the website:
>
> Bug reference:      18281
> Logged by:          Maciej Szeliga
> Email address:      szyjek9302@gmail.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.

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #18281: Superuser can rename the schema with the prefix "pg_" (Applies to all versions of postgresql)
@ 2024-01-10 16:45  Tom Lane <tgl@sss.pgh.pa.us>
  parent: David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2024-01-10 16:45 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: szyjek9302@gmail.com <szyjek9302@gmail.com>; pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>

"David G. Johnston" <david.g.johnston@gmail.com> 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





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2024-01-10 16:45 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-01-10 13:41 BUG #18281: Superuser can rename the schema with the prefix "pg_" (Applies to all versions of postgresql) PG Bug reporting form <noreply@postgresql.org>
2024-01-10 13:59 ` David G. Johnston <david.g.johnston@gmail.com>
2024-01-10 16:45   ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox