5555 *
5656 *
5757 * IDENTIFICATION
58- * $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.64 2007/10/2514:45:55 alvherre Exp $
58+ * $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.65 2007/10/2519:13:37 alvherre Exp $
5959 *
6060 *-------------------------------------------------------------------------
6161 */
@@ -2099,11 +2099,9 @@ do_autovacuum(void)
20992099
21002100/*
21012101 * Save the relation name for a possible error message, to avoid a
2102- * catalog lookup in case of an error. We do it in
2103- * TopTransactionContext so that they go away automatically in the next
2104- * iteration.
2102+ * catalog lookup in case of an error. Note: they must live in a
2103+ * long-lived memory context.
21052104 */
2106- MemoryContextSwitchTo (TopTransactionContext );
21072105datname = get_database_name (MyDatabaseId );
21082106nspname = get_namespace_name (get_rel_namespace (tab -> at_relid ));
21092107relname = get_rel_name (tab -> at_relid );
@@ -2116,6 +2114,7 @@ do_autovacuum(void)
21162114PG_TRY ();
21172115{
21182116/* have at it */
2117+ MemoryContextSwitchTo (TopTransactionContext );
21192118autovacuum_do_vac_analyze (tab -> at_relid ,
21202119tab -> at_dovacuum ,
21212120tab -> at_doanalyze ,
@@ -2152,6 +2151,9 @@ do_autovacuum(void)
21522151
21532152/* be tidy */
21542153pfree (tab );
2154+ pfree (datname );
2155+ pfree (nspname );
2156+ pfree (relname );
21552157
21562158/* remove my info from shared memory */
21572159LWLockAcquire (AutovacuumLock ,LW_EXCLUSIVE );