Gregory Stark <stark@enterprisedb.com> writes:
> This requires treating columns of subrels as equivalent to the columns of the
> parent. Offhand I think that's theoretically ok since they'll never be
> available except where they are in fact equivalent, but I'm not too familiar
> with equivalence classes. There are a few comments indicating we don't
> currently fully track columns of subrels of append rels in equivalence
> classes. I'm not sure what the consequences of adding those columns as full
> members of the equivalence classes would be.
I don't think they're really equivalent in that sense. The implication
of putting A and B in the same equivalence class is "if it's sorted by
A, it can also be considered sorted by B, and vice versa". This is
clearly not the case for an append variable and a member variable ---
their relationship is asymmetric.
I think you probably want to think in terms of converting the outer
pathkeys (mentioning the append variable) into pathkeys that mention
the member variables, and then seeing if you can get a subpath that's
sorted that way. Compare the handling of sub-select ordering. (Not
that that's really clean :-()
regards, tom lane