PostgreSQL Maestro online Help
Prev | Return to chapter overview | Next |
Checks

A check constraint is the most generic constraint type. It allows you to specify that the value in a certain column must satisfy a Boolean (truth-value) expression.
The Check Properties editor allows you to add a new check constraint or edit an existing one. This dialog can be invoked from Table Editor, or via the popup menu of the corresponding nodes of the explorer tree.
Checks are created within Check Properties. In order to run the wizard you should either
or
or
|
Checks are edited within the Check Properties dialog window. In order to open the dialog you should either
or
You can change the name of the check using the Rename Check dialog. To open the dialog you should either
or
|
To drop the check:
or
and confirm dropping in the dialog window.
|
Name
The name of the check constraint.
Comment
This field contains an optional text describing the check.
OID
This field stores the check OID (object identifier). This is a serial number that is automatically added by PostgreSQL to all checks.
Condition
Specify an expression producing a Boolean result which new or updated rows must satisfy for an insert or update operation to succeed. Expressions evaluating to True or Unknown succeed. In case any row of an insert or update operation produce a FALSE result an error exception is raised and the insert or update does not alter the database.
Not validated
Turn this option ON to skip a scan of the table to verify that all existing rows in the table satisfy the new constraint. In this case the constraint will be applied against new inserts or updates. The database will not assume that the constraint holds for all rows in the table, until it will be validated manually via popup menu of the Checks tab in the Table Editor. Icons for not validated constraints are marked with a red exclamation mark in GUI.
Not enforced
Turn this option ON to prevent the database system from checking the constraint. It is then up to the application code to ensure that the constraints are satisfied. The database system might still assume that the data actually satisfies the constraint for optimization decisions where this does not affect the correctness of the result. Not enforced constraints can be useful as documentation if the actual checking of the constraint at run time is too expensive. Leave this option OFF to oblige the database system to ensure that the constraint is satisfied, by checking the constraint at appropriate times (after each statement or at the end of the transaction, as appropriate). Not enforced check constraints are displayed with a grayscale icon in the GUI.