X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id BDBCED1D838 for ; Wed, 19 Nov 2003 12:32:24 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 61503-05 for ; Wed, 19 Nov 2003 08:31:56 -0400 (AST) Received: from smtp-send.myrealbox.com (smtp-send.myrealbox.com [192.108.102.143]) by svr1.postgresql.org (Postfix) with ESMTP id BA29AD1D83B for ; Wed, 19 Nov 2003 08:31:52 -0400 (AST) Received: from myrealbox.com shridhar_daithankar@smtp-send.myrealbox.com [202.54.11.72] by smtp-send.myrealbox.com with NetMail SMTP Agent $Revision: 3.44 $ on Novell NetWare via secured & encrypted transport (TLS); Wed, 19 Nov 2003 05:31:58 -0700 Message-ID: <3FBB62B5.20507@myrealbox.com> Date: Wed, 19 Nov 2003 18:01:49 +0530 From: Shridhar Daithankar User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031013 Thunderbird/0.3 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Laurent Martelli Cc: Shridhar Daithankar , pgsql-performance@postgresql.org Subject: Re: Join on incompatible types References: <87k75ym1v7.fsf@news.nerim.net> <3FB9F855.7010905@myrealbox.com> <87oev9lsgs.fsf@news.nerim.net> <3FBB138C.4090303@myrealbox.com> <87u150k7mc.fsf@news.nerim.net> <3FBB43AB.30302@myrealbox.com> <87ptfok0zg.fsf@news.nerim.net> In-Reply-To: <87ptfok0zg.fsf@news.nerim.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/156 X-Sequence-Number: 4716 Laurent Martelli wrote: >>>>>>"Shridhar" == Shridhar Daithankar 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