Re: [HACKERS] v6.5 release ToDo - Mailing list pgsql-hackers

From Ole Gjerde
Subject Re: [HACKERS] v6.5 release ToDo
Date
Msg-id Pine.LNX.4.05.9905151831470.20515-100000@snowman.icebox.org
Whole thread Raw
In response to Re: [HACKERS] v6.5 release ToDo  (Bruce Momjian <maillist@candle.pha.pa.us>)
Responses Re: [HACKERS] v6.5 release ToDo  (Bruce Momjian <maillist@candle.pha.pa.us>)
List pgsql-hackers
On Sat, 15 May 1999, Bruce Momjian wrote:
> I believe also we have:
>     DROP TABLE/RENAME TABLE doesn't remove extended files, *.1, *.2
> as an open item.  Do you see these problems there?

DROP TABLE worked, ALTER TABLE didn't.

CREATE TABLE
DROP TABLE
CREATE INDEX
DROP INDEX
ALTER TABLE old RENAME TO new

All works on linux now by my tests and regression(with patch below).

Perhaps a mdrename() should be created?  Or is something like this good
enough?

Another thing.  Should error messages from file related(or all system
calls) use strerror() to print out errno?

Ole Gjerde

--- src/backend/commands/rename.c    1999/05/10 00:44:59    1.23
+++ src/backend/commands/rename.c    1999/05/15 23:42:49
@@ -201,10 +201,13 @@voidrenamerel(char *oldrelname, char *newrelname){
+    int        i;    Relation    relrelation;    /* for RELATION relation */    HeapTuple    oldreltup;    char
oldpath[MAXPGPATH],
-                newpath[MAXPGPATH];
+                newpath[MAXPGPATH],
+                toldpath[MAXPGPATH + 10],
+                tnewpath[MAXPGPATH + 10];    Relation    irelations[Num_pg_class_indices];    if
(!allowSystemTableMods&& IsSystemRelationName(oldrelname))
 
@@ -229,6 +232,14 @@    strcpy(newpath, relpath(newrelname));    if (rename(oldpath, newpath) < 0)        elog(ERROR,
"renamerel:unable to rename file: %s", oldpath);
 
+
+    for (i = 1;; i++)
+    {
+        sprintf(toldpath, "%s.%d", oldpath, i);
+        sprintf(tnewpath, "%s.%d", newpath, i);
+        if(rename(toldpath, tnewpath) < 0)
+            break;
+    }    StrNCpy((((Form_pg_class) GETSTRUCT(oldreltup))->relname.data),            newrelname, NAMEDATALEN);



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] v6.5 release ToDo
Next
From: Tom Lane
Date:
Subject: Memory leaks in relcache