Re: FOR PORTION OF does not recompute GENERATED STORED columns that depend on the range column
Paul A Jungwirth <pj@illuminatedcomputing.com>
From: Paul A Jungwirth <pj@illuminatedcomputing.com>
To: Chao Li <li.evan.chao@gmail.com>
Cc: Peter Eisentraut <peter@eisentraut.org>,
jian he <jian.universality@gmail.com>, SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-05-25T22:23:20Z
Lists: pgsql-hackers
Attachments
On Fri, May 8, 2026 at 8:25 AM Paul A Jungwirth
<pj@illuminatedcomputing.com> wrote:
>
> On Fri, May 8, 2026 at 12:10 AM Chao Li <li.evan.chao@gmail.com> wrote:
> > > <v11-0001-Fix-FOR-PORTION-OF-column-dependency-tracking.patch><v11-0002-Fix-FOR-PORTION-OF-with-partitions-and-inheritan.patch>
> >
> > Thanks for updating the patch and making the separation. After reading v11, I still have a few comments for 0001.
> . . .
>
> v12 attached.
After discussing this as PGConf.dev, Peter and I agreed that we
*should* be checking for UPDATE permission on the application-time
column. So we need to add the attno to updatedCols on the
RTEPermissionInfo. That is great, because it fixes GENERATED column
dependency tracking and also UPDATE OF triggers, without the
complexity of changing ExecGetUpdatedCols.
Note we still do not require INSERT permission for the temporal
leftovers, which is what the SQL Standard says and also makes sense
semantically, since those leftovers represent already-existing
history.
No RLS changes are needed because RLS policies aren't checked based on
*column* changes.
We still need a fix for non-partitioning inheritance, but the patch
becomes a lot simpler.
Here is a patch adding the application-time column to updatedCols,
along with the tests we've written for GENERATED columns and UPDATE OF
triggers.
I'll submit a patch for inheritance on that thread.
--
Paul ~{:-)
pj@illuminatedcomputing.com