Commits on Aug 22, 2026
-
skip unnecessary check constraint verification for UPDATE
In an UPDATE, we can skip verification of any columns that do not depend on any UPDATE target column. But if there is a BEFORE ROW UPDATE trigger, we cannot skip because the trigger may modifies more column. We cache ri_CheckConstraintExprs in ExecConstraints and must initialize them all if different actions like INSERT and UPDATE, happen together in a query. Because both INSERT and UPDATE need to use these ri_CheckConstraintExprs. Invoke INSERT AND UPDATE together will happen within MERGE command. We confirm it's a MERGE operation by checking that resultRelInfo->ri_MergeActions is not NIL. See ExecMergeNotMatched and ExecMergeMatched. For cross-partition updates (ExecCrossPartitionUpdate), the operation splits into an INSERT and DELETE, we can treat it as a single action. Author: jian he <jian.universality@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: li carol <carol.li2025@outlook.com> Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com> Reviewed-by: Florin Irion <irionr@gmail.com> Reviewed-by: Haritabh Gupta <haritabh1992@gmail.com> Discussion: https://postgr.es/m/CACJufxEtY1hdLcx=Fhnqp-ERcV1PhbvELG5COy_CZjoEW76ZPQ@mail.gmail.com context: https://postgr.es/m/1326055327.15293.13.camel%40vanquo.pezone.net commitfest: https://commitfest.postgresql.org/patch/6270