summaryrefslogtreecommitdiff
path: root/src/include/utils
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-06-30 07:04:23 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-06-30 07:04:23 +0000
commitb41f4ab8c448fc1bb13b52d00c9c4f1868d97941 (patch)
tree5e832a1210f93033aeab63a572dc81229ad4aa7c /src/include/utils
parentc9ec78a6b89e846c5b1be0aa40b6532ca209c850 (diff)
downloadpostgresql-b41f4ab8c448fc1bb13b52d00c9c4f1868d97941.tar.gz
Use a private memory context to store rule information in each relcache
entry that has rules. This allows us to release the rule parsetrees on relcache flush without needing a working freeObject() routine. Formerly, the rule trees were leaked permanently at relcache flush. Also, clean up handling of rule creation and deletion --- there was not sufficient locking of the relation being modified, and there was no reliable notification of other backends that a relcache reload was needed. Also, clean up relcache.c code so that scans of system tables needed to load a relcache entry are done in the caller's memory context, not in CacheMemoryContext. This prevents any un-pfreed memory from those scans from becoming a permanent memory leak.
Diffstat (limited to 'src/include/utils')
-rw-r--r--src/include/utils/rel.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 901020611a..121012d7fd 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: rel.h,v 1.38 2000/06/18 22:44:34 tgl Exp $
+ * $Id: rel.h,v 1.39 2000/06/30 07:04:03 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -85,7 +85,7 @@ typedef struct TriggerDesc
typedef struct RelationData
{
- File rd_fd; /* open file descriptor */
+ File rd_fd; /* open file descriptor, or -1 if none */
int rd_nblocks; /* number of blocks in rel */
uint16 rd_refcnt; /* reference count */
bool rd_myxactonly; /* rel uses the local buffer mgr */
@@ -99,6 +99,7 @@ typedef struct RelationData
LockInfoData rd_lockInfo; /* lock mgr's info for locking relation */
TupleDesc rd_att; /* tuple descriptor */
RuleLock *rd_rules; /* rewrite rules */
+ MemoryContext rd_rulescxt; /* private memory cxt for rd_rules, if any */
IndexStrategy rd_istrat; /* info needed if rel is an index */
RegProcedure *rd_support;
TriggerDesc *trigdesc; /* Trigger info, or NULL if rel has none */