Wrap calls to SearchSysCache and related functions using macros.

The purpose of this change is to eliminate the need for every caller
of SearchSysCache, SearchSysCacheCopy, SearchSysCacheExists,
GetSysCacheOid, and SearchSysCacheList to know the maximum number
of allowable keys for a syscache entry (currently 4).  This will
make it far easier to increase the maximum number of keys in a
future release should we choose to do so, and it makes the code
shorter, too.

Design and review by Tom Lane.
This commit is contained in:
Robert Haas 2010-02-14 18:42:19 +00:00
parent 1012492bc0
commit e26c539e9f
97 changed files with 1125 additions and 2061 deletions

View File

@ -8,7 +8,7 @@
* Darko Prenosil <Darko.Prenosil@finteh.hr> * Darko Prenosil <Darko.Prenosil@finteh.hr>
* Shridhar Daithankar <shridhar_daithankar@persistent.co.in> * Shridhar Daithankar <shridhar_daithankar@persistent.co.in>
* *
* $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 * Copyright (c) 2001-2010, PostgreSQL Global Development Group
* ALL RIGHTS RESERVED; * ALL RIGHTS RESERVED;
* *
@ -2180,9 +2180,7 @@ generate_relation_name(Oid relid)
char *nspname; char *nspname;
char *result; char *result;
tp = SearchSysCache(RELOID, tp = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
ObjectIdGetDatum(relid),
0, 0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for relation %u", relid); elog(ERROR, "cache lookup failed for relation %u", relid);

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* some of the executor utility code such as "ExecTypeFromTL" should be * some of the executor utility code such as "ExecTypeFromTL" should be
@ -478,9 +478,7 @@ TupleDescInitEntry(TupleDesc desc,
att->attinhcount = 0; att->attinhcount = 0;
/* attacl and attoptions are not present in tupledescs */ /* attacl and attoptions are not present in tupledescs */
tuple = SearchSysCache(TYPEOID, tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(oidtypeid));
ObjectIdGetDatum(oidtypeid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for type %u", oidtypeid); elog(ERROR, "cache lookup failed for type %u", oidtypeid);
typeForm = (Form_pg_type) GETSTRUCT(tuple); typeForm = (Form_pg_type) GETSTRUCT(tuple);

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 * 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 * Now that we have the lock, probe to see if the relation really exists
* or not. * or not.
*/ */
if (!SearchSysCacheExists(RELOID, if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(relationId)))
ObjectIdGetDatum(relationId),
0, 0, 0))
{ {
/* Release useless lock */ /* Release useless lock */
if (lockmode != NoLock) if (lockmode != NoLock)

View File

@ -6,7 +6,7 @@
* Copyright (c) 2000-2010, PostgreSQL Global Development Group * Copyright (c) 2000-2010, PostgreSQL Global Development Group
* *
* IDENTIFICATION * 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) && if (TransactionIdFollowsOrEquals(nextXid, xidVacLimit) &&
TransactionIdIsValid(xidVacLimit)) TransactionIdIsValid(xidVacLimit))
return true; /* past VacLimit, don't delay updating */ return true; /* past VacLimit, don't delay updating */
if (!SearchSysCacheExists(DATABASEOID, if (!SearchSysCacheExists1(DATABASEOID, ObjectIdGetDatum(oldestXidDB)))
ObjectIdGetDatum(oldestXidDB),
0, 0, 0))
return true; /* could happen, per comments above */ return true; /* could happen, per comments above */
return false; return false;
} }

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* See acl.h. * See acl.h.
@ -596,9 +596,7 @@ objectNamesToOids(GrantObjectType objtype, List *objnames)
char *langname = strVal(lfirst(cell)); char *langname = strVal(lfirst(cell));
HeapTuple tuple; HeapTuple tuple;
tuple = SearchSysCache(LANGNAME, tuple = SearchSysCache1(LANGNAME, PointerGetDatum(langname));
PointerGetDatum(langname),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
@ -630,9 +628,8 @@ objectNamesToOids(GrantObjectType objtype, List *objnames)
char *nspname = strVal(lfirst(cell)); char *nspname = strVal(lfirst(cell));
HeapTuple tuple; HeapTuple tuple;
tuple = SearchSysCache(NAMESPACENAME, tuple = SearchSysCache1(NAMESPACENAME,
CStringGetDatum(nspname), CStringGetDatum(nspname));
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_SCHEMA), (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 * CREATE privileges, since without CREATE you won't be able to do
* anything using the default privs anyway. * anything using the default privs anyway.
*/ */
iacls->nspid = GetSysCacheOid(NAMESPACENAME, iacls->nspid = GetSysCacheOid1(NAMESPACENAME,
CStringGetDatum(nspname), CStringGetDatum(nspname));
0, 0, 0);
if (!OidIsValid(iacls->nspid)) if (!OidIsValid(iacls->nspid))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_SCHEMA), (errcode(ERRCODE_UNDEFINED_SCHEMA),
@ -1085,11 +1081,10 @@ SetDefaultACL(InternalDefaultACL *iacls)
} }
/* Search for existing row for this object type in catalog */ /* Search for existing row for this object type in catalog */
tuple = SearchSysCache(DEFACLROLENSPOBJ, tuple = SearchSysCache3(DEFACLROLENSPOBJ,
ObjectIdGetDatum(iacls->roleid), ObjectIdGetDatum(iacls->roleid),
ObjectIdGetDatum(iacls->nspid), ObjectIdGetDatum(iacls->nspid),
CharGetDatum(objtype), CharGetDatum(objtype));
0);
if (HeapTupleIsValid(tuple)) 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) if (classForm->relkind == RELKIND_VIEW && curr_att < 0)
continue; continue;
attTuple = SearchSysCache(ATTNUM, attTuple = SearchSysCache2(ATTNUM,
ObjectIdGetDatum(table_oid), ObjectIdGetDatum(table_oid),
Int16GetDatum(curr_att), Int16GetDatum(curr_att));
0, 0);
if (!HeapTupleIsValid(attTuple)) if (!HeapTupleIsValid(attTuple))
elog(ERROR, "cache lookup failed for attribute %d of relation %u", elog(ERROR, "cache lookup failed for attribute %d of relation %u",
curr_att, table_oid); curr_att, table_oid);
@ -1481,10 +1475,9 @@ ExecGrant_Attribute(InternalGrant *istmt, Oid relOid, const char *relname,
Oid *oldmembers; Oid *oldmembers;
Oid *newmembers; Oid *newmembers;
attr_tuple = SearchSysCache(ATTNUM, attr_tuple = SearchSysCache2(ATTNUM,
ObjectIdGetDatum(relOid), ObjectIdGetDatum(relOid),
Int16GetDatum(attnum), Int16GetDatum(attnum));
0, 0);
if (!HeapTupleIsValid(attr_tuple)) if (!HeapTupleIsValid(attr_tuple))
elog(ERROR, "cache lookup failed for attribute %d of relation %u", elog(ERROR, "cache lookup failed for attribute %d of relation %u",
attnum, relOid); attnum, relOid);
@ -1623,9 +1616,7 @@ ExecGrant_Relation(InternalGrant *istmt)
HeapTuple tuple; HeapTuple tuple;
ListCell *cell_colprivs; ListCell *cell_colprivs;
tuple = SearchSysCache(RELOID, tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relOid));
ObjectIdGetDatum(relOid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", relOid); elog(ERROR, "cache lookup failed for relation %u", relOid);
pg_class_tuple = (Form_pg_class) GETSTRUCT(tuple); pg_class_tuple = (Form_pg_class) GETSTRUCT(tuple);
@ -1939,9 +1930,7 @@ ExecGrant_Database(InternalGrant *istmt)
Oid *newmembers; Oid *newmembers;
HeapTuple tuple; HeapTuple tuple;
tuple = SearchSysCache(DATABASEOID, tuple = SearchSysCache1(DATABASEOID, ObjectIdGetDatum(datId));
ObjectIdGetDatum(datId),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for database %u", datId); elog(ERROR, "cache lookup failed for database %u", datId);
@ -2056,9 +2045,8 @@ ExecGrant_Fdw(InternalGrant *istmt)
Oid *oldmembers; Oid *oldmembers;
Oid *newmembers; Oid *newmembers;
tuple = SearchSysCache(FOREIGNDATAWRAPPEROID, tuple = SearchSysCache1(FOREIGNDATAWRAPPEROID,
ObjectIdGetDatum(fdwid), ObjectIdGetDatum(fdwid));
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for foreign-data wrapper %u", fdwid); elog(ERROR, "cache lookup failed for foreign-data wrapper %u", fdwid);
@ -2175,9 +2163,7 @@ ExecGrant_ForeignServer(InternalGrant *istmt)
Oid *oldmembers; Oid *oldmembers;
Oid *newmembers; Oid *newmembers;
tuple = SearchSysCache(FOREIGNSERVEROID, tuple = SearchSysCache1(FOREIGNSERVEROID, ObjectIdGetDatum(srvid));
ObjectIdGetDatum(srvid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for foreign server %u", srvid); elog(ERROR, "cache lookup failed for foreign server %u", srvid);
@ -2294,9 +2280,7 @@ ExecGrant_Function(InternalGrant *istmt)
Oid *oldmembers; Oid *oldmembers;
Oid *newmembers; Oid *newmembers;
tuple = SearchSysCache(PROCOID, tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcId));
ObjectIdGetDatum(funcId),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for function %u", funcId); elog(ERROR, "cache lookup failed for function %u", funcId);
@ -2411,9 +2395,7 @@ ExecGrant_Language(InternalGrant *istmt)
Oid *oldmembers; Oid *oldmembers;
Oid *newmembers; Oid *newmembers;
tuple = SearchSysCache(LANGOID, tuple = SearchSysCache1(LANGOID, ObjectIdGetDatum(langId));
ObjectIdGetDatum(langId),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for language %u", langId); elog(ERROR, "cache lookup failed for language %u", langId);
@ -2667,9 +2649,7 @@ ExecGrant_Namespace(InternalGrant *istmt)
Oid *oldmembers; Oid *oldmembers;
Oid *newmembers; Oid *newmembers;
tuple = SearchSysCache(NAMESPACEOID, tuple = SearchSysCache1(NAMESPACEOID, ObjectIdGetDatum(nspid));
ObjectIdGetDatum(nspid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for namespace %u", nspid); elog(ERROR, "cache lookup failed for namespace %u", nspid);
@ -2786,8 +2766,7 @@ ExecGrant_Tablespace(InternalGrant *istmt)
HeapTuple tuple; HeapTuple tuple;
/* Search syscache for pg_tablespace */ /* Search syscache for pg_tablespace */
tuple = SearchSysCache(TABLESPACEOID, ObjectIdGetDatum(tblId), tuple = SearchSysCache1(TABLESPACEOID, ObjectIdGetDatum(tblId));
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for tablespace %u", tblId); elog(ERROR, "cache lookup failed for tablespace %u", tblId);
@ -3090,9 +3069,7 @@ has_rolcatupdate(Oid roleid)
bool rolcatupdate; bool rolcatupdate;
HeapTuple tuple; HeapTuple tuple;
tuple = SearchSysCache(AUTHOID, tuple = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid));
ObjectIdGetDatum(roleid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (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 * First, get the column's ACL from its pg_attribute entry
*/ */
attTuple = SearchSysCache(ATTNUM, attTuple = SearchSysCache2(ATTNUM,
ObjectIdGetDatum(table_oid), ObjectIdGetDatum(table_oid),
Int16GetDatum(attnum), Int16GetDatum(attnum));
0, 0);
if (!HeapTupleIsValid(attTuple)) if (!HeapTupleIsValid(attTuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_COLUMN), (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 * privileges" rather than failing in such a case, so as to avoid unwanted
* failures in has_column_privilege() tests. * failures in has_column_privilege() tests.
*/ */
classTuple = SearchSysCache(RELOID, classTuple = SearchSysCache1(RELOID, ObjectIdGetDatum(table_oid));
ObjectIdGetDatum(table_oid),
0, 0, 0);
if (!HeapTupleIsValid(classTuple)) if (!HeapTupleIsValid(classTuple))
{ {
ReleaseSysCache(attTuple); ReleaseSysCache(attTuple);
@ -3269,9 +3243,7 @@ pg_class_aclmask(Oid table_oid, Oid roleid,
/* /*
* Must get the relation's tuple from pg_class * Must get the relation's tuple from pg_class
*/ */
tuple = SearchSysCache(RELOID, tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(table_oid));
ObjectIdGetDatum(table_oid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_TABLE), (errcode(ERRCODE_UNDEFINED_TABLE),
@ -3365,9 +3337,7 @@ pg_database_aclmask(Oid db_oid, Oid roleid,
/* /*
* Get the database's ACL from pg_database * Get the database's ACL from pg_database
*/ */
tuple = SearchSysCache(DATABASEOID, tuple = SearchSysCache1(DATABASEOID, ObjectIdGetDatum(db_oid));
ObjectIdGetDatum(db_oid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_DATABASE), (errcode(ERRCODE_UNDEFINED_DATABASE),
@ -3421,9 +3391,7 @@ pg_proc_aclmask(Oid proc_oid, Oid roleid,
/* /*
* Get the function's ACL from pg_proc * Get the function's ACL from pg_proc
*/ */
tuple = SearchSysCache(PROCOID, tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(proc_oid));
ObjectIdGetDatum(proc_oid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_FUNCTION), (errcode(ERRCODE_UNDEFINED_FUNCTION),
@ -3477,9 +3445,7 @@ pg_language_aclmask(Oid lang_oid, Oid roleid,
/* /*
* Get the language's ACL from pg_language * Get the language's ACL from pg_language
*/ */
tuple = SearchSysCache(LANGOID, tuple = SearchSysCache1(LANGOID, ObjectIdGetDatum(lang_oid));
ObjectIdGetDatum(lang_oid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
@ -3640,9 +3606,7 @@ pg_namespace_aclmask(Oid nsp_oid, Oid roleid,
/* /*
* Get the schema's ACL from pg_namespace * Get the schema's ACL from pg_namespace
*/ */
tuple = SearchSysCache(NAMESPACEOID, tuple = SearchSysCache1(NAMESPACEOID, ObjectIdGetDatum(nsp_oid));
ObjectIdGetDatum(nsp_oid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_SCHEMA), (errcode(ERRCODE_UNDEFINED_SCHEMA),
@ -3696,8 +3660,7 @@ pg_tablespace_aclmask(Oid spc_oid, Oid roleid,
/* /*
* Get the tablespace's ACL from pg_tablespace * Get the tablespace's ACL from pg_tablespace
*/ */
tuple = SearchSysCache(TABLESPACEOID, ObjectIdGetDatum(spc_oid), tuple = SearchSysCache1(TABLESPACEOID, ObjectIdGetDatum(spc_oid));
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (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 * Must get the FDW's tuple from pg_foreign_data_wrapper
*/ */
tuple = SearchSysCache(FOREIGNDATAWRAPPEROID, tuple = SearchSysCache1(FOREIGNDATAWRAPPEROID, ObjectIdGetDatum(fdw_oid));
ObjectIdGetDatum(fdw_oid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
ereport(ERROR, ereport(ERROR,
(errmsg("foreign-data wrapper with OID %u does not exist", (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 * Must get the FDW's tuple from pg_foreign_data_wrapper
*/ */
tuple = SearchSysCache(FOREIGNSERVEROID, tuple = SearchSysCache1(FOREIGNSERVEROID, ObjectIdGetDatum(srv_oid));
ObjectIdGetDatum(srv_oid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
ereport(ERROR, ereport(ERROR,
(errmsg("foreign server with OID %u does not exist", (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 * pg_attribute_aclmask, we prefer to return "no privileges" instead of
* throwing an error if we get any unexpected lookup errors. * throwing an error if we get any unexpected lookup errors.
*/ */
classTuple = SearchSysCache(RELOID, classTuple = SearchSysCache1(RELOID, ObjectIdGetDatum(table_oid));
ObjectIdGetDatum(table_oid),
0, 0, 0);
if (!HeapTupleIsValid(classTuple)) if (!HeapTupleIsValid(classTuple))
return ACLCHECK_NO_PRIV; return ACLCHECK_NO_PRIV;
classForm = (Form_pg_class) GETSTRUCT(classTuple); classForm = (Form_pg_class) GETSTRUCT(classTuple);
@ -3934,10 +3891,9 @@ pg_attribute_aclcheck_all(Oid table_oid, Oid roleid, AclMode mode,
HeapTuple attTuple; HeapTuple attTuple;
AclMode attmask; AclMode attmask;
attTuple = SearchSysCache(ATTNUM, attTuple = SearchSysCache2(ATTNUM,
ObjectIdGetDatum(table_oid), ObjectIdGetDatum(table_oid),
Int16GetDatum(curr_att), Int16GetDatum(curr_att));
0, 0);
if (!HeapTupleIsValid(attTuple)) if (!HeapTupleIsValid(attTuple))
continue; continue;
@ -4107,9 +4063,7 @@ pg_class_ownercheck(Oid class_oid, Oid roleid)
if (superuser_arg(roleid)) if (superuser_arg(roleid))
return true; return true;
tuple = SearchSysCache(RELOID, tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(class_oid));
ObjectIdGetDatum(class_oid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_TABLE), (errcode(ERRCODE_UNDEFINED_TABLE),
@ -4135,9 +4089,7 @@ pg_type_ownercheck(Oid type_oid, Oid roleid)
if (superuser_arg(roleid)) if (superuser_arg(roleid))
return true; return true;
tuple = SearchSysCache(TYPEOID, tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type_oid));
ObjectIdGetDatum(type_oid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
@ -4163,9 +4115,7 @@ pg_oper_ownercheck(Oid oper_oid, Oid roleid)
if (superuser_arg(roleid)) if (superuser_arg(roleid))
return true; return true;
tuple = SearchSysCache(OPEROID, tuple = SearchSysCache1(OPEROID, ObjectIdGetDatum(oper_oid));
ObjectIdGetDatum(oper_oid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_FUNCTION), (errcode(ERRCODE_UNDEFINED_FUNCTION),
@ -4191,9 +4141,7 @@ pg_proc_ownercheck(Oid proc_oid, Oid roleid)
if (superuser_arg(roleid)) if (superuser_arg(roleid))
return true; return true;
tuple = SearchSysCache(PROCOID, tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(proc_oid));
ObjectIdGetDatum(proc_oid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_FUNCTION), (errcode(ERRCODE_UNDEFINED_FUNCTION),
@ -4219,9 +4167,7 @@ pg_language_ownercheck(Oid lan_oid, Oid roleid)
if (superuser_arg(roleid)) if (superuser_arg(roleid))
return true; return true;
tuple = SearchSysCache(LANGOID, tuple = SearchSysCache1(LANGOID, ObjectIdGetDatum(lan_oid));
ObjectIdGetDatum(lan_oid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_FUNCTION), (errcode(ERRCODE_UNDEFINED_FUNCTION),
@ -4293,9 +4239,7 @@ pg_namespace_ownercheck(Oid nsp_oid, Oid roleid)
if (superuser_arg(roleid)) if (superuser_arg(roleid))
return true; return true;
tuple = SearchSysCache(NAMESPACEOID, tuple = SearchSysCache1(NAMESPACEOID, ObjectIdGetDatum(nsp_oid));
ObjectIdGetDatum(nsp_oid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_SCHEMA), (errcode(ERRCODE_UNDEFINED_SCHEMA),
@ -4322,8 +4266,7 @@ pg_tablespace_ownercheck(Oid spc_oid, Oid roleid)
return true; return true;
/* Search syscache for pg_tablespace */ /* Search syscache for pg_tablespace */
spctuple = SearchSysCache(TABLESPACEOID, ObjectIdGetDatum(spc_oid), spctuple = SearchSysCache1(TABLESPACEOID, ObjectIdGetDatum(spc_oid));
0, 0, 0);
if (!HeapTupleIsValid(spctuple)) if (!HeapTupleIsValid(spctuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
@ -4349,9 +4292,7 @@ pg_opclass_ownercheck(Oid opc_oid, Oid roleid)
if (superuser_arg(roleid)) if (superuser_arg(roleid))
return true; return true;
tuple = SearchSysCache(CLAOID, tuple = SearchSysCache1(CLAOID, ObjectIdGetDatum(opc_oid));
ObjectIdGetDatum(opc_oid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
@ -4378,9 +4319,7 @@ pg_opfamily_ownercheck(Oid opf_oid, Oid roleid)
if (superuser_arg(roleid)) if (superuser_arg(roleid))
return true; return true;
tuple = SearchSysCache(OPFAMILYOID, tuple = SearchSysCache1(OPFAMILYOID, ObjectIdGetDatum(opf_oid));
ObjectIdGetDatum(opf_oid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
@ -4407,9 +4346,7 @@ pg_ts_dict_ownercheck(Oid dict_oid, Oid roleid)
if (superuser_arg(roleid)) if (superuser_arg(roleid))
return true; return true;
tuple = SearchSysCache(TSDICTOID, tuple = SearchSysCache1(TSDICTOID, ObjectIdGetDatum(dict_oid));
ObjectIdGetDatum(dict_oid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
@ -4436,9 +4373,7 @@ pg_ts_config_ownercheck(Oid cfg_oid, Oid roleid)
if (superuser_arg(roleid)) if (superuser_arg(roleid))
return true; return true;
tuple = SearchSysCache(TSCONFIGOID, tuple = SearchSysCache1(TSCONFIGOID, ObjectIdGetDatum(cfg_oid));
ObjectIdGetDatum(cfg_oid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
@ -4465,9 +4400,7 @@ pg_foreign_server_ownercheck(Oid srv_oid, Oid roleid)
if (superuser_arg(roleid)) if (superuser_arg(roleid))
return true; return true;
tuple = SearchSysCache(FOREIGNSERVEROID, tuple = SearchSysCache1(FOREIGNSERVEROID, ObjectIdGetDatum(srv_oid));
ObjectIdGetDatum(srv_oid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
@ -4494,9 +4427,7 @@ pg_database_ownercheck(Oid db_oid, Oid roleid)
if (superuser_arg(roleid)) if (superuser_arg(roleid))
return true; return true;
tuple = SearchSysCache(DATABASEOID, tuple = SearchSysCache1(DATABASEOID, ObjectIdGetDatum(db_oid));
ObjectIdGetDatum(db_oid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_DATABASE), (errcode(ERRCODE_UNDEFINED_DATABASE),
@ -4522,9 +4453,7 @@ pg_conversion_ownercheck(Oid conv_oid, Oid roleid)
if (superuser_arg(roleid)) if (superuser_arg(roleid))
return true; return true;
tuple = SearchSysCache(CONVOID, tuple = SearchSysCache1(CONVOID, ObjectIdGetDatum(conv_oid));
ObjectIdGetDatum(conv_oid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
@ -4548,11 +4477,10 @@ get_default_acl_internal(Oid roleId, Oid nsp_oid, char objtype)
Acl *result = NULL; Acl *result = NULL;
HeapTuple tuple; HeapTuple tuple;
tuple = SearchSysCache(DEFACLROLENSPOBJ, tuple = SearchSysCache3(DEFACLROLENSPOBJ,
ObjectIdGetDatum(roleId), ObjectIdGetDatum(roleId),
ObjectIdGetDatum(nsp_oid), ObjectIdGetDatum(nsp_oid),
CharGetDatum(objtype), CharGetDatum(objtype));
0);
if (HeapTupleIsValid(tuple)) if (HeapTupleIsValid(tuple))
{ {

View File

@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * 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 REGPROCOID:
case REGPROCEDUREOID: case REGPROCEDUREOID:
objoid = DatumGetObjectId(con->constvalue); objoid = DatumGetObjectId(con->constvalue);
if (SearchSysCacheExists(PROCOID, if (SearchSysCacheExists1(PROCOID,
ObjectIdGetDatum(objoid), ObjectIdGetDatum(objoid)))
0, 0, 0))
add_object_address(OCLASS_PROC, objoid, 0, add_object_address(OCLASS_PROC, objoid, 0,
context->addrs); context->addrs);
break; break;
case REGOPEROID: case REGOPEROID:
case REGOPERATOROID: case REGOPERATOROID:
objoid = DatumGetObjectId(con->constvalue); objoid = DatumGetObjectId(con->constvalue);
if (SearchSysCacheExists(OPEROID, if (SearchSysCacheExists1(OPEROID,
ObjectIdGetDatum(objoid), ObjectIdGetDatum(objoid)))
0, 0, 0))
add_object_address(OCLASS_OPERATOR, objoid, 0, add_object_address(OCLASS_OPERATOR, objoid, 0,
context->addrs); context->addrs);
break; break;
case REGCLASSOID: case REGCLASSOID:
objoid = DatumGetObjectId(con->constvalue); objoid = DatumGetObjectId(con->constvalue);
if (SearchSysCacheExists(RELOID, if (SearchSysCacheExists1(RELOID,
ObjectIdGetDatum(objoid), ObjectIdGetDatum(objoid)))
0, 0, 0))
add_object_address(OCLASS_CLASS, objoid, 0, add_object_address(OCLASS_CLASS, objoid, 0,
context->addrs); context->addrs);
break; break;
case REGTYPEOID: case REGTYPEOID:
objoid = DatumGetObjectId(con->constvalue); objoid = DatumGetObjectId(con->constvalue);
if (SearchSysCacheExists(TYPEOID, if (SearchSysCacheExists1(TYPEOID,
ObjectIdGetDatum(objoid), ObjectIdGetDatum(objoid)))
0, 0, 0))
add_object_address(OCLASS_TYPE, objoid, 0, add_object_address(OCLASS_TYPE, objoid, 0,
context->addrs); context->addrs);
break; break;
case REGCONFIGOID: case REGCONFIGOID:
objoid = DatumGetObjectId(con->constvalue); objoid = DatumGetObjectId(con->constvalue);
if (SearchSysCacheExists(TSCONFIGOID, if (SearchSysCacheExists1(TSCONFIGOID,
ObjectIdGetDatum(objoid), ObjectIdGetDatum(objoid)))
0, 0, 0))
add_object_address(OCLASS_TSCONFIG, objoid, 0, add_object_address(OCLASS_TSCONFIG, objoid, 0,
context->addrs); context->addrs);
break; break;
case REGDICTIONARYOID: case REGDICTIONARYOID:
objoid = DatumGetObjectId(con->constvalue); objoid = DatumGetObjectId(con->constvalue);
if (SearchSysCacheExists(TSDICTOID, if (SearchSysCacheExists1(TSDICTOID,
ObjectIdGetDatum(objoid), ObjectIdGetDatum(objoid)))
0, 0, 0))
add_object_address(OCLASS_TSDICT, objoid, 0, add_object_address(OCLASS_TSDICT, objoid, 0,
context->addrs); context->addrs);
break; break;
@ -2155,9 +2149,8 @@ getObjectDescription(const ObjectAddress *object)
HeapTuple conTup; HeapTuple conTup;
Form_pg_constraint con; Form_pg_constraint con;
conTup = SearchSysCache(CONSTROID, conTup = SearchSysCache1(CONSTROID,
ObjectIdGetDatum(object->objectId), ObjectIdGetDatum(object->objectId));
0, 0, 0);
if (!HeapTupleIsValid(conTup)) if (!HeapTupleIsValid(conTup))
elog(ERROR, "cache lookup failed for constraint %u", elog(ERROR, "cache lookup failed for constraint %u",
object->objectId); object->objectId);
@ -2187,9 +2180,8 @@ getObjectDescription(const ObjectAddress *object)
{ {
HeapTuple conTup; HeapTuple conTup;
conTup = SearchSysCache(CONVOID, conTup = SearchSysCache1(CONVOID,
ObjectIdGetDatum(object->objectId), ObjectIdGetDatum(object->objectId));
0, 0, 0);
if (!HeapTupleIsValid(conTup)) if (!HeapTupleIsValid(conTup))
elog(ERROR, "cache lookup failed for conversion %u", elog(ERROR, "cache lookup failed for conversion %u",
object->objectId); object->objectId);
@ -2242,9 +2234,8 @@ getObjectDescription(const ObjectAddress *object)
{ {
HeapTuple langTup; HeapTuple langTup;
langTup = SearchSysCache(LANGOID, langTup = SearchSysCache1(LANGOID,
ObjectIdGetDatum(object->objectId), ObjectIdGetDatum(object->objectId));
0, 0, 0);
if (!HeapTupleIsValid(langTup)) if (!HeapTupleIsValid(langTup))
elog(ERROR, "cache lookup failed for language %u", elog(ERROR, "cache lookup failed for language %u",
object->objectId); object->objectId);
@ -2271,17 +2262,15 @@ getObjectDescription(const ObjectAddress *object)
Form_pg_am amForm; Form_pg_am amForm;
char *nspname; char *nspname;
opcTup = SearchSysCache(CLAOID, opcTup = SearchSysCache1(CLAOID,
ObjectIdGetDatum(object->objectId), ObjectIdGetDatum(object->objectId));
0, 0, 0);
if (!HeapTupleIsValid(opcTup)) if (!HeapTupleIsValid(opcTup))
elog(ERROR, "cache lookup failed for opclass %u", elog(ERROR, "cache lookup failed for opclass %u",
object->objectId); object->objectId);
opcForm = (Form_pg_opclass) GETSTRUCT(opcTup); opcForm = (Form_pg_opclass) GETSTRUCT(opcTup);
amTup = SearchSysCache(AMOID, amTup = SearchSysCache1(AMOID,
ObjectIdGetDatum(opcForm->opcmethod), ObjectIdGetDatum(opcForm->opcmethod));
0, 0, 0);
if (!HeapTupleIsValid(amTup)) if (!HeapTupleIsValid(amTup))
elog(ERROR, "cache lookup failed for access method %u", elog(ERROR, "cache lookup failed for access method %u",
opcForm->opcmethod); opcForm->opcmethod);
@ -2487,9 +2476,8 @@ getObjectDescription(const ObjectAddress *object)
{ {
HeapTuple tup; HeapTuple tup;
tup = SearchSysCache(TSPARSEROID, tup = SearchSysCache1(TSPARSEROID,
ObjectIdGetDatum(object->objectId), ObjectIdGetDatum(object->objectId));
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for text search parser %u", elog(ERROR, "cache lookup failed for text search parser %u",
object->objectId); object->objectId);
@ -2503,9 +2491,8 @@ getObjectDescription(const ObjectAddress *object)
{ {
HeapTuple tup; HeapTuple tup;
tup = SearchSysCache(TSDICTOID, tup = SearchSysCache1(TSDICTOID,
ObjectIdGetDatum(object->objectId), ObjectIdGetDatum(object->objectId));
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for text search dictionary %u", elog(ERROR, "cache lookup failed for text search dictionary %u",
object->objectId); object->objectId);
@ -2519,9 +2506,8 @@ getObjectDescription(const ObjectAddress *object)
{ {
HeapTuple tup; HeapTuple tup;
tup = SearchSysCache(TSTEMPLATEOID, tup = SearchSysCache1(TSTEMPLATEOID,
ObjectIdGetDatum(object->objectId), ObjectIdGetDatum(object->objectId));
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for text search template %u", elog(ERROR, "cache lookup failed for text search template %u",
object->objectId); object->objectId);
@ -2535,9 +2521,8 @@ getObjectDescription(const ObjectAddress *object)
{ {
HeapTuple tup; HeapTuple tup;
tup = SearchSysCache(TSCONFIGOID, tup = SearchSysCache1(TSCONFIGOID,
ObjectIdGetDatum(object->objectId), ObjectIdGetDatum(object->objectId));
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for text search configuration %u", elog(ERROR, "cache lookup failed for text search configuration %u",
object->objectId); object->objectId);
@ -2602,9 +2587,8 @@ getObjectDescription(const ObjectAddress *object)
Oid useid; Oid useid;
char *usename; char *usename;
tup = SearchSysCache(USERMAPPINGOID, tup = SearchSysCache1(USERMAPPINGOID,
ObjectIdGetDatum(object->objectId), ObjectIdGetDatum(object->objectId));
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for user mapping %u", elog(ERROR, "cache lookup failed for user mapping %u",
object->objectId); object->objectId);
@ -2707,9 +2691,8 @@ getRelationDescription(StringInfo buffer, Oid relid)
char *nspname; char *nspname;
char *relname; char *relname;
relTup = SearchSysCache(RELOID, relTup = SearchSysCache1(RELOID,
ObjectIdGetDatum(relid), ObjectIdGetDatum(relid));
0, 0, 0);
if (!HeapTupleIsValid(relTup)) if (!HeapTupleIsValid(relTup))
elog(ERROR, "cache lookup failed for relation %u", relid); elog(ERROR, "cache lookup failed for relation %u", relid);
relForm = (Form_pg_class) GETSTRUCT(relTup); relForm = (Form_pg_class) GETSTRUCT(relTup);
@ -2774,16 +2757,12 @@ getOpFamilyDescription(StringInfo buffer, Oid opfid)
Form_pg_am amForm; Form_pg_am amForm;
char *nspname; char *nspname;
opfTup = SearchSysCache(OPFAMILYOID, opfTup = SearchSysCache1(OPFAMILYOID, ObjectIdGetDatum(opfid));
ObjectIdGetDatum(opfid),
0, 0, 0);
if (!HeapTupleIsValid(opfTup)) if (!HeapTupleIsValid(opfTup))
elog(ERROR, "cache lookup failed for opfamily %u", opfid); elog(ERROR, "cache lookup failed for opfamily %u", opfid);
opfForm = (Form_pg_opfamily) GETSTRUCT(opfTup); opfForm = (Form_pg_opfamily) GETSTRUCT(opfTup);
amTup = SearchSysCache(AMOID, amTup = SearchSysCache1(AMOID, ObjectIdGetDatum(opfForm->opfmethod));
ObjectIdGetDatum(opfForm->opfmethod),
0, 0, 0);
if (!HeapTupleIsValid(amTup)) if (!HeapTupleIsValid(amTup))
elog(ERROR, "cache lookup failed for access method %u", elog(ERROR, "cache lookup failed for access method %u",
opfForm->opfmethod); opfForm->opfmethod);

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 * 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 * autogenerated array, we can rename it out of the way; otherwise we can
* at least give a good error message. * at least give a good error message.
*/ */
old_type_oid = GetSysCacheOid(TYPENAMENSP, old_type_oid = GetSysCacheOid2(TYPENAMENSP,
CStringGetDatum(relname), CStringGetDatum(relname),
ObjectIdGetDatum(relnamespace), ObjectIdGetDatum(relnamespace));
0, 0);
if (OidIsValid(old_type_oid)) if (OidIsValid(old_type_oid))
{ {
if (!moveArrayTypeName(old_type_oid, relname, relnamespace)) if (!moveArrayTypeName(old_type_oid, relname, relnamespace))
@ -1244,9 +1243,7 @@ DeleteRelationTuple(Oid relid)
/* Grab an appropriate lock on the pg_class relation */ /* Grab an appropriate lock on the pg_class relation */
pg_class_desc = heap_open(RelationRelationId, RowExclusiveLock); pg_class_desc = heap_open(RelationRelationId, RowExclusiveLock);
tup = SearchSysCache(RELOID, tup = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
ObjectIdGetDatum(relid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for relation %u", relid); elog(ERROR, "cache lookup failed for relation %u", relid);
@ -1323,10 +1320,9 @@ RemoveAttributeById(Oid relid, AttrNumber attnum)
attr_rel = heap_open(AttributeRelationId, RowExclusiveLock); attr_rel = heap_open(AttributeRelationId, RowExclusiveLock);
tuple = SearchSysCacheCopy(ATTNUM, tuple = SearchSysCacheCopy2(ATTNUM,
ObjectIdGetDatum(relid), ObjectIdGetDatum(relid),
Int16GetDatum(attnum), Int16GetDatum(attnum));
0, 0);
if (!HeapTupleIsValid(tuple)) /* shouldn't happen */ if (!HeapTupleIsValid(tuple)) /* shouldn't happen */
elog(ERROR, "cache lookup failed for attribute %d of relation %u", elog(ERROR, "cache lookup failed for attribute %d of relation %u",
attnum, relid); attnum, relid);
@ -1491,10 +1487,9 @@ RemoveAttrDefaultById(Oid attrdefId)
/* Fix the pg_attribute row */ /* Fix the pg_attribute row */
attr_rel = heap_open(AttributeRelationId, RowExclusiveLock); attr_rel = heap_open(AttributeRelationId, RowExclusiveLock);
tuple = SearchSysCacheCopy(ATTNUM, tuple = SearchSysCacheCopy2(ATTNUM,
ObjectIdGetDatum(myrelid), ObjectIdGetDatum(myrelid),
Int16GetDatum(myattnum), Int16GetDatum(myattnum));
0, 0);
if (!HeapTupleIsValid(tuple)) /* shouldn't happen */ if (!HeapTupleIsValid(tuple)) /* shouldn't happen */
elog(ERROR, "cache lookup failed for attribute %d of relation %u", elog(ERROR, "cache lookup failed for attribute %d of relation %u",
myattnum, myrelid); myattnum, myrelid);
@ -1663,10 +1658,9 @@ StoreAttrDefault(Relation rel, AttrNumber attnum, Node *expr)
* exists. * exists.
*/ */
attrrel = heap_open(AttributeRelationId, RowExclusiveLock); attrrel = heap_open(AttributeRelationId, RowExclusiveLock);
atttup = SearchSysCacheCopy(ATTNUM, atttup = SearchSysCacheCopy2(ATTNUM,
ObjectIdGetDatum(RelationGetRelid(rel)), ObjectIdGetDatum(RelationGetRelid(rel)),
Int16GetDatum(attnum), Int16GetDatum(attnum));
0, 0);
if (!HeapTupleIsValid(atttup)) if (!HeapTupleIsValid(atttup))
elog(ERROR, "cache lookup failed for attribute %d of relation %u", elog(ERROR, "cache lookup failed for attribute %d of relation %u",
attnum, RelationGetRelid(rel)); attnum, RelationGetRelid(rel));
@ -2180,9 +2174,8 @@ SetRelationNumChecks(Relation rel, int numchecks)
Form_pg_class relStruct; Form_pg_class relStruct;
relrel = heap_open(RelationRelationId, RowExclusiveLock); relrel = heap_open(RelationRelationId, RowExclusiveLock);
reltup = SearchSysCacheCopy(RELOID, reltup = SearchSysCacheCopy1(RELOID,
ObjectIdGetDatum(RelationGetRelid(rel)), ObjectIdGetDatum(RelationGetRelid(rel)));
0, 0, 0);
if (!HeapTupleIsValid(reltup)) if (!HeapTupleIsValid(reltup))
elog(ERROR, "cache lookup failed for relation %u", elog(ERROR, "cache lookup failed for relation %u",
RelationGetRelid(rel)); RelationGetRelid(rel));

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 * INTERFACE ROUTINES
@ -141,9 +141,8 @@ ConstructTupleDescriptor(Relation heapRelation,
int i; int i;
/* We need access to the index AM's pg_am tuple */ /* We need access to the index AM's pg_am tuple */
amtuple = SearchSysCache(AMOID, amtuple = SearchSysCache1(AMOID,
ObjectIdGetDatum(accessMethodObjectId), ObjectIdGetDatum(accessMethodObjectId));
0, 0, 0);
if (!HeapTupleIsValid(amtuple)) if (!HeapTupleIsValid(amtuple))
elog(ERROR, "cache lookup failed for access method %u", elog(ERROR, "cache lookup failed for access method %u",
accessMethodObjectId); accessMethodObjectId);
@ -230,9 +229,7 @@ ConstructTupleDescriptor(Relation heapRelation,
* Lookup the expression type in pg_type for the type length etc. * Lookup the expression type in pg_type for the type length etc.
*/ */
keyType = exprType(indexkey); keyType = exprType(indexkey);
tuple = SearchSysCache(TYPEOID, tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(keyType));
ObjectIdGetDatum(keyType),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for type %u", keyType); elog(ERROR, "cache lookup failed for type %u", keyType);
typeTup = (Form_pg_type) GETSTRUCT(tuple); 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 * Check the opclass and index AM to see if either provides a keytype
* (overriding the attribute type). Opclass takes precedence. * (overriding the attribute type). Opclass takes precedence.
*/ */
tuple = SearchSysCache(CLAOID, tuple = SearchSysCache1(CLAOID, ObjectIdGetDatum(classObjectId[i]));
ObjectIdGetDatum(classObjectId[i]),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for opclass %u", elog(ERROR, "cache lookup failed for opclass %u",
classObjectId[i]); classObjectId[i]);
@ -300,9 +295,7 @@ ConstructTupleDescriptor(Relation heapRelation,
if (OidIsValid(keyType) && keyType != to->atttypid) if (OidIsValid(keyType) && keyType != to->atttypid)
{ {
/* index value and heap value have different types */ /* index value and heap value have different types */
tuple = SearchSysCache(TYPEOID, tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(keyType));
ObjectIdGetDatum(keyType),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for type %u", keyType); elog(ERROR, "cache lookup failed for type %u", keyType);
typeTup = (Form_pg_type) GETSTRUCT(tuple); typeTup = (Form_pg_type) GETSTRUCT(tuple);
@ -1031,9 +1024,7 @@ index_drop(Oid indexId)
*/ */
indexRelation = heap_open(IndexRelationId, RowExclusiveLock); indexRelation = heap_open(IndexRelationId, RowExclusiveLock);
tuple = SearchSysCache(INDEXRELID, tuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexId));
ObjectIdGetDatum(indexId),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for index %u", indexId); elog(ERROR, "cache lookup failed for index %u", indexId);
@ -1316,9 +1307,7 @@ index_update_stats(Relation rel,
else else
{ {
/* normal case, use syscache */ /* normal case, use syscache */
tuple = SearchSysCacheCopy(RELOID, tuple = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relid));
ObjectIdGetDatum(relid),
0, 0, 0);
} }
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
@ -1473,9 +1462,8 @@ index_build(Relation heapRelation,
pg_index = heap_open(IndexRelationId, RowExclusiveLock); pg_index = heap_open(IndexRelationId, RowExclusiveLock);
indexTuple = SearchSysCacheCopy(INDEXRELID, indexTuple = SearchSysCacheCopy1(INDEXRELID,
ObjectIdGetDatum(indexId), ObjectIdGetDatum(indexId));
0, 0, 0);
if (!HeapTupleIsValid(indexTuple)) if (!HeapTupleIsValid(indexTuple))
elog(ERROR, "cache lookup failed for index %u", indexId); elog(ERROR, "cache lookup failed for index %u", indexId);
indexForm = (Form_pg_index) GETSTRUCT(indexTuple); indexForm = (Form_pg_index) GETSTRUCT(indexTuple);
@ -2393,9 +2381,7 @@ IndexGetRelation(Oid indexId)
Form_pg_index index; Form_pg_index index;
Oid result; Oid result;
tuple = SearchSysCache(INDEXRELID, tuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexId));
ObjectIdGetDatum(indexId),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for index %u", indexId); elog(ERROR, "cache lookup failed for index %u", indexId);
index = (Form_pg_index) GETSTRUCT(tuple); index = (Form_pg_index) GETSTRUCT(tuple);
@ -2498,9 +2484,8 @@ reindex_index(Oid indexId, bool skip_constraint_checks)
{ {
pg_index = heap_open(IndexRelationId, RowExclusiveLock); pg_index = heap_open(IndexRelationId, RowExclusiveLock);
indexTuple = SearchSysCacheCopy(INDEXRELID, indexTuple = SearchSysCacheCopy1(INDEXRELID,
ObjectIdGetDatum(indexId), ObjectIdGetDatum(indexId));
0, 0, 0);
if (!HeapTupleIsValid(indexTuple)) if (!HeapTupleIsValid(indexTuple))
elog(ERROR, "cache lookup failed for index %u", indexId); elog(ERROR, "cache lookup failed for index %u", indexId);
indexForm = (Form_pg_index) GETSTRUCT(indexTuple); indexForm = (Form_pg_index) GETSTRUCT(indexTuple);

View File

@ -13,7 +13,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * 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; return myTempNamespace;
} }
/* use exact schema given */ /* use exact schema given */
namespaceId = GetSysCacheOid(NAMESPACENAME, namespaceId = GetSysCacheOid1(NAMESPACENAME,
CStringGetDatum(newRelation->schemaname), CStringGetDatum(newRelation->schemaname));
0, 0, 0);
if (!OidIsValid(namespaceId)) if (!OidIsValid(namespaceId))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_SCHEMA), (errcode(ERRCODE_UNDEFINED_SCHEMA),
@ -405,9 +404,7 @@ RelationIsVisible(Oid relid)
Oid relnamespace; Oid relnamespace;
bool visible; bool visible;
reltup = SearchSysCache(RELOID, reltup = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
ObjectIdGetDatum(relid),
0, 0, 0);
if (!HeapTupleIsValid(reltup)) if (!HeapTupleIsValid(reltup))
elog(ERROR, "cache lookup failed for relation %u", relid); elog(ERROR, "cache lookup failed for relation %u", relid);
relform = (Form_pg_class) GETSTRUCT(reltup); relform = (Form_pg_class) GETSTRUCT(reltup);
@ -477,10 +474,9 @@ TypenameGetTypid(const char *typname)
{ {
Oid namespaceId = lfirst_oid(l); Oid namespaceId = lfirst_oid(l);
typid = GetSysCacheOid(TYPENAMENSP, typid = GetSysCacheOid2(TYPENAMENSP,
PointerGetDatum(typname), PointerGetDatum(typname),
ObjectIdGetDatum(namespaceId), ObjectIdGetDatum(namespaceId));
0, 0);
if (OidIsValid(typid)) if (OidIsValid(typid))
return typid; return typid;
} }
@ -503,9 +499,7 @@ TypeIsVisible(Oid typid)
Oid typnamespace; Oid typnamespace;
bool visible; bool visible;
typtup = SearchSysCache(TYPEOID, typtup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
ObjectIdGetDatum(typid),
0, 0, 0);
if (!HeapTupleIsValid(typtup)) if (!HeapTupleIsValid(typtup))
elog(ERROR, "cache lookup failed for type %u", typid); elog(ERROR, "cache lookup failed for type %u", typid);
typform = (Form_pg_type) GETSTRUCT(typtup); typform = (Form_pg_type) GETSTRUCT(typtup);
@ -542,10 +536,9 @@ TypeIsVisible(Oid typid)
visible = true; visible = true;
break; break;
} }
if (SearchSysCacheExists(TYPENAMENSP, if (SearchSysCacheExists2(TYPENAMENSP,
PointerGetDatum(typname), PointerGetDatum(typname),
ObjectIdGetDatum(namespaceId), ObjectIdGetDatum(namespaceId)))
0, 0))
{ {
/* Found something else first in path */ /* Found something else first in path */
break; break;
@ -651,9 +644,7 @@ FuncnameGetCandidates(List *names, int nargs, List *argnames,
} }
/* Search syscache by name only */ /* Search syscache by name only */
catlist = SearchSysCacheList(PROCNAMEARGSNSP, 1, catlist = SearchSysCacheList1(PROCNAMEARGSNSP, CStringGetDatum(funcname));
CStringGetDatum(funcname),
0, 0, 0);
for (i = 0; i < catlist->n_members; i++) for (i = 0; i < catlist->n_members; i++)
{ {
@ -1099,9 +1090,7 @@ FunctionIsVisible(Oid funcid)
Oid pronamespace; Oid pronamespace;
bool visible; bool visible;
proctup = SearchSysCache(PROCOID, proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
ObjectIdGetDatum(funcid),
0, 0, 0);
if (!HeapTupleIsValid(proctup)) if (!HeapTupleIsValid(proctup))
elog(ERROR, "cache lookup failed for function %u", funcid); elog(ERROR, "cache lookup failed for function %u", funcid);
procform = (Form_pg_proc) GETSTRUCT(proctup); procform = (Form_pg_proc) GETSTRUCT(proctup);
@ -1181,11 +1170,11 @@ OpernameGetOprid(List *names, Oid oprleft, Oid oprright)
HeapTuple opertup; HeapTuple opertup;
namespaceId = LookupExplicitNamespace(schemaname); namespaceId = LookupExplicitNamespace(schemaname);
opertup = SearchSysCache(OPERNAMENSP, opertup = SearchSysCache4(OPERNAMENSP,
CStringGetDatum(opername), CStringGetDatum(opername),
ObjectIdGetDatum(oprleft), ObjectIdGetDatum(oprleft),
ObjectIdGetDatum(oprright), ObjectIdGetDatum(oprright),
ObjectIdGetDatum(namespaceId)); ObjectIdGetDatum(namespaceId));
if (HeapTupleIsValid(opertup)) if (HeapTupleIsValid(opertup))
{ {
Oid result = HeapTupleGetOid(opertup); Oid result = HeapTupleGetOid(opertup);
@ -1197,11 +1186,10 @@ OpernameGetOprid(List *names, Oid oprleft, Oid oprright)
} }
/* Search syscache by name and argument types */ /* Search syscache by name and argument types */
catlist = SearchSysCacheList(OPERNAMENSP, 3, catlist = SearchSysCacheList3(OPERNAMENSP,
CStringGetDatum(opername), CStringGetDatum(opername),
ObjectIdGetDatum(oprleft), ObjectIdGetDatum(oprleft),
ObjectIdGetDatum(oprright), ObjectIdGetDatum(oprright));
0);
if (catlist->n_members == 0) if (catlist->n_members == 0)
{ {
@ -1289,9 +1277,7 @@ OpernameGetCandidates(List *names, char oprkind)
} }
/* Search syscache by name only */ /* Search syscache by name only */
catlist = SearchSysCacheList(OPERNAMENSP, 1, catlist = SearchSysCacheList1(OPERNAMENSP, CStringGetDatum(opername));
CStringGetDatum(opername),
0, 0, 0);
/* /*
* In typical scenarios, most if not all of the operators found by the * In typical scenarios, most if not all of the operators found by the
@ -1428,9 +1414,7 @@ OperatorIsVisible(Oid oprid)
Oid oprnamespace; Oid oprnamespace;
bool visible; bool visible;
oprtup = SearchSysCache(OPEROID, oprtup = SearchSysCache1(OPEROID, ObjectIdGetDatum(oprid));
ObjectIdGetDatum(oprid),
0, 0, 0);
if (!HeapTupleIsValid(oprtup)) if (!HeapTupleIsValid(oprtup))
elog(ERROR, "cache lookup failed for operator %u", oprid); elog(ERROR, "cache lookup failed for operator %u", oprid);
oprform = (Form_pg_operator) GETSTRUCT(oprtup); oprform = (Form_pg_operator) GETSTRUCT(oprtup);
@ -1490,11 +1474,10 @@ OpclassnameGetOpcid(Oid amid, const char *opcname)
if (namespaceId == myTempNamespace) if (namespaceId == myTempNamespace)
continue; /* do not look in temp namespace */ continue; /* do not look in temp namespace */
opcid = GetSysCacheOid(CLAAMNAMENSP, opcid = GetSysCacheOid3(CLAAMNAMENSP,
ObjectIdGetDatum(amid), ObjectIdGetDatum(amid),
PointerGetDatum(opcname), PointerGetDatum(opcname),
ObjectIdGetDatum(namespaceId), ObjectIdGetDatum(namespaceId));
0);
if (OidIsValid(opcid)) if (OidIsValid(opcid))
return opcid; return opcid;
} }
@ -1517,9 +1500,7 @@ OpclassIsVisible(Oid opcid)
Oid opcnamespace; Oid opcnamespace;
bool visible; bool visible;
opctup = SearchSysCache(CLAOID, opctup = SearchSysCache1(CLAOID, ObjectIdGetDatum(opcid));
ObjectIdGetDatum(opcid),
0, 0, 0);
if (!HeapTupleIsValid(opctup)) if (!HeapTupleIsValid(opctup))
elog(ERROR, "cache lookup failed for opclass %u", opcid); elog(ERROR, "cache lookup failed for opclass %u", opcid);
opcform = (Form_pg_opclass) GETSTRUCT(opctup); opcform = (Form_pg_opclass) GETSTRUCT(opctup);
@ -1576,11 +1557,10 @@ OpfamilynameGetOpfid(Oid amid, const char *opfname)
if (namespaceId == myTempNamespace) if (namespaceId == myTempNamespace)
continue; /* do not look in temp namespace */ continue; /* do not look in temp namespace */
opfid = GetSysCacheOid(OPFAMILYAMNAMENSP, opfid = GetSysCacheOid3(OPFAMILYAMNAMENSP,
ObjectIdGetDatum(amid), ObjectIdGetDatum(amid),
PointerGetDatum(opfname), PointerGetDatum(opfname),
ObjectIdGetDatum(namespaceId), ObjectIdGetDatum(namespaceId));
0);
if (OidIsValid(opfid)) if (OidIsValid(opfid))
return opfid; return opfid;
} }
@ -1603,9 +1583,7 @@ OpfamilyIsVisible(Oid opfid)
Oid opfnamespace; Oid opfnamespace;
bool visible; bool visible;
opftup = SearchSysCache(OPFAMILYOID, opftup = SearchSysCache1(OPFAMILYOID, ObjectIdGetDatum(opfid));
ObjectIdGetDatum(opfid),
0, 0, 0);
if (!HeapTupleIsValid(opftup)) if (!HeapTupleIsValid(opftup))
elog(ERROR, "cache lookup failed for opfamily %u", opfid); elog(ERROR, "cache lookup failed for opfamily %u", opfid);
opfform = (Form_pg_opfamily) GETSTRUCT(opftup); opfform = (Form_pg_opfamily) GETSTRUCT(opftup);
@ -1661,10 +1639,9 @@ ConversionGetConid(const char *conname)
if (namespaceId == myTempNamespace) if (namespaceId == myTempNamespace)
continue; /* do not look in temp namespace */ continue; /* do not look in temp namespace */
conid = GetSysCacheOid(CONNAMENSP, conid = GetSysCacheOid2(CONNAMENSP,
PointerGetDatum(conname), PointerGetDatum(conname),
ObjectIdGetDatum(namespaceId), ObjectIdGetDatum(namespaceId));
0, 0);
if (OidIsValid(conid)) if (OidIsValid(conid))
return conid; return conid;
} }
@ -1687,9 +1664,7 @@ ConversionIsVisible(Oid conid)
Oid connamespace; Oid connamespace;
bool visible; bool visible;
contup = SearchSysCache(CONVOID, contup = SearchSysCache1(CONVOID, ObjectIdGetDatum(conid));
ObjectIdGetDatum(conid),
0, 0, 0);
if (!HeapTupleIsValid(contup)) if (!HeapTupleIsValid(contup))
elog(ERROR, "cache lookup failed for conversion %u", conid); elog(ERROR, "cache lookup failed for conversion %u", conid);
conform = (Form_pg_conversion) GETSTRUCT(contup); conform = (Form_pg_conversion) GETSTRUCT(contup);
@ -1744,10 +1719,9 @@ TSParserGetPrsid(List *names, bool failOK)
{ {
/* use exact schema given */ /* use exact schema given */
namespaceId = LookupExplicitNamespace(schemaname); namespaceId = LookupExplicitNamespace(schemaname);
prsoid = GetSysCacheOid(TSPARSERNAMENSP, prsoid = GetSysCacheOid2(TSPARSERNAMENSP,
PointerGetDatum(parser_name), PointerGetDatum(parser_name),
ObjectIdGetDatum(namespaceId), ObjectIdGetDatum(namespaceId));
0, 0);
} }
else else
{ {
@ -1761,10 +1735,9 @@ TSParserGetPrsid(List *names, bool failOK)
if (namespaceId == myTempNamespace) if (namespaceId == myTempNamespace)
continue; /* do not look in temp namespace */ continue; /* do not look in temp namespace */
prsoid = GetSysCacheOid(TSPARSERNAMENSP, prsoid = GetSysCacheOid2(TSPARSERNAMENSP,
PointerGetDatum(parser_name), PointerGetDatum(parser_name),
ObjectIdGetDatum(namespaceId), ObjectIdGetDatum(namespaceId));
0, 0);
if (OidIsValid(prsoid)) if (OidIsValid(prsoid))
break; break;
} }
@ -1793,9 +1766,7 @@ TSParserIsVisible(Oid prsId)
Oid namespace; Oid namespace;
bool visible; bool visible;
tup = SearchSysCache(TSPARSEROID, tup = SearchSysCache1(TSPARSEROID, ObjectIdGetDatum(prsId));
ObjectIdGetDatum(prsId),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for text search parser %u", prsId); elog(ERROR, "cache lookup failed for text search parser %u", prsId);
form = (Form_pg_ts_parser) GETSTRUCT(tup); form = (Form_pg_ts_parser) GETSTRUCT(tup);
@ -1835,10 +1806,9 @@ TSParserIsVisible(Oid prsId)
visible = true; visible = true;
break; break;
} }
if (SearchSysCacheExists(TSPARSERNAMENSP, if (SearchSysCacheExists2(TSPARSERNAMENSP,
PointerGetDatum(name), PointerGetDatum(name),
ObjectIdGetDatum(namespaceId), ObjectIdGetDatum(namespaceId)))
0, 0))
{ {
/* Found something else first in path */ /* Found something else first in path */
break; break;
@ -1872,10 +1842,9 @@ TSDictionaryGetDictid(List *names, bool failOK)
{ {
/* use exact schema given */ /* use exact schema given */
namespaceId = LookupExplicitNamespace(schemaname); namespaceId = LookupExplicitNamespace(schemaname);
dictoid = GetSysCacheOid(TSDICTNAMENSP, dictoid = GetSysCacheOid2(TSDICTNAMENSP,
PointerGetDatum(dict_name), PointerGetDatum(dict_name),
ObjectIdGetDatum(namespaceId), ObjectIdGetDatum(namespaceId));
0, 0);
} }
else else
{ {
@ -1889,10 +1858,9 @@ TSDictionaryGetDictid(List *names, bool failOK)
if (namespaceId == myTempNamespace) if (namespaceId == myTempNamespace)
continue; /* do not look in temp namespace */ continue; /* do not look in temp namespace */
dictoid = GetSysCacheOid(TSDICTNAMENSP, dictoid = GetSysCacheOid2(TSDICTNAMENSP,
PointerGetDatum(dict_name), PointerGetDatum(dict_name),
ObjectIdGetDatum(namespaceId), ObjectIdGetDatum(namespaceId));
0, 0);
if (OidIsValid(dictoid)) if (OidIsValid(dictoid))
break; break;
} }
@ -1921,9 +1889,7 @@ TSDictionaryIsVisible(Oid dictId)
Oid namespace; Oid namespace;
bool visible; bool visible;
tup = SearchSysCache(TSDICTOID, tup = SearchSysCache1(TSDICTOID, ObjectIdGetDatum(dictId));
ObjectIdGetDatum(dictId),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for text search dictionary %u", elog(ERROR, "cache lookup failed for text search dictionary %u",
dictId); dictId);
@ -1964,10 +1930,9 @@ TSDictionaryIsVisible(Oid dictId)
visible = true; visible = true;
break; break;
} }
if (SearchSysCacheExists(TSDICTNAMENSP, if (SearchSysCacheExists2(TSDICTNAMENSP,
PointerGetDatum(name), PointerGetDatum(name),
ObjectIdGetDatum(namespaceId), ObjectIdGetDatum(namespaceId)))
0, 0))
{ {
/* Found something else first in path */ /* Found something else first in path */
break; break;
@ -2001,10 +1966,9 @@ TSTemplateGetTmplid(List *names, bool failOK)
{ {
/* use exact schema given */ /* use exact schema given */
namespaceId = LookupExplicitNamespace(schemaname); namespaceId = LookupExplicitNamespace(schemaname);
tmploid = GetSysCacheOid(TSTEMPLATENAMENSP, tmploid = GetSysCacheOid2(TSTEMPLATENAMENSP,
PointerGetDatum(template_name), PointerGetDatum(template_name),
ObjectIdGetDatum(namespaceId), ObjectIdGetDatum(namespaceId));
0, 0);
} }
else else
{ {
@ -2018,10 +1982,9 @@ TSTemplateGetTmplid(List *names, bool failOK)
if (namespaceId == myTempNamespace) if (namespaceId == myTempNamespace)
continue; /* do not look in temp namespace */ continue; /* do not look in temp namespace */
tmploid = GetSysCacheOid(TSTEMPLATENAMENSP, tmploid = GetSysCacheOid2(TSTEMPLATENAMENSP,
PointerGetDatum(template_name), PointerGetDatum(template_name),
ObjectIdGetDatum(namespaceId), ObjectIdGetDatum(namespaceId));
0, 0);
if (OidIsValid(tmploid)) if (OidIsValid(tmploid))
break; break;
} }
@ -2050,9 +2013,7 @@ TSTemplateIsVisible(Oid tmplId)
Oid namespace; Oid namespace;
bool visible; bool visible;
tup = SearchSysCache(TSTEMPLATEOID, tup = SearchSysCache1(TSTEMPLATEOID, ObjectIdGetDatum(tmplId));
ObjectIdGetDatum(tmplId),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for text search template %u", tmplId); elog(ERROR, "cache lookup failed for text search template %u", tmplId);
form = (Form_pg_ts_template) GETSTRUCT(tup); form = (Form_pg_ts_template) GETSTRUCT(tup);
@ -2092,10 +2053,9 @@ TSTemplateIsVisible(Oid tmplId)
visible = true; visible = true;
break; break;
} }
if (SearchSysCacheExists(TSTEMPLATENAMENSP, if (SearchSysCacheExists2(TSTEMPLATENAMENSP,
PointerGetDatum(name), PointerGetDatum(name),
ObjectIdGetDatum(namespaceId), ObjectIdGetDatum(namespaceId)))
0, 0))
{ {
/* Found something else first in path */ /* Found something else first in path */
break; break;
@ -2129,10 +2089,9 @@ TSConfigGetCfgid(List *names, bool failOK)
{ {
/* use exact schema given */ /* use exact schema given */
namespaceId = LookupExplicitNamespace(schemaname); namespaceId = LookupExplicitNamespace(schemaname);
cfgoid = GetSysCacheOid(TSCONFIGNAMENSP, cfgoid = GetSysCacheOid2(TSCONFIGNAMENSP,
PointerGetDatum(config_name), PointerGetDatum(config_name),
ObjectIdGetDatum(namespaceId), ObjectIdGetDatum(namespaceId));
0, 0);
} }
else else
{ {
@ -2146,10 +2105,9 @@ TSConfigGetCfgid(List *names, bool failOK)
if (namespaceId == myTempNamespace) if (namespaceId == myTempNamespace)
continue; /* do not look in temp namespace */ continue; /* do not look in temp namespace */
cfgoid = GetSysCacheOid(TSCONFIGNAMENSP, cfgoid = GetSysCacheOid2(TSCONFIGNAMENSP,
PointerGetDatum(config_name), PointerGetDatum(config_name),
ObjectIdGetDatum(namespaceId), ObjectIdGetDatum(namespaceId));
0, 0);
if (OidIsValid(cfgoid)) if (OidIsValid(cfgoid))
break; break;
} }
@ -2178,9 +2136,7 @@ TSConfigIsVisible(Oid cfgid)
Oid namespace; Oid namespace;
bool visible; bool visible;
tup = SearchSysCache(TSCONFIGOID, tup = SearchSysCache1(TSCONFIGOID, ObjectIdGetDatum(cfgid));
ObjectIdGetDatum(cfgid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for text search configuration %u", elog(ERROR, "cache lookup failed for text search configuration %u",
cfgid); cfgid);
@ -2221,10 +2177,9 @@ TSConfigIsVisible(Oid cfgid)
visible = true; visible = true;
break; break;
} }
if (SearchSysCacheExists(TSCONFIGNAMENSP, if (SearchSysCacheExists2(TSCONFIGNAMENSP,
PointerGetDatum(name), PointerGetDatum(name),
ObjectIdGetDatum(namespaceId), ObjectIdGetDatum(namespaceId)))
0, 0))
{ {
/* Found something else first in path */ /* Found something else first in path */
break; break;
@ -2316,9 +2271,7 @@ LookupNamespaceNoError(const char *nspname)
return InvalidOid; return InvalidOid;
} }
return GetSysCacheOid(NAMESPACENAME, return GetSysCacheOid1(NAMESPACENAME, CStringGetDatum(nspname));
CStringGetDatum(nspname),
0, 0, 0);
} }
/* /*
@ -2348,9 +2301,7 @@ LookupExplicitNamespace(const char *nspname)
*/ */
} }
namespaceId = GetSysCacheOid(NAMESPACENAME, namespaceId = GetSysCacheOid1(NAMESPACENAME, CStringGetDatum(nspname));
CStringGetDatum(nspname),
0, 0, 0);
if (!OidIsValid(namespaceId)) if (!OidIsValid(namespaceId))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_SCHEMA), (errcode(ERRCODE_UNDEFINED_SCHEMA),
@ -2389,9 +2340,7 @@ LookupCreationNamespace(const char *nspname)
return myTempNamespace; return myTempNamespace;
} }
namespaceId = GetSysCacheOid(NAMESPACENAME, namespaceId = GetSysCacheOid1(NAMESPACENAME, CStringGetDatum(nspname));
CStringGetDatum(nspname),
0, 0, 0);
if (!OidIsValid(namespaceId)) if (!OidIsValid(namespaceId))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_SCHEMA), (errcode(ERRCODE_UNDEFINED_SCHEMA),
@ -2437,9 +2386,8 @@ QualifiedNameGetCreationNamespace(List *names, char **objname_p)
return myTempNamespace; return myTempNamespace;
} }
/* use exact schema given */ /* use exact schema given */
namespaceId = GetSysCacheOid(NAMESPACENAME, namespaceId = GetSysCacheOid1(NAMESPACENAME,
CStringGetDatum(schemaname), CStringGetDatum(schemaname));
0, 0, 0);
if (!OidIsValid(namespaceId)) if (!OidIsValid(namespaceId))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_SCHEMA), (errcode(ERRCODE_UNDEFINED_SCHEMA),
@ -2836,10 +2784,9 @@ FindConversionByName(List *name)
{ {
/* use exact schema given */ /* use exact schema given */
namespaceId = LookupExplicitNamespace(schemaname); namespaceId = LookupExplicitNamespace(schemaname);
return GetSysCacheOid(CONNAMENSP, return GetSysCacheOid2(CONNAMENSP,
PointerGetDatum(conversion_name), PointerGetDatum(conversion_name),
ObjectIdGetDatum(namespaceId), ObjectIdGetDatum(namespaceId));
0, 0);
} }
else else
{ {
@ -2853,10 +2800,9 @@ FindConversionByName(List *name)
if (namespaceId == myTempNamespace) if (namespaceId == myTempNamespace)
continue; /* do not look in temp namespace */ continue; /* do not look in temp namespace */
conoid = GetSysCacheOid(CONNAMENSP, conoid = GetSysCacheOid2(CONNAMENSP,
PointerGetDatum(conversion_name), PointerGetDatum(conversion_name),
ObjectIdGetDatum(namespaceId), ObjectIdGetDatum(namespaceId));
0, 0);
if (OidIsValid(conoid)) if (OidIsValid(conoid))
return conoid; return conoid;
} }
@ -2946,17 +2892,14 @@ recomputeNamespacePath(void)
/* $user --- substitute namespace matching user name, if any */ /* $user --- substitute namespace matching user name, if any */
HeapTuple tuple; HeapTuple tuple;
tuple = SearchSysCache(AUTHOID, tuple = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid));
ObjectIdGetDatum(roleid),
0, 0, 0);
if (HeapTupleIsValid(tuple)) if (HeapTupleIsValid(tuple))
{ {
char *rname; char *rname;
rname = NameStr(((Form_pg_authid) GETSTRUCT(tuple))->rolname); rname = NameStr(((Form_pg_authid) GETSTRUCT(tuple))->rolname);
namespaceId = GetSysCacheOid(NAMESPACENAME, namespaceId = GetSysCacheOid1(NAMESPACENAME,
CStringGetDatum(rname), CStringGetDatum(rname));
0, 0, 0);
ReleaseSysCache(tuple); ReleaseSysCache(tuple);
if (OidIsValid(namespaceId) && if (OidIsValid(namespaceId) &&
!list_member_oid(oidlist, namespaceId) && !list_member_oid(oidlist, namespaceId) &&
@ -2983,9 +2926,8 @@ recomputeNamespacePath(void)
else else
{ {
/* normal namespace reference */ /* normal namespace reference */
namespaceId = GetSysCacheOid(NAMESPACENAME, namespaceId = GetSysCacheOid1(NAMESPACENAME,
CStringGetDatum(curname), CStringGetDatum(curname));
0, 0, 0);
if (OidIsValid(namespaceId) && if (OidIsValid(namespaceId) &&
!list_member_oid(oidlist, namespaceId) && !list_member_oid(oidlist, namespaceId) &&
pg_namespace_aclcheck(namespaceId, roleid, pg_namespace_aclcheck(namespaceId, roleid,
@ -3077,9 +3019,8 @@ InitTempTableNamespace(void)
snprintf(namespaceName, sizeof(namespaceName), "pg_temp_%d", MyBackendId); snprintf(namespaceName, sizeof(namespaceName), "pg_temp_%d", MyBackendId);
namespaceId = GetSysCacheOid(NAMESPACENAME, namespaceId = GetSysCacheOid1(NAMESPACENAME,
CStringGetDatum(namespaceName), CStringGetDatum(namespaceName));
0, 0, 0);
if (!OidIsValid(namespaceId)) if (!OidIsValid(namespaceId))
{ {
/* /*
@ -3111,9 +3052,8 @@ InitTempTableNamespace(void)
snprintf(namespaceName, sizeof(namespaceName), "pg_toast_temp_%d", snprintf(namespaceName, sizeof(namespaceName), "pg_toast_temp_%d",
MyBackendId); MyBackendId);
toastspaceId = GetSysCacheOid(NAMESPACENAME, toastspaceId = GetSysCacheOid1(NAMESPACENAME,
CStringGetDatum(namespaceName), CStringGetDatum(namespaceName));
0, 0, 0);
if (!OidIsValid(toastspaceId)) if (!OidIsValid(toastspaceId))
{ {
toastspaceId = NamespaceCreate(namespaceName, BOOTSTRAP_SUPERUSERID); toastspaceId = NamespaceCreate(namespaceName, BOOTSTRAP_SUPERUSERID);
@ -3351,9 +3291,8 @@ assign_search_path(const char *newval, bool doit, GucSource source)
continue; continue;
if (strcmp(curname, "pg_temp") == 0) if (strcmp(curname, "pg_temp") == 0)
continue; continue;
if (!SearchSysCacheExists(NAMESPACENAME, if (!SearchSysCacheExists1(NAMESPACENAME,
CStringGetDatum(curname), CStringGetDatum(curname)))
0, 0, 0))
ereport((source == PGC_S_TEST) ? NOTICE : ERROR, ereport((source == PGC_S_TEST) ? NOTICE : ERROR,
(errcode(ERRCODE_UNDEFINED_SCHEMA), (errcode(ERRCODE_UNDEFINED_SCHEMA),
errmsg("schema \"%s\" does not exist", curname))); errmsg("schema \"%s\" does not exist", curname)));
@ -3519,9 +3458,7 @@ pg_table_is_visible(PG_FUNCTION_ARGS)
{ {
Oid oid = PG_GETARG_OID(0); Oid oid = PG_GETARG_OID(0);
if (!SearchSysCacheExists(RELOID, if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(oid)))
ObjectIdGetDatum(oid),
0, 0, 0))
PG_RETURN_NULL(); PG_RETURN_NULL();
PG_RETURN_BOOL(RelationIsVisible(oid)); PG_RETURN_BOOL(RelationIsVisible(oid));
@ -3532,9 +3469,7 @@ pg_type_is_visible(PG_FUNCTION_ARGS)
{ {
Oid oid = PG_GETARG_OID(0); Oid oid = PG_GETARG_OID(0);
if (!SearchSysCacheExists(TYPEOID, if (!SearchSysCacheExists1(TYPEOID, ObjectIdGetDatum(oid)))
ObjectIdGetDatum(oid),
0, 0, 0))
PG_RETURN_NULL(); PG_RETURN_NULL();
PG_RETURN_BOOL(TypeIsVisible(oid)); PG_RETURN_BOOL(TypeIsVisible(oid));
@ -3545,9 +3480,7 @@ pg_function_is_visible(PG_FUNCTION_ARGS)
{ {
Oid oid = PG_GETARG_OID(0); Oid oid = PG_GETARG_OID(0);
if (!SearchSysCacheExists(PROCOID, if (!SearchSysCacheExists1(PROCOID, ObjectIdGetDatum(oid)))
ObjectIdGetDatum(oid),
0, 0, 0))
PG_RETURN_NULL(); PG_RETURN_NULL();
PG_RETURN_BOOL(FunctionIsVisible(oid)); PG_RETURN_BOOL(FunctionIsVisible(oid));
@ -3558,9 +3491,7 @@ pg_operator_is_visible(PG_FUNCTION_ARGS)
{ {
Oid oid = PG_GETARG_OID(0); Oid oid = PG_GETARG_OID(0);
if (!SearchSysCacheExists(OPEROID, if (!SearchSysCacheExists1(OPEROID, ObjectIdGetDatum(oid)))
ObjectIdGetDatum(oid),
0, 0, 0))
PG_RETURN_NULL(); PG_RETURN_NULL();
PG_RETURN_BOOL(OperatorIsVisible(oid)); PG_RETURN_BOOL(OperatorIsVisible(oid));
@ -3571,9 +3502,7 @@ pg_opclass_is_visible(PG_FUNCTION_ARGS)
{ {
Oid oid = PG_GETARG_OID(0); Oid oid = PG_GETARG_OID(0);
if (!SearchSysCacheExists(CLAOID, if (!SearchSysCacheExists1(CLAOID, ObjectIdGetDatum(oid)))
ObjectIdGetDatum(oid),
0, 0, 0))
PG_RETURN_NULL(); PG_RETURN_NULL();
PG_RETURN_BOOL(OpclassIsVisible(oid)); PG_RETURN_BOOL(OpclassIsVisible(oid));
@ -3584,9 +3513,7 @@ pg_conversion_is_visible(PG_FUNCTION_ARGS)
{ {
Oid oid = PG_GETARG_OID(0); Oid oid = PG_GETARG_OID(0);
if (!SearchSysCacheExists(CONVOID, if (!SearchSysCacheExists1(CONVOID, ObjectIdGetDatum(oid)))
ObjectIdGetDatum(oid),
0, 0, 0))
PG_RETURN_NULL(); PG_RETURN_NULL();
PG_RETURN_BOOL(ConversionIsVisible(oid)); PG_RETURN_BOOL(ConversionIsVisible(oid));
@ -3597,9 +3524,7 @@ pg_ts_parser_is_visible(PG_FUNCTION_ARGS)
{ {
Oid oid = PG_GETARG_OID(0); Oid oid = PG_GETARG_OID(0);
if (!SearchSysCacheExists(TSPARSEROID, if (!SearchSysCacheExists1(TSPARSEROID, ObjectIdGetDatum(oid)))
ObjectIdGetDatum(oid),
0, 0, 0))
PG_RETURN_NULL(); PG_RETURN_NULL();
PG_RETURN_BOOL(TSParserIsVisible(oid)); PG_RETURN_BOOL(TSParserIsVisible(oid));
@ -3610,9 +3535,7 @@ pg_ts_dict_is_visible(PG_FUNCTION_ARGS)
{ {
Oid oid = PG_GETARG_OID(0); Oid oid = PG_GETARG_OID(0);
if (!SearchSysCacheExists(TSDICTOID, if (!SearchSysCacheExists1(TSDICTOID, ObjectIdGetDatum(oid)))
ObjectIdGetDatum(oid),
0, 0, 0))
PG_RETURN_NULL(); PG_RETURN_NULL();
PG_RETURN_BOOL(TSDictionaryIsVisible(oid)); PG_RETURN_BOOL(TSDictionaryIsVisible(oid));
@ -3623,9 +3546,7 @@ pg_ts_template_is_visible(PG_FUNCTION_ARGS)
{ {
Oid oid = PG_GETARG_OID(0); Oid oid = PG_GETARG_OID(0);
if (!SearchSysCacheExists(TSTEMPLATEOID, if (!SearchSysCacheExists1(TSTEMPLATEOID, ObjectIdGetDatum(oid)))
ObjectIdGetDatum(oid),
0, 0, 0))
PG_RETURN_NULL(); PG_RETURN_NULL();
PG_RETURN_BOOL(TSTemplateIsVisible(oid)); PG_RETURN_BOOL(TSTemplateIsVisible(oid));
@ -3636,9 +3557,7 @@ pg_ts_config_is_visible(PG_FUNCTION_ARGS)
{ {
Oid oid = PG_GETARG_OID(0); Oid oid = PG_GETARG_OID(0);
if (!SearchSysCacheExists(TSCONFIGOID, if (!SearchSysCacheExists1(TSCONFIGOID, ObjectIdGetDatum(oid)))
ObjectIdGetDatum(oid),
0, 0, 0))
PG_RETURN_NULL(); PG_RETURN_NULL();
PG_RETURN_BOOL(TSConfigIsVisible(oid)); PG_RETURN_BOOL(TSConfigIsVisible(oid));

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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), NameListToString(aggtransfnName),
format_type_be(aggTransType)))); format_type_be(aggTransType))));
tup = SearchSysCache(PROCOID, tup = SearchSysCache1(PROCOID, ObjectIdGetDatum(transfn));
ObjectIdGetDatum(transfn),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for function %u", transfn); elog(ERROR, "cache lookup failed for function %u", transfn);
proc = (Form_pg_proc) GETSTRUCT(tup); proc = (Form_pg_proc) GETSTRUCT(tup);

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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); conDesc = heap_open(ConstraintRelationId, RowExclusiveLock);
tup = SearchSysCache(CONSTROID, tup = SearchSysCache1(CONSTROID, ObjectIdGetDatum(conId));
ObjectIdGetDatum(conId),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for constraint %u", conId); elog(ERROR, "cache lookup failed for constraint %u", conId);
con = (Form_pg_constraint) GETSTRUCT(tup); con = (Form_pg_constraint) GETSTRUCT(tup);
@ -559,9 +557,8 @@ RemoveConstraintById(Oid conId)
Form_pg_class classForm; Form_pg_class classForm;
pgrel = heap_open(RelationRelationId, RowExclusiveLock); pgrel = heap_open(RelationRelationId, RowExclusiveLock);
relTup = SearchSysCacheCopy(RELOID, relTup = SearchSysCacheCopy1(RELOID,
ObjectIdGetDatum(con->conrelid), ObjectIdGetDatum(con->conrelid));
0, 0, 0);
if (!HeapTupleIsValid(relTup)) if (!HeapTupleIsValid(relTup))
elog(ERROR, "cache lookup failed for relation %u", elog(ERROR, "cache lookup failed for relation %u",
con->conrelid); con->conrelid);
@ -623,9 +620,7 @@ RenameConstraintById(Oid conId, const char *newname)
conDesc = heap_open(ConstraintRelationId, RowExclusiveLock); conDesc = heap_open(ConstraintRelationId, RowExclusiveLock);
tuple = SearchSysCacheCopy(CONSTROID, tuple = SearchSysCacheCopy1(CONSTROID, ObjectIdGetDatum(conId));
ObjectIdGetDatum(conId),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for constraint %u", conId); elog(ERROR, "cache lookup failed for constraint %u", conId);
con = (Form_pg_constraint) GETSTRUCT(tuple); con = (Form_pg_constraint) GETSTRUCT(tuple);

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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"); elog(ERROR, "no conversion name supplied");
/* make sure there is no existing conversion of same name */ /* make sure there is no existing conversion of same name */
if (SearchSysCacheExists(CONNAMENSP, if (SearchSysCacheExists2(CONNAMENSP,
PointerGetDatum(conname), PointerGetDatum(conname),
ObjectIdGetDatum(connamespace), ObjectIdGetDatum(connamespace)))
0, 0))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT), (errcode(ERRCODE_DUPLICATE_OBJECT),
errmsg("conversion \"%s\" already exists", conname))); errmsg("conversion \"%s\" already exists", conname)));
@ -190,11 +189,10 @@ FindDefaultConversion(Oid name_space, int32 for_encoding, int32 to_encoding)
Oid proc = InvalidOid; Oid proc = InvalidOid;
int i; int i;
catlist = SearchSysCacheList(CONDEFAULT, 3, catlist = SearchSysCacheList3(CONDEFAULT,
ObjectIdGetDatum(name_space), ObjectIdGetDatum(name_space),
Int32GetDatum(for_encoding), Int32GetDatum(for_encoding),
Int32GetDatum(to_encoding), Int32GetDatum(to_encoding));
0);
for (i = 0; i < catlist->n_members; i++) for (i = 0; i < catlist->n_members; i++)
{ {

View File

@ -13,7 +13,7 @@
* *
* *
* IDENTIFICATION * 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 * really exists or not. If not, assume it was dropped while we
* waited to acquire lock, and ignore it. * waited to acquire lock, and ignore it.
*/ */
if (!SearchSysCacheExists(RELOID, if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(inhrelid)))
ObjectIdGetDatum(inhrelid),
0, 0, 0))
{ {
/* Release useless lock */ /* Release useless lock */
UnlockRelationOid(inhrelid, lockmode); UnlockRelationOid(inhrelid, lockmode);
@ -245,9 +243,7 @@ has_subclass(Oid relationId)
HeapTuple tuple; HeapTuple tuple;
bool result; bool result;
tuple = SearchSysCache(RELOID, tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relationId));
ObjectIdGetDatum(relationId),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", relationId); elog(ERROR, "cache lookup failed for relation %u", relationId);

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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"); elog(ERROR, "no namespace name supplied");
/* make sure there is no existing namespace of same name */ /* make sure there is no existing namespace of same name */
if (SearchSysCacheExists(NAMESPACENAME, if (SearchSysCacheExists1(NAMESPACENAME, PointerGetDatum(nspName)))
PointerGetDatum(nspName),
0, 0, 0))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_SCHEMA), (errcode(ERRCODE_DUPLICATE_SCHEMA),
errmsg("schema \"%s\" already exists", nspName))); errmsg("schema \"%s\" already exists", nspName)));

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* these routines moved here from commands/define.c and somewhat cleaned up. * these routines moved here from commands/define.c and somewhat cleaned up.
@ -137,11 +137,11 @@ OperatorGet(const char *operatorName,
HeapTuple tup; HeapTuple tup;
Oid operatorObjectId; Oid operatorObjectId;
tup = SearchSysCache(OPERNAMENSP, tup = SearchSysCache4(OPERNAMENSP,
PointerGetDatum(operatorName), PointerGetDatum(operatorName),
ObjectIdGetDatum(leftObjectId), ObjectIdGetDatum(leftObjectId),
ObjectIdGetDatum(rightObjectId), ObjectIdGetDatum(rightObjectId),
ObjectIdGetDatum(operatorNamespace)); ObjectIdGetDatum(operatorNamespace));
if (HeapTupleIsValid(tup)) if (HeapTupleIsValid(tup))
{ {
RegProcedure oprcode = ((Form_pg_operator) GETSTRUCT(tup))->oprcode; RegProcedure oprcode = ((Form_pg_operator) GETSTRUCT(tup))->oprcode;
@ -511,9 +511,8 @@ OperatorCreate(const char *operatorName,
*/ */
if (operatorObjectId) if (operatorObjectId)
{ {
tup = SearchSysCacheCopy(OPEROID, tup = SearchSysCacheCopy1(OPEROID,
ObjectIdGetDatum(operatorObjectId), ObjectIdGetDatum(operatorObjectId));
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for operator %u", elog(ERROR, "cache lookup failed for operator %u",
operatorObjectId); operatorObjectId);
@ -660,9 +659,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
pg_operator_desc = heap_open(OperatorRelationId, RowExclusiveLock); pg_operator_desc = heap_open(OperatorRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy(OPEROID, tup = SearchSysCacheCopy1(OPEROID, ObjectIdGetDatum(commId));
ObjectIdGetDatum(commId),
0, 0, 0);
/* /*
* if the commutator and negator are the same operator, do one update. XXX * 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 */ /* check and update the negator, if necessary */
tup = SearchSysCacheCopy(OPEROID, tup = SearchSysCacheCopy1(OPEROID, ObjectIdGetDatum(negId));
ObjectIdGetDatum(negId),
0, 0, 0);
if (HeapTupleIsValid(tup) && if (HeapTupleIsValid(tup) &&
!(OidIsValid(((Form_pg_operator) GETSTRUCT(tup))->oprnegate))) !(OidIsValid(((Form_pg_operator) GETSTRUCT(tup))->oprnegate)))

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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); tupDesc = RelationGetDescr(rel);
/* Check for pre-existing definition */ /* Check for pre-existing definition */
oldtup = SearchSysCache(PROCNAMEARGSNSP, oldtup = SearchSysCache3(PROCNAMEARGSNSP,
PointerGetDatum(procedureName), PointerGetDatum(procedureName),
PointerGetDatum(parameterTypes), PointerGetDatum(parameterTypes),
ObjectIdGetDatum(procNamespace), ObjectIdGetDatum(procNamespace));
0);
if (HeapTupleIsValid(oldtup)) if (HeapTupleIsValid(oldtup))
{ {
@ -647,9 +646,7 @@ fmgr_internal_validator(PG_FUNCTION_ARGS)
* name will be found later if it isn't there now. * name will be found later if it isn't there now.
*/ */
tuple = SearchSysCache(PROCOID, tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcoid));
ObjectIdGetDatum(funcoid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for function %u", funcoid); elog(ERROR, "cache lookup failed for function %u", funcoid);
proc = (Form_pg_proc) GETSTRUCT(tuple); 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. * and for pg_dump loading it's much better if we *do* check.
*/ */
tuple = SearchSysCache(PROCOID, tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcoid));
ObjectIdGetDatum(funcoid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for function %u", funcoid); elog(ERROR, "cache lookup failed for function %u", funcoid);
proc = (Form_pg_proc) GETSTRUCT(tuple); proc = (Form_pg_proc) GETSTRUCT(tuple);
@ -742,9 +737,7 @@ fmgr_sql_validator(PG_FUNCTION_ARGS)
bool haspolyarg; bool haspolyarg;
int i; int i;
tuple = SearchSysCache(PROCOID, tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcoid));
ObjectIdGetDatum(funcoid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for function %u", funcoid); elog(ERROR, "cache lookup failed for function %u", funcoid);
proc = (Form_pg_proc) GETSTRUCT(tuple); proc = (Form_pg_proc) GETSTRUCT(tuple);

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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) switch (classId)
{ {
case AuthIdRelationId: case AuthIdRelationId:
if (!SearchSysCacheExists(AUTHOID, if (!SearchSysCacheExists1(AUTHOID, ObjectIdGetDatum(objectId)))
ObjectIdGetDatum(objectId),
0, 0, 0))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("role %u was concurrently dropped", errmsg("role %u was concurrently dropped",

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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); pg_type_desc = heap_open(TypeRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy(TYPENAMENSP, tup = SearchSysCacheCopy2(TYPENAMENSP,
CStringGetDatum(typeName), CStringGetDatum(typeName),
ObjectIdGetDatum(typeNamespace), ObjectIdGetDatum(typeNamespace));
0, 0);
if (HeapTupleIsValid(tup)) if (HeapTupleIsValid(tup))
{ {
/* /*
@ -647,9 +646,7 @@ RenameTypeInternal(Oid typeOid, const char *newTypeName, Oid typeNamespace)
pg_type_desc = heap_open(TypeRelationId, RowExclusiveLock); pg_type_desc = heap_open(TypeRelationId, RowExclusiveLock);
tuple = SearchSysCacheCopy(TYPEOID, tuple = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(typeOid));
ObjectIdGetDatum(typeOid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for type %u", typeOid); elog(ERROR, "cache lookup failed for type %u", typeOid);
typ = (Form_pg_type) GETSTRUCT(tuple); typ = (Form_pg_type) GETSTRUCT(tuple);
@ -660,10 +657,9 @@ RenameTypeInternal(Oid typeOid, const char *newTypeName, Oid typeNamespace)
arrayOid = typ->typarray; arrayOid = typ->typarray;
/* Just to give a more friendly error than unique-index violation */ /* Just to give a more friendly error than unique-index violation */
if (SearchSysCacheExists(TYPENAMENSP, if (SearchSysCacheExists2(TYPENAMENSP,
CStringGetDatum(newTypeName), CStringGetDatum(newTypeName),
ObjectIdGetDatum(typeNamespace), ObjectIdGetDatum(typeNamespace)))
0, 0))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT), (errcode(ERRCODE_DUPLICATE_OBJECT),
errmsg("type \"%s\" already exists", newTypeName))); errmsg("type \"%s\" already exists", newTypeName)));
@ -720,10 +716,9 @@ makeArrayTypeName(const char *typeName, Oid typeNamespace)
memcpy(arr + i, typeName, NAMEDATALEN - i); memcpy(arr + i, typeName, NAMEDATALEN - i);
truncate_identifier(arr, NAMEDATALEN, false); truncate_identifier(arr, NAMEDATALEN, false);
} }
if (!SearchSysCacheExists(TYPENAMENSP, if (!SearchSysCacheExists2(TYPENAMENSP,
CStringGetDatum(arr), CStringGetDatum(arr),
ObjectIdGetDatum(typeNamespace), ObjectIdGetDatum(typeNamespace)))
0, 0))
break; break;
} }

View File

@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * 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); class_rel = heap_open(RelationRelationId, RowExclusiveLock);
reltup = SearchSysCacheCopy(RELOID, reltup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relOid));
ObjectIdGetDatum(relOid),
0, 0, 0);
if (!HeapTupleIsValid(reltup)) if (!HeapTupleIsValid(reltup))
elog(ERROR, "cache lookup failed for relation %u", relOid); elog(ERROR, "cache lookup failed for relation %u", relOid);

View File

@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * 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 * DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the * 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 * Find the function tuple, do permissions and validity checks
*/ */
tup = SearchSysCache(PROCOID, tup = SearchSysCache1(PROCOID, ObjectIdGetDatum(procOid));
ObjectIdGetDatum(procOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for function %u", procOid); 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 */ /* Look up function and make sure it's an aggregate */
procOid = LookupAggNameTypeNames(name, args, false); procOid = LookupAggNameTypeNames(name, args, false);
tup = SearchSysCacheCopy(PROCOID, tup = SearchSysCacheCopy1(PROCOID, ObjectIdGetDatum(procOid));
ObjectIdGetDatum(procOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for function %u", procOid); elog(ERROR, "cache lookup failed for function %u", procOid);
procForm = (Form_pg_proc) GETSTRUCT(tup); procForm = (Form_pg_proc) GETSTRUCT(tup);
@ -287,11 +283,10 @@ RenameAggregate(List *name, List *args, const char *newname)
namespaceOid = procForm->pronamespace; namespaceOid = procForm->pronamespace;
/* make sure the new name doesn't exist */ /* make sure the new name doesn't exist */
if (SearchSysCacheExists(PROCNAMEARGSNSP, if (SearchSysCacheExists3(PROCNAMEARGSNSP,
CStringGetDatum(newname), CStringGetDatum(newname),
PointerGetDatum(&procForm->proargtypes), PointerGetDatum(&procForm->proargtypes),
ObjectIdGetDatum(namespaceOid), ObjectIdGetDatum(namespaceOid)))
0))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_FUNCTION), (errcode(ERRCODE_DUPLICATE_FUNCTION),
errmsg("function %s already exists in schema \"%s\"", errmsg("function %s already exists in schema \"%s\"",

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 = (VacAttrStats *) palloc0(sizeof(VacAttrStats));
stats->attr = (Form_pg_attribute) palloc(ATTRIBUTE_FIXED_PART_SIZE); stats->attr = (Form_pg_attribute) palloc(ATTRIBUTE_FIXED_PART_SIZE);
memcpy(stats->attr, attr, ATTRIBUTE_FIXED_PART_SIZE); memcpy(stats->attr, attr, ATTRIBUTE_FIXED_PART_SIZE);
typtuple = SearchSysCache(TYPEOID, typtuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(attr->atttypid));
ObjectIdGetDatum(attr->atttypid),
0, 0, 0);
if (!HeapTupleIsValid(typtuple)) if (!HeapTupleIsValid(typtuple))
elog(ERROR, "cache lookup failed for type %u", attr->atttypid); elog(ERROR, "cache lookup failed for type %u", attr->atttypid);
stats->attrtype = (Form_pg_type) palloc(sizeof(FormData_pg_type)); 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? */ /* Is there already a pg_statistic tuple for this attribute? */
oldtup = SearchSysCache(STATRELATTINH, oldtup = SearchSysCache3(STATRELATTINH,
ObjectIdGetDatum(relid), ObjectIdGetDatum(relid),
Int16GetDatum(stats->attr->attnum), Int16GetDatum(stats->attr->attnum),
BoolGetDatum(inh), BoolGetDatum(inh));
0);
if (HeapTupleIsValid(oldtup)) if (HeapTupleIsValid(oldtup))
{ {

View File

@ -11,7 +11,7 @@
* *
* *
* IDENTIFICATION * 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; Form_pg_index indexForm;
indexOid = lfirst_oid(index); indexOid = lfirst_oid(index);
idxtuple = SearchSysCache(INDEXRELID, idxtuple = SearchSysCache1(INDEXRELID,
ObjectIdGetDatum(indexOid), ObjectIdGetDatum(indexOid));
0, 0, 0);
if (!HeapTupleIsValid(idxtuple)) if (!HeapTupleIsValid(idxtuple))
elog(ERROR, "cache lookup failed for index %u", indexOid); elog(ERROR, "cache lookup failed for index %u", indexOid);
indexForm = (Form_pg_index) GETSTRUCT(idxtuple); 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 * Check that the index still exists
*/ */
if (!SearchSysCacheExists(RELOID, if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(indexOid)))
ObjectIdGetDatum(indexOid),
0, 0, 0))
{ {
relation_close(OldHeap, AccessExclusiveLock); relation_close(OldHeap, AccessExclusiveLock);
return; 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. * Check that the index is still the one with indisclustered set.
*/ */
tuple = SearchSysCache(INDEXRELID, tuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexOid));
ObjectIdGetDatum(indexOid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) /* probably can't happen */ if (!HeapTupleIsValid(tuple)) /* probably can't happen */
{ {
relation_close(OldHeap, AccessExclusiveLock); relation_close(OldHeap, AccessExclusiveLock);
@ -519,9 +514,7 @@ mark_index_clustered(Relation rel, Oid indexOid)
*/ */
if (OidIsValid(indexOid)) if (OidIsValid(indexOid))
{ {
indexTuple = SearchSysCache(INDEXRELID, indexTuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexOid));
ObjectIdGetDatum(indexOid),
0, 0, 0);
if (!HeapTupleIsValid(indexTuple)) if (!HeapTupleIsValid(indexTuple))
elog(ERROR, "cache lookup failed for index %u", indexOid); elog(ERROR, "cache lookup failed for index %u", indexOid);
indexForm = (Form_pg_index) GETSTRUCT(indexTuple); indexForm = (Form_pg_index) GETSTRUCT(indexTuple);
@ -544,9 +537,8 @@ mark_index_clustered(Relation rel, Oid indexOid)
{ {
Oid thisIndexOid = lfirst_oid(index); Oid thisIndexOid = lfirst_oid(index);
indexTuple = SearchSysCacheCopy(INDEXRELID, indexTuple = SearchSysCacheCopy1(INDEXRELID,
ObjectIdGetDatum(thisIndexOid), ObjectIdGetDatum(thisIndexOid));
0, 0, 0);
if (!HeapTupleIsValid(indexTuple)) if (!HeapTupleIsValid(indexTuple))
elog(ERROR, "cache lookup failed for index %u", thisIndexOid); elog(ERROR, "cache lookup failed for index %u", thisIndexOid);
indexForm = (Form_pg_index) GETSTRUCT(indexTuple); 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. * But we do want to use reloptions of the old heap for new heap.
*/ */
tuple = SearchSysCache(RELOID, tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(OIDOldHeap));
ObjectIdGetDatum(OIDOldHeap),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", OIDOldHeap); elog(ERROR, "cache lookup failed for relation %u", OIDOldHeap);
reloptions = SysCacheGetAttr(RELOID, tuple, Anum_pg_class_reloptions, reloptions = SysCacheGetAttr(RELOID, tuple, Anum_pg_class_reloptions,
@ -722,9 +712,7 @@ make_new_heap(Oid OIDOldHeap, Oid NewTableSpace)
if (OidIsValid(toastid)) if (OidIsValid(toastid))
{ {
/* keep the existing toast table's reloptions, if any */ /* keep the existing toast table's reloptions, if any */
tuple = SearchSysCache(RELOID, tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(toastid));
ObjectIdGetDatum(toastid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", toastid); elog(ERROR, "cache lookup failed for relation %u", toastid);
reloptions = SysCacheGetAttr(RELOID, tuple, Anum_pg_class_reloptions, 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. */ /* We need writable copies of both pg_class tuples. */
relRelation = heap_open(RelationRelationId, RowExclusiveLock); relRelation = heap_open(RelationRelationId, RowExclusiveLock);
reltup1 = SearchSysCacheCopy(RELOID, reltup1 = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(r1));
ObjectIdGetDatum(r1),
0, 0, 0);
if (!HeapTupleIsValid(reltup1)) if (!HeapTupleIsValid(reltup1))
elog(ERROR, "cache lookup failed for relation %u", r1); elog(ERROR, "cache lookup failed for relation %u", r1);
relform1 = (Form_pg_class) GETSTRUCT(reltup1); relform1 = (Form_pg_class) GETSTRUCT(reltup1);
reltup2 = SearchSysCacheCopy(RELOID, reltup2 = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(r2));
ObjectIdGetDatum(r2),
0, 0, 0);
if (!HeapTupleIsValid(reltup2)) if (!HeapTupleIsValid(reltup2))
elog(ERROR, "cache lookup failed for relation %u", r2); elog(ERROR, "cache lookup failed for relation %u", r2);
relform2 = (Form_pg_class) GETSTRUCT(reltup2); relform2 = (Form_pg_class) GETSTRUCT(reltup2);

View File

@ -7,7 +7,7 @@
* Copyright (c) 1996-2010, PostgreSQL Global Development Group * Copyright (c) 1996-2010, PostgreSQL Global Development Group
* *
* IDENTIFICATION * 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"))); errmsg("schema name cannot be qualified")));
namespace = strVal(linitial(qualname)); namespace = strVal(linitial(qualname));
oid = GetSysCacheOid(NAMESPACENAME, oid = GetSysCacheOid1(NAMESPACENAME, CStringGetDatum(namespace));
CStringGetDatum(namespace),
0, 0, 0);
if (!OidIsValid(oid)) if (!OidIsValid(oid))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_SCHEMA), (errcode(ERRCODE_UNDEFINED_SCHEMA),
@ -904,10 +902,9 @@ CommentRule(List *qualname, char *comment)
reloid = RelationGetRelid(relation); reloid = RelationGetRelid(relation);
/* Find the rule's pg_rewrite tuple, get its OID */ /* Find the rule's pg_rewrite tuple, get its OID */
tuple = SearchSysCache(RULERELNAME, tuple = SearchSysCache2(RULERELNAME,
ObjectIdGetDatum(reloid), ObjectIdGetDatum(reloid),
PointerGetDatum(rulename), PointerGetDatum(rulename));
0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
@ -1217,9 +1214,7 @@ CommentLanguage(List *qualname, char *comment)
errmsg("language name cannot be qualified"))); errmsg("language name cannot be qualified")));
language = strVal(linitial(qualname)); language = strVal(linitial(qualname));
oid = GetSysCacheOid(LANGNAME, oid = GetSysCacheOid1(LANGNAME, CStringGetDatum(language));
CStringGetDatum(language),
0, 0, 0);
if (!OidIsValid(oid)) if (!OidIsValid(oid))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_SCHEMA), (errcode(ERRCODE_UNDEFINED_SCHEMA),
@ -1260,9 +1255,7 @@ CommentOpClass(List *qualname, List *arguments, char *comment)
/* /*
* Get the access method's OID. * Get the access method's OID.
*/ */
amID = GetSysCacheOid(AMNAME, amID = GetSysCacheOid1(AMNAME, CStringGetDatum(amname));
CStringGetDatum(amname),
0, 0, 0);
if (!OidIsValid(amID)) if (!OidIsValid(amID))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
@ -1282,11 +1275,10 @@ CommentOpClass(List *qualname, List *arguments, char *comment)
Oid namespaceId; Oid namespaceId;
namespaceId = LookupExplicitNamespace(schemaname); namespaceId = LookupExplicitNamespace(schemaname);
tuple = SearchSysCache(CLAAMNAMENSP, tuple = SearchSysCache3(CLAAMNAMENSP,
ObjectIdGetDatum(amID), ObjectIdGetDatum(amID),
PointerGetDatum(opcname), PointerGetDatum(opcname),
ObjectIdGetDatum(namespaceId), ObjectIdGetDatum(namespaceId));
0);
} }
else else
{ {
@ -1297,9 +1289,7 @@ CommentOpClass(List *qualname, List *arguments, char *comment)
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("operator class \"%s\" does not exist for access method \"%s\"", errmsg("operator class \"%s\" does not exist for access method \"%s\"",
opcname, amname))); opcname, amname)));
tuple = SearchSysCache(CLAOID, tuple = SearchSysCache1(CLAOID, ObjectIdGetDatum(opcID));
ObjectIdGetDatum(opcID),
0, 0, 0);
} }
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
@ -1346,9 +1336,7 @@ CommentOpFamily(List *qualname, List *arguments, char *comment)
/* /*
* Get the access method's OID. * Get the access method's OID.
*/ */
amID = GetSysCacheOid(AMNAME, amID = GetSysCacheOid1(AMNAME, CStringGetDatum(amname));
CStringGetDatum(amname),
0, 0, 0);
if (!OidIsValid(amID)) if (!OidIsValid(amID))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
@ -1368,11 +1356,10 @@ CommentOpFamily(List *qualname, List *arguments, char *comment)
Oid namespaceId; Oid namespaceId;
namespaceId = LookupExplicitNamespace(schemaname); namespaceId = LookupExplicitNamespace(schemaname);
tuple = SearchSysCache(OPFAMILYAMNAMENSP, tuple = SearchSysCache3(OPFAMILYAMNAMENSP,
ObjectIdGetDatum(amID), ObjectIdGetDatum(amID),
PointerGetDatum(opfname), PointerGetDatum(opfname),
ObjectIdGetDatum(namespaceId), ObjectIdGetDatum(namespaceId));
0);
} }
else else
{ {
@ -1383,9 +1370,7 @@ CommentOpFamily(List *qualname, List *arguments, char *comment)
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("operator family \"%s\" does not exist for access method \"%s\"", errmsg("operator family \"%s\" does not exist for access method \"%s\"",
opfname, amname))); opfname, amname)));
tuple = SearchSysCache(OPFAMILYOID, tuple = SearchSysCache1(OPFAMILYOID, ObjectIdGetDatum(opfID));
ObjectIdGetDatum(opfID),
0, 0, 0);
} }
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
@ -1500,10 +1485,9 @@ CommentCast(List *qualname, List *arguments, char *comment)
sourcetypeid = typenameTypeId(NULL, sourcetype, NULL); sourcetypeid = typenameTypeId(NULL, sourcetype, NULL);
targettypeid = typenameTypeId(NULL, targettype, NULL); targettypeid = typenameTypeId(NULL, targettype, NULL);
tuple = SearchSysCache(CASTSOURCETARGET, tuple = SearchSysCache2(CASTSOURCETARGET,
ObjectIdGetDatum(sourcetypeid), ObjectIdGetDatum(sourcetypeid),
ObjectIdGetDatum(targettypeid), ObjectIdGetDatum(targettypeid));
0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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; continue;
} }
tuple = SearchSysCache(CONVOID, tuple = SearchSysCache1(CONVOID, ObjectIdGetDatum(conversionOid));
ObjectIdGetDatum(conversionOid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for conversion %u", elog(ERROR, "cache lookup failed for conversion %u",
conversionOid); conversionOid);
@ -211,19 +209,16 @@ RenameConversion(List *name, const char *newname)
errmsg("conversion \"%s\" does not exist", errmsg("conversion \"%s\" does not exist",
NameListToString(name)))); NameListToString(name))));
tup = SearchSysCacheCopy(CONVOID, tup = SearchSysCacheCopy1(CONVOID, ObjectIdGetDatum(conversionOid));
ObjectIdGetDatum(conversionOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for conversion %u", conversionOid); elog(ERROR, "cache lookup failed for conversion %u", conversionOid);
namespaceOid = ((Form_pg_conversion) GETSTRUCT(tup))->connamespace; namespaceOid = ((Form_pg_conversion) GETSTRUCT(tup))->connamespace;
/* make sure the new name doesn't exist */ /* make sure the new name doesn't exist */
if (SearchSysCacheExists(CONNAMENSP, if (SearchSysCacheExists2(CONNAMENSP,
CStringGetDatum(newname), CStringGetDatum(newname),
ObjectIdGetDatum(namespaceOid), ObjectIdGetDatum(namespaceOid)))
0, 0))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT), (errcode(ERRCODE_DUPLICATE_OBJECT),
errmsg("conversion \"%s\" already exists in schema \"%s\"", errmsg("conversion \"%s\" already exists in schema \"%s\"",
@ -301,9 +296,7 @@ AlterConversionOwner_internal(Relation rel, Oid conversionOid, Oid newOwnerId)
Assert(RelationGetRelid(rel) == ConversionRelationId); Assert(RelationGetRelid(rel) == ConversionRelationId);
tup = SearchSysCacheCopy(CONVOID, tup = SearchSysCacheCopy1(CONVOID, ObjectIdGetDatum(conversionOid));
ObjectIdGetDatum(conversionOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for conversion %u", conversionOid); elog(ERROR, "cache lookup failed for conversion %u", conversionOid);

View File

@ -13,7 +13,7 @@
* *
* *
* IDENTIFICATION * 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. * Remove the database's tuple from pg_database.
*/ */
tup = SearchSysCache(DATABASEOID, tup = SearchSysCache1(DATABASEOID, ObjectIdGetDatum(db_id));
ObjectIdGetDatum(db_id),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for database %u", db_id); 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))); errdetail_busy_db(notherbackends, npreparedxacts)));
/* rename */ /* rename */
newtup = SearchSysCacheCopy(DATABASEOID, newtup = SearchSysCacheCopy1(DATABASEOID, ObjectIdGetDatum(db_id));
ObjectIdGetDatum(db_id),
0, 0, 0);
if (!HeapTupleIsValid(newtup)) if (!HeapTupleIsValid(newtup))
elog(ERROR, "cache lookup failed for database %u", db_id); elog(ERROR, "cache lookup failed for database %u", db_id);
namestrcpy(&(((Form_pg_database) GETSTRUCT(newtup))->datname), newname); 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 * the same name, we win; else, drop the lock and loop back to try
* again. * again.
*/ */
tuple = SearchSysCache(DATABASEOID, tuple = SearchSysCache1(DATABASEOID, ObjectIdGetDatum(dbOid));
ObjectIdGetDatum(dbOid),
0, 0, 0);
if (HeapTupleIsValid(tuple)) if (HeapTupleIsValid(tuple))
{ {
Form_pg_database dbform = (Form_pg_database) GETSTRUCT(tuple); Form_pg_database dbform = (Form_pg_database) GETSTRUCT(tuple);
@ -1677,9 +1671,7 @@ have_createdb_privilege(void)
if (superuser()) if (superuser())
return true; return true;
utup = SearchSysCache(AUTHOID, utup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(GetUserId()));
ObjectIdGetDatum(GetUserId()),
0, 0, 0);
if (HeapTupleIsValid(utup)) if (HeapTupleIsValid(utup))
{ {
result = ((Form_pg_authid) GETSTRUCT(utup))->rolcreatedb; result = ((Form_pg_authid) GETSTRUCT(utup))->rolcreatedb;
@ -1875,9 +1867,7 @@ get_database_name(Oid dbid)
HeapTuple dbtuple; HeapTuple dbtuple;
char *result; char *result;
dbtuple = SearchSysCache(DATABASEOID, dbtuple = SearchSysCache1(DATABASEOID, ObjectIdGetDatum(dbid));
ObjectIdGetDatum(dbid),
0, 0, 0);
if (HeapTupleIsValid(dbtuple)) if (HeapTupleIsValid(dbtuple))
{ {
result = pstrdup(NameStr(((Form_pg_database) GETSTRUCT(dbtuple))->datname)); result = pstrdup(NameStr(((Form_pg_database) GETSTRUCT(dbtuple))->datname));

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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); rel = heap_open(ForeignDataWrapperRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy(FOREIGNDATAWRAPPERNAME, tup = SearchSysCacheCopy1(FOREIGNDATAWRAPPERNAME, CStringGetDatum(name));
CStringGetDatum(name),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
ereport(ERROR, ereport(ERROR,
@ -264,9 +262,7 @@ AlterForeignServerOwner(const char *name, Oid newOwnerId)
rel = heap_open(ForeignServerRelationId, RowExclusiveLock); rel = heap_open(ForeignServerRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy(FOREIGNSERVERNAME, tup = SearchSysCacheCopy1(FOREIGNSERVERNAME, CStringGetDatum(name));
CStringGetDatum(name),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
ereport(ERROR, ereport(ERROR,
@ -447,9 +443,8 @@ AlterForeignDataWrapper(AlterFdwStmt *stmt)
stmt->fdwname), stmt->fdwname),
errhint("Must be superuser to alter a foreign-data wrapper."))); errhint("Must be superuser to alter a foreign-data wrapper.")));
tp = SearchSysCacheCopy(FOREIGNDATAWRAPPERNAME, tp = SearchSysCacheCopy1(FOREIGNDATAWRAPPERNAME,
CStringGetDatum(stmt->fdwname), CStringGetDatum(stmt->fdwname));
0, 0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
ereport(ERROR, ereport(ERROR,
@ -587,9 +582,7 @@ RemoveForeignDataWrapperById(Oid fdwId)
rel = heap_open(ForeignDataWrapperRelationId, RowExclusiveLock); rel = heap_open(ForeignDataWrapperRelationId, RowExclusiveLock);
tp = SearchSysCache(FOREIGNDATAWRAPPEROID, tp = SearchSysCache1(FOREIGNDATAWRAPPEROID, ObjectIdGetDatum(fdwId));
ObjectIdGetDatum(fdwId),
0, 0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for foreign-data wrapper %u", fdwId); elog(ERROR, "cache lookup failed for foreign-data wrapper %u", fdwId);
@ -721,9 +714,8 @@ AlterForeignServer(AlterForeignServerStmt *stmt)
Oid srvId; Oid srvId;
Form_pg_foreign_server srvForm; Form_pg_foreign_server srvForm;
tp = SearchSysCacheCopy(FOREIGNSERVERNAME, tp = SearchSysCacheCopy1(FOREIGNSERVERNAME,
CStringGetDatum(stmt->servername), CStringGetDatum(stmt->servername));
0, 0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
ereport(ERROR, ereport(ERROR,
@ -851,9 +843,7 @@ RemoveForeignServerById(Oid srvId)
rel = heap_open(ForeignServerRelationId, RowExclusiveLock); rel = heap_open(ForeignServerRelationId, RowExclusiveLock);
tp = SearchSysCache(FOREIGNSERVEROID, tp = SearchSysCache1(FOREIGNSERVEROID, ObjectIdGetDatum(srvId));
ObjectIdGetDatum(srvId),
0, 0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for foreign server %u", srvId); 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. * Check that the user mapping is unique within server.
*/ */
umId = GetSysCacheOid(USERMAPPINGUSERSERVER, umId = GetSysCacheOid2(USERMAPPINGUSERSERVER,
ObjectIdGetDatum(useId), ObjectIdGetDatum(useId),
ObjectIdGetDatum(srv->serverid), ObjectIdGetDatum(srv->serverid));
0, 0);
if (OidIsValid(umId)) if (OidIsValid(umId))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT), (errcode(ERRCODE_DUPLICATE_OBJECT),
@ -1000,10 +989,9 @@ AlterUserMapping(AlterUserMappingStmt *stmt)
useId = GetUserOidFromMapping(stmt->username, false); useId = GetUserOidFromMapping(stmt->username, false);
srv = GetForeignServerByName(stmt->servername, false); srv = GetForeignServerByName(stmt->servername, false);
umId = GetSysCacheOid(USERMAPPINGUSERSERVER, umId = GetSysCacheOid2(USERMAPPINGUSERSERVER,
ObjectIdGetDatum(useId), ObjectIdGetDatum(useId),
ObjectIdGetDatum(srv->serverid), ObjectIdGetDatum(srv->serverid));
0, 0);
if (!OidIsValid(umId)) if (!OidIsValid(umId))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
@ -1012,9 +1000,7 @@ AlterUserMapping(AlterUserMappingStmt *stmt)
user_mapping_ddl_aclcheck(useId, srv->serverid, stmt->servername); user_mapping_ddl_aclcheck(useId, srv->serverid, stmt->servername);
tp = SearchSysCacheCopy(USERMAPPINGOID, tp = SearchSysCacheCopy1(USERMAPPINGOID, ObjectIdGetDatum(umId));
ObjectIdGetDatum(umId),
0, 0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for user mapping %u", umId); elog(ERROR, "cache lookup failed for user mapping %u", umId);
@ -1107,10 +1093,9 @@ RemoveUserMapping(DropUserMappingStmt *stmt)
return; return;
} }
umId = GetSysCacheOid(USERMAPPINGUSERSERVER, umId = GetSysCacheOid2(USERMAPPINGUSERSERVER,
ObjectIdGetDatum(useId), ObjectIdGetDatum(useId),
ObjectIdGetDatum(srv->serverid), ObjectIdGetDatum(srv->serverid));
0, 0);
if (!OidIsValid(umId)) if (!OidIsValid(umId))
{ {
@ -1151,9 +1136,7 @@ RemoveUserMappingById(Oid umId)
rel = heap_open(UserMappingRelationId, RowExclusiveLock); rel = heap_open(UserMappingRelationId, RowExclusiveLock);
tp = SearchSysCache(USERMAPPINGOID, tp = SearchSysCache1(USERMAPPINGOID, ObjectIdGetDatum(umId));
ObjectIdGetDatum(umId),
0, 0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for user mapping %u", umId); elog(ERROR, "cache lookup failed for user mapping %u", umId);

View File

@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * 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 * DESCRIPTION
* These routines take the parse tree and pick out the * 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); languageName = case_translate_language_name(language);
/* Look up the language and validate permissions */ /* Look up the language and validate permissions */
languageTuple = SearchSysCache(LANGNAME, languageTuple = SearchSysCache1(LANGNAME, PointerGetDatum(languageName));
PointerGetDatum(languageName),
0, 0, 0);
if (!HeapTupleIsValid(languageTuple)) if (!HeapTupleIsValid(languageTuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
@ -990,9 +988,7 @@ RemoveFunction(RemoveFuncStmt *stmt)
return; return;
} }
tup = SearchSysCache(PROCOID, tup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcOid));
ObjectIdGetDatum(funcOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for function %u", funcOid); elog(ERROR, "cache lookup failed for function %u", funcOid);
@ -1049,9 +1045,7 @@ RemoveFunctionById(Oid funcOid)
*/ */
relation = heap_open(ProcedureRelationId, RowExclusiveLock); relation = heap_open(ProcedureRelationId, RowExclusiveLock);
tup = SearchSysCache(PROCOID, tup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcOid));
ObjectIdGetDatum(funcOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for function %u", funcOid); elog(ERROR, "cache lookup failed for function %u", funcOid);
@ -1070,9 +1064,7 @@ RemoveFunctionById(Oid funcOid)
{ {
relation = heap_open(AggregateRelationId, RowExclusiveLock); relation = heap_open(AggregateRelationId, RowExclusiveLock);
tup = SearchSysCache(AGGFNOID, tup = SearchSysCache1(AGGFNOID, ObjectIdGetDatum(funcOid));
ObjectIdGetDatum(funcOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for pg_aggregate tuple for function %u", funcOid); 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); procOid = LookupFuncNameTypeNames(name, argtypes, false);
tup = SearchSysCacheCopy(PROCOID, tup = SearchSysCacheCopy1(PROCOID, ObjectIdGetDatum(procOid));
ObjectIdGetDatum(procOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for function %u", procOid); elog(ERROR, "cache lookup failed for function %u", procOid);
procForm = (Form_pg_proc) GETSTRUCT(tup); procForm = (Form_pg_proc) GETSTRUCT(tup);
@ -1119,11 +1109,10 @@ RenameFunction(List *name, List *argtypes, const char *newname)
namespaceOid = procForm->pronamespace; namespaceOid = procForm->pronamespace;
/* make sure the new name doesn't exist */ /* make sure the new name doesn't exist */
if (SearchSysCacheExists(PROCNAMEARGSNSP, if (SearchSysCacheExists3(PROCNAMEARGSNSP,
CStringGetDatum(newname), CStringGetDatum(newname),
PointerGetDatum(&procForm->proargtypes), PointerGetDatum(&procForm->proargtypes),
ObjectIdGetDatum(namespaceOid), ObjectIdGetDatum(namespaceOid)))
0))
{ {
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_FUNCTION), (errcode(ERRCODE_DUPLICATE_FUNCTION),
@ -1169,9 +1158,7 @@ AlterFunctionOwner(List *name, List *argtypes, Oid newOwnerId)
procOid = LookupFuncNameTypeNames(name, argtypes, false); procOid = LookupFuncNameTypeNames(name, argtypes, false);
tup = SearchSysCache(PROCOID, tup = SearchSysCache1(PROCOID, ObjectIdGetDatum(procOid));
ObjectIdGetDatum(procOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for function %u", procOid); elog(ERROR, "cache lookup failed for function %u", procOid);
@ -1198,9 +1185,7 @@ AlterFunctionOwner_oid(Oid procOid, Oid newOwnerId)
rel = heap_open(ProcedureRelationId, RowExclusiveLock); rel = heap_open(ProcedureRelationId, RowExclusiveLock);
tup = SearchSysCache(PROCOID, tup = SearchSysCache1(PROCOID, ObjectIdGetDatum(procOid));
ObjectIdGetDatum(procOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for function %u", procOid); elog(ERROR, "cache lookup failed for function %u", procOid);
AlterFunctionOwner_internal(rel, tup, newOwnerId); AlterFunctionOwner_internal(rel, tup, newOwnerId);
@ -1317,9 +1302,7 @@ AlterFunction(AlterFunctionStmt *stmt)
stmt->func->funcargs, stmt->func->funcargs,
false); false);
tup = SearchSysCacheCopy(PROCOID, tup = SearchSysCacheCopy1(PROCOID, ObjectIdGetDatum(funcOid));
ObjectIdGetDatum(funcOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for function %u", funcOid); 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); pg_proc_rel = heap_open(ProcedureRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy(PROCOID, tup = SearchSysCacheCopy1(PROCOID, ObjectIdGetDatum(funcOid));
ObjectIdGetDatum(funcOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for function %u", funcOid); elog(ERROR, "cache lookup failed for function %u", funcOid);
procForm = (Form_pg_proc) GETSTRUCT(tup); procForm = (Form_pg_proc) GETSTRUCT(tup);
@ -1472,9 +1453,7 @@ SetFunctionArgType(Oid funcOid, int argIndex, Oid newArgType)
pg_proc_rel = heap_open(ProcedureRelationId, RowExclusiveLock); pg_proc_rel = heap_open(ProcedureRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy(PROCOID, tup = SearchSysCacheCopy1(PROCOID, ObjectIdGetDatum(funcOid));
ObjectIdGetDatum(funcOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for function %u", funcOid); elog(ERROR, "cache lookup failed for function %u", funcOid);
procForm = (Form_pg_proc) GETSTRUCT(tup); procForm = (Form_pg_proc) GETSTRUCT(tup);
@ -1560,9 +1539,7 @@ CreateCast(CreateCastStmt *stmt)
stmt->func->funcargs, stmt->func->funcargs,
false); false);
tuple = SearchSysCache(PROCOID, tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
ObjectIdGetDatum(funcid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for function %u", funcid); 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 * the unique index would catch it anyway (so no need to sweat about race
* conditions). * conditions).
*/ */
tuple = SearchSysCache(CASTSOURCETARGET, tuple = SearchSysCache2(CASTSOURCETARGET,
ObjectIdGetDatum(sourcetypeid), ObjectIdGetDatum(sourcetypeid),
ObjectIdGetDatum(targettypeid), ObjectIdGetDatum(targettypeid));
0, 0);
if (HeapTupleIsValid(tuple)) if (HeapTupleIsValid(tuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT), (errcode(ERRCODE_DUPLICATE_OBJECT),
@ -1790,10 +1766,9 @@ DropCast(DropCastStmt *stmt)
sourcetypeid = typenameTypeId(NULL, stmt->sourcetype, NULL); sourcetypeid = typenameTypeId(NULL, stmt->sourcetype, NULL);
targettypeid = typenameTypeId(NULL, stmt->targettype, NULL); targettypeid = typenameTypeId(NULL, stmt->targettype, NULL);
tuple = SearchSysCache(CASTSOURCETARGET, tuple = SearchSysCache2(CASTSOURCETARGET,
ObjectIdGetDatum(sourcetypeid), ObjectIdGetDatum(sourcetypeid),
ObjectIdGetDatum(targettypeid), ObjectIdGetDatum(targettypeid));
0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
{ {
if (!stmt->missing_ok) if (!stmt->missing_ok)
@ -1888,9 +1863,7 @@ AlterFunctionNamespace(List *name, List *argtypes, bool isagg,
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_PROC, aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_PROC,
NameListToString(name)); NameListToString(name));
tup = SearchSysCacheCopy(PROCOID, tup = SearchSysCacheCopy1(PROCOID, ObjectIdGetDatum(procOid));
ObjectIdGetDatum(procOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for function %u", procOid); elog(ERROR, "cache lookup failed for function %u", procOid);
proc = (Form_pg_proc) GETSTRUCT(tup); 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"))); errmsg("cannot move objects into or out of TOAST schema")));
/* check for duplicate name (more friendly than unique-index failure) */ /* check for duplicate name (more friendly than unique-index failure) */
if (SearchSysCacheExists(PROCNAMEARGSNSP, if (SearchSysCacheExists3(PROCNAMEARGSNSP,
CStringGetDatum(NameStr(proc->proname)), CStringGetDatum(NameStr(proc->proname)),
PointerGetDatum(&proc->proargtypes), PointerGetDatum(&proc->proargtypes),
ObjectIdGetDatum(nspOid), ObjectIdGetDatum(nspOid)))
0))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_FUNCTION), (errcode(ERRCODE_DUPLICATE_FUNCTION),
errmsg("function \"%s\" already exists in schema \"%s\"", errmsg("function \"%s\" already exists in schema \"%s\"",
@ -2011,9 +1983,7 @@ ExecuteDoStmt(DoStmt *stmt)
languageName = case_translate_language_name(language); languageName = case_translate_language_name(language);
/* Look up the language and validate permissions */ /* Look up the language and validate permissions */
languageTuple = SearchSysCache(LANGNAME, languageTuple = SearchSysCache1(LANGNAME, PointerGetDatum(languageName));
PointerGetDatum(languageName),
0, 0, 0);
if (!HeapTupleIsValid(languageTuple)) if (!HeapTupleIsValid(languageTuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 * look up the access method, verify it can handle the requested features
*/ */
tuple = SearchSysCache(AMNAME, tuple = SearchSysCache1(AMNAME, PointerGetDatum(accessMethodName));
PointerGetDatum(accessMethodName),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
{ {
/* /*
@ -287,9 +285,7 @@ DefineIndex(RangeVar *heapRelation,
ereport(NOTICE, ereport(NOTICE,
(errmsg("substituting access method \"gist\" for obsolete method \"rtree\""))); (errmsg("substituting access method \"gist\" for obsolete method \"rtree\"")));
accessMethodName = "gist"; accessMethodName = "gist";
tuple = SearchSysCache(AMNAME, tuple = SearchSysCache1(AMNAME, PointerGetDatum(accessMethodName));
PointerGetDatum(accessMethodName),
0, 0, 0);
} }
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
@ -600,9 +596,8 @@ DefineIndex(RangeVar *heapRelation,
*/ */
pg_index = heap_open(IndexRelationId, RowExclusiveLock); pg_index = heap_open(IndexRelationId, RowExclusiveLock);
indexTuple = SearchSysCacheCopy(INDEXRELID, indexTuple = SearchSysCacheCopy1(INDEXRELID,
ObjectIdGetDatum(indexRelationId), ObjectIdGetDatum(indexRelationId));
0, 0, 0);
if (!HeapTupleIsValid(indexTuple)) if (!HeapTupleIsValid(indexTuple))
elog(ERROR, "cache lookup failed for index %u", indexRelationId); elog(ERROR, "cache lookup failed for index %u", indexRelationId);
indexForm = (Form_pg_index) GETSTRUCT(indexTuple); indexForm = (Form_pg_index) GETSTRUCT(indexTuple);
@ -741,9 +736,8 @@ DefineIndex(RangeVar *heapRelation,
*/ */
pg_index = heap_open(IndexRelationId, RowExclusiveLock); pg_index = heap_open(IndexRelationId, RowExclusiveLock);
indexTuple = SearchSysCacheCopy(INDEXRELID, indexTuple = SearchSysCacheCopy1(INDEXRELID,
ObjectIdGetDatum(indexRelationId), ObjectIdGetDatum(indexRelationId));
0, 0, 0);
if (!HeapTupleIsValid(indexTuple)) if (!HeapTupleIsValid(indexTuple))
elog(ERROR, "cache lookup failed for index %u", indexRelationId); elog(ERROR, "cache lookup failed for index %u", indexRelationId);
indexForm = (Form_pg_index) GETSTRUCT(indexTuple); 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 * so fetch the name of the selected opfamily for use in the
* error message. * error message.
*/ */
opftuple = SearchSysCache(OPFAMILYOID, opftuple = SearchSysCache1(OPFAMILYOID,
ObjectIdGetDatum(opfamily), ObjectIdGetDatum(opfamily));
0, 0, 0);
if (!HeapTupleIsValid(opftuple)) if (!HeapTupleIsValid(opftuple))
elog(ERROR, "cache lookup failed for opfamily %u", elog(ERROR, "cache lookup failed for opfamily %u",
opfamily); opfamily);
@ -1113,11 +1106,10 @@ GetIndexOpClass(List *opclass, Oid attrType,
Oid namespaceId; Oid namespaceId;
namespaceId = LookupExplicitNamespace(schemaname); namespaceId = LookupExplicitNamespace(schemaname);
tuple = SearchSysCache(CLAAMNAMENSP, tuple = SearchSysCache3(CLAAMNAMENSP,
ObjectIdGetDatum(accessMethodId), ObjectIdGetDatum(accessMethodId),
PointerGetDatum(opcname), PointerGetDatum(opcname),
ObjectIdGetDatum(namespaceId), ObjectIdGetDatum(namespaceId));
0);
} }
else else
{ {
@ -1128,9 +1120,7 @@ GetIndexOpClass(List *opclass, Oid attrType,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("operator class \"%s\" does not exist for access method \"%s\"", errmsg("operator class \"%s\" does not exist for access method \"%s\"",
opcname, accessMethodName))); opcname, accessMethodName)));
tuple = SearchSysCache(CLAOID, tuple = SearchSysCache1(CLAOID, ObjectIdGetDatum(opClassId));
ObjectIdGetDatum(opClassId),
0, 0, 0);
} }
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
@ -1542,9 +1532,7 @@ relationHasPrimaryKey(Relation rel)
Oid indexoid = lfirst_oid(indexoidscan); Oid indexoid = lfirst_oid(indexoidscan);
HeapTuple indexTuple; HeapTuple indexTuple;
indexTuple = SearchSysCache(INDEXRELID, indexTuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexoid));
ObjectIdGetDatum(indexoid),
0, 0, 0);
if (!HeapTupleIsValid(indexTuple)) /* should not happen */ if (!HeapTupleIsValid(indexTuple)) /* should not happen */
elog(ERROR, "cache lookup failed for index %u", indexoid); elog(ERROR, "cache lookup failed for index %u", indexoid);
result = ((Form_pg_index) GETSTRUCT(indexTuple))->indisprimary; result = ((Form_pg_index) GETSTRUCT(indexTuple))->indisprimary;
@ -1569,9 +1557,7 @@ ReindexIndex(RangeVar *indexRelation)
HeapTuple tuple; HeapTuple tuple;
indOid = RangeVarGetRelid(indexRelation, false); indOid = RangeVarGetRelid(indexRelation, false);
tuple = SearchSysCache(RELOID, tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(indOid));
ObjectIdGetDatum(indOid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) /* shouldn't happen */ if (!HeapTupleIsValid(tuple)) /* shouldn't happen */
elog(ERROR, "cache lookup failed for relation %u", indOid); elog(ERROR, "cache lookup failed for relation %u", indOid);
@ -1602,9 +1588,7 @@ ReindexTable(RangeVar *relation)
HeapTuple tuple; HeapTuple tuple;
heapOid = RangeVarGetRelid(relation, false); heapOid = RangeVarGetRelid(relation, false);
tuple = SearchSysCache(RELOID, tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(heapOid));
ObjectIdGetDatum(heapOid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) /* shouldn't happen */ if (!HeapTupleIsValid(tuple)) /* shouldn't happen */
elog(ERROR, "cache lookup failed for relation %u", heapOid); elog(ERROR, "cache lookup failed for relation %u", heapOid);

View File

@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * 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; Oid namespaceId;
namespaceId = LookupExplicitNamespace(schemaname); namespaceId = LookupExplicitNamespace(schemaname);
return SearchSysCache(OPFAMILYAMNAMENSP, return SearchSysCache3(OPFAMILYAMNAMENSP,
ObjectIdGetDatum(amID), ObjectIdGetDatum(amID),
PointerGetDatum(opfname), PointerGetDatum(opfname),
ObjectIdGetDatum(namespaceId), ObjectIdGetDatum(namespaceId));
0);
} }
else else
{ {
@ -117,9 +116,7 @@ OpFamilyCacheLookup(Oid amID, List *opfamilyname)
if (!OidIsValid(opfID)) if (!OidIsValid(opfID))
return NULL; return NULL;
return SearchSysCache(OPFAMILYOID, return SearchSysCache1(OPFAMILYOID, ObjectIdGetDatum(opfID));
ObjectIdGetDatum(opfID),
0, 0, 0);
} }
} }
@ -144,11 +141,10 @@ OpClassCacheLookup(Oid amID, List *opclassname)
Oid namespaceId; Oid namespaceId;
namespaceId = LookupExplicitNamespace(schemaname); namespaceId = LookupExplicitNamespace(schemaname);
return SearchSysCache(CLAAMNAMENSP, return SearchSysCache3(CLAAMNAMENSP,
ObjectIdGetDatum(amID), ObjectIdGetDatum(amID),
PointerGetDatum(opcname), PointerGetDatum(opcname),
ObjectIdGetDatum(namespaceId), ObjectIdGetDatum(namespaceId));
0);
} }
else else
{ {
@ -157,9 +153,7 @@ OpClassCacheLookup(Oid amID, List *opclassname)
if (!OidIsValid(opcID)) if (!OidIsValid(opcID))
return NULL; return NULL;
return SearchSysCache(CLAOID, return SearchSysCache1(CLAOID, ObjectIdGetDatum(opcID));
ObjectIdGetDatum(opcID),
0, 0, 0);
} }
} }
@ -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 * Make sure there is no existing opfamily of this name (this is just to
* give a more friendly error message than "duplicate key"). * give a more friendly error message than "duplicate key").
*/ */
if (SearchSysCacheExists(OPFAMILYAMNAMENSP, if (SearchSysCacheExists3(OPFAMILYAMNAMENSP,
ObjectIdGetDatum(amoid), ObjectIdGetDatum(amoid),
CStringGetDatum(opfname), CStringGetDatum(opfname),
ObjectIdGetDatum(namespaceoid), ObjectIdGetDatum(namespaceoid)))
0))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT), (errcode(ERRCODE_DUPLICATE_OBJECT),
errmsg("operator family \"%s\" for access method \"%s\" already exists", errmsg("operator family \"%s\" for access method \"%s\" already exists",
@ -281,9 +274,7 @@ DefineOpClass(CreateOpClassStmt *stmt)
get_namespace_name(namespaceoid)); get_namespace_name(namespaceoid));
/* Get necessary info about access method */ /* Get necessary info about access method */
tup = SearchSysCache(AMNAME, tup = SearchSysCache1(AMNAME, CStringGetDatum(stmt->amname));
CStringGetDatum(stmt->amname),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
@ -362,11 +353,10 @@ DefineOpClass(CreateOpClassStmt *stmt)
else else
{ {
/* Lookup existing family of same name and namespace */ /* Lookup existing family of same name and namespace */
tup = SearchSysCache(OPFAMILYAMNAMENSP, tup = SearchSysCache3(OPFAMILYAMNAMENSP,
ObjectIdGetDatum(amoid), ObjectIdGetDatum(amoid),
PointerGetDatum(opcname), PointerGetDatum(opcname),
ObjectIdGetDatum(namespaceoid), ObjectIdGetDatum(namespaceoid));
0);
if (HeapTupleIsValid(tup)) if (HeapTupleIsValid(tup))
{ {
opfamilyoid = HeapTupleGetOid(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 * Make sure there is no existing opclass of this name (this is just to
* give a more friendly error message than "duplicate key"). * give a more friendly error message than "duplicate key").
*/ */
if (SearchSysCacheExists(CLAAMNAMENSP, if (SearchSysCacheExists3(CLAAMNAMENSP,
ObjectIdGetDatum(amoid), ObjectIdGetDatum(amoid),
CStringGetDatum(opcname), CStringGetDatum(opcname),
ObjectIdGetDatum(namespaceoid), ObjectIdGetDatum(namespaceoid)))
0))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT), (errcode(ERRCODE_DUPLICATE_OBJECT),
errmsg("operator class \"%s\" for access method \"%s\" already exists", errmsg("operator class \"%s\" for access method \"%s\" already exists",
@ -673,9 +662,7 @@ DefineOpFamily(CreateOpFamilyStmt *stmt)
get_namespace_name(namespaceoid)); get_namespace_name(namespaceoid));
/* Get necessary info about access method */ /* Get necessary info about access method */
tup = SearchSysCache(AMNAME, tup = SearchSysCache1(AMNAME, CStringGetDatum(stmt->amname));
CStringGetDatum(stmt->amname),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (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 * Make sure there is no existing opfamily of this name (this is just to
* give a more friendly error message than "duplicate key"). * give a more friendly error message than "duplicate key").
*/ */
if (SearchSysCacheExists(OPFAMILYAMNAMENSP, if (SearchSysCacheExists3(OPFAMILYAMNAMENSP,
ObjectIdGetDatum(amoid), ObjectIdGetDatum(amoid),
CStringGetDatum(opfname), CStringGetDatum(opfname),
ObjectIdGetDatum(namespaceoid), ObjectIdGetDatum(namespaceoid)))
0))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT), (errcode(ERRCODE_DUPLICATE_OBJECT),
errmsg("operator family \"%s\" for access method \"%s\" already exists", errmsg("operator family \"%s\" for access method \"%s\" already exists",
@ -776,9 +762,7 @@ AlterOpFamily(AlterOpFamilyStmt *stmt)
Form_pg_am pg_am; Form_pg_am pg_am;
/* Get necessary info about access method */ /* Get necessary info about access method */
tup = SearchSysCache(AMNAME, tup = SearchSysCache1(AMNAME, CStringGetDatum(stmt->amname));
CStringGetDatum(stmt->amname),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
@ -1065,9 +1049,7 @@ assignOperTypes(OpFamilyMember *member, Oid amoid, Oid typeoid)
Form_pg_operator opform; Form_pg_operator opform;
/* Fetch the operator definition */ /* Fetch the operator definition */
optup = SearchSysCache(OPEROID, optup = SearchSysCache1(OPEROID, ObjectIdGetDatum(member->object));
ObjectIdGetDatum(member->object),
0, 0, 0);
if (optup == NULL) if (optup == NULL)
elog(ERROR, "cache lookup failed for operator %u", member->object); elog(ERROR, "cache lookup failed for operator %u", member->object);
opform = (Form_pg_operator) GETSTRUCT(optup); opform = (Form_pg_operator) GETSTRUCT(optup);
@ -1106,9 +1088,7 @@ assignProcTypes(OpFamilyMember *member, Oid amoid, Oid typeoid)
Form_pg_proc procform; Form_pg_proc procform;
/* Fetch the procedure definition */ /* Fetch the procedure definition */
proctup = SearchSysCache(PROCOID, proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(member->object));
ObjectIdGetDatum(member->object),
0, 0, 0);
if (proctup == NULL) if (proctup == NULL)
elog(ERROR, "cache lookup failed for function %u", member->object); elog(ERROR, "cache lookup failed for function %u", member->object);
procform = (Form_pg_proc) GETSTRUCT(proctup); 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) * existing pg_amop entry (just to give a nicer error message)
*/ */
if (isAdd && if (isAdd &&
SearchSysCacheExists(AMOPSTRATEGY, SearchSysCacheExists4(AMOPSTRATEGY,
ObjectIdGetDatum(opfamilyoid), ObjectIdGetDatum(opfamilyoid),
ObjectIdGetDatum(op->lefttype), ObjectIdGetDatum(op->lefttype),
ObjectIdGetDatum(op->righttype), ObjectIdGetDatum(op->righttype),
Int16GetDatum(op->number))) Int16GetDatum(op->number)))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT), (errcode(ERRCODE_DUPLICATE_OBJECT),
errmsg("operator %d(%s,%s) already exists in operator family \"%s\"", 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) * existing pg_amproc entry (just to give a nicer error message)
*/ */
if (isAdd && if (isAdd &&
SearchSysCacheExists(AMPROCNUM, SearchSysCacheExists4(AMPROCNUM,
ObjectIdGetDatum(opfamilyoid), ObjectIdGetDatum(opfamilyoid),
ObjectIdGetDatum(proc->lefttype), ObjectIdGetDatum(proc->lefttype),
ObjectIdGetDatum(proc->righttype), ObjectIdGetDatum(proc->righttype),
Int16GetDatum(proc->number))) Int16GetDatum(proc->number)))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT), (errcode(ERRCODE_DUPLICATE_OBJECT),
errmsg("function %d(%s,%s) already exists in operator family \"%s\"", errmsg("function %d(%s,%s) already exists in operator family \"%s\"",
@ -1430,11 +1410,11 @@ dropOperators(List *opfamilyname, Oid amoid, Oid opfamilyoid,
Oid amopid; Oid amopid;
ObjectAddress object; ObjectAddress object;
amopid = GetSysCacheOid(AMOPSTRATEGY, amopid = GetSysCacheOid4(AMOPSTRATEGY,
ObjectIdGetDatum(opfamilyoid), ObjectIdGetDatum(opfamilyoid),
ObjectIdGetDatum(op->lefttype), ObjectIdGetDatum(op->lefttype),
ObjectIdGetDatum(op->righttype), ObjectIdGetDatum(op->righttype),
Int16GetDatum(op->number)); Int16GetDatum(op->number));
if (!OidIsValid(amopid)) if (!OidIsValid(amopid))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
@ -1470,11 +1450,11 @@ dropProcedures(List *opfamilyname, Oid amoid, Oid opfamilyoid,
Oid amprocid; Oid amprocid;
ObjectAddress object; ObjectAddress object;
amprocid = GetSysCacheOid(AMPROCNUM, amprocid = GetSysCacheOid4(AMPROCNUM,
ObjectIdGetDatum(opfamilyoid), ObjectIdGetDatum(opfamilyoid),
ObjectIdGetDatum(op->lefttype), ObjectIdGetDatum(op->lefttype),
ObjectIdGetDatum(op->righttype), ObjectIdGetDatum(op->righttype),
Int16GetDatum(op->number)); Int16GetDatum(op->number));
if (!OidIsValid(amprocid)) if (!OidIsValid(amprocid))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
@ -1508,9 +1488,7 @@ RemoveOpClass(RemoveOpClassStmt *stmt)
/* /*
* Get the access method's OID. * Get the access method's OID.
*/ */
amID = GetSysCacheOid(AMNAME, amID = GetSysCacheOid1(AMNAME, CStringGetDatum(stmt->amname));
CStringGetDatum(stmt->amname),
0, 0, 0);
if (!OidIsValid(amID)) if (!OidIsValid(amID))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
@ -1571,9 +1549,7 @@ RemoveOpFamily(RemoveOpFamilyStmt *stmt)
/* /*
* Get the access method's OID. * Get the access method's OID.
*/ */
amID = GetSysCacheOid(AMNAME, amID = GetSysCacheOid1(AMNAME, CStringGetDatum(stmt->amname));
CStringGetDatum(stmt->amname),
0, 0, 0);
if (!OidIsValid(amID)) if (!OidIsValid(amID))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
@ -1631,9 +1607,7 @@ RemoveOpFamilyById(Oid opfamilyOid)
rel = heap_open(OperatorFamilyRelationId, RowExclusiveLock); rel = heap_open(OperatorFamilyRelationId, RowExclusiveLock);
tup = SearchSysCache(OPFAMILYOID, tup = SearchSysCache1(OPFAMILYOID, ObjectIdGetDatum(opfamilyOid));
ObjectIdGetDatum(opfamilyOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for opfamily %u", opfamilyOid); elog(ERROR, "cache lookup failed for opfamily %u", opfamilyOid);
@ -1652,9 +1626,7 @@ RemoveOpClassById(Oid opclassOid)
rel = heap_open(OperatorClassRelationId, RowExclusiveLock); rel = heap_open(OperatorClassRelationId, RowExclusiveLock);
tup = SearchSysCache(CLAOID, tup = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclassOid));
ObjectIdGetDatum(opclassOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for opclass %u", opclassOid); 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; Relation rel;
AclResult aclresult; AclResult aclresult;
amOid = GetSysCacheOid(AMNAME, amOid = GetSysCacheOid1(AMNAME, CStringGetDatum(access_method));
CStringGetDatum(access_method),
0, 0, 0);
if (!OidIsValid(amOid)) if (!OidIsValid(amOid))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
@ -1759,11 +1729,10 @@ RenameOpClass(List *name, const char *access_method, const char *newname)
{ {
namespaceOid = LookupExplicitNamespace(schemaname); namespaceOid = LookupExplicitNamespace(schemaname);
tup = SearchSysCacheCopy(CLAAMNAMENSP, tup = SearchSysCacheCopy3(CLAAMNAMENSP,
ObjectIdGetDatum(amOid), ObjectIdGetDatum(amOid),
PointerGetDatum(opcname), PointerGetDatum(opcname),
ObjectIdGetDatum(namespaceOid), ObjectIdGetDatum(namespaceOid));
0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (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\"", errmsg("operator class \"%s\" does not exist for access method \"%s\"",
opcname, access_method))); opcname, access_method)));
tup = SearchSysCacheCopy(CLAOID, tup = SearchSysCacheCopy1(CLAOID, ObjectIdGetDatum(opcOid));
ObjectIdGetDatum(opcOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for opclass %u", opcOid); 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 */ /* make sure the new name doesn't exist */
if (SearchSysCacheExists(CLAAMNAMENSP, if (SearchSysCacheExists3(CLAAMNAMENSP,
ObjectIdGetDatum(amOid), ObjectIdGetDatum(amOid),
CStringGetDatum(newname), CStringGetDatum(newname),
ObjectIdGetDatum(namespaceOid), ObjectIdGetDatum(namespaceOid)))
0))
{ {
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT), (errcode(ERRCODE_DUPLICATE_OBJECT),
@ -1839,9 +1805,7 @@ RenameOpFamily(List *name, const char *access_method, const char *newname)
Relation rel; Relation rel;
AclResult aclresult; AclResult aclresult;
amOid = GetSysCacheOid(AMNAME, amOid = GetSysCacheOid1(AMNAME, CStringGetDatum(access_method));
CStringGetDatum(access_method),
0, 0, 0);
if (!OidIsValid(amOid)) if (!OidIsValid(amOid))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
@ -1859,11 +1823,10 @@ RenameOpFamily(List *name, const char *access_method, const char *newname)
{ {
namespaceOid = LookupExplicitNamespace(schemaname); namespaceOid = LookupExplicitNamespace(schemaname);
tup = SearchSysCacheCopy(OPFAMILYAMNAMENSP, tup = SearchSysCacheCopy3(OPFAMILYAMNAMENSP,
ObjectIdGetDatum(amOid), ObjectIdGetDatum(amOid),
PointerGetDatum(opfname), PointerGetDatum(opfname),
ObjectIdGetDatum(namespaceOid), ObjectIdGetDatum(namespaceOid));
0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (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\"", errmsg("operator family \"%s\" does not exist for access method \"%s\"",
opfname, access_method))); opfname, access_method)));
tup = SearchSysCacheCopy(OPFAMILYOID, tup = SearchSysCacheCopy1(OPFAMILYOID, ObjectIdGetDatum(opfOid));
ObjectIdGetDatum(opfOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for opfamily %u", opfOid); 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 */ /* make sure the new name doesn't exist */
if (SearchSysCacheExists(OPFAMILYAMNAMENSP, if (SearchSysCacheExists3(OPFAMILYAMNAMENSP,
ObjectIdGetDatum(amOid), ObjectIdGetDatum(amOid),
CStringGetDatum(newname), CStringGetDatum(newname),
ObjectIdGetDatum(namespaceOid), ObjectIdGetDatum(namespaceOid)))
0))
{ {
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT), (errcode(ERRCODE_DUPLICATE_OBJECT),
@ -1936,9 +1896,7 @@ AlterOpClassOwner(List *name, const char *access_method, Oid newOwnerId)
char *opcname; char *opcname;
char *schemaname; char *schemaname;
amOid = GetSysCacheOid(AMNAME, amOid = GetSysCacheOid1(AMNAME, CStringGetDatum(access_method));
CStringGetDatum(access_method),
0, 0, 0);
if (!OidIsValid(amOid)) if (!OidIsValid(amOid))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
@ -1958,11 +1916,10 @@ AlterOpClassOwner(List *name, const char *access_method, Oid newOwnerId)
namespaceOid = LookupExplicitNamespace(schemaname); namespaceOid = LookupExplicitNamespace(schemaname);
tup = SearchSysCacheCopy(CLAAMNAMENSP, tup = SearchSysCacheCopy3(CLAAMNAMENSP,
ObjectIdGetDatum(amOid), ObjectIdGetDatum(amOid),
PointerGetDatum(opcname), PointerGetDatum(opcname),
ObjectIdGetDatum(namespaceOid), ObjectIdGetDatum(namespaceOid));
0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (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\"", errmsg("operator class \"%s\" does not exist for access method \"%s\"",
opcname, access_method))); opcname, access_method)));
tup = SearchSysCacheCopy(CLAOID, tup = SearchSysCacheCopy1(CLAOID, ObjectIdGetDatum(opcOid));
ObjectIdGetDatum(opcOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for opclass %u", opcOid); 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 *opfname;
char *schemaname; char *schemaname;
amOid = GetSysCacheOid(AMNAME, amOid = GetSysCacheOid1(AMNAME, CStringGetDatum(access_method));
CStringGetDatum(access_method),
0, 0, 0);
if (!OidIsValid(amOid)) if (!OidIsValid(amOid))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
@ -2085,11 +2038,10 @@ AlterOpFamilyOwner(List *name, const char *access_method, Oid newOwnerId)
namespaceOid = LookupExplicitNamespace(schemaname); namespaceOid = LookupExplicitNamespace(schemaname);
tup = SearchSysCacheCopy(OPFAMILYAMNAMENSP, tup = SearchSysCacheCopy3(OPFAMILYAMNAMENSP,
ObjectIdGetDatum(amOid), ObjectIdGetDatum(amOid),
PointerGetDatum(opfname), PointerGetDatum(opfname),
ObjectIdGetDatum(namespaceOid), ObjectIdGetDatum(namespaceOid));
0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (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\"", errmsg("operator family \"%s\" does not exist for access method \"%s\"",
opfname, access_method))); opfname, access_method)));
tup = SearchSysCacheCopy(OPFAMILYOID, tup = SearchSysCacheCopy1(OPFAMILYOID, ObjectIdGetDatum(opfOid));
ObjectIdGetDatum(opfOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for opfamily %u", opfOid); elog(ERROR, "cache lookup failed for opfamily %u", opfOid);
} }

View File

@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * 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 * DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the * The "DefineFoo" routines take the parse tree and pick out the
@ -308,9 +308,7 @@ RemoveOperator(RemoveFuncStmt *stmt)
return; return;
} }
tup = SearchSysCache(OPEROID, tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operOid));
ObjectIdGetDatum(operOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for operator %u", operOid); elog(ERROR, "cache lookup failed for operator %u", operOid);
@ -344,9 +342,7 @@ RemoveOperatorById(Oid operOid)
relation = heap_open(OperatorRelationId, RowExclusiveLock); relation = heap_open(OperatorRelationId, RowExclusiveLock);
tup = SearchSysCache(OPEROID, tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operOid));
ObjectIdGetDatum(operOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for operator %u", operOid); 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); Assert(RelationGetRelid(rel) == OperatorRelationId);
tup = SearchSysCacheCopy(OPEROID, tup = SearchSysCacheCopy1(OPEROID, ObjectIdGetDatum(operOid));
ObjectIdGetDatum(operOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for operator %u", operOid); elog(ERROR, "cache lookup failed for operator %u", operOid);

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * 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); languageName = case_translate_language_name(stmt->plname);
if (SearchSysCacheExists(LANGNAME, if (SearchSysCacheExists1(LANGNAME, PointerGetDatum(languageName)))
PointerGetDatum(languageName),
0, 0, 0))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT), (errcode(ERRCODE_DUPLICATE_OBJECT),
errmsg("language \"%s\" already exists", languageName))); errmsg("language \"%s\" already exists", languageName)));
@ -489,9 +487,7 @@ DropProceduralLanguage(DropPLangStmt *stmt)
*/ */
languageName = case_translate_language_name(stmt->plname); languageName = case_translate_language_name(stmt->plname);
langTup = SearchSysCache(LANGNAME, langTup = SearchSysCache1(LANGNAME, CStringGetDatum(languageName));
CStringGetDatum(languageName),
0, 0, 0);
if (!HeapTupleIsValid(langTup)) if (!HeapTupleIsValid(langTup))
{ {
if (!stmt->missing_ok) if (!stmt->missing_ok)
@ -536,9 +532,7 @@ DropProceduralLanguageById(Oid langOid)
rel = heap_open(LanguageRelationId, RowExclusiveLock); rel = heap_open(LanguageRelationId, RowExclusiveLock);
langTup = SearchSysCache(LANGOID, langTup = SearchSysCache1(LANGOID, ObjectIdGetDatum(langOid));
ObjectIdGetDatum(langOid),
0, 0, 0);
if (!HeapTupleIsValid(langTup)) /* should not happen */ if (!HeapTupleIsValid(langTup)) /* should not happen */
elog(ERROR, "cache lookup failed for language %u", langOid); 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); rel = heap_open(LanguageRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy(LANGNAME, tup = SearchSysCacheCopy1(LANGNAME, CStringGetDatum(oldname));
CStringGetDatum(oldname),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("language \"%s\" does not exist", oldname))); errmsg("language \"%s\" does not exist", oldname)));
/* make sure the new name doesn't exist */ /* make sure the new name doesn't exist */
if (SearchSysCacheExists(LANGNAME, if (SearchSysCacheExists1(LANGNAME, CStringGetDatum(newname)))
CStringGetDatum(newname),
0, 0, 0))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT), (errcode(ERRCODE_DUPLICATE_OBJECT),
errmsg("language \"%s\" already exists", newname))); errmsg("language \"%s\" already exists", newname)));
@ -608,9 +598,7 @@ AlterLanguageOwner(const char *name, Oid newOwnerId)
rel = heap_open(LanguageRelationId, RowExclusiveLock); rel = heap_open(LanguageRelationId, RowExclusiveLock);
tup = SearchSysCache(LANGNAME, tup = SearchSysCache1(LANGNAME, CStringGetDatum(name));
CStringGetDatum(name),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
@ -635,9 +623,7 @@ AlterLanguageOwner_oid(Oid oid, Oid newOwnerId)
rel = heap_open(LanguageRelationId, RowExclusiveLock); rel = heap_open(LanguageRelationId, RowExclusiveLock);
tup = SearchSysCache(LANGOID, tup = SearchSysCache1(LANGOID, ObjectIdGetDatum(oid));
ObjectIdGetDatum(oid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for language %u", oid); elog(ERROR, "cache lookup failed for language %u", oid);

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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"))); errmsg("schema name cannot be qualified")));
namespaceName = strVal(linitial(names)); namespaceName = strVal(linitial(names));
namespaceId = GetSysCacheOid(NAMESPACENAME, namespaceId = GetSysCacheOid1(NAMESPACENAME,
CStringGetDatum(namespaceName), CStringGetDatum(namespaceName));
0, 0, 0);
if (!OidIsValid(namespaceId)) if (!OidIsValid(namespaceId))
{ {
@ -233,9 +232,8 @@ RemoveSchemaById(Oid schemaOid)
relation = heap_open(NamespaceRelationId, RowExclusiveLock); relation = heap_open(NamespaceRelationId, RowExclusiveLock);
tup = SearchSysCache(NAMESPACEOID, tup = SearchSysCache1(NAMESPACEOID,
ObjectIdGetDatum(schemaOid), ObjectIdGetDatum(schemaOid));
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for namespace %u", schemaOid); 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); rel = heap_open(NamespaceRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy(NAMESPACENAME, tup = SearchSysCacheCopy1(NAMESPACENAME, CStringGetDatum(oldname));
CStringGetDatum(oldname),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_SCHEMA), (errcode(ERRCODE_UNDEFINED_SCHEMA),
@ -269,9 +265,8 @@ RenameSchema(const char *oldname, const char *newname)
/* make sure the new name doesn't exist */ /* make sure the new name doesn't exist */
if (HeapTupleIsValid( if (HeapTupleIsValid(
SearchSysCache(NAMESPACENAME, SearchSysCache1(NAMESPACENAME,
CStringGetDatum(newname), CStringGetDatum(newname))))
0, 0, 0)))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_SCHEMA), (errcode(ERRCODE_DUPLICATE_SCHEMA),
errmsg("schema \"%s\" already exists", newname))); errmsg("schema \"%s\" already exists", newname)));
@ -310,9 +305,7 @@ AlterSchemaOwner_oid(Oid oid, Oid newOwnerId)
rel = heap_open(NamespaceRelationId, RowExclusiveLock); rel = heap_open(NamespaceRelationId, RowExclusiveLock);
tup = SearchSysCache(NAMESPACEOID, tup = SearchSysCache1(NAMESPACEOID, ObjectIdGetDatum(oid));
ObjectIdGetDatum(oid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for schema %u", oid); elog(ERROR, "cache lookup failed for schema %u", oid);
@ -335,9 +328,7 @@ AlterSchemaOwner(const char *name, Oid newOwnerId)
rel = heap_open(NamespaceRelationId, RowExclusiveLock); rel = heap_open(NamespaceRelationId, RowExclusiveLock);
tup = SearchSysCache(NAMESPACENAME, tup = SearchSysCache1(NAMESPACENAME, CStringGetDatum(name));
CStringGetDatum(name),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_SCHEMA), (errcode(ERRCODE_UNDEFINED_SCHEMA),

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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"))); errmsg("lastval is not yet defined in this session")));
/* Someone may have dropped the sequence since the last nextval() */ /* Someone may have dropped the sequence since the last nextval() */
if (!SearchSysCacheExists(RELOID, if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(last_used_seq->relid)))
ObjectIdGetDatum(last_used_seq->relid),
0, 0, 0))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("lastval is not yet defined in this session"))); errmsg("lastval is not yet defined in this session")));

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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) if (relkind == RELKIND_INDEX)
{ {
tuple = SearchSysCache(INDEXRELID, tuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(relOid));
ObjectIdGetDatum(relOid),
0, 0, 0);
if (HeapTupleIsValid(tuple)) if (HeapTupleIsValid(tuple))
{ {
Form_pg_index index = (Form_pg_index) GETSTRUCT(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 */ /* Get the lock before trying to fetch the syscache entry */
LockRelationOid(relOid, AccessExclusiveLock); LockRelationOid(relOid, AccessExclusiveLock);
tuple = SearchSysCache(RELOID, tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relOid));
ObjectIdGetDatum(relOid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", relOid); elog(ERROR, "cache lookup failed for relation %u", relOid);
classform = (Form_pg_class) GETSTRUCT(tuple); 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. * need to update it, but we still need to issue an SI inval message.
*/ */
relationRelation = heap_open(RelationRelationId, RowExclusiveLock); relationRelation = heap_open(RelationRelationId, RowExclusiveLock);
tuple = SearchSysCacheCopy(RELOID, tuple = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relationId));
ObjectIdGetDatum(relationId),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", relationId); elog(ERROR, "cache lookup failed for relation %u", relationId);
classtuple = (Form_pg_class) GETSTRUCT(tuple); classtuple = (Form_pg_class) GETSTRUCT(tuple);
@ -2062,10 +2056,9 @@ renameatt(Oid myrelid,
/* new name should not already exist */ /* new name should not already exist */
/* this test is deliberately not attisdropped-aware */ /* this test is deliberately not attisdropped-aware */
if (SearchSysCacheExists(ATTNAME, if (SearchSysCacheExists2(ATTNAME,
ObjectIdGetDatum(myrelid), ObjectIdGetDatum(myrelid),
PointerGetDatum(newattname), PointerGetDatum(newattname)))
0, 0))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_COLUMN), (errcode(ERRCODE_DUPLICATE_COLUMN),
errmsg("column \"%s\" of relation \"%s\" already exists", 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); relrelation = heap_open(RelationRelationId, RowExclusiveLock);
reltup = SearchSysCacheCopy(RELOID, reltup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(myrelid));
ObjectIdGetDatum(myrelid),
0, 0, 0);
if (!HeapTupleIsValid(reltup)) /* shouldn't happen */ if (!HeapTupleIsValid(reltup)) /* shouldn't happen */
elog(ERROR, "cache lookup failed for relation %u", myrelid); elog(ERROR, "cache lookup failed for relation %u", myrelid);
relform = (Form_pg_class) GETSTRUCT(reltup); relform = (Form_pg_class) GETSTRUCT(reltup);
@ -3671,9 +3662,7 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel,
pgclass = heap_open(RelationRelationId, RowExclusiveLock); pgclass = heap_open(RelationRelationId, RowExclusiveLock);
reltup = SearchSysCacheCopy(RELOID, reltup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(myrelid));
ObjectIdGetDatum(myrelid),
0, 0, 0);
if (!HeapTupleIsValid(reltup)) if (!HeapTupleIsValid(reltup))
elog(ERROR, "cache lookup failed for relation %u", myrelid); elog(ERROR, "cache lookup failed for relation %u", myrelid);
relkind = ((Form_pg_class) GETSTRUCT(reltup))->relkind; 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 * 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. * add a column matching a dropped column name, it's gonna fail anyway.
*/ */
if (SearchSysCacheExists(ATTNAME, if (SearchSysCacheExists2(ATTNAME,
ObjectIdGetDatum(myrelid), ObjectIdGetDatum(myrelid),
PointerGetDatum(colDef->colname), PointerGetDatum(colDef->colname)))
0, 0))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_COLUMN), (errcode(ERRCODE_DUPLICATE_COLUMN),
errmsg("column \"%s\" of relation \"%s\" already exists", errmsg("column \"%s\" of relation \"%s\" already exists",
@ -3953,9 +3941,7 @@ ATExecDropNotNull(Relation rel, const char *colName)
Form_pg_index indexStruct; Form_pg_index indexStruct;
int i; int i;
indexTuple = SearchSysCache(INDEXRELID, indexTuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexoid));
ObjectIdGetDatum(indexoid),
0, 0, 0);
if (!HeapTupleIsValid(indexTuple)) if (!HeapTupleIsValid(indexTuple))
elog(ERROR, "cache lookup failed for index %u", indexoid); elog(ERROR, "cache lookup failed for index %u", indexoid);
indexStruct = (Form_pg_index) GETSTRUCT(indexTuple); indexStruct = (Form_pg_index) GETSTRUCT(indexTuple);
@ -4496,9 +4482,8 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName,
class_rel = heap_open(RelationRelationId, RowExclusiveLock); class_rel = heap_open(RelationRelationId, RowExclusiveLock);
tuple = SearchSysCacheCopy(RELOID, tuple = SearchSysCacheCopy1(RELOID,
ObjectIdGetDatum(RelationGetRelid(rel)), ObjectIdGetDatum(RelationGetRelid(rel)));
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", elog(ERROR, "cache lookup failed for relation %u",
RelationGetRelid(rel)); RelationGetRelid(rel));
@ -4876,9 +4861,7 @@ ATAddForeignKeyConstraint(AlteredTableInfo *tab, Relation rel,
int16 eqstrategy; int16 eqstrategy;
/* We need several fields out of the pg_opclass entry */ /* We need several fields out of the pg_opclass entry */
cla_ht = SearchSysCache(CLAOID, cla_ht = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclasses[i]));
ObjectIdGetDatum(opclasses[i]),
0, 0, 0);
if (!HeapTupleIsValid(cla_ht)) if (!HeapTupleIsValid(cla_ht))
elog(ERROR, "cache lookup failed for opclass %u", opclasses[i]); elog(ERROR, "cache lookup failed for opclass %u", opclasses[i]);
cla_tup = (Form_pg_opclass) GETSTRUCT(cla_ht); cla_tup = (Form_pg_opclass) GETSTRUCT(cla_ht);
@ -5103,9 +5086,7 @@ transformFkeyGetPrimaryKey(Relation pkrel, Oid *indexOid,
{ {
Oid indexoid = lfirst_oid(indexoidscan); Oid indexoid = lfirst_oid(indexoidscan);
indexTuple = SearchSysCache(INDEXRELID, indexTuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexoid));
ObjectIdGetDatum(indexoid),
0, 0, 0);
if (!HeapTupleIsValid(indexTuple)) if (!HeapTupleIsValid(indexTuple))
elog(ERROR, "cache lookup failed for index %u", indexoid); elog(ERROR, "cache lookup failed for index %u", indexoid);
indexStruct = (Form_pg_index) GETSTRUCT(indexTuple); indexStruct = (Form_pg_index) GETSTRUCT(indexTuple);
@ -5200,9 +5181,7 @@ transformFkeyCheckAttrs(Relation pkrel,
j; j;
indexoid = lfirst_oid(indexoidscan); indexoid = lfirst_oid(indexoidscan);
indexTuple = SearchSysCache(INDEXRELID, indexTuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexoid));
ObjectIdGetDatum(indexoid),
0, 0, 0);
if (!HeapTupleIsValid(indexTuple)) if (!HeapTupleIsValid(indexTuple))
elog(ERROR, "cache lookup failed for index %u", indexoid); elog(ERROR, "cache lookup failed for index %u", indexoid);
indexStruct = (Form_pg_index) GETSTRUCT(indexTuple); indexStruct = (Form_pg_index) GETSTRUCT(indexTuple);
@ -6432,9 +6411,7 @@ ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing)
/* Get its pg_class tuple, too */ /* Get its pg_class tuple, too */
class_rel = heap_open(RelationRelationId, RowExclusiveLock); class_rel = heap_open(RelationRelationId, RowExclusiveLock);
tuple = SearchSysCache(RELOID, tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relationOid));
ObjectIdGetDatum(relationOid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", relationOid); elog(ERROR, "cache lookup failed for relation %u", relationOid);
tuple_class = (Form_pg_class) GETSTRUCT(tuple); tuple_class = (Form_pg_class) GETSTRUCT(tuple);
@ -6788,9 +6765,7 @@ ATExecSetRelOptions(Relation rel, List *defList, bool isReset)
/* Get the old reloptions */ /* Get the old reloptions */
relid = RelationGetRelid(rel); relid = RelationGetRelid(rel);
tuple = SearchSysCache(RELOID, tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
ObjectIdGetDatum(relid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", relid); 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); toastrel = heap_open(toastid, AccessExclusiveLock);
/* Get the old reloptions */ /* Get the old reloptions */
tuple = SearchSysCache(RELOID, tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(toastid));
ObjectIdGetDatum(toastid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", toastid); 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 */ /* Get a modifiable copy of the relation's pg_class row */
pg_class = heap_open(RelationRelationId, RowExclusiveLock); pg_class = heap_open(RelationRelationId, RowExclusiveLock);
tuple = SearchSysCacheCopy(RELOID, tuple = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(tableOid));
ObjectIdGetDatum(tableOid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", tableOid); elog(ERROR, "cache lookup failed for relation %u", tableOid);
rd_rel = (Form_pg_class) GETSTRUCT(tuple); rd_rel = (Form_pg_class) GETSTRUCT(tuple);
@ -7866,9 +7837,7 @@ AlterRelationNamespaceInternal(Relation classRel, Oid relOid,
HeapTuple classTup; HeapTuple classTup;
Form_pg_class classForm; Form_pg_class classForm;
classTup = SearchSysCacheCopy(RELOID, classTup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relOid));
ObjectIdGetDatum(relOid),
0, 0, 0);
if (!HeapTupleIsValid(classTup)) if (!HeapTupleIsValid(classTup))
elog(ERROR, "cache lookup failed for relation %u", relOid); elog(ERROR, "cache lookup failed for relation %u", relOid);
classForm = (Form_pg_class) GETSTRUCT(classTup); classForm = (Form_pg_class) GETSTRUCT(classTup);

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * 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. * entries.
*/ */
pgrel = heap_open(RelationRelationId, RowExclusiveLock); pgrel = heap_open(RelationRelationId, RowExclusiveLock);
tuple = SearchSysCacheCopy(RELOID, tuple = SearchSysCacheCopy1(RELOID,
ObjectIdGetDatum(RelationGetRelid(rel)), ObjectIdGetDatum(RelationGetRelid(rel)));
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", elog(ERROR, "cache lookup failed for relation %u",
RelationGetRelid(rel)); RelationGetRelid(rel));

View File

@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * 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); relation = heap_open(TSParserRelationId, RowExclusiveLock);
tup = SearchSysCache(TSPARSEROID, tup = SearchSysCache1(TSPARSEROID, ObjectIdGetDatum(prsId));
ObjectIdGetDatum(prsId),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for text search parser %u", prsId); 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); prsId = TSParserGetPrsid(oldname, false);
tup = SearchSysCacheCopy(TSPARSEROID, tup = SearchSysCacheCopy1(TSPARSEROID, ObjectIdGetDatum(prsId));
ObjectIdGetDatum(prsId),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for text search parser %u", prsId); elog(ERROR, "cache lookup failed for text search parser %u", prsId);
namespaceOid = ((Form_pg_ts_parser) GETSTRUCT(tup))->prsnamespace; namespaceOid = ((Form_pg_ts_parser) GETSTRUCT(tup))->prsnamespace;
if (SearchSysCacheExists(TSPARSERNAMENSP, if (SearchSysCacheExists2(TSPARSERNAMENSP,
PointerGetDatum(newname), PointerGetDatum(newname),
ObjectIdGetDatum(namespaceOid), ObjectIdGetDatum(namespaceOid)))
0, 0))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT), (errcode(ERRCODE_DUPLICATE_OBJECT),
errmsg("text search parser \"%s\" already exists", errmsg("text search parser \"%s\" already exists",
@ -450,9 +445,7 @@ verify_dictoptions(Oid tmplId, List *dictoptions)
if (!IsUnderPostmaster) if (!IsUnderPostmaster)
return; return;
tup = SearchSysCache(TSTEMPLATEOID, tup = SearchSysCache1(TSTEMPLATEOID, ObjectIdGetDatum(tmplId));
ObjectIdGetDatum(tmplId),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for text search template %u", elog(ERROR, "cache lookup failed for text search template %u",
tmplId); tmplId);
@ -591,9 +584,7 @@ RenameTSDictionary(List *oldname, const char *newname)
dictId = TSDictionaryGetDictid(oldname, false); dictId = TSDictionaryGetDictid(oldname, false);
tup = SearchSysCacheCopy(TSDICTOID, tup = SearchSysCacheCopy1(TSDICTOID, ObjectIdGetDatum(dictId));
ObjectIdGetDatum(dictId),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for text search dictionary %u", 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; namespaceOid = ((Form_pg_ts_dict) GETSTRUCT(tup))->dictnamespace;
if (SearchSysCacheExists(TSDICTNAMENSP, if (SearchSysCacheExists2(TSDICTNAMENSP,
PointerGetDatum(newname), PointerGetDatum(newname),
ObjectIdGetDatum(namespaceOid), ObjectIdGetDatum(namespaceOid)))
0, 0))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT), (errcode(ERRCODE_DUPLICATE_OBJECT),
errmsg("text search dictionary \"%s\" already exists", errmsg("text search dictionary \"%s\" already exists",
@ -673,9 +663,7 @@ RemoveTSDictionaries(DropStmt *drop)
continue; continue;
} }
tup = SearchSysCache(TSDICTOID, tup = SearchSysCache1(TSDICTOID, ObjectIdGetDatum(dictOid));
ObjectIdGetDatum(dictOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for text search dictionary %u", elog(ERROR, "cache lookup failed for text search dictionary %u",
dictOid); dictOid);
@ -712,9 +700,7 @@ RemoveTSDictionaryById(Oid dictId)
relation = heap_open(TSDictionaryRelationId, RowExclusiveLock); relation = heap_open(TSDictionaryRelationId, RowExclusiveLock);
tup = SearchSysCache(TSDICTOID, tup = SearchSysCache1(TSDICTOID, ObjectIdGetDatum(dictId));
ObjectIdGetDatum(dictId),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for text search dictionary %u", elog(ERROR, "cache lookup failed for text search dictionary %u",
@ -749,9 +735,7 @@ AlterTSDictionary(AlterTSDictionaryStmt *stmt)
rel = heap_open(TSDictionaryRelationId, RowExclusiveLock); rel = heap_open(TSDictionaryRelationId, RowExclusiveLock);
tup = SearchSysCache(TSDICTOID, tup = SearchSysCache1(TSDICTOID, ObjectIdGetDatum(dictId));
ObjectIdGetDatum(dictId),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for text search dictionary %u", elog(ERROR, "cache lookup failed for text search dictionary %u",
@ -859,9 +843,7 @@ AlterTSDictionaryOwner(List *name, Oid newOwnerId)
dictId = TSDictionaryGetDictid(name, false); dictId = TSDictionaryGetDictid(name, false);
tup = SearchSysCacheCopy(TSDICTOID, tup = SearchSysCacheCopy1(TSDICTOID, ObjectIdGetDatum(dictId));
ObjectIdGetDatum(dictId),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for text search dictionary %u", elog(ERROR, "cache lookup failed for text search dictionary %u",
@ -1093,9 +1075,7 @@ RenameTSTemplate(List *oldname, const char *newname)
tmplId = TSTemplateGetTmplid(oldname, false); tmplId = TSTemplateGetTmplid(oldname, false);
tup = SearchSysCacheCopy(TSTEMPLATEOID, tup = SearchSysCacheCopy1(TSTEMPLATEOID, ObjectIdGetDatum(tmplId));
ObjectIdGetDatum(tmplId),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for text search template %u", 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; namespaceOid = ((Form_pg_ts_template) GETSTRUCT(tup))->tmplnamespace;
if (SearchSysCacheExists(TSTEMPLATENAMENSP, if (SearchSysCacheExists2(TSTEMPLATENAMENSP,
PointerGetDatum(newname), PointerGetDatum(newname),
ObjectIdGetDatum(namespaceOid), ObjectIdGetDatum(namespaceOid)))
0, 0))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT), (errcode(ERRCODE_DUPLICATE_OBJECT),
errmsg("text search template \"%s\" already exists", errmsg("text search template \"%s\" already exists",
@ -1190,9 +1169,7 @@ RemoveTSTemplateById(Oid tmplId)
relation = heap_open(TSTemplateRelationId, RowExclusiveLock); relation = heap_open(TSTemplateRelationId, RowExclusiveLock);
tup = SearchSysCache(TSTEMPLATEOID, tup = SearchSysCache1(TSTEMPLATEOID, ObjectIdGetDatum(tmplId));
ObjectIdGetDatum(tmplId),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for text search template %u", elog(ERROR, "cache lookup failed for text search template %u",
@ -1221,9 +1198,7 @@ GetTSConfigTuple(List *names)
if (!OidIsValid(cfgId)) if (!OidIsValid(cfgId))
return NULL; return NULL;
tup = SearchSysCache(TSCONFIGOID, tup = SearchSysCache1(TSCONFIGOID, ObjectIdGetDatum(cfgId));
ObjectIdGetDatum(cfgId),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for text search configuration %u", elog(ERROR, "cache lookup failed for text search configuration %u",
@ -1376,9 +1351,7 @@ DefineTSConfiguration(List *names, List *parameters)
{ {
Form_pg_ts_config cfg; Form_pg_ts_config cfg;
tup = SearchSysCache(TSCONFIGOID, tup = SearchSysCache1(TSCONFIGOID, ObjectIdGetDatum(sourceOid));
ObjectIdGetDatum(sourceOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for text search configuration %u", elog(ERROR, "cache lookup failed for text search configuration %u",
sourceOid); sourceOid);
@ -1490,9 +1463,7 @@ RenameTSConfiguration(List *oldname, const char *newname)
cfgId = TSConfigGetCfgid(oldname, false); cfgId = TSConfigGetCfgid(oldname, false);
tup = SearchSysCacheCopy(TSCONFIGOID, tup = SearchSysCacheCopy1(TSCONFIGOID, ObjectIdGetDatum(cfgId));
ObjectIdGetDatum(cfgId),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for text search configuration %u", 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; namespaceOid = ((Form_pg_ts_config) GETSTRUCT(tup))->cfgnamespace;
if (SearchSysCacheExists(TSCONFIGNAMENSP, if (SearchSysCacheExists2(TSCONFIGNAMENSP,
PointerGetDatum(newname), PointerGetDatum(newname),
ObjectIdGetDatum(namespaceOid), ObjectIdGetDatum(namespaceOid)))
0, 0))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT), (errcode(ERRCODE_DUPLICATE_OBJECT),
errmsg("text search configuration \"%s\" already exists", errmsg("text search configuration \"%s\" already exists",
@ -1608,9 +1578,7 @@ RemoveTSConfigurationById(Oid cfgId)
/* Remove the pg_ts_config entry */ /* Remove the pg_ts_config entry */
relCfg = heap_open(TSConfigRelationId, RowExclusiveLock); relCfg = heap_open(TSConfigRelationId, RowExclusiveLock);
tup = SearchSysCache(TSCONFIGOID, tup = SearchSysCache1(TSCONFIGOID, ObjectIdGetDatum(cfgId));
ObjectIdGetDatum(cfgId),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for text search dictionary %u", elog(ERROR, "cache lookup failed for text search dictionary %u",
@ -1660,9 +1628,7 @@ AlterTSConfigurationOwner(List *name, Oid newOwnerId)
cfgId = TSConfigGetCfgid(name, false); cfgId = TSConfigGetCfgid(name, false);
tup = SearchSysCacheCopy(TSCONFIGOID, tup = SearchSysCacheCopy1(TSCONFIGOID, ObjectIdGetDatum(cfgId));
ObjectIdGetDatum(cfgId),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for text search configuration %u", elog(ERROR, "cache lookup failed for text search configuration %u",

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 * DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the * 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, * Look to see if type already exists (presumably as a shell; if not,
* TypeCreate will complain). * TypeCreate will complain).
*/ */
typoid = GetSysCacheOid(TYPENAMENSP, typoid = GetSysCacheOid2(TYPENAMENSP,
CStringGetDatum(typeName), CStringGetDatum(typeName),
ObjectIdGetDatum(typeNamespace), ObjectIdGetDatum(typeNamespace));
0, 0);
/* /*
* If it's not a shell, see if it's an autogenerated array type, and if so * 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); relation = heap_open(TypeRelationId, RowExclusiveLock);
tup = SearchSysCache(TYPEOID, tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typeOid));
ObjectIdGetDatum(typeOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for type %u", typeOid); 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 * 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. * it's an autogenerated array, we can rename it out of the way.
*/ */
old_type_oid = GetSysCacheOid(TYPENAMENSP, old_type_oid = GetSysCacheOid2(TYPENAMENSP,
CStringGetDatum(domainName), CStringGetDatum(domainName),
ObjectIdGetDatum(domainNamespace), ObjectIdGetDatum(domainNamespace));
0, 0);
if (OidIsValid(old_type_oid)) if (OidIsValid(old_type_oid))
{ {
if (!moveArrayTypeName(old_type_oid, domainName, domainNamespace)) 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 * 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. * it's an autogenerated array, we can rename it out of the way.
*/ */
old_type_oid = GetSysCacheOid(TYPENAMENSP, old_type_oid = GetSysCacheOid2(TYPENAMENSP,
CStringGetDatum(enumName), CStringGetDatum(enumName),
ObjectIdGetDatum(enumNamespace), ObjectIdGetDatum(enumNamespace));
0, 0);
if (OidIsValid(old_type_oid)) if (OidIsValid(old_type_oid))
{ {
if (!moveArrayTypeName(old_type_oid, enumName, enumNamespace)) 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". * about a "type" instead of below about a "relation".
*/ */
typeNamespace = RangeVarGetCreationNamespace(createStmt->relation); typeNamespace = RangeVarGetCreationNamespace(createStmt->relation);
old_type_oid = GetSysCacheOid(TYPENAMENSP, old_type_oid =
CStringGetDatum(createStmt->relation->relname), GetSysCacheOid2(TYPENAMENSP,
ObjectIdGetDatum(typeNamespace), CStringGetDatum(createStmt->relation->relname),
0, 0); ObjectIdGetDatum(typeNamespace));
if (OidIsValid(old_type_oid)) if (OidIsValid(old_type_oid))
{ {
if (!moveArrayTypeName(old_type_oid, createStmt->relation->relname, typeNamespace)) 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 */ /* Look up the domain in the type table */
rel = heap_open(TypeRelationId, RowExclusiveLock); rel = heap_open(TypeRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy(TYPEOID, tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(domainoid));
ObjectIdGetDatum(domainoid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for type %u", domainoid); elog(ERROR, "cache lookup failed for type %u", domainoid);
typTup = (Form_pg_type) GETSTRUCT(tup); typTup = (Form_pg_type) GETSTRUCT(tup);
@ -1710,9 +1703,7 @@ AlterDomainNotNull(List *names, bool notNull)
/* Look up the domain in the type table */ /* Look up the domain in the type table */
typrel = heap_open(TypeRelationId, RowExclusiveLock); typrel = heap_open(TypeRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy(TYPEOID, tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(domainoid));
ObjectIdGetDatum(domainoid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for type %u", domainoid); elog(ERROR, "cache lookup failed for type %u", domainoid);
typTup = (Form_pg_type) GETSTRUCT(tup); typTup = (Form_pg_type) GETSTRUCT(tup);
@ -1812,9 +1803,7 @@ AlterDomainDropConstraint(List *names, const char *constrName,
/* Look up the domain in the type table */ /* Look up the domain in the type table */
rel = heap_open(TypeRelationId, RowExclusiveLock); rel = heap_open(TypeRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy(TYPEOID, tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(domainoid));
ObjectIdGetDatum(domainoid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for type %u", domainoid); 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 */ /* Look up the domain in the type table */
typrel = heap_open(TypeRelationId, RowExclusiveLock); typrel = heap_open(TypeRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy(TYPEOID, tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(domainoid));
ObjectIdGetDatum(domainoid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for type %u", domainoid); elog(ERROR, "cache lookup failed for type %u", domainoid);
typTup = (Form_pg_type) GETSTRUCT(tup); typTup = (Form_pg_type) GETSTRUCT(tup);
@ -2399,9 +2386,7 @@ GetDomainConstraints(Oid typeOid)
ScanKeyData key[1]; ScanKeyData key[1];
SysScanDesc scan; SysScanDesc scan;
tup = SearchSysCache(TYPEOID, tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typeOid));
ObjectIdGetDatum(typeOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for type %u", typeOid); elog(ERROR, "cache lookup failed for type %u", typeOid);
typTup = (Form_pg_type) GETSTRUCT(tup); typTup = (Form_pg_type) GETSTRUCT(tup);
@ -2512,9 +2497,7 @@ RenameType(List *names, const char *newTypeName)
/* Look up the type in the type table */ /* Look up the type in the type table */
rel = heap_open(TypeRelationId, RowExclusiveLock); rel = heap_open(TypeRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy(TYPEOID, tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(typeOid));
ObjectIdGetDatum(typeOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for type %u", typeOid); elog(ERROR, "cache lookup failed for type %u", typeOid);
typTup = (Form_pg_type) GETSTRUCT(tup); typTup = (Form_pg_type) GETSTRUCT(tup);
@ -2699,9 +2682,7 @@ AlterTypeOwnerInternal(Oid typeOid, Oid newOwnerId,
rel = heap_open(TypeRelationId, RowExclusiveLock); rel = heap_open(TypeRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy(TYPEOID, tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(typeOid));
ObjectIdGetDatum(typeOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for type %u", typeOid); elog(ERROR, "cache lookup failed for type %u", typeOid);
typTup = (Form_pg_type) GETSTRUCT(tup); typTup = (Form_pg_type) GETSTRUCT(tup);
@ -2791,9 +2772,7 @@ AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid,
rel = heap_open(TypeRelationId, RowExclusiveLock); rel = heap_open(TypeRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy(TYPEOID, tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(typeOid));
ObjectIdGetDatum(typeOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for type %u", typeOid); elog(ERROR, "cache lookup failed for type %u", typeOid);
typform = (Form_pg_type) GETSTRUCT(tup); 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"))); errmsg("cannot move objects into or out of TOAST schema")));
/* check for duplicate name (more friendly than unique-index failure) */ /* check for duplicate name (more friendly than unique-index failure) */
if (SearchSysCacheExists(TYPENAMENSP, if (SearchSysCacheExists2(TYPENAMENSP,
CStringGetDatum(NameStr(typform->typname)), CStringGetDatum(NameStr(typform->typname)),
ObjectIdGetDatum(nspOid), ObjectIdGetDatum(nspOid)))
0, 0))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT), (errcode(ERRCODE_DUPLICATE_OBJECT),
errmsg("type \"%s\" already exists in schema \"%s\"", errmsg("type \"%s\" already exists in schema \"%s\"",

View File

@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * 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()) if (superuser())
return true; return true;
utup = SearchSysCache(AUTHOID, utup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(GetUserId()));
ObjectIdGetDatum(GetUserId()),
0, 0, 0);
if (HeapTupleIsValid(utup)) if (HeapTupleIsValid(utup))
{ {
result = ((Form_pg_authid) GETSTRUCT(utup))->rolcreaterole; result = ((Form_pg_authid) GETSTRUCT(utup))->rolcreaterole;
@ -295,9 +293,7 @@ CreateRole(CreateRoleStmt *stmt)
pg_authid_rel = heap_open(AuthIdRelationId, RowExclusiveLock); pg_authid_rel = heap_open(AuthIdRelationId, RowExclusiveLock);
pg_authid_dsc = RelationGetDescr(pg_authid_rel); pg_authid_dsc = RelationGetDescr(pg_authid_rel);
tuple = SearchSysCache(AUTHNAME, tuple = SearchSysCache1(AUTHNAME, PointerGetDatum(stmt->role));
PointerGetDatum(stmt->role),
0, 0, 0);
if (HeapTupleIsValid(tuple)) if (HeapTupleIsValid(tuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT), (errcode(ERRCODE_DUPLICATE_OBJECT),
@ -576,9 +572,7 @@ AlterRole(AlterRoleStmt *stmt)
pg_authid_rel = heap_open(AuthIdRelationId, RowExclusiveLock); pg_authid_rel = heap_open(AuthIdRelationId, RowExclusiveLock);
pg_authid_dsc = RelationGetDescr(pg_authid_rel); pg_authid_dsc = RelationGetDescr(pg_authid_rel);
tuple = SearchSysCache(AUTHNAME, tuple = SearchSysCache1(AUTHNAME, PointerGetDatum(stmt->role));
PointerGetDatum(stmt->role),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
@ -765,9 +759,7 @@ AlterRoleSet(AlterRoleSetStmt *stmt)
HeapTuple roletuple; HeapTuple roletuple;
Oid databaseid = InvalidOid; Oid databaseid = InvalidOid;
roletuple = SearchSysCache(AUTHNAME, roletuple = SearchSysCache1(AUTHNAME, PointerGetDatum(stmt->role));
PointerGetDatum(stmt->role),
0, 0, 0);
if (!HeapTupleIsValid(roletuple)) if (!HeapTupleIsValid(roletuple))
ereport(ERROR, ereport(ERROR,
@ -849,9 +841,7 @@ DropRole(DropRoleStmt *stmt)
SysScanDesc sscan; SysScanDesc sscan;
Oid roleid; Oid roleid;
tuple = SearchSysCache(AUTHNAME, tuple = SearchSysCache1(AUTHNAME, PointerGetDatum(role));
PointerGetDatum(role),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
{ {
if (!stmt->missing_ok) if (!stmt->missing_ok)
@ -1005,9 +995,7 @@ RenameRole(const char *oldname, const char *newname)
rel = heap_open(AuthIdRelationId, RowExclusiveLock); rel = heap_open(AuthIdRelationId, RowExclusiveLock);
dsc = RelationGetDescr(rel); dsc = RelationGetDescr(rel);
oldtuple = SearchSysCache(AUTHNAME, oldtuple = SearchSysCache1(AUTHNAME, CStringGetDatum(oldname));
CStringGetDatum(oldname),
0, 0, 0);
if (!HeapTupleIsValid(oldtuple)) if (!HeapTupleIsValid(oldtuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
@ -1033,9 +1021,7 @@ RenameRole(const char *oldname, const char *newname)
errmsg("current user cannot be renamed"))); errmsg("current user cannot be renamed")));
/* make sure the new name doesn't exist */ /* make sure the new name doesn't exist */
if (SearchSysCacheExists(AUTHNAME, if (SearchSysCacheExists1(AUTHNAME, CStringGetDatum(newname)))
CStringGetDatum(newname),
0, 0, 0))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT), (errcode(ERRCODE_DUPLICATE_OBJECT),
errmsg("role \"%s\" already exists", newname))); 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 * Check if entry for this role/member already exists; if so, give
* warning unless we are adding admin option. * warning unless we are adding admin option.
*/ */
authmem_tuple = SearchSysCache(AUTHMEMROLEMEM, authmem_tuple = SearchSysCache2(AUTHMEMROLEMEM,
ObjectIdGetDatum(roleid), ObjectIdGetDatum(roleid),
ObjectIdGetDatum(memberid), ObjectIdGetDatum(memberid));
0, 0);
if (HeapTupleIsValid(authmem_tuple) && if (HeapTupleIsValid(authmem_tuple) &&
(!admin_opt || (!admin_opt ||
((Form_pg_auth_members) GETSTRUCT(authmem_tuple))->admin_option)) ((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 * Find entry for this role/member
*/ */
authmem_tuple = SearchSysCache(AUTHMEMROLEMEM, authmem_tuple = SearchSysCache2(AUTHMEMROLEMEM,
ObjectIdGetDatum(roleid), ObjectIdGetDatum(roleid),
ObjectIdGetDatum(memberid), ObjectIdGetDatum(memberid));
0, 0);
if (!HeapTupleIsValid(authmem_tuple)) if (!HeapTupleIsValid(authmem_tuple))
{ {
ereport(WARNING, ereport(WARNING,

View File

@ -14,7 +14,7 @@
* *
* *
* IDENTIFICATION * 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); rd = heap_open(RelationRelationId, RowExclusiveLock);
/* Fetch a copy of the tuple to scribble on */ /* Fetch a copy of the tuple to scribble on */
ctup = SearchSysCacheCopy(RELOID, ctup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relid));
ObjectIdGetDatum(relid),
0, 0, 0);
if (!HeapTupleIsValid(ctup)) if (!HeapTupleIsValid(ctup))
elog(ERROR, "pg_class entry for relid %u vanished during vacuuming", elog(ERROR, "pg_class entry for relid %u vanished during vacuuming",
relid); relid);
@ -644,9 +642,7 @@ vac_update_datfrozenxid(void)
relation = heap_open(DatabaseRelationId, RowExclusiveLock); relation = heap_open(DatabaseRelationId, RowExclusiveLock);
/* Fetch a copy of the tuple to scribble on */ /* Fetch a copy of the tuple to scribble on */
tuple = SearchSysCacheCopy(DATABASEOID, tuple = SearchSysCacheCopy1(DATABASEOID, ObjectIdGetDatum(MyDatabaseId));
ObjectIdGetDatum(MyDatabaseId),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "could not find tuple for database %u", MyDatabaseId); elog(ERROR, "could not find tuple for database %u", MyDatabaseId);
dbform = (Form_pg_database) GETSTRUCT(tuple); dbform = (Form_pg_database) GETSTRUCT(tuple);

View File

@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * 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; return NULL;
} }
roleTup = SearchSysCache(AUTHNAME, roleTup = SearchSysCache1(AUTHNAME, PointerGetDatum(value));
PointerGetDatum(value),
0, 0, 0);
if (!HeapTupleIsValid(roleTup)) if (!HeapTupleIsValid(roleTup))
{ {
ereport(GUC_complaint_elevel(source), ereport(GUC_complaint_elevel(source),
@ -839,9 +837,7 @@ assign_role(const char *value, bool doit, GucSource source)
return NULL; return NULL;
} }
roleTup = SearchSysCache(AUTHNAME, roleTup = SearchSysCache1(AUTHNAME, PointerGetDatum(value));
PointerGetDatum(value),
0, 0, 0);
if (!HeapTupleIsValid(roleTup)) if (!HeapTupleIsValid(roleTup))
{ {
ereport(GUC_complaint_elevel(source), ereport(GUC_complaint_elevel(source),

View File

@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * 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; Form_pg_am amrec;
/* Fetch the pg_class tuple of the index relation */ /* Fetch the pg_class tuple of the index relation */
ht_idxrel = SearchSysCache(RELOID, ht_idxrel = SearchSysCache1(RELOID, ObjectIdGetDatum(indexid));
ObjectIdGetDatum(indexid),
0, 0, 0);
if (!HeapTupleIsValid(ht_idxrel)) if (!HeapTupleIsValid(ht_idxrel))
elog(ERROR, "cache lookup failed for relation %u", indexid); elog(ERROR, "cache lookup failed for relation %u", indexid);
idxrelrec = (Form_pg_class) GETSTRUCT(ht_idxrel); idxrelrec = (Form_pg_class) GETSTRUCT(ht_idxrel);
/* Fetch the pg_am tuple of the index' access method */ /* Fetch the pg_am tuple of the index' access method */
ht_am = SearchSysCache(AMOID, ht_am = SearchSysCache1(AMOID, ObjectIdGetDatum(idxrelrec->relam));
ObjectIdGetDatum(idxrelrec->relam),
0, 0, 0);
if (!HeapTupleIsValid(ht_am)) if (!HeapTupleIsValid(ht_am))
elog(ERROR, "cache lookup failed for access method %u", elog(ERROR, "cache lookup failed for access method %u",
idxrelrec->relam); idxrelrec->relam);

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 * get the procedure tuple corresponding to the given function Oid
*/ */
procedureTuple = SearchSysCache(PROCOID, procedureTuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(foid));
ObjectIdGetDatum(foid),
0, 0, 0);
if (!HeapTupleIsValid(procedureTuple)) if (!HeapTupleIsValid(procedureTuple))
elog(ERROR, "cache lookup failed for function %u", foid); elog(ERROR, "cache lookup failed for function %u", foid);
procedureStruct = (Form_pg_proc) GETSTRUCT(procedureTuple); procedureStruct = (Form_pg_proc) GETSTRUCT(procedureTuple);
@ -885,9 +883,7 @@ sql_exec_error_callback(void *arg)
int syntaxerrposition; int syntaxerrposition;
/* Need access to function's pg_proc tuple */ /* Need access to function's pg_proc tuple */
func_tuple = SearchSysCache(PROCOID, func_tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(flinfo->fn_oid));
ObjectIdGetDatum(flinfo->fn_oid),
0, 0, 0);
if (!HeapTupleIsValid(func_tuple)) if (!HeapTupleIsValid(func_tuple))
return; /* shouldn't happen */ return; /* shouldn't happen */
functup = (Form_pg_proc) GETSTRUCT(func_tuple); functup = (Form_pg_proc) GETSTRUCT(func_tuple);

View File

@ -71,7 +71,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * 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; peraggstate->numArguments = numArguments;
aggTuple = SearchSysCache(AGGFNOID, aggTuple = SearchSysCache1(AGGFNOID,
ObjectIdGetDatum(aggref->aggfnoid), ObjectIdGetDatum(aggref->aggfnoid));
0, 0, 0);
if (!HeapTupleIsValid(aggTuple)) if (!HeapTupleIsValid(aggTuple))
elog(ERROR, "cache lookup failed for aggregate %u", elog(ERROR, "cache lookup failed for aggregate %u",
aggref->aggfnoid); aggref->aggfnoid);
@ -1620,9 +1619,8 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
HeapTuple procTuple; HeapTuple procTuple;
Oid aggOwner; Oid aggOwner;
procTuple = SearchSysCache(PROCOID, procTuple = SearchSysCache1(PROCOID,
ObjectIdGetDatum(aggref->aggfnoid), ObjectIdGetDatum(aggref->aggfnoid));
0, 0, 0);
if (!HeapTupleIsValid(procTuple)) if (!HeapTupleIsValid(procTuple))
elog(ERROR, "cache lookup failed for function %u", elog(ERROR, "cache lookup failed for function %u",
aggref->aggfnoid); aggref->aggfnoid);

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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. * Try to find the MCV statistics for the outer relation's join key.
*/ */
statsTuple = SearchSysCache(STATRELATTINH, statsTuple = SearchSysCache3(STATRELATTINH,
ObjectIdGetDatum(node->skewTable), ObjectIdGetDatum(node->skewTable),
Int16GetDatum(node->skewColumn), Int16GetDatum(node->skewColumn),
BoolGetDatum(node->skewInherit), BoolGetDatum(node->skewInherit));
0);
if (!HeapTupleIsValid(statsTuple)) if (!HeapTupleIsValid(statsTuple))
return; return;

View File

@ -27,7 +27,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * 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)); inputTypes[i++] = exprType((Node *) lfirst(lc));
} }
aggTuple = SearchSysCache(AGGFNOID, aggTuple = SearchSysCache1(AGGFNOID, ObjectIdGetDatum(wfunc->winfnoid));
ObjectIdGetDatum(wfunc->winfnoid),
0, 0, 0);
if (!HeapTupleIsValid(aggTuple)) if (!HeapTupleIsValid(aggTuple))
elog(ERROR, "cache lookup failed for aggregate %u", elog(ERROR, "cache lookup failed for aggregate %u",
wfunc->winfnoid); wfunc->winfnoid);
@ -1747,9 +1745,8 @@ initialize_peragg(WindowAggState *winstate, WindowFunc *wfunc,
HeapTuple procTuple; HeapTuple procTuple;
Oid aggOwner; Oid aggOwner;
procTuple = SearchSysCache(PROCOID, procTuple = SearchSysCache1(PROCOID,
ObjectIdGetDatum(wfunc->winfnoid), ObjectIdGetDatum(wfunc->winfnoid));
0, 0, 0);
if (!HeapTupleIsValid(procTuple)) if (!HeapTupleIsValid(procTuple))
elog(ERROR, "cache lookup failed for function %u", elog(ERROR, "cache lookup failed for function %u",
wfunc->winfnoid); wfunc->winfnoid);

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 else
typoid = (SystemAttributeDefinition(fnumber, true))->atttypid; typoid = (SystemAttributeDefinition(fnumber, true))->atttypid;
typeTuple = SearchSysCache(TYPEOID, typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typoid));
ObjectIdGetDatum(typoid),
0, 0, 0);
if (!HeapTupleIsValid(typeTuple)) if (!HeapTupleIsValid(typeTuple))
{ {

View File

@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* *
* IDENTIFICATION * 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; HeapTuple tp;
bool isnull; bool isnull;
tp = SearchSysCache(FOREIGNDATAWRAPPEROID, tp = SearchSysCache1(FOREIGNDATAWRAPPEROID, ObjectIdGetDatum(fdwid));
ObjectIdGetDatum(fdwid),
0, 0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for foreign-data wrapper %u", fdwid); elog(ERROR, "cache lookup failed for foreign-data wrapper %u", fdwid);
@ -84,9 +82,7 @@ GetForeignDataWrapperOidByName(const char *fdwname, bool missing_ok)
{ {
Oid fdwId; Oid fdwId;
fdwId = GetSysCacheOid(FOREIGNDATAWRAPPERNAME, fdwId = GetSysCacheOid1(FOREIGNDATAWRAPPERNAME, CStringGetDatum(fdwname));
CStringGetDatum(fdwname),
0, 0, 0);
if (!OidIsValid(fdwId) && !missing_ok) if (!OidIsValid(fdwId) && !missing_ok)
ereport(ERROR, ereport(ERROR,
@ -125,9 +121,7 @@ GetForeignServer(Oid serverid)
Datum datum; Datum datum;
bool isnull; bool isnull;
tp = SearchSysCache(FOREIGNSERVEROID, tp = SearchSysCache1(FOREIGNSERVEROID, ObjectIdGetDatum(serverid));
ObjectIdGetDatum(serverid),
0, 0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for foreign server %u", serverid); elog(ERROR, "cache lookup failed for foreign server %u", serverid);
@ -177,9 +171,7 @@ GetForeignServerOidByName(const char *srvname, bool missing_ok)
{ {
Oid serverid; Oid serverid;
serverid = GetSysCacheOid(FOREIGNSERVERNAME, serverid = GetSysCacheOid1(FOREIGNSERVERNAME, CStringGetDatum(srvname));
CStringGetDatum(srvname),
0, 0, 0);
if (!OidIsValid(serverid) && !missing_ok) if (!OidIsValid(serverid) && !missing_ok)
ereport(ERROR, ereport(ERROR,
@ -220,18 +212,16 @@ GetUserMapping(Oid userid, Oid serverid)
bool isnull; bool isnull;
UserMapping *um; UserMapping *um;
tp = SearchSysCache(USERMAPPINGUSERSERVER, tp = SearchSysCache2(USERMAPPINGUSERSERVER,
ObjectIdGetDatum(userid), ObjectIdGetDatum(userid),
ObjectIdGetDatum(serverid), ObjectIdGetDatum(serverid));
0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
{ {
/* Not found for the specific user -- try PUBLIC */ /* Not found for the specific user -- try PUBLIC */
tp = SearchSysCache(USERMAPPINGUSERSERVER, tp = SearchSysCache2(USERMAPPINGUSERSERVER,
ObjectIdGetDatum(InvalidOid), ObjectIdGetDatum(InvalidOid),
ObjectIdGetDatum(serverid), ObjectIdGetDatum(serverid));
0, 0);
} }
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))

View File

@ -9,7 +9,7 @@
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * 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; ImmediateInterruptOK = false;
/* Get role info from pg_authid */ /* Get role info from pg_authid */
roleTup = SearchSysCache(AUTHNAME, roleTup = SearchSysCache1(AUTHNAME, PointerGetDatum(role));
PointerGetDatum(role),
0, 0, 0);
if (!HeapTupleIsValid(roleTup)) if (!HeapTupleIsValid(roleTup))
return STATUS_ERROR; /* no such user */ return STATUS_ERROR; /* no such user */

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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; Oid aggsortop;
/* fetch aggregate entry from pg_aggregate */ /* fetch aggregate entry from pg_aggregate */
aggTuple = SearchSysCache(AGGFNOID, aggTuple = SearchSysCache1(AGGFNOID, ObjectIdGetDatum(aggfnoid));
ObjectIdGetDatum(aggfnoid),
0, 0, 0);
if (!HeapTupleIsValid(aggTuple)) if (!HeapTupleIsValid(aggTuple))
return InvalidOid; return InvalidOid;
aggform = (Form_pg_aggregate) GETSTRUCT(aggTuple); aggform = (Form_pg_aggregate) GETSTRUCT(aggTuple);

View File

@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * 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; HeapTuple func_tuple;
PlanInvalItem *inval_item; PlanInvalItem *inval_item;
func_tuple = SearchSysCache(PROCOID, func_tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
ObjectIdGetDatum(funcid),
0, 0, 0);
if (!HeapTupleIsValid(func_tuple)) if (!HeapTupleIsValid(func_tuple))
elog(ERROR, "cache lookup failed for function %u", funcid); elog(ERROR, "cache lookup failed for function %u", funcid);

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * 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) if (list_length(expr->args) != 2)
return false; return false;
/* else must look up the operator properties */ /* else must look up the operator properties */
tup = SearchSysCache(OPEROID, tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(opid));
ObjectIdGetDatum(opid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for operator %u", opid); elog(ERROR, "cache lookup failed for operator %u", opid);
optup = (Form_pg_operator) GETSTRUCT(tup); optup = (Form_pg_operator) GETSTRUCT(tup);

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 * HISTORY
* AUTHOR DATE MAJOR EVENT * AUTHOR DATE MAJOR EVENT
@ -490,9 +490,8 @@ count_agg_clauses_walker(Node *node, AggClauseCounts *counts)
} }
/* fetch aggregate transition datatype from pg_aggregate */ /* fetch aggregate transition datatype from pg_aggregate */
aggTuple = SearchSysCache(AGGFNOID, aggTuple = SearchSysCache1(AGGFNOID,
ObjectIdGetDatum(aggref->aggfnoid), ObjectIdGetDatum(aggref->aggfnoid));
0, 0, 0);
if (!HeapTupleIsValid(aggTuple)) if (!HeapTupleIsValid(aggTuple))
elog(ERROR, "cache lookup failed for aggregate %u", elog(ERROR, "cache lookup failed for aggregate %u",
aggref->aggfnoid); 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 * to the function's pg_proc tuple, so fetch it just once to use in both
* attempts. * attempts.
*/ */
func_tuple = SearchSysCache(PROCOID, func_tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
ObjectIdGetDatum(funcid),
0, 0, 0);
if (!HeapTupleIsValid(func_tuple)) if (!HeapTupleIsValid(func_tuple))
elog(ERROR, "cache lookup failed for function %u", funcid); 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. * OK, let's take a look at the function's pg_proc entry.
*/ */
func_tuple = SearchSysCache(PROCOID, func_tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(func_oid));
ObjectIdGetDatum(func_oid),
0, 0, 0);
if (!HeapTupleIsValid(func_tuple)) if (!HeapTupleIsValid(func_tuple))
elog(ERROR, "cache lookup failed for function %u", func_oid); elog(ERROR, "cache lookup failed for function %u", func_oid);
funcform = (Form_pg_proc) GETSTRUCT(func_tuple); funcform = (Form_pg_proc) GETSTRUCT(func_tuple);

View File

@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * 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 * corresponding test operator. This should work for any logically
* consistent opfamilies. * consistent opfamilies.
*/ */
catlist = SearchSysCacheList(AMOPOPID, 1, catlist = SearchSysCacheList1(AMOPOPID, ObjectIdGetDatum(pred_op));
ObjectIdGetDatum(pred_op),
0, 0, 0);
/* /*
* If we couldn't find any opfamily containing the pred_op, perhaps it is * 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; pred_op_negated = true;
ReleaseSysCacheList(catlist); ReleaseSysCacheList(catlist);
catlist = SearchSysCacheList(AMOPOPID, 1, catlist = SearchSysCacheList1(AMOPOPID,
ObjectIdGetDatum(pred_op_negator), ObjectIdGetDatum(pred_op_negator));
0, 0, 0);
} }
} }
@ -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, * From the same opfamily, find a strategy number for the clause_op,
* if possible * if possible
*/ */
clause_tuple = SearchSysCache(AMOPOPID, clause_tuple = SearchSysCache2(AMOPOPID,
ObjectIdGetDatum(clause_op), ObjectIdGetDatum(clause_op),
ObjectIdGetDatum(opfamily_id), ObjectIdGetDatum(opfamily_id));
0, 0);
if (HeapTupleIsValid(clause_tuple)) if (HeapTupleIsValid(clause_tuple))
{ {
Form_pg_amop clause_form = (Form_pg_amop) GETSTRUCT(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)) else if (OidIsValid(clause_op_negator))
{ {
clause_tuple = SearchSysCache(AMOPOPID, clause_tuple = SearchSysCache2(AMOPOPID,
ObjectIdGetDatum(clause_op_negator), ObjectIdGetDatum(clause_op_negator),
ObjectIdGetDatum(opfamily_id), ObjectIdGetDatum(opfamily_id));
0, 0);
if (HeapTupleIsValid(clause_tuple)) if (HeapTupleIsValid(clause_tuple))
{ {
Form_pg_amop clause_form = (Form_pg_amop) GETSTRUCT(clause_tuple); Form_pg_amop clause_form = (Form_pg_amop) GETSTRUCT(clause_tuple);

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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; HeapTuple tp;
Form_pg_proc procstruct; Form_pg_proc procstruct;
tp = SearchSysCache(PROCOID, tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcId));
ObjectIdGetDatum(funcId),
0, 0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for function %u", funcId); elog(ERROR, "cache lookup failed for function %u", funcId);
procstruct = (Form_pg_proc) GETSTRUCT(tp); procstruct = (Form_pg_proc) GETSTRUCT(tp);
@ -1787,10 +1785,9 @@ IsBinaryCoercible(Oid srctype, Oid targettype)
return true; return true;
/* Else look in pg_cast */ /* Else look in pg_cast */
tuple = SearchSysCache(CASTSOURCETARGET, tuple = SearchSysCache2(CASTSOURCETARGET,
ObjectIdGetDatum(srctype), ObjectIdGetDatum(srctype),
ObjectIdGetDatum(targettype), ObjectIdGetDatum(targettype));
0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
return false; /* no cast */ return false; /* no cast */
castForm = (Form_pg_cast) GETSTRUCT(tuple); castForm = (Form_pg_cast) GETSTRUCT(tuple);
@ -1852,10 +1849,9 @@ find_coercion_pathway(Oid targetTypeId, Oid sourceTypeId,
return COERCION_PATH_RELABELTYPE; return COERCION_PATH_RELABELTYPE;
/* Look in pg_cast */ /* Look in pg_cast */
tuple = SearchSysCache(CASTSOURCETARGET, tuple = SearchSysCache2(CASTSOURCETARGET,
ObjectIdGetDatum(sourceTypeId), ObjectIdGetDatum(sourceTypeId),
ObjectIdGetDatum(targetTypeId), ObjectIdGetDatum(targetTypeId));
0, 0);
if (HeapTupleIsValid(tuple)) if (HeapTupleIsValid(tuple))
{ {
@ -2017,10 +2013,9 @@ find_typmod_coercion_function(Oid typeId,
ReleaseSysCache(targetType); ReleaseSysCache(targetType);
/* Look in pg_cast */ /* Look in pg_cast */
tuple = SearchSysCache(CASTSOURCETARGET, tuple = SearchSysCache2(CASTSOURCETARGET,
ObjectIdGetDatum(typeId), ObjectIdGetDatum(typeId),
ObjectIdGetDatum(typeId), ObjectIdGetDatum(typeId));
0, 0);
if (HeapTupleIsValid(tuple)) if (HeapTupleIsValid(tuple))
{ {

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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, ftup = SearchSysCache1(PROCOID,
ObjectIdGetDatum(best_candidate->oid), ObjectIdGetDatum(best_candidate->oid));
0, 0, 0);
if (!HeapTupleIsValid(ftup)) /* should not happen */ if (!HeapTupleIsValid(ftup)) /* should not happen */
elog(ERROR, "cache lookup failed for function %u", elog(ERROR, "cache lookup failed for function %u",
best_candidate->oid); best_candidate->oid);
@ -1563,9 +1562,7 @@ LookupAggNameTypeNames(List *aggname, List *argtypes, bool noError)
} }
/* Make sure it's an aggregate */ /* Make sure it's an aggregate */
ftup = SearchSysCache(PROCOID, ftup = SearchSysCache1(PROCOID, ObjectIdGetDatum(oid));
ObjectIdGetDatum(oid),
0, 0, 0);
if (!HeapTupleIsValid(ftup)) /* should not happen */ if (!HeapTupleIsValid(ftup)) /* should not happen */
elog(ERROR, "cache lookup failed for function %u", oid); elog(ERROR, "cache lookup failed for function %u", oid);
pform = (Form_pg_proc) GETSTRUCT(ftup); pform = (Form_pg_proc) GETSTRUCT(ftup);

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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; Form_pg_type type_struct_array;
/* Get the type tuple for the array */ /* Get the type tuple for the array */
type_tuple_array = SearchSysCache(TYPEOID, type_tuple_array = SearchSysCache1(TYPEOID, ObjectIdGetDatum(arrayType));
ObjectIdGetDatum(arrayType),
0, 0, 0);
if (!HeapTupleIsValid(type_tuple_array)) if (!HeapTupleIsValid(type_tuple_array))
elog(ERROR, "cache lookup failed for type %u", arrayType); elog(ERROR, "cache lookup failed for type %u", arrayType);
type_struct_array = (Form_pg_type) GETSTRUCT(type_tuple_array); type_struct_array = (Form_pg_type) GETSTRUCT(type_tuple_array);

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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); operOid = find_oper_cache_entry(&key);
if (OidIsValid(operOid)) if (OidIsValid(operOid))
{ {
tup = SearchSysCache(OPEROID, tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operOid));
ObjectIdGetDatum(operOid),
0, 0, 0);
if (HeapTupleIsValid(tup)) if (HeapTupleIsValid(tup))
return (Operator) tup; return (Operator) tup;
} }
@ -463,9 +461,7 @@ oper(ParseState *pstate, List *opname, Oid ltypeId, Oid rtypeId,
} }
if (OidIsValid(operOid)) if (OidIsValid(operOid))
tup = SearchSysCache(OPEROID, tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operOid));
ObjectIdGetDatum(operOid),
0, 0, 0);
if (HeapTupleIsValid(tup)) 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); operOid = find_oper_cache_entry(&key);
if (OidIsValid(operOid)) if (OidIsValid(operOid))
{ {
tup = SearchSysCache(OPEROID, tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operOid));
ObjectIdGetDatum(operOid),
0, 0, 0);
if (HeapTupleIsValid(tup)) if (HeapTupleIsValid(tup))
return (Operator) tup; return (Operator) tup;
} }
@ -605,9 +599,7 @@ right_oper(ParseState *pstate, List *op, Oid arg, bool noError, int location)
} }
if (OidIsValid(operOid)) if (OidIsValid(operOid))
tup = SearchSysCache(OPEROID, tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operOid));
ObjectIdGetDatum(operOid),
0, 0, 0);
if (HeapTupleIsValid(tup)) 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); operOid = find_oper_cache_entry(&key);
if (OidIsValid(operOid)) if (OidIsValid(operOid))
{ {
tup = SearchSysCache(OPEROID, tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operOid));
ObjectIdGetDatum(operOid),
0, 0, 0);
if (HeapTupleIsValid(tup)) if (HeapTupleIsValid(tup))
return (Operator) tup; return (Operator) tup;
} }
@ -699,9 +689,7 @@ left_oper(ParseState *pstate, List *op, Oid arg, bool noError, int location)
} }
if (OidIsValid(operOid)) if (OidIsValid(operOid))
tup = SearchSysCache(OPEROID, tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operOid));
ObjectIdGetDatum(operOid),
0, 0, 0);
if (HeapTupleIsValid(tup)) if (HeapTupleIsValid(tup))
{ {

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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) if (attnum != InvalidAttrNumber)
{ {
/* now check to see if column actually is defined */ /* now check to see if column actually is defined */
if (SearchSysCacheExists(ATTNUM, if (SearchSysCacheExists2(ATTNUM,
ObjectIdGetDatum(rte->relid), ObjectIdGetDatum(rte->relid),
Int16GetDatum(attnum), Int16GetDatum(attnum)))
0, 0))
{ {
var = make_var(pstate, rte, attnum, location); var = make_var(pstate, rte, attnum, location);
/* Require read access to the column */ /* Require read access to the column */
@ -1979,10 +1978,9 @@ get_rte_attribute_type(RangeTblEntry *rte, AttrNumber attnum,
HeapTuple tp; HeapTuple tp;
Form_pg_attribute att_tup; Form_pg_attribute att_tup;
tp = SearchSysCache(ATTNUM, tp = SearchSysCache2(ATTNUM,
ObjectIdGetDatum(rte->relid), ObjectIdGetDatum(rte->relid),
Int16GetDatum(attnum), Int16GetDatum(attnum));
0, 0);
if (!HeapTupleIsValid(tp)) /* shouldn't happen */ if (!HeapTupleIsValid(tp)) /* shouldn't happen */
elog(ERROR, "cache lookup failed for attribute %d of relation %u", elog(ERROR, "cache lookup failed for attribute %d of relation %u",
attnum, rte->relid); attnum, rte->relid);
@ -2133,10 +2131,9 @@ get_rte_attribute_is_dropped(RangeTblEntry *rte, AttrNumber attnum)
HeapTuple tp; HeapTuple tp;
Form_pg_attribute att_tup; Form_pg_attribute att_tup;
tp = SearchSysCache(ATTNUM, tp = SearchSysCache2(ATTNUM,
ObjectIdGetDatum(rte->relid), ObjectIdGetDatum(rte->relid),
Int16GetDatum(attnum), Int16GetDatum(attnum));
0, 0);
if (!HeapTupleIsValid(tp)) /* shouldn't happen */ if (!HeapTupleIsValid(tp)) /* shouldn't happen */
elog(ERROR, "cache lookup failed for attribute %d of relation %u", elog(ERROR, "cache lookup failed for attribute %d of relation %u",
attnum, rte->relid); attnum, rte->relid);
@ -2186,10 +2183,9 @@ get_rte_attribute_is_dropped(RangeTblEntry *rte, AttrNumber attnum)
HeapTuple tp; HeapTuple tp;
Form_pg_attribute att_tup; Form_pg_attribute att_tup;
tp = SearchSysCache(ATTNUM, tp = SearchSysCache2(ATTNUM,
ObjectIdGetDatum(funcrelid), ObjectIdGetDatum(funcrelid),
Int16GetDatum(attnum), Int16GetDatum(attnum));
0, 0);
if (!HeapTupleIsValid(tp)) /* shouldn't happen */ if (!HeapTupleIsValid(tp)) /* shouldn't happen */
elog(ERROR, "cache lookup failed for attribute %d of relation %u", elog(ERROR, "cache lookup failed for attribute %d of relation %u",
attnum, funcrelid); attnum, funcrelid);

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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; Oid namespaceId;
namespaceId = LookupExplicitNamespace(schemaname); namespaceId = LookupExplicitNamespace(schemaname);
typoid = GetSysCacheOid(TYPENAMENSP, typoid = GetSysCacheOid2(TYPENAMENSP,
PointerGetDatum(typname), PointerGetDatum(typname),
ObjectIdGetDatum(namespaceId), ObjectIdGetDatum(namespaceId));
0, 0);
} }
else else
{ {
@ -166,9 +165,7 @@ LookupTypeName(ParseState *pstate, const TypeName *typeName,
return NULL; return NULL;
} }
tup = SearchSysCache(TYPEOID, tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typoid));
ObjectIdGetDatum(typoid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for type %u", typoid); elog(ERROR, "cache lookup failed for type %u", typoid);
@ -423,9 +420,7 @@ typeidType(Oid id)
{ {
HeapTuple tup; HeapTuple tup;
tup = SearchSysCache(TYPEOID, tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(id));
ObjectIdGetDatum(id),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for type %u", id); elog(ERROR, "cache lookup failed for type %u", id);
return (Type) tup; return (Type) tup;
@ -532,9 +527,7 @@ typeidTypeRelid(Oid type_id)
Form_pg_type type; Form_pg_type type;
Oid result; Oid result;
typeTuple = SearchSysCache(TYPEOID, typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type_id));
ObjectIdGetDatum(type_id),
0, 0, 0);
if (!HeapTupleIsValid(typeTuple)) if (!HeapTupleIsValid(typeTuple))
elog(ERROR, "cache lookup failed for type %u", type_id); elog(ERROR, "cache lookup failed for type %u", type_id);

View File

@ -19,7 +19,7 @@
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * 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 * Fetch pg_class tuple of source index. We can't use the copy in the
* relcache entry because it doesn't include optional fields. * relcache entry because it doesn't include optional fields.
*/ */
ht_idxrel = SearchSysCache(RELOID, ht_idxrel = SearchSysCache1(RELOID, ObjectIdGetDatum(source_relid));
ObjectIdGetDatum(source_relid),
0, 0, 0);
if (!HeapTupleIsValid(ht_idxrel)) if (!HeapTupleIsValid(ht_idxrel))
elog(ERROR, "cache lookup failed for relation %u", source_relid); elog(ERROR, "cache lookup failed for relation %u", source_relid);
idxrelrec = (Form_pg_class) GETSTRUCT(ht_idxrel); idxrelrec = (Form_pg_class) GETSTRUCT(ht_idxrel);
@ -943,9 +941,8 @@ generateClonedIndexStmt(CreateStmtContext *cxt, Relation source_idx,
HeapTuple ht_constr; HeapTuple ht_constr;
Form_pg_constraint conrec; Form_pg_constraint conrec;
ht_constr = SearchSysCache(CONSTROID, ht_constr = SearchSysCache1(CONSTROID,
ObjectIdGetDatum(constraintId), ObjectIdGetDatum(constraintId));
0, 0, 0);
if (!HeapTupleIsValid(ht_constr)) if (!HeapTupleIsValid(ht_constr))
elog(ERROR, "cache lookup failed for constraint %u", elog(ERROR, "cache lookup failed for constraint %u",
constraintId); constraintId);
@ -984,9 +981,8 @@ generateClonedIndexStmt(CreateStmtContext *cxt, Relation source_idx,
char *nspname; char *nspname;
List *namelist; List *namelist;
opertup = SearchSysCache(OPEROID, opertup = SearchSysCache1(OPEROID,
ObjectIdGetDatum(operid), ObjectIdGetDatum(operid));
0, 0, 0);
if (!HeapTupleIsValid(opertup)) if (!HeapTupleIsValid(opertup))
elog(ERROR, "cache lookup failed for operator %u", elog(ERROR, "cache lookup failed for operator %u",
operid); operid);
@ -1138,9 +1134,7 @@ get_opclass(Oid opclass, Oid actual_datatype)
Form_pg_opclass opc_rec; Form_pg_opclass opc_rec;
List *result = NIL; List *result = NIL;
ht_opc = SearchSysCache(CLAOID, ht_opc = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclass));
ObjectIdGetDatum(opclass),
0, 0, 0);
if (!HeapTupleIsValid(ht_opc)) if (!HeapTupleIsValid(ht_opc))
elog(ERROR, "cache lookup failed for opclass %u", opclass); elog(ERROR, "cache lookup failed for opclass %u", opclass);
opc_rec = (Form_pg_opclass) GETSTRUCT(ht_opc); opc_rec = (Form_pg_opclass) GETSTRUCT(ht_opc);

View File

@ -55,7 +55,7 @@
* *
* *
* IDENTIFICATION * 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 * zero in template and nonconnectable databases, else the system-wide
* default. * default.
*/ */
tuple = SearchSysCache(DATABASEOID, tuple = SearchSysCache1(DATABASEOID, ObjectIdGetDatum(MyDatabaseId));
ObjectIdGetDatum(MyDatabaseId),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for database %u", MyDatabaseId); elog(ERROR, "cache lookup failed for database %u", MyDatabaseId);
dbForm = (Form_pg_database) GETSTRUCT(tuple); 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); dbentry = pgstat_fetch_stat_dbentry(MyDatabaseId);
/* fetch the relation's relcache entry */ /* fetch the relation's relcache entry */
classTup = SearchSysCacheCopy(RELOID, classTup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relid));
ObjectIdGetDatum(relid),
0, 0, 0);
if (!HeapTupleIsValid(classTup)) if (!HeapTupleIsValid(classTup))
return NULL; return NULL;
classForm = (Form_pg_class) GETSTRUCT(classTup); classForm = (Form_pg_class) GETSTRUCT(classTup);

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 * Check to see if we are replacing an existing tuple
*/ */
oldtup = SearchSysCache(RULERELNAME, oldtup = SearchSysCache2(RULERELNAME,
ObjectIdGetDatum(eventrel_oid), ObjectIdGetDatum(eventrel_oid),
PointerGetDatum(rulname), PointerGetDatum(rulname));
0, 0);
if (HeapTupleIsValid(oldtup)) if (HeapTupleIsValid(oldtup))
{ {
@ -679,10 +678,9 @@ EnableDisableRule(Relation rel, const char *rulename,
* Find the rule tuple to change. * Find the rule tuple to change.
*/ */
pg_rewrite_desc = heap_open(RewriteRelationId, RowExclusiveLock); pg_rewrite_desc = heap_open(RewriteRelationId, RowExclusiveLock);
ruletup = SearchSysCacheCopy(RULERELNAME, ruletup = SearchSysCacheCopy2(RULERELNAME,
ObjectIdGetDatum(owningRel), ObjectIdGetDatum(owningRel),
PointerGetDatum(rulename), PointerGetDatum(rulename));
0, 0);
if (!HeapTupleIsValid(ruletup)) if (!HeapTupleIsValid(ruletup))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
@ -742,10 +740,9 @@ RenameRewriteRule(Oid owningRel, const char *oldName,
pg_rewrite_desc = heap_open(RewriteRelationId, RowExclusiveLock); pg_rewrite_desc = heap_open(RewriteRelationId, RowExclusiveLock);
ruletup = SearchSysCacheCopy(RULERELNAME, ruletup = SearchSysCacheCopy2(RULERELNAME,
ObjectIdGetDatum(owningRel), ObjectIdGetDatum(owningRel),
PointerGetDatum(oldName), PointerGetDatum(oldName));
0, 0);
if (!HeapTupleIsValid(ruletup)) if (!HeapTupleIsValid(ruletup))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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. * Find the tuple for the target rule.
*/ */
tuple = SearchSysCache(RULERELNAME, tuple = SearchSysCache2(RULERELNAME,
ObjectIdGetDatum(owningRel), ObjectIdGetDatum(owningRel),
PointerGetDatum(ruleName), PointerGetDatum(ruleName));
0, 0);
/* /*
* complain if no rule with such name exists * complain if no rule with such name exists

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 bool
IsDefinedRewriteRule(Oid owningRel, const char *ruleName) IsDefinedRewriteRule(Oid owningRel, const char *ruleName)
{ {
return SearchSysCacheExists(RULERELNAME, return SearchSysCacheExists2(RULERELNAME,
ObjectIdGetDatum(owningRel), ObjectIdGetDatum(owningRel),
PointerGetDatum(ruleName), PointerGetDatum(ruleName));
0, 0);
} }
@ -60,9 +59,7 @@ SetRelationRuleStatus(Oid relationId, bool relHasRules,
* Find the tuple to update in pg_class, using syscache for the lookup. * Find the tuple to update in pg_class, using syscache for the lookup.
*/ */
relationRelation = heap_open(RelationRelationId, RowExclusiveLock); relationRelation = heap_open(RelationRelationId, RowExclusiveLock);
tuple = SearchSysCacheCopy(RELOID, tuple = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relationId));
ObjectIdGetDatum(relationId),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", relationId); elog(ERROR, "cache lookup failed for relation %u", relationId);
classForm = (Form_pg_class) GETSTRUCT(tuple); classForm = (Form_pg_class) GETSTRUCT(tuple);

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* This cruft is the server side of PQfn. * 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); fmgr_info(func_id, &fip->flinfo);
func_htp = SearchSysCache(PROCOID, func_htp = SearchSysCache1(PROCOID, ObjectIdGetDatum(func_id));
ObjectIdGetDatum(func_id),
0, 0, 0);
if (!HeapTupleIsValid(func_htp)) if (!HeapTupleIsValid(func_htp))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_FUNCTION), (errcode(ERRCODE_UNDEFINED_FUNCTION),

View File

@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * 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; HeapTuple tuple;
relOid = RangeVarGetRelid(rel, false); relOid = RangeVarGetRelid(rel, false);
tuple = SearchSysCache(RELOID, tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relOid));
ObjectIdGetDatum(relOid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) /* should not happen */ if (!HeapTupleIsValid(tuple)) /* should not happen */
elog(ERROR, "cache lookup failed for relation %u", relOid); elog(ERROR, "cache lookup failed for relation %u", relOid);

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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) if (aip->ai_grantee != ACL_ID_PUBLIC)
{ {
htup = SearchSysCache(AUTHOID, htup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(aip->ai_grantee));
ObjectIdGetDatum(aip->ai_grantee),
0, 0, 0);
if (HeapTupleIsValid(htup)) if (HeapTupleIsValid(htup))
{ {
putid(p, NameStr(((Form_pg_authid) GETSTRUCT(htup))->rolname)); putid(p, NameStr(((Form_pg_authid) GETSTRUCT(htup))->rolname));
@ -629,9 +627,7 @@ aclitemout(PG_FUNCTION_ARGS)
*p++ = '/'; *p++ = '/';
*p = '\0'; *p = '\0';
htup = SearchSysCache(AUTHOID, htup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(aip->ai_grantor));
ObjectIdGetDatum(aip->ai_grantor),
0, 0, 0);
if (HeapTupleIsValid(htup)) if (HeapTupleIsValid(htup))
{ {
putid(p, NameStr(((Form_pg_authid) GETSTRUCT(htup))->rolname)); 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)); roleid = get_roleid_checked(NameStr(*username));
mode = convert_table_priv_string(priv_type_text); mode = convert_table_priv_string(priv_type_text);
if (!SearchSysCacheExists(RELOID, if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(tableoid)))
ObjectIdGetDatum(tableoid),
0, 0, 0))
PG_RETURN_NULL(); PG_RETURN_NULL();
aclresult = pg_class_aclcheck(tableoid, roleid, mode); aclresult = pg_class_aclcheck(tableoid, roleid, mode);
@ -1874,9 +1868,7 @@ has_table_privilege_id(PG_FUNCTION_ARGS)
roleid = GetUserId(); roleid = GetUserId();
mode = convert_table_priv_string(priv_type_text); mode = convert_table_priv_string(priv_type_text);
if (!SearchSysCacheExists(RELOID, if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(tableoid)))
ObjectIdGetDatum(tableoid),
0, 0, 0))
PG_RETURN_NULL(); PG_RETURN_NULL();
aclresult = pg_class_aclcheck(tableoid, roleid, mode); 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); mode = convert_table_priv_string(priv_type_text);
if (!SearchSysCacheExists(RELOID, if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(tableoid)))
ObjectIdGetDatum(tableoid),
0, 0, 0))
PG_RETURN_NULL(); PG_RETURN_NULL();
aclresult = pg_class_aclcheck(tableoid, roleid, mode); 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)); roleid = get_roleid_checked(NameStr(*username));
mode = convert_column_priv_string(priv_type_text); mode = convert_column_priv_string(priv_type_text);
if (!SearchSysCacheExists(RELOID, if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(tableoid)))
ObjectIdGetDatum(tableoid),
0, 0, 0))
PG_RETURN_NULL(); PG_RETURN_NULL();
/* First check at table level, then examine each column if needed */ /* 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(); roleid = GetUserId();
mode = convert_column_priv_string(priv_type_text); mode = convert_column_priv_string(priv_type_text);
if (!SearchSysCacheExists(RELOID, if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(tableoid)))
ObjectIdGetDatum(tableoid),
0, 0, 0))
PG_RETURN_NULL(); PG_RETURN_NULL();
/* First check at table level, then examine each column if needed */ /* 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); mode = convert_column_priv_string(priv_type_text);
if (!SearchSysCacheExists(RELOID, if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(tableoid)))
ObjectIdGetDatum(tableoid),
0, 0, 0))
PG_RETURN_NULL(); PG_RETURN_NULL();
/* First check at table level, then examine each column if needed */ /* 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 * here and there. So if we see the row in the syscache, so will
* pg_class_aclcheck. * pg_class_aclcheck.
*/ */
if (!SearchSysCacheExists(RELOID, if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(tableoid)))
ObjectIdGetDatum(tableoid),
0, 0, 0))
return -1; return -1;
aclresult = pg_class_aclcheck(tableoid, roleid, mode); 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 * check for dropped attribute first, and we rely on the syscache not to
* notice a concurrent drop before pg_attribute_aclcheck fetches the row. * notice a concurrent drop before pg_attribute_aclcheck fetches the row.
*/ */
attTuple = SearchSysCache(ATTNUM, attTuple = SearchSysCache2(ATTNUM,
ObjectIdGetDatum(tableoid), ObjectIdGetDatum(tableoid),
Int16GetDatum(attnum), Int16GetDatum(attnum));
0, 0);
if (!HeapTupleIsValid(attTuple)) if (!HeapTupleIsValid(attTuple))
return -1; return -1;
attributeForm = (Form_pg_attribute) GETSTRUCT(attTuple); attributeForm = (Form_pg_attribute) GETSTRUCT(attTuple);
@ -2893,9 +2874,7 @@ has_database_privilege_name_id(PG_FUNCTION_ARGS)
roleid = get_roleid_checked(NameStr(*username)); roleid = get_roleid_checked(NameStr(*username));
mode = convert_database_priv_string(priv_type_text); mode = convert_database_priv_string(priv_type_text);
if (!SearchSysCacheExists(DATABASEOID, if (!SearchSysCacheExists1(DATABASEOID, ObjectIdGetDatum(databaseoid)))
ObjectIdGetDatum(databaseoid),
0, 0, 0))
PG_RETURN_NULL(); PG_RETURN_NULL();
aclresult = pg_database_aclcheck(databaseoid, roleid, mode); aclresult = pg_database_aclcheck(databaseoid, roleid, mode);
@ -2921,9 +2900,7 @@ has_database_privilege_id(PG_FUNCTION_ARGS)
roleid = GetUserId(); roleid = GetUserId();
mode = convert_database_priv_string(priv_type_text); mode = convert_database_priv_string(priv_type_text);
if (!SearchSysCacheExists(DATABASEOID, if (!SearchSysCacheExists1(DATABASEOID, ObjectIdGetDatum(databaseoid)))
ObjectIdGetDatum(databaseoid),
0, 0, 0))
PG_RETURN_NULL(); PG_RETURN_NULL();
aclresult = pg_database_aclcheck(databaseoid, roleid, mode); 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); mode = convert_database_priv_string(priv_type_text);
if (!SearchSysCacheExists(DATABASEOID, if (!SearchSysCacheExists1(DATABASEOID, ObjectIdGetDatum(databaseoid)))
ObjectIdGetDatum(databaseoid),
0, 0, 0))
PG_RETURN_NULL(); PG_RETURN_NULL();
aclresult = pg_database_aclcheck(databaseoid, roleid, mode); 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)); roleid = get_roleid_checked(NameStr(*username));
mode = convert_function_priv_string(priv_type_text); mode = convert_function_priv_string(priv_type_text);
if (!SearchSysCacheExists(PROCOID, if (!SearchSysCacheExists1(PROCOID, ObjectIdGetDatum(functionoid)))
ObjectIdGetDatum(functionoid),
0, 0, 0))
PG_RETURN_NULL(); PG_RETURN_NULL();
aclresult = pg_proc_aclcheck(functionoid, roleid, mode); aclresult = pg_proc_aclcheck(functionoid, roleid, mode);
@ -3314,9 +3287,7 @@ has_function_privilege_id(PG_FUNCTION_ARGS)
roleid = GetUserId(); roleid = GetUserId();
mode = convert_function_priv_string(priv_type_text); mode = convert_function_priv_string(priv_type_text);
if (!SearchSysCacheExists(PROCOID, if (!SearchSysCacheExists1(PROCOID, ObjectIdGetDatum(functionoid)))
ObjectIdGetDatum(functionoid),
0, 0, 0))
PG_RETURN_NULL(); PG_RETURN_NULL();
aclresult = pg_proc_aclcheck(functionoid, roleid, mode); 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); mode = convert_function_priv_string(priv_type_text);
if (!SearchSysCacheExists(PROCOID, if (!SearchSysCacheExists1(PROCOID, ObjectIdGetDatum(functionoid)))
ObjectIdGetDatum(functionoid),
0, 0, 0))
PG_RETURN_NULL(); PG_RETURN_NULL();
aclresult = pg_proc_aclcheck(functionoid, roleid, mode); 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)); roleid = get_roleid_checked(NameStr(*username));
mode = convert_language_priv_string(priv_type_text); mode = convert_language_priv_string(priv_type_text);
if (!SearchSysCacheExists(LANGOID, if (!SearchSysCacheExists1(LANGOID, ObjectIdGetDatum(languageoid)))
ObjectIdGetDatum(languageoid),
0, 0, 0))
PG_RETURN_NULL(); PG_RETURN_NULL();
aclresult = pg_language_aclcheck(languageoid, roleid, mode); aclresult = pg_language_aclcheck(languageoid, roleid, mode);
@ -3520,9 +3487,7 @@ has_language_privilege_id(PG_FUNCTION_ARGS)
roleid = GetUserId(); roleid = GetUserId();
mode = convert_language_priv_string(priv_type_text); mode = convert_language_priv_string(priv_type_text);
if (!SearchSysCacheExists(LANGOID, if (!SearchSysCacheExists1(LANGOID, ObjectIdGetDatum(languageoid)))
ObjectIdGetDatum(languageoid),
0, 0, 0))
PG_RETURN_NULL(); PG_RETURN_NULL();
aclresult = pg_language_aclcheck(languageoid, roleid, mode); 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); mode = convert_language_priv_string(priv_type_text);
if (!SearchSysCacheExists(LANGOID, if (!SearchSysCacheExists1(LANGOID, ObjectIdGetDatum(languageoid)))
ObjectIdGetDatum(languageoid),
0, 0, 0))
PG_RETURN_NULL(); PG_RETURN_NULL();
aclresult = pg_language_aclcheck(languageoid, roleid, mode); aclresult = pg_language_aclcheck(languageoid, roleid, mode);
@ -3592,9 +3555,7 @@ convert_language_name(text *languagename)
char *langname = text_to_cstring(languagename); char *langname = text_to_cstring(languagename);
Oid oid; Oid oid;
oid = GetSysCacheOid(LANGNAME, oid = GetSysCacheOid1(LANGNAME, CStringGetDatum(langname));
CStringGetDatum(langname),
0, 0, 0);
if (!OidIsValid(oid)) if (!OidIsValid(oid))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
@ -3698,9 +3659,7 @@ has_schema_privilege_name_id(PG_FUNCTION_ARGS)
roleid = get_roleid_checked(NameStr(*username)); roleid = get_roleid_checked(NameStr(*username));
mode = convert_schema_priv_string(priv_type_text); mode = convert_schema_priv_string(priv_type_text);
if (!SearchSysCacheExists(NAMESPACEOID, if (!SearchSysCacheExists1(NAMESPACEOID, ObjectIdGetDatum(schemaoid)))
ObjectIdGetDatum(schemaoid),
0, 0, 0))
PG_RETURN_NULL(); PG_RETURN_NULL();
aclresult = pg_namespace_aclcheck(schemaoid, roleid, mode); aclresult = pg_namespace_aclcheck(schemaoid, roleid, mode);
@ -3726,9 +3685,7 @@ has_schema_privilege_id(PG_FUNCTION_ARGS)
roleid = GetUserId(); roleid = GetUserId();
mode = convert_schema_priv_string(priv_type_text); mode = convert_schema_priv_string(priv_type_text);
if (!SearchSysCacheExists(NAMESPACEOID, if (!SearchSysCacheExists1(NAMESPACEOID, ObjectIdGetDatum(schemaoid)))
ObjectIdGetDatum(schemaoid),
0, 0, 0))
PG_RETURN_NULL(); PG_RETURN_NULL();
aclresult = pg_namespace_aclcheck(schemaoid, roleid, mode); 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); mode = convert_schema_priv_string(priv_type_text);
if (!SearchSysCacheExists(NAMESPACEOID, if (!SearchSysCacheExists1(NAMESPACEOID, ObjectIdGetDatum(schemaoid)))
ObjectIdGetDatum(schemaoid),
0, 0, 0))
PG_RETURN_NULL(); PG_RETURN_NULL();
aclresult = pg_namespace_aclcheck(schemaoid, roleid, mode); aclresult = pg_namespace_aclcheck(schemaoid, roleid, mode);
@ -3798,9 +3753,7 @@ convert_schema_name(text *schemaname)
char *nspname = text_to_cstring(schemaname); char *nspname = text_to_cstring(schemaname);
Oid oid; Oid oid;
oid = GetSysCacheOid(NAMESPACENAME, oid = GetSysCacheOid1(NAMESPACENAME, CStringGetDatum(nspname));
CStringGetDatum(nspname),
0, 0, 0);
if (!OidIsValid(oid)) if (!OidIsValid(oid))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_SCHEMA), (errcode(ERRCODE_UNDEFINED_SCHEMA),
@ -4443,9 +4396,7 @@ has_rolinherit(Oid roleid)
bool result = false; bool result = false;
HeapTuple utup; HeapTuple utup;
utup = SearchSysCache(AUTHOID, utup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid));
ObjectIdGetDatum(roleid),
0, 0, 0);
if (HeapTupleIsValid(utup)) if (HeapTupleIsValid(utup))
{ {
result = ((Form_pg_authid) GETSTRUCT(utup))->rolinherit; result = ((Form_pg_authid) GETSTRUCT(utup))->rolinherit;
@ -4505,9 +4456,8 @@ roles_has_privs_of(Oid roleid)
continue; continue;
/* Find roles that memberid is directly a member of */ /* Find roles that memberid is directly a member of */
memlist = SearchSysCacheList(AUTHMEMMEMROLE, 1, memlist = SearchSysCacheList1(AUTHMEMMEMROLE,
ObjectIdGetDatum(memberid), ObjectIdGetDatum(memberid));
0, 0, 0);
for (i = 0; i < memlist->n_members; i++) for (i = 0; i < memlist->n_members; i++)
{ {
HeapTuple tup = &memlist->members[i]->tuple; HeapTuple tup = &memlist->members[i]->tuple;
@ -4585,9 +4535,8 @@ roles_is_member_of(Oid roleid)
int i; int i;
/* Find roles that memberid is directly a member of */ /* Find roles that memberid is directly a member of */
memlist = SearchSysCacheList(AUTHMEMMEMROLE, 1, memlist = SearchSysCacheList1(AUTHMEMMEMROLE,
ObjectIdGetDatum(memberid), ObjectIdGetDatum(memberid));
0, 0, 0);
for (i = 0; i < memlist->n_members; i++) for (i = 0; i < memlist->n_members; i++)
{ {
HeapTuple tup = &memlist->members[i]->tuple; HeapTuple tup = &memlist->members[i]->tuple;
@ -4744,9 +4693,8 @@ is_admin_of_role(Oid member, Oid role)
int i; int i;
/* Find roles that memberid is directly a member of */ /* Find roles that memberid is directly a member of */
memlist = SearchSysCacheList(AUTHMEMMEMROLE, 1, memlist = SearchSysCacheList1(AUTHMEMMEMROLE,
ObjectIdGetDatum(memberid), ObjectIdGetDatum(memberid));
0, 0, 0);
for (i = 0; i < memlist->n_members; i++) for (i = 0; i < memlist->n_members; i++)
{ {
HeapTuple tup = &memlist->members[i]->tuple; HeapTuple tup = &memlist->members[i]->tuple;

View File

@ -5,7 +5,7 @@
* Copyright (c) 2002-2010, PostgreSQL Global Development Group * Copyright (c) 2002-2010, PostgreSQL Global Development Group
* *
* IDENTIFICATION * 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; HeapTuple tuple;
Form_pg_class relform; Form_pg_class relform;
tuple = SearchSysCache(RELOID, tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
ObjectIdGetDatum(relid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
PG_RETURN_NULL(); PG_RETURN_NULL();
relform = (Form_pg_class) GETSTRUCT(tuple); relform = (Form_pg_class) GETSTRUCT(tuple);
@ -580,9 +578,7 @@ pg_relation_filepath(PG_FUNCTION_ARGS)
RelFileNode rnode; RelFileNode rnode;
char *path; char *path;
tuple = SearchSysCache(RELOID, tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
ObjectIdGetDatum(relid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
PG_RETURN_NULL(); PG_RETURN_NULL();
relform = (Form_pg_class) GETSTRUCT(tuple); relform = (Form_pg_class) GETSTRUCT(tuple);

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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), format_type_be(enumtypoid),
name))); name)));
tup = SearchSysCache(ENUMTYPOIDNAME, tup = SearchSysCache2(ENUMTYPOIDNAME,
ObjectIdGetDatum(enumtypoid), ObjectIdGetDatum(enumtypoid),
CStringGetDatum(name), CStringGetDatum(name));
0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
@ -75,9 +74,7 @@ enum_out(PG_FUNCTION_ARGS)
HeapTuple tup; HeapTuple tup;
Form_pg_enum en; Form_pg_enum en;
tup = SearchSysCache(ENUMOID, tup = SearchSysCache1(ENUMOID, ObjectIdGetDatum(enumval));
ObjectIdGetDatum(enumval),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_BINARY_REPRESENTATION), (errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
@ -113,10 +110,9 @@ enum_recv(PG_FUNCTION_ARGS)
format_type_be(enumtypoid), format_type_be(enumtypoid),
name))); name)));
tup = SearchSysCache(ENUMTYPOIDNAME, tup = SearchSysCache2(ENUMTYPOIDNAME,
ObjectIdGetDatum(enumtypoid), ObjectIdGetDatum(enumtypoid),
CStringGetDatum(name), CStringGetDatum(name));
0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
@ -141,9 +137,7 @@ enum_send(PG_FUNCTION_ARGS)
HeapTuple tup; HeapTuple tup;
Form_pg_enum en; Form_pg_enum en;
tup = SearchSysCache(ENUMOID, tup = SearchSysCache1(ENUMOID, ObjectIdGetDatum(enumval));
ObjectIdGetDatum(enumval),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_BINARY_REPRESENTATION), (errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
@ -269,9 +263,7 @@ enum_first(PG_FUNCTION_ARGS)
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("could not determine actual enum type"))); errmsg("could not determine actual enum type")));
list = SearchSysCacheList(ENUMTYPOIDNAME, 1, list = SearchSysCacheList1(ENUMTYPOIDNAME, ObjectIdGetDatum(enumtypoid));
ObjectIdGetDatum(enumtypoid),
0, 0, 0);
num = list->n_members; num = list->n_members;
for (i = 0; i < num; i++) for (i = 0; i < num; i++)
{ {
@ -310,9 +302,7 @@ enum_last(PG_FUNCTION_ARGS)
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("could not determine actual enum type"))); errmsg("could not determine actual enum type")));
list = SearchSysCacheList(ENUMTYPOIDNAME, 1, list = SearchSysCacheList1(ENUMTYPOIDNAME, ObjectIdGetDatum(enumtypoid));
ObjectIdGetDatum(enumtypoid),
0, 0, 0);
num = list->n_members; num = list->n_members;
for (i = 0; i < num; i++) for (i = 0; i < num; i++)
{ {
@ -393,9 +383,7 @@ enum_range_internal(Oid enumtypoid, Oid lower, Oid upper)
j; j;
Datum *elems; Datum *elems;
list = SearchSysCacheList(ENUMTYPOIDNAME, 1, list = SearchSysCacheList1(ENUMTYPOIDNAME, ObjectIdGetDatum(enumtypoid));
ObjectIdGetDatum(enumtypoid),
0, 0, 0);
total = list->n_members; total = list->n_members;
elems = (Datum *) palloc(total * sizeof(Datum)); elems = (Datum *) palloc(total * sizeof(Datum));

View File

@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * 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) if (type_oid == InvalidOid && allow_invalid)
return pstrdup("-"); return pstrdup("-");
tuple = SearchSysCache(TYPEOID, tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type_oid));
ObjectIdGetDatum(type_oid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
{ {
if (allow_invalid) if (allow_invalid)
@ -151,9 +149,7 @@ format_type_internal(Oid type_oid, int32 typemod,
{ {
/* Switch our attention to the array element type */ /* Switch our attention to the array element type */
ReleaseSysCache(tuple); ReleaseSysCache(tuple);
tuple = SearchSysCache(TYPEOID, tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(array_base_type));
ObjectIdGetDatum(array_base_type),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
{ {
if (allow_invalid) if (allow_invalid)

View File

@ -13,7 +13,7 @@
* *
* *
* IDENTIFICATION * 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); PG_RETURN_CSTRING(result);
} }
proctup = SearchSysCache(PROCOID, proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(proid));
ObjectIdGetDatum(proid),
0, 0, 0);
if (HeapTupleIsValid(proctup)) if (HeapTupleIsValid(proctup))
{ {
@ -307,9 +305,7 @@ format_procedure(Oid procedure_oid)
char *result; char *result;
HeapTuple proctup; HeapTuple proctup;
proctup = SearchSysCache(PROCOID, proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(procedure_oid));
ObjectIdGetDatum(procedure_oid),
0, 0, 0);
if (HeapTupleIsValid(proctup)) if (HeapTupleIsValid(proctup))
{ {
@ -513,9 +509,7 @@ regoperout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result); PG_RETURN_CSTRING(result);
} }
opertup = SearchSysCache(OPEROID, opertup = SearchSysCache1(OPEROID, ObjectIdGetDatum(oprid));
ObjectIdGetDatum(oprid),
0, 0, 0);
if (HeapTupleIsValid(opertup)) if (HeapTupleIsValid(opertup))
{ {
@ -663,9 +657,7 @@ format_operator(Oid operator_oid)
char *result; char *result;
HeapTuple opertup; HeapTuple opertup;
opertup = SearchSysCache(OPEROID, opertup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operator_oid));
ObjectIdGetDatum(operator_oid),
0, 0, 0);
if (HeapTupleIsValid(opertup)) if (HeapTupleIsValid(opertup))
{ {
@ -852,9 +844,7 @@ regclassout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result); PG_RETURN_CSTRING(result);
} }
classtup = SearchSysCache(RELOID, classtup = SearchSysCache1(RELOID, ObjectIdGetDatum(classid));
ObjectIdGetDatum(classid),
0, 0, 0);
if (HeapTupleIsValid(classtup)) if (HeapTupleIsValid(classtup))
{ {
@ -1015,9 +1005,7 @@ regtypeout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result); PG_RETURN_CSTRING(result);
} }
typetup = SearchSysCache(TYPEOID, typetup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
ObjectIdGetDatum(typid),
0, 0, 0);
if (HeapTupleIsValid(typetup)) if (HeapTupleIsValid(typetup))
{ {
@ -1129,9 +1117,7 @@ regconfigout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result); PG_RETURN_CSTRING(result);
} }
cfgtup = SearchSysCache(TSCONFIGOID, cfgtup = SearchSysCache1(TSCONFIGOID, ObjectIdGetDatum(cfgid));
ObjectIdGetDatum(cfgid),
0, 0, 0);
if (HeapTupleIsValid(cfgtup)) if (HeapTupleIsValid(cfgtup))
{ {
@ -1241,9 +1227,7 @@ regdictionaryout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result); PG_RETURN_CSTRING(result);
} }
dicttup = SearchSysCache(TSDICTOID, dicttup = SearchSysCache1(TSDICTOID, ObjectIdGetDatum(dictid));
ObjectIdGetDatum(dictid),
0, 0, 0);
if (HeapTupleIsValid(dicttup)) if (HeapTupleIsValid(dicttup))
{ {

View File

@ -15,7 +15,7 @@
* *
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * 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 *oprname;
char *nspname; char *nspname;
opertup = SearchSysCache(OPEROID, opertup = SearchSysCache1(OPEROID, ObjectIdGetDatum(opoid));
ObjectIdGetDatum(opoid),
0, 0, 0);
if (!HeapTupleIsValid(opertup)) if (!HeapTupleIsValid(opertup))
elog(ERROR, "cache lookup failed for operator %u", opoid); elog(ERROR, "cache lookup failed for operator %u", opoid);
operform = (Form_pg_operator) GETSTRUCT(opertup); operform = (Form_pg_operator) GETSTRUCT(opertup);
@ -2940,9 +2938,7 @@ ri_add_cast_to(StringInfo buf, Oid typid)
char *typname; char *typname;
char *nspname; char *nspname;
typetup = SearchSysCache(TYPEOID, typetup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
ObjectIdGetDatum(typid),
0, 0, 0);
if (!HeapTupleIsValid(typetup)) if (!HeapTupleIsValid(typetup))
elog(ERROR, "cache lookup failed for type %u", typid); elog(ERROR, "cache lookup failed for type %u", typid);
typform = (Form_pg_type) GETSTRUCT(typetup); 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."))); errhint("Remove this referential integrity trigger and its mates, then do ALTER TABLE ADD CONSTRAINT.")));
/* OK, fetch the tuple */ /* OK, fetch the tuple */
tup = SearchSysCache(CONSTROID, tup = SearchSysCache1(CONSTROID, ObjectIdGetDatum(constraintOid));
ObjectIdGetDatum(constraintOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for constraint %u", constraintOid); elog(ERROR, "cache lookup failed for constraint %u", constraintOid);
conForm = (Form_pg_constraint) GETSTRUCT(tup); conForm = (Form_pg_constraint) GETSTRUCT(tup);

View File

@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * 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 * Fetch the pg_index tuple by the Oid of the index
*/ */
ht_idx = SearchSysCache(INDEXRELID, ht_idx = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexrelid));
ObjectIdGetDatum(indexrelid),
0, 0, 0);
if (!HeapTupleIsValid(ht_idx)) if (!HeapTupleIsValid(ht_idx))
elog(ERROR, "cache lookup failed for index %u", indexrelid); elog(ERROR, "cache lookup failed for index %u", indexrelid);
idxrec = (Form_pg_index) GETSTRUCT(ht_idx); 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 * Fetch the pg_class tuple of the index relation
*/ */
ht_idxrel = SearchSysCache(RELOID, ht_idxrel = SearchSysCache1(RELOID, ObjectIdGetDatum(indexrelid));
ObjectIdGetDatum(indexrelid),
0, 0, 0);
if (!HeapTupleIsValid(ht_idxrel)) if (!HeapTupleIsValid(ht_idxrel))
elog(ERROR, "cache lookup failed for relation %u", indexrelid); elog(ERROR, "cache lookup failed for relation %u", indexrelid);
idxrelrec = (Form_pg_class) GETSTRUCT(ht_idxrel); 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 * Fetch the pg_am tuple of the index' access method
*/ */
ht_am = SearchSysCache(AMOID, ht_am = SearchSysCache1(AMOID, ObjectIdGetDatum(idxrelrec->relam));
ObjectIdGetDatum(idxrelrec->relam),
0, 0, 0);
if (!HeapTupleIsValid(ht_am)) if (!HeapTupleIsValid(ht_am))
elog(ERROR, "cache lookup failed for access method %u", elog(ERROR, "cache lookup failed for access method %u",
idxrelrec->relam); idxrelrec->relam);
@ -1048,9 +1042,7 @@ pg_get_constraintdef_worker(Oid constraintId, bool fullCommand,
Form_pg_constraint conForm; Form_pg_constraint conForm;
StringInfoData buf; StringInfoData buf;
tup = SearchSysCache(CONSTROID, tup = SearchSysCache1(CONSTROID, ObjectIdGetDatum(constraintId));
ObjectIdGetDatum(constraintId),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for constraint %u", constraintId); elog(ERROR, "cache lookup failed for constraint %u", constraintId);
conForm = (Form_pg_constraint) GETSTRUCT(tup); 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 * Get the pg_authid entry and print the result
*/ */
roletup = SearchSysCache(AUTHOID, roletup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid));
ObjectIdGetDatum(roleid),
0, 0, 0);
if (HeapTupleIsValid(roletup)) if (HeapTupleIsValid(roletup))
{ {
role_rec = (Form_pg_authid) GETSTRUCT(roletup); role_rec = (Form_pg_authid) GETSTRUCT(roletup);
@ -1581,9 +1571,7 @@ pg_get_serial_sequence(PG_FUNCTION_ARGS)
char *result; char *result;
/* Get the sequence's pg_class entry */ /* Get the sequence's pg_class entry */
classtup = SearchSysCache(RELOID, classtup = SearchSysCache1(RELOID, ObjectIdGetDatum(sequenceId));
ObjectIdGetDatum(sequenceId),
0, 0, 0);
if (!HeapTupleIsValid(classtup)) if (!HeapTupleIsValid(classtup))
elog(ERROR, "cache lookup failed for relation %u", sequenceId); elog(ERROR, "cache lookup failed for relation %u", sequenceId);
classtuple = (Form_pg_class) GETSTRUCT(classtup); classtuple = (Form_pg_class) GETSTRUCT(classtup);
@ -1633,9 +1621,7 @@ pg_get_functiondef(PG_FUNCTION_ARGS)
initStringInfo(&buf); initStringInfo(&buf);
/* Look up the function */ /* Look up the function */
proctup = SearchSysCache(PROCOID, proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
ObjectIdGetDatum(funcid),
0, 0, 0);
if (!HeapTupleIsValid(proctup)) if (!HeapTupleIsValid(proctup))
elog(ERROR, "cache lookup failed for function %u", funcid); elog(ERROR, "cache lookup failed for function %u", funcid);
proc = (Form_pg_proc) GETSTRUCT(proctup); proc = (Form_pg_proc) GETSTRUCT(proctup);
@ -1647,9 +1633,7 @@ pg_get_functiondef(PG_FUNCTION_ARGS)
errmsg("\"%s\" is an aggregate function", name))); errmsg("\"%s\" is an aggregate function", name)));
/* Need its pg_language tuple for the language name */ /* Need its pg_language tuple for the language name */
langtup = SearchSysCache(LANGOID, langtup = SearchSysCache1(LANGOID, ObjectIdGetDatum(proc->prolang));
ObjectIdGetDatum(proc->prolang),
0, 0, 0);
if (!HeapTupleIsValid(langtup)) if (!HeapTupleIsValid(langtup))
elog(ERROR, "cache lookup failed for language %u", proc->prolang); elog(ERROR, "cache lookup failed for language %u", proc->prolang);
lang = (Form_pg_language) GETSTRUCT(langtup); lang = (Form_pg_language) GETSTRUCT(langtup);
@ -1806,9 +1790,7 @@ pg_get_function_arguments(PG_FUNCTION_ARGS)
initStringInfo(&buf); initStringInfo(&buf);
proctup = SearchSysCache(PROCOID, proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
ObjectIdGetDatum(funcid),
0, 0, 0);
if (!HeapTupleIsValid(proctup)) if (!HeapTupleIsValid(proctup))
elog(ERROR, "cache lookup failed for function %u", funcid); elog(ERROR, "cache lookup failed for function %u", funcid);
@ -1834,9 +1816,7 @@ pg_get_function_identity_arguments(PG_FUNCTION_ARGS)
initStringInfo(&buf); initStringInfo(&buf);
proctup = SearchSysCache(PROCOID, proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
ObjectIdGetDatum(funcid),
0, 0, 0);
if (!HeapTupleIsValid(proctup)) if (!HeapTupleIsValid(proctup))
elog(ERROR, "cache lookup failed for function %u", funcid); elog(ERROR, "cache lookup failed for function %u", funcid);
@ -1861,9 +1841,7 @@ pg_get_function_result(PG_FUNCTION_ARGS)
initStringInfo(&buf); initStringInfo(&buf);
proctup = SearchSysCache(PROCOID, proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
ObjectIdGetDatum(funcid),
0, 0, 0);
if (!HeapTupleIsValid(proctup)) if (!HeapTupleIsValid(proctup))
elog(ERROR, "cache lookup failed for function %u", funcid); elog(ERROR, "cache lookup failed for function %u", funcid);
@ -5342,9 +5320,7 @@ get_oper_expr(OpExpr *expr, deparse_context *context)
HeapTuple tp; HeapTuple tp;
Form_pg_operator optup; Form_pg_operator optup;
tp = SearchSysCache(OPEROID, tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
ObjectIdGetDatum(opno),
0, 0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for operator %u", opno); elog(ERROR, "cache lookup failed for operator %u", opno);
optup = (Form_pg_operator) GETSTRUCT(tp); optup = (Form_pg_operator) GETSTRUCT(tp);
@ -6273,9 +6249,7 @@ get_opclass_name(Oid opclass, Oid actual_datatype,
char *opcname; char *opcname;
char *nspname; char *nspname;
ht_opc = SearchSysCache(CLAOID, ht_opc = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclass));
ObjectIdGetDatum(opclass),
0, 0, 0);
if (!HeapTupleIsValid(ht_opc)) if (!HeapTupleIsValid(ht_opc))
elog(ERROR, "cache lookup failed for opclass %u", opclass); elog(ERROR, "cache lookup failed for opclass %u", opclass);
opcrec = (Form_pg_opclass) GETSTRUCT(ht_opc); opcrec = (Form_pg_opclass) GETSTRUCT(ht_opc);
@ -6512,9 +6486,7 @@ generate_relation_name(Oid relid, List *namespaces)
char *nspname; char *nspname;
char *result; char *result;
tp = SearchSysCache(RELOID, tp = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
ObjectIdGetDatum(relid),
0, 0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for relation %u", relid); elog(ERROR, "cache lookup failed for relation %u", relid);
reltup = (Form_pg_class) GETSTRUCT(tp); reltup = (Form_pg_class) GETSTRUCT(tp);
@ -6582,9 +6554,7 @@ generate_function_name(Oid funcid, int nargs, List *argnames,
int p_nvargs; int p_nvargs;
Oid *p_true_typeids; Oid *p_true_typeids;
proctup = SearchSysCache(PROCOID, proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
ObjectIdGetDatum(funcid),
0, 0, 0);
if (!HeapTupleIsValid(proctup)) if (!HeapTupleIsValid(proctup))
elog(ERROR, "cache lookup failed for function %u", funcid); elog(ERROR, "cache lookup failed for function %u", funcid);
procform = (Form_pg_proc) GETSTRUCT(proctup); procform = (Form_pg_proc) GETSTRUCT(proctup);
@ -6650,9 +6620,7 @@ generate_operator_name(Oid operid, Oid arg1, Oid arg2)
initStringInfo(&buf); initStringInfo(&buf);
opertup = SearchSysCache(OPEROID, opertup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operid));
ObjectIdGetDatum(operid),
0, 0, 0);
if (!HeapTupleIsValid(opertup)) if (!HeapTupleIsValid(opertup))
elog(ERROR, "cache lookup failed for operator %u", operid); elog(ERROR, "cache lookup failed for operator %u", operid);
operform = (Form_pg_operator) GETSTRUCT(opertup); operform = (Form_pg_operator) GETSTRUCT(opertup);
@ -6730,9 +6698,7 @@ flatten_reloptions(Oid relid)
Datum reloptions; Datum reloptions;
bool isnull; bool isnull;
tuple = SearchSysCache(RELOID, tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
ObjectIdGetDatum(relid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", relid); elog(ERROR, "cache lookup failed for relation %u", relid);

View File

@ -15,7 +15,7 @@
* *
* *
* IDENTIFICATION * 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) else if (rte->rtekind == RTE_RELATION)
{ {
vardata->statsTuple = SearchSysCache(STATRELATTINH, vardata->statsTuple = SearchSysCache3(STATRELATTINH,
ObjectIdGetDatum(rte->relid), ObjectIdGetDatum(rte->relid),
Int16GetDatum(var->varattno), Int16GetDatum(var->varattno),
BoolGetDatum(rte->inh), BoolGetDatum(rte->inh));
0);
vardata->freefunc = ReleaseSysCache; vardata->freefunc = ReleaseSysCache;
} }
else else
@ -4258,11 +4257,10 @@ examine_variable(PlannerInfo *root, Node *node, int varRelid,
else if (index->indpred == NIL) else if (index->indpred == NIL)
{ {
vardata->statsTuple = vardata->statsTuple =
SearchSysCache(STATRELATTINH, SearchSysCache3(STATRELATTINH,
ObjectIdGetDatum(index->indexoid), ObjectIdGetDatum(index->indexoid),
Int16GetDatum(pos + 1), Int16GetDatum(pos + 1),
BoolGetDatum(false), BoolGetDatum(false));
0);
vardata->freefunc = ReleaseSysCache; vardata->freefunc = ReleaseSysCache;
} }
if (vardata->statsTuple) if (vardata->statsTuple)
@ -6116,11 +6114,10 @@ btcostestimate(PG_FUNCTION_ARGS)
} }
else else
{ {
vardata.statsTuple = SearchSysCache(STATRELATTINH, vardata.statsTuple = SearchSysCache3(STATRELATTINH,
ObjectIdGetDatum(relid), ObjectIdGetDatum(relid),
Int16GetDatum(colnum), Int16GetDatum(colnum),
BoolGetDatum(rte->inh), BoolGetDatum(rte->inh));
0);
vardata.freefunc = ReleaseSysCache; vardata.freefunc = ReleaseSysCache;
} }
} }
@ -6143,11 +6140,10 @@ btcostestimate(PG_FUNCTION_ARGS)
} }
else else
{ {
vardata.statsTuple = SearchSysCache(STATRELATTINH, vardata.statsTuple = SearchSysCache3(STATRELATTINH,
ObjectIdGetDatum(relid), ObjectIdGetDatum(relid),
Int16GetDatum(colnum), Int16GetDatum(colnum),
BoolGetDatum(false), BoolGetDatum(false));
0);
vardata.freefunc = ReleaseSysCache; vardata.freefunc = ReleaseSysCache;
} }
} }

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * 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; HeapTuple tuple;
Form_pg_class reltuple; Form_pg_class reltuple;
tuple = SearchSysCache(RELOID, tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
ObjectIdGetDatum(relid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", relid); elog(ERROR, "cache lookup failed for relation %u", relid);
reltuple = (Form_pg_class) GETSTRUCT(tuple); reltuple = (Form_pg_class) GETSTRUCT(tuple);
@ -2912,9 +2910,7 @@ map_sql_type_to_xml_name(Oid typeoid, int typmod)
HeapTuple tuple; HeapTuple tuple;
Form_pg_type typtuple; Form_pg_type typtuple;
tuple = SearchSysCache(TYPEOID, tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typeoid));
ObjectIdGetDatum(typeoid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for type %u", typeoid); elog(ERROR, "cache lookup failed for type %u", typeoid);
typtuple = (Form_pg_type) GETSTRUCT(tuple); typtuple = (Form_pg_type) GETSTRUCT(tuple);

View File

@ -10,7 +10,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * 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; AttributeOpts *opts;
tp = SearchSysCache(ATTNUM, tp = SearchSysCache2(ATTNUM,
ObjectIdGetDatum(attrelid), ObjectIdGetDatum(attrelid),
Int16GetDatum(attnum), Int16GetDatum(attnum));
0, 0);
/* /*
* If we don't find a valid HeapTuple, it must mean someone has * If we don't find a valid HeapTuple, it must mean someone has

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 static uint32
CatalogCacheComputeTupleHashValue(CatCache *cache, HeapTuple tuple) CatalogCacheComputeTupleHashValue(CatCache *cache, HeapTuple tuple)
{ {
ScanKeyData cur_skey[4]; ScanKeyData cur_skey[CATCACHE_MAXKEYS];
bool isNull = false; bool isNull = false;
/* Copy pre-initialized overhead data for scankey */ /* Copy pre-initialized overhead data for scankey */
@ -1038,7 +1038,7 @@ SearchCatCache(CatCache *cache,
Datum v3, Datum v3,
Datum v4) Datum v4)
{ {
ScanKeyData cur_skey[4]; ScanKeyData cur_skey[CATCACHE_MAXKEYS];
uint32 hashValue; uint32 hashValue;
Index hashIndex; Index hashIndex;
Dlelem *elt; Dlelem *elt;
@ -1279,7 +1279,7 @@ SearchCatCacheList(CatCache *cache,
Datum v3, Datum v3,
Datum v4) Datum v4)
{ {
ScanKeyData cur_skey[4]; ScanKeyData cur_skey[CATCACHE_MAXKEYS];
uint32 lHashValue; uint32 lHashValue;
Dlelem *elt; Dlelem *elt;
CatCList *cl; CatCList *cl;

View File

@ -80,7 +80,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * 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; HeapTuple tup;
tup = SearchSysCache(RELOID, tup = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
ObjectIdGetDatum(relid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for relation %u", relid); elog(ERROR, "cache lookup failed for relation %u", relid);
CacheInvalidateRelcacheByTuple(tup); CacheInvalidateRelcacheByTuple(tup);

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * 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 * NOTES
* Eventually, the index information should go through here, too. * Eventually, the index information should go through here, too.
@ -49,10 +49,9 @@ get_attavgwidth_hook_type get_attavgwidth_hook = NULL;
bool bool
op_in_opfamily(Oid opno, Oid opfamily) op_in_opfamily(Oid opno, Oid opfamily)
{ {
return SearchSysCacheExists(AMOPOPID, return SearchSysCacheExists2(AMOPOPID,
ObjectIdGetDatum(opno), ObjectIdGetDatum(opno),
ObjectIdGetDatum(opfamily), ObjectIdGetDatum(opfamily));
0, 0);
} }
/* /*
@ -68,10 +67,9 @@ get_op_opfamily_strategy(Oid opno, Oid opfamily)
Form_pg_amop amop_tup; Form_pg_amop amop_tup;
int result; int result;
tp = SearchSysCache(AMOPOPID, tp = SearchSysCache2(AMOPOPID,
ObjectIdGetDatum(opno), ObjectIdGetDatum(opno),
ObjectIdGetDatum(opfamily), ObjectIdGetDatum(opfamily));
0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
return 0; return 0;
amop_tup = (Form_pg_amop) GETSTRUCT(tp); amop_tup = (Form_pg_amop) GETSTRUCT(tp);
@ -98,10 +96,9 @@ get_op_opfamily_properties(Oid opno, Oid opfamily,
HeapTuple tp; HeapTuple tp;
Form_pg_amop amop_tup; Form_pg_amop amop_tup;
tp = SearchSysCache(AMOPOPID, tp = SearchSysCache2(AMOPOPID,
ObjectIdGetDatum(opno), ObjectIdGetDatum(opno),
ObjectIdGetDatum(opfamily), ObjectIdGetDatum(opfamily));
0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "operator %u is not a member of opfamily %u", elog(ERROR, "operator %u is not a member of opfamily %u",
opno, opfamily); opno, opfamily);
@ -127,11 +124,11 @@ get_opfamily_member(Oid opfamily, Oid lefttype, Oid righttype,
Form_pg_amop amop_tup; Form_pg_amop amop_tup;
Oid result; Oid result;
tp = SearchSysCache(AMOPSTRATEGY, tp = SearchSysCache4(AMOPSTRATEGY,
ObjectIdGetDatum(opfamily), ObjectIdGetDatum(opfamily),
ObjectIdGetDatum(lefttype), ObjectIdGetDatum(lefttype),
ObjectIdGetDatum(righttype), ObjectIdGetDatum(righttype),
Int16GetDatum(strategy)); Int16GetDatum(strategy));
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
return InvalidOid; return InvalidOid;
amop_tup = (Form_pg_amop) GETSTRUCT(tp); 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 "<" * Search pg_amop to see if the target operator is registered as the "<"
* or ">" operator of any btree opfamily. * or ">" operator of any btree opfamily.
*/ */
catlist = SearchSysCacheList(AMOPOPID, 1, catlist = SearchSysCacheList1(AMOPOPID, ObjectIdGetDatum(opno));
ObjectIdGetDatum(opno),
0, 0, 0);
for (i = 0; i < catlist->n_members; i++) 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 "=" * Search pg_amop to see if the target operator is registered as the "="
* operator of any btree opfamily. * operator of any btree opfamily.
*/ */
catlist = SearchSysCacheList(AMOPOPID, 1, catlist = SearchSysCacheList1(AMOPOPID, ObjectIdGetDatum(opno));
ObjectIdGetDatum(opno),
0, 0, 0);
for (i = 0; i < catlist->n_members; i++) 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 "=" * Search pg_amop to see if the target operator is registered as the "="
* operator of any btree opfamily. * operator of any btree opfamily.
*/ */
catlist = SearchSysCacheList(AMOPOPID, 1, catlist = SearchSysCacheList1(AMOPOPID, ObjectIdGetDatum(opno));
ObjectIdGetDatum(opno),
0, 0, 0);
for (i = 0; i < catlist->n_members; i++) 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 * operator of any hash opfamily. If the operator is registered in
* multiple opfamilies, assume we can use any one. * multiple opfamilies, assume we can use any one.
*/ */
catlist = SearchSysCacheList(AMOPOPID, 1, catlist = SearchSysCacheList1(AMOPOPID, ObjectIdGetDatum(opno));
ObjectIdGetDatum(opno),
0, 0, 0);
for (i = 0; i < catlist->n_members; i++) 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 * operator of any hash opfamily. If the operator is registered in
* multiple opfamilies, assume we can use any one. * multiple opfamilies, assume we can use any one.
*/ */
catlist = SearchSysCacheList(AMOPOPID, 1, catlist = SearchSysCacheList1(AMOPOPID, ObjectIdGetDatum(opno));
ObjectIdGetDatum(opno),
0, 0, 0);
for (i = 0; i < catlist->n_members; i++) 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. * Find all the pg_amop entries containing the operator.
*/ */
catlist = SearchSysCacheList(AMOPOPID, 1, catlist = SearchSysCacheList1(AMOPOPID, ObjectIdGetDatum(opno));
ObjectIdGetDatum(opno),
0, 0, 0);
/* /*
* If we can't find any opfamily containing the op, perhaps it is a <> * 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; op_negated = true;
ReleaseSysCacheList(catlist); ReleaseSysCacheList(catlist);
catlist = SearchSysCacheList(AMOPOPID, 1, catlist = SearchSysCacheList1(AMOPOPID,
ObjectIdGetDatum(op_negator), ObjectIdGetDatum(op_negator));
0, 0, 0);
} }
} }
@ -700,9 +684,7 @@ equality_ops_are_compatible(Oid opno1, Oid opno2)
/* /*
* We search through all the pg_amop entries for opno1. * We search through all the pg_amop entries for opno1.
*/ */
catlist = SearchSysCacheList(AMOPOPID, 1, catlist = SearchSysCacheList1(AMOPOPID, ObjectIdGetDatum(opno1));
ObjectIdGetDatum(opno1),
0, 0, 0);
result = false; result = false;
for (i = 0; i < catlist->n_members; i++) 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; Form_pg_amproc amproc_tup;
RegProcedure result; RegProcedure result;
tp = SearchSysCache(AMPROCNUM, tp = SearchSysCache4(AMPROCNUM,
ObjectIdGetDatum(opfamily), ObjectIdGetDatum(opfamily),
ObjectIdGetDatum(lefttype), ObjectIdGetDatum(lefttype),
ObjectIdGetDatum(righttype), ObjectIdGetDatum(righttype),
Int16GetDatum(procnum)); Int16GetDatum(procnum));
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
return InvalidOid; return InvalidOid;
amproc_tup = (Form_pg_amproc) GETSTRUCT(tp); amproc_tup = (Form_pg_amproc) GETSTRUCT(tp);
@ -772,10 +754,9 @@ get_attname(Oid relid, AttrNumber attnum)
{ {
HeapTuple tp; HeapTuple tp;
tp = SearchSysCache(ATTNUM, tp = SearchSysCache2(ATTNUM,
ObjectIdGetDatum(relid), ObjectIdGetDatum(relid),
Int16GetDatum(attnum), Int16GetDatum(attnum));
0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
Form_pg_attribute att_tup = (Form_pg_attribute) GETSTRUCT(tp); Form_pg_attribute att_tup = (Form_pg_attribute) GETSTRUCT(tp);
@ -845,10 +826,9 @@ get_atttype(Oid relid, AttrNumber attnum)
{ {
HeapTuple tp; HeapTuple tp;
tp = SearchSysCache(ATTNUM, tp = SearchSysCache2(ATTNUM,
ObjectIdGetDatum(relid), ObjectIdGetDatum(relid),
Int16GetDatum(attnum), Int16GetDatum(attnum));
0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
Form_pg_attribute att_tup = (Form_pg_attribute) GETSTRUCT(tp); Form_pg_attribute att_tup = (Form_pg_attribute) GETSTRUCT(tp);
@ -873,10 +853,9 @@ get_atttypmod(Oid relid, AttrNumber attnum)
{ {
HeapTuple tp; HeapTuple tp;
tp = SearchSysCache(ATTNUM, tp = SearchSysCache2(ATTNUM,
ObjectIdGetDatum(relid), ObjectIdGetDatum(relid),
Int16GetDatum(attnum), Int16GetDatum(attnum));
0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
Form_pg_attribute att_tup = (Form_pg_attribute) GETSTRUCT(tp); Form_pg_attribute att_tup = (Form_pg_attribute) GETSTRUCT(tp);
@ -906,10 +885,9 @@ get_atttypetypmod(Oid relid, AttrNumber attnum,
HeapTuple tp; HeapTuple tp;
Form_pg_attribute att_tup; Form_pg_attribute att_tup;
tp = SearchSysCache(ATTNUM, tp = SearchSysCache2(ATTNUM,
ObjectIdGetDatum(relid), ObjectIdGetDatum(relid),
Int16GetDatum(attnum), Int16GetDatum(attnum));
0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for attribute %d of relation %u", elog(ERROR, "cache lookup failed for attribute %d of relation %u",
attnum, relid); attnum, relid);
@ -936,9 +914,7 @@ get_constraint_name(Oid conoid)
{ {
HeapTuple tp; HeapTuple tp;
tp = SearchSysCache(CONSTROID, tp = SearchSysCache1(CONSTROID, ObjectIdGetDatum(conoid));
ObjectIdGetDatum(conoid),
0, 0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
Form_pg_constraint contup = (Form_pg_constraint) GETSTRUCT(tp); Form_pg_constraint contup = (Form_pg_constraint) GETSTRUCT(tp);
@ -966,9 +942,7 @@ get_opclass_family(Oid opclass)
Form_pg_opclass cla_tup; Form_pg_opclass cla_tup;
Oid result; Oid result;
tp = SearchSysCache(CLAOID, tp = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclass));
ObjectIdGetDatum(opclass),
0, 0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for opclass %u", opclass); elog(ERROR, "cache lookup failed for opclass %u", opclass);
cla_tup = (Form_pg_opclass) GETSTRUCT(tp); cla_tup = (Form_pg_opclass) GETSTRUCT(tp);
@ -990,9 +964,7 @@ get_opclass_input_type(Oid opclass)
Form_pg_opclass cla_tup; Form_pg_opclass cla_tup;
Oid result; Oid result;
tp = SearchSysCache(CLAOID, tp = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclass));
ObjectIdGetDatum(opclass),
0, 0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for opclass %u", opclass); elog(ERROR, "cache lookup failed for opclass %u", opclass);
cla_tup = (Form_pg_opclass) GETSTRUCT(tp); cla_tup = (Form_pg_opclass) GETSTRUCT(tp);
@ -1015,9 +987,7 @@ get_opcode(Oid opno)
{ {
HeapTuple tp; HeapTuple tp;
tp = SearchSysCache(OPEROID, tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
ObjectIdGetDatum(opno),
0, 0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp); Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
@ -1042,9 +1012,7 @@ get_opname(Oid opno)
{ {
HeapTuple tp; HeapTuple tp;
tp = SearchSysCache(OPEROID, tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
ObjectIdGetDatum(opno),
0, 0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(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; HeapTuple tp;
Form_pg_operator optup; Form_pg_operator optup;
tp = SearchSysCache(OPEROID, tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
ObjectIdGetDatum(opno),
0, 0, 0);
if (!HeapTupleIsValid(tp)) /* shouldn't happen */ if (!HeapTupleIsValid(tp)) /* shouldn't happen */
elog(ERROR, "cache lookup failed for operator %u", opno); elog(ERROR, "cache lookup failed for operator %u", opno);
optup = (Form_pg_operator) GETSTRUCT(tp); optup = (Form_pg_operator) GETSTRUCT(tp);
@ -1095,9 +1061,7 @@ op_mergejoinable(Oid opno)
HeapTuple tp; HeapTuple tp;
bool result = false; bool result = false;
tp = SearchSysCache(OPEROID, tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
ObjectIdGetDatum(opno),
0, 0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp); Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
@ -1120,9 +1084,7 @@ op_hashjoinable(Oid opno)
HeapTuple tp; HeapTuple tp;
bool result = false; bool result = false;
tp = SearchSysCache(OPEROID, tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
ObjectIdGetDatum(opno),
0, 0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp); Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
@ -1175,9 +1137,7 @@ get_commutator(Oid opno)
{ {
HeapTuple tp; HeapTuple tp;
tp = SearchSysCache(OPEROID, tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
ObjectIdGetDatum(opno),
0, 0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp); Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
@ -1201,9 +1161,7 @@ get_negator(Oid opno)
{ {
HeapTuple tp; HeapTuple tp;
tp = SearchSysCache(OPEROID, tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
ObjectIdGetDatum(opno),
0, 0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp); Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
@ -1227,9 +1185,7 @@ get_oprrest(Oid opno)
{ {
HeapTuple tp; HeapTuple tp;
tp = SearchSysCache(OPEROID, tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
ObjectIdGetDatum(opno),
0, 0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp); Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
@ -1253,9 +1209,7 @@ get_oprjoin(Oid opno)
{ {
HeapTuple tp; HeapTuple tp;
tp = SearchSysCache(OPEROID, tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
ObjectIdGetDatum(opno),
0, 0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp); Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
@ -1282,9 +1236,7 @@ get_func_name(Oid funcid)
{ {
HeapTuple tp; HeapTuple tp;
tp = SearchSysCache(PROCOID, tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
ObjectIdGetDatum(funcid),
0, 0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
Form_pg_proc functup = (Form_pg_proc) GETSTRUCT(tp); Form_pg_proc functup = (Form_pg_proc) GETSTRUCT(tp);
@ -1308,9 +1260,7 @@ get_func_namespace(Oid funcid)
{ {
HeapTuple tp; HeapTuple tp;
tp = SearchSysCache(PROCOID, tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
ObjectIdGetDatum(funcid),
0, 0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
Form_pg_proc functup = (Form_pg_proc) GETSTRUCT(tp); Form_pg_proc functup = (Form_pg_proc) GETSTRUCT(tp);
@ -1334,9 +1284,7 @@ get_func_rettype(Oid funcid)
HeapTuple tp; HeapTuple tp;
Oid result; Oid result;
tp = SearchSysCache(PROCOID, tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
ObjectIdGetDatum(funcid),
0, 0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for function %u", funcid); elog(ERROR, "cache lookup failed for function %u", funcid);
@ -1355,9 +1303,7 @@ get_func_nargs(Oid funcid)
HeapTuple tp; HeapTuple tp;
int result; int result;
tp = SearchSysCache(PROCOID, tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
ObjectIdGetDatum(funcid),
0, 0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for function %u", funcid); 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; Form_pg_proc procstruct;
Oid result; Oid result;
tp = SearchSysCache(PROCOID, tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
ObjectIdGetDatum(funcid),
0, 0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for function %u", funcid); elog(ERROR, "cache lookup failed for function %u", funcid);
@ -1408,9 +1352,7 @@ get_func_retset(Oid funcid)
HeapTuple tp; HeapTuple tp;
bool result; bool result;
tp = SearchSysCache(PROCOID, tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
ObjectIdGetDatum(funcid),
0, 0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for function %u", funcid); elog(ERROR, "cache lookup failed for function %u", funcid);
@ -1429,9 +1371,7 @@ func_strict(Oid funcid)
HeapTuple tp; HeapTuple tp;
bool result; bool result;
tp = SearchSysCache(PROCOID, tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
ObjectIdGetDatum(funcid),
0, 0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for function %u", funcid); elog(ERROR, "cache lookup failed for function %u", funcid);
@ -1450,9 +1390,7 @@ func_volatile(Oid funcid)
HeapTuple tp; HeapTuple tp;
char result; char result;
tp = SearchSysCache(PROCOID, tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
ObjectIdGetDatum(funcid),
0, 0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for function %u", funcid); elog(ERROR, "cache lookup failed for function %u", funcid);
@ -1471,9 +1409,7 @@ get_func_cost(Oid funcid)
HeapTuple tp; HeapTuple tp;
float4 result; float4 result;
tp = SearchSysCache(PROCOID, tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
ObjectIdGetDatum(funcid),
0, 0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for function %u", funcid); elog(ERROR, "cache lookup failed for function %u", funcid);
@ -1492,9 +1428,7 @@ get_func_rows(Oid funcid)
HeapTuple tp; HeapTuple tp;
float4 result; float4 result;
tp = SearchSysCache(PROCOID, tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
ObjectIdGetDatum(funcid),
0, 0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for function %u", funcid); elog(ERROR, "cache lookup failed for function %u", funcid);
@ -1514,10 +1448,9 @@ get_func_rows(Oid funcid)
Oid Oid
get_relname_relid(const char *relname, Oid relnamespace) get_relname_relid(const char *relname, Oid relnamespace)
{ {
return GetSysCacheOid(RELNAMENSP, return GetSysCacheOid2(RELNAMENSP,
PointerGetDatum(relname), PointerGetDatum(relname),
ObjectIdGetDatum(relnamespace), ObjectIdGetDatum(relnamespace));
0, 0);
} }
#ifdef NOT_USED #ifdef NOT_USED
@ -1531,9 +1464,7 @@ get_relnatts(Oid relid)
{ {
HeapTuple tp; HeapTuple tp;
tp = SearchSysCache(RELOID, tp = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
ObjectIdGetDatum(relid),
0, 0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp); Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp);
@ -1562,9 +1493,7 @@ get_rel_name(Oid relid)
{ {
HeapTuple tp; HeapTuple tp;
tp = SearchSysCache(RELOID, tp = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
ObjectIdGetDatum(relid),
0, 0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp); Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp);
@ -1588,9 +1517,7 @@ get_rel_namespace(Oid relid)
{ {
HeapTuple tp; HeapTuple tp;
tp = SearchSysCache(RELOID, tp = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
ObjectIdGetDatum(relid),
0, 0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp); Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp);
@ -1617,9 +1544,7 @@ get_rel_type_id(Oid relid)
{ {
HeapTuple tp; HeapTuple tp;
tp = SearchSysCache(RELOID, tp = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
ObjectIdGetDatum(relid),
0, 0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp); Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp);
@ -1643,9 +1568,7 @@ get_rel_relkind(Oid relid)
{ {
HeapTuple tp; HeapTuple tp;
tp = SearchSysCache(RELOID, tp = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
ObjectIdGetDatum(relid),
0, 0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp); Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp);
@ -1672,9 +1595,7 @@ get_rel_tablespace(Oid relid)
{ {
HeapTuple tp; HeapTuple tp;
tp = SearchSysCache(RELOID, tp = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
ObjectIdGetDatum(relid),
0, 0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp); Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp);
@ -1702,9 +1623,7 @@ get_typisdefined(Oid typid)
{ {
HeapTuple tp; HeapTuple tp;
tp = SearchSysCache(TYPEOID, tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
ObjectIdGetDatum(typid),
0, 0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp); Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
@ -1728,9 +1647,7 @@ get_typlen(Oid typid)
{ {
HeapTuple tp; HeapTuple tp;
tp = SearchSysCache(TYPEOID, tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
ObjectIdGetDatum(typid),
0, 0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp); Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
@ -1755,9 +1672,7 @@ get_typbyval(Oid typid)
{ {
HeapTuple tp; HeapTuple tp;
tp = SearchSysCache(TYPEOID, tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
ObjectIdGetDatum(typid),
0, 0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp); Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
@ -1787,9 +1702,7 @@ get_typlenbyval(Oid typid, int16 *typlen, bool *typbyval)
HeapTuple tp; HeapTuple tp;
Form_pg_type typtup; Form_pg_type typtup;
tp = SearchSysCache(TYPEOID, tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
ObjectIdGetDatum(typid),
0, 0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for type %u", typid); elog(ERROR, "cache lookup failed for type %u", typid);
typtup = (Form_pg_type) GETSTRUCT(tp); typtup = (Form_pg_type) GETSTRUCT(tp);
@ -1810,9 +1723,7 @@ get_typlenbyvalalign(Oid typid, int16 *typlen, bool *typbyval,
HeapTuple tp; HeapTuple tp;
Form_pg_type typtup; Form_pg_type typtup;
tp = SearchSysCache(TYPEOID, tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
ObjectIdGetDatum(typid),
0, 0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for type %u", typid); elog(ERROR, "cache lookup failed for type %u", typid);
typtup = (Form_pg_type) GETSTRUCT(tp); typtup = (Form_pg_type) GETSTRUCT(tp);
@ -1905,9 +1816,7 @@ get_type_io_data(Oid typid,
return; return;
} }
typeTuple = SearchSysCache(TYPEOID, typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
ObjectIdGetDatum(typid),
0, 0, 0);
if (!HeapTupleIsValid(typeTuple)) if (!HeapTupleIsValid(typeTuple))
elog(ERROR, "cache lookup failed for type %u", typid); elog(ERROR, "cache lookup failed for type %u", typid);
typeStruct = (Form_pg_type) GETSTRUCT(typeTuple); typeStruct = (Form_pg_type) GETSTRUCT(typeTuple);
@ -1941,9 +1850,7 @@ get_typalign(Oid typid)
{ {
HeapTuple tp; HeapTuple tp;
tp = SearchSysCache(TYPEOID, tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
ObjectIdGetDatum(typid),
0, 0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp); Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
@ -1963,9 +1870,7 @@ get_typstorage(Oid typid)
{ {
HeapTuple tp; HeapTuple tp;
tp = SearchSysCache(TYPEOID, tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
ObjectIdGetDatum(typid),
0, 0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp); Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
@ -1998,9 +1903,7 @@ get_typdefault(Oid typid)
bool isNull; bool isNull;
Node *expr; Node *expr;
typeTuple = SearchSysCache(TYPEOID, typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
ObjectIdGetDatum(typid),
0, 0, 0);
if (!HeapTupleIsValid(typeTuple)) if (!HeapTupleIsValid(typeTuple))
elog(ERROR, "cache lookup failed for type %u", typid); elog(ERROR, "cache lookup failed for type %u", typid);
type = (Form_pg_type) GETSTRUCT(typeTuple); type = (Form_pg_type) GETSTRUCT(typeTuple);
@ -2091,9 +1994,7 @@ getBaseTypeAndTypmod(Oid typid, int32 *typmod)
HeapTuple tup; HeapTuple tup;
Form_pg_type typTup; Form_pg_type typTup;
tup = SearchSysCache(TYPEOID, tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
ObjectIdGetDatum(typid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for type %u", typid); elog(ERROR, "cache lookup failed for type %u", typid);
typTup = (Form_pg_type) GETSTRUCT(tup); typTup = (Form_pg_type) GETSTRUCT(tup);
@ -2178,9 +2079,7 @@ get_typtype(Oid typid)
{ {
HeapTuple tp; HeapTuple tp;
tp = SearchSysCache(TYPEOID, tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
ObjectIdGetDatum(typid),
0, 0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
Form_pg_type typtup = (Form_pg_type) GETSTRUCT(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; HeapTuple tp;
Form_pg_type typtup; Form_pg_type typtup;
tp = SearchSysCache(TYPEOID, tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
ObjectIdGetDatum(typid),
0, 0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for type %u", typid); elog(ERROR, "cache lookup failed for type %u", typid);
typtup = (Form_pg_type) GETSTRUCT(tp); typtup = (Form_pg_type) GETSTRUCT(tp);
@ -2250,9 +2147,7 @@ get_typ_typrelid(Oid typid)
{ {
HeapTuple tp; HeapTuple tp;
tp = SearchSysCache(TYPEOID, tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
ObjectIdGetDatum(typid),
0, 0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp); Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
@ -2279,9 +2174,7 @@ get_element_type(Oid typid)
{ {
HeapTuple tp; HeapTuple tp;
tp = SearchSysCache(TYPEOID, tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
ObjectIdGetDatum(typid),
0, 0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp); Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
@ -2310,9 +2203,7 @@ get_array_type(Oid typid)
HeapTuple tp; HeapTuple tp;
Oid result = InvalidOid; Oid result = InvalidOid;
tp = SearchSysCache(TYPEOID, tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
ObjectIdGetDatum(typid),
0, 0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
result = ((Form_pg_type) GETSTRUCT(tp))->typarray; result = ((Form_pg_type) GETSTRUCT(tp))->typarray;
@ -2332,9 +2223,7 @@ getTypeInputInfo(Oid type, Oid *typInput, Oid *typIOParam)
HeapTuple typeTuple; HeapTuple typeTuple;
Form_pg_type pt; Form_pg_type pt;
typeTuple = SearchSysCache(TYPEOID, typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type));
ObjectIdGetDatum(type),
0, 0, 0);
if (!HeapTupleIsValid(typeTuple)) if (!HeapTupleIsValid(typeTuple))
elog(ERROR, "cache lookup failed for type %u", type); elog(ERROR, "cache lookup failed for type %u", type);
pt = (Form_pg_type) GETSTRUCT(typeTuple); pt = (Form_pg_type) GETSTRUCT(typeTuple);
@ -2367,9 +2256,7 @@ getTypeOutputInfo(Oid type, Oid *typOutput, bool *typIsVarlena)
HeapTuple typeTuple; HeapTuple typeTuple;
Form_pg_type pt; Form_pg_type pt;
typeTuple = SearchSysCache(TYPEOID, typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type));
ObjectIdGetDatum(type),
0, 0, 0);
if (!HeapTupleIsValid(typeTuple)) if (!HeapTupleIsValid(typeTuple))
elog(ERROR, "cache lookup failed for type %u", type); elog(ERROR, "cache lookup failed for type %u", type);
pt = (Form_pg_type) GETSTRUCT(typeTuple); pt = (Form_pg_type) GETSTRUCT(typeTuple);
@ -2402,9 +2289,7 @@ getTypeBinaryInputInfo(Oid type, Oid *typReceive, Oid *typIOParam)
HeapTuple typeTuple; HeapTuple typeTuple;
Form_pg_type pt; Form_pg_type pt;
typeTuple = SearchSysCache(TYPEOID, typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type));
ObjectIdGetDatum(type),
0, 0, 0);
if (!HeapTupleIsValid(typeTuple)) if (!HeapTupleIsValid(typeTuple))
elog(ERROR, "cache lookup failed for type %u", type); elog(ERROR, "cache lookup failed for type %u", type);
pt = (Form_pg_type) GETSTRUCT(typeTuple); pt = (Form_pg_type) GETSTRUCT(typeTuple);
@ -2437,9 +2322,7 @@ getTypeBinaryOutputInfo(Oid type, Oid *typSend, bool *typIsVarlena)
HeapTuple typeTuple; HeapTuple typeTuple;
Form_pg_type pt; Form_pg_type pt;
typeTuple = SearchSysCache(TYPEOID, typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type));
ObjectIdGetDatum(type),
0, 0, 0);
if (!HeapTupleIsValid(typeTuple)) if (!HeapTupleIsValid(typeTuple))
elog(ERROR, "cache lookup failed for type %u", type); elog(ERROR, "cache lookup failed for type %u", type);
pt = (Form_pg_type) GETSTRUCT(typeTuple); pt = (Form_pg_type) GETSTRUCT(typeTuple);
@ -2471,9 +2354,7 @@ get_typmodin(Oid typid)
{ {
HeapTuple tp; HeapTuple tp;
tp = SearchSysCache(TYPEOID, tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
ObjectIdGetDatum(typid),
0, 0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp); Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
@ -2498,9 +2379,7 @@ get_typmodout(Oid typid)
{ {
HeapTuple tp; HeapTuple tp;
tp = SearchSysCache(TYPEOID, tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
ObjectIdGetDatum(typid),
0, 0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp); Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
@ -2543,11 +2422,10 @@ get_attavgwidth(Oid relid, AttrNumber attnum)
if (stawidth > 0) if (stawidth > 0)
return stawidth; return stawidth;
} }
tp = SearchSysCache(STATRELATTINH, tp = SearchSysCache3(STATRELATTINH,
ObjectIdGetDatum(relid), ObjectIdGetDatum(relid),
Int16GetDatum(attnum), Int16GetDatum(attnum),
BoolGetDatum(false), BoolGetDatum(false));
0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
stawidth = ((Form_pg_statistic) GETSTRUCT(tp))->stawidth; stawidth = ((Form_pg_statistic) GETSTRUCT(tp))->stawidth;
@ -2626,9 +2504,7 @@ get_attstatsslot(HeapTuple statstuple,
statarray = DatumGetArrayTypeP(val); statarray = DatumGetArrayTypeP(val);
/* Need to get info about the array element type */ /* Need to get info about the array element type */
typeTuple = SearchSysCache(TYPEOID, typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(atttype));
ObjectIdGetDatum(atttype),
0, 0, 0);
if (!HeapTupleIsValid(typeTuple)) if (!HeapTupleIsValid(typeTuple))
elog(ERROR, "cache lookup failed for type %u", atttype); elog(ERROR, "cache lookup failed for type %u", atttype);
typeForm = (Form_pg_type) GETSTRUCT(typeTuple); typeForm = (Form_pg_type) GETSTRUCT(typeTuple);
@ -2737,9 +2613,7 @@ get_namespace_name(Oid nspid)
{ {
HeapTuple tp; HeapTuple tp;
tp = SearchSysCache(NAMESPACEOID, tp = SearchSysCache1(NAMESPACEOID, ObjectIdGetDatum(nspid));
ObjectIdGetDatum(nspid),
0, 0, 0);
if (HeapTupleIsValid(tp)) if (HeapTupleIsValid(tp))
{ {
Form_pg_namespace nsptup = (Form_pg_namespace) GETSTRUCT(tp); Form_pg_namespace nsptup = (Form_pg_namespace) GETSTRUCT(tp);
@ -2763,9 +2637,7 @@ get_namespace_name(Oid nspid)
Oid Oid
get_roleid(const char *rolname) get_roleid(const char *rolname)
{ {
return GetSysCacheOid(AUTHNAME, return GetSysCacheOid1(AUTHNAME, PointerGetDatum(rolname));
PointerGetDatum(rolname),
0, 0, 0);
} }
/* /*

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 * contains variable-length and possibly-null fields, we have to do this
* honestly rather than just treating it as a Form_pg_index struct. * honestly rather than just treating it as a Form_pg_index struct.
*/ */
tuple = SearchSysCache(INDEXRELID, tuple = SearchSysCache1(INDEXRELID,
ObjectIdGetDatum(RelationGetRelid(relation)), ObjectIdGetDatum(RelationGetRelid(relation)));
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for index %u", elog(ERROR, "cache lookup failed for index %u",
RelationGetRelid(relation)); RelationGetRelid(relation));
@ -991,9 +990,7 @@ RelationInitIndexAccessInfo(Relation relation)
/* /*
* Make a copy of the pg_am entry for the index's access method * Make a copy of the pg_am entry for the index's access method
*/ */
tuple = SearchSysCache(AMOID, tuple = SearchSysCache1(AMOID, ObjectIdGetDatum(relation->rd_rel->relam));
ObjectIdGetDatum(relation->rd_rel->relam),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for access method %u", elog(ERROR, "cache lookup failed for access method %u",
relation->rd_rel->relam); relation->rd_rel->relam);
@ -1757,9 +1754,8 @@ RelationReloadIndexInfo(Relation relation)
HeapTuple tuple; HeapTuple tuple;
Form_pg_index index; Form_pg_index index;
tuple = SearchSysCache(INDEXRELID, tuple = SearchSysCache1(INDEXRELID,
ObjectIdGetDatum(RelationGetRelid(relation)), ObjectIdGetDatum(RelationGetRelid(relation)));
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for index %u", elog(ERROR, "cache lookup failed for index %u",
RelationGetRelid(relation)); RelationGetRelid(relation));
@ -2627,9 +2623,8 @@ RelationSetNewRelfilenode(Relation relation, TransactionId freezeXid)
*/ */
pg_class = heap_open(RelationRelationId, RowExclusiveLock); pg_class = heap_open(RelationRelationId, RowExclusiveLock);
tuple = SearchSysCacheCopy(RELOID, tuple = SearchSysCacheCopy1(RELOID,
ObjectIdGetDatum(RelationGetRelid(relation)), ObjectIdGetDatum(RelationGetRelid(relation)));
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "could not find tuple for relation %u", elog(ERROR, "could not find tuple for relation %u",
RelationGetRelid(relation)); RelationGetRelid(relation));
@ -2947,9 +2942,8 @@ RelationCacheInitializePhase3(void)
HeapTuple htup; HeapTuple htup;
Form_pg_class relp; Form_pg_class relp;
htup = SearchSysCache(RELOID, htup = SearchSysCache1(RELOID,
ObjectIdGetDatum(RelationGetRelid(relation)), ObjectIdGetDatum(RelationGetRelid(relation)));
0, 0, 0);
if (!HeapTupleIsValid(htup)) if (!HeapTupleIsValid(htup))
elog(FATAL, "cache lookup failed for relation %u", elog(FATAL, "cache lookup failed for relation %u",
RelationGetRelid(relation)); RelationGetRelid(relation));

View File

@ -12,7 +12,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * 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 * details for a non-existent tablespace. We'll just treat that case as if
* no options were specified. * no options were specified.
*/ */
tp = SearchSysCache(TABLESPACEOID, tp = SearchSysCache1(TABLESPACEOID, ObjectIdGetDatum(spcid));
ObjectIdGetDatum(spcid),
0, 0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
opts = NULL; opts = NULL;
else else

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* These routines allow the parser/planner/executor to perform * These routines allow the parser/planner/executor to perform
@ -909,10 +909,9 @@ SearchSysCacheAttName(Oid relid, const char *attname)
{ {
HeapTuple tuple; HeapTuple tuple;
tuple = SearchSysCache(ATTNAME, tuple = SearchSysCache2(ATTNAME,
ObjectIdGetDatum(relid), ObjectIdGetDatum(relid),
CStringGetDatum(attname), CStringGetDatum(attname));
0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
return NULL; return NULL;
if (((Form_pg_attribute) GETSTRUCT(tuple))->attisdropped) if (((Form_pg_attribute) GETSTRUCT(tuple))->attisdropped)

View File

@ -20,7 +20,7 @@
* Copyright (c) 2006-2010, PostgreSQL Global Development Group * Copyright (c) 2006-2010, PostgreSQL Global Development Group
* *
* IDENTIFICATION * 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; HeapTuple tp;
Form_pg_ts_parser prs; Form_pg_ts_parser prs;
tp = SearchSysCache(TSPARSEROID, tp = SearchSysCache1(TSPARSEROID, ObjectIdGetDatum(prsId));
ObjectIdGetDatum(prsId),
0, 0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for text search parser %u", elog(ERROR, "cache lookup failed for text search parser %u",
prsId); prsId);
@ -257,9 +255,7 @@ lookup_ts_dictionary_cache(Oid dictId)
Form_pg_ts_template template; Form_pg_ts_template template;
MemoryContext saveCtx; MemoryContext saveCtx;
tpdict = SearchSysCache(TSDICTOID, tpdict = SearchSysCache1(TSDICTOID, ObjectIdGetDatum(dictId));
ObjectIdGetDatum(dictId),
0, 0, 0);
if (!HeapTupleIsValid(tpdict)) if (!HeapTupleIsValid(tpdict))
elog(ERROR, "cache lookup failed for text search dictionary %u", elog(ERROR, "cache lookup failed for text search dictionary %u",
dictId); dictId);
@ -274,9 +270,8 @@ lookup_ts_dictionary_cache(Oid dictId)
/* /*
* Retrieve dictionary's template * Retrieve dictionary's template
*/ */
tptmpl = SearchSysCache(TSTEMPLATEOID, tptmpl = SearchSysCache1(TSTEMPLATEOID,
ObjectIdGetDatum(dict->dicttemplate), ObjectIdGetDatum(dict->dicttemplate));
0, 0, 0);
if (!HeapTupleIsValid(tptmpl)) if (!HeapTupleIsValid(tptmpl))
elog(ERROR, "cache lookup failed for text search template %u", elog(ERROR, "cache lookup failed for text search template %u",
dict->dicttemplate); dict->dicttemplate);
@ -430,9 +425,7 @@ lookup_ts_config_cache(Oid cfgId)
int ndicts; int ndicts;
int i; int i;
tp = SearchSysCache(TSCONFIGOID, tp = SearchSysCache1(TSCONFIGOID, ObjectIdGetDatum(cfgId));
ObjectIdGetDatum(cfgId),
0, 0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for text search configuration %u", elog(ERROR, "cache lookup failed for text search configuration %u",
cfgId); cfgId);
@ -617,9 +610,7 @@ assignTSCurrentConfig(const char *newval, bool doit, GucSource source)
* Modify the actually stored value to be fully qualified, to ensure * Modify the actually stored value to be fully qualified, to ensure
* later changes of search_path don't affect it. * later changes of search_path don't affect it.
*/ */
tuple = SearchSysCache(TSCONFIGOID, tuple = SearchSysCache1(TSCONFIGOID, ObjectIdGetDatum(cfgId));
ObjectIdGetDatum(cfgId),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for text search configuration %u", elog(ERROR, "cache lookup failed for text search configuration %u",
cfgId); cfgId);

View File

@ -36,7 +36,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * 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; HeapTuple tp;
Form_pg_type typtup; Form_pg_type typtup;
tp = SearchSysCache(TYPEOID, tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type_id));
ObjectIdGetDatum(type_id),
0, 0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for type %u", type_id); elog(ERROR, "cache lookup failed for type %u", type_id);
typtup = (Form_pg_type) GETSTRUCT(tp); typtup = (Form_pg_type) GETSTRUCT(tp);

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 */ /* Otherwise we need the pg_proc entry */
procedureTuple = SearchSysCache(PROCOID, procedureTuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(functionId));
ObjectIdGetDatum(functionId),
0, 0, 0);
if (!HeapTupleIsValid(procedureTuple)) if (!HeapTupleIsValid(procedureTuple))
elog(ERROR, "cache lookup failed for function %u", functionId); elog(ERROR, "cache lookup failed for function %u", functionId);
procedureStruct = (Form_pg_proc) GETSTRUCT(procedureTuple); procedureStruct = (Form_pg_proc) GETSTRUCT(procedureTuple);
@ -396,9 +394,7 @@ fmgr_info_other_lang(Oid functionId, FmgrInfo *finfo, HeapTuple procedureTuple)
Form_pg_language languageStruct; Form_pg_language languageStruct;
FmgrInfo plfinfo; FmgrInfo plfinfo;
languageTuple = SearchSysCache(LANGOID, languageTuple = SearchSysCache1(LANGOID, ObjectIdGetDatum(language));
ObjectIdGetDatum(language),
0, 0, 0);
if (!HeapTupleIsValid(languageTuple)) if (!HeapTupleIsValid(languageTuple))
elog(ERROR, "cache lookup failed for language %u", language); elog(ERROR, "cache lookup failed for language %u", language);
languageStruct = (Form_pg_language) GETSTRUCT(languageTuple); languageStruct = (Form_pg_language) GETSTRUCT(languageTuple);
@ -899,9 +895,8 @@ fmgr_security_definer(PG_FUNCTION_ARGS)
fcinfo->flinfo->fn_mcxt, true); fcinfo->flinfo->fn_mcxt, true);
fcache->flinfo.fn_expr = fcinfo->flinfo->fn_expr; fcache->flinfo.fn_expr = fcinfo->flinfo->fn_expr;
tuple = SearchSysCache(PROCOID, tuple = SearchSysCache1(PROCOID,
ObjectIdGetDatum(fcinfo->flinfo->fn_oid), ObjectIdGetDatum(fcinfo->flinfo->fn_oid));
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for function %u", elog(ERROR, "cache lookup failed for function %u",
fcinfo->flinfo->fn_oid); fcinfo->flinfo->fn_oid);

View File

@ -7,7 +7,7 @@
* Copyright (c) 2002-2010, PostgreSQL Global Development Group * Copyright (c) 2002-2010, PostgreSQL Global Development Group
* *
* IDENTIFICATION * 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; TupleDesc tupdesc;
/* First fetch the function's pg_proc row to inspect its rettype */ /* First fetch the function's pg_proc row to inspect its rettype */
tp = SearchSysCache(PROCOID, tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
ObjectIdGetDatum(funcid),
0, 0, 0);
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for function %u", funcid); elog(ERROR, "cache lookup failed for function %u", funcid);
procform = (Form_pg_proc) GETSTRUCT(tp); procform = (Form_pg_proc) GETSTRUCT(tp);
@ -878,9 +876,7 @@ get_func_result_name(Oid functionId)
int i; int i;
/* First fetch the function's pg_proc row */ /* First fetch the function's pg_proc row */
procTuple = SearchSysCache(PROCOID, procTuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(functionId));
ObjectIdGetDatum(functionId),
0, 0, 0);
if (!HeapTupleIsValid(procTuple)) if (!HeapTupleIsValid(procTuple))
elog(ERROR, "cache lookup failed for function %u", functionId); elog(ERROR, "cache lookup failed for function %u", functionId);

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 */ /* call only once */
AssertState(!OidIsValid(AuthenticatedUserId)); AssertState(!OidIsValid(AuthenticatedUserId));
roleTup = SearchSysCache(AUTHNAME, roleTup = SearchSysCache1(AUTHNAME, PointerGetDatum(rolename));
PointerGetDatum(rolename),
0, 0, 0);
if (!HeapTupleIsValid(roleTup)) if (!HeapTupleIsValid(roleTup))
ereport(FATAL, ereport(FATAL,
(errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION), (errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION),
@ -593,9 +591,7 @@ GetUserNameFromId(Oid roleid)
HeapTuple tuple; HeapTuple tuple;
char *result; char *result;
tuple = SearchSysCache(AUTHOID, tuple = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid));
ObjectIdGetDatum(roleid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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; char *ctype;
/* Fetch our pg_database row normally, via syscache */ /* Fetch our pg_database row normally, via syscache */
tup = SearchSysCache(DATABASEOID, tup = SearchSysCache1(DATABASEOID, ObjectIdGetDatum(MyDatabaseId));
ObjectIdGetDatum(MyDatabaseId),
0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for database %u", MyDatabaseId); elog(ERROR, "cache lookup failed for database %u", MyDatabaseId);
dbform = (Form_pg_database) GETSTRUCT(tup); dbform = (Form_pg_database) GETSTRUCT(tup);

View File

@ -4,7 +4,7 @@
* *
* Tatsuo Ishii * 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" #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 * are going into infinite loop! So we have to make sure that the
* function exists before calling OidFunctionCall. * function exists before calling OidFunctionCall.
*/ */
if (!SearchSysCacheExists(PROCOID, if (!SearchSysCacheExists1(PROCOID, ObjectIdGetDatum(proc)))
ObjectIdGetDatum(proc),
0, 0, 0))
{ {
elog(LOG, "cache lookup failed for function %u", proc); elog(LOG, "cache lookup failed for function %u", proc);
return src; return src;

View File

@ -14,7 +14,7 @@
* *
* *
* IDENTIFICATION * 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; return true;
/* OK, look up the information in pg_authid */ /* OK, look up the information in pg_authid */
rtup = SearchSysCache(AUTHOID, rtup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid));
ObjectIdGetDatum(roleid),
0, 0, 0);
if (HeapTupleIsValid(rtup)) if (HeapTupleIsValid(rtup))
{ {
result = ((Form_pg_authid) GETSTRUCT(rtup))->rolsuper; result = ((Form_pg_authid) GETSTRUCT(rtup))->rolsuper;

View File

@ -13,7 +13,7 @@
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * 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. * struct catcacheheader: information for managing all the caches.
*/ */
#define CATCACHE_MAXKEYS 4
typedef struct catcache typedef struct catcache
{ {
int id; /* cache identifier --- see syscache.h */ int id; /* cache identifier --- see syscache.h */
@ -43,11 +45,11 @@ typedef struct catcache
TupleDesc cc_tupdesc; /* tuple descriptor (copied from reldesc) */ TupleDesc cc_tupdesc; /* tuple descriptor (copied from reldesc) */
int cc_ntup; /* # of tuples currently in this cache */ int cc_ntup; /* # of tuples currently in this cache */
int cc_nbuckets; /* # of hash buckets in this cache */ int cc_nbuckets; /* # of hash buckets in this cache */
int cc_nkeys; /* # of keys (1..4) */ int cc_nkeys; /* # of keys (1..CATCACHE_MAXKEYS) */
int cc_key[4]; /* AttrNumber of each key */ int cc_key[CATCACHE_MAXKEYS]; /* AttrNumber of each key */
PGFunction cc_hashfunc[4]; /* hash function to use for each key */ PGFunction cc_hashfunc[CATCACHE_MAXKEYS]; /* hash function for each key */
ScanKeyData cc_skey[4]; /* precomputed key info for heap scans */ ScanKeyData cc_skey[CATCACHE_MAXKEYS]; /* precomputed key info for heap scans */
bool cc_isname[4]; /* flag key columns that are NAMEs */ bool cc_isname[CATCACHE_MAXKEYS]; /* flag "name" key columns */
Dllist cc_lists; /* list of CatCList structs */ Dllist cc_lists; /* list of CatCList structs */
#ifdef CATCACHE_STATS #ifdef CATCACHE_STATS
long cc_searches; /* total # searches against this cache */ long cc_searches; /* total # searches against this cache */

View File

@ -9,7 +9,7 @@
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * 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, extern struct catclist *SearchSysCacheList(int cacheId, int nkeys,
Datum key1, Datum key2, Datum key3, Datum key4); 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) #define ReleaseSysCacheList(x) ReleaseCatCacheList(x)
#endif /* SYSCACHE_H */ #endif /* SYSCACHE_H */

View File

@ -1,7 +1,7 @@
/********************************************************************** /**********************************************************************
* plperl.c - perl as a procedural language for PostgreSQL * 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; int i;
/* Get the new function's pg_proc entry */ /* Get the new function's pg_proc entry */
tuple = SearchSysCache(PROCOID, tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcoid));
ObjectIdGetDatum(funcoid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for function %u", funcoid); elog(ERROR, "cache lookup failed for function %u", funcoid);
proc = (Form_pg_proc) GETSTRUCT(tuple); proc = (Form_pg_proc) GETSTRUCT(tuple);
@ -1773,9 +1771,7 @@ compile_plperl_function(Oid fn_oid, bool is_trigger)
ErrorContextCallback plperl_error_context; ErrorContextCallback plperl_error_context;
/* We'll need the pg_proc tuple in any case... */ /* We'll need the pg_proc tuple in any case... */
procTup = SearchSysCache(PROCOID, procTup = SearchSysCache1(PROCOID, ObjectIdGetDatum(fn_oid));
ObjectIdGetDatum(fn_oid),
0, 0, 0);
if (!HeapTupleIsValid(procTup)) if (!HeapTupleIsValid(procTup))
elog(ERROR, "cache lookup failed for function %u", fn_oid); elog(ERROR, "cache lookup failed for function %u", fn_oid);
procStruct = (Form_pg_proc) GETSTRUCT(procTup); 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 * Lookup the pg_language tuple by Oid
************************************************************/ ************************************************************/
langTup = SearchSysCache(LANGOID, langTup = SearchSysCache1(LANGOID,
ObjectIdGetDatum(procStruct->prolang), ObjectIdGetDatum(procStruct->prolang));
0, 0, 0);
if (!HeapTupleIsValid(langTup)) if (!HeapTupleIsValid(langTup))
{ {
free(prodesc->proname); free(prodesc->proname);
@ -1887,9 +1882,9 @@ compile_plperl_function(Oid fn_oid, bool is_trigger)
************************************************************/ ************************************************************/
if (!is_trigger) if (!is_trigger)
{ {
typeTup = SearchSysCache(TYPEOID, typeTup =
ObjectIdGetDatum(procStruct->prorettype), SearchSysCache1(TYPEOID,
0, 0, 0); ObjectIdGetDatum(procStruct->prorettype));
if (!HeapTupleIsValid(typeTup)) if (!HeapTupleIsValid(typeTup))
{ {
free(prodesc->proname); free(prodesc->proname);
@ -1948,9 +1943,8 @@ compile_plperl_function(Oid fn_oid, bool is_trigger)
prodesc->nargs = procStruct->pronargs; prodesc->nargs = procStruct->pronargs;
for (i = 0; i < prodesc->nargs; i++) for (i = 0; i < prodesc->nargs; i++)
{ {
typeTup = SearchSysCache(TYPEOID, typeTup = SearchSysCache1(TYPEOID,
ObjectIdGetDatum(procStruct->proargtypes.values[i]), ObjectIdGetDatum(procStruct->proargtypes.values[i]));
0, 0, 0);
if (!HeapTupleIsValid(typeTup)) if (!HeapTupleIsValid(typeTup))
{ {
free(prodesc->proname); free(prodesc->proname);

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 * Lookup the pg_proc tuple by Oid; we'll need it in any case
*/ */
procTup = SearchSysCache(PROCOID, procTup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcOid));
ObjectIdGetDatum(funcOid),
0, 0, 0);
if (!HeapTupleIsValid(procTup)) if (!HeapTupleIsValid(procTup))
elog(ERROR, "cache lookup failed for function %u", funcOid); elog(ERROR, "cache lookup failed for function %u", funcOid);
procStruct = (Form_pg_proc) GETSTRUCT(procTup); procStruct = (Form_pg_proc) GETSTRUCT(procTup);
@ -515,9 +513,7 @@ do_compile(FunctionCallInfo fcinfo,
/* /*
* Lookup the function's return type * Lookup the function's return type
*/ */
typeTup = SearchSysCache(TYPEOID, typeTup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(rettypeid));
ObjectIdGetDatum(rettypeid),
0, 0, 0);
if (!HeapTupleIsValid(typeTup)) if (!HeapTupleIsValid(typeTup))
elog(ERROR, "cache lookup failed for type %u", rettypeid); elog(ERROR, "cache lookup failed for type %u", rettypeid);
typeStruct = (Form_pg_type) GETSTRUCT(typeTup); typeStruct = (Form_pg_type) GETSTRUCT(typeTup);
@ -1629,9 +1625,7 @@ plpgsql_parse_cwordtype(List *idents)
else else
goto done; goto done;
classtup = SearchSysCache(RELOID, classtup = SearchSysCache1(RELOID, ObjectIdGetDatum(classOid));
ObjectIdGetDatum(classOid),
0, 0, 0);
if (!HeapTupleIsValid(classtup)) if (!HeapTupleIsValid(classtup))
goto done; goto done;
classStruct = (Form_pg_class) GETSTRUCT(classtup); classStruct = (Form_pg_class) GETSTRUCT(classtup);
@ -1653,9 +1647,8 @@ plpgsql_parse_cwordtype(List *idents)
goto done; goto done;
attrStruct = (Form_pg_attribute) GETSTRUCT(attrtup); attrStruct = (Form_pg_attribute) GETSTRUCT(attrtup);
typetup = SearchSysCache(TYPEOID, typetup = SearchSysCache1(TYPEOID,
ObjectIdGetDatum(attrStruct->atttypid), ObjectIdGetDatum(attrStruct->atttypid));
0, 0, 0);
if (!HeapTupleIsValid(typetup)) if (!HeapTupleIsValid(typetup))
elog(ERROR, "cache lookup failed for type %u", attrStruct->atttypid); elog(ERROR, "cache lookup failed for type %u", attrStruct->atttypid);
@ -1998,9 +1991,7 @@ plpgsql_build_datatype(Oid typeOid, int32 typmod)
HeapTuple typeTup; HeapTuple typeTup;
PLpgSQL_type *typ; PLpgSQL_type *typ;
typeTup = SearchSysCache(TYPEOID, typeTup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typeOid));
ObjectIdGetDatum(typeOid),
0, 0, 0);
if (!HeapTupleIsValid(typeTup)) if (!HeapTupleIsValid(typeTup))
elog(ERROR, "cache lookup failed for type %u", typeOid); elog(ERROR, "cache lookup failed for type %u", typeOid);

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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; int i;
/* Get the new function's pg_proc entry */ /* Get the new function's pg_proc entry */
tuple = SearchSysCache(PROCOID, tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcoid));
ObjectIdGetDatum(funcoid),
0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for function %u", funcoid); elog(ERROR, "cache lookup failed for function %u", funcoid);
proc = (Form_pg_proc) GETSTRUCT(tuple); proc = (Form_pg_proc) GETSTRUCT(tuple);

View File

@ -1,7 +1,7 @@
/********************************************************************** /**********************************************************************
* plpython.c - python as a procedural language for PostgreSQL * 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; int rv;
fn_oid = fcinfo->flinfo->fn_oid; fn_oid = fcinfo->flinfo->fn_oid;
procTup = SearchSysCache(PROCOID, procTup = SearchSysCache1(PROCOID, ObjectIdGetDatum(fn_oid));
ObjectIdGetDatum(fn_oid),
0, 0, 0);
if (!HeapTupleIsValid(procTup)) if (!HeapTupleIsValid(procTup))
elog(ERROR, "cache lookup failed for function %u", fn_oid); 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; HeapTuple rvTypeTup;
Form_pg_type rvTypeStruct; Form_pg_type rvTypeStruct;
rvTypeTup = SearchSysCache(TYPEOID, rvTypeTup = SearchSysCache1(TYPEOID,
ObjectIdGetDatum(procStruct->prorettype), ObjectIdGetDatum(procStruct->prorettype));
0, 0, 0);
if (!HeapTupleIsValid(rvTypeTup)) if (!HeapTupleIsValid(rvTypeTup))
elog(ERROR, "cache lookup failed for type %u", elog(ERROR, "cache lookup failed for type %u",
procStruct->prorettype); procStruct->prorettype);
@ -1483,9 +1480,8 @@ PLy_procedure_create(HeapTuple procTup, Oid tgreloid, char *key)
Assert(types[i] == procStruct->proargtypes.values[pos]); Assert(types[i] == procStruct->proargtypes.values[pos]);
argTypeTup = SearchSysCache(TYPEOID, argTypeTup = SearchSysCache1(TYPEOID,
ObjectIdGetDatum(types[i]), ObjectIdGetDatum(types[i]));
0, 0, 0);
if (!HeapTupleIsValid(argTypeTup)) if (!HeapTupleIsValid(argTypeTup))
elog(ERROR, "cache lookup failed for type %u", types[i]); elog(ERROR, "cache lookup failed for type %u", types[i]);
argTypeStruct = (Form_pg_type) GETSTRUCT(argTypeTup); 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) if (arg->in.r.atts[i].typoid == desc->attrs[i]->atttypid)
continue; /* already set up this entry */ continue; /* already set up this entry */
typeTup = SearchSysCache(TYPEOID, typeTup = SearchSysCache1(TYPEOID,
ObjectIdGetDatum(desc->attrs[i]->atttypid), ObjectIdGetDatum(desc->attrs[i]->atttypid));
0, 0, 0);
if (!HeapTupleIsValid(typeTup)) if (!HeapTupleIsValid(typeTup))
elog(ERROR, "cache lookup failed for type %u", elog(ERROR, "cache lookup failed for type %u",
desc->attrs[i]->atttypid); 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) if (arg->out.r.atts[i].typoid == desc->attrs[i]->atttypid)
continue; /* already set up this entry */ continue; /* already set up this entry */
typeTup = SearchSysCache(TYPEOID, typeTup = SearchSysCache1(TYPEOID,
ObjectIdGetDatum(desc->attrs[i]->atttypid), ObjectIdGetDatum(desc->attrs[i]->atttypid));
0, 0, 0);
if (!HeapTupleIsValid(typeTup)) if (!HeapTupleIsValid(typeTup))
elog(ERROR, "cache lookup failed for type %u", elog(ERROR, "cache lookup failed for type %u",
desc->attrs[i]->atttypid); desc->attrs[i]->atttypid);
@ -2850,9 +2844,8 @@ PLy_spi_prepare(PyObject *self, PyObject *args)
parseTypeString(sptr, &typeId, &typmod); parseTypeString(sptr, &typeId, &typmod);
typeTup = SearchSysCache(TYPEOID, typeTup = SearchSysCache1(TYPEOID,
ObjectIdGetDatum(typeId), ObjectIdGetDatum(typeId));
0, 0, 0);
if (!HeapTupleIsValid(typeTup)) if (!HeapTupleIsValid(typeTup))
elog(ERROR, "cache lookup failed for type %u", typeId); elog(ERROR, "cache lookup failed for type %u", typeId);

View File

@ -2,7 +2,7 @@
* pltcl.c - PostgreSQL support for Tcl as * pltcl.c - PostgreSQL support for Tcl as
* procedural language (PL) * 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 * Lookup the attribute type in the syscache
* for the input function * for the input function
************************************************************/ ************************************************************/
typeTup = SearchSysCache(TYPEOID, typeTup = SearchSysCache1(TYPEOID,
ObjectIdGetDatum(tupdesc->attrs[attnum - 1]->atttypid), ObjectIdGetDatum(tupdesc->attrs[attnum - 1]->atttypid));
0, 0, 0);
if (!HeapTupleIsValid(typeTup)) if (!HeapTupleIsValid(typeTup))
elog(ERROR, "cache lookup failed for type %u", elog(ERROR, "cache lookup failed for type %u",
tupdesc->attrs[attnum - 1]->atttypid); tupdesc->attrs[attnum - 1]->atttypid);
@ -1055,9 +1054,7 @@ compile_pltcl_function(Oid fn_oid, Oid tgreloid)
int tcl_rc; int tcl_rc;
/* We'll need the pg_proc tuple in any case... */ /* We'll need the pg_proc tuple in any case... */
procTup = SearchSysCache(PROCOID, procTup = SearchSysCache1(PROCOID, ObjectIdGetDatum(fn_oid));
ObjectIdGetDatum(fn_oid),
0, 0, 0);
if (!HeapTupleIsValid(procTup)) if (!HeapTupleIsValid(procTup))
elog(ERROR, "cache lookup failed for function %u", fn_oid); elog(ERROR, "cache lookup failed for function %u", fn_oid);
procStruct = (Form_pg_proc) GETSTRUCT(procTup); 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 * Lookup the pg_language tuple by Oid
************************************************************/ ************************************************************/
langTup = SearchSysCache(LANGOID, langTup = SearchSysCache1(LANGOID,
ObjectIdGetDatum(procStruct->prolang), ObjectIdGetDatum(procStruct->prolang));
0, 0, 0);
if (!HeapTupleIsValid(langTup)) if (!HeapTupleIsValid(langTup))
{ {
free(prodesc->user_proname); free(prodesc->user_proname);
@ -1167,9 +1163,9 @@ compile_pltcl_function(Oid fn_oid, Oid tgreloid)
************************************************************/ ************************************************************/
if (!is_trigger) if (!is_trigger)
{ {
typeTup = SearchSysCache(TYPEOID, typeTup =
ObjectIdGetDatum(procStruct->prorettype), SearchSysCache1(TYPEOID,
0, 0, 0); ObjectIdGetDatum(procStruct->prorettype));
if (!HeapTupleIsValid(typeTup)) if (!HeapTupleIsValid(typeTup))
{ {
free(prodesc->user_proname); free(prodesc->user_proname);
@ -1232,9 +1228,8 @@ compile_pltcl_function(Oid fn_oid, Oid tgreloid)
proc_internal_args[0] = '\0'; proc_internal_args[0] = '\0';
for (i = 0; i < prodesc->nargs; i++) for (i = 0; i < prodesc->nargs; i++)
{ {
typeTup = SearchSysCache(TYPEOID, typeTup = SearchSysCache1(TYPEOID,
ObjectIdGetDatum(procStruct->proargtypes.values[i]), ObjectIdGetDatum(procStruct->proargtypes.values[i]));
0, 0, 0);
if (!HeapTupleIsValid(typeTup)) if (!HeapTupleIsValid(typeTup))
{ {
free(prodesc->user_proname); 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 * Lookup the attribute type in the syscache
* for the output function * for the output function
************************************************************/ ************************************************************/
typeTup = SearchSysCache(TYPEOID, typeTup = SearchSysCache1(TYPEOID,
ObjectIdGetDatum(tupdesc->attrs[i]->atttypid), ObjectIdGetDatum(tupdesc->attrs[i]->atttypid));
0, 0, 0);
if (!HeapTupleIsValid(typeTup)) if (!HeapTupleIsValid(typeTup))
elog(ERROR, "cache lookup failed for type %u", elog(ERROR, "cache lookup failed for type %u",
tupdesc->attrs[i]->atttypid); tupdesc->attrs[i]->atttypid);
@ -2406,9 +2400,8 @@ pltcl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc,
* Lookup the attribute type in the syscache * Lookup the attribute type in the syscache
* for the output function * for the output function
************************************************************/ ************************************************************/
typeTup = SearchSysCache(TYPEOID, typeTup = SearchSysCache1(TYPEOID,
ObjectIdGetDatum(tupdesc->attrs[i]->atttypid), ObjectIdGetDatum(tupdesc->attrs[i]->atttypid));
0, 0, 0);
if (!HeapTupleIsValid(typeTup)) if (!HeapTupleIsValid(typeTup))
elog(ERROR, "cache lookup failed for type %u", elog(ERROR, "cache lookup failed for type %u",
tupdesc->attrs[i]->atttypid); tupdesc->attrs[i]->atttypid);