The text for "ADD table_constraint" says that NOT VALID "is currently only allowed for foreign key constraints." Testing with 18.4 shows that this is incorrect. A brief example of it working for a NOT NULL constraint is available here: https://neon.com/postgresql/18/not-null-as-not-valid