pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Make many cast functions error safe
Date: Tue, 24 Mar 2026 11:18:02 +0000
Message-ID: <E1w4zlq-001EBq-0M@gemulon.postgresql.org> (raw)

Make many cast functions error safe

This adjusts many C functions underlying casts to support soft errors.
This is in preparation for a future feature where conversion errors in
casts can be caught.

This patch covers cast functions that can be adjusted easily by
changing ereport to ereturn or making other light changes.  The
underlying helper functions were already changed to support soft
errors some time ago as part of soft error support in type input
functions.

Other casts and types will require some more work and are being kept
as separate patches.

Author: jian he <jian.universality@gmail.com>
Reviewed-by: Amul Sul <sulamul@gmail.com>
Reviewed-by: Corey Huinker <corey.huinker@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/CADkLM%3Dfv1JfY4Ufa-jcwwNbjQixNViskQ8jZu3Tz_p656i_4hQ%40m...

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e2f289e5b9b82acaf1523fda827e71b8fc8bd549

Modified Files
--------------
src/backend/executor/execExprInterp.c |  2 +-
src/backend/utils/adt/bytea.c         |  8 ++---
src/backend/utils/adt/char.c          |  2 +-
src/backend/utils/adt/date.c          | 35 +++++++++----------
src/backend/utils/adt/float.c         |  8 ++---
src/backend/utils/adt/int.c           |  2 +-
src/backend/utils/adt/int8.c          | 10 +++---
src/backend/utils/adt/mac8.c          |  2 +-
src/backend/utils/adt/network.c       |  2 +-
src/backend/utils/adt/numeric.c       | 64 +++++++++++++++++++++++++----------
src/backend/utils/adt/timestamp.c     | 23 ++++++++++---
src/backend/utils/adt/varbit.c        |  8 ++---
src/backend/utils/adt/varchar.c       |  4 +--
src/backend/utils/adt/xml.c           | 12 ++++---
src/include/utils/xml.h               |  2 +-
15 files changed, 116 insertions(+), 68 deletions(-)



Message-ID: <E1w4zlq-001EBq-0M@gemulon.postgresql.org>
Permalink:  ../E1w4zlq-001EBq-0M@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1w4zlq-001EBq-0M@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: peter@eisentraut.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Make many cast functions error safe
  In-Reply-To: <E1w4zlq-001EBq-0M@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