pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Retype
2+ messages / 2 participants
[nested] [flat]

* Retype
@ 2003-06-09 09:24  Rado Petrik <r.p@szm.sk>
  0 siblings, 1 reply; 2+ messages in thread

From: Rado Petrik @ 2003-06-09 09:24 UTC (permalink / raw)
  To: pgsql-sql

Hi, 

I have query  " SELECT id_user FROM user WHERE (freg_u & 2 ) > 0 ".

freg_u is type smallint.
Query return this error.  

PostgreSQL query failed: ERROR: Unable to identify an operator '&' for
types 'smallint' and 'integer' You will have to retype this query using
an explicit cast in 

How I retype freg_u to interger ? 
-- 
Rado Petrik <r.p@szm.sk>





^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Retype
@ 2003-06-10 07:20  Richard Huxton <dev@archonet.com>
  parent: Rado Petrik <r.p@szm.sk>
  0 siblings, 0 replies; 2+ messages in thread

From: Richard Huxton @ 2003-06-10 07:20 UTC (permalink / raw)
  To: Rado Petrik <r.p@szm.sk>; pgsql-sql

On Monday 09 Jun 2003 10:24 am, Rado Petrik wrote:
> I have query  " SELECT id_user FROM user WHERE (freg_u & 2 ) > 0 ".
>
> freg_u is type smallint.

> How I retype freg_u to interger ?
... WHERE (freg_u::integer & 2) ...

Or you could use the more standard but long-winded CAST function

-- 
  Richard Huxton



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2003-06-10 07:20 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-06-09 09:24 Retype Rado Petrik <r.p@szm.sk>
2003-06-10 07:20 ` Richard Huxton <dev@archonet.com>

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