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.96) (envelope-from ) id 1whFge-0006g6-0a for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Jul 2026 23:58:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1whFgc-003ckO-24 for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Jul 2026 23:58:47 +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.96) (envelope-from ) id 1whFgc-003cjG-0A for pgsql-hackers@lists.postgresql.org; Tue, 07 Jul 2026 23:58:47 +0000 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1whFgZ-0000000087F-1UyG for pgsql-hackers@postgresql.org; Tue, 07 Jul 2026 23:58:46 +0000 Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-381216921aaso121818a91.1 for ; Tue, 07 Jul 2026 16:58:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; t=1783468721; x=1784073521; darn=postgresql.org; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=lkXqsir1HO41dty/EOcXz9FShvcl51iD8UGgEye/S+A=; b=dpgdqUyZ5NP2nxlWY1NWZgUSGm5MVad8Qf5v/AAGpkVtYheQnrILHK4iv+MN6yMQMK gPcDp6tAj0QEi9OxNtB4ZzWMUDV6sV+vZYgfIYpKJ1ukwcLR+v3TZyNfMi1QGDVjsDs9 hjsVjbkbatfrqVhFP7Q3szro9YTej4UaIavdg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783468721; x=1784073521; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=lkXqsir1HO41dty/EOcXz9FShvcl51iD8UGgEye/S+A=; b=GzJDteNP4QNNaQuYO0b27RI/OnMd2cLKsu1jAoBPmC2fuH9MyeTIYZNLCOpToQ11Hj Y2g5qr1RT6BYkO5n4VCd3fw+9UhwthgU0f1LF3ao5QN8oy97q/xQMq7sjhXfBMi8ph0X VkUOHxZoUzXXOlh48o4s9GeUVU6SBz73pB2K9AU181rhO8MTyaApzmEQeTzTw+IvaSuM tcRJplOprxPrQ7SbBL+FOTNT1JVqWAVWhaxl7SSCkQXJluIdNpWhOMYnUUFz6FENxGjZ gv6SL9V8SwxHD/SLI4qN8MrxbPjvrvebijDjz/XuFBTfqpP/OTEt9jggnUwlfnpt3yv6 Q0+w== X-Forwarded-Encrypted: i=1; AHgh+RobVr8PN2kdm/obRmOkkkmXSK/YP12np7KqhREaJN9154Ei66BxTl0Vgwf/IhEeJrEkMG8WA3ZhzYhBjTJX@postgresql.org X-Gm-Message-State: AOJu0Yx2Nbbp56tTG/pGeyQHZ1hCgH0z8mrVcwzLUUSvQfy/XwuR7Oyz kuMWRoIG11+5rt6n6It3nGBHIleeekBbzJyJlSDLH7uEoqeZfdb8zwV2hvO1LT93fg== X-Gm-Gg: AfdE7ck8mOFTriy/CdmngZq5yt8yLiNj+4+RCID+WXzxxiUs7ck8k0IOR/PKn27frmG 3+Vn6zBIQhyYSKVVCL2OIYyZNxtyTisXERefbOEc+Wj/YVpIzPLHETtnOKrkV7xnSDId4uBroQV LFBYt3qA1Y+nQCM5oY5NkgGcpIra3xCK/tefdqZ90fv7OJD4KW6EKRWu6l8sP9D4wqHAvR71kXH wy588McAZZ6+fBy69MjIlNmInOZTkLzoEobpmfla7LkTFY29MnjDCSjzwofSzKtpPHTTOQCGmGX lI0v39GuVxyPLxlArTUrFspJ88+XvXutUTsy+9Zgl+UR75BKNlqRuhe2kf3l56YU2dxV4d2NZLC GWPiduIBUkluJiOAqTLdXoyJjF/1fKgQOfbcF9uwzXNhJTHGq2NCq7WdfIZxO8qoWDVNqbQ3CZE OHzWfSZk5hr9v8FAeZ5m/noox9fy/EKrBhZonKmysrpfZY X-Received: by 2002:a17:90b:6cf:b0:387:e0cb:c8db with SMTP id 98e67ed59e1d1-389421adc6amr65785a91.36.1783468721552; Tue, 07 Jul 2026 16:58:41 -0700 (PDT) Received: from microsoft.com (c-73-15-160-255.hsd1.ca.comcast.net. [73.15.160.255]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3118ee6091dsm1000834eec.14.2026.07.07.16.58.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Jul 2026 16:58:41 -0700 (PDT) Date: Tue, 7 Jul 2026 16:58:39 -0700 From: Noah Misch To: Alexander Korotkov Cc: d.koval@postgrespro.ru, pgsql-hackers@postgresql.org Subject: Re: SPLIT/MERGE use of is_internal=true Message-ID: <20260707235839.5f.noahmisch@microsoft.com> References: <20260707185751.f9.noahmisch@microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/2.3.0 (2026-01-25) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Jul 08, 2026 at 02:49:45AM +0300, Alexander Korotkov wrote: > On Tue, Jul 7, 2026 at 9:57 PM Noah Misch wrote: > > This and other places in the SPLIT/MERGE patches pass is_internal=true, which > > ultimately flows to hooks with the following meaning: > > > > /* > > * If this flag is set, the user hasn't requested that the object be > > * altered, but we're doing it anyway for some internal reason. > > * Permissions-checking hooks may want to skip checks if, say, we're alter > > * the constraints of a temporary heap during CLUSTER. > > */ > > bool is_internal; > > > > SPLIT/MERGE constitute user requests to create and/or drop tables, so they're > > not like a CLUSTER temporary heap. They should pass is_internal=false, like > > when the user runs CREATE/DROP directly. > > Thank you for catching this. For sure, we shouldn't pass > is_internal=true here. Attached patch fixes this. I'm going to push > it if no objections. > Subject: [PATCH v1] Don't create SPLIT/MERGE partitions as internal relations > > createPartitionTable(), which builds the new partitions for ALTER TABLE > ... SPLIT PARTITION and ALTER TABLE ... MERGE PARTITIONS, passed > is_internal=true to heap_create_with_catalog(). These relations are > created at the explicit request of the user, just like a plain CREATE > TABLE, so pass is_internal=false instead. The is_internal flag is meant > for objects created as an internal implementation detail (for example, a > transient heap built during CLUSTER), and it is observed by > object-access hooks. > > Reported-by: Noah Misch > Discussion: https://postgr.es/m/20260707185751.f9.noahmisch@microsoft.com Log should have a "Backpatch-through: 19" line. > --- > src/backend/commands/tablecmds.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c > index 95abaf4890c..0b6a84b32b7 100644 > --- a/src/backend/commands/tablecmds.c > +++ b/src/backend/commands/tablecmds.c > @@ -23137,7 +23137,7 @@ createPartitionTable(List **wqueue, RangeVar *newPartName, > (Datum) 0, > true, > allowSystemTableMods, > - true, > + false, /* is_internal */ > InvalidOid, > NULL); The edit looks fine for this code site. As I mentioned above, other SPLIT/MERGE code sites need the same change.