From: Laurenz Albe <laurenz.albe@cybertec.at>
To: rekgrpth@gmail.com
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #19097: System catalog modifications are allowed by alter
Date: Wed, 29 Oct 2025 13:09:32 +0100
Message-ID: <7da7d6bed64d5b413eb0269363ec79602504e023.camel@cybertec.at> (raw)
In-Reply-To: <19097-bfe65aa1043dba27@postgresql.org>
References: <19097-bfe65aa1043dba27@postgresql.org>
On Wed, 2025-10-29 at 04:41 +0000, PG Bug reporting form wrote:
>
> PostgreSQL version: 18.0
>
> ```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
> ```
That is confusing, but it seems intentional. See the following comment in
src/backend/catalog/heap.c:
/*
* Don't allow creating relations in pg_catalog directly, even though it
* is allowed to move user defined relations there. Semantics with search
* paths including pg_catalog are too confusing for now.
*
* But allow creating indexes on relations in pg_catalog even if
* allow_system_table_mods = off, upper layers already guarantee it's on a
* user defined relation, not a system one.
*/
This was deliberately added by commit 8e18d04d4daf.
I couldn't find the pertinent discussion in the archives.
I don't think it is necessary to document that...
Yours,
Laurenz Albe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: laurenz.albe@cybertec.at, rekgrpth@gmail.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #19097: System catalog modifications are allowed by alter
In-Reply-To: <7da7d6bed64d5b413eb0269363ec79602504e023.camel@cybertec.at>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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