Re: XOR logical operator

From: Pavel Stehule <stehule(at)kix(dot)fsv(dot)cvut(dot)cz>
To: Nagib Abi Fadel <nagib_postgres(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: XOR logical operator
Date: 2003-10-17 08:12:49
Message-ID: Pine.LNX.4.44.0310171009030.10282-100000@kix.fsv.cvut.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

PostgreSQL hasn't logical operator XOR. But You can find it in cookbook
http://www.brasileiro.net/postgres/cookbook/view-recipes.adp?section_id=41&format=long

Regards
Pavel

On Fri, 17 Oct 2003, Nagib Abi Fadel wrote:

> Is there a XOR logical operator in Postgresql, or a
> function for XOR ??
>
> I only found in the docs a Binary XOR (#).
>
> I need to do the following checkup:
> (field1 is NULL XOR field2 is NULL XOR filed3 is NULL)
>
> i can't right it like this:
> (
> (field1 is NUll or field2 is NUll)
> and (field1 is NUll or field3 is NUll)
> and (field2 is NUll or field3 is NUll)
> )
>
> But if i have alot of fields :
> field1,field2,...,field5
> ... this will take a hell of a time
> I can write a function F1 that does the following:
> if a field is NULL it will return 1
> else it will return 0
>
> then i can do:
> (F1(field1) # F1(field2) # F1(field3) ...)
>
>
> but i just wanted to see if XOR already exists ...
>
>
>
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Shopping - with improved product search
> http://shopping.yahoo.com
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Nick Burrett 2003-10-17 08:56:23 Re: ShmemAlloc errors
Previous Message Nagib Abi Fadel 2003-10-17 08:04:48 XOR logical operator