X-Original-To: pgsql-sql@postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by developer.postgresql.org (Postfix) with ESMTP id 8454F92557F for ; Mon, 2 Jun 2003 10:29:40 -0400 (EDT) Received: from developer.postgresql.org ([64.117.224.193]) by localhost (developer.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 97967-08 for ; Mon, 2 Jun 2003 10:29:30 -0400 (EDT) Received: from exchange.hq.openratings.com (unknown [141.149.165.226]) by developer.postgresql.org (Postfix) with ESMTP id C21D19251DA for ; Mon, 2 Jun 2003 10:29:29 -0400 (EDT) Received: from openratings.com (cancun.hq.openratings.com [10.0.0.225]) by exchange.hq.openratings.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id K0W58KY7; Mon, 2 Jun 2003 10:29:30 -0400 Message-ID: <3EDB5FC5.7070809@openratings.com> Date: Mon, 02 Jun 2003 10:31:33 -0400 From: Dmitry Tkach User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Rado Petrik Cc: pgsql-sql@postgresql.org Subject: Re: Using & - operator References: <1054560854.622.14.camel@caj> In-Reply-To: <1054560854.622.14.camel@caj> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new X-Archive-Number: 200306/19 X-Sequence-Number: 13777 Rado Petrik wrote: >Hi, > >I have table users; > >id name bin >-------------- > 1 xx 9 > >dec(1) & dec(9) = dec(1) >bin(0001) & bin(1001) = bin(0001) > >This query is bad. > >SELECT name FROM users WHERE id_user=1 AND (bin & 1) > >This query return >"Warning: PostgreSQL query failed: ERROR: right- hand side of AND is >type 'integer', not 'boolean' in" > > I think, you want: ... AND (bin & 1) = 1 just bin&1 returns an *integer*, and you need a *boolean* expression for your criteria. I hope, it helps... Dima >Wow I write corect this query ? > >Thanks. > > > >