Search Postgresql Archives

bitwise storage and operations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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!




-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux