X-Original-To: pgsql-admin@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 49D13474E4F for ; Mon, 24 Feb 2003 09:35:44 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 75780-01 for ; Mon, 24 Feb 2003 09:35:33 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 5D468474E42 for ; Mon, 24 Feb 2003 09:35:33 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id h1OEZa5u003086; Mon, 24 Feb 2003 09:35:36 -0500 (EST) To: "Gaetano Mendola" Cc: pgsql-admin@postgresql.org Subject: Re: index not used in ( varchar = text ) In-reply-to: References: <20971.1046051478@sss.pgh.pa.us> Comments: In-reply-to "Gaetano Mendola" message dated "Mon, 24 Feb 2003 09:41:54 +0100" Date: Mon, 24 Feb 2003 09:35:36 -0500 Message-ID: <3085.1046097336@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new X-Archive-Number: 200302/372 X-Sequence-Number: 7570 "Gaetano Mendola" writes: >> You need to get rid >> of the datatype ambiguity. "text = text" is a different operator from >> "varchar = varchar". > Yes I agree but was not like this in the Postgres 7.2.X version That was a bug, or at least a horridly misdesigned behavior. The operator chosen by the parser is "text = text" (because text is the preferred datatype in the string class). Leaving aside any issues about whether the parser's choice is correct, it is surely no business of the planner to replace that choice with "varchar = varchar" --- but that's what it was doing. The folly of this idea can be seen by realizing that the same code would equally happily replace it with "char = char", which has distinctly different semantics. regards, tom lane