Add soft error handling to some expression nodes This adjusts the expression evaluation code for CoerceViaIO and CoerceToDomain to handle errors softly if needed.
For CoerceViaIo, this means using InputFunctionCallSafe(), which provides the option to handle errors softly, instead of calling the type input function directly. For CoerceToDomain, this simply entails replacing the ereport() in ExecEvalConstraintCheck() by errsave(). In both cases, the ErrorSaveContext to be used when evaluating the expression is stored by ExecInitExprRec() in the expression's struct in the expression's ExprEvalStep. The ErrorSaveContext is passed by setting ExprState.escontext to point to it when calling ExecInitExprRec() on the expression whose errors are to be handled softly. Note that no call site of ExecInitExprRec() has been changed in this commit, so there's no functional change. This is intended for implementing new SQL/JSON expression nodes in future commits that will use to it suppress errors that may occur during type coercions. Reviewed-by: Álvaro Herrera Discussion: https://postgr.es/m/CA+HiwqE4XTdfb1nW=ojoy_tqsrhyt-q_kb6i5d4xckyrlc1...@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/7fbc75b26ed8ec70c729c5e7f8233896c54c900f Modified Files -------------- src/backend/executor/execExpr.c | 28 ++++++-------- src/backend/executor/execExprInterp.c | 36 +++++++++--------- src/backend/jit/llvm/llvmjit.c | 4 ++ src/backend/jit/llvm/llvmjit_expr.c | 71 +++++++++++++++++++---------------- src/backend/jit/llvm/llvmjit_types.c | 3 ++ src/include/executor/execExpr.h | 5 ++- src/include/jit/llvmjit.h | 2 + src/include/jit/llvmjit_emit.h | 9 +++++ src/include/nodes/execnodes.h | 7 ++++ 9 files changed, 96 insertions(+), 69 deletions(-)