v2-0005-Add-catcache-support-for-INT8OID.patch
text/x-diff
Filename: v2-0005-Add-catcache-support-for-INT8OID.patch
Type: text/x-diff
Part: 4
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: Add catcache support for INT8OID
| File | + | − |
|---|---|---|
| src/backend/utils/cache/catcache.c | 17 | 0 |
From 13bbb82a4765cbcfce8bbaed382507b127d20ca9 Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@paquier.xyz>
Date: Wed, 18 Jun 2025 16:12:11 +0900
Subject: [PATCH v2 05/13] Add catcache support for INT8OID
This is required to be able to do catalog cache lookups of int8 fields
for toast values of the same type.
---
src/backend/utils/cache/catcache.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c
index d1b25214376e..c77f571014e5 100644
--- a/src/backend/utils/cache/catcache.c
+++ b/src/backend/utils/cache/catcache.c
@@ -240,6 +240,18 @@ int4hashfast(Datum datum)
return murmurhash32((int32) DatumGetInt32(datum));
}
+static bool
+int8eqfast(Datum a, Datum b)
+{
+ return DatumGetInt64(a) == DatumGetInt64(b);
+}
+
+static uint32
+int8hashfast(Datum datum)
+{
+ return murmurhash64((int64) DatumGetInt64(datum));
+}
+
static bool
texteqfast(Datum a, Datum b)
{
@@ -300,6 +312,11 @@ GetCCHashEqFuncs(Oid keytype, CCHashFN *hashfunc, RegProcedure *eqfunc, CCFastEq
*fasteqfunc = int4eqfast;
*eqfunc = F_INT4EQ;
break;
+ case INT8OID:
+ *hashfunc = int8hashfast;
+ *fasteqfunc = int8eqfast;
+ *eqfunc = F_INT8EQ;
+ break;
case TEXTOID:
*hashfunc = texthashfast;
*fasteqfunc = texteqfast;
--
2.50.0