make VALIDATE domain constraint lock on related relations as ShareUpdateExclusiveLock

Поиск
Список
Период
Сортировка
Искать

make VALIDATE domain constraint lock on related relations as ShareUpdateExclusiveLock

От:
jian he <jian.universality@gmail.com>
Дата:
Вложения:
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;

Re: make VALIDATE domain constraint lock on related relations as ShareUpdateExclusiveLock

От:
Dilip Kumar <dilipbalaut@gmail.com>
Дата:
On Tue, May 13, 2025 at 8:57 AM jian he  wrote:
>
> 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.

This makes sense, and the patch also looks good to me.

-- 
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com


Re: make VALIDATE domain constraint lock on related relations as ShareUpdateExclusiveLock

От:
wenhui qiu <qiuwenhuifx@gmail.com>
Дата:
HI 
   Thanks for the patch! and overall this is a valuable improvement in terms of concurrency and consistency with table-level behavior.The refactoring to pass LOCK MODE into validateDomainCheckConstraint() improves flexibility and clarity. and the patch also looks good to me.


Regards

On Tue, May 13, 2025 at 2:23 PM Dilip Kumar <dilipbalaut@gmail.com> wrote:
On Tue, May 13, 2025 at 8:57 AM jian he <jian.universality@gmail.com> wrote:
>
> 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.

This makes sense, and the patch also looks good to me.

--
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com


Re: make VALIDATE domain constraint lock on related relations as ShareUpdateExclusiveLock

От:
Peter Eisentraut <peter@eisentraut.org>
Дата:
Committed.

Note that the proposed commit message had an example using ALTER TABLE, 
which was not right.  I used an example from your email using ALTER 
DOMAIN instead.


On 13.05.25 11:34, wenhui qiu wrote:
> HI
>     Thanks for the patch! and overall this is a valuable improvement in 
> terms of concurrency and consistency with table-level behavior.The 
> refactoring to pass LOCK MODE into validateDomainCheckConstraint() 
> improves flexibility and clarity. and the patch also looks good to me.
> 
> 
> Regards
> 
> On Tue, May 13, 2025 at 2:23 PM Dilip Kumar  > wrote:
> 
>     On Tue, May 13, 2025 at 8:57 AM jian he      > wrote:
>      >
>      > 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.
> 
>     This makes sense, and the patch also looks good to me.
> 
>     -- 
>     Regards,
>     Dilip Kumar
>     EnterpriseDB: http://www.enterprisedb.com 
> 
> 



FAQ