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
entry->rel, entry->page,
entry->offset, false);
}
- else if (!LTG_ISALLTRUE(entry->key))
+ else if (!LTG_ISALLTRUE(DatumGetPointer(entry->key)))
{
int32 i;
ltree_gist *key;
for (i = 0; i < Natts_pg_aggregate; i++)
{
nulls[i] = false;
- values[i] = (Datum) NULL;
+ values[i] = (Datum) 0;
replaces[i] = true;
}
values[Anum_pg_aggregate_aggfnoid - 1] = ObjectIdGetDatum(procOid);
for (i = 0; i < Natts_pg_constraint; i++)
{
nulls[i] = false;
- values[i] = (Datum) NULL;
+ values[i] = (Datum) 0;
}
conOid = GetNewOidWithIndex(conDesc, ConstraintOidIndexId,
for (i = 0; i < Natts_pg_conversion; i++)
{
nulls[i] = false;
- values[i] = (Datum) NULL;
+ values[i] = (Datum) 0;
}
/* form a tuple */
for (i = 0; i < Natts_pg_namespace; i++)
{
nulls[i] = false;
- values[i] = (Datum) NULL;
+ values[i] = (Datum) 0;
}
nspoid = GetNewOidWithIndex(nspdesc, NamespaceOidIndexId,
for (i = 0; i < Natts_pg_operator; ++i)
{
nulls[i] = false;
- values[i] = (Datum) NULL; /* redundant, but safe */
+ values[i] = (Datum) 0; /* redundant, but safe */
}
/*
for (i = 0; i < Natts_pg_operator; ++i)
{
- values[i] = (Datum) NULL;
+ values[i] = (Datum) 0;
replaces[i] = true;
nulls[i] = false;
}
for (i = 0; i < Natts_pg_type; ++i)
{
nulls[i] = false;
- values[i] = (Datum) NULL; /* redundant, but safe */
+ values[i] = (Datum) 0; /* redundant, but safe */
}
/*
{
SPI_result = SPI_ERROR_NOATTRIBUTE;
*isnull = true;
- return (Datum) NULL;
+ return (Datum) 0;
}
return heap_getattr(tuple, fnumber, tupdesc, isnull);
}
}
else if (length <= 0)
- res = (Datum) NULL;
+ res = (Datum) 0;
else
{
s = (char *) palloc(length);
{
/* 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));
{
/* 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));
if (isnull && _state->normalize_results)
{
nulls[0] = true;
- values[0] = (Datum) NULL;
+ values[0] = (Datum) 0;
}
else if (_state->next_scalar)
{
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;
if (att_isnull(attnum - 1, tup->t_data->t_bits))
{
*isnull = true;
- return (Datum) NULL;
+ return (Datum) 0;
}
else
return nocachegetattr(tup, attnum, tupleDesc);
if (att_isnull(attnum - 1, (bits8 *) tup + sizeof(IndexTupleData)))
{
*isnull = true;
- return (Datum) NULL;
+ return (Datum) 0;
}
else
return nocache_index_getattr(tup, attnum, tupleDesc);