Re: UPDATE run check constraints for affected columns only

jian he <jian.universality@gmail.com>

From: jian he <jian.universality@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2026-03-04T01:04:49Z
Lists: pgsql-hackers

Attachments

On Fri, Jan 23, 2026 at 10:09 AM jian he <jian.universality@gmail.com> wrote:
> code has been further simplified and is now more neat.
> The test is kind of verbose now.
>

if (check_attrs &&
    !bms_is_member(-FirstLowInvalidHeapAttributeNumber, check_attrs) &&
    !bms_overlap(check_attrs, updatedCols))
{
        ereport(DEBUG1,
                errmsg_internal("skipping verification for constraint
\"%s\" on table \"%s\"",
                                check[i].ccname,
                                RelationGetRelationName(rel)));
}

We need tests to reach the above ereport(DEBUG1, branch.

We can use
+SET log_statement to NONE;
+SET client_min_messages TO 'debug1';

to make sure the regress output has the DEBUG1 message.



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