From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Create infrastructure for "soft" error reporting.
Date: Fri, 09 Dec 2022 15:15:04 +0000
Message-ID: <E1p3f5c-002gaT-0D@gemulon.postgresql.org> (raw)
Create infrastructure for "soft" error reporting.
Postgres' standard mechanism for reporting errors (ereport() or elog())
is used for all sorts of error conditions. This means that throwing
an exception via ereport(ERROR) requires an expensive transaction or
subtransaction abort and cleanup, since the exception catcher dare not
make many assumptions about what has gone wrong. There are situations
where we would rather have a lighter-weight mechanism for dealing
with errors that are known to be safe to recover from without a full
transaction cleanup. This commit creates infrastructure to let us
adapt existing error-reporting code for that purpose. See the
included documentation changes for details. Follow-on commits will
provide test code and usage examples.
The near-term plan is to convert most if not all datatype input
functions to report invalid input "softly". This will enable
implementing some SQL/JSON features cleanly and without the cost
of subtransactions, and it will also allow creating COPY options
to deal with bad input without cancelling the whole COPY.
This patch is mostly by me, but it owes very substantial debt to
earlier work by Nikita Glukhov, Andrew Dunstan, and Amul Sul.
Thanks also to Andres Freund for review.
Discussion: https://postgr.es/m/3bbbb0df-7382-bf87-9737-340ba096e034@postgrespro.ru
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/d9f7f5d32f201bec61fef8104aafcb77cecb4dcb
Modified Files
--------------
doc/src/sgml/ref/create_type.sgml | 11 +++
src/backend/nodes/Makefile | 1 +
src/backend/nodes/gen_node_support.pl | 2 +
src/backend/utils/error/elog.c | 123 ++++++++++++++++++++++++++++++++++
src/backend/utils/fmgr/README | 72 ++++++++++++++++++++
src/backend/utils/fmgr/fmgr.c | 65 ++++++++++++++++++
src/include/fmgr.h | 4 ++
src/include/nodes/meson.build | 1 +
src/include/nodes/miscnodes.h | 56 ++++++++++++++++
src/include/utils/elog.h | 61 +++++++++++++++++
src/tools/pgindent/typedefs.list | 1 +
11 files changed, 397 insertions(+)
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Create infrastructure for "soft" error reporting.
In-Reply-To: <E1p3f5c-002gaT-0D@gemulon.postgresql.org>
References: <E1p3f5c-002gaT-0D@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