diff options
Diffstat (limited to 'src/backend/executor/execExprInterp.c')
-rw-r--r-- | src/backend/executor/execExprInterp.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/src/backend/executor/execExprInterp.c b/src/backend/executor/execExprInterp.c index e55fd10e3b8..24c2b60c62a 100644 --- a/src/backend/executor/execExprInterp.c +++ b/src/backend/executor/execExprInterp.c @@ -1177,27 +1177,29 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) /* call input function (similar to InputFunctionCall) */ if (!op->d.iocoerce.finfo_in->fn_strict || str != NULL) { - bool error; + FunctionCallInfo fcinfo_in; + Datum d; - /* - * InputFunctionCallSafe() writes directly into *op->resvalue. - * Return NULL if an error is reported. - */ - error = !InputFunctionCallSafe(op->d.iocoerce.finfo_in, str, - op->d.iocoerce.typioparam, -1, - (Node *) op->d.iocoerce.escontext, - op->resvalue); - if (error) - *op->resnull = true; + fcinfo_in = op->d.iocoerce.fcinfo_data_in; + fcinfo_in->args[0].value = PointerGetDatum(str); + fcinfo_in->args[0].isnull = *op->resnull; + /* second and third arguments are already set up */ - /* - * Should get null result if and only if str is NULL or if we - * got an error above. - */ - if (str == NULL || error) + fcinfo_in->isnull = false; + d = FunctionCallInvoke(fcinfo_in); + *op->resvalue = d; + + /* Should get null result if and only if str is NULL */ + if (str == NULL) + { Assert(*op->resnull); + Assert(fcinfo_in->isnull); + } else + { Assert(!*op->resnull); + Assert(!fcinfo_in->isnull); + } } EEO_NEXT(); @@ -3743,7 +3745,7 @@ ExecEvalConstraintCheck(ExprState *state, ExprEvalStep *op) { if (!*op->d.domaincheck.checknull && !DatumGetBool(*op->d.domaincheck.checkvalue)) - errsave((Node *) op->d.domaincheck.escontext, + ereport(ERROR, (errcode(ERRCODE_CHECK_VIOLATION), errmsg("value for domain %s violates check constraint \"%s\"", format_type_be(op->d.domaincheck.resulttype), |