From 5c092b86955f9df47e02e393c1ee5a4bf6e6c79c Mon Sep 17 00:00:00 2001
From: Denis Rodionov <denis.rodionov@tantorlabs.ru>
Date: Thu, 28 May 2026 17:56:09 +0300
Subject: [PATCH v1] Remove obsolete tupDesc assignment in extended statistics

lookup_var_attr_stats() assigns tupDesc to VacAttrStats entries built for
expressions. This appears to be obsolete.

make_build_data() uses tupDesc only for regular columns, when fetching
attribute values from sample rows. For expressions, it creates separate
VacAttrStats entries with examine_expression(), so the entries built by
lookup_var_attr_stats() do not need tupDesc.

Remove the assignment and the outdated XXX comment.
---
 src/backend/statistics/extended_stats.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/src/backend/statistics/extended_stats.c b/src/backend/statistics/extended_stats.c
index 2b83355d26e..049933896b4 100644
--- a/src/backend/statistics/extended_stats.c
+++ b/src/backend/statistics/extended_stats.c
@@ -785,14 +785,6 @@ lookup_var_attr_stats(Bitmapset *attrs, List *exprs,
 			return NULL;
 		}
 
-		/*
-		 * XXX We need tuple descriptor later, and we just grab it from
-		 * stats[0]->tupDesc (see e.g. statext_mcv_build). But as coded
-		 * examine_attribute does not set that, so just grab it from the first
-		 * vacatts element.
-		 */
-		stats[i]->tupDesc = vacatts[0]->tupDesc;
-
 		i++;
 	}
 
-- 
2.34.1

