Dennis Gearon <gearond@cvc.net> writes:
> I haven't seen what operators can be applied to bit masks.
> In particular, I am looking to use binary AND:
> I want to AND two bitmasks together and see:
> A/ if the result has ANY bits set
> B/ what bits are set in the results.
Why don't you use bit strings, like the SQL spec authors intended?
regression=# select b'10001' & b'01111';
?column?
----------
00001
(1 row)
See types BIT(n) and BIT VARYING(n).
regards, tom lane