From: Michael Paquier <michael@paquier.xyz>
To: Corey Huinker <corey.huinker@gmail.com>
Cc: Etsuro Fujita <etsuro.fujita@gmail.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Cc: Robert Haas <robertmhaas@gmail.com>
Subject: Re: use of SPI by postgresImportForeignStatistics
Date: Fri, 21 Aug 2026 16:15:23 +0900
Message-ID: <aof7CwOXSNkiMrX-@paquier.xyz> (raw)
In-Reply-To: <CADkLM=dvRPdFG83260bOX8UxmBUqjQmEvCfuVDT6nFMyAxm2ig@mail.gmail.com>
References: <CAPmGK16XqvvkWhsGgUASUQAtrxEtOfUud4id6do3zZ+XX44WZA@mail.gmail.com>
<CAPmGK14aremJGrPezVwFqWt7dnrMhD3KF1DgzsRygAUPETBU7w@mail.gmail.com>
<CAPmGK14nAf_+Ge4cfgEcJ07d0=3=GmVdEO-bGWfvi_5SNb8mgA@mail.gmail.com>
<CADkLM=exCGzyPMYxtHiuL0fr6Zqu4YWwcuiXvMMTBeHE_Fbr4g@mail.gmail.com>
<CAPmGK14CuH5K3HyEEQjLn7g2iEFSTwg_9qvV2qjYAX8EePjyKw@mail.gmail.com>
<CADkLM=c_Pnz1uCYBn+XZQTz47soLF1RWhb7i6zetO7T3m=zHJQ@mail.gmail.com>
<CAPmGK15AvxbzhA6MWJzDDcvSWRvNG1EP9kJLC0-HcRer-zBf0A@mail.gmail.com>
<CADkLM=dS2=HF+S1QoaFJwUJ-EpPT4-PbHzt6mCU9ykqLGgdvZA@mail.gmail.com>
<CAPmGK16eB8mhR1PysomA27ePZo8FRva=gOV4uvk-UXah0nCaPQ@mail.gmail.com>
<CADkLM=dvRPdFG83260bOX8UxmBUqjQmEvCfuVDT6nFMyAxm2ig@mail.gmail.com>
On Thu, Aug 20, 2026 at 12:28:30PM -0400, Corey Huinker wrote:
> On Thu, Aug 20, 2026 at 7:43 AM Etsuro Fujita <etsuro.fujita@gmail.com>
> wrote:
>> On Thu, Aug 20, 2026 at 2:15 AM Corey Huinker <corey.huinker@gmail.com>
>> wrote:
>>> 1. Remove special handling of version parameter, add it into existing
>> StatsArgInfo structures. Not the highest priority, but doing it first
>> remove the possibility of having to re-adjust subsequent changes related to
>> the offset I'm proposing.
>>> 2. Remove construction of of FCINFO, going with passing the latter
>> portion of the positional NullableDatum array.
Just looking at v3-0011, expanding functions like
attribute_statistics_update_internal() so as these use a gazzilion of
input arguments is not something I am on board with. That's bug prone
in the long term. If you wish to eliminate the FCINFO part, which is,
well, not completely wrong either and does work, I'd suggest to pass
one pointer to a structure that has access to all these fields. The
NullableDatum seems to be that, but the patch does not use that so I
cannot be entirely sure about the benefit of suggestion 2.
I am unconvinced with the value patches 0012 and the follow-up ones
bring, as well. For example for the recovery check, we just hide more
stuff in thin wrappers, and we don't have that many entrance points
with these SQL stats import functions.
> Oops, forgot to post the commitfest entry:
>
> https://commitfest.postgresql.org/patch/7170/
A replacement of newfcinfo by a different facility in
src/backend/statistics/ has nothing to do with SPI and postgres_fdw.
I'd suggest to:
- Rebase (and refactor) the patch.
- Create a new thread dealing with the specific topic you wish to deal
with.
Spoiler: v3, which is the latest patch set I am aware of in terms of
replacement of the fcinfo, does not apply cleanly on HEAD. Looking at
the patch, you also seem to update multiple times the same area of the
code, that makes the result more confusing to me, because the result
you are looking for is hidden in a forest of cascading changes.
--
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, corey.huinker@gmail.com, etsuro.fujita@gmail.com, robertmhaas@gmail.com
Subject: Re: use of SPI by postgresImportForeignStatistics
In-Reply-To: <aof7CwOXSNkiMrX-@paquier.xyz>
References: <CAPmGK16XqvvkWhsGgUASUQAtrxEtOfUud4id6do3zZ+XX44WZA@mail.gmail.com> <CAPmGK14aremJGrPezVwFqWt7dnrMhD3KF1DgzsRygAUPETBU7w@mail.gmail.com> <CAPmGK14nAf_+Ge4cfgEcJ07d0=3=GmVdEO-bGWfvi_5SNb8mgA@mail.gmail.com> <CADkLM=exCGzyPMYxtHiuL0fr6Zqu4YWwcuiXvMMTBeHE_Fbr4g@mail.gmail.com> <CAPmGK14CuH5K3HyEEQjLn7g2iEFSTwg_9qvV2qjYAX8EePjyKw@mail.gmail.com> <CADkLM=c_Pnz1uCYBn+XZQTz47soLF1RWhb7i6zetO7T3m=zHJQ@mail.gmail.com> <CAPmGK15AvxbzhA6MWJzDDcvSWRvNG1EP9kJLC0-HcRer-zBf0A@mail.gmail.com> <CADkLM=dS2=HF+S1QoaFJwUJ-EpPT4-PbHzt6mCU9ykqLGgdvZA@mail.gmail.com> <CAPmGK16eB8mhR1PysomA27ePZo8FRva=gOV4uvk-UXah0nCaPQ@mail.gmail.com> <CADkLM=dvRPdFG83260bOX8UxmBUqjQmEvCfuVDT6nFMyAxm2ig@mail.gmail.com> <aof7CwOXSNkiMrX-@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