Re: database constraints

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: sklassen(at)commandprompt(dot)com
Cc: Ben <bench(at)silentmedia(dot)com>, Postgres general mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: database constraints
Date: 2004-10-06 17:48:16
Message-ID: 20041006174816.GA18262@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Wed, Oct 06, 2004 at 08:35:21 -0700,
sklassen(at)commandprompt(dot)com wrote:
> * Ben <bench(at)silentmedia(dot)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);

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2004-10-06 18:01:54 Re: dangling permission on tables after drop user.
Previous Message David Fetter 2004-10-06 17:35:43 Re: database constraints

Browse pgsql-hackers by date

  From Date Subject
Next Message Joshua D. Drake 2004-10-06 18:23:48 Re: database constraints
Previous Message Bruce Momjian 2004-10-06 17:43:07 Re: [PATCHES] That dump-comments-on-composite-type-columns