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

jian he <jian.universality@gmail.com>

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

Attachments

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.



--
jian
https://www.enterprisedb.com/