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


Groups > comp.databases.postgresql > #197

Re: "explicit type casts" ?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From Mladen Gogala <gogala.mladen@gmail.com>
Newsgroups comp.databases.postgresql
Subject Re: "explicit type casts" ?
Date Sun, 7 Aug 2011 17:37:44 +0000 (UTC)
Organization solani.org
Lines 52
Message-ID <pan.2011.08.07.17.37.43@gmail.com> (permalink)
References <4e3d9c85$0$313$14726298@news.sunsite.dk>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
X-Trace solani.org 1312738664 12060 eJwFwYERACEIA7CVRNpyjKP8d/8RTJgKTUEUaForz8bHwsahvcJ/1GQIjXU5ujzs9LTLxQcJeBCn (7 Aug 2011 17:37:44 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Sun, 7 Aug 2011 17:37:44 +0000 (UTC)
User-Agent Pan/0.133 (House of Butterflies)
X-User-ID eJwNydsBADEEBMCWEo9FOQj9l3A3v6OMizaBQnR1X1K82SouVrkDPU4iO6dTkizD+lEM9n93+wAt8xFo
Cancel-Lock sha1:QKTA+i6gw1tudX6JH33arWmEeas=
X-NNTP-Posting-Host eJwFwYEBwCAIA7CXYNRKz1HA/09YsoLO2uAi1luP4/XOodujXbV3ie2VQ9ZIGKAC0qV6Z+4sGeoEXGYioI5vf955Y0792NYZhA==
Xref x330-a1.tempe.blueboxinc.net comp.databases.postgresql:197

Show key headers only | 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