make ALTER DOMAIN VALIDATE CONSTRAINT no-op when constraint is validated

Started by jian he11 months ago3 messageshackers
Jump to latest
#1jian he
jian.universality@gmail.com

hi.

Looking at AlterDomainValidateConstraint, it seems currently, ALTER
DOMAIN VALIDATE
CONSTRAINT will re-validate a VALID constraint, which
would just waste cycles.
Ideally, this operation should be a no-op.

The attached patch addresses this by making ALTER DOMAIN VALIDATE CONSTRAINT a
no-op in such cases.

ALTER TABLE VALIDATE CONSTRAINT is already a no-op when the constraint is VALID.

Attachments:

v1-0001-make-ALTER-DOMAIN-VALIDATE-CONSTRAINT-no-op-when-constrai.patchtext/x-patch; charset=US-ASCII; name=v1-0001-make-ALTER-DOMAIN-VALIDATE-CONSTRAINT-no-op-when-constrai.patchDownload+18-14
#2jian he
jian.universality@gmail.com
In reply to: jian he (#1)
Re: make ALTER DOMAIN VALIDATE CONSTRAINT no-op when constraint is validated

On Wed, May 21, 2025 at 2:49 PM jian he <jian.universality@gmail.com> wrote:

hi.

Looking at AlterDomainValidateConstraint, it seems currently, ALTER
DOMAIN VALIDATE
CONSTRAINT will re-validate a VALID constraint, which
would just waste cycles.
Ideally, this operation should be a no-op.

The attached patch addresses this by making ALTER DOMAIN VALIDATE CONSTRAINT a
no-op in such cases.

ALTER TABLE VALIDATE CONSTRAINT is already a no-op when the constraint is VALID.

hi.

simple rebase.

Attachments:

v2-0001-make-ALTER-DOMAIN-VALIDATE-CONSTRAINT-no-op-when-constraint-is-va.patchtext/x-patch; charset=US-ASCII; name=v2-0001-make-ALTER-DOMAIN-VALIDATE-CONSTRAINT-no-op-when-constraint-is-va.patchDownload+22-20
#3Peter Eisentraut
peter_e@gmx.net
In reply to: jian he (#2)
Re: make ALTER DOMAIN VALIDATE CONSTRAINT no-op when constraint is validated

On 10.10.25 16:42, jian he wrote:

On Wed, May 21, 2025 at 2:49 PM jian he <jian.universality@gmail.com> wrote:

Looking at AlterDomainValidateConstraint, it seems currently, ALTER
DOMAIN VALIDATE
CONSTRAINT will re-validate a VALID constraint, which
would just waste cycles.
Ideally, this operation should be a no-op.

The attached patch addresses this by making ALTER DOMAIN VALIDATE CONSTRAINT a
no-op in such cases.

ALTER TABLE VALIDATE CONSTRAINT is already a no-op when the constraint is VALID.

hi.

simple rebase.

committed