aboutsummaryrefslogtreecommitdiff
path: root/contrib/postgres_fdw/postgres_fdw.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/postgres_fdw/postgres_fdw.c')
-rw-r--r--contrib/postgres_fdw/postgres_fdw.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c
index 0aef00b738d..a3256179f2b 100644
--- a/contrib/postgres_fdw/postgres_fdw.c
+++ b/contrib/postgres_fdw/postgres_fdw.c
@@ -902,10 +902,23 @@ create_cursor(ForeignScanState *node)
params->paramFetch(params, paramno);
/*
+ * Force the remote server to infer a type for this parameter.
+ * Since we explicitly cast every parameter (see deparse.c), the
+ * "inference" is trivial and will produce the desired result.
+ * This allows us to avoid assuming that the remote server has the
+ * same OIDs we do for the parameters' types.
+ *
+ * We'd not need to pass a type array to PQexecParams at all,
+ * except that there may be unused holes in the array, which
+ * will have to be filled with something or the remote server will
+ * complain. We arbitrarily set them to INT4OID earlier.
+ */
+ types[paramno - 1] = InvalidOid;
+
+ /*
* Get string representation of each parameter value by invoking
* type-specific output function, unless the value is null.
*/
- types[paramno - 1] = prm->ptype;
if (prm->isnull)
values[paramno - 1] = NULL;
else