Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!news.glorb.com!feeder.erje.net!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Robert Klemme Newsgroups: comp.databases.postgresql Subject: Re: "explicit type casts" ? Date: Sun, 07 Aug 2011 13:06:02 +0200 Lines: 44 Message-ID: <9a79t1F602U1@mid.individual.net> References: <4e3d9c85$0$313$14726298@news.sunsite.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net NNLrPm0pmW4FGBFMgF7o/wb0TJgf5jWsm4tTuylqPWh1gTc3g= Cancel-Lock: sha1:YVNVg7m980p7YFzZZ6IYPiQLU/k= User-Agent: Mozilla/5.0 (Windows NT 6.0; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0 In-Reply-To: <4e3d9c85$0$313$14726298@news.sunsite.dk> Xref: x330-a1.tempe.blueboxinc.net comp.databases.postgresql:195 On 06.08.2011 21:56, Bjarne Jensen wrote: > I have a table with one column as follows: > > =# \d+ procedures > Table "public.procedures" > Column | Type | Modifiers | Storage | Description > -------------------+-------------------+-----------+----------+------------- > > runway | character varying | | extended | > > > Now: > > 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? Maybe you have trailing whitespace in the column value. > How does one make a sure-fire workaround to this problem? How about a real solution: storing numeric values in numeric types? Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/