Re: FOR PORTION OF does not recompute GENERATED STORED columns that depend on the range column

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, SATYANARAYANA NARLAPURAM <satyanarlapuram(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: FOR PORTION OF does not recompute GENERATED STORED columns that depend on the range column
Date: 2026-05-07 01:14:47
Message-ID: CACJufxF0dzDpq83kYo5tO7ojf4eZxy2ba5fecMgsFnKbPrEF4w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, May 7, 2026 at 1:13 AM Paul A Jungwirth
<pj(at)illuminatedcomputing(dot)com> wrote:
>
> Sorry, I didn't have injection_points enabled, but now I see it too.
> The attached v9 fixes it.
>

diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c
index 1eb6b9f1f40..363830f0158 100644
--- a/src/backend/executor/execUtils.c
+++ b/src/backend/executor/execUtils.c
@@ -1408,6 +1408,7 @@ Bitmapset *
ExecGetUpdatedCols(ResultRelInfo *relinfo, EState *estate)
{
RTEPermissionInfo *perminfo = GetResultRTEPermissionInfo(relinfo, estate);
+ Bitmapset *updatedCols = perminfo->updatedCols;

if (perminfo == NULL)

----------------------------------------------------
v8 crashes because in some cases, `perminfo` is NULL and we are
``perminfo->updatedCols;``

/*
* If we don't have a ForPortionOfState yet, we must be a partition
* child being hit for the first time. Make a copy from the root, with
* our own TupleTableSlot. We do this lazily so that we don't pay the
* price of unused partitions.
*/
if ((((ModifyTable *) context.mtstate->ps.plan)->forPortionOf) &&
!resultRelInfo->ri_forPortionOf)
{
ExecInitForPortionOf(context.mtstate, estate, resultRelInfo);
}

the comment "partition child" seems not 100% accurate.
Since we also need to consider table inheritance.
Maybe replace it with "child table".

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Henson Choi 2026-05-07 01:38:35 Re: CREATE TABLE LIKE INCLUDING TRIGGERS
Previous Message Melanie Plageman 2026-05-06 23:54:36 Re: [PATCH] pg_surgery: Fix WAL corruption from concurrent heap_force_kill