Re: Join on incompatible types

From: Shridhar Daithankar <shridhar_daithankar(at)myrealbox(dot)com>
To: Laurent Martelli <laurent(at)aopsys(dot)com>
Cc: Shridhar Daithankar <shridhar_daithankar(at)myrealbox(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Join on incompatible types
Date: 2003-11-19 12:31:49
Message-ID: 3FBB62B5.20507@myrealbox.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Laurent Martelli wrote:

>>>>>>"Shridhar" == Shridhar Daithankar <shridhar_daithankar(at)myrealbox(dot)com> writes:
>
>
> [...]
>
> Shridhar> 2. Try following query EXPLAIN ANALYZE SELECT * from lists
> Shridhar> join classes on classes.id=lists.value where
> Shridhar> lists.id='16'::integer;
>
> Shridhar> classes.id=lists.value::integer.
>
> With classes.id of type integer and lists.value of type varchar, I get
> "ERROR: Cannot cast type character varying to integer", which is not
> such a surprise.

Try to_numbr function to get a number out of string. Then cast it to integer.

http://developer.postgresql.org/docs/postgres/functions-formatting.html

I hope that works. Don't have postgresql installation handy here..

Shridhar

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Shridhar Daithankar 2003-11-19 14:10:46 Re: More detail on settings for pgavd?
Previous Message Laurent Martelli 2003-11-19 12:16:03 Re: Join on incompatible types