Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.postgresql > #197

Re: "explicit type casts" ?

From Mladen Gogala <gogala.mladen@gmail.com>
Newsgroups comp.databases.postgresql
Subject Re: "explicit type casts" ?
Date 2011-08-07 17:37 +0000
Organization solani.org
Message-ID <pan.2011.08.07.17.37.43@gmail.com> (permalink)
References <4e3d9c85$0$313$14726298@news.sunsite.dk>

Show all headers | View raw


On Sat, 06 Aug 2011 21:56:52 +0200, Bjarne Jensen wrote:

> 
> SELECT airport,ident,runway FROM procedures WHERE runway = 35;
> 
> ERROR:  operator does not exist: character varying = integer LINE 1:
> ...LECT airport,ident,runway FROM procedures WHERE runway = 35;
>                                                                    ^
> HINT:  No operator matches the given name and argument type(s). You
> might need to add explicit type casts.
> 
> 
> I tried
> 	 WHERE runway = '35';
> 	 WHERE runway = "35";
> 	 WHERE runway LIKE '35';
> 	 WHERE runway LIKE '%35%';
> 	 WHERE runway LIKE '35%';
> 
> Last one works but why? and what is it all about?
> 
> How does one make a sure-fire workaround to this problem?
> 
> /Bjarne

This may help:


[mgogala@medo ~]$ psql
psql (9.0.2)
Type "help" for help.

mgogala=# create temporary table procedures(runway varchar(10));
CREATE TABLE
mgogala=# insert into procedures values('10');
INSERT 0 1
mgogala=# select runway from procedures where runway=10;
ERROR:  operator does not exist: character varying = integer
LINE 1: select runway from procedures where runway=10;
                                                  ^
HINT:  No operator matches the given name and argument type(s). You might 
need to add explicit type casts.
mgogala=# select runway from procedures where runway::int=10;
 runway 
--------
 10
(1 row)



-- 
http://mgogala.byethost5.com

Back to comp.databases.postgresql | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

"explicit type casts" ? Bjarne Jensen <bjarne.b.jensen@gmail.com> - 2011-08-06 21:56 +0200
  Re: "explicit type casts" ? Robert Klemme <shortcutter@googlemail.com> - 2011-08-07 13:06 +0200
    Re: "explicit type casts" ? Bjarne Jensen <bjarne.b.jensen@gmail.com> - 2011-08-07 18:44 +0200
  Re: "explicit type casts" ? Mladen Gogala <gogala.mladen@gmail.com> - 2011-08-07 17:37 +0000
    Re: "explicit type casts" ? Bjarne Jensen <bjarne.b.jensen@gmail.com> - 2011-08-08 11:13 +0200
      Re: "explicit type casts" ? Mladen Gogala <gogala.mladen@gmail.com> - 2011-08-08 12:03 +0000

csiph-web