Re: operators and bit field - Mailing list pgsql-general

From Tom Lane
Subject Re: operators and bit field
Date
Msg-id 11645.1045261788@sss.pgh.pa.us
Whole thread Raw
In response to operators and bit field  (Dennis Gearon <gearond@cvc.net>)
Responses Re: operators and bit field  (Dennis Gearon <gearond@cvc.net>)
List pgsql-general
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

pgsql-general by date:

Previous
From: Clarence Gardner
Date:
Subject: Lots o' I/O
Next
From: Arguile
Date:
Subject: Re: "iscachable" functions