Re: bit|varbit #, xor operator

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: bit|varbit #, xor operator
Date: 2016-10-17 20:39:04
Message-ID: 9adb4799-3f9d-69c2-a890-99d59b9d2128@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10/17/16 11:29 AM, Tom Lane wrote:
> Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com> writes:
>> On 10/16/16 3:13 PM, Tom Lane wrote:
>>>> Related to this I'd also like to add a boolean XOR operator as that's a
>>>> relatively common request/question.
>
>>> We have boolean XOR; it's spelled "<>".
>
>> I always forget about that...
>
> Maybe it should be mentioned explicitly in the docs.

Hrm, went to go add it and it appears we don't have a section for
boolean type operators. I guess I should add it to 9.1?

>> though, it doesn't work for boolean arrays.
>
> Define doesn't work?

I would expect array[true, false] XOR array[true, true] to return
array[false, true], but <> just returns a single true (since the arrays
are !=).

Though, I guess what would make the most sense there is a map function
that would apply an operator or function to every element of a set of
arrays. But I don't see any way to do that without major changes to how
anyarray works.
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532) mobile: 512-569-9461

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-10-17 20:42:30 Re: Add PGDLLEXPORT to PG_FUNCTION_INFO_V1
Previous Message Andres Freund 2016-10-17 20:35:51 Re: process type escape for log_line_prefix