> On Jun 12, 2026, at 21:02, Álvaro Herrera <[email protected]> wrote:
>
> Hello,
>
> On 2026-Jun-12, Fujii Masao wrote:
>
>> I just have a few minor review comments.
>>
>> * The lockmode is used for relations using the domain. It should be
>> * ShareLock when adding a new constraint to domain. It can be
>> * ShareUpdateExclusiveLock when validating an existing constraint.
>>
>> This comment in validateDomainCheckConstraint() still references
>> ShareUpdateExclusiveLock, so it seems to need updating.
>
> I may be missing something, but doesn't changing the
> ShareUpdateExclusive lock to ShareLock means essentially reverting
> 16a0039dc0d1? I mean, the code was previously using ShareLock for both
> uses of validateDomainCheckConstraint(); and what that commit did was
> change AlterDomainValidateConstraint() to use ShareUpdateExclusiveLock,
> while AlterDomainAddConstraint() retained the stronger ShareLock level.
> If we now change AlterDomainValidateConstraint() back to ShareLock, then
> the aforementioned commit has no effect whatsoever.
From a runtime behavior perspective, yes, this patch reverts the behavior
change made by 16a0039dc0d1.
However:
* 16a0039dc0d1 also refactored validateDomainCheckConstraint() to allow passing
in the lock mode, and I think that refactoring is still useful and maybe worth
keeping.
* A follow-up commit, a99c6b56f, made validating an already-validated
constraint a no-op. A direct revert of 16a0039dc0d1 would conflict with later
changes around this code.
* This patch also adds a test to prevent future changes from making the same
mistake.
>
>> After the fix is committed, we should probably also ask Bruce to update
>> the following v19 release note item?:
>>
>> Reduce lock level of ALTER DOMAIN ... VALIDATE CONSTRAINT to match
>> ALTER TABLE ... VALIDATE CONSTRAINT (Jian He) §
>
> If we make this change, then the release note item should be removed
> entirely, ISTM.
>
True. Once this patch is pushed, this item should be removed from the release
note.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/