Search Postgresql Archives

Re: Bitmask trickiness

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/23/2010 2:38 AM, Howard Rogers wrote:
Still doesn't answer the precise, specific technical question I
>>  actually asked, though, does it?!
>
>  Which was answered by Stephen Cook was it not?  I.e. use plain old equals?
Maybe I should assume you haven't read the thread, then?! God knows
what that answer even actually meant, but hopefully you read my reply
where I pointed out that it's no answer at all. 21205&  4098 = what,
precisely? Never mind: another rhetorical question. Plain old equals
doesn't come close.


Hate to interrupt your flame war, and I apologize for not being precise in my meaning first try... You don't need any bitwise anything to compare two bitmasks-hiding-in-integers, just check for equality.

Instead of "select * from coloursample where colour & 10 = 10;" just try "select * from coloursample where colour = 10;".

If you want to probe for two values, that MUST be in there, and WITHOUT anything else, bitwise OR them together as the probe value and use plain old equals there too. You only need the bitwise AND stuff for checking for a value that MUST be in there, regardless of whether or not other values are in there as well.

Hope I was clearer this time. Originally I just fired off a quickie email to get you past your coder's block.

-- Stephen

--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux