| From: | Alexander Korotkov <aekorotkov(at)gmail(dot)com> |
|---|---|
| To: | Noah Misch <noah(at)leadboat(dot)com> |
| Cc: | d(dot)koval(at)postgrespro(dot)ru, pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: SPLIT/MERGE use of is_internal=true |
| Date: | 2026-07-07 23:49:45 |
| Message-ID: | CAPpHfdsVnD=BNHFo37sUkMCBi5EpsSJA3DYRGn5rOSdpVonpuA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, Jul 7, 2026 at 9:57 PM Noah Misch <noah(at)leadboat(dot)com> wrote:
>
> commit f2e4cc4 wrote:
> > +/*
> > + * createPartitionTable:
> > + *
> > + * Create a new partition (newPartName) for the partitioned table (parent_rel).
> > + * ownerId is determined by the partition on which the operation is performed,
> > + * so it is passed separately. The new partition will inherit the access method
> > + * and persistence type from the parent table.
> > + *
> > + * Returns the created relation (locked in AccessExclusiveLock mode).
> > + */
> > +static Relation
> > +createPartitionTable(List **wqueue, RangeVar *newPartName,
> > + Relation parent_rel, Oid ownerId)
> > +{
> ...
> > + /* Create the relation. */
> > + newRelId = heap_create_with_catalog(newPartName->relname,
> > + namespaceId,
> > + parent_relform->reltablespace,
> > + InvalidOid,
> > + InvalidOid,
> > + InvalidOid,
> > + ownerId,
> > + relamId,
> > + descriptor,
> > + NIL,
> > + RELKIND_RELATION,
> > + newPartName->relpersistence,
> > + false,
> > + false,
> > + ONCOMMIT_NOOP,
> > + (Datum) 0,
> > + true,
> > + allowSystemTableMods,
> > + true,
> > + InvalidOid,
> > + NULL);
>
> 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.
------
Regards,
Alexander Korotkov
Supabase
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Don-t-create-SPLIT-MERGE-partitions-as-internal-r.patch | application/octet-stream | 1.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2026-07-07 23:54:06 | Re: Add malloc attribute to memory allocation functions |
| Previous Message | Thomas Munro | 2026-07-07 23:40:23 | Re: Can we get rid of TerminateThread() in pg_dump? |