Re: [PATCH] Rebuild CHECK constraints after generated column SET EXPRESSION

Ayush Tiwari <ayushtiwari.slg01@gmail.com>

From: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
To: jian he <jian.universality@gmail.com>
Cc: Zsolt Parragi <zsolt.parragi@percona.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2026-05-16T07:18:05Z
Lists: pgsql-hackers
Hi,

On Sat, 16 May 2026 at 11:38, jian he <jian.universality@gmail.com> wrote:

> On Fri, May 15, 2026 at 12:00 PM Ayush Tiwari
> <ayushtiwari.slg01@gmail.com> wrote:
> >
> > One question about the policy part: do we need to disallow SET
> > EXPRESSION for whole-row policy references at all?
> >
> > For ordinary column references, RememberAllDependentForRebuilding()
> > already sees PolicyRelationId, but it only errors for
> > AT_AlterColumnType, not AT_SetExpression.
>
> For AT_SetExpression:
> RememberAllDependentForRebuilding does not handle policy objects.
> We can safely ignore policy objects that contain whole-row variable
> references too.
>
> > Two small cleanup nits if the policy path stays:
> >
> > 1. `attnum` and `colName` are no longer referenced in
> >    RememberWholeRowDependentForRebuilding(), so they can be dropped
> >    from the signature.
> >
> In case we later need to cope with an ALTER TABLE command, such as
> ALTER TABLE DROP COLUMN
> and ALTER COLUMN SET DATA TYPE.
> The signature also aligns with RememberAllDependentForRebuilding.
>
>
Thanks, v5 addresses my concern about policies.  Ignoring whole-row
policy references for SET EXPRESSION makes sense to me, and the comment
explains the distinction clearly.

No further comments from me.

Regards,
Ayush