From: | Howard Rogers <hjr(at)diznix(dot)com> |
---|---|
To: | Stephen Cook <sclists(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Bitmask trickiness |
Date: | 2010-07-23 11:39:59 |
Message-ID: | AANLkTi=e_o=NMJW_R349oxCgN42XdyHYoNGiq+28wVus@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, Jul 23, 2010 at 7:57 PM, Stephen Cook <sclists(at)gmail(dot)com> wrote:
> On 7/23/2010 5:33 AM, Howard Rogers wrote:
>>
>> ...so select * from table where 21205 | 4097 = 21205 would correctly
>> grab that record. So I'm assuming you mean the 'stored value' should
>> be on both sides of the equals test. If so, that would indeed seem to
>> be the ultimate answer to the question (though I wouldn't myself call
>> it a 'plain old equals' :-) )
>>
>>> Hope I was clearer this time. Originally I just fired off a quickie email
>>> to
>>> get you past your coder's block.
>>
>> I do indeed think the magic of "BIT OR" is the missing ingredient I
>> was looking for, and I very much appreciate your help leading me to
>> it. My apologies for being too dense to spot what you were talking
>> about before.
>
> I think I misunderstood you the whole time actually, or maybe was injecting
> some of my other thoughts into your problem. I figured you meant you wanted
> to find records where your probe value has exactly the same bit pattern as
> your stored value (probe bits, and only probe bits, set; hence the "plain
> old equals"). Rather (and I just confirmed this looking at the OP) you want
> any records where the stored value has all of the probe value's bits set,
> regardless of the other bits in the stored value.
>
> So yeah, check if ORing the stored and probe values equals the stored value.
>
> Oh well, even if I misread, glad to help you stumble upon what you wanted
> eventually.
>
> -- Stephen
>
No worries. We got there in the end!
Thanks again,
HJR
From | Date | Subject | |
---|---|---|---|
Next Message | Machiel Richards | 2010-07-23 11:40:36 | Re: Data dumps to files - best methods? |
Previous Message | Ralf Schuchardt | 2010-07-23 11:37:12 | Re: Data dumps to files - best methods? |