Re: [HACKERS] bit|varbit #, xor operator

2016-10-17 Thread Robert Haas
On Sun, Oct 16, 2016 at 4:13 PM, Tom Lane wrote: > Jim Nasby writes: >> Personally I think it was a mistake to use # for intersection. Range >> doesn't do that (using * instead), and AFAICT PostGIS doesn't either >> (preferring &). So I propose

Re: [HACKERS] bit|varbit #, xor operator

2016-10-17 Thread David G. Johnston
On Mon, Oct 17, 2016 at 1:39 PM, Jim Nasby wrote: > On 10/17/16 11:29 AM, Tom Lane wrote: > >> Jim Nasby 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 >

Re: [HACKERS] bit|varbit #, xor operator

2016-10-17 Thread Jim Nasby
On 10/17/16 11:29 AM, Tom Lane wrote: Jim Nasby 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

Re: [HACKERS] bit|varbit #, xor operator

2016-10-17 Thread Tom Lane
Jim Nasby 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

Re: [HACKERS] bit|varbit #, xor operator

2016-10-17 Thread Jim Nasby
On 10/16/16 3:13 PM, Tom Lane wrote: As for counting bits in a bitstring, why do we have to make that an operator at all? Using a function would decrease the stress involved in choosing a name, and it's hard to believe that the requirement is so common that we need to shave a few keystrokes.

Re: [HACKERS] bit|varbit #, xor operator

2016-10-16 Thread Tom Lane
Jim Nasby writes: > Personally I think it was a mistake to use # for intersection. Range > doesn't do that (using * instead), and AFAICT PostGIS doesn't either > (preferring &). So I propose renaming those operators, as well as the > XOR ones. I think ^^ is pretty

[HACKERS] bit|varbit #, xor operator

2016-10-16 Thread Jim Nasby
Related to [1], I want to add an operator that returns the count of set (or unset) bits in a bit|varbit input. Given the number of times people ask "how can I get a count of NULL fields" and similar, I expect this to become quite popular. The obvious choice would be to use #, but I was rather