We've been storing some "enumerated"/"set" data in postgresql as INT or BIT(32) for several years for some
flags/toggleson records.
This was preferable for storage to the ENUM type (or multiple columns), as we often changed the number of enumerated
optionsor their labels -- and computing everything in the application saved the trouble of database migrations. This
hasworked out perfectly -- until today.
For the first time ever, we need to run some queries that filter on these columns at the PostgreSQL level -- and I
can'tfigure out how.
The documentation doesn't have any examples for SELECT for the bitwise operators, and everything I've found on various
threads/forumshas addressed inserts or converting on a select -- but never a comparison.
I've tried numerous forms and have gotten as far as CASTing everything to BIT(n), but I can't seem to construct a valid
querythat can filter what I want.
Can anyone share a sample WHERE clause or two that does a bitwise comparison against an INT or BIT column?
Thanks!