pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dmitry Tkach <dmitry@openratings.com>
To: Rado Petrik <r.p@szm.sk>
Cc: pgsql-sql@postgresql.org
Subject: Re: Using & - operator
Date: Mon, 02 Jun 2003 10:31:33 -0400
Message-ID: <3EDB5FC5.7070809@openratings.com> (raw)
In-Reply-To: <1054560854.622.14.camel@caj>
References: <1054560854.622.14.camel@caj>

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. 
> 
>
>  
>





view thread (2+ messages)

Message-ID: <3EDB5FC5.7070809@openratings.com>
Permalink:  ../3EDB5FC5.7070809@openratings.com/
Also on:    postgresql.org/message-id/3EDB5FC5.7070809@openratings.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: dmitry@openratings.com, r.p@szm.sk
  Subject: Re: Using & - operator
  In-Reply-To: <3EDB5FC5.7070809@openratings.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