Rajkumar Raghuwanshi <rajkumar(dot)raghuwanshi(at)enterprisedb(dot)com> writes:
> Below test case is failing with ERROR: ORDER/GROUP BY expression not found
> in targetlist. this issue is reproducible from PGv10.
Thanks for the report. I traced through this, and the problem seems to
be that split_pathtarget_at_srfs() is neglecting to attach sortgroupref
labeling to the extra PathTargets it constructs. I don't remember
whether that code is my fault or Andres', but I'll take a look at
fixing it.
regards, tom lane