Re: BUG #19097: System catalog modifications are allowed by alter

From: Kirill Reshke <reshkekirill(at)gmail(dot)com>
To: rekgrpth(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19097: System catalog modifications are allowed by alter
Date: 2025-10-29 11:31:39
Message-ID: CALdSSPge_F_R5H6B6n5vi4TpMnPucF4gj2_V4qEfZEAnLD0s6A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, 29 Oct 2025 at 16:02, PG Bug reporting form
<noreply(at)postgresql(dot)org> wrote:
>
> The following bug has been logged on the website:
>
> Bug reference: 19097
> Logged by: RekGRpth
> Email address: rekgrpth(at)gmail(dot)com
> PostgreSQL version: 18.0
> Operating system: docker alpine
> Description:
>
> ```sql
> create table pg_catalog.t (i int);
> ERROR: permission denied to create "pg_catalog.t"
> DETAIL: System catalog modifications are currently disallowed.
>
> create table t (i int);
> CREATE TABLE
>
> alter table t set schema pg_catalog;
> ALTER TABLE
>
> \dS+ t
> Table "pg_catalog.t"
> Column | Type | Collation | Nullable | Default | Storage | Compression |
> Stats target | Description
> --------+---------+-----------+----------+---------+---------+-------------+--------------+-------------
> i | integer | | | | plain | |
> |
> Replica Identity: NOTHING
> Access method: heap
>
> drop table pg_catalog.t;
> DROP TABLE
> ```
>

reproduced here on v13, v16, v18 and HEAD. Looks like we need to teach
ExecAlterObjectSchemaStmt to respect allow_system_table_mods GUC.
PFA doing this by adding checks to CheckSetNamespace

--
Best regards,
Kirill Reshke

Attachment Content-Type Size
v1-0001-Disallow-alter-schema-to-catalog-schema-without-p.patch application/octet-stream 1.2 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Dilip Kumar 2025-10-29 11:32:07 Re: BUG #19097: System catalog modifications are allowed by alter
Previous Message Laurenz Albe 2025-10-29 11:31:13 Re: BUG #19098: Can't create unique gist index, where pg_indexes says that WITHOUT OVERLAPS does exacly that