Re: use of SPI by postgresImportForeignStatistics - Mailing list pgsql-hackers

From Etsuro Fujita
Subject Re: use of SPI by postgresImportForeignStatistics
Date
Msg-id CAPmGK15MfVT2H+PUvA_nAJvySGr_pAVkVx3KcnVXWGO36acWLA@mail.gmail.com
Whole thread
In response to Re: use of SPI by postgresImportForeignStatistics  (Corey Huinker <corey.huinker@gmail.com>)
Responses Re: use of SPI by postgresImportForeignStatistics
List pgsql-hackers
Hi Corey,

On Wed, Jun 17, 2026 at 7:50 AM Corey Huinker <corey.huinker@gmail.com> wrote:
> I think the right first step is to create the functions import_relation_stats() and import_attribute_stats() which
takethe oid of the destination relation and the rest of the parameters are const char pointers, which is the ideal case
fora bunch of values being fetched from PQgetValue(). Those functions will for now just make the call to
attribute_statistics_update()/ relation_statistics_update(), but at least it will be localized inside relation_stats.c
andattribute_stats.c where we can make internal refactors without disturbing anyone else. 

+1

> Now, we *could* make these 2 new functions take the oid/oid+attname followed by a variadic array of keyname+value
stringpairs like the existing pg_restore_*_stats() functions, so the functions call signature would be somewhat
future-proofed.Let me know if that violates your vision of what this should be. 

IMO I don't think we need to go that far, because 1) the new functions
are provided for FDW authors only, and 2) we don't make changes to the
stats that often.

Thanks!

Best regards,
Etsuro Fujita



pgsql-hackers by date:

Previous
From: Tender Wang
Date:
Subject: Re: btree_gist: Fix NaN handling in float4 and float8 opclasses
Next
From: Ewan Young
Date:
Subject: Re: btree_gist: Fix NaN handling in float4 and float8 opclasses