Re: XOR operator.

From: Jean-Luc Lachance <jllachan(at)nsd(dot)ca>
To: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
Cc: Joshua Moore-Oliva <josh(at)chatgris(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: XOR operator.
Date: 2003-03-29 21:00:02
Message-ID: 3E860952.3F1058C6@nsd.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)postgresql(dot)org)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2003-03-29 21:15:18 Re: XOR operator.
Previous Message Stephan Szabo 2003-03-29 20:13:47 Re: Recursive Stored Procs?