Re: FOR PORTION OF does not recompute GENERATED STORED columns that depend on the range column - Mailing list pgsql-hackers

From jian he
Subject Re: FOR PORTION OF does not recompute GENERATED STORED columns that depend on the range column
Date
Msg-id CACJufxF0dzDpq83kYo5tO7ojf4eZxy2ba5fecMgsFnKbPrEF4w@mail.gmail.com
Whole thread
In response to Re: FOR PORTION OF does not recompute GENERATED STORED columns that depend on the range column  (Paul A Jungwirth <pj@illuminatedcomputing.com>)
List pgsql-hackers
On Thu, May 7, 2026 at 1:13 AM Paul A Jungwirth
<pj@illuminatedcomputing.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".



pgsql-hackers by date:

Previous
From: Melanie Plageman
Date:
Subject: Re: [PATCH] pg_surgery: Fix WAL corruption from concurrent heap_force_kill
Next
From: Henson Choi
Date:
Subject: Re: CREATE TABLE LIKE INCLUDING TRIGGERS