cockroach
cockroach copied to clipboard
sql: support ADD CONSTRAINT ... NOT VALID
Currently, when a constraint is added, the constraint is not validated for existing rows (see #33550). Postgres's behavior (https://www.postgresql.org/docs/11/sql-altertable.html) is to validate newly added constraints for existing rows by default, unless NOT VALID is specified.
We should first address #33550 to bring ADD CONSTRAINT in line with the default behavior of Postgres, and then add NOT VALID as an option.
This is done for check constraints, in #38382
The FK constraint issue is covered by #38663