summaryrefslogtreecommitdiff
path: root/src/backend/utils
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2025-08-08 18:44:57 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2025-08-08 18:44:57 -0400
commit665c3dbba497b795c4ee46145777bc4eb89c78a1 (patch)
tree97f51b84a004547b56fb465cf73ed0d58d018307 /src/backend/utils
parentff89e182d42048380dba32fee1b491893c7b4bec (diff)
Mop-up for Datum conversion cleanups.HEADorigin/masterorigin/HEADmaster
Fix a couple more places where an explicit Datum conversion is needed (not clear how we missed these in ff89e182d and previous commits). Replace the minority usage "(Datum) NULL" with "(Datum) 0". The former depends on the assumption that Datum is the same width as Pointer, the latter doesn't. Anyway consistency is a good thing. This is, I believe, the last of the notational mop-up needed before we can consider changing Datum to uint64 everywhere. It's also important cleanup for more aggressive ideas such as making Datum a struct. Discussion: https://postgr.es/m/1749799.1752797397@sss.pgh.pa.us Discussion: https://postgr.es/m/8246d7ff-f4b7-4363-913e-827dadfeb145@eisentraut.org
Diffstat (limited to 'src/backend/utils')
-rw-r--r--src/backend/utils/adt/jsonfuncs.c6
-rw-r--r--src/backend/utils/adt/rangetypes.c4
2 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/utils/adt/jsonfuncs.c b/src/backend/utils/adt/jsonfuncs.c
index 370456408bf..c5e1a027956 100644
--- a/src/backend/utils/adt/jsonfuncs.c
+++ b/src/backend/utils/adt/jsonfuncs.c
@@ -2027,7 +2027,7 @@ each_worker_jsonb(FunctionCallInfo fcinfo, const char *funcname, bool as_text)
{
/* a json null is an sql null in text mode */
nulls[1] = true;
- values[1] = (Datum) NULL;
+ values[1] = (Datum) 0;
}
else
values[1] = PointerGetDatum(JsonbValueAsText(&v));
@@ -2266,7 +2266,7 @@ elements_worker_jsonb(FunctionCallInfo fcinfo, const char *funcname,
{
/* a json null is an sql null in text mode */
nulls[0] = true;
- values[0] = (Datum) NULL;
+ values[0] = (Datum) 0;
}
else
values[0] = PointerGetDatum(JsonbValueAsText(&v));
@@ -2389,7 +2389,7 @@ elements_array_element_end(void *state, bool isnull)
if (isnull && _state->normalize_results)
{
nulls[0] = true;
- values[0] = (Datum) NULL;
+ values[0] = (Datum) 0;
}
else if (_state->next_scalar)
{
diff --git a/src/backend/utils/adt/rangetypes.c b/src/backend/utils/adt/rangetypes.c
index 15398c72ea0..18e467bccd3 100644
--- a/src/backend/utils/adt/rangetypes.c
+++ b/src/backend/utils/adt/rangetypes.c
@@ -1343,9 +1343,9 @@ range_fast_cmp(Datum a, Datum b, SortSupport ssup)
cmp = range_cmp_bounds(typcache, &upper1, &upper2);
}
- if ((Datum) range_a != a)
+ if ((Pointer) range_a != DatumGetPointer(a))
pfree(range_a);
- if ((Datum) range_b != b)
+ if ((Pointer) range_b != DatumGetPointer(b))
pfree(range_b);
return cmp;