*
*
* 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
* heap_create() - Create an uncataloged heap relation
* heap_create_with_catalog() - Create a cataloged relation
- * heap_destroy_with_catalog() - Removes named relation from catalogs
+ * heap_destroy_with_catalog() - Removes named relation from catalogs
*
* NOTES
* this code taken from access/heap/create.c, which contains
* ----------------
*/
if (rdesc->rd_rel->relhasindex)
- {
RelationRemoveIndexes(rdesc);
- }
/* ----------------
* remove rules if necessary
* ----------------
*/
if (rdesc->rd_rules != NULL)
- {
RelationRemoveRules(rid);
- }
/* triggers */
if (rdesc->rd_rel->reltriggers > 0)
* ----------------
*/
if (!(rdesc->rd_istemp) || !(rdesc->rd_tmpunlinked))
- {
smgrunlink(DEFAULT_SMGR, rdesc);
- }
+
rdesc->rd_tmpunlinked = TRUE;
RelationUnsetLockForWrite(rdesc);
rdesc->rd_tmpunlinked = TRUE;
heap_close(rdesc);
RemoveFromTempRelList(rdesc);
+ RelationForgetRelation(rdesc->rd_id);
}
*
*
* 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
while (tuple = heap_getnext(scan, 0, (Buffer *) NULL),
HeapTupleIsValid(tuple))
{
-
heap_delete(catalogRelation, &tuple->t_ctid);
}
heap_endscan(scan);
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)
elog(ERROR, "amdestroyr: unlink: %m");
index_close(indexRelation);
+ RelationForgetRelation(indexRelation->rd_id);
}
/* ----------------------------------------------------------------