From: | Amit Langote <amitlan(at)postgresql(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Add soft error handling to some expression nodes |
Date: | 2024-01-24 06:16:30 |
Message-ID: | E1rSWYo-002qMp-C3@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
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(dot)gluhov(at)postgrespro(dot)ru>
Author: Teodor Sigaev <teodor(at)sigaev(dot)ru>
Author: Oleg Bartunov <obartunov(at)gmail(dot)com>
Author: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Author: Andrew Dunstan <andrew(at)dunslane(dot)net>
Author: Amit Langote <amitlangote09(at)gmail(dot)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(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Langote | 2024-01-24 06:21:50 | pgsql: Refactor code used by jsonpath executor to fetch variables |
Previous Message | Michael Paquier | 2024-01-24 05:24:00 | pgsql: Fix ALTER TABLE .. ADD COLUMN with complex inheritance trees |