syscache.h 2.35 KB
Newer Older
1 2
/*-------------------------------------------------------------------------
 *
3
 * syscache.h
4
 *	  System catalog cache definitions.
5
 *
6 7
 * See also lsyscache.h, which provides convenience routines for
 * common cache-lookup operations.
8
 *
9
 * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
Bruce Momjian's avatar
Add:  
Bruce Momjian committed
10
 * Portions Copyright (c) 1994, Regents of the University of California
11
 *
12
 * $Id: syscache.h,v 1.47 2002/04/18 20:01:11 tgl Exp $
13 14 15
 *
 *-------------------------------------------------------------------------
 */
16
#ifndef SYSCACHE_H
17 18
#define SYSCACHE_H

19
#include "access/htup.h"
20

21
/*
22
 *		Declarations for util/syscache.c.
23
 *
24
 *		SysCache identifiers.
25
 *
26
 *		The order of these must match the order
27 28
 *		they are entered into the structure cacheinfo[] in syscache.c.
 *		Keep them in alphabetical order.
29 30
 */

31 32 33 34 35 36 37 38
#define AGGFNOID		0
#define AMNAME			1
#define AMOID			2
#define AMOPOPID		3
#define AMOPSTRATEGY	4
#define AMPROCNUM		5
#define ATTNAME			6
#define ATTNUM			7
39
#define CLAAMNAMENSP	8
40 41 42 43 44 45 46 47 48
#define CLAOID			9
#define GRONAME			10
#define GROSYSID		11
#define INDEXRELID		12
#define INHRELID		13
#define LANGNAME		14
#define LANGOID			15
#define NAMESPACENAME	16
#define NAMESPACEOID	17
49
#define OPERNAMENSP		18
50 51 52 53 54
#define OPEROID			19
#define PROCNAMENSP		20
#define PROCOID			21
#define RELNAMENSP		22
#define RELOID			23
55
#define RULERELNAME		24
56 57 58 59 60
#define SHADOWNAME		25
#define SHADOWSYSID		26
#define STATRELATT		27
#define TYPENAMENSP		28
#define TYPEOID			29
61

62

63
extern void InitCatalogCache(void);
64
extern void InitCatalogCachePhase2(void);
65 66

extern HeapTuple SearchSysCache(int cacheId,
67
			   Datum key1, Datum key2, Datum key3, Datum key4);
68 69 70 71
extern void ReleaseSysCache(HeapTuple tuple);

/* convenience routines */
extern HeapTuple SearchSysCacheCopy(int cacheId,
72
				   Datum key1, Datum key2, Datum key3, Datum key4);
73
extern bool SearchSysCacheExists(int cacheId,
74
					 Datum key1, Datum key2, Datum key3, Datum key4);
75
extern Oid GetSysCacheOid(int cacheId,
76
			   Datum key1, Datum key2, Datum key3, Datum key4);
77

78
extern Datum SysCacheGetAttr(int cacheId, HeapTuple tup,
79
				AttrNumber attributeNumber, bool *isNull);
80

81 82 83 84 85
/* list-search interface.  Users of this must import catcache.h too */
extern struct catclist *SearchSysCacheList(int cacheId, int nkeys,
			   Datum key1, Datum key2, Datum key3, Datum key4);
#define ReleaseSysCacheList(x)  ReleaseCatCacheList(x)

86
#endif   /* SYSCACHE_H */