bitwise storage and operations
От
Jonathan Vanasco
Тема
bitwise storage and operations
Дата
Msg-id
2B9ADEA9-3B77-4F74-9D49-56B39FEB0DFB@2xlp.com
Список
Дерево обсуждения
bitwise storage and operations Jonathan Vanasco <postgres@2xlp.com>
Re: bitwise storage and operations "David G. Johnston" <david.g.johnston@gmail.com>
We've been storing some "enumerated"/"set" data in postgresql as INT or BIT(32) for several years for some flags/toggles on records. This was preferable for storage to the ENUM type (or multiple columns), as we often changed the number of enumerated options or their labels -- and computing everything in the application saved the trouble of database migrations. This has worked 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't figure out how. The documentation doesn't have any examples for SELECT for the bitwise operators, and everything I've found on various threads/forums has 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 query that 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!
В списке pgsql-general по дате отправления