Re: [PATCH] Remove obsolete tupDesc assignment in extended statistics

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Denis Rodionov <denis(dot)rodionov(at)tantorlabs(dot)ru>
Cc: Denis Rodionov <denis(dot)rodionov(at)tantorlabs(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] Remove obsolete tupDesc assignment in extended statistics
Date: 2026-06-10 05:21:14
Message-ID: aij0SgZ7NXEbKlCA@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 04, 2026 at 09:27:05PM +0300, Denis Rodionov wrote:
> I agree that an assertion makes this clearer. In v2 I removed the obsolete
> assignment and added an assertion in lookup_var_attr_stats() to document
> that expression stats do not need a tuple descriptor.
>
/*
- * 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.
+ * Expression stats are not tied to a heap attribute, so they do not
+ * need a tuple descriptor.
*/
- stats[i]->tupDesc = vacatts[0]->tupDesc;
+ Assert(stats[i]->tupDesc == NULL);

Planting an assertion at this location feels OK here. (I need to
remember to look at that again once v20 opens for business, noting
that down now..)
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-06-10 05:37:57 Re: [(known) BUG] DELETE/UPDATE more than one row in partitioned foreign table
Previous Message Michael Paquier 2026-06-10 05:19:27 Re: Fix DROP PROPERTY GRAPH "unsupported object class" error