Hi Richard,
The fix looks right to me. The new test trips the Assert without the
pathkeys.c change.
A CTE scan as the member hits the same Assert, example:
set_cte_pathlist().
explain (costs off)
with c as materialized (select q2 from int8_tbl order by q2)
select ss.v from int8_tbl x,
lateral (select x.q1 from c union all
select q2 from int8_tbl) ss(v);
The patch fixes this one too. Maybe the commit message could mention
it as well.
Thanks,
Shihao