pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Amit Langote <amitlan@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add soft error handling to some expression nodes
Date: Mon, 02 Oct 2023 03:43:54 +0000
Message-ID: <E1qn9qc-0074r3-PF@gemulon.postgresql.org> (raw)

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(-)



view thread (2+ messages)  latest in thread

Message-ID: <E1qn9qc-0074r3-PF@gemulon.postgresql.org>
Permalink:  ../E1qn9qc-0074r3-PF@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1qn9qc-0074r3-PF@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: amitlan@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Add soft error handling to some expression nodes
  In-Reply-To: <E1qn9qc-0074r3-PF@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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