bitwise storage and operations
От | Jonathan Vanasco |
---|---|
Тема | bitwise storage and operations |
Дата | |
Msg-id | 2B9ADEA9-3B77-4F74-9D49-56B39FEB0DFB@2xlp.com обсуждение исходный текст |
Ответы |
Re: bitwise storage and operations
|
Список | pgsql-general |
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!
В списке pgsql-general по дате отправления: