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

From Álvaro Herrera
Subject Re: ALTER TABLE ALTER CONSTRAINT misleading error message
Date
Msg-id 202505281159.3mjhwmmf6wuz@alvherre.pgsql
Whole thread Raw
In response to ALTER TABLE ALTER CONSTRAINT misleading error message  (jian he <jian.universality@gmail.com>)
List pgsql-hackers
On 2025-May-28, jian he wrote:

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

We discussed this already, didn't we?  There's a thread with IIRC three
proposed patches for this.  I think I liked this one the most:

https://postgr.es/m/CAAJ_b97hd-jMTS7AjgU6TDBCzDx_KyuKxG+K-DtYmOieg+giyQ@mail.gmail.com

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
"Computing is too important to be left to men." (Karen Spärck Jones)



pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: Add CHECK_FOR_INTERRUPTS in polling loop code path in XactLockTableWait
Next
From: Tender Wang
Date:
Subject: Re: Foreign key validation failure in 18beta1