Re: NOT ENFORCED constraint feature

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Amul Sul <sulamul(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Joel Jacobson <joel(at)compiler(dot)org>, Peter Eisentraut <peter(at)eisentraut(dot)org>
Subject: Re: NOT ENFORCED constraint feature
Date: 2024-12-04 10:43:32
Message-ID: CACJufxFV7bZhYnBpQVubrYPN-pSsCs7MYBMNmn34oFwuexos_g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> errmsg("cannot validated NOT ENFORCED constraint")));
> should be
> errmsg("cannot validate NOT ENFORCED constraint")));
> ?
>

looking at it again.

if (!con->conenforced)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("cannot validated NOT ENFORCED constraint")));

ERRCODE_WRONG_OBJECT_TYPE is not that ok? maybe
ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE
or
ERRCODE_INVALID_TABLE_DEFINITION

if (!con->conenforced)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("cannot validated NOT ENFORCED constraint")));
if (!con->convalidated)
{
....
if (con->contype == CONSTRAINT_FOREIGN)
{
/*
* Queue validation for phase 3 only if constraint is enforced;
* otherwise, adding it to the validation queue won't be very
* effective, as the verification will be skipped.
*/
if (con->conenforced)
......
}

in ATExecValidateConstraint "" if (con->conenforced)""" will always be true?

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2024-12-04 10:46:06 Re: Introduce XID age and inactive timeout based replication slot invalidation
Previous Message Matthias van de Meent 2024-12-04 10:39:03 Re: Incorrect result of bitmap heap scan.