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.