From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Update some timestamp[tz] functions to use soft-error reporting
Date: Tue, 02 Dec 2025 00:31:59 +0000
Message-ID: <E1vQEJC-002Lpj-2X@gemulon.postgresql.org> (raw)
Update some timestamp[tz] functions to use soft-error reporting
This commit updates two functions that convert "timestamptz" to
"timestamp", and vice-versa, to use the soft error reporting rather than
a their own logic to do the same. These are now named as follows:
- timestamp2timestamptz_safe()
- timestamptz2timestamp_safe()
These functions were suffixed with "_opt_overflow", previously.
This shaves some code, as it is possible to detect how a timestamp[tz]
overflowed based on the returned value rather than a custom state. It
is optionally possible for the callers of these functions to rely on the
error generated internally by these functions, depending on the error
context.
Similar work has been done in d03668ea0566 and 4246a977bad6.
Reviewed-by: Amul Sul <sulamul@gmail.com>
Discussion: https://postgr.es/m/aS09YF2GmVXjAxbJ@paquier.xyz
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/713d9a847e6409a2a722aed90975eef6d75dc701
Modified Files
--------------
contrib/btree_gin/btree_gin.c | 12 ++--
src/backend/utils/adt/timestamp.c | 121 ++++++++++++++------------------------
src/include/utils/timestamp.h | 8 +--
3 files changed, 54 insertions(+), 87 deletions(-)
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: Update some timestamp[tz] functions to use soft-error reporting
In-Reply-To: <E1vQEJC-002Lpj-2X@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