Re: BUG #19097: System catalog modifications are allowed by alter
| От | Laurenz Albe |
|---|---|
| Тема | Re: BUG #19097: System catalog modifications are allowed by alter |
| Дата | |
| Msg-id | 7da7d6bed64d5b413eb0269363ec79602504e023.camel@cybertec.at обсуждение исходный текст |
| Ответ на | BUG #19097: System catalog modifications are allowed by alter (PG Bug reporting form <noreply@postgresql.org>) |
| Список | pgsql-bugs |
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
В списке pgsql-bugs по дате отправления: