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