Re: ALTER TABLE ALTER CONSTRAINT misleading error message

From: Tender Wang <tndrwang(at)gmail(dot)com>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: ALTER TABLE ALTER CONSTRAINT misleading error message
Date: 2025-05-28 09:26:33
Message-ID: CAHewXNn8sDWsXjs675R2dc9MV8_M9AQSU-0yvaVUk8NFeipb+A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

jian he <jian(dot)universality(at)gmail(dot)com> 于2025年5月28日周三 17:10写道:

> 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:
>

It looks like a bug, because constraint cc is not a FOREIGN KEY constraint.

--
Thanks,
Tender Wang

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Guo 2025-05-28 09:28:42 Re: Reduce "Var IS [NOT] NULL" quals during constant folding
Previous Message jian he 2025-05-28 09:09:43 ALTER TABLE ALTER CONSTRAINT misleading error message