v13-0005-WIP-a-safer-way-to-accumulate-a-single-struct-me.patch

text/x-patch

Filename: v13-0005-WIP-a-safer-way-to-accumulate-a-single-struct-me.patch
Type: text/x-patch
Part: 0
Message: Re: Change GUC hashtable to use simplehash?

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 v13-0005
Subject: WIP: a safer way to accumulate a single struct member into the hash state
File+
src/backend/catalog/namespace.c 3 1
From cf64f9a0603837dd89efdf1aa455395906e75ded Mon Sep 17 00:00:00 2001
From: John Naylor <john.naylor@postgresql.org>
Date: Fri, 5 Jan 2024 17:21:53 +0700
Subject: [PATCH v13 5/6] WIP: a safer way to accumulate a single struct member
 into the hash state

---
 src/backend/catalog/namespace.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/backend/catalog/namespace.c b/src/backend/catalog/namespace.c
index d1eae2a2d4..83fd57906c 100644
--- a/src/backend/catalog/namespace.c
+++ b/src/backend/catalog/namespace.c
@@ -258,7 +258,9 @@ spcachekey_hash(SearchPathCacheKey key)
 
 	fasthash_init(&hs, FH_UNKNOWN_LENGTH, 0);
 
-	fasthash_accum(&hs, (const char*) &key.roleid, sizeof(Oid));
+	hs.accum = key.roleid;
+	fasthash_combine(&hs);
+
 	sp_len = fasthash_accum_cstring(&hs, key.searchPath);
 
 	/* pass the length to tweak the final mix */
-- 
2.43.0