aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/rename.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-06-20 06:41:13 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-06-20 06:41:13 +0000
commit9f1a22304695cf2b6ed4497b4e12af8bb40704de (patch)
tree235e069936422b49442e8dbc4936395d84291f8c /src/backend/commands/rename.c
parent38db5fab29004edff2ee2eea51d72e04ab45870b (diff)
downloadpostgresql-9f1a22304695cf2b6ed4497b4e12af8bb40704de.tar.gz
postgresql-9f1a22304695cf2b6ed4497b4e12af8bb40704de.zip
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.
Diffstat (limited to 'src/backend/commands/rename.c')
-rw-r--r--src/backend/commands/rename.c10
1 files changed, 9 insertions, 1 deletions
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"
/*
@@ -200,6 +201,13 @@ renamerel(const char *oldrelname, const char *newrelname)
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.
*/