Re: exclusive OR possible within a where clause? - Mailing list pgsql-general

From David Salisbury
Subject Re: exclusive OR possible within a where clause?
Date
Msg-id 4E9C7EC0.1020205@globe.gov
Whole thread Raw
In response to Re: exclusive OR possible within a where clause?  (David Fetter <david@fetter.org>)
Responses Re: exclusive OR possible within a where clause?  (John R Pierce <pierce@hogranch.com>)
Re: exclusive OR possible within a where clause?  (Ken Tanzer <ken.tanzer@gmail.com>)
List pgsql-general

On 10/14/11 10:58 AM, David Fetter wrote:
> On Thu, Oct 13, 2011 at 07:49:59PM -0400, Tom Lane wrote:
>> David Salisbury<salisbury@globe.gov>  writes:

>>> Short version, is there a way to implement an exclusive OR in a where clause?
>>
>> The boolean<>  operator will do the trick.
>>
>>     (x = y)<>  (a = b)
>>
>>             regards, tom lane
>
> Factoring in NULLable columns, that's:
>
> (x IS NOT DISTINCT FROM y)<>  (a IS NOT DISTINCT FROM b)
>
> Cheers,
> David.

Thanks for the replies!

I should note ( for the mail list archives I guess )
that the above suggestions don't work.  Both rows are
returned whether I use OR or <>, though maybe I'm not
understanding something.  I'm not sure why <> would work either,
as all I can find is <> is the same as !=, which is
different than the fabled XOR I was hoping for.  In fact
they would never equal.

But in the end it looks like wrapper sql around my output using
"select distinct.." should do the trick.

-Dave

pgsql-general by date:

Previous
From: Henry Drexler
Date:
Subject: Re: Use true and false when bulk-exporting boolean data
Next
From: John R Pierce
Date:
Subject: Re: exclusive OR possible within a where clause?