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


Groups > comp.databases.postgresql > #195

Re: "explicit type casts" ?

From Robert Klemme <shortcutter@googlemail.com>
Newsgroups comp.databases.postgresql
Subject Re: "explicit type casts" ?
Date 2011-08-07 13:06 +0200
Message-ID <9a79t1F602U1@mid.individual.net> (permalink)
References <4e3d9c85$0$313$14726298@news.sunsite.dk>

Show all headers | View raw


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/

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