Switch some date/timestamp functions to use the soft error reporting
authorMichael Paquier <[email protected]>
Mon, 1 Dec 2025 06:22:20 +0000 (15:22 +0900)
committerMichael Paquier <[email protected]>
Mon, 1 Dec 2025 06:22:20 +0000 (15:22 +0900)
commitd03668ea0566b53522cf2628ab7aa630247640a4
treec990d581f30723994fadf173fea56d44911a8dc2
parent5424f4da9031ac4681ab002d20f021232070c96a
Switch some date/timestamp functions to use the soft error reporting

This commit changes some functions related to the data types date and
timestamp to use the soft error reporting rather than a custom boolean
flag called "overflow", used to let the callers of these functions know
if an overflow happens.

This results in the removal of some boilerplate code, as it is possible
to rely on an error context rather than a custom state, with the
possibility to use the error generated inside the functions updated
here, if necessary.

These functions were suffixed with "_opt_overflow".  They are now
renamed to use "_safe" as suffix.

This work is similar to 4246a977bad6.

Author: Amul Sul <[email protected]>
Reviewed-by: Amit Langote <[email protected]>
Reviewed-by: Michael Paquier <[email protected]>
Discussion: https://postgr.es/m/CAAJ_b95HEmFyzHZfsdPquSHeswcopk8MCG1Q_vn4tVkZ+xxofw@mail.gmail.com
contrib/btree_gin/btree_gin.c
src/backend/utils/adt/date.c
src/include/utils/date.h