Commit 7b69b6ce authored by Robert Haas's avatar Robert Haas

Fix assorted carelessness about Datum vs. int64 vs. uint64

Bugs introduced by commit 81c5e46c
parent 0d9506d1
......@@ -4084,7 +4084,7 @@ hash_array_extended(PG_FUNCTION_ARGS)
{
/* Apply the hash function */
locfcinfo.arg[0] = elt;
locfcinfo.arg[1] = seed;
locfcinfo.arg[1] = Int64GetDatum(seed);
locfcinfo.argnull[0] = false;
locfcinfo.argnull[1] = false;
locfcinfo.isnull = false;
......
......@@ -2223,14 +2223,15 @@ Datum
timetz_hash_extended(PG_FUNCTION_ARGS)
{
TimeTzADT *key = PG_GETARG_TIMETZADT_P(0);
uint64 seed = PG_GETARG_DATUM(1);
Datum seed = PG_GETARG_DATUM(1);
uint64 thash;
/* Same approach as timetz_hash */
thash = DatumGetUInt64(DirectFunctionCall2(hashint8extended,
Int64GetDatumFast(key->time),
seed));
thash ^= DatumGetUInt64(hash_uint32_extended(key->zone, seed));
thash ^= DatumGetUInt64(hash_uint32_extended(key->zone,
DatumGetInt64(seed)));
PG_RETURN_UINT64(thash);
}
......
......@@ -2285,7 +2285,7 @@ hash_numeric_extended(PG_FUNCTION_ARGS)
hash_len * sizeof(NumericDigit),
seed);
result = digit_hash ^ weight;
result = UInt64GetDatum(DatumGetUInt64(digit_hash) ^ weight);
PG_RETURN_DATUM(result);
}
......
......@@ -1288,7 +1288,7 @@ Datum
hash_range_extended(PG_FUNCTION_ARGS)
{
RangeType *r = PG_GETARG_RANGE(0);
uint64 seed = PG_GETARG_INT64(1);
Datum seed = PG_GETARG_DATUM(1);
uint64 result;
TypeCacheEntry *typcache;
TypeCacheEntry *scache;
......@@ -1335,7 +1335,8 @@ hash_range_extended(PG_FUNCTION_ARGS)
upper_hash = 0;
/* Merge hashes of flags and bounds */
result = hash_uint32_extended((uint32) flags, seed);
result = DatumGetUInt64(hash_uint32_extended((uint32) flags,
DatumGetInt64(seed)));
result ^= lower_hash;
result = ROTATE_HIGH_AND_LOW_32BITS(result);
result ^= upper_hash;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment