diff options
| author | Michael Paquier <michael@paquier.xyz> | 2025-12-02 09:30:23 +0900 |
|---|---|---|
| committer | Michael Paquier <michael@paquier.xyz> | 2025-12-02 09:30:23 +0900 |
| commit | 713d9a847e6409a2a722aed90975eef6d75dc701 (patch) | |
| tree | 87612685e6c49f11e4c10f0c8632b15ed58ded96 /src/include/utils/timestamp.h | |
| parent | 19b966243c38196a33b033fb0c259dcf760c0d69 (diff) | |
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
Diffstat (limited to 'src/include/utils/timestamp.h')
| -rw-r--r-- | src/include/utils/timestamp.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/include/utils/timestamp.h b/src/include/utils/timestamp.h index 93531732b08..f1a85c7d9eb 100644 --- a/src/include/utils/timestamp.h +++ b/src/include/utils/timestamp.h @@ -142,10 +142,10 @@ extern int timestamp_cmp_internal(Timestamp dt1, Timestamp dt2); /* timestamp comparison works for timestamptz also */ #define timestamptz_cmp_internal(dt1,dt2) timestamp_cmp_internal(dt1, dt2) -extern TimestampTz timestamp2timestamptz_opt_overflow(Timestamp timestamp, - int *overflow); -extern Timestamp timestamptz2timestamp_opt_overflow(TimestampTz timestamp, - int *overflow); +extern TimestampTz timestamp2timestamptz_safe(Timestamp timestamp, + Node *escontext); +extern Timestamp timestamptz2timestamp_safe(TimestampTz timestamp, + Node *escontext); extern int32 timestamp_cmp_timestamptz_internal(Timestamp timestampVal, TimestampTz dt2); |
