Thread
-
Re: [PATCH] Rebuild CHECK constraints after generated column SET EXPRESSION
jian he <jian.universality@gmail.com> — 2026-05-15T02:52:07Z
On Fri, May 15, 2026 at 1:06 AM Ayush Tiwari <ayushtiwari.slg01@gmail.com> wrote: > > I've two minor follow-up comments/questions: > > 1. The "-- indedx with whole-row reference need rebuild" comment is > still in the new SQL/expected blocks for both generated_stored and > generated_virtual: > "-- index with whole-row reference needs rebuild" > Thanks for finding the typo! I did another round of code cleanup and cosmetic refactoring. Main idea still the same: loop through pg_constraint, pg_index, and pg_policy to locate all objects containing whole-row references, then error reporting or remember them for recreation. The commit message was also updated. Later, I will add this thread to https://wiki.postgresql.org/wiki/PostgreSQL_19_Open_Items > 2. The new policy error message: > > errmsg("ALTER TABLE / SET EXPRESSION is not supported for > generated columns in tables that are part of a policy > definition"), > errdetail("%s contains whole row references.", ...) > > I still find this wording a bit awkward. Quoting "ALTER TABLE / > SET EXPRESSION" as a syntactic form in the message is unusual for > tablecmds.c, and the sentence is long. Could we keep it closer to > the surrounding style. > + if (subtype == AT_SetExpression) + ereport(ERROR, + errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("cannot alter generation expression of table %s because %s uses its row type", + RelationGetRelationName(rel), + getObjectDescription(&pol_obj, false)), + errdetail("You might need to drop %s first.", getObjectDescription(&pol_obj, false))); What do you think? -- jian https://www.enterprisedb.com/