mirror of
https://github.com/postgres/postgres.git
synced 2025-07-11 10:01:57 +03:00
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.
This commit is contained in:
@ -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.
|
||||
|
Reference in New Issue
Block a user