Database Designer for PostgreSQL
Constraint Editor | | Previous Next |
Constraint Editor allows you to define and modify check, unique and primary key
constraints on the table. The Constraint Editor is placed within the
Table Editor dialog. Click the Constraints tab of the
Table Editor to manage table constraints.
The main area of the editor is the list of constraints defined on table. The columns of the list
allow you to modify the properties of the particular constraint.

These properties are:
Constraint Name
On optional name for the constraint. If you don't specify a name, the system chooses a name for
you.
Kind
A kind of the constraint. You can choose one of the following kinds:
CHECK. Is the most generic constraint type. It allows you to specify that the value in certain
columns must satisfy a Boolean (truth-value) expression.
UNIQUE. The unique constraints ensure that the data contained in a column or a group of columns
is unique with respect to all the rows in the table.
PRIMARY KEY. Simply put, it's a combination of a unique constraint and a not-null constraint.
Please note, that you could define primary keys right in the
Column Editor.
Fields
A list of columns on which the current constraint is defined. This field is actual only for
primary key and unique constraints.
Expression
This field can be used for setting boolean expression for a check constraint or setting
additional parameters for primary key and unique constraints.
In case of check constraint. A boolean expression that checks input data. The check expression
should involve the column thus constrained, otherwise the constraint would not make too much sense.
Example expression:
discounted_price > 0
In case of primary key or unique constraint. You can type in any additional parameters
for the constraints of that types. For example, you can set tablespace: TABLESPACE tblsp_name.
The buttons under the list allow you to perform the following actions:
- Add - add a new constraint to the end of the list;
- Duplicate - add a new constraint with the same properties as the selected constraint
to the end of the list;
- Delete - remove the selected constraint from the list;
- Up/Down - move the selected constraint along the list.