aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/util/relnode.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/optimizer/util/relnode.c')
-rw-r--r--src/backend/optimizer/util/relnode.c43
1 files changed, 10 insertions, 33 deletions
diff --git a/src/backend/optimizer/util/relnode.c b/src/backend/optimizer/util/relnode.c
index fe83ec45192..f04c6b76f49 100644
--- a/src/backend/optimizer/util/relnode.c
+++ b/src/backend/optimizer/util/relnode.c
@@ -194,7 +194,7 @@ build_simple_rel(PlannerInfo *root, int relid, RelOptInfo *parent)
rel->baserestrict_min_security = UINT_MAX;
rel->joininfo = NIL;
rel->has_eclass_joins = false;
- rel->consider_partitionwise_join = false; /* might get changed later */
+ rel->consider_partitionwise_join = false; /* might get changed later */
rel->part_scheme = NULL;
rel->nparts = 0;
rel->boundinfo = NULL;
@@ -247,6 +247,13 @@ build_simple_rel(PlannerInfo *root, int relid, RelOptInfo *parent)
rel->attr_widths = (int32 *)
palloc0((rel->max_attr - rel->min_attr + 1) * sizeof(int32));
break;
+ case RTE_RESULT:
+ /* RTE_RESULT has no columns, nor could it have whole-row Var */
+ rel->min_attr = 0;
+ rel->max_attr = -1;
+ rel->attr_needed = NULL;
+ rel->attr_widths = NULL;
+ break;
default:
elog(ERROR, "unrecognized RTE kind: %d",
(int) rte->rtekind);
@@ -609,7 +616,7 @@ build_join_rel(PlannerInfo *root,
joinrel->baserestrict_min_security = UINT_MAX;
joinrel->joininfo = NIL;
joinrel->has_eclass_joins = false;
- joinrel->consider_partitionwise_join = false; /* might get changed later */
+ joinrel->consider_partitionwise_join = false; /* might get changed later */
joinrel->top_parent_relids = NULL;
joinrel->part_scheme = NULL;
joinrel->nparts = 0;
@@ -784,7 +791,7 @@ build_child_join_rel(PlannerInfo *root, RelOptInfo *outer_rel,
joinrel->baserestrictcost.per_tuple = 0;
joinrel->joininfo = NIL;
joinrel->has_eclass_joins = false;
- joinrel->consider_partitionwise_join = false; /* might get changed later */
+ joinrel->consider_partitionwise_join = false; /* might get changed later */
joinrel->top_parent_relids = NULL;
joinrel->part_scheme = NULL;
joinrel->nparts = 0;
@@ -1109,36 +1116,6 @@ subbuild_joinrel_joinlist(RelOptInfo *joinrel,
/*
- * build_empty_join_rel
- * Build a dummy join relation describing an empty set of base rels.
- *
- * This is used for queries with empty FROM clauses, such as "SELECT 2+2" or
- * "INSERT INTO foo VALUES(...)". We don't try very hard to make the empty
- * joinrel completely valid, since no real planning will be done with it ---
- * we just need it to carry a simple Result path out of query_planner().
- */
-RelOptInfo *
-build_empty_join_rel(PlannerInfo *root)
-{
- RelOptInfo *joinrel;
-
- /* The dummy join relation should be the only one ... */
- Assert(root->join_rel_list == NIL);
-
- joinrel = makeNode(RelOptInfo);
- joinrel->reloptkind = RELOPT_JOINREL;
- joinrel->relids = NULL; /* empty set */
- joinrel->rows = 1; /* we produce one row for such cases */
- joinrel->rtekind = RTE_JOIN;
- joinrel->reltarget = create_empty_pathtarget();
-
- root->join_rel_list = lappend(root->join_rel_list, joinrel);
-
- return joinrel;
-}
-
-
-/*
* fetch_upper_rel
* Build a RelOptInfo describing some post-scan/join query processing,
* or return a pre-existing one if somebody already built it.