Re: exclusive OR possible within a where clause?

From: David Salisbury <salisbury(at)globe(dot)gov>
To: John R Pierce <pierce(at)hogranch(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: exclusive OR possible within a where clause?
Date: 2011-10-17 19:40:32
Message-ID: 4E9C84B0.6010509@globe.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/17/11 1:19 PM, John R Pierce wrote:
> On 10/17/11 12:15 PM, David Salisbury wrote:
>> <> is the same as !=, which is
>> different than the fabled XOR I was hoping for. In fact
>> they would never equal.
>
> F != F -> false
> F != T -> true
> T != F -> true
> T != T -> false
>
>
> how is that different than XOR, assuming the arguments are booleans ?
>
>

Perhaps what I'm hoping to do got munged. In essence it's equivalent of..

create table test ( something numeric );
insert into test values ( 1 );
insert into test values ( 2 );

select * from test where ( something = 1.5 + .5 ) or ( something = 1.5 - .5 );
something
-----------
1
2
(2 rows)

select * from test where ( something = 1.5 + .5 ) <> ( something = 1.5 - .5 );
something
-----------
1
2
(2 rows)

( which is of course equivalent of where something = 1 or something = 2 )

In my fabled XOR, I'd get the first one it matched, say something = 1, and the
something = 2 would then be ignored/dropped.

Dave

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2011-10-17 20:12:07 Re: exclusive OR possible within a where clause?
Previous Message Ken Tanzer 2011-10-17 19:21:26 Re: exclusive OR possible within a where clause?