Allow vacuum of temporary tables

This commit is contained in:
Bruce Momjian 2000-04-06 18:12:07 +00:00
parent 6929459279
commit 65ea4f677f

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.145 2000/04/06 00:29:51 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.146 2000/04/06 18:12:07 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -42,6 +42,7 @@
#include "utils/portal.h" #include "utils/portal.h"
#include "utils/relcache.h" #include "utils/relcache.h"
#include "utils/syscache.h" #include "utils/syscache.h"
#include "utils/temprel.h"
#ifndef HAVE_GETRUSAGE #ifndef HAVE_GETRUSAGE
#include "rusagestub.h" #include "rusagestub.h"
@ -315,14 +316,20 @@ vc_getrels(NameData *VacRelP)
if (NameStr(*VacRelP)) if (NameStr(*VacRelP))
{ {
/* /*
* we could use the cache here, but it is clearer to use scankeys * we could use the cache here, but it is clearer to use scankeys
* for both vacuum cases, bjm 2000/01/19 * for both vacuum cases, bjm 2000/01/19
*/ */
char *nontemp_relname;
/* We must re-map temp table names bjm 2000-04-06 */
if ((nontemp_relname =
get_temp_rel_by_username(NameStr(*VacRelP))) == NULL)
nontemp_relname = NameStr(*VacRelP);
ScanKeyEntryInitialize(&key, 0x0, Anum_pg_class_relname, ScanKeyEntryInitialize(&key, 0x0, Anum_pg_class_relname,
F_NAMEEQ, F_NAMEEQ,
PointerGetDatum(NameStr(*VacRelP))); PointerGetDatum(nontemp_relname));
} }
else else
{ {