bit operations - Mailing list pgsql-general

From Johan Björk
Subject bit operations
Date
Msg-id 003801c10473$2a450100$e25843c3@johan.websidorna.com
Whole thread Raw
List pgsql-general
I'm new to PostgreSQL, and I'm trying to migrate a MySQL-implementation to this instead... It's really different from
MySQL,and the docs are not as good, and the IRC-channel (on EFNet at least) is really really inactive. But still. :-)
Maybethe mailinglist is more impressive... 

Have a little problem with bit operaitions that I cannot find the answer to on the Internet. Have been searching
throughthe archives but no result. 

In MySQL you can have a INT column and do bit logic ala C-style like this:
"select * from table where flags & 4;"

Can I do something similar with std SQL? I've been trying to cast everything to BIT but without success, and I've also
beencreating a "flags bit(4)", setting a row to "1000" (8) and trying to compare, but I have absolutely no idea how to. 

Say I wanna check if 8 (1xxx) and 2 (xx1x) is set, how do I do that?!

Please help me! :-)

---
Johan Björk



pgsql-general by date:

Previous
From: "markus jais"
Date:
Subject: which Python interface
Next
From: "Rob Arnold"
Date:
Subject: Re: Red Hat Database Development