1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-29 23:43:17 +03:00

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 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/acl.c,v 1.155 2010/01/12 02:39:22 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/acl.c,v 1.156 2010/02/14 18:42:16 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -599,9 +599,7 @@ aclitemout(PG_FUNCTION_ARGS)
if (aip->ai_grantee != ACL_ID_PUBLIC)
{
htup = SearchSysCache(AUTHOID,
ObjectIdGetDatum(aip->ai_grantee),
0, 0, 0);
htup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(aip->ai_grantee));
if (HeapTupleIsValid(htup))
{
putid(p, NameStr(((Form_pg_authid) GETSTRUCT(htup))->rolname));
@@ -629,9 +627,7 @@ aclitemout(PG_FUNCTION_ARGS)
*p++ = '/';
*p = '\0';
htup = SearchSysCache(AUTHOID,
ObjectIdGetDatum(aip->ai_grantor),
0, 0, 0);
htup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(aip->ai_grantor));
if (HeapTupleIsValid(htup))
{
putid(p, NameStr(((Form_pg_authid) GETSTRUCT(htup))->rolname));
@@ -1846,9 +1842,7 @@ has_table_privilege_name_id(PG_FUNCTION_ARGS)
roleid = get_roleid_checked(NameStr(*username));
mode = convert_table_priv_string(priv_type_text);
if (!SearchSysCacheExists(RELOID,
ObjectIdGetDatum(tableoid),
0, 0, 0))
if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(tableoid)))
PG_RETURN_NULL();
aclresult = pg_class_aclcheck(tableoid, roleid, mode);
@@ -1874,9 +1868,7 @@ has_table_privilege_id(PG_FUNCTION_ARGS)
roleid = GetUserId();
mode = convert_table_priv_string(priv_type_text);
if (!SearchSysCacheExists(RELOID,
ObjectIdGetDatum(tableoid),
0, 0, 0))
if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(tableoid)))
PG_RETURN_NULL();
aclresult = pg_class_aclcheck(tableoid, roleid, mode);
@@ -1923,9 +1915,7 @@ has_table_privilege_id_id(PG_FUNCTION_ARGS)
mode = convert_table_priv_string(priv_type_text);
if (!SearchSysCacheExists(RELOID,
ObjectIdGetDatum(tableoid),
0, 0, 0))
if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(tableoid)))
PG_RETURN_NULL();
aclresult = pg_class_aclcheck(tableoid, roleid, mode);
@@ -2278,9 +2268,7 @@ has_any_column_privilege_name_id(PG_FUNCTION_ARGS)
roleid = get_roleid_checked(NameStr(*username));
mode = convert_column_priv_string(priv_type_text);
if (!SearchSysCacheExists(RELOID,
ObjectIdGetDatum(tableoid),
0, 0, 0))
if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(tableoid)))
PG_RETURN_NULL();
/* First check at table level, then examine each column if needed */
@@ -2310,9 +2298,7 @@ has_any_column_privilege_id(PG_FUNCTION_ARGS)
roleid = GetUserId();
mode = convert_column_priv_string(priv_type_text);
if (!SearchSysCacheExists(RELOID,
ObjectIdGetDatum(tableoid),
0, 0, 0))
if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(tableoid)))
PG_RETURN_NULL();
/* First check at table level, then examine each column if needed */
@@ -2367,9 +2353,7 @@ has_any_column_privilege_id_id(PG_FUNCTION_ARGS)
mode = convert_column_priv_string(priv_type_text);
if (!SearchSysCacheExists(RELOID,
ObjectIdGetDatum(tableoid),
0, 0, 0))
if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(tableoid)))
PG_RETURN_NULL();
/* First check at table level, then examine each column if needed */
@@ -2417,9 +2401,7 @@ column_privilege_check(Oid tableoid, AttrNumber attnum,
* here and there. So if we see the row in the syscache, so will
* pg_class_aclcheck.
*/
if (!SearchSysCacheExists(RELOID,
ObjectIdGetDatum(tableoid),
0, 0, 0))
if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(tableoid)))
return -1;
aclresult = pg_class_aclcheck(tableoid, roleid, mode);
@@ -2432,10 +2414,9 @@ column_privilege_check(Oid tableoid, AttrNumber attnum,
* check for dropped attribute first, and we rely on the syscache not to
* notice a concurrent drop before pg_attribute_aclcheck fetches the row.
*/
attTuple = SearchSysCache(ATTNUM,
ObjectIdGetDatum(tableoid),
Int16GetDatum(attnum),
0, 0);
attTuple = SearchSysCache2(ATTNUM,
ObjectIdGetDatum(tableoid),
Int16GetDatum(attnum));
if (!HeapTupleIsValid(attTuple))
return -1;
attributeForm = (Form_pg_attribute) GETSTRUCT(attTuple);
@@ -2893,9 +2874,7 @@ has_database_privilege_name_id(PG_FUNCTION_ARGS)
roleid = get_roleid_checked(NameStr(*username));
mode = convert_database_priv_string(priv_type_text);
if (!SearchSysCacheExists(DATABASEOID,
ObjectIdGetDatum(databaseoid),
0, 0, 0))
if (!SearchSysCacheExists1(DATABASEOID, ObjectIdGetDatum(databaseoid)))
PG_RETURN_NULL();
aclresult = pg_database_aclcheck(databaseoid, roleid, mode);
@@ -2921,9 +2900,7 @@ has_database_privilege_id(PG_FUNCTION_ARGS)
roleid = GetUserId();
mode = convert_database_priv_string(priv_type_text);
if (!SearchSysCacheExists(DATABASEOID,
ObjectIdGetDatum(databaseoid),
0, 0, 0))
if (!SearchSysCacheExists1(DATABASEOID, ObjectIdGetDatum(databaseoid)))
PG_RETURN_NULL();
aclresult = pg_database_aclcheck(databaseoid, roleid, mode);
@@ -2970,9 +2947,7 @@ has_database_privilege_id_id(PG_FUNCTION_ARGS)
mode = convert_database_priv_string(priv_type_text);
if (!SearchSysCacheExists(DATABASEOID,
ObjectIdGetDatum(databaseoid),
0, 0, 0))
if (!SearchSysCacheExists1(DATABASEOID, ObjectIdGetDatum(databaseoid)))
PG_RETURN_NULL();
aclresult = pg_database_aclcheck(databaseoid, roleid, mode);
@@ -3286,9 +3261,7 @@ has_function_privilege_name_id(PG_FUNCTION_ARGS)
roleid = get_roleid_checked(NameStr(*username));
mode = convert_function_priv_string(priv_type_text);
if (!SearchSysCacheExists(PROCOID,
ObjectIdGetDatum(functionoid),
0, 0, 0))
if (!SearchSysCacheExists1(PROCOID, ObjectIdGetDatum(functionoid)))
PG_RETURN_NULL();
aclresult = pg_proc_aclcheck(functionoid, roleid, mode);
@@ -3314,9 +3287,7 @@ has_function_privilege_id(PG_FUNCTION_ARGS)
roleid = GetUserId();
mode = convert_function_priv_string(priv_type_text);
if (!SearchSysCacheExists(PROCOID,
ObjectIdGetDatum(functionoid),
0, 0, 0))
if (!SearchSysCacheExists1(PROCOID, ObjectIdGetDatum(functionoid)))
PG_RETURN_NULL();
aclresult = pg_proc_aclcheck(functionoid, roleid, mode);
@@ -3363,9 +3334,7 @@ has_function_privilege_id_id(PG_FUNCTION_ARGS)
mode = convert_function_priv_string(priv_type_text);
if (!SearchSysCacheExists(PROCOID,
ObjectIdGetDatum(functionoid),
0, 0, 0))
if (!SearchSysCacheExists1(PROCOID, ObjectIdGetDatum(functionoid)))
PG_RETURN_NULL();
aclresult = pg_proc_aclcheck(functionoid, roleid, mode);
@@ -3492,9 +3461,7 @@ has_language_privilege_name_id(PG_FUNCTION_ARGS)
roleid = get_roleid_checked(NameStr(*username));
mode = convert_language_priv_string(priv_type_text);
if (!SearchSysCacheExists(LANGOID,
ObjectIdGetDatum(languageoid),
0, 0, 0))
if (!SearchSysCacheExists1(LANGOID, ObjectIdGetDatum(languageoid)))
PG_RETURN_NULL();
aclresult = pg_language_aclcheck(languageoid, roleid, mode);
@@ -3520,9 +3487,7 @@ has_language_privilege_id(PG_FUNCTION_ARGS)
roleid = GetUserId();
mode = convert_language_priv_string(priv_type_text);
if (!SearchSysCacheExists(LANGOID,
ObjectIdGetDatum(languageoid),
0, 0, 0))
if (!SearchSysCacheExists1(LANGOID, ObjectIdGetDatum(languageoid)))
PG_RETURN_NULL();
aclresult = pg_language_aclcheck(languageoid, roleid, mode);
@@ -3569,9 +3534,7 @@ has_language_privilege_id_id(PG_FUNCTION_ARGS)
mode = convert_language_priv_string(priv_type_text);
if (!SearchSysCacheExists(LANGOID,
ObjectIdGetDatum(languageoid),
0, 0, 0))
if (!SearchSysCacheExists1(LANGOID, ObjectIdGetDatum(languageoid)))
PG_RETURN_NULL();
aclresult = pg_language_aclcheck(languageoid, roleid, mode);
@@ -3592,9 +3555,7 @@ convert_language_name(text *languagename)
char *langname = text_to_cstring(languagename);
Oid oid;
oid = GetSysCacheOid(LANGNAME,
CStringGetDatum(langname),
0, 0, 0);
oid = GetSysCacheOid1(LANGNAME, CStringGetDatum(langname));
if (!OidIsValid(oid))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -3698,9 +3659,7 @@ has_schema_privilege_name_id(PG_FUNCTION_ARGS)
roleid = get_roleid_checked(NameStr(*username));
mode = convert_schema_priv_string(priv_type_text);
if (!SearchSysCacheExists(NAMESPACEOID,
ObjectIdGetDatum(schemaoid),
0, 0, 0))
if (!SearchSysCacheExists1(NAMESPACEOID, ObjectIdGetDatum(schemaoid)))
PG_RETURN_NULL();
aclresult = pg_namespace_aclcheck(schemaoid, roleid, mode);
@@ -3726,9 +3685,7 @@ has_schema_privilege_id(PG_FUNCTION_ARGS)
roleid = GetUserId();
mode = convert_schema_priv_string(priv_type_text);
if (!SearchSysCacheExists(NAMESPACEOID,
ObjectIdGetDatum(schemaoid),
0, 0, 0))
if (!SearchSysCacheExists1(NAMESPACEOID, ObjectIdGetDatum(schemaoid)))
PG_RETURN_NULL();
aclresult = pg_namespace_aclcheck(schemaoid, roleid, mode);
@@ -3775,9 +3732,7 @@ has_schema_privilege_id_id(PG_FUNCTION_ARGS)
mode = convert_schema_priv_string(priv_type_text);
if (!SearchSysCacheExists(NAMESPACEOID,
ObjectIdGetDatum(schemaoid),
0, 0, 0))
if (!SearchSysCacheExists1(NAMESPACEOID, ObjectIdGetDatum(schemaoid)))
PG_RETURN_NULL();
aclresult = pg_namespace_aclcheck(schemaoid, roleid, mode);
@@ -3798,9 +3753,7 @@ convert_schema_name(text *schemaname)
char *nspname = text_to_cstring(schemaname);
Oid oid;
oid = GetSysCacheOid(NAMESPACENAME,
CStringGetDatum(nspname),
0, 0, 0);
oid = GetSysCacheOid1(NAMESPACENAME, CStringGetDatum(nspname));
if (!OidIsValid(oid))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_SCHEMA),
@@ -4443,9 +4396,7 @@ has_rolinherit(Oid roleid)
bool result = false;
HeapTuple utup;
utup = SearchSysCache(AUTHOID,
ObjectIdGetDatum(roleid),
0, 0, 0);
utup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid));
if (HeapTupleIsValid(utup))
{
result = ((Form_pg_authid) GETSTRUCT(utup))->rolinherit;
@@ -4505,9 +4456,8 @@ roles_has_privs_of(Oid roleid)
continue;
/* Find roles that memberid is directly a member of */
memlist = SearchSysCacheList(AUTHMEMMEMROLE, 1,
ObjectIdGetDatum(memberid),
0, 0, 0);
memlist = SearchSysCacheList1(AUTHMEMMEMROLE,
ObjectIdGetDatum(memberid));
for (i = 0; i < memlist->n_members; i++)
{
HeapTuple tup = &memlist->members[i]->tuple;
@@ -4585,9 +4535,8 @@ roles_is_member_of(Oid roleid)
int i;
/* Find roles that memberid is directly a member of */
memlist = SearchSysCacheList(AUTHMEMMEMROLE, 1,
ObjectIdGetDatum(memberid),
0, 0, 0);
memlist = SearchSysCacheList1(AUTHMEMMEMROLE,
ObjectIdGetDatum(memberid));
for (i = 0; i < memlist->n_members; i++)
{
HeapTuple tup = &memlist->members[i]->tuple;
@@ -4744,9 +4693,8 @@ is_admin_of_role(Oid member, Oid role)
int i;
/* Find roles that memberid is directly a member of */
memlist = SearchSysCacheList(AUTHMEMMEMROLE, 1,
ObjectIdGetDatum(memberid),
0, 0, 0);
memlist = SearchSysCacheList1(AUTHMEMMEMROLE,
ObjectIdGetDatum(memberid));
for (i = 0; i < memlist->n_members; i++)
{
HeapTuple tup = &memlist->members[i]->tuple;

View File

@@ -5,7 +5,7 @@
* Copyright (c) 2002-2010, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/dbsize.c,v 1.29 2010/02/07 20:48:10 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/dbsize.c,v 1.30 2010/02/14 18:42:16 rhaas Exp $
*
*/
@@ -531,9 +531,7 @@ pg_relation_filenode(PG_FUNCTION_ARGS)
HeapTuple tuple;
Form_pg_class relform;
tuple = SearchSysCache(RELOID,
ObjectIdGetDatum(relid),
0, 0, 0);
tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tuple))
PG_RETURN_NULL();
relform = (Form_pg_class) GETSTRUCT(tuple);
@@ -580,9 +578,7 @@ pg_relation_filepath(PG_FUNCTION_ARGS)
RelFileNode rnode;
char *path;
tuple = SearchSysCache(RELOID,
ObjectIdGetDatum(relid),
0, 0, 0);
tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tuple))
PG_RETURN_NULL();
relform = (Form_pg_class) GETSTRUCT(tuple);

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/enum.c,v 1.9 2010/01/02 16:57:53 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/enum.c,v 1.10 2010/02/14 18:42:16 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -45,10 +45,9 @@ enum_in(PG_FUNCTION_ARGS)
format_type_be(enumtypoid),
name)));
tup = SearchSysCache(ENUMTYPOIDNAME,
ObjectIdGetDatum(enumtypoid),
CStringGetDatum(name),
0, 0);
tup = SearchSysCache2(ENUMTYPOIDNAME,
ObjectIdGetDatum(enumtypoid),
CStringGetDatum(name));
if (!HeapTupleIsValid(tup))
ereport(ERROR,
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
@@ -75,9 +74,7 @@ enum_out(PG_FUNCTION_ARGS)
HeapTuple tup;
Form_pg_enum en;
tup = SearchSysCache(ENUMOID,
ObjectIdGetDatum(enumval),
0, 0, 0);
tup = SearchSysCache1(ENUMOID, ObjectIdGetDatum(enumval));
if (!HeapTupleIsValid(tup))
ereport(ERROR,
(errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
@@ -113,10 +110,9 @@ enum_recv(PG_FUNCTION_ARGS)
format_type_be(enumtypoid),
name)));
tup = SearchSysCache(ENUMTYPOIDNAME,
ObjectIdGetDatum(enumtypoid),
CStringGetDatum(name),
0, 0);
tup = SearchSysCache2(ENUMTYPOIDNAME,
ObjectIdGetDatum(enumtypoid),
CStringGetDatum(name));
if (!HeapTupleIsValid(tup))
ereport(ERROR,
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
@@ -141,9 +137,7 @@ enum_send(PG_FUNCTION_ARGS)
HeapTuple tup;
Form_pg_enum en;
tup = SearchSysCache(ENUMOID,
ObjectIdGetDatum(enumval),
0, 0, 0);
tup = SearchSysCache1(ENUMOID, ObjectIdGetDatum(enumval));
if (!HeapTupleIsValid(tup))
ereport(ERROR,
(errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
@@ -269,9 +263,7 @@ enum_first(PG_FUNCTION_ARGS)
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("could not determine actual enum type")));
list = SearchSysCacheList(ENUMTYPOIDNAME, 1,
ObjectIdGetDatum(enumtypoid),
0, 0, 0);
list = SearchSysCacheList1(ENUMTYPOIDNAME, ObjectIdGetDatum(enumtypoid));
num = list->n_members;
for (i = 0; i < num; i++)
{
@@ -310,9 +302,7 @@ enum_last(PG_FUNCTION_ARGS)
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("could not determine actual enum type")));
list = SearchSysCacheList(ENUMTYPOIDNAME, 1,
ObjectIdGetDatum(enumtypoid),
0, 0, 0);
list = SearchSysCacheList1(ENUMTYPOIDNAME, ObjectIdGetDatum(enumtypoid));
num = list->n_members;
for (i = 0; i < num; i++)
{
@@ -393,9 +383,7 @@ enum_range_internal(Oid enumtypoid, Oid lower, Oid upper)
j;
Datum *elems;
list = SearchSysCacheList(ENUMTYPOIDNAME, 1,
ObjectIdGetDatum(enumtypoid),
0, 0, 0);
list = SearchSysCacheList1(ENUMTYPOIDNAME, ObjectIdGetDatum(enumtypoid));
total = list->n_members;
elems = (Datum *) palloc(total * sizeof(Datum));

View File

@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/format_type.c,v 1.52 2010/01/02 16:57:53 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/format_type.c,v 1.53 2010/02/14 18:42:16 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -123,9 +123,7 @@ format_type_internal(Oid type_oid, int32 typemod,
if (type_oid == InvalidOid && allow_invalid)
return pstrdup("-");
tuple = SearchSysCache(TYPEOID,
ObjectIdGetDatum(type_oid),
0, 0, 0);
tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type_oid));
if (!HeapTupleIsValid(tuple))
{
if (allow_invalid)
@@ -151,9 +149,7 @@ format_type_internal(Oid type_oid, int32 typemod,
{
/* Switch our attention to the array element type */
ReleaseSysCache(tuple);
tuple = SearchSysCache(TYPEOID,
ObjectIdGetDatum(array_base_type),
0, 0, 0);
tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(array_base_type));
if (!HeapTupleIsValid(tuple))
{
if (allow_invalid)

View File

@@ -13,7 +13,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/regproc.c,v 1.112 2010/01/02 16:57:55 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/regproc.c,v 1.113 2010/02/14 18:42:16 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -164,9 +164,7 @@ regprocout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
proctup = SearchSysCache(PROCOID,
ObjectIdGetDatum(proid),
0, 0, 0);
proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(proid));
if (HeapTupleIsValid(proctup))
{
@@ -307,9 +305,7 @@ format_procedure(Oid procedure_oid)
char *result;
HeapTuple proctup;
proctup = SearchSysCache(PROCOID,
ObjectIdGetDatum(procedure_oid),
0, 0, 0);
proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(procedure_oid));
if (HeapTupleIsValid(proctup))
{
@@ -513,9 +509,7 @@ regoperout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
opertup = SearchSysCache(OPEROID,
ObjectIdGetDatum(oprid),
0, 0, 0);
opertup = SearchSysCache1(OPEROID, ObjectIdGetDatum(oprid));
if (HeapTupleIsValid(opertup))
{
@@ -663,9 +657,7 @@ format_operator(Oid operator_oid)
char *result;
HeapTuple opertup;
opertup = SearchSysCache(OPEROID,
ObjectIdGetDatum(operator_oid),
0, 0, 0);
opertup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operator_oid));
if (HeapTupleIsValid(opertup))
{
@@ -852,9 +844,7 @@ regclassout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
classtup = SearchSysCache(RELOID,
ObjectIdGetDatum(classid),
0, 0, 0);
classtup = SearchSysCache1(RELOID, ObjectIdGetDatum(classid));
if (HeapTupleIsValid(classtup))
{
@@ -1015,9 +1005,7 @@ regtypeout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
typetup = SearchSysCache(TYPEOID,
ObjectIdGetDatum(typid),
0, 0, 0);
typetup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
if (HeapTupleIsValid(typetup))
{
@@ -1129,9 +1117,7 @@ regconfigout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
cfgtup = SearchSysCache(TSCONFIGOID,
ObjectIdGetDatum(cfgid),
0, 0, 0);
cfgtup = SearchSysCache1(TSCONFIGOID, ObjectIdGetDatum(cfgid));
if (HeapTupleIsValid(cfgtup))
{
@@ -1241,9 +1227,7 @@ regdictionaryout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
dicttup = SearchSysCache(TSDICTOID,
ObjectIdGetDatum(dictid),
0, 0, 0);
dicttup = SearchSysCache1(TSDICTOID, ObjectIdGetDatum(dictid));
if (HeapTupleIsValid(dicttup))
{

View File

@@ -15,7 +15,7 @@
*
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/backend/utils/adt/ri_triggers.c,v 1.117 2010/01/02 16:57:55 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/ri_triggers.c,v 1.118 2010/02/14 18:42:16 rhaas Exp $
*
* ----------
*/
@@ -2901,9 +2901,7 @@ ri_GenerateQual(StringInfo buf,
char *oprname;
char *nspname;
opertup = SearchSysCache(OPEROID,
ObjectIdGetDatum(opoid),
0, 0, 0);
opertup = SearchSysCache1(OPEROID, ObjectIdGetDatum(opoid));
if (!HeapTupleIsValid(opertup))
elog(ERROR, "cache lookup failed for operator %u", opoid);
operform = (Form_pg_operator) GETSTRUCT(opertup);
@@ -2940,9 +2938,7 @@ ri_add_cast_to(StringInfo buf, Oid typid)
char *typname;
char *nspname;
typetup = SearchSysCache(TYPEOID,
ObjectIdGetDatum(typid),
0, 0, 0);
typetup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
if (!HeapTupleIsValid(typetup))
elog(ERROR, "cache lookup failed for type %u", typid);
typform = (Form_pg_type) GETSTRUCT(typetup);
@@ -3071,9 +3067,7 @@ ri_FetchConstraintInfo(RI_ConstraintInfo *riinfo,
errhint("Remove this referential integrity trigger and its mates, then do ALTER TABLE ADD CONSTRAINT.")));
/* OK, fetch the tuple */
tup = SearchSysCache(CONSTROID,
ObjectIdGetDatum(constraintOid),
0, 0, 0);
tup = SearchSysCache1(CONSTROID, ObjectIdGetDatum(constraintOid));
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for constraint %u", constraintOid);
conForm = (Form_pg_constraint) GETSTRUCT(tup);

View File

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

View File

@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.268 2010/01/05 21:53:59 rhaas Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.269 2010/02/14 18:42:16 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -4117,11 +4117,10 @@ examine_variable(PlannerInfo *root, Node *node, int varRelid,
}
else if (rte->rtekind == RTE_RELATION)
{
vardata->statsTuple = SearchSysCache(STATRELATTINH,
ObjectIdGetDatum(rte->relid),
Int16GetDatum(var->varattno),
BoolGetDatum(rte->inh),
0);
vardata->statsTuple = SearchSysCache3(STATRELATTINH,
ObjectIdGetDatum(rte->relid),
Int16GetDatum(var->varattno),
BoolGetDatum(rte->inh));
vardata->freefunc = ReleaseSysCache;
}
else
@@ -4258,11 +4257,10 @@ examine_variable(PlannerInfo *root, Node *node, int varRelid,
else if (index->indpred == NIL)
{
vardata->statsTuple =
SearchSysCache(STATRELATTINH,
SearchSysCache3(STATRELATTINH,
ObjectIdGetDatum(index->indexoid),
Int16GetDatum(pos + 1),
BoolGetDatum(false),
0);
Int16GetDatum(pos + 1),
BoolGetDatum(false));
vardata->freefunc = ReleaseSysCache;
}
if (vardata->statsTuple)
@@ -6116,11 +6114,10 @@ btcostestimate(PG_FUNCTION_ARGS)
}
else
{
vardata.statsTuple = SearchSysCache(STATRELATTINH,
ObjectIdGetDatum(relid),
Int16GetDatum(colnum),
BoolGetDatum(rte->inh),
0);
vardata.statsTuple = SearchSysCache3(STATRELATTINH,
ObjectIdGetDatum(relid),
Int16GetDatum(colnum),
BoolGetDatum(rte->inh));
vardata.freefunc = ReleaseSysCache;
}
}
@@ -6143,11 +6140,10 @@ btcostestimate(PG_FUNCTION_ARGS)
}
else
{
vardata.statsTuple = SearchSysCache(STATRELATTINH,
ObjectIdGetDatum(relid),
Int16GetDatum(colnum),
BoolGetDatum(false),
0);
vardata.statsTuple = SearchSysCache3(STATRELATTINH,
ObjectIdGetDatum(relid),
Int16GetDatum(colnum),
BoolGetDatum(false));
vardata.freefunc = ReleaseSysCache;
}
}

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.95 2010/01/02 16:57:55 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.96 2010/02/14 18:42:17 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -2612,9 +2612,7 @@ map_sql_table_to_xmlschema(TupleDesc tupdesc, Oid relid, bool nulls,
HeapTuple tuple;
Form_pg_class reltuple;
tuple = SearchSysCache(RELOID,
ObjectIdGetDatum(relid),
0, 0, 0);
tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", relid);
reltuple = (Form_pg_class) GETSTRUCT(tuple);
@@ -2912,9 +2910,7 @@ map_sql_type_to_xml_name(Oid typeoid, int typmod)
HeapTuple tuple;
Form_pg_type typtuple;
tuple = SearchSysCache(TYPEOID,
ObjectIdGetDatum(typeoid),
0, 0, 0);
tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typeoid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for type %u", typeoid);
typtuple = (Form_pg_type) GETSTRUCT(tuple);

View File

@@ -10,7 +10,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/cache/attoptcache.c,v 1.1 2010/01/22 16:42:31 rhaas Exp $
* $PostgreSQL: pgsql/src/backend/utils/cache/attoptcache.c,v 1.2 2010/02/14 18:42:17 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -128,10 +128,9 @@ get_attribute_options(Oid attrelid, int attnum)
{
AttributeOpts *opts;
tp = SearchSysCache(ATTNUM,
ObjectIdGetDatum(attrelid),
Int16GetDatum(attnum),
0, 0);
tp = SearchSysCache2(ATTNUM,
ObjectIdGetDatum(attrelid),
Int16GetDatum(attnum));
/*
* If we don't find a valid HeapTuple, it must mean someone has

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/cache/catcache.c,v 1.150 2010/02/08 05:53:55 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/cache/catcache.c,v 1.151 2010/02/14 18:42:17 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -226,7 +226,7 @@ CatalogCacheComputeHashValue(CatCache *cache, int nkeys, ScanKey cur_skey)
static uint32
CatalogCacheComputeTupleHashValue(CatCache *cache, HeapTuple tuple)
{
ScanKeyData cur_skey[4];
ScanKeyData cur_skey[CATCACHE_MAXKEYS];
bool isNull = false;
/* Copy pre-initialized overhead data for scankey */
@@ -1038,7 +1038,7 @@ SearchCatCache(CatCache *cache,
Datum v3,
Datum v4)
{
ScanKeyData cur_skey[4];
ScanKeyData cur_skey[CATCACHE_MAXKEYS];
uint32 hashValue;
Index hashIndex;
Dlelem *elt;
@@ -1279,7 +1279,7 @@ SearchCatCacheList(CatCache *cache,
Datum v3,
Datum v4)
{
ScanKeyData cur_skey[4];
ScanKeyData cur_skey[CATCACHE_MAXKEYS];
uint32 lHashValue;
Dlelem *elt;
CatCList *cl;

View File

@@ -80,7 +80,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/cache/inval.c,v 1.96 2010/02/13 16:15:47 sriggs Exp $
* $PostgreSQL: pgsql/src/backend/utils/cache/inval.c,v 1.97 2010/02/14 18:42:17 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1135,9 +1135,7 @@ CacheInvalidateRelcacheByRelid(Oid relid)
{
HeapTuple tup;
tup = SearchSysCache(RELOID,
ObjectIdGetDatum(relid),
0, 0, 0);
tup = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for relation %u", relid);
CacheInvalidateRelcacheByTuple(tup);

View File

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

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.305 2010/02/09 21:43:30 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.306 2010/02/14 18:42:17 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -976,9 +976,8 @@ RelationInitIndexAccessInfo(Relation relation)
* contains variable-length and possibly-null fields, we have to do this
* honestly rather than just treating it as a Form_pg_index struct.
*/
tuple = SearchSysCache(INDEXRELID,
ObjectIdGetDatum(RelationGetRelid(relation)),
0, 0, 0);
tuple = SearchSysCache1(INDEXRELID,
ObjectIdGetDatum(RelationGetRelid(relation)));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for index %u",
RelationGetRelid(relation));
@@ -991,9 +990,7 @@ RelationInitIndexAccessInfo(Relation relation)
/*
* Make a copy of the pg_am entry for the index's access method
*/
tuple = SearchSysCache(AMOID,
ObjectIdGetDatum(relation->rd_rel->relam),
0, 0, 0);
tuple = SearchSysCache1(AMOID, ObjectIdGetDatum(relation->rd_rel->relam));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for access method %u",
relation->rd_rel->relam);
@@ -1757,9 +1754,8 @@ RelationReloadIndexInfo(Relation relation)
HeapTuple tuple;
Form_pg_index index;
tuple = SearchSysCache(INDEXRELID,
ObjectIdGetDatum(RelationGetRelid(relation)),
0, 0, 0);
tuple = SearchSysCache1(INDEXRELID,
ObjectIdGetDatum(RelationGetRelid(relation)));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for index %u",
RelationGetRelid(relation));
@@ -2627,9 +2623,8 @@ RelationSetNewRelfilenode(Relation relation, TransactionId freezeXid)
*/
pg_class = heap_open(RelationRelationId, RowExclusiveLock);
tuple = SearchSysCacheCopy(RELOID,
ObjectIdGetDatum(RelationGetRelid(relation)),
0, 0, 0);
tuple = SearchSysCacheCopy1(RELOID,
ObjectIdGetDatum(RelationGetRelid(relation)));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "could not find tuple for relation %u",
RelationGetRelid(relation));
@@ -2947,9 +2942,8 @@ RelationCacheInitializePhase3(void)
HeapTuple htup;
Form_pg_class relp;
htup = SearchSysCache(RELOID,
ObjectIdGetDatum(RelationGetRelid(relation)),
0, 0, 0);
htup = SearchSysCache1(RELOID,
ObjectIdGetDatum(RelationGetRelid(relation)));
if (!HeapTupleIsValid(htup))
elog(FATAL, "cache lookup failed for relation %u",
RelationGetRelid(relation));

View File

@@ -12,7 +12,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/cache/spccache.c,v 1.4 2010/01/07 03:53:08 rhaas Exp $
* $PostgreSQL: pgsql/src/backend/utils/cache/spccache.c,v 1.5 2010/02/14 18:42:17 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -133,9 +133,7 @@ get_tablespace(Oid spcid)
* details for a non-existent tablespace. We'll just treat that case as if
* no options were specified.
*/
tp = SearchSysCache(TABLESPACEOID,
ObjectIdGetDatum(spcid),
0, 0, 0);
tp = SearchSysCache1(TABLESPACEOID, ObjectIdGetDatum(spcid));
if (!HeapTupleIsValid(tp))
opts = NULL;
else

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/cache/syscache.c,v 1.125 2010/02/08 05:53:55 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/cache/syscache.c,v 1.126 2010/02/14 18:42:17 rhaas Exp $
*
* NOTES
* These routines allow the parser/planner/executor to perform
@@ -909,10 +909,9 @@ SearchSysCacheAttName(Oid relid, const char *attname)
{
HeapTuple tuple;
tuple = SearchSysCache(ATTNAME,
ObjectIdGetDatum(relid),
CStringGetDatum(attname),
0, 0);
tuple = SearchSysCache2(ATTNAME,
ObjectIdGetDatum(relid),
CStringGetDatum(attname));
if (!HeapTupleIsValid(tuple))
return NULL;
if (((Form_pg_attribute) GETSTRUCT(tuple))->attisdropped)

View File

@@ -20,7 +20,7 @@
* Copyright (c) 2006-2010, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/cache/ts_cache.c,v 1.11 2010/01/02 16:57:56 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/cache/ts_cache.c,v 1.12 2010/02/14 18:42:17 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -151,9 +151,7 @@ lookup_ts_parser_cache(Oid prsId)
HeapTuple tp;
Form_pg_ts_parser prs;
tp = SearchSysCache(TSPARSEROID,
ObjectIdGetDatum(prsId),
0, 0, 0);
tp = SearchSysCache1(TSPARSEROID, ObjectIdGetDatum(prsId));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for text search parser %u",
prsId);
@@ -257,9 +255,7 @@ lookup_ts_dictionary_cache(Oid dictId)
Form_pg_ts_template template;
MemoryContext saveCtx;
tpdict = SearchSysCache(TSDICTOID,
ObjectIdGetDatum(dictId),
0, 0, 0);
tpdict = SearchSysCache1(TSDICTOID, ObjectIdGetDatum(dictId));
if (!HeapTupleIsValid(tpdict))
elog(ERROR, "cache lookup failed for text search dictionary %u",
dictId);
@@ -274,9 +270,8 @@ lookup_ts_dictionary_cache(Oid dictId)
/*
* Retrieve dictionary's template
*/
tptmpl = SearchSysCache(TSTEMPLATEOID,
ObjectIdGetDatum(dict->dicttemplate),
0, 0, 0);
tptmpl = SearchSysCache1(TSTEMPLATEOID,
ObjectIdGetDatum(dict->dicttemplate));
if (!HeapTupleIsValid(tptmpl))
elog(ERROR, "cache lookup failed for text search template %u",
dict->dicttemplate);
@@ -430,9 +425,7 @@ lookup_ts_config_cache(Oid cfgId)
int ndicts;
int i;
tp = SearchSysCache(TSCONFIGOID,
ObjectIdGetDatum(cfgId),
0, 0, 0);
tp = SearchSysCache1(TSCONFIGOID, ObjectIdGetDatum(cfgId));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for text search configuration %u",
cfgId);
@@ -617,9 +610,7 @@ assignTSCurrentConfig(const char *newval, bool doit, GucSource source)
* Modify the actually stored value to be fully qualified, to ensure
* later changes of search_path don't affect it.
*/
tuple = SearchSysCache(TSCONFIGOID,
ObjectIdGetDatum(cfgId),
0, 0, 0);
tuple = SearchSysCache1(TSCONFIGOID, ObjectIdGetDatum(cfgId));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for text search configuration %u",
cfgId);

View File

@@ -36,7 +36,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/cache/typcache.c,v 1.31 2010/01/02 16:57:56 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/cache/typcache.c,v 1.32 2010/02/14 18:42:17 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -135,9 +135,7 @@ lookup_type_cache(Oid type_id, int flags)
HeapTuple tp;
Form_pg_type typtup;
tp = SearchSysCache(TYPEOID,
ObjectIdGetDatum(type_id),
0, 0, 0);
tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type_id));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for type %u", type_id);
typtup = (Form_pg_type) GETSTRUCT(tp);

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/fmgr/fmgr.c,v 1.129 2010/01/07 04:53:34 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/fmgr/fmgr.c,v 1.130 2010/02/14 18:42:17 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -206,9 +206,7 @@ fmgr_info_cxt_security(Oid functionId, FmgrInfo *finfo, MemoryContext mcxt,
}
/* Otherwise we need the pg_proc entry */
procedureTuple = SearchSysCache(PROCOID,
ObjectIdGetDatum(functionId),
0, 0, 0);
procedureTuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(functionId));
if (!HeapTupleIsValid(procedureTuple))
elog(ERROR, "cache lookup failed for function %u", functionId);
procedureStruct = (Form_pg_proc) GETSTRUCT(procedureTuple);
@@ -396,9 +394,7 @@ fmgr_info_other_lang(Oid functionId, FmgrInfo *finfo, HeapTuple procedureTuple)
Form_pg_language languageStruct;
FmgrInfo plfinfo;
languageTuple = SearchSysCache(LANGOID,
ObjectIdGetDatum(language),
0, 0, 0);
languageTuple = SearchSysCache1(LANGOID, ObjectIdGetDatum(language));
if (!HeapTupleIsValid(languageTuple))
elog(ERROR, "cache lookup failed for language %u", language);
languageStruct = (Form_pg_language) GETSTRUCT(languageTuple);
@@ -899,9 +895,8 @@ fmgr_security_definer(PG_FUNCTION_ARGS)
fcinfo->flinfo->fn_mcxt, true);
fcache->flinfo.fn_expr = fcinfo->flinfo->fn_expr;
tuple = SearchSysCache(PROCOID,
ObjectIdGetDatum(fcinfo->flinfo->fn_oid),
0, 0, 0);
tuple = SearchSysCache1(PROCOID,
ObjectIdGetDatum(fcinfo->flinfo->fn_oid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for function %u",
fcinfo->flinfo->fn_oid);

View File

@@ -7,7 +7,7 @@
* Copyright (c) 2002-2010, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/fmgr/funcapi.c,v 1.47 2010/01/02 16:57:56 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/fmgr/funcapi.c,v 1.48 2010/02/14 18:42:17 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -299,9 +299,7 @@ internal_get_result_type(Oid funcid,
TupleDesc tupdesc;
/* First fetch the function's pg_proc row to inspect its rettype */
tp = SearchSysCache(PROCOID,
ObjectIdGetDatum(funcid),
0, 0, 0);
tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for function %u", funcid);
procform = (Form_pg_proc) GETSTRUCT(tp);
@@ -878,9 +876,7 @@ get_func_result_name(Oid functionId)
int i;
/* First fetch the function's pg_proc row */
procTuple = SearchSysCache(PROCOID,
ObjectIdGetDatum(functionId),
0, 0, 0);
procTuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(functionId));
if (!HeapTupleIsValid(procTuple))
elog(ERROR, "cache lookup failed for function %u", functionId);

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/init/miscinit.c,v 1.181 2010/02/07 20:48:10 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/init/miscinit.c,v 1.182 2010/02/14 18:42:17 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -406,9 +406,7 @@ InitializeSessionUserId(const char *rolename)
/* call only once */
AssertState(!OidIsValid(AuthenticatedUserId));
roleTup = SearchSysCache(AUTHNAME,
PointerGetDatum(rolename),
0, 0, 0);
roleTup = SearchSysCache1(AUTHNAME, PointerGetDatum(rolename));
if (!HeapTupleIsValid(roleTup))
ereport(FATAL,
(errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION),
@@ -593,9 +591,7 @@ GetUserNameFromId(Oid roleid)
HeapTuple tuple;
char *result;
tuple = SearchSysCache(AUTHOID,
ObjectIdGetDatum(roleid),
0, 0, 0);
tuple = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid));
if (!HeapTupleIsValid(tuple))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.202 2010/02/05 20:26:56 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.203 2010/02/14 18:42:18 rhaas Exp $
*
*
*-------------------------------------------------------------------------
@@ -240,9 +240,7 @@ CheckMyDatabase(const char *name, bool am_superuser)
char *ctype;
/* Fetch our pg_database row normally, via syscache */
tup = SearchSysCache(DATABASEOID,
ObjectIdGetDatum(MyDatabaseId),
0, 0, 0);
tup = SearchSysCache1(DATABASEOID, ObjectIdGetDatum(MyDatabaseId));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for database %u", MyDatabaseId);
dbform = (Form_pg_database) GETSTRUCT(tup);

View File

@@ -4,7 +4,7 @@
*
* Tatsuo Ishii
*
* $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.92 2009/11/12 02:46:16 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.93 2010/02/14 18:42:18 rhaas Exp $
*/
#include "postgres.h"
@@ -319,9 +319,7 @@ pg_do_encoding_conversion(unsigned char *src, int len,
* are going into infinite loop! So we have to make sure that the
* function exists before calling OidFunctionCall.
*/
if (!SearchSysCacheExists(PROCOID,
ObjectIdGetDatum(proc),
0, 0, 0))
if (!SearchSysCacheExists1(PROCOID, ObjectIdGetDatum(proc)))
{
elog(LOG, "cache lookup failed for function %u", proc);
return src;

View File

@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/misc/superuser.c,v 1.40 2010/01/02 16:57:58 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/misc/superuser.c,v 1.41 2010/02/14 18:42:18 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -67,9 +67,7 @@ superuser_arg(Oid roleid)
return true;
/* OK, look up the information in pg_authid */
rtup = SearchSysCache(AUTHOID,
ObjectIdGetDatum(roleid),
0, 0, 0);
rtup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid));
if (HeapTupleIsValid(rtup))
{
result = ((Form_pg_authid) GETSTRUCT(rtup))->rolsuper;