Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vE4zp-004OEF-3g for pgsql-bugs@arkaria.postgresql.org; Wed, 29 Oct 2025 12:09:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1vE4zn-000hTT-De for pgsql-bugs@arkaria.postgresql.org; Wed, 29 Oct 2025 12:09:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vE4zn-000hTL-4L for pgsql-bugs@lists.postgresql.org; Wed, 29 Oct 2025 12:09:42 +0000 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vE4zk-004sgE-02 for pgsql-bugs@lists.postgresql.org; Wed, 29 Oct 2025 12:09:41 +0000 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-b70406feed3so46798866b.3 for ; Wed, 29 Oct 2025 05:09:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1761739774; x=1762344574; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=wX5AKUQkrV9HogxsiIswpf7htTtBoPMnKUPE1/YjmIY=; b=XAORhcMcqYRyW/ujexbfwTVbY2Lh6DpLvKidKoItkW3pcqvKdb5f4Rnq1jSb6aGvNj BBBgNZQNFcEp5mKTa3AqLw3zNAMMvbNKG6rwLKO9I/AuuQ0BQRDeLKempxdgm55IFKQD LhbaH05JZ0NWQWA0EZ1FtTf9dqFHDgpkZfJlw6W4yxgWLZlZbnMARmDRn/l+/WSpadVF krBWX/4sHXeAnL+vW/mkrrtUtVMDS8o1VQJZoRNbkKOC51URTMssDXfPnE8GrxbkGHrE LRkGbK1ne3AZhFPlJtpHGICaJxv6wiL45vpOtMCotg3AEEUwV8xl6d8aBU6ACslO9y2x QYvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761739774; x=1762344574; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=wX5AKUQkrV9HogxsiIswpf7htTtBoPMnKUPE1/YjmIY=; b=U8NxDcuq2g0IBVNjNz/vjGMvOz0cwdCRIC6O8QZrRiWfPn+Rl/4o5hk3cLEyNm2keD U21rnWQtTeL1rSo1cBhYWWPJgMleS9cG0pHG8KYTIl76efK7ug9BNVR5ttUxA8KvuDW3 V6EB+INBNrjluqS8PHe6ufS7UhDkarVsQKpPV2dLK3mKZLA7aOn8TI6bcFB8xYM6kxEE 3E60v+WQl3phBAYuqpedz+WDqShkDYdgL97gSgkgJSpo0vRv0CMdS9yfTJCTw9hlRyRt 7NNwG5VDsOJTPAesP5vhc6e6TW32LcRx/6xrbxF9E7y8lghqjXl8TKhRQ3/dfkRjErfd mIYQ== X-Forwarded-Encrypted: i=1; AJvYcCWBHhp9rudwcbwRaeZqwAI/8pQIoCrARmLY8a/nuRB8b6PoVBm9DyXl0gozvF1j+Z1Hq53uTDGP96ix@lists.postgresql.org X-Gm-Message-State: AOJu0YyDFkHswLrzaSyoQj3A3tzIycRugbXTAgLYbfOKxWfSdsP5Jw1r kH+IPRxuwejK08GTfL/U+Ww2nnQ2pkpuuKd7hwQ4AeDARidoXcNxW0Mregrs0kQOOoE= X-Gm-Gg: ASbGnct+TjOB9kFYcjdVyq5qSSb9Hs3So1sAry4uSiBLPlg5IC4H4GEwaGBcWNtz+eM LXQl6x09I7WzIzOjz961m7JxePVXd+tt/GbWsC4G7/fn++BsKDxFYDBA5srcqeM+ZcS/zJO3XcG h5lbsAHNMoh8LwbF/Bzy6sdSq0hwfzlr/pzBk313gmTlHaBS4Lkwx5KzCHqfPqBnR1aTO5dzNuz pD+UIPKZVrODNC6el+j9A2vMrYhJkexIL+D5wS0zP57VGHGmYi+UGvbpfZU1yFpCoctm/MOY+lg gPIl6D6d4PyDTmSM68nxEYMpGxelRrUv9GNz8QIx8TBIZrOuAkDp++u7QoZjhsi1y+AFfgvHgrv 8hdJInDmC1KDUqZhxeRW2LS21BmITGp8aCei79QinzZ53syf4R0aokrnoRjdIVBgD9vOXCmthAg rWe83DmTiZm3in0g3WkDCSf21drF9z1zWFXPWKvSQ= X-Google-Smtp-Source: AGHT+IGEP+pPPJZfP9dck6BgQQJIzvBNuUM8jUtjaach2yRcUjwu9wn1laIMkJOUKuRbG8xvzucaLg== X-Received: by 2002:a17:907:2d91:b0:b6d:51f1:beee with SMTP id a640c23a62f3a-b703d0664d7mr234011466b.0.1761739773727; Wed, 29 Oct 2025 05:09:33 -0700 (PDT) Received: from laurenz.albe-K4N0CV00F97414D ([2001:871:260:3448:be1a:44:7171:3d57]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b6d854550f2sm1386805066b.70.2025.10.29.05.09.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Oct 2025 05:09:33 -0700 (PDT) Message-ID: <7da7d6bed64d5b413eb0269363ec79602504e023.camel@cybertec.at> Subject: Re: BUG #19097: System catalog modifications are allowed by alter From: Laurenz Albe To: rekgrpth@gmail.com, pgsql-bugs@lists.postgresql.org Date: Wed, 29 Oct 2025 13:09:32 +0100 In-Reply-To: <19097-bfe65aa1043dba27@postgresql.org> References: <19097-bfe65aa1043dba27@postgresql.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.56.2 (3.56.2-2.fc42) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 2025-10-29 at 04:41 +0000, PG Bug reporting form wrote: >=20 > PostgreSQL version: 18.0 >=20 > ```sql > create table pg_catalog.t (i int); > ERROR: permission denied to create "pg_catalog.t" > DETAIL: System catalog modifications are currently disallowed. >=20 > create table t (i int); > CREATE TABLE >=20 > alter table t set schema pg_catalog; > ALTER TABLE >=20 > \dS+ t > Table "pg_catalog.t" > Column | Type | Collation | Nullable | Default | Storage | Compressio= n | > Stats target | Description > --------+---------+-----------+----------+---------+---------+-----------= --+--------------+------------- > i | integer | | | | plain | = | > >=20 > Replica Identity: NOTHING > Access method: heap >=20 > 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 i= t * is allowed to move user defined relations there. Semantics with sear= ch * paths including pg_catalog are too confusing for now. * * But allow creating indexes on relations in pg_catalog even if * allow_system_table_mods =3D 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