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