pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: Yasir Malik <ymalik@heineken.cs.stevens-tech.edu>
Cc: pgsql-sql@postgresql.org
Subject: Re: Addition and subtraction on BIT type
Date: Mon, 17 Nov 2003 07:18:18 -0800 (PST)
Message-ID: <20031117071700.G94696@megazone.bigpanda.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0311170907360.9844@heineken.cs.stevens-tech.edu>
References: <Pine.SGI.4.58.0311161117410.129151@guinness.cs.stevens-tech.edu>
	<Pine.SGI.4.58.0311162055350.144387@guinness.cs.stevens-tech.edu>
	<20031116213918.P81284@megazone.bigpanda.com>
	<Pine.LNX.4.58.0311170907360.9844@heineken.cs.stevens-tech.edu>

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);



view thread (7+ messages)

Message-ID: <20031117071700.G94696@megazone.bigpanda.com>
Permalink:  ../20031117071700.G94696@megazone.bigpanda.com/
Also on:    postgresql.org/message-id/20031117071700.G94696@megazone.bigpanda.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: sszabo@megazone.bigpanda.com, ymalik@heineken.cs.stevens-tech.edu
  Subject: Re: Addition and subtraction on BIT type
  In-Reply-To: <20031117071700.G94696@megazone.bigpanda.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox