Re: UPDATE run check constraints for affected columns only

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Florin Irion <irionr(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Haritabh Gupta <haritabh1992(at)gmail(dot)com>
Subject: Re: UPDATE run check constraints for affected columns only
Date: 2026-09-02 02:38:22
Message-ID: CACJufxGWWhMvVB5Bu_nDCo9nyTga1DQgWKGZZt-0Ko5Y=NA5Sw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Mar 7, 2026 at 5:46 PM jian he <jian(dot)universality(at)gmail(dot)com> wrote:
>
> OK. I kept these tests. I think covering this scenario is useful. Perhaps it
> has already been tested elsewhere, but including it here makes the tests more
> complete
>

+SET log_statement to NONE;
+SET client_min_messages TO 'debug1';
+
+-- constraint cc contain whole-row reference therefore cannot be skipped
+UPDATE upd_check_skip0 SET a = 2;

In V7, setting client_min_messages to capture DEBUG1 messages in
regression tests is not a good idea, as other messages may also be
emitted.
So I added some tests on test/modules/test_misc/t/001_constraint_validation.pl.

I also made some cosmetic changes to make ExecRelCheck more readable.

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

Attachment Content-Type Size
v8-0001-skip-unnecessary-check-constraint-verification-for-UPDATE.patch text/x-patch 14.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2026-09-02 02:42:06 Re: PSQL schema "describe" \dn is not escaping quotes
Previous Message Chao Li 2026-09-02 02:13:48 Re: Include sequences in publications created by pg_createsubscriber