From 791e9973ab4d4ef425d0877f3ccb6807fae0c423 Mon Sep 17 00:00:00 2001 From: "Vadim B. Mikheev" Date: Tue, 14 Jan 1997 05:38:23 +0000 Subject: [PATCH] heap_destroy () releases dirty buffers of a relation to be destroyed. --- src/backend/catalog/heap.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c index 50609272b6..57371b5822 100644 --- a/src/backend/catalog/heap.c +++ b/src/backend/catalog/heap.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.10 1997/01/01 06:01:16 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.11 1997/01/14 05:38:23 vadim Exp $ * * INTERFACE ROUTINES * heap_creatr() - Create an uncataloged heap relation @@ -1233,6 +1233,8 @@ heap_destroy(char *relname) rdesc = heap_openr(relname); if (rdesc == NULL) elog(WARN,"Relation %s Does Not Exist!", relname); + + RelationSetLockForWrite(rdesc); /* ---------------- * prevent deletion of system relations @@ -1285,6 +1287,11 @@ heap_destroy(char *relname) */ DeletePgRelationTuple(rdesc); + /* + * release dirty buffers of this relation + */ + ReleaseRelationBuffers (rdesc); + /* ---------------- * flush the relation from the relcache * ---------------- @@ -1299,6 +1306,9 @@ heap_destroy(char *relname) if(rdesc->rd_istemp) { rdesc->rd_tmpunlinked = TRUE; } + + RelationUnsetLockForWrite(rdesc); + heap_close(rdesc); } @@ -1311,7 +1321,7 @@ heap_destroy(char *relname) void heap_destroyr(Relation rdesc) { - ReleaseTmpRelBuffers(rdesc); + ReleaseRelationBuffers(rdesc); (void) smgrunlink(rdesc->rd_rel->relsmgr, rdesc); if(rdesc->rd_istemp) { rdesc->rd_tmpunlinked = TRUE; -- 2.40.0