mirror of
https://github.com/postgres/postgres.git
synced 2025-11-07 19:06:32 +03:00
Restructure handling of inheritance queries so that they work with outer
joins, and clean things up a good deal at the same time. Append plan node no longer hacks on rangetable at runtime --- instead, all child tables are given their own RT entries during planning. Concept of multiple target tables pushed up into execMain, replacing bug-prone implementation within nodeAppend. Planner now supports generating Append plans for inheritance sets either at the top of the plan (the old way) or at the bottom. Expanding at the bottom is appropriate for tables used as sources, since they may appear inside an outer join; but we must still expand at the top when the target of an UPDATE or DELETE is an inheritance set, because we actually need a different targetlist and junkfilter for each target table in that case. Fortunately a target table can't be inside an outer join... Bizarre mutual recursion between union_planner and prepunion.c is gone --- in fact, union_planner doesn't really have much to do with union queries anymore, so I renamed it grouping_planner.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: parsenodes.h,v 1.119 2000/11/05 22:50:21 vadim Exp $
|
||||
* $Id: parsenodes.h,v 1.120 2000/11/12 00:37:01 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -70,6 +70,16 @@ typedef struct Query
|
||||
Node *setOperations; /* set-operation tree if this is top level
|
||||
* of a UNION/INTERSECT/EXCEPT query */
|
||||
|
||||
/*
|
||||
* If the resultRelation turns out to be the parent of an inheritance
|
||||
* tree, the planner will add all the child tables to the rtable and
|
||||
* store a list of the rtindexes of all the result relations here.
|
||||
* This is done at plan time, not parse time, since we don't want to
|
||||
* commit to the exact set of child tables at parse time. This field
|
||||
* ought to go in some sort of TopPlan plan node, not in the Query.
|
||||
*/
|
||||
List *resultRelations; /* integer list of RT indexes, or NIL */
|
||||
|
||||
/* internal to planner */
|
||||
List *base_rel_list; /* list of base-relation RelOptInfos */
|
||||
List *join_rel_list; /* list of join-relation RelOptInfos */
|
||||
|
||||
Reference in New Issue
Block a user