ALTER TABLE ALTER CONSTRAINT misleading error message - Mailing list pgsql-hackers

From jian he
Subject ALTER TABLE ALTER CONSTRAINT misleading error message
Date
Msg-id CACJufxHSp2puxP=q8ZtUGL1F+heapnzqFBZy5ZNGUjUgwjBqTQ@mail.gmail.com
Whole thread Raw
List pgsql-hackers
hi.

create table t(a int, constraint cc check(a  = 1));
ALTER TABLE t ALTER CONSTRAINT cc not valid;
ERROR:  FOREIGN KEY constraints cannot be marked NOT VALID
LINE 1: ALTER TABLE t ALTER CONSTRAINT cc not valid;
                                          ^

the error message seems misleading,
should we consider it as a bug for pg18?
the entry point is in gram.y, following part:

            | ALTER CONSTRAINT name ConstraintAttributeSpec
                {
                    AlterTableCmd *n = makeNode(AlterTableCmd);
                    ATAlterConstraint *c = makeNode(ATAlterConstraint);
                    n->subtype = AT_AlterConstraint;
                    n->def = (Node *) c;
                    c->conname = $3;
                    if ($4 & (CAS_NOT_ENFORCED | CAS_ENFORCED))
                        c->alterEnforceability = true;
                    if ($4 & (CAS_DEFERRABLE | CAS_NOT_DEFERRABLE |
                              CAS_INITIALLY_DEFERRED | CAS_INITIALLY_IMMEDIATE))
                        c->alterDeferrability = true;
                    if ($4 & CAS_NO_INHERIT)
                        c->alterInheritability = true;
                    processCASbits($4, @4, "FOREIGN KEY",
                                    &c->deferrable,
                                    &c->initdeferred,
                                    &c->is_enforced,
                                    NULL,
                                    &c->noinherit,
                                    yyscanner);
                    $$ = (Node *) n;
                }



pgsql-hackers by date:

Previous
From: jian he
Date:
Subject: foreign key on virtual generated column
Next
From: Richard Guo
Date:
Subject: Re: Reduce "Var IS [NOT] NULL" quals during constant folding