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

Attachment: signature.asc
Description: PGP signature

Reply via email to