Re: database constraints - Mailing list pgsql-general

From Bruno Wolff III
Subject Re: database constraints
Date
Msg-id 20041006174816.GA18262@wolff.to
Whole thread Raw
In response to Re: database constraints  (sklassen@commandprompt.com)
List pgsql-general
On Wed, Oct 06, 2004 at 08:35:21 -0700,
  sklassen@commandprompt.com wrote:
> * Ben <bench@silentmedia.com> [2004-10-06 08:23:11 -0700]:
>
> ALTER TABLE foo ADD CONSTRAINT must_have_a_or_b CHECK (a::int IS NULL
> AND b::int IS NOT NULL OR a::int IS NOT NULL AND b::int IS NULL);

A simpler constraint is:
check (a is null <> b is null);

pgsql-general by date:

Previous
From: David Fetter
Date:
Subject: Re: database constraints
Next
From: Andrew Sullivan
Date:
Subject: Re: dangling permission on tables after drop user.