Choosing Default Enforcement for Newly Declared or Modified Constraints

The EnableNewPrimaryKeysByDefault and EnableNewUniqueKeysByDefault parameter settings govern automatic enforcement of primary key and unique key constraints. The parameter EnableNewCheckConstraintsByDefault governs automatic enforcement of check constraints, and is the only one of the three parameters that is enabled by default.

Important: If you disable enforcement with a parameter, the constraints you create or modify are not enforced unless you specifically enable them using CREATE TABLE or ALTER TABLE.

You do not need to restart your database once you have set these parameters.

You can check individual parameter values using SHOW CURRENT:

=> show current Enablenewcheckconstraintsbydefault;
  level   |                name                | setting
----------+------------------------------------+---------
 DATABASE | EnableNewCheckConstraintsByDefault | 0

When you upgrade to Vertica 8.1.x, the primary and unique key constraints in any tables you carry over are disabled. Existing constraints are not automatically enforced. To enable existing constraints and make them automatically enforceable, manually enable each constraint using the ALTER TABLE ALTER CONSTRAINT statement. This statement triggers constraint enforcement for the existing table contents. Statements roll back if one or more violations occur.