syscache5-v1.patch

application/octet-stream

Filename: syscache5-v1.patch
Type: application/octet-stream
Part: 0
Message: Re: knngist patch support

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: unified
Series: patch v1
File+
contrib/dblink/dblink.c 1 3
src/backend/access/common/tupdesc.c 1 3
src/backend/access/heap/heapam.c 1 3
src/backend/access/transam/varsup.c 1 3
src/backend/catalog/aclchk.c 59 131
src/backend/catalog/dependency.c 36 57
src/backend/catalog/heap.c 15 22
src/backend/catalog/index.c 12 27
src/backend/catalog/namespace.c 109 190
src/backend/catalog/pg_aggregate.c 1 3
src/backend/catalog/pg_constraint.c 4 9
src/backend/catalog/pg_conversion.c 7 9
src/backend/catalog/pg_inherits.c 2 6
src/backend/catalog/pg_namespace.c 1 3
src/backend/catalog/pg_operator.c 9 14
src/backend/catalog/pg_proc.c 7 14
src/backend/catalog/pg_shdepend.c 1 3
src/backend/catalog/pg_type.c 10 15
src/backend/catalog/toasting.c 1 3
src/backend/commands/aggregatecmds.c 6 11
src/backend/commands/analyze.c 5 8
src/backend/commands/cluster.c 11 27
src/backend/commands/comment.c 20 36
src/backend/commands/conversioncmds.c 6 13
src/backend/commands/dbcommands.c 5 15
src/backend/commands/foreigncmds.c 19 36
src/backend/commands/functioncmds.c 27 57
src/backend/commands/indexcmds.c 16 32
src/backend/commands/opclasscmds.c 87 137
src/backend/commands/operatorcmds.c 3 9
src/backend/commands/proclang.c 7 21
src/backend/commands/schemacmds.c 9 18
src/backend/commands/sequence.c 1 3
src/backend/commands/tablecmds.c 22 53
src/backend/commands/trigger.c 2 3
src/backend/commands/tsearchcmds.c 27 61
src/backend/commands/typecmds.c 25 47
src/backend/commands/user.c 13 29
src/backend/commands/vacuum.c 2 6
src/backend/commands/variable.c 2 6
src/backend/executor/execAmi.c 2 6
src/backend/executor/functions.c 2 6
src/backend/executor/nodeAgg.c 4 6
src/backend/executor/nodeHash.c 4 5
src/backend/executor/nodeWindowAgg.c 3 6
src/backend/executor/spi.c 1 3
src/backend/foreign/foreign.c 10 20
src/backend/libpq/crypt.c 1 3
src/backend/optimizer/plan/planagg.c 1 3
src/backend/optimizer/plan/setrefs.c 1 3
src/backend/optimizer/plan/subselect.c 1 3
src/backend/optimizer/util/clauses.c 4 9
src/backend/optimizer/util/predtest.c 9 14
src/backend/parser/parse_coerce.c 10 15
src/backend/parser/parse_func.c 3 6
src/backend/parser/parse_node.c 1 3
src/backend/parser/parse_oper.c 6 18
src/backend/parser/parse_relation.c 12 16
src/backend/parser/parse_type.c 6 13
src/backend/parser/parse_utilcmd.c 6 12
src/backend/postmaster/autovacuum.c 2 6
src/backend/rewrite/rewriteDefine.c 9 12
src/backend/rewrite/rewriteRemove.c 3 4
src/backend/rewrite/rewriteSupport.c 4 7
src/backend/tcop/fastpath.c 1 3
src/backend/tcop/utility.c 1 3
src/backend/utils/adt/acl.c 33 85
src/backend/utils/adt/dbsize.c 2 6
src/backend/utils/adt/enum.c 11 23
src/backend/utils/adt/format_type.c 2 6
src/backend/utils/adt/regproc.c 8 24
src/backend/utils/adt/ri_triggers.c 3 9
src/backend/utils/adt/ruleutils.c 17 51
src/backend/utils/adt/selfuncs.c 15 19
src/backend/utils/adt/xml.c 2 6
src/backend/utils/cache/attoptcache.c 3 4
src/backend/utils/cache/catcache.c 26 5
src/backend/utils/cache/inval.c 1 3
src/backend/utils/cache/lsyscache.c 99 227
src/backend/utils/cache/relcache.c 9 15
src/backend/utils/cache/spccache.c 1 3
src/backend/utils/cache/syscache.c 17 14
src/backend/utils/cache/ts_cache.c 6 15
src/backend/utils/cache/typcache.c 1 3
src/backend/utils/fmgr/fmgr.c 4 9
src/backend/utils/fmgr/funcapi.c 2 6
src/backend/utils/init/miscinit.c 2 6
src/backend/utils/init/postinit.c 1 3
src/backend/utils/mb/mbutils.c 1 3
src/backend/utils/misc/superuser.c 1 3
src/include/utils/catcache.h 11 7
src/include/utils/syscache.h 62 5
src/pl/plperl/plperl.c 9 15
src/pl/plpgsql/src/pl_comp.c 6 15
src/pl/plpgsql/src/pl_handler.c 1 3
src/pl/plpython/plpython.c 11 18
src/pl/tcl/pltcl.c 14 21
diff --git a/contrib/dblink/dblink.c b/contrib/dblink/dblink.c
index 612866e..1429510 100644
--- a/contrib/dblink/dblink.c
+++ b/contrib/dblink/dblink.c
@@ -2180,9 +2180,7 @@ generate_relation_name(Oid relid)
 	char	   *nspname;
 	char	   *result;
 
-	tp = SearchSysCache(RELOID,
-						ObjectIdGetDatum(relid),
-						0, 0, 0);
+	tp = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
 	if (!HeapTupleIsValid(tp))
 		elog(ERROR, "cache lookup failed for relation %u", relid);
 
diff --git a/src/backend/access/common/tupdesc.c b/src/backend/access/common/tupdesc.c
index 5775a22..9a8611f 100644
--- a/src/backend/access/common/tupdesc.c
+++ b/src/backend/access/common/tupdesc.c
@@ -478,9 +478,7 @@ TupleDescInitEntry(TupleDesc desc,
 	att->attinhcount = 0;
 	/* attacl and attoptions are not present in tupledescs */
 
-	tuple = SearchSysCache(TYPEOID,
-						   ObjectIdGetDatum(oidtypeid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(oidtypeid));
 	if (!HeapTupleIsValid(tuple))
 		elog(ERROR, "cache lookup failed for type %u", oidtypeid);
 	typeForm = (Form_pg_type) GETSTRUCT(tuple);
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index fd7a2a4..61e7533 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -935,9 +935,7 @@ try_relation_open(Oid relationId, LOCKMODE lockmode)
 	 * Now that we have the lock, probe to see if the relation really exists
 	 * or not.
 	 */
-	if (!SearchSysCacheExists(RELOID,
-							  ObjectIdGetDatum(relationId),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(relationId)))
 	{
 		/* Release useless lock */
 		if (lockmode != NoLock)
diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c
index 1b3fd42..097f400 100644
--- a/src/backend/access/transam/varsup.c
+++ b/src/backend/access/transam/varsup.c
@@ -402,9 +402,7 @@ ForceTransactionIdLimitUpdate(void)
 	if (TransactionIdFollowsOrEquals(nextXid, xidVacLimit) &&
 		TransactionIdIsValid(xidVacLimit))
 		return true;			/* past VacLimit, don't delay updating */
-	if (!SearchSysCacheExists(DATABASEOID,
-							  ObjectIdGetDatum(oldestXidDB),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(DATABASEOID, ObjectIdGetDatum(oldestXidDB)))
 		return true;			/* could happen, per comments above */
 	return false;
 }
diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c
index 0bcdffb..cd3e6f4 100644
--- a/src/backend/catalog/aclchk.c
+++ b/src/backend/catalog/aclchk.c
@@ -596,9 +596,7 @@ objectNamesToOids(GrantObjectType objtype, List *objnames)
 				char	   *langname = strVal(lfirst(cell));
 				HeapTuple	tuple;
 
-				tuple = SearchSysCache(LANGNAME,
-									   PointerGetDatum(langname),
-									   0, 0, 0);
+				tuple = SearchSysCache1(LANGNAME, PointerGetDatum(langname));
 				if (!HeapTupleIsValid(tuple))
 					ereport(ERROR,
 							(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -630,9 +628,8 @@ objectNamesToOids(GrantObjectType objtype, List *objnames)
 				char	   *nspname = strVal(lfirst(cell));
 				HeapTuple	tuple;
 
-				tuple = SearchSysCache(NAMESPACENAME,
-									   CStringGetDatum(nspname),
-									   0, 0, 0);
+				tuple = SearchSysCache1(NAMESPACENAME,
+										CStringGetDatum(nspname));
 				if (!HeapTupleIsValid(tuple))
 					ereport(ERROR,
 							(errcode(ERRCODE_UNDEFINED_SCHEMA),
@@ -1009,9 +1006,8 @@ SetDefaultACLsInSchemas(InternalDefaultACL *iacls, List *nspnames)
 			 * CREATE privileges, since without CREATE you won't be able to do
 			 * anything using the default privs anyway.
 			 */
-			iacls->nspid = GetSysCacheOid(NAMESPACENAME,
-										  CStringGetDatum(nspname),
-										  0, 0, 0);
+			iacls->nspid = GetSysCacheOid1(NAMESPACENAME,
+										   CStringGetDatum(nspname));
 			if (!OidIsValid(iacls->nspid))
 				ereport(ERROR,
 						(errcode(ERRCODE_UNDEFINED_SCHEMA),
@@ -1085,11 +1081,10 @@ SetDefaultACL(InternalDefaultACL *iacls)
 	}
 
 	/* Search for existing row for this object type in catalog */
-	tuple = SearchSysCache(DEFACLROLENSPOBJ,
-						   ObjectIdGetDatum(iacls->roleid),
-						   ObjectIdGetDatum(iacls->nspid),
-						   CharGetDatum(objtype),
-						   0);
+	tuple = SearchSysCache3(DEFACLROLENSPOBJ,
+							ObjectIdGetDatum(iacls->roleid),
+							ObjectIdGetDatum(iacls->nspid),
+					 		CharGetDatum(objtype));
 
 	if (HeapTupleIsValid(tuple))
 	{
@@ -1433,10 +1428,9 @@ expand_all_col_privileges(Oid table_oid, Form_pg_class classForm,
 		if (classForm->relkind == RELKIND_VIEW && curr_att < 0)
 			continue;
 
-		attTuple = SearchSysCache(ATTNUM,
-								  ObjectIdGetDatum(table_oid),
-								  Int16GetDatum(curr_att),
-								  0, 0);
+		attTuple = SearchSysCache2(ATTNUM,
+								   ObjectIdGetDatum(table_oid),
+								   Int16GetDatum(curr_att));
 		if (!HeapTupleIsValid(attTuple))
 			elog(ERROR, "cache lookup failed for attribute %d of relation %u",
 				 curr_att, table_oid);
@@ -1481,10 +1475,9 @@ ExecGrant_Attribute(InternalGrant *istmt, Oid relOid, const char *relname,
 	Oid		   *oldmembers;
 	Oid		   *newmembers;
 
-	attr_tuple = SearchSysCache(ATTNUM,
-								ObjectIdGetDatum(relOid),
-								Int16GetDatum(attnum),
-								0, 0);
+	attr_tuple = SearchSysCache2(ATTNUM,
+								 ObjectIdGetDatum(relOid),
+								 Int16GetDatum(attnum));
 	if (!HeapTupleIsValid(attr_tuple))
 		elog(ERROR, "cache lookup failed for attribute %d of relation %u",
 			 attnum, relOid);
@@ -1623,9 +1616,7 @@ ExecGrant_Relation(InternalGrant *istmt)
 		HeapTuple	tuple;
 		ListCell   *cell_colprivs;
 
-		tuple = SearchSysCache(RELOID,
-							   ObjectIdGetDatum(relOid),
-							   0, 0, 0);
+		tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relOid));
 		if (!HeapTupleIsValid(tuple))
 			elog(ERROR, "cache lookup failed for relation %u", relOid);
 		pg_class_tuple = (Form_pg_class) GETSTRUCT(tuple);
@@ -1939,9 +1930,7 @@ ExecGrant_Database(InternalGrant *istmt)
 		Oid		   *newmembers;
 		HeapTuple	tuple;
 
-		tuple = SearchSysCache(DATABASEOID,
-							   ObjectIdGetDatum(datId),
-							   0, 0, 0);
+		tuple = SearchSysCache1(DATABASEOID, ObjectIdGetDatum(datId));
 		if (!HeapTupleIsValid(tuple))
 			elog(ERROR, "cache lookup failed for database %u", datId);
 
@@ -2056,9 +2045,8 @@ ExecGrant_Fdw(InternalGrant *istmt)
 		Oid		   *oldmembers;
 		Oid		   *newmembers;
 
-		tuple = SearchSysCache(FOREIGNDATAWRAPPEROID,
-							   ObjectIdGetDatum(fdwid),
-							   0, 0, 0);
+		tuple = SearchSysCache1(FOREIGNDATAWRAPPEROID,
+							    ObjectIdGetDatum(fdwid));
 		if (!HeapTupleIsValid(tuple))
 			elog(ERROR, "cache lookup failed for foreign-data wrapper %u", fdwid);
 
@@ -2175,9 +2163,7 @@ ExecGrant_ForeignServer(InternalGrant *istmt)
 		Oid		   *oldmembers;
 		Oid		   *newmembers;
 
-		tuple = SearchSysCache(FOREIGNSERVEROID,
-							   ObjectIdGetDatum(srvid),
-							   0, 0, 0);
+		tuple = SearchSysCache1(FOREIGNSERVEROID, ObjectIdGetDatum(srvid));
 		if (!HeapTupleIsValid(tuple))
 			elog(ERROR, "cache lookup failed for foreign server %u", srvid);
 
@@ -2294,9 +2280,7 @@ ExecGrant_Function(InternalGrant *istmt)
 		Oid		   *oldmembers;
 		Oid		   *newmembers;
 
-		tuple = SearchSysCache(PROCOID,
-							   ObjectIdGetDatum(funcId),
-							   0, 0, 0);
+		tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcId));
 		if (!HeapTupleIsValid(tuple))
 			elog(ERROR, "cache lookup failed for function %u", funcId);
 
@@ -2411,9 +2395,7 @@ ExecGrant_Language(InternalGrant *istmt)
 		Oid		   *oldmembers;
 		Oid		   *newmembers;
 
-		tuple = SearchSysCache(LANGOID,
-							   ObjectIdGetDatum(langId),
-							   0, 0, 0);
+		tuple = SearchSysCache1(LANGOID, ObjectIdGetDatum(langId));
 		if (!HeapTupleIsValid(tuple))
 			elog(ERROR, "cache lookup failed for language %u", langId);
 
@@ -2667,9 +2649,7 @@ ExecGrant_Namespace(InternalGrant *istmt)
 		Oid		   *oldmembers;
 		Oid		   *newmembers;
 
-		tuple = SearchSysCache(NAMESPACEOID,
-							   ObjectIdGetDatum(nspid),
-							   0, 0, 0);
+		tuple = SearchSysCache1(NAMESPACEOID, ObjectIdGetDatum(nspid));
 		if (!HeapTupleIsValid(tuple))
 			elog(ERROR, "cache lookup failed for namespace %u", nspid);
 
@@ -2786,8 +2766,7 @@ ExecGrant_Tablespace(InternalGrant *istmt)
 		HeapTuple	tuple;
 
 		/* Search syscache for pg_tablespace */
-		tuple = SearchSysCache(TABLESPACEOID, ObjectIdGetDatum(tblId),
-							   0, 0, 0);
+		tuple = SearchSysCache1(TABLESPACEOID, ObjectIdGetDatum(tblId));
 		if (!HeapTupleIsValid(tuple))
 			elog(ERROR, "cache lookup failed for tablespace %u", tblId);
 
@@ -3090,9 +3069,7 @@ has_rolcatupdate(Oid roleid)
 	bool		rolcatupdate;
 	HeapTuple	tuple;
 
-	tuple = SearchSysCache(AUTHOID,
-						   ObjectIdGetDatum(roleid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid));
 	if (!HeapTupleIsValid(tuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -3183,10 +3160,9 @@ pg_attribute_aclmask(Oid table_oid, AttrNumber attnum, Oid roleid,
 	/*
 	 * First, get the column's ACL from its pg_attribute entry
 	 */
-	attTuple = SearchSysCache(ATTNUM,
-							  ObjectIdGetDatum(table_oid),
-							  Int16GetDatum(attnum),
-							  0, 0);
+	attTuple = SearchSysCache2(ATTNUM,
+							   ObjectIdGetDatum(table_oid),
+							   Int16GetDatum(attnum));
 	if (!HeapTupleIsValid(attTuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_COLUMN),
@@ -3223,9 +3199,7 @@ pg_attribute_aclmask(Oid table_oid, AttrNumber attnum, Oid roleid,
 	 * privileges" rather than failing in such a case, so as to avoid unwanted
 	 * failures in has_column_privilege() tests.
 	 */
-	classTuple = SearchSysCache(RELOID,
-								ObjectIdGetDatum(table_oid),
-								0, 0, 0);
+	classTuple = SearchSysCache1(RELOID, ObjectIdGetDatum(table_oid));
 	if (!HeapTupleIsValid(classTuple))
 	{
 		ReleaseSysCache(attTuple);
@@ -3269,9 +3243,7 @@ pg_class_aclmask(Oid table_oid, Oid roleid,
 	/*
 	 * Must get the relation's tuple from pg_class
 	 */
-	tuple = SearchSysCache(RELOID,
-						   ObjectIdGetDatum(table_oid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(table_oid));
 	if (!HeapTupleIsValid(tuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_TABLE),
@@ -3365,9 +3337,7 @@ pg_database_aclmask(Oid db_oid, Oid roleid,
 	/*
 	 * Get the database's ACL from pg_database
 	 */
-	tuple = SearchSysCache(DATABASEOID,
-						   ObjectIdGetDatum(db_oid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(DATABASEOID, ObjectIdGetDatum(db_oid));
 	if (!HeapTupleIsValid(tuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_DATABASE),
@@ -3421,9 +3391,7 @@ pg_proc_aclmask(Oid proc_oid, Oid roleid,
 	/*
 	 * Get the function's ACL from pg_proc
 	 */
-	tuple = SearchSysCache(PROCOID,
-						   ObjectIdGetDatum(proc_oid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(proc_oid));
 	if (!HeapTupleIsValid(tuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_FUNCTION),
@@ -3477,9 +3445,7 @@ pg_language_aclmask(Oid lang_oid, Oid roleid,
 	/*
 	 * Get the language's ACL from pg_language
 	 */
-	tuple = SearchSysCache(LANGOID,
-						   ObjectIdGetDatum(lang_oid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(LANGOID, ObjectIdGetDatum(lang_oid));
 	if (!HeapTupleIsValid(tuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -3640,9 +3606,7 @@ pg_namespace_aclmask(Oid nsp_oid, Oid roleid,
 	/*
 	 * Get the schema's ACL from pg_namespace
 	 */
-	tuple = SearchSysCache(NAMESPACEOID,
-						   ObjectIdGetDatum(nsp_oid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(NAMESPACEOID, ObjectIdGetDatum(nsp_oid));
 	if (!HeapTupleIsValid(tuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_SCHEMA),
@@ -3696,8 +3660,7 @@ pg_tablespace_aclmask(Oid spc_oid, Oid roleid,
 	/*
 	 * Get the tablespace's ACL from pg_tablespace
 	 */
-	tuple = SearchSysCache(TABLESPACEOID, ObjectIdGetDatum(spc_oid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(TABLESPACEOID, ObjectIdGetDatum(spc_oid));
 	if (!HeapTupleIsValid(tuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -3756,9 +3719,7 @@ pg_foreign_data_wrapper_aclmask(Oid fdw_oid, Oid roleid,
 	/*
 	 * Must get the FDW's tuple from pg_foreign_data_wrapper
 	 */
-	tuple = SearchSysCache(FOREIGNDATAWRAPPEROID,
-						   ObjectIdGetDatum(fdw_oid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(FOREIGNDATAWRAPPEROID, ObjectIdGetDatum(fdw_oid));
 	if (!HeapTupleIsValid(tuple))
 		ereport(ERROR,
 				(errmsg("foreign-data wrapper with OID %u does not exist",
@@ -3819,9 +3780,7 @@ pg_foreign_server_aclmask(Oid srv_oid, Oid roleid,
 	/*
 	 * Must get the FDW's tuple from pg_foreign_data_wrapper
 	 */
-	tuple = SearchSysCache(FOREIGNSERVEROID,
-						   ObjectIdGetDatum(srv_oid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(FOREIGNSERVEROID, ObjectIdGetDatum(srv_oid));
 	if (!HeapTupleIsValid(tuple))
 		ereport(ERROR,
 				(errmsg("foreign server with OID %u does not exist",
@@ -3912,9 +3871,7 @@ pg_attribute_aclcheck_all(Oid table_oid, Oid roleid, AclMode mode,
 	 * pg_attribute_aclmask, we prefer to return "no privileges" instead of
 	 * throwing an error if we get any unexpected lookup errors.
 	 */
-	classTuple = SearchSysCache(RELOID,
-								ObjectIdGetDatum(table_oid),
-								0, 0, 0);
+	classTuple = SearchSysCache1(RELOID, ObjectIdGetDatum(table_oid));
 	if (!HeapTupleIsValid(classTuple))
 		return ACLCHECK_NO_PRIV;
 	classForm = (Form_pg_class) GETSTRUCT(classTuple);
@@ -3934,10 +3891,9 @@ pg_attribute_aclcheck_all(Oid table_oid, Oid roleid, AclMode mode,
 		HeapTuple	attTuple;
 		AclMode		attmask;
 
-		attTuple = SearchSysCache(ATTNUM,
-								  ObjectIdGetDatum(table_oid),
-								  Int16GetDatum(curr_att),
-								  0, 0);
+		attTuple = SearchSysCache2(ATTNUM,
+								   ObjectIdGetDatum(table_oid),
+								   Int16GetDatum(curr_att));
 		if (!HeapTupleIsValid(attTuple))
 			continue;
 
@@ -4107,9 +4063,7 @@ pg_class_ownercheck(Oid class_oid, Oid roleid)
 	if (superuser_arg(roleid))
 		return true;
 
-	tuple = SearchSysCache(RELOID,
-						   ObjectIdGetDatum(class_oid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(class_oid));
 	if (!HeapTupleIsValid(tuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_TABLE),
@@ -4135,9 +4089,7 @@ pg_type_ownercheck(Oid type_oid, Oid roleid)
 	if (superuser_arg(roleid))
 		return true;
 
-	tuple = SearchSysCache(TYPEOID,
-						   ObjectIdGetDatum(type_oid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type_oid));
 	if (!HeapTupleIsValid(tuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -4163,9 +4115,7 @@ pg_oper_ownercheck(Oid oper_oid, Oid roleid)
 	if (superuser_arg(roleid))
 		return true;
 
-	tuple = SearchSysCache(OPEROID,
-						   ObjectIdGetDatum(oper_oid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(OPEROID, ObjectIdGetDatum(oper_oid));
 	if (!HeapTupleIsValid(tuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_FUNCTION),
@@ -4191,9 +4141,7 @@ pg_proc_ownercheck(Oid proc_oid, Oid roleid)
 	if (superuser_arg(roleid))
 		return true;
 
-	tuple = SearchSysCache(PROCOID,
-						   ObjectIdGetDatum(proc_oid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(proc_oid));
 	if (!HeapTupleIsValid(tuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_FUNCTION),
@@ -4219,9 +4167,7 @@ pg_language_ownercheck(Oid lan_oid, Oid roleid)
 	if (superuser_arg(roleid))
 		return true;
 
-	tuple = SearchSysCache(LANGOID,
-						   ObjectIdGetDatum(lan_oid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(LANGOID, ObjectIdGetDatum(lan_oid));
 	if (!HeapTupleIsValid(tuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_FUNCTION),
@@ -4293,9 +4239,7 @@ pg_namespace_ownercheck(Oid nsp_oid, Oid roleid)
 	if (superuser_arg(roleid))
 		return true;
 
-	tuple = SearchSysCache(NAMESPACEOID,
-						   ObjectIdGetDatum(nsp_oid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(NAMESPACEOID, ObjectIdGetDatum(nsp_oid));
 	if (!HeapTupleIsValid(tuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_SCHEMA),
@@ -4322,8 +4266,7 @@ pg_tablespace_ownercheck(Oid spc_oid, Oid roleid)
 		return true;
 
 	/* Search syscache for pg_tablespace */
-	spctuple = SearchSysCache(TABLESPACEOID, ObjectIdGetDatum(spc_oid),
-							  0, 0, 0);
+	spctuple = SearchSysCache1(TABLESPACEOID, ObjectIdGetDatum(spc_oid));
 	if (!HeapTupleIsValid(spctuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -4349,9 +4292,7 @@ pg_opclass_ownercheck(Oid opc_oid, Oid roleid)
 	if (superuser_arg(roleid))
 		return true;
 
-	tuple = SearchSysCache(CLAOID,
-						   ObjectIdGetDatum(opc_oid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(CLAOID, ObjectIdGetDatum(opc_oid));
 	if (!HeapTupleIsValid(tuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -4378,9 +4319,7 @@ pg_opfamily_ownercheck(Oid opf_oid, Oid roleid)
 	if (superuser_arg(roleid))
 		return true;
 
-	tuple = SearchSysCache(OPFAMILYOID,
-						   ObjectIdGetDatum(opf_oid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(OPFAMILYOID, ObjectIdGetDatum(opf_oid));
 	if (!HeapTupleIsValid(tuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -4407,9 +4346,7 @@ pg_ts_dict_ownercheck(Oid dict_oid, Oid roleid)
 	if (superuser_arg(roleid))
 		return true;
 
-	tuple = SearchSysCache(TSDICTOID,
-						   ObjectIdGetDatum(dict_oid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(TSDICTOID, ObjectIdGetDatum(dict_oid));
 	if (!HeapTupleIsValid(tuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -4436,9 +4373,7 @@ pg_ts_config_ownercheck(Oid cfg_oid, Oid roleid)
 	if (superuser_arg(roleid))
 		return true;
 
-	tuple = SearchSysCache(TSCONFIGOID,
-						   ObjectIdGetDatum(cfg_oid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(TSCONFIGOID, ObjectIdGetDatum(cfg_oid));
 	if (!HeapTupleIsValid(tuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -4465,9 +4400,7 @@ pg_foreign_server_ownercheck(Oid srv_oid, Oid roleid)
 	if (superuser_arg(roleid))
 		return true;
 
-	tuple = SearchSysCache(FOREIGNSERVEROID,
-						   ObjectIdGetDatum(srv_oid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(FOREIGNSERVEROID, ObjectIdGetDatum(srv_oid));
 	if (!HeapTupleIsValid(tuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -4494,9 +4427,7 @@ pg_database_ownercheck(Oid db_oid, Oid roleid)
 	if (superuser_arg(roleid))
 		return true;
 
-	tuple = SearchSysCache(DATABASEOID,
-						   ObjectIdGetDatum(db_oid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(DATABASEOID, ObjectIdGetDatum(db_oid));
 	if (!HeapTupleIsValid(tuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_DATABASE),
@@ -4522,9 +4453,7 @@ pg_conversion_ownercheck(Oid conv_oid, Oid roleid)
 	if (superuser_arg(roleid))
 		return true;
 
-	tuple = SearchSysCache(CONVOID,
-						   ObjectIdGetDatum(conv_oid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(CONVOID, ObjectIdGetDatum(conv_oid));
 	if (!HeapTupleIsValid(tuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -4548,11 +4477,10 @@ get_default_acl_internal(Oid roleId, Oid nsp_oid, char objtype)
 	Acl		   *result = NULL;
 	HeapTuple	tuple;
 
-	tuple = SearchSysCache(DEFACLROLENSPOBJ,
-						   ObjectIdGetDatum(roleId),
-						   ObjectIdGetDatum(nsp_oid),
-						   CharGetDatum(objtype),
-						   0);
+	tuple = SearchSysCache3(DEFACLROLENSPOBJ,
+							ObjectIdGetDatum(roleId),
+							ObjectIdGetDatum(nsp_oid),
+							CharGetDatum(objtype));
 
 	if (HeapTupleIsValid(tuple))
 	{
diff --git a/src/backend/catalog/dependency.c b/src/backend/catalog/dependency.c
index a1376ab..5b23ccf 100644
--- a/src/backend/catalog/dependency.c
+++ b/src/backend/catalog/dependency.c
@@ -1399,50 +1399,44 @@ find_expr_references_walker(Node *node,
 				case REGPROCOID:
 				case REGPROCEDUREOID:
 					objoid = DatumGetObjectId(con->constvalue);
-					if (SearchSysCacheExists(PROCOID,
-											 ObjectIdGetDatum(objoid),
-											 0, 0, 0))
+					if (SearchSysCacheExists1(PROCOID,
+											  ObjectIdGetDatum(objoid)))
 						add_object_address(OCLASS_PROC, objoid, 0,
 										   context->addrs);
 					break;
 				case REGOPEROID:
 				case REGOPERATOROID:
 					objoid = DatumGetObjectId(con->constvalue);
-					if (SearchSysCacheExists(OPEROID,
-											 ObjectIdGetDatum(objoid),
-											 0, 0, 0))
+					if (SearchSysCacheExists1(OPEROID,
+											  ObjectIdGetDatum(objoid)))
 						add_object_address(OCLASS_OPERATOR, objoid, 0,
 										   context->addrs);
 					break;
 				case REGCLASSOID:
 					objoid = DatumGetObjectId(con->constvalue);
-					if (SearchSysCacheExists(RELOID,
-											 ObjectIdGetDatum(objoid),
-											 0, 0, 0))
+					if (SearchSysCacheExists1(RELOID,
+											  ObjectIdGetDatum(objoid)))
 						add_object_address(OCLASS_CLASS, objoid, 0,
 										   context->addrs);
 					break;
 				case REGTYPEOID:
 					objoid = DatumGetObjectId(con->constvalue);
-					if (SearchSysCacheExists(TYPEOID,
-											 ObjectIdGetDatum(objoid),
-											 0, 0, 0))
+					if (SearchSysCacheExists1(TYPEOID,
+											  ObjectIdGetDatum(objoid)))
 						add_object_address(OCLASS_TYPE, objoid, 0,
 										   context->addrs);
 					break;
 				case REGCONFIGOID:
 					objoid = DatumGetObjectId(con->constvalue);
-					if (SearchSysCacheExists(TSCONFIGOID,
-											 ObjectIdGetDatum(objoid),
-											 0, 0, 0))
+					if (SearchSysCacheExists1(TSCONFIGOID,
+											  ObjectIdGetDatum(objoid)))
 						add_object_address(OCLASS_TSCONFIG, objoid, 0,
 										   context->addrs);
 					break;
 				case REGDICTIONARYOID:
 					objoid = DatumGetObjectId(con->constvalue);
-					if (SearchSysCacheExists(TSDICTOID,
-											 ObjectIdGetDatum(objoid),
-											 0, 0, 0))
+					if (SearchSysCacheExists1(TSDICTOID,
+											  ObjectIdGetDatum(objoid)))
 						add_object_address(OCLASS_TSDICT, objoid, 0,
 										   context->addrs);
 					break;
@@ -2155,9 +2149,8 @@ getObjectDescription(const ObjectAddress *object)
 				HeapTuple	conTup;
 				Form_pg_constraint con;
 
-				conTup = SearchSysCache(CONSTROID,
-										ObjectIdGetDatum(object->objectId),
-										0, 0, 0);
+				conTup = SearchSysCache1(CONSTROID,
+										 ObjectIdGetDatum(object->objectId));
 				if (!HeapTupleIsValid(conTup))
 					elog(ERROR, "cache lookup failed for constraint %u",
 						 object->objectId);
@@ -2187,9 +2180,8 @@ getObjectDescription(const ObjectAddress *object)
 			{
 				HeapTuple	conTup;
 
-				conTup = SearchSysCache(CONVOID,
-										ObjectIdGetDatum(object->objectId),
-										0, 0, 0);
+				conTup = SearchSysCache1(CONVOID,
+										 ObjectIdGetDatum(object->objectId));
 				if (!HeapTupleIsValid(conTup))
 					elog(ERROR, "cache lookup failed for conversion %u",
 						 object->objectId);
@@ -2242,9 +2234,8 @@ getObjectDescription(const ObjectAddress *object)
 			{
 				HeapTuple	langTup;
 
-				langTup = SearchSysCache(LANGOID,
-										 ObjectIdGetDatum(object->objectId),
-										 0, 0, 0);
+				langTup = SearchSysCache1(LANGOID,
+										  ObjectIdGetDatum(object->objectId));
 				if (!HeapTupleIsValid(langTup))
 					elog(ERROR, "cache lookup failed for language %u",
 						 object->objectId);
@@ -2271,17 +2262,15 @@ getObjectDescription(const ObjectAddress *object)
 				Form_pg_am	amForm;
 				char	   *nspname;
 
-				opcTup = SearchSysCache(CLAOID,
-										ObjectIdGetDatum(object->objectId),
-										0, 0, 0);
+				opcTup = SearchSysCache1(CLAOID,
+										 ObjectIdGetDatum(object->objectId));
 				if (!HeapTupleIsValid(opcTup))
 					elog(ERROR, "cache lookup failed for opclass %u",
 						 object->objectId);
 				opcForm = (Form_pg_opclass) GETSTRUCT(opcTup);
 
-				amTup = SearchSysCache(AMOID,
-									   ObjectIdGetDatum(opcForm->opcmethod),
-									   0, 0, 0);
+				amTup = SearchSysCache1(AMOID,
+										ObjectIdGetDatum(opcForm->opcmethod));
 				if (!HeapTupleIsValid(amTup))
 					elog(ERROR, "cache lookup failed for access method %u",
 						 opcForm->opcmethod);
@@ -2487,9 +2476,8 @@ getObjectDescription(const ObjectAddress *object)
 			{
 				HeapTuple	tup;
 
-				tup = SearchSysCache(TSPARSEROID,
-									 ObjectIdGetDatum(object->objectId),
-									 0, 0, 0);
+				tup = SearchSysCache1(TSPARSEROID,
+									  ObjectIdGetDatum(object->objectId));
 				if (!HeapTupleIsValid(tup))
 					elog(ERROR, "cache lookup failed for text search parser %u",
 						 object->objectId);
@@ -2503,9 +2491,8 @@ getObjectDescription(const ObjectAddress *object)
 			{
 				HeapTuple	tup;
 
-				tup = SearchSysCache(TSDICTOID,
-									 ObjectIdGetDatum(object->objectId),
-									 0, 0, 0);
+				tup = SearchSysCache1(TSDICTOID,
+									  ObjectIdGetDatum(object->objectId));
 				if (!HeapTupleIsValid(tup))
 					elog(ERROR, "cache lookup failed for text search dictionary %u",
 						 object->objectId);
@@ -2519,9 +2506,8 @@ getObjectDescription(const ObjectAddress *object)
 			{
 				HeapTuple	tup;
 
-				tup = SearchSysCache(TSTEMPLATEOID,
-									 ObjectIdGetDatum(object->objectId),
-									 0, 0, 0);
+				tup = SearchSysCache1(TSTEMPLATEOID,
+									  ObjectIdGetDatum(object->objectId));
 				if (!HeapTupleIsValid(tup))
 					elog(ERROR, "cache lookup failed for text search template %u",
 						 object->objectId);
@@ -2535,9 +2521,8 @@ getObjectDescription(const ObjectAddress *object)
 			{
 				HeapTuple	tup;
 
-				tup = SearchSysCache(TSCONFIGOID,
-									 ObjectIdGetDatum(object->objectId),
-									 0, 0, 0);
+				tup = SearchSysCache1(TSCONFIGOID,
+									  ObjectIdGetDatum(object->objectId));
 				if (!HeapTupleIsValid(tup))
 					elog(ERROR, "cache lookup failed for text search configuration %u",
 						 object->objectId);
@@ -2602,9 +2587,8 @@ getObjectDescription(const ObjectAddress *object)
 				Oid			useid;
 				char	   *usename;
 
-				tup = SearchSysCache(USERMAPPINGOID,
-									 ObjectIdGetDatum(object->objectId),
-									 0, 0, 0);
+				tup = SearchSysCache1(USERMAPPINGOID,
+									  ObjectIdGetDatum(object->objectId));
 				if (!HeapTupleIsValid(tup))
 					elog(ERROR, "cache lookup failed for user mapping %u",
 						 object->objectId);
@@ -2707,9 +2691,8 @@ getRelationDescription(StringInfo buffer, Oid relid)
 	char	   *nspname;
 	char	   *relname;
 
-	relTup = SearchSysCache(RELOID,
-							ObjectIdGetDatum(relid),
-							0, 0, 0);
+	relTup = SearchSysCache1(RELOID,
+							 ObjectIdGetDatum(relid));
 	if (!HeapTupleIsValid(relTup))
 		elog(ERROR, "cache lookup failed for relation %u", relid);
 	relForm = (Form_pg_class) GETSTRUCT(relTup);
@@ -2774,16 +2757,12 @@ getOpFamilyDescription(StringInfo buffer, Oid opfid)
 	Form_pg_am	amForm;
 	char	   *nspname;
 
-	opfTup = SearchSysCache(OPFAMILYOID,
-							ObjectIdGetDatum(opfid),
-							0, 0, 0);
+	opfTup = SearchSysCache1(OPFAMILYOID, ObjectIdGetDatum(opfid));
 	if (!HeapTupleIsValid(opfTup))
 		elog(ERROR, "cache lookup failed for opfamily %u", opfid);
 	opfForm = (Form_pg_opfamily) GETSTRUCT(opfTup);
 
-	amTup = SearchSysCache(AMOID,
-						   ObjectIdGetDatum(opfForm->opfmethod),
-						   0, 0, 0);
+	amTup = SearchSysCache1(AMOID, ObjectIdGetDatum(opfForm->opfmethod));
 	if (!HeapTupleIsValid(amTup))
 		elog(ERROR, "cache lookup failed for access method %u",
 			 opfForm->opfmethod);
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index f6ffe21..d797c1d 100644
--- a/src/backend/catalog/heap.c
+++ b/src/backend/catalog/heap.c
@@ -932,10 +932,9 @@ heap_create_with_catalog(const char *relname,
 	 * autogenerated array, we can rename it out of the way; otherwise we can
 	 * at least give a good error message.
 	 */
-	old_type_oid = GetSysCacheOid(TYPENAMENSP,
-								  CStringGetDatum(relname),
-								  ObjectIdGetDatum(relnamespace),
-								  0, 0);
+	old_type_oid = GetSysCacheOid2(TYPENAMENSP,
+								   CStringGetDatum(relname),
+								   ObjectIdGetDatum(relnamespace));
 	if (OidIsValid(old_type_oid))
 	{
 		if (!moveArrayTypeName(old_type_oid, relname, relnamespace))
@@ -1244,9 +1243,7 @@ DeleteRelationTuple(Oid relid)
 	/* Grab an appropriate lock on the pg_class relation */
 	pg_class_desc = heap_open(RelationRelationId, RowExclusiveLock);
 
-	tup = SearchSysCache(RELOID,
-						 ObjectIdGetDatum(relid),
-						 0, 0, 0);
+	tup = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
 	if (!HeapTupleIsValid(tup))
 		elog(ERROR, "cache lookup failed for relation %u", relid);
 
@@ -1323,10 +1320,9 @@ RemoveAttributeById(Oid relid, AttrNumber attnum)
 
 	attr_rel = heap_open(AttributeRelationId, RowExclusiveLock);
 
-	tuple = SearchSysCacheCopy(ATTNUM,
-							   ObjectIdGetDatum(relid),
-							   Int16GetDatum(attnum),
-							   0, 0);
+	tuple = SearchSysCacheCopy2(ATTNUM,
+								ObjectIdGetDatum(relid),
+								Int16GetDatum(attnum));
 	if (!HeapTupleIsValid(tuple))		/* shouldn't happen */
 		elog(ERROR, "cache lookup failed for attribute %d of relation %u",
 			 attnum, relid);
@@ -1491,10 +1487,9 @@ RemoveAttrDefaultById(Oid attrdefId)
 	/* Fix the pg_attribute row */
 	attr_rel = heap_open(AttributeRelationId, RowExclusiveLock);
 
-	tuple = SearchSysCacheCopy(ATTNUM,
-							   ObjectIdGetDatum(myrelid),
-							   Int16GetDatum(myattnum),
-							   0, 0);
+	tuple = SearchSysCacheCopy2(ATTNUM,
+								ObjectIdGetDatum(myrelid),
+								Int16GetDatum(myattnum));
 	if (!HeapTupleIsValid(tuple))		/* shouldn't happen */
 		elog(ERROR, "cache lookup failed for attribute %d of relation %u",
 			 myattnum, myrelid);
@@ -1663,10 +1658,9 @@ StoreAttrDefault(Relation rel, AttrNumber attnum, Node *expr)
 	 * exists.
 	 */
 	attrrel = heap_open(AttributeRelationId, RowExclusiveLock);
-	atttup = SearchSysCacheCopy(ATTNUM,
-								ObjectIdGetDatum(RelationGetRelid(rel)),
-								Int16GetDatum(attnum),
-								0, 0);
+	atttup = SearchSysCacheCopy2(ATTNUM,
+								 ObjectIdGetDatum(RelationGetRelid(rel)),
+								 Int16GetDatum(attnum));
 	if (!HeapTupleIsValid(atttup))
 		elog(ERROR, "cache lookup failed for attribute %d of relation %u",
 			 attnum, RelationGetRelid(rel));
@@ -2180,9 +2174,8 @@ SetRelationNumChecks(Relation rel, int numchecks)
 	Form_pg_class relStruct;
 
 	relrel = heap_open(RelationRelationId, RowExclusiveLock);
-	reltup = SearchSysCacheCopy(RELOID,
-								ObjectIdGetDatum(RelationGetRelid(rel)),
-								0, 0, 0);
+	reltup = SearchSysCacheCopy1(RELOID,
+								 ObjectIdGetDatum(RelationGetRelid(rel)));
 	if (!HeapTupleIsValid(reltup))
 		elog(ERROR, "cache lookup failed for relation %u",
 			 RelationGetRelid(rel));
diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c
index 8f38c1f..a6376ba 100644
--- a/src/backend/catalog/index.c
+++ b/src/backend/catalog/index.c
@@ -141,9 +141,8 @@ ConstructTupleDescriptor(Relation heapRelation,
 	int			i;
 
 	/* We need access to the index AM's pg_am tuple */
-	amtuple = SearchSysCache(AMOID,
-							 ObjectIdGetDatum(accessMethodObjectId),
-							 0, 0, 0);
+	amtuple = SearchSysCache1(AMOID,
+							  ObjectIdGetDatum(accessMethodObjectId));
 	if (!HeapTupleIsValid(amtuple))
 		elog(ERROR, "cache lookup failed for access method %u",
 			 accessMethodObjectId);
@@ -230,9 +229,7 @@ ConstructTupleDescriptor(Relation heapRelation,
 			 * Lookup the expression type in pg_type for the type length etc.
 			 */
 			keyType = exprType(indexkey);
-			tuple = SearchSysCache(TYPEOID,
-								   ObjectIdGetDatum(keyType),
-								   0, 0, 0);
+			tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(keyType));
 			if (!HeapTupleIsValid(tuple))
 				elog(ERROR, "cache lookup failed for type %u", keyType);
 			typeTup = (Form_pg_type) GETSTRUCT(tuple);
@@ -284,9 +281,7 @@ ConstructTupleDescriptor(Relation heapRelation,
 		 * Check the opclass and index AM to see if either provides a keytype
 		 * (overriding the attribute type).  Opclass takes precedence.
 		 */
-		tuple = SearchSysCache(CLAOID,
-							   ObjectIdGetDatum(classObjectId[i]),
-							   0, 0, 0);
+		tuple = SearchSysCache1(CLAOID, ObjectIdGetDatum(classObjectId[i]));
 		if (!HeapTupleIsValid(tuple))
 			elog(ERROR, "cache lookup failed for opclass %u",
 				 classObjectId[i]);
@@ -300,9 +295,7 @@ ConstructTupleDescriptor(Relation heapRelation,
 		if (OidIsValid(keyType) && keyType != to->atttypid)
 		{
 			/* index value and heap value have different types */
-			tuple = SearchSysCache(TYPEOID,
-								   ObjectIdGetDatum(keyType),
-								   0, 0, 0);
+			tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(keyType));
 			if (!HeapTupleIsValid(tuple))
 				elog(ERROR, "cache lookup failed for type %u", keyType);
 			typeTup = (Form_pg_type) GETSTRUCT(tuple);
@@ -1031,9 +1024,7 @@ index_drop(Oid indexId)
 	 */
 	indexRelation = heap_open(IndexRelationId, RowExclusiveLock);
 
-	tuple = SearchSysCache(INDEXRELID,
-						   ObjectIdGetDatum(indexId),
-						   0, 0, 0);
+	tuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexId));
 	if (!HeapTupleIsValid(tuple))
 		elog(ERROR, "cache lookup failed for index %u", indexId);
 
@@ -1316,9 +1307,7 @@ index_update_stats(Relation rel,
 	else
 	{
 		/* normal case, use syscache */
-		tuple = SearchSysCacheCopy(RELOID,
-								   ObjectIdGetDatum(relid),
-								   0, 0, 0);
+		tuple = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relid));
 	}
 
 	if (!HeapTupleIsValid(tuple))
@@ -1473,9 +1462,8 @@ index_build(Relation heapRelation,
 
 		pg_index = heap_open(IndexRelationId, RowExclusiveLock);
 
-		indexTuple = SearchSysCacheCopy(INDEXRELID,
-										ObjectIdGetDatum(indexId),
-										0, 0, 0);
+		indexTuple = SearchSysCacheCopy1(INDEXRELID,
+										 ObjectIdGetDatum(indexId));
 		if (!HeapTupleIsValid(indexTuple))
 			elog(ERROR, "cache lookup failed for index %u", indexId);
 		indexForm = (Form_pg_index) GETSTRUCT(indexTuple);
@@ -2393,9 +2381,7 @@ IndexGetRelation(Oid indexId)
 	Form_pg_index index;
 	Oid			result;
 
-	tuple = SearchSysCache(INDEXRELID,
-						   ObjectIdGetDatum(indexId),
-						   0, 0, 0);
+	tuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexId));
 	if (!HeapTupleIsValid(tuple))
 		elog(ERROR, "cache lookup failed for index %u", indexId);
 	index = (Form_pg_index) GETSTRUCT(tuple);
@@ -2498,9 +2484,8 @@ reindex_index(Oid indexId, bool skip_constraint_checks)
 	{
 		pg_index = heap_open(IndexRelationId, RowExclusiveLock);
 
-		indexTuple = SearchSysCacheCopy(INDEXRELID,
-										ObjectIdGetDatum(indexId),
-										0, 0, 0);
+		indexTuple = SearchSysCacheCopy1(INDEXRELID,
+										 ObjectIdGetDatum(indexId));
 		if (!HeapTupleIsValid(indexTuple))
 			elog(ERROR, "cache lookup failed for index %u", indexId);
 		indexForm = (Form_pg_index) GETSTRUCT(indexTuple);
diff --git a/src/backend/catalog/namespace.c b/src/backend/catalog/namespace.c
index 54de01d..28cd2af 100644
--- a/src/backend/catalog/namespace.c
+++ b/src/backend/catalog/namespace.c
@@ -332,9 +332,8 @@ RangeVarGetCreationNamespace(const RangeVar *newRelation)
 			return myTempNamespace;
 		}
 		/* use exact schema given */
-		namespaceId = GetSysCacheOid(NAMESPACENAME,
-									 CStringGetDatum(newRelation->schemaname),
-									 0, 0, 0);
+		namespaceId = GetSysCacheOid1(NAMESPACENAME,
+									  CStringGetDatum(newRelation->schemaname));
 		if (!OidIsValid(namespaceId))
 			ereport(ERROR,
 					(errcode(ERRCODE_UNDEFINED_SCHEMA),
@@ -405,9 +404,7 @@ RelationIsVisible(Oid relid)
 	Oid			relnamespace;
 	bool		visible;
 
-	reltup = SearchSysCache(RELOID,
-							ObjectIdGetDatum(relid),
-							0, 0, 0);
+	reltup = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
 	if (!HeapTupleIsValid(reltup))
 		elog(ERROR, "cache lookup failed for relation %u", relid);
 	relform = (Form_pg_class) GETSTRUCT(reltup);
@@ -477,10 +474,9 @@ TypenameGetTypid(const char *typname)
 	{
 		Oid			namespaceId = lfirst_oid(l);
 
-		typid = GetSysCacheOid(TYPENAMENSP,
-							   PointerGetDatum(typname),
-							   ObjectIdGetDatum(namespaceId),
-							   0, 0);
+		typid = GetSysCacheOid2(TYPENAMENSP,
+								PointerGetDatum(typname),
+								ObjectIdGetDatum(namespaceId));
 		if (OidIsValid(typid))
 			return typid;
 	}
@@ -503,9 +499,7 @@ TypeIsVisible(Oid typid)
 	Oid			typnamespace;
 	bool		visible;
 
-	typtup = SearchSysCache(TYPEOID,
-							ObjectIdGetDatum(typid),
-							0, 0, 0);
+	typtup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
 	if (!HeapTupleIsValid(typtup))
 		elog(ERROR, "cache lookup failed for type %u", typid);
 	typform = (Form_pg_type) GETSTRUCT(typtup);
@@ -542,10 +536,9 @@ TypeIsVisible(Oid typid)
 				visible = true;
 				break;
 			}
-			if (SearchSysCacheExists(TYPENAMENSP,
-									 PointerGetDatum(typname),
-									 ObjectIdGetDatum(namespaceId),
-									 0, 0))
+			if (SearchSysCacheExists2(TYPENAMENSP,
+									  PointerGetDatum(typname),
+									  ObjectIdGetDatum(namespaceId)))
 			{
 				/* Found something else first in path */
 				break;
@@ -651,9 +644,7 @@ FuncnameGetCandidates(List *names, int nargs, List *argnames,
 	}
 
 	/* Search syscache by name only */
-	catlist = SearchSysCacheList(PROCNAMEARGSNSP, 1,
-								 CStringGetDatum(funcname),
-								 0, 0, 0);
+	catlist = SearchSysCacheList1(PROCNAMEARGSNSP, CStringGetDatum(funcname));
 
 	for (i = 0; i < catlist->n_members; i++)
 	{
@@ -1099,9 +1090,7 @@ FunctionIsVisible(Oid funcid)
 	Oid			pronamespace;
 	bool		visible;
 
-	proctup = SearchSysCache(PROCOID,
-							 ObjectIdGetDatum(funcid),
-							 0, 0, 0);
+	proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
 	if (!HeapTupleIsValid(proctup))
 		elog(ERROR, "cache lookup failed for function %u", funcid);
 	procform = (Form_pg_proc) GETSTRUCT(proctup);
@@ -1181,11 +1170,11 @@ OpernameGetOprid(List *names, Oid oprleft, Oid oprright)
 		HeapTuple	opertup;
 
 		namespaceId = LookupExplicitNamespace(schemaname);
-		opertup = SearchSysCache(OPERNAMENSP,
-								 CStringGetDatum(opername),
-								 ObjectIdGetDatum(oprleft),
-								 ObjectIdGetDatum(oprright),
-								 ObjectIdGetDatum(namespaceId));
+		opertup = SearchSysCache4(OPERNAMENSP,
+								  CStringGetDatum(opername),
+								  ObjectIdGetDatum(oprleft),
+								  ObjectIdGetDatum(oprright),
+								  ObjectIdGetDatum(namespaceId));
 		if (HeapTupleIsValid(opertup))
 		{
 			Oid			result = HeapTupleGetOid(opertup);
@@ -1197,11 +1186,10 @@ OpernameGetOprid(List *names, Oid oprleft, Oid oprright)
 	}
 
 	/* Search syscache by name and argument types */
-	catlist = SearchSysCacheList(OPERNAMENSP, 3,
-								 CStringGetDatum(opername),
-								 ObjectIdGetDatum(oprleft),
-								 ObjectIdGetDatum(oprright),
-								 0);
+	catlist = SearchSysCacheList3(OPERNAMENSP,
+								  CStringGetDatum(opername),
+								  ObjectIdGetDatum(oprleft),
+								  ObjectIdGetDatum(oprright));
 
 	if (catlist->n_members == 0)
 	{
@@ -1289,9 +1277,7 @@ OpernameGetCandidates(List *names, char oprkind)
 	}
 
 	/* Search syscache by name only */
-	catlist = SearchSysCacheList(OPERNAMENSP, 1,
-								 CStringGetDatum(opername),
-								 0, 0, 0);
+	catlist = SearchSysCacheList1(OPERNAMENSP, CStringGetDatum(opername));
 
 	/*
 	 * In typical scenarios, most if not all of the operators found by the
@@ -1428,9 +1414,7 @@ OperatorIsVisible(Oid oprid)
 	Oid			oprnamespace;
 	bool		visible;
 
-	oprtup = SearchSysCache(OPEROID,
-							ObjectIdGetDatum(oprid),
-							0, 0, 0);
+	oprtup = SearchSysCache1(OPEROID, ObjectIdGetDatum(oprid));
 	if (!HeapTupleIsValid(oprtup))
 		elog(ERROR, "cache lookup failed for operator %u", oprid);
 	oprform = (Form_pg_operator) GETSTRUCT(oprtup);
@@ -1490,11 +1474,10 @@ OpclassnameGetOpcid(Oid amid, const char *opcname)
 		if (namespaceId == myTempNamespace)
 			continue;			/* do not look in temp namespace */
 
-		opcid = GetSysCacheOid(CLAAMNAMENSP,
-							   ObjectIdGetDatum(amid),
-							   PointerGetDatum(opcname),
-							   ObjectIdGetDatum(namespaceId),
-							   0);
+		opcid = GetSysCacheOid3(CLAAMNAMENSP,
+								ObjectIdGetDatum(amid),
+								PointerGetDatum(opcname),
+								ObjectIdGetDatum(namespaceId));
 		if (OidIsValid(opcid))
 			return opcid;
 	}
@@ -1517,9 +1500,7 @@ OpclassIsVisible(Oid opcid)
 	Oid			opcnamespace;
 	bool		visible;
 
-	opctup = SearchSysCache(CLAOID,
-							ObjectIdGetDatum(opcid),
-							0, 0, 0);
+	opctup = SearchSysCache1(CLAOID, ObjectIdGetDatum(opcid));
 	if (!HeapTupleIsValid(opctup))
 		elog(ERROR, "cache lookup failed for opclass %u", opcid);
 	opcform = (Form_pg_opclass) GETSTRUCT(opctup);
@@ -1576,11 +1557,10 @@ OpfamilynameGetOpfid(Oid amid, const char *opfname)
 		if (namespaceId == myTempNamespace)
 			continue;			/* do not look in temp namespace */
 
-		opfid = GetSysCacheOid(OPFAMILYAMNAMENSP,
-							   ObjectIdGetDatum(amid),
-							   PointerGetDatum(opfname),
-							   ObjectIdGetDatum(namespaceId),
-							   0);
+		opfid = GetSysCacheOid3(OPFAMILYAMNAMENSP,
+								ObjectIdGetDatum(amid),
+								PointerGetDatum(opfname),
+								ObjectIdGetDatum(namespaceId));
 		if (OidIsValid(opfid))
 			return opfid;
 	}
@@ -1603,9 +1583,7 @@ OpfamilyIsVisible(Oid opfid)
 	Oid			opfnamespace;
 	bool		visible;
 
-	opftup = SearchSysCache(OPFAMILYOID,
-							ObjectIdGetDatum(opfid),
-							0, 0, 0);
+	opftup = SearchSysCache1(OPFAMILYOID, ObjectIdGetDatum(opfid));
 	if (!HeapTupleIsValid(opftup))
 		elog(ERROR, "cache lookup failed for opfamily %u", opfid);
 	opfform = (Form_pg_opfamily) GETSTRUCT(opftup);
@@ -1661,10 +1639,9 @@ ConversionGetConid(const char *conname)
 		if (namespaceId == myTempNamespace)
 			continue;			/* do not look in temp namespace */
 
-		conid = GetSysCacheOid(CONNAMENSP,
-							   PointerGetDatum(conname),
-							   ObjectIdGetDatum(namespaceId),
-							   0, 0);
+		conid = GetSysCacheOid2(CONNAMENSP,
+								PointerGetDatum(conname),
+								ObjectIdGetDatum(namespaceId));
 		if (OidIsValid(conid))
 			return conid;
 	}
@@ -1687,9 +1664,7 @@ ConversionIsVisible(Oid conid)
 	Oid			connamespace;
 	bool		visible;
 
-	contup = SearchSysCache(CONVOID,
-							ObjectIdGetDatum(conid),
-							0, 0, 0);
+	contup = SearchSysCache1(CONVOID, ObjectIdGetDatum(conid));
 	if (!HeapTupleIsValid(contup))
 		elog(ERROR, "cache lookup failed for conversion %u", conid);
 	conform = (Form_pg_conversion) GETSTRUCT(contup);
@@ -1744,10 +1719,9 @@ TSParserGetPrsid(List *names, bool failOK)
 	{
 		/* use exact schema given */
 		namespaceId = LookupExplicitNamespace(schemaname);
-		prsoid = GetSysCacheOid(TSPARSERNAMENSP,
-								PointerGetDatum(parser_name),
-								ObjectIdGetDatum(namespaceId),
-								0, 0);
+		prsoid = GetSysCacheOid2(TSPARSERNAMENSP,
+								 PointerGetDatum(parser_name),
+								 ObjectIdGetDatum(namespaceId));
 	}
 	else
 	{
@@ -1761,10 +1735,9 @@ TSParserGetPrsid(List *names, bool failOK)
 			if (namespaceId == myTempNamespace)
 				continue;		/* do not look in temp namespace */
 
-			prsoid = GetSysCacheOid(TSPARSERNAMENSP,
-									PointerGetDatum(parser_name),
-									ObjectIdGetDatum(namespaceId),
-									0, 0);
+			prsoid = GetSysCacheOid2(TSPARSERNAMENSP,
+									 PointerGetDatum(parser_name),
+									 ObjectIdGetDatum(namespaceId));
 			if (OidIsValid(prsoid))
 				break;
 		}
@@ -1793,9 +1766,7 @@ TSParserIsVisible(Oid prsId)
 	Oid			namespace;
 	bool		visible;
 
-	tup = SearchSysCache(TSPARSEROID,
-						 ObjectIdGetDatum(prsId),
-						 0, 0, 0);
+	tup = SearchSysCache1(TSPARSEROID, ObjectIdGetDatum(prsId));
 	if (!HeapTupleIsValid(tup))
 		elog(ERROR, "cache lookup failed for text search parser %u", prsId);
 	form = (Form_pg_ts_parser) GETSTRUCT(tup);
@@ -1835,10 +1806,9 @@ TSParserIsVisible(Oid prsId)
 				visible = true;
 				break;
 			}
-			if (SearchSysCacheExists(TSPARSERNAMENSP,
-									 PointerGetDatum(name),
-									 ObjectIdGetDatum(namespaceId),
-									 0, 0))
+			if (SearchSysCacheExists2(TSPARSERNAMENSP,
+									  PointerGetDatum(name),
+									  ObjectIdGetDatum(namespaceId)))
 			{
 				/* Found something else first in path */
 				break;
@@ -1872,10 +1842,9 @@ TSDictionaryGetDictid(List *names, bool failOK)
 	{
 		/* use exact schema given */
 		namespaceId = LookupExplicitNamespace(schemaname);
-		dictoid = GetSysCacheOid(TSDICTNAMENSP,
-								 PointerGetDatum(dict_name),
-								 ObjectIdGetDatum(namespaceId),
-								 0, 0);
+		dictoid = GetSysCacheOid2(TSDICTNAMENSP,
+								  PointerGetDatum(dict_name),
+								  ObjectIdGetDatum(namespaceId));
 	}
 	else
 	{
@@ -1889,10 +1858,9 @@ TSDictionaryGetDictid(List *names, bool failOK)
 			if (namespaceId == myTempNamespace)
 				continue;		/* do not look in temp namespace */
 
-			dictoid = GetSysCacheOid(TSDICTNAMENSP,
-									 PointerGetDatum(dict_name),
-									 ObjectIdGetDatum(namespaceId),
-									 0, 0);
+			dictoid = GetSysCacheOid2(TSDICTNAMENSP,
+									  PointerGetDatum(dict_name),
+									  ObjectIdGetDatum(namespaceId));
 			if (OidIsValid(dictoid))
 				break;
 		}
@@ -1921,9 +1889,7 @@ TSDictionaryIsVisible(Oid dictId)
 	Oid			namespace;
 	bool		visible;
 
-	tup = SearchSysCache(TSDICTOID,
-						 ObjectIdGetDatum(dictId),
-						 0, 0, 0);
+	tup = SearchSysCache1(TSDICTOID, ObjectIdGetDatum(dictId));
 	if (!HeapTupleIsValid(tup))
 		elog(ERROR, "cache lookup failed for text search dictionary %u",
 			 dictId);
@@ -1964,10 +1930,9 @@ TSDictionaryIsVisible(Oid dictId)
 				visible = true;
 				break;
 			}
-			if (SearchSysCacheExists(TSDICTNAMENSP,
-									 PointerGetDatum(name),
-									 ObjectIdGetDatum(namespaceId),
-									 0, 0))
+			if (SearchSysCacheExists2(TSDICTNAMENSP,
+									  PointerGetDatum(name),
+									  ObjectIdGetDatum(namespaceId)))
 			{
 				/* Found something else first in path */
 				break;
@@ -2001,10 +1966,9 @@ TSTemplateGetTmplid(List *names, bool failOK)
 	{
 		/* use exact schema given */
 		namespaceId = LookupExplicitNamespace(schemaname);
-		tmploid = GetSysCacheOid(TSTEMPLATENAMENSP,
-								 PointerGetDatum(template_name),
-								 ObjectIdGetDatum(namespaceId),
-								 0, 0);
+		tmploid = GetSysCacheOid2(TSTEMPLATENAMENSP,
+								  PointerGetDatum(template_name),
+								  ObjectIdGetDatum(namespaceId));
 	}
 	else
 	{
@@ -2018,10 +1982,9 @@ TSTemplateGetTmplid(List *names, bool failOK)
 			if (namespaceId == myTempNamespace)
 				continue;		/* do not look in temp namespace */
 
-			tmploid = GetSysCacheOid(TSTEMPLATENAMENSP,
-									 PointerGetDatum(template_name),
-									 ObjectIdGetDatum(namespaceId),
-									 0, 0);
+			tmploid = GetSysCacheOid2(TSTEMPLATENAMENSP,
+									  PointerGetDatum(template_name),
+									  ObjectIdGetDatum(namespaceId));
 			if (OidIsValid(tmploid))
 				break;
 		}
@@ -2050,9 +2013,7 @@ TSTemplateIsVisible(Oid tmplId)
 	Oid			namespace;
 	bool		visible;
 
-	tup = SearchSysCache(TSTEMPLATEOID,
-						 ObjectIdGetDatum(tmplId),
-						 0, 0, 0);
+	tup = SearchSysCache1(TSTEMPLATEOID, ObjectIdGetDatum(tmplId));
 	if (!HeapTupleIsValid(tup))
 		elog(ERROR, "cache lookup failed for text search template %u", tmplId);
 	form = (Form_pg_ts_template) GETSTRUCT(tup);
@@ -2092,10 +2053,9 @@ TSTemplateIsVisible(Oid tmplId)
 				visible = true;
 				break;
 			}
-			if (SearchSysCacheExists(TSTEMPLATENAMENSP,
-									 PointerGetDatum(name),
-									 ObjectIdGetDatum(namespaceId),
-									 0, 0))
+			if (SearchSysCacheExists2(TSTEMPLATENAMENSP,
+									  PointerGetDatum(name),
+									  ObjectIdGetDatum(namespaceId)))
 			{
 				/* Found something else first in path */
 				break;
@@ -2129,10 +2089,9 @@ TSConfigGetCfgid(List *names, bool failOK)
 	{
 		/* use exact schema given */
 		namespaceId = LookupExplicitNamespace(schemaname);
-		cfgoid = GetSysCacheOid(TSCONFIGNAMENSP,
-								PointerGetDatum(config_name),
-								ObjectIdGetDatum(namespaceId),
-								0, 0);
+		cfgoid = GetSysCacheOid2(TSCONFIGNAMENSP,
+								 PointerGetDatum(config_name),
+								 ObjectIdGetDatum(namespaceId));
 	}
 	else
 	{
@@ -2146,10 +2105,9 @@ TSConfigGetCfgid(List *names, bool failOK)
 			if (namespaceId == myTempNamespace)
 				continue;		/* do not look in temp namespace */
 
-			cfgoid = GetSysCacheOid(TSCONFIGNAMENSP,
-									PointerGetDatum(config_name),
-									ObjectIdGetDatum(namespaceId),
-									0, 0);
+			cfgoid = GetSysCacheOid2(TSCONFIGNAMENSP,
+									 PointerGetDatum(config_name),
+									 ObjectIdGetDatum(namespaceId));
 			if (OidIsValid(cfgoid))
 				break;
 		}
@@ -2178,9 +2136,7 @@ TSConfigIsVisible(Oid cfgid)
 	Oid			namespace;
 	bool		visible;
 
-	tup = SearchSysCache(TSCONFIGOID,
-						 ObjectIdGetDatum(cfgid),
-						 0, 0, 0);
+	tup = SearchSysCache1(TSCONFIGOID, ObjectIdGetDatum(cfgid));
 	if (!HeapTupleIsValid(tup))
 		elog(ERROR, "cache lookup failed for text search configuration %u",
 			 cfgid);
@@ -2221,10 +2177,9 @@ TSConfigIsVisible(Oid cfgid)
 				visible = true;
 				break;
 			}
-			if (SearchSysCacheExists(TSCONFIGNAMENSP,
-									 PointerGetDatum(name),
-									 ObjectIdGetDatum(namespaceId),
-									 0, 0))
+			if (SearchSysCacheExists2(TSCONFIGNAMENSP,
+									  PointerGetDatum(name),
+									  ObjectIdGetDatum(namespaceId)))
 			{
 				/* Found something else first in path */
 				break;
@@ -2316,9 +2271,7 @@ LookupNamespaceNoError(const char *nspname)
 		return InvalidOid;
 	}
 
-	return GetSysCacheOid(NAMESPACENAME,
-						  CStringGetDatum(nspname),
-						  0, 0, 0);
+	return GetSysCacheOid1(NAMESPACENAME, CStringGetDatum(nspname));
 }
 
 /*
@@ -2348,9 +2301,7 @@ LookupExplicitNamespace(const char *nspname)
 		 */
 	}
 
-	namespaceId = GetSysCacheOid(NAMESPACENAME,
-								 CStringGetDatum(nspname),
-								 0, 0, 0);
+	namespaceId = GetSysCacheOid1(NAMESPACENAME, CStringGetDatum(nspname));
 	if (!OidIsValid(namespaceId))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_SCHEMA),
@@ -2389,9 +2340,7 @@ LookupCreationNamespace(const char *nspname)
 		return myTempNamespace;
 	}
 
-	namespaceId = GetSysCacheOid(NAMESPACENAME,
-								 CStringGetDatum(nspname),
-								 0, 0, 0);
+	namespaceId = GetSysCacheOid1(NAMESPACENAME, CStringGetDatum(nspname));
 	if (!OidIsValid(namespaceId))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_SCHEMA),
@@ -2437,9 +2386,8 @@ QualifiedNameGetCreationNamespace(List *names, char **objname_p)
 			return myTempNamespace;
 		}
 		/* use exact schema given */
-		namespaceId = GetSysCacheOid(NAMESPACENAME,
-									 CStringGetDatum(schemaname),
-									 0, 0, 0);
+		namespaceId = GetSysCacheOid1(NAMESPACENAME,
+									  CStringGetDatum(schemaname));
 		if (!OidIsValid(namespaceId))
 			ereport(ERROR,
 					(errcode(ERRCODE_UNDEFINED_SCHEMA),
@@ -2836,10 +2784,9 @@ FindConversionByName(List *name)
 	{
 		/* use exact schema given */
 		namespaceId = LookupExplicitNamespace(schemaname);
-		return GetSysCacheOid(CONNAMENSP,
-							  PointerGetDatum(conversion_name),
-							  ObjectIdGetDatum(namespaceId),
-							  0, 0);
+		return GetSysCacheOid2(CONNAMENSP,
+							   PointerGetDatum(conversion_name),
+							   ObjectIdGetDatum(namespaceId));
 	}
 	else
 	{
@@ -2853,10 +2800,9 @@ FindConversionByName(List *name)
 			if (namespaceId == myTempNamespace)
 				continue;		/* do not look in temp namespace */
 
-			conoid = GetSysCacheOid(CONNAMENSP,
-									PointerGetDatum(conversion_name),
-									ObjectIdGetDatum(namespaceId),
-									0, 0);
+			conoid = GetSysCacheOid2(CONNAMENSP,
+									 PointerGetDatum(conversion_name),
+									 ObjectIdGetDatum(namespaceId));
 			if (OidIsValid(conoid))
 				return conoid;
 		}
@@ -2946,17 +2892,14 @@ recomputeNamespacePath(void)
 			/* $user --- substitute namespace matching user name, if any */
 			HeapTuple	tuple;
 
-			tuple = SearchSysCache(AUTHOID,
-								   ObjectIdGetDatum(roleid),
-								   0, 0, 0);
+			tuple = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid));
 			if (HeapTupleIsValid(tuple))
 			{
 				char	   *rname;
 
 				rname = NameStr(((Form_pg_authid) GETSTRUCT(tuple))->rolname);
-				namespaceId = GetSysCacheOid(NAMESPACENAME,
-											 CStringGetDatum(rname),
-											 0, 0, 0);
+				namespaceId = GetSysCacheOid1(NAMESPACENAME,
+											  CStringGetDatum(rname));
 				ReleaseSysCache(tuple);
 				if (OidIsValid(namespaceId) &&
 					!list_member_oid(oidlist, namespaceId) &&
@@ -2983,9 +2926,8 @@ recomputeNamespacePath(void)
 		else
 		{
 			/* normal namespace reference */
-			namespaceId = GetSysCacheOid(NAMESPACENAME,
-										 CStringGetDatum(curname),
-										 0, 0, 0);
+			namespaceId = GetSysCacheOid1(NAMESPACENAME,
+										  CStringGetDatum(curname));
 			if (OidIsValid(namespaceId) &&
 				!list_member_oid(oidlist, namespaceId) &&
 				pg_namespace_aclcheck(namespaceId, roleid,
@@ -3077,9 +3019,8 @@ InitTempTableNamespace(void)
 
 	snprintf(namespaceName, sizeof(namespaceName), "pg_temp_%d", MyBackendId);
 
-	namespaceId = GetSysCacheOid(NAMESPACENAME,
-								 CStringGetDatum(namespaceName),
-								 0, 0, 0);
+	namespaceId = GetSysCacheOid1(NAMESPACENAME,
+								  CStringGetDatum(namespaceName));
 	if (!OidIsValid(namespaceId))
 	{
 		/*
@@ -3111,9 +3052,8 @@ InitTempTableNamespace(void)
 	snprintf(namespaceName, sizeof(namespaceName), "pg_toast_temp_%d",
 			 MyBackendId);
 
-	toastspaceId = GetSysCacheOid(NAMESPACENAME,
-								  CStringGetDatum(namespaceName),
-								  0, 0, 0);
+	toastspaceId = GetSysCacheOid1(NAMESPACENAME,
+								   CStringGetDatum(namespaceName));
 	if (!OidIsValid(toastspaceId))
 	{
 		toastspaceId = NamespaceCreate(namespaceName, BOOTSTRAP_SUPERUSERID);
@@ -3351,9 +3291,8 @@ assign_search_path(const char *newval, bool doit, GucSource source)
 				continue;
 			if (strcmp(curname, "pg_temp") == 0)
 				continue;
-			if (!SearchSysCacheExists(NAMESPACENAME,
-									  CStringGetDatum(curname),
-									  0, 0, 0))
+			if (!SearchSysCacheExists1(NAMESPACENAME,
+									   CStringGetDatum(curname)))
 				ereport((source == PGC_S_TEST) ? NOTICE : ERROR,
 						(errcode(ERRCODE_UNDEFINED_SCHEMA),
 						 errmsg("schema \"%s\" does not exist", curname)));
@@ -3519,9 +3458,7 @@ pg_table_is_visible(PG_FUNCTION_ARGS)
 {
 	Oid			oid = PG_GETARG_OID(0);
 
-	if (!SearchSysCacheExists(RELOID,
-							  ObjectIdGetDatum(oid),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(oid)))
 		PG_RETURN_NULL();
 
 	PG_RETURN_BOOL(RelationIsVisible(oid));
@@ -3532,9 +3469,7 @@ pg_type_is_visible(PG_FUNCTION_ARGS)
 {
 	Oid			oid = PG_GETARG_OID(0);
 
-	if (!SearchSysCacheExists(TYPEOID,
-							  ObjectIdGetDatum(oid),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(TYPEOID, ObjectIdGetDatum(oid)))
 		PG_RETURN_NULL();
 
 	PG_RETURN_BOOL(TypeIsVisible(oid));
@@ -3545,9 +3480,7 @@ pg_function_is_visible(PG_FUNCTION_ARGS)
 {
 	Oid			oid = PG_GETARG_OID(0);
 
-	if (!SearchSysCacheExists(PROCOID,
-							  ObjectIdGetDatum(oid),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(PROCOID, ObjectIdGetDatum(oid)))
 		PG_RETURN_NULL();
 
 	PG_RETURN_BOOL(FunctionIsVisible(oid));
@@ -3558,9 +3491,7 @@ pg_operator_is_visible(PG_FUNCTION_ARGS)
 {
 	Oid			oid = PG_GETARG_OID(0);
 
-	if (!SearchSysCacheExists(OPEROID,
-							  ObjectIdGetDatum(oid),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(OPEROID, ObjectIdGetDatum(oid)))
 		PG_RETURN_NULL();
 
 	PG_RETURN_BOOL(OperatorIsVisible(oid));
@@ -3571,9 +3502,7 @@ pg_opclass_is_visible(PG_FUNCTION_ARGS)
 {
 	Oid			oid = PG_GETARG_OID(0);
 
-	if (!SearchSysCacheExists(CLAOID,
-							  ObjectIdGetDatum(oid),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(CLAOID, ObjectIdGetDatum(oid)))
 		PG_RETURN_NULL();
 
 	PG_RETURN_BOOL(OpclassIsVisible(oid));
@@ -3584,9 +3513,7 @@ pg_conversion_is_visible(PG_FUNCTION_ARGS)
 {
 	Oid			oid = PG_GETARG_OID(0);
 
-	if (!SearchSysCacheExists(CONVOID,
-							  ObjectIdGetDatum(oid),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(CONVOID, ObjectIdGetDatum(oid)))
 		PG_RETURN_NULL();
 
 	PG_RETURN_BOOL(ConversionIsVisible(oid));
@@ -3597,9 +3524,7 @@ pg_ts_parser_is_visible(PG_FUNCTION_ARGS)
 {
 	Oid			oid = PG_GETARG_OID(0);
 
-	if (!SearchSysCacheExists(TSPARSEROID,
-							  ObjectIdGetDatum(oid),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(TSPARSEROID, ObjectIdGetDatum(oid)))
 		PG_RETURN_NULL();
 
 	PG_RETURN_BOOL(TSParserIsVisible(oid));
@@ -3610,9 +3535,7 @@ pg_ts_dict_is_visible(PG_FUNCTION_ARGS)
 {
 	Oid			oid = PG_GETARG_OID(0);
 
-	if (!SearchSysCacheExists(TSDICTOID,
-							  ObjectIdGetDatum(oid),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(TSDICTOID, ObjectIdGetDatum(oid)))
 		PG_RETURN_NULL();
 
 	PG_RETURN_BOOL(TSDictionaryIsVisible(oid));
@@ -3623,9 +3546,7 @@ pg_ts_template_is_visible(PG_FUNCTION_ARGS)
 {
 	Oid			oid = PG_GETARG_OID(0);
 
-	if (!SearchSysCacheExists(TSTEMPLATEOID,
-							  ObjectIdGetDatum(oid),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(TSTEMPLATEOID, ObjectIdGetDatum(oid)))
 		PG_RETURN_NULL();
 
 	PG_RETURN_BOOL(TSTemplateIsVisible(oid));
@@ -3636,9 +3557,7 @@ pg_ts_config_is_visible(PG_FUNCTION_ARGS)
 {
 	Oid			oid = PG_GETARG_OID(0);
 
-	if (!SearchSysCacheExists(TSCONFIGOID,
-							  ObjectIdGetDatum(oid),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(TSCONFIGOID, ObjectIdGetDatum(oid)))
 		PG_RETURN_NULL();
 
 	PG_RETURN_BOOL(TSConfigIsVisible(oid));
diff --git a/src/backend/catalog/pg_aggregate.c b/src/backend/catalog/pg_aggregate.c
index cd5d927..877e975 100644
--- a/src/backend/catalog/pg_aggregate.c
+++ b/src/backend/catalog/pg_aggregate.c
@@ -125,9 +125,7 @@ AggregateCreate(const char *aggName,
 						NameListToString(aggtransfnName),
 						format_type_be(aggTransType))));
 
-	tup = SearchSysCache(PROCOID,
-						 ObjectIdGetDatum(transfn),
-						 0, 0, 0);
+	tup = SearchSysCache1(PROCOID, ObjectIdGetDatum(transfn));
 	if (!HeapTupleIsValid(tup))
 		elog(ERROR, "cache lookup failed for function %u", transfn);
 	proc = (Form_pg_proc) GETSTRUCT(tup);
diff --git a/src/backend/catalog/pg_constraint.c b/src/backend/catalog/pg_constraint.c
index 470fa1f..3c6407c 100644
--- a/src/backend/catalog/pg_constraint.c
+++ b/src/backend/catalog/pg_constraint.c
@@ -527,9 +527,7 @@ RemoveConstraintById(Oid conId)
 
 	conDesc = heap_open(ConstraintRelationId, RowExclusiveLock);
 
-	tup = SearchSysCache(CONSTROID,
-						 ObjectIdGetDatum(conId),
-						 0, 0, 0);
+	tup = SearchSysCache1(CONSTROID, ObjectIdGetDatum(conId));
 	if (!HeapTupleIsValid(tup)) /* should not happen */
 		elog(ERROR, "cache lookup failed for constraint %u", conId);
 	con = (Form_pg_constraint) GETSTRUCT(tup);
@@ -559,9 +557,8 @@ RemoveConstraintById(Oid conId)
 			Form_pg_class classForm;
 
 			pgrel = heap_open(RelationRelationId, RowExclusiveLock);
-			relTup = SearchSysCacheCopy(RELOID,
-										ObjectIdGetDatum(con->conrelid),
-										0, 0, 0);
+			relTup = SearchSysCacheCopy1(RELOID,
+										 ObjectIdGetDatum(con->conrelid));
 			if (!HeapTupleIsValid(relTup))
 				elog(ERROR, "cache lookup failed for relation %u",
 					 con->conrelid);
@@ -623,9 +620,7 @@ RenameConstraintById(Oid conId, const char *newname)
 
 	conDesc = heap_open(ConstraintRelationId, RowExclusiveLock);
 
-	tuple = SearchSysCacheCopy(CONSTROID,
-							   ObjectIdGetDatum(conId),
-							   0, 0, 0);
+	tuple = SearchSysCacheCopy1(CONSTROID, ObjectIdGetDatum(conId));
 	if (!HeapTupleIsValid(tuple))
 		elog(ERROR, "cache lookup failed for constraint %u", conId);
 	con = (Form_pg_constraint) GETSTRUCT(tuple);
diff --git a/src/backend/catalog/pg_conversion.c b/src/backend/catalog/pg_conversion.c
index d26adda..99085c9 100644
--- a/src/backend/catalog/pg_conversion.c
+++ b/src/backend/catalog/pg_conversion.c
@@ -58,10 +58,9 @@ ConversionCreate(const char *conname, Oid connamespace,
 		elog(ERROR, "no conversion name supplied");
 
 	/* make sure there is no existing conversion of same name */
-	if (SearchSysCacheExists(CONNAMENSP,
-							 PointerGetDatum(conname),
-							 ObjectIdGetDatum(connamespace),
-							 0, 0))
+	if (SearchSysCacheExists2(CONNAMENSP,
+							  PointerGetDatum(conname),
+							  ObjectIdGetDatum(connamespace)))
 		ereport(ERROR,
 				(errcode(ERRCODE_DUPLICATE_OBJECT),
 				 errmsg("conversion \"%s\" already exists", conname)));
@@ -190,11 +189,10 @@ FindDefaultConversion(Oid name_space, int32 for_encoding, int32 to_encoding)
 	Oid			proc = InvalidOid;
 	int			i;
 
-	catlist = SearchSysCacheList(CONDEFAULT, 3,
-								 ObjectIdGetDatum(name_space),
-								 Int32GetDatum(for_encoding),
-								 Int32GetDatum(to_encoding),
-								 0);
+	catlist = SearchSysCacheList3(CONDEFAULT,
+								  ObjectIdGetDatum(name_space),
+								  Int32GetDatum(for_encoding),
+								  Int32GetDatum(to_encoding));
 
 	for (i = 0; i < catlist->n_members; i++)
 	{
diff --git a/src/backend/catalog/pg_inherits.c b/src/backend/catalog/pg_inherits.c
index 8b84ad5..a87f62e 100644
--- a/src/backend/catalog/pg_inherits.c
+++ b/src/backend/catalog/pg_inherits.c
@@ -124,9 +124,7 @@ find_inheritance_children(Oid parentrelId, LOCKMODE lockmode)
 			 * really exists or not.  If not, assume it was dropped while we
 			 * waited to acquire lock, and ignore it.
 			 */
-			if (!SearchSysCacheExists(RELOID,
-									  ObjectIdGetDatum(inhrelid),
-									  0, 0, 0))
+			if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(inhrelid)))
 			{
 				/* Release useless lock */
 				UnlockRelationOid(inhrelid, lockmode);
@@ -245,9 +243,7 @@ has_subclass(Oid relationId)
 	HeapTuple	tuple;
 	bool		result;
 
-	tuple = SearchSysCache(RELOID,
-						   ObjectIdGetDatum(relationId),
-						   0, 0, 0);
+	tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relationId));
 	if (!HeapTupleIsValid(tuple))
 		elog(ERROR, "cache lookup failed for relation %u", relationId);
 
diff --git a/src/backend/catalog/pg_namespace.c b/src/backend/catalog/pg_namespace.c
index fd67fa3..22111a3 100644
--- a/src/backend/catalog/pg_namespace.c
+++ b/src/backend/catalog/pg_namespace.c
@@ -44,9 +44,7 @@ NamespaceCreate(const char *nspName, Oid ownerId)
 		elog(ERROR, "no namespace name supplied");
 
 	/* make sure there is no existing namespace of same name */
-	if (SearchSysCacheExists(NAMESPACENAME,
-							 PointerGetDatum(nspName),
-							 0, 0, 0))
+	if (SearchSysCacheExists1(NAMESPACENAME, PointerGetDatum(nspName)))
 		ereport(ERROR,
 				(errcode(ERRCODE_DUPLICATE_SCHEMA),
 				 errmsg("schema \"%s\" already exists", nspName)));
diff --git a/src/backend/catalog/pg_operator.c b/src/backend/catalog/pg_operator.c
index edcd7f4..2362268 100644
--- a/src/backend/catalog/pg_operator.c
+++ b/src/backend/catalog/pg_operator.c
@@ -137,11 +137,11 @@ OperatorGet(const char *operatorName,
 	HeapTuple	tup;
 	Oid			operatorObjectId;
 
-	tup = SearchSysCache(OPERNAMENSP,
-						 PointerGetDatum(operatorName),
-						 ObjectIdGetDatum(leftObjectId),
-						 ObjectIdGetDatum(rightObjectId),
-						 ObjectIdGetDatum(operatorNamespace));
+	tup = SearchSysCache4(OPERNAMENSP,
+						  PointerGetDatum(operatorName),
+						  ObjectIdGetDatum(leftObjectId),
+						  ObjectIdGetDatum(rightObjectId),
+						  ObjectIdGetDatum(operatorNamespace));
 	if (HeapTupleIsValid(tup))
 	{
 		RegProcedure oprcode = ((Form_pg_operator) GETSTRUCT(tup))->oprcode;
@@ -511,9 +511,8 @@ OperatorCreate(const char *operatorName,
 	 */
 	if (operatorObjectId)
 	{
-		tup = SearchSysCacheCopy(OPEROID,
-								 ObjectIdGetDatum(operatorObjectId),
-								 0, 0, 0);
+		tup = SearchSysCacheCopy1(OPEROID,
+								  ObjectIdGetDatum(operatorObjectId));
 		if (!HeapTupleIsValid(tup))
 			elog(ERROR, "cache lookup failed for operator %u",
 				 operatorObjectId);
@@ -660,9 +659,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
 
 	pg_operator_desc = heap_open(OperatorRelationId, RowExclusiveLock);
 
-	tup = SearchSysCacheCopy(OPEROID,
-							 ObjectIdGetDatum(commId),
-							 0, 0, 0);
+	tup = SearchSysCacheCopy1(OPEROID, ObjectIdGetDatum(commId));
 
 	/*
 	 * if the commutator and negator are the same operator, do one update. XXX
@@ -730,9 +727,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
 
 	/* check and update the negator, if necessary */
 
-	tup = SearchSysCacheCopy(OPEROID,
-							 ObjectIdGetDatum(negId),
-							 0, 0, 0);
+	tup = SearchSysCacheCopy1(OPEROID, ObjectIdGetDatum(negId));
 
 	if (HeapTupleIsValid(tup) &&
 		!(OidIsValid(((Form_pg_operator) GETSTRUCT(tup))->oprnegate)))
diff --git a/src/backend/catalog/pg_proc.c b/src/backend/catalog/pg_proc.c
index 2db1e0e..922134d 100644
--- a/src/backend/catalog/pg_proc.c
+++ b/src/backend/catalog/pg_proc.c
@@ -338,11 +338,10 @@ ProcedureCreate(const char *procedureName,
 	tupDesc = RelationGetDescr(rel);
 
 	/* Check for pre-existing definition */
-	oldtup = SearchSysCache(PROCNAMEARGSNSP,
-							PointerGetDatum(procedureName),
-							PointerGetDatum(parameterTypes),
-							ObjectIdGetDatum(procNamespace),
-							0);
+	oldtup = SearchSysCache3(PROCNAMEARGSNSP,
+							 PointerGetDatum(procedureName),
+							 PointerGetDatum(parameterTypes),
+							 ObjectIdGetDatum(procNamespace));
 
 	if (HeapTupleIsValid(oldtup))
 	{
@@ -647,9 +646,7 @@ fmgr_internal_validator(PG_FUNCTION_ARGS)
 	 * name will be found later if it isn't there now.
 	 */
 
-	tuple = SearchSysCache(PROCOID,
-						   ObjectIdGetDatum(funcoid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcoid));
 	if (!HeapTupleIsValid(tuple))
 		elog(ERROR, "cache lookup failed for function %u", funcoid);
 	proc = (Form_pg_proc) GETSTRUCT(tuple);
@@ -697,9 +694,7 @@ fmgr_c_validator(PG_FUNCTION_ARGS)
 	 * and for pg_dump loading it's much better if we *do* check.
 	 */
 
-	tuple = SearchSysCache(PROCOID,
-						   ObjectIdGetDatum(funcoid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcoid));
 	if (!HeapTupleIsValid(tuple))
 		elog(ERROR, "cache lookup failed for function %u", funcoid);
 	proc = (Form_pg_proc) GETSTRUCT(tuple);
@@ -742,9 +737,7 @@ fmgr_sql_validator(PG_FUNCTION_ARGS)
 	bool		haspolyarg;
 	int			i;
 
-	tuple = SearchSysCache(PROCOID,
-						   ObjectIdGetDatum(funcoid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcoid));
 	if (!HeapTupleIsValid(tuple))
 		elog(ERROR, "cache lookup failed for function %u", funcoid);
 	proc = (Form_pg_proc) GETSTRUCT(tuple);
diff --git a/src/backend/catalog/pg_shdepend.c b/src/backend/catalog/pg_shdepend.c
index 6cde99c..b60ce37 100644
--- a/src/backend/catalog/pg_shdepend.c
+++ b/src/backend/catalog/pg_shdepend.c
@@ -973,9 +973,7 @@ shdepLockAndCheckObject(Oid classId, Oid objectId)
 	switch (classId)
 	{
 		case AuthIdRelationId:
-			if (!SearchSysCacheExists(AUTHOID,
-									  ObjectIdGetDatum(objectId),
-									  0, 0, 0))
+			if (!SearchSysCacheExists1(AUTHOID, ObjectIdGetDatum(objectId)))
 				ereport(ERROR,
 						(errcode(ERRCODE_UNDEFINED_OBJECT),
 						 errmsg("role %u was concurrently dropped",
diff --git a/src/backend/catalog/pg_type.c b/src/backend/catalog/pg_type.c
index 48125e8..dac86b0 100644
--- a/src/backend/catalog/pg_type.c
+++ b/src/backend/catalog/pg_type.c
@@ -370,10 +370,9 @@ TypeCreate(Oid newTypeOid,
 	 */
 	pg_type_desc = heap_open(TypeRelationId, RowExclusiveLock);
 
-	tup = SearchSysCacheCopy(TYPENAMENSP,
-							 CStringGetDatum(typeName),
-							 ObjectIdGetDatum(typeNamespace),
-							 0, 0);
+	tup = SearchSysCacheCopy2(TYPENAMENSP,
+							  CStringGetDatum(typeName),
+							  ObjectIdGetDatum(typeNamespace));
 	if (HeapTupleIsValid(tup))
 	{
 		/*
@@ -647,9 +646,7 @@ RenameTypeInternal(Oid typeOid, const char *newTypeName, Oid typeNamespace)
 
 	pg_type_desc = heap_open(TypeRelationId, RowExclusiveLock);
 
-	tuple = SearchSysCacheCopy(TYPEOID,
-							   ObjectIdGetDatum(typeOid),
-							   0, 0, 0);
+	tuple = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(typeOid));
 	if (!HeapTupleIsValid(tuple))
 		elog(ERROR, "cache lookup failed for type %u", typeOid);
 	typ = (Form_pg_type) GETSTRUCT(tuple);
@@ -660,10 +657,9 @@ RenameTypeInternal(Oid typeOid, const char *newTypeName, Oid typeNamespace)
 	arrayOid = typ->typarray;
 
 	/* Just to give a more friendly error than unique-index violation */
-	if (SearchSysCacheExists(TYPENAMENSP,
-							 CStringGetDatum(newTypeName),
-							 ObjectIdGetDatum(typeNamespace),
-							 0, 0))
+	if (SearchSysCacheExists2(TYPENAMENSP,
+							  CStringGetDatum(newTypeName),
+							  ObjectIdGetDatum(typeNamespace)))
 		ereport(ERROR,
 				(errcode(ERRCODE_DUPLICATE_OBJECT),
 				 errmsg("type \"%s\" already exists", newTypeName)));
@@ -720,10 +716,9 @@ makeArrayTypeName(const char *typeName, Oid typeNamespace)
 			memcpy(arr + i, typeName, NAMEDATALEN - i);
 			truncate_identifier(arr, NAMEDATALEN, false);
 		}
-		if (!SearchSysCacheExists(TYPENAMENSP,
-								  CStringGetDatum(arr),
-								  ObjectIdGetDatum(typeNamespace),
-								  0, 0))
+		if (!SearchSysCacheExists2(TYPENAMENSP,
+								   CStringGetDatum(arr),
+								   ObjectIdGetDatum(typeNamespace)))
 			break;
 	}
 
diff --git a/src/backend/catalog/toasting.c b/src/backend/catalog/toasting.c
index a516099..ecc0a95 100644
--- a/src/backend/catalog/toasting.c
+++ b/src/backend/catalog/toasting.c
@@ -276,9 +276,7 @@ create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid, Datum reloptio
 	 */
 	class_rel = heap_open(RelationRelationId, RowExclusiveLock);
 
-	reltup = SearchSysCacheCopy(RELOID,
-								ObjectIdGetDatum(relOid),
-								0, 0, 0);
+	reltup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relOid));
 	if (!HeapTupleIsValid(reltup))
 		elog(ERROR, "cache lookup failed for relation %u", relOid);
 
diff --git a/src/backend/commands/aggregatecmds.c b/src/backend/commands/aggregatecmds.c
index 29483b7..4964fb3 100644
--- a/src/backend/commands/aggregatecmds.c
+++ b/src/backend/commands/aggregatecmds.c
@@ -236,9 +236,7 @@ RemoveAggregate(RemoveFuncStmt *stmt)
 	/*
 	 * Find the function tuple, do permissions and validity checks
 	 */
-	tup = SearchSysCache(PROCOID,
-						 ObjectIdGetDatum(procOid),
-						 0, 0, 0);
+	tup = SearchSysCache1(PROCOID, ObjectIdGetDatum(procOid));
 	if (!HeapTupleIsValid(tup)) /* should not happen */
 		elog(ERROR, "cache lookup failed for function %u", procOid);
 
@@ -277,9 +275,7 @@ RenameAggregate(List *name, List *args, const char *newname)
 	/* Look up function and make sure it's an aggregate */
 	procOid = LookupAggNameTypeNames(name, args, false);
 
-	tup = SearchSysCacheCopy(PROCOID,
-							 ObjectIdGetDatum(procOid),
-							 0, 0, 0);
+	tup = SearchSysCacheCopy1(PROCOID, ObjectIdGetDatum(procOid));
 	if (!HeapTupleIsValid(tup)) /* should not happen */
 		elog(ERROR, "cache lookup failed for function %u", procOid);
 	procForm = (Form_pg_proc) GETSTRUCT(tup);
@@ -287,11 +283,10 @@ RenameAggregate(List *name, List *args, const char *newname)
 	namespaceOid = procForm->pronamespace;
 
 	/* make sure the new name doesn't exist */
-	if (SearchSysCacheExists(PROCNAMEARGSNSP,
-							 CStringGetDatum(newname),
-							 PointerGetDatum(&procForm->proargtypes),
-							 ObjectIdGetDatum(namespaceOid),
-							 0))
+	if (SearchSysCacheExists3(PROCNAMEARGSNSP,
+							  CStringGetDatum(newname),
+							  PointerGetDatum(&procForm->proargtypes),
+							  ObjectIdGetDatum(namespaceOid)))
 		ereport(ERROR,
 				(errcode(ERRCODE_DUPLICATE_FUNCTION),
 				 errmsg("function %s already exists in schema \"%s\"",
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c
index 411ac4c..3e07620 100644
--- a/src/backend/commands/analyze.c
+++ b/src/backend/commands/analyze.c
@@ -827,9 +827,7 @@ examine_attribute(Relation onerel, int attnum)
 	stats = (VacAttrStats *) palloc0(sizeof(VacAttrStats));
 	stats->attr = (Form_pg_attribute) palloc(ATTRIBUTE_FIXED_PART_SIZE);
 	memcpy(stats->attr, attr, ATTRIBUTE_FIXED_PART_SIZE);
-	typtuple = SearchSysCache(TYPEOID,
-							  ObjectIdGetDatum(attr->atttypid),
-							  0, 0, 0);
+	typtuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(attr->atttypid));
 	if (!HeapTupleIsValid(typtuple))
 		elog(ERROR, "cache lookup failed for type %u", attr->atttypid);
 	stats->attrtype = (Form_pg_type) palloc(sizeof(FormData_pg_type));
@@ -1633,11 +1631,10 @@ update_attstats(Oid relid, bool inh, int natts, VacAttrStats **vacattrstats)
 		}
 
 		/* Is there already a pg_statistic tuple for this attribute? */
-		oldtup = SearchSysCache(STATRELATTINH,
-								ObjectIdGetDatum(relid),
-								Int16GetDatum(stats->attr->attnum),
-								BoolGetDatum(inh),
-								0);
+		oldtup = SearchSysCache3(STATRELATTINH,
+								 ObjectIdGetDatum(relid),
+								 Int16GetDatum(stats->attr->attnum),
+								 BoolGetDatum(inh));
 
 		if (HeapTupleIsValid(oldtup))
 		{
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 75dabec..0ea9b99 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -136,9 +136,8 @@ cluster(ClusterStmt *stmt, bool isTopLevel)
 				Form_pg_index indexForm;
 
 				indexOid = lfirst_oid(index);
-				idxtuple = SearchSysCache(INDEXRELID,
-										  ObjectIdGetDatum(indexOid),
-										  0, 0, 0);
+				idxtuple = SearchSysCache1(INDEXRELID,
+										   ObjectIdGetDatum(indexOid));
 				if (!HeapTupleIsValid(idxtuple))
 					elog(ERROR, "cache lookup failed for index %u", indexOid);
 				indexForm = (Form_pg_index) GETSTRUCT(idxtuple);
@@ -316,9 +315,7 @@ cluster_rel(Oid tableOid, Oid indexOid, bool recheck, bool verbose,
 			/*
 			 * Check that the index still exists
 			 */
-			if (!SearchSysCacheExists(RELOID,
-									  ObjectIdGetDatum(indexOid),
-									  0, 0, 0))
+			if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(indexOid)))
 			{
 				relation_close(OldHeap, AccessExclusiveLock);
 				return;
@@ -327,9 +324,7 @@ cluster_rel(Oid tableOid, Oid indexOid, bool recheck, bool verbose,
 			/*
 			 * Check that the index is still the one with indisclustered set.
 			 */
-			tuple = SearchSysCache(INDEXRELID,
-								   ObjectIdGetDatum(indexOid),
-								   0, 0, 0);
+			tuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexOid));
 			if (!HeapTupleIsValid(tuple))	/* probably can't happen */
 			{
 				relation_close(OldHeap, AccessExclusiveLock);
@@ -519,9 +514,7 @@ mark_index_clustered(Relation rel, Oid indexOid)
 	 */
 	if (OidIsValid(indexOid))
 	{
-		indexTuple = SearchSysCache(INDEXRELID,
-									ObjectIdGetDatum(indexOid),
-									0, 0, 0);
+		indexTuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexOid));
 		if (!HeapTupleIsValid(indexTuple))
 			elog(ERROR, "cache lookup failed for index %u", indexOid);
 		indexForm = (Form_pg_index) GETSTRUCT(indexTuple);
@@ -544,9 +537,8 @@ mark_index_clustered(Relation rel, Oid indexOid)
 	{
 		Oid			thisIndexOid = lfirst_oid(index);
 
-		indexTuple = SearchSysCacheCopy(INDEXRELID,
-										ObjectIdGetDatum(thisIndexOid),
-										0, 0, 0);
+		indexTuple = SearchSysCacheCopy1(INDEXRELID,
+										 ObjectIdGetDatum(thisIndexOid));
 		if (!HeapTupleIsValid(indexTuple))
 			elog(ERROR, "cache lookup failed for index %u", thisIndexOid);
 		indexForm = (Form_pg_index) GETSTRUCT(indexTuple);
@@ -656,9 +648,7 @@ make_new_heap(Oid OIDOldHeap, Oid NewTableSpace)
 	/*
 	 * But we do want to use reloptions of the old heap for new heap.
 	 */
-	tuple = SearchSysCache(RELOID,
-						   ObjectIdGetDatum(OIDOldHeap),
-						   0, 0, 0);
+	tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(OIDOldHeap));
 	if (!HeapTupleIsValid(tuple))
 		elog(ERROR, "cache lookup failed for relation %u", OIDOldHeap);
 	reloptions = SysCacheGetAttr(RELOID, tuple, Anum_pg_class_reloptions,
@@ -722,9 +712,7 @@ make_new_heap(Oid OIDOldHeap, Oid NewTableSpace)
 	if (OidIsValid(toastid))
 	{
 		/* keep the existing toast table's reloptions, if any */
-		tuple = SearchSysCache(RELOID,
-							   ObjectIdGetDatum(toastid),
-							   0, 0, 0);
+		tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(toastid));
 		if (!HeapTupleIsValid(tuple))
 			elog(ERROR, "cache lookup failed for relation %u", toastid);
 		reloptions = SysCacheGetAttr(RELOID, tuple, Anum_pg_class_reloptions,
@@ -1077,16 +1065,12 @@ swap_relation_files(Oid r1, Oid r2, bool target_is_pg_class,
 	/* We need writable copies of both pg_class tuples. */
 	relRelation = heap_open(RelationRelationId, RowExclusiveLock);
 
-	reltup1 = SearchSysCacheCopy(RELOID,
-								 ObjectIdGetDatum(r1),
-								 0, 0, 0);
+	reltup1 = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(r1));
 	if (!HeapTupleIsValid(reltup1))
 		elog(ERROR, "cache lookup failed for relation %u", r1);
 	relform1 = (Form_pg_class) GETSTRUCT(reltup1);
 
-	reltup2 = SearchSysCacheCopy(RELOID,
-								 ObjectIdGetDatum(r2),
-								 0, 0, 0);
+	reltup2 = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(r2));
 	if (!HeapTupleIsValid(reltup2))
 		elog(ERROR, "cache lookup failed for relation %u", r2);
 	relform2 = (Form_pg_class) GETSTRUCT(reltup2);
diff --git a/src/backend/commands/comment.c b/src/backend/commands/comment.c
index 6bcaebb..be9ff3b 100644
--- a/src/backend/commands/comment.c
+++ b/src/backend/commands/comment.c
@@ -800,9 +800,7 @@ CommentNamespace(List *qualname, char *comment)
 				 errmsg("schema name cannot be qualified")));
 	namespace = strVal(linitial(qualname));
 
-	oid = GetSysCacheOid(NAMESPACENAME,
-						 CStringGetDatum(namespace),
-						 0, 0, 0);
+	oid = GetSysCacheOid1(NAMESPACENAME, CStringGetDatum(namespace));
 	if (!OidIsValid(oid))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_SCHEMA),
@@ -904,10 +902,9 @@ CommentRule(List *qualname, char *comment)
 		reloid = RelationGetRelid(relation);
 
 		/* Find the rule's pg_rewrite tuple, get its OID */
-		tuple = SearchSysCache(RULERELNAME,
-							   ObjectIdGetDatum(reloid),
-							   PointerGetDatum(rulename),
-							   0, 0);
+		tuple = SearchSysCache2(RULERELNAME,
+						 		ObjectIdGetDatum(reloid),
+								PointerGetDatum(rulename));
 		if (!HeapTupleIsValid(tuple))
 			ereport(ERROR,
 					(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -1217,9 +1214,7 @@ CommentLanguage(List *qualname, char *comment)
 				 errmsg("language name cannot be qualified")));
 	language = strVal(linitial(qualname));
 
-	oid = GetSysCacheOid(LANGNAME,
-						 CStringGetDatum(language),
-						 0, 0, 0);
+	oid = GetSysCacheOid1(LANGNAME, CStringGetDatum(language));
 	if (!OidIsValid(oid))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_SCHEMA),
@@ -1260,9 +1255,7 @@ CommentOpClass(List *qualname, List *arguments, char *comment)
 	/*
 	 * Get the access method's OID.
 	 */
-	amID = GetSysCacheOid(AMNAME,
-						  CStringGetDatum(amname),
-						  0, 0, 0);
+	amID = GetSysCacheOid1(AMNAME, CStringGetDatum(amname));
 	if (!OidIsValid(amID))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -1282,11 +1275,10 @@ CommentOpClass(List *qualname, List *arguments, char *comment)
 		Oid			namespaceId;
 
 		namespaceId = LookupExplicitNamespace(schemaname);
-		tuple = SearchSysCache(CLAAMNAMENSP,
-							   ObjectIdGetDatum(amID),
-							   PointerGetDatum(opcname),
-							   ObjectIdGetDatum(namespaceId),
-							   0);
+		tuple = SearchSysCache3(CLAAMNAMENSP,
+								ObjectIdGetDatum(amID),
+								PointerGetDatum(opcname),
+								ObjectIdGetDatum(namespaceId));
 	}
 	else
 	{
@@ -1297,9 +1289,7 @@ CommentOpClass(List *qualname, List *arguments, char *comment)
 					(errcode(ERRCODE_UNDEFINED_OBJECT),
 					 errmsg("operator class \"%s\" does not exist for access method \"%s\"",
 							opcname, amname)));
-		tuple = SearchSysCache(CLAOID,
-							   ObjectIdGetDatum(opcID),
-							   0, 0, 0);
+		tuple = SearchSysCache1(CLAOID, ObjectIdGetDatum(opcID));
 	}
 
 	if (!HeapTupleIsValid(tuple))
@@ -1346,9 +1336,7 @@ CommentOpFamily(List *qualname, List *arguments, char *comment)
 	/*
 	 * Get the access method's OID.
 	 */
-	amID = GetSysCacheOid(AMNAME,
-						  CStringGetDatum(amname),
-						  0, 0, 0);
+	amID = GetSysCacheOid1(AMNAME, CStringGetDatum(amname));
 	if (!OidIsValid(amID))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -1368,11 +1356,10 @@ CommentOpFamily(List *qualname, List *arguments, char *comment)
 		Oid			namespaceId;
 
 		namespaceId = LookupExplicitNamespace(schemaname);
-		tuple = SearchSysCache(OPFAMILYAMNAMENSP,
-							   ObjectIdGetDatum(amID),
-							   PointerGetDatum(opfname),
-							   ObjectIdGetDatum(namespaceId),
-							   0);
+		tuple = SearchSysCache3(OPFAMILYAMNAMENSP,
+								ObjectIdGetDatum(amID),
+						 		PointerGetDatum(opfname),
+								ObjectIdGetDatum(namespaceId));
 	}
 	else
 	{
@@ -1383,9 +1370,7 @@ CommentOpFamily(List *qualname, List *arguments, char *comment)
 					(errcode(ERRCODE_UNDEFINED_OBJECT),
 					 errmsg("operator family \"%s\" does not exist for access method \"%s\"",
 							opfname, amname)));
-		tuple = SearchSysCache(OPFAMILYOID,
-							   ObjectIdGetDatum(opfID),
-							   0, 0, 0);
+		tuple = SearchSysCache1(OPFAMILYOID, ObjectIdGetDatum(opfID));
 	}
 
 	if (!HeapTupleIsValid(tuple))
@@ -1500,10 +1485,9 @@ CommentCast(List *qualname, List *arguments, char *comment)
 	sourcetypeid = typenameTypeId(NULL, sourcetype, NULL);
 	targettypeid = typenameTypeId(NULL, targettype, NULL);
 
-	tuple = SearchSysCache(CASTSOURCETARGET,
-						   ObjectIdGetDatum(sourcetypeid),
-						   ObjectIdGetDatum(targettypeid),
-						   0, 0);
+	tuple = SearchSysCache2(CASTSOURCETARGET,
+							ObjectIdGetDatum(sourcetypeid),
+							ObjectIdGetDatum(targettypeid));
 	if (!HeapTupleIsValid(tuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
diff --git a/src/backend/commands/conversioncmds.c b/src/backend/commands/conversioncmds.c
index 1a79854..57ddab0 100644
--- a/src/backend/commands/conversioncmds.c
+++ b/src/backend/commands/conversioncmds.c
@@ -162,9 +162,7 @@ DropConversionsCommand(DropStmt *drop)
 			continue;
 		}
 
-		tuple = SearchSysCache(CONVOID,
-							   ObjectIdGetDatum(conversionOid),
-							   0, 0, 0);
+		tuple = SearchSysCache1(CONVOID, ObjectIdGetDatum(conversionOid));
 		if (!HeapTupleIsValid(tuple))
 			elog(ERROR, "cache lookup failed for conversion %u",
 				 conversionOid);
@@ -211,19 +209,16 @@ RenameConversion(List *name, const char *newname)
 				 errmsg("conversion \"%s\" does not exist",
 						NameListToString(name))));
 
-	tup = SearchSysCacheCopy(CONVOID,
-							 ObjectIdGetDatum(conversionOid),
-							 0, 0, 0);
+	tup = SearchSysCacheCopy1(CONVOID, ObjectIdGetDatum(conversionOid));
 	if (!HeapTupleIsValid(tup)) /* should not happen */
 		elog(ERROR, "cache lookup failed for conversion %u", conversionOid);
 
 	namespaceOid = ((Form_pg_conversion) GETSTRUCT(tup))->connamespace;
 
 	/* make sure the new name doesn't exist */
-	if (SearchSysCacheExists(CONNAMENSP,
-							 CStringGetDatum(newname),
-							 ObjectIdGetDatum(namespaceOid),
-							 0, 0))
+	if (SearchSysCacheExists2(CONNAMENSP,
+							  CStringGetDatum(newname),
+							  ObjectIdGetDatum(namespaceOid)))
 		ereport(ERROR,
 				(errcode(ERRCODE_DUPLICATE_OBJECT),
 				 errmsg("conversion \"%s\" already exists in schema \"%s\"",
@@ -301,9 +296,7 @@ AlterConversionOwner_internal(Relation rel, Oid conversionOid, Oid newOwnerId)
 
 	Assert(RelationGetRelid(rel) == ConversionRelationId);
 
-	tup = SearchSysCacheCopy(CONVOID,
-							 ObjectIdGetDatum(conversionOid),
-							 0, 0, 0);
+	tup = SearchSysCacheCopy1(CONVOID, ObjectIdGetDatum(conversionOid));
 	if (!HeapTupleIsValid(tup)) /* should not happen */
 		elog(ERROR, "cache lookup failed for conversion %u", conversionOid);
 
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index 36c02ff..34dbcb4 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -809,9 +809,7 @@ dropdb(const char *dbname, bool missing_ok)
 	/*
 	 * Remove the database's tuple from pg_database.
 	 */
-	tup = SearchSysCache(DATABASEOID,
-						 ObjectIdGetDatum(db_id),
-						 0, 0, 0);
+	tup = SearchSysCache1(DATABASEOID, ObjectIdGetDatum(db_id));
 	if (!HeapTupleIsValid(tup))
 		elog(ERROR, "cache lookup failed for database %u", db_id);
 
@@ -951,9 +949,7 @@ RenameDatabase(const char *oldname, const char *newname)
 				 errdetail_busy_db(notherbackends, npreparedxacts)));
 
 	/* rename */
-	newtup = SearchSysCacheCopy(DATABASEOID,
-								ObjectIdGetDatum(db_id),
-								0, 0, 0);
+	newtup = SearchSysCacheCopy1(DATABASEOID, ObjectIdGetDatum(db_id));
 	if (!HeapTupleIsValid(newtup))
 		elog(ERROR, "cache lookup failed for database %u", db_id);
 	namestrcpy(&(((Form_pg_database) GETSTRUCT(newtup))->datname), newname);
@@ -1611,9 +1607,7 @@ get_db_info(const char *name, LOCKMODE lockmode,
 		 * the same name, we win; else, drop the lock and loop back to try
 		 * again.
 		 */
-		tuple = SearchSysCache(DATABASEOID,
-							   ObjectIdGetDatum(dbOid),
-							   0, 0, 0);
+		tuple = SearchSysCache1(DATABASEOID, ObjectIdGetDatum(dbOid));
 		if (HeapTupleIsValid(tuple))
 		{
 			Form_pg_database dbform = (Form_pg_database) GETSTRUCT(tuple);
@@ -1677,9 +1671,7 @@ have_createdb_privilege(void)
 	if (superuser())
 		return true;
 
-	utup = SearchSysCache(AUTHOID,
-						  ObjectIdGetDatum(GetUserId()),
-						  0, 0, 0);
+	utup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(GetUserId()));
 	if (HeapTupleIsValid(utup))
 	{
 		result = ((Form_pg_authid) GETSTRUCT(utup))->rolcreatedb;
@@ -1875,9 +1867,7 @@ get_database_name(Oid dbid)
 	HeapTuple	dbtuple;
 	char	   *result;
 
-	dbtuple = SearchSysCache(DATABASEOID,
-							 ObjectIdGetDatum(dbid),
-							 0, 0, 0);
+	dbtuple = SearchSysCache1(DATABASEOID, ObjectIdGetDatum(dbid));
 	if (HeapTupleIsValid(dbtuple))
 	{
 		result = pstrdup(NameStr(((Form_pg_database) GETSTRUCT(dbtuple))->datname));
diff --git a/src/backend/commands/foreigncmds.c b/src/backend/commands/foreigncmds.c
index 523b190..14356a2 100644
--- a/src/backend/commands/foreigncmds.c
+++ b/src/backend/commands/foreigncmds.c
@@ -220,9 +220,7 @@ AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId)
 
 	rel = heap_open(ForeignDataWrapperRelationId, RowExclusiveLock);
 
-	tup = SearchSysCacheCopy(FOREIGNDATAWRAPPERNAME,
-							 CStringGetDatum(name),
-							 0, 0, 0);
+	tup = SearchSysCacheCopy1(FOREIGNDATAWRAPPERNAME, CStringGetDatum(name));
 
 	if (!HeapTupleIsValid(tup))
 		ereport(ERROR,
@@ -264,9 +262,7 @@ AlterForeignServerOwner(const char *name, Oid newOwnerId)
 
 	rel = heap_open(ForeignServerRelationId, RowExclusiveLock);
 
-	tup = SearchSysCacheCopy(FOREIGNSERVERNAME,
-							 CStringGetDatum(name),
-							 0, 0, 0);
+	tup = SearchSysCacheCopy1(FOREIGNSERVERNAME, CStringGetDatum(name));
 
 	if (!HeapTupleIsValid(tup))
 		ereport(ERROR,
@@ -447,9 +443,8 @@ AlterForeignDataWrapper(AlterFdwStmt *stmt)
 					stmt->fdwname),
 			 errhint("Must be superuser to alter a foreign-data wrapper.")));
 
-	tp = SearchSysCacheCopy(FOREIGNDATAWRAPPERNAME,
-							CStringGetDatum(stmt->fdwname),
-							0, 0, 0);
+	tp = SearchSysCacheCopy1(FOREIGNDATAWRAPPERNAME,
+							 CStringGetDatum(stmt->fdwname));
 
 	if (!HeapTupleIsValid(tp))
 		ereport(ERROR,
@@ -587,9 +582,7 @@ RemoveForeignDataWrapperById(Oid fdwId)
 
 	rel = heap_open(ForeignDataWrapperRelationId, RowExclusiveLock);
 
-	tp = SearchSysCache(FOREIGNDATAWRAPPEROID,
-						ObjectIdGetDatum(fdwId),
-						0, 0, 0);
+	tp = SearchSysCache1(FOREIGNDATAWRAPPEROID, ObjectIdGetDatum(fdwId));
 
 	if (!HeapTupleIsValid(tp))
 		elog(ERROR, "cache lookup failed for foreign-data wrapper %u", fdwId);
@@ -721,9 +714,8 @@ AlterForeignServer(AlterForeignServerStmt *stmt)
 	Oid			srvId;
 	Form_pg_foreign_server srvForm;
 
-	tp = SearchSysCacheCopy(FOREIGNSERVERNAME,
-							CStringGetDatum(stmt->servername),
-							0, 0, 0);
+	tp = SearchSysCacheCopy1(FOREIGNSERVERNAME,
+							 CStringGetDatum(stmt->servername));
 
 	if (!HeapTupleIsValid(tp))
 		ereport(ERROR,
@@ -851,9 +843,7 @@ RemoveForeignServerById(Oid srvId)
 
 	rel = heap_open(ForeignServerRelationId, RowExclusiveLock);
 
-	tp = SearchSysCache(FOREIGNSERVEROID,
-						ObjectIdGetDatum(srvId),
-						0, 0, 0);
+	tp = SearchSysCache1(FOREIGNSERVEROID, ObjectIdGetDatum(srvId));
 
 	if (!HeapTupleIsValid(tp))
 		elog(ERROR, "cache lookup failed for foreign server %u", srvId);
@@ -921,10 +911,9 @@ CreateUserMapping(CreateUserMappingStmt *stmt)
 	/*
 	 * Check that the user mapping is unique within server.
 	 */
-	umId = GetSysCacheOid(USERMAPPINGUSERSERVER,
-						  ObjectIdGetDatum(useId),
-						  ObjectIdGetDatum(srv->serverid),
-						  0, 0);
+	umId = GetSysCacheOid2(USERMAPPINGUSERSERVER,
+						   ObjectIdGetDatum(useId),
+						   ObjectIdGetDatum(srv->serverid));
 	if (OidIsValid(umId))
 		ereport(ERROR,
 				(errcode(ERRCODE_DUPLICATE_OBJECT),
@@ -1000,10 +989,9 @@ AlterUserMapping(AlterUserMappingStmt *stmt)
 	useId = GetUserOidFromMapping(stmt->username, false);
 	srv = GetForeignServerByName(stmt->servername, false);
 
-	umId = GetSysCacheOid(USERMAPPINGUSERSERVER,
-						  ObjectIdGetDatum(useId),
-						  ObjectIdGetDatum(srv->serverid),
-						  0, 0);
+	umId = GetSysCacheOid2(USERMAPPINGUSERSERVER,
+						   ObjectIdGetDatum(useId),
+						   ObjectIdGetDatum(srv->serverid));
 	if (!OidIsValid(umId))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -1012,9 +1000,7 @@ AlterUserMapping(AlterUserMappingStmt *stmt)
 
 	user_mapping_ddl_aclcheck(useId, srv->serverid, stmt->servername);
 
-	tp = SearchSysCacheCopy(USERMAPPINGOID,
-							ObjectIdGetDatum(umId),
-							0, 0, 0);
+	tp = SearchSysCacheCopy1(USERMAPPINGOID, ObjectIdGetDatum(umId));
 
 	if (!HeapTupleIsValid(tp))
 		elog(ERROR, "cache lookup failed for user mapping %u", umId);
@@ -1107,10 +1093,9 @@ RemoveUserMapping(DropUserMappingStmt *stmt)
 		return;
 	}
 
-	umId = GetSysCacheOid(USERMAPPINGUSERSERVER,
-						  ObjectIdGetDatum(useId),
-						  ObjectIdGetDatum(srv->serverid),
-						  0, 0);
+	umId = GetSysCacheOid2(USERMAPPINGUSERSERVER,
+						   ObjectIdGetDatum(useId),
+						   ObjectIdGetDatum(srv->serverid));
 
 	if (!OidIsValid(umId))
 	{
@@ -1151,9 +1136,7 @@ RemoveUserMappingById(Oid umId)
 
 	rel = heap_open(UserMappingRelationId, RowExclusiveLock);
 
-	tp = SearchSysCache(USERMAPPINGOID,
-						ObjectIdGetDatum(umId),
-						0, 0, 0);
+	tp = SearchSysCache1(USERMAPPINGOID, ObjectIdGetDatum(umId));
 
 	if (!HeapTupleIsValid(tp))
 		elog(ERROR, "cache lookup failed for user mapping %u", umId);
diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c
index 2eb2eaa..d5cfeed 100644
--- a/src/backend/commands/functioncmds.c
+++ b/src/backend/commands/functioncmds.c
@@ -829,9 +829,7 @@ CreateFunction(CreateFunctionStmt *stmt, const char *queryString)
 	languageName = case_translate_language_name(language);
 
 	/* Look up the language and validate permissions */
-	languageTuple = SearchSysCache(LANGNAME,
-								   PointerGetDatum(languageName),
-								   0, 0, 0);
+	languageTuple = SearchSysCache1(LANGNAME, PointerGetDatum(languageName));
 	if (!HeapTupleIsValid(languageTuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -990,9 +988,7 @@ RemoveFunction(RemoveFuncStmt *stmt)
 		return;
 	}
 
-	tup = SearchSysCache(PROCOID,
-						 ObjectIdGetDatum(funcOid),
-						 0, 0, 0);
+	tup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcOid));
 	if (!HeapTupleIsValid(tup)) /* should not happen */
 		elog(ERROR, "cache lookup failed for function %u", funcOid);
 
@@ -1049,9 +1045,7 @@ RemoveFunctionById(Oid funcOid)
 	 */
 	relation = heap_open(ProcedureRelationId, RowExclusiveLock);
 
-	tup = SearchSysCache(PROCOID,
-						 ObjectIdGetDatum(funcOid),
-						 0, 0, 0);
+	tup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcOid));
 	if (!HeapTupleIsValid(tup)) /* should not happen */
 		elog(ERROR, "cache lookup failed for function %u", funcOid);
 
@@ -1070,9 +1064,7 @@ RemoveFunctionById(Oid funcOid)
 	{
 		relation = heap_open(AggregateRelationId, RowExclusiveLock);
 
-		tup = SearchSysCache(AGGFNOID,
-							 ObjectIdGetDatum(funcOid),
-							 0, 0, 0);
+		tup = SearchSysCache1(AGGFNOID, ObjectIdGetDatum(funcOid));
 		if (!HeapTupleIsValid(tup))		/* should not happen */
 			elog(ERROR, "cache lookup failed for pg_aggregate tuple for function %u", funcOid);
 
@@ -1102,9 +1094,7 @@ RenameFunction(List *name, List *argtypes, const char *newname)
 
 	procOid = LookupFuncNameTypeNames(name, argtypes, false);
 
-	tup = SearchSysCacheCopy(PROCOID,
-							 ObjectIdGetDatum(procOid),
-							 0, 0, 0);
+	tup = SearchSysCacheCopy1(PROCOID, ObjectIdGetDatum(procOid));
 	if (!HeapTupleIsValid(tup)) /* should not happen */
 		elog(ERROR, "cache lookup failed for function %u", procOid);
 	procForm = (Form_pg_proc) GETSTRUCT(tup);
@@ -1119,11 +1109,10 @@ RenameFunction(List *name, List *argtypes, const char *newname)
 	namespaceOid = procForm->pronamespace;
 
 	/* make sure the new name doesn't exist */
-	if (SearchSysCacheExists(PROCNAMEARGSNSP,
-							 CStringGetDatum(newname),
-							 PointerGetDatum(&procForm->proargtypes),
-							 ObjectIdGetDatum(namespaceOid),
-							 0))
+	if (SearchSysCacheExists3(PROCNAMEARGSNSP,
+							  CStringGetDatum(newname),
+							  PointerGetDatum(&procForm->proargtypes),
+							  ObjectIdGetDatum(namespaceOid)))
 	{
 		ereport(ERROR,
 				(errcode(ERRCODE_DUPLICATE_FUNCTION),
@@ -1169,9 +1158,7 @@ AlterFunctionOwner(List *name, List *argtypes, Oid newOwnerId)
 
 	procOid = LookupFuncNameTypeNames(name, argtypes, false);
 
-	tup = SearchSysCache(PROCOID,
-						 ObjectIdGetDatum(procOid),
-						 0, 0, 0);
+	tup = SearchSysCache1(PROCOID, ObjectIdGetDatum(procOid));
 	if (!HeapTupleIsValid(tup)) /* should not happen */
 		elog(ERROR, "cache lookup failed for function %u", procOid);
 
@@ -1198,9 +1185,7 @@ AlterFunctionOwner_oid(Oid procOid, Oid newOwnerId)
 
 	rel = heap_open(ProcedureRelationId, RowExclusiveLock);
 
-	tup = SearchSysCache(PROCOID,
-						 ObjectIdGetDatum(procOid),
-						 0, 0, 0);
+	tup = SearchSysCache1(PROCOID, ObjectIdGetDatum(procOid));
 	if (!HeapTupleIsValid(tup)) /* should not happen */
 		elog(ERROR, "cache lookup failed for function %u", procOid);
 	AlterFunctionOwner_internal(rel, tup, newOwnerId);
@@ -1317,9 +1302,7 @@ AlterFunction(AlterFunctionStmt *stmt)
 									  stmt->func->funcargs,
 									  false);
 
-	tup = SearchSysCacheCopy(PROCOID,
-							 ObjectIdGetDatum(funcOid),
-							 0, 0, 0);
+	tup = SearchSysCacheCopy1(PROCOID, ObjectIdGetDatum(funcOid));
 	if (!HeapTupleIsValid(tup)) /* should not happen */
 		elog(ERROR, "cache lookup failed for function %u", funcOid);
 
@@ -1436,9 +1419,7 @@ SetFunctionReturnType(Oid funcOid, Oid newRetType)
 
 	pg_proc_rel = heap_open(ProcedureRelationId, RowExclusiveLock);
 
-	tup = SearchSysCacheCopy(PROCOID,
-							 ObjectIdGetDatum(funcOid),
-							 0, 0, 0);
+	tup = SearchSysCacheCopy1(PROCOID, ObjectIdGetDatum(funcOid));
 	if (!HeapTupleIsValid(tup)) /* should not happen */
 		elog(ERROR, "cache lookup failed for function %u", funcOid);
 	procForm = (Form_pg_proc) GETSTRUCT(tup);
@@ -1472,9 +1453,7 @@ SetFunctionArgType(Oid funcOid, int argIndex, Oid newArgType)
 
 	pg_proc_rel = heap_open(ProcedureRelationId, RowExclusiveLock);
 
-	tup = SearchSysCacheCopy(PROCOID,
-							 ObjectIdGetDatum(funcOid),
-							 0, 0, 0);
+	tup = SearchSysCacheCopy1(PROCOID, ObjectIdGetDatum(funcOid));
 	if (!HeapTupleIsValid(tup)) /* should not happen */
 		elog(ERROR, "cache lookup failed for function %u", funcOid);
 	procForm = (Form_pg_proc) GETSTRUCT(tup);
@@ -1560,9 +1539,7 @@ CreateCast(CreateCastStmt *stmt)
 										 stmt->func->funcargs,
 										 false);
 
-		tuple = SearchSysCache(PROCOID,
-							   ObjectIdGetDatum(funcid),
-							   0, 0, 0);
+		tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
 		if (!HeapTupleIsValid(tuple))
 			elog(ERROR, "cache lookup failed for function %u", funcid);
 
@@ -1716,10 +1693,9 @@ CreateCast(CreateCastStmt *stmt)
 	 * the unique index would catch it anyway (so no need to sweat about race
 	 * conditions).
 	 */
-	tuple = SearchSysCache(CASTSOURCETARGET,
-						   ObjectIdGetDatum(sourcetypeid),
-						   ObjectIdGetDatum(targettypeid),
-						   0, 0);
+	tuple = SearchSysCache2(CASTSOURCETARGET,
+							ObjectIdGetDatum(sourcetypeid),
+							ObjectIdGetDatum(targettypeid));
 	if (HeapTupleIsValid(tuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_DUPLICATE_OBJECT),
@@ -1790,10 +1766,9 @@ DropCast(DropCastStmt *stmt)
 	sourcetypeid = typenameTypeId(NULL, stmt->sourcetype, NULL);
 	targettypeid = typenameTypeId(NULL, stmt->targettype, NULL);
 
-	tuple = SearchSysCache(CASTSOURCETARGET,
-						   ObjectIdGetDatum(sourcetypeid),
-						   ObjectIdGetDatum(targettypeid),
-						   0, 0);
+	tuple = SearchSysCache2(CASTSOURCETARGET,
+							ObjectIdGetDatum(sourcetypeid),
+							ObjectIdGetDatum(targettypeid));
 	if (!HeapTupleIsValid(tuple))
 	{
 		if (!stmt->missing_ok)
@@ -1888,9 +1863,7 @@ AlterFunctionNamespace(List *name, List *argtypes, bool isagg,
 		aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_PROC,
 					   NameListToString(name));
 
-	tup = SearchSysCacheCopy(PROCOID,
-							 ObjectIdGetDatum(procOid),
-							 0, 0, 0);
+	tup = SearchSysCacheCopy1(PROCOID, ObjectIdGetDatum(procOid));
 	if (!HeapTupleIsValid(tup))
 		elog(ERROR, "cache lookup failed for function %u", procOid);
 	proc = (Form_pg_proc) GETSTRUCT(tup);
@@ -1920,11 +1893,10 @@ AlterFunctionNamespace(List *name, List *argtypes, bool isagg,
 				 errmsg("cannot move objects into or out of TOAST schema")));
 
 	/* check for duplicate name (more friendly than unique-index failure) */
-	if (SearchSysCacheExists(PROCNAMEARGSNSP,
-							 CStringGetDatum(NameStr(proc->proname)),
-							 PointerGetDatum(&proc->proargtypes),
-							 ObjectIdGetDatum(nspOid),
-							 0))
+	if (SearchSysCacheExists3(PROCNAMEARGSNSP,
+							  CStringGetDatum(NameStr(proc->proname)),
+							  PointerGetDatum(&proc->proargtypes),
+							  ObjectIdGetDatum(nspOid)))
 		ereport(ERROR,
 				(errcode(ERRCODE_DUPLICATE_FUNCTION),
 				 errmsg("function \"%s\" already exists in schema \"%s\"",
@@ -2011,9 +1983,7 @@ ExecuteDoStmt(DoStmt *stmt)
 	languageName = case_translate_language_name(language);
 
 	/* Look up the language and validate permissions */
-	languageTuple = SearchSysCache(LANGNAME,
-								   PointerGetDatum(languageName),
-								   0, 0, 0);
+	languageTuple = SearchSysCache1(LANGNAME, PointerGetDatum(languageName));
 	if (!HeapTupleIsValid(languageTuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c
index 75f2e2d..aea98b6 100644
--- a/src/backend/commands/indexcmds.c
+++ b/src/backend/commands/indexcmds.c
@@ -273,9 +273,7 @@ DefineIndex(RangeVar *heapRelation,
 	/*
 	 * look up the access method, verify it can handle the requested features
 	 */
-	tuple = SearchSysCache(AMNAME,
-						   PointerGetDatum(accessMethodName),
-						   0, 0, 0);
+	tuple = SearchSysCache1(AMNAME, PointerGetDatum(accessMethodName));
 	if (!HeapTupleIsValid(tuple))
 	{
 		/*
@@ -287,9 +285,7 @@ DefineIndex(RangeVar *heapRelation,
 			ereport(NOTICE,
 					(errmsg("substituting access method \"gist\" for obsolete method \"rtree\"")));
 			accessMethodName = "gist";
-			tuple = SearchSysCache(AMNAME,
-								   PointerGetDatum(accessMethodName),
-								   0, 0, 0);
+			tuple = SearchSysCache1(AMNAME, PointerGetDatum(accessMethodName));
 		}
 
 		if (!HeapTupleIsValid(tuple))
@@ -600,9 +596,8 @@ DefineIndex(RangeVar *heapRelation,
 	 */
 	pg_index = heap_open(IndexRelationId, RowExclusiveLock);
 
-	indexTuple = SearchSysCacheCopy(INDEXRELID,
-									ObjectIdGetDatum(indexRelationId),
-									0, 0, 0);
+	indexTuple = SearchSysCacheCopy1(INDEXRELID,
+									 ObjectIdGetDatum(indexRelationId));
 	if (!HeapTupleIsValid(indexTuple))
 		elog(ERROR, "cache lookup failed for index %u", indexRelationId);
 	indexForm = (Form_pg_index) GETSTRUCT(indexTuple);
@@ -741,9 +736,8 @@ DefineIndex(RangeVar *heapRelation,
 	 */
 	pg_index = heap_open(IndexRelationId, RowExclusiveLock);
 
-	indexTuple = SearchSysCacheCopy(INDEXRELID,
-									ObjectIdGetDatum(indexRelationId),
-									0, 0, 0);
+	indexTuple = SearchSysCacheCopy1(INDEXRELID,
+									 ObjectIdGetDatum(indexRelationId));
 	if (!HeapTupleIsValid(indexTuple))
 		elog(ERROR, "cache lookup failed for index %u", indexRelationId);
 	indexForm = (Form_pg_index) GETSTRUCT(indexTuple);
@@ -985,9 +979,8 @@ ComputeIndexAttrs(IndexInfo *indexInfo,
 				 * so fetch the name of the selected opfamily for use in the
 				 * error message.
 				 */
-				opftuple = SearchSysCache(OPFAMILYOID,
-										  ObjectIdGetDatum(opfamily),
-										  0, 0, 0);
+				opftuple = SearchSysCache1(OPFAMILYOID,
+										   ObjectIdGetDatum(opfamily));
 				if (!HeapTupleIsValid(opftuple))
 					elog(ERROR, "cache lookup failed for opfamily %u",
 						 opfamily);
@@ -1113,11 +1106,10 @@ GetIndexOpClass(List *opclass, Oid attrType,
 		Oid			namespaceId;
 
 		namespaceId = LookupExplicitNamespace(schemaname);
-		tuple = SearchSysCache(CLAAMNAMENSP,
-							   ObjectIdGetDatum(accessMethodId),
-							   PointerGetDatum(opcname),
-							   ObjectIdGetDatum(namespaceId),
-							   0);
+		tuple = SearchSysCache3(CLAAMNAMENSP,
+								ObjectIdGetDatum(accessMethodId),
+								PointerGetDatum(opcname),
+								ObjectIdGetDatum(namespaceId));
 	}
 	else
 	{
@@ -1128,9 +1120,7 @@ GetIndexOpClass(List *opclass, Oid attrType,
 					(errcode(ERRCODE_UNDEFINED_OBJECT),
 					 errmsg("operator class \"%s\" does not exist for access method \"%s\"",
 							opcname, accessMethodName)));
-		tuple = SearchSysCache(CLAOID,
-							   ObjectIdGetDatum(opClassId),
-							   0, 0, 0);
+		tuple = SearchSysCache1(CLAOID, ObjectIdGetDatum(opClassId));
 	}
 
 	if (!HeapTupleIsValid(tuple))
@@ -1542,9 +1532,7 @@ relationHasPrimaryKey(Relation rel)
 		Oid			indexoid = lfirst_oid(indexoidscan);
 		HeapTuple	indexTuple;
 
-		indexTuple = SearchSysCache(INDEXRELID,
-									ObjectIdGetDatum(indexoid),
-									0, 0, 0);
+		indexTuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexoid));
 		if (!HeapTupleIsValid(indexTuple))		/* should not happen */
 			elog(ERROR, "cache lookup failed for index %u", indexoid);
 		result = ((Form_pg_index) GETSTRUCT(indexTuple))->indisprimary;
@@ -1569,9 +1557,7 @@ ReindexIndex(RangeVar *indexRelation)
 	HeapTuple	tuple;
 
 	indOid = RangeVarGetRelid(indexRelation, false);
-	tuple = SearchSysCache(RELOID,
-						   ObjectIdGetDatum(indOid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(indOid));
 	if (!HeapTupleIsValid(tuple))		/* shouldn't happen */
 		elog(ERROR, "cache lookup failed for relation %u", indOid);
 
@@ -1602,9 +1588,7 @@ ReindexTable(RangeVar *relation)
 	HeapTuple	tuple;
 
 	heapOid = RangeVarGetRelid(relation, false);
-	tuple = SearchSysCache(RELOID,
-						   ObjectIdGetDatum(heapOid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(heapOid));
 	if (!HeapTupleIsValid(tuple))		/* shouldn't happen */
 		elog(ERROR, "cache lookup failed for relation %u", heapOid);
 
diff --git a/src/backend/commands/opclasscmds.c b/src/backend/commands/opclasscmds.c
index a26aa47..ac0270f 100644
--- a/src/backend/commands/opclasscmds.c
+++ b/src/backend/commands/opclasscmds.c
@@ -104,11 +104,10 @@ OpFamilyCacheLookup(Oid amID, List *opfamilyname)
 		Oid			namespaceId;
 
 		namespaceId = LookupExplicitNamespace(schemaname);
-		return SearchSysCache(OPFAMILYAMNAMENSP,
-							  ObjectIdGetDatum(amID),
-							  PointerGetDatum(opfname),
-							  ObjectIdGetDatum(namespaceId),
-							  0);
+		return SearchSysCache3(OPFAMILYAMNAMENSP,
+							   ObjectIdGetDatum(amID),
+							   PointerGetDatum(opfname),
+							   ObjectIdGetDatum(namespaceId));
 	}
 	else
 	{
@@ -117,9 +116,7 @@ OpFamilyCacheLookup(Oid amID, List *opfamilyname)
 
 		if (!OidIsValid(opfID))
 			return NULL;
-		return SearchSysCache(OPFAMILYOID,
-							  ObjectIdGetDatum(opfID),
-							  0, 0, 0);
+		return SearchSysCache1(OPFAMILYOID, ObjectIdGetDatum(opfID));
 	}
 }
 
@@ -144,11 +141,10 @@ OpClassCacheLookup(Oid amID, List *opclassname)
 		Oid			namespaceId;
 
 		namespaceId = LookupExplicitNamespace(schemaname);
-		return SearchSysCache(CLAAMNAMENSP,
-							  ObjectIdGetDatum(amID),
-							  PointerGetDatum(opcname),
-							  ObjectIdGetDatum(namespaceId),
-							  0);
+		return SearchSysCache3(CLAAMNAMENSP,
+							   ObjectIdGetDatum(amID),
+							   PointerGetDatum(opcname),
+							   ObjectIdGetDatum(namespaceId));
 	}
 	else
 	{
@@ -157,9 +153,7 @@ OpClassCacheLookup(Oid amID, List *opclassname)
 
 		if (!OidIsValid(opcID))
 			return NULL;
-		return SearchSysCache(CLAOID,
-							  ObjectIdGetDatum(opcID),
-							  0, 0, 0);
+		return SearchSysCache1(CLAOID, ObjectIdGetDatum(opcID));
 	}
 }
 
@@ -187,11 +181,10 @@ CreateOpFamily(char *amname, char *opfname, Oid namespaceoid, Oid amoid)
 	 * Make sure there is no existing opfamily of this name (this is just to
 	 * give a more friendly error message than "duplicate key").
 	 */
-	if (SearchSysCacheExists(OPFAMILYAMNAMENSP,
-							 ObjectIdGetDatum(amoid),
-							 CStringGetDatum(opfname),
-							 ObjectIdGetDatum(namespaceoid),
-							 0))
+	if (SearchSysCacheExists3(OPFAMILYAMNAMENSP,
+							  ObjectIdGetDatum(amoid),
+							  CStringGetDatum(opfname),
+							  ObjectIdGetDatum(namespaceoid)))
 		ereport(ERROR,
 				(errcode(ERRCODE_DUPLICATE_OBJECT),
 				 errmsg("operator family \"%s\" for access method \"%s\" already exists",
@@ -281,9 +274,7 @@ DefineOpClass(CreateOpClassStmt *stmt)
 					   get_namespace_name(namespaceoid));
 
 	/* Get necessary info about access method */
-	tup = SearchSysCache(AMNAME,
-						 CStringGetDatum(stmt->amname),
-						 0, 0, 0);
+	tup = SearchSysCache1(AMNAME, CStringGetDatum(stmt->amname));
 	if (!HeapTupleIsValid(tup))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -362,11 +353,10 @@ DefineOpClass(CreateOpClassStmt *stmt)
 	else
 	{
 		/* Lookup existing family of same name and namespace */
-		tup = SearchSysCache(OPFAMILYAMNAMENSP,
-							 ObjectIdGetDatum(amoid),
-							 PointerGetDatum(opcname),
-							 ObjectIdGetDatum(namespaceoid),
-							 0);
+		tup = SearchSysCache3(OPFAMILYAMNAMENSP,
+							  ObjectIdGetDatum(amoid),
+							  PointerGetDatum(opcname),
+							  ObjectIdGetDatum(namespaceoid));
 		if (HeapTupleIsValid(tup))
 		{
 			opfamilyoid = HeapTupleGetOid(tup);
@@ -521,11 +511,10 @@ DefineOpClass(CreateOpClassStmt *stmt)
 	 * Make sure there is no existing opclass of this name (this is just to
 	 * give a more friendly error message than "duplicate key").
 	 */
-	if (SearchSysCacheExists(CLAAMNAMENSP,
-							 ObjectIdGetDatum(amoid),
-							 CStringGetDatum(opcname),
-							 ObjectIdGetDatum(namespaceoid),
-							 0))
+	if (SearchSysCacheExists3(CLAAMNAMENSP,
+							  ObjectIdGetDatum(amoid),
+							  CStringGetDatum(opcname),
+							  ObjectIdGetDatum(namespaceoid)))
 		ereport(ERROR,
 				(errcode(ERRCODE_DUPLICATE_OBJECT),
 				 errmsg("operator class \"%s\" for access method \"%s\" already exists",
@@ -673,9 +662,7 @@ DefineOpFamily(CreateOpFamilyStmt *stmt)
 					   get_namespace_name(namespaceoid));
 
 	/* Get necessary info about access method */
-	tup = SearchSysCache(AMNAME,
-						 CStringGetDatum(stmt->amname),
-						 0, 0, 0);
+	tup = SearchSysCache1(AMNAME, CStringGetDatum(stmt->amname));
 	if (!HeapTupleIsValid(tup))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -705,11 +692,10 @@ DefineOpFamily(CreateOpFamilyStmt *stmt)
 	 * Make sure there is no existing opfamily of this name (this is just to
 	 * give a more friendly error message than "duplicate key").
 	 */
-	if (SearchSysCacheExists(OPFAMILYAMNAMENSP,
-							 ObjectIdGetDatum(amoid),
-							 CStringGetDatum(opfname),
-							 ObjectIdGetDatum(namespaceoid),
-							 0))
+	if (SearchSysCacheExists3(OPFAMILYAMNAMENSP,
+							  ObjectIdGetDatum(amoid),
+							  CStringGetDatum(opfname),
+							  ObjectIdGetDatum(namespaceoid)))
 		ereport(ERROR,
 				(errcode(ERRCODE_DUPLICATE_OBJECT),
 				 errmsg("operator family \"%s\" for access method \"%s\" already exists",
@@ -776,9 +762,7 @@ AlterOpFamily(AlterOpFamilyStmt *stmt)
 	Form_pg_am	pg_am;
 
 	/* Get necessary info about access method */
-	tup = SearchSysCache(AMNAME,
-						 CStringGetDatum(stmt->amname),
-						 0, 0, 0);
+	tup = SearchSysCache1(AMNAME, CStringGetDatum(stmt->amname));
 	if (!HeapTupleIsValid(tup))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -1065,9 +1049,7 @@ assignOperTypes(OpFamilyMember *member, Oid amoid, Oid typeoid)
 	Form_pg_operator opform;
 
 	/* Fetch the operator definition */
-	optup = SearchSysCache(OPEROID,
-						   ObjectIdGetDatum(member->object),
-						   0, 0, 0);
+	optup = SearchSysCache1(OPEROID, ObjectIdGetDatum(member->object));
 	if (optup == NULL)
 		elog(ERROR, "cache lookup failed for operator %u", member->object);
 	opform = (Form_pg_operator) GETSTRUCT(optup);
@@ -1106,9 +1088,7 @@ assignProcTypes(OpFamilyMember *member, Oid amoid, Oid typeoid)
 	Form_pg_proc procform;
 
 	/* Fetch the procedure definition */
-	proctup = SearchSysCache(PROCOID,
-							 ObjectIdGetDatum(member->object),
-							 0, 0, 0);
+	proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(member->object));
 	if (proctup == NULL)
 		elog(ERROR, "cache lookup failed for function %u", member->object);
 	procform = (Form_pg_proc) GETSTRUCT(proctup);
@@ -1244,11 +1224,11 @@ storeOperators(List *opfamilyname, Oid amoid,
 		 * existing pg_amop entry (just to give a nicer error message)
 		 */
 		if (isAdd &&
-			SearchSysCacheExists(AMOPSTRATEGY,
-								 ObjectIdGetDatum(opfamilyoid),
-								 ObjectIdGetDatum(op->lefttype),
-								 ObjectIdGetDatum(op->righttype),
-								 Int16GetDatum(op->number)))
+			SearchSysCacheExists4(AMOPSTRATEGY,
+								  ObjectIdGetDatum(opfamilyoid),
+								  ObjectIdGetDatum(op->lefttype),
+								  ObjectIdGetDatum(op->righttype),
+								  Int16GetDatum(op->number)))
 			ereport(ERROR,
 					(errcode(ERRCODE_DUPLICATE_OBJECT),
 					 errmsg("operator %d(%s,%s) already exists in operator family \"%s\"",
@@ -1344,11 +1324,11 @@ storeProcedures(List *opfamilyname, Oid amoid,
 		 * existing pg_amproc entry (just to give a nicer error message)
 		 */
 		if (isAdd &&
-			SearchSysCacheExists(AMPROCNUM,
-								 ObjectIdGetDatum(opfamilyoid),
-								 ObjectIdGetDatum(proc->lefttype),
-								 ObjectIdGetDatum(proc->righttype),
-								 Int16GetDatum(proc->number)))
+			SearchSysCacheExists4(AMPROCNUM,
+								  ObjectIdGetDatum(opfamilyoid),
+								  ObjectIdGetDatum(proc->lefttype),
+								  ObjectIdGetDatum(proc->righttype),
+								  Int16GetDatum(proc->number)))
 			ereport(ERROR,
 					(errcode(ERRCODE_DUPLICATE_OBJECT),
 					 errmsg("function %d(%s,%s) already exists in operator family \"%s\"",
@@ -1430,11 +1410,11 @@ dropOperators(List *opfamilyname, Oid amoid, Oid opfamilyoid,
 		Oid			amopid;
 		ObjectAddress object;
 
-		amopid = GetSysCacheOid(AMOPSTRATEGY,
-								ObjectIdGetDatum(opfamilyoid),
-								ObjectIdGetDatum(op->lefttype),
-								ObjectIdGetDatum(op->righttype),
-								Int16GetDatum(op->number));
+		amopid = GetSysCacheOid4(AMOPSTRATEGY,
+								 ObjectIdGetDatum(opfamilyoid),
+								 ObjectIdGetDatum(op->lefttype),
+								 ObjectIdGetDatum(op->righttype),
+								 Int16GetDatum(op->number));
 		if (!OidIsValid(amopid))
 			ereport(ERROR,
 					(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -1470,11 +1450,11 @@ dropProcedures(List *opfamilyname, Oid amoid, Oid opfamilyoid,
 		Oid			amprocid;
 		ObjectAddress object;
 
-		amprocid = GetSysCacheOid(AMPROCNUM,
-								  ObjectIdGetDatum(opfamilyoid),
-								  ObjectIdGetDatum(op->lefttype),
-								  ObjectIdGetDatum(op->righttype),
-								  Int16GetDatum(op->number));
+		amprocid = GetSysCacheOid4(AMPROCNUM,
+								   ObjectIdGetDatum(opfamilyoid),
+								   ObjectIdGetDatum(op->lefttype),
+								   ObjectIdGetDatum(op->righttype),
+								   Int16GetDatum(op->number));
 		if (!OidIsValid(amprocid))
 			ereport(ERROR,
 					(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -1508,9 +1488,7 @@ RemoveOpClass(RemoveOpClassStmt *stmt)
 	/*
 	 * Get the access method's OID.
 	 */
-	amID = GetSysCacheOid(AMNAME,
-						  CStringGetDatum(stmt->amname),
-						  0, 0, 0);
+	amID = GetSysCacheOid1(AMNAME, CStringGetDatum(stmt->amname));
 	if (!OidIsValid(amID))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -1571,9 +1549,7 @@ RemoveOpFamily(RemoveOpFamilyStmt *stmt)
 	/*
 	 * Get the access method's OID.
 	 */
-	amID = GetSysCacheOid(AMNAME,
-						  CStringGetDatum(stmt->amname),
-						  0, 0, 0);
+	amID = GetSysCacheOid1(AMNAME, CStringGetDatum(stmt->amname));
 	if (!OidIsValid(amID))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -1631,9 +1607,7 @@ RemoveOpFamilyById(Oid opfamilyOid)
 
 	rel = heap_open(OperatorFamilyRelationId, RowExclusiveLock);
 
-	tup = SearchSysCache(OPFAMILYOID,
-						 ObjectIdGetDatum(opfamilyOid),
-						 0, 0, 0);
+	tup = SearchSysCache1(OPFAMILYOID, ObjectIdGetDatum(opfamilyOid));
 	if (!HeapTupleIsValid(tup)) /* should not happen */
 		elog(ERROR, "cache lookup failed for opfamily %u", opfamilyOid);
 
@@ -1652,9 +1626,7 @@ RemoveOpClassById(Oid opclassOid)
 
 	rel = heap_open(OperatorClassRelationId, RowExclusiveLock);
 
-	tup = SearchSysCache(CLAOID,
-						 ObjectIdGetDatum(opclassOid),
-						 0, 0, 0);
+	tup = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclassOid));
 	if (!HeapTupleIsValid(tup)) /* should not happen */
 		elog(ERROR, "cache lookup failed for opclass %u", opclassOid);
 
@@ -1739,9 +1711,7 @@ RenameOpClass(List *name, const char *access_method, const char *newname)
 	Relation	rel;
 	AclResult	aclresult;
 
-	amOid = GetSysCacheOid(AMNAME,
-						   CStringGetDatum(access_method),
-						   0, 0, 0);
+	amOid = GetSysCacheOid1(AMNAME, CStringGetDatum(access_method));
 	if (!OidIsValid(amOid))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -1759,11 +1729,10 @@ RenameOpClass(List *name, const char *access_method, const char *newname)
 	{
 		namespaceOid = LookupExplicitNamespace(schemaname);
 
-		tup = SearchSysCacheCopy(CLAAMNAMENSP,
-								 ObjectIdGetDatum(amOid),
-								 PointerGetDatum(opcname),
-								 ObjectIdGetDatum(namespaceOid),
-								 0);
+		tup = SearchSysCacheCopy3(CLAAMNAMENSP,
+								  ObjectIdGetDatum(amOid),
+								  PointerGetDatum(opcname),
+								  ObjectIdGetDatum(namespaceOid));
 		if (!HeapTupleIsValid(tup))
 			ereport(ERROR,
 					(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -1781,9 +1750,7 @@ RenameOpClass(List *name, const char *access_method, const char *newname)
 					 errmsg("operator class \"%s\" does not exist for access method \"%s\"",
 							opcname, access_method)));
 
-		tup = SearchSysCacheCopy(CLAOID,
-								 ObjectIdGetDatum(opcOid),
-								 0, 0, 0);
+		tup = SearchSysCacheCopy1(CLAOID, ObjectIdGetDatum(opcOid));
 		if (!HeapTupleIsValid(tup))		/* should not happen */
 			elog(ERROR, "cache lookup failed for opclass %u", opcOid);
 
@@ -1791,11 +1758,10 @@ RenameOpClass(List *name, const char *access_method, const char *newname)
 	}
 
 	/* make sure the new name doesn't exist */
-	if (SearchSysCacheExists(CLAAMNAMENSP,
-							 ObjectIdGetDatum(amOid),
-							 CStringGetDatum(newname),
-							 ObjectIdGetDatum(namespaceOid),
-							 0))
+	if (SearchSysCacheExists3(CLAAMNAMENSP,
+							  ObjectIdGetDatum(amOid),
+							  CStringGetDatum(newname),
+							  ObjectIdGetDatum(namespaceOid)))
 	{
 		ereport(ERROR,
 				(errcode(ERRCODE_DUPLICATE_OBJECT),
@@ -1839,9 +1805,7 @@ RenameOpFamily(List *name, const char *access_method, const char *newname)
 	Relation	rel;
 	AclResult	aclresult;
 
-	amOid = GetSysCacheOid(AMNAME,
-						   CStringGetDatum(access_method),
-						   0, 0, 0);
+	amOid = GetSysCacheOid1(AMNAME, CStringGetDatum(access_method));
 	if (!OidIsValid(amOid))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -1859,11 +1823,10 @@ RenameOpFamily(List *name, const char *access_method, const char *newname)
 	{
 		namespaceOid = LookupExplicitNamespace(schemaname);
 
-		tup = SearchSysCacheCopy(OPFAMILYAMNAMENSP,
-								 ObjectIdGetDatum(amOid),
-								 PointerGetDatum(opfname),
-								 ObjectIdGetDatum(namespaceOid),
-								 0);
+		tup = SearchSysCacheCopy3(OPFAMILYAMNAMENSP,
+								  ObjectIdGetDatum(amOid),
+								  PointerGetDatum(opfname),
+								  ObjectIdGetDatum(namespaceOid));
 		if (!HeapTupleIsValid(tup))
 			ereport(ERROR,
 					(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -1881,9 +1844,7 @@ RenameOpFamily(List *name, const char *access_method, const char *newname)
 					 errmsg("operator family \"%s\" does not exist for access method \"%s\"",
 							opfname, access_method)));
 
-		tup = SearchSysCacheCopy(OPFAMILYOID,
-								 ObjectIdGetDatum(opfOid),
-								 0, 0, 0);
+		tup = SearchSysCacheCopy1(OPFAMILYOID, ObjectIdGetDatum(opfOid));
 		if (!HeapTupleIsValid(tup))		/* should not happen */
 			elog(ERROR, "cache lookup failed for opfamily %u", opfOid);
 
@@ -1891,11 +1852,10 @@ RenameOpFamily(List *name, const char *access_method, const char *newname)
 	}
 
 	/* make sure the new name doesn't exist */
-	if (SearchSysCacheExists(OPFAMILYAMNAMENSP,
-							 ObjectIdGetDatum(amOid),
-							 CStringGetDatum(newname),
-							 ObjectIdGetDatum(namespaceOid),
-							 0))
+	if (SearchSysCacheExists3(OPFAMILYAMNAMENSP,
+							  ObjectIdGetDatum(amOid),
+							  CStringGetDatum(newname),
+							  ObjectIdGetDatum(namespaceOid)))
 	{
 		ereport(ERROR,
 				(errcode(ERRCODE_DUPLICATE_OBJECT),
@@ -1936,9 +1896,7 @@ AlterOpClassOwner(List *name, const char *access_method, Oid newOwnerId)
 	char	   *opcname;
 	char	   *schemaname;
 
-	amOid = GetSysCacheOid(AMNAME,
-						   CStringGetDatum(access_method),
-						   0, 0, 0);
+	amOid = GetSysCacheOid1(AMNAME, CStringGetDatum(access_method));
 	if (!OidIsValid(amOid))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -1958,11 +1916,10 @@ AlterOpClassOwner(List *name, const char *access_method, Oid newOwnerId)
 
 		namespaceOid = LookupExplicitNamespace(schemaname);
 
-		tup = SearchSysCacheCopy(CLAAMNAMENSP,
-								 ObjectIdGetDatum(amOid),
-								 PointerGetDatum(opcname),
-								 ObjectIdGetDatum(namespaceOid),
-								 0);
+		tup = SearchSysCacheCopy3(CLAAMNAMENSP,
+								  ObjectIdGetDatum(amOid),
+								  PointerGetDatum(opcname),
+								  ObjectIdGetDatum(namespaceOid));
 		if (!HeapTupleIsValid(tup))
 			ereport(ERROR,
 					(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -1980,9 +1937,7 @@ AlterOpClassOwner(List *name, const char *access_method, Oid newOwnerId)
 					 errmsg("operator class \"%s\" does not exist for access method \"%s\"",
 							opcname, access_method)));
 
-		tup = SearchSysCacheCopy(CLAOID,
-								 ObjectIdGetDatum(opcOid),
-								 0, 0, 0);
+		tup = SearchSysCacheCopy1(CLAOID, ObjectIdGetDatum(opcOid));
 		if (!HeapTupleIsValid(tup))		/* should not happen */
 			elog(ERROR, "cache lookup failed for opclass %u", opcOid);
 	}
@@ -2063,9 +2018,7 @@ AlterOpFamilyOwner(List *name, const char *access_method, Oid newOwnerId)
 	char	   *opfname;
 	char	   *schemaname;
 
-	amOid = GetSysCacheOid(AMNAME,
-						   CStringGetDatum(access_method),
-						   0, 0, 0);
+	amOid = GetSysCacheOid1(AMNAME, CStringGetDatum(access_method));
 	if (!OidIsValid(amOid))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -2085,11 +2038,10 @@ AlterOpFamilyOwner(List *name, const char *access_method, Oid newOwnerId)
 
 		namespaceOid = LookupExplicitNamespace(schemaname);
 
-		tup = SearchSysCacheCopy(OPFAMILYAMNAMENSP,
-								 ObjectIdGetDatum(amOid),
-								 PointerGetDatum(opfname),
-								 ObjectIdGetDatum(namespaceOid),
-								 0);
+		tup = SearchSysCacheCopy3(OPFAMILYAMNAMENSP,
+								  ObjectIdGetDatum(amOid),
+								  PointerGetDatum(opfname),
+								  ObjectIdGetDatum(namespaceOid));
 		if (!HeapTupleIsValid(tup))
 			ereport(ERROR,
 					(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -2107,9 +2059,7 @@ AlterOpFamilyOwner(List *name, const char *access_method, Oid newOwnerId)
 					 errmsg("operator family \"%s\" does not exist for access method \"%s\"",
 							opfname, access_method)));
 
-		tup = SearchSysCacheCopy(OPFAMILYOID,
-								 ObjectIdGetDatum(opfOid),
-								 0, 0, 0);
+		tup = SearchSysCacheCopy1(OPFAMILYOID, ObjectIdGetDatum(opfOid));
 		if (!HeapTupleIsValid(tup))		/* should not happen */
 			elog(ERROR, "cache lookup failed for opfamily %u", opfOid);
 	}
diff --git a/src/backend/commands/operatorcmds.c b/src/backend/commands/operatorcmds.c
index 70b9e17..9c07cf3 100644
--- a/src/backend/commands/operatorcmds.c
+++ b/src/backend/commands/operatorcmds.c
@@ -308,9 +308,7 @@ RemoveOperator(RemoveFuncStmt *stmt)
 		return;
 	}
 
-	tup = SearchSysCache(OPEROID,
-						 ObjectIdGetDatum(operOid),
-						 0, 0, 0);
+	tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operOid));
 	if (!HeapTupleIsValid(tup)) /* should not happen */
 		elog(ERROR, "cache lookup failed for operator %u", operOid);
 
@@ -344,9 +342,7 @@ RemoveOperatorById(Oid operOid)
 
 	relation = heap_open(OperatorRelationId, RowExclusiveLock);
 
-	tup = SearchSysCache(OPEROID,
-						 ObjectIdGetDatum(operOid),
-						 0, 0, 0);
+	tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operOid));
 	if (!HeapTupleIsValid(tup)) /* should not happen */
 		elog(ERROR, "cache lookup failed for operator %u", operOid);
 
@@ -399,9 +395,7 @@ AlterOperatorOwner_internal(Relation rel, Oid operOid, Oid newOwnerId)
 
 	Assert(RelationGetRelid(rel) == OperatorRelationId);
 
-	tup = SearchSysCacheCopy(OPEROID,
-							 ObjectIdGetDatum(operOid),
-							 0, 0, 0);
+	tup = SearchSysCacheCopy1(OPEROID, ObjectIdGetDatum(operOid));
 	if (!HeapTupleIsValid(tup)) /* should not happen */
 		elog(ERROR, "cache lookup failed for operator %u", operOid);
 
diff --git a/src/backend/commands/proclang.c b/src/backend/commands/proclang.c
index cf10713..9e80fd9 100644
--- a/src/backend/commands/proclang.c
+++ b/src/backend/commands/proclang.c
@@ -78,9 +78,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
 	 */
 	languageName = case_translate_language_name(stmt->plname);
 
-	if (SearchSysCacheExists(LANGNAME,
-							 PointerGetDatum(languageName),
-							 0, 0, 0))
+	if (SearchSysCacheExists1(LANGNAME, PointerGetDatum(languageName)))
 		ereport(ERROR,
 				(errcode(ERRCODE_DUPLICATE_OBJECT),
 				 errmsg("language \"%s\" already exists", languageName)));
@@ -489,9 +487,7 @@ DropProceduralLanguage(DropPLangStmt *stmt)
 	 */
 	languageName = case_translate_language_name(stmt->plname);
 
-	langTup = SearchSysCache(LANGNAME,
-							 CStringGetDatum(languageName),
-							 0, 0, 0);
+	langTup = SearchSysCache1(LANGNAME, CStringGetDatum(languageName));
 	if (!HeapTupleIsValid(langTup))
 	{
 		if (!stmt->missing_ok)
@@ -536,9 +532,7 @@ DropProceduralLanguageById(Oid langOid)
 
 	rel = heap_open(LanguageRelationId, RowExclusiveLock);
 
-	langTup = SearchSysCache(LANGOID,
-							 ObjectIdGetDatum(langOid),
-							 0, 0, 0);
+	langTup = SearchSysCache1(LANGOID, ObjectIdGetDatum(langOid));
 	if (!HeapTupleIsValid(langTup))		/* should not happen */
 		elog(ERROR, "cache lookup failed for language %u", langOid);
 
@@ -564,18 +558,14 @@ RenameLanguage(const char *oldname, const char *newname)
 
 	rel = heap_open(LanguageRelationId, RowExclusiveLock);
 
-	tup = SearchSysCacheCopy(LANGNAME,
-							 CStringGetDatum(oldname),
-							 0, 0, 0);
+	tup = SearchSysCacheCopy1(LANGNAME, CStringGetDatum(oldname));
 	if (!HeapTupleIsValid(tup))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
 				 errmsg("language \"%s\" does not exist", oldname)));
 
 	/* make sure the new name doesn't exist */
-	if (SearchSysCacheExists(LANGNAME,
-							 CStringGetDatum(newname),
-							 0, 0, 0))
+	if (SearchSysCacheExists1(LANGNAME, CStringGetDatum(newname)))
 		ereport(ERROR,
 				(errcode(ERRCODE_DUPLICATE_OBJECT),
 				 errmsg("language \"%s\" already exists", newname)));
@@ -608,9 +598,7 @@ AlterLanguageOwner(const char *name, Oid newOwnerId)
 
 	rel = heap_open(LanguageRelationId, RowExclusiveLock);
 
-	tup = SearchSysCache(LANGNAME,
-						 CStringGetDatum(name),
-						 0, 0, 0);
+	tup = SearchSysCache1(LANGNAME, CStringGetDatum(name));
 	if (!HeapTupleIsValid(tup))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -635,9 +623,7 @@ AlterLanguageOwner_oid(Oid oid, Oid newOwnerId)
 
 	rel = heap_open(LanguageRelationId, RowExclusiveLock);
 
-	tup = SearchSysCache(LANGOID,
-						 ObjectIdGetDatum(oid),
-						 0, 0, 0);
+	tup = SearchSysCache1(LANGOID, ObjectIdGetDatum(oid));
 	if (!HeapTupleIsValid(tup))
 		elog(ERROR, "cache lookup failed for language %u", oid);
 
diff --git a/src/backend/commands/schemacmds.c b/src/backend/commands/schemacmds.c
index afdc6dc..407bd8a 100644
--- a/src/backend/commands/schemacmds.c
+++ b/src/backend/commands/schemacmds.c
@@ -178,9 +178,8 @@ RemoveSchemas(DropStmt *drop)
 					 errmsg("schema name cannot be qualified")));
 		namespaceName = strVal(linitial(names));
 
-		namespaceId = GetSysCacheOid(NAMESPACENAME,
-									 CStringGetDatum(namespaceName),
-									 0, 0, 0);
+		namespaceId = GetSysCacheOid1(NAMESPACENAME,
+									  CStringGetDatum(namespaceName));
 
 		if (!OidIsValid(namespaceId))
 		{
@@ -233,9 +232,8 @@ RemoveSchemaById(Oid schemaOid)
 
 	relation = heap_open(NamespaceRelationId, RowExclusiveLock);
 
-	tup = SearchSysCache(NAMESPACEOID,
-						 ObjectIdGetDatum(schemaOid),
-						 0, 0, 0);
+	tup = SearchSysCache1(NAMESPACEOID,
+						  ObjectIdGetDatum(schemaOid));
 	if (!HeapTupleIsValid(tup)) /* should not happen */
 		elog(ERROR, "cache lookup failed for namespace %u", schemaOid);
 
@@ -259,9 +257,7 @@ RenameSchema(const char *oldname, const char *newname)
 
 	rel = heap_open(NamespaceRelationId, RowExclusiveLock);
 
-	tup = SearchSysCacheCopy(NAMESPACENAME,
-							 CStringGetDatum(oldname),
-							 0, 0, 0);
+	tup = SearchSysCacheCopy1(NAMESPACENAME, CStringGetDatum(oldname));
 	if (!HeapTupleIsValid(tup))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_SCHEMA),
@@ -269,9 +265,8 @@ RenameSchema(const char *oldname, const char *newname)
 
 	/* make sure the new name doesn't exist */
 	if (HeapTupleIsValid(
-						 SearchSysCache(NAMESPACENAME,
-										CStringGetDatum(newname),
-										0, 0, 0)))
+						 SearchSysCache1(NAMESPACENAME,
+										 CStringGetDatum(newname))))
 		ereport(ERROR,
 				(errcode(ERRCODE_DUPLICATE_SCHEMA),
 				 errmsg("schema \"%s\" already exists", newname)));
@@ -310,9 +305,7 @@ AlterSchemaOwner_oid(Oid oid, Oid newOwnerId)
 
 	rel = heap_open(NamespaceRelationId, RowExclusiveLock);
 
-	tup = SearchSysCache(NAMESPACEOID,
-						 ObjectIdGetDatum(oid),
-						 0, 0, 0);
+	tup = SearchSysCache1(NAMESPACEOID, ObjectIdGetDatum(oid));
 	if (!HeapTupleIsValid(tup))
 		elog(ERROR, "cache lookup failed for schema %u", oid);
 
@@ -335,9 +328,7 @@ AlterSchemaOwner(const char *name, Oid newOwnerId)
 
 	rel = heap_open(NamespaceRelationId, RowExclusiveLock);
 
-	tup = SearchSysCache(NAMESPACENAME,
-						 CStringGetDatum(name),
-						 0, 0, 0);
+	tup = SearchSysCache1(NAMESPACENAME, CStringGetDatum(name));
 	if (!HeapTupleIsValid(tup))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_SCHEMA),
diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c
index 0f9dcfe..4ba4b29 100644
--- a/src/backend/commands/sequence.c
+++ b/src/backend/commands/sequence.c
@@ -692,9 +692,7 @@ lastval(PG_FUNCTION_ARGS)
 				 errmsg("lastval is not yet defined in this session")));
 
 	/* Someone may have dropped the sequence since the last nextval() */
-	if (!SearchSysCacheExists(RELOID,
-							  ObjectIdGetDatum(last_used_seq->relid),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(last_used_seq->relid)))
 		ereport(ERROR,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("lastval is not yet defined in this session")));
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 94ba2d1..1f26eef 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -728,9 +728,7 @@ RemoveRelations(DropStmt *drop)
 		 */
 		if (relkind == RELKIND_INDEX)
 		{
-			tuple = SearchSysCache(INDEXRELID,
-								   ObjectIdGetDatum(relOid),
-								   0, 0, 0);
+			tuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(relOid));
 			if (HeapTupleIsValid(tuple))
 			{
 				Form_pg_index index = (Form_pg_index) GETSTRUCT(tuple);
@@ -743,9 +741,7 @@ RemoveRelations(DropStmt *drop)
 		/* Get the lock before trying to fetch the syscache entry */
 		LockRelationOid(relOid, AccessExclusiveLock);
 
-		tuple = SearchSysCache(RELOID,
-							   ObjectIdGetDatum(relOid),
-							   0, 0, 0);
+		tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relOid));
 		if (!HeapTupleIsValid(tuple))
 			elog(ERROR, "cache lookup failed for relation %u", relOid);
 		classform = (Form_pg_class) GETSTRUCT(tuple);
@@ -1906,9 +1902,7 @@ setRelhassubclassInRelation(Oid relationId, bool relhassubclass)
 	 * need to update it, but we still need to issue an SI inval message.
 	 */
 	relationRelation = heap_open(RelationRelationId, RowExclusiveLock);
-	tuple = SearchSysCacheCopy(RELOID,
-							   ObjectIdGetDatum(relationId),
-							   0, 0, 0);
+	tuple = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relationId));
 	if (!HeapTupleIsValid(tuple))
 		elog(ERROR, "cache lookup failed for relation %u", relationId);
 	classtuple = (Form_pg_class) GETSTRUCT(tuple);
@@ -2062,10 +2056,9 @@ renameatt(Oid myrelid,
 	/* new name should not already exist */
 
 	/* this test is deliberately not attisdropped-aware */
-	if (SearchSysCacheExists(ATTNAME,
-							 ObjectIdGetDatum(myrelid),
-							 PointerGetDatum(newattname),
-							 0, 0))
+	if (SearchSysCacheExists2(ATTNAME,
+							  ObjectIdGetDatum(myrelid),
+							  PointerGetDatum(newattname)))
 		ereport(ERROR,
 				(errcode(ERRCODE_DUPLICATE_COLUMN),
 				 errmsg("column \"%s\" of relation \"%s\" already exists",
@@ -2172,9 +2165,7 @@ RenameRelationInternal(Oid myrelid, const char *newrelname, Oid namespaceId)
 	 */
 	relrelation = heap_open(RelationRelationId, RowExclusiveLock);
 
-	reltup = SearchSysCacheCopy(RELOID,
-								ObjectIdGetDatum(myrelid),
-								0, 0, 0);
+	reltup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(myrelid));
 	if (!HeapTupleIsValid(reltup))		/* shouldn't happen */
 		elog(ERROR, "cache lookup failed for relation %u", myrelid);
 	relform = (Form_pg_class) GETSTRUCT(reltup);
@@ -3671,9 +3662,7 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel,
 
 	pgclass = heap_open(RelationRelationId, RowExclusiveLock);
 
-	reltup = SearchSysCacheCopy(RELOID,
-								ObjectIdGetDatum(myrelid),
-								0, 0, 0);
+	reltup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(myrelid));
 	if (!HeapTupleIsValid(reltup))
 		elog(ERROR, "cache lookup failed for relation %u", myrelid);
 	relkind = ((Form_pg_class) GETSTRUCT(reltup))->relkind;
@@ -3682,10 +3671,9 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel,
 	 * this test is deliberately not attisdropped-aware, since if one tries to
 	 * add a column matching a dropped column name, it's gonna fail anyway.
 	 */
-	if (SearchSysCacheExists(ATTNAME,
-							 ObjectIdGetDatum(myrelid),
-							 PointerGetDatum(colDef->colname),
-							 0, 0))
+	if (SearchSysCacheExists2(ATTNAME,
+							  ObjectIdGetDatum(myrelid),
+							  PointerGetDatum(colDef->colname)))
 		ereport(ERROR,
 				(errcode(ERRCODE_DUPLICATE_COLUMN),
 				 errmsg("column \"%s\" of relation \"%s\" already exists",
@@ -3953,9 +3941,7 @@ ATExecDropNotNull(Relation rel, const char *colName)
 		Form_pg_index indexStruct;
 		int			i;
 
-		indexTuple = SearchSysCache(INDEXRELID,
-									ObjectIdGetDatum(indexoid),
-									0, 0, 0);
+		indexTuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexoid));
 		if (!HeapTupleIsValid(indexTuple))
 			elog(ERROR, "cache lookup failed for index %u", indexoid);
 		indexStruct = (Form_pg_index) GETSTRUCT(indexTuple);
@@ -4496,9 +4482,8 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName,
 
 		class_rel = heap_open(RelationRelationId, RowExclusiveLock);
 
-		tuple = SearchSysCacheCopy(RELOID,
-								   ObjectIdGetDatum(RelationGetRelid(rel)),
-								   0, 0, 0);
+		tuple = SearchSysCacheCopy1(RELOID,
+									ObjectIdGetDatum(RelationGetRelid(rel)));
 		if (!HeapTupleIsValid(tuple))
 			elog(ERROR, "cache lookup failed for relation %u",
 				 RelationGetRelid(rel));
@@ -4876,9 +4861,7 @@ ATAddForeignKeyConstraint(AlteredTableInfo *tab, Relation rel,
 		int16		eqstrategy;
 
 		/* We need several fields out of the pg_opclass entry */
-		cla_ht = SearchSysCache(CLAOID,
-								ObjectIdGetDatum(opclasses[i]),
-								0, 0, 0);
+		cla_ht = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclasses[i]));
 		if (!HeapTupleIsValid(cla_ht))
 			elog(ERROR, "cache lookup failed for opclass %u", opclasses[i]);
 		cla_tup = (Form_pg_opclass) GETSTRUCT(cla_ht);
@@ -5103,9 +5086,7 @@ transformFkeyGetPrimaryKey(Relation pkrel, Oid *indexOid,
 	{
 		Oid			indexoid = lfirst_oid(indexoidscan);
 
-		indexTuple = SearchSysCache(INDEXRELID,
-									ObjectIdGetDatum(indexoid),
-									0, 0, 0);
+		indexTuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexoid));
 		if (!HeapTupleIsValid(indexTuple))
 			elog(ERROR, "cache lookup failed for index %u", indexoid);
 		indexStruct = (Form_pg_index) GETSTRUCT(indexTuple);
@@ -5200,9 +5181,7 @@ transformFkeyCheckAttrs(Relation pkrel,
 					j;
 
 		indexoid = lfirst_oid(indexoidscan);
-		indexTuple = SearchSysCache(INDEXRELID,
-									ObjectIdGetDatum(indexoid),
-									0, 0, 0);
+		indexTuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexoid));
 		if (!HeapTupleIsValid(indexTuple))
 			elog(ERROR, "cache lookup failed for index %u", indexoid);
 		indexStruct = (Form_pg_index) GETSTRUCT(indexTuple);
@@ -6432,9 +6411,7 @@ ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing)
 	/* Get its pg_class tuple, too */
 	class_rel = heap_open(RelationRelationId, RowExclusiveLock);
 
-	tuple = SearchSysCache(RELOID,
-						   ObjectIdGetDatum(relationOid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relationOid));
 	if (!HeapTupleIsValid(tuple))
 		elog(ERROR, "cache lookup failed for relation %u", relationOid);
 	tuple_class = (Form_pg_class) GETSTRUCT(tuple);
@@ -6788,9 +6765,7 @@ ATExecSetRelOptions(Relation rel, List *defList, bool isReset)
 
 	/* Get the old reloptions */
 	relid = RelationGetRelid(rel);
-	tuple = SearchSysCache(RELOID,
-						   ObjectIdGetDatum(relid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
 	if (!HeapTupleIsValid(tuple))
 		elog(ERROR, "cache lookup failed for relation %u", relid);
 
@@ -6853,9 +6828,7 @@ ATExecSetRelOptions(Relation rel, List *defList, bool isReset)
 		toastrel = heap_open(toastid, AccessExclusiveLock);
 
 		/* Get the old reloptions */
-		tuple = SearchSysCache(RELOID,
-							   ObjectIdGetDatum(toastid),
-							   0, 0, 0);
+		tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(toastid));
 		if (!HeapTupleIsValid(tuple))
 			elog(ERROR, "cache lookup failed for relation %u", toastid);
 
@@ -6960,9 +6933,7 @@ ATExecSetTableSpace(Oid tableOid, Oid newTableSpace)
 	/* Get a modifiable copy of the relation's pg_class row */
 	pg_class = heap_open(RelationRelationId, RowExclusiveLock);
 
-	tuple = SearchSysCacheCopy(RELOID,
-							   ObjectIdGetDatum(tableOid),
-							   0, 0, 0);
+	tuple = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(tableOid));
 	if (!HeapTupleIsValid(tuple))
 		elog(ERROR, "cache lookup failed for relation %u", tableOid);
 	rd_rel = (Form_pg_class) GETSTRUCT(tuple);
@@ -7866,9 +7837,7 @@ AlterRelationNamespaceInternal(Relation classRel, Oid relOid,
 	HeapTuple	classTup;
 	Form_pg_class classForm;
 
-	classTup = SearchSysCacheCopy(RELOID,
-								  ObjectIdGetDatum(relOid),
-								  0, 0, 0);
+	classTup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relOid));
 	if (!HeapTupleIsValid(classTup))
 		elog(ERROR, "cache lookup failed for relation %u", relOid);
 	classForm = (Form_pg_class) GETSTRUCT(classTup);
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c
index adcbdd3..f0cf3c7 100644
--- a/src/backend/commands/trigger.c
+++ b/src/backend/commands/trigger.c
@@ -574,9 +574,8 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString,
 	 * entries.
 	 */
 	pgrel = heap_open(RelationRelationId, RowExclusiveLock);
-	tuple = SearchSysCacheCopy(RELOID,
-							   ObjectIdGetDatum(RelationGetRelid(rel)),
-							   0, 0, 0);
+	tuple = SearchSysCacheCopy1(RELOID,
+								ObjectIdGetDatum(RelationGetRelid(rel)));
 	if (!HeapTupleIsValid(tuple))
 		elog(ERROR, "cache lookup failed for relation %u",
 			 RelationGetRelid(rel));
diff --git a/src/backend/commands/tsearchcmds.c b/src/backend/commands/tsearchcmds.c
index 333e2d1..ba3de63 100644
--- a/src/backend/commands/tsearchcmds.c
+++ b/src/backend/commands/tsearchcmds.c
@@ -338,9 +338,7 @@ RemoveTSParserById(Oid prsId)
 
 	relation = heap_open(TSParserRelationId, RowExclusiveLock);
 
-	tup = SearchSysCache(TSPARSEROID,
-						 ObjectIdGetDatum(prsId),
-						 0, 0, 0);
+	tup = SearchSysCache1(TSPARSEROID, ObjectIdGetDatum(prsId));
 
 	if (!HeapTupleIsValid(tup))
 		elog(ERROR, "cache lookup failed for text search parser %u", prsId);
@@ -372,19 +370,16 @@ RenameTSParser(List *oldname, const char *newname)
 
 	prsId = TSParserGetPrsid(oldname, false);
 
-	tup = SearchSysCacheCopy(TSPARSEROID,
-							 ObjectIdGetDatum(prsId),
-							 0, 0, 0);
+	tup = SearchSysCacheCopy1(TSPARSEROID, ObjectIdGetDatum(prsId));
 
 	if (!HeapTupleIsValid(tup)) /* should not happen */
 		elog(ERROR, "cache lookup failed for text search parser %u", prsId);
 
 	namespaceOid = ((Form_pg_ts_parser) GETSTRUCT(tup))->prsnamespace;
 
-	if (SearchSysCacheExists(TSPARSERNAMENSP,
-							 PointerGetDatum(newname),
-							 ObjectIdGetDatum(namespaceOid),
-							 0, 0))
+	if (SearchSysCacheExists2(TSPARSERNAMENSP,
+							  PointerGetDatum(newname),
+							  ObjectIdGetDatum(namespaceOid)))
 		ereport(ERROR,
 				(errcode(ERRCODE_DUPLICATE_OBJECT),
 				 errmsg("text search parser \"%s\" already exists",
@@ -450,9 +445,7 @@ verify_dictoptions(Oid tmplId, List *dictoptions)
 	if (!IsUnderPostmaster)
 		return;
 
-	tup = SearchSysCache(TSTEMPLATEOID,
-						 ObjectIdGetDatum(tmplId),
-						 0, 0, 0);
+	tup = SearchSysCache1(TSTEMPLATEOID, ObjectIdGetDatum(tmplId));
 	if (!HeapTupleIsValid(tup)) /* should not happen */
 		elog(ERROR, "cache lookup failed for text search template %u",
 			 tmplId);
@@ -591,9 +584,7 @@ RenameTSDictionary(List *oldname, const char *newname)
 
 	dictId = TSDictionaryGetDictid(oldname, false);
 
-	tup = SearchSysCacheCopy(TSDICTOID,
-							 ObjectIdGetDatum(dictId),
-							 0, 0, 0);
+	tup = SearchSysCacheCopy1(TSDICTOID, ObjectIdGetDatum(dictId));
 
 	if (!HeapTupleIsValid(tup)) /* should not happen */
 		elog(ERROR, "cache lookup failed for text search dictionary %u",
@@ -601,10 +592,9 @@ RenameTSDictionary(List *oldname, const char *newname)
 
 	namespaceOid = ((Form_pg_ts_dict) GETSTRUCT(tup))->dictnamespace;
 
-	if (SearchSysCacheExists(TSDICTNAMENSP,
-							 PointerGetDatum(newname),
-							 ObjectIdGetDatum(namespaceOid),
-							 0, 0))
+	if (SearchSysCacheExists2(TSDICTNAMENSP,
+							  PointerGetDatum(newname),
+							  ObjectIdGetDatum(namespaceOid)))
 		ereport(ERROR,
 				(errcode(ERRCODE_DUPLICATE_OBJECT),
 				 errmsg("text search dictionary \"%s\" already exists",
@@ -673,9 +663,7 @@ RemoveTSDictionaries(DropStmt *drop)
 			continue;
 		}
 
-		tup = SearchSysCache(TSDICTOID,
-							 ObjectIdGetDatum(dictOid),
-							 0, 0, 0);
+		tup = SearchSysCache1(TSDICTOID, ObjectIdGetDatum(dictOid));
 		if (!HeapTupleIsValid(tup))		/* should not happen */
 			elog(ERROR, "cache lookup failed for text search dictionary %u",
 				 dictOid);
@@ -712,9 +700,7 @@ RemoveTSDictionaryById(Oid dictId)
 
 	relation = heap_open(TSDictionaryRelationId, RowExclusiveLock);
 
-	tup = SearchSysCache(TSDICTOID,
-						 ObjectIdGetDatum(dictId),
-						 0, 0, 0);
+	tup = SearchSysCache1(TSDICTOID, ObjectIdGetDatum(dictId));
 
 	if (!HeapTupleIsValid(tup))
 		elog(ERROR, "cache lookup failed for text search dictionary %u",
@@ -749,9 +735,7 @@ AlterTSDictionary(AlterTSDictionaryStmt *stmt)
 
 	rel = heap_open(TSDictionaryRelationId, RowExclusiveLock);
 
-	tup = SearchSysCache(TSDICTOID,
-						 ObjectIdGetDatum(dictId),
-						 0, 0, 0);
+	tup = SearchSysCache1(TSDICTOID, ObjectIdGetDatum(dictId));
 
 	if (!HeapTupleIsValid(tup))
 		elog(ERROR, "cache lookup failed for text search dictionary %u",
@@ -859,9 +843,7 @@ AlterTSDictionaryOwner(List *name, Oid newOwnerId)
 
 	dictId = TSDictionaryGetDictid(name, false);
 
-	tup = SearchSysCacheCopy(TSDICTOID,
-							 ObjectIdGetDatum(dictId),
-							 0, 0, 0);
+	tup = SearchSysCacheCopy1(TSDICTOID, ObjectIdGetDatum(dictId));
 
 	if (!HeapTupleIsValid(tup)) /* should not happen */
 		elog(ERROR, "cache lookup failed for text search dictionary %u",
@@ -1093,9 +1075,7 @@ RenameTSTemplate(List *oldname, const char *newname)
 
 	tmplId = TSTemplateGetTmplid(oldname, false);
 
-	tup = SearchSysCacheCopy(TSTEMPLATEOID,
-							 ObjectIdGetDatum(tmplId),
-							 0, 0, 0);
+	tup = SearchSysCacheCopy1(TSTEMPLATEOID, ObjectIdGetDatum(tmplId));
 
 	if (!HeapTupleIsValid(tup)) /* should not happen */
 		elog(ERROR, "cache lookup failed for text search template %u",
@@ -1103,10 +1083,9 @@ RenameTSTemplate(List *oldname, const char *newname)
 
 	namespaceOid = ((Form_pg_ts_template) GETSTRUCT(tup))->tmplnamespace;
 
-	if (SearchSysCacheExists(TSTEMPLATENAMENSP,
-							 PointerGetDatum(newname),
-							 ObjectIdGetDatum(namespaceOid),
-							 0, 0))
+	if (SearchSysCacheExists2(TSTEMPLATENAMENSP,
+							  PointerGetDatum(newname),
+							  ObjectIdGetDatum(namespaceOid)))
 		ereport(ERROR,
 				(errcode(ERRCODE_DUPLICATE_OBJECT),
 				 errmsg("text search template \"%s\" already exists",
@@ -1190,9 +1169,7 @@ RemoveTSTemplateById(Oid tmplId)
 
 	relation = heap_open(TSTemplateRelationId, RowExclusiveLock);
 
-	tup = SearchSysCache(TSTEMPLATEOID,
-						 ObjectIdGetDatum(tmplId),
-						 0, 0, 0);
+	tup = SearchSysCache1(TSTEMPLATEOID, ObjectIdGetDatum(tmplId));
 
 	if (!HeapTupleIsValid(tup))
 		elog(ERROR, "cache lookup failed for text search template %u",
@@ -1221,9 +1198,7 @@ GetTSConfigTuple(List *names)
 	if (!OidIsValid(cfgId))
 		return NULL;
 
-	tup = SearchSysCache(TSCONFIGOID,
-						 ObjectIdGetDatum(cfgId),
-						 0, 0, 0);
+	tup = SearchSysCache1(TSCONFIGOID, ObjectIdGetDatum(cfgId));
 
 	if (!HeapTupleIsValid(tup)) /* should not happen */
 		elog(ERROR, "cache lookup failed for text search configuration %u",
@@ -1376,9 +1351,7 @@ DefineTSConfiguration(List *names, List *parameters)
 	{
 		Form_pg_ts_config cfg;
 
-		tup = SearchSysCache(TSCONFIGOID,
-							 ObjectIdGetDatum(sourceOid),
-							 0, 0, 0);
+		tup = SearchSysCache1(TSCONFIGOID, ObjectIdGetDatum(sourceOid));
 		if (!HeapTupleIsValid(tup))
 			elog(ERROR, "cache lookup failed for text search configuration %u",
 				 sourceOid);
@@ -1490,9 +1463,7 @@ RenameTSConfiguration(List *oldname, const char *newname)
 
 	cfgId = TSConfigGetCfgid(oldname, false);
 
-	tup = SearchSysCacheCopy(TSCONFIGOID,
-							 ObjectIdGetDatum(cfgId),
-							 0, 0, 0);
+	tup = SearchSysCacheCopy1(TSCONFIGOID, ObjectIdGetDatum(cfgId));
 
 	if (!HeapTupleIsValid(tup)) /* should not happen */
 		elog(ERROR, "cache lookup failed for text search configuration %u",
@@ -1500,10 +1471,9 @@ RenameTSConfiguration(List *oldname, const char *newname)
 
 	namespaceOid = ((Form_pg_ts_config) GETSTRUCT(tup))->cfgnamespace;
 
-	if (SearchSysCacheExists(TSCONFIGNAMENSP,
-							 PointerGetDatum(newname),
-							 ObjectIdGetDatum(namespaceOid),
-							 0, 0))
+	if (SearchSysCacheExists2(TSCONFIGNAMENSP,
+							  PointerGetDatum(newname),
+							  ObjectIdGetDatum(namespaceOid)))
 		ereport(ERROR,
 				(errcode(ERRCODE_DUPLICATE_OBJECT),
 				 errmsg("text search configuration \"%s\" already exists",
@@ -1608,9 +1578,7 @@ RemoveTSConfigurationById(Oid cfgId)
 	/* Remove the pg_ts_config entry */
 	relCfg = heap_open(TSConfigRelationId, RowExclusiveLock);
 
-	tup = SearchSysCache(TSCONFIGOID,
-						 ObjectIdGetDatum(cfgId),
-						 0, 0, 0);
+	tup = SearchSysCache1(TSCONFIGOID, ObjectIdGetDatum(cfgId));
 
 	if (!HeapTupleIsValid(tup))
 		elog(ERROR, "cache lookup failed for text search dictionary %u",
@@ -1660,9 +1628,7 @@ AlterTSConfigurationOwner(List *name, Oid newOwnerId)
 
 	cfgId = TSConfigGetCfgid(name, false);
 
-	tup = SearchSysCacheCopy(TSCONFIGOID,
-							 ObjectIdGetDatum(cfgId),
-							 0, 0, 0);
+	tup = SearchSysCacheCopy1(TSCONFIGOID, ObjectIdGetDatum(cfgId));
 
 	if (!HeapTupleIsValid(tup)) /* should not happen */
 		elog(ERROR, "cache lookup failed for text search configuration %u",
diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c
index 82815c7..7b3b782 100644
--- a/src/backend/commands/typecmds.c
+++ b/src/backend/commands/typecmds.c
@@ -178,10 +178,9 @@ DefineType(List *names, List *parameters)
 	 * Look to see if type already exists (presumably as a shell; if not,
 	 * TypeCreate will complain).
 	 */
-	typoid = GetSysCacheOid(TYPENAMENSP,
-							CStringGetDatum(typeName),
-							ObjectIdGetDatum(typeNamespace),
-							0, 0);
+	typoid = GetSysCacheOid2(TYPENAMENSP,
+							 CStringGetDatum(typeName),
+							 ObjectIdGetDatum(typeNamespace));
 
 	/*
 	 * If it's not a shell, see if it's an autogenerated array type, and if so
@@ -710,9 +709,7 @@ RemoveTypeById(Oid typeOid)
 
 	relation = heap_open(TypeRelationId, RowExclusiveLock);
 
-	tup = SearchSysCache(TYPEOID,
-						 ObjectIdGetDatum(typeOid),
-						 0, 0, 0);
+	tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typeOid));
 	if (!HeapTupleIsValid(tup))
 		elog(ERROR, "cache lookup failed for type %u", typeOid);
 
@@ -787,10 +784,9 @@ DefineDomain(CreateDomainStmt *stmt)
 	 * Check for collision with an existing type name.	If there is one and
 	 * it's an autogenerated array, we can rename it out of the way.
 	 */
-	old_type_oid = GetSysCacheOid(TYPENAMENSP,
-								  CStringGetDatum(domainName),
-								  ObjectIdGetDatum(domainNamespace),
-								  0, 0);
+	old_type_oid = GetSysCacheOid2(TYPENAMENSP,
+								   CStringGetDatum(domainName),
+								   ObjectIdGetDatum(domainNamespace));
 	if (OidIsValid(old_type_oid))
 	{
 		if (!moveArrayTypeName(old_type_oid, domainName, domainNamespace))
@@ -1113,10 +1109,9 @@ DefineEnum(CreateEnumStmt *stmt)
 	 * Check for collision with an existing type name.	If there is one and
 	 * it's an autogenerated array, we can rename it out of the way.
 	 */
-	old_type_oid = GetSysCacheOid(TYPENAMENSP,
-								  CStringGetDatum(enumName),
-								  ObjectIdGetDatum(enumNamespace),
-								  0, 0);
+	old_type_oid = GetSysCacheOid2(TYPENAMENSP,
+								   CStringGetDatum(enumName),
+								   ObjectIdGetDatum(enumNamespace));
 	if (OidIsValid(old_type_oid))
 	{
 		if (!moveArrayTypeName(old_type_oid, enumName, enumNamespace))
@@ -1536,10 +1531,10 @@ DefineCompositeType(const RangeVar *typevar, List *coldeflist)
 	 * about a "type" instead of below about a "relation".
 	 */
 	typeNamespace = RangeVarGetCreationNamespace(createStmt->relation);
-	old_type_oid = GetSysCacheOid(TYPENAMENSP,
-								  CStringGetDatum(createStmt->relation->relname),
-								  ObjectIdGetDatum(typeNamespace),
-								  0, 0);
+	old_type_oid =
+		GetSysCacheOid2(TYPENAMENSP,
+						CStringGetDatum(createStmt->relation->relname),
+						ObjectIdGetDatum(typeNamespace));
 	if (OidIsValid(old_type_oid))
 	{
 		if (!moveArrayTypeName(old_type_oid, createStmt->relation->relname, typeNamespace))
@@ -1582,9 +1577,7 @@ AlterDomainDefault(List *names, Node *defaultRaw)
 	/* Look up the domain in the type table */
 	rel = heap_open(TypeRelationId, RowExclusiveLock);
 
-	tup = SearchSysCacheCopy(TYPEOID,
-							 ObjectIdGetDatum(domainoid),
-							 0, 0, 0);
+	tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(domainoid));
 	if (!HeapTupleIsValid(tup))
 		elog(ERROR, "cache lookup failed for type %u", domainoid);
 	typTup = (Form_pg_type) GETSTRUCT(tup);
@@ -1710,9 +1703,7 @@ AlterDomainNotNull(List *names, bool notNull)
 	/* Look up the domain in the type table */
 	typrel = heap_open(TypeRelationId, RowExclusiveLock);
 
-	tup = SearchSysCacheCopy(TYPEOID,
-							 ObjectIdGetDatum(domainoid),
-							 0, 0, 0);
+	tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(domainoid));
 	if (!HeapTupleIsValid(tup))
 		elog(ERROR, "cache lookup failed for type %u", domainoid);
 	typTup = (Form_pg_type) GETSTRUCT(tup);
@@ -1812,9 +1803,7 @@ AlterDomainDropConstraint(List *names, const char *constrName,
 	/* Look up the domain in the type table */
 	rel = heap_open(TypeRelationId, RowExclusiveLock);
 
-	tup = SearchSysCacheCopy(TYPEOID,
-							 ObjectIdGetDatum(domainoid),
-							 0, 0, 0);
+	tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(domainoid));
 	if (!HeapTupleIsValid(tup))
 		elog(ERROR, "cache lookup failed for type %u", domainoid);
 
@@ -1887,9 +1876,7 @@ AlterDomainAddConstraint(List *names, Node *newConstraint)
 	/* Look up the domain in the type table */
 	typrel = heap_open(TypeRelationId, RowExclusiveLock);
 
-	tup = SearchSysCacheCopy(TYPEOID,
-							 ObjectIdGetDatum(domainoid),
-							 0, 0, 0);
+	tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(domainoid));
 	if (!HeapTupleIsValid(tup))
 		elog(ERROR, "cache lookup failed for type %u", domainoid);
 	typTup = (Form_pg_type) GETSTRUCT(tup);
@@ -2399,9 +2386,7 @@ GetDomainConstraints(Oid typeOid)
 		ScanKeyData key[1];
 		SysScanDesc scan;
 
-		tup = SearchSysCache(TYPEOID,
-							 ObjectIdGetDatum(typeOid),
-							 0, 0, 0);
+		tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typeOid));
 		if (!HeapTupleIsValid(tup))
 			elog(ERROR, "cache lookup failed for type %u", typeOid);
 		typTup = (Form_pg_type) GETSTRUCT(tup);
@@ -2512,9 +2497,7 @@ RenameType(List *names, const char *newTypeName)
 	/* Look up the type in the type table */
 	rel = heap_open(TypeRelationId, RowExclusiveLock);
 
-	tup = SearchSysCacheCopy(TYPEOID,
-							 ObjectIdGetDatum(typeOid),
-							 0, 0, 0);
+	tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(typeOid));
 	if (!HeapTupleIsValid(tup))
 		elog(ERROR, "cache lookup failed for type %u", typeOid);
 	typTup = (Form_pg_type) GETSTRUCT(tup);
@@ -2699,9 +2682,7 @@ AlterTypeOwnerInternal(Oid typeOid, Oid newOwnerId,
 
 	rel = heap_open(TypeRelationId, RowExclusiveLock);
 
-	tup = SearchSysCacheCopy(TYPEOID,
-							 ObjectIdGetDatum(typeOid),
-							 0, 0, 0);
+	tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(typeOid));
 	if (!HeapTupleIsValid(tup))
 		elog(ERROR, "cache lookup failed for type %u", typeOid);
 	typTup = (Form_pg_type) GETSTRUCT(tup);
@@ -2791,9 +2772,7 @@ AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid,
 
 	rel = heap_open(TypeRelationId, RowExclusiveLock);
 
-	tup = SearchSysCacheCopy(TYPEOID,
-							 ObjectIdGetDatum(typeOid),
-							 0, 0, 0);
+	tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(typeOid));
 	if (!HeapTupleIsValid(tup))
 		elog(ERROR, "cache lookup failed for type %u", typeOid);
 	typform = (Form_pg_type) GETSTRUCT(tup);
@@ -2821,10 +2800,9 @@ AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid,
 				 errmsg("cannot move objects into or out of TOAST schema")));
 
 	/* check for duplicate name (more friendly than unique-index failure) */
-	if (SearchSysCacheExists(TYPENAMENSP,
-							 CStringGetDatum(NameStr(typform->typname)),
-							 ObjectIdGetDatum(nspOid),
-							 0, 0))
+	if (SearchSysCacheExists2(TYPENAMENSP,
+							  CStringGetDatum(NameStr(typform->typname)),
+							  ObjectIdGetDatum(nspOid)))
 		ereport(ERROR,
 				(errcode(ERRCODE_DUPLICATE_OBJECT),
 				 errmsg("type \"%s\" already exists in schema \"%s\"",
diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c
index 6503310..9eb8bdc 100644
--- a/src/backend/commands/user.c
+++ b/src/backend/commands/user.c
@@ -61,9 +61,7 @@ have_createrole_privilege(void)
 	if (superuser())
 		return true;
 
-	utup = SearchSysCache(AUTHOID,
-						  ObjectIdGetDatum(GetUserId()),
-						  0, 0, 0);
+	utup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(GetUserId()));
 	if (HeapTupleIsValid(utup))
 	{
 		result = ((Form_pg_authid) GETSTRUCT(utup))->rolcreaterole;
@@ -295,9 +293,7 @@ CreateRole(CreateRoleStmt *stmt)
 	pg_authid_rel = heap_open(AuthIdRelationId, RowExclusiveLock);
 	pg_authid_dsc = RelationGetDescr(pg_authid_rel);
 
-	tuple = SearchSysCache(AUTHNAME,
-						   PointerGetDatum(stmt->role),
-						   0, 0, 0);
+	tuple = SearchSysCache1(AUTHNAME, PointerGetDatum(stmt->role));
 	if (HeapTupleIsValid(tuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_DUPLICATE_OBJECT),
@@ -576,9 +572,7 @@ AlterRole(AlterRoleStmt *stmt)
 	pg_authid_rel = heap_open(AuthIdRelationId, RowExclusiveLock);
 	pg_authid_dsc = RelationGetDescr(pg_authid_rel);
 
-	tuple = SearchSysCache(AUTHNAME,
-						   PointerGetDatum(stmt->role),
-						   0, 0, 0);
+	tuple = SearchSysCache1(AUTHNAME, PointerGetDatum(stmt->role));
 	if (!HeapTupleIsValid(tuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -765,9 +759,7 @@ AlterRoleSet(AlterRoleSetStmt *stmt)
 	HeapTuple	roletuple;
 	Oid			databaseid = InvalidOid;
 
-	roletuple = SearchSysCache(AUTHNAME,
-							   PointerGetDatum(stmt->role),
-							   0, 0, 0);
+	roletuple = SearchSysCache1(AUTHNAME, PointerGetDatum(stmt->role));
 
 	if (!HeapTupleIsValid(roletuple))
 		ereport(ERROR,
@@ -849,9 +841,7 @@ DropRole(DropRoleStmt *stmt)
 		SysScanDesc sscan;
 		Oid			roleid;
 
-		tuple = SearchSysCache(AUTHNAME,
-							   PointerGetDatum(role),
-							   0, 0, 0);
+		tuple = SearchSysCache1(AUTHNAME, PointerGetDatum(role));
 		if (!HeapTupleIsValid(tuple))
 		{
 			if (!stmt->missing_ok)
@@ -1005,9 +995,7 @@ RenameRole(const char *oldname, const char *newname)
 	rel = heap_open(AuthIdRelationId, RowExclusiveLock);
 	dsc = RelationGetDescr(rel);
 
-	oldtuple = SearchSysCache(AUTHNAME,
-							  CStringGetDatum(oldname),
-							  0, 0, 0);
+	oldtuple = SearchSysCache1(AUTHNAME, CStringGetDatum(oldname));
 	if (!HeapTupleIsValid(oldtuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -1033,9 +1021,7 @@ RenameRole(const char *oldname, const char *newname)
 				 errmsg("current user cannot be renamed")));
 
 	/* make sure the new name doesn't exist */
-	if (SearchSysCacheExists(AUTHNAME,
-							 CStringGetDatum(newname),
-							 0, 0, 0))
+	if (SearchSysCacheExists1(AUTHNAME, CStringGetDatum(newname)))
 		ereport(ERROR,
 				(errcode(ERRCODE_DUPLICATE_OBJECT),
 				 errmsg("role \"%s\" already exists", newname)));
@@ -1326,10 +1312,9 @@ AddRoleMems(const char *rolename, Oid roleid,
 		 * Check if entry for this role/member already exists; if so, give
 		 * warning unless we are adding admin option.
 		 */
-		authmem_tuple = SearchSysCache(AUTHMEMROLEMEM,
-									   ObjectIdGetDatum(roleid),
-									   ObjectIdGetDatum(memberid),
-									   0, 0);
+		authmem_tuple = SearchSysCache2(AUTHMEMROLEMEM,
+										ObjectIdGetDatum(roleid),
+										ObjectIdGetDatum(memberid));
 		if (HeapTupleIsValid(authmem_tuple) &&
 			(!admin_opt ||
 			 ((Form_pg_auth_members) GETSTRUCT(authmem_tuple))->admin_option))
@@ -1440,10 +1425,9 @@ DelRoleMems(const char *rolename, Oid roleid,
 		/*
 		 * Find entry for this role/member
 		 */
-		authmem_tuple = SearchSysCache(AUTHMEMROLEMEM,
-									   ObjectIdGetDatum(roleid),
-									   ObjectIdGetDatum(memberid),
-									   0, 0);
+		authmem_tuple = SearchSysCache2(AUTHMEMROLEMEM,
+										ObjectIdGetDatum(roleid),
+										ObjectIdGetDatum(memberid));
 		if (!HeapTupleIsValid(authmem_tuple))
 		{
 			ereport(WARNING,
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index d8a707b..77dc4f4 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -498,9 +498,7 @@ vac_update_relstats(Relation relation,
 	rd = heap_open(RelationRelationId, RowExclusiveLock);
 
 	/* Fetch a copy of the tuple to scribble on */
-	ctup = SearchSysCacheCopy(RELOID,
-							  ObjectIdGetDatum(relid),
-							  0, 0, 0);
+	ctup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relid));
 	if (!HeapTupleIsValid(ctup))
 		elog(ERROR, "pg_class entry for relid %u vanished during vacuuming",
 			 relid);
@@ -644,9 +642,7 @@ vac_update_datfrozenxid(void)
 	relation = heap_open(DatabaseRelationId, RowExclusiveLock);
 
 	/* Fetch a copy of the tuple to scribble on */
-	tuple = SearchSysCacheCopy(DATABASEOID,
-							   ObjectIdGetDatum(MyDatabaseId),
-							   0, 0, 0);
+	tuple = SearchSysCacheCopy1(DATABASEOID, ObjectIdGetDatum(MyDatabaseId));
 	if (!HeapTupleIsValid(tuple))
 		elog(ERROR, "could not find tuple for database %u", MyDatabaseId);
 	dbform = (Form_pg_database) GETSTRUCT(tuple);
diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index 96c12f6..55d8183 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -727,9 +727,7 @@ assign_session_authorization(const char *value, bool doit, GucSource source)
 			return NULL;
 		}
 
-		roleTup = SearchSysCache(AUTHNAME,
-								 PointerGetDatum(value),
-								 0, 0, 0);
+		roleTup = SearchSysCache1(AUTHNAME, PointerGetDatum(value));
 		if (!HeapTupleIsValid(roleTup))
 		{
 			ereport(GUC_complaint_elevel(source),
@@ -839,9 +837,7 @@ assign_role(const char *value, bool doit, GucSource source)
 			return NULL;
 		}
 
-		roleTup = SearchSysCache(AUTHNAME,
-								 PointerGetDatum(value),
-								 0, 0, 0);
+		roleTup = SearchSysCache1(AUTHNAME, PointerGetDatum(value));
 		if (!HeapTupleIsValid(roleTup))
 		{
 			ereport(GUC_complaint_elevel(source),
diff --git a/src/backend/executor/execAmi.c b/src/backend/executor/execAmi.c
index 6bfb761..e80da3a 100644
--- a/src/backend/executor/execAmi.c
+++ b/src/backend/executor/execAmi.c
@@ -484,17 +484,13 @@ IndexSupportsBackwardScan(Oid indexid)
 	Form_pg_am	amrec;
 
 	/* Fetch the pg_class tuple of the index relation */
-	ht_idxrel = SearchSysCache(RELOID,
-							   ObjectIdGetDatum(indexid),
-							   0, 0, 0);
+	ht_idxrel = SearchSysCache1(RELOID, ObjectIdGetDatum(indexid));
 	if (!HeapTupleIsValid(ht_idxrel))
 		elog(ERROR, "cache lookup failed for relation %u", indexid);
 	idxrelrec = (Form_pg_class) GETSTRUCT(ht_idxrel);
 
 	/* Fetch the pg_am tuple of the index' access method */
-	ht_am = SearchSysCache(AMOID,
-						   ObjectIdGetDatum(idxrelrec->relam),
-						   0, 0, 0);
+	ht_am = SearchSysCache1(AMOID, ObjectIdGetDatum(idxrelrec->relam));
 	if (!HeapTupleIsValid(ht_am))
 		elog(ERROR, "cache lookup failed for access method %u",
 			 idxrelrec->relam);
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c
index 8fd180e..60cd112 100644
--- a/src/backend/executor/functions.c
+++ b/src/backend/executor/functions.c
@@ -232,9 +232,7 @@ init_sql_fcache(FmgrInfo *finfo, bool lazyEvalOK)
 	/*
 	 * get the procedure tuple corresponding to the given function Oid
 	 */
-	procedureTuple = SearchSysCache(PROCOID,
-									ObjectIdGetDatum(foid),
-									0, 0, 0);
+	procedureTuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(foid));
 	if (!HeapTupleIsValid(procedureTuple))
 		elog(ERROR, "cache lookup failed for function %u", foid);
 	procedureStruct = (Form_pg_proc) GETSTRUCT(procedureTuple);
@@ -885,9 +883,7 @@ sql_exec_error_callback(void *arg)
 	int			syntaxerrposition;
 
 	/* Need access to function's pg_proc tuple */
-	func_tuple = SearchSysCache(PROCOID,
-								ObjectIdGetDatum(flinfo->fn_oid),
-								0, 0, 0);
+	func_tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(flinfo->fn_oid));
 	if (!HeapTupleIsValid(func_tuple))
 		return;					/* shouldn't happen */
 	functup = (Form_pg_proc) GETSTRUCT(func_tuple);
diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c
index d86a7f2..5730db3 100644
--- a/src/backend/executor/nodeAgg.c
+++ b/src/backend/executor/nodeAgg.c
@@ -1597,9 +1597,8 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
 		}
 		peraggstate->numArguments = numArguments;
 
-		aggTuple = SearchSysCache(AGGFNOID,
-								  ObjectIdGetDatum(aggref->aggfnoid),
-								  0, 0, 0);
+		aggTuple = SearchSysCache1(AGGFNOID,
+								   ObjectIdGetDatum(aggref->aggfnoid));
 		if (!HeapTupleIsValid(aggTuple))
 			elog(ERROR, "cache lookup failed for aggregate %u",
 				 aggref->aggfnoid);
@@ -1620,9 +1619,8 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
 			HeapTuple	procTuple;
 			Oid			aggOwner;
 
-			procTuple = SearchSysCache(PROCOID,
-									   ObjectIdGetDatum(aggref->aggfnoid),
-									   0, 0, 0);
+			procTuple = SearchSysCache1(PROCOID,
+										ObjectIdGetDatum(aggref->aggfnoid));
 			if (!HeapTupleIsValid(procTuple))
 				elog(ERROR, "cache lookup failed for function %u",
 					 aggref->aggfnoid);
diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c
index 7ca387b..a0a77d0 100644
--- a/src/backend/executor/nodeHash.c
+++ b/src/backend/executor/nodeHash.c
@@ -999,11 +999,10 @@ ExecHashBuildSkewHash(HashJoinTable hashtable, Hash *node, int mcvsToUse)
 	/*
 	 * Try to find the MCV statistics for the outer relation's join key.
 	 */
-	statsTuple = SearchSysCache(STATRELATTINH,
-								ObjectIdGetDatum(node->skewTable),
-								Int16GetDatum(node->skewColumn),
-								BoolGetDatum(node->skewInherit),
-								0);
+	statsTuple = SearchSysCache3(STATRELATTINH,
+								 ObjectIdGetDatum(node->skewTable),
+								 Int16GetDatum(node->skewColumn),
+								 BoolGetDatum(node->skewInherit));
 	if (!HeapTupleIsValid(statsTuple))
 		return;
 
diff --git a/src/backend/executor/nodeWindowAgg.c b/src/backend/executor/nodeWindowAgg.c
index f800aa6..ce4d78a 100644
--- a/src/backend/executor/nodeWindowAgg.c
+++ b/src/backend/executor/nodeWindowAgg.c
@@ -1369,9 +1369,7 @@ initialize_peragg(WindowAggState *winstate, WindowFunc *wfunc,
 		inputTypes[i++] = exprType((Node *) lfirst(lc));
 	}
 
-	aggTuple = SearchSysCache(AGGFNOID,
-							  ObjectIdGetDatum(wfunc->winfnoid),
-							  0, 0, 0);
+	aggTuple = SearchSysCache1(AGGFNOID, ObjectIdGetDatum(wfunc->winfnoid));
 	if (!HeapTupleIsValid(aggTuple))
 		elog(ERROR, "cache lookup failed for aggregate %u",
 			 wfunc->winfnoid);
@@ -1390,9 +1388,8 @@ initialize_peragg(WindowAggState *winstate, WindowFunc *wfunc,
 		HeapTuple	procTuple;
 		Oid			aggOwner;
 
-		procTuple = SearchSysCache(PROCOID,
-								   ObjectIdGetDatum(wfunc->winfnoid),
-								   0, 0, 0);
+		procTuple = SearchSysCache1(PROCOID,
+									ObjectIdGetDatum(wfunc->winfnoid));
 		if (!HeapTupleIsValid(procTuple))
 			elog(ERROR, "cache lookup failed for function %u",
 				 wfunc->winfnoid);
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index 2b0d8ee..900f636 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -911,9 +911,7 @@ SPI_gettype(TupleDesc tupdesc, int fnumber)
 	else
 		typoid = (SystemAttributeDefinition(fnumber, true))->atttypid;
 
-	typeTuple = SearchSysCache(TYPEOID,
-							   ObjectIdGetDatum(typoid),
-							   0, 0, 0);
+	typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typoid));
 
 	if (!HeapTupleIsValid(typeTuple))
 	{
diff --git a/src/backend/foreign/foreign.c b/src/backend/foreign/foreign.c
index 82f3db4..fd8d36b 100644
--- a/src/backend/foreign/foreign.c
+++ b/src/backend/foreign/foreign.c
@@ -47,9 +47,7 @@ GetForeignDataWrapper(Oid fdwid)
 	HeapTuple	tp;
 	bool		isnull;
 
-	tp = SearchSysCache(FOREIGNDATAWRAPPEROID,
-						ObjectIdGetDatum(fdwid),
-						0, 0, 0);
+	tp = SearchSysCache1(FOREIGNDATAWRAPPEROID, ObjectIdGetDatum(fdwid));
 
 	if (!HeapTupleIsValid(tp))
 		elog(ERROR, "cache lookup failed for foreign-data wrapper %u", fdwid);
@@ -84,9 +82,7 @@ GetForeignDataWrapperOidByName(const char *fdwname, bool missing_ok)
 {
 	Oid			fdwId;
 
-	fdwId = GetSysCacheOid(FOREIGNDATAWRAPPERNAME,
-						   CStringGetDatum(fdwname),
-						   0, 0, 0);
+	fdwId = GetSysCacheOid1(FOREIGNDATAWRAPPERNAME, CStringGetDatum(fdwname));
 
 	if (!OidIsValid(fdwId) && !missing_ok)
 		ereport(ERROR,
@@ -125,9 +121,7 @@ GetForeignServer(Oid serverid)
 	Datum		datum;
 	bool		isnull;
 
-	tp = SearchSysCache(FOREIGNSERVEROID,
-						ObjectIdGetDatum(serverid),
-						0, 0, 0);
+	tp = SearchSysCache1(FOREIGNSERVEROID, ObjectIdGetDatum(serverid));
 
 	if (!HeapTupleIsValid(tp))
 		elog(ERROR, "cache lookup failed for foreign server %u", serverid);
@@ -177,9 +171,7 @@ GetForeignServerOidByName(const char *srvname, bool missing_ok)
 {
 	Oid			serverid;
 
-	serverid = GetSysCacheOid(FOREIGNSERVERNAME,
-							  CStringGetDatum(srvname),
-							  0, 0, 0);
+	serverid = GetSysCacheOid1(FOREIGNSERVERNAME, CStringGetDatum(srvname));
 
 	if (!OidIsValid(serverid) && !missing_ok)
 		ereport(ERROR,
@@ -220,18 +212,16 @@ GetUserMapping(Oid userid, Oid serverid)
 	bool		isnull;
 	UserMapping *um;
 
-	tp = SearchSysCache(USERMAPPINGUSERSERVER,
-						ObjectIdGetDatum(userid),
-						ObjectIdGetDatum(serverid),
-						0, 0);
+	tp = SearchSysCache2(USERMAPPINGUSERSERVER,
+						 ObjectIdGetDatum(userid),
+						 ObjectIdGetDatum(serverid));
 
 	if (!HeapTupleIsValid(tp))
 	{
 		/* Not found for the specific user -- try PUBLIC */
-		tp = SearchSysCache(USERMAPPINGUSERSERVER,
-							ObjectIdGetDatum(InvalidOid),
-							ObjectIdGetDatum(serverid),
-							0, 0);
+		tp = SearchSysCache2(USERMAPPINGUSERSERVER,
+							 ObjectIdGetDatum(InvalidOid),
+							 ObjectIdGetDatum(serverid));
 	}
 
 	if (!HeapTupleIsValid(tp))
diff --git a/src/backend/libpq/crypt.c b/src/backend/libpq/crypt.c
index 04ee355..1d210d6 100644
--- a/src/backend/libpq/crypt.c
+++ b/src/backend/libpq/crypt.c
@@ -48,9 +48,7 @@ md5_crypt_verify(const Port *port, const char *role, char *client_pass)
 	ImmediateInterruptOK = false;
 
 	/* Get role info from pg_authid */
-	roleTup = SearchSysCache(AUTHNAME,
-							 PointerGetDatum(role),
-							 0, 0, 0);
+	roleTup = SearchSysCache1(AUTHNAME, PointerGetDatum(role));
 	if (!HeapTupleIsValid(roleTup))
 		return STATUS_ERROR;					/* no such user */
 
diff --git a/src/backend/optimizer/plan/planagg.c b/src/backend/optimizer/plan/planagg.c
index fd4c5c8..6550eb4 100644
--- a/src/backend/optimizer/plan/planagg.c
+++ b/src/backend/optimizer/plan/planagg.c
@@ -627,9 +627,7 @@ fetch_agg_sort_op(Oid aggfnoid)
 	Oid			aggsortop;
 
 	/* fetch aggregate entry from pg_aggregate */
-	aggTuple = SearchSysCache(AGGFNOID,
-							  ObjectIdGetDatum(aggfnoid),
-							  0, 0, 0);
+	aggTuple = SearchSysCache1(AGGFNOID, ObjectIdGetDatum(aggfnoid));
 	if (!HeapTupleIsValid(aggTuple))
 		return InvalidOid;
 	aggform = (Form_pg_aggregate) GETSTRUCT(aggTuple);
diff --git a/src/backend/optimizer/plan/setrefs.c b/src/backend/optimizer/plan/setrefs.c
index c75d1d8..b4dc162 100644
--- a/src/backend/optimizer/plan/setrefs.c
+++ b/src/backend/optimizer/plan/setrefs.c
@@ -1882,9 +1882,7 @@ record_plan_function_dependency(PlannerGlobal *glob, Oid funcid)
 		HeapTuple	func_tuple;
 		PlanInvalItem *inval_item;
 
-		func_tuple = SearchSysCache(PROCOID,
-									ObjectIdGetDatum(funcid),
-									0, 0, 0);
+		func_tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
 		if (!HeapTupleIsValid(func_tuple))
 			elog(ERROR, "cache lookup failed for function %u", funcid);
 
diff --git a/src/backend/optimizer/plan/subselect.c b/src/backend/optimizer/plan/subselect.c
index 6728060..8ba4fc8 100644
--- a/src/backend/optimizer/plan/subselect.c
+++ b/src/backend/optimizer/plan/subselect.c
@@ -832,9 +832,7 @@ hash_ok_operator(OpExpr *expr)
 	if (list_length(expr->args) != 2)
 		return false;
 	/* else must look up the operator properties */
-	tup = SearchSysCache(OPEROID,
-						 ObjectIdGetDatum(opid),
-						 0, 0, 0);
+	tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(opid));
 	if (!HeapTupleIsValid(tup))
 		elog(ERROR, "cache lookup failed for operator %u", opid);
 	optup = (Form_pg_operator) GETSTRUCT(tup);
diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c
index 357ed02..91947a4 100644
--- a/src/backend/optimizer/util/clauses.c
+++ b/src/backend/optimizer/util/clauses.c
@@ -490,9 +490,8 @@ count_agg_clauses_walker(Node *node, AggClauseCounts *counts)
 		}
 
 		/* fetch aggregate transition datatype from pg_aggregate */
-		aggTuple = SearchSysCache(AGGFNOID,
-								  ObjectIdGetDatum(aggref->aggfnoid),
-								  0, 0, 0);
+		aggTuple = SearchSysCache1(AGGFNOID,
+								   ObjectIdGetDatum(aggref->aggfnoid));
 		if (!HeapTupleIsValid(aggTuple))
 			elog(ERROR, "cache lookup failed for aggregate %u",
 				 aggref->aggfnoid);
@@ -3288,9 +3287,7 @@ simplify_function(Oid funcid, Oid result_type, int32 result_typmod,
 	 * to the function's pg_proc tuple, so fetch it just once to use in both
 	 * attempts.
 	 */
-	func_tuple = SearchSysCache(PROCOID,
-								ObjectIdGetDatum(funcid),
-								0, 0, 0);
+	func_tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
 	if (!HeapTupleIsValid(func_tuple))
 		elog(ERROR, "cache lookup failed for function %u", funcid);
 
@@ -4149,9 +4146,7 @@ inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte)
 	/*
 	 * OK, let's take a look at the function's pg_proc entry.
 	 */
-	func_tuple = SearchSysCache(PROCOID,
-								ObjectIdGetDatum(func_oid),
-								0, 0, 0);
+	func_tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(func_oid));
 	if (!HeapTupleIsValid(func_tuple))
 		elog(ERROR, "cache lookup failed for function %u", func_oid);
 	funcform = (Form_pg_proc) GETSTRUCT(func_tuple);
diff --git a/src/backend/optimizer/util/predtest.c b/src/backend/optimizer/util/predtest.c
index 9e494c0..5a2f501 100644
--- a/src/backend/optimizer/util/predtest.c
+++ b/src/backend/optimizer/util/predtest.c
@@ -1585,9 +1585,7 @@ get_btree_test_op(Oid pred_op, Oid clause_op, bool refute_it)
 	 * corresponding test operator.  This should work for any logically
 	 * consistent opfamilies.
 	 */
-	catlist = SearchSysCacheList(AMOPOPID, 1,
-								 ObjectIdGetDatum(pred_op),
-								 0, 0, 0);
+	catlist = SearchSysCacheList1(AMOPOPID, ObjectIdGetDatum(pred_op));
 
 	/*
 	 * If we couldn't find any opfamily containing the pred_op, perhaps it is
@@ -1601,9 +1599,8 @@ get_btree_test_op(Oid pred_op, Oid clause_op, bool refute_it)
 		{
 			pred_op_negated = true;
 			ReleaseSysCacheList(catlist);
-			catlist = SearchSysCacheList(AMOPOPID, 1,
-										 ObjectIdGetDatum(pred_op_negator),
-										 0, 0, 0);
+			catlist = SearchSysCacheList1(AMOPOPID,
+										  ObjectIdGetDatum(pred_op_negator));
 		}
 	}
 
@@ -1638,10 +1635,9 @@ get_btree_test_op(Oid pred_op, Oid clause_op, bool refute_it)
 		 * From the same opfamily, find a strategy number for the clause_op,
 		 * if possible
 		 */
-		clause_tuple = SearchSysCache(AMOPOPID,
-									  ObjectIdGetDatum(clause_op),
-									  ObjectIdGetDatum(opfamily_id),
-									  0, 0);
+		clause_tuple = SearchSysCache2(AMOPOPID,
+									   ObjectIdGetDatum(clause_op),
+									   ObjectIdGetDatum(opfamily_id));
 		if (HeapTupleIsValid(clause_tuple))
 		{
 			Form_pg_amop clause_form = (Form_pg_amop) GETSTRUCT(clause_tuple);
@@ -1655,10 +1651,9 @@ get_btree_test_op(Oid pred_op, Oid clause_op, bool refute_it)
 		}
 		else if (OidIsValid(clause_op_negator))
 		{
-			clause_tuple = SearchSysCache(AMOPOPID,
-										  ObjectIdGetDatum(clause_op_negator),
-										  ObjectIdGetDatum(opfamily_id),
-										  0, 0);
+			clause_tuple = SearchSysCache2(AMOPOPID,
+										   ObjectIdGetDatum(clause_op_negator),
+										   ObjectIdGetDatum(opfamily_id));
 			if (HeapTupleIsValid(clause_tuple))
 			{
 				Form_pg_amop clause_form = (Form_pg_amop) GETSTRUCT(clause_tuple);
diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c
index 3ae965c..510e0fe 100644
--- a/src/backend/parser/parse_coerce.c
+++ b/src/backend/parser/parse_coerce.c
@@ -684,9 +684,7 @@ build_coercion_expression(Node *node,
 		HeapTuple	tp;
 		Form_pg_proc procstruct;
 
-		tp = SearchSysCache(PROCOID,
-							ObjectIdGetDatum(funcId),
-							0, 0, 0);
+		tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcId));
 		if (!HeapTupleIsValid(tp))
 			elog(ERROR, "cache lookup failed for function %u", funcId);
 		procstruct = (Form_pg_proc) GETSTRUCT(tp);
@@ -1787,10 +1785,9 @@ IsBinaryCoercible(Oid srctype, Oid targettype)
 			return true;
 
 	/* Else look in pg_cast */
-	tuple = SearchSysCache(CASTSOURCETARGET,
-						   ObjectIdGetDatum(srctype),
-						   ObjectIdGetDatum(targettype),
-						   0, 0);
+	tuple = SearchSysCache2(CASTSOURCETARGET,
+							ObjectIdGetDatum(srctype),
+							ObjectIdGetDatum(targettype));
 	if (!HeapTupleIsValid(tuple))
 		return false;			/* no cast */
 	castForm = (Form_pg_cast) GETSTRUCT(tuple);
@@ -1852,10 +1849,9 @@ find_coercion_pathway(Oid targetTypeId, Oid sourceTypeId,
 		return COERCION_PATH_RELABELTYPE;
 
 	/* Look in pg_cast */
-	tuple = SearchSysCache(CASTSOURCETARGET,
-						   ObjectIdGetDatum(sourceTypeId),
-						   ObjectIdGetDatum(targetTypeId),
-						   0, 0);
+	tuple = SearchSysCache2(CASTSOURCETARGET,
+							ObjectIdGetDatum(sourceTypeId),
+							ObjectIdGetDatum(targetTypeId));
 
 	if (HeapTupleIsValid(tuple))
 	{
@@ -2017,10 +2013,9 @@ find_typmod_coercion_function(Oid typeId,
 	ReleaseSysCache(targetType);
 
 	/* Look in pg_cast */
-	tuple = SearchSysCache(CASTSOURCETARGET,
-						   ObjectIdGetDatum(typeId),
-						   ObjectIdGetDatum(typeId),
-						   0, 0);
+	tuple = SearchSysCache2(CASTSOURCETARGET,
+							ObjectIdGetDatum(typeId),
+							ObjectIdGetDatum(typeId));
 
 	if (HeapTupleIsValid(tuple))
 	{
diff --git a/src/backend/parser/parse_func.c b/src/backend/parser/parse_func.c
index 9ef6b16..516a6d4 100644
--- a/src/backend/parser/parse_func.c
+++ b/src/backend/parser/parse_func.c
@@ -1108,9 +1108,8 @@ func_get_detail(List *funcname,
 			}
 		}
 
-		ftup = SearchSysCache(PROCOID,
-							  ObjectIdGetDatum(best_candidate->oid),
-							  0, 0, 0);
+		ftup = SearchSysCache1(PROCOID,
+							   ObjectIdGetDatum(best_candidate->oid));
 		if (!HeapTupleIsValid(ftup))	/* should not happen */
 			elog(ERROR, "cache lookup failed for function %u",
 				 best_candidate->oid);
@@ -1563,9 +1562,7 @@ LookupAggNameTypeNames(List *aggname, List *argtypes, bool noError)
 	}
 
 	/* Make sure it's an aggregate */
-	ftup = SearchSysCache(PROCOID,
-						  ObjectIdGetDatum(oid),
-						  0, 0, 0);
+	ftup = SearchSysCache1(PROCOID, ObjectIdGetDatum(oid));
 	if (!HeapTupleIsValid(ftup))	/* should not happen */
 		elog(ERROR, "cache lookup failed for function %u", oid);
 	pform = (Form_pg_proc) GETSTRUCT(ftup);
diff --git a/src/backend/parser/parse_node.c b/src/backend/parser/parse_node.c
index 90ec36b..a838b1e 100644
--- a/src/backend/parser/parse_node.c
+++ b/src/backend/parser/parse_node.c
@@ -208,9 +208,7 @@ transformArrayType(Oid arrayType)
 	Form_pg_type type_struct_array;
 
 	/* Get the type tuple for the array */
-	type_tuple_array = SearchSysCache(TYPEOID,
-									  ObjectIdGetDatum(arrayType),
-									  0, 0, 0);
+	type_tuple_array = SearchSysCache1(TYPEOID, ObjectIdGetDatum(arrayType));
 	if (!HeapTupleIsValid(type_tuple_array))
 		elog(ERROR, "cache lookup failed for type %u", arrayType);
 	type_struct_array = (Form_pg_type) GETSTRUCT(type_tuple_array);
diff --git a/src/backend/parser/parse_oper.c b/src/backend/parser/parse_oper.c
index c1428f5..8659060 100644
--- a/src/backend/parser/parse_oper.c
+++ b/src/backend/parser/parse_oper.c
@@ -421,9 +421,7 @@ oper(ParseState *pstate, List *opname, Oid ltypeId, Oid rtypeId,
 		operOid = find_oper_cache_entry(&key);
 		if (OidIsValid(operOid))
 		{
-			tup = SearchSysCache(OPEROID,
-								 ObjectIdGetDatum(operOid),
-								 0, 0, 0);
+			tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operOid));
 			if (HeapTupleIsValid(tup))
 				return (Operator) tup;
 		}
@@ -463,9 +461,7 @@ oper(ParseState *pstate, List *opname, Oid ltypeId, Oid rtypeId,
 	}
 
 	if (OidIsValid(operOid))
-		tup = SearchSysCache(OPEROID,
-							 ObjectIdGetDatum(operOid),
-							 0, 0, 0);
+		tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operOid));
 
 	if (HeapTupleIsValid(tup))
 	{
@@ -571,9 +567,7 @@ right_oper(ParseState *pstate, List *op, Oid arg, bool noError, int location)
 		operOid = find_oper_cache_entry(&key);
 		if (OidIsValid(operOid))
 		{
-			tup = SearchSysCache(OPEROID,
-								 ObjectIdGetDatum(operOid),
-								 0, 0, 0);
+			tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operOid));
 			if (HeapTupleIsValid(tup))
 				return (Operator) tup;
 		}
@@ -605,9 +599,7 @@ right_oper(ParseState *pstate, List *op, Oid arg, bool noError, int location)
 	}
 
 	if (OidIsValid(operOid))
-		tup = SearchSysCache(OPEROID,
-							 ObjectIdGetDatum(operOid),
-							 0, 0, 0);
+		tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operOid));
 
 	if (HeapTupleIsValid(tup))
 	{
@@ -653,9 +645,7 @@ left_oper(ParseState *pstate, List *op, Oid arg, bool noError, int location)
 		operOid = find_oper_cache_entry(&key);
 		if (OidIsValid(operOid))
 		{
-			tup = SearchSysCache(OPEROID,
-								 ObjectIdGetDatum(operOid),
-								 0, 0, 0);
+			tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operOid));
 			if (HeapTupleIsValid(tup))
 				return (Operator) tup;
 		}
@@ -699,9 +689,7 @@ left_oper(ParseState *pstate, List *op, Oid arg, bool noError, int location)
 	}
 
 	if (OidIsValid(operOid))
-		tup = SearchSysCache(OPEROID,
-							 ObjectIdGetDatum(operOid),
-							 0, 0, 0);
+		tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operOid));
 
 	if (HeapTupleIsValid(tup))
 	{
diff --git a/src/backend/parser/parse_relation.c b/src/backend/parser/parse_relation.c
index 0e310b7..8b5d6a7 100644
--- a/src/backend/parser/parse_relation.c
+++ b/src/backend/parser/parse_relation.c
@@ -502,10 +502,9 @@ scanRTEForColumn(ParseState *pstate, RangeTblEntry *rte, char *colname,
 		if (attnum != InvalidAttrNumber)
 		{
 			/* now check to see if column actually is defined */
-			if (SearchSysCacheExists(ATTNUM,
-									 ObjectIdGetDatum(rte->relid),
-									 Int16GetDatum(attnum),
-									 0, 0))
+			if (SearchSysCacheExists2(ATTNUM,
+									  ObjectIdGetDatum(rte->relid),
+									  Int16GetDatum(attnum)))
 			{
 				var = make_var(pstate, rte, attnum, location);
 				/* Require read access to the column */
@@ -1979,10 +1978,9 @@ get_rte_attribute_type(RangeTblEntry *rte, AttrNumber attnum,
 				HeapTuple	tp;
 				Form_pg_attribute att_tup;
 
-				tp = SearchSysCache(ATTNUM,
-									ObjectIdGetDatum(rte->relid),
-									Int16GetDatum(attnum),
-									0, 0);
+				tp = SearchSysCache2(ATTNUM,
+									 ObjectIdGetDatum(rte->relid),
+									 Int16GetDatum(attnum));
 				if (!HeapTupleIsValid(tp))		/* shouldn't happen */
 					elog(ERROR, "cache lookup failed for attribute %d of relation %u",
 						 attnum, rte->relid);
@@ -2133,10 +2131,9 @@ get_rte_attribute_is_dropped(RangeTblEntry *rte, AttrNumber attnum)
 				HeapTuple	tp;
 				Form_pg_attribute att_tup;
 
-				tp = SearchSysCache(ATTNUM,
-									ObjectIdGetDatum(rte->relid),
-									Int16GetDatum(attnum),
-									0, 0);
+				tp = SearchSysCache2(ATTNUM,
+									 ObjectIdGetDatum(rte->relid),
+									 Int16GetDatum(attnum));
 				if (!HeapTupleIsValid(tp))		/* shouldn't happen */
 					elog(ERROR, "cache lookup failed for attribute %d of relation %u",
 						 attnum, rte->relid);
@@ -2186,10 +2183,9 @@ get_rte_attribute_is_dropped(RangeTblEntry *rte, AttrNumber attnum)
 					HeapTuple	tp;
 					Form_pg_attribute att_tup;
 
-					tp = SearchSysCache(ATTNUM,
-										ObjectIdGetDatum(funcrelid),
-										Int16GetDatum(attnum),
-										0, 0);
+					tp = SearchSysCache2(ATTNUM,
+										 ObjectIdGetDatum(funcrelid),
+										 Int16GetDatum(attnum));
 					if (!HeapTupleIsValid(tp))	/* shouldn't happen */
 						elog(ERROR, "cache lookup failed for attribute %d of relation %u",
 							 attnum, funcrelid);
diff --git a/src/backend/parser/parse_type.c b/src/backend/parser/parse_type.c
index 243098a..8d0932b 100644
--- a/src/backend/parser/parse_type.c
+++ b/src/backend/parser/parse_type.c
@@ -143,10 +143,9 @@ LookupTypeName(ParseState *pstate, const TypeName *typeName,
 			Oid			namespaceId;
 
 			namespaceId = LookupExplicitNamespace(schemaname);
-			typoid = GetSysCacheOid(TYPENAMENSP,
-									PointerGetDatum(typname),
-									ObjectIdGetDatum(namespaceId),
-									0, 0);
+			typoid = GetSysCacheOid2(TYPENAMENSP,
+									 PointerGetDatum(typname),
+									 ObjectIdGetDatum(namespaceId));
 		}
 		else
 		{
@@ -166,9 +165,7 @@ LookupTypeName(ParseState *pstate, const TypeName *typeName,
 		return NULL;
 	}
 
-	tup = SearchSysCache(TYPEOID,
-						 ObjectIdGetDatum(typoid),
-						 0, 0, 0);
+	tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typoid));
 	if (!HeapTupleIsValid(tup)) /* should not happen */
 		elog(ERROR, "cache lookup failed for type %u", typoid);
 
@@ -423,9 +420,7 @@ typeidType(Oid id)
 {
 	HeapTuple	tup;
 
-	tup = SearchSysCache(TYPEOID,
-						 ObjectIdGetDatum(id),
-						 0, 0, 0);
+	tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(id));
 	if (!HeapTupleIsValid(tup))
 		elog(ERROR, "cache lookup failed for type %u", id);
 	return (Type) tup;
@@ -532,9 +527,7 @@ typeidTypeRelid(Oid type_id)
 	Form_pg_type type;
 	Oid			result;
 
-	typeTuple = SearchSysCache(TYPEOID,
-							   ObjectIdGetDatum(type_id),
-							   0, 0, 0);
+	typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type_id));
 	if (!HeapTupleIsValid(typeTuple))
 		elog(ERROR, "cache lookup failed for type %u", type_id);
 
diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c
index 8aba938..e123c60 100644
--- a/src/backend/parser/parse_utilcmd.c
+++ b/src/backend/parser/parse_utilcmd.c
@@ -889,9 +889,7 @@ generateClonedIndexStmt(CreateStmtContext *cxt, Relation source_idx,
 	 * Fetch pg_class tuple of source index.  We can't use the copy in the
 	 * relcache entry because it doesn't include optional fields.
 	 */
-	ht_idxrel = SearchSysCache(RELOID,
-							   ObjectIdGetDatum(source_relid),
-							   0, 0, 0);
+	ht_idxrel = SearchSysCache1(RELOID, ObjectIdGetDatum(source_relid));
 	if (!HeapTupleIsValid(ht_idxrel))
 		elog(ERROR, "cache lookup failed for relation %u", source_relid);
 	idxrelrec = (Form_pg_class) GETSTRUCT(ht_idxrel);
@@ -943,9 +941,8 @@ generateClonedIndexStmt(CreateStmtContext *cxt, Relation source_idx,
 			HeapTuple	ht_constr;
 			Form_pg_constraint conrec;
 
-			ht_constr = SearchSysCache(CONSTROID,
-									   ObjectIdGetDatum(constraintId),
-									   0, 0, 0);
+			ht_constr = SearchSysCache1(CONSTROID,
+									    ObjectIdGetDatum(constraintId));
 			if (!HeapTupleIsValid(ht_constr))
 				elog(ERROR, "cache lookup failed for constraint %u",
 					 constraintId);
@@ -984,9 +981,8 @@ generateClonedIndexStmt(CreateStmtContext *cxt, Relation source_idx,
 					char	   *nspname;
 					List	   *namelist;
 
-					opertup = SearchSysCache(OPEROID,
-											 ObjectIdGetDatum(operid),
-											 0, 0, 0);
+					opertup = SearchSysCache1(OPEROID,
+											  ObjectIdGetDatum(operid));
 					if (!HeapTupleIsValid(opertup))
 						elog(ERROR, "cache lookup failed for operator %u",
 							 operid);
@@ -1138,9 +1134,7 @@ get_opclass(Oid opclass, Oid actual_datatype)
 	Form_pg_opclass opc_rec;
 	List	   *result = NIL;
 
-	ht_opc = SearchSysCache(CLAOID,
-							ObjectIdGetDatum(opclass),
-							0, 0, 0);
+	ht_opc = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclass));
 	if (!HeapTupleIsValid(ht_opc))
 		elog(ERROR, "cache lookup failed for opclass %u", opclass);
 	opc_rec = (Form_pg_opclass) GETSTRUCT(ht_opc);
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index ae81658..785e569 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1863,9 +1863,7 @@ do_autovacuum(void)
 	 * zero in template and nonconnectable databases, else the system-wide
 	 * default.
 	 */
-	tuple = SearchSysCache(DATABASEOID,
-						   ObjectIdGetDatum(MyDatabaseId),
-						   0, 0, 0);
+	tuple = SearchSysCache1(DATABASEOID, ObjectIdGetDatum(MyDatabaseId));
 	if (!HeapTupleIsValid(tuple))
 		elog(ERROR, "cache lookup failed for database %u", MyDatabaseId);
 	dbForm = (Form_pg_database) GETSTRUCT(tuple);
@@ -2379,9 +2377,7 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	dbentry = pgstat_fetch_stat_dbentry(MyDatabaseId);
 
 	/* fetch the relation's relcache entry */
-	classTup = SearchSysCacheCopy(RELOID,
-								  ObjectIdGetDatum(relid),
-								  0, 0, 0);
+	classTup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relid));
 	if (!HeapTupleIsValid(classTup))
 		return NULL;
 	classForm = (Form_pg_class) GETSTRUCT(classTup);
diff --git a/src/backend/rewrite/rewriteDefine.c b/src/backend/rewrite/rewriteDefine.c
index 5d9aa66..68be146 100644
--- a/src/backend/rewrite/rewriteDefine.c
+++ b/src/backend/rewrite/rewriteDefine.c
@@ -96,10 +96,9 @@ InsertRule(char *rulname,
 	/*
 	 * Check to see if we are replacing an existing tuple
 	 */
-	oldtup = SearchSysCache(RULERELNAME,
-							ObjectIdGetDatum(eventrel_oid),
-							PointerGetDatum(rulname),
-							0, 0);
+	oldtup = SearchSysCache2(RULERELNAME,
+							 ObjectIdGetDatum(eventrel_oid),
+							 PointerGetDatum(rulname));
 
 	if (HeapTupleIsValid(oldtup))
 	{
@@ -679,10 +678,9 @@ EnableDisableRule(Relation rel, const char *rulename,
 	 * Find the rule tuple to change.
 	 */
 	pg_rewrite_desc = heap_open(RewriteRelationId, RowExclusiveLock);
-	ruletup = SearchSysCacheCopy(RULERELNAME,
-								 ObjectIdGetDatum(owningRel),
-								 PointerGetDatum(rulename),
-								 0, 0);
+	ruletup = SearchSysCacheCopy2(RULERELNAME,
+								  ObjectIdGetDatum(owningRel),
+								  PointerGetDatum(rulename));
 	if (!HeapTupleIsValid(ruletup))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -742,10 +740,9 @@ RenameRewriteRule(Oid owningRel, const char *oldName,
 
 	pg_rewrite_desc = heap_open(RewriteRelationId, RowExclusiveLock);
 
-	ruletup = SearchSysCacheCopy(RULERELNAME,
-								 ObjectIdGetDatum(owningRel),
-								 PointerGetDatum(oldName),
-								 0, 0);
+	ruletup = SearchSysCacheCopy2(RULERELNAME,
+								  ObjectIdGetDatum(owningRel),
+								  PointerGetDatum(oldName));
 	if (!HeapTupleIsValid(ruletup))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
diff --git a/src/backend/rewrite/rewriteRemove.c b/src/backend/rewrite/rewriteRemove.c
index d4ac32e..c1c5ce9 100644
--- a/src/backend/rewrite/rewriteRemove.c
+++ b/src/backend/rewrite/rewriteRemove.c
@@ -47,10 +47,9 @@ RemoveRewriteRule(Oid owningRel, const char *ruleName, DropBehavior behavior,
 	/*
 	 * Find the tuple for the target rule.
 	 */
-	tuple = SearchSysCache(RULERELNAME,
-						   ObjectIdGetDatum(owningRel),
-						   PointerGetDatum(ruleName),
-						   0, 0);
+	tuple = SearchSysCache2(RULERELNAME,
+							ObjectIdGetDatum(owningRel),
+							PointerGetDatum(ruleName));
 
 	/*
 	 * complain if no rule with such name exists
diff --git a/src/backend/rewrite/rewriteSupport.c b/src/backend/rewrite/rewriteSupport.c
index af41468..27d21e3 100644
--- a/src/backend/rewrite/rewriteSupport.c
+++ b/src/backend/rewrite/rewriteSupport.c
@@ -28,10 +28,9 @@
 bool
 IsDefinedRewriteRule(Oid owningRel, const char *ruleName)
 {
-	return SearchSysCacheExists(RULERELNAME,
-								ObjectIdGetDatum(owningRel),
-								PointerGetDatum(ruleName),
-								0, 0);
+	return SearchSysCacheExists2(RULERELNAME,
+								 ObjectIdGetDatum(owningRel),
+								 PointerGetDatum(ruleName));
 }
 
 
@@ -60,9 +59,7 @@ SetRelationRuleStatus(Oid relationId, bool relHasRules,
 	 * Find the tuple to update in pg_class, using syscache for the lookup.
 	 */
 	relationRelation = heap_open(RelationRelationId, RowExclusiveLock);
-	tuple = SearchSysCacheCopy(RELOID,
-							   ObjectIdGetDatum(relationId),
-							   0, 0, 0);
+	tuple = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relationId));
 	if (!HeapTupleIsValid(tuple))
 		elog(ERROR, "cache lookup failed for relation %u", relationId);
 	classForm = (Form_pg_class) GETSTRUCT(tuple);
diff --git a/src/backend/tcop/fastpath.c b/src/backend/tcop/fastpath.c
index cc4573e..575fa86 100644
--- a/src/backend/tcop/fastpath.c
+++ b/src/backend/tcop/fastpath.c
@@ -214,9 +214,7 @@ fetch_fp_info(Oid func_id, struct fp_info * fip)
 
 	fmgr_info(func_id, &fip->flinfo);
 
-	func_htp = SearchSysCache(PROCOID,
-							  ObjectIdGetDatum(func_id),
-							  0, 0, 0);
+	func_htp = SearchSysCache1(PROCOID, ObjectIdGetDatum(func_id));
 	if (!HeapTupleIsValid(func_htp))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_FUNCTION),
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index 3f70e5f..7bb02dc 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -75,9 +75,7 @@ CheckRelationOwnership(RangeVar *rel, bool noCatalogs)
 	HeapTuple	tuple;
 
 	relOid = RangeVarGetRelid(rel, false);
-	tuple = SearchSysCache(RELOID,
-						   ObjectIdGetDatum(relOid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relOid));
 	if (!HeapTupleIsValid(tuple))		/* should not happen */
 		elog(ERROR, "cache lookup failed for relation %u", relOid);
 
diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c
index 0e05234..1c612ee 100644
--- a/src/backend/utils/adt/acl.c
+++ b/src/backend/utils/adt/acl.c
@@ -599,9 +599,7 @@ aclitemout(PG_FUNCTION_ARGS)
 
 	if (aip->ai_grantee != ACL_ID_PUBLIC)
 	{
-		htup = SearchSysCache(AUTHOID,
-							  ObjectIdGetDatum(aip->ai_grantee),
-							  0, 0, 0);
+		htup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(aip->ai_grantee));
 		if (HeapTupleIsValid(htup))
 		{
 			putid(p, NameStr(((Form_pg_authid) GETSTRUCT(htup))->rolname));
@@ -629,9 +627,7 @@ aclitemout(PG_FUNCTION_ARGS)
 	*p++ = '/';
 	*p = '\0';
 
-	htup = SearchSysCache(AUTHOID,
-						  ObjectIdGetDatum(aip->ai_grantor),
-						  0, 0, 0);
+	htup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(aip->ai_grantor));
 	if (HeapTupleIsValid(htup))
 	{
 		putid(p, NameStr(((Form_pg_authid) GETSTRUCT(htup))->rolname));
@@ -1846,9 +1842,7 @@ has_table_privilege_name_id(PG_FUNCTION_ARGS)
 	roleid = get_roleid_checked(NameStr(*username));
 	mode = convert_table_priv_string(priv_type_text);
 
-	if (!SearchSysCacheExists(RELOID,
-							  ObjectIdGetDatum(tableoid),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(tableoid)))
 		PG_RETURN_NULL();
 
 	aclresult = pg_class_aclcheck(tableoid, roleid, mode);
@@ -1874,9 +1868,7 @@ has_table_privilege_id(PG_FUNCTION_ARGS)
 	roleid = GetUserId();
 	mode = convert_table_priv_string(priv_type_text);
 
-	if (!SearchSysCacheExists(RELOID,
-							  ObjectIdGetDatum(tableoid),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(tableoid)))
 		PG_RETURN_NULL();
 
 	aclresult = pg_class_aclcheck(tableoid, roleid, mode);
@@ -1923,9 +1915,7 @@ has_table_privilege_id_id(PG_FUNCTION_ARGS)
 
 	mode = convert_table_priv_string(priv_type_text);
 
-	if (!SearchSysCacheExists(RELOID,
-							  ObjectIdGetDatum(tableoid),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(tableoid)))
 		PG_RETURN_NULL();
 
 	aclresult = pg_class_aclcheck(tableoid, roleid, mode);
@@ -2278,9 +2268,7 @@ has_any_column_privilege_name_id(PG_FUNCTION_ARGS)
 	roleid = get_roleid_checked(NameStr(*username));
 	mode = convert_column_priv_string(priv_type_text);
 
-	if (!SearchSysCacheExists(RELOID,
-							  ObjectIdGetDatum(tableoid),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(tableoid)))
 		PG_RETURN_NULL();
 
 	/* First check at table level, then examine each column if needed */
@@ -2310,9 +2298,7 @@ has_any_column_privilege_id(PG_FUNCTION_ARGS)
 	roleid = GetUserId();
 	mode = convert_column_priv_string(priv_type_text);
 
-	if (!SearchSysCacheExists(RELOID,
-							  ObjectIdGetDatum(tableoid),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(tableoid)))
 		PG_RETURN_NULL();
 
 	/* First check at table level, then examine each column if needed */
@@ -2367,9 +2353,7 @@ has_any_column_privilege_id_id(PG_FUNCTION_ARGS)
 
 	mode = convert_column_priv_string(priv_type_text);
 
-	if (!SearchSysCacheExists(RELOID,
-							  ObjectIdGetDatum(tableoid),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(tableoid)))
 		PG_RETURN_NULL();
 
 	/* First check at table level, then examine each column if needed */
@@ -2417,9 +2401,7 @@ column_privilege_check(Oid tableoid, AttrNumber attnum,
 	 * here and there.	So if we see the row in the syscache, so will
 	 * pg_class_aclcheck.
 	 */
-	if (!SearchSysCacheExists(RELOID,
-							  ObjectIdGetDatum(tableoid),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(tableoid)))
 		return -1;
 
 	aclresult = pg_class_aclcheck(tableoid, roleid, mode);
@@ -2432,10 +2414,9 @@ column_privilege_check(Oid tableoid, AttrNumber attnum,
 	 * check for dropped attribute first, and we rely on the syscache not to
 	 * notice a concurrent drop before pg_attribute_aclcheck fetches the row.
 	 */
-	attTuple = SearchSysCache(ATTNUM,
-							  ObjectIdGetDatum(tableoid),
-							  Int16GetDatum(attnum),
-							  0, 0);
+	attTuple = SearchSysCache2(ATTNUM,
+							   ObjectIdGetDatum(tableoid),
+							   Int16GetDatum(attnum));
 	if (!HeapTupleIsValid(attTuple))
 		return -1;
 	attributeForm = (Form_pg_attribute) GETSTRUCT(attTuple);
@@ -2893,9 +2874,7 @@ has_database_privilege_name_id(PG_FUNCTION_ARGS)
 	roleid = get_roleid_checked(NameStr(*username));
 	mode = convert_database_priv_string(priv_type_text);
 
-	if (!SearchSysCacheExists(DATABASEOID,
-							  ObjectIdGetDatum(databaseoid),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(DATABASEOID, ObjectIdGetDatum(databaseoid)))
 		PG_RETURN_NULL();
 
 	aclresult = pg_database_aclcheck(databaseoid, roleid, mode);
@@ -2921,9 +2900,7 @@ has_database_privilege_id(PG_FUNCTION_ARGS)
 	roleid = GetUserId();
 	mode = convert_database_priv_string(priv_type_text);
 
-	if (!SearchSysCacheExists(DATABASEOID,
-							  ObjectIdGetDatum(databaseoid),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(DATABASEOID, ObjectIdGetDatum(databaseoid)))
 		PG_RETURN_NULL();
 
 	aclresult = pg_database_aclcheck(databaseoid, roleid, mode);
@@ -2970,9 +2947,7 @@ has_database_privilege_id_id(PG_FUNCTION_ARGS)
 
 	mode = convert_database_priv_string(priv_type_text);
 
-	if (!SearchSysCacheExists(DATABASEOID,
-							  ObjectIdGetDatum(databaseoid),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(DATABASEOID, ObjectIdGetDatum(databaseoid)))
 		PG_RETURN_NULL();
 
 	aclresult = pg_database_aclcheck(databaseoid, roleid, mode);
@@ -3286,9 +3261,7 @@ has_function_privilege_name_id(PG_FUNCTION_ARGS)
 	roleid = get_roleid_checked(NameStr(*username));
 	mode = convert_function_priv_string(priv_type_text);
 
-	if (!SearchSysCacheExists(PROCOID,
-							  ObjectIdGetDatum(functionoid),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(PROCOID, ObjectIdGetDatum(functionoid)))
 		PG_RETURN_NULL();
 
 	aclresult = pg_proc_aclcheck(functionoid, roleid, mode);
@@ -3314,9 +3287,7 @@ has_function_privilege_id(PG_FUNCTION_ARGS)
 	roleid = GetUserId();
 	mode = convert_function_priv_string(priv_type_text);
 
-	if (!SearchSysCacheExists(PROCOID,
-							  ObjectIdGetDatum(functionoid),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(PROCOID, ObjectIdGetDatum(functionoid)))
 		PG_RETURN_NULL();
 
 	aclresult = pg_proc_aclcheck(functionoid, roleid, mode);
@@ -3363,9 +3334,7 @@ has_function_privilege_id_id(PG_FUNCTION_ARGS)
 
 	mode = convert_function_priv_string(priv_type_text);
 
-	if (!SearchSysCacheExists(PROCOID,
-							  ObjectIdGetDatum(functionoid),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(PROCOID, ObjectIdGetDatum(functionoid)))
 		PG_RETURN_NULL();
 
 	aclresult = pg_proc_aclcheck(functionoid, roleid, mode);
@@ -3492,9 +3461,7 @@ has_language_privilege_name_id(PG_FUNCTION_ARGS)
 	roleid = get_roleid_checked(NameStr(*username));
 	mode = convert_language_priv_string(priv_type_text);
 
-	if (!SearchSysCacheExists(LANGOID,
-							  ObjectIdGetDatum(languageoid),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(LANGOID, ObjectIdGetDatum(languageoid)))
 		PG_RETURN_NULL();
 
 	aclresult = pg_language_aclcheck(languageoid, roleid, mode);
@@ -3520,9 +3487,7 @@ has_language_privilege_id(PG_FUNCTION_ARGS)
 	roleid = GetUserId();
 	mode = convert_language_priv_string(priv_type_text);
 
-	if (!SearchSysCacheExists(LANGOID,
-							  ObjectIdGetDatum(languageoid),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(LANGOID, ObjectIdGetDatum(languageoid)))
 		PG_RETURN_NULL();
 
 	aclresult = pg_language_aclcheck(languageoid, roleid, mode);
@@ -3569,9 +3534,7 @@ has_language_privilege_id_id(PG_FUNCTION_ARGS)
 
 	mode = convert_language_priv_string(priv_type_text);
 
-	if (!SearchSysCacheExists(LANGOID,
-							  ObjectIdGetDatum(languageoid),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(LANGOID, ObjectIdGetDatum(languageoid)))
 		PG_RETURN_NULL();
 
 	aclresult = pg_language_aclcheck(languageoid, roleid, mode);
@@ -3592,9 +3555,7 @@ convert_language_name(text *languagename)
 	char	   *langname = text_to_cstring(languagename);
 	Oid			oid;
 
-	oid = GetSysCacheOid(LANGNAME,
-						 CStringGetDatum(langname),
-						 0, 0, 0);
+	oid = GetSysCacheOid1(LANGNAME, CStringGetDatum(langname));
 	if (!OidIsValid(oid))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -3698,9 +3659,7 @@ has_schema_privilege_name_id(PG_FUNCTION_ARGS)
 	roleid = get_roleid_checked(NameStr(*username));
 	mode = convert_schema_priv_string(priv_type_text);
 
-	if (!SearchSysCacheExists(NAMESPACEOID,
-							  ObjectIdGetDatum(schemaoid),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(NAMESPACEOID, ObjectIdGetDatum(schemaoid)))
 		PG_RETURN_NULL();
 
 	aclresult = pg_namespace_aclcheck(schemaoid, roleid, mode);
@@ -3726,9 +3685,7 @@ has_schema_privilege_id(PG_FUNCTION_ARGS)
 	roleid = GetUserId();
 	mode = convert_schema_priv_string(priv_type_text);
 
-	if (!SearchSysCacheExists(NAMESPACEOID,
-							  ObjectIdGetDatum(schemaoid),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(NAMESPACEOID, ObjectIdGetDatum(schemaoid)))
 		PG_RETURN_NULL();
 
 	aclresult = pg_namespace_aclcheck(schemaoid, roleid, mode);
@@ -3775,9 +3732,7 @@ has_schema_privilege_id_id(PG_FUNCTION_ARGS)
 
 	mode = convert_schema_priv_string(priv_type_text);
 
-	if (!SearchSysCacheExists(NAMESPACEOID,
-							  ObjectIdGetDatum(schemaoid),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(NAMESPACEOID, ObjectIdGetDatum(schemaoid)))
 		PG_RETURN_NULL();
 
 	aclresult = pg_namespace_aclcheck(schemaoid, roleid, mode);
@@ -3798,9 +3753,7 @@ convert_schema_name(text *schemaname)
 	char	   *nspname = text_to_cstring(schemaname);
 	Oid			oid;
 
-	oid = GetSysCacheOid(NAMESPACENAME,
-						 CStringGetDatum(nspname),
-						 0, 0, 0);
+	oid = GetSysCacheOid1(NAMESPACENAME, CStringGetDatum(nspname));
 	if (!OidIsValid(oid))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_SCHEMA),
@@ -4443,9 +4396,7 @@ has_rolinherit(Oid roleid)
 	bool		result = false;
 	HeapTuple	utup;
 
-	utup = SearchSysCache(AUTHOID,
-						  ObjectIdGetDatum(roleid),
-						  0, 0, 0);
+	utup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid));
 	if (HeapTupleIsValid(utup))
 	{
 		result = ((Form_pg_authid) GETSTRUCT(utup))->rolinherit;
@@ -4505,9 +4456,8 @@ roles_has_privs_of(Oid roleid)
 			continue;
 
 		/* Find roles that memberid is directly a member of */
-		memlist = SearchSysCacheList(AUTHMEMMEMROLE, 1,
-									 ObjectIdGetDatum(memberid),
-									 0, 0, 0);
+		memlist = SearchSysCacheList1(AUTHMEMMEMROLE,
+									  ObjectIdGetDatum(memberid));
 		for (i = 0; i < memlist->n_members; i++)
 		{
 			HeapTuple	tup = &memlist->members[i]->tuple;
@@ -4585,9 +4535,8 @@ roles_is_member_of(Oid roleid)
 		int			i;
 
 		/* Find roles that memberid is directly a member of */
-		memlist = SearchSysCacheList(AUTHMEMMEMROLE, 1,
-									 ObjectIdGetDatum(memberid),
-									 0, 0, 0);
+		memlist = SearchSysCacheList1(AUTHMEMMEMROLE,
+									  ObjectIdGetDatum(memberid));
 		for (i = 0; i < memlist->n_members; i++)
 		{
 			HeapTuple	tup = &memlist->members[i]->tuple;
@@ -4744,9 +4693,8 @@ is_admin_of_role(Oid member, Oid role)
 		int			i;
 
 		/* Find roles that memberid is directly a member of */
-		memlist = SearchSysCacheList(AUTHMEMMEMROLE, 1,
-									 ObjectIdGetDatum(memberid),
-									 0, 0, 0);
+		memlist = SearchSysCacheList1(AUTHMEMMEMROLE,
+									  ObjectIdGetDatum(memberid));
 		for (i = 0; i < memlist->n_members; i++)
 		{
 			HeapTuple	tup = &memlist->members[i]->tuple;
diff --git a/src/backend/utils/adt/dbsize.c b/src/backend/utils/adt/dbsize.c
index 4e0a0a8..d59f7df 100644
--- a/src/backend/utils/adt/dbsize.c
+++ b/src/backend/utils/adt/dbsize.c
@@ -531,9 +531,7 @@ pg_relation_filenode(PG_FUNCTION_ARGS)
 	HeapTuple	tuple;
 	Form_pg_class relform;
 
-	tuple = SearchSysCache(RELOID,
-						   ObjectIdGetDatum(relid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
 	if (!HeapTupleIsValid(tuple))
 		PG_RETURN_NULL();
 	relform = (Form_pg_class) GETSTRUCT(tuple);
@@ -580,9 +578,7 @@ pg_relation_filepath(PG_FUNCTION_ARGS)
 	RelFileNode rnode;
 	char	   *path;
 
-	tuple = SearchSysCache(RELOID,
-						   ObjectIdGetDatum(relid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
 	if (!HeapTupleIsValid(tuple))
 		PG_RETURN_NULL();
 	relform = (Form_pg_class) GETSTRUCT(tuple);
diff --git a/src/backend/utils/adt/enum.c b/src/backend/utils/adt/enum.c
index 004655c..d444f51 100644
--- a/src/backend/utils/adt/enum.c
+++ b/src/backend/utils/adt/enum.c
@@ -45,10 +45,9 @@ enum_in(PG_FUNCTION_ARGS)
 						format_type_be(enumtypoid),
 						name)));
 
-	tup = SearchSysCache(ENUMTYPOIDNAME,
-						 ObjectIdGetDatum(enumtypoid),
-						 CStringGetDatum(name),
-						 0, 0);
+	tup = SearchSysCache2(ENUMTYPOIDNAME,
+						  ObjectIdGetDatum(enumtypoid),
+						  CStringGetDatum(name));
 	if (!HeapTupleIsValid(tup))
 		ereport(ERROR,
 				(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
@@ -75,9 +74,7 @@ enum_out(PG_FUNCTION_ARGS)
 	HeapTuple	tup;
 	Form_pg_enum en;
 
-	tup = SearchSysCache(ENUMOID,
-						 ObjectIdGetDatum(enumval),
-						 0, 0, 0);
+	tup = SearchSysCache1(ENUMOID, ObjectIdGetDatum(enumval));
 	if (!HeapTupleIsValid(tup))
 		ereport(ERROR,
 				(errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
@@ -113,10 +110,9 @@ enum_recv(PG_FUNCTION_ARGS)
 						format_type_be(enumtypoid),
 						name)));
 
-	tup = SearchSysCache(ENUMTYPOIDNAME,
-						 ObjectIdGetDatum(enumtypoid),
-						 CStringGetDatum(name),
-						 0, 0);
+	tup = SearchSysCache2(ENUMTYPOIDNAME,
+						  ObjectIdGetDatum(enumtypoid),
+						  CStringGetDatum(name));
 	if (!HeapTupleIsValid(tup))
 		ereport(ERROR,
 				(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
@@ -141,9 +137,7 @@ enum_send(PG_FUNCTION_ARGS)
 	HeapTuple	tup;
 	Form_pg_enum en;
 
-	tup = SearchSysCache(ENUMOID,
-						 ObjectIdGetDatum(enumval),
-						 0, 0, 0);
+	tup = SearchSysCache1(ENUMOID, ObjectIdGetDatum(enumval));
 	if (!HeapTupleIsValid(tup))
 		ereport(ERROR,
 				(errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
@@ -269,9 +263,7 @@ enum_first(PG_FUNCTION_ARGS)
 				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
 				 errmsg("could not determine actual enum type")));
 
-	list = SearchSysCacheList(ENUMTYPOIDNAME, 1,
-							  ObjectIdGetDatum(enumtypoid),
-							  0, 0, 0);
+	list = SearchSysCacheList1(ENUMTYPOIDNAME, ObjectIdGetDatum(enumtypoid));
 	num = list->n_members;
 	for (i = 0; i < num; i++)
 	{
@@ -310,9 +302,7 @@ enum_last(PG_FUNCTION_ARGS)
 				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
 				 errmsg("could not determine actual enum type")));
 
-	list = SearchSysCacheList(ENUMTYPOIDNAME, 1,
-							  ObjectIdGetDatum(enumtypoid),
-							  0, 0, 0);
+	list = SearchSysCacheList1(ENUMTYPOIDNAME, ObjectIdGetDatum(enumtypoid));
 	num = list->n_members;
 	for (i = 0; i < num; i++)
 	{
@@ -393,9 +383,7 @@ enum_range_internal(Oid enumtypoid, Oid lower, Oid upper)
 				j;
 	Datum	   *elems;
 
-	list = SearchSysCacheList(ENUMTYPOIDNAME, 1,
-							  ObjectIdGetDatum(enumtypoid),
-							  0, 0, 0);
+	list = SearchSysCacheList1(ENUMTYPOIDNAME, ObjectIdGetDatum(enumtypoid));
 	total = list->n_members;
 
 	elems = (Datum *) palloc(total * sizeof(Datum));
diff --git a/src/backend/utils/adt/format_type.c b/src/backend/utils/adt/format_type.c
index 07809e7..cd19dfb 100644
--- a/src/backend/utils/adt/format_type.c
+++ b/src/backend/utils/adt/format_type.c
@@ -123,9 +123,7 @@ format_type_internal(Oid type_oid, int32 typemod,
 	if (type_oid == InvalidOid && allow_invalid)
 		return pstrdup("-");
 
-	tuple = SearchSysCache(TYPEOID,
-						   ObjectIdGetDatum(type_oid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type_oid));
 	if (!HeapTupleIsValid(tuple))
 	{
 		if (allow_invalid)
@@ -151,9 +149,7 @@ format_type_internal(Oid type_oid, int32 typemod,
 	{
 		/* Switch our attention to the array element type */
 		ReleaseSysCache(tuple);
-		tuple = SearchSysCache(TYPEOID,
-							   ObjectIdGetDatum(array_base_type),
-							   0, 0, 0);
+		tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(array_base_type));
 		if (!HeapTupleIsValid(tuple))
 		{
 			if (allow_invalid)
diff --git a/src/backend/utils/adt/regproc.c b/src/backend/utils/adt/regproc.c
index 7214d94..2450cc7 100644
--- a/src/backend/utils/adt/regproc.c
+++ b/src/backend/utils/adt/regproc.c
@@ -164,9 +164,7 @@ regprocout(PG_FUNCTION_ARGS)
 		PG_RETURN_CSTRING(result);
 	}
 
-	proctup = SearchSysCache(PROCOID,
-							 ObjectIdGetDatum(proid),
-							 0, 0, 0);
+	proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(proid));
 
 	if (HeapTupleIsValid(proctup))
 	{
@@ -307,9 +305,7 @@ format_procedure(Oid procedure_oid)
 	char	   *result;
 	HeapTuple	proctup;
 
-	proctup = SearchSysCache(PROCOID,
-							 ObjectIdGetDatum(procedure_oid),
-							 0, 0, 0);
+	proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(procedure_oid));
 
 	if (HeapTupleIsValid(proctup))
 	{
@@ -513,9 +509,7 @@ regoperout(PG_FUNCTION_ARGS)
 		PG_RETURN_CSTRING(result);
 	}
 
-	opertup = SearchSysCache(OPEROID,
-							 ObjectIdGetDatum(oprid),
-							 0, 0, 0);
+	opertup = SearchSysCache1(OPEROID, ObjectIdGetDatum(oprid));
 
 	if (HeapTupleIsValid(opertup))
 	{
@@ -663,9 +657,7 @@ format_operator(Oid operator_oid)
 	char	   *result;
 	HeapTuple	opertup;
 
-	opertup = SearchSysCache(OPEROID,
-							 ObjectIdGetDatum(operator_oid),
-							 0, 0, 0);
+	opertup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operator_oid));
 
 	if (HeapTupleIsValid(opertup))
 	{
@@ -852,9 +844,7 @@ regclassout(PG_FUNCTION_ARGS)
 		PG_RETURN_CSTRING(result);
 	}
 
-	classtup = SearchSysCache(RELOID,
-							  ObjectIdGetDatum(classid),
-							  0, 0, 0);
+	classtup = SearchSysCache1(RELOID, ObjectIdGetDatum(classid));
 
 	if (HeapTupleIsValid(classtup))
 	{
@@ -1015,9 +1005,7 @@ regtypeout(PG_FUNCTION_ARGS)
 		PG_RETURN_CSTRING(result);
 	}
 
-	typetup = SearchSysCache(TYPEOID,
-							 ObjectIdGetDatum(typid),
-							 0, 0, 0);
+	typetup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
 
 	if (HeapTupleIsValid(typetup))
 	{
@@ -1129,9 +1117,7 @@ regconfigout(PG_FUNCTION_ARGS)
 		PG_RETURN_CSTRING(result);
 	}
 
-	cfgtup = SearchSysCache(TSCONFIGOID,
-							ObjectIdGetDatum(cfgid),
-							0, 0, 0);
+	cfgtup = SearchSysCache1(TSCONFIGOID, ObjectIdGetDatum(cfgid));
 
 	if (HeapTupleIsValid(cfgtup))
 	{
@@ -1241,9 +1227,7 @@ regdictionaryout(PG_FUNCTION_ARGS)
 		PG_RETURN_CSTRING(result);
 	}
 
-	dicttup = SearchSysCache(TSDICTOID,
-							 ObjectIdGetDatum(dictid),
-							 0, 0, 0);
+	dicttup = SearchSysCache1(TSDICTOID, ObjectIdGetDatum(dictid));
 
 	if (HeapTupleIsValid(dicttup))
 	{
diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c
index 5966773..9db070d 100644
--- a/src/backend/utils/adt/ri_triggers.c
+++ b/src/backend/utils/adt/ri_triggers.c
@@ -2901,9 +2901,7 @@ ri_GenerateQual(StringInfo buf,
 	char	   *oprname;
 	char	   *nspname;
 
-	opertup = SearchSysCache(OPEROID,
-							 ObjectIdGetDatum(opoid),
-							 0, 0, 0);
+	opertup = SearchSysCache1(OPEROID, ObjectIdGetDatum(opoid));
 	if (!HeapTupleIsValid(opertup))
 		elog(ERROR, "cache lookup failed for operator %u", opoid);
 	operform = (Form_pg_operator) GETSTRUCT(opertup);
@@ -2940,9 +2938,7 @@ ri_add_cast_to(StringInfo buf, Oid typid)
 	char	   *typname;
 	char	   *nspname;
 
-	typetup = SearchSysCache(TYPEOID,
-							 ObjectIdGetDatum(typid),
-							 0, 0, 0);
+	typetup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
 	if (!HeapTupleIsValid(typetup))
 		elog(ERROR, "cache lookup failed for type %u", typid);
 	typform = (Form_pg_type) GETSTRUCT(typetup);
@@ -3071,9 +3067,7 @@ ri_FetchConstraintInfo(RI_ConstraintInfo *riinfo,
 				 errhint("Remove this referential integrity trigger and its mates, then do ALTER TABLE ADD CONSTRAINT.")));
 
 	/* OK, fetch the tuple */
-	tup = SearchSysCache(CONSTROID,
-						 ObjectIdGetDatum(constraintOid),
-						 0, 0, 0);
+	tup = SearchSysCache1(CONSTROID, ObjectIdGetDatum(constraintOid));
 	if (!HeapTupleIsValid(tup)) /* should not happen */
 		elog(ERROR, "cache lookup failed for constraint %u", constraintOid);
 	conForm = (Form_pg_constraint) GETSTRUCT(tup);
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 1651350..1712676 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -774,9 +774,7 @@ pg_get_indexdef_worker(Oid indexrelid, int colno,
 	/*
 	 * Fetch the pg_index tuple by the Oid of the index
 	 */
-	ht_idx = SearchSysCache(INDEXRELID,
-							ObjectIdGetDatum(indexrelid),
-							0, 0, 0);
+	ht_idx = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexrelid));
 	if (!HeapTupleIsValid(ht_idx))
 		elog(ERROR, "cache lookup failed for index %u", indexrelid);
 	idxrec = (Form_pg_index) GETSTRUCT(ht_idx);
@@ -797,9 +795,7 @@ pg_get_indexdef_worker(Oid indexrelid, int colno,
 	/*
 	 * Fetch the pg_class tuple of the index relation
 	 */
-	ht_idxrel = SearchSysCache(RELOID,
-							   ObjectIdGetDatum(indexrelid),
-							   0, 0, 0);
+	ht_idxrel = SearchSysCache1(RELOID, ObjectIdGetDatum(indexrelid));
 	if (!HeapTupleIsValid(ht_idxrel))
 		elog(ERROR, "cache lookup failed for relation %u", indexrelid);
 	idxrelrec = (Form_pg_class) GETSTRUCT(ht_idxrel);
@@ -807,9 +803,7 @@ pg_get_indexdef_worker(Oid indexrelid, int colno,
 	/*
 	 * Fetch the pg_am tuple of the index' access method
 	 */
-	ht_am = SearchSysCache(AMOID,
-						   ObjectIdGetDatum(idxrelrec->relam),
-						   0, 0, 0);
+	ht_am = SearchSysCache1(AMOID, ObjectIdGetDatum(idxrelrec->relam));
 	if (!HeapTupleIsValid(ht_am))
 		elog(ERROR, "cache lookup failed for access method %u",
 			 idxrelrec->relam);
@@ -1048,9 +1042,7 @@ pg_get_constraintdef_worker(Oid constraintId, bool fullCommand,
 	Form_pg_constraint conForm;
 	StringInfoData buf;
 
-	tup = SearchSysCache(CONSTROID,
-						 ObjectIdGetDatum(constraintId),
-						 0, 0, 0);
+	tup = SearchSysCache1(CONSTROID, ObjectIdGetDatum(constraintId));
 	if (!HeapTupleIsValid(tup)) /* should not happen */
 		elog(ERROR, "cache lookup failed for constraint %u", constraintId);
 	conForm = (Form_pg_constraint) GETSTRUCT(tup);
@@ -1480,9 +1472,7 @@ pg_get_userbyid(PG_FUNCTION_ARGS)
 	/*
 	 * Get the pg_authid entry and print the result
 	 */
-	roletup = SearchSysCache(AUTHOID,
-							 ObjectIdGetDatum(roleid),
-							 0, 0, 0);
+	roletup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid));
 	if (HeapTupleIsValid(roletup))
 	{
 		role_rec = (Form_pg_authid) GETSTRUCT(roletup);
@@ -1581,9 +1571,7 @@ pg_get_serial_sequence(PG_FUNCTION_ARGS)
 		char	   *result;
 
 		/* Get the sequence's pg_class entry */
-		classtup = SearchSysCache(RELOID,
-								  ObjectIdGetDatum(sequenceId),
-								  0, 0, 0);
+		classtup = SearchSysCache1(RELOID, ObjectIdGetDatum(sequenceId));
 		if (!HeapTupleIsValid(classtup))
 			elog(ERROR, "cache lookup failed for relation %u", sequenceId);
 		classtuple = (Form_pg_class) GETSTRUCT(classtup);
@@ -1633,9 +1621,7 @@ pg_get_functiondef(PG_FUNCTION_ARGS)
 	initStringInfo(&buf);
 
 	/* Look up the function */
-	proctup = SearchSysCache(PROCOID,
-							 ObjectIdGetDatum(funcid),
-							 0, 0, 0);
+	proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
 	if (!HeapTupleIsValid(proctup))
 		elog(ERROR, "cache lookup failed for function %u", funcid);
 	proc = (Form_pg_proc) GETSTRUCT(proctup);
@@ -1647,9 +1633,7 @@ pg_get_functiondef(PG_FUNCTION_ARGS)
 				 errmsg("\"%s\" is an aggregate function", name)));
 
 	/* Need its pg_language tuple for the language name */
-	langtup = SearchSysCache(LANGOID,
-							 ObjectIdGetDatum(proc->prolang),
-							 0, 0, 0);
+	langtup = SearchSysCache1(LANGOID, ObjectIdGetDatum(proc->prolang));
 	if (!HeapTupleIsValid(langtup))
 		elog(ERROR, "cache lookup failed for language %u", proc->prolang);
 	lang = (Form_pg_language) GETSTRUCT(langtup);
@@ -1806,9 +1790,7 @@ pg_get_function_arguments(PG_FUNCTION_ARGS)
 
 	initStringInfo(&buf);
 
-	proctup = SearchSysCache(PROCOID,
-							 ObjectIdGetDatum(funcid),
-							 0, 0, 0);
+	proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
 	if (!HeapTupleIsValid(proctup))
 		elog(ERROR, "cache lookup failed for function %u", funcid);
 
@@ -1834,9 +1816,7 @@ pg_get_function_identity_arguments(PG_FUNCTION_ARGS)
 
 	initStringInfo(&buf);
 
-	proctup = SearchSysCache(PROCOID,
-							 ObjectIdGetDatum(funcid),
-							 0, 0, 0);
+	proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
 	if (!HeapTupleIsValid(proctup))
 		elog(ERROR, "cache lookup failed for function %u", funcid);
 
@@ -1861,9 +1841,7 @@ pg_get_function_result(PG_FUNCTION_ARGS)
 
 	initStringInfo(&buf);
 
-	proctup = SearchSysCache(PROCOID,
-							 ObjectIdGetDatum(funcid),
-							 0, 0, 0);
+	proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
 	if (!HeapTupleIsValid(proctup))
 		elog(ERROR, "cache lookup failed for function %u", funcid);
 
@@ -5322,9 +5300,7 @@ get_oper_expr(OpExpr *expr, deparse_context *context)
 		HeapTuple	tp;
 		Form_pg_operator optup;
 
-		tp = SearchSysCache(OPEROID,
-							ObjectIdGetDatum(opno),
-							0, 0, 0);
+		tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
 		if (!HeapTupleIsValid(tp))
 			elog(ERROR, "cache lookup failed for operator %u", opno);
 		optup = (Form_pg_operator) GETSTRUCT(tp);
@@ -6253,9 +6229,7 @@ get_opclass_name(Oid opclass, Oid actual_datatype,
 	char	   *opcname;
 	char	   *nspname;
 
-	ht_opc = SearchSysCache(CLAOID,
-							ObjectIdGetDatum(opclass),
-							0, 0, 0);
+	ht_opc = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclass));
 	if (!HeapTupleIsValid(ht_opc))
 		elog(ERROR, "cache lookup failed for opclass %u", opclass);
 	opcrec = (Form_pg_opclass) GETSTRUCT(ht_opc);
@@ -6492,9 +6466,7 @@ generate_relation_name(Oid relid, List *namespaces)
 	char	   *nspname;
 	char	   *result;
 
-	tp = SearchSysCache(RELOID,
-						ObjectIdGetDatum(relid),
-						0, 0, 0);
+	tp = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
 	if (!HeapTupleIsValid(tp))
 		elog(ERROR, "cache lookup failed for relation %u", relid);
 	reltup = (Form_pg_class) GETSTRUCT(tp);
@@ -6562,9 +6534,7 @@ generate_function_name(Oid funcid, int nargs, List *argnames,
 	int			p_nvargs;
 	Oid		   *p_true_typeids;
 
-	proctup = SearchSysCache(PROCOID,
-							 ObjectIdGetDatum(funcid),
-							 0, 0, 0);
+	proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
 	if (!HeapTupleIsValid(proctup))
 		elog(ERROR, "cache lookup failed for function %u", funcid);
 	procform = (Form_pg_proc) GETSTRUCT(proctup);
@@ -6630,9 +6600,7 @@ generate_operator_name(Oid operid, Oid arg1, Oid arg2)
 
 	initStringInfo(&buf);
 
-	opertup = SearchSysCache(OPEROID,
-							 ObjectIdGetDatum(operid),
-							 0, 0, 0);
+	opertup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operid));
 	if (!HeapTupleIsValid(opertup))
 		elog(ERROR, "cache lookup failed for operator %u", operid);
 	operform = (Form_pg_operator) GETSTRUCT(opertup);
@@ -6710,9 +6678,7 @@ flatten_reloptions(Oid relid)
 	Datum		reloptions;
 	bool		isnull;
 
-	tuple = SearchSysCache(RELOID,
-						   ObjectIdGetDatum(relid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
 	if (!HeapTupleIsValid(tuple))
 		elog(ERROR, "cache lookup failed for relation %u", relid);
 
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
index 9ef0aa9..17b6f0f 100644
--- a/src/backend/utils/adt/selfuncs.c
+++ b/src/backend/utils/adt/selfuncs.c
@@ -4117,11 +4117,10 @@ examine_variable(PlannerInfo *root, Node *node, int varRelid,
 		}
 		else if (rte->rtekind == RTE_RELATION)
 		{
-			vardata->statsTuple = SearchSysCache(STATRELATTINH,
-												 ObjectIdGetDatum(rte->relid),
-												 Int16GetDatum(var->varattno),
-												 BoolGetDatum(rte->inh),
-												 0);
+			vardata->statsTuple = SearchSysCache3(STATRELATTINH,
+												  ObjectIdGetDatum(rte->relid),
+												  Int16GetDatum(var->varattno),
+												  BoolGetDatum(rte->inh));
 			vardata->freefunc = ReleaseSysCache;
 		}
 		else
@@ -4258,11 +4257,10 @@ examine_variable(PlannerInfo *root, Node *node, int varRelid,
 						else if (index->indpred == NIL)
 						{
 							vardata->statsTuple =
-								SearchSysCache(STATRELATTINH,
+								SearchSysCache3(STATRELATTINH,
 										   ObjectIdGetDatum(index->indexoid),
-											   Int16GetDatum(pos + 1),
-											   BoolGetDatum(false),
-											   0);
+											    Int16GetDatum(pos + 1),
+											    BoolGetDatum(false));
 							vardata->freefunc = ReleaseSysCache;
 						}
 						if (vardata->statsTuple)
@@ -6116,11 +6114,10 @@ btcostestimate(PG_FUNCTION_ARGS)
 		}
 		else
 		{
-			vardata.statsTuple = SearchSysCache(STATRELATTINH,
-												ObjectIdGetDatum(relid),
-												Int16GetDatum(colnum),
-												BoolGetDatum(rte->inh),
-												0);
+			vardata.statsTuple = SearchSysCache3(STATRELATTINH,
+												 ObjectIdGetDatum(relid),
+												 Int16GetDatum(colnum),
+												 BoolGetDatum(rte->inh));
 			vardata.freefunc = ReleaseSysCache;
 		}
 	}
@@ -6143,11 +6140,10 @@ btcostestimate(PG_FUNCTION_ARGS)
 		}
 		else
 		{
-			vardata.statsTuple = SearchSysCache(STATRELATTINH,
-												ObjectIdGetDatum(relid),
-												Int16GetDatum(colnum),
-												BoolGetDatum(false),
-												0);
+			vardata.statsTuple = SearchSysCache3(STATRELATTINH,
+												 ObjectIdGetDatum(relid),
+												 Int16GetDatum(colnum),
+												 BoolGetDatum(false));
 			vardata.freefunc = ReleaseSysCache;
 		}
 	}
diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c
index 7d1ddff..7f2bd89 100644
--- a/src/backend/utils/adt/xml.c
+++ b/src/backend/utils/adt/xml.c
@@ -2612,9 +2612,7 @@ map_sql_table_to_xmlschema(TupleDesc tupdesc, Oid relid, bool nulls,
 		HeapTuple	tuple;
 		Form_pg_class reltuple;
 
-		tuple = SearchSysCache(RELOID,
-							   ObjectIdGetDatum(relid),
-							   0, 0, 0);
+		tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
 		if (!HeapTupleIsValid(tuple))
 			elog(ERROR, "cache lookup failed for relation %u", relid);
 		reltuple = (Form_pg_class) GETSTRUCT(tuple);
@@ -2912,9 +2910,7 @@ map_sql_type_to_xml_name(Oid typeoid, int typmod)
 				HeapTuple	tuple;
 				Form_pg_type typtuple;
 
-				tuple = SearchSysCache(TYPEOID,
-									   ObjectIdGetDatum(typeoid),
-									   0, 0, 0);
+				tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typeoid));
 				if (!HeapTupleIsValid(tuple))
 					elog(ERROR, "cache lookup failed for type %u", typeoid);
 				typtuple = (Form_pg_type) GETSTRUCT(tuple);
diff --git a/src/backend/utils/cache/attoptcache.c b/src/backend/utils/cache/attoptcache.c
index 65385b8..833ecde 100644
--- a/src/backend/utils/cache/attoptcache.c
+++ b/src/backend/utils/cache/attoptcache.c
@@ -128,10 +128,9 @@ get_attribute_options(Oid attrelid, int attnum)
 	{
 		AttributeOpts *opts;
 
-		tp = SearchSysCache(ATTNUM,
-							ObjectIdGetDatum(attrelid),
-							Int16GetDatum(attnum),
-							0, 0);
+		tp = SearchSysCache2(ATTNUM,
+							 ObjectIdGetDatum(attrelid),
+							 Int16GetDatum(attnum));
 
 		/*
 		 * If we don't find a valid HeapTuple, it must mean someone has
diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c
index c9cb4b2..5fbffe9 100644
--- a/src/backend/utils/cache/catcache.c
+++ b/src/backend/utils/cache/catcache.c
@@ -183,6 +183,13 @@ CatalogCacheComputeHashValue(CatCache *cache, int nkeys, ScanKey cur_skey)
 
 	switch (nkeys)
 	{
+		case 5:
+			oneHash =
+				DatumGetUInt32(DirectFunctionCall1(cache->cc_hashfunc[4],
+												   cur_skey[4].sk_argument));
+			hashValue ^= oneHash << 12;
+			hashValue ^= oneHash >> 20;
+			/* FALLTHROUGH */
 		case 4:
 			oneHash =
 				DatumGetUInt32(DirectFunctionCall1(cache->cc_hashfunc[3],
@@ -226,7 +233,7 @@ CatalogCacheComputeHashValue(CatCache *cache, int nkeys, ScanKey cur_skey)
 static uint32
 CatalogCacheComputeTupleHashValue(CatCache *cache, HeapTuple tuple)
 {
-	ScanKeyData cur_skey[4];
+	ScanKeyData cur_skey[CATCACHE_MAXKEYS];
 	bool		isNull = false;
 
 	/* Copy pre-initialized overhead data for scankey */
@@ -235,6 +242,16 @@ CatalogCacheComputeTupleHashValue(CatCache *cache, HeapTuple tuple)
 	/* Now extract key fields from tuple, insert into scankey */
 	switch (cache->cc_nkeys)
 	{
+		case 5:
+			cur_skey[4].sk_argument =
+				(cache->cc_key[4] == ObjectIdAttributeNumber)
+				? ObjectIdGetDatum(HeapTupleGetOid(tuple))
+				: fastgetattr(tuple,
+							  cache->cc_key[4],
+							  cache->cc_tupdesc,
+							  &isNull);
+			Assert(!isNull);
+			/* FALLTHROUGH */
 		case 4:
 			cur_skey[3].sk_argument =
 				(cache->cc_key[3] == ObjectIdAttributeNumber)
@@ -1036,9 +1053,10 @@ SearchCatCache(CatCache *cache,
 			   Datum v1,
 			   Datum v2,
 			   Datum v3,
-			   Datum v4)
+			   Datum v4,
+			   Datum v5)
 {
-	ScanKeyData cur_skey[4];
+	ScanKeyData cur_skey[CATCACHE_MAXKEYS];
 	uint32		hashValue;
 	Index		hashIndex;
 	Dlelem	   *elt;
@@ -1065,6 +1083,7 @@ SearchCatCache(CatCache *cache,
 	cur_skey[1].sk_argument = v2;
 	cur_skey[2].sk_argument = v3;
 	cur_skey[3].sk_argument = v4;
+	cur_skey[4].sk_argument = v5;
 
 	/*
 	 * find the hash bucket in which to look for the tuple
@@ -1277,9 +1296,10 @@ SearchCatCacheList(CatCache *cache,
 				   Datum v1,
 				   Datum v2,
 				   Datum v3,
-				   Datum v4)
+				   Datum v4,
+				   Datum v5)
 {
-	ScanKeyData cur_skey[4];
+	ScanKeyData cur_skey[CATCACHE_MAXKEYS];
 	uint32		lHashValue;
 	Dlelem	   *elt;
 	CatCList   *cl;
@@ -1312,6 +1332,7 @@ SearchCatCacheList(CatCache *cache,
 	cur_skey[1].sk_argument = v2;
 	cur_skey[2].sk_argument = v3;
 	cur_skey[3].sk_argument = v4;
+	cur_skey[4].sk_argument = v5;
 
 	/*
 	 * compute a hash value of the given keys for faster search.  We don't
diff --git a/src/backend/utils/cache/inval.c b/src/backend/utils/cache/inval.c
index f475aac..930bb6d 100644
--- a/src/backend/utils/cache/inval.c
+++ b/src/backend/utils/cache/inval.c
@@ -1201,9 +1201,7 @@ CacheInvalidateRelcacheByRelid(Oid relid)
 {
 	HeapTuple	tup;
 
-	tup = SearchSysCache(RELOID,
-						 ObjectIdGetDatum(relid),
-						 0, 0, 0);
+	tup = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
 	if (!HeapTupleIsValid(tup))
 		elog(ERROR, "cache lookup failed for relation %u", relid);
 	CacheInvalidateRelcacheByTuple(tup);
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c
index 7bb0f62..143408e 100644
--- a/src/backend/utils/cache/lsyscache.c
+++ b/src/backend/utils/cache/lsyscache.c
@@ -49,10 +49,9 @@ get_attavgwidth_hook_type get_attavgwidth_hook = NULL;
 bool
 op_in_opfamily(Oid opno, Oid opfamily)
 {
-	return SearchSysCacheExists(AMOPOPID,
-								ObjectIdGetDatum(opno),
-								ObjectIdGetDatum(opfamily),
-								0, 0);
+	return SearchSysCacheExists2(AMOPOPID,
+								 ObjectIdGetDatum(opno),
+								 ObjectIdGetDatum(opfamily));
 }
 
 /*
@@ -68,10 +67,9 @@ get_op_opfamily_strategy(Oid opno, Oid opfamily)
 	Form_pg_amop amop_tup;
 	int			result;
 
-	tp = SearchSysCache(AMOPOPID,
-						ObjectIdGetDatum(opno),
-						ObjectIdGetDatum(opfamily),
-						0, 0);
+	tp = SearchSysCache2(AMOPOPID,
+						 ObjectIdGetDatum(opno),
+						 ObjectIdGetDatum(opfamily));
 	if (!HeapTupleIsValid(tp))
 		return 0;
 	amop_tup = (Form_pg_amop) GETSTRUCT(tp);
@@ -98,10 +96,9 @@ get_op_opfamily_properties(Oid opno, Oid opfamily,
 	HeapTuple	tp;
 	Form_pg_amop amop_tup;
 
-	tp = SearchSysCache(AMOPOPID,
-						ObjectIdGetDatum(opno),
-						ObjectIdGetDatum(opfamily),
-						0, 0);
+	tp = SearchSysCache2(AMOPOPID,
+						 ObjectIdGetDatum(opno),
+						 ObjectIdGetDatum(opfamily));
 	if (!HeapTupleIsValid(tp))
 		elog(ERROR, "operator %u is not a member of opfamily %u",
 			 opno, opfamily);
@@ -127,11 +124,11 @@ get_opfamily_member(Oid opfamily, Oid lefttype, Oid righttype,
 	Form_pg_amop amop_tup;
 	Oid			result;
 
-	tp = SearchSysCache(AMOPSTRATEGY,
-						ObjectIdGetDatum(opfamily),
-						ObjectIdGetDatum(lefttype),
-						ObjectIdGetDatum(righttype),
-						Int16GetDatum(strategy));
+	tp = SearchSysCache4(AMOPSTRATEGY,
+						 ObjectIdGetDatum(opfamily),
+						 ObjectIdGetDatum(lefttype),
+						 ObjectIdGetDatum(righttype),
+						 Int16GetDatum(strategy));
 	if (!HeapTupleIsValid(tp))
 		return InvalidOid;
 	amop_tup = (Form_pg_amop) GETSTRUCT(tp);
@@ -177,9 +174,7 @@ get_ordering_op_properties(Oid opno,
 	 * Search pg_amop to see if the target operator is registered as the "<"
 	 * or ">" operator of any btree opfamily.
 	 */
-	catlist = SearchSysCacheList(AMOPOPID, 1,
-								 ObjectIdGetDatum(opno),
-								 0, 0, 0);
+	catlist = SearchSysCacheList1(AMOPOPID, ObjectIdGetDatum(opno));
 
 	for (i = 0; i < catlist->n_members; i++)
 	{
@@ -314,9 +309,7 @@ get_ordering_op_for_equality_op(Oid opno, bool use_lhs_type)
 	 * Search pg_amop to see if the target operator is registered as the "="
 	 * operator of any btree opfamily.
 	 */
-	catlist = SearchSysCacheList(AMOPOPID, 1,
-								 ObjectIdGetDatum(opno),
-								 0, 0, 0);
+	catlist = SearchSysCacheList1(AMOPOPID, ObjectIdGetDatum(opno));
 
 	for (i = 0; i < catlist->n_members; i++)
 	{
@@ -377,9 +370,7 @@ get_mergejoin_opfamilies(Oid opno)
 	 * Search pg_amop to see if the target operator is registered as the "="
 	 * operator of any btree opfamily.
 	 */
-	catlist = SearchSysCacheList(AMOPOPID, 1,
-								 ObjectIdGetDatum(opno),
-								 0, 0, 0);
+	catlist = SearchSysCacheList1(AMOPOPID, ObjectIdGetDatum(opno));
 
 	for (i = 0; i < catlist->n_members; i++)
 	{
@@ -431,9 +422,7 @@ get_compatible_hash_operators(Oid opno,
 	 * operator of any hash opfamily.  If the operator is registered in
 	 * multiple opfamilies, assume we can use any one.
 	 */
-	catlist = SearchSysCacheList(AMOPOPID, 1,
-								 ObjectIdGetDatum(opno),
-								 0, 0, 0);
+	catlist = SearchSysCacheList1(AMOPOPID, ObjectIdGetDatum(opno));
 
 	for (i = 0; i < catlist->n_members; i++)
 	{
@@ -533,9 +522,7 @@ get_op_hash_functions(Oid opno,
 	 * operator of any hash opfamily.  If the operator is registered in
 	 * multiple opfamilies, assume we can use any one.
 	 */
-	catlist = SearchSysCacheList(AMOPOPID, 1,
-								 ObjectIdGetDatum(opno),
-								 0, 0, 0);
+	catlist = SearchSysCacheList1(AMOPOPID, ObjectIdGetDatum(opno));
 
 	for (i = 0; i < catlist->n_members; i++)
 	{
@@ -620,9 +607,7 @@ get_op_btree_interpretation(Oid opno, List **opfamilies, List **opstrats)
 	/*
 	 * Find all the pg_amop entries containing the operator.
 	 */
-	catlist = SearchSysCacheList(AMOPOPID, 1,
-								 ObjectIdGetDatum(opno),
-								 0, 0, 0);
+	catlist = SearchSysCacheList1(AMOPOPID, ObjectIdGetDatum(opno));
 
 	/*
 	 * If we can't find any opfamily containing the op, perhaps it is a <>
@@ -637,9 +622,8 @@ get_op_btree_interpretation(Oid opno, List **opfamilies, List **opstrats)
 		{
 			op_negated = true;
 			ReleaseSysCacheList(catlist);
-			catlist = SearchSysCacheList(AMOPOPID, 1,
-										 ObjectIdGetDatum(op_negator),
-										 0, 0, 0);
+			catlist = SearchSysCacheList1(AMOPOPID, 
+										  ObjectIdGetDatum(op_negator));
 		}
 	}
 
@@ -700,9 +684,7 @@ equality_ops_are_compatible(Oid opno1, Oid opno2)
 	/*
 	 * We search through all the pg_amop entries for opno1.
 	 */
-	catlist = SearchSysCacheList(AMOPOPID, 1,
-								 ObjectIdGetDatum(opno1),
-								 0, 0, 0);
+	catlist = SearchSysCacheList1(AMOPOPID, ObjectIdGetDatum(opno1));
 
 	result = false;
 	for (i = 0; i < catlist->n_members; i++)
@@ -744,11 +726,11 @@ get_opfamily_proc(Oid opfamily, Oid lefttype, Oid righttype, int16 procnum)
 	Form_pg_amproc amproc_tup;
 	RegProcedure result;
 
-	tp = SearchSysCache(AMPROCNUM,
-						ObjectIdGetDatum(opfamily),
-						ObjectIdGetDatum(lefttype),
-						ObjectIdGetDatum(righttype),
-						Int16GetDatum(procnum));
+	tp = SearchSysCache4(AMPROCNUM,
+						 ObjectIdGetDatum(opfamily),
+						 ObjectIdGetDatum(lefttype),
+						 ObjectIdGetDatum(righttype),
+						 Int16GetDatum(procnum));
 	if (!HeapTupleIsValid(tp))
 		return InvalidOid;
 	amproc_tup = (Form_pg_amproc) GETSTRUCT(tp);
@@ -772,10 +754,9 @@ get_attname(Oid relid, AttrNumber attnum)
 {
 	HeapTuple	tp;
 
-	tp = SearchSysCache(ATTNUM,
-						ObjectIdGetDatum(relid),
-						Int16GetDatum(attnum),
-						0, 0);
+	tp = SearchSysCache2(ATTNUM,
+						 ObjectIdGetDatum(relid),
+						 Int16GetDatum(attnum));
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_attribute att_tup = (Form_pg_attribute) GETSTRUCT(tp);
@@ -845,10 +826,9 @@ get_atttype(Oid relid, AttrNumber attnum)
 {
 	HeapTuple	tp;
 
-	tp = SearchSysCache(ATTNUM,
-						ObjectIdGetDatum(relid),
-						Int16GetDatum(attnum),
-						0, 0);
+	tp = SearchSysCache2(ATTNUM,
+						 ObjectIdGetDatum(relid),
+						 Int16GetDatum(attnum));
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_attribute att_tup = (Form_pg_attribute) GETSTRUCT(tp);
@@ -873,10 +853,9 @@ get_atttypmod(Oid relid, AttrNumber attnum)
 {
 	HeapTuple	tp;
 
-	tp = SearchSysCache(ATTNUM,
-						ObjectIdGetDatum(relid),
-						Int16GetDatum(attnum),
-						0, 0);
+	tp = SearchSysCache2(ATTNUM,
+						 ObjectIdGetDatum(relid),
+						 Int16GetDatum(attnum));
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_attribute att_tup = (Form_pg_attribute) GETSTRUCT(tp);
@@ -906,10 +885,9 @@ get_atttypetypmod(Oid relid, AttrNumber attnum,
 	HeapTuple	tp;
 	Form_pg_attribute att_tup;
 
-	tp = SearchSysCache(ATTNUM,
-						ObjectIdGetDatum(relid),
-						Int16GetDatum(attnum),
-						0, 0);
+	tp = SearchSysCache2(ATTNUM,
+						 ObjectIdGetDatum(relid),
+						 Int16GetDatum(attnum));
 	if (!HeapTupleIsValid(tp))
 		elog(ERROR, "cache lookup failed for attribute %d of relation %u",
 			 attnum, relid);
@@ -936,9 +914,7 @@ get_constraint_name(Oid conoid)
 {
 	HeapTuple	tp;
 
-	tp = SearchSysCache(CONSTROID,
-						ObjectIdGetDatum(conoid),
-						0, 0, 0);
+	tp = SearchSysCache1(CONSTROID, ObjectIdGetDatum(conoid));
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_constraint contup = (Form_pg_constraint) GETSTRUCT(tp);
@@ -966,9 +942,7 @@ get_opclass_family(Oid opclass)
 	Form_pg_opclass cla_tup;
 	Oid			result;
 
-	tp = SearchSysCache(CLAOID,
-						ObjectIdGetDatum(opclass),
-						0, 0, 0);
+	tp = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclass));
 	if (!HeapTupleIsValid(tp))
 		elog(ERROR, "cache lookup failed for opclass %u", opclass);
 	cla_tup = (Form_pg_opclass) GETSTRUCT(tp);
@@ -990,9 +964,7 @@ get_opclass_input_type(Oid opclass)
 	Form_pg_opclass cla_tup;
 	Oid			result;
 
-	tp = SearchSysCache(CLAOID,
-						ObjectIdGetDatum(opclass),
-						0, 0, 0);
+	tp = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclass));
 	if (!HeapTupleIsValid(tp))
 		elog(ERROR, "cache lookup failed for opclass %u", opclass);
 	cla_tup = (Form_pg_opclass) GETSTRUCT(tp);
@@ -1015,9 +987,7 @@ get_opcode(Oid opno)
 {
 	HeapTuple	tp;
 
-	tp = SearchSysCache(OPEROID,
-						ObjectIdGetDatum(opno),
-						0, 0, 0);
+	tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
@@ -1042,9 +1012,7 @@ get_opname(Oid opno)
 {
 	HeapTuple	tp;
 
-	tp = SearchSysCache(OPEROID,
-						ObjectIdGetDatum(opno),
-						0, 0, 0);
+	tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
@@ -1070,9 +1038,7 @@ op_input_types(Oid opno, Oid *lefttype, Oid *righttype)
 	HeapTuple	tp;
 	Form_pg_operator optup;
 
-	tp = SearchSysCache(OPEROID,
-						ObjectIdGetDatum(opno),
-						0, 0, 0);
+	tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
 	if (!HeapTupleIsValid(tp))	/* shouldn't happen */
 		elog(ERROR, "cache lookup failed for operator %u", opno);
 	optup = (Form_pg_operator) GETSTRUCT(tp);
@@ -1095,9 +1061,7 @@ op_mergejoinable(Oid opno)
 	HeapTuple	tp;
 	bool		result = false;
 
-	tp = SearchSysCache(OPEROID,
-						ObjectIdGetDatum(opno),
-						0, 0, 0);
+	tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
@@ -1120,9 +1084,7 @@ op_hashjoinable(Oid opno)
 	HeapTuple	tp;
 	bool		result = false;
 
-	tp = SearchSysCache(OPEROID,
-						ObjectIdGetDatum(opno),
-						0, 0, 0);
+	tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
@@ -1175,9 +1137,7 @@ get_commutator(Oid opno)
 {
 	HeapTuple	tp;
 
-	tp = SearchSysCache(OPEROID,
-						ObjectIdGetDatum(opno),
-						0, 0, 0);
+	tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
@@ -1201,9 +1161,7 @@ get_negator(Oid opno)
 {
 	HeapTuple	tp;
 
-	tp = SearchSysCache(OPEROID,
-						ObjectIdGetDatum(opno),
-						0, 0, 0);
+	tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
@@ -1227,9 +1185,7 @@ get_oprrest(Oid opno)
 {
 	HeapTuple	tp;
 
-	tp = SearchSysCache(OPEROID,
-						ObjectIdGetDatum(opno),
-						0, 0, 0);
+	tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
@@ -1253,9 +1209,7 @@ get_oprjoin(Oid opno)
 {
 	HeapTuple	tp;
 
-	tp = SearchSysCache(OPEROID,
-						ObjectIdGetDatum(opno),
-						0, 0, 0);
+	tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
@@ -1282,9 +1236,7 @@ get_func_name(Oid funcid)
 {
 	HeapTuple	tp;
 
-	tp = SearchSysCache(PROCOID,
-						ObjectIdGetDatum(funcid),
-						0, 0, 0);
+	tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_proc functup = (Form_pg_proc) GETSTRUCT(tp);
@@ -1308,9 +1260,7 @@ get_func_namespace(Oid funcid)
 {
 	HeapTuple	tp;
 
-	tp = SearchSysCache(PROCOID,
-						ObjectIdGetDatum(funcid),
-						0, 0, 0);
+	tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_proc functup = (Form_pg_proc) GETSTRUCT(tp);
@@ -1334,9 +1284,7 @@ get_func_rettype(Oid funcid)
 	HeapTuple	tp;
 	Oid			result;
 
-	tp = SearchSysCache(PROCOID,
-						ObjectIdGetDatum(funcid),
-						0, 0, 0);
+	tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
 	if (!HeapTupleIsValid(tp))
 		elog(ERROR, "cache lookup failed for function %u", funcid);
 
@@ -1355,9 +1303,7 @@ get_func_nargs(Oid funcid)
 	HeapTuple	tp;
 	int			result;
 
-	tp = SearchSysCache(PROCOID,
-						ObjectIdGetDatum(funcid),
-						0, 0, 0);
+	tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
 	if (!HeapTupleIsValid(tp))
 		elog(ERROR, "cache lookup failed for function %u", funcid);
 
@@ -1380,9 +1326,7 @@ get_func_signature(Oid funcid, Oid **argtypes, int *nargs)
 	Form_pg_proc procstruct;
 	Oid			result;
 
-	tp = SearchSysCache(PROCOID,
-						ObjectIdGetDatum(funcid),
-						0, 0, 0);
+	tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
 	if (!HeapTupleIsValid(tp))
 		elog(ERROR, "cache lookup failed for function %u", funcid);
 
@@ -1408,9 +1352,7 @@ get_func_retset(Oid funcid)
 	HeapTuple	tp;
 	bool		result;
 
-	tp = SearchSysCache(PROCOID,
-						ObjectIdGetDatum(funcid),
-						0, 0, 0);
+	tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
 	if (!HeapTupleIsValid(tp))
 		elog(ERROR, "cache lookup failed for function %u", funcid);
 
@@ -1429,9 +1371,7 @@ func_strict(Oid funcid)
 	HeapTuple	tp;
 	bool		result;
 
-	tp = SearchSysCache(PROCOID,
-						ObjectIdGetDatum(funcid),
-						0, 0, 0);
+	tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
 	if (!HeapTupleIsValid(tp))
 		elog(ERROR, "cache lookup failed for function %u", funcid);
 
@@ -1450,9 +1390,7 @@ func_volatile(Oid funcid)
 	HeapTuple	tp;
 	char		result;
 
-	tp = SearchSysCache(PROCOID,
-						ObjectIdGetDatum(funcid),
-						0, 0, 0);
+	tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
 	if (!HeapTupleIsValid(tp))
 		elog(ERROR, "cache lookup failed for function %u", funcid);
 
@@ -1471,9 +1409,7 @@ get_func_cost(Oid funcid)
 	HeapTuple	tp;
 	float4		result;
 
-	tp = SearchSysCache(PROCOID,
-						ObjectIdGetDatum(funcid),
-						0, 0, 0);
+	tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
 	if (!HeapTupleIsValid(tp))
 		elog(ERROR, "cache lookup failed for function %u", funcid);
 
@@ -1492,9 +1428,7 @@ get_func_rows(Oid funcid)
 	HeapTuple	tp;
 	float4		result;
 
-	tp = SearchSysCache(PROCOID,
-						ObjectIdGetDatum(funcid),
-						0, 0, 0);
+	tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
 	if (!HeapTupleIsValid(tp))
 		elog(ERROR, "cache lookup failed for function %u", funcid);
 
@@ -1514,10 +1448,9 @@ get_func_rows(Oid funcid)
 Oid
 get_relname_relid(const char *relname, Oid relnamespace)
 {
-	return GetSysCacheOid(RELNAMENSP,
-						  PointerGetDatum(relname),
-						  ObjectIdGetDatum(relnamespace),
-						  0, 0);
+	return GetSysCacheOid2(RELNAMENSP,
+						   PointerGetDatum(relname),
+						   ObjectIdGetDatum(relnamespace));
 }
 
 #ifdef NOT_USED
@@ -1531,9 +1464,7 @@ get_relnatts(Oid relid)
 {
 	HeapTuple	tp;
 
-	tp = SearchSysCache(RELOID,
-						ObjectIdGetDatum(relid),
-						0, 0, 0);
+	tp = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp);
@@ -1562,9 +1493,7 @@ get_rel_name(Oid relid)
 {
 	HeapTuple	tp;
 
-	tp = SearchSysCache(RELOID,
-						ObjectIdGetDatum(relid),
-						0, 0, 0);
+	tp = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp);
@@ -1588,9 +1517,7 @@ get_rel_namespace(Oid relid)
 {
 	HeapTuple	tp;
 
-	tp = SearchSysCache(RELOID,
-						ObjectIdGetDatum(relid),
-						0, 0, 0);
+	tp = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp);
@@ -1617,9 +1544,7 @@ get_rel_type_id(Oid relid)
 {
 	HeapTuple	tp;
 
-	tp = SearchSysCache(RELOID,
-						ObjectIdGetDatum(relid),
-						0, 0, 0);
+	tp = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp);
@@ -1643,9 +1568,7 @@ get_rel_relkind(Oid relid)
 {
 	HeapTuple	tp;
 
-	tp = SearchSysCache(RELOID,
-						ObjectIdGetDatum(relid),
-						0, 0, 0);
+	tp = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp);
@@ -1672,9 +1595,7 @@ get_rel_tablespace(Oid relid)
 {
 	HeapTuple	tp;
 
-	tp = SearchSysCache(RELOID,
-						ObjectIdGetDatum(relid),
-						0, 0, 0);
+	tp = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp);
@@ -1702,9 +1623,7 @@ get_typisdefined(Oid typid)
 {
 	HeapTuple	tp;
 
-	tp = SearchSysCache(TYPEOID,
-						ObjectIdGetDatum(typid),
-						0, 0, 0);
+	tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
@@ -1728,9 +1647,7 @@ get_typlen(Oid typid)
 {
 	HeapTuple	tp;
 
-	tp = SearchSysCache(TYPEOID,
-						ObjectIdGetDatum(typid),
-						0, 0, 0);
+	tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
@@ -1755,9 +1672,7 @@ get_typbyval(Oid typid)
 {
 	HeapTuple	tp;
 
-	tp = SearchSysCache(TYPEOID,
-						ObjectIdGetDatum(typid),
-						0, 0, 0);
+	tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
@@ -1787,9 +1702,7 @@ get_typlenbyval(Oid typid, int16 *typlen, bool *typbyval)
 	HeapTuple	tp;
 	Form_pg_type typtup;
 
-	tp = SearchSysCache(TYPEOID,
-						ObjectIdGetDatum(typid),
-						0, 0, 0);
+	tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
 	if (!HeapTupleIsValid(tp))
 		elog(ERROR, "cache lookup failed for type %u", typid);
 	typtup = (Form_pg_type) GETSTRUCT(tp);
@@ -1810,9 +1723,7 @@ get_typlenbyvalalign(Oid typid, int16 *typlen, bool *typbyval,
 	HeapTuple	tp;
 	Form_pg_type typtup;
 
-	tp = SearchSysCache(TYPEOID,
-						ObjectIdGetDatum(typid),
-						0, 0, 0);
+	tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
 	if (!HeapTupleIsValid(tp))
 		elog(ERROR, "cache lookup failed for type %u", typid);
 	typtup = (Form_pg_type) GETSTRUCT(tp);
@@ -1905,9 +1816,7 @@ get_type_io_data(Oid typid,
 		return;
 	}
 
-	typeTuple = SearchSysCache(TYPEOID,
-							   ObjectIdGetDatum(typid),
-							   0, 0, 0);
+	typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
 	if (!HeapTupleIsValid(typeTuple))
 		elog(ERROR, "cache lookup failed for type %u", typid);
 	typeStruct = (Form_pg_type) GETSTRUCT(typeTuple);
@@ -1941,9 +1850,7 @@ get_typalign(Oid typid)
 {
 	HeapTuple	tp;
 
-	tp = SearchSysCache(TYPEOID,
-						ObjectIdGetDatum(typid),
-						0, 0, 0);
+	tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
@@ -1963,9 +1870,7 @@ get_typstorage(Oid typid)
 {
 	HeapTuple	tp;
 
-	tp = SearchSysCache(TYPEOID,
-						ObjectIdGetDatum(typid),
-						0, 0, 0);
+	tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
@@ -1998,9 +1903,7 @@ get_typdefault(Oid typid)
 	bool		isNull;
 	Node	   *expr;
 
-	typeTuple = SearchSysCache(TYPEOID,
-							   ObjectIdGetDatum(typid),
-							   0, 0, 0);
+	typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
 	if (!HeapTupleIsValid(typeTuple))
 		elog(ERROR, "cache lookup failed for type %u", typid);
 	type = (Form_pg_type) GETSTRUCT(typeTuple);
@@ -2091,9 +1994,7 @@ getBaseTypeAndTypmod(Oid typid, int32 *typmod)
 		HeapTuple	tup;
 		Form_pg_type typTup;
 
-		tup = SearchSysCache(TYPEOID,
-							 ObjectIdGetDatum(typid),
-							 0, 0, 0);
+		tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
 		if (!HeapTupleIsValid(tup))
 			elog(ERROR, "cache lookup failed for type %u", typid);
 		typTup = (Form_pg_type) GETSTRUCT(tup);
@@ -2178,9 +2079,7 @@ get_typtype(Oid typid)
 {
 	HeapTuple	tp;
 
-	tp = SearchSysCache(TYPEOID,
-						ObjectIdGetDatum(typid),
-						0, 0, 0);
+	tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
@@ -2228,9 +2127,7 @@ get_type_category_preferred(Oid typid, char *typcategory, bool *typispreferred)
 	HeapTuple	tp;
 	Form_pg_type typtup;
 
-	tp = SearchSysCache(TYPEOID,
-						ObjectIdGetDatum(typid),
-						0, 0, 0);
+	tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
 	if (!HeapTupleIsValid(tp))
 		elog(ERROR, "cache lookup failed for type %u", typid);
 	typtup = (Form_pg_type) GETSTRUCT(tp);
@@ -2250,9 +2147,7 @@ get_typ_typrelid(Oid typid)
 {
 	HeapTuple	tp;
 
-	tp = SearchSysCache(TYPEOID,
-						ObjectIdGetDatum(typid),
-						0, 0, 0);
+	tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
@@ -2279,9 +2174,7 @@ get_element_type(Oid typid)
 {
 	HeapTuple	tp;
 
-	tp = SearchSysCache(TYPEOID,
-						ObjectIdGetDatum(typid),
-						0, 0, 0);
+	tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
@@ -2310,9 +2203,7 @@ get_array_type(Oid typid)
 	HeapTuple	tp;
 	Oid			result = InvalidOid;
 
-	tp = SearchSysCache(TYPEOID,
-						ObjectIdGetDatum(typid),
-						0, 0, 0);
+	tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
 	if (HeapTupleIsValid(tp))
 	{
 		result = ((Form_pg_type) GETSTRUCT(tp))->typarray;
@@ -2332,9 +2223,7 @@ getTypeInputInfo(Oid type, Oid *typInput, Oid *typIOParam)
 	HeapTuple	typeTuple;
 	Form_pg_type pt;
 
-	typeTuple = SearchSysCache(TYPEOID,
-							   ObjectIdGetDatum(type),
-							   0, 0, 0);
+	typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type));
 	if (!HeapTupleIsValid(typeTuple))
 		elog(ERROR, "cache lookup failed for type %u", type);
 	pt = (Form_pg_type) GETSTRUCT(typeTuple);
@@ -2367,9 +2256,7 @@ getTypeOutputInfo(Oid type, Oid *typOutput, bool *typIsVarlena)
 	HeapTuple	typeTuple;
 	Form_pg_type pt;
 
-	typeTuple = SearchSysCache(TYPEOID,
-							   ObjectIdGetDatum(type),
-							   0, 0, 0);
+	typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type));
 	if (!HeapTupleIsValid(typeTuple))
 		elog(ERROR, "cache lookup failed for type %u", type);
 	pt = (Form_pg_type) GETSTRUCT(typeTuple);
@@ -2402,9 +2289,7 @@ getTypeBinaryInputInfo(Oid type, Oid *typReceive, Oid *typIOParam)
 	HeapTuple	typeTuple;
 	Form_pg_type pt;
 
-	typeTuple = SearchSysCache(TYPEOID,
-							   ObjectIdGetDatum(type),
-							   0, 0, 0);
+	typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type));
 	if (!HeapTupleIsValid(typeTuple))
 		elog(ERROR, "cache lookup failed for type %u", type);
 	pt = (Form_pg_type) GETSTRUCT(typeTuple);
@@ -2437,9 +2322,7 @@ getTypeBinaryOutputInfo(Oid type, Oid *typSend, bool *typIsVarlena)
 	HeapTuple	typeTuple;
 	Form_pg_type pt;
 
-	typeTuple = SearchSysCache(TYPEOID,
-							   ObjectIdGetDatum(type),
-							   0, 0, 0);
+	typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type));
 	if (!HeapTupleIsValid(typeTuple))
 		elog(ERROR, "cache lookup failed for type %u", type);
 	pt = (Form_pg_type) GETSTRUCT(typeTuple);
@@ -2471,9 +2354,7 @@ get_typmodin(Oid typid)
 {
 	HeapTuple	tp;
 
-	tp = SearchSysCache(TYPEOID,
-						ObjectIdGetDatum(typid),
-						0, 0, 0);
+	tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
@@ -2498,9 +2379,7 @@ get_typmodout(Oid typid)
 {
 	HeapTuple	tp;
 
-	tp = SearchSysCache(TYPEOID,
-						ObjectIdGetDatum(typid),
-						0, 0, 0);
+	tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
@@ -2543,11 +2422,10 @@ get_attavgwidth(Oid relid, AttrNumber attnum)
 		if (stawidth > 0)
 			return stawidth;
 	}
-	tp = SearchSysCache(STATRELATTINH,
-						ObjectIdGetDatum(relid),
-						Int16GetDatum(attnum),
-						BoolGetDatum(false),
-						0);
+	tp = SearchSysCache3(STATRELATTINH,
+						 ObjectIdGetDatum(relid),
+						 Int16GetDatum(attnum),
+						 BoolGetDatum(false));
 	if (HeapTupleIsValid(tp))
 	{
 		stawidth = ((Form_pg_statistic) GETSTRUCT(tp))->stawidth;
@@ -2626,9 +2504,7 @@ get_attstatsslot(HeapTuple statstuple,
 		statarray = DatumGetArrayTypeP(val);
 
 		/* Need to get info about the array element type */
-		typeTuple = SearchSysCache(TYPEOID,
-								   ObjectIdGetDatum(atttype),
-								   0, 0, 0);
+		typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(atttype));
 		if (!HeapTupleIsValid(typeTuple))
 			elog(ERROR, "cache lookup failed for type %u", atttype);
 		typeForm = (Form_pg_type) GETSTRUCT(typeTuple);
@@ -2737,9 +2613,7 @@ get_namespace_name(Oid nspid)
 {
 	HeapTuple	tp;
 
-	tp = SearchSysCache(NAMESPACEOID,
-						ObjectIdGetDatum(nspid),
-						0, 0, 0);
+	tp = SearchSysCache1(NAMESPACEOID, ObjectIdGetDatum(nspid));
 	if (HeapTupleIsValid(tp))
 	{
 		Form_pg_namespace nsptup = (Form_pg_namespace) GETSTRUCT(tp);
@@ -2763,9 +2637,7 @@ get_namespace_name(Oid nspid)
 Oid
 get_roleid(const char *rolname)
 {
-	return GetSysCacheOid(AUTHNAME,
-						  PointerGetDatum(rolname),
-						  0, 0, 0);
+	return GetSysCacheOid1(AUTHNAME, PointerGetDatum(rolname));
 }
 
 /*
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index b1dbdbe..cf11c79 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -976,9 +976,8 @@ RelationInitIndexAccessInfo(Relation relation)
 	 * contains variable-length and possibly-null fields, we have to do this
 	 * honestly rather than just treating it as a Form_pg_index struct.
 	 */
-	tuple = SearchSysCache(INDEXRELID,
-						   ObjectIdGetDatum(RelationGetRelid(relation)),
-						   0, 0, 0);
+	tuple = SearchSysCache1(INDEXRELID,
+						    ObjectIdGetDatum(RelationGetRelid(relation)));
 	if (!HeapTupleIsValid(tuple))
 		elog(ERROR, "cache lookup failed for index %u",
 			 RelationGetRelid(relation));
@@ -991,9 +990,7 @@ RelationInitIndexAccessInfo(Relation relation)
 	/*
 	 * Make a copy of the pg_am entry for the index's access method
 	 */
-	tuple = SearchSysCache(AMOID,
-						   ObjectIdGetDatum(relation->rd_rel->relam),
-						   0, 0, 0);
+	tuple = SearchSysCache1(AMOID, ObjectIdGetDatum(relation->rd_rel->relam));
 	if (!HeapTupleIsValid(tuple))
 		elog(ERROR, "cache lookup failed for access method %u",
 			 relation->rd_rel->relam);
@@ -1757,9 +1754,8 @@ RelationReloadIndexInfo(Relation relation)
 		HeapTuple	tuple;
 		Form_pg_index index;
 
-		tuple = SearchSysCache(INDEXRELID,
-							   ObjectIdGetDatum(RelationGetRelid(relation)),
-							   0, 0, 0);
+		tuple = SearchSysCache1(INDEXRELID,
+							 	ObjectIdGetDatum(RelationGetRelid(relation)));
 		if (!HeapTupleIsValid(tuple))
 			elog(ERROR, "cache lookup failed for index %u",
 				 RelationGetRelid(relation));
@@ -2627,9 +2623,8 @@ RelationSetNewRelfilenode(Relation relation, TransactionId freezeXid)
 	 */
 	pg_class = heap_open(RelationRelationId, RowExclusiveLock);
 
-	tuple = SearchSysCacheCopy(RELOID,
-							   ObjectIdGetDatum(RelationGetRelid(relation)),
-							   0, 0, 0);
+	tuple = SearchSysCacheCopy1(RELOID,
+								ObjectIdGetDatum(RelationGetRelid(relation)));
 	if (!HeapTupleIsValid(tuple))
 		elog(ERROR, "could not find tuple for relation %u",
 			 RelationGetRelid(relation));
@@ -2947,9 +2942,8 @@ RelationCacheInitializePhase3(void)
 			HeapTuple	htup;
 			Form_pg_class relp;
 
-			htup = SearchSysCache(RELOID,
-								ObjectIdGetDatum(RelationGetRelid(relation)),
-								  0, 0, 0);
+			htup = SearchSysCache1(RELOID,
+								ObjectIdGetDatum(RelationGetRelid(relation)));
 			if (!HeapTupleIsValid(htup))
 				elog(FATAL, "cache lookup failed for relation %u",
 					 RelationGetRelid(relation));
diff --git a/src/backend/utils/cache/spccache.c b/src/backend/utils/cache/spccache.c
index bd956be..82f627d 100644
--- a/src/backend/utils/cache/spccache.c
+++ b/src/backend/utils/cache/spccache.c
@@ -133,9 +133,7 @@ get_tablespace(Oid spcid)
 	 * details for a non-existent tablespace.  We'll just treat that case as if
 	 * no options were specified.
 	 */
-	tp = SearchSysCache(TABLESPACEOID,
-						ObjectIdGetDatum(spcid),
-						0, 0, 0);
+	tp = SearchSysCache1(TABLESPACEOID, ObjectIdGetDatum(spcid));
 	if (!HeapTupleIsValid(tp))
 		opts = NULL;
 	else
diff --git a/src/backend/utils/cache/syscache.c b/src/backend/utils/cache/syscache.c
index 77aed0c..d324fac 100644
--- a/src/backend/utils/cache/syscache.c
+++ b/src/backend/utils/cache/syscache.c
@@ -803,13 +803,14 @@ SearchSysCache(int cacheId,
 			   Datum key1,
 			   Datum key2,
 			   Datum key3,
-			   Datum key4)
+			   Datum key4,
+			   Datum key5)
 {
 	if (cacheId < 0 || cacheId >= SysCacheSize ||
 		!PointerIsValid(SysCache[cacheId]))
 		elog(ERROR, "invalid cache id: %d", cacheId);
 
-	return SearchCatCache(SysCache[cacheId], key1, key2, key3, key4);
+	return SearchCatCache(SysCache[cacheId], key1, key2, key3, key4, key5);
 }
 
 /*
@@ -835,12 +836,13 @@ SearchSysCacheCopy(int cacheId,
 				   Datum key1,
 				   Datum key2,
 				   Datum key3,
-				   Datum key4)
+				   Datum key4,
+				   Datum key5)
 {
 	HeapTuple	tuple,
 				newtuple;
 
-	tuple = SearchSysCache(cacheId, key1, key2, key3, key4);
+	tuple = SearchSysCache(cacheId, key1, key2, key3, key4, key5);
 	if (!HeapTupleIsValid(tuple))
 		return tuple;
 	newtuple = heap_copytuple(tuple);
@@ -859,11 +861,12 @@ SearchSysCacheExists(int cacheId,
 					 Datum key1,
 					 Datum key2,
 					 Datum key3,
-					 Datum key4)
+					 Datum key4,
+					 Datum key5)
 {
 	HeapTuple	tuple;
 
-	tuple = SearchSysCache(cacheId, key1, key2, key3, key4);
+	tuple = SearchSysCache(cacheId, key1, key2, key3, key4, key5);
 	if (!HeapTupleIsValid(tuple))
 		return false;
 	ReleaseSysCache(tuple);
@@ -882,12 +885,13 @@ GetSysCacheOid(int cacheId,
 			   Datum key1,
 			   Datum key2,
 			   Datum key3,
-			   Datum key4)
+			   Datum key4,
+			   Datum key5)
 {
 	HeapTuple	tuple;
 	Oid			result;
 
-	tuple = SearchSysCache(cacheId, key1, key2, key3, key4);
+	tuple = SearchSysCache(cacheId, key1, key2, key3, key4, key5);
 	if (!HeapTupleIsValid(tuple))
 		return InvalidOid;
 	result = HeapTupleGetOid(tuple);
@@ -909,10 +913,9 @@ SearchSysCacheAttName(Oid relid, const char *attname)
 {
 	HeapTuple	tuple;
 
-	tuple = SearchSysCache(ATTNAME,
-						   ObjectIdGetDatum(relid),
-						   CStringGetDatum(attname),
-						   0, 0);
+	tuple = SearchSysCache2(ATTNAME,
+							ObjectIdGetDatum(relid),
+							CStringGetDatum(attname));
 	if (!HeapTupleIsValid(tuple))
 		return NULL;
 	if (((Form_pg_attribute) GETSTRUCT(tuple))->attisdropped)
@@ -1009,12 +1012,12 @@ SysCacheGetAttr(int cacheId, HeapTuple tup,
  */
 struct catclist *
 SearchSysCacheList(int cacheId, int nkeys,
-				   Datum key1, Datum key2, Datum key3, Datum key4)
+				   Datum key1, Datum key2, Datum key3, Datum key4, Datum key5)
 {
 	if (cacheId < 0 || cacheId >= SysCacheSize ||
 		!PointerIsValid(SysCache[cacheId]))
 		elog(ERROR, "invalid cache id: %d", cacheId);
 
 	return SearchCatCacheList(SysCache[cacheId], nkeys,
-							  key1, key2, key3, key4);
+							  key1, key2, key3, key4, key5);
 }
diff --git a/src/backend/utils/cache/ts_cache.c b/src/backend/utils/cache/ts_cache.c
index b4df7ce..77d8e2f 100644
--- a/src/backend/utils/cache/ts_cache.c
+++ b/src/backend/utils/cache/ts_cache.c
@@ -151,9 +151,7 @@ lookup_ts_parser_cache(Oid prsId)
 		HeapTuple	tp;
 		Form_pg_ts_parser prs;
 
-		tp = SearchSysCache(TSPARSEROID,
-							ObjectIdGetDatum(prsId),
-							0, 0, 0);
+		tp = SearchSysCache1(TSPARSEROID, ObjectIdGetDatum(prsId));
 		if (!HeapTupleIsValid(tp))
 			elog(ERROR, "cache lookup failed for text search parser %u",
 				 prsId);
@@ -257,9 +255,7 @@ lookup_ts_dictionary_cache(Oid dictId)
 		Form_pg_ts_template template;
 		MemoryContext saveCtx;
 
-		tpdict = SearchSysCache(TSDICTOID,
-								ObjectIdGetDatum(dictId),
-								0, 0, 0);
+		tpdict = SearchSysCache1(TSDICTOID, ObjectIdGetDatum(dictId));
 		if (!HeapTupleIsValid(tpdict))
 			elog(ERROR, "cache lookup failed for text search dictionary %u",
 				 dictId);
@@ -274,9 +270,8 @@ lookup_ts_dictionary_cache(Oid dictId)
 		/*
 		 * Retrieve dictionary's template
 		 */
-		tptmpl = SearchSysCache(TSTEMPLATEOID,
-								ObjectIdGetDatum(dict->dicttemplate),
-								0, 0, 0);
+		tptmpl = SearchSysCache1(TSTEMPLATEOID,
+								 ObjectIdGetDatum(dict->dicttemplate));
 		if (!HeapTupleIsValid(tptmpl))
 			elog(ERROR, "cache lookup failed for text search template %u",
 				 dict->dicttemplate);
@@ -430,9 +425,7 @@ lookup_ts_config_cache(Oid cfgId)
 		int			ndicts;
 		int			i;
 
-		tp = SearchSysCache(TSCONFIGOID,
-							ObjectIdGetDatum(cfgId),
-							0, 0, 0);
+		tp = SearchSysCache1(TSCONFIGOID, ObjectIdGetDatum(cfgId));
 		if (!HeapTupleIsValid(tp))
 			elog(ERROR, "cache lookup failed for text search configuration %u",
 				 cfgId);
@@ -617,9 +610,7 @@ assignTSCurrentConfig(const char *newval, bool doit, GucSource source)
 		 * Modify the actually stored value to be fully qualified, to ensure
 		 * later changes of search_path don't affect it.
 		 */
-		tuple = SearchSysCache(TSCONFIGOID,
-							   ObjectIdGetDatum(cfgId),
-							   0, 0, 0);
+		tuple = SearchSysCache1(TSCONFIGOID, ObjectIdGetDatum(cfgId));
 		if (!HeapTupleIsValid(tuple))
 			elog(ERROR, "cache lookup failed for text search configuration %u",
 				 cfgId);
diff --git a/src/backend/utils/cache/typcache.c b/src/backend/utils/cache/typcache.c
index 8822c30..89d1e7f 100644
--- a/src/backend/utils/cache/typcache.c
+++ b/src/backend/utils/cache/typcache.c
@@ -135,9 +135,7 @@ lookup_type_cache(Oid type_id, int flags)
 		HeapTuple	tp;
 		Form_pg_type typtup;
 
-		tp = SearchSysCache(TYPEOID,
-							ObjectIdGetDatum(type_id),
-							0, 0, 0);
+		tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type_id));
 		if (!HeapTupleIsValid(tp))
 			elog(ERROR, "cache lookup failed for type %u", type_id);
 		typtup = (Form_pg_type) GETSTRUCT(tp);
diff --git a/src/backend/utils/fmgr/fmgr.c b/src/backend/utils/fmgr/fmgr.c
index 03a1855..227994c 100644
--- a/src/backend/utils/fmgr/fmgr.c
+++ b/src/backend/utils/fmgr/fmgr.c
@@ -206,9 +206,7 @@ fmgr_info_cxt_security(Oid functionId, FmgrInfo *finfo, MemoryContext mcxt,
 	}
 
 	/* Otherwise we need the pg_proc entry */
-	procedureTuple = SearchSysCache(PROCOID,
-									ObjectIdGetDatum(functionId),
-									0, 0, 0);
+	procedureTuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(functionId));
 	if (!HeapTupleIsValid(procedureTuple))
 		elog(ERROR, "cache lookup failed for function %u", functionId);
 	procedureStruct = (Form_pg_proc) GETSTRUCT(procedureTuple);
@@ -396,9 +394,7 @@ fmgr_info_other_lang(Oid functionId, FmgrInfo *finfo, HeapTuple procedureTuple)
 	Form_pg_language languageStruct;
 	FmgrInfo	plfinfo;
 
-	languageTuple = SearchSysCache(LANGOID,
-								   ObjectIdGetDatum(language),
-								   0, 0, 0);
+	languageTuple = SearchSysCache1(LANGOID, ObjectIdGetDatum(language));
 	if (!HeapTupleIsValid(languageTuple))
 		elog(ERROR, "cache lookup failed for language %u", language);
 	languageStruct = (Form_pg_language) GETSTRUCT(languageTuple);
@@ -899,9 +895,8 @@ fmgr_security_definer(PG_FUNCTION_ARGS)
 							   fcinfo->flinfo->fn_mcxt, true);
 		fcache->flinfo.fn_expr = fcinfo->flinfo->fn_expr;
 
-		tuple = SearchSysCache(PROCOID,
-							   ObjectIdGetDatum(fcinfo->flinfo->fn_oid),
-							   0, 0, 0);
+		tuple = SearchSysCache1(PROCOID,
+								ObjectIdGetDatum(fcinfo->flinfo->fn_oid));
 		if (!HeapTupleIsValid(tuple))
 			elog(ERROR, "cache lookup failed for function %u",
 				 fcinfo->flinfo->fn_oid);
diff --git a/src/backend/utils/fmgr/funcapi.c b/src/backend/utils/fmgr/funcapi.c
index 85b819a..63ee73b 100644
--- a/src/backend/utils/fmgr/funcapi.c
+++ b/src/backend/utils/fmgr/funcapi.c
@@ -299,9 +299,7 @@ internal_get_result_type(Oid funcid,
 	TupleDesc	tupdesc;
 
 	/* First fetch the function's pg_proc row to inspect its rettype */
-	tp = SearchSysCache(PROCOID,
-						ObjectIdGetDatum(funcid),
-						0, 0, 0);
+	tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
 	if (!HeapTupleIsValid(tp))
 		elog(ERROR, "cache lookup failed for function %u", funcid);
 	procform = (Form_pg_proc) GETSTRUCT(tp);
@@ -878,9 +876,7 @@ get_func_result_name(Oid functionId)
 	int			i;
 
 	/* First fetch the function's pg_proc row */
-	procTuple = SearchSysCache(PROCOID,
-							   ObjectIdGetDatum(functionId),
-							   0, 0, 0);
+	procTuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(functionId));
 	if (!HeapTupleIsValid(procTuple))
 		elog(ERROR, "cache lookup failed for function %u", functionId);
 
diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c
index 0ceaf17..706e017 100644
--- a/src/backend/utils/init/miscinit.c
+++ b/src/backend/utils/init/miscinit.c
@@ -406,9 +406,7 @@ InitializeSessionUserId(const char *rolename)
 	/* call only once */
 	AssertState(!OidIsValid(AuthenticatedUserId));
 
-	roleTup = SearchSysCache(AUTHNAME,
-							 PointerGetDatum(rolename),
-							 0, 0, 0);
+	roleTup = SearchSysCache1(AUTHNAME, PointerGetDatum(rolename));
 	if (!HeapTupleIsValid(roleTup))
 		ereport(FATAL,
 				(errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION),
@@ -593,9 +591,7 @@ GetUserNameFromId(Oid roleid)
 	HeapTuple	tuple;
 	char	   *result;
 
-	tuple = SearchSysCache(AUTHOID,
-						   ObjectIdGetDatum(roleid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid));
 	if (!HeapTupleIsValid(tuple))
 		ereport(ERROR,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index b2768d2..d2de471 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -240,9 +240,7 @@ CheckMyDatabase(const char *name, bool am_superuser)
 	char	   *ctype;
 
 	/* Fetch our pg_database row normally, via syscache */
-	tup = SearchSysCache(DATABASEOID,
-						 ObjectIdGetDatum(MyDatabaseId),
-						 0, 0, 0);
+	tup = SearchSysCache1(DATABASEOID, ObjectIdGetDatum(MyDatabaseId));
 	if (!HeapTupleIsValid(tup))
 		elog(ERROR, "cache lookup failed for database %u", MyDatabaseId);
 	dbform = (Form_pg_database) GETSTRUCT(tup);
diff --git a/src/backend/utils/mb/mbutils.c b/src/backend/utils/mb/mbutils.c
index 7c216fd..8ad8027 100644
--- a/src/backend/utils/mb/mbutils.c
+++ b/src/backend/utils/mb/mbutils.c
@@ -319,9 +319,7 @@ pg_do_encoding_conversion(unsigned char *src, int len,
 	 * are going into infinite loop!  So we have to make sure that the
 	 * function exists before calling OidFunctionCall.
 	 */
-	if (!SearchSysCacheExists(PROCOID,
-							  ObjectIdGetDatum(proc),
-							  0, 0, 0))
+	if (!SearchSysCacheExists1(PROCOID, ObjectIdGetDatum(proc)))
 	{
 		elog(LOG, "cache lookup failed for function %u", proc);
 		return src;
diff --git a/src/backend/utils/misc/superuser.c b/src/backend/utils/misc/superuser.c
index a534ce0..1f1a9ba 100644
--- a/src/backend/utils/misc/superuser.c
+++ b/src/backend/utils/misc/superuser.c
@@ -67,9 +67,7 @@ superuser_arg(Oid roleid)
 		return true;
 
 	/* OK, look up the information in pg_authid */
-	rtup = SearchSysCache(AUTHOID,
-						  ObjectIdGetDatum(roleid),
-						  0, 0, 0);
+	rtup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid));
 	if (HeapTupleIsValid(rtup))
 	{
 		result = ((Form_pg_authid) GETSTRUCT(rtup))->rolsuper;
diff --git a/src/include/utils/catcache.h b/src/include/utils/catcache.h
index ebae8b7..c0b4a4d 100644
--- a/src/include/utils/catcache.h
+++ b/src/include/utils/catcache.h
@@ -32,6 +32,8 @@
  *		struct catcacheheader:	information for managing all the caches.
  */
 
+#define CATCACHE_MAXKEYS		5
+
 typedef struct catcache
 {
 	int			id;				/* cache identifier --- see syscache.h */
@@ -43,11 +45,11 @@ typedef struct catcache
 	TupleDesc	cc_tupdesc;		/* tuple descriptor (copied from reldesc) */
 	int			cc_ntup;		/* # of tuples currently in this cache */
 	int			cc_nbuckets;	/* # of hash buckets in this cache */
-	int			cc_nkeys;		/* # of keys (1..4) */
-	int			cc_key[4];		/* AttrNumber of each key */
-	PGFunction	cc_hashfunc[4]; /* hash function to use for each key */
-	ScanKeyData cc_skey[4];		/* precomputed key info for heap scans */
-	bool		cc_isname[4];	/* flag key columns that are NAMEs */
+	int			cc_nkeys;		/* # of keys (1..CATCACHE_MAXKEYS) */
+	int			cc_key[CATCACHE_MAXKEYS];		/* AttrNumber of each key */
+	PGFunction	cc_hashfunc[CATCACHE_MAXKEYS]; /* hash function for each key */
+	ScanKeyData cc_skey[CATCACHE_MAXKEYS];		/* precomputed key info for heap scans */
+	bool		cc_isname[CATCACHE_MAXKEYS];	/* flag "name" key columns */
 	Dllist		cc_lists;		/* list of CatCList structs */
 #ifdef CATCACHE_STATS
 	long		cc_searches;	/* total # searches against this cache */
@@ -168,12 +170,14 @@ extern void InitCatCachePhase2(CatCache *cache, bool touch_index);
 
 extern HeapTuple SearchCatCache(CatCache *cache,
 			   Datum v1, Datum v2,
-			   Datum v3, Datum v4);
+			   Datum v3, Datum v4,
+			   Datum v5);
 extern void ReleaseCatCache(HeapTuple tuple);
 
 extern CatCList *SearchCatCacheList(CatCache *cache, int nkeys,
 				   Datum v1, Datum v2,
-				   Datum v3, Datum v4);
+				   Datum v3, Datum v4,
+				   Datum v5);
 extern void ReleaseCatCacheList(CatCList *list);
 
 extern void ResetCatalogCaches(void);
diff --git a/src/include/utils/syscache.h b/src/include/utils/syscache.h
index c6459d0..7e16ba6 100644
--- a/src/include/utils/syscache.h
+++ b/src/include/utils/syscache.h
@@ -91,16 +91,61 @@ extern void InitCatalogCache(void);
 extern void InitCatalogCachePhase2(void);
 
 extern HeapTuple SearchSysCache(int cacheId,
-			   Datum key1, Datum key2, Datum key3, Datum key4);
+			   Datum key1, Datum key2, Datum key3, Datum key4, Datum key5);
 extern void ReleaseSysCache(HeapTuple tuple);
 
+#define SearchSysCache1(cacheId, key1) \
+	SearchSysCache(cacheId, key1, 0, 0, 0, 0)
+#define SearchSysCache2(cacheId, key1, key2) \
+	SearchSysCache(cacheId, key1, key2, 0, 0, 0)
+#define SearchSysCache3(cacheId, key1, key2, key3) \
+	SearchSysCache(cacheId, key1, key2, key3, 0, 0)
+#define SearchSysCache4(cacheId, key1, key2, key3, key4) \
+	SearchSysCache(cacheId, key1, key2, key3, key4, 0)
+#define SearchSysCache5(cacheId, key1, key2, key3, key4, key5) \
+	SearchSysCache(cacheId, key1, key2, key3, key4, key5)
+
 /* convenience routines */
 extern HeapTuple SearchSysCacheCopy(int cacheId,
-				   Datum key1, Datum key2, Datum key3, Datum key4);
+				   Datum key1, Datum key2, Datum key3, Datum key4, Datum key5);
 extern bool SearchSysCacheExists(int cacheId,
-					 Datum key1, Datum key2, Datum key3, Datum key4);
+					 Datum key1, Datum key2, Datum key3, Datum key4,
+					 Datum key5);
 extern Oid GetSysCacheOid(int cacheId,
-			   Datum key1, Datum key2, Datum key3, Datum key4);
+			   Datum key1, Datum key2, Datum key3, Datum key4, Datum key5);
+
+#define SearchSysCacheCopy1(cacheId, key1) \
+	SearchSysCacheCopy(cacheId, key1, 0, 0, 0, 0)
+#define SearchSysCacheCopy2(cacheId, key1, key2) \
+	SearchSysCacheCopy(cacheId, key1, key2, 0, 0, 0)
+#define SearchSysCacheCopy3(cacheId, key1, key2, key3) \
+	SearchSysCacheCopy(cacheId, key1, key2, key3, 0, 0)
+#define SearchSysCacheCopy4(cacheId, key1, key2, key3, key4) \
+	SearchSysCacheCopy(cacheId, key1, key2, key3, key4, 0)
+#define SearchSysCacheCopy5(cacheId, key1, key2, key3, key4, key5) \
+	SearchSysCacheCopy(cacheId, key1, key2, key3, key4, key5)
+
+#define SearchSysCacheExists1(cacheId, key1) \
+	SearchSysCacheExists(cacheId, key1, 0, 0, 0, 0)
+#define SearchSysCacheExists2(cacheId, key1, key2) \
+	SearchSysCacheExists(cacheId, key1, key2, 0, 0, 0)
+#define SearchSysCacheExists3(cacheId, key1, key2, key3) \
+	SearchSysCacheExists(cacheId, key1, key2, key3, 0, 0)
+#define SearchSysCacheExists4(cacheId, key1, key2, key3, key4) \
+	SearchSysCacheExists(cacheId, key1, key2, key3, key4, 0)
+#define SearchSysCacheExists5(cacheId, key1, key2, key3, key4, key5) \
+	SearchSysCacheExists(cacheId, key1, key2, key3, key4, key5)
+
+#define GetSysCacheOid1(cacheId, key1) \
+	GetSysCacheOid(cacheId, key1, 0, 0, 0, 0)
+#define GetSysCacheOid2(cacheId, key1, key2) \
+	GetSysCacheOid(cacheId, key1, key2, 0, 0, 0)
+#define GetSysCacheOid3(cacheId, key1, key2, key3) \
+	GetSysCacheOid(cacheId, key1, key2, key3, 0, 0)
+#define GetSysCacheOid4(cacheId, key1, key2, key3, key4) \
+	GetSysCacheOid(cacheId, key1, key2, key3, key4, 0)
+#define GetSysCacheOid5(cacheId, key1, key2, key3, key4, key5) \
+	GetSysCacheOid(cacheId, key1, key2, key3, key4, key5)
 
 extern HeapTuple SearchSysCacheAttName(Oid relid, const char *attname);
 extern HeapTuple SearchSysCacheCopyAttName(Oid relid, const char *attname);
@@ -111,7 +156,19 @@ extern Datum SysCacheGetAttr(int cacheId, HeapTuple tup,
 
 /* list-search interface.  Users of this must import catcache.h too */
 extern struct catclist *SearchSysCacheList(int cacheId, int nkeys,
-				   Datum key1, Datum key2, Datum key3, Datum key4);
+				   Datum key1, Datum key2, Datum key3, Datum key4,
+				   Datum key5);
+
+#define SearchSysCacheList1(cacheId, key1) \
+	SearchSysCacheList(cacheId, 1, key1, 0, 0, 0, 0)
+#define SearchSysCacheList2(cacheId, key1, key2) \
+	SearchSysCacheList(cacheId, 2, key1, key2, 0, 0, 0)
+#define SearchSysCacheList3(cacheId, key1, key2, key3) \
+	SearchSysCacheList(cacheId, 3, key1, key2, key3, 0, 0)
+#define SearchSysCacheList4(cacheId, key1, key2, key3, key4) \
+	SearchSysCacheList(cacheId, 4, key1, key2, key3, key4, 0)
+#define SearchSysCacheList5(cacheId, key1, key2, key3, key4, key5) \
+	SearchSysCacheList(cacheId, 5, key1, key2, key3, key4, key5)
 
 #define ReleaseSysCacheList(x)	ReleaseCatCacheList(x)
 
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c
index 1a559f3..0bcd249 100644
--- a/src/pl/plperl/plperl.c
+++ b/src/pl/plperl/plperl.c
@@ -1143,9 +1143,7 @@ plperl_validator(PG_FUNCTION_ARGS)
 	int			i;
 
 	/* Get the new function's pg_proc entry */
-	tuple = SearchSysCache(PROCOID,
-						   ObjectIdGetDatum(funcoid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcoid));
 	if (!HeapTupleIsValid(tuple))
 		elog(ERROR, "cache lookup failed for function %u", funcoid);
 	proc = (Form_pg_proc) GETSTRUCT(tuple);
@@ -1717,9 +1715,7 @@ compile_plperl_function(Oid fn_oid, bool is_trigger)
 	ErrorContextCallback plperl_error_context;
 
 	/* We'll need the pg_proc tuple in any case... */
-	procTup = SearchSysCache(PROCOID,
-							 ObjectIdGetDatum(fn_oid),
-							 0, 0, 0);
+	procTup = SearchSysCache1(PROCOID, ObjectIdGetDatum(fn_oid));
 	if (!HeapTupleIsValid(procTup))
 		elog(ERROR, "cache lookup failed for function %u", fn_oid);
 	procStruct = (Form_pg_proc) GETSTRUCT(procTup);
@@ -1808,9 +1804,8 @@ compile_plperl_function(Oid fn_oid, bool is_trigger)
 		/************************************************************
 		 * Lookup the pg_language tuple by Oid
 		 ************************************************************/
-		langTup = SearchSysCache(LANGOID,
-								 ObjectIdGetDatum(procStruct->prolang),
-								 0, 0, 0);
+		langTup = SearchSysCache1(LANGOID,
+								  ObjectIdGetDatum(procStruct->prolang));
 		if (!HeapTupleIsValid(langTup))
 		{
 			free(prodesc->proname);
@@ -1828,9 +1823,9 @@ compile_plperl_function(Oid fn_oid, bool is_trigger)
 		 ************************************************************/
 		if (!is_trigger)
 		{
-			typeTup = SearchSysCache(TYPEOID,
-									 ObjectIdGetDatum(procStruct->prorettype),
-									 0, 0, 0);
+			typeTup =
+				SearchSysCache1(TYPEOID,
+							    ObjectIdGetDatum(procStruct->prorettype));
 			if (!HeapTupleIsValid(typeTup))
 			{
 				free(prodesc->proname);
@@ -1889,9 +1884,8 @@ compile_plperl_function(Oid fn_oid, bool is_trigger)
 			prodesc->nargs = procStruct->pronargs;
 			for (i = 0; i < prodesc->nargs; i++)
 			{
-				typeTup = SearchSysCache(TYPEOID,
-						 ObjectIdGetDatum(procStruct->proargtypes.values[i]),
-										 0, 0, 0);
+				typeTup = SearchSysCache1(TYPEOID,
+						 ObjectIdGetDatum(procStruct->proargtypes.values[i]));
 				if (!HeapTupleIsValid(typeTup))
 				{
 					free(prodesc->proname);
diff --git a/src/pl/plpgsql/src/pl_comp.c b/src/pl/plpgsql/src/pl_comp.c
index f9f3e75..67f8979 100644
--- a/src/pl/plpgsql/src/pl_comp.c
+++ b/src/pl/plpgsql/src/pl_comp.c
@@ -142,9 +142,7 @@ plpgsql_compile(FunctionCallInfo fcinfo, bool forValidator)
 	/*
 	 * Lookup the pg_proc tuple by Oid; we'll need it in any case
 	 */
-	procTup = SearchSysCache(PROCOID,
-							 ObjectIdGetDatum(funcOid),
-							 0, 0, 0);
+	procTup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcOid));
 	if (!HeapTupleIsValid(procTup))
 		elog(ERROR, "cache lookup failed for function %u", funcOid);
 	procStruct = (Form_pg_proc) GETSTRUCT(procTup);
@@ -515,9 +513,7 @@ do_compile(FunctionCallInfo fcinfo,
 			/*
 			 * Lookup the function's return type
 			 */
-			typeTup = SearchSysCache(TYPEOID,
-									 ObjectIdGetDatum(rettypeid),
-									 0, 0, 0);
+			typeTup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(rettypeid));
 			if (!HeapTupleIsValid(typeTup))
 				elog(ERROR, "cache lookup failed for type %u", rettypeid);
 			typeStruct = (Form_pg_type) GETSTRUCT(typeTup);
@@ -1629,9 +1625,7 @@ plpgsql_parse_cwordtype(List *idents)
 	else
 		goto done;
 
-	classtup = SearchSysCache(RELOID,
-							  ObjectIdGetDatum(classOid),
-							  0, 0, 0);
+	classtup = SearchSysCache1(RELOID, ObjectIdGetDatum(classOid));
 	if (!HeapTupleIsValid(classtup))
 		goto done;
 	classStruct = (Form_pg_class) GETSTRUCT(classtup);
@@ -1653,9 +1647,8 @@ plpgsql_parse_cwordtype(List *idents)
 		goto done;
 	attrStruct = (Form_pg_attribute) GETSTRUCT(attrtup);
 
-	typetup = SearchSysCache(TYPEOID,
-							 ObjectIdGetDatum(attrStruct->atttypid),
-							 0, 0, 0);
+	typetup = SearchSysCache1(TYPEOID,
+							  ObjectIdGetDatum(attrStruct->atttypid));
 	if (!HeapTupleIsValid(typetup))
 		elog(ERROR, "cache lookup failed for type %u", attrStruct->atttypid);
 
@@ -1998,9 +1991,7 @@ plpgsql_build_datatype(Oid typeOid, int32 typmod)
 	HeapTuple	typeTup;
 	PLpgSQL_type *typ;
 
-	typeTup = SearchSysCache(TYPEOID,
-							 ObjectIdGetDatum(typeOid),
-							 0, 0, 0);
+	typeTup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typeOid));
 	if (!HeapTupleIsValid(typeTup))
 		elog(ERROR, "cache lookup failed for type %u", typeOid);
 
diff --git a/src/pl/plpgsql/src/pl_handler.c b/src/pl/plpgsql/src/pl_handler.c
index f9afcbb..3b823f5 100644
--- a/src/pl/plpgsql/src/pl_handler.c
+++ b/src/pl/plpgsql/src/pl_handler.c
@@ -218,9 +218,7 @@ plpgsql_validator(PG_FUNCTION_ARGS)
 	int			i;
 
 	/* Get the new function's pg_proc entry */
-	tuple = SearchSysCache(PROCOID,
-						   ObjectIdGetDatum(funcoid),
-						   0, 0, 0);
+	tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcoid));
 	if (!HeapTupleIsValid(tuple))
 		elog(ERROR, "cache lookup failed for function %u", funcoid);
 	proc = (Form_pg_proc) GETSTRUCT(tuple);
diff --git a/src/pl/plpython/plpython.c b/src/pl/plpython/plpython.c
index 1d29739..b6511b3 100644
--- a/src/pl/plpython/plpython.c
+++ b/src/pl/plpython/plpython.c
@@ -1287,9 +1287,7 @@ PLy_procedure_get(FunctionCallInfo fcinfo, Oid tgreloid)
 	int			rv;
 
 	fn_oid = fcinfo->flinfo->fn_oid;
-	procTup = SearchSysCache(PROCOID,
-							 ObjectIdGetDatum(fn_oid),
-							 0, 0, 0);
+	procTup = SearchSysCache1(PROCOID, ObjectIdGetDatum(fn_oid));
 	if (!HeapTupleIsValid(procTup))
 		elog(ERROR, "cache lookup failed for function %u", fn_oid);
 
@@ -1399,9 +1397,8 @@ PLy_procedure_create(HeapTuple procTup, Oid tgreloid, char *key)
 			HeapTuple	rvTypeTup;
 			Form_pg_type rvTypeStruct;
 
-			rvTypeTup = SearchSysCache(TYPEOID,
-									ObjectIdGetDatum(procStruct->prorettype),
-									   0, 0, 0);
+			rvTypeTup = SearchSysCache1(TYPEOID,
+									ObjectIdGetDatum(procStruct->prorettype));
 			if (!HeapTupleIsValid(rvTypeTup))
 				elog(ERROR, "cache lookup failed for type %u",
 					 procStruct->prorettype);
@@ -1483,9 +1480,8 @@ PLy_procedure_create(HeapTuple procTup, Oid tgreloid, char *key)
 
 				Assert(types[i] == procStruct->proargtypes.values[pos]);
 
-				argTypeTup = SearchSysCache(TYPEOID,
-											ObjectIdGetDatum(types[i]),
-											0, 0, 0);
+				argTypeTup = SearchSysCache1(TYPEOID,
+											 ObjectIdGetDatum(types[i]));
 				if (!HeapTupleIsValid(argTypeTup))
 					elog(ERROR, "cache lookup failed for type %u", types[i]);
 				argTypeStruct = (Form_pg_type) GETSTRUCT(argTypeTup);
@@ -1699,9 +1695,8 @@ PLy_input_tuple_funcs(PLyTypeInfo *arg, TupleDesc desc)
 		if (arg->in.r.atts[i].typoid == desc->attrs[i]->atttypid)
 			continue;			/* already set up this entry */
 
-		typeTup = SearchSysCache(TYPEOID,
-								 ObjectIdGetDatum(desc->attrs[i]->atttypid),
-								 0, 0, 0);
+		typeTup = SearchSysCache1(TYPEOID,
+								  ObjectIdGetDatum(desc->attrs[i]->atttypid));
 		if (!HeapTupleIsValid(typeTup))
 			elog(ERROR, "cache lookup failed for type %u",
 				 desc->attrs[i]->atttypid);
@@ -1741,9 +1736,8 @@ PLy_output_tuple_funcs(PLyTypeInfo *arg, TupleDesc desc)
 		if (arg->out.r.atts[i].typoid == desc->attrs[i]->atttypid)
 			continue;			/* already set up this entry */
 
-		typeTup = SearchSysCache(TYPEOID,
-								 ObjectIdGetDatum(desc->attrs[i]->atttypid),
-								 0, 0, 0);
+		typeTup = SearchSysCache1(TYPEOID,
+								  ObjectIdGetDatum(desc->attrs[i]->atttypid));
 		if (!HeapTupleIsValid(typeTup))
 			elog(ERROR, "cache lookup failed for type %u",
 				 desc->attrs[i]->atttypid);
@@ -2850,9 +2844,8 @@ PLy_spi_prepare(PyObject *self, PyObject *args)
 
 					parseTypeString(sptr, &typeId, &typmod);
 
-					typeTup = SearchSysCache(TYPEOID,
-											 ObjectIdGetDatum(typeId),
-											 0, 0, 0);
+					typeTup = SearchSysCache1(TYPEOID,
+											  ObjectIdGetDatum(typeId));
 					if (!HeapTupleIsValid(typeTup))
 						elog(ERROR, "cache lookup failed for type %u", typeId);
 
diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c
index 350d471..b05364a 100644
--- a/src/pl/tcl/pltcl.c
+++ b/src/pl/tcl/pltcl.c
@@ -958,9 +958,8 @@ pltcl_trigger_handler(PG_FUNCTION_ARGS)
 			 * Lookup the attribute type in the syscache
 			 * for the input function
 			 ************************************************************/
-			typeTup = SearchSysCache(TYPEOID,
-					  ObjectIdGetDatum(tupdesc->attrs[attnum - 1]->atttypid),
-									 0, 0, 0);
+			typeTup = SearchSysCache1(TYPEOID,
+					  ObjectIdGetDatum(tupdesc->attrs[attnum - 1]->atttypid));
 			if (!HeapTupleIsValid(typeTup))
 				elog(ERROR, "cache lookup failed for type %u",
 					 tupdesc->attrs[attnum - 1]->atttypid);
@@ -1055,9 +1054,7 @@ compile_pltcl_function(Oid fn_oid, Oid tgreloid)
 	int			tcl_rc;
 
 	/* We'll need the pg_proc tuple in any case... */
-	procTup = SearchSysCache(PROCOID,
-							 ObjectIdGetDatum(fn_oid),
-							 0, 0, 0);
+	procTup = SearchSysCache1(PROCOID, ObjectIdGetDatum(fn_oid));
 	if (!HeapTupleIsValid(procTup))
 		elog(ERROR, "cache lookup failed for function %u", fn_oid);
 	procStruct = (Form_pg_proc) GETSTRUCT(procTup);
@@ -1141,9 +1138,8 @@ compile_pltcl_function(Oid fn_oid, Oid tgreloid)
 		/************************************************************
 		 * Lookup the pg_language tuple by Oid
 		 ************************************************************/
-		langTup = SearchSysCache(LANGOID,
-								 ObjectIdGetDatum(procStruct->prolang),
-								 0, 0, 0);
+		langTup = SearchSysCache1(LANGOID,
+								  ObjectIdGetDatum(procStruct->prolang));
 		if (!HeapTupleIsValid(langTup))
 		{
 			free(prodesc->user_proname);
@@ -1167,9 +1163,9 @@ compile_pltcl_function(Oid fn_oid, Oid tgreloid)
 		 ************************************************************/
 		if (!is_trigger)
 		{
-			typeTup = SearchSysCache(TYPEOID,
-									 ObjectIdGetDatum(procStruct->prorettype),
-									 0, 0, 0);
+			typeTup =
+				SearchSysCache1(TYPEOID,
+							    ObjectIdGetDatum(procStruct->prorettype));
 			if (!HeapTupleIsValid(typeTup))
 			{
 				free(prodesc->user_proname);
@@ -1232,9 +1228,8 @@ compile_pltcl_function(Oid fn_oid, Oid tgreloid)
 			proc_internal_args[0] = '\0';
 			for (i = 0; i < prodesc->nargs; i++)
 			{
-				typeTup = SearchSysCache(TYPEOID,
-						 ObjectIdGetDatum(procStruct->proargtypes.values[i]),
-										 0, 0, 0);
+				typeTup = SearchSysCache1(TYPEOID,
+						 ObjectIdGetDatum(procStruct->proargtypes.values[i]));
 				if (!HeapTupleIsValid(typeTup))
 				{
 					free(prodesc->user_proname);
@@ -2337,9 +2332,8 @@ pltcl_set_tuple_values(Tcl_Interp *interp, CONST84 char *arrayname,
 		 * Lookup the attribute type in the syscache
 		 * for the output function
 		 ************************************************************/
-		typeTup = SearchSysCache(TYPEOID,
-							   ObjectIdGetDatum(tupdesc->attrs[i]->atttypid),
-								 0, 0, 0);
+		typeTup = SearchSysCache1(TYPEOID,
+							   ObjectIdGetDatum(tupdesc->attrs[i]->atttypid));
 		if (!HeapTupleIsValid(typeTup))
 			elog(ERROR, "cache lookup failed for type %u",
 				 tupdesc->attrs[i]->atttypid);
@@ -2406,9 +2400,8 @@ pltcl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc,
 		 * Lookup the attribute type in the syscache
 		 * for the output function
 		 ************************************************************/
-		typeTup = SearchSysCache(TYPEOID,
-							   ObjectIdGetDatum(tupdesc->attrs[i]->atttypid),
-								 0, 0, 0);
+		typeTup = SearchSysCache1(TYPEOID,
+							   ObjectIdGetDatum(tupdesc->attrs[i]->atttypid));
 		if (!HeapTupleIsValid(typeTup))
 			elog(ERROR, "cache lookup failed for type %u",
 				 tupdesc->attrs[i]->atttypid);