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

ALTER TABLE RENAME with extents.
Ole Gjerde
This commit is contained in:
Bruce Momjian 1999-05-17 18:24:48 +00:00
parent 19c4e862d4
commit c2b75c83f3
1 changed files with 13 additions and 2 deletions

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.23 1999/05/10 00:44:59 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.24 1999/05/17 18:24:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -201,10 +201,13 @@ renameatt(char *relname,
void
renamerel(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))
@ -230,6 +233,14 @@ renamerel(char *oldrelname, char *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);