v1-0001-Don-t-create-SPLIT-MERGE-partitions-as-internal-r.patch

application/octet-stream

Filename: v1-0001-Don-t-create-SPLIT-MERGE-partitions-as-internal-r.patch
Type: application/octet-stream
Part: 0
Message: Re: SPLIT/MERGE use of is_internal=true

Patch

Format: format-patch
Series: patch v1-0001
Subject: Don't create SPLIT/MERGE partitions as internal relations
File+
src/backend/commands/tablecmds.c 1 1
From 775398f6823378a682ec5347884fd4a9390d9679 Mon Sep 17 00:00:00 2001
From: Alexander Korotkov <akorotkov@postgresql.org>
Date: Wed, 8 Jul 2026 02:47:07 +0300
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 <noah@leadboat.com>
Discussion: https://postgr.es/m/20260707185751.f9.noahmisch@microsoft.com
---
 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);
 
-- 
2.50.1 (Apple Git-155)