0007_ex_handle_oid.patch
application/octet-stream
Filename: 0007_ex_handle_oid.patch
Type: application/octet-stream
Part: 0
Patch
Format: unified
| File | + | − |
|---|---|---|
| src/backend/utils/cache/catcache.c | 14 | 12 |
diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c
index 67c596d..aa1bc62 100644
--- a/src/backend/utils/cache/catcache.c
+++ b/src/backend/utils/cache/catcache.c
@@ -393,19 +393,21 @@ CatalogCacheCompareTuple(const CatCache *cache, int nkeys,
Datum atp;
bool isnull;
- /*
- * XXX: might be worthwhile to only handle oid sysattr, to reduce
- * overhead - it's the most common key.
- */
- atp = heap_getattr(tuple,
- cc_key[i],
- tupdesc,
- &isnull);
- Assert(!isnull);
-
- if (!(cc_fastequal[i])(atp, arguments[i]))
+ if (cc_key[i] == ObjectIdAttributeNumber)
{
- return false;
+ if (HeapTupleGetOid(tuple) != DatumGetObjectId(arguments[i]))
+ return false;
+ }
+ else
+ {
+ atp = heap_getattr(tuple,
+ cc_key[i],
+ tupdesc,
+ &isnull);
+ Assert(!isnull);
+
+ if (!(cc_fastequal[i])(atp, arguments[i]))
+ return false;
}
}
return true;