Re: How do i extract a certain bit from a bigint column - Mailing list pgsql-sql

From Bruno Wolff III
Subject Re: How do i extract a certain bit from a bigint column
Date
Msg-id 20040512181620.GB4372@wolff.to
Whole thread Raw
In response to Re: How do i extract a certain bit from a bigint column  (Mike Rylander <miker@purplefrog.com>)
List pgsql-sql
On Wed, May 12, 2004 at 08:17:39 -0400, Mike Rylander <miker@purplefrog.com> wrote:
> 
> The easiest way is to test for a bit using bitwise and:
> 
> SELECT * FROM table WHERE (status & 2::BIGINT) <> 0 AND (status & 8::BIGINT) = 
> 0;

The following will probably be a bit faster:
SELECT * FROM table WHERE (status & 10::BIGINT) = 8;


pgsql-sql by date:

Previous
From: Theodore Petrosky
Date:
Subject: where is this problem (trigger)
Next
From: "Jie Liang"
Date:
Subject: Re: \set