pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Switch some numeric-related functions to use soft error reportin
Date: Fri, 05 Sep 2025 04:57:21 +0000
Message-ID: <E1uuOVl-000Zcl-21@gemulon.postgresql.org> (raw)

Switch some numeric-related functions to use soft error reporting

This commit changes some functions related to the data type numeric to
use the soft error reporting rather than a custom boolean flag (called
"have_error") that callers of these functions could rely on to bypass
the generation of ERROR reports, letting the callers do their own error
handling (timestamp, jsonpath and numeric_to_char() require them).

This results in the removal of some boilerplate code that was required
to handle both the ereport() and the "have_error" code paths bypassing
ereport(), unifying everything under the soft error reporting facility.

While on it, some duplicated error messages are removed.  The function
upgraded in this commit were suffixed with "_opt_error" in their names.
They are renamed to "_safe" instead.

This change relies on d9f7f5d32f20, that has introduced the soft error
reporting infrastructure.

Author: Amul Sul <sulamul@gmail.com>
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>
Discussion: https://postgr.es/m/CAAJ_b96No5h5tRuR+KhcC44YcYUCw8WAHuLoqqyyop8_k3+JDQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4246a977bad6e76c4276a0d52def8a3dced154bb

Modified Files
--------------
src/backend/utils/adt/formatting.c    |   6 +-
src/backend/utils/adt/jsonpath_exec.c |  62 ++++----
src/backend/utils/adt/numeric.c       | 266 +++++++++++-----------------------
src/backend/utils/adt/timestamp.c     |  46 +++---
src/include/utils/numeric.h           |  22 ++-
5 files changed, 152 insertions(+), 250 deletions(-)



Message-ID: <E1uuOVl-000Zcl-21@gemulon.postgresql.org>
Permalink:  ../E1uuOVl-000Zcl-21@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1uuOVl-000Zcl-21@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: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Switch some numeric-related functions to use soft error reportin
  In-Reply-To: <E1uuOVl-000Zcl-21@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