Commit c2b75c83 authored by Bruce Momjian's avatar Bruce Momjian

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

ALTER TABLE RENAME with extents.
Ole Gjerde
parent 19c4e862
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment