Re: Why is a check constraint not working ? - Mailing list pgsql-general

From David G. Johnston
Subject Re: Why is a check constraint not working ?
Date
Msg-id CAKFQuwaYcbZbXQzS74h6ONJPVCKW5Q67ACyTwH5rKB9CuyweBg@mail.gmail.com
Whole thread Raw
In response to Why is a check constraint not working ?  (David Gauthier <davegauthierpg@gmail.com>)
List pgsql-general
On Wed, Apr 29, 2020 at 8:17 AM David Gauthier <davegauthierpg@gmail.com> wrote:

Check constraints:
    "dvm_events_status_check" CHECK (status::text = ANY (ARRAY['passed'::character varying, 'failed'::character varying, NULL::character varying]::text[]))


What could cause this ?   

NULL in the array.

"status = NULL" yields NULL which is a pass for a check constraint.

David J.

pgsql-general by date:

Previous
From: David Gauthier
Date:
Subject: Why is a check constraint not working ?
Next
From: Don Seiler
Date:
Subject: Re: Mixed Locales and Upgrading