On Thu, Oct 22, 2026 at 11:12 AM Artem Gavrilov <[email protected]> wrote:
> Hello hackers, > > Since c32fb29e979, pg_dump --statistics dumps extended statistics > data. For servers older than v15, where pg_stats_ext has no inherited > column, the query hard-codes the flag to false. The commit message > says "In v14 and older versions, inherited extended statistics are not > supported". That is true for the catalog, but not for the data: since > 20b9fa308eb, back-patched down to 10.20, 11.15, 12.10, 13.6 and 14.2, > these versions build inherited extended stats on partitioned tables. > That's an odd one, indeed. > The attached patch deduces the inherited flag from the relkind of the > table for pre-v15 servers, the same way 20b9fa308eb chooses which data > to build: true for partitioned tables, false for all other relations. > pg_dump already has the relkind in TableInfo, so I did it in C rather > than in the SQL query. The patch applies to master (5ffb8c74093) and > REL_19_STABLE (2dc899f780f). > My inclination was also to handle it in SQL but there isn't an elegant way to do that, so the C route is definitely better. I've also confirmed that it applies to master (d073ddd5180) and REL_19_STABLE. It passes tests, but it isn't really exercised by the regular test suite, so we'll have to rely on the buildfarm and even then I'm not sure there will be coverage.
