aboutsummaryrefslogtreecommitdiff
path: root/contrib/postgres_fdw/deparse.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/postgres_fdw/deparse.c')
-rw-r--r--contrib/postgres_fdw/deparse.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/contrib/postgres_fdw/deparse.c b/contrib/postgres_fdw/deparse.c
index a3639e96042..ad37a742213 100644
--- a/contrib/postgres_fdw/deparse.c
+++ b/contrib/postgres_fdw/deparse.c
@@ -391,6 +391,22 @@ foreign_expr_walker(Node *node,
Param *p = (Param *) node;
/*
+ * If it's a MULTIEXPR Param, punt. We can't tell from here
+ * whether the referenced sublink/subplan contains any remote
+ * Vars; if it does, handling that is too complicated to
+ * consider supporting at present. Fortunately, MULTIEXPR
+ * Params are not reduced to plain PARAM_EXEC until the end of
+ * planning, so we can easily detect this case. (Normal
+ * PARAM_EXEC Params are safe to ship because their values
+ * come from somewhere else in the plan tree; but a MULTIEXPR
+ * references a sub-select elsewhere in the same targetlist,
+ * so we'd be on the hook to evaluate it somehow if we wanted
+ * to handle such cases as direct foreign updates.)
+ */
+ if (p->paramkind == PARAM_MULTIEXPR)
+ return false;
+
+ /*
* Collation rule is same as for Consts and non-foreign Vars.
*/
collation = p->paramcollid;