constraint

CHECK

Rejects false conditions. UNKNOWN from NULL passes this rule; combine with NOT NULL when a value is mandatory. Use row-local conditions rather than cross-table checks. Target: PostgreSQL 17; focused syntax.

Formal Syntax & Structure

sql syntaxsql
CHECK (amount > 0)

Working Example

Example Snippetsql
CREATE TABLE t(amount INT CHECK(amount > 0));INSERT INTO t VALUES (NULL),(2);INSERT INTO t VALUES (-1);
SQL Reference