Re: index not used in ( varchar = text )

From: "Gaetano Mendola" <mendola(at)bigfoot(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: index not used in ( varchar = text )
Date: 2003-02-24 08:41:54
Message-ID: b3clsg$o2q$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

----- Original Message -----
From: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Newsgroups: comp.databases.postgresql.admin
Sent: Monday, February 24, 2003 2:57 AM
Subject: Re: index not used in ( varchar = text )

> "Gaetano Mendola" <mendola(at)bigfoot(dot)com> 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

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message er 2003-02-24 11:10:52 Re: PostgreSQL User On Mac OS X
Previous Message Rajesh Kumar Mallah 2003-02-24 05:10:57 Re: \d tablename with psql over slow links...