Heikki Linnakangas <heikki@enterprisedb.com> writes:
> Tom Lane wrote:
>> I guess the right answer is to fix equivclass.c to strip RelabelTypes,
>> and hope to maybe take that out again someday when all this gets cleaned
>> up.
> That certainly looks like the easier solution. We still strip
> RelabelTypes in many places anyway, so doing it in one more place
> doesn't seem too bad to me.
I reconsidered this after further thought. If we do that it'd also mean
that clauses generated from EquivalenceClasses don't have RelabelType,
which is definitely going in the wrong direction in a big way.
What I'm just about to experiment with is the idea that lines 498-517
of pathkeys.c are in the wrong place: that should be done within
make_pathkey_from_sortinfo, so that it would also happen for expressions
coming from SortClauses (see the other caller of
make_pathkey_from_sortinfo). Then the expressions coming in to
equivclass.c should always match.
regards, tom lane