diff options
Diffstat (limited to 'src/backend/optimizer/util/relnode.c')
-rw-r--r-- | src/backend/optimizer/util/relnode.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/src/backend/optimizer/util/relnode.c b/src/backend/optimizer/util/relnode.c index 86258b0f644..64720944ce3 100644 --- a/src/backend/optimizer/util/relnode.c +++ b/src/backend/optimizer/util/relnode.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.29 2000/09/29 18:21:23 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.30 2000/11/12 00:36:59 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -45,7 +45,6 @@ get_base_rel(Query *root, int relid) { List *baserels; RelOptInfo *rel; - Oid relationObjectId; foreach(baserels, root->base_rel_list) { @@ -60,7 +59,30 @@ get_base_rel(Query *root, int relid) } /* No existing RelOptInfo for this base rel, so make a new one */ - rel = makeNode(RelOptInfo); + rel = make_base_rel(root, relid); + + /* and add it to the list */ + root->base_rel_list = lcons(rel, root->base_rel_list); + + return rel; +} + +/* + * make_base_rel + * Construct a base-relation RelOptInfo for the specified rangetable index. + * + * This is split out of get_base_rel so that inheritance-tree processing can + * construct baserel nodes for child tables. We need a RelOptInfo so we can + * plan a suitable access path for each child table, but we do NOT want to + * enter the child nodes into base_rel_list. In most contexts, get_base_rel + * should be called instead. + */ +RelOptInfo * +make_base_rel(Query *root, int relid) +{ + RelOptInfo *rel = makeNode(RelOptInfo); + Oid relationObjectId; + rel->relids = makeListi1(relid); rel->rows = 0; rel->width = 0; @@ -95,8 +117,6 @@ get_base_rel(Query *root, int relid) rel->issubquery = true; } - root->base_rel_list = lcons(rel, root->base_rel_list); - return rel; } |