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 74EDF30F4CA for ; Mon, 30 Jun 2003 12:39:31 +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 80610-09 for ; Mon, 30 Jun 2003 09:39:21 -0300 (ADT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id E526A310858 for ; Mon, 30 Jun 2003 09:39:11 -0300 (ADT) Received: (qmail 26263 invoked by uid 500); 30 Jun 2003 12:42:49 -0000 Date: Mon, 30 Jun 2003 07:42:49 -0500 From: Bruno Wolff III To: Rudi Starcevic Cc: pgsql-sql@postgresql.org Subject: Re: Bitwise operation Message-ID: <20030630124249.GB26142@wolff.to> Mail-Followup-To: Rudi Starcevic , pgsql-sql@postgresql.org References: <20030630122815.M76087@oasis.net.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030630122815.M76087@oasis.net.au> User-Agent: Mutt/1.5.4i X-Archive-Number: 200306/336 X-Sequence-Number: 14094 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)