X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 60E15310A13 for ; Mon, 30 Jun 2003 23:47:18 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 09288-05 for ; Mon, 30 Jun 2003 20:47:07 -0300 (ADT) Received: from water.oasis.net.au (water.oasis.net.au [210.8.139.2]) by svr1.postgresql.org (Postfix) with ESMTP id 0BA333109FA for ; Mon, 30 Jun 2003 20:47:06 -0300 (ADT) Received: from oasis.net.au (guardian [210.8.139.5]) by water.oasis.net.au (8.9.3/8.9.3/Debian 8.9.3-21) with ESMTP id KAA29154 for ; Tue, 1 Jul 2003 10:04:34 +1000 X-Authentication-Warning: water.oasis.net.au: Host guardian [210.8.139.5] claimed to be oasis.net.au Message-ID: <3F00CC31.3030200@oasis.net.au> Date: Tue, 01 Jul 2003 09:48:01 +1000 From: Rudi Starcevic User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 Cc: pgsql-sql@postgresql.org Subject: Re: Bitwise operation References: <20030630122815.M76087@oasis.net.au> <20030630124249.GB26142@wolff.to> In-Reply-To: <20030630124249.GB26142@wolff.to> Content-Type: multipart/alternative; boundary="------------020204050500020502030203" X-Archive-Number: 200306/353 X-Sequence-Number: 14111 This is a multi-part message in MIME format. --------------020204050500020502030203 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Bruno,Hubert, Thanks. It's all crystal clear now. Now I can keep moving on with my app. If all goes well I hope to add a 'techdoc' on how to do this. I've found documents from other DBMS on using Bitwise operations but not PG. Cheers Rudi. Bruno Wolff III wrote: >On Mon, Jun 30, 2003 at 22:28:15 +1000, > Rudi Starcevic wrote: > > >>Hi, >> >>I'm learning to use Postgresql's bitwise operator's as I'm interested >>in building super fast search's based on user selections in web forms. >> >>So far so good but I have just lost it a little so I thought I'd post. >>Please growl at me if I'm asking on the wrong list :-) >> >>I understand this: >> >>SELECT 111 & 11 = 11 >> >>but not this >> >>SELECT 1111 & 111 = 71 >> >>I was expecting the second example to be >> >>SELECT 1111 & 111 = 111 >> >> > >In the above examples the numbers are decimal values. > >Maybe you wanted to do something like the following: > >area=> select b'1111' & b'0111'; > ?column? >---------- > 0111 >(1 row) > >---------------------------(end of broadcast)--------------------------- >TIP 4: Don't 'kill -9' the postmaster > > > --------------020204050500020502030203 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit
Bruno,Hubert,

Thanks.
It's all crystal clear now.

Now I can keep moving on with my app.

If all goes well I hope to add a 'techdoc' on how to do this.
I've found documents from other DBMS on using Bitwise operations
but not PG.

Cheers
Rudi.

Bruno Wolff III wrote:
On Mon, Jun 30, 2003 at 22:28:15 +1000,
  Rudi Starcevic <rudi@oasis.net.au> wrote:
  
Hi,

I'm learning to use Postgresql's bitwise operator's as I'm interested
in building super fast search's based on user selections in web forms.

So far so good but I have just lost it a little so I thought I'd post.
Please growl at me if I'm asking on the wrong list :-)

I understand this:

SELECT 111 & 11 = 11

but not this

SELECT 1111 & 111 = 71

I was expecting the second example to be 

SELECT 1111 & 111 = 111
    

In the above examples the numbers are decimal values.

Maybe you wanted to do something like the following:

area=> select b'1111' & b'0111';
 ?column?
----------
 0111
(1 row)

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

  

--------------020204050500020502030203--