Thread: OR-ing rows of bits

OR-ing rows of bits

From
"Thomas T. Thai"
Date:
what's the best way of OR-ing rows of bits or integers? SUM works for bits
that are all atomic (1, 2, 4, 8, ...) but not for inclusive (1, 3, 7,
...).


Re: OR-ing rows of bits

From
Antonio Fiol Bonnín
Date:
Thomas T. Thai wrote:

>what's the best way of OR-ing rows of bits or integers? SUM works for bits
>that are all atomic (1, 2, 4, 8, ...) but not for inclusive (1, 3, 7,
>...).
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 2: you can get off all lists at once with the unregister command
>    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
>.
>
I'd bet for a custom aggregate function.

Something like the ready-to-go statement

CREATE AGGREGATE int4or_aggregate ( BASETYPE=int4, SFUNC=int4or,
STYPE=int4 );

Hope that helps.

Antonio Fiol