Re: index not used in ( varchar = text ) - Mailing list pgsql-admin

From Tom Lane
Subject Re: index not used in ( varchar = text )
Date
Msg-id 3085.1046097336@sss.pgh.pa.us
Whole thread Raw
In response to Re: index not used in ( varchar = text )  ("Gaetano Mendola" <mendola@bigfoot.com>)
List pgsql-admin
"Gaetano Mendola" <mendola@bigfoot.com> 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

pgsql-admin by date:

Previous
From: "Donald Fraser"
Date:
Subject: Bugs with rules on views/tables: permission denied
Next
From: Tom Lane
Date:
Subject: Re: Bugs with rules on views/tables: permission denied