Check Constraint

Description

The CHECK clause specifies an expression producing a Boolean result which new or updated rows must satisfy for an insert or update operation to succeed.

Click here to navigate to the PostgreSQL documentation page for this syntax.

Grammar Syntax

[ CONSTRAINT constraint_name ]
{CHECK ( expression ) [ NO INHERIT ]}
[ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]

Sample Source Patterns

PostgreSQL

CREATE TABLE table1 (
    did     integer,
    name    varchar(40),
    CONSTRAINT con1 CHECK (did > 100 AND name <> '')
);

Snowflake

CREATE TABLE table1 (
    did     integer,
    name    varchar(40)
-- ** MSC-WARNING - MSCEWI1035 - CHECK STATEMENT NOT SUPPORTED **
--    CONSTRAINT con1 CHECK (did > 100 AND name <> '')
);
  1. MSCEWI1035: Check statement not supported.

Last updated

Was this helpful?