Dennis Bjorklund <db@zigo.dhs.org> writes:
> On Wed, 17 Sep 2003, Tom Lane wrote:
>> So I'm beginning to think that avoiding cross-type operators is not the
>> right route to a solution anyway. It may be better to leave the parser
>> alone and teach the planner how to switch to the alternate
>> representation when and where appropriate.
> Yes, and the planner needs information about what alternative
> representations there are (which is the same as letting the planner insert
> coercions and selecting what == operator to use, or are you thinking of
> something else).
Right. My pg_amsecop catalog proposal of yesterday could be seen as
providing knowledge about valid/useful transformations of this form
(ignoring the linkage to index opclasses, which I now see to be
possibly irrelevant).
> Another problem is of course if one let the planner do too much work and
> have to many possible plans to choose from, it has to be fast.
I don't think it's a big problem; this would add at most one catalog
lookup in each situation where an indexed column is compared to
something of a different type. And the plans involved would usually
be ones we'd want to find, I think.
regards, tom lane