Re: [HACKERS] v6.5 release ToDo

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Ole Gjerde <gjerde(at)icebox(dot)org>
Cc: Postgres Hackers List <hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] v6.5 release ToDo
Date: 1999-05-17 18:28:01
Message-ID: 199905171828.OAA24589@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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).

Applied.

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

I think this is good enough for now. Do people want an mdrename?

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

Seems like in the code you have, you just keep renaming until you can't
find any more files, so printing out any errno would be a problem,
right?

I assume you are taling about the initial rename. Not sure if strerror
would help. We really try and insulate the user from knowing how we are
doing the SQL we do, so it is possible it may be confusing. However, it
may be very helpful too. Not sure. Comments?

> 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 @@
> 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))
> @@ -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);
>
>
>

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 1999-05-17 22:10:25 Re: [HACKERS] DROP TABLE leaks file descriptors
Previous Message Bruce Momjian 1999-05-17 18:23:00 Re: [HACKERS] Misleading Error Message