pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Add soft error handling to some expression nodes 2+ messages / 1 participants [nested] [flat]
* pgsql: Add soft error handling to some expression nodes @ 2023-10-02 03:43 Amit Langote <amitlan@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: Amit Langote @ 2023-10-02 03:43 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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_kb6i5d4xcKyrLC1Nbg@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(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Add soft error handling to some expression nodes @ 2024-01-24 06:16 Amit Langote <amitlan@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: Amit Langote @ 2024-01-24 06:16 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Add soft error handling to some expression nodes This adjusts the code for CoerceViaIO and CoerceToDomain expression nodes to handle errors softly. For CoerceViaIo, this adds a new ExprEvalStep opcode EEOP_IOCOERCE_SAFE, which is implemented in the new accompanying function ExecEvalCoerceViaIOSafe(). The only difference from EEOP_IOCOERCE's inline implementation is that the input function receives an ErrorSaveContext via the function's FunctionCallInfo.context, which it can use to handle errors softly. For CoerceToDomain, this simply entails replacing the ereport() in ExecEvalConstraintNotNull() and ExecEvalConstraintCheck() by errsave() passing it the ErrorSaveContext passed in the expression's ExprEvalStep. In both cases, the ErrorSaveContext to be used is passed by setting ExprState.escontext to point to it before calling ExecInitExprRec() on the expression tree whose errors are to be handled softly. Note that there's no functional change as of this commit as no call site of ExecInitExprRec() has been changed. This is intended for implementing new SQL/JSON expression nodes in future commits. Extracted from a much larger patch to add SQL/JSON query functions. Author: Nikita Glukhov <n.gluhov@postgrespro.ru> Author: Teodor Sigaev <teodor@sigaev.ru> Author: Oleg Bartunov <obartunov@gmail.com> Author: Alexander Korotkov <aekorotkov@gmail.com> Author: Andrew Dunstan <andrew@dunslane.net> Author: Amit Langote <amitlangote09@gmail.com> Reviewers have included (in no particular order) Andres Freund, Alexander Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers, Zihong Yu, Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby, Álvaro Herrera, Jian He, Peter Eisentraut Discussion: https://postgr.es/m/cd0bb935-0158-78a7-08b5-904886deac4b@postgrespro.ru Discussion: https://postgr.es/m/20220616233130.rparivafipt6doj3@alap3.anarazel.de Discussion: https://postgr.es/m/abd9b83b-aa66-f230-3d6d-734817f0995d%40postgresql.org Discussion: https://postgr.es/m/CA+HiwqHROpf9e644D8BRqYvaAPmgBZVup-xKMDPk-nd4EpgzHw@mail.gmail.com Discussion: https://postgr.es/m/CA+HiwqE4XTdfb1nW=Ojoy_tQSRhYt-q_kb6i5d4xcKyrLC1Nbg@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/aaaf9449ec6be62cb0d30ed3588dc384f56274bf Modified Files -------------- src/backend/executor/execExpr.c | 8 +++- src/backend/executor/execExprInterp.c | 80 ++++++++++++++++++++++++++++++++++- src/backend/jit/llvm/llvmjit_expr.c | 6 +++ src/backend/jit/llvm/llvmjit_types.c | 1 + src/include/executor/execExpr.h | 4 ++ src/include/nodes/execnodes.h | 7 +++ 6 files changed, 103 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2024-01-24 06:16 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2023-10-02 03:43 pgsql: Add soft error handling to some expression nodes Amit Langote <amitlan@postgresql.org> 2024-01-24 06:16 pgsql: Add soft error handling to some expression nodes Amit Langote <amitlan@postgresql.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox