pgsql-bugs(at)postgresql(dot)org writes:
> [ SELECT DISTINCT ON in a subquery-in-FROM misbehaves ]
Oooh, good catch! I had thought about pushing down quals into a SELECT
DISTINCT, and concluded it was OK because the qual would eliminate all
or none of a set of not-DISTINCT rows. But I forgot about DISTINCT ON
:-(.
Will have a source patch for this tomorrow, if that helps.
regards, tom lane