On Wed, Sep 13, 2017 at 10:57 PM, Amit Langote <langote_amit...@lab.ntt.co.jp> wrote: > I very much like pcinfo-for-subquery.patch, although I'm not sure if we > need to create PartitionedChildRelInfo for the sub-query parent RTE as the > patch teaches add_paths_to_append_rel() to do. ISTM, nested UNION ALL > subqueries are flattened way before we get to add_paths_to_append_rel(); > if it could not be flattened, there wouldn't be a call to > add_paths_to_append_rel() in the first place, because no AppendRelInfos > would be generated. See what happens when is_simple_union_all_recurse() > returns false to flatten_simple_union_all() -- no AppendRelInfos will be > generated and added to root->append_rel_list in that case. > > IOW, there won't be nested AppendRelInfos for nested UNION ALL sub-queries > like we're setting out to build for multi-level partitioned tables. > > So, as things stand today, there can at most be one recursive call of > add_path_to_append_rel() for a sub-query parent RTE, that is, if its child > sub-queries contain partitioned tables, but not more. The other patch > (multi-level expansion of partitioned tables) will change that, but even > then we won't need sub-query's own PartitioendChildRelInfo.
OK, let's assume you're correct unless some contrary evidence emerges. Committed without that part; thanks for the review. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers