88 *
99 *
1010 * IDENTIFICATION
11- * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.125 2001/01/06 21:53:18 tgl Exp $
11+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.126 2001/01/08 18:34:44 tgl Exp $
1212 *
1313 *-------------------------------------------------------------------------
1414 */
@@ -1557,14 +1557,25 @@ RelationNameGetRelation(const char *relationName)
15571557/* --------------------------------
15581558 * RelationClose - close an open relation
15591559 *
1560- * Actually, we just decrement the refcount.
1560+ *Actually, we just decrement the refcount.
1561+ *
1562+ *NOTE: if compiled with -DRELCACHE_FORCE_RELEASE then relcache entries
1563+ *will be freed as soon as their refcount goes to zero. In combination
1564+ *with aset.c's CLOBBER_FREED_MEMORY option, this provides a good test
1565+ *to catch references to already-released relcache entries. It slows
1566+ *things down quite a bit, however.
15611567 * --------------------------------
15621568 */
15631569void
15641570RelationClose (Relation relation )
15651571{
15661572/* Note: no locking manipulations needed */
15671573RelationDecrementReferenceCount (relation );
1574+
1575+ #ifdef RELCACHE_FORCE_RELEASE
1576+ if (RelationHasReferenceCountZero (relation )&& !relation -> rd_myxactonly )
1577+ RelationClearRelation (relation , false);
1578+ #endif
15681579}
15691580
15701581#ifdef ENABLE_REINDEX_NAILED_RELATIONS
@@ -1603,6 +1614,7 @@ RelationReloadClassinfo(Relation relation)
16031614return ;
16041615}
16051616#endif /* ENABLE_REINDEX_NAILED_RELATIONS */
1617+
16061618/* --------------------------------
16071619 * RelationClearRelation
16081620 *
@@ -1611,9 +1623,6 @@ RelationReloadClassinfo(Relation relation)
16111623 * usually used when we are notified of a change to an open relation
16121624 * (one with refcount > 0). However, this routine just does whichever
16131625 * it's told to do; callers must determine which they want.
1614- *
1615- * If we detect a change in the relation's TupleDesc, rules, or triggers
1616- * while rebuilding, we complain unless refcount is 0.
16171626 * --------------------------------
16181627 */
16191628static void