Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> writes:
> Notice that the (k = k) qual is being dropped somewhere, which changes
> the output since that's a disguised not-null condition.
Huh ... I'm surprised it only does that with the ORDER BY present.
I suppose it's got something to do with the equivalence-class machinery.
regards, tom lane