aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/optimizer/util/clauses.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c
index 505ae0af85d..a04ad6e99e6 100644
--- a/src/backend/optimizer/util/clauses.c
+++ b/src/backend/optimizer/util/clauses.c
@@ -2567,7 +2567,14 @@ eval_const_expressions_mutator(Node *node,
else
prm = &paramLI->params[param->paramid - 1];
- if (OidIsValid(prm->ptype))
+ /*
+ * We don't just check OidIsValid, but insist that the
+ * fetched type match the Param, just in case the hook did
+ * something unexpected. No need to throw an error here
+ * though; leave that for runtime.
+ */
+ if (OidIsValid(prm->ptype) &&
+ prm->ptype == param->paramtype)
{
/* OK to substitute parameter value? */
if (context->estimate ||
@@ -2583,7 +2590,6 @@ eval_const_expressions_mutator(Node *node,
bool typByVal;
Datum pval;
- Assert(prm->ptype == param->paramtype);
get_typlenbyval(param->paramtype,
&typLen, &typByVal);
if (prm->isnull || typByVal)