Re: Addition and subtraction on BIT type - Mailing list pgsql-sql

From Stephan Szabo
Subject Re: Addition and subtraction on BIT type
Date
Msg-id 20031117071700.G94696@megazone.bigpanda.com
Whole thread Raw
In response to Addition and subtraction on BIT type  (Yasir Malik <ymalik@cs.stevens-tech.edu>)
List pgsql-sql
On Mon, 17 Nov 2003, Yasir Malik wrote:

> Thank you for your reply.
> select int4(b'1001')::bit(32); gives the same result as what you gave.
> select int4(b'1001')::bit(4); gives the upper four bits, which are all
> zeroes.  How would I get the lower four bits?  I building bitmaps using
> plpgsql, and therefore, I will be doing a lot bit manipulation.

I think you need to use substring, probably something like:
select substring(9::bit(32) from 29 for 4);


pgsql-sql by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: strange "not deferrable" behaviour
Next
From: Tomasz Myrta
Date:
Subject: Re: strange "not deferrable" behaviour