X-Original-To: pgsql-admin@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 400724758BD for ; Mon, 24 Feb 2003 03:42:15 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 24467-03 for ; Mon, 24 Feb 2003 03:42:04 -0500 (EST) Received: from news.hub.org (news.hub.org [64.49.215.80]) by postgresql.org (Postfix) with ESMTP id D5531474E5C for ; Mon, 24 Feb 2003 03:41:53 -0500 (EST) Received: by news.hub.org (Postfix, from userid 8) id 91A9B43A69E; Mon, 24 Feb 2003 03:41:53 -0500 (EST) From: "Gaetano Mendola" X-Newsgroups: comp.databases.postgresql.admin Subject: Re: index not used in ( varchar = text ) Date: Mon, 24 Feb 2003 09:41:54 +0100 Organization: Hub.Org Networking Services (http://www.hub.org) Lines: 39 Message-ID: References: <20971.1046051478@sss.pgh.pa.us> Reply-To: "Gaetano Mendola" X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 To: pgsql-admin@postgresql.org X-Virus-Scanned: by amavisd-new X-Archive-Number: 200302/369 X-Sequence-Number: 7567 ----- Original Message ----- From: "Tom Lane" Newsgroups: comp.databases.postgresql.admin Sent: Monday, February 24, 2003 2:57 AM Subject: Re: index not used in ( varchar = text ) > "Gaetano Mendola" writes: > >> Why would you want to cast that to text, if your field is a varchar? > > > Of course that example was a semplification of a real > > situation: > > .......... > > my_login ALIAS FOR $1; > > > SELECT * > > FROM user_login > > WHERE login = my_login; > > > and $1 is of type TEXT. > > So declare it as VARCHAR. Or cast it to varchar. I did, and fortunatelly I found this behaviour before to upgrade the production database. > 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 Ciao Gaetano. html