aboutsummaryrefslogtreecommitdiff
path: root/contrib/postgres_fdw/postgres_fdw.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2017-04-11 13:53:13 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2017-04-11 13:53:21 -0400
commit88e902b769e180a232013e265ff9fd582dde125b (patch)
treed54ac09b917465674acb3320abf260f2bea6ba3c /contrib/postgres_fdw/postgres_fdw.h
parent02af7857e5694b13c21401d1982ac21d31e27dee (diff)
downloadpostgresql-88e902b769e180a232013e265ff9fd582dde125b.tar.gz
postgresql-88e902b769e180a232013e265ff9fd582dde125b.zip
Simplify handling of remote-qual pass-forward in postgres_fdw.
Commit 0bf3ae88a encountered a need to pass the finally chosen remote qual conditions forward from postgresGetForeignPlan to postgresPlanDirectModify. It solved that by sticking them into the plan node's fdw_private list, which in hindsight was a pretty bad idea. In the first place, there's no use for those qual trees either in EXPLAIN or execution; indeed they could never safely be used for any post-planning purposes, because they would not get processed by setrefs.c. So they're just dead weight to carry around in the finished plan tree, plus being an attractive nuisance for somebody who might get the idea that they could be used that way. Secondly, because those qual trees (sometimes) contained RestrictInfos, they created a plan-transmission hazard for parallel query, which is how come we noticed a problem. We dealt with that symptom in commit 28b047875, but really a more straightforward and more efficient fix is to pass the data through in a new field of struct PgFdwRelationInfo. So do it that way. (There's no need to revert 28b047875, as it has sufficient reason to live anyway.) Per fuzz testing by Andreas Seltenreich. Discussion: https://postgr.es/m/87tw5x4vcu.fsf@credativ.de
Diffstat (limited to 'contrib/postgres_fdw/postgres_fdw.h')
-rw-r--r--contrib/postgres_fdw/postgres_fdw.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/contrib/postgres_fdw/postgres_fdw.h b/contrib/postgres_fdw/postgres_fdw.h
index df75518f465..2bae799ccfe 100644
--- a/contrib/postgres_fdw/postgres_fdw.h
+++ b/contrib/postgres_fdw/postgres_fdw.h
@@ -22,7 +22,10 @@
/*
* FDW-specific planner information kept in RelOptInfo.fdw_private for a
- * foreign table. This information is collected by postgresGetForeignRelSize.
+ * postgres_fdw foreign table. For a baserel, this struct is created by
+ * postgresGetForeignRelSize, although some fields are not filled till later.
+ * postgresGetForeignJoinPaths creates it for a joinrel, and
+ * postgresGetForeignUpperPaths creates it for an upperrel.
*/
typedef struct PgFdwRelationInfo
{
@@ -40,6 +43,9 @@ typedef struct PgFdwRelationInfo
List *remote_conds;
List *local_conds;
+ /* Actual remote restriction clauses for scan (sans RestrictInfos) */
+ List *final_remote_exprs;
+
/* Bitmap of attr numbers we need to fetch from the remote server. */
Bitmapset *attrs_used;
@@ -83,6 +89,7 @@ typedef struct PgFdwRelationInfo
RelOptInfo *outerrel;
RelOptInfo *innerrel;
JoinType jointype;
+ /* joinclauses contains only JOIN/ON conditions for an outer join */
List *joinclauses; /* List of RestrictInfo */
/* Grouping information */