While doing some random testing, I noticed that the following is broken in HEAD:
SELECT COUNT(DISTINCT random()) FROM generate_series(1,10);
ERROR: ORDER/GROUP BY expression not found in targetlist
It appears to have been broken by 1349d279, though I haven't looked at the details.
Yeah, this is definitely broken. For this query, we try to sort the scan/join path by random() before performing the Aggregate, which is an optimization implemented in 1349d2790b. However the scan/join plan's tlist does not contain random(), which I think we need to fix.