PostgreSQL Source Code  git master
syscache.c
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * syscache.c
4  * System cache management routines
5  *
6  * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  *
10  * IDENTIFICATION
11  * src/backend/utils/cache/syscache.c
12  *
13  * NOTES
14  * These routines allow the parser/planner/executor to perform
15  * rapid lookups on the contents of the system catalogs.
16  *
17  * see utils/syscache.h for a list of the cache IDs
18  *
19  *-------------------------------------------------------------------------
20  */
21 #include "postgres.h"
22 
23 #include "access/htup_details.h"
24 #include "access/sysattr.h"
25 #include "catalog/pg_aggregate.h"
26 #include "catalog/pg_am.h"
27 #include "catalog/pg_amop.h"
28 #include "catalog/pg_amproc.h"
30 #include "catalog/pg_authid.h"
31 #include "catalog/pg_cast.h"
32 #include "catalog/pg_collation.h"
33 #include "catalog/pg_constraint.h"
34 #include "catalog/pg_conversion.h"
35 #include "catalog/pg_database.h"
37 #include "catalog/pg_default_acl.h"
38 #include "catalog/pg_depend.h"
39 #include "catalog/pg_description.h"
40 #include "catalog/pg_enum.h"
45 #include "catalog/pg_language.h"
46 #include "catalog/pg_namespace.h"
47 #include "catalog/pg_opclass.h"
48 #include "catalog/pg_operator.h"
49 #include "catalog/pg_opfamily.h"
52 #include "catalog/pg_proc.h"
53 #include "catalog/pg_publication.h"
56 #include "catalog/pg_range.h"
58 #include "catalog/pg_rewrite.h"
59 #include "catalog/pg_seclabel.h"
60 #include "catalog/pg_sequence.h"
61 #include "catalog/pg_shdepend.h"
63 #include "catalog/pg_shseclabel.h"
64 #include "catalog/pg_statistic.h"
69 #include "catalog/pg_tablespace.h"
70 #include "catalog/pg_transform.h"
71 #include "catalog/pg_ts_config.h"
73 #include "catalog/pg_ts_dict.h"
74 #include "catalog/pg_ts_parser.h"
75 #include "catalog/pg_ts_template.h"
76 #include "catalog/pg_type.h"
78 #include "lib/qunique.h"
79 #include "utils/catcache.h"
80 #include "utils/rel.h"
81 #include "utils/syscache.h"
82 
83 /*---------------------------------------------------------------------------
84 
85  Adding system caches:
86 
87  Add your new cache to the list in include/utils/syscache.h.
88  Keep the list sorted alphabetically.
89 
90  Add your entry to the cacheinfo[] array below. All cache lists are
91  alphabetical, so add it in the proper place. Specify the relation OID,
92  index OID, number of keys, key attribute numbers, and initial number of
93  hash buckets.
94 
95  The number of hash buckets must be a power of 2. It's reasonable to
96  set this to the number of entries that might be in the particular cache
97  in a medium-size database.
98 
99  There must be a unique index underlying each syscache (ie, an index
100  whose key is the same as that of the cache). If there is not one
101  already, add the definition for it to include/catalog/pg_*.h using
102  DECLARE_UNIQUE_INDEX.
103  (Adding an index requires a catversion.h update, while simply
104  adding/deleting caches only requires a recompile.)
105 
106  Finally, any place your relation gets heap_insert() or
107  heap_update() calls, use CatalogTupleInsert() or CatalogTupleUpdate()
108  instead, which also update indexes. The heap_* calls do not do that.
109 
110 *---------------------------------------------------------------------------
111 */
112 
113 /*
114  * struct cachedesc: information defining a single syscache
115  */
116 struct cachedesc
117 {
118  Oid reloid; /* OID of the relation being cached */
119  Oid indoid; /* OID of index relation for this cache */
120  int nkeys; /* # of keys needed for cache lookup */
121  int key[4]; /* attribute numbers of key attrs */
122  int nbuckets; /* number of hash buckets for this cache */
123 };
124 
125 static const struct cachedesc cacheinfo[] = {
126  {AggregateRelationId, /* AGGFNOID */
127  AggregateFnoidIndexId,
128  1,
129  {
130  Anum_pg_aggregate_aggfnoid,
131  0,
132  0,
133  0
134  },
135  16
136  },
137  {AccessMethodRelationId, /* AMNAME */
138  AmNameIndexId,
139  1,
140  {
141  Anum_pg_am_amname,
142  0,
143  0,
144  0
145  },
146  4
147  },
148  {AccessMethodRelationId, /* AMOID */
149  AmOidIndexId,
150  1,
151  {
152  Anum_pg_am_oid,
153  0,
154  0,
155  0
156  },
157  4
158  },
159  {AccessMethodOperatorRelationId, /* AMOPOPID */
160  AccessMethodOperatorIndexId,
161  3,
162  {
163  Anum_pg_amop_amopopr,
164  Anum_pg_amop_amoppurpose,
165  Anum_pg_amop_amopfamily,
166  0
167  },
168  64
169  },
170  {AccessMethodOperatorRelationId, /* AMOPSTRATEGY */
171  AccessMethodStrategyIndexId,
172  4,
173  {
174  Anum_pg_amop_amopfamily,
175  Anum_pg_amop_amoplefttype,
176  Anum_pg_amop_amoprighttype,
177  Anum_pg_amop_amopstrategy
178  },
179  64
180  },
181  {AccessMethodProcedureRelationId, /* AMPROCNUM */
182  AccessMethodProcedureIndexId,
183  4,
184  {
185  Anum_pg_amproc_amprocfamily,
186  Anum_pg_amproc_amproclefttype,
187  Anum_pg_amproc_amprocrighttype,
188  Anum_pg_amproc_amprocnum
189  },
190  16
191  },
192  {AttributeRelationId, /* ATTNAME */
193  AttributeRelidNameIndexId,
194  2,
195  {
196  Anum_pg_attribute_attrelid,
197  Anum_pg_attribute_attname,
198  0,
199  0
200  },
201  32
202  },
203  {AttributeRelationId, /* ATTNUM */
204  AttributeRelidNumIndexId,
205  2,
206  {
207  Anum_pg_attribute_attrelid,
208  Anum_pg_attribute_attnum,
209  0,
210  0
211  },
212  128
213  },
214  {AuthMemRelationId, /* AUTHMEMMEMROLE */
215  AuthMemMemRoleIndexId,
216  3,
217  {
218  Anum_pg_auth_members_member,
219  Anum_pg_auth_members_roleid,
220  Anum_pg_auth_members_grantor,
221  0
222  },
223  8
224  },
225  {AuthMemRelationId, /* AUTHMEMROLEMEM */
226  AuthMemRoleMemIndexId,
227  3,
228  {
229  Anum_pg_auth_members_roleid,
230  Anum_pg_auth_members_member,
231  Anum_pg_auth_members_grantor,
232  0
233  },
234  8
235  },
236  {AuthIdRelationId, /* AUTHNAME */
237  AuthIdRolnameIndexId,
238  1,
239  {
240  Anum_pg_authid_rolname,
241  0,
242  0,
243  0
244  },
245  8
246  },
247  {AuthIdRelationId, /* AUTHOID */
248  AuthIdOidIndexId,
249  1,
250  {
251  Anum_pg_authid_oid,
252  0,
253  0,
254  0
255  },
256  8
257  },
258  {
259  CastRelationId, /* CASTSOURCETARGET */
260  CastSourceTargetIndexId,
261  2,
262  {
263  Anum_pg_cast_castsource,
264  Anum_pg_cast_casttarget,
265  0,
266  0
267  },
268  256
269  },
270  {OperatorClassRelationId, /* CLAAMNAMENSP */
271  OpclassAmNameNspIndexId,
272  3,
273  {
274  Anum_pg_opclass_opcmethod,
275  Anum_pg_opclass_opcname,
276  Anum_pg_opclass_opcnamespace,
277  0
278  },
279  8
280  },
281  {OperatorClassRelationId, /* CLAOID */
282  OpclassOidIndexId,
283  1,
284  {
285  Anum_pg_opclass_oid,
286  0,
287  0,
288  0
289  },
290  8
291  },
292  {CollationRelationId, /* COLLNAMEENCNSP */
293  CollationNameEncNspIndexId,
294  3,
295  {
296  Anum_pg_collation_collname,
297  Anum_pg_collation_collencoding,
298  Anum_pg_collation_collnamespace,
299  0
300  },
301  8
302  },
303  {CollationRelationId, /* COLLOID */
304  CollationOidIndexId,
305  1,
306  {
307  Anum_pg_collation_oid,
308  0,
309  0,
310  0
311  },
312  8
313  },
314  {ConversionRelationId, /* CONDEFAULT */
315  ConversionDefaultIndexId,
316  4,
317  {
318  Anum_pg_conversion_connamespace,
319  Anum_pg_conversion_conforencoding,
320  Anum_pg_conversion_contoencoding,
321  Anum_pg_conversion_oid
322  },
323  8
324  },
325  {ConversionRelationId, /* CONNAMENSP */
326  ConversionNameNspIndexId,
327  2,
328  {
329  Anum_pg_conversion_conname,
330  Anum_pg_conversion_connamespace,
331  0,
332  0
333  },
334  8
335  },
336  {ConstraintRelationId, /* CONSTROID */
337  ConstraintOidIndexId,
338  1,
339  {
340  Anum_pg_constraint_oid,
341  0,
342  0,
343  0
344  },
345  16
346  },
347  {ConversionRelationId, /* CONVOID */
348  ConversionOidIndexId,
349  1,
350  {
351  Anum_pg_conversion_oid,
352  0,
353  0,
354  0
355  },
356  8
357  },
358  {DatabaseRelationId, /* DATABASEOID */
359  DatabaseOidIndexId,
360  1,
361  {
362  Anum_pg_database_oid,
363  0,
364  0,
365  0
366  },
367  4
368  },
369  {DefaultAclRelationId, /* DEFACLROLENSPOBJ */
370  DefaultAclRoleNspObjIndexId,
371  3,
372  {
373  Anum_pg_default_acl_defaclrole,
374  Anum_pg_default_acl_defaclnamespace,
375  Anum_pg_default_acl_defaclobjtype,
376  0
377  },
378  8
379  },
380  {EnumRelationId, /* ENUMOID */
381  EnumOidIndexId,
382  1,
383  {
384  Anum_pg_enum_oid,
385  0,
386  0,
387  0
388  },
389  8
390  },
391  {EnumRelationId, /* ENUMTYPOIDNAME */
392  EnumTypIdLabelIndexId,
393  2,
394  {
395  Anum_pg_enum_enumtypid,
396  Anum_pg_enum_enumlabel,
397  0,
398  0
399  },
400  8
401  },
402  {EventTriggerRelationId, /* EVENTTRIGGERNAME */
403  EventTriggerNameIndexId,
404  1,
405  {
406  Anum_pg_event_trigger_evtname,
407  0,
408  0,
409  0
410  },
411  8
412  },
413  {EventTriggerRelationId, /* EVENTTRIGGEROID */
414  EventTriggerOidIndexId,
415  1,
416  {
417  Anum_pg_event_trigger_oid,
418  0,
419  0,
420  0
421  },
422  8
423  },
424  {ForeignDataWrapperRelationId, /* FOREIGNDATAWRAPPERNAME */
425  ForeignDataWrapperNameIndexId,
426  1,
427  {
428  Anum_pg_foreign_data_wrapper_fdwname,
429  0,
430  0,
431  0
432  },
433  2
434  },
435  {ForeignDataWrapperRelationId, /* FOREIGNDATAWRAPPEROID */
436  ForeignDataWrapperOidIndexId,
437  1,
438  {
439  Anum_pg_foreign_data_wrapper_oid,
440  0,
441  0,
442  0
443  },
444  2
445  },
446  {ForeignServerRelationId, /* FOREIGNSERVERNAME */
447  ForeignServerNameIndexId,
448  1,
449  {
450  Anum_pg_foreign_server_srvname,
451  0,
452  0,
453  0
454  },
455  2
456  },
457  {ForeignServerRelationId, /* FOREIGNSERVEROID */
458  ForeignServerOidIndexId,
459  1,
460  {
461  Anum_pg_foreign_server_oid,
462  0,
463  0,
464  0
465  },
466  2
467  },
468  {ForeignTableRelationId, /* FOREIGNTABLEREL */
469  ForeignTableRelidIndexId,
470  1,
471  {
472  Anum_pg_foreign_table_ftrelid,
473  0,
474  0,
475  0
476  },
477  4
478  },
479  {IndexRelationId, /* INDEXRELID */
480  IndexRelidIndexId,
481  1,
482  {
483  Anum_pg_index_indexrelid,
484  0,
485  0,
486  0
487  },
488  64
489  },
490  {LanguageRelationId, /* LANGNAME */
491  LanguageNameIndexId,
492  1,
493  {
494  Anum_pg_language_lanname,
495  0,
496  0,
497  0
498  },
499  4
500  },
501  {LanguageRelationId, /* LANGOID */
502  LanguageOidIndexId,
503  1,
504  {
505  Anum_pg_language_oid,
506  0,
507  0,
508  0
509  },
510  4
511  },
512  {NamespaceRelationId, /* NAMESPACENAME */
513  NamespaceNameIndexId,
514  1,
515  {
516  Anum_pg_namespace_nspname,
517  0,
518  0,
519  0
520  },
521  4
522  },
523  {NamespaceRelationId, /* NAMESPACEOID */
524  NamespaceOidIndexId,
525  1,
526  {
527  Anum_pg_namespace_oid,
528  0,
529  0,
530  0
531  },
532  16
533  },
534  {OperatorRelationId, /* OPERNAMENSP */
535  OperatorNameNspIndexId,
536  4,
537  {
538  Anum_pg_operator_oprname,
539  Anum_pg_operator_oprleft,
540  Anum_pg_operator_oprright,
541  Anum_pg_operator_oprnamespace
542  },
543  256
544  },
545  {OperatorRelationId, /* OPEROID */
546  OperatorOidIndexId,
547  1,
548  {
549  Anum_pg_operator_oid,
550  0,
551  0,
552  0
553  },
554  32
555  },
556  {OperatorFamilyRelationId, /* OPFAMILYAMNAMENSP */
557  OpfamilyAmNameNspIndexId,
558  3,
559  {
560  Anum_pg_opfamily_opfmethod,
561  Anum_pg_opfamily_opfname,
562  Anum_pg_opfamily_opfnamespace,
563  0
564  },
565  8
566  },
567  {OperatorFamilyRelationId, /* OPFAMILYOID */
568  OpfamilyOidIndexId,
569  1,
570  {
571  Anum_pg_opfamily_oid,
572  0,
573  0,
574  0
575  },
576  8
577  },
578  {ParameterAclRelationId, /* PARAMETERACLNAME */
579  ParameterAclParnameIndexId,
580  1,
581  {
582  Anum_pg_parameter_acl_parname,
583  0,
584  0,
585  0
586  },
587  4
588  },
589  {ParameterAclRelationId, /* PARAMETERACLOID */
590  ParameterAclOidIndexId,
591  1,
592  {
593  Anum_pg_parameter_acl_oid,
594  0,
595  0,
596  0
597  },
598  4
599  },
600  {PartitionedRelationId, /* PARTRELID */
601  PartitionedRelidIndexId,
602  1,
603  {
604  Anum_pg_partitioned_table_partrelid,
605  0,
606  0,
607  0
608  },
609  32
610  },
611  {ProcedureRelationId, /* PROCNAMEARGSNSP */
612  ProcedureNameArgsNspIndexId,
613  3,
614  {
615  Anum_pg_proc_proname,
616  Anum_pg_proc_proargtypes,
617  Anum_pg_proc_pronamespace,
618  0
619  },
620  128
621  },
622  {ProcedureRelationId, /* PROCOID */
623  ProcedureOidIndexId,
624  1,
625  {
626  Anum_pg_proc_oid,
627  0,
628  0,
629  0
630  },
631  128
632  },
633  {PublicationRelationId, /* PUBLICATIONNAME */
634  PublicationNameIndexId,
635  1,
636  {
637  Anum_pg_publication_pubname,
638  0,
639  0,
640  0
641  },
642  8
643  },
644  {PublicationNamespaceRelationId, /* PUBLICATIONNAMESPACE */
645  PublicationNamespaceObjectIndexId,
646  1,
647  {
648  Anum_pg_publication_namespace_oid,
649  0,
650  0,
651  0
652  },
653  64
654  },
655  {PublicationNamespaceRelationId, /* PUBLICATIONNAMESPACEMAP */
656  PublicationNamespacePnnspidPnpubidIndexId,
657  2,
658  {
659  Anum_pg_publication_namespace_pnnspid,
660  Anum_pg_publication_namespace_pnpubid,
661  0,
662  0
663  },
664  64
665  },
666  {PublicationRelationId, /* PUBLICATIONOID */
667  PublicationObjectIndexId,
668  1,
669  {
670  Anum_pg_publication_oid,
671  0,
672  0,
673  0
674  },
675  8
676  },
677  {PublicationRelRelationId, /* PUBLICATIONREL */
678  PublicationRelObjectIndexId,
679  1,
680  {
681  Anum_pg_publication_rel_oid,
682  0,
683  0,
684  0
685  },
686  64
687  },
688  {PublicationRelRelationId, /* PUBLICATIONRELMAP */
689  PublicationRelPrrelidPrpubidIndexId,
690  2,
691  {
692  Anum_pg_publication_rel_prrelid,
693  Anum_pg_publication_rel_prpubid,
694  0,
695  0
696  },
697  64
698  },
699  {RangeRelationId, /* RANGEMULTIRANGE */
700  RangeMultirangeTypidIndexId,
701  1,
702  {
703  Anum_pg_range_rngmultitypid,
704  0,
705  0,
706  0
707  },
708  4
709  },
710 
711  {RangeRelationId, /* RANGETYPE */
712  RangeTypidIndexId,
713  1,
714  {
715  Anum_pg_range_rngtypid,
716  0,
717  0,
718  0
719  },
720  4
721  },
722  {RelationRelationId, /* RELNAMENSP */
723  ClassNameNspIndexId,
724  2,
725  {
726  Anum_pg_class_relname,
727  Anum_pg_class_relnamespace,
728  0,
729  0
730  },
731  128
732  },
733  {RelationRelationId, /* RELOID */
734  ClassOidIndexId,
735  1,
736  {
737  Anum_pg_class_oid,
738  0,
739  0,
740  0
741  },
742  128
743  },
744  {ReplicationOriginRelationId, /* REPLORIGIDENT */
745  ReplicationOriginIdentIndex,
746  1,
747  {
748  Anum_pg_replication_origin_roident,
749  0,
750  0,
751  0
752  },
753  16
754  },
755  {ReplicationOriginRelationId, /* REPLORIGNAME */
756  ReplicationOriginNameIndex,
757  1,
758  {
759  Anum_pg_replication_origin_roname,
760  0,
761  0,
762  0
763  },
764  16
765  },
766  {RewriteRelationId, /* RULERELNAME */
767  RewriteRelRulenameIndexId,
768  2,
769  {
770  Anum_pg_rewrite_ev_class,
771  Anum_pg_rewrite_rulename,
772  0,
773  0
774  },
775  8
776  },
777  {SequenceRelationId, /* SEQRELID */
778  SequenceRelidIndexId,
779  1,
780  {
781  Anum_pg_sequence_seqrelid,
782  0,
783  0,
784  0
785  },
786  32
787  },
788  {StatisticExtDataRelationId, /* STATEXTDATASTXOID */
789  StatisticExtDataStxoidInhIndexId,
790  2,
791  {
792  Anum_pg_statistic_ext_data_stxoid,
793  Anum_pg_statistic_ext_data_stxdinherit,
794  0,
795  0
796  },
797  4
798  },
799  {StatisticExtRelationId, /* STATEXTNAMENSP */
800  StatisticExtNameIndexId,
801  2,
802  {
803  Anum_pg_statistic_ext_stxname,
804  Anum_pg_statistic_ext_stxnamespace,
805  0,
806  0
807  },
808  4
809  },
810  {StatisticExtRelationId, /* STATEXTOID */
811  StatisticExtOidIndexId,
812  1,
813  {
814  Anum_pg_statistic_ext_oid,
815  0,
816  0,
817  0
818  },
819  4
820  },
821  {StatisticRelationId, /* STATRELATTINH */
822  StatisticRelidAttnumInhIndexId,
823  3,
824  {
825  Anum_pg_statistic_starelid,
826  Anum_pg_statistic_staattnum,
827  Anum_pg_statistic_stainherit,
828  0
829  },
830  128
831  },
832  {SubscriptionRelationId, /* SUBSCRIPTIONNAME */
833  SubscriptionNameIndexId,
834  2,
835  {
836  Anum_pg_subscription_subdbid,
837  Anum_pg_subscription_subname,
838  0,
839  0
840  },
841  4
842  },
843  {SubscriptionRelationId, /* SUBSCRIPTIONOID */
844  SubscriptionObjectIndexId,
845  1,
846  {
847  Anum_pg_subscription_oid,
848  0,
849  0,
850  0
851  },
852  4
853  },
854  {SubscriptionRelRelationId, /* SUBSCRIPTIONRELMAP */
855  SubscriptionRelSrrelidSrsubidIndexId,
856  2,
857  {
858  Anum_pg_subscription_rel_srrelid,
859  Anum_pg_subscription_rel_srsubid,
860  0,
861  0
862  },
863  64
864  },
865  {TableSpaceRelationId, /* TABLESPACEOID */
866  TablespaceOidIndexId,
867  1,
868  {
869  Anum_pg_tablespace_oid,
870  0,
871  0,
872  0,
873  },
874  4
875  },
876  {TransformRelationId, /* TRFOID */
877  TransformOidIndexId,
878  1,
879  {
880  Anum_pg_transform_oid,
881  0,
882  0,
883  0,
884  },
885  16
886  },
887  {TransformRelationId, /* TRFTYPELANG */
888  TransformTypeLangIndexId,
889  2,
890  {
891  Anum_pg_transform_trftype,
892  Anum_pg_transform_trflang,
893  0,
894  0,
895  },
896  16
897  },
898  {TSConfigMapRelationId, /* TSCONFIGMAP */
899  TSConfigMapIndexId,
900  3,
901  {
902  Anum_pg_ts_config_map_mapcfg,
903  Anum_pg_ts_config_map_maptokentype,
904  Anum_pg_ts_config_map_mapseqno,
905  0
906  },
907  2
908  },
909  {TSConfigRelationId, /* TSCONFIGNAMENSP */
910  TSConfigNameNspIndexId,
911  2,
912  {
913  Anum_pg_ts_config_cfgname,
914  Anum_pg_ts_config_cfgnamespace,
915  0,
916  0
917  },
918  2
919  },
920  {TSConfigRelationId, /* TSCONFIGOID */
921  TSConfigOidIndexId,
922  1,
923  {
924  Anum_pg_ts_config_oid,
925  0,
926  0,
927  0
928  },
929  2
930  },
931  {TSDictionaryRelationId, /* TSDICTNAMENSP */
932  TSDictionaryNameNspIndexId,
933  2,
934  {
935  Anum_pg_ts_dict_dictname,
936  Anum_pg_ts_dict_dictnamespace,
937  0,
938  0
939  },
940  2
941  },
942  {TSDictionaryRelationId, /* TSDICTOID */
943  TSDictionaryOidIndexId,
944  1,
945  {
946  Anum_pg_ts_dict_oid,
947  0,
948  0,
949  0
950  },
951  2
952  },
953  {TSParserRelationId, /* TSPARSERNAMENSP */
954  TSParserNameNspIndexId,
955  2,
956  {
957  Anum_pg_ts_parser_prsname,
958  Anum_pg_ts_parser_prsnamespace,
959  0,
960  0
961  },
962  2
963  },
964  {TSParserRelationId, /* TSPARSEROID */
965  TSParserOidIndexId,
966  1,
967  {
968  Anum_pg_ts_parser_oid,
969  0,
970  0,
971  0
972  },
973  2
974  },
975  {TSTemplateRelationId, /* TSTEMPLATENAMENSP */
976  TSTemplateNameNspIndexId,
977  2,
978  {
979  Anum_pg_ts_template_tmplname,
980  Anum_pg_ts_template_tmplnamespace,
981  0,
982  0
983  },
984  2
985  },
986  {TSTemplateRelationId, /* TSTEMPLATEOID */
987  TSTemplateOidIndexId,
988  1,
989  {
990  Anum_pg_ts_template_oid,
991  0,
992  0,
993  0
994  },
995  2
996  },
997  {TypeRelationId, /* TYPENAMENSP */
998  TypeNameNspIndexId,
999  2,
1000  {
1001  Anum_pg_type_typname,
1002  Anum_pg_type_typnamespace,
1003  0,
1004  0
1005  },
1006  64
1007  },
1008  {TypeRelationId, /* TYPEOID */
1009  TypeOidIndexId,
1010  1,
1011  {
1012  Anum_pg_type_oid,
1013  0,
1014  0,
1015  0
1016  },
1017  64
1018  },
1019  {UserMappingRelationId, /* USERMAPPINGOID */
1020  UserMappingOidIndexId,
1021  1,
1022  {
1023  Anum_pg_user_mapping_oid,
1024  0,
1025  0,
1026  0
1027  },
1028  2
1029  },
1030  {UserMappingRelationId, /* USERMAPPINGUSERSERVER */
1031  UserMappingUserServerIndexId,
1032  2,
1033  {
1034  Anum_pg_user_mapping_umuser,
1035  Anum_pg_user_mapping_umserver,
1036  0,
1037  0
1038  },
1039  2
1040  }
1041 };
1042 
1044 
1045 static bool CacheInitialized = false;
1046 
1047 /* Sorted array of OIDs of tables that have caches on them */
1050 
1051 /* Sorted array of OIDs of tables and indexes used by caches */
1054 
1055 static int oid_compare(const void *a, const void *b);
1056 
1057 
1058 /*
1059  * InitCatalogCache - initialize the caches
1060  *
1061  * Note that no database access is done here; we only allocate memory
1062  * and initialize the cache structure. Interrogation of the database
1063  * to complete initialization of a cache happens upon first use
1064  * of that cache.
1065  */
1066 void
1068 {
1069  int cacheId;
1070 
1072  "SysCacheSize does not match syscache.c's array");
1073 
1075 
1077 
1078  for (cacheId = 0; cacheId < SysCacheSize; cacheId++)
1079  {
1080  SysCache[cacheId] = InitCatCache(cacheId,
1081  cacheinfo[cacheId].reloid,
1082  cacheinfo[cacheId].indoid,
1083  cacheinfo[cacheId].nkeys,
1084  cacheinfo[cacheId].key,
1085  cacheinfo[cacheId].nbuckets);
1086  if (!PointerIsValid(SysCache[cacheId]))
1087  elog(ERROR, "could not initialize cache %u (%d)",
1088  cacheinfo[cacheId].reloid, cacheId);
1089  /* Accumulate data for OID lists, too */
1091  cacheinfo[cacheId].reloid;
1093  cacheinfo[cacheId].reloid;
1095  cacheinfo[cacheId].indoid;
1096  /* see comments for RelationInvalidatesSnapshotsOnly */
1098  }
1099 
1102 
1103  /* Sort and de-dup OID arrays, so we can use binary search. */
1105  sizeof(Oid), oid_compare);
1108  oid_compare);
1109 
1111  sizeof(Oid), oid_compare);
1114  sizeof(Oid), oid_compare);
1115 
1116  CacheInitialized = true;
1117 }
1118 
1119 /*
1120  * InitCatalogCachePhase2 - finish initializing the caches
1121  *
1122  * Finish initializing all the caches, including necessary database
1123  * access.
1124  *
1125  * This is *not* essential; normally we allow syscaches to be initialized
1126  * on first use. However, it is useful as a mechanism to preload the
1127  * relcache with entries for the most-commonly-used system catalogs.
1128  * Therefore, we invoke this routine when we need to write a new relcache
1129  * init file.
1130  */
1131 void
1133 {
1134  int cacheId;
1135 
1137 
1138  for (cacheId = 0; cacheId < SysCacheSize; cacheId++)
1139  InitCatCachePhase2(SysCache[cacheId], true);
1140 }
1141 
1142 
1143 /*
1144  * SearchSysCache
1145  *
1146  * A layer on top of SearchCatCache that does the initialization and
1147  * key-setting for you.
1148  *
1149  * Returns the cache copy of the tuple if one is found, NULL if not.
1150  * The tuple is the 'cache' copy and must NOT be modified!
1151  *
1152  * When the caller is done using the tuple, call ReleaseSysCache()
1153  * to release the reference count grabbed by SearchSysCache(). If this
1154  * is not done, the tuple will remain locked in cache until end of
1155  * transaction, which is tolerable but not desirable.
1156  *
1157  * CAUTION: The tuple that is returned must NOT be freed by the caller!
1158  */
1159 HeapTuple
1160 SearchSysCache(int cacheId,
1161  Datum key1,
1162  Datum key2,
1163  Datum key3,
1164  Datum key4)
1165 {
1166  Assert(cacheId >= 0 && cacheId < SysCacheSize &&
1167  PointerIsValid(SysCache[cacheId]));
1168 
1169  return SearchCatCache(SysCache[cacheId], key1, key2, key3, key4);
1170 }
1171 
1172 HeapTuple
1173 SearchSysCache1(int cacheId,
1174  Datum key1)
1175 {
1176  Assert(cacheId >= 0 && cacheId < SysCacheSize &&
1177  PointerIsValid(SysCache[cacheId]));
1178  Assert(SysCache[cacheId]->cc_nkeys == 1);
1179 
1180  return SearchCatCache1(SysCache[cacheId], key1);
1181 }
1182 
1183 HeapTuple
1184 SearchSysCache2(int cacheId,
1185  Datum key1, Datum key2)
1186 {
1187  Assert(cacheId >= 0 && cacheId < SysCacheSize &&
1188  PointerIsValid(SysCache[cacheId]));
1189  Assert(SysCache[cacheId]->cc_nkeys == 2);
1190 
1191  return SearchCatCache2(SysCache[cacheId], key1, key2);
1192 }
1193 
1194 HeapTuple
1195 SearchSysCache3(int cacheId,
1196  Datum key1, Datum key2, Datum key3)
1197 {
1198  Assert(cacheId >= 0 && cacheId < SysCacheSize &&
1199  PointerIsValid(SysCache[cacheId]));
1200  Assert(SysCache[cacheId]->cc_nkeys == 3);
1201 
1202  return SearchCatCache3(SysCache[cacheId], key1, key2, key3);
1203 }
1204 
1205 HeapTuple
1206 SearchSysCache4(int cacheId,
1207  Datum key1, Datum key2, Datum key3, Datum key4)
1208 {
1209  Assert(cacheId >= 0 && cacheId < SysCacheSize &&
1210  PointerIsValid(SysCache[cacheId]));
1211  Assert(SysCache[cacheId]->cc_nkeys == 4);
1212 
1213  return SearchCatCache4(SysCache[cacheId], key1, key2, key3, key4);
1214 }
1215 
1216 /*
1217  * ReleaseSysCache
1218  * Release previously grabbed reference count on a tuple
1219  */
1220 void
1222 {
1223  ReleaseCatCache(tuple);
1224 }
1225 
1226 /*
1227  * SearchSysCacheCopy
1228  *
1229  * A convenience routine that does SearchSysCache and (if successful)
1230  * returns a modifiable copy of the syscache entry. The original
1231  * syscache entry is released before returning. The caller should
1232  * heap_freetuple() the result when done with it.
1233  */
1234 HeapTuple
1236  Datum key1,
1237  Datum key2,
1238  Datum key3,
1239  Datum key4)
1240 {
1241  HeapTuple tuple,
1242  newtuple;
1243 
1244  tuple = SearchSysCache(cacheId, key1, key2, key3, key4);
1245  if (!HeapTupleIsValid(tuple))
1246  return tuple;
1247  newtuple = heap_copytuple(tuple);
1248  ReleaseSysCache(tuple);
1249  return newtuple;
1250 }
1251 
1252 /*
1253  * SearchSysCacheExists
1254  *
1255  * A convenience routine that just probes to see if a tuple can be found.
1256  * No lock is retained on the syscache entry.
1257  */
1258 bool
1260  Datum key1,
1261  Datum key2,
1262  Datum key3,
1263  Datum key4)
1264 {
1265  HeapTuple tuple;
1266 
1267  tuple = SearchSysCache(cacheId, key1, key2, key3, key4);
1268  if (!HeapTupleIsValid(tuple))
1269  return false;
1270  ReleaseSysCache(tuple);
1271  return true;
1272 }
1273 
1274 /*
1275  * GetSysCacheOid
1276  *
1277  * A convenience routine that does SearchSysCache and returns the OID in the
1278  * oidcol column of the found tuple, or InvalidOid if no tuple could be found.
1279  * No lock is retained on the syscache entry.
1280  */
1281 Oid
1282 GetSysCacheOid(int cacheId,
1283  AttrNumber oidcol,
1284  Datum key1,
1285  Datum key2,
1286  Datum key3,
1287  Datum key4)
1288 {
1289  HeapTuple tuple;
1290  bool isNull;
1291  Oid result;
1292 
1293  tuple = SearchSysCache(cacheId, key1, key2, key3, key4);
1294  if (!HeapTupleIsValid(tuple))
1295  return InvalidOid;
1296  result = heap_getattr(tuple, oidcol,
1297  SysCache[cacheId]->cc_tupdesc,
1298  &isNull);
1299  Assert(!isNull); /* columns used as oids should never be NULL */
1300  ReleaseSysCache(tuple);
1301  return result;
1302 }
1303 
1304 
1305 /*
1306  * SearchSysCacheAttName
1307  *
1308  * This routine is equivalent to SearchSysCache on the ATTNAME cache,
1309  * except that it will return NULL if the found attribute is marked
1310  * attisdropped. This is convenient for callers that want to act as
1311  * though dropped attributes don't exist.
1312  */
1313 HeapTuple
1314 SearchSysCacheAttName(Oid relid, const char *attname)
1315 {
1316  HeapTuple tuple;
1317 
1318  tuple = SearchSysCache2(ATTNAME,
1319  ObjectIdGetDatum(relid),
1321  if (!HeapTupleIsValid(tuple))
1322  return NULL;
1323  if (((Form_pg_attribute) GETSTRUCT(tuple))->attisdropped)
1324  {
1325  ReleaseSysCache(tuple);
1326  return NULL;
1327  }
1328  return tuple;
1329 }
1330 
1331 /*
1332  * SearchSysCacheCopyAttName
1333  *
1334  * As above, an attisdropped-aware version of SearchSysCacheCopy.
1335  */
1336 HeapTuple
1338 {
1339  HeapTuple tuple,
1340  newtuple;
1341 
1342  tuple = SearchSysCacheAttName(relid, attname);
1343  if (!HeapTupleIsValid(tuple))
1344  return tuple;
1345  newtuple = heap_copytuple(tuple);
1346  ReleaseSysCache(tuple);
1347  return newtuple;
1348 }
1349 
1350 /*
1351  * SearchSysCacheExistsAttName
1352  *
1353  * As above, an attisdropped-aware version of SearchSysCacheExists.
1354  */
1355 bool
1357 {
1358  HeapTuple tuple;
1359 
1360  tuple = SearchSysCacheAttName(relid, attname);
1361  if (!HeapTupleIsValid(tuple))
1362  return false;
1363  ReleaseSysCache(tuple);
1364  return true;
1365 }
1366 
1367 
1368 /*
1369  * SearchSysCacheAttNum
1370  *
1371  * This routine is equivalent to SearchSysCache on the ATTNUM cache,
1372  * except that it will return NULL if the found attribute is marked
1373  * attisdropped. This is convenient for callers that want to act as
1374  * though dropped attributes don't exist.
1375  */
1376 HeapTuple
1378 {
1379  HeapTuple tuple;
1380 
1381  tuple = SearchSysCache2(ATTNUM,
1382  ObjectIdGetDatum(relid),
1384  if (!HeapTupleIsValid(tuple))
1385  return NULL;
1386  if (((Form_pg_attribute) GETSTRUCT(tuple))->attisdropped)
1387  {
1388  ReleaseSysCache(tuple);
1389  return NULL;
1390  }
1391  return tuple;
1392 }
1393 
1394 /*
1395  * SearchSysCacheCopyAttNum
1396  *
1397  * As above, an attisdropped-aware version of SearchSysCacheCopy.
1398  */
1399 HeapTuple
1401 {
1402  HeapTuple tuple,
1403  newtuple;
1404 
1405  tuple = SearchSysCacheAttNum(relid, attnum);
1406  if (!HeapTupleIsValid(tuple))
1407  return NULL;
1408  newtuple = heap_copytuple(tuple);
1409  ReleaseSysCache(tuple);
1410  return newtuple;
1411 }
1412 
1413 
1414 /*
1415  * SysCacheGetAttr
1416  *
1417  * Given a tuple previously fetched by SearchSysCache(),
1418  * extract a specific attribute.
1419  *
1420  * This is equivalent to using heap_getattr() on a tuple fetched
1421  * from a non-cached relation. Usually, this is only used for attributes
1422  * that could be NULL or variable length; the fixed-size attributes in
1423  * a system table are accessed just by mapping the tuple onto the C struct
1424  * declarations from include/catalog/.
1425  *
1426  * As with heap_getattr(), if the attribute is of a pass-by-reference type
1427  * then a pointer into the tuple data area is returned --- the caller must
1428  * not modify or pfree the datum!
1429  *
1430  * Note: it is legal to use SysCacheGetAttr() with a cacheId referencing
1431  * a different cache for the same catalog the tuple was fetched from.
1432  */
1433 Datum
1434 SysCacheGetAttr(int cacheId, HeapTuple tup,
1435  AttrNumber attributeNumber,
1436  bool *isNull)
1437 {
1438  /*
1439  * We just need to get the TupleDesc out of the cache entry, and then we
1440  * can apply heap_getattr(). Normally the cache control data is already
1441  * valid (because the caller recently fetched the tuple via this same
1442  * cache), but there are cases where we have to initialize the cache here.
1443  */
1444  if (cacheId < 0 || cacheId >= SysCacheSize ||
1445  !PointerIsValid(SysCache[cacheId]))
1446  elog(ERROR, "invalid cache ID: %d", cacheId);
1447  if (!PointerIsValid(SysCache[cacheId]->cc_tupdesc))
1448  {
1449  InitCatCachePhase2(SysCache[cacheId], false);
1450  Assert(PointerIsValid(SysCache[cacheId]->cc_tupdesc));
1451  }
1452 
1453  return heap_getattr(tup, attributeNumber,
1454  SysCache[cacheId]->cc_tupdesc,
1455  isNull);
1456 }
1457 
1458 /*
1459  * GetSysCacheHashValue
1460  *
1461  * Get the hash value that would be used for a tuple in the specified cache
1462  * with the given search keys.
1463  *
1464  * The reason for exposing this as part of the API is that the hash value is
1465  * exposed in cache invalidation operations, so there are places outside the
1466  * catcache code that need to be able to compute the hash values.
1467  */
1468 uint32
1470  Datum key1,
1471  Datum key2,
1472  Datum key3,
1473  Datum key4)
1474 {
1475  if (cacheId < 0 || cacheId >= SysCacheSize ||
1476  !PointerIsValid(SysCache[cacheId]))
1477  elog(ERROR, "invalid cache ID: %d", cacheId);
1478 
1479  return GetCatCacheHashValue(SysCache[cacheId], key1, key2, key3, key4);
1480 }
1481 
1482 /*
1483  * List-search interface
1484  */
1485 struct catclist *
1486 SearchSysCacheList(int cacheId, int nkeys,
1487  Datum key1, Datum key2, Datum key3)
1488 {
1489  if (cacheId < 0 || cacheId >= SysCacheSize ||
1490  !PointerIsValid(SysCache[cacheId]))
1491  elog(ERROR, "invalid cache ID: %d", cacheId);
1492 
1493  return SearchCatCacheList(SysCache[cacheId], nkeys,
1494  key1, key2, key3);
1495 }
1496 
1497 /*
1498  * SysCacheInvalidate
1499  *
1500  * Invalidate entries in the specified cache, given a hash value.
1501  * See CatCacheInvalidate() for more info.
1502  *
1503  * This routine is only quasi-public: it should only be used by inval.c.
1504  */
1505 void
1506 SysCacheInvalidate(int cacheId, uint32 hashValue)
1507 {
1508  if (cacheId < 0 || cacheId >= SysCacheSize)
1509  elog(ERROR, "invalid cache ID: %d", cacheId);
1510 
1511  /* if this cache isn't initialized yet, no need to do anything */
1512  if (!PointerIsValid(SysCache[cacheId]))
1513  return;
1514 
1515  CatCacheInvalidate(SysCache[cacheId], hashValue);
1516 }
1517 
1518 /*
1519  * Certain relations that do not have system caches send snapshot invalidation
1520  * messages in lieu of catcache messages. This is for the benefit of
1521  * GetCatalogSnapshot(), which can then reuse its existing MVCC snapshot
1522  * for scanning one of those catalogs, rather than taking a new one, if no
1523  * invalidation has been received.
1524  *
1525  * Relations that have syscaches need not (and must not) be listed here. The
1526  * catcache invalidation messages will also flush the snapshot. If you add a
1527  * syscache for one of these relations, remove it from this list.
1528  */
1529 bool
1531 {
1532  switch (relid)
1533  {
1534  case DbRoleSettingRelationId:
1535  case DependRelationId:
1536  case SharedDependRelationId:
1537  case DescriptionRelationId:
1538  case SharedDescriptionRelationId:
1539  case SecLabelRelationId:
1540  case SharedSecLabelRelationId:
1541  return true;
1542  default:
1543  break;
1544  }
1545 
1546  return false;
1547 }
1548 
1549 /*
1550  * Test whether a relation has a system cache.
1551  */
1552 bool
1554 {
1555  int low = 0,
1556  high = SysCacheRelationOidSize - 1;
1557 
1558  while (low <= high)
1559  {
1560  int middle = low + (high - low) / 2;
1561 
1562  if (SysCacheRelationOid[middle] == relid)
1563  return true;
1564  if (SysCacheRelationOid[middle] < relid)
1565  low = middle + 1;
1566  else
1567  high = middle - 1;
1568  }
1569 
1570  return false;
1571 }
1572 
1573 /*
1574  * Test whether a relation supports a system cache, ie it is either a
1575  * cached table or the index used for a cache.
1576  */
1577 bool
1579 {
1580  int low = 0,
1581  high = SysCacheSupportingRelOidSize - 1;
1582 
1583  while (low <= high)
1584  {
1585  int middle = low + (high - low) / 2;
1586 
1587  if (SysCacheSupportingRelOid[middle] == relid)
1588  return true;
1589  if (SysCacheSupportingRelOid[middle] < relid)
1590  low = middle + 1;
1591  else
1592  high = middle - 1;
1593  }
1594 
1595  return false;
1596 }
1597 
1598 
1599 /*
1600  * OID comparator for pg_qsort
1601  */
1602 static int
1603 oid_compare(const void *a, const void *b)
1604 {
1605  Oid oa = *((const Oid *) a);
1606  Oid ob = *((const Oid *) b);
1607 
1608  if (oa == ob)
1609  return 0;
1610  return (oa > ob) ? 1 : -1;
1611 }
int16 AttrNumber
Definition: attnum.h:21
unsigned int uint32
Definition: c.h:442
signed short int16
Definition: c.h:429
#define PointerIsValid(pointer)
Definition: c.h:699
#define lengthof(array)
Definition: c.h:724
#define StaticAssertStmt(condition, errmessage)
Definition: c.h:869
HeapTuple SearchCatCache2(CatCache *cache, Datum v1, Datum v2)
Definition: catcache.c:1168
HeapTuple SearchCatCache3(CatCache *cache, Datum v1, Datum v2, Datum v3)
Definition: catcache.c:1176
void InitCatCachePhase2(CatCache *cache, bool touch_index)
Definition: catcache.c:1026
uint32 GetCatCacheHashValue(CatCache *cache, Datum v1, Datum v2, Datum v3, Datum v4)
Definition: catcache.c:1468
HeapTuple SearchCatCache4(CatCache *cache, Datum v1, Datum v2, Datum v3, Datum v4)
Definition: catcache.c:1184
CatCache * InitCatCache(int id, Oid reloid, Oid indexoid, int nkeys, const int *key, int nbuckets)
Definition: catcache.c:757
CatCList * SearchCatCacheList(CatCache *cache, int nkeys, Datum v1, Datum v2, Datum v3)
Definition: catcache.c:1502
void CatCacheInvalidate(CatCache *cache, uint32 hashValue)
Definition: catcache.c:546
HeapTuple SearchCatCache1(CatCache *cache, Datum v1)
Definition: catcache.c:1160
void ReleaseCatCache(HeapTuple tuple)
Definition: catcache.c:1436
HeapTuple SearchCatCache(CatCache *cache, Datum v1, Datum v2, Datum v3, Datum v4)
Definition: catcache.c:1143
#define ERROR
Definition: elog.h:35
HeapTuple heap_copytuple(HeapTuple tuple)
Definition: heaptuple.c:680
#define HeapTupleIsValid(tuple)
Definition: htup.h:78
static Datum heap_getattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
Definition: htup_details.h:788
#define GETSTRUCT(TUP)
Definition: htup_details.h:649
int b
Definition: isn.c:70
int a
Definition: isn.c:69
Assert(fmt[strlen(fmt) - 1] !='\n')
NameData attname
Definition: pg_attribute.h:41
int16 attnum
Definition: pg_attribute.h:83
FormData_pg_attribute * Form_pg_attribute
Definition: pg_attribute.h:207
void pg_qsort(void *base, size_t nel, size_t elsize, int(*cmp)(const void *, const void *))
uintptr_t Datum
Definition: postgres.h:412
static Datum Int16GetDatum(int16 X)
Definition: postgres.h:520
static Datum ObjectIdGetDatum(Oid X)
Definition: postgres.h:600
static Datum CStringGetDatum(const char *X)
Definition: postgres.h:698
#define InvalidOid
Definition: postgres_ext.h:36
unsigned int Oid
Definition: postgres_ext.h:31
static size_t qunique(void *array, size_t elements, size_t width, int(*compare)(const void *, const void *))
Definition: qunique.h:21
int key[4]
Definition: syscache.c:121
int nkeys
Definition: syscache.c:120
int nbuckets
Definition: syscache.c:122
Oid indoid
Definition: syscache.c:119
Oid reloid
Definition: syscache.c:118
short nkeys
Definition: catcache.h:175
HeapTuple SearchSysCacheCopyAttName(Oid relid, const char *attname)
Definition: syscache.c:1337
void SysCacheInvalidate(int cacheId, uint32 hashValue)
Definition: syscache.c:1506
bool RelationHasSysCache(Oid relid)
Definition: syscache.c:1553
HeapTuple SearchSysCacheCopyAttNum(Oid relid, int16 attnum)
Definition: syscache.c:1400
void InitCatalogCache(void)
Definition: syscache.c:1067
static const struct cachedesc cacheinfo[]
Definition: syscache.c:125
void ReleaseSysCache(HeapTuple tuple)
Definition: syscache.c:1221
static bool CacheInitialized
Definition: syscache.c:1045
static int oid_compare(const void *a, const void *b)
Definition: syscache.c:1603
HeapTuple SearchSysCache(int cacheId, Datum key1, Datum key2, Datum key3, Datum key4)
Definition: syscache.c:1160
HeapTuple SearchSysCache1(int cacheId, Datum key1)
Definition: syscache.c:1173
uint32 GetSysCacheHashValue(int cacheId, Datum key1, Datum key2, Datum key3, Datum key4)
Definition: syscache.c:1469
struct catclist * SearchSysCacheList(int cacheId, int nkeys, Datum key1, Datum key2, Datum key3)
Definition: syscache.c:1486
HeapTuple SearchSysCache3(int cacheId, Datum key1, Datum key2, Datum key3)
Definition: syscache.c:1195
static int SysCacheSupportingRelOidSize
Definition: syscache.c:1053
HeapTuple SearchSysCacheAttNum(Oid relid, int16 attnum)
Definition: syscache.c:1377
bool RelationSupportsSysCache(Oid relid)
Definition: syscache.c:1578
Datum SysCacheGetAttr(int cacheId, HeapTuple tup, AttrNumber attributeNumber, bool *isNull)
Definition: syscache.c:1434
bool SearchSysCacheExistsAttName(Oid relid, const char *attname)
Definition: syscache.c:1356
void InitCatalogCachePhase2(void)
Definition: syscache.c:1132
HeapTuple SearchSysCache2(int cacheId, Datum key1, Datum key2)
Definition: syscache.c:1184
HeapTuple SearchSysCacheAttName(Oid relid, const char *attname)
Definition: syscache.c:1314
bool SearchSysCacheExists(int cacheId, Datum key1, Datum key2, Datum key3, Datum key4)
Definition: syscache.c:1259
HeapTuple SearchSysCacheCopy(int cacheId, Datum key1, Datum key2, Datum key3, Datum key4)
Definition: syscache.c:1235
static Oid SysCacheRelationOid[SysCacheSize]
Definition: syscache.c:1048
static CatCache * SysCache[SysCacheSize]
Definition: syscache.c:1043
static Oid SysCacheSupportingRelOid[SysCacheSize *2]
Definition: syscache.c:1052
static int SysCacheRelationOidSize
Definition: syscache.c:1049
bool RelationInvalidatesSnapshotsOnly(Oid relid)
Definition: syscache.c:1530
HeapTuple SearchSysCache4(int cacheId, Datum key1, Datum key2, Datum key3, Datum key4)
Definition: syscache.c:1206
Oid GetSysCacheOid(int cacheId, AttrNumber oidcol, Datum key1, Datum key2, Datum key3, Datum key4)
Definition: syscache.c:1282
@ ATTNAME
Definition: syscache.h:40
@ ATTNUM
Definition: syscache.h:41
#define SysCacheSize
Definition: syscache.h:118