From a421b4e850087e6ba7e63dc9193376718e96d43a Mon Sep 17 00:00:00 2001 From: Tom Lane <tgl@sss.pgh.pa.us> Date: Tue, 31 Aug 2004 16:13:06 +0000 Subject: [PATCH] FlushRelationBuffers was also being a bit cavalier about whether the relation is already opened by smgr. --- src/backend/storage/buffer/bufmgr.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 53c01c844a5..b9ba90cd8ec 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.175 2004/08/29 05:06:47 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.176 2004/08/31 16:13:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1366,6 +1366,10 @@ FlushRelationBuffers(Relation rel, BlockNumber firstDelBlock) int i; BufferDesc *bufHdr; + /* Open rel at the smgr level if not already done */ + if (rel->rd_smgr == NULL) + rel->rd_smgr = smgropen(rel->rd_node); + if (rel->rd_istemp) { for (i = 0; i < NLocBuffer; i++) @@ -1384,10 +1388,6 @@ FlushRelationBuffers(Relation rel, BlockNumber firstDelBlock) errcontext.previous = error_context_stack; error_context_stack = &errcontext; - /* Open rel at the smgr level if not already done */ - if (rel->rd_smgr == NULL) - rel->rd_smgr = smgropen(rel->rd_node); - smgrwrite(rel->rd_smgr, bufHdr->tag.blockNum, (char *) MAKE_PTR(bufHdr->data), -- GitLab