aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/cache/relcache.c
diff options
context:
space:
mode:
authorMarc G. Fournier <scrappy@hub.org>1998-02-23 17:44:24 +0000
committerMarc G. Fournier <scrappy@hub.org>1998-02-23 17:44:24 +0000
commit6c7c6d0c05c3e9e8f9d4817ca761caf84ff50d54 (patch)
treec834d2793eb6a5236d1127a22e791d6641bc0dca /src/backend/utils/cache/relcache.c
parent9324d5cbe3e118059813a2bbd4ac826830f3653f (diff)
downloadpostgresql-6c7c6d0c05c3e9e8f9d4817ca761caf84ff50d54.tar.gz
postgresql-6c7c6d0c05c3e9e8f9d4817ca761caf84ff50d54.zip
From: Jan Wieck <jwieck@debis.com>
The diff looks so simple and easy. But to find it wasn't fun. It must have been there for a long time. What happened: When a tuple in one of some central catalogs was updated, the referenced relation got flushed, so it would be reopened on the next access (to reflect new triggers, rules and table structure changes into the relation cache). Some data (the tupleDescriptor e.g.) is used in the system cache too. So when a relation is subject to the system cache, this must know too that a cached system relation got flushed because the tupleDesc data gets freed during the flush! For the GRANT/REVOKE on pg_class it was slightly different. There is some local data in inval.c that gets initialized on the first invalidation of a tuple in some central catalogs. This needs a SysCache lookup in pg_class. But when the first of all commands is a GRANT on pg_class, exactly the needed tuple is the one actually invalidated. So I added little code snippets that the initialization of the local variables in inval.c will already happen during InitPostgres().
Diffstat (limited to 'src/backend/utils/cache/relcache.c')
-rw-r--r--src/backend/utils/cache/relcache.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index 28d9848f7b5..f40d5a3fdbc 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.35 1998/01/31 04:38:52 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.36 1998/02/23 17:43:25 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
@@ -65,6 +65,7 @@
#include "utils/relcache.h"
#include "utils/hsearch.h"
#include "utils/relcache.h"
+#include "utils/catcache.h"
#include "catalog/catname.h"
#include "catalog/catalog.h"
@@ -1344,6 +1345,7 @@ RelationFlushRelation(Relation *relationPtr,
RelationCacheDelete(relation);
FreeTupleDesc(relation->rd_att);
+ SystemCacheRelationFlushed(relation->rd_id);
FreeTriggerDesc(relation);