The CHECK constraint specifies a rule that a group of one or
more columns of a table may contain only those values allowed by
the rule.
-
The CHECK constraint is either a table constraint or a column
constraint.
PostgreSQL automatically creates an unique index to assure
- data integrity. (See CREATE INDEX statement)
-
+ data integrity (See CREATE INDEX statement).
The SQL92 CHECK column constraints can only be defined on, and
refer to, one column of the table. PostgreSQL does not have
this restriction.
-
-
BUGS in CHECK constraint
- The following CHECK constraints gives a parse error like:
- ERROR: parser: parse error at or near "opname":
-
-
- CHECK ( column BETWEEN 'A' AND 'Z' )
- CHECK ( column IN ('A','Z'))
- CHECK ( column NOT LIKE 'A%')
-
-
-
Temporary tables are not currently available in
Postgres.
+
-
TIP: In the current release of Postgres (v6.3.2), to create a temporary
+
In the current release of Postgres (v6.4), to create a temporary
table you must create and drop the table by explicit commands.
- >
+>
+
SQL92 specifies some additional capabilities for CONSTRAINTs,
- it also defines assertions and domain constraints.
+ and also defines assertions and domain constraints.
An assertion is a special type of integrity constraint and share
CHECK clause
- SQL92 specifies some additional capabilities for CHECK:
+ SQL92 specifies some additional capabilities for CHECK in either
+table or column constraints.
+
table constraint definition:
[ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ]
[ [ NOT ] DEFERRABLE ]
+