Attached patch adds DatumGetUInt32() around the hash_any() and
hash_uint32() calls within varlena.c. These should have been in the
original abbreviated keys commit. Mea culpa.

-- 
Peter Geoghegan
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 3edd283..02e9949 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -2084,8 +2084,8 @@ bttext_abbrev_convert(Datum original, SortSupport ssup)
 	 * in order to compensate for cases where differences are past
 	 * PG_CACHE_LINE_SIZE bytes, so as to limit the overhead of hashing.
 	 */
-	hash = hash_any((unsigned char *) authoritative_data,
-					Min(len, PG_CACHE_LINE_SIZE));
+	hash = DatumGetUInt32(hash_any((unsigned char *) authoritative_data,
+								   Min(len, PG_CACHE_LINE_SIZE)));
 
 	if (len > PG_CACHE_LINE_SIZE)
 		hash ^= DatumGetUInt32(hash_uint32((uint32) len));
@@ -2100,10 +2100,10 @@ bttext_abbrev_convert(Datum original, SortSupport ssup)
 
 		lohalf = (uint32) res;
 		hihalf = (uint32) (res >> 32);
-		hash = hash_uint32(lohalf ^ hihalf);
+		hash = DatumGetUInt32(hash_uint32(lohalf ^ hihalf));
 	}
 #else							/* SIZEOF_DATUM != 8 */
-	hash = hash_uint32((uint32) res);
+	hash = DatumGetUInt32(hash_uint32((uint32) res));
 #endif
 
 	addHyperLogLog(&tss->abbr_card, hash);
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to