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 4E9C84B0.6010509@globe.gov
Whole thread Raw
In response to Re: exclusive OR possible within a where clause?  (John R Pierce <pierce@hogranch.com>)
Responses Re: exclusive OR possible within a where clause?  (John R Pierce <pierce@hogranch.com>)
Re: exclusive OR possible within a where clause?  ("David Johnston" <polobo@yahoo.com>)
List 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





pgsql-general by date:

Previous
From: Ken Tanzer
Date:
Subject: Re: exclusive OR possible within a where clause?
Next
From: John R Pierce
Date:
Subject: Re: exclusive OR possible within a where clause?