diff --git a/contrib/dblink/dblink.c b/contrib/dblink/dblink.c index 9806160be2..bb19abb965 100644 --- a/contrib/dblink/dblink.c +++ b/contrib/dblink/dblink.c @@ -8,7 +8,7 @@ * Darko Prenosil * Shridhar Daithankar * - * $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.88 2010/02/03 23:01:11 joe Exp $ + * $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.89 2010/02/14 18:42:11 rhaas Exp $ * Copyright (c) 2001-2010, PostgreSQL Global Development Group * ALL RIGHTS RESERVED; * @@ -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 9edecda2d8..2125fdfb0b 100644 --- a/src/backend/access/common/tupdesc.c +++ b/src/backend/access/common/tupdesc.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/common/tupdesc.c,v 1.132 2010/01/22 16:40:18 rhaas Exp $ + * $PostgreSQL: pgsql/src/backend/access/common/tupdesc.c,v 1.133 2010/02/14 18:42:12 rhaas Exp $ * * NOTES * some of the executor utility code such as "ExecTypeFromTL" should be @@ -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 9983ff65c8..4dfb85ac56 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.286 2010/02/08 04:33:52 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.287 2010/02/14 18:42:12 rhaas Exp $ * * * INTERFACE ROUTINES @@ -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 cd9334dd87..79bc4ba580 100644 --- a/src/backend/access/transam/varsup.c +++ b/src/backend/access/transam/varsup.c @@ -6,7 +6,7 @@ * Copyright (c) 2000-2010, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/transam/varsup.c,v 1.87 2010/01/02 16:57:35 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/varsup.c,v 1.88 2010/02/14 18:42:12 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 d1b287c039..1576191737 100644 --- a/src/backend/catalog/aclchk.c +++ b/src/backend/catalog/aclchk.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/aclchk.c,v 1.161 2010/01/07 02:41:15 rhaas Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/aclchk.c,v 1.162 2010/02/14 18:42:12 rhaas Exp $ * * NOTES * See acl.h. @@ -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 ca80c47fa1..e4fa47d27f 100644 --- a/src/backend/catalog/dependency.c +++ b/src/backend/catalog/dependency.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/dependency.c,v 1.94 2010/01/02 16:57:36 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/dependency.c,v 1.95 2010/02/14 18:42:12 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 bc232cd143..b4d448da3e 100644 --- a/src/backend/catalog/heap.c +++ b/src/backend/catalog/heap.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.370 2010/02/07 20:48:09 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.371 2010/02/14 18:42:13 rhaas Exp $ * * * INTERFACE ROUTINES @@ -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 e1785c887c..e90b92dcf6 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/index.c,v 1.335 2010/02/08 04:33:53 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/index.c,v 1.336 2010/02/14 18:42:13 rhaas Exp $ * * * INTERFACE ROUTINES @@ -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 a345d98e64..e3f528fc4a 100644 --- a/src/backend/catalog/namespace.c +++ b/src/backend/catalog/namespace.c @@ -13,7 +13,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.122 2010/02/02 18:52:33 rhaas Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.123 2010/02/14 18:42:13 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 53262b6370..ddb16a2745 100644 --- a/src/backend/catalog/pg_aggregate.c +++ b/src/backend/catalog/pg_aggregate.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/pg_aggregate.c,v 1.104 2010/01/02 16:57:36 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/pg_aggregate.c,v 1.105 2010/02/14 18:42:13 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 ceb4fcd4f0..6d453538b3 100644 --- a/src/backend/catalog/pg_constraint.c +++ b/src/backend/catalog/pg_constraint.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/pg_constraint.c,v 1.51 2010/01/02 16:57:36 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/pg_constraint.c,v 1.52 2010/02/14 18:42:13 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 cb3654a893..574eef56e1 100644 --- a/src/backend/catalog/pg_conversion.c +++ b/src/backend/catalog/pg_conversion.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/pg_conversion.c,v 1.49 2010/02/02 18:52:33 rhaas Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/pg_conversion.c,v 1.50 2010/02/14 18:42:13 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 bbba5ae5cb..14bef8bf3b 100644 --- a/src/backend/catalog/pg_inherits.c +++ b/src/backend/catalog/pg_inherits.c @@ -13,7 +13,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/pg_inherits.c,v 1.6 2010/02/01 19:28:56 rhaas Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/pg_inherits.c,v 1.7 2010/02/14 18:42:13 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 80a79e19fa..79d03b317a 100644 --- a/src/backend/catalog/pg_namespace.c +++ b/src/backend/catalog/pg_namespace.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/pg_namespace.c,v 1.22 2010/01/02 16:57:36 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/pg_namespace.c,v 1.23 2010/02/14 18:42:13 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 23e96258b5..8eebb1d496 100644 --- a/src/backend/catalog/pg_operator.c +++ b/src/backend/catalog/pg_operator.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/pg_operator.c,v 1.110 2010/01/02 16:57:36 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/pg_operator.c,v 1.111 2010/02/14 18:42:13 rhaas Exp $ * * NOTES * these routines moved here from commands/define.c and somewhat cleaned up. @@ -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 bdcbf6b67b..fc87a80c4d 100644 --- a/src/backend/catalog/pg_proc.c +++ b/src/backend/catalog/pg_proc.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.170 2010/01/02 16:57:36 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.171 2010/02/14 18:42:13 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 1bdc340a65..999776402d 100644 --- a/src/backend/catalog/pg_shdepend.c +++ b/src/backend/catalog/pg_shdepend.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/pg_shdepend.c,v 1.38 2010/01/02 16:57:36 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/pg_shdepend.c,v 1.39 2010/02/14 18:42:13 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 7bc11af76c..e8ff841a72 100644 --- a/src/backend/catalog/pg_type.c +++ b/src/backend/catalog/pg_type.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/pg_type.c,v 1.131 2010/01/02 16:57:36 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/pg_type.c,v 1.132 2010/02/14 18:42:13 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 35bade50ea..363d21ac61 100644 --- a/src/backend/catalog/toasting.c +++ b/src/backend/catalog/toasting.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/toasting.c,v 1.30 2010/02/07 20:48:10 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/toasting.c,v 1.31 2010/02/14 18:42:13 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 7689708b8a..2c6ce59222 100644 --- a/src/backend/commands/aggregatecmds.c +++ b/src/backend/commands/aggregatecmds.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/aggregatecmds.c,v 1.51 2010/01/02 16:57:36 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/commands/aggregatecmds.c,v 1.52 2010/02/14 18:42:13 rhaas Exp $ * * DESCRIPTION * The "DefineFoo" routines take the parse tree and pick out the @@ -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 47179ec602..32fb44051c 100644 --- a/src/backend/commands/analyze.c +++ b/src/backend/commands/analyze.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.150 2010/02/08 04:33:53 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.151 2010/02/14 18:42:13 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 07817daf1f..eed4d51edc 100644 --- a/src/backend/commands/cluster.c +++ b/src/backend/commands/cluster.c @@ -11,7 +11,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.200 2010/02/09 21:43:30 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.201 2010/02/14 18:42:14 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 ac89f86d97..6577af4969 100644 --- a/src/backend/commands/comment.c +++ b/src/backend/commands/comment.c @@ -7,7 +7,7 @@ * Copyright (c) 1996-2010, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/comment.c,v 1.112 2010/01/02 16:57:37 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/commands/comment.c,v 1.113 2010/02/14 18:42:14 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 149237e31b..2e5a7dfe9e 100644 --- a/src/backend/commands/conversioncmds.c +++ b/src/backend/commands/conversioncmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/conversioncmds.c,v 1.40 2010/01/02 16:57:37 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/commands/conversioncmds.c,v 1.41 2010/02/14 18:42:14 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 320c1773b8..9c6f1b6936 100644 --- a/src/backend/commands/dbcommands.c +++ b/src/backend/commands/dbcommands.c @@ -13,7 +13,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.233 2010/01/16 14:16:31 sriggs Exp $ + * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.234 2010/02/14 18:42:14 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 2ba58ea900..abbe731b14 100644 --- a/src/backend/commands/foreigncmds.c +++ b/src/backend/commands/foreigncmds.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/foreigncmds.c,v 1.10 2010/01/02 16:57:37 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/commands/foreigncmds.c,v 1.11 2010/02/14 18:42:14 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 5c8e13bc9a..0a9920097b 100644 --- a/src/backend/commands/functioncmds.c +++ b/src/backend/commands/functioncmds.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.115 2010/01/26 16:33:40 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.116 2010/02/14 18:42:14 rhaas Exp $ * * DESCRIPTION * These routines take the parse tree and pick out the @@ -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 b79723a777..dee14d57f6 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/indexcmds.c,v 1.192 2010/02/07 22:40:33 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/indexcmds.c,v 1.193 2010/02/14 18:42:14 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 0a7635da68..a043680e34 100644 --- a/src/backend/commands/opclasscmds.c +++ b/src/backend/commands/opclasscmds.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/opclasscmds.c,v 1.65 2010/01/02 16:57:37 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/commands/opclasscmds.c,v 1.66 2010/02/14 18:42:14 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 d567b05cf0..ff94aea42d 100644 --- a/src/backend/commands/operatorcmds.c +++ b/src/backend/commands/operatorcmds.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/operatorcmds.c,v 1.44 2010/01/02 16:57:37 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/commands/operatorcmds.c,v 1.45 2010/02/14 18:42:14 rhaas Exp $ * * DESCRIPTION * The "DefineFoo" routines take the parse tree and pick out the @@ -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 494d56c6b9..e51675ee11 100644 --- a/src/backend/commands/proclang.c +++ b/src/backend/commands/proclang.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/proclang.c,v 1.88 2010/01/02 16:57:37 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/commands/proclang.c,v 1.89 2010/02/14 18:42:14 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 09a284d7a1..1357493813 100644 --- a/src/backend/commands/schemacmds.c +++ b/src/backend/commands/schemacmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/schemacmds.c,v 1.55 2010/01/02 16:57:37 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/commands/schemacmds.c,v 1.56 2010/02/14 18:42:14 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 d6c6696e2b..7215ca91e9 100644 --- a/src/backend/commands/sequence.c +++ b/src/backend/commands/sequence.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/sequence.c,v 1.165 2010/02/09 21:43:30 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/sequence.c,v 1.166 2010/02/14 18:42:14 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 683c7f58d8..228304562d 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.325 2010/02/07 20:48:10 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.326 2010/02/14 18:42:14 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 cec815cf60..49c913c00b 100644 --- a/src/backend/commands/trigger.c +++ b/src/backend/commands/trigger.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.260 2010/01/24 21:49:17 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.261 2010/02/14 18:42:14 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 ae2f41370d..522ea6e2f5 100644 --- a/src/backend/commands/tsearchcmds.c +++ b/src/backend/commands/tsearchcmds.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/tsearchcmds.c,v 1.19 2010/01/02 16:57:39 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/commands/tsearchcmds.c,v 1.20 2010/02/14 18:42:14 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 7d5b409f59..86d631a0ad 100644 --- a/src/backend/commands/typecmds.c +++ b/src/backend/commands/typecmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.146 2010/01/20 05:47:09 petere Exp $ + * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.147 2010/02/14 18:42:14 rhaas Exp $ * * DESCRIPTION * The "DefineFoo" routines take the parse tree and pick out the @@ -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 632904be7a..3671156554 100644 --- a/src/backend/commands/user.c +++ b/src/backend/commands/user.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.191 2010/01/02 16:57:39 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.192 2010/02/14 18:42:14 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 ff4178bd21..fa6b2371c1 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -14,7 +14,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.407 2010/02/09 21:43:30 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.408 2010/02/14 18:42:14 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 fc115012f5..835b548235 100644 --- a/src/backend/commands/variable.c +++ b/src/backend/commands/variable.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/variable.c,v 1.132 2010/01/02 16:57:40 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/commands/variable.c,v 1.133 2010/02/14 18:42:14 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 bb5ad28130..dfc3636580 100644 --- a/src/backend/executor/execAmi.c +++ b/src/backend/executor/execAmi.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/executor/execAmi.c,v 1.107 2010/01/02 16:57:40 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/executor/execAmi.c,v 1.108 2010/02/14 18:42:14 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 831f38882f..88b47316e2 100644 --- a/src/backend/executor/functions.c +++ b/src/backend/executor/functions.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.140 2010/01/02 16:57:41 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.141 2010/02/14 18:42:14 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 9f748ca6c0..14a0a091b0 100644 --- a/src/backend/executor/nodeAgg.c +++ b/src/backend/executor/nodeAgg.c @@ -71,7 +71,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeAgg.c,v 1.173 2010/02/12 17:33:19 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeAgg.c,v 1.174 2010/02/14 18:42:14 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 86bbef9be0..6a41a29012 100644 --- a/src/backend/executor/nodeHash.c +++ b/src/backend/executor/nodeHash.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeHash.c,v 1.127 2010/02/01 15:43:36 rhaas Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeHash.c,v 1.128 2010/02/14 18:42:14 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 c2c0af3cde..2668d83b03 100644 --- a/src/backend/executor/nodeWindowAgg.c +++ b/src/backend/executor/nodeWindowAgg.c @@ -27,7 +27,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeWindowAgg.c,v 1.10 2010/02/12 17:33:19 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeWindowAgg.c,v 1.11 2010/02/14 18:42:14 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -1726,9 +1726,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); @@ -1747,9 +1745,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 35261444d6..a78474f037 100644 --- a/src/backend/executor/spi.c +++ b/src/backend/executor/spi.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.213 2010/01/02 16:57:45 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.214 2010/02/14 18:42:14 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 e13f7277e8..042dbed13d 100644 --- a/src/backend/foreign/foreign.c +++ b/src/backend/foreign/foreign.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/foreign/foreign.c,v 1.7 2010/01/02 16:57:45 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/foreign/foreign.c,v 1.8 2010/02/14 18:42:14 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 c160b763f9..56a20a6749 100644 --- a/src/backend/libpq/crypt.c +++ b/src/backend/libpq/crypt.c @@ -9,7 +9,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/libpq/crypt.c,v 1.79 2010/01/02 16:57:45 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/libpq/crypt.c,v 1.80 2010/02/14 18:42:15 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 ce8e7fbd6a..021662607b 100644 --- a/src/backend/optimizer/plan/planagg.c +++ b/src/backend/optimizer/plan/planagg.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/plan/planagg.c,v 1.50 2010/01/02 16:57:47 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/plan/planagg.c,v 1.51 2010/02/14 18:42:15 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 18e721a581..d1d875d3cf 100644 --- a/src/backend/optimizer/plan/setrefs.c +++ b/src/backend/optimizer/plan/setrefs.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/plan/setrefs.c,v 1.158 2010/02/12 17:33:20 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/plan/setrefs.c,v 1.159 2010/02/14 18:42:15 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -1898,9 +1898,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 d75981467b..202243c35b 100644 --- a/src/backend/optimizer/plan/subselect.c +++ b/src/backend/optimizer/plan/subselect.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/plan/subselect.c,v 1.159 2010/02/12 17:33:20 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/plan/subselect.c,v 1.160 2010/02/14 18:42:15 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 5910246dc9..91bdb3537e 100644 --- a/src/backend/optimizer/util/clauses.c +++ b/src/backend/optimizer/util/clauses.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.284 2010/01/19 16:33:33 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.285 2010/02/14 18:42:15 rhaas Exp $ * * HISTORY * AUTHOR DATE MAJOR EVENT @@ -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 91b6d49e0e..dd19e4390b 100644 --- a/src/backend/optimizer/util/predtest.c +++ b/src/backend/optimizer/util/predtest.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/util/predtest.c,v 1.30 2010/01/02 16:57:48 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/predtest.c,v 1.31 2010/02/14 18:42:15 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 b6bead8a18..66ce032cee 100644 --- a/src/backend/parser/parse_coerce.c +++ b/src/backend/parser/parse_coerce.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_coerce.c,v 2.179 2010/01/02 16:57:49 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_coerce.c,v 2.180 2010/02/14 18:42:15 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 0408997100..df34711af6 100644 --- a/src/backend/parser/parse_func.c +++ b/src/backend/parser/parse_func.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_func.c,v 1.220 2010/01/02 16:57:49 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_func.c,v 1.221 2010/02/14 18:42:15 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 86459af716..59f1245fd6 100644 --- a/src/backend/parser/parse_node.c +++ b/src/backend/parser/parse_node.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_node.c,v 1.107 2010/01/02 16:57:49 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_node.c,v 1.108 2010/02/14 18:42:15 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 98af55274e..daa9e2341f 100644 --- a/src/backend/parser/parse_oper.c +++ b/src/backend/parser/parse_oper.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_oper.c,v 1.111 2010/01/02 16:57:50 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_oper.c,v 1.112 2010/02/14 18:42:15 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 19dd9446f5..34f2dc410b 100644 --- a/src/backend/parser/parse_relation.c +++ b/src/backend/parser/parse_relation.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_relation.c,v 1.148 2010/01/02 16:57:50 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_relation.c,v 1.149 2010/02/14 18:42:15 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 61d704d183..006f406455 100644 --- a/src/backend/parser/parse_type.c +++ b/src/backend/parser/parse_type.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_type.c,v 1.105 2010/01/02 16:57:50 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_type.c,v 1.106 2010/02/14 18:42:15 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 f2b29d327c..4a5a572545 100644 --- a/src/backend/parser/parse_utilcmd.c +++ b/src/backend/parser/parse_utilcmd.c @@ -19,7 +19,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/parser/parse_utilcmd.c,v 2.38 2010/02/03 05:46:37 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_utilcmd.c,v 2.39 2010/02/14 18:42:15 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 d29732dea5..8d7282b512 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -55,7 +55,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.107 2010/01/02 16:57:50 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.108 2010/02/14 18:42:15 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 ac0278244a..06469b31cf 100644 --- a/src/backend/rewrite/rewriteDefine.c +++ b/src/backend/rewrite/rewriteDefine.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/rewrite/rewriteDefine.c,v 1.140 2010/01/02 16:57:51 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/rewrite/rewriteDefine.c,v 1.141 2010/02/14 18:42:15 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 b362eb7a94..2bbfc1f2fa 100644 --- a/src/backend/rewrite/rewriteRemove.c +++ b/src/backend/rewrite/rewriteRemove.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/rewrite/rewriteRemove.c,v 1.79 2010/01/02 16:57:51 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/rewrite/rewriteRemove.c,v 1.80 2010/02/14 18:42:15 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 68735860da..8f668f5791 100644 --- a/src/backend/rewrite/rewriteSupport.c +++ b/src/backend/rewrite/rewriteSupport.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/rewrite/rewriteSupport.c,v 1.68 2010/01/02 16:57:51 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/rewrite/rewriteSupport.c,v 1.69 2010/02/14 18:42:15 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 ddb48926da..75e4791546 100644 --- a/src/backend/tcop/fastpath.c +++ b/src/backend/tcop/fastpath.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/tcop/fastpath.c,v 1.102 2010/01/02 16:57:52 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/tcop/fastpath.c,v 1.103 2010/02/14 18:42:15 rhaas Exp $ * * NOTES * This cruft is the server side of PQfn. @@ -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 28e7b1e7f8..4879970632 100644 --- a/src/backend/tcop/utility.c +++ b/src/backend/tcop/utility.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/tcop/utility.c,v 1.331 2010/01/29 06:03:15 itagaki Exp $ + * $PostgreSQL: pgsql/src/backend/tcop/utility.c,v 1.332 2010/02/14 18:42:15 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 52e4999900..8457fc5e48 100644 --- a/src/backend/utils/adt/acl.c +++ b/src/backend/utils/adt/acl.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/acl.c,v 1.155 2010/01/12 02:39:22 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/acl.c,v 1.156 2010/02/14 18:42:16 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 d894e8906c..2bb2427c06 100644 --- a/src/backend/utils/adt/dbsize.c +++ b/src/backend/utils/adt/dbsize.c @@ -5,7 +5,7 @@ * Copyright (c) 2002-2010, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/dbsize.c,v 1.29 2010/02/07 20:48:10 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/dbsize.c,v 1.30 2010/02/14 18:42:16 rhaas Exp $ * */ @@ -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 307a8de321..ebee928f17 100644 --- a/src/backend/utils/adt/enum.c +++ b/src/backend/utils/adt/enum.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/enum.c,v 1.9 2010/01/02 16:57:53 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/enum.c,v 1.10 2010/02/14 18:42:16 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 4ba4636a16..bdb1d62814 100644 --- a/src/backend/utils/adt/format_type.c +++ b/src/backend/utils/adt/format_type.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/format_type.c,v 1.52 2010/01/02 16:57:53 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/format_type.c,v 1.53 2010/02/14 18:42:16 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 d32fff2731..b050d02a06 100644 --- a/src/backend/utils/adt/regproc.c +++ b/src/backend/utils/adt/regproc.c @@ -13,7 +13,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/regproc.c,v 1.112 2010/01/02 16:57:55 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/regproc.c,v 1.113 2010/02/14 18:42:16 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 ecd7b56a26..2d0ab44b7d 100644 --- a/src/backend/utils/adt/ri_triggers.c +++ b/src/backend/utils/adt/ri_triggers.c @@ -15,7 +15,7 @@ * * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/backend/utils/adt/ri_triggers.c,v 1.117 2010/01/02 16:57:55 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/ri_triggers.c,v 1.118 2010/02/14 18:42:16 rhaas Exp $ * * ---------- */ @@ -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 202d68f589..b2127a3129 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.321 2010/02/12 17:33:20 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.322 2010/02/14 18:42:16 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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); @@ -5342,9 +5320,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); @@ -6273,9 +6249,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); @@ -6512,9 +6486,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); @@ -6582,9 +6554,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); @@ -6650,9 +6620,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); @@ -6730,9 +6698,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 4bd302eab5..b83cd45d7c 100644 --- a/src/backend/utils/adt/selfuncs.c +++ b/src/backend/utils/adt/selfuncs.c @@ -15,7 +15,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.268 2010/01/05 21:53:59 rhaas Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.269 2010/02/14 18:42:16 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 504a35e94c..b32d03f90f 100644 --- a/src/backend/utils/adt/xml.c +++ b/src/backend/utils/adt/xml.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.95 2010/01/02 16:57:55 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.96 2010/02/14 18:42:17 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 f553655803..e5f4dfcbbd 100644 --- a/src/backend/utils/cache/attoptcache.c +++ b/src/backend/utils/cache/attoptcache.c @@ -10,7 +10,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/cache/attoptcache.c,v 1.1 2010/01/22 16:42:31 rhaas Exp $ + * $PostgreSQL: pgsql/src/backend/utils/cache/attoptcache.c,v 1.2 2010/02/14 18:42:17 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 8851e23661..ad9a263b5a 100644 --- a/src/backend/utils/cache/catcache.c +++ b/src/backend/utils/cache/catcache.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/cache/catcache.c,v 1.150 2010/02/08 05:53:55 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/cache/catcache.c,v 1.151 2010/02/14 18:42:17 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -226,7 +226,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 */ @@ -1038,7 +1038,7 @@ SearchCatCache(CatCache *cache, Datum v3, Datum v4) { - ScanKeyData cur_skey[4]; + ScanKeyData cur_skey[CATCACHE_MAXKEYS]; uint32 hashValue; Index hashIndex; Dlelem *elt; @@ -1279,7 +1279,7 @@ SearchCatCacheList(CatCache *cache, Datum v3, Datum v4) { - ScanKeyData cur_skey[4]; + ScanKeyData cur_skey[CATCACHE_MAXKEYS]; uint32 lHashValue; Dlelem *elt; CatCList *cl; diff --git a/src/backend/utils/cache/inval.c b/src/backend/utils/cache/inval.c index 54a7af8053..2f1aefcc34 100644 --- a/src/backend/utils/cache/inval.c +++ b/src/backend/utils/cache/inval.c @@ -80,7 +80,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/cache/inval.c,v 1.96 2010/02/13 16:15:47 sriggs Exp $ + * $PostgreSQL: pgsql/src/backend/utils/cache/inval.c,v 1.97 2010/02/14 18:42:17 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -1135,9 +1135,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 e68a16c49f..4769f6f35e 100644 --- a/src/backend/utils/cache/lsyscache.c +++ b/src/backend/utils/cache/lsyscache.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/cache/lsyscache.c,v 1.166 2010/01/04 02:44:40 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/cache/lsyscache.c,v 1.167 2010/02/14 18:42:17 rhaas Exp $ * * NOTES * Eventually, the index information should go through here, too. @@ -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 0492f73e2e..cc62c4fb7c 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.305 2010/02/09 21:43:30 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.306 2010/02/14 18:42:17 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 6f28da3203..8a60fe4f42 100644 --- a/src/backend/utils/cache/spccache.c +++ b/src/backend/utils/cache/spccache.c @@ -12,7 +12,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/cache/spccache.c,v 1.4 2010/01/07 03:53:08 rhaas Exp $ + * $PostgreSQL: pgsql/src/backend/utils/cache/spccache.c,v 1.5 2010/02/14 18:42:17 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 c04db4f02f..0224cfb264 100644 --- a/src/backend/utils/cache/syscache.c +++ b/src/backend/utils/cache/syscache.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/cache/syscache.c,v 1.125 2010/02/08 05:53:55 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/cache/syscache.c,v 1.126 2010/02/14 18:42:17 rhaas Exp $ * * NOTES * These routines allow the parser/planner/executor to perform @@ -909,10 +909,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) diff --git a/src/backend/utils/cache/ts_cache.c b/src/backend/utils/cache/ts_cache.c index c3c5647144..52a79e9996 100644 --- a/src/backend/utils/cache/ts_cache.c +++ b/src/backend/utils/cache/ts_cache.c @@ -20,7 +20,7 @@ * Copyright (c) 2006-2010, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/cache/ts_cache.c,v 1.11 2010/01/02 16:57:56 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/cache/ts_cache.c,v 1.12 2010/02/14 18:42:17 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 6eba8910df..35b6351636 100644 --- a/src/backend/utils/cache/typcache.c +++ b/src/backend/utils/cache/typcache.c @@ -36,7 +36,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/cache/typcache.c,v 1.31 2010/01/02 16:57:56 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/cache/typcache.c,v 1.32 2010/02/14 18:42:17 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 4ae507912e..196fb2a0a4 100644 --- a/src/backend/utils/fmgr/fmgr.c +++ b/src/backend/utils/fmgr/fmgr.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/fmgr/fmgr.c,v 1.129 2010/01/07 04:53:34 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/fmgr/fmgr.c,v 1.130 2010/02/14 18:42:17 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 efda810797..6bb9e1da00 100644 --- a/src/backend/utils/fmgr/funcapi.c +++ b/src/backend/utils/fmgr/funcapi.c @@ -7,7 +7,7 @@ * Copyright (c) 2002-2010, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/fmgr/funcapi.c,v 1.47 2010/01/02 16:57:56 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/fmgr/funcapi.c,v 1.48 2010/02/14 18:42:17 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 31bdc65ec1..fd653bcce5 100644 --- a/src/backend/utils/init/miscinit.c +++ b/src/backend/utils/init/miscinit.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/init/miscinit.c,v 1.181 2010/02/07 20:48:10 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/init/miscinit.c,v 1.182 2010/02/14 18:42:17 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 0c6a59c80b..034c615403 100644 --- a/src/backend/utils/init/postinit.c +++ b/src/backend/utils/init/postinit.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.202 2010/02/05 20:26:56 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.203 2010/02/14 18:42:18 rhaas Exp $ * * *------------------------------------------------------------------------- @@ -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 c8a43dced6..9064c85fc6 100644 --- a/src/backend/utils/mb/mbutils.c +++ b/src/backend/utils/mb/mbutils.c @@ -4,7 +4,7 @@ * * Tatsuo Ishii * - * $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.92 2009/11/12 02:46:16 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.93 2010/02/14 18:42:18 rhaas Exp $ */ #include "postgres.h" @@ -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 24ce1759c6..d270a09d66 100644 --- a/src/backend/utils/misc/superuser.c +++ b/src/backend/utils/misc/superuser.c @@ -14,7 +14,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/misc/superuser.c,v 1.40 2010/01/02 16:57:58 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/misc/superuser.c,v 1.41 2010/02/14 18:42:18 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 27f46083f4..6f3397f731 100644 --- a/src/include/utils/catcache.h +++ b/src/include/utils/catcache.h @@ -13,7 +13,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/catcache.h,v 1.71 2010/02/08 05:53:55 tgl Exp $ + * $PostgreSQL: pgsql/src/include/utils/catcache.h,v 1.72 2010/02/14 18:42:18 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -32,6 +32,8 @@ * struct catcacheheader: information for managing all the caches. */ +#define CATCACHE_MAXKEYS 4 + 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 */ diff --git a/src/include/utils/syscache.h b/src/include/utils/syscache.h index 8cdd7e79ee..9faefbe8d7 100644 --- a/src/include/utils/syscache.h +++ b/src/include/utils/syscache.h @@ -9,7 +9,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/syscache.h,v 1.78 2010/01/05 21:54:00 rhaas Exp $ + * $PostgreSQL: pgsql/src/include/utils/syscache.h,v 1.79 2010/02/14 18:42:18 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -113,6 +113,56 @@ extern Datum SysCacheGetAttr(int cacheId, HeapTuple tup, extern struct catclist *SearchSysCacheList(int cacheId, int nkeys, Datum key1, Datum key2, Datum key3, Datum key4); +/* + * The use of the macros below rather than direct calls to the corresponding + * functions is encouraged, as it insulates the caller from changes in the + * maximum number of keys. + */ +#define SearchSysCache1(cacheId, key1) \ + SearchSysCache(cacheId, key1, 0, 0, 0) +#define SearchSysCache2(cacheId, key1, key2) \ + SearchSysCache(cacheId, key1, key2, 0, 0) +#define SearchSysCache3(cacheId, key1, key2, key3) \ + SearchSysCache(cacheId, key1, key2, key3, 0) +#define SearchSysCache4(cacheId, key1, key2, key3, key4) \ + SearchSysCache(cacheId, key1, key2, key3, key4) + +#define SearchSysCacheCopy1(cacheId, key1) \ + SearchSysCacheCopy(cacheId, key1, 0, 0, 0) +#define SearchSysCacheCopy2(cacheId, key1, key2) \ + SearchSysCacheCopy(cacheId, key1, key2, 0, 0) +#define SearchSysCacheCopy3(cacheId, key1, key2, key3) \ + SearchSysCacheCopy(cacheId, key1, key2, key3, 0) +#define SearchSysCacheCopy4(cacheId, key1, key2, key3, key4) \ + SearchSysCacheCopy(cacheId, key1, key2, key3, key4) + +#define SearchSysCacheExists1(cacheId, key1) \ + SearchSysCacheExists(cacheId, key1, 0, 0, 0) +#define SearchSysCacheExists2(cacheId, key1, key2) \ + SearchSysCacheExists(cacheId, key1, key2, 0, 0) +#define SearchSysCacheExists3(cacheId, key1, key2, key3) \ + SearchSysCacheExists(cacheId, key1, key2, key3, 0) +#define SearchSysCacheExists4(cacheId, key1, key2, key3, key4) \ + SearchSysCacheExists(cacheId, key1, key2, key3, key4) + +#define GetSysCacheOid1(cacheId, key1) \ + GetSysCacheOid(cacheId, key1, 0, 0, 0) +#define GetSysCacheOid2(cacheId, key1, key2) \ + GetSysCacheOid(cacheId, key1, key2, 0, 0) +#define GetSysCacheOid3(cacheId, key1, key2, key3) \ + GetSysCacheOid(cacheId, key1, key2, key3, 0) +#define GetSysCacheOid4(cacheId, key1, key2, key3, key4) \ + GetSysCacheOid(cacheId, key1, key2, key3, key4) + +#define SearchSysCacheList1(cacheId, key1) \ + SearchSysCacheList(cacheId, 1, key1, 0, 0, 0) +#define SearchSysCacheList2(cacheId, key1, key2) \ + SearchSysCacheList(cacheId, 2, key1, key2, 0, 0) +#define SearchSysCacheList3(cacheId, key1, key2, key3) \ + SearchSysCacheList(cacheId, 3, key1, key2, key3, 0) +#define SearchSysCacheList4(cacheId, key1, key2, key3, key4) \ + SearchSysCacheList(cacheId, 4, key1, key2, key3, key4) + #define ReleaseSysCacheList(x) ReleaseCatCacheList(x) #endif /* SYSCACHE_H */ diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c index d066b504d4..ab32fd88c5 100644 --- a/src/pl/plperl/plperl.c +++ b/src/pl/plperl/plperl.c @@ -1,7 +1,7 @@ /********************************************************************** * plperl.c - perl as a procedural language for PostgreSQL * - * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.165 2010/02/12 19:35:25 adunstan Exp $ + * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.166 2010/02/14 18:42:18 rhaas Exp $ * **********************************************************************/ @@ -1198,9 +1198,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); @@ -1773,9 +1771,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); @@ -1867,9 +1863,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); @@ -1887,9 +1882,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); @@ -1948,9 +1943,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 cc0c3c870c..f0cf7c4ab7 100644 --- a/src/pl/plpgsql/src/pl_comp.c +++ b/src/pl/plpgsql/src/pl_comp.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.148 2010/01/10 17:15:18 tgl Exp $ + * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.149 2010/02/14 18:42:18 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 6f12d2ee74..d8443fabf4 100644 --- a/src/pl/plpgsql/src/pl_handler.c +++ b/src/pl/plpgsql/src/pl_handler.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_handler.c,v 1.49 2010/01/02 16:58:13 momjian Exp $ + * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_handler.c,v 1.50 2010/02/14 18:42:18 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -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 c6accdac9a..37b8638a08 100644 --- a/src/pl/plpython/plpython.c +++ b/src/pl/plpython/plpython.c @@ -1,7 +1,7 @@ /********************************************************************** * plpython.c - python as a procedural language for PostgreSQL * - * $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.136 2010/01/22 15:45:15 petere Exp $ + * $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.137 2010/02/14 18:42:19 rhaas Exp $ * ********************************************************************* */ @@ -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 7c689ee063..31922a885a 100644 --- a/src/pl/tcl/pltcl.c +++ b/src/pl/tcl/pltcl.c @@ -2,7 +2,7 @@ * pltcl.c - PostgreSQL support for Tcl as * procedural language (PL) * - * $PostgreSQL: pgsql/src/pl/tcl/pltcl.c,v 1.130 2010/01/25 01:58:13 tgl Exp $ + * $PostgreSQL: pgsql/src/pl/tcl/pltcl.c,v 1.131 2010/02/14 18:42:19 rhaas Exp $ * **********************************************************************/ @@ -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);