Re: Maintain the pathkesy for subquery from outer side information

2021-07-25 Thread Andy Fan
> I think that in cases where there's not a semantic hazard involved, > we'd usually have pulled up the subquery so that this is all moot > anyway. > I get your point with this statement. Things driven by this idea look practical and lucky. But for the UniqueKey stuff, we are not that lucky. SEL

Re: Maintain the pathkesy for subquery from outer side information

2021-07-24 Thread Tom Lane
Andy Fan writes: > On Sat, Jul 24, 2021 at 10:14 PM Tom Lane wrote: >> Why do you "expect" that? I think pushing the outer ORDER BY past a >> LIMIT is an unacceptable semantics change. > I don't mean push down a "ORDER BY" clause to subquery, I mean push > down an "interesting order" to subque

Re: Maintain the pathkesy for subquery from outer side information

2021-07-24 Thread Andy Fan
On Sat, Jul 24, 2021 at 10:14 PM Tom Lane wrote: > > Andy Fan writes: > > When I am working on the UnqiueKey stuff, I find the following cases. > > SELECT * FROM (SELECT * FROM t offset 0) v ORDER BY a; > > // root->query_keys = A. root->order_pathkeys = A > > // Current: subroot->query_pathkeys

Re: Maintain the pathkesy for subquery from outer side information

2021-07-24 Thread Tom Lane
Andy Fan writes: > When I am working on the UnqiueKey stuff, I find the following cases. > SELECT * FROM (SELECT * FROM t offset 0) v ORDER BY a; > // root->query_keys = A. root->order_pathkeys = A > // Current: subroot->query_pathkeys = NIL. > // Expected: subroot->_pathkeys = [A]. Why do