From: Michael Paquier <michael@paquier.xyz>
To: Denis Rodionov <denis.rodionov@tantorlabs.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: [PATCH] Remove obsolete tupDesc assignment in extended statistics
Date: Mon, 1 Jun 2026 14:17:16 +0900
Message-ID: <ah0V3EPMrHJs5IKs@paquier.xyz> (raw)
In-Reply-To: <4cb9e2ae-9ac4-4e2d-a840-c4accb9d105d@tantorlabs.com>
References: <4cb9e2ae-9ac4-4e2d-a840-c4accb9d105d@tantorlabs.com>
On Thu, May 28, 2026 at 06:58:39PM +0300, Denis Rodionov wrote:
> lookup_var_attr_stats() assigns tupDesc to VacAttrStats entries created for
> expressions. That appears to be obsolete: make_build_data() uses tupDesc
> only when fetching values for regular columns, while expressions are handled
> separately using VacAttrStats entries created by examine_expression().
>
> The old comment also points at statext_mcv_build(), but this does not seem
> to match the current code anymore. If some future code needs a tuple
> descriptor for expression entries here, it should probably set up that
> dependency explicitly rather than rely on copying vacatts[0]->tupDesc.
>
> The patch removes the assignment and the outdated XXX comment.
I got this code under my eyes a couple of weeks ago for a bug fix, and
wondered the same thing as you here, but I never got down to analyze
where the TupleDesc is used. Could that be just an oversight of
a4d75c86bf15 due to rebases of what has been committed?
Perhaps we should enforce somewhere that a VacAttrStats.tupDesc is
never set for an expression, in the shape of an assertion? I am not
sure where I would plant that, or if it's required, but that would
feel better than just removing these lines.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: michael@paquier.xyz, denis.rodionov@tantorlabs.com
Subject: Re: [PATCH] Remove obsolete tupDesc assignment in extended statistics
In-Reply-To: <ah0V3EPMrHJs5IKs@paquier.xyz>
References: <4cb9e2ae-9ac4-4e2d-a840-c4accb9d105d@tantorlabs.com> <ah0V3EPMrHJs5IKs@paquier.xyz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox