Re: constraint -- one or the other column not null

From: Wayne Conrad <wconrad(at)yagni(dot)com>
To: George Pavlov <gpavlov(at)mynewplace(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: constraint -- one or the other column not null
Date: 2006-09-06 14:21:12
Message-ID: 20060906142112.GA2657@yagni.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Sep 06, 2006 at 12:04:18AM -0700, George Pavlov wrote:
> I have two columns, both individually nullable, but a row needs to have
> a value in one or the other. What is the best way to implement the
> constraints?

check (a is null != b is null);

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Srinivas Iyyer 2006-09-06 14:54:50 Re: Removing duplicate keys and updating deleted entry key in other table
Previous Message Andrew Sullivan 2006-09-06 14:19:52 Re: Estimate on gborg rescue?