| From: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
|---|---|
| To: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com> |
| Cc: | Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Peter Eisentraut <peter(at)eisentraut(dot)org>, jian he <jian(dot)universality(at)gmail(dot)com> |
| Subject: | Re: Fix ALTER DOMAIN VALIDATE CONSTRAINT locking |
| Date: | 2026-06-12 12:45:00 |
| Message-ID: | 3FB3A348-F15B-4D65-A747-0E747A18EB72@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> On Jun 12, 2026, at 19:47, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>
> On Mon, Jun 8, 2026 at 12:54 PM Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
>> See the attached patch for details. I also added an isolation test that follows the repro above.
>
> Thanks for the patch! It looks good to me.
>
> 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.
>
>
> Regarding the test, I think it would be safer to also check whether
> pg_constraint.convalidated is set correctly. For example:
>
> -----------------------
> step s3_validate { ALTER DOMAIN alter_domain_validate_d VALIDATE
> CONSTRAINT alter_domain_validate_d_pos; }
> +step s3_validated { SELECT convalidated FROM pg_constraint WHERE
> conname = 'alter_domain_validate_d_pos'; }
> step s3_check { SELECT count(*) FROM alter_domain_validate_t; }
>
> -permutation s1_lock s2_insert s3_add s3_validate s1_unlock s3_check
> +permutation s1_lock s2_insert s3_add s3_validate s1_unlock s3_validated s3_chec
> -----------------------
>
>
> 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) §
>
> Regards,
>
> --
> Fujii Masao
Hi Fujii-san,
Thanks for picking this up. PFA v2 that addressed your comments.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
| Attachment | Content-Type | Size |
|---|---|---|
| v2-0001-Fix-ALTER-DOMAIN-VALIDATE-CONSTRAINT-locking.patch | application/octet-stream | 6.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Álvaro Herrera | 2026-06-12 12:53:55 | Re: PSQL - prevent describe listing tables that are already in listed schemas |
| Previous Message | Álvaro Herrera | 2026-06-12 12:32:45 | Re: PSQL - prevent describe listing tables that are already in listed schemas |