From 54afdcd6182af709cb0ab775c11b90decff166eb Mon Sep 17 00:00:00 2001 From: Peter Geoghegan Date: Tue, 3 Jan 2023 11:48:47 -0800 Subject: [PATCH] vacuumlazy.c: Save get_database_name() in vacrel. This brings dbname strings in line with namespace and relation name strings. Author: Peter Geoghegan Discussion: https://postgr.es/m/CAH2-WzkQ1TKU-DdNvnGeL870di3+CU1UTo-7nw7xFDpVE-XGjA@mail.gmail.com --- src/backend/access/heap/vacuumlazy.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c index 21bd104f69..a42e881da3 100644 --- a/src/backend/access/heap/vacuumlazy.c +++ b/src/backend/access/heap/vacuumlazy.c @@ -172,6 +172,7 @@ typedef struct LVRelState bool skippedallvis; /* Error reporting state */ + char *dbname; char *relnamespace; char *relname; char *indname; /* Current index name */ @@ -354,6 +355,7 @@ heap_vacuum_rel(Relation rel, VacuumParams *params, * these temp copies. */ vacrel = (LVRelState *) palloc0(sizeof(LVRelState)); + vacrel->dbname = get_database_name(MyDatabaseId); vacrel->relnamespace = get_namespace_name(RelationGetNamespace(rel)); vacrel->relname = pstrdup(RelationGetRelationName(rel)); vacrel->indname = NULL; @@ -475,13 +477,13 @@ heap_vacuum_rel(Relation rel, VacuumParams *params, if (vacrel->aggressive) ereport(INFO, (errmsg("aggressively vacuuming \"%s.%s.%s\"", - get_database_name(MyDatabaseId), - vacrel->relnamespace, vacrel->relname))); + vacrel->dbname, vacrel->relnamespace, + vacrel->relname))); else ereport(INFO, (errmsg("vacuuming \"%s.%s.%s\"", - get_database_name(MyDatabaseId), - vacrel->relnamespace, vacrel->relname))); + vacrel->dbname, vacrel->relnamespace, + vacrel->relname))); } /* @@ -650,7 +652,7 @@ heap_vacuum_rel(Relation rel, VacuumParams *params, msgfmt = _("automatic vacuum of table \"%s.%s.%s\": index scans: %d\n"); } appendStringInfo(&buf, msgfmt, - get_database_name(MyDatabaseId), + vacrel->dbname, vacrel->relnamespace, vacrel->relname, vacrel->num_index_scans); @@ -2614,9 +2616,7 @@ lazy_check_wraparound_failsafe(LVRelState *vacrel) ereport(WARNING, (errmsg("bypassing nonessential maintenance of table \"%s.%s.%s\" as a failsafe after %d index scans", - get_database_name(MyDatabaseId), - vacrel->relnamespace, - vacrel->relname, + vacrel->dbname, vacrel->relnamespace, vacrel->relname, vacrel->num_index_scans), errdetail("The table's relfrozenxid or relminmxid is too far in the past."), errhint("Consider increasing configuration parameter \"maintenance_work_mem\" or \"autovacuum_work_mem\".\n" -- 2.11.4.GIT