v2-0002-Rename-date2timestamp_no_overflow-to-date2double.patch
application/octet-stream
Filename: v2-0002-Rename-date2timestamp_no_overflow-to-date2double.patch
Type: application/octet-stream
Part: 1
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v2-0002
Subject: Rename date2timestamp_no_overflow to date2double.
| File | + | − |
|---|---|---|
| src/backend/utils/adt/date.c | 2 | 2 |
| src/backend/utils/adt/selfuncs.c | 1 | 1 |
| src/include/utils/date.h | 1 | 1 |
From 184f60a3f3aba949cb530bf365c9aa086d08aaa4 Mon Sep 17 00:00:00 2001
From: Amul Sul <sulamul@gmail.com>
Date: Fri, 28 Nov 2025 09:22:52 +0530
Subject: [PATCH v2 2/2] Rename date2timestamp_no_overflow to date2double.
In the previous commit, we renamed all date/timestamp-related
functions that ended with the opt_overflow keyword. This function is
the only version containing the overflow keyword that still needs to
be renamed for consistency. Furthermore, we cannot simply remove the
no_overflow suffix because the date2timestamp() function already
exists. Therefore, it is better to rename it to date2double(), which
would be more appropriate since the remaining date/timestamp
conversion functions include both the source and target type names.
---
src/backend/utils/adt/date.c | 4 ++--
src/backend/utils/adt/selfuncs.c | 2 +-
src/include/utils/date.h | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/backend/utils/adt/date.c b/src/backend/utils/adt/date.c
index f5da1a24439..5b68cd4374c 100644
--- a/src/backend/utils/adt/date.c
+++ b/src/backend/utils/adt/date.c
@@ -740,7 +740,7 @@ date2timestamptz(DateADT dateVal)
}
/*
- * date2timestamp_no_overflow
+ * date2double
*
* This is chartered to produce a double value that is numerically
* equivalent to the corresponding Timestamp value, if the date is in the
@@ -750,7 +750,7 @@ date2timestamptz(DateADT dateVal)
* used for statistical estimation purposes.
*/
double
-date2timestamp_no_overflow(DateADT dateVal)
+date2double(DateADT dateVal)
{
double result;
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
index 540aa9628d7..8277072ab7b 100644
--- a/src/backend/utils/adt/selfuncs.c
+++ b/src/backend/utils/adt/selfuncs.c
@@ -5432,7 +5432,7 @@ convert_timevalue_to_scalar(Datum value, Oid typid, bool *failure)
case TIMESTAMPTZOID:
return DatumGetTimestampTz(value);
case DATEOID:
- return date2timestamp_no_overflow(DatumGetDateADT(value));
+ return date2double(DatumGetDateADT(value));
case INTERVALOID:
{
Interval *interval = DatumGetIntervalP(value);
diff --git a/src/include/utils/date.h b/src/include/utils/date.h
index 7316ac0ff17..ef6d1b47390 100644
--- a/src/include/utils/date.h
+++ b/src/include/utils/date.h
@@ -97,7 +97,7 @@ TimeTzADTPGetDatum(const TimeTzADT *X)
/* date.c */
extern int32 anytime_typmod_check(bool istz, int32 typmod);
-extern double date2timestamp_no_overflow(DateADT dateVal);
+extern double date2double(DateADT dateVal);
extern Timestamp date2timestamp_safe(DateADT dateVal, Node *escontext);
extern TimestampTz date2timestamptz_safe(DateADT dateVal, Node *escontext);
extern DateADT timestamp2date_safe(Timestamp timestamp, Node *escontext);
--
2.47.1