aboutsummaryrefslogtreecommitdiff
path: root/contrib/postgres_fdw
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2016-03-14 16:59:59 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2016-03-14 16:59:59 -0400
commit307c78852f516042cebacaed411a0391bfeb2129 (patch)
treeafa2959e11e171e93411164a7e5b0adfa3609700 /contrib/postgres_fdw
parent07341a2980a37ccbb3a51af2bd2f3c87953d8ea4 (diff)
downloadpostgresql-307c78852f516042cebacaed411a0391bfeb2129.tar.gz
postgresql-307c78852f516042cebacaed411a0391bfeb2129.zip
Rethink representation of PathTargets.
In commit 19a541143a09c067 I did not make PathTarget a subtype of Node, and embedded a RelOptInfo's reltarget directly into it rather than having a separately-allocated Node. In hindsight that was misguided micro-optimization, enabled by the fact that at that point we didn't have any Paths with custom PathTargets. Now that PathTarget processing has been fleshed out some more, it's easier to see that it's better to have PathTarget as an indepedent Node type, even if it does cost us one more palloc to create a RelOptInfo. So change it while we still can. This commit just changes the representation, without doing anything more interesting than that.
Diffstat (limited to 'contrib/postgres_fdw')
-rw-r--r--contrib/postgres_fdw/deparse.c4
-rw-r--r--contrib/postgres_fdw/postgres_fdw.c10
2 files changed, 7 insertions, 7 deletions
diff --git a/contrib/postgres_fdw/deparse.c b/contrib/postgres_fdw/deparse.c
index e6d4cdbe5ba..17081e48bd1 100644
--- a/contrib/postgres_fdw/deparse.c
+++ b/contrib/postgres_fdw/deparse.c
@@ -728,10 +728,10 @@ build_tlist_to_deparse(RelOptInfo *foreignrel)
PgFdwRelationInfo *fpinfo = (PgFdwRelationInfo *) foreignrel->fdw_private;
/*
- * We require columns specified in foreignrel->reltarget.exprs and those
+ * We require columns specified in foreignrel->reltarget->exprs and those
* required for evaluating the local conditions.
*/
- tlist = add_to_flat_tlist(tlist, foreignrel->reltarget.exprs);
+ tlist = add_to_flat_tlist(tlist, foreignrel->reltarget->exprs);
tlist = add_to_flat_tlist(tlist,
pull_var_clause((Node *) fpinfo->local_conds,
PVC_RECURSE_PLACEHOLDERS));
diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c
index aa745f237e2..d4ee2a8548f 100644
--- a/contrib/postgres_fdw/postgres_fdw.c
+++ b/contrib/postgres_fdw/postgres_fdw.c
@@ -481,7 +481,7 @@ postgresGetForeignRelSize(PlannerInfo *root,
* columns used in them. Doesn't seem worth detecting that case though.)
*/
fpinfo->attrs_used = NULL;
- pull_varattnos((Node *) baserel->reltarget.exprs, baserel->relid,
+ pull_varattnos((Node *) baserel->reltarget->exprs, baserel->relid,
&fpinfo->attrs_used);
foreach(lc, fpinfo->local_conds)
{
@@ -532,7 +532,7 @@ postgresGetForeignRelSize(PlannerInfo *root,
/* Report estimated baserel size to planner. */
baserel->rows = fpinfo->rows;
- baserel->reltarget.width = fpinfo->width;
+ baserel->reltarget->width = fpinfo->width;
}
else
{
@@ -549,7 +549,7 @@ postgresGetForeignRelSize(PlannerInfo *root,
{
baserel->pages = 10;
baserel->tuples =
- (10 * BLCKSZ) / (baserel->reltarget.width +
+ (10 * BLCKSZ) / (baserel->reltarget->width +
MAXALIGN(SizeofHeapTupleHeader));
}
@@ -2164,7 +2164,7 @@ estimate_path_cost_size(PlannerInfo *root,
* between foreign relations.
*/
rows = foreignrel->rows;
- width = foreignrel->reltarget.width;
+ width = foreignrel->reltarget->width;
/* Back into an estimate of the number of retrieved rows. */
retrieved_rows = clamp_row_est(rows / fpinfo->local_conds_sel);
@@ -3690,7 +3690,7 @@ postgresGetForeignJoinPaths(PlannerInfo *root,
&width, &startup_cost, &total_cost);
/* Now update this information in the joinrel */
joinrel->rows = rows;
- joinrel->reltarget.width = width;
+ joinrel->reltarget->width = width;
fpinfo->rows = rows;
fpinfo->width = width;
fpinfo->startup_cost = startup_cost;