Use the *Domain Constraint* dialog to create a domain constraint. A domain constraint confirms that the values provided for a domain meet a defined criteria. The *Domain Constraint* dialog implements options of the ALTER DOMAIN command.
The *Domain Constraint* dialog organizes the development of a domain constraint through the following dialog tabs: *General* and *Definition*. The *SQL* tab displays the SQL code generated by dialog selections.
Use the fields in the *Definition* tab to define the domain constraint:
* Use the *Check* field to write a CHECK expression. A CHECK clause specifies a constraint that the domain must satisfy. A constraint must be an expression producing a Boolean result; include the key word VALUE to refer to the value being tested. Only those expressions that evaluate to TRUE or UNKNOWN succeed. A CHECK expressions cannot contain subqueries or refer to variables other than VALUE. When a domain has multiple CHECK constraints, they will be tested in alphabetical order by name.
* Move the *Validate?* switch to the *No* position to mark the constraint NOT VALID. If the constraint is marked NOT VALID, the constraint will not be applied to existing column data. The default value is *Yes*.
Your entries in the *Domain Constraint* dialog generate a SQL command (see an example below). Use the *SQL* tab for review; revisit or switch tabs to make any changes to the SQL command.
**Example**
The following is an example of the sql command generated by user selections in the *Domain Constraint* dialog:
* Click the *Info* button (i) to access online help. View context-sensitive help in the *Tabbed browser*, where a new tab displays the PostgreSQL core documentation.