v2-0005-Avoid-unnecessary-type-casting-in-timetz_hash-tim.patch
text/x-patch
Filename: v2-0005-Avoid-unnecessary-type-casting-in-timetz_hash-tim.patch
Type: text/x-patch
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-0005
Subject: Avoid unnecessary type casting in timetz_hash() / timetz_hash_extended()
| File | + | − |
|---|---|---|
| src/backend/utils/adt/date.c | 3 | 3 |
From 18e85156bb64d980f2867d3a36da6f34b26bcc19 Mon Sep 17 00:00:00 2001 From: Aleksander Alekseev <aleksander@tigerdata.com> Date: Tue, 3 Feb 2026 17:47:45 +0300 Subject: [PATCH v2 5/5] Avoid unnecessary type casting in timetz_hash() / timetz_hash_extended() Simplify the code by calling hash_bytes_uint32() / hash_bytes_uint32_extended() directly. This removes unnecessary uint -> Datum -> uint casting. Author: Aleksander Alekseev <aleksander@tigerdata.com> Suggested-by: John Naylor <johncnaylorls@gmail.com> Reviewed-by: TODO FIXME Discussion: https://postgr.es/m/CAJ7c6TMPhDRQMmkUHPv8oOK97B1mR8NRS61DgjpdaZUPAwaeZQ%40mail.gmail.com --- src/backend/utils/adt/date.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backend/utils/adt/date.c b/src/backend/utils/adt/date.c index 621b9175c12..7ec08b3bb48 100644 --- a/src/backend/utils/adt/date.c +++ b/src/backend/utils/adt/date.c @@ -2637,7 +2637,7 @@ timetz_hash(PG_FUNCTION_ARGS) */ thash = DatumGetUInt32(DirectFunctionCall1(hashint8, Int64GetDatumFast(key->time))); - thash ^= DatumGetUInt32(hash_uint32(key->zone)); + thash ^= hash_bytes_uint32(key->zone); PG_RETURN_UINT32(thash); } @@ -2652,8 +2652,8 @@ timetz_hash_extended(PG_FUNCTION_ARGS) thash = DatumGetUInt64(DirectFunctionCall2(hashint8extended, Int64GetDatumFast(key->time), seed)); - thash ^= DatumGetUInt64(hash_uint32_extended(key->zone, - DatumGetInt64(seed))); + thash ^= hash_bytes_uint32_extended(key->zone, + DatumGetInt64(seed)); PG_RETURN_UINT64(thash); } -- 2.43.0