From 369328747aa6d0a30093e79199f60d034e5eab85 Mon Sep 17 00:00:00 2001
From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Date: Tue, 24 Feb 2026 16:44:30 +0000
Subject: [PATCH v1] Make use of unvolatize() in vac_truncate_clog()

481018f2804 introduced unvolatize() but c66a7d75e652 forgot to make use of
it.

Reported by -Wcast-qual. Note that that does not remove the warning (481018f2804
also did not remove them), but move it from vacuum.c:1885 to c.h:1263.
---
 src/backend/commands/vacuum.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 100.0% src/backend/commands/

diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 03932f45c8a..edef3396aae 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -1882,7 +1882,7 @@ vac_truncate_clog(TransactionId frozenXID,
 		 * anymore. Therefore we don't need to take it into account here.
 		 * Which is good, because it can't be processed by autovacuum either.
 		 */
-		if (database_is_invalid_form((Form_pg_database) dbform))
+		if (database_is_invalid_form(unvolatize(FormData_pg_database *, dbform)))
 		{
 			elog(DEBUG2,
 				 "skipping invalid database \"%s\" while computing relfrozenxid",
-- 
2.34.1

