pgbitmap provides a bitmap datatype for Postgres with a full set of functions, operators and aggregates.
This release fixes a number of issues with empty bitmaps and is considered a production release candidate. Any and all feedback is welcomed.
A bitmap is an array of bits, indexed by an integer. Bitmaps provide an efficient means to implement sets of integers. pgbitmap provides functions and operators for:
It differs from the standard Postgres bitstring in that it isn't based around bit zero (bitmap(1000000) does not contain 1,000,000 zeroes followed by a 1) and it has more functionality.
It was developed primarily in order to efficiently manage sets of privileges for Virtual Private Database implementations.
Full documentation is available here