1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-12 05:01:15 +03:00

Fix problem with table drop after rollback of transaction, no flush

of index tuples.  Thanks to Vadim for fix.
This commit is contained in:
Bruce Momjian
1998-06-13 20:22:54 +00:00
parent d3d541996b
commit 1e88d82462
2 changed files with 9 additions and 11 deletions

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.48 1998/04/27 04:04:47 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.49 1998/06/13 20:22:53 momjian Exp $
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
* heap_create() - Create an uncataloged heap relation * heap_create() - Create an uncataloged heap relation
@@ -1290,18 +1290,14 @@ heap_destroy_with_catalog(char *relname)
* ---------------- * ----------------
*/ */
if (rdesc->rd_rel->relhasindex) if (rdesc->rd_rel->relhasindex)
{
RelationRemoveIndexes(rdesc); RelationRemoveIndexes(rdesc);
}
/* ---------------- /* ----------------
* remove rules if necessary * remove rules if necessary
* ---------------- * ----------------
*/ */
if (rdesc->rd_rules != NULL) if (rdesc->rd_rules != NULL)
{
RelationRemoveRules(rid); RelationRemoveRules(rid);
}
/* triggers */ /* triggers */
if (rdesc->rd_rel->reltriggers > 0) if (rdesc->rd_rel->reltriggers > 0)
@@ -1347,9 +1343,8 @@ heap_destroy_with_catalog(char *relname)
* ---------------- * ----------------
*/ */
if (!(rdesc->rd_istemp) || !(rdesc->rd_tmpunlinked)) if (!(rdesc->rd_istemp) || !(rdesc->rd_tmpunlinked))
{
smgrunlink(DEFAULT_SMGR, rdesc); smgrunlink(DEFAULT_SMGR, rdesc);
}
rdesc->rd_tmpunlinked = TRUE; rdesc->rd_tmpunlinked = TRUE;
RelationUnsetLockForWrite(rdesc); RelationUnsetLockForWrite(rdesc);
@@ -1375,6 +1370,7 @@ heap_destroy(Relation rdesc)
rdesc->rd_tmpunlinked = TRUE; rdesc->rd_tmpunlinked = TRUE;
heap_close(rdesc); heap_close(rdesc);
RemoveFromTempRelList(rdesc); RemoveFromTempRelList(rdesc);
RelationForgetRelation(rdesc->rd_id);
} }

View File

@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.41 1998/05/09 23:42:59 thomas Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.42 1998/06/13 20:22:54 momjian Exp $
* *
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
@@ -1270,7 +1270,6 @@ index_destroy(Oid indexId)
while (tuple = heap_getnext(scan, 0, (Buffer *) NULL), while (tuple = heap_getnext(scan, 0, (Buffer *) NULL),
HeapTupleIsValid(tuple)) HeapTupleIsValid(tuple))
{ {
heap_delete(catalogRelation, &tuple->t_ctid); heap_delete(catalogRelation, &tuple->t_ctid);
} }
heap_endscan(scan); heap_endscan(scan);
@@ -1296,12 +1295,15 @@ index_destroy(Oid indexId)
heap_close(catalogRelation); heap_close(catalogRelation);
/* /*
* physically remove the file * flush cache and physically remove the file
*/ */
ReleaseRelationBuffers(indexRelation);
if (FileNameUnlink(relpath(indexRelation->rd_rel->relname.data)) < 0) if (FileNameUnlink(relpath(indexRelation->rd_rel->relname.data)) < 0)
elog(ERROR, "amdestroyr: unlink: %m"); elog(ERROR, "amdestroyr: unlink: %m");
index_close(indexRelation); index_close(indexRelation);
RelationForgetRelation(indexRelation->rd_id);
} }
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------