make VALIDATE domain constraint lock on related relations as ShareUpdateExclusiveLock

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: make VALIDATE domain constraint lock on related relations as ShareUpdateExclusiveLock
Date: 2025-05-13 03:26:32
Message-ID: CACJufxHz92A88NLRTA2msgE2dpXpE-EoZ2QO61od76-6bfqurA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

hi.

We can still perform DML operations on a table while validating its
check constraint.
Similarly, it should be fine to do DML while validating domain constraints?
but currently, it's not allowed for domain constraints.

The attached patch addresses this problem.
so, with the patch, the following is allowed:

create domain d1 as int;
create table t(a d1);
alter domain d1 add constraint cc10 check(value > 10) not valid;

begin;
alter domain d1 validate constraint cc10;

--another session
INSERT INTO T SELECT 8;

Attachment Content-Type Size
v1-0001-reduce-lock-level-when-ALTER-DOMAIN.VALIDATE-CONSTRAINT.patch text/x-patch 3.6 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2025-05-13 03:27:40 Re: PG 18 release notes draft committed
Previous Message J. Javier Maestro 2025-05-13 03:14:59 fix: propagate M4 env variable to flex subprocess