aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>1999-06-11 02:39:43 +0000
committerBruce Momjian <bruce@momjian.us>1999-06-11 02:39:43 +0000
commit3b9ef4d0733cbf8e903afb45e21fd55ecf0a73ed (patch)
treed03bea049677c98d96b098a097f440bd77fe73cf
parentd852d31ea3926fbfe2705a1789d1f4ef4946c7b4 (diff)
downloadpostgresql-3b9ef4d0733cbf8e903afb45e21fd55ecf0a73ed.tar.gz
postgresql-3b9ef4d0733cbf8e903afb45e21fd55ecf0a73ed.zip
Change mdtruncate to truncate and not unlink.
Hiroshi Inoue
-rw-r--r--src/backend/storage/smgr/md.c25
1 files changed, 6 insertions, 19 deletions
diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c
index ce4fd6ab651..5d84956059f 100644
--- a/src/backend/storage/smgr/md.c
+++ b/src/backend/storage/smgr/md.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.44 1999/05/25 16:11:30 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.45 1999/06/11 02:39:43 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -711,27 +711,14 @@ mdtruncate(Relation reln, int nblocks)
MdfdVec *v;
#ifndef LET_OS_MANAGE_FILESIZE
- int curnblk,
- i,
- oldsegno,
- newsegno;
- char fname[NAMEDATALEN];
- char tname[NAMEDATALEN + 10];
+ int curnblk;
curnblk = mdnblocks(reln);
- oldsegno = curnblk / RELSEG_SIZE;
- newsegno = nblocks / RELSEG_SIZE;
-
- StrNCpy(fname, RelationGetRelationName(reln)->data, NAMEDATALEN);
-
- if (newsegno < oldsegno)
+ if (curnblk / RELSEG_SIZE > 0)
{
- for (i = (newsegno + 1);; i++)
- {
- sprintf(tname, "%s.%d", fname, i);
- if (FileNameUnlink(tname) < 0)
- break;
- }
+ elog(NOTICE, "Can't truncate multi-segments relation %s",
+ reln->rd_rel->relname.data);
+ return curnblk;
}
#endif