Re: index not used in ( varchar = text )

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Gaetano Mendola" <mendola(at)bigfoot(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: index not used in ( varchar = text )
Date: 2003-02-24 01:51:18
Message-ID: 20971.1046051478@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

"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. You need to get rid
of the datatype ambiguity. "text = text" is a different operator from
"varchar = varchar".

regards, tom lane

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Angie tel 2003-02-24 02:02:32 check the date created of the table, Urgent!
Previous Message Stephen Harris 2003-02-23 20:03:47 ident sameuser failure