Re: XOR operator. - Mailing list pgsql-general

From Jean-Luc Lachance
Subject Re: XOR operator.
Date
Msg-id 3E860952.3F1058C6@nsd.ca
Whole thread Raw
In response to Re: XOR operator.  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Responses Re: XOR operator.  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
List pgsql-general
AFAICR

A xor B = ( A and not B) or ( not A and B)

It is a pain to write, but you can always:

CREATE FUNCTION XOR( boolean, boolean)
RETURNS boolean as '
RETURN ( $1 and not $2) or ( not $1 and $2);
' LANGUAGE 'plpgsql';



Stephan Szabo wrote:
>
> On Fri, 28 Mar 2003, Joshua Moore-Oliva wrote:
>
> > Does postgresql support the xor operator?
>
> You can get bitwise/binary xor (of bitstrings and integers) with the #
> operator AFAICS.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)


pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Recursive Stored Procs?
Next
From: Stephan Szabo
Date:
Subject: Re: XOR operator.