From 9f1a22304695cf2b6ed4497b4e12af8bb40704de Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 20 Jun 2000 06:41:13 +0000 Subject: Make renaming a temp table behave sensibly. We don't need to touch the underlying table at all, just change the mapping entry ... but that logic was missing. --- src/backend/commands/rename.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/backend/commands/rename.c') diff --git a/src/backend/commands/rename.c b/src/backend/commands/rename.c index 7f46a3d83be..2daebf7c5e1 100644 --- a/src/backend/commands/rename.c +++ b/src/backend/commands/rename.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.45 2000/05/25 21:30:20 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.46 2000/06/20 06:41:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -29,6 +29,7 @@ #include "utils/acl.h" #include "utils/relcache.h" #include "utils/syscache.h" +#include "utils/temprel.h" /* @@ -199,6 +200,13 @@ renamerel(const char *oldrelname, const char *newrelname) elog(ERROR, "renamerel: Illegal class name: \"%s\" -- pg_ is reserved for system catalogs", newrelname); + /* + * Check for renaming a temp table, which only requires altering + * the temp-table mapping, not the physical table. + */ + if (rename_temp_relation(oldrelname, newrelname)) + return; /* all done... */ + /* * Instead of using heap_openr(), do it the hard way, so that we * can rename indexes as well as regular relations. -- cgit v1.2.3