Array initialisation notation in syscache.c
Hi,
While hacking on a new system catalogue for a nearby thread, it
occurred to me that syscache.c's table of entries could be made more
readable and less error prone. They look like this:
{AttributeRelationId, /* ATTNUM */
AttributeRelidNumIndexId,
2,
{
Anum_pg_attribute_attrelid,
Anum_pg_attribute_attnum,
0,
0
},
128
},
Do you think this is better?
[ATTNUM] = {
AttributeRelationId,
AttributeRelidNumIndexId,
{
Anum_pg_attribute_attrelid,
Anum_pg_attribute_attnum
},
128
},
We could also consider writing eg ".nbuckets = 128", but it's not a
complicated struct that the eye gets lost in, so I didn't bother with
that in the attached.
Attachments:
0001-Improve-notation-of-cacheinfo-table-in-syscache.c.patchtext/x-patch; charset=US-ASCII; name=0001-Improve-notation-of-cacheinfo-table-in-syscache.c.patchDownload
From 3c554145b65bde834a1ff9f65396d2ab07f72120 Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@gmail.com>
Date: Tue, 20 Dec 2022 15:47:59 +1300
Subject: [PATCH] Improve notation of cacheinfo table in syscache.c.
Use C99 designated initializer syntax for the array elements, instead of
writing the position in a comment. Remove the explicit trailing zeros
from the key. Remove the human-supplied nkeys member, which can be
computed by searching for the last non-zero key.
---
src/backend/utils/cache/syscache.c | 700 +++++++++++------------------
1 file changed, 253 insertions(+), 447 deletions(-)
diff --git a/src/backend/utils/cache/syscache.c b/src/backend/utils/cache/syscache.c
index 5f17047047..4f22861926 100644
--- a/src/backend/utils/cache/syscache.c
+++ b/src/backend/utils/cache/syscache.c
@@ -89,8 +89,7 @@
Add your entry to the cacheinfo[] array below. All cache lists are
alphabetical, so add it in the proper place. Specify the relation OID,
- index OID, number of keys, key attribute numbers, and initial number of
- hash buckets.
+ index OID, key attribute numbers, and initial number of hash buckets.
The number of hash buckets must be a power of 2. It's reasonable to
set this to the number of entries that might be in the particular cache
@@ -117,59 +116,48 @@ struct cachedesc
{
Oid reloid; /* OID of the relation being cached */
Oid indoid; /* OID of index relation for this cache */
- int nkeys; /* # of keys needed for cache lookup */
int key[4]; /* attribute numbers of key attrs */
int nbuckets; /* number of hash buckets for this cache */
};
static const struct cachedesc cacheinfo[] = {
- {AggregateRelationId, /* AGGFNOID */
+ [AGGFNOID] = {
+ AggregateRelationId,
AggregateFnoidIndexId,
- 1,
{
- Anum_pg_aggregate_aggfnoid,
- 0,
- 0,
- 0
+ Anum_pg_aggregate_aggfnoid
},
16
},
- {AccessMethodRelationId, /* AMNAME */
+ [AMNAME] = {
+ AccessMethodRelationId,
AmNameIndexId,
- 1,
{
- Anum_pg_am_amname,
- 0,
- 0,
- 0
+ Anum_pg_am_amname
},
4
},
- {AccessMethodRelationId, /* AMOID */
+ [AMOID] = {
+ AccessMethodRelationId,
AmOidIndexId,
- 1,
{
- Anum_pg_am_oid,
- 0,
- 0,
- 0
+ Anum_pg_am_oid
},
4
},
- {AccessMethodOperatorRelationId, /* AMOPOPID */
+ [AMOPOPID] = {
+ AccessMethodOperatorRelationId,
AccessMethodOperatorIndexId,
- 3,
{
Anum_pg_amop_amopopr,
Anum_pg_amop_amoppurpose,
- Anum_pg_amop_amopfamily,
- 0
+ Anum_pg_amop_amopfamily
},
64
},
- {AccessMethodOperatorRelationId, /* AMOPSTRATEGY */
+ [AMOPSTRATEGY] = {
+ AccessMethodOperatorRelationId,
AccessMethodStrategyIndexId,
- 4,
{
Anum_pg_amop_amopfamily,
Anum_pg_amop_amoplefttype,
@@ -178,9 +166,9 @@ static const struct cachedesc cacheinfo[] = {
},
64
},
- {AccessMethodProcedureRelationId, /* AMPROCNUM */
+ [AMPROCNUM] = {
+ AccessMethodProcedureRelationId,
AccessMethodProcedureIndexId,
- 4,
{
Anum_pg_amproc_amprocfamily,
Anum_pg_amproc_amproclefttype,
@@ -189,131 +177,108 @@ static const struct cachedesc cacheinfo[] = {
},
16
},
- {AttributeRelationId, /* ATTNAME */
+ [ATTNAME] = {
+ AttributeRelationId,
AttributeRelidNameIndexId,
- 2,
{
Anum_pg_attribute_attrelid,
- Anum_pg_attribute_attname,
- 0,
- 0
+ Anum_pg_attribute_attname
},
32
},
- {AttributeRelationId, /* ATTNUM */
+ [ATTNUM] = {
+ AttributeRelationId,
AttributeRelidNumIndexId,
- 2,
{
Anum_pg_attribute_attrelid,
- Anum_pg_attribute_attnum,
- 0,
- 0
+ Anum_pg_attribute_attnum
},
128
},
- {AuthMemRelationId, /* AUTHMEMMEMROLE */
+ [AUTHMEMMEMROLE] = {
+ AuthMemRelationId,
AuthMemMemRoleIndexId,
- 3,
{
Anum_pg_auth_members_member,
Anum_pg_auth_members_roleid,
- Anum_pg_auth_members_grantor,
- 0
+ Anum_pg_auth_members_grantor
},
8
},
- {AuthMemRelationId, /* AUTHMEMROLEMEM */
+ [AUTHMEMROLEMEM] = {
+ AuthMemRelationId,
AuthMemRoleMemIndexId,
- 3,
{
Anum_pg_auth_members_roleid,
Anum_pg_auth_members_member,
- Anum_pg_auth_members_grantor,
- 0
+ Anum_pg_auth_members_grantor
},
8
},
- {AuthIdRelationId, /* AUTHNAME */
+ [AUTHNAME] = {
+ AuthIdRelationId,
AuthIdRolnameIndexId,
- 1,
{
- Anum_pg_authid_rolname,
- 0,
- 0,
- 0
+ Anum_pg_authid_rolname
},
8
},
- {AuthIdRelationId, /* AUTHOID */
+ [AUTHOID] = {
+ AuthIdRelationId,
AuthIdOidIndexId,
- 1,
{
- Anum_pg_authid_oid,
- 0,
- 0,
- 0
+ Anum_pg_authid_oid
},
8
},
- {
- CastRelationId, /* CASTSOURCETARGET */
+ [CASTSOURCETARGET] = {
+ CastRelationId,
CastSourceTargetIndexId,
- 2,
{
Anum_pg_cast_castsource,
- Anum_pg_cast_casttarget,
- 0,
- 0
+ Anum_pg_cast_casttarget
},
256
},
- {OperatorClassRelationId, /* CLAAMNAMENSP */
+ [CLAAMNAMENSP] = {
+ OperatorClassRelationId,
OpclassAmNameNspIndexId,
- 3,
{
Anum_pg_opclass_opcmethod,
Anum_pg_opclass_opcname,
- Anum_pg_opclass_opcnamespace,
- 0
+ Anum_pg_opclass_opcnamespace
},
8
},
- {OperatorClassRelationId, /* CLAOID */
+ [CLAOID] = {
+ OperatorClassRelationId,
OpclassOidIndexId,
- 1,
{
- Anum_pg_opclass_oid,
- 0,
- 0,
- 0
+ Anum_pg_opclass_oid
},
8
},
- {CollationRelationId, /* COLLNAMEENCNSP */
+ [COLLNAMEENCNSP] = {
+ CollationRelationId,
CollationNameEncNspIndexId,
- 3,
{
Anum_pg_collation_collname,
Anum_pg_collation_collencoding,
- Anum_pg_collation_collnamespace,
- 0
+ Anum_pg_collation_collnamespace
},
8
},
- {CollationRelationId, /* COLLOID */
+ [COLLOID] = {
+ CollationRelationId,
CollationOidIndexId,
- 1,
{
- Anum_pg_collation_oid,
- 0,
- 0,
- 0
+ Anum_pg_collation_oid
},
8
},
- {ConversionRelationId, /* CONDEFAULT */
+ [CONDEFAULT] = {
+ ConversionRelationId,
ConversionDefaultIndexId,
- 4,
{
Anum_pg_conversion_connamespace,
Anum_pg_conversion_conforencoding,
@@ -322,218 +287,165 @@ static const struct cachedesc cacheinfo[] = {
},
8
},
- {ConversionRelationId, /* CONNAMENSP */
+ [CONNAMENSP] = {
+ ConversionRelationId,
ConversionNameNspIndexId,
- 2,
{
Anum_pg_conversion_conname,
- Anum_pg_conversion_connamespace,
- 0,
- 0
+ Anum_pg_conversion_connamespace
},
8
},
- {ConstraintRelationId, /* CONSTROID */
+ [CONSTROID] = {
+ ConstraintRelationId,
ConstraintOidIndexId,
- 1,
{
- Anum_pg_constraint_oid,
- 0,
- 0,
- 0
+ Anum_pg_constraint_oid
},
16
},
- {ConversionRelationId, /* CONVOID */
+ [CONVOID] = {
+ ConversionRelationId,
ConversionOidIndexId,
- 1,
{
- Anum_pg_conversion_oid,
- 0,
- 0,
- 0
+ Anum_pg_conversion_oid
},
8
},
- {DatabaseRelationId, /* DATABASEOID */
+ [DATABASEOID] = {
+ DatabaseRelationId,
DatabaseOidIndexId,
- 1,
{
- Anum_pg_database_oid,
- 0,
- 0,
- 0
+ Anum_pg_database_oid
},
4
},
- {DefaultAclRelationId, /* DEFACLROLENSPOBJ */
+ [DEFACLROLENSPOBJ] = {
+ DefaultAclRelationId,
DefaultAclRoleNspObjIndexId,
- 3,
{
Anum_pg_default_acl_defaclrole,
Anum_pg_default_acl_defaclnamespace,
- Anum_pg_default_acl_defaclobjtype,
- 0
+ Anum_pg_default_acl_defaclobjtype
},
8
},
- {EnumRelationId, /* ENUMOID */
+ [ENUMOID] = {
+ EnumRelationId,
EnumOidIndexId,
- 1,
{
- Anum_pg_enum_oid,
- 0,
- 0,
- 0
+ Anum_pg_enum_oid
},
8
},
- {EnumRelationId, /* ENUMTYPOIDNAME */
+ [ENUMTYPOIDNAME] = {
+ EnumRelationId,
EnumTypIdLabelIndexId,
- 2,
{
Anum_pg_enum_enumtypid,
- Anum_pg_enum_enumlabel,
- 0,
- 0
+ Anum_pg_enum_enumlabel
},
8
},
- {EventTriggerRelationId, /* EVENTTRIGGERNAME */
+ [EVENTTRIGGERNAME] = {
+ EventTriggerRelationId,
EventTriggerNameIndexId,
- 1,
{
- Anum_pg_event_trigger_evtname,
- 0,
- 0,
- 0
+ Anum_pg_event_trigger_evtname
},
8
},
- {EventTriggerRelationId, /* EVENTTRIGGEROID */
+ [EVENTTRIGGEROID] = {
+ EventTriggerRelationId,
EventTriggerOidIndexId,
- 1,
{
- Anum_pg_event_trigger_oid,
- 0,
- 0,
- 0
+ Anum_pg_event_trigger_oid
},
8
},
- {ForeignDataWrapperRelationId, /* FOREIGNDATAWRAPPERNAME */
+ [FOREIGNDATAWRAPPERNAME] = {
+ ForeignDataWrapperRelationId,
ForeignDataWrapperNameIndexId,
- 1,
{
- Anum_pg_foreign_data_wrapper_fdwname,
- 0,
- 0,
- 0
+ Anum_pg_foreign_data_wrapper_fdwname
},
2
},
- {ForeignDataWrapperRelationId, /* FOREIGNDATAWRAPPEROID */
+ [FOREIGNDATAWRAPPEROID] = {
+ ForeignDataWrapperRelationId,
ForeignDataWrapperOidIndexId,
- 1,
{
- Anum_pg_foreign_data_wrapper_oid,
- 0,
- 0,
- 0
+ Anum_pg_foreign_data_wrapper_oid
},
2
},
- {ForeignServerRelationId, /* FOREIGNSERVERNAME */
+ [FOREIGNSERVERNAME] = {
+ ForeignServerRelationId,
ForeignServerNameIndexId,
- 1,
{
- Anum_pg_foreign_server_srvname,
- 0,
- 0,
- 0
+ Anum_pg_foreign_server_srvname
},
2
},
- {ForeignServerRelationId, /* FOREIGNSERVEROID */
+ [FOREIGNSERVEROID] = {
+ ForeignServerRelationId,
ForeignServerOidIndexId,
- 1,
{
- Anum_pg_foreign_server_oid,
- 0,
- 0,
- 0
+ Anum_pg_foreign_server_oid
},
2
},
- {ForeignTableRelationId, /* FOREIGNTABLEREL */
+ [FOREIGNTABLEREL] = {
+ ForeignTableRelationId,
ForeignTableRelidIndexId,
- 1,
{
- Anum_pg_foreign_table_ftrelid,
- 0,
- 0,
- 0
+ Anum_pg_foreign_table_ftrelid
},
4
},
- {IndexRelationId, /* INDEXRELID */
+ [INDEXRELID] = {
+ IndexRelationId,
IndexRelidIndexId,
- 1,
{
- Anum_pg_index_indexrelid,
- 0,
- 0,
- 0
+ Anum_pg_index_indexrelid
},
64
},
- {LanguageRelationId, /* LANGNAME */
+ [LANGNAME] = {
+ LanguageRelationId,
LanguageNameIndexId,
- 1,
{
- Anum_pg_language_lanname,
- 0,
- 0,
- 0
+ Anum_pg_language_lanname
},
4
},
- {LanguageRelationId, /* LANGOID */
+ [LANGOID] = {
+ LanguageRelationId,
LanguageOidIndexId,
- 1,
{
- Anum_pg_language_oid,
- 0,
- 0,
- 0
+ Anum_pg_language_oid
},
4
},
- {NamespaceRelationId, /* NAMESPACENAME */
+ [NAMESPACENAME] = {
+ NamespaceRelationId,
NamespaceNameIndexId,
- 1,
{
- Anum_pg_namespace_nspname,
- 0,
- 0,
- 0
+ Anum_pg_namespace_nspname
},
4
},
- {NamespaceRelationId, /* NAMESPACEOID */
+ [NAMESPACEOID] = {
+ NamespaceRelationId,
NamespaceOidIndexId,
- 1,
{
- Anum_pg_namespace_oid,
- 0,
- 0,
- 0
+ Anum_pg_namespace_oid
},
16
},
- {OperatorRelationId, /* OPERNAMENSP */
+ [OPERNAMENSP] = {
+ OperatorRelationId,
OperatorNameNspIndexId,
- 4,
{
Anum_pg_operator_oprname,
Anum_pg_operator_oprleft,
@@ -542,499 +454,387 @@ static const struct cachedesc cacheinfo[] = {
},
256
},
- {OperatorRelationId, /* OPEROID */
+ [OPEROID] = {
+ OperatorRelationId,
OperatorOidIndexId,
- 1,
{
- Anum_pg_operator_oid,
- 0,
- 0,
- 0
+ Anum_pg_operator_oid
},
32
},
- {OperatorFamilyRelationId, /* OPFAMILYAMNAMENSP */
+ [OPFAMILYAMNAMENSP] = {
+ OperatorFamilyRelationId,
OpfamilyAmNameNspIndexId,
- 3,
{
Anum_pg_opfamily_opfmethod,
Anum_pg_opfamily_opfname,
- Anum_pg_opfamily_opfnamespace,
- 0
+ Anum_pg_opfamily_opfnamespace
},
8
},
- {OperatorFamilyRelationId, /* OPFAMILYOID */
+ [OPFAMILYOID] = {
+ OperatorFamilyRelationId,
OpfamilyOidIndexId,
- 1,
{
- Anum_pg_opfamily_oid,
- 0,
- 0,
- 0
+ Anum_pg_opfamily_oid
},
8
},
- {ParameterAclRelationId, /* PARAMETERACLNAME */
+ [PARAMETERACLNAME] = {
+ ParameterAclRelationId,
ParameterAclParnameIndexId,
- 1,
{
- Anum_pg_parameter_acl_parname,
- 0,
- 0,
- 0
+ Anum_pg_parameter_acl_parname
},
4
},
- {ParameterAclRelationId, /* PARAMETERACLOID */
+ [PARAMETERACLOID] = {
+ ParameterAclRelationId,
ParameterAclOidIndexId,
- 1,
{
- Anum_pg_parameter_acl_oid,
- 0,
- 0,
- 0
+ Anum_pg_parameter_acl_oid
},
4
},
- {PartitionedRelationId, /* PARTRELID */
+ [PARTRELID] = {
+ PartitionedRelationId,
PartitionedRelidIndexId,
- 1,
{
- Anum_pg_partitioned_table_partrelid,
- 0,
- 0,
- 0
+ Anum_pg_partitioned_table_partrelid
},
32
},
- {ProcedureRelationId, /* PROCNAMEARGSNSP */
+ [PROCNAMEARGSNSP] = {
+ ProcedureRelationId,
ProcedureNameArgsNspIndexId,
- 3,
{
Anum_pg_proc_proname,
Anum_pg_proc_proargtypes,
- Anum_pg_proc_pronamespace,
- 0
+ Anum_pg_proc_pronamespace
},
128
},
- {ProcedureRelationId, /* PROCOID */
+ [PROCOID] = {
+ ProcedureRelationId,
ProcedureOidIndexId,
- 1,
{
- Anum_pg_proc_oid,
- 0,
- 0,
- 0
+ Anum_pg_proc_oid
},
128
},
- {PublicationRelationId, /* PUBLICATIONNAME */
+ [PUBLICATIONNAME] = {
+ PublicationRelationId,
PublicationNameIndexId,
- 1,
{
- Anum_pg_publication_pubname,
- 0,
- 0,
- 0
+ Anum_pg_publication_pubname
},
8
},
- {PublicationNamespaceRelationId, /* PUBLICATIONNAMESPACE */
+ [PUBLICATIONNAMESPACE] = {
+ PublicationNamespaceRelationId,
PublicationNamespaceObjectIndexId,
- 1,
{
- Anum_pg_publication_namespace_oid,
- 0,
- 0,
- 0
+ Anum_pg_publication_namespace_oid
},
64
},
- {PublicationNamespaceRelationId, /* PUBLICATIONNAMESPACEMAP */
+ [PUBLICATIONNAMESPACEMAP] = {
+ PublicationNamespaceRelationId,
PublicationNamespacePnnspidPnpubidIndexId,
- 2,
{
Anum_pg_publication_namespace_pnnspid,
- Anum_pg_publication_namespace_pnpubid,
- 0,
- 0
+ Anum_pg_publication_namespace_pnpubid
},
64
},
- {PublicationRelationId, /* PUBLICATIONOID */
+ [PUBLICATIONOID] = {
+ PublicationRelationId,
PublicationObjectIndexId,
- 1,
{
- Anum_pg_publication_oid,
- 0,
- 0,
- 0
+ Anum_pg_publication_oid
},
8
},
- {PublicationRelRelationId, /* PUBLICATIONREL */
+ [PUBLICATIONREL] = {
+ PublicationRelRelationId,
PublicationRelObjectIndexId,
- 1,
{
- Anum_pg_publication_rel_oid,
- 0,
- 0,
- 0
+ Anum_pg_publication_rel_oid
},
64
},
- {PublicationRelRelationId, /* PUBLICATIONRELMAP */
+ [PUBLICATIONRELMAP] = {
+ PublicationRelRelationId,
PublicationRelPrrelidPrpubidIndexId,
- 2,
{
Anum_pg_publication_rel_prrelid,
- Anum_pg_publication_rel_prpubid,
- 0,
- 0
+ Anum_pg_publication_rel_prpubid
},
64
},
- {RangeRelationId, /* RANGEMULTIRANGE */
+ [RANGEMULTIRANGE] = {
+ RangeRelationId,
RangeMultirangeTypidIndexId,
- 1,
{
- Anum_pg_range_rngmultitypid,
- 0,
- 0,
- 0
+ Anum_pg_range_rngmultitypid
},
4
},
- {RangeRelationId, /* RANGETYPE */
+ [RANGETYPE] = {
+ RangeRelationId,
RangeTypidIndexId,
- 1,
{
- Anum_pg_range_rngtypid,
- 0,
- 0,
- 0
+ Anum_pg_range_rngtypid
},
4
},
- {RelationRelationId, /* RELNAMENSP */
+ [RELNAMENSP] = {
+ RelationRelationId,
ClassNameNspIndexId,
- 2,
{
Anum_pg_class_relname,
- Anum_pg_class_relnamespace,
- 0,
- 0
+ Anum_pg_class_relnamespace
},
128
},
- {RelationRelationId, /* RELOID */
+ [RELOID] = {
+ RelationRelationId,
ClassOidIndexId,
- 1,
{
- Anum_pg_class_oid,
- 0,
- 0,
- 0
+ Anum_pg_class_oid
},
128
},
- {ReplicationOriginRelationId, /* REPLORIGIDENT */
+ [REPLORIGIDENT] = {
+ ReplicationOriginRelationId,
ReplicationOriginIdentIndex,
- 1,
{
- Anum_pg_replication_origin_roident,
- 0,
- 0,
- 0
+ Anum_pg_replication_origin_roident
},
16
},
- {ReplicationOriginRelationId, /* REPLORIGNAME */
+ [REPLORIGNAME] = {
+ ReplicationOriginRelationId,
ReplicationOriginNameIndex,
- 1,
{
- Anum_pg_replication_origin_roname,
- 0,
- 0,
- 0
+ Anum_pg_replication_origin_roname
},
16
},
- {RewriteRelationId, /* RULERELNAME */
+ [RULERELNAME] = {
+ RewriteRelationId,
RewriteRelRulenameIndexId,
- 2,
{
Anum_pg_rewrite_ev_class,
- Anum_pg_rewrite_rulename,
- 0,
- 0
+ Anum_pg_rewrite_rulename
},
8
},
- {SequenceRelationId, /* SEQRELID */
+ [SEQRELID] = {
+ SequenceRelationId,
SequenceRelidIndexId,
- 1,
{
- Anum_pg_sequence_seqrelid,
- 0,
- 0,
- 0
+ Anum_pg_sequence_seqrelid
},
32
},
- {StatisticExtDataRelationId, /* STATEXTDATASTXOID */
+ [STATEXTDATASTXOID] = {
+ StatisticExtDataRelationId,
StatisticExtDataStxoidInhIndexId,
- 2,
{
Anum_pg_statistic_ext_data_stxoid,
- Anum_pg_statistic_ext_data_stxdinherit,
- 0,
- 0
+ Anum_pg_statistic_ext_data_stxdinherit
},
4
},
- {StatisticExtRelationId, /* STATEXTNAMENSP */
+ [STATEXTNAMENSP] = {
+ StatisticExtRelationId,
StatisticExtNameIndexId,
- 2,
{
Anum_pg_statistic_ext_stxname,
- Anum_pg_statistic_ext_stxnamespace,
- 0,
- 0
+ Anum_pg_statistic_ext_stxnamespace
},
4
},
- {StatisticExtRelationId, /* STATEXTOID */
+ [STATEXTOID] = {
+ StatisticExtRelationId,
StatisticExtOidIndexId,
- 1,
{
- Anum_pg_statistic_ext_oid,
- 0,
- 0,
- 0
+ Anum_pg_statistic_ext_oid
},
4
},
- {StatisticRelationId, /* STATRELATTINH */
+ [STATRELATTINH] = {
+ StatisticRelationId,
StatisticRelidAttnumInhIndexId,
- 3,
{
Anum_pg_statistic_starelid,
Anum_pg_statistic_staattnum,
- Anum_pg_statistic_stainherit,
- 0
+ Anum_pg_statistic_stainherit
},
128
},
- {SubscriptionRelationId, /* SUBSCRIPTIONNAME */
+ [SUBSCRIPTIONNAME] = {
+ SubscriptionRelationId,
SubscriptionNameIndexId,
- 2,
{
Anum_pg_subscription_subdbid,
- Anum_pg_subscription_subname,
- 0,
- 0
+ Anum_pg_subscription_subname
},
4
},
- {SubscriptionRelationId, /* SUBSCRIPTIONOID */
+ [SUBSCRIPTIONOID] = {
+ SubscriptionRelationId,
SubscriptionObjectIndexId,
- 1,
{
- Anum_pg_subscription_oid,
- 0,
- 0,
- 0
+ Anum_pg_subscription_oid
},
4
},
- {SubscriptionRelRelationId, /* SUBSCRIPTIONRELMAP */
+ [SUBSCRIPTIONRELMAP] = {
+ SubscriptionRelRelationId,
SubscriptionRelSrrelidSrsubidIndexId,
- 2,
{
Anum_pg_subscription_rel_srrelid,
- Anum_pg_subscription_rel_srsubid,
- 0,
- 0
+ Anum_pg_subscription_rel_srsubid
},
64
},
- {TableSpaceRelationId, /* TABLESPACEOID */
+ [TABLESPACEOID] = {
+ TableSpaceRelationId,
TablespaceOidIndexId,
- 1,
{
- Anum_pg_tablespace_oid,
- 0,
- 0,
- 0,
+ Anum_pg_tablespace_oid
},
4
},
- {TransformRelationId, /* TRFOID */
+ [TRFOID] = {
+ TransformRelationId,
TransformOidIndexId,
- 1,
{
- Anum_pg_transform_oid,
- 0,
- 0,
- 0,
+ Anum_pg_transform_oid
},
16
},
- {TransformRelationId, /* TRFTYPELANG */
+ [TRFTYPELANG] = {
+ TransformRelationId,
TransformTypeLangIndexId,
- 2,
{
Anum_pg_transform_trftype,
- Anum_pg_transform_trflang,
- 0,
- 0,
+ Anum_pg_transform_trflang
},
16
},
- {TSConfigMapRelationId, /* TSCONFIGMAP */
+ [TSCONFIGMAP] = {
+ TSConfigMapRelationId,
TSConfigMapIndexId,
- 3,
{
Anum_pg_ts_config_map_mapcfg,
Anum_pg_ts_config_map_maptokentype,
- Anum_pg_ts_config_map_mapseqno,
- 0
+ Anum_pg_ts_config_map_mapseqno
},
2
},
- {TSConfigRelationId, /* TSCONFIGNAMENSP */
+ [TSCONFIGNAMENSP] = {
+ TSConfigRelationId,
TSConfigNameNspIndexId,
- 2,
{
Anum_pg_ts_config_cfgname,
- Anum_pg_ts_config_cfgnamespace,
- 0,
- 0
+ Anum_pg_ts_config_cfgnamespace
},
2
},
- {TSConfigRelationId, /* TSCONFIGOID */
+ [TSCONFIGOID] = {
+ TSConfigRelationId,
TSConfigOidIndexId,
- 1,
{
- Anum_pg_ts_config_oid,
- 0,
- 0,
- 0
+ Anum_pg_ts_config_oid
},
2
},
- {TSDictionaryRelationId, /* TSDICTNAMENSP */
+ [TSDICTNAMENSP] = {
+ TSDictionaryRelationId,
TSDictionaryNameNspIndexId,
- 2,
{
Anum_pg_ts_dict_dictname,
- Anum_pg_ts_dict_dictnamespace,
- 0,
- 0
+ Anum_pg_ts_dict_dictnamespace
},
2
},
- {TSDictionaryRelationId, /* TSDICTOID */
+ [TSDICTOID] = {
+ TSDictionaryRelationId,
TSDictionaryOidIndexId,
- 1,
{
- Anum_pg_ts_dict_oid,
- 0,
- 0,
- 0
+ Anum_pg_ts_dict_oid
},
2
},
- {TSParserRelationId, /* TSPARSERNAMENSP */
+ [TSPARSERNAMENSP] = {
+ TSParserRelationId,
TSParserNameNspIndexId,
- 2,
{
Anum_pg_ts_parser_prsname,
- Anum_pg_ts_parser_prsnamespace,
- 0,
- 0
+ Anum_pg_ts_parser_prsnamespace
},
2
},
- {TSParserRelationId, /* TSPARSEROID */
+ [TSPARSEROID] = {
+ TSParserRelationId,
TSParserOidIndexId,
- 1,
{
- Anum_pg_ts_parser_oid,
- 0,
- 0,
- 0
+ Anum_pg_ts_parser_oid
},
2
},
- {TSTemplateRelationId, /* TSTEMPLATENAMENSP */
+ [TSTEMPLATENAMENSP] = {
+ TSTemplateRelationId,
TSTemplateNameNspIndexId,
- 2,
{
Anum_pg_ts_template_tmplname,
- Anum_pg_ts_template_tmplnamespace,
- 0,
- 0
+ Anum_pg_ts_template_tmplnamespace
},
2
},
- {TSTemplateRelationId, /* TSTEMPLATEOID */
+ [TSTEMPLATEOID] = {
+ TSTemplateRelationId,
TSTemplateOidIndexId,
- 1,
{
- Anum_pg_ts_template_oid,
- 0,
- 0,
- 0
+ Anum_pg_ts_template_oid
},
2
},
- {TypeRelationId, /* TYPENAMENSP */
+ [TYPENAMENSP] = {
+ TypeRelationId,
TypeNameNspIndexId,
- 2,
{
Anum_pg_type_typname,
- Anum_pg_type_typnamespace,
- 0,
- 0
+ Anum_pg_type_typnamespace
},
64
},
- {TypeRelationId, /* TYPEOID */
+ [TYPEOID] = {
+ TypeRelationId,
TypeOidIndexId,
- 1,
{
- Anum_pg_type_oid,
- 0,
- 0,
- 0
+ Anum_pg_type_oid
},
64
},
- {UserMappingRelationId, /* USERMAPPINGOID */
+ [USERMAPPINGOID] = {
+ UserMappingRelationId,
UserMappingOidIndexId,
- 1,
{
- Anum_pg_user_mapping_oid,
- 0,
- 0,
- 0
+ Anum_pg_user_mapping_oid
},
2
},
- {UserMappingRelationId, /* USERMAPPINGUSERSERVER */
+ [USERMAPPINGUSERSERVER] = {
+ UserMappingRelationId,
UserMappingUserServerIndexId,
- 2,
{
Anum_pg_user_mapping_umuser,
- Anum_pg_user_mapping_umserver,
- 0,
- 0
+ Anum_pg_user_mapping_umserver
},
2
}
@@ -1077,10 +877,16 @@ InitCatalogCache(void)
for (cacheId = 0; cacheId < SysCacheSize; cacheId++)
{
+ int nkeys;
+
+ for (nkeys = lengthof(cacheinfo[cacheId].key); nkeys > 1; --nkeys)
+ if (cacheinfo[cacheId].key[nkeys - 1])
+ break;
+
SysCache[cacheId] = InitCatCache(cacheId,
cacheinfo[cacheId].reloid,
cacheinfo[cacheId].indoid,
- cacheinfo[cacheId].nkeys,
+ nkeys,
cacheinfo[cacheId].key,
cacheinfo[cacheId].nbuckets);
if (!PointerIsValid(SysCache[cacheId]))
--
2.38.1
Thomas Munro <thomas.munro@gmail.com> writes:
Do you think this is better?
I'm not at all on board with adding runtime overhead to
save maintaining the nkeys fields.
Getting rid of the useless trailing zeroes in the key[] arrays
is clearly a win, though.
I'm kind of neutral on using "[N] = " as a substitute for
ordering the entries correctly. While that does remove
one failure mode, it seems like it adds another (ie
failure to provide an entry at all would be masked).
regards, tom lane
On Wed, Dec 21, 2022 at 12:05 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Thomas Munro <thomas.munro@gmail.com> writes:
Do you think this is better?
I'm not at all on board with adding runtime overhead to
save maintaining the nkeys fields.
I don't see how to do it at compile time without getting the
preprocessor involved. What do you think about this version?
[ATTNUM] = {
AttributeRelationId,
AttributeRelidNumIndexId,
KEY(Anum_pg_attribute_attrelid,
Anum_pg_attribute_attnum),
128
},
I'm kind of neutral on using "[N] = " as a substitute for
ordering the entries correctly. While that does remove
one failure mode, it seems like it adds another (ie
failure to provide an entry at all would be masked).
It fails very early in testing if you do that. Admittedly, the
assertion is hard to understand, but if I add a new assertion close to
the cause with a new comment to say what you did wrong, I think that
should be good enough?
Attachments:
v2-0001-Improve-notation-of-cacheinfo-table-in-syscache.c.patchtext/x-patch; charset=US-ASCII; name=v2-0001-Improve-notation-of-cacheinfo-table-in-syscache.c.patchDownload
From 6a2425bdfccaa9a247657f3e148b87753213e746 Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@gmail.com>
Date: Tue, 20 Dec 2022 15:47:59 +1300
Subject: [PATCH v2] Improve notation of cacheinfo table in syscache.c.
Use C99 designated initializer syntax for the array elements, instead of
writing the enumerator name and position in a comment. Replace nkeys
and key with a local variadic macro, for a shorter notation.
---
src/backend/utils/cache/syscache.c | 943 +++++++++--------------------
1 file changed, 293 insertions(+), 650 deletions(-)
diff --git a/src/backend/utils/cache/syscache.c b/src/backend/utils/cache/syscache.c
index 5f17047047..99513aa336 100644
--- a/src/backend/utils/cache/syscache.c
+++ b/src/backend/utils/cache/syscache.c
@@ -89,8 +89,7 @@
Add your entry to the cacheinfo[] array below. All cache lists are
alphabetical, so add it in the proper place. Specify the relation OID,
- index OID, number of keys, key attribute numbers, and initial number of
- hash buckets.
+ index OID, key attribute numbers, and initial number of hash buckets.
The number of hash buckets must be a power of 2. It's reasonable to
set this to the number of entries that might be in the particular cache
@@ -122,920 +121,558 @@ struct cachedesc
int nbuckets; /* number of hash buckets for this cache */
};
+/* Macro to provide nkeys and key array with convenient syntax. */
+#define KEY(...) VA_ARGS_NARGS(__VA_ARGS__), { __VA_ARGS__ }
+
static const struct cachedesc cacheinfo[] = {
- {AggregateRelationId, /* AGGFNOID */
+ [AGGFNOID] = {
+ AggregateRelationId,
AggregateFnoidIndexId,
- 1,
- {
- Anum_pg_aggregate_aggfnoid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_aggregate_aggfnoid),
16
},
- {AccessMethodRelationId, /* AMNAME */
+ [AMNAME] = {
+ AccessMethodRelationId,
AmNameIndexId,
- 1,
- {
- Anum_pg_am_amname,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_am_amname),
4
},
- {AccessMethodRelationId, /* AMOID */
+ [AMOID] = {
+ AccessMethodRelationId,
AmOidIndexId,
- 1,
- {
- Anum_pg_am_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_am_oid),
4
},
- {AccessMethodOperatorRelationId, /* AMOPOPID */
+ [AMOPOPID] = {
+ AccessMethodOperatorRelationId,
AccessMethodOperatorIndexId,
- 3,
- {
- Anum_pg_amop_amopopr,
+ KEY(Anum_pg_amop_amopopr,
Anum_pg_amop_amoppurpose,
- Anum_pg_amop_amopfamily,
- 0
- },
+ Anum_pg_amop_amopfamily),
64
},
- {AccessMethodOperatorRelationId, /* AMOPSTRATEGY */
+ [AMOPSTRATEGY] = {
+ AccessMethodOperatorRelationId,
AccessMethodStrategyIndexId,
- 4,
- {
- Anum_pg_amop_amopfamily,
+ KEY(Anum_pg_amop_amopfamily,
Anum_pg_amop_amoplefttype,
Anum_pg_amop_amoprighttype,
- Anum_pg_amop_amopstrategy
- },
+ Anum_pg_amop_amopstrategy),
64
},
- {AccessMethodProcedureRelationId, /* AMPROCNUM */
+ [AMPROCNUM] = {
+ AccessMethodProcedureRelationId,
AccessMethodProcedureIndexId,
- 4,
- {
- Anum_pg_amproc_amprocfamily,
+ KEY(Anum_pg_amproc_amprocfamily,
Anum_pg_amproc_amproclefttype,
Anum_pg_amproc_amprocrighttype,
- Anum_pg_amproc_amprocnum
- },
+ Anum_pg_amproc_amprocnum),
16
},
- {AttributeRelationId, /* ATTNAME */
+ [ATTNAME] = {
+ AttributeRelationId,
AttributeRelidNameIndexId,
- 2,
- {
- Anum_pg_attribute_attrelid,
- Anum_pg_attribute_attname,
- 0,
- 0
- },
+ KEY(Anum_pg_attribute_attrelid,
+ Anum_pg_attribute_attname),
32
},
- {AttributeRelationId, /* ATTNUM */
+ [ATTNUM] = {
+ AttributeRelationId,
AttributeRelidNumIndexId,
- 2,
- {
- Anum_pg_attribute_attrelid,
- Anum_pg_attribute_attnum,
- 0,
- 0
- },
+ KEY(Anum_pg_attribute_attrelid,
+ Anum_pg_attribute_attnum),
128
},
- {AuthMemRelationId, /* AUTHMEMMEMROLE */
+ [AUTHMEMMEMROLE] = {
+ AuthMemRelationId,
AuthMemMemRoleIndexId,
- 3,
- {
- Anum_pg_auth_members_member,
+ KEY(Anum_pg_auth_members_member,
Anum_pg_auth_members_roleid,
- Anum_pg_auth_members_grantor,
- 0
- },
+ Anum_pg_auth_members_grantor),
8
},
- {AuthMemRelationId, /* AUTHMEMROLEMEM */
+ [AUTHMEMROLEMEM] = {
+ AuthMemRelationId,
AuthMemRoleMemIndexId,
- 3,
- {
- Anum_pg_auth_members_roleid,
+ KEY(Anum_pg_auth_members_roleid,
Anum_pg_auth_members_member,
- Anum_pg_auth_members_grantor,
- 0
- },
+ Anum_pg_auth_members_grantor),
8
},
- {AuthIdRelationId, /* AUTHNAME */
+ [AUTHNAME] = {
+ AuthIdRelationId,
AuthIdRolnameIndexId,
- 1,
- {
- Anum_pg_authid_rolname,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_authid_rolname),
8
},
- {AuthIdRelationId, /* AUTHOID */
+ [AUTHOID] = {
+ AuthIdRelationId,
AuthIdOidIndexId,
- 1,
- {
- Anum_pg_authid_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_authid_oid),
8
},
- {
- CastRelationId, /* CASTSOURCETARGET */
+ [CASTSOURCETARGET] = {
+ CastRelationId,
CastSourceTargetIndexId,
- 2,
- {
- Anum_pg_cast_castsource,
- Anum_pg_cast_casttarget,
- 0,
- 0
- },
+ KEY(Anum_pg_cast_castsource,
+ Anum_pg_cast_casttarget),
256
},
- {OperatorClassRelationId, /* CLAAMNAMENSP */
+ [CLAAMNAMENSP] = {
+ OperatorClassRelationId,
OpclassAmNameNspIndexId,
- 3,
- {
- Anum_pg_opclass_opcmethod,
+ KEY(Anum_pg_opclass_opcmethod,
Anum_pg_opclass_opcname,
- Anum_pg_opclass_opcnamespace,
- 0
- },
+ Anum_pg_opclass_opcnamespace),
8
},
- {OperatorClassRelationId, /* CLAOID */
+ [CLAOID] = {
+ OperatorClassRelationId,
OpclassOidIndexId,
- 1,
- {
- Anum_pg_opclass_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_opclass_oid),
8
},
- {CollationRelationId, /* COLLNAMEENCNSP */
+ [COLLNAMEENCNSP] = {
+ CollationRelationId,
CollationNameEncNspIndexId,
- 3,
- {
- Anum_pg_collation_collname,
+ KEY(Anum_pg_collation_collname,
Anum_pg_collation_collencoding,
- Anum_pg_collation_collnamespace,
- 0
- },
+ Anum_pg_collation_collnamespace),
8
},
- {CollationRelationId, /* COLLOID */
+ [COLLOID] = {
+ CollationRelationId,
CollationOidIndexId,
- 1,
- {
- Anum_pg_collation_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_collation_oid),
8
},
- {ConversionRelationId, /* CONDEFAULT */
+ [CONDEFAULT] = {
+ ConversionRelationId,
ConversionDefaultIndexId,
- 4,
- {
- Anum_pg_conversion_connamespace,
+ KEY(Anum_pg_conversion_connamespace,
Anum_pg_conversion_conforencoding,
Anum_pg_conversion_contoencoding,
- Anum_pg_conversion_oid
- },
+ Anum_pg_conversion_oid),
8
},
- {ConversionRelationId, /* CONNAMENSP */
+ [CONNAMENSP] = {
+ ConversionRelationId,
ConversionNameNspIndexId,
- 2,
- {
- Anum_pg_conversion_conname,
- Anum_pg_conversion_connamespace,
- 0,
- 0
- },
+ KEY(Anum_pg_conversion_conname,
+ Anum_pg_conversion_connamespace),
8
},
- {ConstraintRelationId, /* CONSTROID */
+ [CONSTROID] = {
+ ConstraintRelationId,
ConstraintOidIndexId,
- 1,
- {
- Anum_pg_constraint_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_constraint_oid),
16
},
- {ConversionRelationId, /* CONVOID */
+ [CONVOID] = {
+ ConversionRelationId,
ConversionOidIndexId,
- 1,
- {
- Anum_pg_conversion_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_conversion_oid),
8
},
- {DatabaseRelationId, /* DATABASEOID */
+ [DATABASEOID] = {
+ DatabaseRelationId,
DatabaseOidIndexId,
- 1,
- {
- Anum_pg_database_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_database_oid),
4
},
- {DefaultAclRelationId, /* DEFACLROLENSPOBJ */
+ [DEFACLROLENSPOBJ] = {
+ DefaultAclRelationId,
DefaultAclRoleNspObjIndexId,
- 3,
- {
- Anum_pg_default_acl_defaclrole,
+ KEY(Anum_pg_default_acl_defaclrole,
Anum_pg_default_acl_defaclnamespace,
- Anum_pg_default_acl_defaclobjtype,
- 0
- },
+ Anum_pg_default_acl_defaclobjtype),
8
},
- {EnumRelationId, /* ENUMOID */
+ [ENUMOID] = {
+ EnumRelationId,
EnumOidIndexId,
- 1,
- {
- Anum_pg_enum_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_enum_oid),
8
},
- {EnumRelationId, /* ENUMTYPOIDNAME */
+ [ENUMTYPOIDNAME] = {
+ EnumRelationId,
EnumTypIdLabelIndexId,
- 2,
- {
- Anum_pg_enum_enumtypid,
- Anum_pg_enum_enumlabel,
- 0,
- 0
- },
+ KEY(Anum_pg_enum_enumtypid,
+ Anum_pg_enum_enumlabel),
8
},
- {EventTriggerRelationId, /* EVENTTRIGGERNAME */
+ [EVENTTRIGGERNAME] = {
+ EventTriggerRelationId,
EventTriggerNameIndexId,
- 1,
- {
- Anum_pg_event_trigger_evtname,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_event_trigger_evtname),
8
},
- {EventTriggerRelationId, /* EVENTTRIGGEROID */
+ [EVENTTRIGGEROID] = {
+ EventTriggerRelationId,
EventTriggerOidIndexId,
- 1,
- {
- Anum_pg_event_trigger_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_event_trigger_oid),
8
},
- {ForeignDataWrapperRelationId, /* FOREIGNDATAWRAPPERNAME */
+ [FOREIGNDATAWRAPPERNAME] = {
+ ForeignDataWrapperRelationId,
ForeignDataWrapperNameIndexId,
- 1,
- {
- Anum_pg_foreign_data_wrapper_fdwname,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_foreign_data_wrapper_fdwname),
2
},
- {ForeignDataWrapperRelationId, /* FOREIGNDATAWRAPPEROID */
+ [FOREIGNDATAWRAPPEROID] = {
+ ForeignDataWrapperRelationId,
ForeignDataWrapperOidIndexId,
- 1,
- {
- Anum_pg_foreign_data_wrapper_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_foreign_data_wrapper_oid),
2
},
- {ForeignServerRelationId, /* FOREIGNSERVERNAME */
+ [FOREIGNSERVERNAME] = {
+ ForeignServerRelationId,
ForeignServerNameIndexId,
- 1,
- {
- Anum_pg_foreign_server_srvname,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_foreign_server_srvname),
2
},
- {ForeignServerRelationId, /* FOREIGNSERVEROID */
+ [FOREIGNSERVEROID] = {
+ ForeignServerRelationId,
ForeignServerOidIndexId,
- 1,
- {
- Anum_pg_foreign_server_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_foreign_server_oid),
2
},
- {ForeignTableRelationId, /* FOREIGNTABLEREL */
+ [FOREIGNTABLEREL] = {
+ ForeignTableRelationId,
ForeignTableRelidIndexId,
- 1,
- {
- Anum_pg_foreign_table_ftrelid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_foreign_table_ftrelid),
4
},
- {IndexRelationId, /* INDEXRELID */
+ [INDEXRELID] = {
+ IndexRelationId,
IndexRelidIndexId,
- 1,
- {
- Anum_pg_index_indexrelid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_index_indexrelid),
64
},
- {LanguageRelationId, /* LANGNAME */
+ [LANGNAME] = {
+ LanguageRelationId,
LanguageNameIndexId,
- 1,
- {
- Anum_pg_language_lanname,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_language_lanname),
4
},
- {LanguageRelationId, /* LANGOID */
+ [LANGOID] = {
+ LanguageRelationId,
LanguageOidIndexId,
- 1,
- {
- Anum_pg_language_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_language_oid),
4
},
- {NamespaceRelationId, /* NAMESPACENAME */
+ [NAMESPACENAME] = {
+ NamespaceRelationId,
NamespaceNameIndexId,
- 1,
- {
- Anum_pg_namespace_nspname,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_namespace_nspname),
4
},
- {NamespaceRelationId, /* NAMESPACEOID */
+ [NAMESPACEOID] = {
+ NamespaceRelationId,
NamespaceOidIndexId,
- 1,
- {
- Anum_pg_namespace_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_namespace_oid),
16
},
- {OperatorRelationId, /* OPERNAMENSP */
+ [OPERNAMENSP] = {
+ OperatorRelationId,
OperatorNameNspIndexId,
- 4,
- {
- Anum_pg_operator_oprname,
+ KEY(Anum_pg_operator_oprname,
Anum_pg_operator_oprleft,
Anum_pg_operator_oprright,
- Anum_pg_operator_oprnamespace
- },
+ Anum_pg_operator_oprnamespace),
256
},
- {OperatorRelationId, /* OPEROID */
+ [OPEROID] = {
+ OperatorRelationId,
OperatorOidIndexId,
- 1,
- {
- Anum_pg_operator_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_operator_oid),
32
},
- {OperatorFamilyRelationId, /* OPFAMILYAMNAMENSP */
+ [OPFAMILYAMNAMENSP] = {
+ OperatorFamilyRelationId,
OpfamilyAmNameNspIndexId,
- 3,
- {
- Anum_pg_opfamily_opfmethod,
+ KEY(Anum_pg_opfamily_opfmethod,
Anum_pg_opfamily_opfname,
- Anum_pg_opfamily_opfnamespace,
- 0
- },
+ Anum_pg_opfamily_opfnamespace),
8
},
- {OperatorFamilyRelationId, /* OPFAMILYOID */
+ [OPFAMILYOID] = {
+ OperatorFamilyRelationId,
OpfamilyOidIndexId,
- 1,
- {
- Anum_pg_opfamily_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_opfamily_oid),
8
},
- {ParameterAclRelationId, /* PARAMETERACLNAME */
+ [PARAMETERACLNAME] = {
+ ParameterAclRelationId,
ParameterAclParnameIndexId,
- 1,
- {
- Anum_pg_parameter_acl_parname,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_parameter_acl_parname),
4
},
- {ParameterAclRelationId, /* PARAMETERACLOID */
+ [PARAMETERACLOID] = {
+ ParameterAclRelationId,
ParameterAclOidIndexId,
- 1,
- {
- Anum_pg_parameter_acl_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_parameter_acl_oid),
4
},
- {PartitionedRelationId, /* PARTRELID */
+ [PARTRELID] = {
+ PartitionedRelationId,
PartitionedRelidIndexId,
- 1,
- {
- Anum_pg_partitioned_table_partrelid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_partitioned_table_partrelid),
32
},
- {ProcedureRelationId, /* PROCNAMEARGSNSP */
+ [PROCNAMEARGSNSP] = {
+ ProcedureRelationId,
ProcedureNameArgsNspIndexId,
- 3,
- {
- Anum_pg_proc_proname,
+ KEY(Anum_pg_proc_proname,
Anum_pg_proc_proargtypes,
- Anum_pg_proc_pronamespace,
- 0
- },
+ Anum_pg_proc_pronamespace),
128
},
- {ProcedureRelationId, /* PROCOID */
+ [PROCOID] = {
+ ProcedureRelationId,
ProcedureOidIndexId,
- 1,
- {
- Anum_pg_proc_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_proc_oid),
128
},
- {PublicationRelationId, /* PUBLICATIONNAME */
+ [PUBLICATIONNAME] = {
+ PublicationRelationId,
PublicationNameIndexId,
- 1,
- {
- Anum_pg_publication_pubname,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_publication_pubname),
8
},
- {PublicationNamespaceRelationId, /* PUBLICATIONNAMESPACE */
+ [PUBLICATIONNAMESPACE] = {
+ PublicationNamespaceRelationId,
PublicationNamespaceObjectIndexId,
- 1,
- {
- Anum_pg_publication_namespace_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_publication_namespace_oid),
64
},
- {PublicationNamespaceRelationId, /* PUBLICATIONNAMESPACEMAP */
+ [PUBLICATIONNAMESPACEMAP] = {
+ PublicationNamespaceRelationId,
PublicationNamespacePnnspidPnpubidIndexId,
- 2,
- {
- Anum_pg_publication_namespace_pnnspid,
- Anum_pg_publication_namespace_pnpubid,
- 0,
- 0
- },
+ KEY(Anum_pg_publication_namespace_pnnspid,
+ Anum_pg_publication_namespace_pnpubid),
64
},
- {PublicationRelationId, /* PUBLICATIONOID */
+ [PUBLICATIONOID] = {
+ PublicationRelationId,
PublicationObjectIndexId,
- 1,
- {
- Anum_pg_publication_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_publication_oid),
8
},
- {PublicationRelRelationId, /* PUBLICATIONREL */
+ [PUBLICATIONREL] = {
+ PublicationRelRelationId,
PublicationRelObjectIndexId,
- 1,
- {
- Anum_pg_publication_rel_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_publication_rel_oid),
64
},
- {PublicationRelRelationId, /* PUBLICATIONRELMAP */
+ [PUBLICATIONRELMAP] = {
+ PublicationRelRelationId,
PublicationRelPrrelidPrpubidIndexId,
- 2,
- {
- Anum_pg_publication_rel_prrelid,
- Anum_pg_publication_rel_prpubid,
- 0,
- 0
- },
+ KEY(Anum_pg_publication_rel_prrelid,
+ Anum_pg_publication_rel_prpubid),
64
},
- {RangeRelationId, /* RANGEMULTIRANGE */
+ [RANGEMULTIRANGE] = {
+ RangeRelationId,
RangeMultirangeTypidIndexId,
- 1,
- {
- Anum_pg_range_rngmultitypid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_range_rngmultitypid),
4
},
-
- {RangeRelationId, /* RANGETYPE */
+ [RANGETYPE] = {
+ RangeRelationId,
RangeTypidIndexId,
- 1,
- {
- Anum_pg_range_rngtypid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_range_rngtypid),
4
},
- {RelationRelationId, /* RELNAMENSP */
+ [RELNAMENSP] = {
+ RelationRelationId,
ClassNameNspIndexId,
- 2,
- {
- Anum_pg_class_relname,
- Anum_pg_class_relnamespace,
- 0,
- 0
- },
+ KEY(Anum_pg_class_relname,
+ Anum_pg_class_relnamespace),
128
},
- {RelationRelationId, /* RELOID */
+ [RELOID] = {
+ RelationRelationId,
ClassOidIndexId,
- 1,
- {
- Anum_pg_class_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_class_oid),
128
},
- {ReplicationOriginRelationId, /* REPLORIGIDENT */
+ [REPLORIGIDENT] = {
+ ReplicationOriginRelationId,
ReplicationOriginIdentIndex,
- 1,
- {
- Anum_pg_replication_origin_roident,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_replication_origin_roident),
16
},
- {ReplicationOriginRelationId, /* REPLORIGNAME */
+ [REPLORIGNAME] = {
+ ReplicationOriginRelationId,
ReplicationOriginNameIndex,
- 1,
- {
- Anum_pg_replication_origin_roname,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_replication_origin_roname),
16
},
- {RewriteRelationId, /* RULERELNAME */
+ [RULERELNAME] = {
+ RewriteRelationId,
RewriteRelRulenameIndexId,
- 2,
- {
- Anum_pg_rewrite_ev_class,
- Anum_pg_rewrite_rulename,
- 0,
- 0
- },
+ KEY(Anum_pg_rewrite_ev_class,
+ Anum_pg_rewrite_rulename),
8
},
- {SequenceRelationId, /* SEQRELID */
+ [SEQRELID] = {
+ SequenceRelationId,
SequenceRelidIndexId,
- 1,
- {
- Anum_pg_sequence_seqrelid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_sequence_seqrelid),
32
},
- {StatisticExtDataRelationId, /* STATEXTDATASTXOID */
+ [STATEXTDATASTXOID] = {
+ StatisticExtDataRelationId,
StatisticExtDataStxoidInhIndexId,
- 2,
- {
- Anum_pg_statistic_ext_data_stxoid,
- Anum_pg_statistic_ext_data_stxdinherit,
- 0,
- 0
- },
+ KEY(Anum_pg_statistic_ext_data_stxoid,
+ Anum_pg_statistic_ext_data_stxdinherit),
4
},
- {StatisticExtRelationId, /* STATEXTNAMENSP */
+ [STATEXTNAMENSP] = {
+ StatisticExtRelationId,
StatisticExtNameIndexId,
- 2,
- {
- Anum_pg_statistic_ext_stxname,
- Anum_pg_statistic_ext_stxnamespace,
- 0,
- 0
- },
+ KEY(Anum_pg_statistic_ext_stxname,
+ Anum_pg_statistic_ext_stxnamespace),
4
},
- {StatisticExtRelationId, /* STATEXTOID */
+ [STATEXTOID] = {
+ StatisticExtRelationId,
StatisticExtOidIndexId,
- 1,
- {
- Anum_pg_statistic_ext_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_statistic_ext_oid),
4
},
- {StatisticRelationId, /* STATRELATTINH */
+ [STATRELATTINH] = {
+ StatisticRelationId,
StatisticRelidAttnumInhIndexId,
- 3,
- {
- Anum_pg_statistic_starelid,
+ KEY(Anum_pg_statistic_starelid,
Anum_pg_statistic_staattnum,
- Anum_pg_statistic_stainherit,
- 0
- },
+ Anum_pg_statistic_stainherit),
128
},
- {SubscriptionRelationId, /* SUBSCRIPTIONNAME */
+ [SUBSCRIPTIONNAME] = {
+ SubscriptionRelationId,
SubscriptionNameIndexId,
- 2,
- {
- Anum_pg_subscription_subdbid,
- Anum_pg_subscription_subname,
- 0,
- 0
- },
+ KEY(Anum_pg_subscription_subdbid,
+ Anum_pg_subscription_subname),
4
},
- {SubscriptionRelationId, /* SUBSCRIPTIONOID */
+ [SUBSCRIPTIONOID] = {
+ SubscriptionRelationId,
SubscriptionObjectIndexId,
- 1,
- {
- Anum_pg_subscription_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_subscription_oid),
4
},
- {SubscriptionRelRelationId, /* SUBSCRIPTIONRELMAP */
+ [SUBSCRIPTIONRELMAP] = {
+ SubscriptionRelRelationId,
SubscriptionRelSrrelidSrsubidIndexId,
- 2,
- {
- Anum_pg_subscription_rel_srrelid,
- Anum_pg_subscription_rel_srsubid,
- 0,
- 0
- },
+ KEY(Anum_pg_subscription_rel_srrelid,
+ Anum_pg_subscription_rel_srsubid),
64
},
- {TableSpaceRelationId, /* TABLESPACEOID */
+ [TABLESPACEOID] = {
+ TableSpaceRelationId,
TablespaceOidIndexId,
- 1,
- {
- Anum_pg_tablespace_oid,
- 0,
- 0,
- 0,
- },
+ KEY(Anum_pg_tablespace_oid),
4
},
- {TransformRelationId, /* TRFOID */
+ [TRFOID] = {
+ TransformRelationId,
TransformOidIndexId,
- 1,
- {
- Anum_pg_transform_oid,
- 0,
- 0,
- 0,
- },
+ KEY(Anum_pg_transform_oid),
16
},
- {TransformRelationId, /* TRFTYPELANG */
+ [TRFTYPELANG] = {
+ TransformRelationId,
TransformTypeLangIndexId,
- 2,
- {
- Anum_pg_transform_trftype,
- Anum_pg_transform_trflang,
- 0,
- 0,
- },
+ KEY(Anum_pg_transform_trftype,
+ Anum_pg_transform_trflang),
16
},
- {TSConfigMapRelationId, /* TSCONFIGMAP */
+ [TSCONFIGMAP] = {
+ TSConfigMapRelationId,
TSConfigMapIndexId,
- 3,
- {
- Anum_pg_ts_config_map_mapcfg,
+ KEY(Anum_pg_ts_config_map_mapcfg,
Anum_pg_ts_config_map_maptokentype,
- Anum_pg_ts_config_map_mapseqno,
- 0
- },
+ Anum_pg_ts_config_map_mapseqno),
2
},
- {TSConfigRelationId, /* TSCONFIGNAMENSP */
+ [TSCONFIGNAMENSP] = {
+ TSConfigRelationId,
TSConfigNameNspIndexId,
- 2,
- {
- Anum_pg_ts_config_cfgname,
- Anum_pg_ts_config_cfgnamespace,
- 0,
- 0
- },
+ KEY(Anum_pg_ts_config_cfgname,
+ Anum_pg_ts_config_cfgnamespace),
2
},
- {TSConfigRelationId, /* TSCONFIGOID */
+ [TSCONFIGOID] = {
+ TSConfigRelationId,
TSConfigOidIndexId,
- 1,
- {
- Anum_pg_ts_config_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_ts_config_oid),
2
},
- {TSDictionaryRelationId, /* TSDICTNAMENSP */
+ [TSDICTNAMENSP] = {
+ TSDictionaryRelationId,
TSDictionaryNameNspIndexId,
- 2,
- {
- Anum_pg_ts_dict_dictname,
- Anum_pg_ts_dict_dictnamespace,
- 0,
- 0
- },
+ KEY(Anum_pg_ts_dict_dictname,
+ Anum_pg_ts_dict_dictnamespace),
2
},
- {TSDictionaryRelationId, /* TSDICTOID */
+ [TSDICTOID] = {
+ TSDictionaryRelationId,
TSDictionaryOidIndexId,
- 1,
- {
- Anum_pg_ts_dict_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_ts_dict_oid),
2
},
- {TSParserRelationId, /* TSPARSERNAMENSP */
+ [TSPARSERNAMENSP] = {
+ TSParserRelationId,
TSParserNameNspIndexId,
- 2,
- {
- Anum_pg_ts_parser_prsname,
- Anum_pg_ts_parser_prsnamespace,
- 0,
- 0
- },
+ KEY(Anum_pg_ts_parser_prsname,
+ Anum_pg_ts_parser_prsnamespace),
2
},
- {TSParserRelationId, /* TSPARSEROID */
+ [TSPARSEROID] = {
+ TSParserRelationId,
TSParserOidIndexId,
- 1,
- {
- Anum_pg_ts_parser_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_ts_parser_oid),
2
},
- {TSTemplateRelationId, /* TSTEMPLATENAMENSP */
+ [TSTEMPLATENAMENSP] = {
+ TSTemplateRelationId,
TSTemplateNameNspIndexId,
- 2,
- {
- Anum_pg_ts_template_tmplname,
- Anum_pg_ts_template_tmplnamespace,
- 0,
- 0
- },
+ KEY(Anum_pg_ts_template_tmplname,
+ Anum_pg_ts_template_tmplnamespace),
2
},
- {TSTemplateRelationId, /* TSTEMPLATEOID */
+ [TSTEMPLATEOID] = {
+ TSTemplateRelationId,
TSTemplateOidIndexId,
- 1,
- {
- Anum_pg_ts_template_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_ts_template_oid),
2
},
- {TypeRelationId, /* TYPENAMENSP */
+ [TYPENAMENSP] = {
+ TypeRelationId,
TypeNameNspIndexId,
- 2,
- {
- Anum_pg_type_typname,
- Anum_pg_type_typnamespace,
- 0,
- 0
- },
+ KEY(Anum_pg_type_typname,
+ Anum_pg_type_typnamespace),
64
},
- {TypeRelationId, /* TYPEOID */
+ [TYPEOID] = {
+ TypeRelationId,
TypeOidIndexId,
- 1,
- {
- Anum_pg_type_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_type_oid),
64
},
- {UserMappingRelationId, /* USERMAPPINGOID */
+ [USERMAPPINGOID] = {
+ UserMappingRelationId,
UserMappingOidIndexId,
- 1,
- {
- Anum_pg_user_mapping_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_user_mapping_oid),
2
},
- {UserMappingRelationId, /* USERMAPPINGUSERSERVER */
+ [USERMAPPINGUSERSERVER] = {
+ UserMappingRelationId,
UserMappingUserServerIndexId,
- 2,
- {
- Anum_pg_user_mapping_umuser,
- Anum_pg_user_mapping_umserver,
- 0,
- 0
- },
+ KEY(Anum_pg_user_mapping_umuser,
+ Anum_pg_user_mapping_umserver),
2
}
};
@@ -1077,6 +714,12 @@ InitCatalogCache(void)
for (cacheId = 0; cacheId < SysCacheSize; cacheId++)
{
+ /*
+ * Assert that every enumeration value defined in syscache.h has been
+ * populated in the cacheinfo array.
+ */
+ Assert(cacheinfo[cacheId].reloid != 0);
+
SysCache[cacheId] = InitCatCache(cacheId,
cacheinfo[cacheId].reloid,
cacheinfo[cacheId].indoid,
--
2.38.1
On Wed, Dec 21, 2022 at 1:33 PM Thomas Munro <thomas.munro@gmail.com> wrote:
KEY(Anum_pg_attribute_attrelid,
Anum_pg_attribute_attnum),
I independently rediscovered that our VA_ARGS_NARGS() macro in c.h
always returns 1 on MSVC via trial-by-CI. Derp. Here is the same
patch, no change from v2, but this time accompanied by Victor Spirin's
fix, which I found via one of the tab-completion-is-busted-on-Windows
discussions. I can't supply a useful commit message, because I
haven't understood why it works, but it does indeed seem to work and
this should make cfbot green.
Attachments:
v3-0001-Fix-VA_ARGS_NARGS-macro-on-MSVC.patchtext/x-patch; charset=US-ASCII; name=v3-0001-Fix-VA_ARGS_NARGS-macro-on-MSVC.patchDownload
From a875324d9aca79cfbc46924354dcb4631d418dff Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@gmail.com>
Date: Wed, 21 Dec 2022 15:36:46 +1300
Subject: [PATCH v3 1/2] Fix VA_ARGS_NARGS() macro on MSVC.
The previous coding of VA_ARGS_NARGS() always returned 1 on MSVC.
XXX Explain?
Author: Victor Spirin <v.spirin@postgrespro.ru>
Discussion: https://postgr.es/m/f450fc57-a147-19d0-e50c-33571c52cc13%40postgrespro.ru
---
src/include/c.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/include/c.h b/src/include/c.h
index bd6d8e5bf5..06f49e7592 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -325,6 +325,19 @@
* the call so that that is the appropriate one of the list of constants.
* This idea is due to Laurent Deniau.
*/
+#ifdef _MSC_VER
+#define EXPAND(args) args
+#define VA_ARGS_NARGS(...) \
+ VA_ARGS_NARGS_ EXPAND((__VA_ARGS__, \
+ 63,62,61,60, \
+ 59,58,57,56,55,54,53,52,51,50, \
+ 49,48,47,46,45,44,43,42,41,40, \
+ 39,38,37,36,35,34,33,32,31,30, \
+ 29,28,27,26,25,24,23,22,21,20, \
+ 19,18,17,16,15,14,13,12,11,10, \
+ 9, 8, 7, 6, 5, 4, 3, 2, 1, 0))
+#else
+
#define VA_ARGS_NARGS(...) \
VA_ARGS_NARGS_(__VA_ARGS__, \
63,62,61,60, \
@@ -334,6 +347,8 @@
29,28,27,26,25,24,23,22,21,20, \
19,18,17,16,15,14,13,12,11,10, \
9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
+#endif
+
#define VA_ARGS_NARGS_( \
_01,_02,_03,_04,_05,_06,_07,_08,_09,_10, \
_11,_12,_13,_14,_15,_16,_17,_18,_19,_20, \
--
2.38.1
v3-0002-Improve-notation-of-cacheinfo-table-in-syscache.c.patchtext/x-patch; charset=US-ASCII; name=v3-0002-Improve-notation-of-cacheinfo-table-in-syscache.c.patchDownload
From fe6420c519a6351a1a53b5e7e1f44418985c5609 Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@gmail.com>
Date: Tue, 20 Dec 2022 15:47:59 +1300
Subject: [PATCH v3 2/2] Improve notation of cacheinfo table in syscache.c.
Use C99 designated initializer syntax for the array elements, instead of
writing the enumerator name and position in a comment. Replace nkeys
and key with a local variadic macro, for a shorter notation.
---
src/backend/utils/cache/syscache.c | 943 +++++++++--------------------
1 file changed, 293 insertions(+), 650 deletions(-)
diff --git a/src/backend/utils/cache/syscache.c b/src/backend/utils/cache/syscache.c
index 5f17047047..99513aa336 100644
--- a/src/backend/utils/cache/syscache.c
+++ b/src/backend/utils/cache/syscache.c
@@ -89,8 +89,7 @@
Add your entry to the cacheinfo[] array below. All cache lists are
alphabetical, so add it in the proper place. Specify the relation OID,
- index OID, number of keys, key attribute numbers, and initial number of
- hash buckets.
+ index OID, key attribute numbers, and initial number of hash buckets.
The number of hash buckets must be a power of 2. It's reasonable to
set this to the number of entries that might be in the particular cache
@@ -122,920 +121,558 @@ struct cachedesc
int nbuckets; /* number of hash buckets for this cache */
};
+/* Macro to provide nkeys and key array with convenient syntax. */
+#define KEY(...) VA_ARGS_NARGS(__VA_ARGS__), { __VA_ARGS__ }
+
static const struct cachedesc cacheinfo[] = {
- {AggregateRelationId, /* AGGFNOID */
+ [AGGFNOID] = {
+ AggregateRelationId,
AggregateFnoidIndexId,
- 1,
- {
- Anum_pg_aggregate_aggfnoid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_aggregate_aggfnoid),
16
},
- {AccessMethodRelationId, /* AMNAME */
+ [AMNAME] = {
+ AccessMethodRelationId,
AmNameIndexId,
- 1,
- {
- Anum_pg_am_amname,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_am_amname),
4
},
- {AccessMethodRelationId, /* AMOID */
+ [AMOID] = {
+ AccessMethodRelationId,
AmOidIndexId,
- 1,
- {
- Anum_pg_am_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_am_oid),
4
},
- {AccessMethodOperatorRelationId, /* AMOPOPID */
+ [AMOPOPID] = {
+ AccessMethodOperatorRelationId,
AccessMethodOperatorIndexId,
- 3,
- {
- Anum_pg_amop_amopopr,
+ KEY(Anum_pg_amop_amopopr,
Anum_pg_amop_amoppurpose,
- Anum_pg_amop_amopfamily,
- 0
- },
+ Anum_pg_amop_amopfamily),
64
},
- {AccessMethodOperatorRelationId, /* AMOPSTRATEGY */
+ [AMOPSTRATEGY] = {
+ AccessMethodOperatorRelationId,
AccessMethodStrategyIndexId,
- 4,
- {
- Anum_pg_amop_amopfamily,
+ KEY(Anum_pg_amop_amopfamily,
Anum_pg_amop_amoplefttype,
Anum_pg_amop_amoprighttype,
- Anum_pg_amop_amopstrategy
- },
+ Anum_pg_amop_amopstrategy),
64
},
- {AccessMethodProcedureRelationId, /* AMPROCNUM */
+ [AMPROCNUM] = {
+ AccessMethodProcedureRelationId,
AccessMethodProcedureIndexId,
- 4,
- {
- Anum_pg_amproc_amprocfamily,
+ KEY(Anum_pg_amproc_amprocfamily,
Anum_pg_amproc_amproclefttype,
Anum_pg_amproc_amprocrighttype,
- Anum_pg_amproc_amprocnum
- },
+ Anum_pg_amproc_amprocnum),
16
},
- {AttributeRelationId, /* ATTNAME */
+ [ATTNAME] = {
+ AttributeRelationId,
AttributeRelidNameIndexId,
- 2,
- {
- Anum_pg_attribute_attrelid,
- Anum_pg_attribute_attname,
- 0,
- 0
- },
+ KEY(Anum_pg_attribute_attrelid,
+ Anum_pg_attribute_attname),
32
},
- {AttributeRelationId, /* ATTNUM */
+ [ATTNUM] = {
+ AttributeRelationId,
AttributeRelidNumIndexId,
- 2,
- {
- Anum_pg_attribute_attrelid,
- Anum_pg_attribute_attnum,
- 0,
- 0
- },
+ KEY(Anum_pg_attribute_attrelid,
+ Anum_pg_attribute_attnum),
128
},
- {AuthMemRelationId, /* AUTHMEMMEMROLE */
+ [AUTHMEMMEMROLE] = {
+ AuthMemRelationId,
AuthMemMemRoleIndexId,
- 3,
- {
- Anum_pg_auth_members_member,
+ KEY(Anum_pg_auth_members_member,
Anum_pg_auth_members_roleid,
- Anum_pg_auth_members_grantor,
- 0
- },
+ Anum_pg_auth_members_grantor),
8
},
- {AuthMemRelationId, /* AUTHMEMROLEMEM */
+ [AUTHMEMROLEMEM] = {
+ AuthMemRelationId,
AuthMemRoleMemIndexId,
- 3,
- {
- Anum_pg_auth_members_roleid,
+ KEY(Anum_pg_auth_members_roleid,
Anum_pg_auth_members_member,
- Anum_pg_auth_members_grantor,
- 0
- },
+ Anum_pg_auth_members_grantor),
8
},
- {AuthIdRelationId, /* AUTHNAME */
+ [AUTHNAME] = {
+ AuthIdRelationId,
AuthIdRolnameIndexId,
- 1,
- {
- Anum_pg_authid_rolname,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_authid_rolname),
8
},
- {AuthIdRelationId, /* AUTHOID */
+ [AUTHOID] = {
+ AuthIdRelationId,
AuthIdOidIndexId,
- 1,
- {
- Anum_pg_authid_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_authid_oid),
8
},
- {
- CastRelationId, /* CASTSOURCETARGET */
+ [CASTSOURCETARGET] = {
+ CastRelationId,
CastSourceTargetIndexId,
- 2,
- {
- Anum_pg_cast_castsource,
- Anum_pg_cast_casttarget,
- 0,
- 0
- },
+ KEY(Anum_pg_cast_castsource,
+ Anum_pg_cast_casttarget),
256
},
- {OperatorClassRelationId, /* CLAAMNAMENSP */
+ [CLAAMNAMENSP] = {
+ OperatorClassRelationId,
OpclassAmNameNspIndexId,
- 3,
- {
- Anum_pg_opclass_opcmethod,
+ KEY(Anum_pg_opclass_opcmethod,
Anum_pg_opclass_opcname,
- Anum_pg_opclass_opcnamespace,
- 0
- },
+ Anum_pg_opclass_opcnamespace),
8
},
- {OperatorClassRelationId, /* CLAOID */
+ [CLAOID] = {
+ OperatorClassRelationId,
OpclassOidIndexId,
- 1,
- {
- Anum_pg_opclass_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_opclass_oid),
8
},
- {CollationRelationId, /* COLLNAMEENCNSP */
+ [COLLNAMEENCNSP] = {
+ CollationRelationId,
CollationNameEncNspIndexId,
- 3,
- {
- Anum_pg_collation_collname,
+ KEY(Anum_pg_collation_collname,
Anum_pg_collation_collencoding,
- Anum_pg_collation_collnamespace,
- 0
- },
+ Anum_pg_collation_collnamespace),
8
},
- {CollationRelationId, /* COLLOID */
+ [COLLOID] = {
+ CollationRelationId,
CollationOidIndexId,
- 1,
- {
- Anum_pg_collation_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_collation_oid),
8
},
- {ConversionRelationId, /* CONDEFAULT */
+ [CONDEFAULT] = {
+ ConversionRelationId,
ConversionDefaultIndexId,
- 4,
- {
- Anum_pg_conversion_connamespace,
+ KEY(Anum_pg_conversion_connamespace,
Anum_pg_conversion_conforencoding,
Anum_pg_conversion_contoencoding,
- Anum_pg_conversion_oid
- },
+ Anum_pg_conversion_oid),
8
},
- {ConversionRelationId, /* CONNAMENSP */
+ [CONNAMENSP] = {
+ ConversionRelationId,
ConversionNameNspIndexId,
- 2,
- {
- Anum_pg_conversion_conname,
- Anum_pg_conversion_connamespace,
- 0,
- 0
- },
+ KEY(Anum_pg_conversion_conname,
+ Anum_pg_conversion_connamespace),
8
},
- {ConstraintRelationId, /* CONSTROID */
+ [CONSTROID] = {
+ ConstraintRelationId,
ConstraintOidIndexId,
- 1,
- {
- Anum_pg_constraint_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_constraint_oid),
16
},
- {ConversionRelationId, /* CONVOID */
+ [CONVOID] = {
+ ConversionRelationId,
ConversionOidIndexId,
- 1,
- {
- Anum_pg_conversion_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_conversion_oid),
8
},
- {DatabaseRelationId, /* DATABASEOID */
+ [DATABASEOID] = {
+ DatabaseRelationId,
DatabaseOidIndexId,
- 1,
- {
- Anum_pg_database_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_database_oid),
4
},
- {DefaultAclRelationId, /* DEFACLROLENSPOBJ */
+ [DEFACLROLENSPOBJ] = {
+ DefaultAclRelationId,
DefaultAclRoleNspObjIndexId,
- 3,
- {
- Anum_pg_default_acl_defaclrole,
+ KEY(Anum_pg_default_acl_defaclrole,
Anum_pg_default_acl_defaclnamespace,
- Anum_pg_default_acl_defaclobjtype,
- 0
- },
+ Anum_pg_default_acl_defaclobjtype),
8
},
- {EnumRelationId, /* ENUMOID */
+ [ENUMOID] = {
+ EnumRelationId,
EnumOidIndexId,
- 1,
- {
- Anum_pg_enum_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_enum_oid),
8
},
- {EnumRelationId, /* ENUMTYPOIDNAME */
+ [ENUMTYPOIDNAME] = {
+ EnumRelationId,
EnumTypIdLabelIndexId,
- 2,
- {
- Anum_pg_enum_enumtypid,
- Anum_pg_enum_enumlabel,
- 0,
- 0
- },
+ KEY(Anum_pg_enum_enumtypid,
+ Anum_pg_enum_enumlabel),
8
},
- {EventTriggerRelationId, /* EVENTTRIGGERNAME */
+ [EVENTTRIGGERNAME] = {
+ EventTriggerRelationId,
EventTriggerNameIndexId,
- 1,
- {
- Anum_pg_event_trigger_evtname,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_event_trigger_evtname),
8
},
- {EventTriggerRelationId, /* EVENTTRIGGEROID */
+ [EVENTTRIGGEROID] = {
+ EventTriggerRelationId,
EventTriggerOidIndexId,
- 1,
- {
- Anum_pg_event_trigger_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_event_trigger_oid),
8
},
- {ForeignDataWrapperRelationId, /* FOREIGNDATAWRAPPERNAME */
+ [FOREIGNDATAWRAPPERNAME] = {
+ ForeignDataWrapperRelationId,
ForeignDataWrapperNameIndexId,
- 1,
- {
- Anum_pg_foreign_data_wrapper_fdwname,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_foreign_data_wrapper_fdwname),
2
},
- {ForeignDataWrapperRelationId, /* FOREIGNDATAWRAPPEROID */
+ [FOREIGNDATAWRAPPEROID] = {
+ ForeignDataWrapperRelationId,
ForeignDataWrapperOidIndexId,
- 1,
- {
- Anum_pg_foreign_data_wrapper_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_foreign_data_wrapper_oid),
2
},
- {ForeignServerRelationId, /* FOREIGNSERVERNAME */
+ [FOREIGNSERVERNAME] = {
+ ForeignServerRelationId,
ForeignServerNameIndexId,
- 1,
- {
- Anum_pg_foreign_server_srvname,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_foreign_server_srvname),
2
},
- {ForeignServerRelationId, /* FOREIGNSERVEROID */
+ [FOREIGNSERVEROID] = {
+ ForeignServerRelationId,
ForeignServerOidIndexId,
- 1,
- {
- Anum_pg_foreign_server_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_foreign_server_oid),
2
},
- {ForeignTableRelationId, /* FOREIGNTABLEREL */
+ [FOREIGNTABLEREL] = {
+ ForeignTableRelationId,
ForeignTableRelidIndexId,
- 1,
- {
- Anum_pg_foreign_table_ftrelid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_foreign_table_ftrelid),
4
},
- {IndexRelationId, /* INDEXRELID */
+ [INDEXRELID] = {
+ IndexRelationId,
IndexRelidIndexId,
- 1,
- {
- Anum_pg_index_indexrelid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_index_indexrelid),
64
},
- {LanguageRelationId, /* LANGNAME */
+ [LANGNAME] = {
+ LanguageRelationId,
LanguageNameIndexId,
- 1,
- {
- Anum_pg_language_lanname,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_language_lanname),
4
},
- {LanguageRelationId, /* LANGOID */
+ [LANGOID] = {
+ LanguageRelationId,
LanguageOidIndexId,
- 1,
- {
- Anum_pg_language_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_language_oid),
4
},
- {NamespaceRelationId, /* NAMESPACENAME */
+ [NAMESPACENAME] = {
+ NamespaceRelationId,
NamespaceNameIndexId,
- 1,
- {
- Anum_pg_namespace_nspname,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_namespace_nspname),
4
},
- {NamespaceRelationId, /* NAMESPACEOID */
+ [NAMESPACEOID] = {
+ NamespaceRelationId,
NamespaceOidIndexId,
- 1,
- {
- Anum_pg_namespace_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_namespace_oid),
16
},
- {OperatorRelationId, /* OPERNAMENSP */
+ [OPERNAMENSP] = {
+ OperatorRelationId,
OperatorNameNspIndexId,
- 4,
- {
- Anum_pg_operator_oprname,
+ KEY(Anum_pg_operator_oprname,
Anum_pg_operator_oprleft,
Anum_pg_operator_oprright,
- Anum_pg_operator_oprnamespace
- },
+ Anum_pg_operator_oprnamespace),
256
},
- {OperatorRelationId, /* OPEROID */
+ [OPEROID] = {
+ OperatorRelationId,
OperatorOidIndexId,
- 1,
- {
- Anum_pg_operator_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_operator_oid),
32
},
- {OperatorFamilyRelationId, /* OPFAMILYAMNAMENSP */
+ [OPFAMILYAMNAMENSP] = {
+ OperatorFamilyRelationId,
OpfamilyAmNameNspIndexId,
- 3,
- {
- Anum_pg_opfamily_opfmethod,
+ KEY(Anum_pg_opfamily_opfmethod,
Anum_pg_opfamily_opfname,
- Anum_pg_opfamily_opfnamespace,
- 0
- },
+ Anum_pg_opfamily_opfnamespace),
8
},
- {OperatorFamilyRelationId, /* OPFAMILYOID */
+ [OPFAMILYOID] = {
+ OperatorFamilyRelationId,
OpfamilyOidIndexId,
- 1,
- {
- Anum_pg_opfamily_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_opfamily_oid),
8
},
- {ParameterAclRelationId, /* PARAMETERACLNAME */
+ [PARAMETERACLNAME] = {
+ ParameterAclRelationId,
ParameterAclParnameIndexId,
- 1,
- {
- Anum_pg_parameter_acl_parname,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_parameter_acl_parname),
4
},
- {ParameterAclRelationId, /* PARAMETERACLOID */
+ [PARAMETERACLOID] = {
+ ParameterAclRelationId,
ParameterAclOidIndexId,
- 1,
- {
- Anum_pg_parameter_acl_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_parameter_acl_oid),
4
},
- {PartitionedRelationId, /* PARTRELID */
+ [PARTRELID] = {
+ PartitionedRelationId,
PartitionedRelidIndexId,
- 1,
- {
- Anum_pg_partitioned_table_partrelid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_partitioned_table_partrelid),
32
},
- {ProcedureRelationId, /* PROCNAMEARGSNSP */
+ [PROCNAMEARGSNSP] = {
+ ProcedureRelationId,
ProcedureNameArgsNspIndexId,
- 3,
- {
- Anum_pg_proc_proname,
+ KEY(Anum_pg_proc_proname,
Anum_pg_proc_proargtypes,
- Anum_pg_proc_pronamespace,
- 0
- },
+ Anum_pg_proc_pronamespace),
128
},
- {ProcedureRelationId, /* PROCOID */
+ [PROCOID] = {
+ ProcedureRelationId,
ProcedureOidIndexId,
- 1,
- {
- Anum_pg_proc_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_proc_oid),
128
},
- {PublicationRelationId, /* PUBLICATIONNAME */
+ [PUBLICATIONNAME] = {
+ PublicationRelationId,
PublicationNameIndexId,
- 1,
- {
- Anum_pg_publication_pubname,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_publication_pubname),
8
},
- {PublicationNamespaceRelationId, /* PUBLICATIONNAMESPACE */
+ [PUBLICATIONNAMESPACE] = {
+ PublicationNamespaceRelationId,
PublicationNamespaceObjectIndexId,
- 1,
- {
- Anum_pg_publication_namespace_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_publication_namespace_oid),
64
},
- {PublicationNamespaceRelationId, /* PUBLICATIONNAMESPACEMAP */
+ [PUBLICATIONNAMESPACEMAP] = {
+ PublicationNamespaceRelationId,
PublicationNamespacePnnspidPnpubidIndexId,
- 2,
- {
- Anum_pg_publication_namespace_pnnspid,
- Anum_pg_publication_namespace_pnpubid,
- 0,
- 0
- },
+ KEY(Anum_pg_publication_namespace_pnnspid,
+ Anum_pg_publication_namespace_pnpubid),
64
},
- {PublicationRelationId, /* PUBLICATIONOID */
+ [PUBLICATIONOID] = {
+ PublicationRelationId,
PublicationObjectIndexId,
- 1,
- {
- Anum_pg_publication_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_publication_oid),
8
},
- {PublicationRelRelationId, /* PUBLICATIONREL */
+ [PUBLICATIONREL] = {
+ PublicationRelRelationId,
PublicationRelObjectIndexId,
- 1,
- {
- Anum_pg_publication_rel_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_publication_rel_oid),
64
},
- {PublicationRelRelationId, /* PUBLICATIONRELMAP */
+ [PUBLICATIONRELMAP] = {
+ PublicationRelRelationId,
PublicationRelPrrelidPrpubidIndexId,
- 2,
- {
- Anum_pg_publication_rel_prrelid,
- Anum_pg_publication_rel_prpubid,
- 0,
- 0
- },
+ KEY(Anum_pg_publication_rel_prrelid,
+ Anum_pg_publication_rel_prpubid),
64
},
- {RangeRelationId, /* RANGEMULTIRANGE */
+ [RANGEMULTIRANGE] = {
+ RangeRelationId,
RangeMultirangeTypidIndexId,
- 1,
- {
- Anum_pg_range_rngmultitypid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_range_rngmultitypid),
4
},
-
- {RangeRelationId, /* RANGETYPE */
+ [RANGETYPE] = {
+ RangeRelationId,
RangeTypidIndexId,
- 1,
- {
- Anum_pg_range_rngtypid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_range_rngtypid),
4
},
- {RelationRelationId, /* RELNAMENSP */
+ [RELNAMENSP] = {
+ RelationRelationId,
ClassNameNspIndexId,
- 2,
- {
- Anum_pg_class_relname,
- Anum_pg_class_relnamespace,
- 0,
- 0
- },
+ KEY(Anum_pg_class_relname,
+ Anum_pg_class_relnamespace),
128
},
- {RelationRelationId, /* RELOID */
+ [RELOID] = {
+ RelationRelationId,
ClassOidIndexId,
- 1,
- {
- Anum_pg_class_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_class_oid),
128
},
- {ReplicationOriginRelationId, /* REPLORIGIDENT */
+ [REPLORIGIDENT] = {
+ ReplicationOriginRelationId,
ReplicationOriginIdentIndex,
- 1,
- {
- Anum_pg_replication_origin_roident,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_replication_origin_roident),
16
},
- {ReplicationOriginRelationId, /* REPLORIGNAME */
+ [REPLORIGNAME] = {
+ ReplicationOriginRelationId,
ReplicationOriginNameIndex,
- 1,
- {
- Anum_pg_replication_origin_roname,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_replication_origin_roname),
16
},
- {RewriteRelationId, /* RULERELNAME */
+ [RULERELNAME] = {
+ RewriteRelationId,
RewriteRelRulenameIndexId,
- 2,
- {
- Anum_pg_rewrite_ev_class,
- Anum_pg_rewrite_rulename,
- 0,
- 0
- },
+ KEY(Anum_pg_rewrite_ev_class,
+ Anum_pg_rewrite_rulename),
8
},
- {SequenceRelationId, /* SEQRELID */
+ [SEQRELID] = {
+ SequenceRelationId,
SequenceRelidIndexId,
- 1,
- {
- Anum_pg_sequence_seqrelid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_sequence_seqrelid),
32
},
- {StatisticExtDataRelationId, /* STATEXTDATASTXOID */
+ [STATEXTDATASTXOID] = {
+ StatisticExtDataRelationId,
StatisticExtDataStxoidInhIndexId,
- 2,
- {
- Anum_pg_statistic_ext_data_stxoid,
- Anum_pg_statistic_ext_data_stxdinherit,
- 0,
- 0
- },
+ KEY(Anum_pg_statistic_ext_data_stxoid,
+ Anum_pg_statistic_ext_data_stxdinherit),
4
},
- {StatisticExtRelationId, /* STATEXTNAMENSP */
+ [STATEXTNAMENSP] = {
+ StatisticExtRelationId,
StatisticExtNameIndexId,
- 2,
- {
- Anum_pg_statistic_ext_stxname,
- Anum_pg_statistic_ext_stxnamespace,
- 0,
- 0
- },
+ KEY(Anum_pg_statistic_ext_stxname,
+ Anum_pg_statistic_ext_stxnamespace),
4
},
- {StatisticExtRelationId, /* STATEXTOID */
+ [STATEXTOID] = {
+ StatisticExtRelationId,
StatisticExtOidIndexId,
- 1,
- {
- Anum_pg_statistic_ext_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_statistic_ext_oid),
4
},
- {StatisticRelationId, /* STATRELATTINH */
+ [STATRELATTINH] = {
+ StatisticRelationId,
StatisticRelidAttnumInhIndexId,
- 3,
- {
- Anum_pg_statistic_starelid,
+ KEY(Anum_pg_statistic_starelid,
Anum_pg_statistic_staattnum,
- Anum_pg_statistic_stainherit,
- 0
- },
+ Anum_pg_statistic_stainherit),
128
},
- {SubscriptionRelationId, /* SUBSCRIPTIONNAME */
+ [SUBSCRIPTIONNAME] = {
+ SubscriptionRelationId,
SubscriptionNameIndexId,
- 2,
- {
- Anum_pg_subscription_subdbid,
- Anum_pg_subscription_subname,
- 0,
- 0
- },
+ KEY(Anum_pg_subscription_subdbid,
+ Anum_pg_subscription_subname),
4
},
- {SubscriptionRelationId, /* SUBSCRIPTIONOID */
+ [SUBSCRIPTIONOID] = {
+ SubscriptionRelationId,
SubscriptionObjectIndexId,
- 1,
- {
- Anum_pg_subscription_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_subscription_oid),
4
},
- {SubscriptionRelRelationId, /* SUBSCRIPTIONRELMAP */
+ [SUBSCRIPTIONRELMAP] = {
+ SubscriptionRelRelationId,
SubscriptionRelSrrelidSrsubidIndexId,
- 2,
- {
- Anum_pg_subscription_rel_srrelid,
- Anum_pg_subscription_rel_srsubid,
- 0,
- 0
- },
+ KEY(Anum_pg_subscription_rel_srrelid,
+ Anum_pg_subscription_rel_srsubid),
64
},
- {TableSpaceRelationId, /* TABLESPACEOID */
+ [TABLESPACEOID] = {
+ TableSpaceRelationId,
TablespaceOidIndexId,
- 1,
- {
- Anum_pg_tablespace_oid,
- 0,
- 0,
- 0,
- },
+ KEY(Anum_pg_tablespace_oid),
4
},
- {TransformRelationId, /* TRFOID */
+ [TRFOID] = {
+ TransformRelationId,
TransformOidIndexId,
- 1,
- {
- Anum_pg_transform_oid,
- 0,
- 0,
- 0,
- },
+ KEY(Anum_pg_transform_oid),
16
},
- {TransformRelationId, /* TRFTYPELANG */
+ [TRFTYPELANG] = {
+ TransformRelationId,
TransformTypeLangIndexId,
- 2,
- {
- Anum_pg_transform_trftype,
- Anum_pg_transform_trflang,
- 0,
- 0,
- },
+ KEY(Anum_pg_transform_trftype,
+ Anum_pg_transform_trflang),
16
},
- {TSConfigMapRelationId, /* TSCONFIGMAP */
+ [TSCONFIGMAP] = {
+ TSConfigMapRelationId,
TSConfigMapIndexId,
- 3,
- {
- Anum_pg_ts_config_map_mapcfg,
+ KEY(Anum_pg_ts_config_map_mapcfg,
Anum_pg_ts_config_map_maptokentype,
- Anum_pg_ts_config_map_mapseqno,
- 0
- },
+ Anum_pg_ts_config_map_mapseqno),
2
},
- {TSConfigRelationId, /* TSCONFIGNAMENSP */
+ [TSCONFIGNAMENSP] = {
+ TSConfigRelationId,
TSConfigNameNspIndexId,
- 2,
- {
- Anum_pg_ts_config_cfgname,
- Anum_pg_ts_config_cfgnamespace,
- 0,
- 0
- },
+ KEY(Anum_pg_ts_config_cfgname,
+ Anum_pg_ts_config_cfgnamespace),
2
},
- {TSConfigRelationId, /* TSCONFIGOID */
+ [TSCONFIGOID] = {
+ TSConfigRelationId,
TSConfigOidIndexId,
- 1,
- {
- Anum_pg_ts_config_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_ts_config_oid),
2
},
- {TSDictionaryRelationId, /* TSDICTNAMENSP */
+ [TSDICTNAMENSP] = {
+ TSDictionaryRelationId,
TSDictionaryNameNspIndexId,
- 2,
- {
- Anum_pg_ts_dict_dictname,
- Anum_pg_ts_dict_dictnamespace,
- 0,
- 0
- },
+ KEY(Anum_pg_ts_dict_dictname,
+ Anum_pg_ts_dict_dictnamespace),
2
},
- {TSDictionaryRelationId, /* TSDICTOID */
+ [TSDICTOID] = {
+ TSDictionaryRelationId,
TSDictionaryOidIndexId,
- 1,
- {
- Anum_pg_ts_dict_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_ts_dict_oid),
2
},
- {TSParserRelationId, /* TSPARSERNAMENSP */
+ [TSPARSERNAMENSP] = {
+ TSParserRelationId,
TSParserNameNspIndexId,
- 2,
- {
- Anum_pg_ts_parser_prsname,
- Anum_pg_ts_parser_prsnamespace,
- 0,
- 0
- },
+ KEY(Anum_pg_ts_parser_prsname,
+ Anum_pg_ts_parser_prsnamespace),
2
},
- {TSParserRelationId, /* TSPARSEROID */
+ [TSPARSEROID] = {
+ TSParserRelationId,
TSParserOidIndexId,
- 1,
- {
- Anum_pg_ts_parser_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_ts_parser_oid),
2
},
- {TSTemplateRelationId, /* TSTEMPLATENAMENSP */
+ [TSTEMPLATENAMENSP] = {
+ TSTemplateRelationId,
TSTemplateNameNspIndexId,
- 2,
- {
- Anum_pg_ts_template_tmplname,
- Anum_pg_ts_template_tmplnamespace,
- 0,
- 0
- },
+ KEY(Anum_pg_ts_template_tmplname,
+ Anum_pg_ts_template_tmplnamespace),
2
},
- {TSTemplateRelationId, /* TSTEMPLATEOID */
+ [TSTEMPLATEOID] = {
+ TSTemplateRelationId,
TSTemplateOidIndexId,
- 1,
- {
- Anum_pg_ts_template_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_ts_template_oid),
2
},
- {TypeRelationId, /* TYPENAMENSP */
+ [TYPENAMENSP] = {
+ TypeRelationId,
TypeNameNspIndexId,
- 2,
- {
- Anum_pg_type_typname,
- Anum_pg_type_typnamespace,
- 0,
- 0
- },
+ KEY(Anum_pg_type_typname,
+ Anum_pg_type_typnamespace),
64
},
- {TypeRelationId, /* TYPEOID */
+ [TYPEOID] = {
+ TypeRelationId,
TypeOidIndexId,
- 1,
- {
- Anum_pg_type_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_type_oid),
64
},
- {UserMappingRelationId, /* USERMAPPINGOID */
+ [USERMAPPINGOID] = {
+ UserMappingRelationId,
UserMappingOidIndexId,
- 1,
- {
- Anum_pg_user_mapping_oid,
- 0,
- 0,
- 0
- },
+ KEY(Anum_pg_user_mapping_oid),
2
},
- {UserMappingRelationId, /* USERMAPPINGUSERSERVER */
+ [USERMAPPINGUSERSERVER] = {
+ UserMappingRelationId,
UserMappingUserServerIndexId,
- 2,
- {
- Anum_pg_user_mapping_umuser,
- Anum_pg_user_mapping_umserver,
- 0,
- 0
- },
+ KEY(Anum_pg_user_mapping_umuser,
+ Anum_pg_user_mapping_umserver),
2
}
};
@@ -1077,6 +714,12 @@ InitCatalogCache(void)
for (cacheId = 0; cacheId < SysCacheSize; cacheId++)
{
+ /*
+ * Assert that every enumeration value defined in syscache.h has been
+ * populated in the cacheinfo array.
+ */
+ Assert(cacheinfo[cacheId].reloid != 0);
+
SysCache[cacheId] = InitCatCache(cacheId,
cacheinfo[cacheId].reloid,
cacheinfo[cacheId].indoid,
--
2.38.1
On 21.12.22 04:16, Thomas Munro wrote:
On Wed, Dec 21, 2022 at 1:33 PM Thomas Munro <thomas.munro@gmail.com> wrote:
KEY(Anum_pg_attribute_attrelid,
Anum_pg_attribute_attnum),I independently rediscovered that our VA_ARGS_NARGS() macro in c.h
always returns 1 on MSVC via trial-by-CI. Derp. Here is the same
patch, no change from v2, but this time accompanied by Victor Spirin's
fix, which I found via one of the tab-completion-is-busted-on-Windows
discussions. I can't supply a useful commit message, because I
haven't understood why it works, but it does indeed seem to work and
this should make cfbot green.
This looks like a good improvement to me.
(I have also thought about having this generated from the catalog
definition files somehow, but one step at a time ...)
Hi!
Wanted to ask this since I encountered a need for a cache with 5 keys -
why is the syscache index still limited to 4 keys?
Thanks!
On Wed, Dec 21, 2022 at 7:36 PM Peter Eisentraut <
peter.eisentraut@enterprisedb.com> wrote:
On 21.12.22 04:16, Thomas Munro wrote:
On Wed, Dec 21, 2022 at 1:33 PM Thomas Munro <thomas.munro@gmail.com>
wrote:
KEY(Anum_pg_attribute_attrelid,
Anum_pg_attribute_attnum),I independently rediscovered that our VA_ARGS_NARGS() macro in c.h
always returns 1 on MSVC via trial-by-CI. Derp. Here is the same
patch, no change from v2, but this time accompanied by Victor Spirin's
fix, which I found via one of the tab-completion-is-busted-on-Windows
discussions. I can't supply a useful commit message, because I
haven't understood why it works, but it does indeed seem to work and
this should make cfbot green.This looks like a good improvement to me.
(I have also thought about having this generated from the catalog
definition files somehow, but one step at a time ...)
--
Regards,
Nikita Malakhov
Postgres Professional
https://postgrespro.ru/
Nikita Malakhov <hukutoc@gmail.com> writes:
Wanted to ask this since I encountered a need for a cache with 5 keys -
why is the syscache index still limited to 4 keys?
Because there are no cases requiring 5, so far.
(A unique index with as many as 5 keys seems a bit fishy btw.)
regards, tom lane
On Thu, Dec 22, 2022 at 5:36 AM Peter Eisentraut
<peter.eisentraut@enterprisedb.com> wrote:
This looks like a good improvement to me.
Thanks both. Pushed.
(I have also thought about having this generated from the catalog
definition files somehow, but one step at a time ...)
Good plan.
From the light relief department, here is some more variadic macrology:
- tp = SearchSysCache1(TSPARSEROID, ObjectIdGetDatum(prsId));
+ tp = SearchSysCache(TSPARSEROID, ObjectIdGetDatum(prsId));
Attachments:
0001-Use-variadic-macros-for-syscache-lookup-functions.patchtext/x-patch; charset=US-ASCII; name=0001-Use-variadic-macros-for-syscache-lookup-functions.patchDownload
From 5930588da586aa7a5f2aaf8edc365dd0ea399e5b Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@gmail.com>
Date: Wed, 29 Mar 2023 12:48:57 +1300
Subject: [PATCH] Use variadic macros for syscache lookup functions.
Various syscache lookup functions that take 1-4 OIDs as a key had
variants with with the "arity" in the name. Many of these were already
macro wrappers. We can use C99 macros instead, and drop the numbers for
a slightly prettier notation.
Discussion: https://postgr.es/m/CA%2BhUKGKdpDjKL2jgC-GpoL4DGZU1YPqnOFHbDqFkfRQcPaR5DQ%40mail.gmail.com
diff --git a/contrib/bloom/blvalidate.c b/contrib/bloom/blvalidate.c
index 74bb3f894e..e3576838ab 100644
--- a/contrib/bloom/blvalidate.c
+++ b/contrib/bloom/blvalidate.c
@@ -49,7 +49,7 @@ blvalidate(Oid opclassoid)
ListCell *lc;
/* Fetch opclass information */
- classtup = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclassoid));
+ classtup = SearchSysCache(CLAOID, ObjectIdGetDatum(opclassoid));
if (!HeapTupleIsValid(classtup))
elog(ERROR, "cache lookup failed for operator class %u", opclassoid);
classform = (Form_pg_opclass) GETSTRUCT(classtup);
@@ -62,7 +62,7 @@ blvalidate(Oid opclassoid)
opclassname = NameStr(classform->opcname);
/* Fetch opfamily information */
- familytup = SearchSysCache1(OPFAMILYOID, ObjectIdGetDatum(opfamilyoid));
+ familytup = SearchSysCache(OPFAMILYOID, ObjectIdGetDatum(opfamilyoid));
if (!HeapTupleIsValid(familytup))
elog(ERROR, "cache lookup failed for operator family %u", opfamilyoid);
familyform = (Form_pg_opfamily) GETSTRUCT(familytup);
@@ -70,8 +70,8 @@ blvalidate(Oid opclassoid)
opfamilyname = NameStr(familyform->opfname);
/* Fetch all operators and support functions of the opfamily */
- oprlist = SearchSysCacheList1(AMOPSTRATEGY, ObjectIdGetDatum(opfamilyoid));
- proclist = SearchSysCacheList1(AMPROCNUM, ObjectIdGetDatum(opfamilyoid));
+ oprlist = SearchSysCacheList(AMOPSTRATEGY, ObjectIdGetDatum(opfamilyoid));
+ proclist = SearchSysCacheList(AMPROCNUM, ObjectIdGetDatum(opfamilyoid));
/* Check individual support functions */
for (i = 0; i < proclist->n_members; i++)
diff --git a/contrib/postgres_fdw/connection.c b/contrib/postgres_fdw/connection.c
index 8eb9194506..bb4db72578 100644
--- a/contrib/postgres_fdw/connection.c
+++ b/contrib/postgres_fdw/connection.c
@@ -306,11 +306,11 @@ make_new_connection(ConnCacheEntry *entry, UserMapping *user)
entry->invalidated = false;
entry->serverid = server->serverid;
entry->server_hashvalue =
- GetSysCacheHashValue1(FOREIGNSERVEROID,
- ObjectIdGetDatum(server->serverid));
+ GetSysCacheHashValue(FOREIGNSERVEROID,
+ ObjectIdGetDatum(server->serverid));
entry->mapping_hashvalue =
- GetSysCacheHashValue1(USERMAPPINGOID,
- ObjectIdGetDatum(user->umid));
+ GetSysCacheHashValue(USERMAPPINGOID,
+ ObjectIdGetDatum(user->umid));
memset(&entry->state, 0, sizeof(entry->state));
/*
diff --git a/contrib/postgres_fdw/deparse.c b/contrib/postgres_fdw/deparse.c
index 09d6dd60dd..c2e949edd5 100644
--- a/contrib/postgres_fdw/deparse.c
+++ b/contrib/postgres_fdw/deparse.c
@@ -3141,7 +3141,7 @@ deparseOpExpr(OpExpr *node, deparse_expr_cxt *context)
char oprkind;
/* Retrieve information about the operator from system catalog. */
- tuple = SearchSysCache1(OPEROID, ObjectIdGetDatum(node->opno));
+ tuple = SearchSysCache(OPEROID, ObjectIdGetDatum(node->opno));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for operator %u", node->opno);
form = (Form_pg_operator) GETSTRUCT(tuple);
@@ -3316,7 +3316,7 @@ deparseScalarArrayOpExpr(ScalarArrayOpExpr *node, deparse_expr_cxt *context)
Expr *arg2;
/* Retrieve information about the operator from system catalog. */
- tuple = SearchSysCache1(OPEROID, ObjectIdGetDatum(node->opno));
+ tuple = SearchSysCache(OPEROID, ObjectIdGetDatum(node->opno));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for operator %u", node->opno);
form = (Form_pg_operator) GETSTRUCT(tuple);
@@ -3655,7 +3655,7 @@ appendOrderBySuffix(Oid sortop, Oid sortcoltype, bool nulls_first,
appendStringInfoString(buf, " USING ");
/* Append operator name. */
- opertup = SearchSysCache1(OPEROID, ObjectIdGetDatum(sortop));
+ opertup = SearchSysCache(OPEROID, ObjectIdGetDatum(sortop));
if (!HeapTupleIsValid(opertup))
elog(ERROR, "cache lookup failed for operator %u", sortop);
operform = (Form_pg_operator) GETSTRUCT(opertup);
@@ -3877,7 +3877,7 @@ appendFunctionName(Oid funcid, deparse_expr_cxt *context)
Form_pg_proc procform;
const char *proname;
- proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
+ proctup = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(proctup))
elog(ERROR, "cache lookup failed for function %u", funcid);
procform = (Form_pg_proc) GETSTRUCT(proctup);
diff --git a/contrib/sepgsql/dml.c b/contrib/sepgsql/dml.c
index 8c8f6f1e3a..279dd3903e 100644
--- a/contrib/sepgsql/dml.c
+++ b/contrib/sepgsql/dml.c
@@ -50,7 +50,7 @@ fixup_whole_row_references(Oid relOid, Bitmapset *columns)
return columns;
/* obtain number of attributes */
- tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relOid));
+ tuple = SearchSysCache(RELOID, ObjectIdGetDatum(relOid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", relOid);
natts = ((Form_pg_class) GETSTRUCT(tuple))->relnatts;
@@ -62,9 +62,9 @@ fixup_whole_row_references(Oid relOid, Bitmapset *columns)
for (attno = 1; attno <= natts; attno++)
{
- tuple = SearchSysCache2(ATTNUM,
- ObjectIdGetDatum(relOid),
- Int16GetDatum(attno));
+ tuple = SearchSysCache(ATTNUM,
+ ObjectIdGetDatum(relOid),
+ Int16GetDatum(attno));
if (!HeapTupleIsValid(tuple))
continue; /* unexpected case, should we error? */
diff --git a/contrib/sepgsql/proc.c b/contrib/sepgsql/proc.c
index 2182034427..e8c48fb8cf 100644
--- a/contrib/sepgsql/proc.c
+++ b/contrib/sepgsql/proc.c
@@ -265,7 +265,7 @@ sepgsql_proc_setattr(Oid functionId)
/*
* Fetch older catalog
*/
- oldtup = SearchSysCache1(PROCOID, ObjectIdGetDatum(functionId));
+ oldtup = SearchSysCache(PROCOID, ObjectIdGetDatum(functionId));
if (!HeapTupleIsValid(oldtup))
elog(ERROR, "cache lookup failed for function %u", functionId);
oldform = (Form_pg_proc) GETSTRUCT(oldtup);
diff --git a/contrib/sepgsql/relation.c b/contrib/sepgsql/relation.c
index 4653a98502..0e776e225b 100644
--- a/contrib/sepgsql/relation.c
+++ b/contrib/sepgsql/relation.c
@@ -490,7 +490,7 @@ sepgsql_relation_drop(Oid relOid)
HeapTuple atttup;
int i;
- attrList = SearchSysCacheList1(ATTNUM, ObjectIdGetDatum(relOid));
+ attrList = SearchSysCacheList(ATTNUM, ObjectIdGetDatum(relOid));
for (i = 0; i < attrList->n_members; i++)
{
atttup = &attrList->members[i]->tuple;
@@ -667,7 +667,7 @@ sepgsql_relation_setattr(Oid relOid)
/*
* Fetch older catalog
*/
- oldtup = SearchSysCache1(RELOID, ObjectIdGetDatum(relOid));
+ oldtup = SearchSysCache(RELOID, ObjectIdGetDatum(relOid));
if (!HeapTupleIsValid(oldtup))
elog(ERROR, "cache lookup failed for relation %u", relOid);
oldform = (Form_pg_class) GETSTRUCT(oldtup);
diff --git a/contrib/tcn/tcn.c b/contrib/tcn/tcn.c
index 546fbf2632..528445f2a0 100644
--- a/contrib/tcn/tcn.c
+++ b/contrib/tcn/tcn.c
@@ -131,7 +131,7 @@ triggered_change_notification(PG_FUNCTION_ARGS)
HeapTuple indexTuple;
Form_pg_index index;
- indexTuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexoid));
+ indexTuple = SearchSysCache(INDEXRELID, ObjectIdGetDatum(indexoid));
if (!HeapTupleIsValid(indexTuple)) /* should not happen */
elog(ERROR, "cache lookup failed for index %u", indexoid);
index = (Form_pg_index) GETSTRUCT(indexTuple);
diff --git a/contrib/unaccent/unaccent.c b/contrib/unaccent/unaccent.c
index 64c879e547..88897320d2 100644
--- a/contrib/unaccent/unaccent.c
+++ b/contrib/unaccent/unaccent.c
@@ -386,9 +386,9 @@ unaccent_dict(PG_FUNCTION_ARGS)
Oid procnspid = get_func_namespace(fcinfo->flinfo->fn_oid);
const char *dictname = "unaccent";
- dictOid = GetSysCacheOid2(TSDICTNAMENSP, Anum_pg_ts_dict_oid,
- PointerGetDatum(dictname),
- ObjectIdGetDatum(procnspid));
+ dictOid = GetSysCacheOid(TSDICTNAMENSP, Anum_pg_ts_dict_oid,
+ PointerGetDatum(dictname),
+ ObjectIdGetDatum(procnspid));
if (!OidIsValid(dictOid))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
diff --git a/src/backend/access/brin/brin_inclusion.c b/src/backend/access/brin/brin_inclusion.c
index 02f4d0ae76..2dc800f5e2 100644
--- a/src/backend/access/brin/brin_inclusion.c
+++ b/src/backend/access/brin/brin_inclusion.c
@@ -633,10 +633,10 @@ inclusion_get_strategy_procinfo(BrinDesc *bdesc, uint16 attno, Oid subtype,
opfamily = bdesc->bd_index->rd_opfamily[attno - 1];
attr = TupleDescAttr(bdesc->bd_tupdesc, attno - 1);
- tuple = SearchSysCache4(AMOPSTRATEGY, ObjectIdGetDatum(opfamily),
- ObjectIdGetDatum(attr->atttypid),
- ObjectIdGetDatum(subtype),
- Int16GetDatum(strategynum));
+ tuple = SearchSysCache(AMOPSTRATEGY, ObjectIdGetDatum(opfamily),
+ ObjectIdGetDatum(attr->atttypid),
+ ObjectIdGetDatum(subtype),
+ Int16GetDatum(strategynum));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "missing operator %d(%u,%u) in opfamily %u",
diff --git a/src/backend/access/brin/brin_minmax.c b/src/backend/access/brin/brin_minmax.c
index 8229493c84..0840a459d5 100644
--- a/src/backend/access/brin/brin_minmax.c
+++ b/src/backend/access/brin/brin_minmax.c
@@ -293,10 +293,10 @@ minmax_get_strategy_procinfo(BrinDesc *bdesc, uint16 attno, Oid subtype,
opfamily = bdesc->bd_index->rd_opfamily[attno - 1];
attr = TupleDescAttr(bdesc->bd_tupdesc, attno - 1);
- tuple = SearchSysCache4(AMOPSTRATEGY, ObjectIdGetDatum(opfamily),
- ObjectIdGetDatum(attr->atttypid),
- ObjectIdGetDatum(subtype),
- Int16GetDatum(strategynum));
+ tuple = SearchSysCache(AMOPSTRATEGY, ObjectIdGetDatum(opfamily),
+ ObjectIdGetDatum(attr->atttypid),
+ ObjectIdGetDatum(subtype),
+ Int16GetDatum(strategynum));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "missing operator %d(%u,%u) in opfamily %u",
diff --git a/src/backend/access/brin/brin_minmax_multi.c b/src/backend/access/brin/brin_minmax_multi.c
index 8e4e6c2fc8..8bf785c60b 100644
--- a/src/backend/access/brin/brin_minmax_multi.c
+++ b/src/backend/access/brin/brin_minmax_multi.c
@@ -2956,10 +2956,10 @@ minmax_multi_get_strategy_procinfo(BrinDesc *bdesc, uint16 attno, Oid subtype,
opfamily = bdesc->bd_index->rd_opfamily[attno - 1];
attr = TupleDescAttr(bdesc->bd_tupdesc, attno - 1);
- tuple = SearchSysCache4(AMOPSTRATEGY, ObjectIdGetDatum(opfamily),
- ObjectIdGetDatum(attr->atttypid),
- ObjectIdGetDatum(subtype),
- Int16GetDatum(strategynum));
+ tuple = SearchSysCache(AMOPSTRATEGY, ObjectIdGetDatum(opfamily),
+ ObjectIdGetDatum(attr->atttypid),
+ ObjectIdGetDatum(subtype),
+ Int16GetDatum(strategynum));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "missing operator %d(%u,%u) in opfamily %u",
strategynum, attr->atttypid, subtype, opfamily);
diff --git a/src/backend/access/brin/brin_validate.c b/src/backend/access/brin/brin_validate.c
index c8edfb3759..61c39e3472 100644
--- a/src/backend/access/brin/brin_validate.c
+++ b/src/backend/access/brin/brin_validate.c
@@ -55,7 +55,7 @@ brinvalidate(Oid opclassoid)
ListCell *lc;
/* Fetch opclass information */
- classtup = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclassoid));
+ classtup = SearchSysCache(CLAOID, ObjectIdGetDatum(opclassoid));
if (!HeapTupleIsValid(classtup))
elog(ERROR, "cache lookup failed for operator class %u", opclassoid);
classform = (Form_pg_opclass) GETSTRUCT(classtup);
@@ -65,7 +65,7 @@ brinvalidate(Oid opclassoid)
opclassname = NameStr(classform->opcname);
/* Fetch opfamily information */
- familytup = SearchSysCache1(OPFAMILYOID, ObjectIdGetDatum(opfamilyoid));
+ familytup = SearchSysCache(OPFAMILYOID, ObjectIdGetDatum(opfamilyoid));
if (!HeapTupleIsValid(familytup))
elog(ERROR, "cache lookup failed for operator family %u", opfamilyoid);
familyform = (Form_pg_opfamily) GETSTRUCT(familytup);
@@ -73,8 +73,8 @@ brinvalidate(Oid opclassoid)
opfamilyname = NameStr(familyform->opfname);
/* Fetch all operators and support functions of the opfamily */
- oprlist = SearchSysCacheList1(AMOPSTRATEGY, ObjectIdGetDatum(opfamilyoid));
- proclist = SearchSysCacheList1(AMPROCNUM, ObjectIdGetDatum(opfamilyoid));
+ oprlist = SearchSysCacheList(AMOPSTRATEGY, ObjectIdGetDatum(opfamilyoid));
+ proclist = SearchSysCacheList(AMPROCNUM, ObjectIdGetDatum(opfamilyoid));
/* Check individual support functions */
for (i = 0; i < proclist->n_members; i++)
diff --git a/src/backend/access/common/relation.c b/src/backend/access/common/relation.c
index 4017e175e3..2e34e14e02 100644
--- a/src/backend/access/common/relation.c
+++ b/src/backend/access/common/relation.c
@@ -100,7 +100,7 @@ try_relation_open(Oid relationId, LOCKMODE lockmode)
* Now that we have the lock, probe to see if the relation really exists
* or not.
*/
- if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(relationId)))
+ if (!SearchSysCacheExists(RELOID, ObjectIdGetDatum(relationId)))
{
/* Release useless lock */
if (lockmode != NoLock)
diff --git a/src/backend/access/common/tupdesc.c b/src/backend/access/common/tupdesc.c
index 7c5c390503..4445036074 100644
--- a/src/backend/access/common/tupdesc.c
+++ b/src/backend/access/common/tupdesc.c
@@ -634,7 +634,7 @@ TupleDescInitEntry(TupleDesc desc,
att->attinhcount = 0;
/* variable-length fields are not present in tupledescs */
- tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(oidtypeid));
+ tuple = SearchSysCache(TYPEOID, ObjectIdGetDatum(oidtypeid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for type %u", oidtypeid);
typeForm = (Form_pg_type) GETSTRUCT(tuple);
diff --git a/src/backend/access/gin/ginvalidate.c b/src/backend/access/gin/ginvalidate.c
index 33f43371f9..19c74cb748 100644
--- a/src/backend/access/gin/ginvalidate.c
+++ b/src/backend/access/gin/ginvalidate.c
@@ -50,7 +50,7 @@ ginvalidate(Oid opclassoid)
ListCell *lc;
/* Fetch opclass information */
- classtup = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclassoid));
+ classtup = SearchSysCache(CLAOID, ObjectIdGetDatum(opclassoid));
if (!HeapTupleIsValid(classtup))
elog(ERROR, "cache lookup failed for operator class %u", opclassoid);
classform = (Form_pg_opclass) GETSTRUCT(classtup);
@@ -63,7 +63,7 @@ ginvalidate(Oid opclassoid)
opclassname = NameStr(classform->opcname);
/* Fetch opfamily information */
- familytup = SearchSysCache1(OPFAMILYOID, ObjectIdGetDatum(opfamilyoid));
+ familytup = SearchSysCache(OPFAMILYOID, ObjectIdGetDatum(opfamilyoid));
if (!HeapTupleIsValid(familytup))
elog(ERROR, "cache lookup failed for operator family %u", opfamilyoid);
familyform = (Form_pg_opfamily) GETSTRUCT(familytup);
@@ -71,8 +71,8 @@ ginvalidate(Oid opclassoid)
opfamilyname = NameStr(familyform->opfname);
/* Fetch all operators and support functions of the opfamily */
- oprlist = SearchSysCacheList1(AMOPSTRATEGY, ObjectIdGetDatum(opfamilyoid));
- proclist = SearchSysCacheList1(AMPROCNUM, ObjectIdGetDatum(opfamilyoid));
+ oprlist = SearchSysCacheList(AMOPSTRATEGY, ObjectIdGetDatum(opfamilyoid));
+ proclist = SearchSysCacheList(AMPROCNUM, ObjectIdGetDatum(opfamilyoid));
/* Check individual support functions */
for (i = 0; i < proclist->n_members; i++)
diff --git a/src/backend/access/gist/gistutil.c b/src/backend/access/gist/gistutil.c
index b4d843a0ff..35f2e3aece 100644
--- a/src/backend/access/gist/gistutil.c
+++ b/src/backend/access/gist/gistutil.c
@@ -992,11 +992,11 @@ gistproperty(Oid index_oid, int attno,
/* And now we can check whether the function is provided. */
- *res = SearchSysCacheExists4(AMPROCNUM,
- ObjectIdGetDatum(opfamily),
- ObjectIdGetDatum(opcintype),
- ObjectIdGetDatum(opcintype),
- Int16GetDatum(procno));
+ *res = SearchSysCacheExists(AMPROCNUM,
+ ObjectIdGetDatum(opfamily),
+ ObjectIdGetDatum(opcintype),
+ ObjectIdGetDatum(opcintype),
+ Int16GetDatum(procno));
/*
* Special case: even without a fetch function, AMPROP_RETURNABLE is true
@@ -1004,11 +1004,11 @@ gistproperty(Oid index_oid, int attno,
*/
if (prop == AMPROP_RETURNABLE && !*res)
{
- *res = !SearchSysCacheExists4(AMPROCNUM,
- ObjectIdGetDatum(opfamily),
- ObjectIdGetDatum(opcintype),
- ObjectIdGetDatum(opcintype),
- Int16GetDatum(GIST_COMPRESS_PROC));
+ *res = !SearchSysCacheExists(AMPROCNUM,
+ ObjectIdGetDatum(opfamily),
+ ObjectIdGetDatum(opcintype),
+ ObjectIdGetDatum(opcintype),
+ Int16GetDatum(GIST_COMPRESS_PROC));
}
*isnull = false;
diff --git a/src/backend/access/gist/gistvalidate.c b/src/backend/access/gist/gistvalidate.c
index 4c711ecfa8..864cae0703 100644
--- a/src/backend/access/gist/gistvalidate.c
+++ b/src/backend/access/gist/gistvalidate.c
@@ -51,7 +51,7 @@ gistvalidate(Oid opclassoid)
ListCell *lc;
/* Fetch opclass information */
- classtup = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclassoid));
+ classtup = SearchSysCache(CLAOID, ObjectIdGetDatum(opclassoid));
if (!HeapTupleIsValid(classtup))
elog(ERROR, "cache lookup failed for operator class %u", opclassoid);
classform = (Form_pg_opclass) GETSTRUCT(classtup);
@@ -64,7 +64,7 @@ gistvalidate(Oid opclassoid)
opclassname = NameStr(classform->opcname);
/* Fetch opfamily information */
- familytup = SearchSysCache1(OPFAMILYOID, ObjectIdGetDatum(opfamilyoid));
+ familytup = SearchSysCache(OPFAMILYOID, ObjectIdGetDatum(opfamilyoid));
if (!HeapTupleIsValid(familytup))
elog(ERROR, "cache lookup failed for operator family %u", opfamilyoid);
familyform = (Form_pg_opfamily) GETSTRUCT(familytup);
@@ -72,8 +72,8 @@ gistvalidate(Oid opclassoid)
opfamilyname = NameStr(familyform->opfname);
/* Fetch all operators and support functions of the opfamily */
- oprlist = SearchSysCacheList1(AMOPSTRATEGY, ObjectIdGetDatum(opfamilyoid));
- proclist = SearchSysCacheList1(AMPROCNUM, ObjectIdGetDatum(opfamilyoid));
+ oprlist = SearchSysCacheList(AMOPSTRATEGY, ObjectIdGetDatum(opfamilyoid));
+ proclist = SearchSysCacheList(AMPROCNUM, ObjectIdGetDatum(opfamilyoid));
/* Check individual support functions */
for (i = 0; i < proclist->n_members; i++)
diff --git a/src/backend/access/hash/hashvalidate.c b/src/backend/access/hash/hashvalidate.c
index 24bab58499..4a7addb7e0 100644
--- a/src/backend/access/hash/hashvalidate.c
+++ b/src/backend/access/hash/hashvalidate.c
@@ -64,7 +64,7 @@ hashvalidate(Oid opclassoid)
ListCell *lc;
/* Fetch opclass information */
- classtup = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclassoid));
+ classtup = SearchSysCache(CLAOID, ObjectIdGetDatum(opclassoid));
if (!HeapTupleIsValid(classtup))
elog(ERROR, "cache lookup failed for operator class %u", opclassoid);
classform = (Form_pg_opclass) GETSTRUCT(classtup);
@@ -74,7 +74,7 @@ hashvalidate(Oid opclassoid)
opclassname = NameStr(classform->opcname);
/* Fetch opfamily information */
- familytup = SearchSysCache1(OPFAMILYOID, ObjectIdGetDatum(opfamilyoid));
+ familytup = SearchSysCache(OPFAMILYOID, ObjectIdGetDatum(opfamilyoid));
if (!HeapTupleIsValid(familytup))
elog(ERROR, "cache lookup failed for operator family %u", opfamilyoid);
familyform = (Form_pg_opfamily) GETSTRUCT(familytup);
@@ -82,8 +82,8 @@ hashvalidate(Oid opclassoid)
opfamilyname = NameStr(familyform->opfname);
/* Fetch all operators and support functions of the opfamily */
- oprlist = SearchSysCacheList1(AMOPSTRATEGY, ObjectIdGetDatum(opfamilyoid));
- proclist = SearchSysCacheList1(AMPROCNUM, ObjectIdGetDatum(opfamilyoid));
+ oprlist = SearchSysCacheList(AMOPSTRATEGY, ObjectIdGetDatum(opfamilyoid));
+ proclist = SearchSysCacheList(AMPROCNUM, ObjectIdGetDatum(opfamilyoid));
/* Check individual support functions */
for (i = 0; i < proclist->n_members; i++)
@@ -296,7 +296,7 @@ check_hash_func_signature(Oid funcid, int16 amprocnum, Oid argtype)
elog(ERROR, "invalid amprocnum");
}
- tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
+ tp = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for function %u", funcid);
procform = (Form_pg_proc) GETSTRUCT(tp);
diff --git a/src/backend/access/index/amapi.c b/src/backend/access/index/amapi.c
index 8b02cdbe82..3b4d850de6 100644
--- a/src/backend/access/index/amapi.c
+++ b/src/backend/access/index/amapi.c
@@ -60,7 +60,7 @@ GetIndexAmRoutineByAmId(Oid amoid, bool noerror)
regproc amhandler;
/* Get handler function OID for the access method */
- tuple = SearchSysCache1(AMOID, ObjectIdGetDatum(amoid));
+ tuple = SearchSysCache(AMOID, ObjectIdGetDatum(amoid));
if (!HeapTupleIsValid(tuple))
{
if (noerror)
@@ -120,7 +120,7 @@ amvalidate(PG_FUNCTION_ARGS)
Oid amoid;
IndexAmRoutine *amroutine;
- classtup = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclassoid));
+ classtup = SearchSysCache(CLAOID, ObjectIdGetDatum(opclassoid));
if (!HeapTupleIsValid(classtup))
elog(ERROR, "cache lookup failed for operator class %u", opclassoid);
classform = (Form_pg_opclass) GETSTRUCT(classtup);
diff --git a/src/backend/access/index/amvalidate.c b/src/backend/access/index/amvalidate.c
index 5c2d77e908..c541990639 100644
--- a/src/backend/access/index/amvalidate.c
+++ b/src/backend/access/index/amvalidate.c
@@ -158,7 +158,7 @@ check_amproc_signature(Oid funcid, Oid restype, bool exact,
va_list ap;
int i;
- tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
+ tp = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for function %u", funcid);
procform = (Form_pg_proc) GETSTRUCT(tp);
@@ -209,7 +209,7 @@ check_amop_signature(Oid opno, Oid restype, Oid lefttype, Oid righttype)
HeapTuple tp;
Form_pg_operator opform;
- tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
+ tp = SearchSysCache(OPEROID, ObjectIdGetDatum(opno));
if (!HeapTupleIsValid(tp)) /* shouldn't happen */
elog(ERROR, "cache lookup failed for operator %u", opno);
opform = (Form_pg_operator) GETSTRUCT(tp);
@@ -244,7 +244,7 @@ opclass_for_family_datatype(Oid amoid, Oid opfamilyoid, Oid datatypeoid)
* is a bit inefficient but there is no better index available. It also
* saves making an explicit check that the opfamily belongs to the AM.
*/
- opclist = SearchSysCacheList1(CLAAMNAMENSP, ObjectIdGetDatum(amoid));
+ opclist = SearchSysCacheList(CLAAMNAMENSP, ObjectIdGetDatum(amoid));
for (i = 0; i < opclist->n_members; i++)
{
diff --git a/src/backend/access/nbtree/nbtvalidate.c b/src/backend/access/nbtree/nbtvalidate.c
index de823ddfed..cab83e72a9 100644
--- a/src/backend/access/nbtree/nbtvalidate.c
+++ b/src/backend/access/nbtree/nbtvalidate.c
@@ -59,7 +59,7 @@ btvalidate(Oid opclassoid)
ListCell *lc;
/* Fetch opclass information */
- classtup = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclassoid));
+ classtup = SearchSysCache(CLAOID, ObjectIdGetDatum(opclassoid));
if (!HeapTupleIsValid(classtup))
elog(ERROR, "cache lookup failed for operator class %u", opclassoid);
classform = (Form_pg_opclass) GETSTRUCT(classtup);
@@ -69,7 +69,7 @@ btvalidate(Oid opclassoid)
opclassname = NameStr(classform->opcname);
/* Fetch opfamily information */
- familytup = SearchSysCache1(OPFAMILYOID, ObjectIdGetDatum(opfamilyoid));
+ familytup = SearchSysCache(OPFAMILYOID, ObjectIdGetDatum(opfamilyoid));
if (!HeapTupleIsValid(familytup))
elog(ERROR, "cache lookup failed for operator family %u", opfamilyoid);
familyform = (Form_pg_opfamily) GETSTRUCT(familytup);
@@ -77,8 +77,8 @@ btvalidate(Oid opclassoid)
opfamilyname = NameStr(familyform->opfname);
/* Fetch all operators and support functions of the opfamily */
- oprlist = SearchSysCacheList1(AMOPSTRATEGY, ObjectIdGetDatum(opfamilyoid));
- proclist = SearchSysCacheList1(AMPROCNUM, ObjectIdGetDatum(opfamilyoid));
+ oprlist = SearchSysCacheList(AMOPSTRATEGY, ObjectIdGetDatum(opfamilyoid));
+ proclist = SearchSysCacheList(AMPROCNUM, ObjectIdGetDatum(opfamilyoid));
/* Check individual support functions */
for (i = 0; i < proclist->n_members; i++)
diff --git a/src/backend/access/spgist/spgutils.c b/src/backend/access/spgist/spgutils.c
index 4e7ff1d160..c33857ac56 100644
--- a/src/backend/access/spgist/spgutils.c
+++ b/src/backend/access/spgist/spgutils.c
@@ -161,7 +161,7 @@ fillTypeDesc(SpGistTypeDesc *desc, Oid type)
Form_pg_type typtup;
desc->type = type;
- tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type));
+ tp = SearchSysCache(TYPEOID, ObjectIdGetDatum(type));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for type %u", type);
typtup = (Form_pg_type) GETSTRUCT(tp);
@@ -1321,8 +1321,8 @@ spgproperty(Oid index_oid, int attno,
}
/* And now we can check whether the operator is provided. */
- catlist = SearchSysCacheList1(AMOPSTRATEGY,
- ObjectIdGetDatum(opfamily));
+ catlist = SearchSysCacheList(AMOPSTRATEGY,
+ ObjectIdGetDatum(opfamily));
*res = false;
diff --git a/src/backend/access/spgist/spgvalidate.c b/src/backend/access/spgist/spgvalidate.c
index 1e763f9e28..9cac4729ef 100644
--- a/src/backend/access/spgist/spgvalidate.c
+++ b/src/backend/access/spgist/spgvalidate.c
@@ -61,7 +61,7 @@ spgvalidate(Oid opclassoid)
Oid configOutLeafType = InvalidOid;
/* Fetch opclass information */
- classtup = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclassoid));
+ classtup = SearchSysCache(CLAOID, ObjectIdGetDatum(opclassoid));
if (!HeapTupleIsValid(classtup))
elog(ERROR, "cache lookup failed for operator class %u", opclassoid);
classform = (Form_pg_opclass) GETSTRUCT(classtup);
@@ -72,7 +72,7 @@ spgvalidate(Oid opclassoid)
opclassname = NameStr(classform->opcname);
/* Fetch opfamily information */
- familytup = SearchSysCache1(OPFAMILYOID, ObjectIdGetDatum(opfamilyoid));
+ familytup = SearchSysCache(OPFAMILYOID, ObjectIdGetDatum(opfamilyoid));
if (!HeapTupleIsValid(familytup))
elog(ERROR, "cache lookup failed for operator family %u", opfamilyoid);
familyform = (Form_pg_opfamily) GETSTRUCT(familytup);
@@ -80,8 +80,8 @@ spgvalidate(Oid opclassoid)
opfamilyname = NameStr(familyform->opfname);
/* Fetch all operators and support functions of the opfamily */
- oprlist = SearchSysCacheList1(AMOPSTRATEGY, ObjectIdGetDatum(opfamilyoid));
- proclist = SearchSysCacheList1(AMPROCNUM, ObjectIdGetDatum(opfamilyoid));
+ oprlist = SearchSysCacheList(AMOPSTRATEGY, ObjectIdGetDatum(opfamilyoid));
+ proclist = SearchSysCacheList(AMPROCNUM, ObjectIdGetDatum(opfamilyoid));
grouplist = identify_opfamily_groups(oprlist, proclist);
/* Check individual support functions */
diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c
index 334adac09e..eafb27040e 100644
--- a/src/backend/access/transam/varsup.c
+++ b/src/backend/access/transam/varsup.c
@@ -508,7 +508,7 @@ ForceTransactionIdLimitUpdate(void)
return true; /* this shouldn't happen anymore either */
if (TransactionIdFollowsOrEquals(nextXid, xidVacLimit))
return true; /* past xidVacLimit, don't delay updating */
- if (!SearchSysCacheExists1(DATABASEOID, ObjectIdGetDatum(oldestXidDB)))
+ if (!SearchSysCacheExists(DATABASEOID, ObjectIdGetDatum(oldestXidDB)))
return true; /* could happen, per comments above */
return false;
}
diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c
index 45cdcd3dc6..34295423f5 100644
--- a/src/backend/catalog/aclchk.c
+++ b/src/backend/catalog/aclchk.c
@@ -1267,10 +1267,10 @@ SetDefaultACL(InternalDefaultACL *iacls)
}
/* Search for existing row for this object type in catalog */
- tuple = SearchSysCache3(DEFACLROLENSPOBJ,
- ObjectIdGetDatum(iacls->roleid),
- ObjectIdGetDatum(iacls->nspid),
- CharGetDatum(objtype));
+ tuple = SearchSysCache(DEFACLROLENSPOBJ,
+ ObjectIdGetDatum(iacls->roleid),
+ ObjectIdGetDatum(iacls->nspid),
+ CharGetDatum(objtype));
if (HeapTupleIsValid(tuple))
{
@@ -1631,9 +1631,9 @@ expand_all_col_privileges(Oid table_oid, Form_pg_class classForm,
if (classForm->relkind == RELKIND_VIEW && curr_att < 0)
continue;
- attTuple = SearchSysCache2(ATTNUM,
- ObjectIdGetDatum(table_oid),
- Int16GetDatum(curr_att));
+ attTuple = SearchSysCache(ATTNUM,
+ ObjectIdGetDatum(table_oid),
+ Int16GetDatum(curr_att));
if (!HeapTupleIsValid(attTuple))
elog(ERROR, "cache lookup failed for attribute %d of relation %u",
curr_att, table_oid);
@@ -1678,9 +1678,9 @@ ExecGrant_Attribute(InternalGrant *istmt, Oid relOid, const char *relname,
Oid *oldmembers;
Oid *newmembers;
- attr_tuple = SearchSysCache2(ATTNUM,
- ObjectIdGetDatum(relOid),
- Int16GetDatum(attnum));
+ attr_tuple = SearchSysCache(ATTNUM,
+ ObjectIdGetDatum(relOid),
+ Int16GetDatum(attnum));
if (!HeapTupleIsValid(attr_tuple))
elog(ERROR, "cache lookup failed for attribute %d of relation %u",
attnum, relOid);
@@ -1827,7 +1827,7 @@ ExecGrant_Relation(InternalGrant *istmt)
HeapTuple tuple;
ListCell *cell_colprivs;
- tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relOid));
+ tuple = SearchSysCache(RELOID, ObjectIdGetDatum(relOid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", relOid);
pg_class_tuple = (Form_pg_class) GETSTRUCT(tuple);
@@ -2164,7 +2164,7 @@ ExecGrant_common(InternalGrant *istmt, Oid classid, AclMode default_privs,
Oid *oldmembers;
Oid *newmembers;
- tuple = SearchSysCache1(cacheid, ObjectIdGetDatum(objectid));
+ tuple = SearchSysCache(cacheid, ObjectIdGetDatum(objectid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for %s %u", get_object_class_descr(classid), objectid);
@@ -2466,7 +2466,7 @@ ExecGrant_Parameter(InternalGrant *istmt)
Oid *oldmembers;
Oid *newmembers;
- tuple = SearchSysCache1(PARAMETERACLOID, ObjectIdGetDatum(parameterId));
+ tuple = SearchSysCache(PARAMETERACLOID, ObjectIdGetDatum(parameterId));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for parameter ACL %u",
parameterId);
@@ -3101,7 +3101,7 @@ object_aclmask(Oid classid, Oid objectid, Oid roleid,
cacheid = get_object_catcache_oid(classid);
- tuple = SearchSysCache1(cacheid, ObjectIdGetDatum(objectid));
+ tuple = SearchSysCache(cacheid, ObjectIdGetDatum(objectid));
if (!HeapTupleIsValid(tuple))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_DATABASE),
@@ -3175,9 +3175,9 @@ pg_attribute_aclmask_ext(Oid table_oid, AttrNumber attnum, Oid roleid,
/*
* First, get the column's ACL from its pg_attribute entry
*/
- attTuple = SearchSysCache2(ATTNUM,
- ObjectIdGetDatum(table_oid),
- Int16GetDatum(attnum));
+ attTuple = SearchSysCache(ATTNUM,
+ ObjectIdGetDatum(table_oid),
+ Int16GetDatum(attnum));
if (!HeapTupleIsValid(attTuple))
{
if (is_missing != NULL)
@@ -3234,7 +3234,7 @@ pg_attribute_aclmask_ext(Oid table_oid, AttrNumber attnum, Oid roleid,
* privileges" rather than failing in such a case, so as to avoid unwanted
* failures in has_column_privilege() tests.
*/
- classTuple = SearchSysCache1(RELOID, ObjectIdGetDatum(table_oid));
+ classTuple = SearchSysCache(RELOID, ObjectIdGetDatum(table_oid));
if (!HeapTupleIsValid(classTuple))
{
ReleaseSysCache(attTuple);
@@ -3291,7 +3291,7 @@ pg_class_aclmask_ext(Oid table_oid, Oid roleid, AclMode mask,
/*
* Must get the relation's tuple from pg_class
*/
- tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(table_oid));
+ tuple = SearchSysCache(RELOID, ObjectIdGetDatum(table_oid));
if (!HeapTupleIsValid(tuple))
{
if (is_missing != NULL)
@@ -3423,7 +3423,7 @@ pg_parameter_aclmask(const char *name, Oid roleid, AclMode mask, AclMaskHow how)
partext = cstring_to_text(parname);
/* ... and look it up */
- tuple = SearchSysCache1(PARAMETERACLNAME, PointerGetDatum(partext));
+ tuple = SearchSysCache(PARAMETERACLNAME, PointerGetDatum(partext));
if (!HeapTupleIsValid(tuple))
{
@@ -3484,7 +3484,7 @@ pg_parameter_acl_aclmask(Oid acl_oid, Oid roleid, AclMode mask, AclMaskHow how)
return mask;
/* Get the ACL from pg_parameter_acl */
- tuple = SearchSysCache1(PARAMETERACLOID, ObjectIdGetDatum(acl_oid));
+ tuple = SearchSysCache(PARAMETERACLOID, ObjectIdGetDatum(acl_oid));
if (!HeapTupleIsValid(tuple))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -3648,7 +3648,7 @@ pg_namespace_aclmask(Oid nsp_oid, Oid roleid,
/*
* Get the schema's ACL from pg_namespace
*/
- tuple = SearchSysCache1(NAMESPACEOID, ObjectIdGetDatum(nsp_oid));
+ tuple = SearchSysCache(NAMESPACEOID, ObjectIdGetDatum(nsp_oid));
if (!HeapTupleIsValid(tuple))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_SCHEMA),
@@ -3713,7 +3713,7 @@ pg_type_aclmask(Oid type_oid, Oid roleid, AclMode mask, AclMaskHow how)
/*
* Must get the type's tuple from pg_type
*/
- tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type_oid));
+ tuple = SearchSysCache(TYPEOID, ObjectIdGetDatum(type_oid));
if (!HeapTupleIsValid(tuple))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -3731,7 +3731,7 @@ pg_type_aclmask(Oid type_oid, Oid roleid, AclMode mask, AclMaskHow how)
ReleaseSysCache(tuple);
- tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(elttype_oid));
+ tuple = SearchSysCache(TYPEOID, ObjectIdGetDatum(elttype_oid));
/* this case is not a user-facing error, so elog not ereport */
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for type %u", elttype_oid);
@@ -3849,7 +3849,7 @@ pg_attribute_aclcheck_all(Oid table_oid, Oid roleid, AclMode mode,
* pg_attribute_aclmask, we prefer to return "no privileges" instead of
* throwing an error if we get any unexpected lookup errors.
*/
- classTuple = SearchSysCache1(RELOID, ObjectIdGetDatum(table_oid));
+ classTuple = SearchSysCache(RELOID, ObjectIdGetDatum(table_oid));
if (!HeapTupleIsValid(classTuple))
return ACLCHECK_NO_PRIV;
classForm = (Form_pg_class) GETSTRUCT(classTuple);
@@ -3869,9 +3869,9 @@ pg_attribute_aclcheck_all(Oid table_oid, Oid roleid, AclMode mode,
HeapTuple attTuple;
AclMode attmask;
- attTuple = SearchSysCache2(ATTNUM,
- ObjectIdGetDatum(table_oid),
- Int16GetDatum(curr_att));
+ attTuple = SearchSysCache(ATTNUM,
+ ObjectIdGetDatum(table_oid),
+ Int16GetDatum(curr_att));
if (!HeapTupleIsValid(attTuple))
continue;
@@ -3987,7 +3987,7 @@ object_ownercheck(Oid classid, Oid objectid, Oid roleid)
{
HeapTuple tuple;
- tuple = SearchSysCache1(cacheid, ObjectIdGetDatum(objectid));
+ tuple = SearchSysCache(cacheid, ObjectIdGetDatum(objectid));
if (!HeapTupleIsValid(tuple))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -4059,7 +4059,7 @@ has_createrole_privilege(Oid roleid)
if (superuser_arg(roleid))
return true;
- utup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid));
+ utup = SearchSysCache(AUTHOID, ObjectIdGetDatum(roleid));
if (HeapTupleIsValid(utup))
{
result = ((Form_pg_authid) GETSTRUCT(utup))->rolcreaterole;
@@ -4078,7 +4078,7 @@ has_bypassrls_privilege(Oid roleid)
if (superuser_arg(roleid))
return true;
- utup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid));
+ utup = SearchSysCache(AUTHOID, ObjectIdGetDatum(roleid));
if (HeapTupleIsValid(utup))
{
result = ((Form_pg_authid) GETSTRUCT(utup))->rolbypassrls;
@@ -4098,10 +4098,10 @@ get_default_acl_internal(Oid roleId, Oid nsp_oid, char objtype)
Acl *result = NULL;
HeapTuple tuple;
- tuple = SearchSysCache3(DEFACLROLENSPOBJ,
- ObjectIdGetDatum(roleId),
- ObjectIdGetDatum(nsp_oid),
- CharGetDatum(objtype));
+ tuple = SearchSysCache(DEFACLROLENSPOBJ,
+ ObjectIdGetDatum(roleId),
+ ObjectIdGetDatum(nsp_oid),
+ CharGetDatum(objtype));
if (HeapTupleIsValid(tuple))
{
@@ -4247,7 +4247,7 @@ recordExtObjInitPriv(Oid objoid, Oid classoid)
bool isNull;
HeapTuple tuple;
- tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(objoid));
+ tuple = SearchSysCache(RELOID, ObjectIdGetDatum(objoid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", objoid);
pg_class_tuple = (Form_pg_class) GETSTRUCT(tuple);
@@ -4279,9 +4279,9 @@ recordExtObjInitPriv(Oid objoid, Oid classoid)
HeapTuple attTuple;
Datum attaclDatum;
- attTuple = SearchSysCache2(ATTNUM,
- ObjectIdGetDatum(objoid),
- Int16GetDatum(curr_att));
+ attTuple = SearchSysCache(ATTNUM,
+ ObjectIdGetDatum(objoid),
+ Int16GetDatum(curr_att));
if (!HeapTupleIsValid(attTuple))
continue;
@@ -4370,8 +4370,8 @@ recordExtObjInitPriv(Oid objoid, Oid classoid)
bool isNull;
HeapTuple tuple;
- tuple = SearchSysCache1(get_object_catcache_oid(classoid),
- ObjectIdGetDatum(objoid));
+ tuple = SearchSysCache(get_object_catcache_oid(classoid),
+ ObjectIdGetDatum(objoid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for %s %u",
get_object_class_descr(classoid), objoid);
@@ -4406,7 +4406,7 @@ removeExtObjInitPriv(Oid objoid, Oid classoid)
Form_pg_class pg_class_tuple;
HeapTuple tuple;
- tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(objoid));
+ tuple = SearchSysCache(RELOID, ObjectIdGetDatum(objoid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", objoid);
pg_class_tuple = (Form_pg_class) GETSTRUCT(tuple);
@@ -4437,9 +4437,9 @@ removeExtObjInitPriv(Oid objoid, Oid classoid)
{
HeapTuple attTuple;
- attTuple = SearchSysCache2(ATTNUM,
- ObjectIdGetDatum(objoid),
- Int16GetDatum(curr_att));
+ attTuple = SearchSysCache(ATTNUM,
+ ObjectIdGetDatum(objoid),
+ Int16GetDatum(curr_att));
if (!HeapTupleIsValid(attTuple))
continue;
diff --git a/src/backend/catalog/dependency.c b/src/backend/catalog/dependency.c
index f8a136ba0a..ca0c482bc8 100644
--- a/src/backend/catalog/dependency.c
+++ b/src/backend/catalog/dependency.c
@@ -1250,7 +1250,7 @@ DropObjectById(const ObjectAddress *object)
*/
if (cacheId >= 0)
{
- tup = SearchSysCache1(cacheId, ObjectIdGetDatum(object->objectId));
+ tup = SearchSysCache(cacheId, ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for %s %u",
get_object_class_descr(object->classId), object->objectId);
@@ -1832,59 +1832,59 @@ find_expr_references_walker(Node *node,
case REGPROCOID:
case REGPROCEDUREOID:
objoid = DatumGetObjectId(con->constvalue);
- if (SearchSysCacheExists1(PROCOID,
- ObjectIdGetDatum(objoid)))
+ if (SearchSysCacheExists(PROCOID,
+ ObjectIdGetDatum(objoid)))
add_object_address(OCLASS_PROC, objoid, 0,
context->addrs);
break;
case REGOPEROID:
case REGOPERATOROID:
objoid = DatumGetObjectId(con->constvalue);
- if (SearchSysCacheExists1(OPEROID,
- ObjectIdGetDatum(objoid)))
+ if (SearchSysCacheExists(OPEROID,
+ ObjectIdGetDatum(objoid)))
add_object_address(OCLASS_OPERATOR, objoid, 0,
context->addrs);
break;
case REGCLASSOID:
objoid = DatumGetObjectId(con->constvalue);
- if (SearchSysCacheExists1(RELOID,
- ObjectIdGetDatum(objoid)))
+ if (SearchSysCacheExists(RELOID,
+ ObjectIdGetDatum(objoid)))
add_object_address(OCLASS_CLASS, objoid, 0,
context->addrs);
break;
case REGTYPEOID:
objoid = DatumGetObjectId(con->constvalue);
- if (SearchSysCacheExists1(TYPEOID,
- ObjectIdGetDatum(objoid)))
+ if (SearchSysCacheExists(TYPEOID,
+ ObjectIdGetDatum(objoid)))
add_object_address(OCLASS_TYPE, objoid, 0,
context->addrs);
break;
case REGCOLLATIONOID:
objoid = DatumGetObjectId(con->constvalue);
- if (SearchSysCacheExists1(COLLOID,
- ObjectIdGetDatum(objoid)))
+ if (SearchSysCacheExists(COLLOID,
+ ObjectIdGetDatum(objoid)))
add_object_address(OCLASS_COLLATION, objoid, 0,
context->addrs);
break;
case REGCONFIGOID:
objoid = DatumGetObjectId(con->constvalue);
- if (SearchSysCacheExists1(TSCONFIGOID,
- ObjectIdGetDatum(objoid)))
+ if (SearchSysCacheExists(TSCONFIGOID,
+ ObjectIdGetDatum(objoid)))
add_object_address(OCLASS_TSCONFIG, objoid, 0,
context->addrs);
break;
case REGDICTIONARYOID:
objoid = DatumGetObjectId(con->constvalue);
- if (SearchSysCacheExists1(TSDICTOID,
- ObjectIdGetDatum(objoid)))
+ if (SearchSysCacheExists(TSDICTOID,
+ ObjectIdGetDatum(objoid)))
add_object_address(OCLASS_TSDICT, objoid, 0,
context->addrs);
break;
case REGNAMESPACEOID:
objoid = DatumGetObjectId(con->constvalue);
- if (SearchSysCacheExists1(NAMESPACEOID,
- ObjectIdGetDatum(objoid)))
+ if (SearchSysCacheExists(NAMESPACEOID,
+ ObjectIdGetDatum(objoid)))
add_object_address(OCLASS_SCHEMA, objoid, 0,
context->addrs);
break;
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index 2a0d82aedd..8ffa361339 100644
--- a/src/backend/catalog/heap.c
+++ b/src/backend/catalog/heap.c
@@ -1153,9 +1153,9 @@ heap_create_with_catalog(const char *relname,
* autogenerated array, we can rename it out of the way; otherwise we can
* at least give a good error message.
*/
- old_type_oid = GetSysCacheOid2(TYPENAMENSP, Anum_pg_type_oid,
- CStringGetDatum(relname),
- ObjectIdGetDatum(relnamespace));
+ old_type_oid = GetSysCacheOid(TYPENAMENSP, Anum_pg_type_oid,
+ CStringGetDatum(relname),
+ ObjectIdGetDatum(relnamespace));
if (OidIsValid(old_type_oid))
{
if (!moveArrayTypeName(old_type_oid, relname, relnamespace))
@@ -1541,7 +1541,7 @@ DeleteRelationTuple(Oid relid)
/* Grab an appropriate lock on the pg_class relation */
pg_class_desc = table_open(RelationRelationId, RowExclusiveLock);
- tup = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
+ tup = SearchSysCache(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for relation %u", relid);
@@ -1658,9 +1658,9 @@ RemoveAttributeById(Oid relid, AttrNumber attnum)
attr_rel = table_open(AttributeRelationId, RowExclusiveLock);
- tuple = SearchSysCacheCopy2(ATTNUM,
- ObjectIdGetDatum(relid),
- Int16GetDatum(attnum));
+ tuple = SearchSysCacheCopy(ATTNUM,
+ ObjectIdGetDatum(relid),
+ Int16GetDatum(attnum));
if (!HeapTupleIsValid(tuple)) /* shouldn't happen */
elog(ERROR, "cache lookup failed for attribute %d of relation %u",
attnum, relid);
@@ -1769,7 +1769,7 @@ heap_drop_with_catalog(Oid relid)
* shared-cache-inval notice that will make them update their partition
* descriptors.
*/
- tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
+ tuple = SearchSysCache(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", relid);
if (((Form_pg_class) GETSTRUCT(tuple))->relispartition)
@@ -1823,7 +1823,7 @@ heap_drop_with_catalog(Oid relid)
ftrel = table_open(ForeignTableRelationId, RowExclusiveLock);
- fttuple = SearchSysCache1(FOREIGNTABLEREL, ObjectIdGetDatum(relid));
+ fttuple = SearchSysCache(FOREIGNTABLEREL, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(fttuple))
elog(ERROR, "cache lookup failed for foreign table %u", relid);
@@ -1962,9 +1962,9 @@ RelationClearMissing(Relation rel)
/* process each non-system attribute, including any dropped columns */
for (attnum = 1; attnum <= natts; attnum++)
{
- tuple = SearchSysCache2(ATTNUM,
- ObjectIdGetDatum(relid),
- Int16GetDatum(attnum));
+ tuple = SearchSysCache(ATTNUM,
+ ObjectIdGetDatum(relid),
+ Int16GetDatum(attnum));
if (!HeapTupleIsValid(tuple)) /* shouldn't happen */
elog(ERROR, "cache lookup failed for attribute %d of relation %u",
attnum, relid);
@@ -2655,8 +2655,8 @@ SetRelationNumChecks(Relation rel, int numchecks)
Form_pg_class relStruct;
relrel = table_open(RelationRelationId, RowExclusiveLock);
- reltup = SearchSysCacheCopy1(RELOID,
- ObjectIdGetDatum(RelationGetRelid(rel)));
+ reltup = SearchSysCacheCopy(RELOID,
+ ObjectIdGetDatum(RelationGetRelid(rel)));
if (!HeapTupleIsValid(reltup))
elog(ERROR, "cache lookup failed for relation %u",
RelationGetRelid(rel));
@@ -3442,7 +3442,7 @@ RemovePartitionKeyByRelId(Oid relid)
rel = table_open(PartitionedRelationId, RowExclusiveLock);
- tuple = SearchSysCache1(PARTRELID, ObjectIdGetDatum(relid));
+ tuple = SearchSysCache(PARTRELID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for partition key of relation %u",
relid);
@@ -3478,8 +3478,8 @@ StorePartitionBound(Relation rel, Relation parent, PartitionBoundSpec *bound)
/* Update pg_class tuple */
classRel = table_open(RelationRelationId, RowExclusiveLock);
- tuple = SearchSysCacheCopy1(RELOID,
- ObjectIdGetDatum(RelationGetRelid(rel)));
+ tuple = SearchSysCacheCopy(RELOID,
+ ObjectIdGetDatum(RelationGetRelid(rel)));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u",
RelationGetRelid(rel));
diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c
index 6aec1b1bca..df7cafbbb4 100644
--- a/src/backend/catalog/index.c
+++ b/src/backend/catalog/index.c
@@ -167,7 +167,7 @@ relationHasPrimaryKey(Relation rel)
Oid indexoid = lfirst_oid(indexoidscan);
HeapTuple indexTuple;
- indexTuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexoid));
+ indexTuple = SearchSysCache(INDEXRELID, ObjectIdGetDatum(indexoid));
if (!HeapTupleIsValid(indexTuple)) /* should not happen */
elog(ERROR, "cache lookup failed for index %u", indexoid);
result = ((Form_pg_index) GETSTRUCT(indexTuple))->indisprimary;
@@ -258,9 +258,9 @@ index_check_primary_key(Relation heapRel,
if (attnum < 0)
continue;
- atttuple = SearchSysCache2(ATTNUM,
- ObjectIdGetDatum(RelationGetRelid(heapRel)),
- Int16GetDatum(attnum));
+ atttuple = SearchSysCache(ATTNUM,
+ ObjectIdGetDatum(RelationGetRelid(heapRel)),
+ Int16GetDatum(attnum));
if (!HeapTupleIsValid(atttuple))
elog(ERROR, "cache lookup failed for attribute %d of relation %u",
attnum, RelationGetRelid(heapRel));
@@ -379,7 +379,7 @@ ConstructTupleDescriptor(Relation heapRelation,
* Lookup the expression type in pg_type for the type length etc.
*/
keyType = exprType(indexkey);
- tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(keyType));
+ tuple = SearchSysCache(TYPEOID, ObjectIdGetDatum(keyType));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for type %u", keyType);
typeTup = (Form_pg_type) GETSTRUCT(tuple);
@@ -435,7 +435,7 @@ ConstructTupleDescriptor(Relation heapRelation,
if (i < indexInfo->ii_NumIndexKeyAttrs)
{
- tuple = SearchSysCache1(CLAOID, ObjectIdGetDatum(classObjectId[i]));
+ tuple = SearchSysCache(CLAOID, ObjectIdGetDatum(classObjectId[i]));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for opclass %u",
classObjectId[i]);
@@ -469,7 +469,7 @@ ConstructTupleDescriptor(Relation heapRelation,
*/
if (OidIsValid(keyType) && keyType != to->atttypid)
{
- tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(keyType));
+ tuple = SearchSysCache(TYPEOID, ObjectIdGetDatum(keyType));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for type %u", keyType);
typeTup = (Form_pg_type) GETSTRUCT(tuple);
@@ -817,7 +817,7 @@ index_create(Relation heapRelation,
{
HeapTuple classtup;
- classtup = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclass));
+ classtup = SearchSysCache(CLAOID, ObjectIdGetDatum(opclass));
if (!HeapTupleIsValid(classtup))
elog(ERROR, "cache lookup failed for operator class %u", opclass);
ereport(ERROR,
@@ -1317,7 +1317,7 @@ index_concurrently_create_copy(Relation heapRelation, Oid oldIndexId,
errmsg("concurrent index creation for exclusion constraints is not supported")));
/* Get the array of class and column options IDs from index info */
- indexTuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(oldIndexId));
+ indexTuple = SearchSysCache(INDEXRELID, ObjectIdGetDatum(oldIndexId));
if (!HeapTupleIsValid(indexTuple))
elog(ERROR, "cache lookup failed for index %u", oldIndexId);
indclassDatum = SysCacheGetAttrNotNull(INDEXRELID, indexTuple,
@@ -1329,7 +1329,7 @@ index_concurrently_create_copy(Relation heapRelation, Oid oldIndexId,
indcoloptions = (int2vector *) DatumGetPointer(colOptionDatum);
/* Fetch options of index if any */
- classTuple = SearchSysCache1(RELOID, oldIndexId);
+ classTuple = SearchSysCache(RELOID, oldIndexId);
if (!HeapTupleIsValid(classTuple))
elog(ERROR, "cache lookup failed for relation %u", oldIndexId);
optionDatum = SysCacheGetAttr(RELOID, classTuple,
@@ -1546,12 +1546,12 @@ index_concurrently_swap(Oid newIndexId, Oid oldIndexId, const char *oldName)
/* Now swap names and dependencies of those indexes */
pg_class = table_open(RelationRelationId, RowExclusiveLock);
- oldClassTuple = SearchSysCacheCopy1(RELOID,
- ObjectIdGetDatum(oldIndexId));
+ oldClassTuple = SearchSysCacheCopy(RELOID,
+ ObjectIdGetDatum(oldIndexId));
if (!HeapTupleIsValid(oldClassTuple))
elog(ERROR, "could not find tuple for relation %u", oldIndexId);
- newClassTuple = SearchSysCacheCopy1(RELOID,
- ObjectIdGetDatum(newIndexId));
+ newClassTuple = SearchSysCacheCopy(RELOID,
+ ObjectIdGetDatum(newIndexId));
if (!HeapTupleIsValid(newClassTuple))
elog(ERROR, "could not find tuple for relation %u", newIndexId);
@@ -1576,12 +1576,12 @@ index_concurrently_swap(Oid newIndexId, Oid oldIndexId, const char *oldName)
/* Now swap index info */
pg_index = table_open(IndexRelationId, RowExclusiveLock);
- oldIndexTuple = SearchSysCacheCopy1(INDEXRELID,
- ObjectIdGetDatum(oldIndexId));
+ oldIndexTuple = SearchSysCacheCopy(INDEXRELID,
+ ObjectIdGetDatum(oldIndexId));
if (!HeapTupleIsValid(oldIndexTuple))
elog(ERROR, "could not find tuple for relation %u", oldIndexId);
- newIndexTuple = SearchSysCacheCopy1(INDEXRELID,
- ObjectIdGetDatum(newIndexId));
+ newIndexTuple = SearchSysCacheCopy(INDEXRELID,
+ ObjectIdGetDatum(newIndexId));
if (!HeapTupleIsValid(newIndexTuple))
elog(ERROR, "could not find tuple for relation %u", newIndexId);
@@ -1644,8 +1644,8 @@ index_concurrently_swap(Oid newIndexId, Oid oldIndexId, const char *oldName)
Oid constraintOid = lfirst_oid(lc);
/* Move the constraint from the old to the new index */
- constraintTuple = SearchSysCacheCopy1(CONSTROID,
- ObjectIdGetDatum(constraintOid));
+ constraintTuple = SearchSysCacheCopy(CONSTROID,
+ ObjectIdGetDatum(constraintOid));
if (!HeapTupleIsValid(constraintTuple))
elog(ERROR, "could not find tuple for constraint %u", constraintOid);
@@ -2082,8 +2082,8 @@ index_constraint_create(Relation heapRelation,
pg_index = table_open(IndexRelationId, RowExclusiveLock);
- indexTuple = SearchSysCacheCopy1(INDEXRELID,
- ObjectIdGetDatum(indexRelationId));
+ indexTuple = SearchSysCacheCopy(INDEXRELID,
+ ObjectIdGetDatum(indexRelationId));
if (!HeapTupleIsValid(indexTuple))
elog(ERROR, "cache lookup failed for index %u", indexRelationId);
indexForm = (Form_pg_index) GETSTRUCT(indexTuple);
@@ -2352,7 +2352,7 @@ index_drop(Oid indexId, bool concurrent, bool concurrent_lock_mode)
*/
indexRelation = table_open(IndexRelationId, RowExclusiveLock);
- tuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexId));
+ tuple = SearchSysCache(INDEXRELID, ObjectIdGetDatum(indexId));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for index %u", indexId);
@@ -2862,7 +2862,7 @@ index_update_stats(Relation rel,
else
{
/* normal case, use syscache */
- tuple = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relid));
+ tuple = SearchSysCacheCopy(RELOID, ObjectIdGetDatum(relid));
}
if (!HeapTupleIsValid(tuple))
@@ -3087,8 +3087,8 @@ index_build(Relation heapRelation,
pg_index = table_open(IndexRelationId, RowExclusiveLock);
- indexTuple = SearchSysCacheCopy1(INDEXRELID,
- ObjectIdGetDatum(indexId));
+ indexTuple = SearchSysCacheCopy(INDEXRELID,
+ ObjectIdGetDatum(indexId));
if (!HeapTupleIsValid(indexTuple))
elog(ERROR, "cache lookup failed for index %u", indexId);
indexForm = (Form_pg_index) GETSTRUCT(indexTuple);
@@ -3459,8 +3459,8 @@ index_set_state_flags(Oid indexId, IndexStateFlagsAction action)
/* Open pg_index and fetch a writable copy of the index's tuple */
pg_index = table_open(IndexRelationId, RowExclusiveLock);
- indexTuple = SearchSysCacheCopy1(INDEXRELID,
- ObjectIdGetDatum(indexId));
+ indexTuple = SearchSysCacheCopy(INDEXRELID,
+ ObjectIdGetDatum(indexId));
if (!HeapTupleIsValid(indexTuple))
elog(ERROR, "cache lookup failed for index %u", indexId);
indexForm = (Form_pg_index) GETSTRUCT(indexTuple);
@@ -3536,7 +3536,7 @@ IndexGetRelation(Oid indexId, bool missing_ok)
Form_pg_index index;
Oid result;
- tuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexId));
+ tuple = SearchSysCache(INDEXRELID, ObjectIdGetDatum(indexId));
if (!HeapTupleIsValid(tuple))
{
if (missing_ok)
@@ -3776,8 +3776,8 @@ reindex_index(Oid indexId, bool skip_constraint_checks, char persistence,
pg_index = table_open(IndexRelationId, RowExclusiveLock);
- indexTuple = SearchSysCacheCopy1(INDEXRELID,
- ObjectIdGetDatum(indexId));
+ indexTuple = SearchSysCacheCopy(INDEXRELID,
+ ObjectIdGetDatum(indexId));
if (!HeapTupleIsValid(indexTuple))
elog(ERROR, "cache lookup failed for index %u", indexId);
indexForm = (Form_pg_index) GETSTRUCT(indexTuple);
diff --git a/src/backend/catalog/namespace.c b/src/backend/catalog/namespace.c
index 14e57adee2..a3a74d6927 100644
--- a/src/backend/catalog/namespace.c
+++ b/src/backend/catalog/namespace.c
@@ -715,7 +715,7 @@ RelationIsVisible(Oid relid)
Oid relnamespace;
bool visible;
- reltup = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
+ reltup = SearchSysCache(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(reltup))
elog(ERROR, "cache lookup failed for relation %u", relid);
relform = (Form_pg_class) GETSTRUCT(reltup);
@@ -798,9 +798,9 @@ TypenameGetTypidExtended(const char *typname, bool temp_ok)
if (!temp_ok && namespaceId == myTempNamespace)
continue; /* do not look in temp namespace */
- typid = GetSysCacheOid2(TYPENAMENSP, Anum_pg_type_oid,
- PointerGetDatum(typname),
- ObjectIdGetDatum(namespaceId));
+ typid = GetSysCacheOid(TYPENAMENSP, Anum_pg_type_oid,
+ PointerGetDatum(typname),
+ ObjectIdGetDatum(namespaceId));
if (OidIsValid(typid))
return typid;
}
@@ -823,7 +823,7 @@ TypeIsVisible(Oid typid)
Oid typnamespace;
bool visible;
- typtup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
+ typtup = SearchSysCache(TYPEOID, ObjectIdGetDatum(typid));
if (!HeapTupleIsValid(typtup))
elog(ERROR, "cache lookup failed for type %u", typid);
typform = (Form_pg_type) GETSTRUCT(typtup);
@@ -860,9 +860,9 @@ TypeIsVisible(Oid typid)
visible = true;
break;
}
- if (SearchSysCacheExists2(TYPENAMENSP,
- PointerGetDatum(typname),
- ObjectIdGetDatum(namespaceId)))
+ if (SearchSysCacheExists(TYPENAMENSP,
+ PointerGetDatum(typname),
+ ObjectIdGetDatum(namespaceId)))
{
/* Found something else first in path */
break;
@@ -982,7 +982,7 @@ FuncnameGetCandidates(List *names, int nargs, List *argnames,
}
/* Search syscache by name only */
- catlist = SearchSysCacheList1(PROCNAMEARGSNSP, CStringGetDatum(funcname));
+ catlist = SearchSysCacheList(PROCNAMEARGSNSP, CStringGetDatum(funcname));
for (i = 0; i < catlist->n_members; i++)
{
@@ -1460,7 +1460,7 @@ FunctionIsVisible(Oid funcid)
Oid pronamespace;
bool visible;
- proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
+ proctup = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(proctup))
elog(ERROR, "cache lookup failed for function %u", funcid);
procform = (Form_pg_proc) GETSTRUCT(proctup);
@@ -1543,11 +1543,11 @@ OpernameGetOprid(List *names, Oid oprleft, Oid oprright)
{
HeapTuple opertup;
- opertup = SearchSysCache4(OPERNAMENSP,
- CStringGetDatum(opername),
- ObjectIdGetDatum(oprleft),
- ObjectIdGetDatum(oprright),
- ObjectIdGetDatum(namespaceId));
+ opertup = SearchSysCache(OPERNAMENSP,
+ CStringGetDatum(opername),
+ ObjectIdGetDatum(oprleft),
+ ObjectIdGetDatum(oprright),
+ ObjectIdGetDatum(namespaceId));
if (HeapTupleIsValid(opertup))
{
Form_pg_operator operclass = (Form_pg_operator) GETSTRUCT(opertup);
@@ -1562,10 +1562,10 @@ OpernameGetOprid(List *names, Oid oprleft, Oid oprright)
}
/* Search syscache by name and argument types */
- catlist = SearchSysCacheList3(OPERNAMENSP,
- CStringGetDatum(opername),
- ObjectIdGetDatum(oprleft),
- ObjectIdGetDatum(oprright));
+ catlist = SearchSysCacheList(OPERNAMENSP,
+ CStringGetDatum(opername),
+ ObjectIdGetDatum(oprleft),
+ ObjectIdGetDatum(oprright));
if (catlist->n_members == 0)
{
@@ -1655,7 +1655,7 @@ OpernameGetCandidates(List *names, char oprkind, bool missing_schema_ok)
}
/* Search syscache by name only */
- catlist = SearchSysCacheList1(OPERNAMENSP, CStringGetDatum(opername));
+ catlist = SearchSysCacheList(OPERNAMENSP, CStringGetDatum(opername));
/*
* In typical scenarios, most if not all of the operators found by the
@@ -1794,7 +1794,7 @@ OperatorIsVisible(Oid oprid)
Oid oprnamespace;
bool visible;
- oprtup = SearchSysCache1(OPEROID, ObjectIdGetDatum(oprid));
+ oprtup = SearchSysCache(OPEROID, ObjectIdGetDatum(oprid));
if (!HeapTupleIsValid(oprtup))
elog(ERROR, "cache lookup failed for operator %u", oprid);
oprform = (Form_pg_operator) GETSTRUCT(oprtup);
@@ -1854,10 +1854,10 @@ OpclassnameGetOpcid(Oid amid, const char *opcname)
if (namespaceId == myTempNamespace)
continue; /* do not look in temp namespace */
- opcid = GetSysCacheOid3(CLAAMNAMENSP, Anum_pg_opclass_oid,
- ObjectIdGetDatum(amid),
- PointerGetDatum(opcname),
- ObjectIdGetDatum(namespaceId));
+ opcid = GetSysCacheOid(CLAAMNAMENSP, Anum_pg_opclass_oid,
+ ObjectIdGetDatum(amid),
+ PointerGetDatum(opcname),
+ ObjectIdGetDatum(namespaceId));
if (OidIsValid(opcid))
return opcid;
}
@@ -1880,7 +1880,7 @@ OpclassIsVisible(Oid opcid)
Oid opcnamespace;
bool visible;
- opctup = SearchSysCache1(CLAOID, ObjectIdGetDatum(opcid));
+ opctup = SearchSysCache(CLAOID, ObjectIdGetDatum(opcid));
if (!HeapTupleIsValid(opctup))
elog(ERROR, "cache lookup failed for opclass %u", opcid);
opcform = (Form_pg_opclass) GETSTRUCT(opctup);
@@ -1937,10 +1937,10 @@ OpfamilynameGetOpfid(Oid amid, const char *opfname)
if (namespaceId == myTempNamespace)
continue; /* do not look in temp namespace */
- opfid = GetSysCacheOid3(OPFAMILYAMNAMENSP, Anum_pg_opfamily_oid,
- ObjectIdGetDatum(amid),
- PointerGetDatum(opfname),
- ObjectIdGetDatum(namespaceId));
+ opfid = GetSysCacheOid(OPFAMILYAMNAMENSP, Anum_pg_opfamily_oid,
+ ObjectIdGetDatum(amid),
+ PointerGetDatum(opfname),
+ ObjectIdGetDatum(namespaceId));
if (OidIsValid(opfid))
return opfid;
}
@@ -1963,7 +1963,7 @@ OpfamilyIsVisible(Oid opfid)
Oid opfnamespace;
bool visible;
- opftup = SearchSysCache1(OPFAMILYOID, ObjectIdGetDatum(opfid));
+ opftup = SearchSysCache(OPFAMILYOID, ObjectIdGetDatum(opfid));
if (!HeapTupleIsValid(opftup))
elog(ERROR, "cache lookup failed for opfamily %u", opfid);
opfform = (Form_pg_opfamily) GETSTRUCT(opftup);
@@ -2010,10 +2010,10 @@ lookup_collation(const char *collname, Oid collnamespace, int32 encoding)
Form_pg_collation collform;
/* Check for encoding-specific entry (exact match) */
- collid = GetSysCacheOid3(COLLNAMEENCNSP, Anum_pg_collation_oid,
- PointerGetDatum(collname),
- Int32GetDatum(encoding),
- ObjectIdGetDatum(collnamespace));
+ collid = GetSysCacheOid(COLLNAMEENCNSP, Anum_pg_collation_oid,
+ PointerGetDatum(collname),
+ Int32GetDatum(encoding),
+ ObjectIdGetDatum(collnamespace));
if (OidIsValid(collid))
return collid;
@@ -2023,10 +2023,10 @@ lookup_collation(const char *collname, Oid collnamespace, int32 encoding)
* collations only work with certain encodings, so we have to check that
* aspect before deciding it's a match.
*/
- colltup = SearchSysCache3(COLLNAMEENCNSP,
- PointerGetDatum(collname),
- Int32GetDatum(-1),
- ObjectIdGetDatum(collnamespace));
+ colltup = SearchSysCache(COLLNAMEENCNSP,
+ PointerGetDatum(collname),
+ Int32GetDatum(-1),
+ ObjectIdGetDatum(collnamespace));
if (!HeapTupleIsValid(colltup))
return InvalidOid;
collform = (Form_pg_collation) GETSTRUCT(colltup);
@@ -2095,7 +2095,7 @@ CollationIsVisible(Oid collid)
Oid collnamespace;
bool visible;
- colltup = SearchSysCache1(COLLOID, ObjectIdGetDatum(collid));
+ colltup = SearchSysCache(COLLOID, ObjectIdGetDatum(collid));
if (!HeapTupleIsValid(colltup))
elog(ERROR, "cache lookup failed for collation %u", collid);
collform = (Form_pg_collation) GETSTRUCT(colltup);
@@ -2153,9 +2153,9 @@ ConversionGetConid(const char *conname)
if (namespaceId == myTempNamespace)
continue; /* do not look in temp namespace */
- conid = GetSysCacheOid2(CONNAMENSP, Anum_pg_conversion_oid,
- PointerGetDatum(conname),
- ObjectIdGetDatum(namespaceId));
+ conid = GetSysCacheOid(CONNAMENSP, Anum_pg_conversion_oid,
+ PointerGetDatum(conname),
+ ObjectIdGetDatum(namespaceId));
if (OidIsValid(conid))
return conid;
}
@@ -2178,7 +2178,7 @@ ConversionIsVisible(Oid conid)
Oid connamespace;
bool visible;
- contup = SearchSysCache1(CONVOID, ObjectIdGetDatum(conid));
+ contup = SearchSysCache(CONVOID, ObjectIdGetDatum(conid));
if (!HeapTupleIsValid(contup))
elog(ERROR, "cache lookup failed for conversion %u", conid);
conform = (Form_pg_conversion) GETSTRUCT(contup);
@@ -2236,9 +2236,9 @@ get_statistics_object_oid(List *names, bool missing_ok)
if (missing_ok && !OidIsValid(namespaceId))
stats_oid = InvalidOid;
else
- stats_oid = GetSysCacheOid2(STATEXTNAMENSP, Anum_pg_statistic_ext_oid,
- PointerGetDatum(stats_name),
- ObjectIdGetDatum(namespaceId));
+ stats_oid = GetSysCacheOid(STATEXTNAMENSP, Anum_pg_statistic_ext_oid,
+ PointerGetDatum(stats_name),
+ ObjectIdGetDatum(namespaceId));
}
else
{
@@ -2251,9 +2251,9 @@ get_statistics_object_oid(List *names, bool missing_ok)
if (namespaceId == myTempNamespace)
continue; /* do not look in temp namespace */
- stats_oid = GetSysCacheOid2(STATEXTNAMENSP, Anum_pg_statistic_ext_oid,
- PointerGetDatum(stats_name),
- ObjectIdGetDatum(namespaceId));
+ stats_oid = GetSysCacheOid(STATEXTNAMENSP, Anum_pg_statistic_ext_oid,
+ PointerGetDatum(stats_name),
+ ObjectIdGetDatum(namespaceId));
if (OidIsValid(stats_oid))
break;
}
@@ -2282,7 +2282,7 @@ StatisticsObjIsVisible(Oid relid)
Oid stxnamespace;
bool visible;
- stxtup = SearchSysCache1(STATEXTOID, ObjectIdGetDatum(relid));
+ stxtup = SearchSysCache(STATEXTOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(stxtup))
elog(ERROR, "cache lookup failed for statistics object %u", relid);
stxform = (Form_pg_statistic_ext) GETSTRUCT(stxtup);
@@ -2319,9 +2319,9 @@ StatisticsObjIsVisible(Oid relid)
visible = true;
break;
}
- if (SearchSysCacheExists2(STATEXTNAMENSP,
- PointerGetDatum(stxname),
- ObjectIdGetDatum(namespaceId)))
+ if (SearchSysCacheExists(STATEXTNAMENSP,
+ PointerGetDatum(stxname),
+ ObjectIdGetDatum(namespaceId)))
{
/* Found something else first in path */
break;
@@ -2358,9 +2358,9 @@ get_ts_parser_oid(List *names, bool missing_ok)
if (missing_ok && !OidIsValid(namespaceId))
prsoid = InvalidOid;
else
- prsoid = GetSysCacheOid2(TSPARSERNAMENSP, Anum_pg_ts_parser_oid,
- PointerGetDatum(parser_name),
- ObjectIdGetDatum(namespaceId));
+ prsoid = GetSysCacheOid(TSPARSERNAMENSP, Anum_pg_ts_parser_oid,
+ PointerGetDatum(parser_name),
+ ObjectIdGetDatum(namespaceId));
}
else
{
@@ -2374,7 +2374,7 @@ get_ts_parser_oid(List *names, bool missing_ok)
if (namespaceId == myTempNamespace)
continue; /* do not look in temp namespace */
- prsoid = GetSysCacheOid2(TSPARSERNAMENSP, Anum_pg_ts_parser_oid,
+ prsoid = GetSysCacheOid(TSPARSERNAMENSP, Anum_pg_ts_parser_oid,
PointerGetDatum(parser_name),
ObjectIdGetDatum(namespaceId));
if (OidIsValid(prsoid))
@@ -2405,7 +2405,7 @@ TSParserIsVisible(Oid prsId)
Oid namespace;
bool visible;
- tup = SearchSysCache1(TSPARSEROID, ObjectIdGetDatum(prsId));
+ tup = SearchSysCache(TSPARSEROID, ObjectIdGetDatum(prsId));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for text search parser %u", prsId);
form = (Form_pg_ts_parser) GETSTRUCT(tup);
@@ -2445,9 +2445,9 @@ TSParserIsVisible(Oid prsId)
visible = true;
break;
}
- if (SearchSysCacheExists2(TSPARSERNAMENSP,
- PointerGetDatum(name),
- ObjectIdGetDatum(namespaceId)))
+ if (SearchSysCacheExists(TSPARSERNAMENSP,
+ PointerGetDatum(name),
+ ObjectIdGetDatum(namespaceId)))
{
/* Found something else first in path */
break;
@@ -2484,9 +2484,9 @@ get_ts_dict_oid(List *names, bool missing_ok)
if (missing_ok && !OidIsValid(namespaceId))
dictoid = InvalidOid;
else
- dictoid = GetSysCacheOid2(TSDICTNAMENSP, Anum_pg_ts_dict_oid,
- PointerGetDatum(dict_name),
- ObjectIdGetDatum(namespaceId));
+ dictoid = GetSysCacheOid(TSDICTNAMENSP, Anum_pg_ts_dict_oid,
+ PointerGetDatum(dict_name),
+ ObjectIdGetDatum(namespaceId));
}
else
{
@@ -2500,9 +2500,9 @@ get_ts_dict_oid(List *names, bool missing_ok)
if (namespaceId == myTempNamespace)
continue; /* do not look in temp namespace */
- dictoid = GetSysCacheOid2(TSDICTNAMENSP, Anum_pg_ts_dict_oid,
- PointerGetDatum(dict_name),
- ObjectIdGetDatum(namespaceId));
+ dictoid = GetSysCacheOid(TSDICTNAMENSP, Anum_pg_ts_dict_oid,
+ PointerGetDatum(dict_name),
+ ObjectIdGetDatum(namespaceId));
if (OidIsValid(dictoid))
break;
}
@@ -2531,7 +2531,7 @@ TSDictionaryIsVisible(Oid dictId)
Oid namespace;
bool visible;
- tup = SearchSysCache1(TSDICTOID, ObjectIdGetDatum(dictId));
+ tup = SearchSysCache(TSDICTOID, ObjectIdGetDatum(dictId));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for text search dictionary %u",
dictId);
@@ -2572,9 +2572,9 @@ TSDictionaryIsVisible(Oid dictId)
visible = true;
break;
}
- if (SearchSysCacheExists2(TSDICTNAMENSP,
- PointerGetDatum(name),
- ObjectIdGetDatum(namespaceId)))
+ if (SearchSysCacheExists(TSDICTNAMENSP,
+ PointerGetDatum(name),
+ ObjectIdGetDatum(namespaceId)))
{
/* Found something else first in path */
break;
@@ -2611,9 +2611,9 @@ get_ts_template_oid(List *names, bool missing_ok)
if (missing_ok && !OidIsValid(namespaceId))
tmploid = InvalidOid;
else
- tmploid = GetSysCacheOid2(TSTEMPLATENAMENSP, Anum_pg_ts_template_oid,
- PointerGetDatum(template_name),
- ObjectIdGetDatum(namespaceId));
+ tmploid = GetSysCacheOid(TSTEMPLATENAMENSP, Anum_pg_ts_template_oid,
+ PointerGetDatum(template_name),
+ ObjectIdGetDatum(namespaceId));
}
else
{
@@ -2627,9 +2627,9 @@ get_ts_template_oid(List *names, bool missing_ok)
if (namespaceId == myTempNamespace)
continue; /* do not look in temp namespace */
- tmploid = GetSysCacheOid2(TSTEMPLATENAMENSP, Anum_pg_ts_template_oid,
- PointerGetDatum(template_name),
- ObjectIdGetDatum(namespaceId));
+ tmploid = GetSysCacheOid(TSTEMPLATENAMENSP, Anum_pg_ts_template_oid,
+ PointerGetDatum(template_name),
+ ObjectIdGetDatum(namespaceId));
if (OidIsValid(tmploid))
break;
}
@@ -2658,7 +2658,7 @@ TSTemplateIsVisible(Oid tmplId)
Oid namespace;
bool visible;
- tup = SearchSysCache1(TSTEMPLATEOID, ObjectIdGetDatum(tmplId));
+ tup = SearchSysCache(TSTEMPLATEOID, ObjectIdGetDatum(tmplId));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for text search template %u", tmplId);
form = (Form_pg_ts_template) GETSTRUCT(tup);
@@ -2698,9 +2698,9 @@ TSTemplateIsVisible(Oid tmplId)
visible = true;
break;
}
- if (SearchSysCacheExists2(TSTEMPLATENAMENSP,
- PointerGetDatum(name),
- ObjectIdGetDatum(namespaceId)))
+ if (SearchSysCacheExists(TSTEMPLATENAMENSP,
+ PointerGetDatum(name),
+ ObjectIdGetDatum(namespaceId)))
{
/* Found something else first in path */
break;
@@ -2737,9 +2737,9 @@ get_ts_config_oid(List *names, bool missing_ok)
if (missing_ok && !OidIsValid(namespaceId))
cfgoid = InvalidOid;
else
- cfgoid = GetSysCacheOid2(TSCONFIGNAMENSP, Anum_pg_ts_config_oid,
- PointerGetDatum(config_name),
- ObjectIdGetDatum(namespaceId));
+ cfgoid = GetSysCacheOid(TSCONFIGNAMENSP, Anum_pg_ts_config_oid,
+ PointerGetDatum(config_name),
+ ObjectIdGetDatum(namespaceId));
}
else
{
@@ -2753,9 +2753,9 @@ get_ts_config_oid(List *names, bool missing_ok)
if (namespaceId == myTempNamespace)
continue; /* do not look in temp namespace */
- cfgoid = GetSysCacheOid2(TSCONFIGNAMENSP, Anum_pg_ts_config_oid,
- PointerGetDatum(config_name),
- ObjectIdGetDatum(namespaceId));
+ cfgoid = GetSysCacheOid(TSCONFIGNAMENSP, Anum_pg_ts_config_oid,
+ PointerGetDatum(config_name),
+ ObjectIdGetDatum(namespaceId));
if (OidIsValid(cfgoid))
break;
}
@@ -2784,7 +2784,7 @@ TSConfigIsVisible(Oid cfgid)
Oid namespace;
bool visible;
- tup = SearchSysCache1(TSCONFIGOID, ObjectIdGetDatum(cfgid));
+ tup = SearchSysCache(TSCONFIGOID, ObjectIdGetDatum(cfgid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for text search configuration %u",
cfgid);
@@ -2825,9 +2825,9 @@ TSConfigIsVisible(Oid cfgid)
visible = true;
break;
}
- if (SearchSysCacheExists2(TSCONFIGNAMENSP,
- PointerGetDatum(name),
- ObjectIdGetDatum(namespaceId)))
+ if (SearchSysCacheExists(TSCONFIGNAMENSP,
+ PointerGetDatum(name),
+ ObjectIdGetDatum(namespaceId)))
{
/* Found something else first in path */
break;
@@ -3087,8 +3087,8 @@ get_namespace_oid(const char *nspname, bool missing_ok)
{
Oid oid;
- oid = GetSysCacheOid1(NAMESPACENAME, Anum_pg_namespace_oid,
- CStringGetDatum(nspname));
+ oid = GetSysCacheOid(NAMESPACENAME, Anum_pg_namespace_oid,
+ CStringGetDatum(nspname));
if (!OidIsValid(oid) && !missing_ok)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_SCHEMA),
@@ -3713,9 +3713,9 @@ get_conversion_oid(List *conname, bool missing_ok)
if (missing_ok && !OidIsValid(namespaceId))
conoid = InvalidOid;
else
- conoid = GetSysCacheOid2(CONNAMENSP, Anum_pg_conversion_oid,
- PointerGetDatum(conversion_name),
- ObjectIdGetDatum(namespaceId));
+ conoid = GetSysCacheOid(CONNAMENSP, Anum_pg_conversion_oid,
+ PointerGetDatum(conversion_name),
+ ObjectIdGetDatum(namespaceId));
}
else
{
@@ -3729,9 +3729,9 @@ get_conversion_oid(List *conname, bool missing_ok)
if (namespaceId == myTempNamespace)
continue; /* do not look in temp namespace */
- conoid = GetSysCacheOid2(CONNAMENSP, Anum_pg_conversion_oid,
- PointerGetDatum(conversion_name),
- ObjectIdGetDatum(namespaceId));
+ conoid = GetSysCacheOid(CONNAMENSP, Anum_pg_conversion_oid,
+ PointerGetDatum(conversion_name),
+ ObjectIdGetDatum(namespaceId));
if (OidIsValid(conoid))
return conoid;
}
@@ -3827,7 +3827,7 @@ recomputeNamespacePath(void)
/* $user --- substitute namespace matching user name, if any */
HeapTuple tuple;
- tuple = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid));
+ tuple = SearchSysCache(AUTHOID, ObjectIdGetDatum(roleid));
if (HeapTupleIsValid(tuple))
{
char *rname;
@@ -4506,7 +4506,7 @@ pg_table_is_visible(PG_FUNCTION_ARGS)
{
Oid oid = PG_GETARG_OID(0);
- if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(oid)))
+ if (!SearchSysCacheExists(RELOID, ObjectIdGetDatum(oid)))
PG_RETURN_NULL();
PG_RETURN_BOOL(RelationIsVisible(oid));
@@ -4517,7 +4517,7 @@ pg_type_is_visible(PG_FUNCTION_ARGS)
{
Oid oid = PG_GETARG_OID(0);
- if (!SearchSysCacheExists1(TYPEOID, ObjectIdGetDatum(oid)))
+ if (!SearchSysCacheExists(TYPEOID, ObjectIdGetDatum(oid)))
PG_RETURN_NULL();
PG_RETURN_BOOL(TypeIsVisible(oid));
@@ -4528,7 +4528,7 @@ pg_function_is_visible(PG_FUNCTION_ARGS)
{
Oid oid = PG_GETARG_OID(0);
- if (!SearchSysCacheExists1(PROCOID, ObjectIdGetDatum(oid)))
+ if (!SearchSysCacheExists(PROCOID, ObjectIdGetDatum(oid)))
PG_RETURN_NULL();
PG_RETURN_BOOL(FunctionIsVisible(oid));
@@ -4539,7 +4539,7 @@ pg_operator_is_visible(PG_FUNCTION_ARGS)
{
Oid oid = PG_GETARG_OID(0);
- if (!SearchSysCacheExists1(OPEROID, ObjectIdGetDatum(oid)))
+ if (!SearchSysCacheExists(OPEROID, ObjectIdGetDatum(oid)))
PG_RETURN_NULL();
PG_RETURN_BOOL(OperatorIsVisible(oid));
@@ -4550,7 +4550,7 @@ pg_opclass_is_visible(PG_FUNCTION_ARGS)
{
Oid oid = PG_GETARG_OID(0);
- if (!SearchSysCacheExists1(CLAOID, ObjectIdGetDatum(oid)))
+ if (!SearchSysCacheExists(CLAOID, ObjectIdGetDatum(oid)))
PG_RETURN_NULL();
PG_RETURN_BOOL(OpclassIsVisible(oid));
@@ -4561,7 +4561,7 @@ pg_opfamily_is_visible(PG_FUNCTION_ARGS)
{
Oid oid = PG_GETARG_OID(0);
- if (!SearchSysCacheExists1(OPFAMILYOID, ObjectIdGetDatum(oid)))
+ if (!SearchSysCacheExists(OPFAMILYOID, ObjectIdGetDatum(oid)))
PG_RETURN_NULL();
PG_RETURN_BOOL(OpfamilyIsVisible(oid));
@@ -4572,7 +4572,7 @@ pg_collation_is_visible(PG_FUNCTION_ARGS)
{
Oid oid = PG_GETARG_OID(0);
- if (!SearchSysCacheExists1(COLLOID, ObjectIdGetDatum(oid)))
+ if (!SearchSysCacheExists(COLLOID, ObjectIdGetDatum(oid)))
PG_RETURN_NULL();
PG_RETURN_BOOL(CollationIsVisible(oid));
@@ -4583,7 +4583,7 @@ pg_conversion_is_visible(PG_FUNCTION_ARGS)
{
Oid oid = PG_GETARG_OID(0);
- if (!SearchSysCacheExists1(CONVOID, ObjectIdGetDatum(oid)))
+ if (!SearchSysCacheExists(CONVOID, ObjectIdGetDatum(oid)))
PG_RETURN_NULL();
PG_RETURN_BOOL(ConversionIsVisible(oid));
@@ -4594,7 +4594,7 @@ pg_statistics_obj_is_visible(PG_FUNCTION_ARGS)
{
Oid oid = PG_GETARG_OID(0);
- if (!SearchSysCacheExists1(STATEXTOID, ObjectIdGetDatum(oid)))
+ if (!SearchSysCacheExists(STATEXTOID, ObjectIdGetDatum(oid)))
PG_RETURN_NULL();
PG_RETURN_BOOL(StatisticsObjIsVisible(oid));
@@ -4605,7 +4605,7 @@ pg_ts_parser_is_visible(PG_FUNCTION_ARGS)
{
Oid oid = PG_GETARG_OID(0);
- if (!SearchSysCacheExists1(TSPARSEROID, ObjectIdGetDatum(oid)))
+ if (!SearchSysCacheExists(TSPARSEROID, ObjectIdGetDatum(oid)))
PG_RETURN_NULL();
PG_RETURN_BOOL(TSParserIsVisible(oid));
@@ -4616,7 +4616,7 @@ pg_ts_dict_is_visible(PG_FUNCTION_ARGS)
{
Oid oid = PG_GETARG_OID(0);
- if (!SearchSysCacheExists1(TSDICTOID, ObjectIdGetDatum(oid)))
+ if (!SearchSysCacheExists(TSDICTOID, ObjectIdGetDatum(oid)))
PG_RETURN_NULL();
PG_RETURN_BOOL(TSDictionaryIsVisible(oid));
@@ -4627,7 +4627,7 @@ pg_ts_template_is_visible(PG_FUNCTION_ARGS)
{
Oid oid = PG_GETARG_OID(0);
- if (!SearchSysCacheExists1(TSTEMPLATEOID, ObjectIdGetDatum(oid)))
+ if (!SearchSysCacheExists(TSTEMPLATEOID, ObjectIdGetDatum(oid)))
PG_RETURN_NULL();
PG_RETURN_BOOL(TSTemplateIsVisible(oid));
@@ -4638,7 +4638,7 @@ pg_ts_config_is_visible(PG_FUNCTION_ARGS)
{
Oid oid = PG_GETARG_OID(0);
- if (!SearchSysCacheExists1(TSCONFIGOID, ObjectIdGetDatum(oid)))
+ if (!SearchSysCacheExists(TSCONFIGOID, ObjectIdGetDatum(oid)))
PG_RETURN_NULL();
PG_RETURN_BOOL(TSConfigIsVisible(oid));
diff --git a/src/backend/catalog/objectaddress.c b/src/backend/catalog/objectaddress.c
index 95fefc7565..8989e6cff4 100644
--- a/src/backend/catalog/objectaddress.c
+++ b/src/backend/catalog/objectaddress.c
@@ -1762,11 +1762,11 @@ get_object_address_opf_member(ObjectType objtype,
ObjectAddressSet(address, AccessMethodOperatorRelationId,
InvalidOid);
- tp = SearchSysCache4(AMOPSTRATEGY,
- ObjectIdGetDatum(famaddr.objectId),
- ObjectIdGetDatum(typeoids[0]),
- ObjectIdGetDatum(typeoids[1]),
- Int16GetDatum(membernum));
+ tp = SearchSysCache(AMOPSTRATEGY,
+ ObjectIdGetDatum(famaddr.objectId),
+ ObjectIdGetDatum(typeoids[0]),
+ ObjectIdGetDatum(typeoids[1]),
+ Int16GetDatum(membernum));
if (!HeapTupleIsValid(tp))
{
if (!missing_ok)
@@ -1793,11 +1793,11 @@ get_object_address_opf_member(ObjectType objtype,
ObjectAddressSet(address, AccessMethodProcedureRelationId,
InvalidOid);
- tp = SearchSysCache4(AMPROCNUM,
- ObjectIdGetDatum(famaddr.objectId),
- ObjectIdGetDatum(typeoids[0]),
- ObjectIdGetDatum(typeoids[1]),
- Int16GetDatum(membernum));
+ tp = SearchSysCache(AMPROCNUM,
+ ObjectIdGetDatum(famaddr.objectId),
+ ObjectIdGetDatum(typeoids[0]),
+ ObjectIdGetDatum(typeoids[1]),
+ Int16GetDatum(membernum));
if (!HeapTupleIsValid(tp))
{
if (!missing_ok)
@@ -1847,8 +1847,8 @@ get_object_address_usermapping(List *object, bool missing_ok)
userid = InvalidOid;
else
{
- tp = SearchSysCache1(AUTHNAME,
- CStringGetDatum(username));
+ tp = SearchSysCache(AUTHNAME,
+ CStringGetDatum(username));
if (!HeapTupleIsValid(tp))
{
if (!missing_ok)
@@ -1872,9 +1872,9 @@ get_object_address_usermapping(List *object, bool missing_ok)
errmsg("server \"%s\" does not exist", servername)));
return address;
}
- tp = SearchSysCache2(USERMAPPINGUSERSERVER,
- ObjectIdGetDatum(userid),
- ObjectIdGetDatum(server->serverid));
+ tp = SearchSysCache(USERMAPPINGUSERSERVER,
+ ObjectIdGetDatum(userid),
+ ObjectIdGetDatum(server->serverid));
if (!HeapTupleIsValid(tp))
{
if (!missing_ok)
@@ -1928,9 +1928,9 @@ get_object_address_publication_rel(List *object,
/* Find the publication relation mapping in syscache. */
address.objectId =
- GetSysCacheOid2(PUBLICATIONRELMAP, Anum_pg_publication_rel_oid,
- ObjectIdGetDatum(RelationGetRelid(relation)),
- ObjectIdGetDatum(pub->oid));
+ GetSysCacheOid(PUBLICATIONRELMAP, Anum_pg_publication_rel_oid,
+ ObjectIdGetDatum(RelationGetRelid(relation)),
+ ObjectIdGetDatum(pub->oid));
if (!OidIsValid(address.objectId))
{
if (!missing_ok)
@@ -1976,9 +1976,9 @@ get_object_address_publication_schema(List *object, bool missing_ok)
/* Find the publication schema mapping in syscache */
address.objectId =
- GetSysCacheOid2(PUBLICATIONNAMESPACEMAP,
- Anum_pg_publication_namespace_oid,
- ObjectIdGetDatum(schemaid),
+ GetSysCacheOid(PUBLICATIONNAMESPACEMAP,
+ Anum_pg_publication_namespace_oid,
+ ObjectIdGetDatum(schemaid),
ObjectIdGetDatum(pub->oid));
if (!OidIsValid(address.objectId) && !missing_ok)
ereport(ERROR,
@@ -2054,8 +2054,8 @@ get_object_address_defacl(List *object, bool missing_ok)
* Look up user ID. Behave as "default ACL not found" if the user doesn't
* exist.
*/
- tp = SearchSysCache1(AUTHNAME,
- CStringGetDatum(username));
+ tp = SearchSysCache(AUTHNAME,
+ CStringGetDatum(username));
if (!HeapTupleIsValid(tp))
goto not_found;
userid = ((Form_pg_authid) GETSTRUCT(tp))->oid;
@@ -2075,10 +2075,10 @@ get_object_address_defacl(List *object, bool missing_ok)
schemaid = InvalidOid;
/* Finally, look up the pg_default_acl object */
- tp = SearchSysCache3(DEFACLROLENSPOBJ,
- ObjectIdGetDatum(userid),
- ObjectIdGetDatum(schemaid),
- CharGetDatum(objtype));
+ tp = SearchSysCache(DEFACLROLENSPOBJ,
+ ObjectIdGetDatum(userid),
+ ObjectIdGetDatum(schemaid),
+ CharGetDatum(objtype));
if (!HeapTupleIsValid(tp))
goto not_found;
@@ -2448,8 +2448,8 @@ check_object_ownership(Oid roleid, ObjectType objtype, ObjectAddress address,
HeapTuple tuple;
Oid contypid;
- tuple = SearchSysCache1(CONSTROID,
- ObjectIdGetDatum(address.objectId));
+ tuple = SearchSysCache(CONSTROID,
+ ObjectIdGetDatum(address.objectId));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "constraint with OID %u does not exist",
address.objectId);
@@ -2616,7 +2616,7 @@ get_object_namespace(const ObjectAddress *address)
Assert(cache != -1);
/* Fetch tuple from syscache and extract namespace attribute. */
- tuple = SearchSysCache1(cache, ObjectIdGetDatum(address->objectId));
+ tuple = SearchSysCache(cache, ObjectIdGetDatum(address->objectId));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for cache %d oid %u",
cache, address->objectId);
@@ -2824,7 +2824,7 @@ get_catalog_object_by_oid(Relation catalog, AttrNumber oidcol, Oid objectId)
if (oidCacheId > 0)
{
- tuple = SearchSysCacheCopy1(oidCacheId, ObjectIdGetDatum(objectId));
+ tuple = SearchSysCacheCopy(oidCacheId, ObjectIdGetDatum(objectId));
if (!HeapTupleIsValid(tuple)) /* should not happen */
return NULL;
}
@@ -2871,8 +2871,8 @@ getPublicationSchemaInfo(const ObjectAddress *object, bool missing_ok,
HeapTuple tup;
Form_pg_publication_namespace pnform;
- tup = SearchSysCache1(PUBLICATIONNAMESPACE,
- ObjectIdGetDatum(object->objectId));
+ tup = SearchSysCache(PUBLICATIONNAMESPACE,
+ ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(tup))
{
if (!missing_ok)
@@ -3018,8 +3018,8 @@ getObjectDescription(const ObjectAddress *object, bool missing_ok)
Form_pg_collation coll;
char *nspname;
- collTup = SearchSysCache1(COLLOID,
- ObjectIdGetDatum(object->objectId));
+ collTup = SearchSysCache(COLLOID,
+ ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(collTup))
{
if (!missing_ok)
@@ -3048,8 +3048,8 @@ getObjectDescription(const ObjectAddress *object, bool missing_ok)
HeapTuple conTup;
Form_pg_constraint con;
- conTup = SearchSysCache1(CONSTROID,
- ObjectIdGetDatum(object->objectId));
+ conTup = SearchSysCache(CONSTROID,
+ ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(conTup))
{
if (!missing_ok)
@@ -3087,8 +3087,8 @@ getObjectDescription(const ObjectAddress *object, bool missing_ok)
Form_pg_conversion conv;
char *nspname;
- conTup = SearchSysCache1(CONVOID,
- ObjectIdGetDatum(object->objectId));
+ conTup = SearchSysCache(CONVOID,
+ ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(conTup))
{
if (!missing_ok)
@@ -3171,8 +3171,8 @@ getObjectDescription(const ObjectAddress *object, bool missing_ok)
Form_pg_am amForm;
char *nspname;
- opcTup = SearchSysCache1(CLAOID,
- ObjectIdGetDatum(object->objectId));
+ opcTup = SearchSysCache(CLAOID,
+ ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(opcTup))
{
if (!missing_ok)
@@ -3183,8 +3183,8 @@ getObjectDescription(const ObjectAddress *object, bool missing_ok)
opcForm = (Form_pg_opclass) GETSTRUCT(opcTup);
- amTup = SearchSysCache1(AMOID,
- ObjectIdGetDatum(opcForm->opcmethod));
+ amTup = SearchSysCache(AMOID,
+ ObjectIdGetDatum(opcForm->opcmethod));
if (!HeapTupleIsValid(amTup))
elog(ERROR, "cache lookup failed for access method %u",
opcForm->opcmethod);
@@ -3214,8 +3214,8 @@ getObjectDescription(const ObjectAddress *object, bool missing_ok)
{
HeapTuple tup;
- tup = SearchSysCache1(AMOID,
- ObjectIdGetDatum(object->objectId));
+ tup = SearchSysCache(AMOID,
+ ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(tup))
{
if (!missing_ok)
@@ -3458,8 +3458,8 @@ getObjectDescription(const ObjectAddress *object, bool missing_ok)
Form_pg_statistic_ext stxForm;
char *nspname;
- stxTup = SearchSysCache1(STATEXTOID,
- ObjectIdGetDatum(object->objectId));
+ stxTup = SearchSysCache(STATEXTOID,
+ ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(stxTup))
{
if (!missing_ok)
@@ -3490,8 +3490,8 @@ getObjectDescription(const ObjectAddress *object, bool missing_ok)
Form_pg_ts_parser prsForm;
char *nspname;
- tup = SearchSysCache1(TSPARSEROID,
- ObjectIdGetDatum(object->objectId));
+ tup = SearchSysCache(TSPARSEROID,
+ ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(tup))
{
if (!missing_ok)
@@ -3520,8 +3520,8 @@ getObjectDescription(const ObjectAddress *object, bool missing_ok)
Form_pg_ts_dict dictForm;
char *nspname;
- tup = SearchSysCache1(TSDICTOID,
- ObjectIdGetDatum(object->objectId));
+ tup = SearchSysCache(TSDICTOID,
+ ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(tup))
{
if (!missing_ok)
@@ -3551,8 +3551,8 @@ getObjectDescription(const ObjectAddress *object, bool missing_ok)
Form_pg_ts_template tmplForm;
char *nspname;
- tup = SearchSysCache1(TSTEMPLATEOID,
- ObjectIdGetDatum(object->objectId));
+ tup = SearchSysCache(TSTEMPLATEOID,
+ ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(tup))
{
if (!missing_ok)
@@ -3582,8 +3582,8 @@ getObjectDescription(const ObjectAddress *object, bool missing_ok)
Form_pg_ts_config cfgForm;
char *nspname;
- tup = SearchSysCache1(TSCONFIGOID,
- ObjectIdGetDatum(object->objectId));
+ tup = SearchSysCache(TSCONFIGOID,
+ ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(tup))
{
if (!missing_ok)
@@ -3720,8 +3720,8 @@ getObjectDescription(const ObjectAddress *object, bool missing_ok)
Form_pg_user_mapping umform;
ForeignServer *srv;
- tup = SearchSysCache1(USERMAPPINGOID,
- ObjectIdGetDatum(object->objectId));
+ tup = SearchSysCache(USERMAPPINGOID,
+ ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(tup))
{
if (!missing_ok)
@@ -3874,8 +3874,8 @@ getObjectDescription(const ObjectAddress *object, bool missing_ok)
{
HeapTuple tup;
- tup = SearchSysCache1(EVENTTRIGGEROID,
- ObjectIdGetDatum(object->objectId));
+ tup = SearchSysCache(EVENTTRIGGEROID,
+ ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(tup))
{
if (!missing_ok)
@@ -3895,8 +3895,8 @@ getObjectDescription(const ObjectAddress *object, bool missing_ok)
Datum nameDatum;
char *parname;
- tup = SearchSysCache1(PARAMETERACLOID,
- ObjectIdGetDatum(object->objectId));
+ tup = SearchSysCache(PARAMETERACLOID,
+ ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(tup))
{
if (!missing_ok)
@@ -3991,8 +3991,8 @@ getObjectDescription(const ObjectAddress *object, bool missing_ok)
Form_pg_publication_rel prform;
StringInfoData rel;
- tup = SearchSysCache1(PUBLICATIONREL,
- ObjectIdGetDatum(object->objectId));
+ tup = SearchSysCache(PUBLICATIONREL,
+ ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(tup))
{
if (!missing_ok)
@@ -4030,8 +4030,8 @@ getObjectDescription(const ObjectAddress *object, bool missing_ok)
HeapTuple trfTup;
Form_pg_transform trfForm;
- trfTup = SearchSysCache1(TRFOID,
- ObjectIdGetDatum(object->objectId));
+ trfTup = SearchSysCache(TRFOID,
+ ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(trfTup))
{
if (!missing_ok)
@@ -4091,8 +4091,8 @@ getRelationDescription(StringInfo buffer, Oid relid, bool missing_ok)
char *nspname;
char *relname;
- relTup = SearchSysCache1(RELOID,
- ObjectIdGetDatum(relid));
+ relTup = SearchSysCache(RELOID,
+ ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(relTup))
{
if (!missing_ok)
@@ -4167,7 +4167,7 @@ getOpFamilyDescription(StringInfo buffer, Oid opfid, bool missing_ok)
Form_pg_am amForm;
char *nspname;
- opfTup = SearchSysCache1(OPFAMILYOID, ObjectIdGetDatum(opfid));
+ opfTup = SearchSysCache(OPFAMILYOID, ObjectIdGetDatum(opfid));
if (!HeapTupleIsValid(opfTup))
{
if (!missing_ok)
@@ -4176,7 +4176,7 @@ getOpFamilyDescription(StringInfo buffer, Oid opfid, bool missing_ok)
}
opfForm = (Form_pg_opfamily) GETSTRUCT(opfTup);
- amTup = SearchSysCache1(AMOID, ObjectIdGetDatum(opfForm->opfmethod));
+ amTup = SearchSysCache(AMOID, ObjectIdGetDatum(opfForm->opfmethod));
if (!HeapTupleIsValid(amTup))
elog(ERROR, "cache lookup failed for access method %u",
opfForm->opfmethod);
@@ -4607,8 +4607,8 @@ getRelationTypeDescription(StringInfo buffer, Oid relid, int32 objectSubId,
HeapTuple relTup;
Form_pg_class relForm;
- relTup = SearchSysCache1(RELOID,
- ObjectIdGetDatum(relid));
+ relTup = SearchSysCache(RELOID,
+ ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(relTup))
{
if (!missing_ok)
@@ -4707,8 +4707,8 @@ getProcedureTypeDescription(StringInfo buffer, Oid procid,
HeapTuple procTup;
Form_pg_proc procForm;
- procTup = SearchSysCache1(PROCOID,
- ObjectIdGetDatum(procid));
+ procTup = SearchSysCache(PROCOID,
+ ObjectIdGetDatum(procid));
if (!HeapTupleIsValid(procTup))
{
if (!missing_ok)
@@ -4884,8 +4884,8 @@ getObjectIdentityParts(const ObjectAddress *object,
Form_pg_collation coll;
char *schema;
- collTup = SearchSysCache1(COLLOID,
- ObjectIdGetDatum(object->objectId));
+ collTup = SearchSysCache(COLLOID,
+ ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(collTup))
{
if (!missing_ok)
@@ -4910,8 +4910,8 @@ getObjectIdentityParts(const ObjectAddress *object,
HeapTuple conTup;
Form_pg_constraint con;
- conTup = SearchSysCache1(CONSTROID,
- ObjectIdGetDatum(object->objectId));
+ conTup = SearchSysCache(CONSTROID,
+ ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(conTup))
{
if (!missing_ok)
@@ -4958,8 +4958,8 @@ getObjectIdentityParts(const ObjectAddress *object,
Form_pg_conversion conForm;
char *schema;
- conTup = SearchSysCache1(CONVOID,
- ObjectIdGetDatum(object->objectId));
+ conTup = SearchSysCache(CONVOID,
+ ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(conTup))
{
if (!missing_ok)
@@ -5005,8 +5005,8 @@ getObjectIdentityParts(const ObjectAddress *object,
HeapTuple langTup;
Form_pg_language langForm;
- langTup = SearchSysCache1(LANGOID,
- ObjectIdGetDatum(object->objectId));
+ langTup = SearchSysCache(LANGOID,
+ ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(langTup))
{
if (!missing_ok)
@@ -5054,8 +5054,8 @@ getObjectIdentityParts(const ObjectAddress *object,
Form_pg_am amForm;
char *schema;
- opcTup = SearchSysCache1(CLAOID,
- ObjectIdGetDatum(object->objectId));
+ opcTup = SearchSysCache(CLAOID,
+ ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(opcTup))
{
if (!missing_ok)
@@ -5066,8 +5066,8 @@ getObjectIdentityParts(const ObjectAddress *object,
opcForm = (Form_pg_opclass) GETSTRUCT(opcTup);
schema = get_namespace_name_or_temp(opcForm->opcnamespace);
- amTup = SearchSysCache1(AMOID,
- ObjectIdGetDatum(opcForm->opcmethod));
+ amTup = SearchSysCache(AMOID,
+ ObjectIdGetDatum(opcForm->opcmethod));
if (!HeapTupleIsValid(amTup))
elog(ERROR, "cache lookup failed for access method %u",
opcForm->opcmethod);
@@ -5325,8 +5325,8 @@ getObjectIdentityParts(const ObjectAddress *object,
Form_pg_statistic_ext formStatistic;
char *schema;
- tup = SearchSysCache1(STATEXTOID,
- ObjectIdGetDatum(object->objectId));
+ tup = SearchSysCache(STATEXTOID,
+ ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(tup))
{
if (!missing_ok)
@@ -5352,8 +5352,8 @@ getObjectIdentityParts(const ObjectAddress *object,
Form_pg_ts_parser formParser;
char *schema;
- tup = SearchSysCache1(TSPARSEROID,
- ObjectIdGetDatum(object->objectId));
+ tup = SearchSysCache(TSPARSEROID,
+ ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(tup))
{
if (!missing_ok)
@@ -5379,8 +5379,8 @@ getObjectIdentityParts(const ObjectAddress *object,
Form_pg_ts_dict formDict;
char *schema;
- tup = SearchSysCache1(TSDICTOID,
- ObjectIdGetDatum(object->objectId));
+ tup = SearchSysCache(TSDICTOID,
+ ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(tup))
{
if (!missing_ok)
@@ -5406,8 +5406,8 @@ getObjectIdentityParts(const ObjectAddress *object,
Form_pg_ts_template formTmpl;
char *schema;
- tup = SearchSysCache1(TSTEMPLATEOID,
- ObjectIdGetDatum(object->objectId));
+ tup = SearchSysCache(TSTEMPLATEOID,
+ ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(tup))
{
if (!missing_ok)
@@ -5433,8 +5433,8 @@ getObjectIdentityParts(const ObjectAddress *object,
Form_pg_ts_config formCfg;
char *schema;
- tup = SearchSysCache1(TSCONFIGOID,
- ObjectIdGetDatum(object->objectId));
+ tup = SearchSysCache(TSCONFIGOID,
+ ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(tup))
{
if (!missing_ok)
@@ -5588,8 +5588,8 @@ getObjectIdentityParts(const ObjectAddress *object,
ForeignServer *srv;
const char *usename;
- tup = SearchSysCache1(USERMAPPINGOID,
- ObjectIdGetDatum(object->objectId));
+ tup = SearchSysCache(USERMAPPINGOID,
+ ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(tup))
{
if (!missing_ok)
@@ -5731,8 +5731,8 @@ getObjectIdentityParts(const ObjectAddress *object,
Form_pg_event_trigger trigForm;
char *evtname;
- tup = SearchSysCache1(EVENTTRIGGEROID,
- ObjectIdGetDatum(object->objectId));
+ tup = SearchSysCache(EVENTTRIGGEROID,
+ ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(tup))
{
if (!missing_ok)
@@ -5755,8 +5755,8 @@ getObjectIdentityParts(const ObjectAddress *object,
Datum nameDatum;
char *parname;
- tup = SearchSysCache1(PARAMETERACLOID,
- ObjectIdGetDatum(object->objectId));
+ tup = SearchSysCache(PARAMETERACLOID,
+ ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(tup))
{
if (!missing_ok)
@@ -5852,8 +5852,8 @@ getObjectIdentityParts(const ObjectAddress *object,
char *pubname;
Form_pg_publication_rel prform;
- tup = SearchSysCache1(PUBLICATIONREL,
- ObjectIdGetDatum(object->objectId));
+ tup = SearchSysCache(PUBLICATIONREL,
+ ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(tup))
{
if (!missing_ok)
@@ -5973,7 +5973,7 @@ getOpFamilyIdentity(StringInfo buffer, Oid opfid, List **object,
Form_pg_am amForm;
char *schema;
- opfTup = SearchSysCache1(OPFAMILYOID, ObjectIdGetDatum(opfid));
+ opfTup = SearchSysCache(OPFAMILYOID, ObjectIdGetDatum(opfid));
if (!HeapTupleIsValid(opfTup))
{
if (!missing_ok)
@@ -5982,7 +5982,7 @@ getOpFamilyIdentity(StringInfo buffer, Oid opfid, List **object,
}
opfForm = (Form_pg_opfamily) GETSTRUCT(opfTup);
- amTup = SearchSysCache1(AMOID, ObjectIdGetDatum(opfForm->opfmethod));
+ amTup = SearchSysCache(AMOID, ObjectIdGetDatum(opfForm->opfmethod));
if (!HeapTupleIsValid(amTup))
elog(ERROR, "cache lookup failed for access method %u",
opfForm->opfmethod);
@@ -6015,8 +6015,8 @@ getRelationIdentity(StringInfo buffer, Oid relid, List **object,
Form_pg_class relForm;
char *schema;
- relTup = SearchSysCache1(RELOID,
- ObjectIdGetDatum(relid));
+ relTup = SearchSysCache(RELOID,
+ ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(relTup))
{
if (!missing_ok)
diff --git a/src/backend/catalog/partition.c b/src/backend/catalog/partition.c
index f8780ce57d..fbd83a139f 100644
--- a/src/backend/catalog/partition.c
+++ b/src/backend/catalog/partition.c
@@ -184,7 +184,7 @@ index_get_partition(Relation partition, Oid indexId)
Form_pg_class classForm;
bool ispartition;
- tup = SearchSysCache1(RELOID, ObjectIdGetDatum(partIdx));
+ tup = SearchSysCache(RELOID, ObjectIdGetDatum(partIdx));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for relation %u", partIdx);
classForm = (Form_pg_class) GETSTRUCT(tup);
@@ -316,7 +316,7 @@ get_default_partition_oid(Oid parentId)
HeapTuple tuple;
Oid defaultPartId = InvalidOid;
- tuple = SearchSysCache1(PARTRELID, ObjectIdGetDatum(parentId));
+ tuple = SearchSysCache(PARTRELID, ObjectIdGetDatum(parentId));
if (HeapTupleIsValid(tuple))
{
@@ -344,7 +344,7 @@ update_default_partition_oid(Oid parentId, Oid defaultPartId)
pg_partitioned_table = table_open(PartitionedRelationId, RowExclusiveLock);
- tuple = SearchSysCacheCopy1(PARTRELID, ObjectIdGetDatum(parentId));
+ tuple = SearchSysCacheCopy(PARTRELID, ObjectIdGetDatum(parentId));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for partition key of relation %u",
diff --git a/src/backend/catalog/pg_aggregate.c b/src/backend/catalog/pg_aggregate.c
index ebc4454743..6dc8d3fa9b 100644
--- a/src/backend/catalog/pg_aggregate.c
+++ b/src/backend/catalog/pg_aggregate.c
@@ -247,7 +247,7 @@ AggregateCreate(const char *aggName,
NameListToString(aggtransfnName),
format_type_be(aggTransType))));
- tup = SearchSysCache1(PROCOID, ObjectIdGetDatum(transfn));
+ tup = SearchSysCache(PROCOID, ObjectIdGetDatum(transfn));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for function %u", transfn);
proc = (Form_pg_proc) GETSTRUCT(tup);
@@ -291,7 +291,7 @@ AggregateCreate(const char *aggName,
NameListToString(aggmtransfnName),
format_type_be(aggmTransType))));
- tup = SearchSysCache1(PROCOID, ObjectIdGetDatum(mtransfn));
+ tup = SearchSysCache(PROCOID, ObjectIdGetDatum(mtransfn));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for function %u", mtransfn);
proc = (Form_pg_proc) GETSTRUCT(tup);
@@ -336,7 +336,7 @@ AggregateCreate(const char *aggName,
NameListToString(aggminvtransfnName),
format_type_be(aggmTransType))));
- tup = SearchSysCache1(PROCOID, ObjectIdGetDatum(minvtransfn));
+ tup = SearchSysCache(PROCOID, ObjectIdGetDatum(minvtransfn));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for function %u", minvtransfn);
proc = (Form_pg_proc) GETSTRUCT(tup);
@@ -686,7 +686,7 @@ AggregateCreate(const char *aggName,
nulls[Anum_pg_aggregate_aggminitval - 1] = true;
if (replace)
- oldtup = SearchSysCache1(AGGFNOID, ObjectIdGetDatum(procOid));
+ oldtup = SearchSysCache(AGGFNOID, ObjectIdGetDatum(procOid));
else
oldtup = NULL;
diff --git a/src/backend/catalog/pg_attrdef.c b/src/backend/catalog/pg_attrdef.c
index ade0b6d8e6..394e30bb09 100644
--- a/src/backend/catalog/pg_attrdef.c
+++ b/src/backend/catalog/pg_attrdef.c
@@ -95,9 +95,9 @@ StoreAttrDefault(Relation rel, AttrNumber attnum,
* exists.
*/
attrrel = table_open(AttributeRelationId, RowExclusiveLock);
- atttup = SearchSysCacheCopy2(ATTNUM,
- ObjectIdGetDatum(RelationGetRelid(rel)),
- Int16GetDatum(attnum));
+ atttup = SearchSysCacheCopy(ATTNUM,
+ ObjectIdGetDatum(RelationGetRelid(rel)),
+ Int16GetDatum(attnum));
if (!HeapTupleIsValid(atttup))
elog(ERROR, "cache lookup failed for attribute %d of relation %u",
attnum, RelationGetRelid(rel));
@@ -307,9 +307,9 @@ RemoveAttrDefaultById(Oid attrdefId)
/* Fix the pg_attribute row */
attr_rel = table_open(AttributeRelationId, RowExclusiveLock);
- tuple = SearchSysCacheCopy2(ATTNUM,
- ObjectIdGetDatum(myrelid),
- Int16GetDatum(myattnum));
+ tuple = SearchSysCacheCopy(ATTNUM,
+ ObjectIdGetDatum(myrelid),
+ Int16GetDatum(myattnum));
if (!HeapTupleIsValid(tuple)) /* shouldn't happen */
elog(ERROR, "cache lookup failed for attribute %d of relation %u",
myattnum, myrelid);
diff --git a/src/backend/catalog/pg_cast.c b/src/backend/catalog/pg_cast.c
index 1fee83c71b..0b90e40cad 100644
--- a/src/backend/catalog/pg_cast.c
+++ b/src/backend/catalog/pg_cast.c
@@ -66,9 +66,9 @@ CastCreate(Oid sourcetypeid, Oid targettypeid,
* the unique index would catch it anyway (so no need to sweat about race
* conditions).
*/
- tuple = SearchSysCache2(CASTSOURCETARGET,
- ObjectIdGetDatum(sourcetypeid),
- ObjectIdGetDatum(targettypeid));
+ tuple = SearchSysCache(CASTSOURCETARGET,
+ ObjectIdGetDatum(sourcetypeid),
+ ObjectIdGetDatum(targettypeid));
if (HeapTupleIsValid(tuple))
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT),
diff --git a/src/backend/catalog/pg_collation.c b/src/backend/catalog/pg_collation.c
index fd022e6fc2..b25a932769 100644
--- a/src/backend/catalog/pg_collation.c
+++ b/src/backend/catalog/pg_collation.c
@@ -77,10 +77,10 @@ CollationCreate(const char *collname, Oid collnamespace,
* friendlier error message. The unique index provides a backstop against
* race conditions.
*/
- oid = GetSysCacheOid3(COLLNAMEENCNSP,
- Anum_pg_collation_oid,
- PointerGetDatum(collname),
- Int32GetDatum(collencoding),
+ oid = GetSysCacheOid(COLLNAMEENCNSP,
+ Anum_pg_collation_oid,
+ PointerGetDatum(collname),
+ Int32GetDatum(collencoding),
ObjectIdGetDatum(collnamespace));
if (OidIsValid(oid))
{
@@ -126,17 +126,17 @@ CollationCreate(const char *collname, Oid collnamespace,
* concurrent changes fooling this check.
*/
if (collencoding == -1)
- oid = GetSysCacheOid3(COLLNAMEENCNSP,
- Anum_pg_collation_oid,
- PointerGetDatum(collname),
- Int32GetDatum(GetDatabaseEncoding()),
- ObjectIdGetDatum(collnamespace));
+ oid = GetSysCacheOid(COLLNAMEENCNSP,
+ Anum_pg_collation_oid,
+ PointerGetDatum(collname),
+ Int32GetDatum(GetDatabaseEncoding()),
+ ObjectIdGetDatum(collnamespace));
else
- oid = GetSysCacheOid3(COLLNAMEENCNSP,
- Anum_pg_collation_oid,
- PointerGetDatum(collname),
- Int32GetDatum(-1),
- ObjectIdGetDatum(collnamespace));
+ oid = GetSysCacheOid(COLLNAMEENCNSP,
+ Anum_pg_collation_oid,
+ PointerGetDatum(collname),
+ Int32GetDatum(-1),
+ ObjectIdGetDatum(collnamespace));
if (OidIsValid(oid))
{
if (quiet)
diff --git a/src/backend/catalog/pg_constraint.c b/src/backend/catalog/pg_constraint.c
index 4002317f70..e0f29cd8f5 100644
--- a/src/backend/catalog/pg_constraint.c
+++ b/src/backend/catalog/pg_constraint.c
@@ -574,7 +574,7 @@ RemoveConstraintById(Oid conId)
conDesc = table_open(ConstraintRelationId, RowExclusiveLock);
- tup = SearchSysCache1(CONSTROID, ObjectIdGetDatum(conId));
+ tup = SearchSysCache(CONSTROID, ObjectIdGetDatum(conId));
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for constraint %u", conId);
con = (Form_pg_constraint) GETSTRUCT(tup);
@@ -604,8 +604,8 @@ RemoveConstraintById(Oid conId)
Form_pg_class classForm;
pgrel = table_open(RelationRelationId, RowExclusiveLock);
- relTup = SearchSysCacheCopy1(RELOID,
- ObjectIdGetDatum(con->conrelid));
+ relTup = SearchSysCacheCopy(RELOID,
+ ObjectIdGetDatum(con->conrelid));
if (!HeapTupleIsValid(relTup))
elog(ERROR, "cache lookup failed for relation %u",
con->conrelid);
@@ -665,7 +665,7 @@ RenameConstraintById(Oid conId, const char *newname)
conDesc = table_open(ConstraintRelationId, RowExclusiveLock);
- tuple = SearchSysCacheCopy1(CONSTROID, ObjectIdGetDatum(conId));
+ tuple = SearchSysCacheCopy(CONSTROID, ObjectIdGetDatum(conId));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for constraint %u", conId);
con = (Form_pg_constraint) GETSTRUCT(tuple);
@@ -790,7 +790,7 @@ ConstraintSetParentConstraint(Oid childConstrId,
ObjectAddress referenced;
constrRel = table_open(ConstraintRelationId, RowExclusiveLock);
- tuple = SearchSysCache1(CONSTROID, ObjectIdGetDatum(childConstrId));
+ tuple = SearchSysCache(CONSTROID, ObjectIdGetDatum(childConstrId));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for constraint %u", childConstrId);
newtup = heap_copytuple(tuple);
diff --git a/src/backend/catalog/pg_conversion.c b/src/backend/catalog/pg_conversion.c
index 65e9f355d2..99ef767975 100644
--- a/src/backend/catalog/pg_conversion.c
+++ b/src/backend/catalog/pg_conversion.c
@@ -59,9 +59,9 @@ ConversionCreate(const char *conname, Oid connamespace,
elog(ERROR, "no conversion name supplied");
/* make sure there is no existing conversion of same name */
- if (SearchSysCacheExists2(CONNAMENSP,
- PointerGetDatum(conname),
- ObjectIdGetDatum(connamespace)))
+ if (SearchSysCacheExists(CONNAMENSP,
+ PointerGetDatum(conname),
+ ObjectIdGetDatum(connamespace)))
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT),
errmsg("conversion \"%s\" already exists", conname)));
@@ -160,10 +160,10 @@ FindDefaultConversion(Oid name_space, int32 for_encoding, int32 to_encoding)
Oid proc = InvalidOid;
int i;
- catlist = SearchSysCacheList3(CONDEFAULT,
- ObjectIdGetDatum(name_space),
- Int32GetDatum(for_encoding),
- Int32GetDatum(to_encoding));
+ catlist = SearchSysCacheList(CONDEFAULT,
+ ObjectIdGetDatum(name_space),
+ Int32GetDatum(for_encoding),
+ Int32GetDatum(to_encoding));
for (i = 0; i < catlist->n_members; i++)
{
diff --git a/src/backend/catalog/pg_enum.c b/src/backend/catalog/pg_enum.c
index 3c328664b2..1f7810d9a4 100644
--- a/src/backend/catalog/pg_enum.c
+++ b/src/backend/catalog/pg_enum.c
@@ -275,9 +275,9 @@ AddEnumLabel(Oid enumTypeOid,
* catch this anyway, but we prefer a friendlier error message, and
* besides we need a check to support IF NOT EXISTS.
*/
- enum_tup = SearchSysCache2(ENUMTYPOIDNAME,
- ObjectIdGetDatum(enumTypeOid),
- CStringGetDatum(newVal));
+ enum_tup = SearchSysCache(ENUMTYPOIDNAME,
+ ObjectIdGetDatum(enumTypeOid),
+ CStringGetDatum(newVal));
if (HeapTupleIsValid(enum_tup))
{
ReleaseSysCache(enum_tup);
@@ -302,8 +302,8 @@ AddEnumLabel(Oid enumTypeOid,
restart:
/* Get the list of existing members of the enum */
- list = SearchSysCacheList1(ENUMTYPOIDNAME,
- ObjectIdGetDatum(enumTypeOid));
+ list = SearchSysCacheList(ENUMTYPOIDNAME,
+ ObjectIdGetDatum(enumTypeOid));
nelems = list->n_members;
/* Sort the existing members by enumsortorder */
@@ -567,8 +567,8 @@ RenameEnumLabel(Oid enumTypeOid,
pg_enum = table_open(EnumRelationId, RowExclusiveLock);
/* Get the list of existing members of the enum */
- list = SearchSysCacheList1(ENUMTYPOIDNAME,
- ObjectIdGetDatum(enumTypeOid));
+ list = SearchSysCacheList(ENUMTYPOIDNAME,
+ ObjectIdGetDatum(enumTypeOid));
nelems = list->n_members;
/*
diff --git a/src/backend/catalog/pg_inherits.c b/src/backend/catalog/pg_inherits.c
index da969bd2f9..172a00d9ed 100644
--- a/src/backend/catalog/pg_inherits.c
+++ b/src/backend/catalog/pg_inherits.c
@@ -218,7 +218,7 @@ find_inheritance_children_extended(Oid parentrelId, bool omit_detached,
* really exists or not. If not, assume it was dropped while we
* waited to acquire lock, and ignore it.
*/
- if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(inhrelid)))
+ if (!SearchSysCacheExists(RELOID, ObjectIdGetDatum(inhrelid)))
{
/* Release useless lock */
UnlockRelationOid(inhrelid, lockmode);
@@ -358,7 +358,7 @@ has_subclass(Oid relationId)
HeapTuple tuple;
bool result;
- tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relationId));
+ tuple = SearchSysCache(RELOID, ObjectIdGetDatum(relationId));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", relationId);
diff --git a/src/backend/catalog/pg_namespace.c b/src/backend/catalog/pg_namespace.c
index 697ca32d83..ae3f0c4554 100644
--- a/src/backend/catalog/pg_namespace.c
+++ b/src/backend/catalog/pg_namespace.c
@@ -58,7 +58,7 @@ NamespaceCreate(const char *nspName, Oid ownerId, bool isTemp)
elog(ERROR, "no namespace name supplied");
/* make sure there is no existing namespace of same name */
- if (SearchSysCacheExists1(NAMESPACENAME, PointerGetDatum(nspName)))
+ if (SearchSysCacheExists(NAMESPACENAME, PointerGetDatum(nspName)))
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_SCHEMA),
errmsg("schema \"%s\" already exists", nspName)));
diff --git a/src/backend/catalog/pg_operator.c b/src/backend/catalog/pg_operator.c
index 792b0ef414..3c1ed303d4 100644
--- a/src/backend/catalog/pg_operator.c
+++ b/src/backend/catalog/pg_operator.c
@@ -136,11 +136,11 @@ OperatorGet(const char *operatorName,
HeapTuple tup;
Oid operatorObjectId;
- tup = SearchSysCache4(OPERNAMENSP,
- PointerGetDatum(operatorName),
- ObjectIdGetDatum(leftObjectId),
- ObjectIdGetDatum(rightObjectId),
- ObjectIdGetDatum(operatorNamespace));
+ tup = SearchSysCache(OPERNAMENSP,
+ PointerGetDatum(operatorName),
+ ObjectIdGetDatum(leftObjectId),
+ ObjectIdGetDatum(rightObjectId),
+ ObjectIdGetDatum(operatorNamespace));
if (HeapTupleIsValid(tup))
{
Form_pg_operator oprform = (Form_pg_operator) GETSTRUCT(tup);
@@ -515,8 +515,8 @@ OperatorCreate(const char *operatorName,
{
isUpdate = true;
- tup = SearchSysCacheCopy1(OPEROID,
- ObjectIdGetDatum(operatorObjectId));
+ tup = SearchSysCacheCopy(OPEROID,
+ ObjectIdGetDatum(operatorObjectId));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for operator %u",
operatorObjectId);
@@ -670,7 +670,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId, bool isDelete)
/* Get a writable copy of the commutator's tuple. */
if (OidIsValid(commId))
- tup = SearchSysCacheCopy1(OPEROID, ObjectIdGetDatum(commId));
+ tup = SearchSysCacheCopy(OPEROID, ObjectIdGetDatum(commId));
else
tup = NULL;
@@ -716,7 +716,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId, bool isDelete)
* Similarly find and update the negator, if any.
*/
if (OidIsValid(negId))
- tup = SearchSysCacheCopy1(OPEROID, ObjectIdGetDatum(negId));
+ tup = SearchSysCacheCopy(OPEROID, ObjectIdGetDatum(negId));
else
tup = NULL;
diff --git a/src/backend/catalog/pg_parameter_acl.c b/src/backend/catalog/pg_parameter_acl.c
index 073392e2c4..77a601a0cc 100644
--- a/src/backend/catalog/pg_parameter_acl.c
+++ b/src/backend/catalog/pg_parameter_acl.c
@@ -44,8 +44,8 @@ ParameterAclLookup(const char *parameter, bool missing_ok)
parname = convert_GUC_name_for_parameter_acl(parameter);
/* ... and look it up */
- oid = GetSysCacheOid1(PARAMETERACLNAME, Anum_pg_parameter_acl_oid,
- PointerGetDatum(cstring_to_text(parname)));
+ oid = GetSysCacheOid(PARAMETERACLNAME, Anum_pg_parameter_acl_oid,
+ PointerGetDatum(cstring_to_text(parname)));
if (!OidIsValid(oid) && !missing_ok)
ereport(ERROR,
diff --git a/src/backend/catalog/pg_proc.c b/src/backend/catalog/pg_proc.c
index 41fa2a4987..72a63dcc85 100644
--- a/src/backend/catalog/pg_proc.c
+++ b/src/backend/catalog/pg_proc.c
@@ -357,10 +357,10 @@ ProcedureCreate(const char *procedureName,
tupDesc = RelationGetDescr(rel);
/* Check for pre-existing definition */
- oldtup = SearchSysCache3(PROCNAMEARGSNSP,
- PointerGetDatum(procedureName),
- PointerGetDatum(parameterTypes),
- ObjectIdGetDatum(procNamespace));
+ oldtup = SearchSysCache(PROCNAMEARGSNSP,
+ PointerGetDatum(procedureName),
+ PointerGetDatum(parameterTypes),
+ ObjectIdGetDatum(procNamespace));
if (HeapTupleIsValid(oldtup))
{
@@ -740,7 +740,7 @@ fmgr_internal_validator(PG_FUNCTION_ARGS)
* name will be found later if it isn't there now.
*/
- tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcoid));
+ tuple = SearchSysCache(PROCOID, ObjectIdGetDatum(funcoid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for function %u", funcoid);
@@ -786,7 +786,7 @@ fmgr_c_validator(PG_FUNCTION_ARGS)
* and for pg_dump loading it's much better if we *do* check.
*/
- tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcoid));
+ tuple = SearchSysCache(PROCOID, ObjectIdGetDatum(funcoid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for function %u", funcoid);
@@ -830,7 +830,7 @@ fmgr_sql_validator(PG_FUNCTION_ARGS)
if (!CheckFunctionValidatorAccess(fcinfo->flinfo->fn_oid, funcoid))
PG_RETURN_VOID();
- tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcoid));
+ tuple = SearchSysCache(PROCOID, ObjectIdGetDatum(funcoid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for function %u", funcoid);
proc = (Form_pg_proc) GETSTRUCT(tuple);
diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index 47637f28ab..a76ecf6bb7 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -171,7 +171,7 @@ pg_relation_is_publishable(PG_FUNCTION_ARGS)
HeapTuple tuple;
bool result;
- tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
+ tuple = SearchSysCache(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tuple))
PG_RETURN_NULL();
result = is_publishable_class(relid, (Form_pg_class) GETSTRUCT(tuple));
@@ -384,8 +384,8 @@ publication_add_relation(Oid pubid, PublicationRelInfo *pri,
* duplicates, it's here just to provide nicer error message in common
* case. The real protection is the unique key on the catalog.
*/
- if (SearchSysCacheExists2(PUBLICATIONRELMAP, ObjectIdGetDatum(relid),
- ObjectIdGetDatum(pubid)))
+ if (SearchSysCacheExists(PUBLICATIONRELMAP, ObjectIdGetDatum(relid),
+ ObjectIdGetDatum(pubid)))
{
table_close(rel, RowExclusiveLock);
@@ -627,9 +627,9 @@ publication_add_schema(Oid pubid, Oid schemaid, bool if_not_exists)
* duplicates, it's here just to provide nicer error message in common
* case. The real protection is the unique key on the catalog.
*/
- if (SearchSysCacheExists2(PUBLICATIONNAMESPACEMAP,
- ObjectIdGetDatum(schemaid),
- ObjectIdGetDatum(pubid)))
+ if (SearchSysCacheExists(PUBLICATIONNAMESPACEMAP,
+ ObjectIdGetDatum(schemaid),
+ ObjectIdGetDatum(pubid)))
{
table_close(rel, RowExclusiveLock);
@@ -696,8 +696,8 @@ GetRelationPublications(Oid relid)
int i;
/* Find all publications associated with the relation. */
- pubrellist = SearchSysCacheList1(PUBLICATIONRELMAP,
- ObjectIdGetDatum(relid));
+ pubrellist = SearchSysCacheList(PUBLICATIONRELMAP,
+ ObjectIdGetDatum(relid));
for (i = 0; i < pubrellist->n_members; i++)
{
HeapTuple tup = &pubrellist->members[i]->tuple;
@@ -908,8 +908,8 @@ GetSchemaPublications(Oid schemaid)
int i;
/* Find all publications associated with the schema */
- pubschlist = SearchSysCacheList1(PUBLICATIONNAMESPACEMAP,
- ObjectIdGetDatum(schemaid));
+ pubschlist = SearchSysCacheList(PUBLICATIONNAMESPACEMAP,
+ ObjectIdGetDatum(schemaid));
for (i = 0; i < pubschlist->n_members; i++)
{
HeapTuple tup = &pubschlist->members[i]->tuple;
@@ -1014,7 +1014,7 @@ GetPublication(Oid pubid)
Publication *pub;
Form_pg_publication pubform;
- tup = SearchSysCache1(PUBLICATIONOID, ObjectIdGetDatum(pubid));
+ tup = SearchSysCache(PUBLICATIONOID, ObjectIdGetDatum(pubid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for publication %u", pubid);
@@ -1197,12 +1197,12 @@ pg_get_publication_tables(PG_FUNCTION_ARGS)
* FOR TABLES IN SCHEMA publications.
*/
if (!pub->alltables &&
- !SearchSysCacheExists2(PUBLICATIONNAMESPACEMAP,
- ObjectIdGetDatum(schemaid),
- ObjectIdGetDatum(pub->oid)))
- pubtuple = SearchSysCacheCopy2(PUBLICATIONRELMAP,
- ObjectIdGetDatum(relid),
- ObjectIdGetDatum(pub->oid));
+ !SearchSysCacheExists(PUBLICATIONNAMESPACEMAP,
+ ObjectIdGetDatum(schemaid),
+ ObjectIdGetDatum(pub->oid)))
+ pubtuple = SearchSysCacheCopy(PUBLICATIONRELMAP,
+ ObjectIdGetDatum(relid),
+ ObjectIdGetDatum(pub->oid));
if (HeapTupleIsValid(pubtuple))
{
diff --git a/src/backend/catalog/pg_shdepend.c b/src/backend/catalog/pg_shdepend.c
index 64d326f073..824ecff20b 100644
--- a/src/backend/catalog/pg_shdepend.c
+++ b/src/backend/catalog/pg_shdepend.c
@@ -1171,7 +1171,7 @@ shdepLockAndCheckObject(Oid classId, Oid objectId)
switch (classId)
{
case AuthIdRelationId:
- if (!SearchSysCacheExists1(AUTHOID, ObjectIdGetDatum(objectId)))
+ if (!SearchSysCacheExists(AUTHOID, ObjectIdGetDatum(objectId)))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("role %u was concurrently dropped",
diff --git a/src/backend/catalog/pg_subscription.c b/src/backend/catalog/pg_subscription.c
index 87e8ea7efa..2319f6481b 100644
--- a/src/backend/catalog/pg_subscription.c
+++ b/src/backend/catalog/pg_subscription.c
@@ -48,7 +48,7 @@ GetSubscription(Oid subid, bool missing_ok)
Datum datum;
bool isnull;
- tup = SearchSysCache1(SUBSCRIPTIONOID, ObjectIdGetDatum(subid));
+ tup = SearchSysCache(SUBSCRIPTIONOID, ObjectIdGetDatum(subid));
if (!HeapTupleIsValid(tup))
{
@@ -173,7 +173,7 @@ DisableSubscription(Oid subid)
/* Look up the subscription in the catalog */
rel = table_open(SubscriptionRelationId, RowExclusiveLock);
- tup = SearchSysCacheCopy1(SUBSCRIPTIONOID, ObjectIdGetDatum(subid));
+ tup = SearchSysCacheCopy(SUBSCRIPTIONOID, ObjectIdGetDatum(subid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for subscription %u", subid);
@@ -239,9 +239,9 @@ AddSubscriptionRelState(Oid subid, Oid relid, char state,
rel = table_open(SubscriptionRelRelationId, RowExclusiveLock);
/* Try finding existing mapping. */
- tup = SearchSysCacheCopy2(SUBSCRIPTIONRELMAP,
- ObjectIdGetDatum(relid),
- ObjectIdGetDatum(subid));
+ tup = SearchSysCacheCopy(SUBSCRIPTIONRELMAP,
+ ObjectIdGetDatum(relid),
+ ObjectIdGetDatum(subid));
if (HeapTupleIsValid(tup))
elog(ERROR, "subscription table %u in subscription %u already exists",
relid, subid);
@@ -286,9 +286,9 @@ UpdateSubscriptionRelState(Oid subid, Oid relid, char state,
rel = table_open(SubscriptionRelRelationId, RowExclusiveLock);
/* Try finding existing mapping. */
- tup = SearchSysCacheCopy2(SUBSCRIPTIONRELMAP,
- ObjectIdGetDatum(relid),
- ObjectIdGetDatum(subid));
+ tup = SearchSysCacheCopy(SUBSCRIPTIONRELMAP,
+ ObjectIdGetDatum(relid),
+ ObjectIdGetDatum(subid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "subscription table %u in subscription %u does not exist",
relid, subid);
@@ -338,9 +338,9 @@ GetSubscriptionRelState(Oid subid, Oid relid, XLogRecPtr *sublsn)
rel = table_open(SubscriptionRelRelationId, AccessShareLock);
/* Try finding the mapping. */
- tup = SearchSysCache2(SUBSCRIPTIONRELMAP,
- ObjectIdGetDatum(relid),
- ObjectIdGetDatum(subid));
+ tup = SearchSysCache(SUBSCRIPTIONRELMAP,
+ ObjectIdGetDatum(relid),
+ ObjectIdGetDatum(subid));
if (!HeapTupleIsValid(tup))
{
diff --git a/src/backend/catalog/pg_type.c b/src/backend/catalog/pg_type.c
index 7fbda5301f..38806a19d7 100644
--- a/src/backend/catalog/pg_type.c
+++ b/src/backend/catalog/pg_type.c
@@ -417,9 +417,9 @@ TypeCreate(Oid newTypeOid,
*/
pg_type_desc = table_open(TypeRelationId, RowExclusiveLock);
- tup = SearchSysCacheCopy2(TYPENAMENSP,
- CStringGetDatum(typeName),
- ObjectIdGetDatum(typeNamespace));
+ tup = SearchSysCacheCopy(TYPENAMENSP,
+ CStringGetDatum(typeName),
+ ObjectIdGetDatum(typeNamespace));
if (HeapTupleIsValid(tup))
{
Form_pg_type typform = (Form_pg_type) GETSTRUCT(tup);
@@ -749,7 +749,7 @@ RenameTypeInternal(Oid typeOid, const char *newTypeName, Oid typeNamespace)
pg_type_desc = table_open(TypeRelationId, RowExclusiveLock);
- tuple = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(typeOid));
+ tuple = SearchSysCacheCopy(TYPEOID, ObjectIdGetDatum(typeOid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for type %u", typeOid);
typ = (Form_pg_type) GETSTRUCT(tuple);
@@ -760,9 +760,9 @@ RenameTypeInternal(Oid typeOid, const char *newTypeName, Oid typeNamespace)
arrayOid = typ->typarray;
/* Check for a conflicting type name. */
- oldTypeOid = GetSysCacheOid2(TYPENAMENSP, Anum_pg_type_oid,
- CStringGetDatum(newTypeName),
- ObjectIdGetDatum(typeNamespace));
+ oldTypeOid = GetSysCacheOid(TYPENAMENSP, Anum_pg_type_oid,
+ CStringGetDatum(newTypeName),
+ ObjectIdGetDatum(typeNamespace));
/*
* If there is one, see if it's an autogenerated array type, and if so
@@ -839,9 +839,9 @@ makeArrayTypeName(const char *typeName, Oid typeNamespace)
for (;;)
{
- if (!SearchSysCacheExists2(TYPENAMENSP,
- CStringGetDatum(arr_name),
- ObjectIdGetDatum(typeNamespace)))
+ if (!SearchSysCacheExists(TYPENAMENSP,
+ CStringGetDatum(arr_name),
+ ObjectIdGetDatum(typeNamespace)))
break;
/* That attempt conflicted. Prepare a new name with some digits. */
@@ -946,9 +946,9 @@ makeMultirangeTypeName(const char *rangeTypeName, Oid typeNamespace)
/* clip it at NAMEDATALEN-1 bytes */
buf[pg_mbcliplen(buf, strlen(buf), NAMEDATALEN - 1)] = '\0';
- if (SearchSysCacheExists2(TYPENAMENSP,
- CStringGetDatum(buf),
- ObjectIdGetDatum(typeNamespace)))
+ if (SearchSysCacheExists(TYPENAMENSP,
+ CStringGetDatum(buf),
+ ObjectIdGetDatum(typeNamespace)))
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT),
errmsg("type \"%s\" already exists", buf),
diff --git a/src/backend/catalog/toasting.c b/src/backend/catalog/toasting.c
index ab12b0b9de..76a9c1cb03 100644
--- a/src/backend/catalog/toasting.c
+++ b/src/backend/catalog/toasting.c
@@ -337,7 +337,7 @@ create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid,
*/
class_rel = table_open(RelationRelationId, RowExclusiveLock);
- reltup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relOid));
+ reltup = SearchSysCacheCopy(RELOID, ObjectIdGetDatum(relOid));
if (!HeapTupleIsValid(reltup))
elog(ERROR, "cache lookup failed for relation %u", relOid);
diff --git a/src/backend/commands/alter.c b/src/backend/commands/alter.c
index 10f28f94bc..87caee77a2 100644
--- a/src/backend/commands/alter.c
+++ b/src/backend/commands/alter.c
@@ -186,7 +186,7 @@ AlterObjectRename_internal(Relation rel, Oid objectId, const char *new_name)
bool *replaces;
NameData nameattrdata;
- oldtup = SearchSysCache1(oidCacheId, ObjectIdGetDatum(objectId));
+ oldtup = SearchSysCache(oidCacheId, ObjectIdGetDatum(objectId));
if (!HeapTupleIsValid(oldtup))
elog(ERROR, "cache lookup failed for object %u of catalog \"%s\"",
objectId, RelationGetRelationName(rel));
@@ -295,8 +295,8 @@ AlterObjectRename_internal(Relation rel, Oid objectId, const char *new_name)
}
else if (classId == SubscriptionRelationId)
{
- if (SearchSysCacheExists2(SUBSCRIPTIONNAME, MyDatabaseId,
- CStringGetDatum(new_name)))
+ if (SearchSysCacheExists(SUBSCRIPTIONNAME, MyDatabaseId,
+ CStringGetDatum(new_name)))
report_name_conflict(classId, new_name);
/* Also enforce regression testing naming rules, if enabled */
@@ -312,15 +312,15 @@ AlterObjectRename_internal(Relation rel, Oid objectId, const char *new_name)
{
if (OidIsValid(namespaceId))
{
- if (SearchSysCacheExists2(nameCacheId,
- CStringGetDatum(new_name),
- ObjectIdGetDatum(namespaceId)))
+ if (SearchSysCacheExists(nameCacheId,
+ CStringGetDatum(new_name),
+ ObjectIdGetDatum(namespaceId)))
report_namespace_conflict(classId, new_name, namespaceId);
}
else
{
- if (SearchSysCacheExists1(nameCacheId,
- CStringGetDatum(new_name)))
+ if (SearchSysCacheExists(nameCacheId,
+ CStringGetDatum(new_name)))
report_name_conflict(classId, new_name);
}
}
@@ -736,7 +736,7 @@ AlterObjectNamespace_internal(Relation rel, Oid objid, Oid nspOid)
bool *nulls;
bool *replaces;
- tup = SearchSysCacheCopy1(oidCacheId, ObjectIdGetDatum(objid));
+ tup = SearchSysCacheCopy(oidCacheId, ObjectIdGetDatum(objid));
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for object %u of catalog \"%s\"",
objid, RelationGetRelationName(rel));
@@ -824,8 +824,8 @@ AlterObjectNamespace_internal(Relation rel, Oid objid, Oid nspOid)
opf->opfmethod, nspOid);
}
else if (nameCacheId >= 0 &&
- SearchSysCacheExists2(nameCacheId, name,
- ObjectIdGetDatum(nspOid)))
+ SearchSysCacheExists(nameCacheId, name,
+ ObjectIdGetDatum(nspOid)))
report_namespace_conflict(classId,
NameStr(*(DatumGetName(name))),
nspOid);
diff --git a/src/backend/commands/amcmds.c b/src/backend/commands/amcmds.c
index 2050619123..fa8e2a86d3 100644
--- a/src/backend/commands/amcmds.c
+++ b/src/backend/commands/amcmds.c
@@ -62,7 +62,7 @@ CreateAccessMethod(CreateAmStmt *stmt)
errhint("Must be superuser to create an access method.")));
/* Check if name is used */
- amoid = GetSysCacheOid1(AMNAME, Anum_pg_am_oid,
+ amoid = GetSysCacheOid(AMNAME, Anum_pg_am_oid,
CStringGetDatum(stmt->amname));
if (OidIsValid(amoid))
{
@@ -131,7 +131,7 @@ get_am_type_oid(const char *amname, char amtype, bool missing_ok)
HeapTuple tup;
Oid oid = InvalidOid;
- tup = SearchSysCache1(AMNAME, CStringGetDatum(amname));
+ tup = SearchSysCache(AMNAME, CStringGetDatum(amname));
if (HeapTupleIsValid(tup))
{
Form_pg_am amform = (Form_pg_am) GETSTRUCT(tup);
@@ -194,7 +194,7 @@ get_am_name(Oid amOid)
HeapTuple tup;
char *result = NULL;
- tup = SearchSysCache1(AMOID, ObjectIdGetDatum(amOid));
+ tup = SearchSysCache(AMOID, ObjectIdGetDatum(amOid));
if (HeapTupleIsValid(tup))
{
Form_pg_am amform = (Form_pg_am) GETSTRUCT(tup);
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c
index 65750958bb..ce19ad8ebb 100644
--- a/src/backend/commands/analyze.c
+++ b/src/backend/commands/analyze.c
@@ -1051,8 +1051,8 @@ examine_attribute(Relation onerel, int attnum, Node *index_expr)
stats->attrcollid = attr->attcollation;
}
- typtuple = SearchSysCacheCopy1(TYPEOID,
- ObjectIdGetDatum(stats->attrtypid));
+ typtuple = SearchSysCacheCopy(TYPEOID,
+ ObjectIdGetDatum(stats->attrtypid));
if (!HeapTupleIsValid(typtuple))
elog(ERROR, "cache lookup failed for type %u", stats->attrtypid);
stats->attrtype = (Form_pg_type) GETSTRUCT(typtuple);
@@ -1720,10 +1720,10 @@ update_attstats(Oid relid, bool inh, int natts, VacAttrStats **vacattrstats)
}
/* Is there already a pg_statistic tuple for this attribute? */
- oldtup = SearchSysCache3(STATRELATTINH,
- ObjectIdGetDatum(relid),
- Int16GetDatum(stats->attr->attnum),
- BoolGetDatum(inh));
+ oldtup = SearchSysCache(STATRELATTINH,
+ ObjectIdGetDatum(relid),
+ Int16GetDatum(stats->attr->attnum),
+ BoolGetDatum(inh));
/* Open index information when we know we need it */
if (indstate == NULL)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 369fea7c04..283278a656 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -393,7 +393,7 @@ cluster_rel(Oid tableOid, Oid indexOid, ClusterParams *params)
/*
* Check that the index still exists
*/
- if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(indexOid)))
+ if (!SearchSysCacheExists(RELOID, ObjectIdGetDatum(indexOid)))
{
relation_close(OldHeap, AccessExclusiveLock);
goto out;
@@ -590,8 +590,8 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
{
Oid thisIndexOid = lfirst_oid(index);
- indexTuple = SearchSysCacheCopy1(INDEXRELID,
- ObjectIdGetDatum(thisIndexOid));
+ indexTuple = SearchSysCacheCopy(INDEXRELID,
+ ObjectIdGetDatum(thisIndexOid));
if (!HeapTupleIsValid(indexTuple))
elog(ERROR, "cache lookup failed for index %u", thisIndexOid);
indexForm = (Form_pg_index) GETSTRUCT(indexTuple);
@@ -713,7 +713,7 @@ make_new_heap(Oid OIDOldHeap, Oid NewTableSpace, Oid NewAccessMethod,
/*
* But we do want to use reloptions of the old heap for new heap.
*/
- tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(OIDOldHeap));
+ tuple = SearchSysCache(RELOID, ObjectIdGetDatum(OIDOldHeap));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", OIDOldHeap);
reloptions = SysCacheGetAttr(RELOID, tuple, Anum_pg_class_reloptions,
@@ -786,7 +786,7 @@ make_new_heap(Oid OIDOldHeap, Oid NewTableSpace, Oid NewAccessMethod,
if (OidIsValid(toastid))
{
/* keep the existing toast table's reloptions, if any */
- tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(toastid));
+ tuple = SearchSysCache(RELOID, ObjectIdGetDatum(toastid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", toastid);
reloptions = SysCacheGetAttr(RELOID, tuple, Anum_pg_class_reloptions,
@@ -1005,7 +1005,7 @@ copy_table_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex, bool verbose,
/* Update pg_class to reflect the correct values of pages and tuples. */
relRelation = table_open(RelationRelationId, RowExclusiveLock);
- reltup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(OIDNewHeap));
+ reltup = SearchSysCacheCopy(RELOID, ObjectIdGetDatum(OIDNewHeap));
if (!HeapTupleIsValid(reltup))
elog(ERROR, "cache lookup failed for relation %u", OIDNewHeap);
relform = (Form_pg_class) GETSTRUCT(reltup);
@@ -1074,12 +1074,12 @@ swap_relation_files(Oid r1, Oid r2, bool target_is_pg_class,
/* We need writable copies of both pg_class tuples. */
relRelation = table_open(RelationRelationId, RowExclusiveLock);
- reltup1 = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(r1));
+ reltup1 = SearchSysCacheCopy(RELOID, ObjectIdGetDatum(r1));
if (!HeapTupleIsValid(reltup1))
elog(ERROR, "cache lookup failed for relation %u", r1);
relform1 = (Form_pg_class) GETSTRUCT(reltup1);
- reltup2 = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(r2));
+ reltup2 = SearchSysCacheCopy(RELOID, ObjectIdGetDatum(r2));
if (!HeapTupleIsValid(reltup2))
elog(ERROR, "cache lookup failed for relation %u", r2);
relform2 = (Form_pg_class) GETSTRUCT(reltup2);
@@ -1517,7 +1517,7 @@ finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
relRelation = table_open(RelationRelationId, RowExclusiveLock);
- reltup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(OIDOldHeap));
+ reltup = SearchSysCacheCopy(RELOID, ObjectIdGetDatum(OIDOldHeap));
if (!HeapTupleIsValid(reltup))
elog(ERROR, "cache lookup failed for relation %u", OIDOldHeap);
relform = (Form_pg_class) GETSTRUCT(reltup);
diff --git a/src/backend/commands/collationcmds.c b/src/backend/commands/collationcmds.c
index 45de78352c..0288e9f2e3 100644
--- a/src/backend/commands/collationcmds.c
+++ b/src/backend/commands/collationcmds.c
@@ -139,7 +139,7 @@ DefineCollation(ParseState *pstate, List *names, List *parameters, bool if_not_e
bool isnull;
collid = get_collation_oid(defGetQualifiedName(fromEl), false);
- tp = SearchSysCache1(COLLOID, ObjectIdGetDatum(collid));
+ tp = SearchSysCache(COLLOID, ObjectIdGetDatum(collid));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for collation %u", collid);
@@ -349,10 +349,10 @@ void
IsThereCollationInNamespace(const char *collname, Oid nspOid)
{
/* make sure the name doesn't already exist in new schema */
- if (SearchSysCacheExists3(COLLNAMEENCNSP,
- CStringGetDatum(collname),
- Int32GetDatum(GetDatabaseEncoding()),
- ObjectIdGetDatum(nspOid)))
+ if (SearchSysCacheExists(COLLNAMEENCNSP,
+ CStringGetDatum(collname),
+ Int32GetDatum(GetDatabaseEncoding()),
+ ObjectIdGetDatum(nspOid)))
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT),
errmsg("collation \"%s\" for encoding \"%s\" already exists in schema \"%s\"",
@@ -360,10 +360,10 @@ IsThereCollationInNamespace(const char *collname, Oid nspOid)
get_namespace_name(nspOid))));
/* mustn't match an any-encoding entry, either */
- if (SearchSysCacheExists3(COLLNAMEENCNSP,
- CStringGetDatum(collname),
- Int32GetDatum(-1),
- ObjectIdGetDatum(nspOid)))
+ if (SearchSysCacheExists(COLLNAMEENCNSP,
+ CStringGetDatum(collname),
+ Int32GetDatum(-1),
+ ObjectIdGetDatum(nspOid)))
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT),
errmsg("collation \"%s\" already exists in schema \"%s\"",
@@ -398,7 +398,7 @@ AlterCollation(AlterCollationStmt *stmt)
aclcheck_error(ACLCHECK_NOT_OWNER, OBJECT_COLLATION,
NameListToString(stmt->collname));
- tup = SearchSysCacheCopy1(COLLOID, ObjectIdGetDatum(collOid));
+ tup = SearchSysCacheCopy(COLLOID, ObjectIdGetDatum(collOid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for collation %u", collOid);
@@ -462,7 +462,7 @@ pg_collation_actual_version(PG_FUNCTION_ARGS)
{
/* retrieve from pg_database */
- HeapTuple dbtup = SearchSysCache1(DATABASEOID, ObjectIdGetDatum(MyDatabaseId));
+ HeapTuple dbtup = SearchSysCache(DATABASEOID, ObjectIdGetDatum(MyDatabaseId));
if (!HeapTupleIsValid(dbtup))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -482,7 +482,7 @@ pg_collation_actual_version(PG_FUNCTION_ARGS)
{
/* retrieve from pg_collation */
- HeapTuple colltp = SearchSysCache1(COLLOID, ObjectIdGetDatum(collid));
+ HeapTuple colltp = SearchSysCache(COLLOID, ObjectIdGetDatum(collid));
if (!HeapTupleIsValid(colltp))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -798,7 +798,7 @@ pg_import_system_collations(PG_FUNCTION_ARGS)
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("must be superuser to import system collations")));
- if (!SearchSysCacheExists1(NAMESPACEOID, ObjectIdGetDatum(nspid)))
+ if (!SearchSysCacheExists(NAMESPACEOID, ObjectIdGetDatum(nspid)))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_SCHEMA),
errmsg("schema with OID %u does not exist", nspid)));
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index 24bcc5adfe..f46cb094ef 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -1667,7 +1667,7 @@ dropdb(const char *dbname, bool missing_ok, bool force)
/*
* Remove the database's tuple from pg_database.
*/
- tup = SearchSysCache1(DATABASEOID, ObjectIdGetDatum(db_id));
+ tup = SearchSysCache(DATABASEOID, ObjectIdGetDatum(db_id));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for database %u", db_id);
@@ -1824,7 +1824,7 @@ RenameDatabase(const char *oldname, const char *newname)
errdetail_busy_db(notherbackends, npreparedxacts)));
/* rename */
- newtup = SearchSysCacheCopy1(DATABASEOID, ObjectIdGetDatum(db_id));
+ newtup = SearchSysCacheCopy(DATABASEOID, ObjectIdGetDatum(db_id));
if (!HeapTupleIsValid(newtup))
elog(ERROR, "cache lookup failed for database %u", db_id);
namestrcpy(&(((Form_pg_database) GETSTRUCT(newtup))->datname), newname);
@@ -2599,7 +2599,7 @@ pg_database_collation_actual_version(PG_FUNCTION_ARGS)
Datum datum;
char *version;
- tp = SearchSysCache1(DATABASEOID, ObjectIdGetDatum(dbid));
+ tp = SearchSysCache(DATABASEOID, ObjectIdGetDatum(dbid));
if (!HeapTupleIsValid(tp))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -2695,7 +2695,7 @@ get_db_info(const char *name, LOCKMODE lockmode,
* the same name, we win; else, drop the lock and loop back to try
* again.
*/
- tuple = SearchSysCache1(DATABASEOID, ObjectIdGetDatum(dbOid));
+ tuple = SearchSysCache(DATABASEOID, ObjectIdGetDatum(dbOid));
if (HeapTupleIsValid(tuple))
{
Form_pg_database dbform = (Form_pg_database) GETSTRUCT(tuple);
@@ -2794,7 +2794,7 @@ have_createdb_privilege(void)
if (superuser())
return true;
- utup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(GetUserId()));
+ utup = SearchSysCache(AUTHOID, ObjectIdGetDatum(GetUserId()));
if (HeapTupleIsValid(utup))
{
result = ((Form_pg_authid) GETSTRUCT(utup))->rolcreatedb;
@@ -3025,7 +3025,7 @@ get_database_name(Oid dbid)
HeapTuple dbtuple;
char *result;
- dbtuple = SearchSysCache1(DATABASEOID, ObjectIdGetDatum(dbid));
+ dbtuple = SearchSysCache(DATABASEOID, ObjectIdGetDatum(dbid));
if (HeapTupleIsValid(dbtuple))
{
result = pstrdup(NameStr(((Form_pg_database) GETSTRUCT(dbtuple))->datname));
diff --git a/src/backend/commands/event_trigger.c b/src/backend/commands/event_trigger.c
index d4b00d1a82..328b30409b 100644
--- a/src/backend/commands/event_trigger.c
+++ b/src/backend/commands/event_trigger.c
@@ -167,7 +167,7 @@ CreateEventTrigger(CreateEventTrigStmt *stmt)
* Give user a nice error message if an event trigger of the same name
* already exists.
*/
- tuple = SearchSysCache1(EVENTTRIGGERNAME, CStringGetDatum(stmt->trigname));
+ tuple = SearchSysCache(EVENTTRIGGERNAME, CStringGetDatum(stmt->trigname));
if (HeapTupleIsValid(tuple))
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT),
@@ -368,8 +368,8 @@ AlterEventTrigger(AlterEventTrigStmt *stmt)
tgrel = table_open(EventTriggerRelationId, RowExclusiveLock);
- tup = SearchSysCacheCopy1(EVENTTRIGGERNAME,
- CStringGetDatum(stmt->trigname));
+ tup = SearchSysCacheCopy(EVENTTRIGGERNAME,
+ CStringGetDatum(stmt->trigname));
if (!HeapTupleIsValid(tup))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -412,7 +412,7 @@ AlterEventTriggerOwner(const char *name, Oid newOwnerId)
rel = table_open(EventTriggerRelationId, RowExclusiveLock);
- tup = SearchSysCacheCopy1(EVENTTRIGGERNAME, CStringGetDatum(name));
+ tup = SearchSysCacheCopy(EVENTTRIGGERNAME, CStringGetDatum(name));
if (!HeapTupleIsValid(tup))
ereport(ERROR,
@@ -444,7 +444,7 @@ AlterEventTriggerOwner_oid(Oid trigOid, Oid newOwnerId)
rel = table_open(EventTriggerRelationId, RowExclusiveLock);
- tup = SearchSysCacheCopy1(EVENTTRIGGEROID, ObjectIdGetDatum(trigOid));
+ tup = SearchSysCacheCopy(EVENTTRIGGEROID, ObjectIdGetDatum(trigOid));
if (!HeapTupleIsValid(tup))
ereport(ERROR,
@@ -506,8 +506,8 @@ get_event_trigger_oid(const char *trigname, bool missing_ok)
{
Oid oid;
- oid = GetSysCacheOid1(EVENTTRIGGERNAME, Anum_pg_event_trigger_oid,
- CStringGetDatum(trigname));
+ oid = GetSysCacheOid(EVENTTRIGGERNAME, Anum_pg_event_trigger_oid,
+ CStringGetDatum(trigname));
if (!OidIsValid(oid) && !missing_ok)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
diff --git a/src/backend/commands/foreigncmds.c b/src/backend/commands/foreigncmds.c
index 0ecff545a9..24cba1b1ac 100644
--- a/src/backend/commands/foreigncmds.c
+++ b/src/backend/commands/foreigncmds.c
@@ -283,7 +283,7 @@ AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId)
rel = table_open(ForeignDataWrapperRelationId, RowExclusiveLock);
- tup = SearchSysCacheCopy1(FOREIGNDATAWRAPPERNAME, CStringGetDatum(name));
+ tup = SearchSysCacheCopy(FOREIGNDATAWRAPPERNAME, CStringGetDatum(name));
if (!HeapTupleIsValid(tup))
ereport(ERROR,
@@ -317,7 +317,7 @@ AlterForeignDataWrapperOwner_oid(Oid fwdId, Oid newOwnerId)
rel = table_open(ForeignDataWrapperRelationId, RowExclusiveLock);
- tup = SearchSysCacheCopy1(FOREIGNDATAWRAPPEROID, ObjectIdGetDatum(fwdId));
+ tup = SearchSysCacheCopy(FOREIGNDATAWRAPPEROID, ObjectIdGetDatum(fwdId));
if (!HeapTupleIsValid(tup))
ereport(ERROR,
@@ -422,7 +422,7 @@ AlterForeignServerOwner(const char *name, Oid newOwnerId)
rel = table_open(ForeignServerRelationId, RowExclusiveLock);
- tup = SearchSysCacheCopy1(FOREIGNSERVERNAME, CStringGetDatum(name));
+ tup = SearchSysCacheCopy(FOREIGNSERVERNAME, CStringGetDatum(name));
if (!HeapTupleIsValid(tup))
ereport(ERROR,
@@ -454,7 +454,7 @@ AlterForeignServerOwner_oid(Oid srvId, Oid newOwnerId)
rel = table_open(ForeignServerRelationId, RowExclusiveLock);
- tup = SearchSysCacheCopy1(FOREIGNSERVEROID, ObjectIdGetDatum(srvId));
+ tup = SearchSysCacheCopy(FOREIGNSERVEROID, ObjectIdGetDatum(srvId));
if (!HeapTupleIsValid(tup))
ereport(ERROR,
@@ -698,8 +698,8 @@ AlterForeignDataWrapper(ParseState *pstate, AlterFdwStmt *stmt)
stmt->fdwname),
errhint("Must be superuser to alter a foreign-data wrapper.")));
- tp = SearchSysCacheCopy1(FOREIGNDATAWRAPPERNAME,
- CStringGetDatum(stmt->fdwname));
+ tp = SearchSysCacheCopy(FOREIGNDATAWRAPPERNAME,
+ CStringGetDatum(stmt->fdwname));
if (!HeapTupleIsValid(tp))
ereport(ERROR,
@@ -984,8 +984,8 @@ AlterForeignServer(AlterForeignServerStmt *stmt)
rel = table_open(ForeignServerRelationId, RowExclusiveLock);
- tp = SearchSysCacheCopy1(FOREIGNSERVERNAME,
- CStringGetDatum(stmt->servername));
+ tp = SearchSysCacheCopy(FOREIGNSERVERNAME,
+ CStringGetDatum(stmt->servername));
if (!HeapTupleIsValid(tp))
ereport(ERROR,
@@ -1127,9 +1127,9 @@ CreateUserMapping(CreateUserMappingStmt *stmt)
/*
* Check that the user mapping is unique within server.
*/
- umId = GetSysCacheOid2(USERMAPPINGUSERSERVER, Anum_pg_user_mapping_oid,
- ObjectIdGetDatum(useId),
- ObjectIdGetDatum(srv->serverid));
+ umId = GetSysCacheOid(USERMAPPINGUSERSERVER, Anum_pg_user_mapping_oid,
+ ObjectIdGetDatum(useId),
+ ObjectIdGetDatum(srv->serverid));
if (OidIsValid(umId))
{
@@ -1245,9 +1245,9 @@ AlterUserMapping(AlterUserMappingStmt *stmt)
srv = GetForeignServerByName(stmt->servername, false);
- umId = GetSysCacheOid2(USERMAPPINGUSERSERVER, Anum_pg_user_mapping_oid,
- ObjectIdGetDatum(useId),
- ObjectIdGetDatum(srv->serverid));
+ umId = GetSysCacheOid(USERMAPPINGUSERSERVER, Anum_pg_user_mapping_oid,
+ ObjectIdGetDatum(useId),
+ ObjectIdGetDatum(srv->serverid));
if (!OidIsValid(umId))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -1256,7 +1256,7 @@ AlterUserMapping(AlterUserMappingStmt *stmt)
user_mapping_ddl_aclcheck(useId, srv->serverid, stmt->servername);
- tp = SearchSysCacheCopy1(USERMAPPINGOID, ObjectIdGetDatum(umId));
+ tp = SearchSysCacheCopy(USERMAPPINGOID, ObjectIdGetDatum(umId));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for user mapping %u", umId);
@@ -1362,9 +1362,9 @@ RemoveUserMapping(DropUserMappingStmt *stmt)
return InvalidOid;
}
- umId = GetSysCacheOid2(USERMAPPINGUSERSERVER, Anum_pg_user_mapping_oid,
- ObjectIdGetDatum(useId),
- ObjectIdGetDatum(srv->serverid));
+ umId = GetSysCacheOid(USERMAPPINGUSERSERVER, Anum_pg_user_mapping_oid,
+ ObjectIdGetDatum(useId),
+ ObjectIdGetDatum(srv->serverid));
if (!OidIsValid(umId))
{
diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c
index 69f66dfe7d..14b04ea157 100644
--- a/src/backend/commands/functioncmds.c
+++ b/src/backend/commands/functioncmds.c
@@ -1097,7 +1097,7 @@ CreateFunction(ParseState *pstate, CreateFunctionStmt *stmt)
}
/* Look up the language and validate permissions */
- languageTuple = SearchSysCache1(LANGNAME, PointerGetDatum(language));
+ languageTuple = SearchSysCache(LANGNAME, PointerGetDatum(language));
if (!HeapTupleIsValid(languageTuple))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -1306,7 +1306,7 @@ RemoveFunctionById(Oid funcOid)
*/
relation = table_open(ProcedureRelationId, RowExclusiveLock);
- tup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcOid));
+ tup = SearchSysCache(PROCOID, ObjectIdGetDatum(funcOid));
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for function %u", funcOid);
@@ -1327,7 +1327,7 @@ RemoveFunctionById(Oid funcOid)
{
relation = table_open(AggregateRelationId, RowExclusiveLock);
- tup = SearchSysCache1(AGGFNOID, ObjectIdGetDatum(funcOid));
+ tup = SearchSysCache(AGGFNOID, ObjectIdGetDatum(funcOid));
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for pg_aggregate tuple for function %u", funcOid);
@@ -1370,7 +1370,7 @@ AlterFunction(ParseState *pstate, AlterFunctionStmt *stmt)
ObjectAddressSet(address, ProcedureRelationId, funcOid);
- tup = SearchSysCacheCopy1(PROCOID, ObjectIdGetDatum(funcOid));
+ tup = SearchSysCacheCopy(PROCOID, ObjectIdGetDatum(funcOid));
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for function %u", funcOid);
@@ -1595,7 +1595,7 @@ CreateCast(CreateCastStmt *stmt)
funcid = LookupFuncWithArgs(OBJECT_FUNCTION, stmt->func, false);
- tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
+ tuple = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for function %u", funcid);
@@ -1868,7 +1868,7 @@ CreateTransform(CreateTransformStmt *stmt)
if (aclresult != ACLCHECK_OK)
aclcheck_error(aclresult, OBJECT_FUNCTION, NameListToString(stmt->fromsql->objname));
- tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(fromsqlfuncid));
+ tuple = SearchSysCache(PROCOID, ObjectIdGetDatum(fromsqlfuncid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for function %u", fromsqlfuncid);
procstruct = (Form_pg_proc) GETSTRUCT(tuple);
@@ -1894,7 +1894,7 @@ CreateTransform(CreateTransformStmt *stmt)
if (aclresult != ACLCHECK_OK)
aclcheck_error(aclresult, OBJECT_FUNCTION, NameListToString(stmt->tosql->objname));
- tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(tosqlfuncid));
+ tuple = SearchSysCache(PROCOID, ObjectIdGetDatum(tosqlfuncid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for function %u", tosqlfuncid);
procstruct = (Form_pg_proc) GETSTRUCT(tuple);
@@ -1918,9 +1918,9 @@ CreateTransform(CreateTransformStmt *stmt)
relation = table_open(TransformRelationId, RowExclusiveLock);
- tuple = SearchSysCache2(TRFTYPELANG,
- ObjectIdGetDatum(typeid),
- ObjectIdGetDatum(langid));
+ tuple = SearchSysCache(TRFTYPELANG,
+ ObjectIdGetDatum(typeid),
+ ObjectIdGetDatum(langid));
if (HeapTupleIsValid(tuple))
{
Form_pg_transform form = (Form_pg_transform) GETSTRUCT(tuple);
@@ -2008,9 +2008,9 @@ get_transform_oid(Oid type_id, Oid lang_id, bool missing_ok)
{
Oid oid;
- oid = GetSysCacheOid2(TRFTYPELANG, Anum_pg_transform_oid,
- ObjectIdGetDatum(type_id),
- ObjectIdGetDatum(lang_id));
+ oid = GetSysCacheOid(TRFTYPELANG, Anum_pg_transform_oid,
+ ObjectIdGetDatum(type_id),
+ ObjectIdGetDatum(lang_id));
if (!OidIsValid(oid) && !missing_ok)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -2032,10 +2032,10 @@ IsThereFunctionInNamespace(const char *proname, int pronargs,
oidvector *proargtypes, Oid nspOid)
{
/* check for duplicate name (more friendly than unique-index failure) */
- if (SearchSysCacheExists3(PROCNAMEARGSNSP,
- CStringGetDatum(proname),
- PointerGetDatum(proargtypes),
- ObjectIdGetDatum(nspOid)))
+ if (SearchSysCacheExists(PROCNAMEARGSNSP,
+ CStringGetDatum(proname),
+ PointerGetDatum(proargtypes),
+ ObjectIdGetDatum(nspOid)))
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_FUNCTION),
errmsg("function %s already exists in schema \"%s\"",
@@ -2098,7 +2098,7 @@ ExecuteDoStmt(ParseState *pstate, DoStmt *stmt, bool atomic)
language = "plpgsql";
/* Look up the language and validate permissions */
- languageTuple = SearchSysCache1(LANGNAME, PointerGetDatum(language));
+ languageTuple = SearchSysCache(LANGNAME, PointerGetDatum(language));
if (!HeapTupleIsValid(languageTuple))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -2201,7 +2201,7 @@ ExecuteCallStmt(CallStmt *stmt, ParamListInfo params, bool atomic, DestReceiver
callcontext = makeNode(CallContext);
callcontext->atomic = atomic;
- tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(fexpr->funcid));
+ tp = SearchSysCache(PROCOID, ObjectIdGetDatum(fexpr->funcid));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for function %u", fexpr->funcid);
@@ -2358,7 +2358,7 @@ CallStmtResultDesc(CallStmt *stmt)
fexpr = stmt->funcexpr;
- tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(fexpr->funcid));
+ tuple = SearchSysCache(PROCOID, ObjectIdGetDatum(fexpr->funcid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for procedure %u", fexpr->funcid);
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c
index e6ee99e51f..8409275002 100644
--- a/src/backend/commands/indexcmds.c
+++ b/src/backend/commands/indexcmds.c
@@ -210,7 +210,7 @@ CheckIndexCompatible(Oid oldId,
Assert(numberOfAttributes <= INDEX_MAX_KEYS);
/* look up the access method */
- tuple = SearchSysCache1(AMNAME, PointerGetDatum(accessMethodName));
+ tuple = SearchSysCache(AMNAME, PointerGetDatum(accessMethodName));
if (!HeapTupleIsValid(tuple))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -248,7 +248,7 @@ CheckIndexCompatible(Oid oldId,
/* Get the soon-obsolete pg_index tuple. */
- tuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(oldId));
+ tuple = SearchSysCache(INDEXRELID, ObjectIdGetDatum(oldId));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for index %u", oldId);
indexForm = (Form_pg_index) GETSTRUCT(tuple);
@@ -819,7 +819,7 @@ DefineIndex(Oid relationId,
* look up the access method, verify it can handle the requested features
*/
accessMethodName = stmt->accessMethod;
- tuple = SearchSysCache1(AMNAME, PointerGetDatum(accessMethodName));
+ tuple = SearchSysCache(AMNAME, PointerGetDatum(accessMethodName));
if (!HeapTupleIsValid(tuple))
{
/*
@@ -831,7 +831,7 @@ DefineIndex(Oid relationId,
ereport(NOTICE,
(errmsg("substituting access method \"gist\" for obsolete method \"rtree\"")));
accessMethodName = "gist";
- tuple = SearchSysCache1(AMNAME, PointerGetDatum(accessMethodName));
+ tuple = SearchSysCache(AMNAME, PointerGetDatum(accessMethodName));
}
if (!HeapTupleIsValid(tuple))
@@ -1496,8 +1496,8 @@ DefineIndex(Oid relationId,
HeapTuple tup,
newtup;
- tup = SearchSysCache1(INDEXRELID,
- ObjectIdGetDatum(indexRelationId));
+ tup = SearchSysCache(INDEXRELID,
+ ObjectIdGetDatum(indexRelationId));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for index %u",
indexRelationId);
@@ -2111,8 +2111,8 @@ ComputeIndexAttrs(IndexInfo *indexInfo,
* so fetch the name of the selected opfamily for use in the
* error message.
*/
- opftuple = SearchSysCache1(OPFAMILYOID,
- ObjectIdGetDatum(opfamily));
+ opftuple = SearchSysCache(OPFAMILYOID,
+ ObjectIdGetDatum(opfamily));
if (!HeapTupleIsValid(opftuple))
elog(ERROR, "cache lookup failed for opfamily %u",
opfamily);
@@ -2228,10 +2228,10 @@ ResolveOpClass(List *opclass, Oid attrType,
Oid namespaceId;
namespaceId = LookupExplicitNamespace(schemaname, false);
- tuple = SearchSysCache3(CLAAMNAMENSP,
- ObjectIdGetDatum(accessMethodId),
- PointerGetDatum(opcname),
- ObjectIdGetDatum(namespaceId));
+ tuple = SearchSysCache(CLAAMNAMENSP,
+ ObjectIdGetDatum(accessMethodId),
+ PointerGetDatum(opcname),
+ ObjectIdGetDatum(namespaceId));
}
else
{
@@ -2242,7 +2242,7 @@ ResolveOpClass(List *opclass, Oid attrType,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("operator class \"%s\" does not exist for access method \"%s\"",
opcname, accessMethodName)));
- tuple = SearchSysCache1(CLAOID, ObjectIdGetDatum(opClassId));
+ tuple = SearchSysCache(CLAOID, ObjectIdGetDatum(opClassId));
}
if (!HeapTupleIsValid(tuple))
@@ -3293,7 +3293,7 @@ ReindexMultipleInternal(List *relids, ReindexParams *params)
PushActiveSnapshot(GetTransactionSnapshot());
/* check if the relation still exists */
- if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(relid)))
+ if (!SearchSysCacheExists(RELOID, ObjectIdGetDatum(relid)))
{
PopActiveSnapshot();
CommitTransactionCommand();
@@ -4372,7 +4372,7 @@ update_relispartition(Oid relationId, bool newval)
Relation classRel;
classRel = table_open(RelationRelationId, RowExclusiveLock);
- tup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relationId));
+ tup = SearchSysCacheCopy(RELOID, ObjectIdGetDatum(relationId));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for relation %u", relationId);
Assert(((Form_pg_class) GETSTRUCT(tup))->relispartition != newval);
diff --git a/src/backend/commands/lockcmds.c b/src/backend/commands/lockcmds.c
index 43c7d7f4bb..70e2a5a0b8 100644
--- a/src/backend/commands/lockcmds.c
+++ b/src/backend/commands/lockcmds.c
@@ -150,7 +150,7 @@ LockTableRecurse(Oid reloid, LOCKMODE lockmode, bool nowait)
* Even if we got the lock, child might have been concurrently
* dropped. If so, we can skip it.
*/
- if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(childreloid)))
+ if (!SearchSysCacheExists(RELOID, ObjectIdGetDatum(childreloid)))
{
/* Release useless lock */
UnlockRelationOid(childreloid, lockmode);
diff --git a/src/backend/commands/matview.c b/src/backend/commands/matview.c
index f9a3bdfc3a..b2ea9ae1a7 100644
--- a/src/backend/commands/matview.c
+++ b/src/backend/commands/matview.c
@@ -94,8 +94,8 @@ SetMatViewPopulatedState(Relation relation, bool newstate)
* entries.
*/
pgrel = table_open(RelationRelationId, RowExclusiveLock);
- tuple = SearchSysCacheCopy1(RELOID,
- ObjectIdGetDatum(RelationGetRelid(relation)));
+ tuple = SearchSysCacheCopy(RELOID,
+ ObjectIdGetDatum(RelationGetRelid(relation)));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u",
RelationGetRelid(relation));
@@ -719,7 +719,7 @@ refresh_by_match_merge(Oid matviewOid, Oid tempOid, Oid relowner,
* Identify the equality operator associated with this index
* column. First we need to look up the column's opclass.
*/
- cla_ht = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclass));
+ cla_ht = SearchSysCache(CLAOID, ObjectIdGetDatum(opclass));
if (!HeapTupleIsValid(cla_ht))
elog(ERROR, "cache lookup failed for opclass %u", opclass);
cla_tup = (Form_pg_opclass) GETSTRUCT(cla_ht);
diff --git a/src/backend/commands/opclasscmds.c b/src/backend/commands/opclasscmds.c
index 864e35e45b..7b0c1a24d7 100644
--- a/src/backend/commands/opclasscmds.c
+++ b/src/backend/commands/opclasscmds.c
@@ -96,10 +96,10 @@ OpFamilyCacheLookup(Oid amID, List *opfamilyname, bool missing_ok)
if (!OidIsValid(namespaceId))
htup = NULL;
else
- htup = SearchSysCache3(OPFAMILYAMNAMENSP,
- ObjectIdGetDatum(amID),
- PointerGetDatum(opfname),
- ObjectIdGetDatum(namespaceId));
+ htup = SearchSysCache(OPFAMILYAMNAMENSP,
+ ObjectIdGetDatum(amID),
+ PointerGetDatum(opfname),
+ ObjectIdGetDatum(namespaceId));
}
else
{
@@ -109,14 +109,14 @@ OpFamilyCacheLookup(Oid amID, List *opfamilyname, bool missing_ok)
if (!OidIsValid(opfID))
htup = NULL;
else
- htup = SearchSysCache1(OPFAMILYOID, ObjectIdGetDatum(opfID));
+ htup = SearchSysCache(OPFAMILYOID, ObjectIdGetDatum(opfID));
}
if (!HeapTupleIsValid(htup) && !missing_ok)
{
HeapTuple amtup;
- amtup = SearchSysCache1(AMOID, ObjectIdGetDatum(amID));
+ amtup = SearchSysCache(AMOID, ObjectIdGetDatum(amID));
if (!HeapTupleIsValid(amtup))
elog(ERROR, "cache lookup failed for access method %u", amID);
ereport(ERROR,
@@ -177,10 +177,10 @@ OpClassCacheLookup(Oid amID, List *opclassname, bool missing_ok)
if (!OidIsValid(namespaceId))
htup = NULL;
else
- htup = SearchSysCache3(CLAAMNAMENSP,
- ObjectIdGetDatum(amID),
- PointerGetDatum(opcname),
- ObjectIdGetDatum(namespaceId));
+ htup = SearchSysCache(CLAAMNAMENSP,
+ ObjectIdGetDatum(amID),
+ PointerGetDatum(opcname),
+ ObjectIdGetDatum(namespaceId));
}
else
{
@@ -190,14 +190,14 @@ OpClassCacheLookup(Oid amID, List *opclassname, bool missing_ok)
if (!OidIsValid(opcID))
htup = NULL;
else
- htup = SearchSysCache1(CLAOID, ObjectIdGetDatum(opcID));
+ htup = SearchSysCache(CLAOID, ObjectIdGetDatum(opcID));
}
if (!HeapTupleIsValid(htup) && !missing_ok)
{
HeapTuple amtup;
- amtup = SearchSysCache1(AMOID, ObjectIdGetDatum(amID));
+ amtup = SearchSysCache(AMOID, ObjectIdGetDatum(amID));
if (!HeapTupleIsValid(amtup))
elog(ERROR, "cache lookup failed for access method %u", amID);
ereport(ERROR,
@@ -258,10 +258,10 @@ CreateOpFamily(CreateOpFamilyStmt *stmt, const char *opfname,
* Make sure there is no existing opfamily of this name (this is just to
* give a more friendly error message than "duplicate key").
*/
- if (SearchSysCacheExists3(OPFAMILYAMNAMENSP,
- ObjectIdGetDatum(amoid),
- CStringGetDatum(opfname),
- ObjectIdGetDatum(namespaceoid)))
+ if (SearchSysCacheExists(OPFAMILYAMNAMENSP,
+ ObjectIdGetDatum(amoid),
+ CStringGetDatum(opfname),
+ ObjectIdGetDatum(namespaceoid)))
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT),
errmsg("operator family \"%s\" for access method \"%s\" already exists",
@@ -368,7 +368,7 @@ DefineOpClass(CreateOpClassStmt *stmt)
get_namespace_name(namespaceoid));
/* Get necessary info about access method */
- tup = SearchSysCache1(AMNAME, CStringGetDatum(stmt->amname));
+ tup = SearchSysCache(AMNAME, CStringGetDatum(stmt->amname));
if (!HeapTupleIsValid(tup))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -436,10 +436,10 @@ DefineOpClass(CreateOpClassStmt *stmt)
else
{
/* Lookup existing family of same name and namespace */
- tup = SearchSysCache3(OPFAMILYAMNAMENSP,
- ObjectIdGetDatum(amoid),
- PointerGetDatum(opcname),
- ObjectIdGetDatum(namespaceoid));
+ tup = SearchSysCache(OPFAMILYAMNAMENSP,
+ ObjectIdGetDatum(amoid),
+ PointerGetDatum(opcname),
+ ObjectIdGetDatum(namespaceoid));
if (HeapTupleIsValid(tup))
{
opfamilyoid = ((Form_pg_opfamily) GETSTRUCT(tup))->oid;
@@ -601,10 +601,10 @@ DefineOpClass(CreateOpClassStmt *stmt)
* Make sure there is no existing opclass of this name (this is just to
* give a more friendly error message than "duplicate key").
*/
- if (SearchSysCacheExists3(CLAAMNAMENSP,
- ObjectIdGetDatum(amoid),
- CStringGetDatum(opcname),
- ObjectIdGetDatum(namespaceoid)))
+ if (SearchSysCacheExists(CLAAMNAMENSP,
+ ObjectIdGetDatum(amoid),
+ CStringGetDatum(opcname),
+ ObjectIdGetDatum(namespaceoid)))
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT),
errmsg("operator class \"%s\" for access method \"%s\" already exists",
@@ -826,7 +826,7 @@ AlterOpFamily(AlterOpFamilyStmt *stmt)
IndexAmRoutine *amroutine;
/* Get necessary info about access method */
- tup = SearchSysCache1(AMNAME, CStringGetDatum(stmt->amname));
+ tup = SearchSysCache(AMNAME, CStringGetDatum(stmt->amname));
if (!HeapTupleIsValid(tup))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -1140,7 +1140,7 @@ assignOperTypes(OpFamilyMember *member, Oid amoid, Oid typeoid)
Form_pg_operator opform;
/* Fetch the operator definition */
- optup = SearchSysCache1(OPEROID, ObjectIdGetDatum(member->object));
+ optup = SearchSysCache(OPEROID, ObjectIdGetDatum(member->object));
if (!HeapTupleIsValid(optup))
elog(ERROR, "cache lookup failed for operator %u", member->object);
opform = (Form_pg_operator) GETSTRUCT(optup);
@@ -1207,7 +1207,7 @@ assignProcTypes(OpFamilyMember *member, Oid amoid, Oid typeoid,
Form_pg_proc procform;
/* Fetch the procedure definition */
- proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(member->object));
+ proctup = SearchSysCache(PROCOID, ObjectIdGetDatum(member->object));
if (!HeapTupleIsValid(proctup))
elog(ERROR, "cache lookup failed for function %u", member->object);
procform = (Form_pg_proc) GETSTRUCT(proctup);
@@ -1450,11 +1450,11 @@ storeOperators(List *opfamilyname, Oid amoid, Oid opfamilyoid,
* existing pg_amop entry (just to give a nicer error message)
*/
if (isAdd &&
- SearchSysCacheExists4(AMOPSTRATEGY,
- ObjectIdGetDatum(opfamilyoid),
- ObjectIdGetDatum(op->lefttype),
- ObjectIdGetDatum(op->righttype),
- Int16GetDatum(op->number)))
+ SearchSysCacheExists(AMOPSTRATEGY,
+ ObjectIdGetDatum(opfamilyoid),
+ ObjectIdGetDatum(op->lefttype),
+ ObjectIdGetDatum(op->righttype),
+ Int16GetDatum(op->number)))
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT),
errmsg("operator %d(%s,%s) already exists in operator family \"%s\"",
@@ -1556,11 +1556,11 @@ storeProcedures(List *opfamilyname, Oid amoid, Oid opfamilyoid,
* existing pg_amproc entry (just to give a nicer error message)
*/
if (isAdd &&
- SearchSysCacheExists4(AMPROCNUM,
- ObjectIdGetDatum(opfamilyoid),
- ObjectIdGetDatum(proc->lefttype),
- ObjectIdGetDatum(proc->righttype),
- Int16GetDatum(proc->number)))
+ SearchSysCacheExists(AMPROCNUM,
+ ObjectIdGetDatum(opfamilyoid),
+ ObjectIdGetDatum(proc->lefttype),
+ ObjectIdGetDatum(proc->righttype),
+ Int16GetDatum(proc->number)))
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT),
errmsg("function %d(%s,%s) already exists in operator family \"%s\"",
@@ -1636,11 +1636,11 @@ dropOperators(List *opfamilyname, Oid amoid, Oid opfamilyoid,
Oid amopid;
ObjectAddress object;
- amopid = GetSysCacheOid4(AMOPSTRATEGY, Anum_pg_amop_oid,
- ObjectIdGetDatum(opfamilyoid),
- ObjectIdGetDatum(op->lefttype),
- ObjectIdGetDatum(op->righttype),
- Int16GetDatum(op->number));
+ amopid = GetSysCacheOid(AMOPSTRATEGY, Anum_pg_amop_oid,
+ ObjectIdGetDatum(opfamilyoid),
+ ObjectIdGetDatum(op->lefttype),
+ ObjectIdGetDatum(op->righttype),
+ Int16GetDatum(op->number));
if (!OidIsValid(amopid))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -1676,11 +1676,11 @@ dropProcedures(List *opfamilyname, Oid amoid, Oid opfamilyoid,
Oid amprocid;
ObjectAddress object;
- amprocid = GetSysCacheOid4(AMPROCNUM, Anum_pg_amproc_oid,
- ObjectIdGetDatum(opfamilyoid),
- ObjectIdGetDatum(op->lefttype),
- ObjectIdGetDatum(op->righttype),
- Int16GetDatum(op->number));
+ amprocid = GetSysCacheOid(AMPROCNUM, Anum_pg_amproc_oid,
+ ObjectIdGetDatum(opfamilyoid),
+ ObjectIdGetDatum(op->lefttype),
+ ObjectIdGetDatum(op->righttype),
+ Int16GetDatum(op->number));
if (!OidIsValid(amprocid))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -1709,10 +1709,10 @@ IsThereOpClassInNamespace(const char *opcname, Oid opcmethod,
Oid opcnamespace)
{
/* make sure the new name doesn't exist */
- if (SearchSysCacheExists3(CLAAMNAMENSP,
- ObjectIdGetDatum(opcmethod),
- CStringGetDatum(opcname),
- ObjectIdGetDatum(opcnamespace)))
+ if (SearchSysCacheExists(CLAAMNAMENSP,
+ ObjectIdGetDatum(opcmethod),
+ CStringGetDatum(opcname),
+ ObjectIdGetDatum(opcnamespace)))
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT),
errmsg("operator class \"%s\" for access method \"%s\" already exists in schema \"%s\"",
@@ -1732,10 +1732,10 @@ IsThereOpFamilyInNamespace(const char *opfname, Oid opfmethod,
Oid opfnamespace)
{
/* make sure the new name doesn't exist */
- if (SearchSysCacheExists3(OPFAMILYAMNAMENSP,
- ObjectIdGetDatum(opfmethod),
- CStringGetDatum(opfname),
- ObjectIdGetDatum(opfnamespace)))
+ if (SearchSysCacheExists(OPFAMILYAMNAMENSP,
+ ObjectIdGetDatum(opfmethod),
+ CStringGetDatum(opfname),
+ ObjectIdGetDatum(opfnamespace)))
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT),
errmsg("operator family \"%s\" for access method \"%s\" already exists in schema \"%s\"",
diff --git a/src/backend/commands/operatorcmds.c b/src/backend/commands/operatorcmds.c
index cd7f83136f..49d7e3e5db 100644
--- a/src/backend/commands/operatorcmds.c
+++ b/src/backend/commands/operatorcmds.c
@@ -371,7 +371,7 @@ RemoveOperatorById(Oid operOid)
relation = table_open(OperatorRelationId, RowExclusiveLock);
- tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operOid));
+ tup = SearchSysCache(OPEROID, ObjectIdGetDatum(operOid));
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for operator %u", operOid);
op = (Form_pg_operator) GETSTRUCT(tup);
@@ -388,7 +388,7 @@ RemoveOperatorById(Oid operOid)
if (operOid == op->oprcom || operOid == op->oprnegate)
{
ReleaseSysCache(tup);
- tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operOid));
+ tup = SearchSysCache(OPEROID, ObjectIdGetDatum(operOid));
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for operator %u", operOid);
}
@@ -430,7 +430,7 @@ AlterOperator(AlterOperatorStmt *stmt)
/* Look up the operator */
oprId = LookupOperWithArgs(stmt->opername, false);
catalog = table_open(OperatorRelationId, RowExclusiveLock);
- tup = SearchSysCacheCopy1(OPEROID, ObjectIdGetDatum(oprId));
+ tup = SearchSysCacheCopy(OPEROID, ObjectIdGetDatum(oprId));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for operator %u", oprId);
oprForm = (Form_pg_operator) GETSTRUCT(tup);
diff --git a/src/backend/commands/policy.c b/src/backend/commands/policy.c
index 76a45e56bf..24afdbe4f1 100644
--- a/src/backend/commands/policy.c
+++ b/src/backend/commands/policy.c
@@ -71,7 +71,7 @@ RangeVarCallbackForPolicy(const RangeVar *rv, Oid relid, Oid oldrelid,
Form_pg_class classform;
char relkind;
- tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
+ tuple = SearchSysCache(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tuple))
return;
@@ -541,7 +541,7 @@ RemoveRoleFromObjectPolicy(Oid roleid, Oid classid, Oid policy_id)
* redoing any dependent plans. In case of a race condition where the
* rel was just dropped, we need do nothing.
*/
- reltup = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
+ reltup = SearchSysCache(RELOID, ObjectIdGetDatum(relid));
if (HeapTupleIsValid(reltup))
{
CacheInvalidateRelcacheByTuple(reltup);
diff --git a/src/backend/commands/proclang.c b/src/backend/commands/proclang.c
index 1debc9693e..a49cf22ba1 100644
--- a/src/backend/commands/proclang.c
+++ b/src/backend/commands/proclang.c
@@ -120,7 +120,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
nulls[Anum_pg_language_lanacl - 1] = true;
/* Check for pre-existing definition */
- oldtup = SearchSysCache1(LANGNAME, PointerGetDatum(languageName));
+ oldtup = SearchSysCache(LANGNAME, PointerGetDatum(languageName));
if (HeapTupleIsValid(oldtup))
{
@@ -229,8 +229,8 @@ get_language_oid(const char *langname, bool missing_ok)
{
Oid oid;
- oid = GetSysCacheOid1(LANGNAME, Anum_pg_language_oid,
- CStringGetDatum(langname));
+ oid = GetSysCacheOid(LANGNAME, Anum_pg_language_oid,
+ CStringGetDatum(langname));
if (!OidIsValid(oid) && !missing_ok)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c
index f4ba572697..842f73912c 100644
--- a/src/backend/commands/publicationcmds.c
+++ b/src/backend/commands/publicationcmds.c
@@ -296,9 +296,9 @@ pub_rf_contains_invalid_column(Oid pubid, Relation relation, List *ancestors,
publish_as_relid = relid;
}
- rftuple = SearchSysCache2(PUBLICATIONRELMAP,
- ObjectIdGetDatum(publish_as_relid),
- ObjectIdGetDatum(pubid));
+ rftuple = SearchSysCache(PUBLICATIONRELMAP,
+ ObjectIdGetDatum(publish_as_relid),
+ ObjectIdGetDatum(pubid));
if (!HeapTupleIsValid(rftuple))
return false;
@@ -364,9 +364,9 @@ pub_collist_contains_invalid_column(Oid pubid, Relation relation, List *ancestor
publish_as_relid = relid;
}
- tuple = SearchSysCache2(PUBLICATIONRELMAP,
- ObjectIdGetDatum(publish_as_relid),
- ObjectIdGetDatum(pubid));
+ tuple = SearchSysCache(PUBLICATIONRELMAP,
+ ObjectIdGetDatum(publish_as_relid),
+ ObjectIdGetDatum(pubid));
if (!HeapTupleIsValid(tuple))
return false;
@@ -763,8 +763,8 @@ CreatePublication(ParseState *pstate, CreatePublicationStmt *stmt)
rel = table_open(PublicationRelationId, RowExclusiveLock);
/* Check if name is used */
- puboid = GetSysCacheOid1(PUBLICATIONNAME, Anum_pg_publication_oid,
- CStringGetDatum(stmt->pubname));
+ puboid = GetSysCacheOid(PUBLICATIONNAME, Anum_pg_publication_oid,
+ CStringGetDatum(stmt->pubname));
if (OidIsValid(puboid))
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT),
@@ -933,9 +933,9 @@ AlterPublicationOptions(ParseState *pstate, AlterPublicationStmt *stmt,
* with the cache lookups returning NULL.
*/
- rftuple = SearchSysCache2(PUBLICATIONRELMAP,
- ObjectIdGetDatum(relid),
- ObjectIdGetDatum(pubform->oid));
+ rftuple = SearchSysCache(PUBLICATIONRELMAP,
+ ObjectIdGetDatum(relid),
+ ObjectIdGetDatum(pubform->oid));
if (!HeapTupleIsValid(rftuple))
continue;
has_rowfilter = !heap_attisnull(rftuple, Anum_pg_publication_rel_prqual, NULL);
@@ -1141,9 +1141,9 @@ AlterPublicationTables(AlterPublicationStmt *stmt, HeapTuple tup,
Bitmapset *oldcolumns = NULL;
/* look up the cache for the old relmap */
- rftuple = SearchSysCache2(PUBLICATIONRELMAP,
- ObjectIdGetDatum(oldrelid),
- ObjectIdGetDatum(pubid));
+ rftuple = SearchSysCache(PUBLICATIONRELMAP,
+ ObjectIdGetDatum(oldrelid),
+ ObjectIdGetDatum(pubid));
/*
* See if the existing relation currently has a WHERE clause or a
@@ -1282,9 +1282,9 @@ AlterPublicationSchemas(AlterPublicationStmt *stmt,
{
HeapTuple coltuple;
- coltuple = SearchSysCache2(PUBLICATIONRELMAP,
- ObjectIdGetDatum(lfirst_oid(lc)),
- ObjectIdGetDatum(pubform->oid));
+ coltuple = SearchSysCache(PUBLICATIONRELMAP,
+ ObjectIdGetDatum(lfirst_oid(lc)),
+ ObjectIdGetDatum(pubform->oid));
if (!HeapTupleIsValid(coltuple))
continue;
@@ -1383,8 +1383,8 @@ AlterPublication(ParseState *pstate, AlterPublicationStmt *stmt)
rel = table_open(PublicationRelationId, RowExclusiveLock);
- tup = SearchSysCacheCopy1(PUBLICATIONNAME,
- CStringGetDatum(stmt->pubname));
+ tup = SearchSysCacheCopy(PUBLICATIONNAME,
+ CStringGetDatum(stmt->pubname));
if (!HeapTupleIsValid(tup))
ereport(ERROR,
@@ -1424,7 +1424,7 @@ AlterPublication(ParseState *pstate, AlterPublicationStmt *stmt)
* existence of publication. We get the tuple again to avoid the risk
* of any publication option getting changed.
*/
- tup = SearchSysCacheCopy1(PUBLICATIONOID, ObjectIdGetDatum(pubid));
+ tup = SearchSysCacheCopy(PUBLICATIONOID, ObjectIdGetDatum(pubid));
if (!HeapTupleIsValid(tup))
ereport(ERROR,
errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -1454,7 +1454,7 @@ RemovePublicationRelById(Oid proid)
rel = table_open(PublicationRelRelationId, RowExclusiveLock);
- tup = SearchSysCache1(PUBLICATIONREL, ObjectIdGetDatum(proid));
+ tup = SearchSysCache(PUBLICATIONREL, ObjectIdGetDatum(proid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for publication table %u",
@@ -1494,7 +1494,7 @@ RemovePublicationById(Oid pubid)
rel = table_open(PublicationRelationId, RowExclusiveLock);
- tup = SearchSysCache1(PUBLICATIONOID, ObjectIdGetDatum(pubid));
+ tup = SearchSysCache(PUBLICATIONOID, ObjectIdGetDatum(pubid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for publication %u", pubid);
@@ -1524,7 +1524,7 @@ RemovePublicationSchemaById(Oid psoid)
rel = table_open(PublicationNamespaceRelationId, RowExclusiveLock);
- tup = SearchSysCache1(PUBLICATIONNAMESPACE, ObjectIdGetDatum(psoid));
+ tup = SearchSysCache(PUBLICATIONNAMESPACE, ObjectIdGetDatum(psoid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for publication schema %u", psoid);
@@ -1740,7 +1740,7 @@ LockSchemaList(List *schemalist)
* concurrent DDL has removed it. We can test this by checking the
* existence of schema.
*/
- if (!SearchSysCacheExists1(NAMESPACEOID, ObjectIdGetDatum(schemaid)))
+ if (!SearchSysCacheExists(NAMESPACEOID, ObjectIdGetDatum(schemaid)))
ereport(ERROR,
errcode(ERRCODE_UNDEFINED_SCHEMA),
errmsg("schema with OID %u does not exist", schemaid));
@@ -1802,9 +1802,9 @@ PublicationDropTables(Oid pubid, List *rels, bool missing_ok)
errcode(ERRCODE_SYNTAX_ERROR),
errmsg("column list must not be specified in ALTER PUBLICATION ... DROP"));
- prid = GetSysCacheOid2(PUBLICATIONRELMAP, Anum_pg_publication_rel_oid,
- ObjectIdGetDatum(relid),
- ObjectIdGetDatum(pubid));
+ prid = GetSysCacheOid(PUBLICATIONRELMAP, Anum_pg_publication_rel_oid,
+ ObjectIdGetDatum(relid),
+ ObjectIdGetDatum(pubid));
if (!OidIsValid(prid))
{
if (missing_ok)
@@ -1868,10 +1868,10 @@ PublicationDropSchemas(Oid pubid, List *schemas, bool missing_ok)
{
Oid schemaid = lfirst_oid(lc);
- psid = GetSysCacheOid2(PUBLICATIONNAMESPACEMAP,
- Anum_pg_publication_namespace_oid,
- ObjectIdGetDatum(schemaid),
- ObjectIdGetDatum(pubid));
+ psid = GetSysCacheOid(PUBLICATIONNAMESPACEMAP,
+ Anum_pg_publication_namespace_oid,
+ ObjectIdGetDatum(schemaid),
+ ObjectIdGetDatum(pubid));
if (!OidIsValid(psid))
{
if (missing_ok)
@@ -1960,7 +1960,7 @@ AlterPublicationOwner(const char *name, Oid newOwnerId)
rel = table_open(PublicationRelationId, RowExclusiveLock);
- tup = SearchSysCacheCopy1(PUBLICATIONNAME, CStringGetDatum(name));
+ tup = SearchSysCacheCopy(PUBLICATIONNAME, CStringGetDatum(name));
if (!HeapTupleIsValid(tup))
ereport(ERROR,
@@ -1992,7 +1992,7 @@ AlterPublicationOwner_oid(Oid subid, Oid newOwnerId)
rel = table_open(PublicationRelationId, RowExclusiveLock);
- tup = SearchSysCacheCopy1(PUBLICATIONOID, ObjectIdGetDatum(subid));
+ tup = SearchSysCacheCopy(PUBLICATIONOID, ObjectIdGetDatum(subid));
if (!HeapTupleIsValid(tup))
ereport(ERROR,
diff --git a/src/backend/commands/schemacmds.c b/src/backend/commands/schemacmds.c
index 90de935267..3d8f76744e 100644
--- a/src/backend/commands/schemacmds.c
+++ b/src/backend/commands/schemacmds.c
@@ -77,7 +77,7 @@ CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString,
{
HeapTuple tuple;
- tuple = SearchSysCache1(AUTHOID, ObjectIdGetDatum(owner_uid));
+ tuple = SearchSysCache(AUTHOID, ObjectIdGetDatum(owner_uid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for role %u", owner_uid);
schemaName =
@@ -239,7 +239,7 @@ RenameSchema(const char *oldname, const char *newname)
rel = table_open(NamespaceRelationId, RowExclusiveLock);
- tup = SearchSysCacheCopy1(NAMESPACENAME, CStringGetDatum(oldname));
+ tup = SearchSysCacheCopy(NAMESPACENAME, CStringGetDatum(oldname));
if (!HeapTupleIsValid(tup))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_SCHEMA),
@@ -293,7 +293,7 @@ AlterSchemaOwner_oid(Oid schemaoid, Oid newOwnerId)
rel = table_open(NamespaceRelationId, RowExclusiveLock);
- tup = SearchSysCache1(NAMESPACEOID, ObjectIdGetDatum(schemaoid));
+ tup = SearchSysCache(NAMESPACEOID, ObjectIdGetDatum(schemaoid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for schema %u", schemaoid);
@@ -319,7 +319,7 @@ AlterSchemaOwner(const char *name, Oid newOwnerId)
rel = table_open(NamespaceRelationId, RowExclusiveLock);
- tup = SearchSysCache1(NAMESPACENAME, CStringGetDatum(name));
+ tup = SearchSysCache(NAMESPACENAME, CStringGetDatum(name));
if (!HeapTupleIsValid(tup))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_SCHEMA),
diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c
index bfe279cddf..e3d39d1767 100644
--- a/src/backend/commands/sequence.c
+++ b/src/backend/commands/sequence.c
@@ -291,7 +291,7 @@ ResetSequence(Oid seq_relid)
init_sequence(seq_relid, &elm, &seq_rel);
(void) read_seq_tuple(seq_rel, &buf, &seqdatatuple);
- pgstuple = SearchSysCache1(SEQRELID, ObjectIdGetDatum(seq_relid));
+ pgstuple = SearchSysCache(SEQRELID, ObjectIdGetDatum(seq_relid));
if (!HeapTupleIsValid(pgstuple))
elog(ERROR, "cache lookup failed for sequence %u", seq_relid);
pgsform = (Form_pg_sequence) GETSTRUCT(pgstuple);
@@ -480,8 +480,8 @@ AlterSequence(ParseState *pstate, AlterSeqStmt *stmt)
init_sequence(relid, &elm, &seqrel);
rel = table_open(SequenceRelationId, RowExclusiveLock);
- seqtuple = SearchSysCacheCopy1(SEQRELID,
- ObjectIdGetDatum(relid));
+ seqtuple = SearchSysCacheCopy(SEQRELID,
+ ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(seqtuple))
elog(ERROR, "cache lookup failed for sequence %u",
relid);
@@ -580,7 +580,7 @@ DeleteSequenceTuple(Oid relid)
rel = table_open(SequenceRelationId, RowExclusiveLock);
- tuple = SearchSysCache1(SEQRELID, ObjectIdGetDatum(relid));
+ tuple = SearchSysCache(SEQRELID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for sequence %u", relid);
@@ -681,7 +681,7 @@ nextval_internal(Oid relid, bool check_permissions)
return elm->last;
}
- pgstuple = SearchSysCache1(SEQRELID, ObjectIdGetDatum(relid));
+ pgstuple = SearchSysCache(SEQRELID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(pgstuple))
elog(ERROR, "cache lookup failed for sequence %u", relid);
pgsform = (Form_pg_sequence) GETSTRUCT(pgstuple);
@@ -911,7 +911,7 @@ lastval(PG_FUNCTION_ARGS)
errmsg("lastval is not yet defined in this session")));
/* Someone may have dropped the sequence since the last nextval() */
- if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(last_used_seq->relid)))
+ if (!SearchSysCacheExists(RELOID, ObjectIdGetDatum(last_used_seq->relid)))
ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("lastval is not yet defined in this session")));
@@ -969,7 +969,7 @@ do_setval(Oid relid, int64 next, bool iscalled)
errmsg("permission denied for sequence %s",
RelationGetRelationName(seqrel))));
- pgstuple = SearchSysCache1(SEQRELID, ObjectIdGetDatum(relid));
+ pgstuple = SearchSysCache(SEQRELID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(pgstuple))
elog(ERROR, "cache lookup failed for sequence %u", relid);
pgsform = (Form_pg_sequence) GETSTRUCT(pgstuple);
@@ -1719,7 +1719,7 @@ sequence_options(Oid relid)
Form_pg_sequence pgsform;
List *options = NIL;
- pgstuple = SearchSysCache1(SEQRELID, relid);
+ pgstuple = SearchSysCache(SEQRELID, relid);
if (!HeapTupleIsValid(pgstuple))
elog(ERROR, "cache lookup failed for sequence %u", relid);
pgsform = (Form_pg_sequence) GETSTRUCT(pgstuple);
@@ -1767,7 +1767,7 @@ pg_sequence_parameters(PG_FUNCTION_ARGS)
memset(isnull, 0, sizeof(isnull));
- pgstuple = SearchSysCache1(SEQRELID, relid);
+ pgstuple = SearchSysCache(SEQRELID, relid);
if (!HeapTupleIsValid(pgstuple))
elog(ERROR, "cache lookup failed for sequence %u", relid);
pgsform = (Form_pg_sequence) GETSTRUCT(pgstuple);
diff --git a/src/backend/commands/statscmds.c b/src/backend/commands/statscmds.c
index 26ebd0819d..225d204705 100644
--- a/src/backend/commands/statscmds.c
+++ b/src/backend/commands/statscmds.c
@@ -175,9 +175,9 @@ CreateStatistics(CreateStatsStmt *stmt)
/*
* Deal with the possibility that the statistics object already exists.
*/
- if (SearchSysCacheExists2(STATEXTNAMENSP,
- CStringGetDatum(namestr),
- ObjectIdGetDatum(namespaceId)))
+ if (SearchSysCacheExists(STATEXTNAMENSP,
+ CStringGetDatum(namestr),
+ ObjectIdGetDatum(namespaceId)))
{
if (stmt->if_not_exists)
{
@@ -660,7 +660,7 @@ AlterStatistics(AlterStatsStmt *stmt)
/* Search pg_statistic_ext */
rel = table_open(StatisticExtRelationId, RowExclusiveLock);
- oldtup = SearchSysCache1(STATEXTOID, ObjectIdGetDatum(stxoid));
+ oldtup = SearchSysCache(STATEXTOID, ObjectIdGetDatum(stxoid));
if (!HeapTupleIsValid(oldtup))
elog(ERROR, "cache lookup failed for extended statistics object %u", stxoid);
@@ -713,8 +713,8 @@ RemoveStatisticsDataById(Oid statsOid, bool inh)
relation = table_open(StatisticExtDataRelationId, RowExclusiveLock);
- tup = SearchSysCache2(STATEXTDATASTXOID, ObjectIdGetDatum(statsOid),
- BoolGetDatum(inh));
+ tup = SearchSysCache(STATEXTDATASTXOID, ObjectIdGetDatum(statsOid),
+ BoolGetDatum(inh));
/* We don't know if the data row for inh value exists. */
if (HeapTupleIsValid(tup))
@@ -752,7 +752,7 @@ RemoveStatisticsById(Oid statsOid)
*/
relation = table_open(StatisticExtRelationId, RowExclusiveLock);
- tup = SearchSysCache1(STATEXTOID, ObjectIdGetDatum(statsOid));
+ tup = SearchSysCache(STATEXTOID, ObjectIdGetDatum(statsOid));
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for statistics object %u", statsOid);
@@ -802,8 +802,8 @@ ChooseExtendedStatisticName(const char *name1, const char *name2,
stxname = makeObjectName(name1, name2, modlabel);
- existingstats = GetSysCacheOid2(STATEXTNAMENSP, Anum_pg_statistic_ext_oid,
- PointerGetDatum(stxname),
+ existingstats = GetSysCacheOid(STATEXTNAMENSP, Anum_pg_statistic_ext_oid,
+ PointerGetDatum(stxname),
ObjectIdGetDatum(namespaceid));
if (!OidIsValid(existingstats))
break;
@@ -881,7 +881,7 @@ StatisticsGetRelation(Oid statId, bool missing_ok)
Form_pg_statistic_ext stx;
Oid result;
- tuple = SearchSysCache1(STATEXTOID, ObjectIdGetDatum(statId));
+ tuple = SearchSysCache(STATEXTOID, ObjectIdGetDatum(statId));
if (!HeapTupleIsValid(tuple))
{
if (missing_ok)
diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c
index 87eb23496e..d5db389af8 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -633,8 +633,8 @@ CreateSubscription(ParseState *pstate, CreateSubscriptionStmt *stmt,
rel = table_open(SubscriptionRelationId, RowExclusiveLock);
/* Check if name is used */
- subid = GetSysCacheOid2(SUBSCRIPTIONNAME, Anum_pg_subscription_oid,
- MyDatabaseId, CStringGetDatum(stmt->subname));
+ subid = GetSysCacheOid(SUBSCRIPTIONNAME, Anum_pg_subscription_oid,
+ MyDatabaseId, CStringGetDatum(stmt->subname));
if (OidIsValid(subid))
{
ereport(ERROR,
@@ -1071,8 +1071,8 @@ AlterSubscription(ParseState *pstate, AlterSubscriptionStmt *stmt,
rel = table_open(SubscriptionRelationId, RowExclusiveLock);
/* Fetch the existing tuple. */
- tup = SearchSysCacheCopy2(SUBSCRIPTIONNAME, MyDatabaseId,
- CStringGetDatum(stmt->subname));
+ tup = SearchSysCacheCopy(SUBSCRIPTIONNAME, MyDatabaseId,
+ CStringGetDatum(stmt->subname));
if (!HeapTupleIsValid(tup))
ereport(ERROR,
@@ -1472,8 +1472,8 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel)
*/
rel = table_open(SubscriptionRelationId, AccessExclusiveLock);
- tup = SearchSysCache2(SUBSCRIPTIONNAME, MyDatabaseId,
- CStringGetDatum(stmt->subname));
+ tup = SearchSysCache(SUBSCRIPTIONNAME, MyDatabaseId,
+ CStringGetDatum(stmt->subname));
if (!HeapTupleIsValid(tup))
{
@@ -1859,8 +1859,8 @@ AlterSubscriptionOwner(const char *name, Oid newOwnerId)
rel = table_open(SubscriptionRelationId, RowExclusiveLock);
- tup = SearchSysCacheCopy2(SUBSCRIPTIONNAME, MyDatabaseId,
- CStringGetDatum(name));
+ tup = SearchSysCacheCopy(SUBSCRIPTIONNAME, MyDatabaseId,
+ CStringGetDatum(name));
if (!HeapTupleIsValid(tup))
ereport(ERROR,
@@ -1892,7 +1892,7 @@ AlterSubscriptionOwner_oid(Oid subid, Oid newOwnerId)
rel = table_open(SubscriptionRelationId, RowExclusiveLock);
- tup = SearchSysCacheCopy1(SUBSCRIPTIONOID, ObjectIdGetDatum(subid));
+ tup = SearchSysCacheCopy(SUBSCRIPTIONOID, ObjectIdGetDatum(subid));
if (!HeapTupleIsValid(tup))
ereport(ERROR,
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 3147dddf28..c047060480 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -1544,7 +1544,7 @@ RangeVarCallbackForDropRelation(const RangeVar *rel, Oid relOid, Oid oldRelOid,
if (!OidIsValid(relOid))
return;
- tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relOid));
+ tuple = SearchSysCache(RELOID, ObjectIdGetDatum(relOid));
if (!HeapTupleIsValid(tuple))
return; /* concurrently dropped, so nothing to do */
classform = (Form_pg_class) GETSTRUCT(tuple);
@@ -1592,7 +1592,7 @@ RangeVarCallbackForDropRelation(const RangeVar *rel, Oid relOid, Oid oldRelOid,
Form_pg_index indexform;
bool indisvalid;
- locTuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(relOid));
+ locTuple = SearchSysCache(INDEXRELID, ObjectIdGetDatum(relOid));
if (!HeapTupleIsValid(locTuple))
{
ReleaseSysCache(tuple);
@@ -3332,7 +3332,7 @@ SetRelationHasSubclass(Oid relationId, bool relhassubclass)
* Fetch a modifiable copy of the tuple, modify it, update pg_class.
*/
relationRelation = table_open(RelationRelationId, RowExclusiveLock);
- tuple = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relationId));
+ tuple = SearchSysCacheCopy(RELOID, ObjectIdGetDatum(relationId));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", relationId);
classtuple = (Form_pg_class) GETSTRUCT(tuple);
@@ -3434,7 +3434,7 @@ SetRelationTableSpace(Relation rel,
/* Get a modifiable copy of the relation's pg_class row. */
pg_class = table_open(RelationRelationId, RowExclusiveLock);
- tuple = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(reloid));
+ tuple = SearchSysCacheCopy(RELOID, ObjectIdGetDatum(reloid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", reloid);
rd_rel = (Form_pg_class) GETSTRUCT(tuple);
@@ -3662,7 +3662,7 @@ RangeVarCallbackForRenameAttribute(const RangeVar *rv, Oid relid, Oid oldrelid,
HeapTuple tuple;
Form_pg_class form;
- tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
+ tuple = SearchSysCache(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tuple))
return; /* concurrently dropped */
form = (Form_pg_class) GETSTRUCT(tuple);
@@ -3747,7 +3747,7 @@ rename_constraint_internal(Oid myrelid,
constraintOid = get_relation_constraint_oid(myrelid, oldconname, false);
}
- tuple = SearchSysCache1(CONSTROID, ObjectIdGetDatum(constraintOid));
+ tuple = SearchSysCache(CONSTROID, ObjectIdGetDatum(constraintOid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for constraint %u",
constraintOid);
@@ -3832,7 +3832,7 @@ RenameConstraint(RenameStmt *stmt)
typid = typenameTypeId(NULL, makeTypeNameFromNameList(castNode(List, stmt->object)));
rel = table_open(TypeRelationId, RowExclusiveLock);
- tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
+ tup = SearchSysCache(TYPEOID, ObjectIdGetDatum(typid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for type %u", typid);
checkDomainOwner(tup);
@@ -3960,7 +3960,7 @@ RenameRelationInternal(Oid myrelid, const char *newrelname, bool is_internal, bo
*/
relrelation = table_open(RelationRelationId, RowExclusiveLock);
- reltup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(myrelid));
+ reltup = SearchSysCacheCopy(RELOID, ObjectIdGetDatum(myrelid));
if (!HeapTupleIsValid(reltup)) /* shouldn't happen */
elog(ERROR, "cache lookup failed for relation %u", myrelid);
relform = (Form_pg_class) GETSTRUCT(reltup);
@@ -4035,7 +4035,7 @@ ResetRelRewrite(Oid myrelid)
*/
relrelation = table_open(RelationRelationId, RowExclusiveLock);
- reltup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(myrelid));
+ reltup = SearchSysCacheCopy(RELOID, ObjectIdGetDatum(myrelid));
if (!HeapTupleIsValid(reltup)) /* shouldn't happen */
elog(ERROR, "cache lookup failed for relation %u", myrelid);
relform = (Form_pg_class) GETSTRUCT(reltup);
@@ -6893,7 +6893,7 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
pgclass = table_open(RelationRelationId, RowExclusiveLock);
- reltup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(myrelid));
+ reltup = SearchSysCacheCopy(RELOID, ObjectIdGetDatum(myrelid));
if (!HeapTupleIsValid(reltup))
elog(ERROR, "cache lookup failed for relation %u", myrelid);
relkind = ((Form_pg_class) GETSTRUCT(reltup))->relkind;
@@ -7193,9 +7193,9 @@ check_for_column_name_collision(Relation rel, const char *colname,
* 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.
*/
- attTuple = SearchSysCache2(ATTNAME,
- ObjectIdGetDatum(RelationGetRelid(rel)),
- PointerGetDatum(colname));
+ attTuple = SearchSysCache(ATTNAME,
+ ObjectIdGetDatum(RelationGetRelid(rel)),
+ PointerGetDatum(colname));
if (!HeapTupleIsValid(attTuple))
return true;
@@ -7355,7 +7355,7 @@ ATExecDropNotNull(Relation rel, const char *colName, LOCKMODE lockmode)
Form_pg_index indexStruct;
int i;
- indexTuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexoid));
+ indexTuple = SearchSysCache(INDEXRELID, ObjectIdGetDatum(indexoid));
if (!HeapTupleIsValid(indexTuple))
elog(ERROR, "cache lookup failed for index %u", indexoid);
indexStruct = (Form_pg_index) GETSTRUCT(indexTuple);
@@ -9308,7 +9308,7 @@ ATAddForeignKeyConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel,
Oid pfeqop_right;
/* We need several fields out of the pg_opclass entry */
- cla_ht = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclasses[i]));
+ cla_ht = SearchSysCache(CLAOID, ObjectIdGetDatum(opclasses[i]));
if (!HeapTupleIsValid(cla_ht))
elog(ERROR, "cache lookup failed for opclass %u", opclasses[i]);
cla_tup = (Form_pg_opclass) GETSTRUCT(cla_ht);
@@ -10131,7 +10131,7 @@ CloneFkReferenced(Relation parentRel, Relation partitionRel)
Oid deleteTriggerOid,
updateTriggerOid;
- tuple = SearchSysCache1(CONSTROID, constrOid);
+ tuple = SearchSysCache(CONSTROID, constrOid);
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for constraint %u", constrOid);
constrForm = (Form_pg_constraint) GETSTRUCT(tuple);
@@ -10337,7 +10337,7 @@ CloneFkReferencing(List **wqueue, Relation parentRel, Relation partRel)
Oid insertTriggerOid,
updateTriggerOid;
- tuple = SearchSysCache1(CONSTROID, parentConstrOid);
+ tuple = SearchSysCache(CONSTROID, parentConstrOid);
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for constraint %u",
parentConstrOid);
@@ -10555,8 +10555,8 @@ tryAttachPartitionForeignKey(ForeignKeyCacheInfo *fk,
Oid insertTriggerOid,
updateTriggerOid;
- parentConstrTup = SearchSysCache1(CONSTROID,
- ObjectIdGetDatum(parentConstrOid));
+ parentConstrTup = SearchSysCache(CONSTROID,
+ ObjectIdGetDatum(parentConstrOid));
if (!HeapTupleIsValid(parentConstrTup))
elog(ERROR, "cache lookup failed for constraint %u", parentConstrOid);
parentConstr = (Form_pg_constraint) GETSTRUCT(parentConstrTup);
@@ -10586,8 +10586,8 @@ tryAttachPartitionForeignKey(ForeignKeyCacheInfo *fk,
* for 'convalidated' could be dropped, since we don't really care about
* that, but let's be careful for now.
*/
- partcontup = SearchSysCache1(CONSTROID,
- ObjectIdGetDatum(fk->conoid));
+ partcontup = SearchSysCache(CONSTROID,
+ ObjectIdGetDatum(fk->conoid));
if (!HeapTupleIsValid(partcontup))
elog(ERROR, "cache lookup failed for constraint %u", fk->conoid);
partConstr = (Form_pg_constraint) GETSTRUCT(partcontup);
@@ -10872,7 +10872,7 @@ ATExecAlterConstraint(Relation rel, AlterTableCmd *cmd, bool recurse,
char *ancestortable = NULL;
/* Loop to find the topmost constraint */
- while (HeapTupleIsValid(tp = SearchSysCache1(CONSTROID, ObjectIdGetDatum(parent))))
+ while (HeapTupleIsValid(tp = SearchSysCache(CONSTROID, ObjectIdGetDatum(parent))))
{
Form_pg_constraint contup = (Form_pg_constraint) GETSTRUCT(tp);
@@ -11345,7 +11345,7 @@ transformFkeyGetPrimaryKey(Relation pkrel, Oid *indexOid,
{
Oid indexoid = lfirst_oid(indexoidscan);
- indexTuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexoid));
+ indexTuple = SearchSysCache(INDEXRELID, ObjectIdGetDatum(indexoid));
if (!HeapTupleIsValid(indexTuple))
elog(ERROR, "cache lookup failed for index %u", indexoid);
indexStruct = (Form_pg_index) GETSTRUCT(indexTuple);
@@ -11457,7 +11457,7 @@ transformFkeyCheckAttrs(Relation pkrel,
Form_pg_index indexStruct;
indexoid = lfirst_oid(indexoidscan);
- indexTuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexoid));
+ indexTuple = SearchSysCache(INDEXRELID, ObjectIdGetDatum(indexoid));
if (!HeapTupleIsValid(indexTuple))
elog(ERROR, "cache lookup failed for index %u", indexoid);
indexStruct = (Form_pg_index) GETSTRUCT(indexTuple);
@@ -13212,7 +13212,7 @@ ATPostAlterTypeCleanup(List **wqueue, AlteredTableInfo *tab, LOCKMODE lockmode)
char contype;
bool conislocal;
- tup = SearchSysCache1(CONSTROID, ObjectIdGetDatum(oldId));
+ tup = SearchSysCache(CONSTROID, ObjectIdGetDatum(oldId));
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for constraint %u", oldId);
con = (Form_pg_constraint) GETSTRUCT(tup);
@@ -13642,7 +13642,7 @@ TryReuseForeignKey(Oid oldId, Constraint *con)
Assert(con->contype == CONSTR_FOREIGN);
Assert(con->old_conpfeqop == NIL); /* already prepared this node */
- tup = SearchSysCache1(CONSTROID, ObjectIdGetDatum(oldId));
+ tup = SearchSysCache(CONSTROID, ObjectIdGetDatum(oldId));
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for constraint %u", oldId);
@@ -13696,7 +13696,7 @@ ATExecAlterColumnGenericOptions(Relation rel,
/* First, determine FDW validator associated to the foreign table. */
ftrel = table_open(ForeignTableRelationId, AccessShareLock);
- tuple = SearchSysCache1(FOREIGNTABLEREL, rel->rd_id);
+ tuple = SearchSysCache(FOREIGNTABLEREL, rel->rd_id);
if (!HeapTupleIsValid(tuple))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -13803,7 +13803,7 @@ ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing, LOCKMODE lock
/* Get its pg_class tuple, too */
class_rel = table_open(RelationRelationId, RowExclusiveLock);
- tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relationOid));
+ tuple = SearchSysCache(RELOID, ObjectIdGetDatum(relationOid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", relationOid);
tuple_class = (Form_pg_class) GETSTRUCT(tuple);
@@ -14275,7 +14275,7 @@ ATExecSetRelOptions(Relation rel, List *defList, AlterTableType operation,
/* Fetch heap tuple */
relid = RelationGetRelid(rel);
- tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
+ tuple = SearchSysCache(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", relid);
@@ -14395,7 +14395,7 @@ ATExecSetRelOptions(Relation rel, List *defList, AlterTableType operation,
toastrel = table_open(toastid, lockmode);
/* Fetch heap tuple */
- tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(toastid));
+ tuple = SearchSysCache(RELOID, ObjectIdGetDatum(toastid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", toastid);
@@ -15825,7 +15825,7 @@ ATExecAddOf(Relation rel, const TypeName *ofTypename, LOCKMODE lockmode)
/* Update pg_class.reloftype */
relationRelation = table_open(RelationRelationId, RowExclusiveLock);
- classtuple = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relid));
+ classtuple = SearchSysCacheCopy(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(classtuple))
elog(ERROR, "cache lookup failed for relation %u", relid);
((Form_pg_class) GETSTRUCT(classtuple))->reloftype = typeid;
@@ -15870,7 +15870,7 @@ ATExecDropOf(Relation rel, LOCKMODE lockmode)
/* Clear pg_class.reloftype */
relationRelation = table_open(RelationRelationId, RowExclusiveLock);
- tuple = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relid));
+ tuple = SearchSysCacheCopy(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", relid);
((Form_pg_class) GETSTRUCT(tuple))->reloftype = InvalidOid;
@@ -15907,8 +15907,8 @@ relation_mark_replica_identity(Relation rel, char ri_type, Oid indexOid,
* Check whether relreplident has changed, and update it if so.
*/
pg_class = table_open(RelationRelationId, RowExclusiveLock);
- pg_class_tuple = SearchSysCacheCopy1(RELOID,
- ObjectIdGetDatum(RelationGetRelid(rel)));
+ pg_class_tuple = SearchSysCacheCopy(RELOID,
+ ObjectIdGetDatum(RelationGetRelid(rel)));
if (!HeapTupleIsValid(pg_class_tuple))
elog(ERROR, "cache lookup failed for relation \"%s\"",
RelationGetRelationName(rel));
@@ -15930,8 +15930,8 @@ relation_mark_replica_identity(Relation rel, char ri_type, Oid indexOid,
Oid thisIndexOid = lfirst_oid(index);
bool dirty = false;
- pg_index_tuple = SearchSysCacheCopy1(INDEXRELID,
- ObjectIdGetDatum(thisIndexOid));
+ pg_index_tuple = SearchSysCacheCopy(INDEXRELID,
+ ObjectIdGetDatum(thisIndexOid));
if (!HeapTupleIsValid(pg_index_tuple))
elog(ERROR, "cache lookup failed for index %u", thisIndexOid);
pg_index_form = (Form_pg_index) GETSTRUCT(pg_index_tuple);
@@ -16099,7 +16099,7 @@ ATExecSetRowSecurity(Relation rel, bool rls)
/* Pull the record for this relation and update it */
pg_class = table_open(RelationRelationId, RowExclusiveLock);
- tuple = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relid));
+ tuple = SearchSysCacheCopy(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", relid);
@@ -16125,7 +16125,7 @@ ATExecForceNoForceRowSecurity(Relation rel, bool force_rls)
pg_class = table_open(RelationRelationId, RowExclusiveLock);
- tuple = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relid));
+ tuple = SearchSysCacheCopy(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", relid);
@@ -16159,7 +16159,7 @@ ATExecGenericOptions(Relation rel, List *options)
ftrel = table_open(ForeignTableRelationId, RowExclusiveLock);
- tuple = SearchSysCacheCopy1(FOREIGNTABLEREL, rel->rd_id);
+ tuple = SearchSysCacheCopy(FOREIGNTABLEREL, rel->rd_id);
if (!HeapTupleIsValid(tuple))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -16540,7 +16540,7 @@ AlterRelationNamespaceInternal(Relation classRel, Oid relOid,
ObjectAddress thisobj;
bool already_done = false;
- classTup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relOid));
+ classTup = SearchSysCacheCopy(RELOID, ObjectIdGetDatum(relOid));
if (!HeapTupleIsValid(classTup))
elog(ERROR, "cache lookup failed for relation %u", relOid);
classForm = (Form_pg_class) GETSTRUCT(classTup);
@@ -17024,7 +17024,7 @@ RangeVarCallbackForTruncate(const RangeVar *relation,
if (!OidIsValid(relId))
return;
- tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relId));
+ tuple = SearchSysCache(RELOID, ObjectIdGetDatum(relId));
if (!HeapTupleIsValid(tuple)) /* should not happen */
elog(ERROR, "cache lookup failed for relation %u", relId);
@@ -17048,7 +17048,7 @@ RangeVarCallbackOwnsRelation(const RangeVar *relation,
if (!OidIsValid(relId))
return;
- tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relId));
+ tuple = SearchSysCache(RELOID, ObjectIdGetDatum(relId));
if (!HeapTupleIsValid(tuple)) /* should not happen */
elog(ERROR, "cache lookup failed for relation %u", relId);
@@ -17081,7 +17081,7 @@ RangeVarCallbackForAlterRelation(const RangeVar *rv, Oid relid, Oid oldrelid,
AclResult aclresult;
char relkind;
- tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
+ tuple = SearchSysCache(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tuple))
return; /* concurrently dropped */
classform = (Form_pg_class) GETSTRUCT(tuple);
@@ -17859,9 +17859,9 @@ ATExecAttachPartition(List **wqueue, Relation rel, PartitionCmd *cmd,
continue;
/* Try to find the column in parent (matching on column name) */
- if (!SearchSysCacheExists2(ATTNAME,
- ObjectIdGetDatum(RelationGetRelid(rel)),
- CStringGetDatum(attributeName)))
+ if (!SearchSysCacheExists(ATTNAME,
+ ObjectIdGetDatum(RelationGetRelid(rel)),
+ CStringGetDatum(attributeName)))
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("table \"%s\" contains column \"%s\" not found in parent \"%s\"",
@@ -18556,7 +18556,7 @@ DetachPartitionFinalize(Relation rel, Relation partRel, bool concurrent,
Oid insertTriggerOid,
updateTriggerOid;
- contup = SearchSysCache1(CONSTROID, ObjectIdGetDatum(fk->conoid));
+ contup = SearchSysCache(CONSTROID, ObjectIdGetDatum(fk->conoid));
if (!HeapTupleIsValid(contup))
elog(ERROR, "cache lookup failed for constraint %u", fk->conoid);
conform = (Form_pg_constraint) GETSTRUCT(contup);
@@ -18670,8 +18670,8 @@ DetachPartitionFinalize(Relation rel, Relation partRel, bool concurrent,
/* Update pg_class tuple */
classRel = table_open(RelationRelationId, RowExclusiveLock);
- tuple = SearchSysCacheCopy1(RELOID,
- ObjectIdGetDatum(RelationGetRelid(partRel)));
+ tuple = SearchSysCacheCopy(RELOID,
+ ObjectIdGetDatum(RelationGetRelid(partRel)));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u",
RelationGetRelid(partRel));
@@ -18921,7 +18921,7 @@ RangeVarCallbackForAttachIndex(const RangeVar *rv, Oid relOid, Oid oldRelOid,
if (!OidIsValid(relOid))
return;
- tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relOid));
+ tuple = SearchSysCache(RELOID, ObjectIdGetDatum(relOid));
if (!HeapTupleIsValid(tuple))
return; /* concurrently dropped, so nothing to do */
classform = (Form_pg_class) GETSTRUCT(tuple);
@@ -19150,8 +19150,8 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl)
HeapTuple indTup;
Form_pg_index indexForm;
- indTup = SearchSysCache1(INDEXRELID,
- ObjectIdGetDatum(inhForm->inhrelid));
+ indTup = SearchSysCache(INDEXRELID,
+ ObjectIdGetDatum(inhForm->inhrelid));
if (!HeapTupleIsValid(indTup))
elog(ERROR, "cache lookup failed for index %u", inhForm->inhrelid);
indexForm = (Form_pg_index) GETSTRUCT(indTup);
@@ -19284,7 +19284,7 @@ ATDetachCheckNoForeignKeyRefs(Relation partition)
Relation rel;
Trigger trig = {0};
- tuple = SearchSysCache1(CONSTROID, ObjectIdGetDatum(constrOid));
+ tuple = SearchSysCache(CONSTROID, ObjectIdGetDatum(constrOid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for constraint %u", constrOid);
constrForm = (Form_pg_constraint) GETSTRUCT(tuple);
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c
index 0f2de7e2e0..395c6ddcdf 100644
--- a/src/backend/commands/trigger.c
+++ b/src/backend/commands/trigger.c
@@ -1020,8 +1020,8 @@ CreateTriggerFiringOn(CreateTrigStmt *stmt, const char *queryString,
* message to make other backends (and this one) rebuild relcache entries.
*/
pgrel = table_open(RelationRelationId, RowExclusiveLock);
- tuple = SearchSysCacheCopy1(RELOID,
- ObjectIdGetDatum(RelationGetRelid(rel)));
+ tuple = SearchSysCacheCopy(RELOID,
+ ObjectIdGetDatum(RelationGetRelid(rel)));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u",
RelationGetRelid(rel));
@@ -1430,7 +1430,7 @@ RangeVarCallbackForRenameTrigger(const RangeVar *rv, Oid relid, Oid oldrelid,
HeapTuple tuple;
Form_pg_class form;
- tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
+ tuple = SearchSysCache(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tuple))
return; /* concurrently dropped */
form = (Form_pg_class) GETSTRUCT(tuple);
diff --git a/src/backend/commands/tsearchcmds.c b/src/backend/commands/tsearchcmds.c
index 23e62a31a1..00d9acac27 100644
--- a/src/backend/commands/tsearchcmds.c
+++ b/src/backend/commands/tsearchcmds.c
@@ -349,7 +349,7 @@ verify_dictoptions(Oid tmplId, List *dictoptions)
if (!IsUnderPostmaster)
return;
- tup = SearchSysCache1(TSTEMPLATEOID, ObjectIdGetDatum(tmplId));
+ tup = SearchSysCache(TSTEMPLATEOID, ObjectIdGetDatum(tmplId));
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for text search template %u",
tmplId);
@@ -503,7 +503,7 @@ AlterTSDictionary(AlterTSDictionaryStmt *stmt)
rel = table_open(TSDictionaryRelationId, RowExclusiveLock);
- tup = SearchSysCache1(TSDICTOID, ObjectIdGetDatum(dictId));
+ tup = SearchSysCache(TSDICTOID, ObjectIdGetDatum(dictId));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for text search dictionary %u",
@@ -787,7 +787,7 @@ GetTSConfigTuple(List *names)
if (!OidIsValid(cfgId))
return NULL;
- tup = SearchSysCache1(TSCONFIGOID, ObjectIdGetDatum(cfgId));
+ tup = SearchSysCache(TSCONFIGOID, ObjectIdGetDatum(cfgId));
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for text search configuration %u",
@@ -954,7 +954,7 @@ DefineTSConfiguration(List *names, List *parameters, ObjectAddress *copied)
{
Form_pg_ts_config cfg;
- tup = SearchSysCache1(TSCONFIGOID, ObjectIdGetDatum(sourceOid));
+ tup = SearchSysCache(TSCONFIGOID, ObjectIdGetDatum(sourceOid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for text search configuration %u",
sourceOid);
@@ -1110,7 +1110,7 @@ RemoveTSConfigurationById(Oid cfgId)
/* Remove the pg_ts_config entry */
relCfg = table_open(TSConfigRelationId, RowExclusiveLock);
- tup = SearchSysCache1(TSCONFIGOID, ObjectIdGetDatum(cfgId));
+ tup = SearchSysCache(TSCONFIGOID, ObjectIdGetDatum(cfgId));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for text search dictionary %u",
diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c
index 3440dbc440..adb0ede2d0 100644
--- a/src/backend/commands/typecmds.c
+++ b/src/backend/commands/typecmds.c
@@ -231,9 +231,9 @@ DefineType(ParseState *pstate, List *names, List *parameters)
/*
* Look to see if type already exists.
*/
- typoid = GetSysCacheOid2(TYPENAMENSP, Anum_pg_type_oid,
- CStringGetDatum(typeName),
- ObjectIdGetDatum(typeNamespace));
+ typoid = GetSysCacheOid(TYPENAMENSP, Anum_pg_type_oid,
+ CStringGetDatum(typeName),
+ ObjectIdGetDatum(typeNamespace));
/*
* If it's not a shell, see if it's an autogenerated array type, and if so
@@ -657,7 +657,7 @@ RemoveTypeById(Oid typeOid)
relation = table_open(TypeRelationId, RowExclusiveLock);
- tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typeOid));
+ tup = SearchSysCache(TYPEOID, ObjectIdGetDatum(typeOid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for type %u", typeOid);
@@ -743,9 +743,9 @@ DefineDomain(CreateDomainStmt *stmt)
* Check for collision with an existing type name. If there is one and
* it's an autogenerated array, we can rename it out of the way.
*/
- old_type_oid = GetSysCacheOid2(TYPENAMENSP, Anum_pg_type_oid,
- CStringGetDatum(domainName),
- ObjectIdGetDatum(domainNamespace));
+ old_type_oid = GetSysCacheOid(TYPENAMENSP, Anum_pg_type_oid,
+ CStringGetDatum(domainName),
+ ObjectIdGetDatum(domainNamespace));
if (OidIsValid(old_type_oid))
{
if (!moveArrayTypeName(old_type_oid, domainName, domainNamespace))
@@ -1158,9 +1158,9 @@ DefineEnum(CreateEnumStmt *stmt)
* Check for collision with an existing type name. If there is one and
* it's an autogenerated array, we can rename it out of the way.
*/
- old_type_oid = GetSysCacheOid2(TYPENAMENSP, Anum_pg_type_oid,
- CStringGetDatum(enumName),
- ObjectIdGetDatum(enumNamespace));
+ old_type_oid = GetSysCacheOid(TYPENAMENSP, Anum_pg_type_oid,
+ CStringGetDatum(enumName),
+ ObjectIdGetDatum(enumNamespace));
if (OidIsValid(old_type_oid))
{
if (!moveArrayTypeName(old_type_oid, enumName, enumNamespace))
@@ -1269,7 +1269,7 @@ AlterEnum(AlterEnumStmt *stmt)
typename = makeTypeNameFromNameList(stmt->typeName);
enum_type_oid = typenameTypeId(NULL, typename);
- tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(enum_type_oid));
+ tup = SearchSysCache(TYPEOID, ObjectIdGetDatum(enum_type_oid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for type %u", enum_type_oid);
@@ -1377,9 +1377,9 @@ DefineRange(ParseState *pstate, CreateRangeStmt *stmt)
/*
* Look to see if type already exists.
*/
- typoid = GetSysCacheOid2(TYPENAMENSP, Anum_pg_type_oid,
- CStringGetDatum(typeName),
- ObjectIdGetDatum(typeNamespace));
+ typoid = GetSysCacheOid(TYPENAMENSP, Anum_pg_type_oid,
+ CStringGetDatum(typeName),
+ ObjectIdGetDatum(typeNamespace));
/*
* If it's not a shell, see if it's an autogenerated array type, and if so
@@ -1559,9 +1559,9 @@ DefineRange(ParseState *pstate, CreateRangeStmt *stmt)
/*
* Look to see if multirange type already exists.
*/
- old_typoid = GetSysCacheOid2(TYPENAMENSP, Anum_pg_type_oid,
- CStringGetDatum(multirangeTypeName),
- ObjectIdGetDatum(multirangeNamespace));
+ old_typoid = GetSysCacheOid(TYPENAMENSP, Anum_pg_type_oid,
+ CStringGetDatum(multirangeTypeName),
+ ObjectIdGetDatum(multirangeNamespace));
/*
* If it's not a shell, see if it's an autogenerated array type, and
@@ -2535,9 +2535,9 @@ DefineCompositeType(RangeVar *typevar, List *coldeflist)
NoLock, NULL);
RangeVarAdjustRelationPersistence(createStmt->relation, typeNamespace);
old_type_oid =
- GetSysCacheOid2(TYPENAMENSP, Anum_pg_type_oid,
- CStringGetDatum(createStmt->relation->relname),
- ObjectIdGetDatum(typeNamespace));
+ GetSysCacheOid(TYPENAMENSP, Anum_pg_type_oid,
+ CStringGetDatum(createStmt->relation->relname),
+ ObjectIdGetDatum(typeNamespace));
if (OidIsValid(old_type_oid))
{
if (!moveArrayTypeName(old_type_oid, createStmt->relation->relname, typeNamespace))
@@ -2586,7 +2586,7 @@ AlterDomainDefault(List *names, Node *defaultRaw)
/* Look up the domain in the type table */
rel = table_open(TypeRelationId, RowExclusiveLock);
- tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(domainoid));
+ tup = SearchSysCacheCopy(TYPEOID, ObjectIdGetDatum(domainoid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for type %u", domainoid);
typTup = (Form_pg_type) GETSTRUCT(tup);
@@ -2708,7 +2708,7 @@ AlterDomainNotNull(List *names, bool notNull)
/* Look up the domain in the type table */
typrel = table_open(TypeRelationId, RowExclusiveLock);
- tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(domainoid));
+ tup = SearchSysCacheCopy(TYPEOID, ObjectIdGetDatum(domainoid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for type %u", domainoid);
typTup = (Form_pg_type) GETSTRUCT(tup);
@@ -2833,7 +2833,7 @@ AlterDomainDropConstraint(List *names, const char *constrName,
/* Look up the domain in the type table */
rel = table_open(TypeRelationId, RowExclusiveLock);
- tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(domainoid));
+ tup = SearchSysCacheCopy(TYPEOID, ObjectIdGetDatum(domainoid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for type %u", domainoid);
@@ -2930,7 +2930,7 @@ AlterDomainAddConstraint(List *names, Node *newConstraint,
/* Look up the domain in the type table */
typrel = table_open(TypeRelationId, RowExclusiveLock);
- tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(domainoid));
+ tup = SearchSysCacheCopy(TYPEOID, ObjectIdGetDatum(domainoid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for type %u", domainoid);
typTup = (Form_pg_type) GETSTRUCT(tup);
@@ -3051,7 +3051,7 @@ AlterDomainValidateConstraint(List *names, const char *constrName)
/* Look up the domain in the type table */
typrel = table_open(TypeRelationId, AccessShareLock);
- tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(domainoid));
+ tup = SearchSysCache(TYPEOID, ObjectIdGetDatum(domainoid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for type %u", domainoid);
@@ -3606,7 +3606,7 @@ RenameType(RenameStmt *stmt)
/* Look up the type in the type table */
rel = table_open(TypeRelationId, RowExclusiveLock);
- tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(typeOid));
+ tup = SearchSysCacheCopy(TYPEOID, ObjectIdGetDatum(typeOid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for type %u", typeOid);
typTup = (Form_pg_type) GETSTRUCT(tup);
@@ -3781,7 +3781,7 @@ AlterTypeOwner_oid(Oid typeOid, Oid newOwnerId, bool hasDependEntry)
rel = table_open(TypeRelationId, RowExclusiveLock);
- tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typeOid));
+ tup = SearchSysCache(TYPEOID, ObjectIdGetDatum(typeOid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for type %u", typeOid);
typTup = (Form_pg_type) GETSTRUCT(tup);
@@ -3827,7 +3827,7 @@ AlterTypeOwnerInternal(Oid typeOid, Oid newOwnerId)
rel = table_open(TypeRelationId, RowExclusiveLock);
- tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(typeOid));
+ tup = SearchSysCacheCopy(TYPEOID, ObjectIdGetDatum(typeOid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for type %u", typeOid);
typTup = (Form_pg_type) GETSTRUCT(tup);
@@ -3968,7 +3968,7 @@ AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid,
rel = table_open(TypeRelationId, RowExclusiveLock);
- tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(typeOid));
+ tup = SearchSysCacheCopy(TYPEOID, ObjectIdGetDatum(typeOid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for type %u", typeOid);
typform = (Form_pg_type) GETSTRUCT(tup);
@@ -3983,9 +3983,9 @@ AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid,
CheckSetNamespace(oldNspOid, nspOid);
/* check for duplicate name (more friendly than unique-index failure) */
- if (SearchSysCacheExists2(TYPENAMENSP,
- NameGetDatum(&typform->typname),
- ObjectIdGetDatum(nspOid)))
+ if (SearchSysCacheExists(TYPENAMENSP,
+ NameGetDatum(&typform->typname),
+ ObjectIdGetDatum(nspOid)))
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT),
errmsg("type \"%s\" already exists in schema \"%s\"",
@@ -4426,7 +4426,7 @@ AlterTypeRecurse(Oid typeOid, bool isImplicitArray,
HeapTuple arrtup;
AlterTypeRecurseParams arrparams;
- arrtup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(arrtypoid));
+ arrtup = SearchSysCache(TYPEOID, ObjectIdGetDatum(arrtypoid));
if (!HeapTupleIsValid(arrtup))
elog(ERROR, "cache lookup failed for type %u", arrtypoid);
diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c
index 707114bdd0..37344971db 100644
--- a/src/backend/commands/user.c
+++ b/src/backend/commands/user.c
@@ -1127,7 +1127,7 @@ DropRole(DropRoleStmt *stmt)
errmsg("cannot use special role specifier in DROP ROLE")));
role = rolspec->rolename;
- tuple = SearchSysCache1(AUTHNAME, PointerGetDatum(role));
+ tuple = SearchSysCache(AUTHNAME, PointerGetDatum(role));
if (!HeapTupleIsValid(tuple))
{
if (!stmt->missing_ok)
@@ -1287,7 +1287,7 @@ DropRole(DropRoleStmt *stmt)
* for the tuple to have been deleted -- or for that matter updated --
* unless the user is manually modifying the system catalogs.
*/
- tuple = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid));
+ tuple = SearchSysCache(AUTHOID, ObjectIdGetDatum(roleid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "could not find tuple for role %u", roleid);
roleform = (Form_pg_authid) GETSTRUCT(tuple);
@@ -1357,7 +1357,7 @@ RenameRole(const char *oldname, const char *newname)
rel = table_open(AuthIdRelationId, RowExclusiveLock);
dsc = RelationGetDescr(rel);
- oldtuple = SearchSysCache1(AUTHNAME, CStringGetDatum(oldname));
+ oldtuple = SearchSysCache(AUTHNAME, CStringGetDatum(oldname));
if (!HeapTupleIsValid(oldtuple))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -1411,7 +1411,7 @@ RenameRole(const char *oldname, const char *newname)
#endif
/* make sure the new name doesn't exist */
- if (SearchSysCacheExists1(AUTHNAME, CStringGetDatum(newname)))
+ if (SearchSysCacheExists(AUTHNAME, CStringGetDatum(newname)))
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT),
errmsg("role \"%s\" already exists", newname)));
@@ -1775,8 +1775,8 @@ AddRoleMems(Oid currentUserId, const char *rolename, Oid roleid,
int i;
/* Get the list of members for this role. */
- memlist = SearchSysCacheList1(AUTHMEMROLEMEM,
- ObjectIdGetDatum(roleid));
+ memlist = SearchSysCacheList(AUTHMEMROLEMEM,
+ ObjectIdGetDatum(roleid));
/*
* Figure out what would happen if we removed all existing grants to
@@ -1842,10 +1842,10 @@ AddRoleMems(Oid currentUserId, const char *rolename, Oid roleid,
ObjectIdGetDatum(grantorId);
/* Find any existing tuple */
- authmem_tuple = SearchSysCache3(AUTHMEMROLEMEM,
- ObjectIdGetDatum(roleid),
- ObjectIdGetDatum(memberid),
- ObjectIdGetDatum(grantorId));
+ authmem_tuple = SearchSysCache(AUTHMEMROLEMEM,
+ ObjectIdGetDatum(roleid),
+ ObjectIdGetDatum(memberid),
+ ObjectIdGetDatum(grantorId));
/*
* If we found a tuple, update it with new option values, unless
@@ -1935,7 +1935,7 @@ AddRoleMems(Oid currentUserId, const char *rolename, Oid roleid,
HeapTuple mrtup;
Form_pg_authid mrform;
- mrtup = SearchSysCache1(AUTHOID, memberid);
+ mrtup = SearchSysCache(AUTHOID, memberid);
if (!HeapTupleIsValid(mrtup))
elog(ERROR, "cache lookup failed for role %u", memberid);
mrform = (Form_pg_authid) GETSTRUCT(mrtup);
@@ -2010,7 +2010,7 @@ DelRoleMems(Oid currentUserId, const char *rolename, Oid roleid,
LockSharedObject(AuthIdRelationId, roleid, 0,
ShareUpdateExclusiveLock);
- memlist = SearchSysCacheList1(AUTHMEMROLEMEM, ObjectIdGetDatum(roleid));
+ memlist = SearchSysCacheList(AUTHMEMROLEMEM, ObjectIdGetDatum(roleid));
actions = initialize_revoke_actions(memlist);
/*
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index c54360a6a0..d1043d81e5 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -821,7 +821,7 @@ expand_vacuum_rel(VacuumRelation *vrel, int options)
* To check whether the relation is a partitioned table and its
* ownership, fetch its syscache entry.
*/
- tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
+ tuple = SearchSysCache(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", relid);
classForm = (Form_pg_class) GETSTRUCT(tuple);
@@ -1327,7 +1327,7 @@ vac_update_relstats(Relation relation,
rd = table_open(RelationRelationId, RowExclusiveLock);
/* Fetch a copy of the tuple to scribble on */
- ctup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relid));
+ ctup = SearchSysCacheCopy(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(ctup))
elog(ERROR, "pg_class entry for relid %u vanished during vacuuming",
relid);
diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index f0f2e07655..e788912516 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -822,7 +822,7 @@ check_session_authorization(char **newval, void **extra, GucSource source)
}
/* Look up the username */
- roleTup = SearchSysCache1(AUTHNAME, PointerGetDatum(*newval));
+ roleTup = SearchSysCache(AUTHNAME, PointerGetDatum(*newval));
if (!HeapTupleIsValid(roleTup))
{
/*
@@ -913,7 +913,7 @@ check_role(char **newval, void **extra, GucSource source)
*/
/* Look up the username */
- roleTup = SearchSysCache1(AUTHNAME, PointerGetDatum(*newval));
+ roleTup = SearchSysCache(AUTHNAME, PointerGetDatum(*newval));
if (!HeapTupleIsValid(roleTup))
{
if (source == PGC_S_TEST)
diff --git a/src/backend/executor/execAmi.c b/src/backend/executor/execAmi.c
index 9d18ce8c6b..4e40aa6d58 100644
--- a/src/backend/executor/execAmi.c
+++ b/src/backend/executor/execAmi.c
@@ -609,7 +609,7 @@ IndexSupportsBackwardScan(Oid indexid)
IndexAmRoutine *amroutine;
/* Fetch the pg_class tuple of the index relation */
- ht_idxrel = SearchSysCache1(RELOID, ObjectIdGetDatum(indexid));
+ ht_idxrel = SearchSysCache(RELOID, ObjectIdGetDatum(indexid));
if (!HeapTupleIsValid(ht_idxrel))
elog(ERROR, "cache lookup failed for relation %u", indexid);
idxrelrec = (Form_pg_class) GETSTRUCT(ht_idxrel);
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c
index f55424eb5a..a18758f0b2 100644
--- a/src/backend/executor/functions.c
+++ b/src/backend/executor/functions.c
@@ -618,7 +618,7 @@ init_sql_fcache(FunctionCallInfo fcinfo, Oid collation, bool lazyEvalOK)
/*
* get the procedure tuple corresponding to the given function Oid
*/
- procedureTuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(foid));
+ procedureTuple = SearchSysCache(PROCOID, ObjectIdGetDatum(foid));
if (!HeapTupleIsValid(procedureTuple))
elog(ERROR, "cache lookup failed for function %u", foid);
procedureStruct = (Form_pg_proc) GETSTRUCT(procedureTuple);
diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c
index 19342a420c..38645fdcb8 100644
--- a/src/backend/executor/nodeAgg.c
+++ b/src/backend/executor/nodeAgg.c
@@ -3673,8 +3673,8 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
peragg->transno = aggref->aggtransno;
/* Fetch the pg_aggregate row */
- aggTuple = SearchSysCache1(AGGFNOID,
- ObjectIdGetDatum(aggref->aggfnoid));
+ aggTuple = SearchSysCache(AGGFNOID,
+ ObjectIdGetDatum(aggref->aggfnoid));
if (!HeapTupleIsValid(aggTuple))
elog(ERROR, "cache lookup failed for aggregate %u",
aggref->aggfnoid);
@@ -3738,8 +3738,8 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
{
HeapTuple procTuple;
- procTuple = SearchSysCache1(PROCOID,
- ObjectIdGetDatum(aggref->aggfnoid));
+ procTuple = SearchSysCache(PROCOID,
+ ObjectIdGetDatum(aggref->aggfnoid));
if (!HeapTupleIsValid(procTuple))
elog(ERROR, "cache lookup failed for function %u",
aggref->aggfnoid);
diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c
index a45bd3a315..64db64e4c5 100644
--- a/src/backend/executor/nodeHash.c
+++ b/src/backend/executor/nodeHash.c
@@ -2371,10 +2371,10 @@ ExecHashBuildSkewHash(HashJoinTable hashtable, Hash *node, int mcvsToUse)
/*
* Try to find the MCV statistics for the outer relation's join key.
*/
- statsTuple = SearchSysCache3(STATRELATTINH,
- ObjectIdGetDatum(node->skewTable),
- Int16GetDatum(node->skewColumn),
- BoolGetDatum(node->skewInherit));
+ statsTuple = SearchSysCache(STATRELATTINH,
+ ObjectIdGetDatum(node->skewTable),
+ Int16GetDatum(node->skewColumn),
+ BoolGetDatum(node->skewInherit));
if (!HeapTupleIsValid(statsTuple))
return;
diff --git a/src/backend/executor/nodeWindowAgg.c b/src/backend/executor/nodeWindowAgg.c
index 7c07fb0684..790ae50088 100644
--- a/src/backend/executor/nodeWindowAgg.c
+++ b/src/backend/executor/nodeWindowAgg.c
@@ -2787,7 +2787,7 @@ initialize_peragg(WindowAggState *winstate, WindowFunc *wfunc,
inputTypes[i++] = exprType((Node *) lfirst(lc));
}
- aggTuple = SearchSysCache1(AGGFNOID, ObjectIdGetDatum(wfunc->winfnoid));
+ aggTuple = SearchSysCache(AGGFNOID, ObjectIdGetDatum(wfunc->winfnoid));
if (!HeapTupleIsValid(aggTuple))
elog(ERROR, "cache lookup failed for aggregate %u",
wfunc->winfnoid);
@@ -2855,8 +2855,8 @@ initialize_peragg(WindowAggState *winstate, WindowFunc *wfunc,
HeapTuple procTuple;
Oid aggOwner;
- procTuple = SearchSysCache1(PROCOID,
- ObjectIdGetDatum(wfunc->winfnoid));
+ procTuple = SearchSysCache(PROCOID,
+ ObjectIdGetDatum(wfunc->winfnoid));
if (!HeapTupleIsValid(procTuple))
elog(ERROR, "cache lookup failed for function %u",
wfunc->winfnoid);
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index e3a170c38b..985eabd81f 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -1283,7 +1283,7 @@ SPI_gettype(TupleDesc tupdesc, int fnumber)
else
typoid = (SystemAttributeDefinition(fnumber))->atttypid;
- typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typoid));
+ typeTuple = SearchSysCache(TYPEOID, ObjectIdGetDatum(typoid));
if (!HeapTupleIsValid(typeTuple))
{
diff --git a/src/backend/foreign/foreign.c b/src/backend/foreign/foreign.c
index dca02271dc..5f72d61be2 100644
--- a/src/backend/foreign/foreign.c
+++ b/src/backend/foreign/foreign.c
@@ -54,7 +54,7 @@ GetForeignDataWrapperExtended(Oid fdwid, bits16 flags)
HeapTuple tp;
bool isnull;
- tp = SearchSysCache1(FOREIGNDATAWRAPPEROID, ObjectIdGetDatum(fdwid));
+ tp = SearchSysCache(FOREIGNDATAWRAPPEROID, ObjectIdGetDatum(fdwid));
if (!HeapTupleIsValid(tp))
{
@@ -128,7 +128,7 @@ GetForeignServerExtended(Oid serverid, bits16 flags)
Datum datum;
bool isnull;
- tp = SearchSysCache1(FOREIGNSERVEROID, ObjectIdGetDatum(serverid));
+ tp = SearchSysCache(FOREIGNSERVEROID, ObjectIdGetDatum(serverid));
if (!HeapTupleIsValid(tp))
{
@@ -204,16 +204,16 @@ GetUserMapping(Oid userid, Oid serverid)
bool isnull;
UserMapping *um;
- tp = SearchSysCache2(USERMAPPINGUSERSERVER,
- ObjectIdGetDatum(userid),
- ObjectIdGetDatum(serverid));
+ tp = SearchSysCache(USERMAPPINGUSERSERVER,
+ ObjectIdGetDatum(userid),
+ ObjectIdGetDatum(serverid));
if (!HeapTupleIsValid(tp))
{
/* Not found for the specific user -- try PUBLIC */
- tp = SearchSysCache2(USERMAPPINGUSERSERVER,
- ObjectIdGetDatum(InvalidOid),
- ObjectIdGetDatum(serverid));
+ tp = SearchSysCache(USERMAPPINGUSERSERVER,
+ ObjectIdGetDatum(InvalidOid),
+ ObjectIdGetDatum(serverid));
}
if (!HeapTupleIsValid(tp))
@@ -255,7 +255,7 @@ GetForeignTable(Oid relid)
Datum datum;
bool isnull;
- tp = SearchSysCache1(FOREIGNTABLEREL, ObjectIdGetDatum(relid));
+ tp = SearchSysCache(FOREIGNTABLEREL, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for foreign table %u", relid);
tableform = (Form_pg_foreign_table) GETSTRUCT(tp);
@@ -292,9 +292,9 @@ GetForeignColumnOptions(Oid relid, AttrNumber attnum)
Datum datum;
bool isnull;
- tp = SearchSysCache2(ATTNUM,
- ObjectIdGetDatum(relid),
- Int16GetDatum(attnum));
+ tp = SearchSysCache(ATTNUM,
+ ObjectIdGetDatum(relid),
+ Int16GetDatum(attnum));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for attribute %d of relation %u",
attnum, relid);
@@ -345,7 +345,7 @@ GetForeignServerIdByRelId(Oid relid)
Form_pg_foreign_table tableform;
Oid serverid;
- tp = SearchSysCache1(FOREIGNTABLEREL, ObjectIdGetDatum(relid));
+ tp = SearchSysCache(FOREIGNTABLEREL, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for foreign table %u", relid);
tableform = (Form_pg_foreign_table) GETSTRUCT(tp);
@@ -370,7 +370,7 @@ GetFdwRoutineByServerId(Oid serverid)
Oid fdwhandler;
/* Get foreign-data wrapper OID for the server. */
- tp = SearchSysCache1(FOREIGNSERVEROID, ObjectIdGetDatum(serverid));
+ tp = SearchSysCache(FOREIGNSERVEROID, ObjectIdGetDatum(serverid));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for foreign server %u", serverid);
serverform = (Form_pg_foreign_server) GETSTRUCT(tp);
@@ -378,7 +378,7 @@ GetFdwRoutineByServerId(Oid serverid)
ReleaseSysCache(tp);
/* Get handler function OID for the FDW. */
- tp = SearchSysCache1(FOREIGNDATAWRAPPEROID, ObjectIdGetDatum(fdwid));
+ tp = SearchSysCache(FOREIGNDATAWRAPPEROID, ObjectIdGetDatum(fdwid));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for foreign-data wrapper %u", fdwid);
fdwform = (Form_pg_foreign_data_wrapper) GETSTRUCT(tp);
@@ -668,9 +668,9 @@ get_foreign_data_wrapper_oid(const char *fdwname, bool missing_ok)
{
Oid oid;
- oid = GetSysCacheOid1(FOREIGNDATAWRAPPERNAME,
- Anum_pg_foreign_data_wrapper_oid,
- CStringGetDatum(fdwname));
+ oid = GetSysCacheOid(FOREIGNDATAWRAPPERNAME,
+ Anum_pg_foreign_data_wrapper_oid,
+ CStringGetDatum(fdwname));
if (!OidIsValid(oid) && !missing_ok)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -691,8 +691,8 @@ get_foreign_server_oid(const char *servername, bool missing_ok)
{
Oid oid;
- oid = GetSysCacheOid1(FOREIGNSERVERNAME, Anum_pg_foreign_server_oid,
- CStringGetDatum(servername));
+ oid = GetSysCacheOid(FOREIGNSERVERNAME, Anum_pg_foreign_server_oid,
+ CStringGetDatum(servername));
if (!OidIsValid(oid) && !missing_ok)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
diff --git a/src/backend/libpq/crypt.c b/src/backend/libpq/crypt.c
index ef496a0bea..9ddc0e551f 100644
--- a/src/backend/libpq/crypt.c
+++ b/src/backend/libpq/crypt.c
@@ -43,7 +43,7 @@ get_role_password(const char *role, const char **logdetail)
char *shadow_pass;
/* Get role info from pg_authid */
- roleTup = SearchSysCache1(AUTHNAME, PointerGetDatum(role));
+ roleTup = SearchSysCache(AUTHNAME, PointerGetDatum(role));
if (!HeapTupleIsValid(roleTup))
{
*logdetail = psprintf(_("Role \"%s\" does not exist."),
diff --git a/src/backend/optimizer/plan/planagg.c b/src/backend/optimizer/plan/planagg.c
index d168620665..da72b6805a 100644
--- a/src/backend/optimizer/plan/planagg.c
+++ b/src/backend/optimizer/plan/planagg.c
@@ -502,7 +502,7 @@ fetch_agg_sort_op(Oid aggfnoid)
Oid aggsortop;
/* fetch aggregate entry from pg_aggregate */
- aggTuple = SearchSysCache1(AGGFNOID, ObjectIdGetDatum(aggfnoid));
+ aggTuple = SearchSysCache(AGGFNOID, ObjectIdGetDatum(aggfnoid));
if (!HeapTupleIsValid(aggTuple))
return InvalidOid;
aggform = (Form_pg_aggregate) GETSTRUCT(aggTuple);
diff --git a/src/backend/optimizer/plan/setrefs.c b/src/backend/optimizer/plan/setrefs.c
index b56666398e..689b57d0f1 100644
--- a/src/backend/optimizer/plan/setrefs.c
+++ b/src/backend/optimizer/plan/setrefs.c
@@ -3439,8 +3439,8 @@ record_plan_function_dependency(PlannerInfo *root, Oid funcid)
* that plancache.c knows we use PROCOID.
*/
inval_item->cacheId = PROCOID;
- inval_item->hashValue = GetSysCacheHashValue1(PROCOID,
- ObjectIdGetDatum(funcid));
+ inval_item->hashValue = GetSysCacheHashValue(PROCOID,
+ ObjectIdGetDatum(funcid));
root->glob->invalItems = lappend(root->glob->invalItems, inval_item);
}
@@ -3475,8 +3475,8 @@ record_plan_type_dependency(PlannerInfo *root, Oid typid)
* plancache.c knows we use TYPEOID.
*/
inval_item->cacheId = TYPEOID;
- inval_item->hashValue = GetSysCacheHashValue1(TYPEOID,
- ObjectIdGetDatum(typid));
+ inval_item->hashValue = GetSysCacheHashValue(TYPEOID,
+ ObjectIdGetDatum(typid));
root->glob->invalItems = lappend(root->glob->invalItems, inval_item);
}
diff --git a/src/backend/optimizer/plan/subselect.c b/src/backend/optimizer/plan/subselect.c
index 052263aea6..8fa6fa1a5d 100644
--- a/src/backend/optimizer/plan/subselect.c
+++ b/src/backend/optimizer/plan/subselect.c
@@ -863,7 +863,7 @@ hash_ok_operator(OpExpr *expr)
HeapTuple tup;
Form_pg_operator optup;
- tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(opid));
+ tup = SearchSysCache(OPEROID, ObjectIdGetDatum(opid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for operator %u", opid);
optup = (Form_pg_operator) GETSTRUCT(tup);
diff --git a/src/backend/optimizer/prep/prepagg.c b/src/backend/optimizer/prep/prepagg.c
index 806078311c..bef2f1270e 100644
--- a/src/backend/optimizer/prep/prepagg.c
+++ b/src/backend/optimizer/prep/prepagg.c
@@ -147,8 +147,8 @@ preprocess_aggref(Aggref *aggref, PlannerInfo *root)
* ignore the moving-aggregate variant, since what we're concerned with
* here is aggregates not window functions.
*/
- aggTuple = SearchSysCache1(AGGFNOID,
- ObjectIdGetDatum(aggref->aggfnoid));
+ aggTuple = SearchSysCache(AGGFNOID,
+ ObjectIdGetDatum(aggref->aggfnoid));
if (!HeapTupleIsValid(aggTuple))
elog(ERROR, "cache lookup failed for aggregate %u",
aggref->aggfnoid);
diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c
index a9c7bc342e..7e473f080b 100644
--- a/src/backend/optimizer/util/clauses.c
+++ b/src/backend/optimizer/util/clauses.c
@@ -2443,7 +2443,7 @@ eval_const_expressions_mutator(Node *node,
* list. That takes care of inserting default arguments and
* expanding named-argument notation.
*/
- func_tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
+ func_tuple = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(func_tuple))
elog(ERROR, "cache lookup failed for function %u", funcid);
@@ -3959,7 +3959,7 @@ simplify_function(Oid funcid, Oid result_type, int32 result_typmod,
* strategies; so if !allow_non_const, simplify_function can only return a
* Const or NULL. Argument-list rewriting happens anyway, though.
*/
- func_tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
+ func_tuple = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(func_tuple))
elog(ERROR, "cache lookup failed for function %u", funcid);
func_form = (Form_pg_proc) GETSTRUCT(func_tuple);
@@ -5021,7 +5021,7 @@ inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte)
/*
* OK, let's take a look at the function's pg_proc entry.
*/
- func_tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(func_oid));
+ func_tuple = SearchSysCache(PROCOID, ObjectIdGetDatum(func_oid));
if (!HeapTupleIsValid(func_tuple))
elog(ERROR, "cache lookup failed for function %u", func_oid);
funcform = (Form_pg_proc) GETSTRUCT(func_tuple);
diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c
index d58c4a1078..8c56bece41 100644
--- a/src/backend/optimizer/util/plancat.c
+++ b/src/backend/optimizer/util/plancat.c
@@ -1344,8 +1344,8 @@ get_relation_statistics_worker(List **stainfos, RelOptInfo *rel,
Form_pg_statistic_ext_data dataForm;
HeapTuple dtup;
- dtup = SearchSysCache2(STATEXTDATASTXOID,
- ObjectIdGetDatum(statOid), BoolGetDatum(inh));
+ dtup = SearchSysCache(STATEXTDATASTXOID,
+ ObjectIdGetDatum(statOid), BoolGetDatum(inh));
if (!HeapTupleIsValid(dtup))
return;
@@ -1438,7 +1438,7 @@ get_relation_statistics(RelOptInfo *rel, Relation relation)
List *exprs = NIL;
int i;
- htup = SearchSysCache1(STATEXTOID, ObjectIdGetDatum(statOid));
+ htup = SearchSysCache(STATEXTOID, ObjectIdGetDatum(statOid));
if (!HeapTupleIsValid(htup))
elog(ERROR, "cache lookup failed for statistics object %u", statOid);
staForm = (Form_pg_statistic_ext) GETSTRUCT(htup);
@@ -2044,7 +2044,7 @@ add_function_cost(PlannerInfo *root, Oid funcid, Node *node,
HeapTuple proctup;
Form_pg_proc procform;
- proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
+ proctup = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(proctup))
elog(ERROR, "cache lookup failed for function %u", funcid);
procform = (Form_pg_proc) GETSTRUCT(proctup);
@@ -2105,7 +2105,7 @@ get_function_rows(PlannerInfo *root, Oid funcid, Node *node)
Form_pg_proc procform;
double result;
- proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
+ proctup = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(proctup))
elog(ERROR, "cache lookup failed for function %u", funcid);
procform = (Form_pg_proc) GETSTRUCT(proctup);
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c
index 70932dba61..758ac01417 100644
--- a/src/backend/parser/analyze.c
+++ b/src/backend/parser/analyze.c
@@ -3067,7 +3067,7 @@ transformCallStmt(ParseState *pstate, CallStmt *stmt)
fexpr = castNode(FuncExpr, node);
- proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(fexpr->funcid));
+ proctup = SearchSysCache(PROCOID, ObjectIdGetDatum(fexpr->funcid));
if (!HeapTupleIsValid(proctup))
elog(ERROR, "cache lookup failed for function %u", fexpr->funcid);
diff --git a/src/backend/parser/parse_agg.c b/src/backend/parser/parse_agg.c
index 85cd47b7ae..ce5a2c197b 100644
--- a/src/backend/parser/parse_agg.c
+++ b/src/backend/parser/parse_agg.c
@@ -1964,7 +1964,7 @@ agg_args_support_sendreceive(Aggref *aggref)
TargetEntry *tle = (TargetEntry *) lfirst(lc);
Oid type = exprType((Node *) tle->expr);
- typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type));
+ typeTuple = SearchSysCache(TYPEOID, ObjectIdGetDatum(type));
if (!HeapTupleIsValid(typeTuple))
elog(ERROR, "cache lookup failed for type %u", type);
diff --git a/src/backend/parser/parse_clause.c b/src/backend/parser/parse_clause.c
index f61f794755..f32a06c19e 100644
--- a/src/backend/parser/parse_clause.c
+++ b/src/backend/parser/parse_clause.c
@@ -3730,9 +3730,9 @@ transformFrameOffset(ParseState *pstate, int frameOptions,
preferredType = (nodeType != UNKNOWNOID) ? nodeType : rangeopcintype;
/* Find the in_range support functions applicable to this case */
- proclist = SearchSysCacheList2(AMPROCNUM,
- ObjectIdGetDatum(rangeopfamily),
- ObjectIdGetDatum(rangeopcintype));
+ proclist = SearchSysCacheList(AMPROCNUM,
+ ObjectIdGetDatum(rangeopfamily),
+ ObjectIdGetDatum(rangeopcintype));
for (i = 0; i < proclist->n_members; i++)
{
HeapTuple proctup = &proclist->members[i]->tuple;
diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c
index 52787b6794..5fd29449ee 100644
--- a/src/backend/parser/parse_coerce.c
+++ b/src/backend/parser/parse_coerce.c
@@ -850,7 +850,7 @@ build_coercion_expression(Node *node,
HeapTuple tp;
Form_pg_proc procstruct;
- tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcId));
+ tp = SearchSysCache(PROCOID, ObjectIdGetDatum(funcId));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for function %u", funcId);
procstruct = (Form_pg_proc) GETSTRUCT(tp);
@@ -3069,9 +3069,9 @@ IsBinaryCoercibleWithCast(Oid srctype, Oid targettype,
return true;
/* Else look in pg_cast */
- tuple = SearchSysCache2(CASTSOURCETARGET,
- ObjectIdGetDatum(srctype),
- ObjectIdGetDatum(targettype));
+ tuple = SearchSysCache(CASTSOURCETARGET,
+ ObjectIdGetDatum(srctype),
+ ObjectIdGetDatum(targettype));
if (!HeapTupleIsValid(tuple))
return false; /* no cast */
castForm = (Form_pg_cast) GETSTRUCT(tuple);
@@ -3135,9 +3135,9 @@ find_coercion_pathway(Oid targetTypeId, Oid sourceTypeId,
return COERCION_PATH_RELABELTYPE;
/* Look in pg_cast */
- tuple = SearchSysCache2(CASTSOURCETARGET,
- ObjectIdGetDatum(sourceTypeId),
- ObjectIdGetDatum(targetTypeId));
+ tuple = SearchSysCache(CASTSOURCETARGET,
+ ObjectIdGetDatum(sourceTypeId),
+ ObjectIdGetDatum(targetTypeId));
if (HeapTupleIsValid(tuple))
{
@@ -3302,9 +3302,9 @@ find_typmod_coercion_function(Oid typeId,
ReleaseSysCache(targetType);
/* Look in pg_cast */
- tuple = SearchSysCache2(CASTSOURCETARGET,
- ObjectIdGetDatum(typeId),
- ObjectIdGetDatum(typeId));
+ tuple = SearchSysCache(CASTSOURCETARGET,
+ ObjectIdGetDatum(typeId),
+ ObjectIdGetDatum(typeId));
if (HeapTupleIsValid(tuple))
{
@@ -3352,7 +3352,7 @@ typeIsOfTypedTable(Oid reltypeId, Oid reloftypeId)
HeapTuple tp;
Form_pg_class reltup;
- tp = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
+ tp = SearchSysCache(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for relation %u", relid);
diff --git a/src/backend/parser/parse_func.c b/src/backend/parser/parse_func.c
index b3f0b6a137..9090375ac1 100644
--- a/src/backend/parser/parse_func.c
+++ b/src/backend/parser/parse_func.c
@@ -364,7 +364,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
Form_pg_aggregate classForm;
int catDirectArgs;
- tup = SearchSysCache1(AGGFNOID, ObjectIdGetDatum(funcid));
+ tup = SearchSysCache(AGGFNOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for aggregate %u", funcid);
classForm = (Form_pg_aggregate) GETSTRUCT(tup);
@@ -1619,8 +1619,8 @@ func_get_detail(List *funcname,
}
}
- ftup = SearchSysCache1(PROCOID,
- ObjectIdGetDatum(best_candidate->oid));
+ ftup = SearchSysCache(PROCOID,
+ ObjectIdGetDatum(best_candidate->oid));
if (!HeapTupleIsValid(ftup)) /* should not happen */
elog(ERROR, "cache lookup failed for function %u",
best_candidate->oid);
diff --git a/src/backend/parser/parse_oper.c b/src/backend/parser/parse_oper.c
index bdc8f8e26a..5c09f67ad5 100644
--- a/src/backend/parser/parse_oper.c
+++ b/src/backend/parser/parse_oper.c
@@ -398,7 +398,7 @@ oper(ParseState *pstate, List *opname, Oid ltypeId, Oid rtypeId,
operOid = find_oper_cache_entry(&key);
if (OidIsValid(operOid))
{
- tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operOid));
+ tup = SearchSysCache(OPEROID, ObjectIdGetDatum(operOid));
if (HeapTupleIsValid(tup))
return (Operator) tup;
}
@@ -438,7 +438,7 @@ oper(ParseState *pstate, List *opname, Oid ltypeId, Oid rtypeId,
}
if (OidIsValid(operOid))
- tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operOid));
+ tup = SearchSysCache(OPEROID, ObjectIdGetDatum(operOid));
if (HeapTupleIsValid(tup))
{
@@ -545,7 +545,7 @@ left_oper(ParseState *pstate, List *op, Oid arg, bool noError, int location)
operOid = find_oper_cache_entry(&key);
if (OidIsValid(operOid))
{
- tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operOid));
+ tup = SearchSysCache(OPEROID, ObjectIdGetDatum(operOid));
if (HeapTupleIsValid(tup))
return (Operator) tup;
}
@@ -589,7 +589,7 @@ left_oper(ParseState *pstate, List *op, Oid arg, bool noError, int location)
}
if (OidIsValid(operOid))
- tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operOid));
+ tup = SearchSysCache(OPEROID, ObjectIdGetDatum(operOid));
if (HeapTupleIsValid(tup))
{
diff --git a/src/backend/parser/parse_relation.c b/src/backend/parser/parse_relation.c
index 41d60494b9..74a3f19300 100644
--- a/src/backend/parser/parse_relation.c
+++ b/src/backend/parser/parse_relation.c
@@ -862,9 +862,9 @@ scanRTEForColumn(ParseState *pstate, RangeTblEntry *rte,
if (attnum != InvalidAttrNumber)
{
/* now check to see if column actually is defined */
- if (SearchSysCacheExists2(ATTNUM,
- ObjectIdGetDatum(rte->relid),
- Int16GetDatum(attnum)))
+ if (SearchSysCacheExists(ATTNUM,
+ ObjectIdGetDatum(rte->relid),
+ Int16GetDatum(attnum)))
result = attnum;
}
}
@@ -3302,9 +3302,9 @@ get_rte_attribute_is_dropped(RangeTblEntry *rte, AttrNumber attnum)
HeapTuple tp;
Form_pg_attribute att_tup;
- tp = SearchSysCache2(ATTNUM,
- ObjectIdGetDatum(rte->relid),
- Int16GetDatum(attnum));
+ tp = SearchSysCache(ATTNUM,
+ ObjectIdGetDatum(rte->relid),
+ Int16GetDatum(attnum));
if (!HeapTupleIsValid(tp)) /* shouldn't happen */
elog(ERROR, "cache lookup failed for attribute %d of relation %u",
attnum, rte->relid);
diff --git a/src/backend/parser/parse_type.c b/src/backend/parser/parse_type.c
index be75dc6ab0..d63db34187 100644
--- a/src/backend/parser/parse_type.c
+++ b/src/backend/parser/parse_type.c
@@ -178,9 +178,9 @@ LookupTypeNameExtended(ParseState *pstate,
namespaceId = LookupExplicitNamespace(schemaname, missing_ok);
if (OidIsValid(namespaceId))
- typoid = GetSysCacheOid2(TYPENAMENSP, Anum_pg_type_oid,
- PointerGetDatum(typname),
- ObjectIdGetDatum(namespaceId));
+ typoid = GetSysCacheOid(TYPENAMENSP, Anum_pg_type_oid,
+ PointerGetDatum(typname),
+ ObjectIdGetDatum(namespaceId));
else
typoid = InvalidOid;
@@ -204,7 +204,7 @@ LookupTypeNameExtended(ParseState *pstate,
return NULL;
}
- tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typoid));
+ tup = SearchSysCache(TYPEOID, ObjectIdGetDatum(typoid));
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for type %u", typoid);
@@ -579,7 +579,7 @@ typeidType(Oid id)
{
HeapTuple tup;
- tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(id));
+ tup = SearchSysCache(TYPEOID, ObjectIdGetDatum(id));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for type %u", id);
return (Type) tup;
@@ -671,7 +671,7 @@ typeidTypeRelid(Oid type_id)
Form_pg_type type;
Oid result;
- typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type_id));
+ typeTuple = SearchSysCache(TYPEOID, ObjectIdGetDatum(type_id));
if (!HeapTupleIsValid(typeTuple))
elog(ERROR, "cache lookup failed for type %u", type_id);
type = (Form_pg_type) GETSTRUCT(typeTuple);
@@ -694,7 +694,7 @@ typeOrDomainTypeRelid(Oid type_id)
for (;;)
{
- typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type_id));
+ typeTuple = SearchSysCache(TYPEOID, ObjectIdGetDatum(type_id));
if (!HeapTupleIsValid(typeTuple))
elog(ERROR, "cache lookup failed for type %u", type_id);
type = (Form_pg_type) GETSTRUCT(typeTuple);
diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c
index b0f6fe4fa6..2058b87c66 100644
--- a/src/backend/parser/parse_utilcmd.c
+++ b/src/backend/parser/parse_utilcmd.c
@@ -1547,7 +1547,7 @@ generateClonedIndexStmt(RangeVar *heapRel, Relation source_idx,
* Fetch pg_class tuple of source index. We can't use the copy in the
* relcache entry because it doesn't include optional fields.
*/
- ht_idxrel = SearchSysCache1(RELOID, ObjectIdGetDatum(source_relid));
+ ht_idxrel = SearchSysCache(RELOID, ObjectIdGetDatum(source_relid));
if (!HeapTupleIsValid(ht_idxrel))
elog(ERROR, "cache lookup failed for relation %u", source_relid);
idxrelrec = (Form_pg_class) GETSTRUCT(ht_idxrel);
@@ -1558,7 +1558,7 @@ generateClonedIndexStmt(RangeVar *heapRel, Relation source_idx,
indrelid = idxrec->indrelid;
/* Fetch the pg_am tuple of the index' access method */
- ht_am = SearchSysCache1(AMOID, ObjectIdGetDatum(idxrelrec->relam));
+ ht_am = SearchSysCache(AMOID, ObjectIdGetDatum(idxrelrec->relam));
if (!HeapTupleIsValid(ht_am))
elog(ERROR, "cache lookup failed for access method %u",
idxrelrec->relam);
@@ -1621,8 +1621,8 @@ generateClonedIndexStmt(RangeVar *heapRel, Relation source_idx,
if (constraintOid)
*constraintOid = constraintId;
- ht_constr = SearchSysCache1(CONSTROID,
- ObjectIdGetDatum(constraintId));
+ ht_constr = SearchSysCache(CONSTROID,
+ ObjectIdGetDatum(constraintId));
if (!HeapTupleIsValid(ht_constr))
elog(ERROR, "cache lookup failed for constraint %u",
constraintId);
@@ -1654,8 +1654,8 @@ generateClonedIndexStmt(RangeVar *heapRel, Relation source_idx,
char *nspname;
List *namelist;
- opertup = SearchSysCache1(OPEROID,
- ObjectIdGetDatum(operid));
+ opertup = SearchSysCache(OPEROID,
+ ObjectIdGetDatum(operid));
if (!HeapTupleIsValid(opertup))
elog(ERROR, "cache lookup failed for operator %u",
operid);
@@ -1887,7 +1887,7 @@ generateClonedExtStatsStmt(RangeVar *heapRel, Oid heapRelid,
/*
* Fetch pg_statistic_ext tuple of source statistics object.
*/
- ht_stats = SearchSysCache1(STATEXTOID, ObjectIdGetDatum(source_statsid));
+ ht_stats = SearchSysCache(STATEXTOID, ObjectIdGetDatum(source_statsid));
if (!HeapTupleIsValid(ht_stats))
elog(ERROR, "cache lookup failed for statistics object %u", source_statsid);
statsrec = (Form_pg_statistic_ext) GETSTRUCT(ht_stats);
@@ -1998,7 +1998,7 @@ get_collation(Oid collation, Oid actual_datatype)
if (collation == get_typcollation(actual_datatype))
return NIL; /* just let it default */
- ht_coll = SearchSysCache1(COLLOID, ObjectIdGetDatum(collation));
+ ht_coll = SearchSysCache(COLLOID, ObjectIdGetDatum(collation));
if (!HeapTupleIsValid(ht_coll))
elog(ERROR, "cache lookup failed for collation %u", collation);
coll_rec = (Form_pg_collation) GETSTRUCT(ht_coll);
@@ -2025,7 +2025,7 @@ get_opclass(Oid opclass, Oid actual_datatype)
HeapTuple ht_opc;
Form_pg_opclass opc_rec;
- ht_opc = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclass));
+ ht_opc = SearchSysCache(CLAOID, ObjectIdGetDatum(opclass));
if (!HeapTupleIsValid(ht_opc))
elog(ERROR, "cache lookup failed for opclass %u", opclass);
opc_rec = (Form_pg_opclass) GETSTRUCT(ht_opc);
diff --git a/src/backend/partitioning/partbounds.c b/src/backend/partitioning/partbounds.c
index cf1156b842..560248b791 100644
--- a/src/backend/partitioning/partbounds.c
+++ b/src/backend/partitioning/partbounds.c
@@ -4313,7 +4313,7 @@ get_qual_for_range(Relation parent, PartitionBoundSpec *spec,
Datum datum;
PartitionBoundSpec *bspec;
- tuple = SearchSysCache1(RELOID, inhrelid);
+ tuple = SearchSysCache(RELOID, inhrelid);
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", inhrelid);
diff --git a/src/backend/partitioning/partdesc.c b/src/backend/partitioning/partdesc.c
index de06caccd2..cfd76b8453 100644
--- a/src/backend/partitioning/partdesc.c
+++ b/src/backend/partitioning/partdesc.c
@@ -183,7 +183,7 @@ RelationBuildPartitionDesc(Relation rel, bool omit_detached)
PartitionBoundSpec *boundspec = NULL;
/* Try fetching the tuple from the catcache, for speed. */
- tuple = SearchSysCache1(RELOID, inhrelid);
+ tuple = SearchSysCache(RELOID, inhrelid);
if (HeapTupleIsValid(tuple))
{
Datum datum;
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 585d28148c..b573ef635f 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1999,7 +1999,7 @@ do_autovacuum(void)
* zero in template and nonconnectable databases, else the system-wide
* default.
*/
- tuple = SearchSysCache1(DATABASEOID, ObjectIdGetDatum(MyDatabaseId));
+ tuple = SearchSysCache(DATABASEOID, ObjectIdGetDatum(MyDatabaseId));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for database %u", MyDatabaseId);
dbForm = (Form_pg_database) GETSTRUCT(tuple);
@@ -2233,7 +2233,7 @@ do_autovacuum(void)
* be an orphaned temp table. If it's not there or no longer the same
* relation, ignore it.
*/
- tuple = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relid));
+ tuple = SearchSysCacheCopy(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tuple))
{
/* be sure to drop useless lock so we don't bloat lock table */
@@ -2342,7 +2342,7 @@ do_autovacuum(void)
* tuple here and passing it to table_recheck_autovac, but that
* increases the odds of that function working with stale data.)
*/
- classTup = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
+ classTup = SearchSysCache(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(classTup))
continue; /* somebody deleted the rel, forget it */
isshared = ((Form_pg_class) GETSTRUCT(classTup))->relisshared;
@@ -2772,7 +2772,7 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
AutoVacOpts *avopts;
/* fetch the relation's relcache entry */
- classTup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relid));
+ classTup = SearchSysCacheCopy(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(classTup))
return NULL;
classForm = (Form_pg_class) GETSTRUCT(classTup);
diff --git a/src/backend/replication/logical/origin.c b/src/backend/replication/logical/origin.c
index 2c04c8707d..5a97ddf40c 100644
--- a/src/backend/replication/logical/origin.c
+++ b/src/backend/replication/logical/origin.c
@@ -227,7 +227,7 @@ replorigin_by_name(const char *roname, bool missing_ok)
roname_d = CStringGetTextDatum(roname);
- tuple = SearchSysCache1(REPLORIGNAME, roname_d);
+ tuple = SearchSysCache(REPLORIGNAME, roname_d);
if (HeapTupleIsValid(tuple))
{
ident = (Form_pg_replication_origin) GETSTRUCT(tuple);
@@ -424,7 +424,7 @@ replorigin_drop_by_name(const char *name, bool missing_ok, bool nowait)
LockSharedObject(ReplicationOriginRelationId, roident, 0,
AccessExclusiveLock);
- tuple = SearchSysCache1(REPLORIGIDENT, ObjectIdGetDatum(roident));
+ tuple = SearchSysCache(REPLORIGIDENT, ObjectIdGetDatum(roident));
if (!HeapTupleIsValid(tuple))
{
if (!missing_ok)
@@ -471,7 +471,7 @@ replorigin_by_oid(RepOriginId roident, bool missing_ok, char **roname)
Assert(roident != InvalidRepOriginId);
Assert(roident != DoNotReplicateId);
- tuple = SearchSysCache1(REPLORIGIDENT,
+ tuple = SearchSysCache(REPLORIGIDENT,
ObjectIdGetDatum((Oid) roident));
if (HeapTupleIsValid(tuple))
diff --git a/src/backend/replication/logical/proto.c b/src/backend/replication/logical/proto.c
index f308713275..a9d0965ffa 100644
--- a/src/backend/replication/logical/proto.c
+++ b/src/backend/replication/logical/proto.c
@@ -734,7 +734,7 @@ logicalrep_write_typ(StringInfo out, TransactionId xid, Oid typoid)
if (TransactionIdIsValid(xid))
pq_sendint32(out, xid);
- tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(basetypoid));
+ tup = SearchSysCache(TYPEOID, ObjectIdGetDatum(basetypoid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for type %u", basetypoid);
typtup = (Form_pg_type) GETSTRUCT(tup);
@@ -825,7 +825,7 @@ logicalrep_write_tuple(StringInfo out, Relation rel, TupleTableSlot *slot,
continue;
}
- typtup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(att->atttypid));
+ typtup = SearchSysCache(TYPEOID, ObjectIdGetDatum(att->atttypid));
if (!HeapTupleIsValid(typtup))
elog(ERROR, "cache lookup failed for type %u", att->atttypid);
typclass = (Form_pg_type) GETSTRUCT(typtup);
diff --git a/src/backend/replication/logical/tablesync.c b/src/backend/replication/logical/tablesync.c
index 6dce355633..5ff5acd91f 100644
--- a/src/backend/replication/logical/tablesync.c
+++ b/src/backend/replication/logical/tablesync.c
@@ -1615,7 +1615,7 @@ UpdateTwoPhaseState(Oid suboid, char new_state)
new_state == LOGICALREP_TWOPHASE_STATE_ENABLED);
rel = table_open(SubscriptionRelationId, RowExclusiveLock);
- tup = SearchSysCacheCopy1(SUBSCRIPTIONOID, ObjectIdGetDatum(suboid));
+ tup = SearchSysCacheCopy(SUBSCRIPTIONOID, ObjectIdGetDatum(suboid));
if (!HeapTupleIsValid(tup))
elog(ERROR,
"cache lookup failed for subscription oid %u",
diff --git a/src/backend/replication/logical/worker.c b/src/backend/replication/logical/worker.c
index 6fd674b5d6..0b2c76126a 100644
--- a/src/backend/replication/logical/worker.c
+++ b/src/backend/replication/logical/worker.c
@@ -4803,8 +4803,8 @@ clear_subscription_skip_lsn(XLogRecPtr finish_lsn)
rel = table_open(SubscriptionRelationId, RowExclusiveLock);
/* Fetch the existing tuple. */
- tup = SearchSysCacheCopy1(SUBSCRIPTIONOID,
- ObjectIdGetDatum(MySubscription->oid));
+ tup = SearchSysCacheCopy(SUBSCRIPTIONOID,
+ ObjectIdGetDatum(MySubscription->oid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "subscription \"%s\" does not exist", MySubscription->name);
diff --git a/src/backend/replication/pgoutput/pgoutput.c b/src/backend/replication/pgoutput/pgoutput.c
index ebaf555d56..1d0f9f022b 100644
--- a/src/backend/replication/pgoutput/pgoutput.c
+++ b/src/backend/replication/pgoutput/pgoutput.c
@@ -904,16 +904,16 @@ pgoutput_row_filter_init(PGOutputData *data, List *publications,
* (even if other publications have a row filter).
*/
if (!pub->alltables &&
- !SearchSysCacheExists2(PUBLICATIONNAMESPACEMAP,
- ObjectIdGetDatum(schemaid),
- ObjectIdGetDatum(pub->oid)))
+ !SearchSysCacheExists(PUBLICATIONNAMESPACEMAP,
+ ObjectIdGetDatum(schemaid),
+ ObjectIdGetDatum(pub->oid)))
{
/*
* Check for the presence of a row filter in this publication.
*/
- rftuple = SearchSysCache2(PUBLICATIONRELMAP,
- ObjectIdGetDatum(entry->publish_as_relid),
- ObjectIdGetDatum(pub->oid));
+ rftuple = SearchSysCache(PUBLICATIONRELMAP,
+ ObjectIdGetDatum(entry->publish_as_relid),
+ ObjectIdGetDatum(pub->oid));
if (HeapTupleIsValid(rftuple))
{
@@ -1055,9 +1055,9 @@ pgoutput_column_list_init(PGOutputData *data, List *publications,
* defined for a whole schema, so it can't have a column list,
* just like a FOR ALL TABLES publication.
*/
- cftuple = SearchSysCache2(PUBLICATIONRELMAP,
- ObjectIdGetDatum(entry->publish_as_relid),
- ObjectIdGetDatum(pub->oid));
+ cftuple = SearchSysCache(PUBLICATIONRELMAP,
+ ObjectIdGetDatum(entry->publish_as_relid),
+ ObjectIdGetDatum(pub->oid));
if (HeapTupleIsValid(cftuple))
{
diff --git a/src/backend/rewrite/rewriteDefine.c b/src/backend/rewrite/rewriteDefine.c
index e36fc72e1e..90396cbd83 100644
--- a/src/backend/rewrite/rewriteDefine.c
+++ b/src/backend/rewrite/rewriteDefine.c
@@ -97,9 +97,9 @@ InsertRule(const char *rulname,
/*
* Check to see if we are replacing an existing tuple
*/
- oldtup = SearchSysCache2(RULERELNAME,
- ObjectIdGetDatum(eventrel_oid),
- PointerGetDatum(rulname));
+ oldtup = SearchSysCache(RULERELNAME,
+ ObjectIdGetDatum(eventrel_oid),
+ PointerGetDatum(rulname));
if (HeapTupleIsValid(oldtup))
{
@@ -709,9 +709,9 @@ EnableDisableRule(Relation rel, const char *rulename,
* Find the rule tuple to change.
*/
pg_rewrite_desc = table_open(RewriteRelationId, RowExclusiveLock);
- ruletup = SearchSysCacheCopy2(RULERELNAME,
- ObjectIdGetDatum(owningRel),
- PointerGetDatum(rulename));
+ ruletup = SearchSysCacheCopy(RULERELNAME,
+ ObjectIdGetDatum(owningRel),
+ PointerGetDatum(rulename));
if (!HeapTupleIsValid(ruletup))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -766,7 +766,7 @@ RangeVarCallbackForRenameRule(const RangeVar *rv, Oid relid, Oid oldrelid,
HeapTuple tuple;
Form_pg_class form;
- tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
+ tuple = SearchSysCache(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tuple))
return; /* concurrently dropped */
form = (Form_pg_class) GETSTRUCT(tuple);
@@ -824,9 +824,9 @@ RenameRewriteRule(RangeVar *relation, const char *oldName,
pg_rewrite_desc = table_open(RewriteRelationId, RowExclusiveLock);
/* Fetch the rule's entry (it had better exist) */
- ruletup = SearchSysCacheCopy2(RULERELNAME,
- ObjectIdGetDatum(relid),
- PointerGetDatum(oldName));
+ ruletup = SearchSysCacheCopy(RULERELNAME,
+ ObjectIdGetDatum(relid),
+ PointerGetDatum(oldName));
if (!HeapTupleIsValid(ruletup))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
diff --git a/src/backend/rewrite/rewriteSupport.c b/src/backend/rewrite/rewriteSupport.c
index eed9f834ae..ae27a60efe 100644
--- a/src/backend/rewrite/rewriteSupport.c
+++ b/src/backend/rewrite/rewriteSupport.c
@@ -32,9 +32,9 @@
bool
IsDefinedRewriteRule(Oid owningRel, const char *ruleName)
{
- return SearchSysCacheExists2(RULERELNAME,
- ObjectIdGetDatum(owningRel),
- PointerGetDatum(ruleName));
+ return SearchSysCacheExists(RULERELNAME,
+ ObjectIdGetDatum(owningRel),
+ PointerGetDatum(ruleName));
}
@@ -61,7 +61,7 @@ SetRelationRuleStatus(Oid relationId, bool relHasRules)
* Find the tuple to update in pg_class, using syscache for the lookup.
*/
relationRelation = table_open(RelationRelationId, RowExclusiveLock);
- tuple = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relationId));
+ tuple = SearchSysCacheCopy(RELOID, ObjectIdGetDatum(relationId));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", relationId);
classForm = (Form_pg_class) GETSTRUCT(tuple);
@@ -97,9 +97,9 @@ get_rewrite_oid(Oid relid, const char *rulename, bool missing_ok)
Oid ruleoid;
/* Find the rule's pg_rewrite tuple, get its OID */
- tuple = SearchSysCache2(RULERELNAME,
- ObjectIdGetDatum(relid),
- PointerGetDatum(rulename));
+ tuple = SearchSysCache(RULERELNAME,
+ ObjectIdGetDatum(relid),
+ PointerGetDatum(rulename));
if (!HeapTupleIsValid(tuple))
{
if (missing_ok)
diff --git a/src/backend/statistics/dependencies.c b/src/backend/statistics/dependencies.c
index edb2e5347d..f1dec26247 100644
--- a/src/backend/statistics/dependencies.c
+++ b/src/backend/statistics/dependencies.c
@@ -625,9 +625,9 @@ statext_dependencies_load(Oid mvoid, bool inh)
Datum deps;
HeapTuple htup;
- htup = SearchSysCache2(STATEXTDATASTXOID,
- ObjectIdGetDatum(mvoid),
- BoolGetDatum(inh));
+ htup = SearchSysCache(STATEXTDATASTXOID,
+ ObjectIdGetDatum(mvoid),
+ BoolGetDatum(inh));
if (!HeapTupleIsValid(htup))
elog(ERROR, "cache lookup failed for statistics object %u", mvoid);
diff --git a/src/backend/statistics/extended_stats.c b/src/backend/statistics/extended_stats.c
index 54e3bb4aa2..9b001a221e 100644
--- a/src/backend/statistics/extended_stats.c
+++ b/src/backend/statistics/extended_stats.c
@@ -556,8 +556,8 @@ examine_attribute(Node *expr)
stats->attrtypmod = exprTypmod(expr);
stats->attrcollid = exprCollation(expr);
- typtuple = SearchSysCacheCopy1(TYPEOID,
- ObjectIdGetDatum(stats->attrtypid));
+ typtuple = SearchSysCacheCopy(TYPEOID,
+ ObjectIdGetDatum(stats->attrtypid));
if (!HeapTupleIsValid(typtuple))
elog(ERROR, "cache lookup failed for type %u", stats->attrtypid);
stats->attrtype = (Form_pg_type) GETSTRUCT(typtuple);
@@ -657,8 +657,8 @@ examine_expression(Node *expr, int stattarget)
stats->attr->attnum = InvalidAttrNumber;
stats->attr->atttypid = stats->attrtypid;
- typtuple = SearchSysCacheCopy1(TYPEOID,
- ObjectIdGetDatum(stats->attrtypid));
+ typtuple = SearchSysCacheCopy(TYPEOID,
+ ObjectIdGetDatum(stats->attrtypid));
if (!HeapTupleIsValid(typtuple))
elog(ERROR, "cache lookup failed for type %u", stats->attrtypid);
@@ -2457,8 +2457,8 @@ statext_expressions_load(Oid stxoid, bool inh, int idx)
HeapTupleData tmptup;
HeapTuple tup;
- htup = SearchSysCache2(STATEXTDATASTXOID,
- ObjectIdGetDatum(stxoid), BoolGetDatum(inh));
+ htup = SearchSysCache(STATEXTDATASTXOID,
+ ObjectIdGetDatum(stxoid), BoolGetDatum(inh));
if (!HeapTupleIsValid(htup))
elog(ERROR, "cache lookup failed for statistics object %u", stxoid);
diff --git a/src/backend/statistics/mcv.c b/src/backend/statistics/mcv.c
index 03b9f04bb5..a262b6103c 100644
--- a/src/backend/statistics/mcv.c
+++ b/src/backend/statistics/mcv.c
@@ -564,8 +564,8 @@ statext_mcv_load(Oid mvoid, bool inh)
MCVList *result;
bool isnull;
Datum mcvlist;
- HeapTuple htup = SearchSysCache2(STATEXTDATASTXOID,
- ObjectIdGetDatum(mvoid), BoolGetDatum(inh));
+ HeapTuple htup = SearchSysCache(STATEXTDATASTXOID,
+ ObjectIdGetDatum(mvoid), BoolGetDatum(inh));
if (!HeapTupleIsValid(htup))
elog(ERROR, "cache lookup failed for statistics object %u", mvoid);
diff --git a/src/backend/statistics/mvdistinct.c b/src/backend/statistics/mvdistinct.c
index 6d25c14644..35eba054ae 100644
--- a/src/backend/statistics/mvdistinct.c
+++ b/src/backend/statistics/mvdistinct.c
@@ -153,8 +153,8 @@ statext_ndistinct_load(Oid mvoid, bool inh)
Datum ndist;
HeapTuple htup;
- htup = SearchSysCache2(STATEXTDATASTXOID,
- ObjectIdGetDatum(mvoid), BoolGetDatum(inh));
+ htup = SearchSysCache(STATEXTDATASTXOID,
+ ObjectIdGetDatum(mvoid), BoolGetDatum(inh));
if (!HeapTupleIsValid(htup))
elog(ERROR, "cache lookup failed for statistics object %u", mvoid);
diff --git a/src/backend/tcop/fastpath.c b/src/backend/tcop/fastpath.c
index 2f70ebd5fa..1e10c61c50 100644
--- a/src/backend/tcop/fastpath.c
+++ b/src/backend/tcop/fastpath.c
@@ -135,7 +135,7 @@ fetch_fp_info(Oid func_id, struct fp_info *fip)
MemSet(fip, 0, sizeof(struct fp_info));
fip->funcid = InvalidOid;
- func_htp = SearchSysCache1(PROCOID, ObjectIdGetDatum(func_id));
+ func_htp = SearchSysCache(PROCOID, ObjectIdGetDatum(func_id));
if (!HeapTupleIsValid(func_htp))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_FUNCTION),
diff --git a/src/backend/utils/activity/pgstat_function.c b/src/backend/utils/activity/pgstat_function.c
index 79e781167b..5ad9981b0d 100644
--- a/src/backend/utils/activity/pgstat_function.c
+++ b/src/backend/utils/activity/pgstat_function.c
@@ -110,7 +110,7 @@ pgstat_init_function_usage(FunctionCallInfo fcinfo,
if (created_entry)
{
AcceptInvalidationMessages();
- if (!SearchSysCacheExists1(PROCOID, ObjectIdGetDatum(fcinfo->flinfo->fn_oid)))
+ if (!SearchSysCacheExists(PROCOID, ObjectIdGetDatum(fcinfo->flinfo->fn_oid)))
{
pgstat_drop_entry(PGSTAT_KIND_FUNCTION, MyDatabaseId,
fcinfo->flinfo->fn_oid);
diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c
index 8f7522d103..4d15491d41 100644
--- a/src/backend/utils/adt/acl.c
+++ b/src/backend/utils/adt/acl.c
@@ -638,7 +638,7 @@ aclitemout(PG_FUNCTION_ARGS)
if (aip->ai_grantee != ACL_ID_PUBLIC)
{
- htup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(aip->ai_grantee));
+ htup = SearchSysCache(AUTHOID, ObjectIdGetDatum(aip->ai_grantee));
if (HeapTupleIsValid(htup))
{
putid(p, NameStr(((Form_pg_authid) GETSTRUCT(htup))->rolname));
@@ -666,7 +666,7 @@ aclitemout(PG_FUNCTION_ARGS)
*p++ = '/';
*p = '\0';
- htup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(aip->ai_grantor));
+ htup = SearchSysCache(AUTHOID, ObjectIdGetDatum(aip->ai_grantor));
if (HeapTupleIsValid(htup))
{
putid(p, NameStr(((Form_pg_authid) GETSTRUCT(htup))->rolname));
@@ -1925,7 +1925,7 @@ has_table_privilege_name_id(PG_FUNCTION_ARGS)
roleid = get_role_oid_or_public(NameStr(*username));
mode = convert_table_priv_string(priv_type_text);
- if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(tableoid)))
+ if (!SearchSysCacheExists(RELOID, ObjectIdGetDatum(tableoid)))
PG_RETURN_NULL();
aclresult = pg_class_aclcheck(tableoid, roleid, mode);
@@ -1951,7 +1951,7 @@ has_table_privilege_id(PG_FUNCTION_ARGS)
roleid = GetUserId();
mode = convert_table_priv_string(priv_type_text);
- if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(tableoid)))
+ if (!SearchSysCacheExists(RELOID, ObjectIdGetDatum(tableoid)))
PG_RETURN_NULL();
aclresult = pg_class_aclcheck(tableoid, roleid, mode);
@@ -1998,7 +1998,7 @@ has_table_privilege_id_id(PG_FUNCTION_ARGS)
mode = convert_table_priv_string(priv_type_text);
- if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(tableoid)))
+ if (!SearchSysCacheExists(RELOID, ObjectIdGetDatum(tableoid)))
PG_RETURN_NULL();
aclresult = pg_class_aclcheck(tableoid, roleid, mode);
@@ -2357,7 +2357,7 @@ has_any_column_privilege_name_id(PG_FUNCTION_ARGS)
roleid = get_role_oid_or_public(NameStr(*username));
mode = convert_column_priv_string(priv_type_text);
- if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(tableoid)))
+ if (!SearchSysCacheExists(RELOID, ObjectIdGetDatum(tableoid)))
PG_RETURN_NULL();
/* First check at table level, then examine each column if needed */
@@ -2387,7 +2387,7 @@ has_any_column_privilege_id(PG_FUNCTION_ARGS)
roleid = GetUserId();
mode = convert_column_priv_string(priv_type_text);
- if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(tableoid)))
+ if (!SearchSysCacheExists(RELOID, ObjectIdGetDatum(tableoid)))
PG_RETURN_NULL();
/* First check at table level, then examine each column if needed */
@@ -2442,7 +2442,7 @@ has_any_column_privilege_id_id(PG_FUNCTION_ARGS)
mode = convert_column_priv_string(priv_type_text);
- if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(tableoid)))
+ if (!SearchSysCacheExists(RELOID, ObjectIdGetDatum(tableoid)))
PG_RETURN_NULL();
/* First check at table level, then examine each column if needed */
@@ -2852,9 +2852,9 @@ convert_column_name(Oid tableoid, text *column)
* columns don't exist. We need to treat dropped columns differently from
* nonexistent columns.
*/
- attTuple = SearchSysCache2(ATTNAME,
- ObjectIdGetDatum(tableoid),
- CStringGetDatum(colname));
+ attTuple = SearchSysCache(ATTNAME,
+ ObjectIdGetDatum(tableoid),
+ CStringGetDatum(colname));
if (HeapTupleIsValid(attTuple))
{
Form_pg_attribute attributeForm;
@@ -2993,7 +2993,7 @@ has_database_privilege_name_id(PG_FUNCTION_ARGS)
roleid = get_role_oid_or_public(NameStr(*username));
mode = convert_database_priv_string(priv_type_text);
- if (!SearchSysCacheExists1(DATABASEOID, ObjectIdGetDatum(databaseoid)))
+ if (!SearchSysCacheExists(DATABASEOID, ObjectIdGetDatum(databaseoid)))
PG_RETURN_NULL();
aclresult = object_aclcheck(DatabaseRelationId, databaseoid, roleid, mode);
@@ -3019,7 +3019,7 @@ has_database_privilege_id(PG_FUNCTION_ARGS)
roleid = GetUserId();
mode = convert_database_priv_string(priv_type_text);
- if (!SearchSysCacheExists1(DATABASEOID, ObjectIdGetDatum(databaseoid)))
+ if (!SearchSysCacheExists(DATABASEOID, ObjectIdGetDatum(databaseoid)))
PG_RETURN_NULL();
aclresult = object_aclcheck(DatabaseRelationId, databaseoid, roleid, mode);
@@ -3066,7 +3066,7 @@ has_database_privilege_id_id(PG_FUNCTION_ARGS)
mode = convert_database_priv_string(priv_type_text);
- if (!SearchSysCacheExists1(DATABASEOID, ObjectIdGetDatum(databaseoid)))
+ if (!SearchSysCacheExists(DATABASEOID, ObjectIdGetDatum(databaseoid)))
PG_RETURN_NULL();
aclresult = object_aclcheck(DatabaseRelationId, databaseoid, roleid, mode);
@@ -3190,7 +3190,7 @@ has_foreign_data_wrapper_privilege_name_id(PG_FUNCTION_ARGS)
roleid = get_role_oid_or_public(NameStr(*username));
mode = convert_foreign_data_wrapper_priv_string(priv_type_text);
- if (!SearchSysCacheExists1(FOREIGNDATAWRAPPEROID, ObjectIdGetDatum(fdwid)))
+ if (!SearchSysCacheExists(FOREIGNDATAWRAPPEROID, ObjectIdGetDatum(fdwid)))
PG_RETURN_NULL();
aclresult = object_aclcheck(ForeignDataWrapperRelationId, fdwid, roleid, mode);
@@ -3216,7 +3216,7 @@ has_foreign_data_wrapper_privilege_id(PG_FUNCTION_ARGS)
roleid = GetUserId();
mode = convert_foreign_data_wrapper_priv_string(priv_type_text);
- if (!SearchSysCacheExists1(FOREIGNDATAWRAPPEROID, ObjectIdGetDatum(fdwid)))
+ if (!SearchSysCacheExists(FOREIGNDATAWRAPPEROID, ObjectIdGetDatum(fdwid)))
PG_RETURN_NULL();
aclresult = object_aclcheck(ForeignDataWrapperRelationId, fdwid, roleid, mode);
@@ -3263,7 +3263,7 @@ has_foreign_data_wrapper_privilege_id_id(PG_FUNCTION_ARGS)
mode = convert_foreign_data_wrapper_priv_string(priv_type_text);
- if (!SearchSysCacheExists1(FOREIGNDATAWRAPPEROID, ObjectIdGetDatum(fdwid)))
+ if (!SearchSysCacheExists(FOREIGNDATAWRAPPEROID, ObjectIdGetDatum(fdwid)))
PG_RETURN_NULL();
aclresult = object_aclcheck(ForeignDataWrapperRelationId, fdwid, roleid, mode);
@@ -3381,7 +3381,7 @@ has_function_privilege_name_id(PG_FUNCTION_ARGS)
roleid = get_role_oid_or_public(NameStr(*username));
mode = convert_function_priv_string(priv_type_text);
- if (!SearchSysCacheExists1(PROCOID, ObjectIdGetDatum(functionoid)))
+ if (!SearchSysCacheExists(PROCOID, ObjectIdGetDatum(functionoid)))
PG_RETURN_NULL();
aclresult = object_aclcheck(ProcedureRelationId, functionoid, roleid, mode);
@@ -3407,7 +3407,7 @@ has_function_privilege_id(PG_FUNCTION_ARGS)
roleid = GetUserId();
mode = convert_function_priv_string(priv_type_text);
- if (!SearchSysCacheExists1(PROCOID, ObjectIdGetDatum(functionoid)))
+ if (!SearchSysCacheExists(PROCOID, ObjectIdGetDatum(functionoid)))
PG_RETURN_NULL();
aclresult = object_aclcheck(ProcedureRelationId, functionoid, roleid, mode);
@@ -3454,7 +3454,7 @@ has_function_privilege_id_id(PG_FUNCTION_ARGS)
mode = convert_function_priv_string(priv_type_text);
- if (!SearchSysCacheExists1(PROCOID, ObjectIdGetDatum(functionoid)))
+ if (!SearchSysCacheExists(PROCOID, ObjectIdGetDatum(functionoid)))
PG_RETURN_NULL();
aclresult = object_aclcheck(ProcedureRelationId, functionoid, roleid, mode);
@@ -3581,7 +3581,7 @@ has_language_privilege_name_id(PG_FUNCTION_ARGS)
roleid = get_role_oid_or_public(NameStr(*username));
mode = convert_language_priv_string(priv_type_text);
- if (!SearchSysCacheExists1(LANGOID, ObjectIdGetDatum(languageoid)))
+ if (!SearchSysCacheExists(LANGOID, ObjectIdGetDatum(languageoid)))
PG_RETURN_NULL();
aclresult = object_aclcheck(LanguageRelationId, languageoid, roleid, mode);
@@ -3607,7 +3607,7 @@ has_language_privilege_id(PG_FUNCTION_ARGS)
roleid = GetUserId();
mode = convert_language_priv_string(priv_type_text);
- if (!SearchSysCacheExists1(LANGOID, ObjectIdGetDatum(languageoid)))
+ if (!SearchSysCacheExists(LANGOID, ObjectIdGetDatum(languageoid)))
PG_RETURN_NULL();
aclresult = object_aclcheck(LanguageRelationId, languageoid, roleid, mode);
@@ -3654,7 +3654,7 @@ has_language_privilege_id_id(PG_FUNCTION_ARGS)
mode = convert_language_priv_string(priv_type_text);
- if (!SearchSysCacheExists1(LANGOID, ObjectIdGetDatum(languageoid)))
+ if (!SearchSysCacheExists(LANGOID, ObjectIdGetDatum(languageoid)))
PG_RETURN_NULL();
aclresult = object_aclcheck(LanguageRelationId, languageoid, roleid, mode);
@@ -3772,7 +3772,7 @@ has_schema_privilege_name_id(PG_FUNCTION_ARGS)
roleid = get_role_oid_or_public(NameStr(*username));
mode = convert_schema_priv_string(priv_type_text);
- if (!SearchSysCacheExists1(NAMESPACEOID, ObjectIdGetDatum(schemaoid)))
+ if (!SearchSysCacheExists(NAMESPACEOID, ObjectIdGetDatum(schemaoid)))
PG_RETURN_NULL();
aclresult = object_aclcheck(NamespaceRelationId, schemaoid, roleid, mode);
@@ -3798,7 +3798,7 @@ has_schema_privilege_id(PG_FUNCTION_ARGS)
roleid = GetUserId();
mode = convert_schema_priv_string(priv_type_text);
- if (!SearchSysCacheExists1(NAMESPACEOID, ObjectIdGetDatum(schemaoid)))
+ if (!SearchSysCacheExists(NAMESPACEOID, ObjectIdGetDatum(schemaoid)))
PG_RETURN_NULL();
aclresult = object_aclcheck(NamespaceRelationId, schemaoid, roleid, mode);
@@ -3845,7 +3845,7 @@ has_schema_privilege_id_id(PG_FUNCTION_ARGS)
mode = convert_schema_priv_string(priv_type_text);
- if (!SearchSysCacheExists1(NAMESPACEOID, ObjectIdGetDatum(schemaoid)))
+ if (!SearchSysCacheExists(NAMESPACEOID, ObjectIdGetDatum(schemaoid)))
PG_RETURN_NULL();
aclresult = object_aclcheck(NamespaceRelationId, schemaoid, roleid, mode);
@@ -3965,7 +3965,7 @@ has_server_privilege_name_id(PG_FUNCTION_ARGS)
roleid = get_role_oid_or_public(NameStr(*username));
mode = convert_server_priv_string(priv_type_text);
- if (!SearchSysCacheExists1(FOREIGNSERVEROID, ObjectIdGetDatum(serverid)))
+ if (!SearchSysCacheExists(FOREIGNSERVEROID, ObjectIdGetDatum(serverid)))
PG_RETURN_NULL();
aclresult = object_aclcheck(ForeignServerRelationId, serverid, roleid, mode);
@@ -3991,7 +3991,7 @@ has_server_privilege_id(PG_FUNCTION_ARGS)
roleid = GetUserId();
mode = convert_server_priv_string(priv_type_text);
- if (!SearchSysCacheExists1(FOREIGNSERVEROID, ObjectIdGetDatum(serverid)))
+ if (!SearchSysCacheExists(FOREIGNSERVEROID, ObjectIdGetDatum(serverid)))
PG_RETURN_NULL();
aclresult = object_aclcheck(ForeignServerRelationId, serverid, roleid, mode);
@@ -4038,7 +4038,7 @@ has_server_privilege_id_id(PG_FUNCTION_ARGS)
mode = convert_server_priv_string(priv_type_text);
- if (!SearchSysCacheExists1(FOREIGNSERVEROID, ObjectIdGetDatum(serverid)))
+ if (!SearchSysCacheExists(FOREIGNSERVEROID, ObjectIdGetDatum(serverid)))
PG_RETURN_NULL();
aclresult = object_aclcheck(ForeignServerRelationId, serverid, roleid, mode);
@@ -4156,7 +4156,7 @@ has_tablespace_privilege_name_id(PG_FUNCTION_ARGS)
roleid = get_role_oid_or_public(NameStr(*username));
mode = convert_tablespace_priv_string(priv_type_text);
- if (!SearchSysCacheExists1(TABLESPACEOID, ObjectIdGetDatum(tablespaceoid)))
+ if (!SearchSysCacheExists(TABLESPACEOID, ObjectIdGetDatum(tablespaceoid)))
PG_RETURN_NULL();
aclresult = object_aclcheck(TableSpaceRelationId, tablespaceoid, roleid, mode);
@@ -4182,7 +4182,7 @@ has_tablespace_privilege_id(PG_FUNCTION_ARGS)
roleid = GetUserId();
mode = convert_tablespace_priv_string(priv_type_text);
- if (!SearchSysCacheExists1(TABLESPACEOID, ObjectIdGetDatum(tablespaceoid)))
+ if (!SearchSysCacheExists(TABLESPACEOID, ObjectIdGetDatum(tablespaceoid)))
PG_RETURN_NULL();
aclresult = object_aclcheck(TableSpaceRelationId, tablespaceoid, roleid, mode);
@@ -4229,7 +4229,7 @@ has_tablespace_privilege_id_id(PG_FUNCTION_ARGS)
mode = convert_tablespace_priv_string(priv_type_text);
- if (!SearchSysCacheExists1(TABLESPACEOID, ObjectIdGetDatum(tablespaceoid)))
+ if (!SearchSysCacheExists(TABLESPACEOID, ObjectIdGetDatum(tablespaceoid)))
PG_RETURN_NULL();
aclresult = object_aclcheck(TableSpaceRelationId, tablespaceoid, roleid, mode);
@@ -4346,7 +4346,7 @@ has_type_privilege_name_id(PG_FUNCTION_ARGS)
roleid = get_role_oid_or_public(NameStr(*username));
mode = convert_type_priv_string(priv_type_text);
- if (!SearchSysCacheExists1(TYPEOID, ObjectIdGetDatum(typeoid)))
+ if (!SearchSysCacheExists(TYPEOID, ObjectIdGetDatum(typeoid)))
PG_RETURN_NULL();
aclresult = object_aclcheck(TypeRelationId, typeoid, roleid, mode);
@@ -4372,7 +4372,7 @@ has_type_privilege_id(PG_FUNCTION_ARGS)
roleid = GetUserId();
mode = convert_type_priv_string(priv_type_text);
- if (!SearchSysCacheExists1(TYPEOID, ObjectIdGetDatum(typeoid)))
+ if (!SearchSysCacheExists(TYPEOID, ObjectIdGetDatum(typeoid)))
PG_RETURN_NULL();
aclresult = object_aclcheck(TypeRelationId, typeoid, roleid, mode);
@@ -4419,7 +4419,7 @@ has_type_privilege_id_id(PG_FUNCTION_ARGS)
mode = convert_type_priv_string(priv_type_text);
- if (!SearchSysCacheExists1(TYPEOID, ObjectIdGetDatum(typeoid)))
+ if (!SearchSysCacheExists(TYPEOID, ObjectIdGetDatum(typeoid)))
PG_RETURN_NULL();
aclresult = object_aclcheck(TypeRelationId, typeoid, roleid, mode);
@@ -4781,8 +4781,8 @@ initialize_acl(void)
if (!IsBootstrapProcessingMode())
{
cached_db_hash =
- GetSysCacheHashValue1(DATABASEOID,
- ObjectIdGetDatum(MyDatabaseId));
+ GetSysCacheHashValue(DATABASEOID,
+ ObjectIdGetDatum(MyDatabaseId));
/*
* In normal mode, set a callback on any syscache invalidation of rows
@@ -4870,7 +4870,7 @@ roles_is_member_of(Oid roleid, enum RoleRecurseType type,
{
HeapTuple dbtup;
- dbtup = SearchSysCache1(DATABASEOID, ObjectIdGetDatum(MyDatabaseId));
+ dbtup = SearchSysCache(DATABASEOID, ObjectIdGetDatum(MyDatabaseId));
if (!HeapTupleIsValid(dbtup))
elog(ERROR, "cache lookup failed for database %u", MyDatabaseId);
dba = ((Form_pg_database) GETSTRUCT(dbtup))->datdba;
@@ -4897,8 +4897,8 @@ roles_is_member_of(Oid roleid, enum RoleRecurseType type,
int i;
/* Find roles that memberid is directly a member of */
- memlist = SearchSysCacheList1(AUTHMEMMEMROLE,
- ObjectIdGetDatum(memberid));
+ memlist = SearchSysCacheList(AUTHMEMMEMROLE,
+ ObjectIdGetDatum(memberid));
for (i = 0; i < memlist->n_members; i++)
{
HeapTuple tup = &memlist->members[i]->tuple;
@@ -5256,8 +5256,8 @@ get_role_oid(const char *rolname, bool missing_ok)
{
Oid oid;
- oid = GetSysCacheOid1(AUTHNAME, Anum_pg_authid_oid,
- CStringGetDatum(rolname));
+ oid = GetSysCacheOid(AUTHNAME, Anum_pg_authid_oid,
+ CStringGetDatum(rolname));
if (!OidIsValid(oid) && !missing_ok)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -5333,7 +5333,7 @@ get_rolespec_tuple(const RoleSpec *role)
{
case ROLESPEC_CSTRING:
Assert(role->rolename);
- tuple = SearchSysCache1(AUTHNAME, CStringGetDatum(role->rolename));
+ tuple = SearchSysCache(AUTHNAME, CStringGetDatum(role->rolename));
if (!HeapTupleIsValid(tuple))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -5342,13 +5342,13 @@ get_rolespec_tuple(const RoleSpec *role)
case ROLESPEC_CURRENT_ROLE:
case ROLESPEC_CURRENT_USER:
- tuple = SearchSysCache1(AUTHOID, GetUserId());
+ tuple = SearchSysCache(AUTHOID, GetUserId());
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for role %u", GetUserId());
break;
case ROLESPEC_SESSION_USER:
- tuple = SearchSysCache1(AUTHOID, GetSessionUserId());
+ tuple = SearchSysCache(AUTHOID, GetSessionUserId());
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for role %u", GetSessionUserId());
break;
diff --git a/src/backend/utils/adt/amutils.c b/src/backend/utils/adt/amutils.c
index 48852bf79e..062b1f18e6 100644
--- a/src/backend/utils/adt/amutils.c
+++ b/src/backend/utils/adt/amutils.c
@@ -168,7 +168,7 @@ indexam_property(FunctionCallInfo fcinfo,
Form_pg_class rd_rel;
Assert(!OidIsValid(amoid));
- tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(index_oid));
+ tuple = SearchSysCache(RELOID, ObjectIdGetDatum(index_oid));
if (!HeapTupleIsValid(tuple))
PG_RETURN_NULL();
rd_rel = (Form_pg_class) GETSTRUCT(tuple);
@@ -223,7 +223,7 @@ indexam_property(FunctionCallInfo fcinfo,
* (which we also need to use to check for nonkey atts) so we fetch
* that first.
*/
- tuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(index_oid));
+ tuple = SearchSysCache(INDEXRELID, ObjectIdGetDatum(index_oid));
if (!HeapTupleIsValid(tuple))
PG_RETURN_NULL();
rd_index = (Form_pg_index) GETSTRUCT(tuple);
diff --git a/src/backend/utils/adt/dbsize.c b/src/backend/utils/adt/dbsize.c
index e5c0f1c45b..8d6682e266 100644
--- a/src/backend/utils/adt/dbsize.c
+++ b/src/backend/utils/adt/dbsize.c
@@ -880,7 +880,7 @@ pg_relation_filenode(PG_FUNCTION_ARGS)
HeapTuple tuple;
Form_pg_class relform;
- tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
+ tuple = SearchSysCache(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tuple))
PG_RETURN_NULL();
relform = (Form_pg_class) GETSTRUCT(tuple);
@@ -954,7 +954,7 @@ pg_relation_filepath(PG_FUNCTION_ARGS)
BackendId backend;
char *path;
- tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
+ tuple = SearchSysCache(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tuple))
PG_RETURN_NULL();
relform = (Form_pg_class) GETSTRUCT(tuple);
diff --git a/src/backend/utils/adt/domains.c b/src/backend/utils/adt/domains.c
index 8d766f68e3..6c80926b2b 100644
--- a/src/backend/utils/adt/domains.c
+++ b/src/backend/utils/adt/domains.c
@@ -378,7 +378,7 @@ errdatatype(Oid datatypeOid)
HeapTuple tup;
Form_pg_type typtup;
- tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(datatypeOid));
+ tup = SearchSysCache(TYPEOID, ObjectIdGetDatum(datatypeOid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for type %u", datatypeOid);
typtup = (Form_pg_type) GETSTRUCT(tup);
diff --git a/src/backend/utils/adt/enum.c b/src/backend/utils/adt/enum.c
index fdfdf7d0d2..491dc0f205 100644
--- a/src/backend/utils/adt/enum.c
+++ b/src/backend/utils/adt/enum.c
@@ -122,9 +122,9 @@ enum_in(PG_FUNCTION_ARGS)
format_type_be(enumtypoid),
name)));
- tup = SearchSysCache2(ENUMTYPOIDNAME,
- ObjectIdGetDatum(enumtypoid),
- CStringGetDatum(name));
+ tup = SearchSysCache(ENUMTYPOIDNAME,
+ ObjectIdGetDatum(enumtypoid),
+ CStringGetDatum(name));
if (!HeapTupleIsValid(tup))
ereturn(escontext, (Datum) 0,
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
@@ -159,7 +159,7 @@ enum_out(PG_FUNCTION_ARGS)
HeapTuple tup;
Form_pg_enum en;
- tup = SearchSysCache1(ENUMOID, ObjectIdGetDatum(enumval));
+ tup = SearchSysCache(ENUMOID, ObjectIdGetDatum(enumval));
if (!HeapTupleIsValid(tup))
ereport(ERROR,
(errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
@@ -195,9 +195,9 @@ enum_recv(PG_FUNCTION_ARGS)
format_type_be(enumtypoid),
name)));
- tup = SearchSysCache2(ENUMTYPOIDNAME,
- ObjectIdGetDatum(enumtypoid),
- CStringGetDatum(name));
+ tup = SearchSysCache(ENUMTYPOIDNAME,
+ ObjectIdGetDatum(enumtypoid),
+ CStringGetDatum(name));
if (!HeapTupleIsValid(tup))
ereport(ERROR,
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
@@ -225,7 +225,7 @@ enum_send(PG_FUNCTION_ARGS)
HeapTuple tup;
Form_pg_enum en;
- tup = SearchSysCache1(ENUMOID, ObjectIdGetDatum(enumval));
+ tup = SearchSysCache(ENUMOID, ObjectIdGetDatum(enumval));
if (!HeapTupleIsValid(tup))
ereport(ERROR,
(errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
@@ -284,7 +284,7 @@ enum_cmp_internal(Oid arg1, Oid arg2, FunctionCallInfo fcinfo)
Oid typeoid;
/* Get the OID of the enum type containing arg1 */
- enum_tup = SearchSysCache1(ENUMOID, ObjectIdGetDatum(arg1));
+ enum_tup = SearchSysCache(ENUMOID, ObjectIdGetDatum(arg1));
if (!HeapTupleIsValid(enum_tup))
ereport(ERROR,
(errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
diff --git a/src/backend/utils/adt/format_type.c b/src/backend/utils/adt/format_type.c
index 12402a0637..9c984879c2 100644
--- a/src/backend/utils/adt/format_type.c
+++ b/src/backend/utils/adt/format_type.c
@@ -126,7 +126,7 @@ format_type_extended(Oid type_oid, int32 typemod, bits16 flags)
return pstrdup("-");
}
- tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type_oid));
+ tuple = SearchSysCache(TYPEOID, ObjectIdGetDatum(type_oid));
if (!HeapTupleIsValid(tuple))
{
if ((flags & FORMAT_TYPE_INVALID_AS_NULL) != 0)
@@ -151,7 +151,7 @@ format_type_extended(Oid type_oid, int32 typemod, bits16 flags)
{
/* Switch our attention to the array element type */
ReleaseSysCache(tuple);
- tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(array_base_type));
+ tuple = SearchSysCache(TYPEOID, ObjectIdGetDatum(array_base_type));
if (!HeapTupleIsValid(tuple))
{
if ((flags & FORMAT_TYPE_INVALID_AS_NULL) != 0)
diff --git a/src/backend/utils/adt/genfile.c b/src/backend/utils/adt/genfile.c
index f281ce9806..aed5472dc1 100644
--- a/src/backend/utils/adt/genfile.c
+++ b/src/backend/utils/adt/genfile.c
@@ -696,7 +696,7 @@ pg_ls_tmpdir(FunctionCallInfo fcinfo, Oid tblspc)
{
char path[MAXPGPATH];
- if (!SearchSysCacheExists1(TABLESPACEOID, ObjectIdGetDatum(tblspc)))
+ if (!SearchSysCacheExists(TABLESPACEOID, ObjectIdGetDatum(tblspc)))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("tablespace with OID %u does not exist",
diff --git a/src/backend/utils/adt/jsonfuncs.c b/src/backend/utils/adt/jsonfuncs.c
index 7a36f74dad..f2031ee572 100644
--- a/src/backend/utils/adt/jsonfuncs.c
+++ b/src/backend/utils/adt/jsonfuncs.c
@@ -3076,7 +3076,7 @@ prepare_column_cache(ColumnIOData *column,
column->typid = typid;
column->typmod = typmod;
- tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
+ tup = SearchSysCache(TYPEOID, ObjectIdGetDatum(typid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for type %u", typid);
diff --git a/src/backend/utils/adt/partitionfuncs.c b/src/backend/utils/adt/partitionfuncs.c
index 70e4c1308c..c8ded714df 100644
--- a/src/backend/utils/adt/partitionfuncs.c
+++ b/src/backend/utils/adt/partitionfuncs.c
@@ -38,7 +38,7 @@ check_rel_can_be_partition(Oid relid)
bool relispartition;
/* Check if relation exists */
- if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(relid)))
+ if (!SearchSysCacheExists(RELOID, ObjectIdGetDatum(relid)))
return false;
relkind = get_rel_relkind(relid);
diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c
index 9497c20d12..8d9ddcc08d 100644
--- a/src/backend/utils/adt/pg_locale.c
+++ b/src/backend/utils/adt/pg_locale.c
@@ -1281,7 +1281,7 @@ lookup_collation_cache(Oid collation, bool set_flags)
HeapTuple tp;
Form_pg_collation collform;
- tp = SearchSysCache1(COLLOID, ObjectIdGetDatum(collation));
+ tp = SearchSysCache(COLLOID, ObjectIdGetDatum(collation));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for collation %u", collation);
collform = (Form_pg_collation) GETSTRUCT(tp);
@@ -1561,7 +1561,7 @@ pg_newlocale_from_collation(Oid collid)
Datum datum;
bool isnull;
- tp = SearchSysCache1(COLLOID, ObjectIdGetDatum(collid));
+ tp = SearchSysCache(COLLOID, ObjectIdGetDatum(collid));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for collation %u", collid);
collform = (Form_pg_collation) GETSTRUCT(tp);
diff --git a/src/backend/utils/adt/regproc.c b/src/backend/utils/adt/regproc.c
index 296930eb3b..70bb476196 100644
--- a/src/backend/utils/adt/regproc.c
+++ b/src/backend/utils/adt/regproc.c
@@ -145,7 +145,7 @@ regprocout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
- proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(proid));
+ proctup = SearchSysCache(PROCOID, ObjectIdGetDatum(proid));
if (HeapTupleIsValid(proctup))
{
@@ -328,7 +328,7 @@ format_procedure_extended(Oid procedure_oid, bits16 flags)
char *result;
HeapTuple proctup;
- proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(procedure_oid));
+ proctup = SearchSysCache(PROCOID, ObjectIdGetDatum(procedure_oid));
if (HeapTupleIsValid(proctup))
{
@@ -403,7 +403,7 @@ format_procedure_parts(Oid procedure_oid, List **objnames, List **objargs,
int nargs;
int i;
- proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(procedure_oid));
+ proctup = SearchSysCache(PROCOID, ObjectIdGetDatum(procedure_oid));
if (!HeapTupleIsValid(proctup))
{
@@ -554,7 +554,7 @@ regoperout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
- opertup = SearchSysCache1(OPEROID, ObjectIdGetDatum(oprid));
+ opertup = SearchSysCache(OPEROID, ObjectIdGetDatum(oprid));
if (HeapTupleIsValid(opertup))
{
@@ -724,7 +724,7 @@ format_operator_extended(Oid operator_oid, bits16 flags)
char *result;
HeapTuple opertup;
- opertup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operator_oid));
+ opertup = SearchSysCache(OPEROID, ObjectIdGetDatum(operator_oid));
if (HeapTupleIsValid(opertup))
{
@@ -809,7 +809,7 @@ format_operator_parts(Oid operator_oid, List **objnames, List **objargs,
HeapTuple opertup;
Form_pg_operator oprForm;
- opertup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operator_oid));
+ opertup = SearchSysCache(OPEROID, ObjectIdGetDatum(operator_oid));
if (!HeapTupleIsValid(opertup))
{
if (!missing_ok)
@@ -952,7 +952,7 @@ regclassout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
- classtup = SearchSysCache1(RELOID, ObjectIdGetDatum(classid));
+ classtup = SearchSysCache(RELOID, ObjectIdGetDatum(classid));
if (HeapTupleIsValid(classtup))
{
@@ -1095,7 +1095,7 @@ regcollationout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
- collationtup = SearchSysCache1(COLLOID, ObjectIdGetDatum(collationid));
+ collationtup = SearchSysCache(COLLOID, ObjectIdGetDatum(collationid));
if (HeapTupleIsValid(collationtup))
{
@@ -1236,7 +1236,7 @@ regtypeout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
- typetup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
+ typetup = SearchSysCache(TYPEOID, ObjectIdGetDatum(typid));
if (HeapTupleIsValid(typetup))
{
@@ -1348,7 +1348,7 @@ regconfigout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
- cfgtup = SearchSysCache1(TSCONFIGOID, ObjectIdGetDatum(cfgid));
+ cfgtup = SearchSysCache(TSCONFIGOID, ObjectIdGetDatum(cfgid));
if (HeapTupleIsValid(cfgtup))
{
@@ -1458,7 +1458,7 @@ regdictionaryout(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(result);
}
- dicttup = SearchSysCache1(TSDICTOID, ObjectIdGetDatum(dictid));
+ dicttup = SearchSysCache(TSDICTOID, ObjectIdGetDatum(dictid));
if (HeapTupleIsValid(dicttup))
{
diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c
index 375b17b9f3..1b285d790c 100644
--- a/src/backend/utils/adt/ri_triggers.c
+++ b/src/backend/utils/adt/ri_triggers.c
@@ -1950,7 +1950,7 @@ ri_GenerateQualCollation(StringInfo buf, Oid collation)
if (!OidIsValid(collation))
return;
- tp = SearchSysCache1(COLLOID, ObjectIdGetDatum(collation));
+ tp = SearchSysCache(COLLOID, ObjectIdGetDatum(collation));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for collation %u", collation);
colltup = (Form_pg_collation) GETSTRUCT(tp);
@@ -2139,7 +2139,7 @@ ri_LoadConstraintInfo(Oid constraintOid)
/*
* Fetch the pg_constraint row so we can fill in the entry.
*/
- tup = SearchSysCache1(CONSTROID, ObjectIdGetDatum(constraintOid));
+ tup = SearchSysCache(CONSTROID, ObjectIdGetDatum(constraintOid));
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for constraint %u", constraintOid);
conForm = (Form_pg_constraint) GETSTRUCT(tup);
@@ -2155,10 +2155,10 @@ ri_LoadConstraintInfo(Oid constraintOid)
get_ri_constraint_root(conForm->conparentid);
else
riinfo->constraint_root_id = constraintOid;
- riinfo->oidHashValue = GetSysCacheHashValue1(CONSTROID,
- ObjectIdGetDatum(constraintOid));
- riinfo->rootHashValue = GetSysCacheHashValue1(CONSTROID,
- ObjectIdGetDatum(riinfo->constraint_root_id));
+ riinfo->oidHashValue = GetSysCacheHashValue(CONSTROID,
+ ObjectIdGetDatum(constraintOid));
+ riinfo->rootHashValue = GetSysCacheHashValue(CONSTROID,
+ ObjectIdGetDatum(riinfo->constraint_root_id));
memcpy(&riinfo->conname, &conForm->conname, sizeof(NameData));
riinfo->pk_relid = conForm->confrelid;
riinfo->fk_relid = conForm->conrelid;
@@ -2201,7 +2201,7 @@ get_ri_constraint_root(Oid constrOid)
HeapTuple tuple;
Oid constrParentOid;
- tuple = SearchSysCache1(CONSTROID, ObjectIdGetDatum(constrOid));
+ tuple = SearchSysCache(CONSTROID, ObjectIdGetDatum(constrOid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for constraint %u", constrOid);
constrParentOid = ((Form_pg_constraint) GETSTRUCT(tuple))->conparentid;
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 1c078d700d..4b4489429d 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -1253,7 +1253,7 @@ pg_get_indexdef_worker(Oid indexrelid, int colno,
/*
* Fetch the pg_index tuple by the Oid of the index
*/
- ht_idx = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexrelid));
+ ht_idx = SearchSysCache(INDEXRELID, ObjectIdGetDatum(indexrelid));
if (!HeapTupleIsValid(ht_idx))
{
if (missing_ok)
@@ -1281,7 +1281,7 @@ pg_get_indexdef_worker(Oid indexrelid, int colno,
/*
* Fetch the pg_class tuple of the index relation
*/
- ht_idxrel = SearchSysCache1(RELOID, ObjectIdGetDatum(indexrelid));
+ ht_idxrel = SearchSysCache(RELOID, ObjectIdGetDatum(indexrelid));
if (!HeapTupleIsValid(ht_idxrel))
elog(ERROR, "cache lookup failed for relation %u", indexrelid);
idxrelrec = (Form_pg_class) GETSTRUCT(ht_idxrel);
@@ -1289,7 +1289,7 @@ pg_get_indexdef_worker(Oid indexrelid, int colno,
/*
* Fetch the pg_am tuple of the index' access method
*/
- ht_am = SearchSysCache1(AMOID, ObjectIdGetDatum(idxrelrec->relam));
+ ht_am = SearchSysCache(AMOID, ObjectIdGetDatum(idxrelrec->relam));
if (!HeapTupleIsValid(ht_am))
elog(ERROR, "cache lookup failed for access method %u",
idxrelrec->relam);
@@ -1624,7 +1624,7 @@ pg_get_statisticsobj_worker(Oid statextid, bool columns_only, bool missing_ok)
bool has_exprs;
int ncolumns;
- statexttup = SearchSysCache1(STATEXTOID, ObjectIdGetDatum(statextid));
+ statexttup = SearchSysCache(STATEXTOID, ObjectIdGetDatum(statextid));
if (!HeapTupleIsValid(statexttup))
{
@@ -1801,7 +1801,7 @@ pg_get_statisticsobjdef_expressions(PG_FUNCTION_ARGS)
char *tmp;
ArrayBuildState *astate = NULL;
- statexttup = SearchSysCache1(STATEXTOID, ObjectIdGetDatum(statextid));
+ statexttup = SearchSysCache(STATEXTOID, ObjectIdGetDatum(statextid));
if (!HeapTupleIsValid(statexttup))
PG_RETURN_NULL();
@@ -1903,7 +1903,7 @@ pg_get_partkeydef_worker(Oid relid, int prettyFlags,
char *str;
char *sep;
- tuple = SearchSysCache1(PARTRELID, ObjectIdGetDatum(relid));
+ tuple = SearchSysCache(PARTRELID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tuple))
{
if (missing_ok)
@@ -2348,7 +2348,7 @@ pg_get_constraintdef_worker(Oid constraintId, bool fullCommand,
indexId = conForm->conindid;
- indtup = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexId));
+ indtup = SearchSysCache(INDEXRELID, ObjectIdGetDatum(indexId));
if (!HeapTupleIsValid(indtup))
elog(ERROR, "cache lookup failed for index %u", indexId);
if (conForm->contype == CONSTRAINT_UNIQUE &&
@@ -2731,7 +2731,7 @@ pg_get_userbyid(PG_FUNCTION_ARGS)
/*
* Get the pg_authid entry and print the result
*/
- roletup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid));
+ roletup = SearchSysCache(AUTHOID, ObjectIdGetDatum(roleid));
if (HeapTupleIsValid(roletup))
{
role_rec = (Form_pg_authid) GETSTRUCT(roletup);
@@ -2866,7 +2866,7 @@ pg_get_functiondef(PG_FUNCTION_ARGS)
initStringInfo(&buf);
/* Look up the function */
- proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
+ proctup = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(proctup))
PG_RETURN_NULL();
@@ -3105,7 +3105,7 @@ pg_get_function_arguments(PG_FUNCTION_ARGS)
StringInfoData buf;
HeapTuple proctup;
- proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
+ proctup = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(proctup))
PG_RETURN_NULL();
@@ -3131,7 +3131,7 @@ pg_get_function_identity_arguments(PG_FUNCTION_ARGS)
StringInfoData buf;
HeapTuple proctup;
- proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
+ proctup = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(proctup))
PG_RETURN_NULL();
@@ -3156,7 +3156,7 @@ pg_get_function_result(PG_FUNCTION_ARGS)
StringInfoData buf;
HeapTuple proctup;
- proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
+ proctup = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(proctup))
PG_RETURN_NULL();
@@ -3265,7 +3265,7 @@ print_function_arguments(StringInfo buf, HeapTuple proctup,
HeapTuple aggtup;
Form_pg_aggregate agg;
- aggtup = SearchSysCache1(AGGFNOID, proc->oid);
+ aggtup = SearchSysCache(AGGFNOID, proc->oid);
if (!HeapTupleIsValid(aggtup))
elog(ERROR, "cache lookup failed for aggregate %u",
proc->oid);
@@ -3425,7 +3425,7 @@ pg_get_function_arg_default(PG_FUNCTION_ARGS)
bool isnull;
int nth_default;
- proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
+ proctup = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(proctup))
PG_RETURN_NULL();
@@ -3540,7 +3540,7 @@ pg_get_function_sqlbody(PG_FUNCTION_ARGS)
initStringInfo(&buf);
/* Look up the function */
- proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
+ proctup = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(proctup))
PG_RETURN_NULL();
@@ -11588,7 +11588,7 @@ get_opclass_name(Oid opclass, Oid actual_datatype,
char *opcname;
char *nspname;
- ht_opc = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclass));
+ ht_opc = SearchSysCache(CLAOID, ObjectIdGetDatum(opclass));
if (!HeapTupleIsValid(ht_opc))
elog(ERROR, "cache lookup failed for opclass %u", opclass);
opcrec = (Form_pg_opclass) GETSTRUCT(ht_opc);
@@ -11882,7 +11882,7 @@ generate_relation_name(Oid relid, List *namespaces)
char *nspname;
char *result;
- tp = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
+ tp = SearchSysCache(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for relation %u", relid);
reltup = (Form_pg_class) GETSTRUCT(tp);
@@ -11940,7 +11940,7 @@ generate_qualified_relation_name(Oid relid)
char *nspname;
char *result;
- tp = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
+ tp = SearchSysCache(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for relation %u", relid);
reltup = (Form_pg_class) GETSTRUCT(tp);
@@ -11993,7 +11993,7 @@ generate_function_name(Oid funcid, int nargs, List *argnames, Oid *argtypes,
Oid *p_true_typeids;
bool force_qualify = false;
- proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
+ proctup = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(proctup))
elog(ERROR, "cache lookup failed for function %u", funcid);
procform = (Form_pg_proc) GETSTRUCT(proctup);
@@ -12090,7 +12090,7 @@ generate_operator_name(Oid operid, Oid arg1, Oid arg2)
initStringInfo(&buf);
- opertup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operid));
+ opertup = SearchSysCache(OPEROID, ObjectIdGetDatum(operid));
if (!HeapTupleIsValid(opertup))
elog(ERROR, "cache lookup failed for operator %u", operid);
operform = (Form_pg_operator) GETSTRUCT(opertup);
@@ -12166,7 +12166,7 @@ generate_operator_clause(StringInfo buf,
char *oprname;
char *nspname;
- opertup = SearchSysCache1(OPEROID, ObjectIdGetDatum(opoid));
+ opertup = SearchSysCache(OPEROID, ObjectIdGetDatum(opoid));
if (!HeapTupleIsValid(opertup))
elog(ERROR, "cache lookup failed for operator %u", opoid);
operform = (Form_pg_operator) GETSTRUCT(opertup);
@@ -12203,7 +12203,7 @@ add_cast_to(StringInfo buf, Oid typid)
char *typname;
char *nspname;
- typetup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
+ typetup = SearchSysCache(TYPEOID, ObjectIdGetDatum(typid));
if (!HeapTupleIsValid(typetup))
elog(ERROR, "cache lookup failed for type %u", typid);
typform = (Form_pg_type) GETSTRUCT(typetup);
@@ -12235,7 +12235,7 @@ generate_qualified_type_name(Oid typid)
char *nspname;
char *result;
- tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
+ tp = SearchSysCache(TYPEOID, ObjectIdGetDatum(typid));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for type %u", typid);
typtup = (Form_pg_type) GETSTRUCT(tp);
@@ -12268,7 +12268,7 @@ generate_collation_name(Oid collid)
char *nspname;
char *result;
- tp = SearchSysCache1(COLLOID, ObjectIdGetDatum(collid));
+ tp = SearchSysCache(COLLOID, ObjectIdGetDatum(collid));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for collation %u", collid);
colltup = (Form_pg_collation) GETSTRUCT(tp);
@@ -12367,7 +12367,7 @@ flatten_reloptions(Oid relid)
Datum reloptions;
bool isnull;
- tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
+ tuple = SearchSysCache(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", relid);
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
index fe37e65af0..9355f35002 100644
--- a/src/backend/utils/adt/selfuncs.c
+++ b/src/backend/utils/adt/selfuncs.c
@@ -5152,10 +5152,10 @@ examine_variable(PlannerInfo *root, Node *node, int varRelid,
else if (index->indpred == NIL)
{
vardata->statsTuple =
- SearchSysCache3(STATRELATTINH,
- ObjectIdGetDatum(index->indexoid),
- Int16GetDatum(pos + 1),
- BoolGetDatum(false));
+ SearchSysCache(STATRELATTINH,
+ ObjectIdGetDatum(index->indexoid),
+ Int16GetDatum(pos + 1),
+ BoolGetDatum(false));
vardata->freefunc = ReleaseSysCache;
if (HeapTupleIsValid(vardata->statsTuple))
@@ -5388,10 +5388,10 @@ examine_simple_variable(PlannerInfo *root, Var *var,
* Plain table or parent of an inheritance appendrel, so look up the
* column in pg_statistic
*/
- vardata->statsTuple = SearchSysCache3(STATRELATTINH,
- ObjectIdGetDatum(rte->relid),
- Int16GetDatum(var->varattno),
- BoolGetDatum(rte->inh));
+ vardata->statsTuple = SearchSysCache(STATRELATTINH,
+ ObjectIdGetDatum(rte->relid),
+ Int16GetDatum(var->varattno),
+ BoolGetDatum(rte->inh));
vardata->freefunc = ReleaseSysCache;
if (HeapTupleIsValid(vardata->statsTuple))
@@ -6895,10 +6895,10 @@ btcostestimate(PlannerInfo *root, IndexPath *path, double loop_count,
}
else
{
- vardata.statsTuple = SearchSysCache3(STATRELATTINH,
- ObjectIdGetDatum(relid),
- Int16GetDatum(colnum),
- BoolGetDatum(rte->inh));
+ vardata.statsTuple = SearchSysCache(STATRELATTINH,
+ ObjectIdGetDatum(relid),
+ Int16GetDatum(colnum),
+ BoolGetDatum(rte->inh));
vardata.freefunc = ReleaseSysCache;
}
}
@@ -6921,10 +6921,10 @@ btcostestimate(PlannerInfo *root, IndexPath *path, double loop_count,
}
else
{
- vardata.statsTuple = SearchSysCache3(STATRELATTINH,
- ObjectIdGetDatum(relid),
- Int16GetDatum(colnum),
- BoolGetDatum(false));
+ vardata.statsTuple = SearchSysCache(STATRELATTINH,
+ ObjectIdGetDatum(relid),
+ Int16GetDatum(colnum),
+ BoolGetDatum(false));
vardata.freefunc = ReleaseSysCache;
}
}
@@ -7905,10 +7905,10 @@ brincostestimate(PlannerInfo *root, IndexPath *path, double loop_count,
else
{
vardata.statsTuple =
- SearchSysCache3(STATRELATTINH,
- ObjectIdGetDatum(rte->relid),
- Int16GetDatum(attnum),
- BoolGetDatum(false));
+ SearchSysCache(STATRELATTINH,
+ ObjectIdGetDatum(rte->relid),
+ Int16GetDatum(attnum),
+ BoolGetDatum(false));
vardata.freefunc = ReleaseSysCache;
}
}
@@ -7935,10 +7935,10 @@ brincostestimate(PlannerInfo *root, IndexPath *path, double loop_count,
}
else
{
- vardata.statsTuple = SearchSysCache3(STATRELATTINH,
- ObjectIdGetDatum(index->indexoid),
- Int16GetDatum(attnum),
- BoolGetDatum(false));
+ vardata.statsTuple = SearchSysCache(STATRELATTINH,
+ ObjectIdGetDatum(index->indexoid),
+ Int16GetDatum(attnum),
+ BoolGetDatum(false));
vardata.freefunc = ReleaseSysCache;
}
}
diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c
index 15adbd6a01..17c6c1419e 100644
--- a/src/backend/utils/adt/xml.c
+++ b/src/backend/utils/adt/xml.c
@@ -3431,7 +3431,7 @@ map_sql_table_to_xmlschema(TupleDesc tupdesc, Oid relid, bool nulls,
HeapTuple tuple;
Form_pg_class reltuple;
- tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
+ tuple = SearchSysCache(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", relid);
reltuple = (Form_pg_class) GETSTRUCT(tuple);
@@ -3731,7 +3731,7 @@ map_sql_type_to_xml_name(Oid typeoid, int typmod)
HeapTuple tuple;
Form_pg_type typtuple;
- tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typeoid));
+ tuple = SearchSysCache(TYPEOID, ObjectIdGetDatum(typeoid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for type %u", typeoid);
typtuple = (Form_pg_type) GETSTRUCT(tuple);
diff --git a/src/backend/utils/cache/attoptcache.c b/src/backend/utils/cache/attoptcache.c
index 6769d4765b..be5652fe10 100644
--- a/src/backend/utils/cache/attoptcache.c
+++ b/src/backend/utils/cache/attoptcache.c
@@ -125,9 +125,9 @@ get_attribute_options(Oid attrelid, int attnum)
{
AttributeOpts *opts;
- tp = SearchSysCache2(ATTNUM,
- ObjectIdGetDatum(attrelid),
- Int16GetDatum(attnum));
+ tp = SearchSysCache(ATTNUM,
+ ObjectIdGetDatum(attrelid),
+ Int16GetDatum(attnum));
/*
* If we don't find a valid HeapTuple, it must mean someone has
diff --git a/src/backend/utils/cache/inval.c b/src/backend/utils/cache/inval.c
index 0008826f67..31747a8c13 100644
--- a/src/backend/utils/cache/inval.c
+++ b/src/backend/utils/cache/inval.c
@@ -1425,7 +1425,7 @@ CacheInvalidateRelcacheByRelid(Oid relid)
PrepareInvalidationState();
- tup = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
+ tup = SearchSysCache(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for relation %u", relid);
CacheInvalidateRelcacheByTuple(tup);
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c
index c7607895cd..0d88cde3ce 100644
--- a/src/backend/utils/cache/lsyscache.c
+++ b/src/backend/utils/cache/lsyscache.c
@@ -64,10 +64,10 @@ get_attavgwidth_hook_type get_attavgwidth_hook = NULL;
bool
op_in_opfamily(Oid opno, Oid opfamily)
{
- return SearchSysCacheExists3(AMOPOPID,
- ObjectIdGetDatum(opno),
- CharGetDatum(AMOP_SEARCH),
- ObjectIdGetDatum(opfamily));
+ return SearchSysCacheExists(AMOPOPID,
+ ObjectIdGetDatum(opno),
+ CharGetDatum(AMOP_SEARCH),
+ ObjectIdGetDatum(opfamily));
}
/*
@@ -85,10 +85,10 @@ get_op_opfamily_strategy(Oid opno, Oid opfamily)
Form_pg_amop amop_tup;
int result;
- tp = SearchSysCache3(AMOPOPID,
- ObjectIdGetDatum(opno),
- CharGetDatum(AMOP_SEARCH),
- ObjectIdGetDatum(opfamily));
+ tp = SearchSysCache(AMOPOPID,
+ ObjectIdGetDatum(opno),
+ CharGetDatum(AMOP_SEARCH),
+ ObjectIdGetDatum(opfamily));
if (!HeapTupleIsValid(tp))
return 0;
amop_tup = (Form_pg_amop) GETSTRUCT(tp);
@@ -110,10 +110,10 @@ get_op_opfamily_sortfamily(Oid opno, Oid opfamily)
Form_pg_amop amop_tup;
Oid result;
- tp = SearchSysCache3(AMOPOPID,
- ObjectIdGetDatum(opno),
- CharGetDatum(AMOP_ORDER),
- ObjectIdGetDatum(opfamily));
+ tp = SearchSysCache(AMOPOPID,
+ ObjectIdGetDatum(opno),
+ CharGetDatum(AMOP_ORDER),
+ ObjectIdGetDatum(opfamily));
if (!HeapTupleIsValid(tp))
return InvalidOid;
amop_tup = (Form_pg_amop) GETSTRUCT(tp);
@@ -140,10 +140,10 @@ get_op_opfamily_properties(Oid opno, Oid opfamily, bool ordering_op,
HeapTuple tp;
Form_pg_amop amop_tup;
- tp = SearchSysCache3(AMOPOPID,
- ObjectIdGetDatum(opno),
- CharGetDatum(ordering_op ? AMOP_ORDER : AMOP_SEARCH),
- ObjectIdGetDatum(opfamily));
+ tp = SearchSysCache(AMOPOPID,
+ ObjectIdGetDatum(opno),
+ CharGetDatum(ordering_op ? AMOP_ORDER : AMOP_SEARCH),
+ ObjectIdGetDatum(opfamily));
if (!HeapTupleIsValid(tp))
elog(ERROR, "operator %u is not a member of opfamily %u",
opno, opfamily);
@@ -169,11 +169,11 @@ get_opfamily_member(Oid opfamily, Oid lefttype, Oid righttype,
Form_pg_amop amop_tup;
Oid result;
- tp = SearchSysCache4(AMOPSTRATEGY,
- ObjectIdGetDatum(opfamily),
- ObjectIdGetDatum(lefttype),
- ObjectIdGetDatum(righttype),
- Int16GetDatum(strategy));
+ tp = SearchSysCache(AMOPSTRATEGY,
+ ObjectIdGetDatum(opfamily),
+ ObjectIdGetDatum(lefttype),
+ ObjectIdGetDatum(righttype),
+ Int16GetDatum(strategy));
if (!HeapTupleIsValid(tp))
return InvalidOid;
amop_tup = (Form_pg_amop) GETSTRUCT(tp);
@@ -219,7 +219,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 = SearchSysCacheList1(AMOPOPID, ObjectIdGetDatum(opno));
+ catlist = SearchSysCacheList(AMOPOPID, ObjectIdGetDatum(opno));
for (i = 0; i < catlist->n_members; i++)
{
@@ -311,7 +311,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 = SearchSysCacheList1(AMOPOPID, ObjectIdGetDatum(opno));
+ catlist = SearchSysCacheList(AMOPOPID, ObjectIdGetDatum(opno));
for (i = 0; i < catlist->n_members; i++)
{
@@ -372,7 +372,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 = SearchSysCacheList1(AMOPOPID, ObjectIdGetDatum(opno));
+ catlist = SearchSysCacheList(AMOPOPID, ObjectIdGetDatum(opno));
for (i = 0; i < catlist->n_members; i++)
{
@@ -424,7 +424,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 = SearchSysCacheList1(AMOPOPID, ObjectIdGetDatum(opno));
+ catlist = SearchSysCacheList(AMOPOPID, ObjectIdGetDatum(opno));
for (i = 0; i < catlist->n_members; i++)
{
@@ -524,7 +524,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 = SearchSysCacheList1(AMOPOPID, ObjectIdGetDatum(opno));
+ catlist = SearchSysCacheList(AMOPOPID, ObjectIdGetDatum(opno));
for (i = 0; i < catlist->n_members; i++)
{
@@ -607,7 +607,7 @@ get_op_btree_interpretation(Oid opno)
/*
* Find all the pg_amop entries containing the operator.
*/
- catlist = SearchSysCacheList1(AMOPOPID, ObjectIdGetDatum(opno));
+ catlist = SearchSysCacheList(AMOPOPID, ObjectIdGetDatum(opno));
for (i = 0; i < catlist->n_members; i++)
{
@@ -644,8 +644,8 @@ get_op_btree_interpretation(Oid opno)
if (OidIsValid(op_negator))
{
- catlist = SearchSysCacheList1(AMOPOPID,
- ObjectIdGetDatum(op_negator));
+ catlist = SearchSysCacheList(AMOPOPID,
+ ObjectIdGetDatum(op_negator));
for (i = 0; i < catlist->n_members; i++)
{
@@ -707,7 +707,7 @@ equality_ops_are_compatible(Oid opno1, Oid opno2)
/*
* We search through all the pg_amop entries for opno1.
*/
- catlist = SearchSysCacheList1(AMOPOPID, ObjectIdGetDatum(opno1));
+ catlist = SearchSysCacheList(AMOPOPID, ObjectIdGetDatum(opno1));
result = false;
for (i = 0; i < catlist->n_members; i++)
@@ -758,7 +758,7 @@ comparison_ops_are_compatible(Oid opno1, Oid opno2)
/*
* We search through all the pg_amop entries for opno1.
*/
- catlist = SearchSysCacheList1(AMOPOPID, ObjectIdGetDatum(opno1));
+ catlist = SearchSysCacheList(AMOPOPID, ObjectIdGetDatum(opno1));
result = false;
for (i = 0; i < catlist->n_members; i++)
@@ -798,11 +798,11 @@ get_opfamily_proc(Oid opfamily, Oid lefttype, Oid righttype, int16 procnum)
Form_pg_amproc amproc_tup;
RegProcedure result;
- tp = SearchSysCache4(AMPROCNUM,
- ObjectIdGetDatum(opfamily),
- ObjectIdGetDatum(lefttype),
- ObjectIdGetDatum(righttype),
- Int16GetDatum(procnum));
+ tp = SearchSysCache(AMPROCNUM,
+ ObjectIdGetDatum(opfamily),
+ ObjectIdGetDatum(lefttype),
+ ObjectIdGetDatum(righttype),
+ Int16GetDatum(procnum));
if (!HeapTupleIsValid(tp))
return InvalidOid;
amproc_tup = (Form_pg_amproc) GETSTRUCT(tp);
@@ -827,8 +827,8 @@ get_attname(Oid relid, AttrNumber attnum, bool missing_ok)
{
HeapTuple tp;
- tp = SearchSysCache2(ATTNUM,
- ObjectIdGetDatum(relid), Int16GetDatum(attnum));
+ tp = SearchSysCache(ATTNUM,
+ ObjectIdGetDatum(relid), Int16GetDatum(attnum));
if (HeapTupleIsValid(tp))
{
Form_pg_attribute att_tup = (Form_pg_attribute) GETSTRUCT(tp);
@@ -887,9 +887,9 @@ get_attstattarget(Oid relid, AttrNumber attnum)
Form_pg_attribute att_tup;
int result;
- tp = SearchSysCache2(ATTNUM,
- ObjectIdGetDatum(relid),
- Int16GetDatum(attnum));
+ tp = SearchSysCache(ATTNUM,
+ ObjectIdGetDatum(relid),
+ Int16GetDatum(attnum));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for attribute %d of relation %u",
attnum, relid);
@@ -917,9 +917,9 @@ get_attgenerated(Oid relid, AttrNumber attnum)
Form_pg_attribute att_tup;
char result;
- tp = SearchSysCache2(ATTNUM,
- ObjectIdGetDatum(relid),
- Int16GetDatum(attnum));
+ tp = SearchSysCache(ATTNUM,
+ ObjectIdGetDatum(relid),
+ Int16GetDatum(attnum));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for attribute %d of relation %u",
attnum, relid);
@@ -940,9 +940,9 @@ get_atttype(Oid relid, AttrNumber attnum)
{
HeapTuple tp;
- tp = SearchSysCache2(ATTNUM,
- ObjectIdGetDatum(relid),
- Int16GetDatum(attnum));
+ tp = SearchSysCache(ATTNUM,
+ ObjectIdGetDatum(relid),
+ Int16GetDatum(attnum));
if (HeapTupleIsValid(tp))
{
Form_pg_attribute att_tup = (Form_pg_attribute) GETSTRUCT(tp);
@@ -972,9 +972,9 @@ get_atttypetypmodcoll(Oid relid, AttrNumber attnum,
HeapTuple tp;
Form_pg_attribute att_tup;
- tp = SearchSysCache2(ATTNUM,
- ObjectIdGetDatum(relid),
- Int16GetDatum(attnum));
+ tp = SearchSysCache(ATTNUM,
+ ObjectIdGetDatum(relid),
+ Int16GetDatum(attnum));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for attribute %d of relation %u",
attnum, relid);
@@ -1000,9 +1000,9 @@ get_attoptions(Oid relid, int16 attnum)
Datum result;
bool isnull;
- tuple = SearchSysCache2(ATTNUM,
- ObjectIdGetDatum(relid),
- Int16GetDatum(attnum));
+ tuple = SearchSysCache(ATTNUM,
+ ObjectIdGetDatum(relid),
+ Int16GetDatum(attnum));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for attribute %d of relation %u",
@@ -1034,9 +1034,9 @@ get_cast_oid(Oid sourcetypeid, Oid targettypeid, bool missing_ok)
{
Oid oid;
- oid = GetSysCacheOid2(CASTSOURCETARGET, Anum_pg_cast_oid,
- ObjectIdGetDatum(sourcetypeid),
- ObjectIdGetDatum(targettypeid));
+ oid = GetSysCacheOid(CASTSOURCETARGET, Anum_pg_cast_oid,
+ ObjectIdGetDatum(sourcetypeid),
+ ObjectIdGetDatum(targettypeid));
if (!OidIsValid(oid) && !missing_ok)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -1062,7 +1062,7 @@ get_collation_name(Oid colloid)
{
HeapTuple tp;
- tp = SearchSysCache1(COLLOID, ObjectIdGetDatum(colloid));
+ tp = SearchSysCache(COLLOID, ObjectIdGetDatum(colloid));
if (HeapTupleIsValid(tp))
{
Form_pg_collation colltup = (Form_pg_collation) GETSTRUCT(tp);
@@ -1083,7 +1083,7 @@ get_collation_isdeterministic(Oid colloid)
Form_pg_collation colltup;
bool result;
- tp = SearchSysCache1(COLLOID, ObjectIdGetDatum(colloid));
+ tp = SearchSysCache(COLLOID, ObjectIdGetDatum(colloid));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for collation %u", colloid);
colltup = (Form_pg_collation) GETSTRUCT(tp);
@@ -1108,7 +1108,7 @@ get_constraint_name(Oid conoid)
{
HeapTuple tp;
- tp = SearchSysCache1(CONSTROID, ObjectIdGetDatum(conoid));
+ tp = SearchSysCache(CONSTROID, ObjectIdGetDatum(conoid));
if (HeapTupleIsValid(tp))
{
Form_pg_constraint contup = (Form_pg_constraint) GETSTRUCT(tp);
@@ -1140,7 +1140,7 @@ get_constraint_index(Oid conoid)
{
HeapTuple tp;
- tp = SearchSysCache1(CONSTROID, ObjectIdGetDatum(conoid));
+ tp = SearchSysCache(CONSTROID, ObjectIdGetDatum(conoid));
if (HeapTupleIsValid(tp))
{
Form_pg_constraint contup = (Form_pg_constraint) GETSTRUCT(tp);
@@ -1166,7 +1166,7 @@ get_language_name(Oid langoid, bool missing_ok)
{
HeapTuple tp;
- tp = SearchSysCache1(LANGOID, ObjectIdGetDatum(langoid));
+ tp = SearchSysCache(LANGOID, ObjectIdGetDatum(langoid));
if (HeapTupleIsValid(tp))
{
Form_pg_language lantup = (Form_pg_language) GETSTRUCT(tp);
@@ -1197,7 +1197,7 @@ get_opclass_family(Oid opclass)
Form_pg_opclass cla_tup;
Oid result;
- tp = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclass));
+ tp = SearchSysCache(CLAOID, ObjectIdGetDatum(opclass));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for opclass %u", opclass);
cla_tup = (Form_pg_opclass) GETSTRUCT(tp);
@@ -1219,7 +1219,7 @@ get_opclass_input_type(Oid opclass)
Form_pg_opclass cla_tup;
Oid result;
- tp = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclass));
+ tp = SearchSysCache(CLAOID, ObjectIdGetDatum(opclass));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for opclass %u", opclass);
cla_tup = (Form_pg_opclass) GETSTRUCT(tp);
@@ -1241,7 +1241,7 @@ get_opclass_opfamily_and_input_type(Oid opclass, Oid *opfamily, Oid *opcintype)
HeapTuple tp;
Form_pg_opclass cla_tup;
- tp = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclass));
+ tp = SearchSysCache(CLAOID, ObjectIdGetDatum(opclass));
if (!HeapTupleIsValid(tp))
return false;
@@ -1268,7 +1268,7 @@ get_opcode(Oid opno)
{
HeapTuple tp;
- tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
+ tp = SearchSysCache(OPEROID, ObjectIdGetDatum(opno));
if (HeapTupleIsValid(tp))
{
Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
@@ -1293,7 +1293,7 @@ get_opname(Oid opno)
{
HeapTuple tp;
- tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
+ tp = SearchSysCache(OPEROID, ObjectIdGetDatum(opno));
if (HeapTupleIsValid(tp))
{
Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
@@ -1316,7 +1316,7 @@ get_op_rettype(Oid opno)
{
HeapTuple tp;
- tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
+ tp = SearchSysCache(OPEROID, ObjectIdGetDatum(opno));
if (HeapTupleIsValid(tp))
{
Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
@@ -1342,7 +1342,7 @@ op_input_types(Oid opno, Oid *lefttype, Oid *righttype)
HeapTuple tp;
Form_pg_operator optup;
- tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
+ tp = SearchSysCache(OPEROID, ObjectIdGetDatum(opno));
if (!HeapTupleIsValid(tp)) /* shouldn't happen */
elog(ERROR, "cache lookup failed for operator %u", opno);
optup = (Form_pg_operator) GETSTRUCT(tp);
@@ -1392,7 +1392,7 @@ op_mergejoinable(Oid opno, Oid inputtype)
else
{
/* For all other operators, rely on pg_operator.oprcanmerge */
- tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
+ tp = SearchSysCache(OPEROID, ObjectIdGetDatum(opno));
if (HeapTupleIsValid(tp))
{
Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
@@ -1438,7 +1438,7 @@ op_hashjoinable(Oid opno, Oid inputtype)
else
{
/* For all other operators, rely on pg_operator.oprcanhash */
- tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
+ tp = SearchSysCache(OPEROID, ObjectIdGetDatum(opno));
if (HeapTupleIsValid(tp))
{
Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
@@ -1492,7 +1492,7 @@ get_commutator(Oid opno)
{
HeapTuple tp;
- tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
+ tp = SearchSysCache(OPEROID, ObjectIdGetDatum(opno));
if (HeapTupleIsValid(tp))
{
Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
@@ -1516,7 +1516,7 @@ get_negator(Oid opno)
{
HeapTuple tp;
- tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
+ tp = SearchSysCache(OPEROID, ObjectIdGetDatum(opno));
if (HeapTupleIsValid(tp))
{
Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
@@ -1540,7 +1540,7 @@ get_oprrest(Oid opno)
{
HeapTuple tp;
- tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
+ tp = SearchSysCache(OPEROID, ObjectIdGetDatum(opno));
if (HeapTupleIsValid(tp))
{
Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
@@ -1564,7 +1564,7 @@ get_oprjoin(Oid opno)
{
HeapTuple tp;
- tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
+ tp = SearchSysCache(OPEROID, ObjectIdGetDatum(opno));
if (HeapTupleIsValid(tp))
{
Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
@@ -1591,7 +1591,7 @@ get_func_name(Oid funcid)
{
HeapTuple tp;
- tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
+ tp = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid));
if (HeapTupleIsValid(tp))
{
Form_pg_proc functup = (Form_pg_proc) GETSTRUCT(tp);
@@ -1615,7 +1615,7 @@ get_func_namespace(Oid funcid)
{
HeapTuple tp;
- tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
+ tp = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid));
if (HeapTupleIsValid(tp))
{
Form_pg_proc functup = (Form_pg_proc) GETSTRUCT(tp);
@@ -1639,7 +1639,7 @@ get_func_rettype(Oid funcid)
HeapTuple tp;
Oid result;
- tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
+ tp = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for function %u", funcid);
@@ -1658,7 +1658,7 @@ get_func_nargs(Oid funcid)
HeapTuple tp;
int result;
- tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
+ tp = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for function %u", funcid);
@@ -1681,7 +1681,7 @@ get_func_signature(Oid funcid, Oid **argtypes, int *nargs)
Form_pg_proc procstruct;
Oid result;
- tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
+ tp = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for function %u", funcid);
@@ -1707,7 +1707,7 @@ get_func_variadictype(Oid funcid)
HeapTuple tp;
Oid result;
- tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
+ tp = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for function %u", funcid);
@@ -1726,7 +1726,7 @@ get_func_retset(Oid funcid)
HeapTuple tp;
bool result;
- tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
+ tp = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for function %u", funcid);
@@ -1745,7 +1745,7 @@ func_strict(Oid funcid)
HeapTuple tp;
bool result;
- tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
+ tp = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for function %u", funcid);
@@ -1764,7 +1764,7 @@ func_volatile(Oid funcid)
HeapTuple tp;
char result;
- tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
+ tp = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for function %u", funcid);
@@ -1783,7 +1783,7 @@ func_parallel(Oid funcid)
HeapTuple tp;
char result;
- tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
+ tp = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for function %u", funcid);
@@ -1802,7 +1802,7 @@ get_func_prokind(Oid funcid)
HeapTuple tp;
char result;
- tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
+ tp = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for function %u", funcid);
@@ -1821,7 +1821,7 @@ get_func_leakproof(Oid funcid)
HeapTuple tp;
bool result;
- tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
+ tp = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for function %u", funcid);
@@ -1841,7 +1841,7 @@ get_func_support(Oid funcid)
{
HeapTuple tp;
- tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
+ tp = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid));
if (HeapTupleIsValid(tp))
{
Form_pg_proc functup = (Form_pg_proc) GETSTRUCT(tp);
@@ -1866,9 +1866,9 @@ get_func_support(Oid funcid)
Oid
get_relname_relid(const char *relname, Oid relnamespace)
{
- return GetSysCacheOid2(RELNAMENSP, Anum_pg_class_oid,
- PointerGetDatum(relname),
- ObjectIdGetDatum(relnamespace));
+ return GetSysCacheOid(RELNAMENSP, Anum_pg_class_oid,
+ PointerGetDatum(relname),
+ ObjectIdGetDatum(relnamespace));
}
#ifdef NOT_USED
@@ -1882,7 +1882,7 @@ get_relnatts(Oid relid)
{
HeapTuple tp;
- tp = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
+ tp = SearchSysCache(RELOID, ObjectIdGetDatum(relid));
if (HeapTupleIsValid(tp))
{
Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp);
@@ -1911,7 +1911,7 @@ get_rel_name(Oid relid)
{
HeapTuple tp;
- tp = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
+ tp = SearchSysCache(RELOID, ObjectIdGetDatum(relid));
if (HeapTupleIsValid(tp))
{
Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp);
@@ -1935,7 +1935,7 @@ get_rel_namespace(Oid relid)
{
HeapTuple tp;
- tp = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
+ tp = SearchSysCache(RELOID, ObjectIdGetDatum(relid));
if (HeapTupleIsValid(tp))
{
Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp);
@@ -1962,7 +1962,7 @@ get_rel_type_id(Oid relid)
{
HeapTuple tp;
- tp = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
+ tp = SearchSysCache(RELOID, ObjectIdGetDatum(relid));
if (HeapTupleIsValid(tp))
{
Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp);
@@ -1986,7 +1986,7 @@ get_rel_relkind(Oid relid)
{
HeapTuple tp;
- tp = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
+ tp = SearchSysCache(RELOID, ObjectIdGetDatum(relid));
if (HeapTupleIsValid(tp))
{
Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp);
@@ -2010,7 +2010,7 @@ get_rel_relispartition(Oid relid)
{
HeapTuple tp;
- tp = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
+ tp = SearchSysCache(RELOID, ObjectIdGetDatum(relid));
if (HeapTupleIsValid(tp))
{
Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp);
@@ -2037,7 +2037,7 @@ get_rel_tablespace(Oid relid)
{
HeapTuple tp;
- tp = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
+ tp = SearchSysCache(RELOID, ObjectIdGetDatum(relid));
if (HeapTupleIsValid(tp))
{
Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp);
@@ -2063,7 +2063,7 @@ get_rel_persistence(Oid relid)
Form_pg_class reltup;
char result;
- tp = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
+ tp = SearchSysCache(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for relation %u", relid);
reltup = (Form_pg_class) GETSTRUCT(tp);
@@ -2084,7 +2084,7 @@ get_transform_fromsql(Oid typid, Oid langid, List *trftypes)
if (!list_member_oid(trftypes, typid))
return InvalidOid;
- tup = SearchSysCache2(TRFTYPELANG, typid, langid);
+ tup = SearchSysCache(TRFTYPELANG, typid, langid);
if (HeapTupleIsValid(tup))
{
Oid funcid;
@@ -2105,7 +2105,7 @@ get_transform_tosql(Oid typid, Oid langid, List *trftypes)
if (!list_member_oid(trftypes, typid))
return InvalidOid;
- tup = SearchSysCache2(TRFTYPELANG, typid, langid);
+ tup = SearchSysCache(TRFTYPELANG, typid, langid);
if (HeapTupleIsValid(tup))
{
Oid funcid;
@@ -2132,7 +2132,7 @@ get_typisdefined(Oid typid)
{
HeapTuple tp;
- tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
+ tp = SearchSysCache(TYPEOID, ObjectIdGetDatum(typid));
if (HeapTupleIsValid(tp))
{
Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
@@ -2156,7 +2156,7 @@ get_typlen(Oid typid)
{
HeapTuple tp;
- tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
+ tp = SearchSysCache(TYPEOID, ObjectIdGetDatum(typid));
if (HeapTupleIsValid(tp))
{
Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
@@ -2181,7 +2181,7 @@ get_typbyval(Oid typid)
{
HeapTuple tp;
- tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
+ tp = SearchSysCache(TYPEOID, ObjectIdGetDatum(typid));
if (HeapTupleIsValid(tp))
{
Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
@@ -2211,7 +2211,7 @@ get_typlenbyval(Oid typid, int16 *typlen, bool *typbyval)
HeapTuple tp;
Form_pg_type typtup;
- tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
+ tp = SearchSysCache(TYPEOID, ObjectIdGetDatum(typid));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for type %u", typid);
typtup = (Form_pg_type) GETSTRUCT(tp);
@@ -2232,7 +2232,7 @@ get_typlenbyvalalign(Oid typid, int16 *typlen, bool *typbyval,
HeapTuple tp;
Form_pg_type typtup;
- tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
+ tp = SearchSysCache(TYPEOID, ObjectIdGetDatum(typid));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for type %u", typid);
typtup = (Form_pg_type) GETSTRUCT(tp);
@@ -2324,7 +2324,7 @@ get_type_io_data(Oid typid,
return;
}
- typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
+ typeTuple = SearchSysCache(TYPEOID, ObjectIdGetDatum(typid));
if (!HeapTupleIsValid(typeTuple))
elog(ERROR, "cache lookup failed for type %u", typid);
typeStruct = (Form_pg_type) GETSTRUCT(typeTuple);
@@ -2358,7 +2358,7 @@ get_typalign(Oid typid)
{
HeapTuple tp;
- tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
+ tp = SearchSysCache(TYPEOID, ObjectIdGetDatum(typid));
if (HeapTupleIsValid(tp))
{
Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
@@ -2378,7 +2378,7 @@ get_typstorage(Oid typid)
{
HeapTuple tp;
- tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
+ tp = SearchSysCache(TYPEOID, ObjectIdGetDatum(typid));
if (HeapTupleIsValid(tp))
{
Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
@@ -2411,7 +2411,7 @@ get_typdefault(Oid typid)
bool isNull;
Node *expr;
- typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
+ typeTuple = SearchSysCache(TYPEOID, ObjectIdGetDatum(typid));
if (!HeapTupleIsValid(typeTuple))
elog(ERROR, "cache lookup failed for type %u", typid);
type = (Form_pg_type) GETSTRUCT(typeTuple);
@@ -2503,7 +2503,7 @@ getBaseTypeAndTypmod(Oid typid, int32 *typmod)
HeapTuple tup;
Form_pg_type typTup;
- tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
+ tup = SearchSysCache(TYPEOID, ObjectIdGetDatum(typid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for type %u", typid);
typTup = (Form_pg_type) GETSTRUCT(tup);
@@ -2588,7 +2588,7 @@ get_typtype(Oid typid)
{
HeapTuple tp;
- tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
+ tp = SearchSysCache(TYPEOID, ObjectIdGetDatum(typid));
if (HeapTupleIsValid(tp))
{
Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
@@ -2670,7 +2670,7 @@ get_type_category_preferred(Oid typid, char *typcategory, bool *typispreferred)
HeapTuple tp;
Form_pg_type typtup;
- tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
+ tp = SearchSysCache(TYPEOID, ObjectIdGetDatum(typid));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for type %u", typid);
typtup = (Form_pg_type) GETSTRUCT(tp);
@@ -2690,7 +2690,7 @@ get_typ_typrelid(Oid typid)
{
HeapTuple tp;
- tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
+ tp = SearchSysCache(TYPEOID, ObjectIdGetDatum(typid));
if (HeapTupleIsValid(tp))
{
Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
@@ -2718,7 +2718,7 @@ get_element_type(Oid typid)
{
HeapTuple tp;
- tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
+ tp = SearchSysCache(TYPEOID, ObjectIdGetDatum(typid));
if (HeapTupleIsValid(tp))
{
Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
@@ -2747,7 +2747,7 @@ get_array_type(Oid typid)
HeapTuple tp;
Oid result = InvalidOid;
- tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
+ tp = SearchSysCache(TYPEOID, ObjectIdGetDatum(typid));
if (HeapTupleIsValid(tp))
{
result = ((Form_pg_type) GETSTRUCT(tp))->typarray;
@@ -2797,7 +2797,7 @@ get_base_element_type(Oid typid)
HeapTuple tup;
Form_pg_type typTup;
- tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
+ tup = SearchSysCache(TYPEOID, ObjectIdGetDatum(typid));
if (!HeapTupleIsValid(tup))
break;
typTup = (Form_pg_type) GETSTRUCT(tup);
@@ -2834,7 +2834,7 @@ getTypeInputInfo(Oid type, Oid *typInput, Oid *typIOParam)
HeapTuple typeTuple;
Form_pg_type pt;
- typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type));
+ typeTuple = SearchSysCache(TYPEOID, ObjectIdGetDatum(type));
if (!HeapTupleIsValid(typeTuple))
elog(ERROR, "cache lookup failed for type %u", type);
pt = (Form_pg_type) GETSTRUCT(typeTuple);
@@ -2867,7 +2867,7 @@ getTypeOutputInfo(Oid type, Oid *typOutput, bool *typIsVarlena)
HeapTuple typeTuple;
Form_pg_type pt;
- typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type));
+ typeTuple = SearchSysCache(TYPEOID, ObjectIdGetDatum(type));
if (!HeapTupleIsValid(typeTuple))
elog(ERROR, "cache lookup failed for type %u", type);
pt = (Form_pg_type) GETSTRUCT(typeTuple);
@@ -2900,7 +2900,7 @@ getTypeBinaryInputInfo(Oid type, Oid *typReceive, Oid *typIOParam)
HeapTuple typeTuple;
Form_pg_type pt;
- typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type));
+ typeTuple = SearchSysCache(TYPEOID, ObjectIdGetDatum(type));
if (!HeapTupleIsValid(typeTuple))
elog(ERROR, "cache lookup failed for type %u", type);
pt = (Form_pg_type) GETSTRUCT(typeTuple);
@@ -2933,7 +2933,7 @@ getTypeBinaryOutputInfo(Oid type, Oid *typSend, bool *typIsVarlena)
HeapTuple typeTuple;
Form_pg_type pt;
- typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type));
+ typeTuple = SearchSysCache(TYPEOID, ObjectIdGetDatum(type));
if (!HeapTupleIsValid(typeTuple))
elog(ERROR, "cache lookup failed for type %u", type);
pt = (Form_pg_type) GETSTRUCT(typeTuple);
@@ -2965,7 +2965,7 @@ get_typmodin(Oid typid)
{
HeapTuple tp;
- tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
+ tp = SearchSysCache(TYPEOID, ObjectIdGetDatum(typid));
if (HeapTupleIsValid(tp))
{
Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
@@ -2990,7 +2990,7 @@ get_typmodout(Oid typid)
{
HeapTuple tp;
- tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
+ tp = SearchSysCache(TYPEOID, ObjectIdGetDatum(typid));
if (HeapTupleIsValid(tp))
{
Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
@@ -3015,7 +3015,7 @@ get_typcollation(Oid typid)
{
HeapTuple tp;
- tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
+ tp = SearchSysCache(TYPEOID, ObjectIdGetDatum(typid));
if (HeapTupleIsValid(tp))
{
Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
@@ -3056,7 +3056,7 @@ get_typsubscript(Oid typid, Oid *typelemp)
{
HeapTuple tp;
- tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
+ tp = SearchSysCache(TYPEOID, ObjectIdGetDatum(typid));
if (HeapTupleIsValid(tp))
{
Form_pg_type typform = (Form_pg_type) GETSTRUCT(tp);
@@ -3124,10 +3124,10 @@ get_attavgwidth(Oid relid, AttrNumber attnum)
if (stawidth > 0)
return stawidth;
}
- tp = SearchSysCache3(STATRELATTINH,
- ObjectIdGetDatum(relid),
- Int16GetDatum(attnum),
- BoolGetDatum(false));
+ tp = SearchSysCache(STATRELATTINH,
+ ObjectIdGetDatum(relid),
+ Int16GetDatum(attnum),
+ BoolGetDatum(false));
if (HeapTupleIsValid(tp))
{
stawidth = ((Form_pg_statistic) GETSTRUCT(tp))->stawidth;
@@ -3234,7 +3234,7 @@ get_attstatsslot(AttStatsSlot *sslot, HeapTuple statstuple,
sslot->valuetype = arrayelemtype = ARR_ELEMTYPE(statarray);
/* Need info about element type */
- typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(arrayelemtype));
+ typeTuple = SearchSysCache(TYPEOID, ObjectIdGetDatum(arrayelemtype));
if (!HeapTupleIsValid(typeTuple))
elog(ERROR, "cache lookup failed for type %u", arrayelemtype);
typeForm = (Form_pg_type) GETSTRUCT(typeTuple);
@@ -3325,7 +3325,7 @@ get_namespace_name(Oid nspid)
{
HeapTuple tp;
- tp = SearchSysCache1(NAMESPACEOID, ObjectIdGetDatum(nspid));
+ tp = SearchSysCache(NAMESPACEOID, ObjectIdGetDatum(nspid));
if (HeapTupleIsValid(tp))
{
Form_pg_namespace nsptup = (Form_pg_namespace) GETSTRUCT(tp);
@@ -3366,7 +3366,7 @@ get_range_subtype(Oid rangeOid)
{
HeapTuple tp;
- tp = SearchSysCache1(RANGETYPE, ObjectIdGetDatum(rangeOid));
+ tp = SearchSysCache(RANGETYPE, ObjectIdGetDatum(rangeOid));
if (HeapTupleIsValid(tp))
{
Form_pg_range rngtup = (Form_pg_range) GETSTRUCT(tp);
@@ -3392,7 +3392,7 @@ get_range_collation(Oid rangeOid)
{
HeapTuple tp;
- tp = SearchSysCache1(RANGETYPE, ObjectIdGetDatum(rangeOid));
+ tp = SearchSysCache(RANGETYPE, ObjectIdGetDatum(rangeOid));
if (HeapTupleIsValid(tp))
{
Form_pg_range rngtup = (Form_pg_range) GETSTRUCT(tp);
@@ -3417,7 +3417,7 @@ get_range_multirange(Oid rangeOid)
{
HeapTuple tp;
- tp = SearchSysCache1(RANGETYPE, ObjectIdGetDatum(rangeOid));
+ tp = SearchSysCache(RANGETYPE, ObjectIdGetDatum(rangeOid));
if (HeapTupleIsValid(tp))
{
Form_pg_range rngtup = (Form_pg_range) GETSTRUCT(tp);
@@ -3442,7 +3442,7 @@ get_multirange_range(Oid multirangeOid)
{
HeapTuple tp;
- tp = SearchSysCache1(RANGEMULTIRANGE, ObjectIdGetDatum(multirangeOid));
+ tp = SearchSysCache(RANGEMULTIRANGE, ObjectIdGetDatum(multirangeOid));
if (HeapTupleIsValid(tp))
{
Form_pg_range rngtup = (Form_pg_range) GETSTRUCT(tp);
@@ -3477,7 +3477,7 @@ get_index_column_opclass(Oid index_oid, int attno)
/* First we need to know the column's opclass. */
- tuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(index_oid));
+ tuple = SearchSysCache(INDEXRELID, ObjectIdGetDatum(index_oid));
if (!HeapTupleIsValid(tuple))
return InvalidOid;
@@ -3516,7 +3516,7 @@ get_index_isreplident(Oid index_oid)
Form_pg_index rd_index;
bool result;
- tuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(index_oid));
+ tuple = SearchSysCache(INDEXRELID, ObjectIdGetDatum(index_oid));
if (!HeapTupleIsValid(tuple))
return false;
@@ -3539,7 +3539,7 @@ get_index_isvalid(Oid index_oid)
HeapTuple tuple;
Form_pg_index rd_index;
- tuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(index_oid));
+ tuple = SearchSysCache(INDEXRELID, ObjectIdGetDatum(index_oid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for index %u", index_oid);
@@ -3562,7 +3562,7 @@ get_index_isclustered(Oid index_oid)
HeapTuple tuple;
Form_pg_index rd_index;
- tuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(index_oid));
+ tuple = SearchSysCache(INDEXRELID, ObjectIdGetDatum(index_oid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for index %u", index_oid);
@@ -3584,8 +3584,8 @@ get_publication_oid(const char *pubname, bool missing_ok)
{
Oid oid;
- oid = GetSysCacheOid1(PUBLICATIONNAME, Anum_pg_publication_oid,
- CStringGetDatum(pubname));
+ oid = GetSysCacheOid(PUBLICATIONNAME, Anum_pg_publication_oid,
+ CStringGetDatum(pubname));
if (!OidIsValid(oid) && !missing_ok)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -3606,7 +3606,7 @@ get_publication_name(Oid pubid, bool missing_ok)
char *pubname;
Form_pg_publication pubform;
- tup = SearchSysCache1(PUBLICATIONOID, ObjectIdGetDatum(pubid));
+ tup = SearchSysCache(PUBLICATIONOID, ObjectIdGetDatum(pubid));
if (!HeapTupleIsValid(tup))
{
@@ -3634,8 +3634,8 @@ get_subscription_oid(const char* subname, bool missing_ok)
{
Oid oid;
- oid = GetSysCacheOid2(SUBSCRIPTIONNAME, Anum_pg_subscription_oid,
- MyDatabaseId, CStringGetDatum(subname));
+ oid = GetSysCacheOid(SUBSCRIPTIONNAME, Anum_pg_subscription_oid,
+ MyDatabaseId, CStringGetDatum(subname));
if (!OidIsValid(oid) && !missing_ok)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -3656,7 +3656,7 @@ get_subscription_name(Oid subid, bool missing_ok)
char* subname;
Form_pg_subscription subform;
- tup = SearchSysCache1(SUBSCRIPTIONOID, ObjectIdGetDatum(subid));
+ tup = SearchSysCache(SUBSCRIPTIONOID, ObjectIdGetDatum(subid));
if (!HeapTupleIsValid(tup))
{
diff --git a/src/backend/utils/cache/partcache.c b/src/backend/utils/cache/partcache.c
index 5f3516ad0c..5a10f8118f 100644
--- a/src/backend/utils/cache/partcache.c
+++ b/src/backend/utils/cache/partcache.c
@@ -94,8 +94,8 @@ RelationBuildPartitionKey(Relation relation)
oldcxt;
int16 procnum;
- tuple = SearchSysCache1(PARTRELID,
- ObjectIdGetDatum(RelationGetRelid(relation)));
+ tuple = SearchSysCache(PARTRELID,
+ ObjectIdGetDatum(RelationGetRelid(relation)));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for partition key of relation %u",
@@ -199,8 +199,8 @@ RelationBuildPartitionKey(Relation relation)
Oid funcid;
/* Collect opfamily information */
- opclasstup = SearchSysCache1(CLAOID,
- ObjectIdGetDatum(opclass->values[i]));
+ opclasstup = SearchSysCache(CLAOID,
+ ObjectIdGetDatum(opclass->values[i]));
if (!HeapTupleIsValid(opclasstup))
elog(ERROR, "cache lookup failed for opclass %u", opclass->values[i]);
@@ -365,7 +365,7 @@ generate_partition_qual(Relation rel)
parent = relation_open(parentrelid, AccessShareLock);
/* Get pg_class.relpartbound */
- tuple = SearchSysCache1(RELOID, RelationGetRelid(rel));
+ tuple = SearchSysCache(RELOID, RelationGetRelid(rel));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u",
RelationGetRelid(rel));
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index 40140de958..b19384376d 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -1436,8 +1436,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 = SearchSysCache1(INDEXRELID,
- ObjectIdGetDatum(RelationGetRelid(relation)));
+ tuple = SearchSysCache(INDEXRELID,
+ ObjectIdGetDatum(RelationGetRelid(relation)));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for index %u",
RelationGetRelid(relation));
@@ -1451,7 +1451,7 @@ RelationInitIndexAccessInfo(Relation relation)
* Look up the index's access method, save the OID of its handler function
*/
Assert(relation->rd_rel->relam != InvalidOid);
- tuple = SearchSysCache1(AMOID, ObjectIdGetDatum(relation->rd_rel->relam));
+ tuple = SearchSysCache(AMOID, ObjectIdGetDatum(relation->rd_rel->relam));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for access method %u",
relation->rd_rel->relam);
@@ -1828,8 +1828,8 @@ RelationInitTableAccessMethod(Relation relation)
* function.
*/
Assert(relation->rd_rel->relam != InvalidOid);
- tuple = SearchSysCache1(AMOID,
- ObjectIdGetDatum(relation->rd_rel->relam));
+ tuple = SearchSysCache(AMOID,
+ ObjectIdGetDatum(relation->rd_rel->relam));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for access method %u",
relation->rd_rel->relam);
@@ -2282,8 +2282,8 @@ RelationReloadIndexInfo(Relation relation)
HeapTuple tuple;
Form_pg_index index;
- tuple = SearchSysCache1(INDEXRELID,
- ObjectIdGetDatum(RelationGetRelid(relation)));
+ tuple = SearchSysCache(INDEXRELID,
+ ObjectIdGetDatum(RelationGetRelid(relation)));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for index %u",
RelationGetRelid(relation));
@@ -3752,8 +3752,8 @@ RelationSetNewRelfilenumber(Relation relation, char persistence)
*/
pg_class = table_open(RelationRelationId, RowExclusiveLock);
- tuple = SearchSysCacheCopy1(RELOID,
- ObjectIdGetDatum(RelationGetRelid(relation)));
+ tuple = SearchSysCacheCopy(RELOID,
+ ObjectIdGetDatum(RelationGetRelid(relation)));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "could not find tuple for relation %u",
RelationGetRelid(relation));
@@ -4196,8 +4196,8 @@ RelationCacheInitializePhase3(void)
HeapTuple htup;
Form_pg_class relp;
- htup = SearchSysCache1(RELOID,
- ObjectIdGetDatum(RelationGetRelid(relation)));
+ htup = SearchSysCache(RELOID,
+ ObjectIdGetDatum(RelationGetRelid(relation)));
if (!HeapTupleIsValid(htup))
elog(FATAL, "cache lookup failed for relation %u",
RelationGetRelid(relation));
@@ -5709,7 +5709,7 @@ RelationBuildPublicationDesc(Relation relation, PublicationDesc *pubdesc)
HeapTuple tup;
Form_pg_publication pubform;
- tup = SearchSysCache1(PUBLICATIONOID, ObjectIdGetDatum(pubid));
+ tup = SearchSysCache(PUBLICATIONOID, ObjectIdGetDatum(pubid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for publication %u", pubid);
diff --git a/src/backend/utils/cache/spccache.c b/src/backend/utils/cache/spccache.c
index 136fd737d3..78ede5b205 100644
--- a/src/backend/utils/cache/spccache.c
+++ b/src/backend/utils/cache/spccache.c
@@ -133,7 +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 = SearchSysCache1(TABLESPACEOID, ObjectIdGetDatum(spcid));
+ tp = SearchSysCache(TABLESPACEOID, ObjectIdGetDatum(spcid));
if (!HeapTupleIsValid(tp))
opts = NULL;
else
diff --git a/src/backend/utils/cache/syscache.c b/src/backend/utils/cache/syscache.c
index 4e4a34bde8..64c4130b60 100644
--- a/src/backend/utils/cache/syscache.c
+++ b/src/backend/utils/cache/syscache.c
@@ -802,62 +802,20 @@ InitCatalogCachePhase2(void)
* CAUTION: The tuple that is returned must NOT be freed by the caller!
*/
HeapTuple
-SearchSysCache(int cacheId,
- Datum key1,
- Datum key2,
- Datum key3,
- Datum key4)
+SearchSysCacheImpl(int cacheId,
+ int nkeys,
+ Datum key1,
+ Datum key2,
+ Datum key3,
+ Datum key4)
{
Assert(cacheId >= 0 && cacheId < SysCacheSize &&
PointerIsValid(SysCache[cacheId]));
+ Assert(SysCache[cacheId]->cc_nkeys == nkeys);
return SearchCatCache(SysCache[cacheId], key1, key2, key3, key4);
}
-HeapTuple
-SearchSysCache1(int cacheId,
- Datum key1)
-{
- Assert(cacheId >= 0 && cacheId < SysCacheSize &&
- PointerIsValid(SysCache[cacheId]));
- Assert(SysCache[cacheId]->cc_nkeys == 1);
-
- return SearchCatCache1(SysCache[cacheId], key1);
-}
-
-HeapTuple
-SearchSysCache2(int cacheId,
- Datum key1, Datum key2)
-{
- Assert(cacheId >= 0 && cacheId < SysCacheSize &&
- PointerIsValid(SysCache[cacheId]));
- Assert(SysCache[cacheId]->cc_nkeys == 2);
-
- return SearchCatCache2(SysCache[cacheId], key1, key2);
-}
-
-HeapTuple
-SearchSysCache3(int cacheId,
- Datum key1, Datum key2, Datum key3)
-{
- Assert(cacheId >= 0 && cacheId < SysCacheSize &&
- PointerIsValid(SysCache[cacheId]));
- Assert(SysCache[cacheId]->cc_nkeys == 3);
-
- return SearchCatCache3(SysCache[cacheId], key1, key2, key3);
-}
-
-HeapTuple
-SearchSysCache4(int cacheId,
- Datum key1, Datum key2, Datum key3, Datum key4)
-{
- Assert(cacheId >= 0 && cacheId < SysCacheSize &&
- PointerIsValid(SysCache[cacheId]));
- Assert(SysCache[cacheId]->cc_nkeys == 4);
-
- return SearchCatCache4(SysCache[cacheId], key1, key2, key3, key4);
-}
-
/*
* ReleaseSysCache
* Release previously grabbed reference count on a tuple
@@ -877,16 +835,17 @@ ReleaseSysCache(HeapTuple tuple)
* heap_freetuple() the result when done with it.
*/
HeapTuple
-SearchSysCacheCopy(int cacheId,
- Datum key1,
- Datum key2,
- Datum key3,
- Datum key4)
+SearchSysCacheCopyImpl(int cacheId,
+ int nkey,
+ Datum key1,
+ Datum key2,
+ Datum key3,
+ Datum key4)
{
HeapTuple tuple,
newtuple;
- tuple = SearchSysCache(cacheId, key1, key2, key3, key4);
+ tuple = SearchSysCacheImpl(cacheId, nkey, key1, key2, key3, key4);
if (!HeapTupleIsValid(tuple))
return tuple;
newtuple = heap_copytuple(tuple);
@@ -901,15 +860,16 @@ SearchSysCacheCopy(int cacheId,
* No lock is retained on the syscache entry.
*/
bool
-SearchSysCacheExists(int cacheId,
- Datum key1,
- Datum key2,
- Datum key3,
- Datum key4)
+SearchSysCacheExistsImpl(int cacheId,
+ int nkey,
+ Datum key1,
+ Datum key2,
+ Datum key3,
+ Datum key4)
{
HeapTuple tuple;
- tuple = SearchSysCache(cacheId, key1, key2, key3, key4);
+ tuple = SearchSysCacheImpl(cacheId, nkey, key1, key2, key3, key4);
if (!HeapTupleIsValid(tuple))
return false;
ReleaseSysCache(tuple);
@@ -924,18 +884,19 @@ SearchSysCacheExists(int cacheId,
* No lock is retained on the syscache entry.
*/
Oid
-GetSysCacheOid(int cacheId,
- AttrNumber oidcol,
- Datum key1,
- Datum key2,
- Datum key3,
- Datum key4)
+GetSysCacheOidImpl(int cacheId,
+ AttrNumber oidcol,
+ int nkey,
+ Datum key1,
+ Datum key2,
+ Datum key3,
+ Datum key4)
{
HeapTuple tuple;
bool isNull;
Oid result;
- tuple = SearchSysCache(cacheId, key1, key2, key3, key4);
+ tuple = SearchSysCacheImpl(cacheId, nkey, key1, key2, key3, key4);
if (!HeapTupleIsValid(tuple))
return InvalidOid;
result = heap_getattr(tuple, oidcol,
@@ -960,9 +921,9 @@ SearchSysCacheAttName(Oid relid, const char *attname)
{
HeapTuple tuple;
- tuple = SearchSysCache2(ATTNAME,
- ObjectIdGetDatum(relid),
- CStringGetDatum(attname));
+ tuple = SearchSysCache(ATTNAME,
+ ObjectIdGetDatum(relid),
+ CStringGetDatum(attname));
if (!HeapTupleIsValid(tuple))
return NULL;
if (((Form_pg_attribute) GETSTRUCT(tuple))->attisdropped)
@@ -1023,9 +984,9 @@ SearchSysCacheAttNum(Oid relid, int16 attnum)
{
HeapTuple tuple;
- tuple = SearchSysCache2(ATTNUM,
- ObjectIdGetDatum(relid),
- Int16GetDatum(attnum));
+ tuple = SearchSysCache(ATTNUM,
+ ObjectIdGetDatum(relid),
+ Int16GetDatum(attnum));
if (!HeapTupleIsValid(tuple))
return NULL;
if (((Form_pg_attribute) GETSTRUCT(tuple))->attisdropped)
@@ -1127,7 +1088,7 @@ SysCacheGetAttrNotNull(int cacheId, HeapTuple tup,
}
/*
- * GetSysCacheHashValue
+ * GetSysCacheHashValueImpl
*
* Get the hash value that would be used for a tuple in the specified cache
* with the given search keys.
@@ -1137,11 +1098,11 @@ SysCacheGetAttrNotNull(int cacheId, HeapTuple tup,
* catcache code that need to be able to compute the hash values.
*/
uint32
-GetSysCacheHashValue(int cacheId,
- Datum key1,
- Datum key2,
- Datum key3,
- Datum key4)
+GetSysCacheHashValueImpl(int cacheId,
+ Datum key1,
+ Datum key2,
+ Datum key3,
+ Datum key4)
{
if (cacheId < 0 || cacheId >= SysCacheSize ||
!PointerIsValid(SysCache[cacheId]))
@@ -1154,8 +1115,8 @@ GetSysCacheHashValue(int cacheId,
* List-search interface
*/
struct catclist *
-SearchSysCacheList(int cacheId, int nkeys,
- Datum key1, Datum key2, Datum key3)
+SearchSysCacheListImpl(int cacheId, int nkeys,
+ Datum key1, Datum key2, Datum key3)
{
if (cacheId < 0 || cacheId >= SysCacheSize ||
!PointerIsValid(SysCache[cacheId]))
diff --git a/src/backend/utils/cache/ts_cache.c b/src/backend/utils/cache/ts_cache.c
index 7760ad764e..dff1ac3831 100644
--- a/src/backend/utils/cache/ts_cache.c
+++ b/src/backend/utils/cache/ts_cache.c
@@ -150,7 +150,7 @@ lookup_ts_parser_cache(Oid prsId)
HeapTuple tp;
Form_pg_ts_parser prs;
- tp = SearchSysCache1(TSPARSEROID, ObjectIdGetDatum(prsId));
+ tp = SearchSysCache(TSPARSEROID, ObjectIdGetDatum(prsId));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for text search parser %u",
prsId);
@@ -250,7 +250,7 @@ lookup_ts_dictionary_cache(Oid dictId)
Form_pg_ts_template template;
MemoryContext saveCtx;
- tpdict = SearchSysCache1(TSDICTOID, ObjectIdGetDatum(dictId));
+ tpdict = SearchSysCache(TSDICTOID, ObjectIdGetDatum(dictId));
if (!HeapTupleIsValid(tpdict))
elog(ERROR, "cache lookup failed for text search dictionary %u",
dictId);
@@ -265,8 +265,8 @@ lookup_ts_dictionary_cache(Oid dictId)
/*
* Retrieve dictionary's template
*/
- tptmpl = SearchSysCache1(TSTEMPLATEOID,
- ObjectIdGetDatum(dict->dicttemplate));
+ tptmpl = SearchSysCache(TSTEMPLATEOID,
+ ObjectIdGetDatum(dict->dicttemplate));
if (!HeapTupleIsValid(tptmpl))
elog(ERROR, "cache lookup failed for text search template %u",
dict->dicttemplate);
@@ -420,7 +420,7 @@ lookup_ts_config_cache(Oid cfgId)
int ndicts;
int i;
- tp = SearchSysCache1(TSCONFIGOID, ObjectIdGetDatum(cfgId));
+ tp = SearchSysCache(TSCONFIGOID, ObjectIdGetDatum(cfgId));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for text search configuration %u",
cfgId);
@@ -643,7 +643,7 @@ check_default_text_search_config(char **newval, void **extra, GucSource source)
* Modify the actually stored value to be fully qualified, to ensure
* later changes of search_path don't affect it.
*/
- tuple = SearchSysCache1(TSCONFIGOID, ObjectIdGetDatum(cfgId));
+ tuple = SearchSysCache(TSCONFIGOID, ObjectIdGetDatum(cfgId));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for text search configuration %u",
cfgId);
diff --git a/src/backend/utils/cache/typcache.c b/src/backend/utils/cache/typcache.c
index ed6360ce2b..7a973ded11 100644
--- a/src/backend/utils/cache/typcache.c
+++ b/src/backend/utils/cache/typcache.c
@@ -378,7 +378,7 @@ lookup_type_cache(Oid type_id, int flags)
HeapTuple tp;
Form_pg_type typtup;
- tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type_id));
+ tp = SearchSysCache(TYPEOID, ObjectIdGetDatum(type_id));
if (!HeapTupleIsValid(tp))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -400,8 +400,8 @@ lookup_type_cache(Oid type_id, int flags)
/* These fields can never change, by definition */
typentry->type_id = type_id;
- typentry->type_id_hash = GetSysCacheHashValue1(TYPEOID,
- ObjectIdGetDatum(type_id));
+ typentry->type_id_hash = GetSysCacheHashValue(TYPEOID,
+ ObjectIdGetDatum(type_id));
/* Keep this part in sync with the code below */
typentry->typlen = typtup->typlen;
@@ -433,7 +433,7 @@ lookup_type_cache(Oid type_id, int flags)
HeapTuple tp;
Form_pg_type typtup;
- tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type_id));
+ tp = SearchSysCache(TYPEOID, ObjectIdGetDatum(type_id));
if (!HeapTupleIsValid(tp))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -917,7 +917,7 @@ load_rangetype_info(TypeCacheEntry *typentry)
Oid cmpFnOid;
/* get information from pg_range */
- tup = SearchSysCache1(RANGETYPE, ObjectIdGetDatum(typentry->type_id));
+ tup = SearchSysCache(RANGETYPE, ObjectIdGetDatum(typentry->type_id));
/* should not fail, since we already checked typtype ... */
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for range type %u",
@@ -1029,7 +1029,7 @@ load_domaintype_info(TypeCacheEntry *typentry)
ScanKeyData key[1];
SysScanDesc scan;
- tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typeOid));
+ tup = SearchSysCache(TYPEOID, ObjectIdGetDatum(typeOid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for type %u", typeOid);
typTup = (Form_pg_type) GETSTRUCT(tup);
diff --git a/src/backend/utils/fmgr/fmgr.c b/src/backend/utils/fmgr/fmgr.c
index f72dd25efa..d9c4940a5f 100644
--- a/src/backend/utils/fmgr/fmgr.c
+++ b/src/backend/utils/fmgr/fmgr.c
@@ -178,7 +178,7 @@ fmgr_info_cxt_security(Oid functionId, FmgrInfo *finfo, MemoryContext mcxt,
}
/* Otherwise we need the pg_proc entry */
- procedureTuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(functionId));
+ procedureTuple = SearchSysCache(PROCOID, ObjectIdGetDatum(functionId));
if (!HeapTupleIsValid(procedureTuple))
elog(ERROR, "cache lookup failed for function %u", functionId);
procedureStruct = (Form_pg_proc) GETSTRUCT(procedureTuple);
@@ -285,7 +285,7 @@ fmgr_symbol(Oid functionId, char **mod, char **fn)
Datum prosrcattr;
Datum probinattr;
- procedureTuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(functionId));
+ procedureTuple = SearchSysCache(PROCOID, ObjectIdGetDatum(functionId));
if (!HeapTupleIsValid(procedureTuple))
elog(ERROR, "cache lookup failed for function %u", functionId);
procedureStruct = (Form_pg_proc) GETSTRUCT(procedureTuple);
@@ -423,7 +423,7 @@ fmgr_info_other_lang(Oid functionId, FmgrInfo *finfo, HeapTuple procedureTuple)
Form_pg_language languageStruct;
FmgrInfo plfinfo;
- languageTuple = SearchSysCache1(LANGOID, ObjectIdGetDatum(language));
+ languageTuple = SearchSysCache(LANGOID, ObjectIdGetDatum(language));
if (!HeapTupleIsValid(languageTuple))
elog(ERROR, "cache lookup failed for language %u", language);
languageStruct = (Form_pg_language) GETSTRUCT(languageTuple);
@@ -652,8 +652,8 @@ fmgr_security_definer(PG_FUNCTION_ARGS)
fcinfo->flinfo->fn_mcxt, true);
fcache->flinfo.fn_expr = fcinfo->flinfo->fn_expr;
- tuple = SearchSysCache1(PROCOID,
- ObjectIdGetDatum(fcinfo->flinfo->fn_oid));
+ tuple = SearchSysCache(PROCOID,
+ ObjectIdGetDatum(fcinfo->flinfo->fn_oid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for function %u",
fcinfo->flinfo->fn_oid);
@@ -2126,7 +2126,7 @@ CheckFunctionValidatorAccess(Oid validatorOid, Oid functionOid)
* Get the function's pg_proc entry. Throw a user-facing error for bad
* OID, because validators can be called with user-specified OIDs.
*/
- procTup = SearchSysCache1(PROCOID, ObjectIdGetDatum(functionOid));
+ procTup = SearchSysCache(PROCOID, ObjectIdGetDatum(functionOid));
if (!HeapTupleIsValid(procTup))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_FUNCTION),
@@ -2137,7 +2137,7 @@ CheckFunctionValidatorAccess(Oid validatorOid, Oid functionOid)
* Fetch pg_language entry to know if this is the correct validation
* function for that pg_proc entry.
*/
- langTup = SearchSysCache1(LANGOID, ObjectIdGetDatum(procStruct->prolang));
+ langTup = SearchSysCache(LANGOID, ObjectIdGetDatum(procStruct->prolang));
if (!HeapTupleIsValid(langTup))
elog(ERROR, "cache lookup failed for language %u", procStruct->prolang);
langStruct = (Form_pg_language) GETSTRUCT(langTup);
diff --git a/src/backend/utils/fmgr/funcapi.c b/src/backend/utils/fmgr/funcapi.c
index 24683bb608..0ef892cccf 100644
--- a/src/backend/utils/fmgr/funcapi.c
+++ b/src/backend/utils/fmgr/funcapi.c
@@ -434,7 +434,7 @@ internal_get_result_type(Oid funcid,
TupleDesc tupdesc;
/* First fetch the function's pg_proc row to inspect its rettype */
- tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
+ tp = SearchSysCache(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for function %u", funcid);
procform = (Form_pg_proc) GETSTRUCT(tp);
@@ -1611,7 +1611,7 @@ get_func_result_name(Oid functionId)
int i;
/* First fetch the function's pg_proc row */
- procTuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(functionId));
+ procTuple = SearchSysCache(PROCOID, ObjectIdGetDatum(functionId));
if (!HeapTupleIsValid(procTuple))
elog(ERROR, "cache lookup failed for function %u", functionId);
diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c
index a604432126..bafd53151f 100644
--- a/src/backend/utils/init/miscinit.c
+++ b/src/backend/utils/init/miscinit.c
@@ -713,7 +713,7 @@ has_rolreplication(Oid roleid)
if (superuser_arg(roleid))
return true;
- utup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid));
+ utup = SearchSysCache(AUTHOID, ObjectIdGetDatum(roleid));
if (HeapTupleIsValid(utup))
{
result = ((Form_pg_authid) GETSTRUCT(utup))->rolreplication;
@@ -750,7 +750,7 @@ InitializeSessionUserId(const char *rolename, Oid roleid)
if (rolename != NULL)
{
- roleTup = SearchSysCache1(AUTHNAME, PointerGetDatum(rolename));
+ roleTup = SearchSysCache(AUTHNAME, PointerGetDatum(rolename));
if (!HeapTupleIsValid(roleTup))
ereport(FATAL,
(errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION),
@@ -758,7 +758,7 @@ InitializeSessionUserId(const char *rolename, Oid roleid)
}
else
{
- roleTup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid));
+ roleTup = SearchSysCache(AUTHOID, ObjectIdGetDatum(roleid));
if (!HeapTupleIsValid(roleTup))
ereport(FATAL,
(errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION),
@@ -986,7 +986,7 @@ GetUserNameFromId(Oid roleid, bool noerr)
HeapTuple tuple;
char *result;
- tuple = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid));
+ tuple = SearchSysCache(AUTHOID, ObjectIdGetDatum(roleid));
if (!HeapTupleIsValid(tuple))
{
if (!noerr)
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index 60feae0f1b..fa91a5a53e 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -319,7 +319,7 @@ CheckMyDatabase(const char *name, bool am_superuser, bool override_allow_connect
char *iculocale;
/* Fetch our pg_database row normally, via syscache */
- tup = SearchSysCache1(DATABASEOID, ObjectIdGetDatum(MyDatabaseId));
+ tup = SearchSysCache(DATABASEOID, ObjectIdGetDatum(MyDatabaseId));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for database %u", MyDatabaseId);
dbform = (Form_pg_database) GETSTRUCT(tup);
diff --git a/src/backend/utils/misc/rls.c b/src/backend/utils/misc/rls.c
index b8c9a133a8..6c739f59ce 100644
--- a/src/backend/utils/misc/rls.c
+++ b/src/backend/utils/misc/rls.c
@@ -63,7 +63,7 @@ check_enable_rls(Oid relid, Oid checkAsUser, bool noError)
return RLS_NONE;
/* Fetch relation's relrowsecurity and relforcerowsecurity flags */
- tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
+ tuple = SearchSysCache(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tuple))
return RLS_NONE;
classform = (Form_pg_class) GETSTRUCT(tuple);
diff --git a/src/backend/utils/misc/superuser.c b/src/backend/utils/misc/superuser.c
index 71c0e725a6..de997e22df 100644
--- a/src/backend/utils/misc/superuser.c
+++ b/src/backend/utils/misc/superuser.c
@@ -67,7 +67,7 @@ superuser_arg(Oid roleid)
return true;
/* OK, look up the information in pg_authid */
- rtup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid));
+ rtup = SearchSysCache(AUTHOID, ObjectIdGetDatum(roleid));
if (HeapTupleIsValid(rtup))
{
result = ((Form_pg_authid) GETSTRUCT(rtup))->rolsuper;
diff --git a/src/include/utils/syscache.h b/src/include/utils/syscache.h
index 67ea6e4945..c1ccedcda7 100644
--- a/src/include/utils/syscache.h
+++ b/src/include/utils/syscache.h
@@ -121,31 +121,20 @@ enum SysCacheIdentifier
extern void InitCatalogCache(void);
extern void InitCatalogCachePhase2(void);
-extern HeapTuple SearchSysCache(int cacheId,
- Datum key1, Datum key2, Datum key3, Datum key4);
+extern HeapTuple SearchSysCacheImpl(int cacheId, int nkeys,
+ Datum key1, Datum key2, Datum key3, Datum key4);
+
-/*
- * The use of argument specific numbers is encouraged. They're faster, and
- * insulates the caller from changes in the maximum number of keys.
- */
-extern HeapTuple SearchSysCache1(int cacheId,
- Datum key1);
-extern HeapTuple SearchSysCache2(int cacheId,
- Datum key1, Datum key2);
-extern HeapTuple SearchSysCache3(int cacheId,
- Datum key1, Datum key2, Datum key3);
-extern HeapTuple SearchSysCache4(int cacheId,
- Datum key1, Datum key2, Datum key3, Datum key4);
extern void ReleaseSysCache(HeapTuple tuple);
/* convenience routines */
-extern HeapTuple SearchSysCacheCopy(int cacheId,
- Datum key1, Datum key2, Datum key3, Datum key4);
-extern bool SearchSysCacheExists(int cacheId,
- Datum key1, Datum key2, Datum key3, Datum key4);
-extern Oid GetSysCacheOid(int cacheId, AttrNumber oidcol,
- Datum key1, Datum key2, Datum key3, Datum key4);
+extern HeapTuple SearchSysCacheCopyImpl(int cacheId, int nkey,
+ Datum key1, Datum key2, Datum key3, Datum key4);
+extern bool SearchSysCacheExistsImpl(int cacheId, int nkey,
+ Datum key1, Datum key2, Datum key3, Datum key4);
+extern Oid GetSysCacheOidImpl(int cacheId, AttrNumber oidcol, int nkey,
+ Datum key1, Datum key2, Datum key3, Datum key4);
extern HeapTuple SearchSysCacheAttName(Oid relid, const char *attname);
extern HeapTuple SearchSysCacheCopyAttName(Oid relid, const char *attname);
@@ -160,13 +149,13 @@ extern Datum SysCacheGetAttr(int cacheId, HeapTuple tup,
extern Datum SysCacheGetAttrNotNull(int cacheId, HeapTuple tup,
AttrNumber attributeNumber);
-extern uint32 GetSysCacheHashValue(int cacheId,
- Datum key1, Datum key2, Datum key3, Datum key4);
+extern uint32 GetSysCacheHashValueImpl(int cacheId,
+ Datum key1, Datum key2, Datum key3, Datum key4);
/* list-search interface. Users of this must import catcache.h too */
struct catclist;
-extern struct catclist *SearchSysCacheList(int cacheId, int nkeys,
- Datum key1, Datum key2, Datum key3);
+extern struct catclist *SearchSysCacheListImpl(int cacheId, int nkeys,
+ Datum key1, Datum key2, Datum key3);
extern void SysCacheInvalidate(int cacheId, uint32 hashValue);
@@ -174,53 +163,51 @@ extern bool RelationInvalidatesSnapshotsOnly(Oid relid);
extern bool RelationHasSysCache(Oid relid);
extern bool RelationSupportsSysCache(Oid relid);
-/*
- * 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 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, oidcol, key1) \
- GetSysCacheOid(cacheId, oidcol, key1, 0, 0, 0)
-#define GetSysCacheOid2(cacheId, oidcol, key1, key2) \
- GetSysCacheOid(cacheId, oidcol, key1, key2, 0, 0)
-#define GetSysCacheOid3(cacheId, oidcol, key1, key2, key3) \
- GetSysCacheOid(cacheId, oidcol, key1, key2, key3, 0)
-#define GetSysCacheOid4(cacheId, oidcol, key1, key2, key3, key4) \
- GetSysCacheOid(cacheId, oidcol, key1, key2, key3, key4)
-
-#define GetSysCacheHashValue1(cacheId, key1) \
- GetSysCacheHashValue(cacheId, key1, 0, 0, 0)
-#define GetSysCacheHashValue2(cacheId, key1, key2) \
- GetSysCacheHashValue(cacheId, key1, key2, 0, 0)
-#define GetSysCacheHashValue3(cacheId, key1, key2, key3) \
- GetSysCacheHashValue(cacheId, key1, key2, key3, 0)
-#define GetSysCacheHashValue4(cacheId, key1, key2, key3, key4) \
- GetSysCacheHashValue(cacheId, key1, key2, key3, key4)
-
-#define SearchSysCacheList1(cacheId, key1) \
- SearchSysCacheList(cacheId, 1, key1, 0, 0)
-#define SearchSysCacheList2(cacheId, key1, key2) \
- SearchSysCacheList(cacheId, 2, key1, key2, 0)
-#define SearchSysCacheList3(cacheId, key1, key2, key3) \
- SearchSysCacheList(cacheId, 3, key1, key2, key3)
+/* Macros to provide dummy 0 arguments. */
+#define SYSCACHE_ARG_1(arg1, ...) arg1
+#define SYSCACHE_ARG_2(arg1, arg2, ...) arg2
+#define SYSCACHE_ARG_3(arg1, arg2, arg3, ...) arg3
+#define SYSCACHE_ARG_4(arg1, arg2, arg3, arg4, ...) arg4
+#define SYSCACHE_ARG_2_OR_0(...) SYSCACHE_ARG_2(__VA_ARGS__, 0, 0, 0)
+#define SYSCACHE_ARG_3_OR_0(...) SYSCACHE_ARG_3(__VA_ARGS__, 0, 0, 0)
+#define SYSCACHE_ARG_4_OR_0(...) SYSCACHE_ARG_4(__VA_ARGS__, 0, 0, 0)
+
+/* Variadic macros to call syscache routines with variable number of keys. */
+#define SearchSysCache(cacheId, ...) \
+ SearchSysCacheImpl(cacheId, VA_ARGS_NARGS(__VA_ARGS__), \
+ SYSCACHE_ARG_1(__VA_ARGS__), \
+ SYSCACHE_ARG_2_OR_0(__VA_ARGS__), \
+ SYSCACHE_ARG_3_OR_0(__VA_ARGS__), \
+ SYSCACHE_ARG_4_OR_0(__VA_ARGS__))
+#define SearchSysCacheList(cacheId, ...) \
+ SearchSysCacheListImpl(cacheId, VA_ARGS_NARGS(__VA_ARGS__), \
+ SYSCACHE_ARG_1(__VA_ARGS__), \
+ SYSCACHE_ARG_2_OR_0(__VA_ARGS__), \
+ SYSCACHE_ARG_3_OR_0(__VA_ARGS__))
+#define SearchSysCacheCopy(cacheId, ...) \
+ SearchSysCacheCopyImpl(cacheId, VA_ARGS_NARGS(__VA_ARGS__), \
+ SYSCACHE_ARG_1(__VA_ARGS__), \
+ SYSCACHE_ARG_2_OR_0(__VA_ARGS__), \
+ SYSCACHE_ARG_3_OR_0(__VA_ARGS__), \
+ SYSCACHE_ARG_4_OR_0(__VA_ARGS__))
+#define SearchSysCacheExists(cacheId, ...) \
+ SearchSysCacheExistsImpl(cacheId, VA_ARGS_NARGS(__VA_ARGS__), \
+ SYSCACHE_ARG_1(__VA_ARGS__), \
+ SYSCACHE_ARG_2_OR_0(__VA_ARGS__), \
+ SYSCACHE_ARG_3_OR_0(__VA_ARGS__), \
+ SYSCACHE_ARG_4_OR_0(__VA_ARGS__))
+#define GetSysCacheOid(cacheId, oidcol, ...) \
+ GetSysCacheOidImpl(cacheId, oidcol, VA_ARGS_NARGS(__VA_ARGS__), \
+ SYSCACHE_ARG_1(__VA_ARGS__), \
+ SYSCACHE_ARG_2_OR_0(__VA_ARGS__), \
+ SYSCACHE_ARG_3_OR_0(__VA_ARGS__), \
+ SYSCACHE_ARG_4_OR_0(__VA_ARGS__))
+#define GetSysCacheHashValue(cacheId, ...) \
+ GetSysCacheHashValueImpl(cacheId, \
+ SYSCACHE_ARG_1(__VA_ARGS__), \
+ SYSCACHE_ARG_2_OR_0(__VA_ARGS__), \
+ SYSCACHE_ARG_3_OR_0(__VA_ARGS__), \
+ SYSCACHE_ARG_4_OR_0(__VA_ARGS__))
#define ReleaseSysCacheList(x) ReleaseCatCacheList(x)
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c
index d7d9c1bee3..acd02873a9 100644
--- a/src/pl/plperl/plperl.c
+++ b/src/pl/plperl/plperl.c
@@ -1988,7 +1988,7 @@ plperl_validator(PG_FUNCTION_ARGS)
PG_RETURN_VOID();
/* Get the new function's pg_proc entry */
- tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcoid));
+ tuple = SearchSysCache(PROCOID, ObjectIdGetDatum(funcoid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for function %u", funcoid);
proc = (Form_pg_proc) GETSTRUCT(tuple);
@@ -2711,7 +2711,7 @@ compile_plperl_function(Oid fn_oid, bool is_trigger, bool is_event_trigger)
ErrorContextCallback plperl_error_context;
/* We'll need the pg_proc tuple in any case... */
- procTup = SearchSysCache1(PROCOID, ObjectIdGetDatum(fn_oid));
+ procTup = SearchSysCache(PROCOID, ObjectIdGetDatum(fn_oid));
if (!HeapTupleIsValid(procTup))
elog(ERROR, "cache lookup failed for function %u", fn_oid);
procStruct = (Form_pg_proc) GETSTRUCT(procTup);
@@ -2810,8 +2810,8 @@ compile_plperl_function(Oid fn_oid, bool is_trigger, bool is_event_trigger)
/************************************************************
* Lookup the pg_language tuple by Oid
************************************************************/
- langTup = SearchSysCache1(LANGOID,
- ObjectIdGetDatum(procStruct->prolang));
+ langTup = SearchSysCache(LANGOID,
+ ObjectIdGetDatum(procStruct->prolang));
if (!HeapTupleIsValid(langTup))
elog(ERROR, "cache lookup failed for language %u",
procStruct->prolang);
@@ -2828,7 +2828,7 @@ compile_plperl_function(Oid fn_oid, bool is_trigger, bool is_event_trigger)
{
Oid rettype = procStruct->prorettype;
- typeTup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(rettype));
+ typeTup = SearchSysCache(TYPEOID, ObjectIdGetDatum(rettype));
if (!HeapTupleIsValid(typeTup))
elog(ERROR, "cache lookup failed for type %u", rettype);
typeStruct = (Form_pg_type) GETSTRUCT(typeTup);
@@ -2877,7 +2877,7 @@ compile_plperl_function(Oid fn_oid, bool is_trigger, bool is_event_trigger)
{
Oid argtype = procStruct->proargtypes.values[i];
- typeTup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(argtype));
+ typeTup = SearchSysCache(TYPEOID, ObjectIdGetDatum(argtype));
if (!HeapTupleIsValid(typeTup))
elog(ERROR, "cache lookup failed for type %u", argtype);
typeStruct = (Form_pg_type) GETSTRUCT(typeTup);
diff --git a/src/pl/plpgsql/src/pl_comp.c b/src/pl/plpgsql/src/pl_comp.c
index a341cde2c1..45e94ea03f 100644
--- a/src/pl/plpgsql/src/pl_comp.c
+++ b/src/pl/plpgsql/src/pl_comp.c
@@ -146,7 +146,7 @@ plpgsql_compile(FunctionCallInfo fcinfo, bool forValidator)
/*
* Lookup the pg_proc tuple by Oid; we'll need it in any case
*/
- procTup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcOid));
+ procTup = SearchSysCache(PROCOID, ObjectIdGetDatum(funcOid));
if (!HeapTupleIsValid(procTup))
elog(ERROR, "cache lookup failed for function %u", funcOid);
procStruct = (Form_pg_proc) GETSTRUCT(procTup);
@@ -538,7 +538,7 @@ do_compile(FunctionCallInfo fcinfo,
/*
* Lookup the function's return type
*/
- typeTup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(rettypeid));
+ typeTup = SearchSysCache(TYPEOID, ObjectIdGetDatum(rettypeid));
if (!HeapTupleIsValid(typeTup))
elog(ERROR, "cache lookup failed for type %u", rettypeid);
typeStruct = (Form_pg_type) GETSTRUCT(typeTup);
@@ -1728,7 +1728,7 @@ plpgsql_parse_cwordtype(List *idents)
else
goto done;
- classtup = SearchSysCache1(RELOID, ObjectIdGetDatum(classOid));
+ classtup = SearchSysCache(RELOID, ObjectIdGetDatum(classOid));
if (!HeapTupleIsValid(classtup))
goto done;
classStruct = (Form_pg_class) GETSTRUCT(classtup);
@@ -1754,8 +1754,8 @@ plpgsql_parse_cwordtype(List *idents)
goto done;
attrStruct = (Form_pg_attribute) GETSTRUCT(attrtup);
- typetup = SearchSysCache1(TYPEOID,
- ObjectIdGetDatum(attrStruct->atttypid));
+ typetup = SearchSysCache(TYPEOID,
+ ObjectIdGetDatum(attrStruct->atttypid));
if (!HeapTupleIsValid(typetup))
elog(ERROR, "cache lookup failed for type %u", attrStruct->atttypid);
@@ -2084,7 +2084,7 @@ plpgsql_build_datatype(Oid typeOid, int32 typmod,
HeapTuple typeTup;
PLpgSQL_type *typ;
- typeTup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typeOid));
+ typeTup = SearchSysCache(TYPEOID, ObjectIdGetDatum(typeOid));
if (!HeapTupleIsValid(typeTup))
elog(ERROR, "cache lookup failed for type %u", typeOid);
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c
index b0a2cac227..14c6aea05d 100644
--- a/src/pl/plpgsql/src/pl_exec.c
+++ b/src/pl/plpgsql/src/pl_exec.c
@@ -2298,8 +2298,8 @@ make_callstmt_target(PLpgSQL_execstate *estate, PLpgSQL_expr *expr)
funcexpr = stmt->funcexpr;
- func_tuple = SearchSysCache1(PROCOID,
- ObjectIdGetDatum(funcexpr->funcid));
+ func_tuple = SearchSysCache(PROCOID,
+ ObjectIdGetDatum(funcexpr->funcid));
if (!HeapTupleIsValid(func_tuple))
elog(ERROR, "cache lookup failed for function %u",
funcexpr->funcid);
diff --git a/src/pl/plpgsql/src/pl_handler.c b/src/pl/plpgsql/src/pl_handler.c
index d8994538b7..b99023760d 100644
--- a/src/pl/plpgsql/src/pl_handler.c
+++ b/src/pl/plpgsql/src/pl_handler.c
@@ -457,7 +457,7 @@ plpgsql_validator(PG_FUNCTION_ARGS)
PG_RETURN_VOID();
/* Get the new function's pg_proc entry */
- tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcoid));
+ tuple = SearchSysCache(PROCOID, ObjectIdGetDatum(funcoid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for function %u", funcoid);
proc = (Form_pg_proc) GETSTRUCT(tuple);
diff --git a/src/pl/plpython/plpy_main.c b/src/pl/plpython/plpy_main.c
index a4d66f3057..b45d744029 100644
--- a/src/pl/plpython/plpy_main.c
+++ b/src/pl/plpython/plpy_main.c
@@ -172,7 +172,7 @@ plpython3_validator(PG_FUNCTION_ARGS)
PLy_initialize();
/* Get the new function's pg_proc entry */
- tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcoid));
+ tuple = SearchSysCache(PROCOID, ObjectIdGetDatum(funcoid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for function %u", funcoid);
procStruct = (Form_pg_proc) GETSTRUCT(tuple);
diff --git a/src/pl/plpython/plpy_procedure.c b/src/pl/plpython/plpy_procedure.c
index 79b6ef6a44..37bb228cb6 100644
--- a/src/pl/plpython/plpy_procedure.c
+++ b/src/pl/plpython/plpy_procedure.c
@@ -75,7 +75,7 @@ PLy_procedure_get(Oid fn_oid, Oid fn_rel, bool is_trigger)
PLyProcedure *volatile proc = NULL;
bool found = false;
- procTup = SearchSysCache1(PROCOID, ObjectIdGetDatum(fn_oid));
+ procTup = SearchSysCache(PROCOID, ObjectIdGetDatum(fn_oid));
if (!HeapTupleIsValid(procTup))
elog(ERROR, "cache lookup failed for function %u", fn_oid);
@@ -208,7 +208,7 @@ PLy_procedure_create(HeapTuple procTup, Oid fn_oid, bool is_trigger)
HeapTuple rvTypeTup;
Form_pg_type rvTypeStruct;
- rvTypeTup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(rettype));
+ rvTypeTup = SearchSysCache(TYPEOID, ObjectIdGetDatum(rettype));
if (!HeapTupleIsValid(rvTypeTup))
elog(ERROR, "cache lookup failed for type %u", rettype);
rvTypeStruct = (Form_pg_type) GETSTRUCT(rvTypeTup);
@@ -294,8 +294,8 @@ PLy_procedure_create(HeapTuple procTup, Oid fn_oid, bool is_trigger)
Assert(types[i] == procStruct->proargtypes.values[pos]);
- argTypeTup = SearchSysCache1(TYPEOID,
- ObjectIdGetDatum(types[i]));
+ argTypeTup = SearchSysCache(TYPEOID,
+ ObjectIdGetDatum(types[i]));
if (!HeapTupleIsValid(argTypeTup))
elog(ERROR, "cache lookup failed for type %u", types[i]);
argTypeStruct = (Form_pg_type) GETSTRUCT(argTypeTup);
diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c
index e8f9d7b289..9b5199b186 100644
--- a/src/pl/tcl/pltcl.c
+++ b/src/pl/tcl/pltcl.c
@@ -624,7 +624,7 @@ call_pltcl_start_proc(Oid prolang, bool pltrusted)
aclcheck_error(aclresult, OBJECT_FUNCTION, start_proc);
/* Get the function's pg_proc entry */
- procTup = SearchSysCache1(PROCOID, ObjectIdGetDatum(procOid));
+ procTup = SearchSysCache(PROCOID, ObjectIdGetDatum(procOid));
if (!HeapTupleIsValid(procTup))
elog(ERROR, "cache lookup failed for function %u", procOid);
procStruct = (Form_pg_proc) GETSTRUCT(procTup);
@@ -1401,7 +1401,7 @@ compile_pltcl_function(Oid fn_oid, Oid tgreloid,
Tcl_DString proc_internal_body;
/* We'll need the pg_proc tuple in any case... */
- procTup = SearchSysCache1(PROCOID, ObjectIdGetDatum(fn_oid));
+ procTup = SearchSysCache(PROCOID, ObjectIdGetDatum(fn_oid));
if (!HeapTupleIsValid(procTup))
elog(ERROR, "cache lookup failed for function %u", fn_oid);
procStruct = (Form_pg_proc) GETSTRUCT(procTup);
@@ -1522,7 +1522,7 @@ compile_pltcl_function(Oid fn_oid, Oid tgreloid,
{
Oid rettype = procStruct->prorettype;
- typeTup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(rettype));
+ typeTup = SearchSysCache(TYPEOID, ObjectIdGetDatum(rettype));
if (!HeapTupleIsValid(typeTup))
elog(ERROR, "cache lookup failed for type %u", rettype);
typeStruct = (Form_pg_type) GETSTRUCT(typeTup);
@@ -1570,7 +1570,7 @@ compile_pltcl_function(Oid fn_oid, Oid tgreloid,
{
Oid argtype = procStruct->proargtypes.values[i];
- typeTup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(argtype));
+ typeTup = SearchSysCache(TYPEOID, ObjectIdGetDatum(argtype));
if (!HeapTupleIsValid(typeTup))
elog(ERROR, "cache lookup failed for type %u", argtype);
typeStruct = (Form_pg_type) GETSTRUCT(typeTup);
diff --git a/src/test/modules/plsample/plsample.c b/src/test/modules/plsample/plsample.c
index a80d966e2a..61a9e666de 100644
--- a/src/test/modules/plsample/plsample.c
+++ b/src/test/modules/plsample/plsample.c
@@ -112,8 +112,8 @@ plsample_func_handler(PG_FUNCTION_ARGS)
int numargs;
/* Fetch the function's pg_proc entry. */
- pl_tuple = SearchSysCache1(PROCOID,
- ObjectIdGetDatum(fcinfo->flinfo->fn_oid));
+ pl_tuple = SearchSysCache(PROCOID,
+ ObjectIdGetDatum(fcinfo->flinfo->fn_oid));
if (!HeapTupleIsValid(pl_tuple))
elog(ERROR, "cache lookup failed for function %u",
fcinfo->flinfo->fn_oid);
@@ -153,7 +153,7 @@ plsample_func_handler(PG_FUNCTION_ARGS)
Oid argtype = pl_struct->proargtypes.values[i];
char *value;
- type_tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(argtype));
+ type_tuple = SearchSysCache(TYPEOID, ObjectIdGetDatum(argtype));
if (!HeapTupleIsValid(type_tuple))
elog(ERROR, "cache lookup failed for type %u", argtype);
@@ -182,8 +182,8 @@ plsample_func_handler(PG_FUNCTION_ARGS)
if (prorettype != TEXTOID)
PG_RETURN_NULL();
- type_tuple = SearchSysCache1(TYPEOID,
- ObjectIdGetDatum(prorettype));
+ type_tuple = SearchSysCache(TYPEOID,
+ ObjectIdGetDatum(prorettype));
if (!HeapTupleIsValid(type_tuple))
elog(ERROR, "cache lookup failed for type %u", prorettype);
pg_type_entry = (Form_pg_type) GETSTRUCT(type_tuple);
@@ -227,8 +227,8 @@ plsample_trigger_handler(PG_FUNCTION_ARGS)
Assert(rc >= 0);
/* Fetch the function's pg_proc entry. */
- pl_tuple = SearchSysCache1(PROCOID,
- ObjectIdGetDatum(fcinfo->flinfo->fn_oid));
+ pl_tuple = SearchSysCache(PROCOID,
+ ObjectIdGetDatum(fcinfo->flinfo->fn_oid));
if (!HeapTupleIsValid(pl_tuple))
elog(ERROR, "cache lookup failed for function %u",
fcinfo->flinfo->fn_oid);
--
2.39.2
On 31.03.23 04:16, Thomas Munro wrote:
From the light relief department, here is some more variadic macrology:
- tp = SearchSysCache1(TSPARSEROID, ObjectIdGetDatum(prsId)); + tp = SearchSysCache(TSPARSEROID, ObjectIdGetDatum(prsId));
I'm worried that if we are removing the variants with the explicit
numbers, it will make it difficult for extensions to maintain
compatibility with previous PG major versions. They would probably have
to copy much of your syscache.h changes into their own code. Seems messy.
On Thu, Sep 21, 2023 at 8:19 PM Peter Eisentraut <peter@eisentraut.org> wrote:
On 31.03.23 04:16, Thomas Munro wrote:
From the light relief department, here is some more variadic macrology:
- tp = SearchSysCache1(TSPARSEROID, ObjectIdGetDatum(prsId)); + tp = SearchSysCache(TSPARSEROID, ObjectIdGetDatum(prsId));I'm worried that if we are removing the variants with the explicit
numbers, it will make it difficult for extensions to maintain
compatibility with previous PG major versions. They would probably have
to copy much of your syscache.h changes into their own code. Seems messy.
I suppose we could also supply a set of macros with the numbers that
map straight onto the numberless ones, with a note that they will be
deleted after N releases. But maybe not worth the hassle for such a
tiny improvement in core code readability. I will withdraw this
entry. Thanks.
On 2023-Nov-14, Thomas Munro wrote:
I suppose we could also supply a set of macros with the numbers that
map straight onto the numberless ones, with a note that they will be
deleted after N releases.
Maybe just keep compatibility ones with 1 and 2 arguments (the ones most
used) forever, or 15 years, and drop the rest.
--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
“Cuando no hay humildad las personas se degradan” (A. Christie)