aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/cache
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2001-03-22 04:01:46 +0000
committerBruce Momjian <bruce@momjian.us>2001-03-22 04:01:46 +0000
commit9e1552607a9dc6bc23e43d46770a9063ade4f3f0 (patch)
tree6a230d81917ebc004e40cd46c48f2aa27eec153e /src/backend/utils/cache
parent6cf8707b828b14b5c2336076ce358b18b67829d6 (diff)
downloadpostgresql-9e1552607a9dc6bc23e43d46770a9063ade4f3f0.tar.gz
postgresql-9e1552607a9dc6bc23e43d46770a9063ade4f3f0.zip
pgindent run. Make it all clean.
Diffstat (limited to 'src/backend/utils/cache')
-rw-r--r--src/backend/utils/cache/catcache.c177
-rw-r--r--src/backend/utils/cache/fcache.c7
-rw-r--r--src/backend/utils/cache/inval.c87
-rw-r--r--src/backend/utils/cache/lsyscache.c41
-rw-r--r--src/backend/utils/cache/relcache.c328
-rw-r--r--src/backend/utils/cache/syscache.c131
-rw-r--r--src/backend/utils/cache/temprel.c39
7 files changed, 417 insertions, 393 deletions
diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c
index 1bedd565d03..f843f2bb166 100644
--- a/src/backend/utils/cache/catcache.c
+++ b/src/backend/utils/cache/catcache.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.76 2001/02/22 18:39:19 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.77 2001/03/22 03:59:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -31,9 +31,9 @@
static void CatCacheRemoveCTup(CatCache *cache, CatCTup *ct);
static Index CatalogCacheComputeHashIndex(CatCache *cache,
- ScanKey cur_skey);
+ ScanKey cur_skey);
static Index CatalogCacheComputeTupleHashIndex(CatCache *cache,
- HeapTuple tuple);
+ HeapTuple tuple);
static void CatalogCacheInitializeCache(CatCache *cache);
static Datum cc_hashname(PG_FUNCTION_ARGS);
@@ -88,8 +88,8 @@ GetCCHashFunc(Oid keytype)
{
switch (keytype)
{
- case BOOLOID:
- case CHAROID:
+ case BOOLOID:
+ case CHAROID:
return hashchar;
case NAMEOID:
return cc_hashname;
@@ -125,7 +125,7 @@ cc_hashname(PG_FUNCTION_ARGS)
*/
NameData my_n;
- namestrcpy(&my_n, NameStr(* PG_GETARG_NAME(0)));
+ namestrcpy(&my_n, NameStr(*PG_GETARG_NAME(0)));
return DirectFunctionCall1(hashname, NameGetDatum(&my_n));
}
@@ -141,15 +141,17 @@ cc_hashname(PG_FUNCTION_ARGS)
void
CreateCacheMemoryContext(void)
{
- /* Purely for paranoia, check that context doesn't exist;
- * caller probably did so already.
+
+ /*
+ * Purely for paranoia, check that context doesn't exist; caller
+ * probably did so already.
*/
if (!CacheMemoryContext)
CacheMemoryContext = AllocSetContextCreate(TopMemoryContext,
"CacheMemoryContext",
- ALLOCSET_DEFAULT_MINSIZE,
- ALLOCSET_DEFAULT_INITSIZE,
- ALLOCSET_DEFAULT_MAXSIZE);
+ ALLOCSET_DEFAULT_MINSIZE,
+ ALLOCSET_DEFAULT_INITSIZE,
+ ALLOCSET_DEFAULT_MAXSIZE);
}
@@ -157,7 +159,7 @@ CreateCacheMemoryContext(void)
* CatalogCacheInitializeCache
*
* This function does final initialization of a catcache: obtain the tuple
- * descriptor and set up the hash and equality function links. We assume
+ * descriptor and set up the hash and equality function links. We assume
* that the relcache entry can be opened at this point!
*
*/
@@ -201,8 +203,8 @@ CatalogCacheInitializeCache(CatCache *cache)
Assert(RelationIsValid(relation));
/*
- * switch to the cache context so our allocations
- * do not vanish at the end of a transaction
+ * switch to the cache context so our allocations do not vanish at the
+ * end of a transaction
*
*/
if (!CacheMemoryContext)
@@ -211,13 +213,13 @@ CatalogCacheInitializeCache(CatCache *cache)
oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
/*
- * copy the relcache's tuple descriptor to permanent cache storage
+ * copy the relcache's tuple descriptor to permanent cache storage
*
*/
tupdesc = CreateTupleDescCopyConstr(RelationGetDescr(relation));
/*
- * return to the caller's memory context and close the rel
+ * return to the caller's memory context and close the rel
*
*/
MemoryContextSwitchTo(oldcxt);
@@ -228,7 +230,7 @@ CatalogCacheInitializeCache(CatCache *cache)
cache->cc_relname, cache->cc_nkeys);
/*
- * initialize cache's key information
+ * initialize cache's key information
*
*/
for (i = 0; i < cache->cc_nkeys; ++i)
@@ -238,9 +240,7 @@ CatalogCacheInitializeCache(CatCache *cache)
CatalogCacheInitializeCache_DEBUG2;
if (cache->cc_key[i] > 0)
- {
keytype = tupdesc->attrs[cache->cc_key[i] - 1]->atttypid;
- }
else
{
if (cache->cc_key[i] != ObjectIdAttributeNumber)
@@ -249,6 +249,7 @@ CatalogCacheInitializeCache(CatCache *cache)
}
cache->cc_hashfunc[i] = GetCCHashFunc(keytype);
+
/*
* If GetCCHashFunc liked the type, safe to index into eqproc[]
*/
@@ -268,7 +269,7 @@ CatalogCacheInitializeCache(CatCache *cache)
}
/*
- * mark this cache fully initialized
+ * mark this cache fully initialized
*
*/
cache->cc_tupdesc = tupdesc;
@@ -293,22 +294,22 @@ CatalogCacheComputeHashIndex(CatCache *cache, ScanKey cur_skey)
case 4:
hashIndex ^=
DatumGetUInt32(DirectFunctionCall1(cache->cc_hashfunc[3],
- cur_skey[3].sk_argument)) << 9;
+ cur_skey[3].sk_argument)) << 9;
/* FALLTHROUGH */
case 3:
hashIndex ^=
DatumGetUInt32(DirectFunctionCall1(cache->cc_hashfunc[2],
- cur_skey[2].sk_argument)) << 6;
+ cur_skey[2].sk_argument)) << 6;
/* FALLTHROUGH */
case 2:
hashIndex ^=
DatumGetUInt32(DirectFunctionCall1(cache->cc_hashfunc[1],
- cur_skey[1].sk_argument)) << 3;
+ cur_skey[1].sk_argument)) << 3;
/* FALLTHROUGH */
case 1:
hashIndex ^=
DatumGetUInt32(DirectFunctionCall1(cache->cc_hashfunc[0],
- cur_skey[0].sk_argument));
+ cur_skey[0].sk_argument));
break;
default:
elog(FATAL, "CCComputeHashIndex: %d cc_nkeys", cache->cc_nkeys);
@@ -422,7 +423,7 @@ CatalogCacheIdInvalidate(int cacheId,
CatCache *ccp;
/*
- * sanity checks
+ * sanity checks
*
*/
Assert(hashIndex < NCCBUCK);
@@ -430,7 +431,7 @@ CatalogCacheIdInvalidate(int cacheId,
CACHE1_elog(DEBUG, "CatalogCacheIdInvalidate: called");
/*
- * inspect caches to find the proper cache
+ * inspect caches to find the proper cache
*
*/
for (ccp = Caches; ccp; ccp = ccp->cc_next)
@@ -440,8 +441,9 @@ CatalogCacheIdInvalidate(int cacheId,
if (cacheId != ccp->id)
continue;
+
/*
- * inspect the hash bucket until we find a match or exhaust
+ * inspect the hash bucket until we find a match or exhaust
*
*/
for (elt = DLGetHead(&ccp->cc_cache[hashIndex]); elt; elt = nextelt)
@@ -491,7 +493,7 @@ CatalogCacheIdInvalidate(int cacheId,
void
AtEOXact_CatCache(bool isCommit)
{
- CatCache *cache;
+ CatCache *cache;
for (cache = Caches; cache; cache = cache->cc_next)
{
@@ -530,7 +532,7 @@ AtEOXact_CatCache(bool isCommit)
void
ResetSystemCache(void)
{
- CatCache *cache;
+ CatCache *cache;
CACHE1_elog(DEBUG, "ResetSystemCache called");
@@ -617,7 +619,7 @@ do { \
#define InitCatCache_DEBUG1
#endif
-CatCache *
+CatCache *
InitCatCache(int id,
char *relname,
char *indname,
@@ -629,8 +631,8 @@ InitCatCache(int id,
int i;
/*
- * first switch to the cache context so our allocations
- * do not vanish at the end of a transaction
+ * first switch to the cache context so our allocations do not vanish
+ * at the end of a transaction
*
*/
if (!CacheMemoryContext)
@@ -639,15 +641,15 @@ InitCatCache(int id,
oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
/*
- * allocate a new cache structure
+ * allocate a new cache structure
*
*/
cp = (CatCache *) palloc(sizeof(CatCache));
MemSet((char *) cp, 0, sizeof(CatCache));
/*
- * initialize the cache buckets (each bucket is a list header)
- * and the LRU tuple list
+ * initialize the cache buckets (each bucket is a list header) and the
+ * LRU tuple list
*
*/
DLInitList(&cp->cc_lrulist);
@@ -655,17 +657,17 @@ InitCatCache(int id,
DLInitList(&cp->cc_cache[i]);
/*
- * Caches is the pointer to the head of the list of all the
- * system caches. here we add the new cache to the top of the list.
+ * Caches is the pointer to the head of the list of all the system
+ * caches. here we add the new cache to the top of the list.
*
*/
cp->cc_next = Caches; /* list of caches (single link) */
Caches = cp;
/*
- * initialize the cache's relation information for the relation
- * corresponding to this cache, and initialize some of the new
- * cache's other internal fields. But don't open the relation yet.
+ * initialize the cache's relation information for the relation
+ * corresponding to this cache, and initialize some of the new cache's
+ * other internal fields. But don't open the relation yet.
*
*/
cp->cc_relname = relname;
@@ -679,14 +681,14 @@ InitCatCache(int id,
cp->cc_key[i] = key[i];
/*
- * all done. new cache is initialized. print some debugging
- * information, if appropriate.
+ * all done. new cache is initialized. print some debugging
+ * information, if appropriate.
*
*/
InitCatCache_DEBUG1;
/*
- * back to the old context before we return...
+ * back to the old context before we return...
*
*/
MemoryContextSwitchTo(oldcxt);
@@ -774,14 +776,14 @@ SearchCatCache(CatCache *cache,
MemoryContext oldcxt;
/*
- * one-time startup overhead
+ * one-time startup overhead
*
*/
if (cache->cc_tupdesc == NULL)
CatalogCacheInitializeCache(cache);
/*
- * initialize the search key information
+ * initialize the search key information
*
*/
memcpy(cur_skey, cache->cc_skey, sizeof(cur_skey));
@@ -791,13 +793,13 @@ SearchCatCache(CatCache *cache,
cur_skey[3].sk_argument = v4;
/*
- * find the hash bucket in which to look for the tuple
+ * find the hash bucket in which to look for the tuple
*
*/
hash = CatalogCacheComputeHashIndex(cache, cur_skey);
/*
- * scan the hash bucket until we find a match or exhaust our tuples
+ * scan the hash bucket until we find a match or exhaust our tuples
*
*/
for (elt = DLGetHead(&cache->cc_cache[hash]);
@@ -812,8 +814,8 @@ SearchCatCache(CatCache *cache,
continue; /* ignore dead entries */
/*
- * see if the cached tuple matches our key.
- * (should we be worried about time ranges? -cim 10/2/90)
+ * see if the cached tuple matches our key. (should we be worried
+ * about time ranges? -cim 10/2/90)
*
*/
HeapKeyTest(&ct->tuple,
@@ -821,16 +823,16 @@ SearchCatCache(CatCache *cache,
cache->cc_nkeys,
cur_skey,
res);
- if (! res)
+ if (!res)
continue;
/*
- * we found a tuple in the cache: bump its refcount, move it to
- * the front of the LRU list, and return it. We also move it
- * to the front of the list for its hashbucket, in order to speed
- * subsequent searches. (The most frequently accessed elements
- * in any hashbucket will tend to be near the front of the
- * hashbucket's list.)
+ * we found a tuple in the cache: bump its refcount, move it to
+ * the front of the LRU list, and return it. We also move it to
+ * the front of the list for its hashbucket, in order to speed
+ * subsequent searches. (The most frequently accessed elements in
+ * any hashbucket will tend to be near the front of the
+ * hashbucket's list.)
*
*/
ct->refcount++;
@@ -847,31 +849,30 @@ SearchCatCache(CatCache *cache,
}
/*
- * Tuple was not found in cache, so we have to try and
- * retrieve it directly from the relation. If it's found,
- * we add it to the cache.
+ * Tuple was not found in cache, so we have to try and retrieve it
+ * directly from the relation. If it's found, we add it to the cache.
*
- * NOTE: it is possible for recursive cache lookups to occur while
- * reading the relation --- for example, due to shared-cache-inval
- * messages being processed during heap_open(). This is OK. It's
- * even possible for one of those lookups to find and enter the
- * very same tuple we are trying to fetch here. If that happens,
- * we will enter a second copy of the tuple into the cache. The
- * first copy will never be referenced again, and will eventually
- * age out of the cache, so there's no functional problem. This case
- * is rare enough that it's not worth expending extra cycles to detect.
+ * NOTE: it is possible for recursive cache lookups to occur while
+ * reading the relation --- for example, due to shared-cache-inval
+ * messages being processed during heap_open(). This is OK. It's
+ * even possible for one of those lookups to find and enter the very
+ * same tuple we are trying to fetch here. If that happens, we will
+ * enter a second copy of the tuple into the cache. The first copy
+ * will never be referenced again, and will eventually age out of the
+ * cache, so there's no functional problem. This case is rare enough
+ * that it's not worth expending extra cycles to detect.
*
*/
/*
- * open the relation associated with the cache
+ * open the relation associated with the cache
*
*/
relation = heap_openr(cache->cc_relname, AccessShareLock);
/*
- * Scan the relation to find the tuple. If there's an index, and
- * if it's safe to do so, use the index. Else do a heap scan.
+ * Scan the relation to find the tuple. If there's an index, and if
+ * it's safe to do so, use the index. Else do a heap scan.
*
*/
ct = NULL;
@@ -891,13 +892,13 @@ SearchCatCache(CatCache *cache,
cache->cc_relname);
/*
- * For an index scan, sk_attno has to be set to the index attribute
- * number(s), not the heap attribute numbers. We assume that the
- * index corresponds exactly to the cache keys (or its first N
- * keys do, anyway).
+ * For an index scan, sk_attno has to be set to the index
+ * attribute number(s), not the heap attribute numbers. We assume
+ * that the index corresponds exactly to the cache keys (or its
+ * first N keys do, anyway).
*/
for (i = 0; i < cache->cc_nkeys; ++i)
- cur_skey[i].sk_attno = i+1;
+ cur_skey[i].sk_attno = i + 1;
idesc = index_openr(cache->cc_indname);
isd = index_beginscan(idesc, false, cache->cc_nkeys, cur_skey);
@@ -948,21 +949,21 @@ SearchCatCache(CatCache *cache,
}
/*
- * close the relation
+ * close the relation
*
*/
heap_close(relation, AccessShareLock);
/*
- * scan is complete. if tup was found, we can add it to the cache.
+ * scan is complete. if tup was found, we can add it to the cache.
*
*/
if (ct == NULL)
return NULL;
/*
- * Finish initializing the CatCTup header, and add it to the
- * linked lists.
+ * Finish initializing the CatCTup header, and add it to the linked
+ * lists.
*
*/
CACHE1_elog(DEBUG, "SearchCatCache: found tuple");
@@ -977,8 +978,8 @@ SearchCatCache(CatCache *cache,
DLAddHead(&cache->cc_cache[hash], &ct->cache_elem);
/*
- * If we've exceeded the desired size of this cache,
- * try to throw away the least recently used entry.
+ * If we've exceeded the desired size of this cache, try to throw away
+ * the least recently used entry.
*
*/
if (++cache->cc_ntup > cache->cc_maxtup)
@@ -1022,7 +1023,7 @@ SearchCatCache(CatCache *cache,
void
ReleaseCatCache(HeapTuple tuple)
{
- CatCTup *ct = (CatCTup *) (((char *) tuple) -
+ CatCTup *ct = (CatCTup *) (((char *) tuple) -
offsetof(CatCTup, tuple));
/* Safety checks to ensure we were handed a cache entry */
@@ -1038,9 +1039,9 @@ ReleaseCatCache(HeapTuple tuple)
)
{
/* We can find the associated cache using the dllist pointers */
- Dllist *lru = DLGetListHdr(&ct->lrulist_elem);
- CatCache *cache = (CatCache *) (((char *) lru) -
- offsetof(CatCache, cc_lrulist));
+ Dllist *lru = DLGetListHdr(&ct->lrulist_elem);
+ CatCache *cache = (CatCache *) (((char *) lru) -
+ offsetof(CatCache, cc_lrulist));
CatCacheRemoveCTup(cache, ct);
}
@@ -1061,7 +1062,7 @@ ReleaseCatCache(HeapTuple tuple)
* the specified relation, find all catcaches it could be in, compute the
* correct hashindex for each such catcache, and call the specified function
* to record the cache id, hashindex, and tuple ItemPointer in inval.c's
- * lists. CatalogCacheIdInvalidate will be called later, if appropriate,
+ * lists. CatalogCacheIdInvalidate will be called later, if appropriate,
* using the recorded information.
*
* Note that it is irrelevant whether the given tuple is actually loaded
@@ -1082,7 +1083,7 @@ PrepareToInvalidateCacheTuple(Relation relation,
CatCache *ccp;
/*
- * sanity checks
+ * sanity checks
*
*/
Assert(RelationIsValid(relation));
diff --git a/src/backend/utils/cache/fcache.c b/src/backend/utils/cache/fcache.c
index 8c246a1a9fd..91bea5cfc71 100644
--- a/src/backend/utils/cache/fcache.c
+++ b/src/backend/utils/cache/fcache.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.38 2001/01/24 19:43:14 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.39 2001/03/22 03:59:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -45,7 +45,10 @@ init_fcache(Oid foid, int nargs, MemoryContext fcacheCxt)
if (nargs > FUNC_MAX_ARGS)
elog(ERROR, "init_fcache: too many arguments");
- /* If function returns set, prepare a resultinfo node for communication */
+ /*
+ * If function returns set, prepare a resultinfo node for
+ * communication
+ */
if (retval->func.fn_retset)
{
retval->fcinfo.resultinfo = (Node *) &(retval->rsinfo);
diff --git a/src/backend/utils/cache/inval.c b/src/backend/utils/cache/inval.c
index 8d15188aaf0..bb3c2822232 100644
--- a/src/backend/utils/cache/inval.c
+++ b/src/backend/utils/cache/inval.c
@@ -25,7 +25,7 @@
* so that they can flush obsolete entries from their caches.
*
* We do not need to register EVERY tuple operation in this way, just those
- * on tuples in relations that have associated catcaches. Also, whenever
+ * on tuples in relations that have associated catcaches. Also, whenever
* we see an operation on a pg_class or pg_attribute tuple, we register
* a relcache flush operation for the relation described by that tuple.
*
@@ -34,7 +34,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.41 2001/02/22 18:39:19 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.42 2001/03/22 03:59:57 momjian Exp $
*
* Note - this code is real crufty... badly needs a rewrite to improve
* readability and portability. (Shouldn't assume Oid == Index, for example)
@@ -136,8 +136,8 @@ static LocalInvalid RollbackStack = EmptyLocalInvalid;
static InvalidationEntry InvalidationEntryAllocate(uint16 size);
static void LocalInvalidInvalidate(LocalInvalid invalid,
- void (*function) (InvalidationMessage),
- bool freemember);
+ void (*function) (InvalidationMessage),
+ bool freemember);
static LocalInvalid LocalInvalidRegister(LocalInvalid invalid,
InvalidationEntry entry);
static void DiscardInvalidStack(LocalInvalid *invalid);
@@ -269,14 +269,14 @@ CacheIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid,
InvalidationMessage message;
/*
- * debugging stuff
+ * debugging stuff
*
*/
CacheIdRegisterSpecifiedLocalInvalid_DEBUG1;
/*
- * create a message describing the system catalog tuple
- * we wish to invalidate.
+ * create a message describing the system catalog tuple we wish to
+ * invalidate.
*
*/
message = (InvalidationMessage)
@@ -289,7 +289,7 @@ CacheIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid,
ItemPointerCopy(pointer, &message->any.catalog.pointerData);
/*
- * Add message to linked list of unprocessed messages.
+ * Add message to linked list of unprocessed messages.
*
*/
invalid = LocalInvalidRegister(invalid, (InvalidationEntry) message);
@@ -305,20 +305,22 @@ CacheIdRegisterLocalInvalid(int cacheId,
Index hashIndex,
ItemPointer pointer)
{
+
/*
- * debugging stuff
+ * debugging stuff
*
*/
CacheIdRegisterLocalInvalid_DEBUG1;
/*
- * Add message to InvalidForall linked list.
+ * Add message to InvalidForall linked list.
*
*/
InvalidForall = CacheIdRegisterSpecifiedLocalInvalid(InvalidForall,
cacheId, hashIndex, pointer);
+
/*
- * Add message to InvalidLocal linked list.
+ * Add message to InvalidLocal linked list.
*
*/
InvalidLocal = CacheIdRegisterSpecifiedLocalInvalid(InvalidLocal,
@@ -336,13 +338,13 @@ CacheIdRegisterLocalRollback(int cacheId,
{
/*
- * debugging stuff
+ * debugging stuff
*
*/
CacheIdRegisterLocalRollback_DEBUG1;
/*
- * Add message to RollbackStack linked list.
+ * Add message to RollbackStack linked list.
*
*/
RollbackStack = CacheIdRegisterSpecifiedLocalInvalid(
@@ -360,7 +362,7 @@ RelationIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid,
InvalidationMessage message;
/*
- * debugging stuff
+ * debugging stuff
*
*/
#ifdef INVALIDDEBUG
@@ -369,8 +371,8 @@ RelationIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid,
#endif /* defined(INVALIDDEBUG) */
/*
- * create a message describing the relation descriptor
- * we wish to invalidate.
+ * create a message describing the relation descriptor we wish to
+ * invalidate.
*
*/
message = (InvalidationMessage)
@@ -381,7 +383,7 @@ RelationIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid,
message->any.relation.objectId = objectId;
/*
- * Add message to linked list of unprocessed messages.
+ * Add message to linked list of unprocessed messages.
*
*/
invalid = LocalInvalidRegister(invalid, (InvalidationEntry) message);
@@ -395,8 +397,9 @@ RelationIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid,
static void
RelationIdRegisterLocalInvalid(Oid relationId, Oid objectId)
{
+
/*
- * debugging stuff
+ * debugging stuff
*
*/
#ifdef INVALIDDEBUG
@@ -405,13 +408,14 @@ RelationIdRegisterLocalInvalid(Oid relationId, Oid objectId)
#endif /* defined(INVALIDDEBUG) */
/*
- * Add message to InvalidForall linked list.
+ * Add message to InvalidForall linked list.
*
*/
InvalidForall = RelationIdRegisterSpecifiedLocalInvalid(InvalidForall,
relationId, objectId);
+
/*
- * Add message to InvalidLocal linked list.
+ * Add message to InvalidLocal linked list.
*
*/
InvalidLocal = RelationIdRegisterSpecifiedLocalInvalid(InvalidLocal,
@@ -427,7 +431,7 @@ RelationIdRegisterLocalRollback(Oid relationId, Oid objectId)
{
/*
- * debugging stuff
+ * debugging stuff
*
*/
#ifdef INVALIDDEBUG
@@ -436,7 +440,7 @@ RelationIdRegisterLocalRollback(Oid relationId, Oid objectId)
#endif /* defined(INVALIDDEBUG) */
/*
- * Add message to RollbackStack linked list.
+ * Add message to RollbackStack linked list.
*
*/
RollbackStack = RelationIdRegisterSpecifiedLocalInvalid(
@@ -464,9 +468,10 @@ CacheIdInvalidate(Index cacheId,
Index hashIndex,
ItemPointer pointer)
{
+
/*
- * assume that if the item pointer is valid, then we are
- * invalidating an item in the specified system catalog cache.
+ * assume that if the item pointer is valid, then we are invalidating
+ * an item in the specified system catalog cache.
*
*/
if (ItemPointerIsValid(pointer))
@@ -478,8 +483,8 @@ CacheIdInvalidate(Index cacheId,
CacheIdInvalidate_DEBUG1;
/*
- * if the cacheId is the oid of any of the following system relations,
- * then assume we are invalidating a relation descriptor
+ * if the cacheId is the oid of any of the following system relations,
+ * then assume we are invalidating a relation descriptor
*
*/
if (cacheId == RelOid_pg_class)
@@ -495,7 +500,7 @@ CacheIdInvalidate(Index cacheId,
}
/*
- * Yow! the caller asked us to invalidate something else.
+ * Yow! the caller asked us to invalidate something else.
*
*/
elog(FATAL, "CacheIdInvalidate: cacheId=%d relation id?", cacheId);
@@ -630,13 +635,13 @@ PrepareToInvalidateRelationCache(Relation relation,
Oid objectId;
/*
- * get the relation object id
+ * get the relation object id
*
*/
relationId = RelationGetRelid(relation);
/*
- * is it one of the ones we need to send an SI message for?
+ * is it one of the ones we need to send an SI message for?
*
*/
if (relationId == RelOid_pg_class)
@@ -647,7 +652,7 @@ PrepareToInvalidateRelationCache(Relation relation,
return;
/*
- * register the relcache-invalidation action in the appropriate list
+ * register the relcache-invalidation action in the appropriate list
*
*/
Assert(PointerIsValid(function));
@@ -666,8 +671,9 @@ PrepareToInvalidateRelationCache(Relation relation,
void
DiscardInvalid(void)
{
+
/*
- * debugging stuff
+ * debugging stuff
*
*/
#ifdef INVALIDDEBUG
@@ -690,7 +696,7 @@ RegisterInvalid(bool send)
LocalInvalid invalid;
/*
- * debugging stuff
+ * debugging stuff
*
*/
#ifdef INVALIDDEBUG
@@ -698,7 +704,7 @@ RegisterInvalid(bool send)
#endif /* defined(INVALIDDEBUG) */
/*
- * Process and free the current list of inval messages.
+ * Process and free the current list of inval messages.
*
*/
@@ -734,7 +740,7 @@ ImmediateLocalInvalidation(bool send)
LocalInvalid invalid;
/*
- * debugging stuff
+ * debugging stuff
*
*/
#ifdef INVALIDDEBUG
@@ -742,7 +748,7 @@ ImmediateLocalInvalidation(bool send)
#endif /* defined(INVALIDDEBUG) */
/*
- * Process and free the local list of inval messages.
+ * Process and free the local list of inval messages.
*
*/
@@ -792,8 +798,9 @@ PrepareForTupleInvalidation(Relation relation, HeapTuple tuple,
void (*RelationIdRegisterFunc) (Oid, Oid),
const char *funcname)
{
+
/*
- * sanity checks
+ * sanity checks
*
*/
Assert(RelationIsValid(relation));
@@ -803,16 +810,16 @@ PrepareForTupleInvalidation(Relation relation, HeapTuple tuple,
return;
/*
- * We only need to worry about invalidation for tuples that are in
- * system relations; user-relation tuples are never in catcaches
- * and can't affect the relcache either.
+ * We only need to worry about invalidation for tuples that are in
+ * system relations; user-relation tuples are never in catcaches and
+ * can't affect the relcache either.
*
*/
if (!IsSystemRelationName(NameStr(RelationGetForm(relation)->relname)))
return;
/*
- * debugging stuff
+ * debugging stuff
*
*/
PrepareForTupleInvalidation_DEBUG1;
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c
index 4e04cfea7c4..4882094bee1 100644
--- a/src/backend/utils/cache/lsyscache.c
+++ b/src/backend/utils/cache/lsyscache.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.50 2001/01/24 19:43:15 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.51 2001/03/22 03:59:57 momjian Exp $
*
* NOTES
* Eventually, the index information should go through here, too.
@@ -62,7 +62,7 @@ get_attname(Oid relid, AttrNumber attnum)
if (HeapTupleIsValid(tp))
{
Form_pg_attribute att_tup = (Form_pg_attribute) GETSTRUCT(tp);
- char *result;
+ char *result;
result = pstrdup(NameStr(att_tup->attname));
ReleaseSysCache(tp);
@@ -118,7 +118,7 @@ get_atttype(Oid relid, AttrNumber attnum)
if (HeapTupleIsValid(tp))
{
Form_pg_attribute att_tup = (Form_pg_attribute) GETSTRUCT(tp);
- Oid result;
+ Oid result;
result = att_tup->atttypid;
ReleaseSysCache(tp);
@@ -144,7 +144,7 @@ get_attisset(Oid relid, char *attname)
if (HeapTupleIsValid(tp))
{
Form_pg_attribute att_tup = (Form_pg_attribute) GETSTRUCT(tp);
- bool result;
+ bool result;
result = att_tup->attisset;
ReleaseSysCache(tp);
@@ -172,7 +172,7 @@ get_atttypmod(Oid relid, AttrNumber attnum)
if (HeapTupleIsValid(tp))
{
Form_pg_attribute att_tup = (Form_pg_attribute) GETSTRUCT(tp);
- int32 result;
+ int32 result;
result = att_tup->atttypmod;
ReleaseSysCache(tp);
@@ -306,7 +306,7 @@ get_opcode(Oid opno)
if (HeapTupleIsValid(tp))
{
Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
- RegProcedure result;
+ RegProcedure result;
result = optup->oprcode;
ReleaseSysCache(tp);
@@ -333,7 +333,7 @@ get_opname(Oid opno)
if (HeapTupleIsValid(tp))
{
Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
- char *result;
+ char *result;
result = pstrdup(NameStr(optup->oprname));
ReleaseSysCache(tp);
@@ -412,7 +412,7 @@ op_hashjoinable(Oid opno, Oid ltype, Oid rtype)
bool
op_iscachable(Oid opno)
{
- RegProcedure funcid = get_opcode(opno);
+ RegProcedure funcid = get_opcode(opno);
if (funcid == (RegProcedure) InvalidOid)
elog(ERROR, "Operator OID %u does not exist", opno);
@@ -436,7 +436,7 @@ get_commutator(Oid opno)
if (HeapTupleIsValid(tp))
{
Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
- Oid result;
+ Oid result;
result = optup->oprcom;
ReleaseSysCache(tp);
@@ -462,7 +462,7 @@ get_negator(Oid opno)
if (HeapTupleIsValid(tp))
{
Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
- Oid result;
+ Oid result;
result = optup->oprnegate;
ReleaseSysCache(tp);
@@ -488,7 +488,7 @@ get_oprrest(Oid opno)
if (HeapTupleIsValid(tp))
{
Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
- RegProcedure result;
+ RegProcedure result;
result = optup->oprrest;
ReleaseSysCache(tp);
@@ -514,7 +514,7 @@ get_oprjoin(Oid opno)
if (HeapTupleIsValid(tp))
{
Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
- RegProcedure result;
+ RegProcedure result;
result = optup->oprjoin;
ReleaseSysCache(tp);
@@ -587,7 +587,7 @@ get_relnatts(Oid relid)
if (HeapTupleIsValid(tp))
{
Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp);
- int result;
+ int result;
result = reltup->relnatts;
ReleaseSysCache(tp);
@@ -596,6 +596,7 @@ get_relnatts(Oid relid)
else
return InvalidAttrNumber;
}
+
#endif
/*
@@ -616,7 +617,7 @@ get_rel_name(Oid relid)
if (HeapTupleIsValid(tp))
{
Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp);
- char *result;
+ char *result;
result = pstrdup(NameStr(reltup->relname));
ReleaseSysCache(tp);
@@ -644,7 +645,7 @@ get_typlen(Oid typid)
if (HeapTupleIsValid(tp))
{
Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
- int16 result;
+ int16 result;
result = typtup->typlen;
ReleaseSysCache(tp);
@@ -671,7 +672,7 @@ get_typbyval(Oid typid)
if (HeapTupleIsValid(tp))
{
Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
- bool result;
+ bool result;
result = typtup->typbyval;
ReleaseSysCache(tp);
@@ -687,7 +688,7 @@ get_typbyval(Oid typid)
* A two-fer: given the type OID, return both typlen and typbyval.
*
* Since both pieces of info are needed to know how to copy a Datum,
- * many places need both. Might as well get them with one cache lookup
+ * many places need both. Might as well get them with one cache lookup
* instead of two. Also, this routine raises an error instead of
* returning a bogus value when given a bad type OID.
*/
@@ -720,7 +721,7 @@ get_typalign(Oid typid)
if (HeapTupleIsValid(tp))
{
Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
- char result;
+ char result;
result = typtup->typalign;
ReleaseSysCache(tp);
@@ -743,7 +744,7 @@ get_typstorage(Oid typid)
if (HeapTupleIsValid(tp))
{
Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
- char result;
+ char result;
result = typtup->typstorage;
ReleaseSysCache(tp);
@@ -864,7 +865,7 @@ get_typtype(Oid typid)
if (HeapTupleIsValid(tp))
{
Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
- char result;
+ char result;
result = typtup->typtype;
ReleaseSysCache(tp);
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index a2a539f5abf..fc97f46910a 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.128 2001/02/22 18:39:19 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.129 2001/03/22 03:59:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -135,7 +135,7 @@ typedef struct relidcacheent
typedef struct relnodecacheent
{
- RelFileNode relnode;
+ RelFileNode relnode;
Relation reldesc;
} RelNodeCacheEnt;
@@ -250,9 +250,11 @@ do { \
/* non-export function prototypes */
static void RelationClearRelation(Relation relation, bool rebuildIt);
+
#ifdef ENABLE_REINDEX_NAILED_RELATIONS
static void RelationReloadClassinfo(Relation relation);
-#endif /* ENABLE_REINDEX_NAILED_RELATIONS */
+
+#endif /* ENABLE_REINDEX_NAILED_RELATIONS */
static void RelationFlushRelation(Relation relation);
static Relation RelationNameCacheGetRelation(const char *relationName);
static void RelationCacheInvalidateWalker(Relation *relationPtr, Datum listp);
@@ -326,7 +328,7 @@ scan_pg_rel_seq(RelationBuildDescInfo buildinfo)
ScanKeyData key;
/*
- * form a scan key
+ * form a scan key
*
*/
switch (buildinfo.infotype)
@@ -351,7 +353,7 @@ scan_pg_rel_seq(RelationBuildDescInfo buildinfo)
}
/*
- * open pg_class and fetch a tuple
+ * open pg_class and fetch a tuple
*
*/
pg_class_desc = heap_openr(RelationRelationName, AccessShareLock);
@@ -359,18 +361,19 @@ scan_pg_rel_seq(RelationBuildDescInfo buildinfo)
pg_class_tuple = heap_getnext(pg_class_scan, 0);
/*
- * get set to return tuple
+ * get set to return tuple
*
*/
if (!HeapTupleIsValid(pg_class_tuple))
return_tuple = pg_class_tuple;
else
{
+
/*
- * a satanic bug used to live here: pg_class_tuple used to be
- * returned here without having the corresponding buffer pinned.
- * so when the buffer gets replaced, all hell breaks loose.
- * this bug is discovered and killed by wei on 9/27/91.
+ * a satanic bug used to live here: pg_class_tuple used to be
+ * returned here without having the corresponding buffer pinned.
+ * so when the buffer gets replaced, all hell breaks loose. this
+ * bug is discovered and killed by wei on 9/27/91.
*
*/
return_tuple = heap_copytuple(pg_class_tuple);
@@ -390,9 +393,10 @@ scan_pg_rel_ind(RelationBuildDescInfo buildinfo)
HeapTuple return_tuple;
pg_class_desc = heap_openr(RelationRelationName, AccessShareLock);
+
/*
- * If the indexes of pg_class are deactivated
- * we have to call scan_pg_rel_seq() instead.
+ * If the indexes of pg_class are deactivated we have to call
+ * scan_pg_rel_seq() instead.
*/
if (!pg_class_desc->rd_rel->relhasindex)
{
@@ -404,12 +408,12 @@ scan_pg_rel_ind(RelationBuildDescInfo buildinfo)
{
case INFO_RELID:
return_tuple = ClassOidIndexScan(pg_class_desc,
- ObjectIdGetDatum(buildinfo.i.info_id));
+ ObjectIdGetDatum(buildinfo.i.info_id));
break;
case INFO_RELNAME:
return_tuple = ClassNameIndexScan(pg_class_desc,
- PointerGetDatum(buildinfo.i.info_name));
+ PointerGetDatum(buildinfo.i.info_name));
break;
default:
@@ -445,14 +449,14 @@ AllocateRelationDesc(Relation relation, Form_pg_class relp)
oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
/*
- * allocate space for new relation descriptor, if needed
+ * allocate space for new relation descriptor, if needed
*
*/
if (relation == NULL)
relation = (Relation) palloc(sizeof(RelationData));
/*
- * clear all fields of reldesc
+ * clear all fields of reldesc
*
*/
MemSet((char *) relation, 0, sizeof(RelationData));
@@ -461,14 +465,14 @@ AllocateRelationDesc(Relation relation, Form_pg_class relp)
relation->rd_fd = -1;
/*
- * Copy the relation tuple form
+ * Copy the relation tuple form
*
- * We only allocate space for the fixed fields, ie, CLASS_TUPLE_SIZE.
- * relacl is NOT stored in the relcache --- there'd be little point
- * in it, since we don't copy the tuple's nullvalues bitmap and hence
- * wouldn't know if the value is valid ... bottom line is that relacl
- * *cannot* be retrieved from the relcache. Get it from the syscache
- * if you need it.
+ * We only allocate space for the fixed fields, ie, CLASS_TUPLE_SIZE.
+ * relacl is NOT stored in the relcache --- there'd be little point in
+ * it, since we don't copy the tuple's nullvalues bitmap and hence
+ * wouldn't know if the value is valid ... bottom line is that relacl
+ * *cannot* be retrieved from the relcache. Get it from the syscache
+ * if you need it.
*
*/
relationForm = (Form_pg_class) palloc(CLASS_TUPLE_SIZE);
@@ -538,7 +542,7 @@ SetConstrOfRelation(Relation relation,
constr->num_check = relation->rd_rel->relchecks;
constr->check = (ConstrCheck *)
MemoryContextAlloc(CacheMemoryContext,
- constr->num_check * sizeof(ConstrCheck));
+ constr->num_check * sizeof(ConstrCheck));
MemSet(constr->check, 0, constr->num_check * sizeof(ConstrCheck));
RelCheckFetch(relation);
}
@@ -571,7 +575,7 @@ build_tupdesc_seq(RelationBuildDescInfo buildinfo,
constr->has_not_null = false;
/*
- * form a scan key
+ * form a scan key
*
*/
ScanKeyEntryInitialize(&key, 0,
@@ -580,14 +584,14 @@ build_tupdesc_seq(RelationBuildDescInfo buildinfo,
ObjectIdGetDatum(RelationGetRelid(relation)));
/*
- * open pg_attribute and begin a scan
+ * open pg_attribute and begin a scan
*
*/
pg_attribute_desc = heap_openr(AttributeRelationName, AccessShareLock);
pg_attribute_scan = heap_beginscan(pg_attribute_desc, 0, SnapshotNow, 1, &key);
/*
- * add attribute data to relation->rd_att
+ * add attribute data to relation->rd_att
*
*/
need = relation->rd_rel->relnatts;
@@ -601,7 +605,7 @@ build_tupdesc_seq(RelationBuildDescInfo buildinfo,
{
relation->rd_att->attrs[attp->attnum - 1] =
(Form_pg_attribute) MemoryContextAlloc(CacheMemoryContext,
- ATTRIBUTE_TUPLE_SIZE);
+ ATTRIBUTE_TUPLE_SIZE);
memcpy((char *) (relation->rd_att->attrs[attp->attnum - 1]),
(char *) attp,
@@ -621,7 +625,7 @@ build_tupdesc_seq(RelationBuildDescInfo buildinfo,
relation->rd_rel->relnatts *
sizeof(AttrDefault));
MemSet(attrdef, 0,
- relation->rd_rel->relnatts * sizeof(AttrDefault));
+ relation->rd_rel->relnatts * sizeof(AttrDefault));
}
attrdef[ndef].adnum = attp->attnum;
attrdef[ndef].adbin = NULL;
@@ -636,34 +640,32 @@ build_tupdesc_seq(RelationBuildDescInfo buildinfo,
need, (need == 1 ? "" : "s"), RelationGetRelid(relation));
/*
- * end the scan and close the attribute relation
+ * end the scan and close the attribute relation
*
*/
heap_endscan(pg_attribute_scan);
heap_close(pg_attribute_desc, AccessShareLock);
/*
- * The attcacheoff values we read from pg_attribute should all be -1
- * ("unknown"). Verify this if assert checking is on. They will be
- * computed when and if needed during tuple access.
+ * The attcacheoff values we read from pg_attribute should all be -1
+ * ("unknown"). Verify this if assert checking is on. They will be
+ * computed when and if needed during tuple access.
*
*/
#ifdef USE_ASSERT_CHECKING
{
- int i;
+ int i;
for (i = 0; i < relation->rd_rel->relnatts; i++)
- {
Assert(relation->rd_att->attrs[i]->attcacheoff == -1);
- }
}
#endif
/*
- * However, we can easily set the attcacheoff value for the first
- * attribute: it must be zero. This eliminates the need for special
- * cases for attnum=1 that used to exist in fastgetattr() and
- * index_getattr().
+ * However, we can easily set the attcacheoff value for the first
+ * attribute: it must be zero. This eliminates the need for special
+ * cases for attnum=1 that used to exist in fastgetattr() and
+ * index_getattr().
*
*/
relation->rd_att->attrs[0]->attcacheoff = 0;
@@ -693,18 +695,19 @@ build_tupdesc_ind(RelationBuildDescInfo buildinfo,
{
#ifdef _DROP_COLUMN_HACK__
bool columnDropped = false;
+
#endif /* _DROP_COLUMN_HACK__ */
atttup = AttributeRelidNumIndexScan(attrel,
- ObjectIdGetDatum(RelationGetRelid(relation)),
+ ObjectIdGetDatum(RelationGetRelid(relation)),
Int32GetDatum(i));
if (!HeapTupleIsValid(atttup))
{
#ifdef _DROP_COLUMN_HACK__
atttup = AttributeRelidNumIndexScan(attrel,
- ObjectIdGetDatum(RelationGetRelid(relation)),
- Int32GetDatum(DROPPED_COLUMN_INDEX(i)));
+ ObjectIdGetDatum(RelationGetRelid(relation)),
+ Int32GetDatum(DROPPED_COLUMN_INDEX(i)));
if (!HeapTupleIsValid(atttup))
#endif /* _DROP_COLUMN_HACK__ */
elog(ERROR, "cannot find attribute %d of relation %s", i,
@@ -754,23 +757,21 @@ build_tupdesc_ind(RelationBuildDescInfo buildinfo,
heap_close(attrel, AccessShareLock);
/*
- * The attcacheoff values we read from pg_attribute should all be -1
- * ("unknown"). Verify this if assert checking is on. They will be
- * computed when and if needed during tuple access.
+ * The attcacheoff values we read from pg_attribute should all be -1
+ * ("unknown"). Verify this if assert checking is on. They will be
+ * computed when and if needed during tuple access.
*
*/
#ifdef USE_ASSERT_CHECKING
for (i = 0; i < relation->rd_rel->relnatts; i++)
- {
Assert(relation->rd_att->attrs[i]->attcacheoff == -1);
- }
#endif
/*
- * However, we can easily set the attcacheoff value for the first
- * attribute: it must be zero. This eliminates the need for special
- * cases for attnum=1 that used to exist in fastgetattr() and
- * index_getattr().
+ * However, we can easily set the attcacheoff value for the first
+ * attribute: it must be zero. This eliminates the need for special
+ * cases for attnum=1 that used to exist in fastgetattr() and
+ * index_getattr().
*
*/
relation->rd_att->attrs[0]->attcacheoff = 0;
@@ -790,7 +791,7 @@ build_tupdesc_ind(RelationBuildDescInfo buildinfo,
* each relcache entry that has associated rules. The context is used
* just for rule info, not for any other subsidiary data of the relcache
* entry, because that keeps the update logic in RelationClearRelation()
- * manageable. The other subsidiary data structures are simple enough
+ * manageable. The other subsidiary data structures are simple enough
* to be easy to free explicitly, anyway.
*
*/
@@ -815,14 +816,14 @@ RelationBuildRuleLock(Relation relation)
*/
rulescxt = AllocSetContextCreate(CacheMemoryContext,
RelationGetRelationName(relation),
- 0, /* minsize */
- 1024, /* initsize */
- 1024); /* maxsize */
+ 0, /* minsize */
+ 1024, /* initsize */
+ 1024); /* maxsize */
relation->rd_rulescxt = rulescxt;
/*
- * form an array to hold the rewrite rules (the array is extended if
- * necessary)
+ * form an array to hold the rewrite rules (the array is extended if
+ * necessary)
*
*/
maxlocks = 4;
@@ -831,7 +832,7 @@ RelationBuildRuleLock(Relation relation)
numlocks = 0;
/*
- * form a scan key
+ * form a scan key
*
*/
ScanKeyEntryInitialize(&key, 0,
@@ -840,7 +841,7 @@ RelationBuildRuleLock(Relation relation)
ObjectIdGetDatum(RelationGetRelid(relation)));
/*
- * open pg_rewrite and begin a scan
+ * open pg_rewrite and begin a scan
*
*/
pg_rewrite_desc = heap_openr(RewriteRelationName, AccessShareLock);
@@ -870,7 +871,7 @@ RelationBuildRuleLock(Relation relation)
pg_rewrite_tupdesc,
&isnull));
rule->isInstead = DatumGetBool(heap_getattr(pg_rewrite_tuple,
- Anum_pg_rewrite_is_instead,
+ Anum_pg_rewrite_is_instead,
pg_rewrite_tupdesc,
&isnull));
@@ -878,7 +879,7 @@ RelationBuildRuleLock(Relation relation)
Anum_pg_rewrite_ev_action,
pg_rewrite_tupdesc,
&isnull);
- Assert(! isnull);
+ Assert(!isnull);
ruleaction_str = DatumGetCString(DirectFunctionCall1(textout,
ruleaction));
oldcxt = MemoryContextSwitchTo(rulescxt);
@@ -890,9 +891,9 @@ RelationBuildRuleLock(Relation relation)
Anum_pg_rewrite_ev_qual,
pg_rewrite_tupdesc,
&isnull);
- Assert(! isnull);
+ Assert(!isnull);
rule_evqual_str = DatumGetCString(DirectFunctionCall1(textout,
- rule_evqual));
+ rule_evqual));
oldcxt = MemoryContextSwitchTo(rulescxt);
rule->qual = (Node *) stringToNode(rule_evqual_str);
MemoryContextSwitchTo(oldcxt);
@@ -908,14 +909,14 @@ RelationBuildRuleLock(Relation relation)
}
/*
- * end the scan and close the attribute relation
+ * end the scan and close the attribute relation
*
*/
heap_endscan(pg_rewrite_scan);
heap_close(pg_rewrite_desc, AccessShareLock);
/*
- * form a RuleLock and insert into relation
+ * form a RuleLock and insert into relation
*
*/
rulelock = (RuleLock *) MemoryContextAlloc(rulescxt, sizeof(RuleLock));
@@ -1022,58 +1023,58 @@ RelationBuildDesc(RelationBuildDescInfo buildinfo,
MemoryContext oldcxt;
/*
- * find the tuple in pg_class corresponding to the given relation id
+ * find the tuple in pg_class corresponding to the given relation id
*
*/
pg_class_tuple = ScanPgRelation(buildinfo);
/*
- * if no such tuple exists, return NULL
+ * if no such tuple exists, return NULL
*
*/
if (!HeapTupleIsValid(pg_class_tuple))
return NULL;
/*
- * get information from the pg_class_tuple
+ * get information from the pg_class_tuple
*
*/
relid = pg_class_tuple->t_data->t_oid;
relp = (Form_pg_class) GETSTRUCT(pg_class_tuple);
/*
- * allocate storage for the relation descriptor,
- * and copy pg_class_tuple to relation->rd_rel.
+ * allocate storage for the relation descriptor, and copy
+ * pg_class_tuple to relation->rd_rel.
*
*/
relation = AllocateRelationDesc(oldrelation, relp);
/*
- * now we can free the memory allocated for pg_class_tuple
+ * now we can free the memory allocated for pg_class_tuple
*
*/
heap_freetuple(pg_class_tuple);
/*
- * initialize the relation's relation id (relation->rd_id)
+ * initialize the relation's relation id (relation->rd_id)
*
*/
RelationGetRelid(relation) = relid;
/*
- * initialize relation->rd_refcnt
+ * initialize relation->rd_refcnt
*
*/
RelationSetReferenceCount(relation, 1);
/*
- * normal relations are not nailed into the cache
+ * normal relations are not nailed into the cache
*
*/
relation->rd_isnailed = false;
/*
- * initialize the access method information (relation->rd_am)
+ * initialize the access method information (relation->rd_am)
*
*/
relam = relation->rd_rel->relam;
@@ -1082,13 +1083,13 @@ RelationBuildDesc(RelationBuildDescInfo buildinfo,
CacheMemoryContext);
/*
- * initialize the tuple descriptor (relation->rd_att).
+ * initialize the tuple descriptor (relation->rd_att).
*
*/
RelationBuildTupleDesc(buildinfo, relation);
/*
- * Fetch rules and triggers that affect this relation
+ * Fetch rules and triggers that affect this relation
*
*/
if (relation->rd_rel->relhasrules)
@@ -1105,14 +1106,14 @@ RelationBuildDesc(RelationBuildDescInfo buildinfo,
relation->trigdesc = NULL;
/*
- * initialize index strategy and support information for this relation
+ * initialize index strategy and support information for this relation
*
*/
if (OidIsValid(relam))
IndexedAccessMethodInitialize(relation);
/*
- * initialize the relation lock manager information
+ * initialize the relation lock manager information
*
*/
RelationInitLockInfo(relation); /* see lmgr.c */
@@ -1124,8 +1125,8 @@ RelationBuildDesc(RelationBuildDescInfo buildinfo,
relation->rd_node.relNode = relation->rd_rel->relfilenode;
/*
- * open the relation and assign the file descriptor returned
- * by the storage manager code to rd_fd.
+ * open the relation and assign the file descriptor returned by the
+ * storage manager code to rd_fd.
*
*/
if (relation->rd_rel->relkind != RELKIND_VIEW)
@@ -1134,8 +1135,8 @@ RelationBuildDesc(RelationBuildDescInfo buildinfo,
relation->rd_fd = -1;
/*
- * insert newly created relation into proper relcaches,
- * restore memory context and return the new reldesc.
+ * insert newly created relation into proper relcaches, restore memory
+ * context and return the new reldesc.
*
*/
oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
@@ -1203,36 +1204,36 @@ formrdesc(char *relationName,
int i;
/*
- * allocate new relation desc
+ * allocate new relation desc
*
*/
relation = (Relation) palloc(sizeof(RelationData));
MemSet((char *) relation, 0, sizeof(RelationData));
/*
- * don't open the unix file yet..
+ * don't open the unix file yet..
*
*/
relation->rd_fd = -1;
/*
- * initialize reference count
+ * initialize reference count
*
*/
RelationSetReferenceCount(relation, 1);
/*
- * all entries built with this routine are nailed-in-cache
+ * all entries built with this routine are nailed-in-cache
*
*/
relation->rd_isnailed = true;
/*
- * initialize relation tuple form
+ * initialize relation tuple form
*
- * The data we insert here is pretty incomplete/bogus, but it'll
- * serve to get us launched. RelationCacheInitializePhase2() will
- * read the real data from pg_class and replace what we've done here.
+ * The data we insert here is pretty incomplete/bogus, but it'll serve to
+ * get us launched. RelationCacheInitializePhase2() will read the
+ * real data from pg_class and replace what we've done here.
*
*/
relation->rd_rel = (Form_pg_class) palloc(CLASS_TUPLE_SIZE);
@@ -1257,13 +1258,13 @@ formrdesc(char *relationName,
relation->rd_rel->relnatts = (int16) natts;
/*
- * initialize attribute tuple form
+ * initialize attribute tuple form
*
*/
relation->rd_att = CreateTemplateTupleDesc(natts);
/*
- * initialize tuple desc info
+ * initialize tuple desc info
*
*/
for (i = 0; i < natts; i++)
@@ -1275,13 +1276,13 @@ formrdesc(char *relationName,
}
/*
- * initialize relation id
+ * initialize relation id
*
*/
RelationGetRelid(relation) = relation->rd_att->attrs[0]->attrelid;
/*
- * initialize the relation's lock manager and RelFileNode information
+ * initialize the relation's lock manager and RelFileNode information
*
*/
RelationInitLockInfo(relation); /* see lmgr.c */
@@ -1290,11 +1291,11 @@ formrdesc(char *relationName,
relation->rd_node.tblNode = InvalidOid;
else
relation->rd_node.tblNode = MyDatabaseId;
- relation->rd_node.relNode =
+ relation->rd_node.relNode =
relation->rd_rel->relfilenode = RelationGetRelid(relation);
/*
- * initialize the rel-has-index flag, using hardwired knowledge
+ * initialize the rel-has-index flag, using hardwired knowledge
*
*/
relation->rd_rel->relhasindex = false;
@@ -1313,7 +1314,7 @@ formrdesc(char *relationName,
}
/*
- * add new reldesc to relcache
+ * add new reldesc to relcache
*
*/
RelationCacheInsert(relation);
@@ -1336,7 +1337,7 @@ fixrdesc(char *relationName)
Relation relation;
/*
- * find the tuple in pg_class corresponding to the given relation name
+ * find the tuple in pg_class corresponding to the given relation name
*
*/
buildinfo.infotype = INFO_RELNAME;
@@ -1350,7 +1351,7 @@ fixrdesc(char *relationName)
relp = (Form_pg_class) GETSTRUCT(pg_class_tuple);
/*
- * find the pre-made relcache entry (better be there!)
+ * find the pre-made relcache entry (better be there!)
*
*/
relation = RelationNameCacheGetRelation(relationName);
@@ -1359,8 +1360,8 @@ fixrdesc(char *relationName)
relationName);
/*
- * and copy pg_class_tuple to relation->rd_rel.
- * (See notes in AllocateRelationDesc())
+ * and copy pg_class_tuple to relation->rd_rel. (See notes in
+ * AllocateRelationDesc())
*
*/
Assert(relation->rd_rel != NULL);
@@ -1474,14 +1475,14 @@ RelationIdGetRelation(Oid relationId)
RelationBuildDescInfo buildinfo;
/*
- * increment access statistics
+ * increment access statistics
*
*/
IncrHeapAccessStat(local_RelationIdGetRelation);
IncrHeapAccessStat(global_RelationIdGetRelation);
/*
- * first try and get a reldesc from the cache
+ * first try and get a reldesc from the cache
*
*/
rd = RelationIdCacheGetRelation(relationId);
@@ -1489,8 +1490,8 @@ RelationIdGetRelation(Oid relationId)
return rd;
/*
- * no reldesc in the cache, so have RelationBuildDesc()
- * build one and add it.
+ * no reldesc in the cache, so have RelationBuildDesc() build one and
+ * add it.
*
*/
buildinfo.infotype = INFO_RELID;
@@ -1514,15 +1515,15 @@ RelationNameGetRelation(const char *relationName)
RelationBuildDescInfo buildinfo;
/*
- * increment access statistics
+ * increment access statistics
*
*/
IncrHeapAccessStat(local_RelationNameGetRelation);
IncrHeapAccessStat(global_RelationNameGetRelation);
/*
- * if caller is looking for a temp relation, substitute its real name;
- * we only index temp rels by their real names.
+ * if caller is looking for a temp relation, substitute its real name;
+ * we only index temp rels by their real names.
*
*/
temprelname = get_temp_rel_by_username(relationName);
@@ -1530,7 +1531,7 @@ RelationNameGetRelation(const char *relationName)
relationName = temprelname;
/*
- * first try and get a reldesc from the cache
+ * first try and get a reldesc from the cache
*
*/
rd = RelationNameCacheGetRelation(relationName);
@@ -1538,8 +1539,8 @@ RelationNameGetRelation(const char *relationName)
return rd;
/*
- * no reldesc in the cache, so have RelationBuildDesc()
- * build one and add it.
+ * no reldesc in the cache, so have RelationBuildDesc() build one and
+ * add it.
*
*/
buildinfo.infotype = INFO_RELNAME;
@@ -1592,7 +1593,7 @@ RelationReloadClassinfo(Relation relation)
{
RelationBuildDescInfo buildinfo;
HeapTuple pg_class_tuple;
- Form_pg_class relp;
+ Form_pg_class relp;
if (!relation->rd_rel)
return;
@@ -1613,7 +1614,8 @@ RelationReloadClassinfo(Relation relation)
return;
}
-#endif /* ENABLE_REINDEX_NAILED_RELATIONS */
+
+#endif /* ENABLE_REINDEX_NAILED_RELATIONS */
/*
* RelationClearRelation
@@ -1633,7 +1635,7 @@ RelationClearRelation(Relation relation, bool rebuildIt)
/*
* Make sure smgr and lower levels close the relation's files, if they
* weren't closed already. If the relation is not getting deleted,
- * the next smgr access should reopen the files automatically. This
+ * the next smgr access should reopen the files automatically. This
* ensures that the low-level file access state is updated after, say,
* a vacuum truncation.
*/
@@ -1648,7 +1650,7 @@ RelationClearRelation(Relation relation, bool rebuildIt)
{
#ifdef ENABLE_REINDEX_NAILED_RELATIONS
RelationReloadClassinfo(relation);
-#endif /* ENABLE_REINDEX_NAILED_RELATIONS */
+#endif /* ENABLE_REINDEX_NAILED_RELATIONS */
return;
}
@@ -1740,9 +1742,7 @@ RelationClearRelation(Relation relation, bool rebuildIt)
relation->rd_att = old_att;
}
else
- {
FreeTupleDesc(old_att);
- }
if (equalRuleLocks(old_rules, relation->rd_rules))
{
if (relation->rd_rulescxt)
@@ -1761,9 +1761,7 @@ RelationClearRelation(Relation relation, bool rebuildIt)
relation->trigdesc = old_trigdesc;
}
else
- {
FreeTriggerDesc(old_trigdesc);
- }
relation->rd_nblocks = old_nblocks;
/*
@@ -1787,6 +1785,7 @@ RelationFlushRelation(Relation relation)
if (relation->rd_myxactonly)
{
+
/*
* Local rels should always be rebuilt, not flushed; the relcache
* entry must live until RelationPurgeLocalRelation().
@@ -1912,7 +1911,7 @@ RelationFlushIndexes(Relation *r,
* We do this in two phases: the first pass deletes deletable items, and
* the second one rebuilds the rebuildable items. This is essential for
* safety, because HashTableWalk only copes with concurrent deletion of
- * the element it is currently visiting. If a second SI overflow were to
+ * the element it is currently visiting. If a second SI overflow were to
* occur while we are walking the table, resulting in recursive entry to
* this routine, we could crash because the inner invocation blows away
* the entry next to be visited by the outer scan. But this way is OK,
@@ -1923,8 +1922,8 @@ RelationFlushIndexes(Relation *r,
void
RelationCacheInvalidate(void)
{
- List *rebuildList = NIL;
- List *l;
+ List *rebuildList = NIL;
+ List *l;
/* Phase 1 */
HashTableWalk(RelationNameCache,
@@ -1932,7 +1931,7 @@ RelationCacheInvalidate(void)
PointerGetDatum(&rebuildList));
/* Phase 2: rebuild the items found to need rebuild in phase 1 */
- foreach (l, rebuildList)
+ foreach(l, rebuildList)
{
Relation relation = (Relation) lfirst(l);
@@ -1945,7 +1944,7 @@ static void
RelationCacheInvalidateWalker(Relation *relationPtr, Datum listp)
{
Relation relation = *relationPtr;
- List **rebuildList = (List **) DatumGetPointer(listp);
+ List **rebuildList = (List **) DatumGetPointer(listp);
/* We can ignore xact-local relations, since they are never SI targets */
if (relation->rd_myxactonly)
@@ -2070,7 +2069,7 @@ RelationCacheInitialize(void)
HASHCTL ctl;
/*
- * switch to cache memory context
+ * switch to cache memory context
*
*/
if (!CacheMemoryContext)
@@ -2079,7 +2078,7 @@ RelationCacheInitialize(void)
oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
/*
- * create global caches
+ * create global caches
*
*/
MemSet(&ctl, 0, (int) sizeof(ctl));
@@ -2095,14 +2094,14 @@ RelationCacheInitialize(void)
ctl.keysize = sizeof(RelFileNode);
ctl.hash = tag_hash;
RelationNodeCache = hash_create(INITRELCACHESIZE, &ctl,
- HASH_ELEM | HASH_FUNCTION);
+ HASH_ELEM | HASH_FUNCTION);
/*
- * initialize the cache with pre-made relation descriptors
- * for some of the more important system relations. These
- * relations should always be in the cache.
+ * initialize the cache with pre-made relation descriptors for some of
+ * the more important system relations. These relations should always
+ * be in the cache.
*
- * NB: see also the list in RelationCacheInitializePhase2().
+ * NB: see also the list in RelationCacheInitializePhase2().
*
*/
formrdesc(RelationRelationName, Natts_pg_class, Desc_pg_class);
@@ -2113,9 +2112,9 @@ RelationCacheInitialize(void)
formrdesc(LogRelationName, Natts_pg_log, Desc_pg_log);
/*
- * init_irels() used to be called here. It is changed to be called
- * in RelationCacheInitializePhase2() now so that transactional
- * control could guarantee the consistency.
+ * init_irels() used to be called here. It is changed to be called in
+ * RelationCacheInitializePhase2() now so that transactional control
+ * could guarantee the consistency.
*/
MemoryContextSwitchTo(oldcxt);
@@ -2131,21 +2130,25 @@ RelationCacheInitialize(void)
void
RelationCacheInitializePhase2(void)
{
+
/*
* Get the real pg_class tuple for each nailed-in-cache relcache entry
* that was made by RelationCacheInitialize(), and replace the phony
- * rd_rel entry made by formrdesc(). This is necessary so that we have,
- * for example, the correct toast-table info for tables that have such.
+ * rd_rel entry made by formrdesc(). This is necessary so that we
+ * have, for example, the correct toast-table info for tables that
+ * have such.
*/
if (!IsBootstrapProcessingMode())
{
+
/*
* Initialize critical system index relation descriptors, first.
* They are to make building relation descriptors fast.
- * init_irels() used to be called in RelationCacheInitialize().
- * It is changed to be called here to be transaction safe.
+ * init_irels() used to be called in RelationCacheInitialize(). It
+ * is changed to be called here to be transaction safe.
*/
MemoryContext oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
+
init_irels();
MemoryContextSwitchTo(oldcxt);
@@ -2154,19 +2157,23 @@ RelationCacheInitializePhase2(void)
fixrdesc(AttributeRelationName);
fixrdesc(ProcedureRelationName);
fixrdesc(TypeRelationName);
- /* We don't bother to update the entries for pg_variable or pg_log. */
+
+ /*
+ * We don't bother to update the entries for pg_variable or
+ * pg_log.
+ */
}
}
/* used by XLogInitCache */
-void CreateDummyCaches(void);
-void DestroyDummyCaches(void);
+void CreateDummyCaches(void);
+void DestroyDummyCaches(void);
void
CreateDummyCaches(void)
{
- MemoryContext oldcxt;
- HASHCTL ctl;
+ MemoryContext oldcxt;
+ HASHCTL ctl;
if (!CacheMemoryContext)
CreateCacheMemoryContext();
@@ -2186,14 +2193,14 @@ CreateDummyCaches(void)
ctl.keysize = sizeof(RelFileNode);
ctl.hash = tag_hash;
RelationNodeCache = hash_create(INITRELCACHESIZE, &ctl,
- HASH_ELEM | HASH_FUNCTION);
+ HASH_ELEM | HASH_FUNCTION);
MemoryContextSwitchTo(oldcxt);
}
void
DestroyDummyCaches(void)
{
- MemoryContext oldcxt;
+ MemoryContext oldcxt;
if (!CacheMemoryContext)
return;
@@ -2293,8 +2300,8 @@ AttrDefaultFetch(Relation relation)
RelationGetRelationName(relation));
else
attrdef[i].adbin = MemoryContextStrdup(CacheMemoryContext,
- DatumGetCString(DirectFunctionCall1(textout,
- val)));
+ DatumGetCString(DirectFunctionCall1(textout,
+ val)));
break;
}
if (hasindex)
@@ -2399,8 +2406,8 @@ RelCheckFetch(Relation relation)
elog(ERROR, "RelCheckFetch: rcbin IS NULL for rel %s",
RelationGetRelationName(relation));
check[found].ccbin = MemoryContextStrdup(CacheMemoryContext,
- DatumGetCString(DirectFunctionCall1(textout,
- val)));
+ DatumGetCString(DirectFunctionCall1(textout,
+ val)));
found++;
if (hasindex)
ReleaseBuffer(buffer);
@@ -2438,7 +2445,7 @@ RelCheckFetch(Relation relation)
*
* Since shared cache inval causes the relcache's copy of the list to go away,
* we return a copy of the list palloc'd in the caller's context. The caller
- * may freeList() the returned list after scanning it. This is necessary
+ * may freeList() the returned list after scanning it. This is necessary
* since the caller will typically be doing syscache lookups on the relevant
* indexes, and syscache lookup could cause SI messages to be processed!
*/
@@ -2468,7 +2475,7 @@ RelationGetIndexList(Relation relation)
(bits16) 0x0,
(AttrNumber) 1,
(RegProcedure) F_OIDEQ,
- ObjectIdGetDatum(RelationGetRelid(relation)));
+ ObjectIdGetDatum(RelationGetRelid(relation)));
sd = index_beginscan(irel, false, 1, &skey);
}
else
@@ -2477,18 +2484,18 @@ RelationGetIndexList(Relation relation)
(bits16) 0x0,
(AttrNumber) Anum_pg_index_indrelid,
(RegProcedure) F_OIDEQ,
- ObjectIdGetDatum(RelationGetRelid(relation)));
+ ObjectIdGetDatum(RelationGetRelid(relation)));
hscan = heap_beginscan(indrel, false, SnapshotNow, 1, &skey);
}
/*
- * We build the list we intend to return (in the caller's context) while
- * doing the scan. After successfully completing the scan, we copy that
- * list into the relcache entry. This avoids cache-context memory leakage
- * if we get some sort of error partway through.
+ * We build the list we intend to return (in the caller's context)
+ * while doing the scan. After successfully completing the scan, we
+ * copy that list into the relcache entry. This avoids cache-context
+ * memory leakage if we get some sort of error partway through.
*/
result = NIL;
-
+
for (;;)
{
HeapTupleData tuple;
@@ -2806,6 +2813,7 @@ write_irels(void)
fd = PathNameOpenFile(tempfilename, O_WRONLY | O_CREAT | O_TRUNC | PG_BINARY, 0600);
if (fd < 0)
{
+
/*
* We used to consider this a fatal error, but we might as well
* continue with backend startup ...
@@ -2943,7 +2951,5 @@ write_irels(void)
* previously-existing init file.
*/
if (rename(tempfilename, finalfilename) < 0)
- {
elog(NOTICE, "Cannot rename init file %s to %s: %m\n\tContinuing anyway, but there's something wrong.", tempfilename, finalfilename);
- }
}
diff --git a/src/backend/utils/cache/syscache.c b/src/backend/utils/cache/syscache.c
index 4a6a8c00bca..75ef3179202 100644
--- a/src/backend/utils/cache/syscache.c
+++ b/src/backend/utils/cache/syscache.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.59 2001/02/22 18:39:20 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.60 2001/03/22 03:59:57 momjian Exp $
*
* NOTES
* These routines allow the parser/planner/executor to perform
@@ -60,7 +60,7 @@
In include/catalog/indexing.h, add a define for the number of indexes
on the relation, add define(s) for the index name(s), add an extern
array to hold the index names, and use DECLARE_UNIQUE_INDEX to define
- the index. Cache lookups return only one row, so the index should be
+ the index. Cache lookups return only one row, so the index should be
unique in most cases.
In backend/catalog/indexing.c, initialize the relation array with
@@ -89,261 +89,262 @@ struct cachedesc
static struct cachedesc cacheinfo[] = {
{AggregateRelationName, /* AGGNAME */
- AggregateNameTypeIndex,
+ AggregateNameTypeIndex,
2,
{
Anum_pg_aggregate_aggname,
Anum_pg_aggregate_aggbasetype,
0,
0
- }},
+ }},
{AccessMethodRelationName, /* AMNAME */
- AmNameIndex,
+ AmNameIndex,
1,
{
Anum_pg_am_amname,
0,
0,
0
- }},
+ }},
{AccessMethodOperatorRelationName, /* AMOPOPID */
- AccessMethodOpidIndex,
+ AccessMethodOpidIndex,
3,
{
Anum_pg_amop_amopclaid,
Anum_pg_amop_amopopr,
Anum_pg_amop_amopid,
0
- }},
+ }},
{AccessMethodOperatorRelationName, /* AMOPSTRATEGY */
- AccessMethodStrategyIndex,
+ AccessMethodStrategyIndex,
3,
{
Anum_pg_amop_amopid,
Anum_pg_amop_amopclaid,
Anum_pg_amop_amopstrategy,
0
- }},
+ }},
{AttributeRelationName, /* ATTNAME */
- AttributeRelidNameIndex,
+ AttributeRelidNameIndex,
2,
{
Anum_pg_attribute_attrelid,
Anum_pg_attribute_attname,
0,
0
- }},
+ }},
{AttributeRelationName, /* ATTNUM */
- AttributeRelidNumIndex,
+ AttributeRelidNumIndex,
2,
{
Anum_pg_attribute_attrelid,
Anum_pg_attribute_attnum,
0,
0
- }},
+ }},
{OperatorClassRelationName, /* CLADEFTYPE */
- OpclassDeftypeIndex,
+ OpclassDeftypeIndex,
1,
{
Anum_pg_opclass_opcdeftype,
0,
0,
0
- }},
+ }},
{OperatorClassRelationName, /* CLANAME */
- OpclassNameIndex,
+ OpclassNameIndex,
1,
{
Anum_pg_opclass_opcname,
0,
0,
0
- }},
+ }},
{GroupRelationName, /* GRONAME */
- GroupNameIndex,
+ GroupNameIndex,
1,
{
Anum_pg_group_groname,
0,
0,
0
- }},
+ }},
{GroupRelationName, /* GROSYSID */
- GroupSysidIndex,
+ GroupSysidIndex,
1,
{
Anum_pg_group_grosysid,
0,
0,
0
- }},
+ }},
{IndexRelationName, /* INDEXRELID */
- IndexRelidIndex,
+ IndexRelidIndex,
1,
{
Anum_pg_index_indexrelid,
0,
0,
0
- }},
+ }},
{InheritsRelationName, /* INHRELID */
- InheritsRelidSeqnoIndex,
+ InheritsRelidSeqnoIndex,
2,
{
Anum_pg_inherits_inhrelid,
Anum_pg_inherits_inhseqno,
0,
0
- }},
+ }},
{LanguageRelationName, /* LANGNAME */
- LanguageNameIndex,
+ LanguageNameIndex,
1,
{
Anum_pg_language_lanname,
0,
0,
0
- }},
+ }},
{LanguageRelationName, /* LANGOID */
- LanguageOidIndex,
+ LanguageOidIndex,
1,
{
ObjectIdAttributeNumber,
0,
0,
0
- }},
+ }},
{ListenerRelationName, /* LISTENREL */
- ListenerPidRelnameIndex,
+ ListenerPidRelnameIndex,
2,
{
Anum_pg_listener_pid,
Anum_pg_listener_relname,
0,
0
- }},
+ }},
{OperatorRelationName, /* OPERNAME */
- OperatorNameIndex,
+ OperatorNameIndex,
4,
{
Anum_pg_operator_oprname,
Anum_pg_operator_oprleft,
Anum_pg_operator_oprright,
Anum_pg_operator_oprkind
- }},
+ }},
{OperatorRelationName, /* OPEROID */
- OperatorOidIndex,
+ OperatorOidIndex,
1,
{
ObjectIdAttributeNumber,
0,
0,
0
- }},
+ }},
{ProcedureRelationName, /* PROCNAME */
- ProcedureNameIndex,
+ ProcedureNameIndex,
3,
{
Anum_pg_proc_proname,
Anum_pg_proc_pronargs,
Anum_pg_proc_proargtypes,
0
- }},
+ }},
{ProcedureRelationName, /* PROCOID */
- ProcedureOidIndex,
+ ProcedureOidIndex,
1,
{
ObjectIdAttributeNumber,
0,
0,
0
- }},
+ }},
{RelationRelationName, /* RELNAME */
- ClassNameIndex,
+ ClassNameIndex,
1,
{
Anum_pg_class_relname,
0,
0,
0
- }},
+ }},
{RelationRelationName, /* RELOID */
- ClassOidIndex,
+ ClassOidIndex,
1,
{
ObjectIdAttributeNumber,
0,
0,
0
- }},
+ }},
{RewriteRelationName, /* REWRITENAME */
- RewriteRulenameIndex,
+ RewriteRulenameIndex,
1,
{
Anum_pg_rewrite_rulename,
0,
0,
0
- }},
+ }},
{RewriteRelationName, /* RULEOID */
- RewriteOidIndex,
+ RewriteOidIndex,
1,
{
ObjectIdAttributeNumber,
0,
0,
0
- }},
+ }},
{ShadowRelationName, /* SHADOWNAME */
- ShadowNameIndex,
+ ShadowNameIndex,
1,
{
Anum_pg_shadow_usename,
0,
0,
0
- }},
+ }},
{ShadowRelationName, /* SHADOWSYSID */
- ShadowSysidIndex,
+ ShadowSysidIndex,
1,
{
Anum_pg_shadow_usesysid,
0,
0,
0
- }},
+ }},
{StatisticRelationName, /* STATRELID */
- StatisticRelidAttnumIndex,
+ StatisticRelidAttnumIndex,
2,
{
Anum_pg_statistic_starelid,
Anum_pg_statistic_staattnum,
0,
0
- }},
+ }},
{TypeRelationName, /* TYPENAME */
- TypeNameIndex,
+ TypeNameIndex,
1,
{
Anum_pg_type_typname,
0,
0,
0
- }},
+ }},
{TypeRelationName, /* TYPEOID */
- TypeOidIndex,
+ TypeOidIndex,
1,
{
ObjectIdAttributeNumber,
0,
0,
0
- }}
+ }}
};
-static CatCache *SysCache[lengthof(cacheinfo)];
-static int SysCacheSize = lengthof(cacheinfo);
+static CatCache *SysCache[
+ lengthof(cacheinfo)];
+static int SysCacheSize = lengthof(cacheinfo);
static bool CacheInitialized = false;
@@ -358,7 +359,7 @@ IsCacheInitialized(void)
* InitCatalogCache - initialize the caches
*
* Note that no database access is done here; we only allocate memory
- * and initialize the cache structure. Interrogation of the database
+ * and initialize the cache structure. Interrogation of the database
* to complete initialization of a cache happens only upon first use
* of that cache.
*/
@@ -419,8 +420,8 @@ SearchSysCache(int cacheId,
/*
* If someone tries to look up a relname, translate temp relation
- * names to real names. Less obviously, apply the same translation
- * to type names, so that the type tuple of a temp table will be found
+ * names to real names. Less obviously, apply the same translation to
+ * type names, so that the type tuple of a temp table will be found
* when sought. This is a kluge ... temp table substitution should be
* happening at a higher level ...
*/
@@ -522,8 +523,8 @@ SysCacheGetAttr(int cacheId, HeapTuple tup,
/*
* We just need to get the TupleDesc out of the cache entry, and then
* we can apply heap_getattr(). We expect that the cache control data
- * is currently valid --- if the caller recently fetched the tuple, then
- * it should be.
+ * is currently valid --- if the caller recently fetched the tuple,
+ * then it should be.
*/
if (cacheId < 0 || cacheId >= SysCacheSize)
elog(ERROR, "SysCacheGetAttr: Bad cache id %d", cacheId);
diff --git a/src/backend/utils/cache/temprel.c b/src/backend/utils/cache/temprel.c
index b4ca06bbce6..88dc606cb0e 100644
--- a/src/backend/utils/cache/temprel.c
+++ b/src/backend/utils/cache/temprel.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/temprel.c,v 1.34 2001/01/24 19:43:15 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/temprel.c,v 1.35 2001/03/22 03:59:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -19,7 +19,7 @@
*
* When a temp table is created, normal entries are made for it in pg_class,
* pg_type, etc using a unique "physical" relation name. We also make an
- * entry in the temp table list maintained by this module. Subsequently,
+ * entry in the temp table list maintained by this module. Subsequently,
* relname lookups are filtered through the temp table list, and attempts
* to look up a temp table name are changed to look up the physical name.
* This allows temp table names to mask a regular table of the same name
@@ -50,12 +50,13 @@ typedef struct TempTable
NameData relname; /* underlying unique name */
Oid relid; /* needed properties of rel */
char relkind;
+
/*
- * If this entry was created during this xact, it should be deleted
- * at xact abort. Conversely, if this entry was deleted during this
- * xact, it should be removed at xact commit. We leave deleted entries
- * in the list until commit so that we can roll back if needed ---
- * but we ignore them for purposes of lookup!
+ * If this entry was created during this xact, it should be deleted at
+ * xact abort. Conversely, if this entry was deleted during this
+ * xact, it should be removed at xact commit. We leave deleted
+ * entries in the list until commit so that we can roll back if needed
+ * --- but we ignore them for purposes of lookup!
*/
bool created_in_cur_xact;
bool deleted_in_cur_xact;
@@ -110,7 +111,11 @@ remove_temp_rel_by_relid(Oid relid)
if (temp_rel->relid == relid)
temp_rel->deleted_in_cur_xact = true;
- /* Keep scanning 'cause there could be multiple matches; see RENAME */
+
+ /*
+ * Keep scanning 'cause there could be multiple matches; see
+ * RENAME
+ */
}
}
@@ -161,10 +166,10 @@ rename_temp_relation(const char *oldname,
* xact. One of these entries will be deleted at xact end.
*
* NOTE: the new mapping entry is inserted into the list just after
- * the old one. We could alternatively insert it before the old one,
- * but that'd take more code. It does need to be in one spot or the
- * other, to ensure that deletion of temp rels happens in the right
- * order during remove_all_temp_relations().
+ * the old one. We could alternatively insert it before the old
+ * one, but that'd take more code. It does need to be in one spot
+ * or the other, to ensure that deletion of temp rels happens in
+ * the right order during remove_all_temp_relations().
*/
oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
@@ -208,11 +213,11 @@ remove_all_temp_relations(void)
StartTransactionCommand();
/*
- * Scan the list and delete all entries not already deleted.
- * We need not worry about list entries getting deleted from under us,
- * because remove_temp_rel_by_relid() doesn't remove entries, only
- * mark them dead. Note that entries will be deleted in reverse order
- * of creation --- that's critical for cases involving inheritance.
+ * Scan the list and delete all entries not already deleted. We need
+ * not worry about list entries getting deleted from under us, because
+ * remove_temp_rel_by_relid() doesn't remove entries, only mark them
+ * dead. Note that entries will be deleted in reverse order of
+ * creation --- that's critical for cases involving inheritance.
*/
foreach(l, temp_rels)
{