Re: Update comments in functions for statistics import in postgres_fdw.c

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Update comments in functions for statistics import in postgres_fdw.c
Date: 2026-11-10 06:22:36
Message-ID: 69C6CF8D-31BC-4B31-8919-DB23A8F673BD@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Nov 9, 2026, at 17:35, Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com> wrote:
>
> Hi,
>
> I did s/attname/remote_attname/ to a comment in match_attrmap(), for
> clarity, and added a comment to import_fetched_statistics(). I also
> tweaked the comments for each of the two functions.
>
> Best regards,
> Etsuro Fujita
> <update-comments-in-stat-import-functions.patch>

```
+ /*
+ * ATTSTATS_NUM_FIELDS corresponds to the number of statistical value
+ * parameters for import_attribute_statistics(), which is larger than that
+ * for import_relation_statistics(). Therefore, a NullableDatum array of
+ * that length is used to store data for each parameter in both functions.
+ */
NullableDatum args[ATTSTATS_NUM_FIELDS];
```

I think this comment is slightly inaccurate. ATTSTATS_NUM_FIELDS is 14, including ATTSTATS_ATTNAME as 0. So the number of statistical value parameters is 13. import_attribute_statistics() needs 14 NullableDatatum including a “version” argument plus 13 statistical value parameters.

How about:
```
ATTSTATS_NUM_FIELDS equals the number of NullableDatum arguments
required by import_relation_statistics(). Use the same array for import_relation_statistics(),
which requires fewer arguments.
```

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2026-11-10 06:24:44 Re: Clarify wait versus poll behavior in ExecAppendAsyncEventWait
Previous Message Chao Li 2026-11-10 06:02:28 Re: Pass heap tuple counts to parallel vacuum as double