summaryrefslogtreecommitdiff
path: root/src/backend/storage/lmgr/lmgr.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/storage/lmgr/lmgr.c')
-rw-r--r--src/backend/storage/lmgr/lmgr.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/backend/storage/lmgr/lmgr.c b/src/backend/storage/lmgr/lmgr.c
index df8f991fae7..839533952b5 100644
--- a/src/backend/storage/lmgr/lmgr.c
+++ b/src/backend/storage/lmgr/lmgr.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.33 1999/07/17 20:17:46 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.34 1999/09/04 18:42:14 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -22,6 +22,7 @@
#include "postgres.h"
#include "access/transam.h"
#include "catalog/catalog.h"
+#include "utils/inval.h"
extern Oid MyDatabaseId;
@@ -161,7 +162,16 @@ LockRelation(Relation relation, LOCKMODE lockmode)
tag.objId.blkno = InvalidBlockNumber;
LockAcquire(LockTableId, &tag, lockmode);
- return;
+
+ /*
+ * Check to see if the relcache entry has been invalidated
+ * while we were waiting to lock it. If so, rebuild it,
+ * or elog() trying. Increment the refcount to ensure that
+ * RelationFlushRelation will rebuild it and not just delete it.
+ */
+ RelationIncrementReferenceCount(relation);
+ DiscardInvalid();
+ RelationDecrementReferenceCount(relation);
}
/*