Re: Add starelid, attnum to pg_stats and leverage this in pg_dump

From: Sami Imseih <samimseih(at)gmail(dot)com>
To: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
Cc: Nathan Bossart <nathandbossart(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Add starelid, attnum to pg_stats and leverage this in pg_dump
Date: 2026-03-13 15:38:42
Message-ID: CAA5RZ0sf7vYav+Q5GwxGikBZSYUm+4haA5bHC0N67ct570HLcg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>> It will be good to add more commentary here to the next person adding
>> a test, and mention
>> that only stable values should be included in this view. what do you think?
>
>
> I added a comment, but I don't think a test writer would be confused for long if they did break that rule.

Thanks! it looks like you added the additional comment to 0002 rather than 0001
which introduced the view. I fixed that in the attached.

>> + (references <link
>> linkend="catalog-pg-class"><structname>pg_statistic_ext</structname></link>.<structfield>stxrelid</structfield>)
>
>
> Fixed catalog-pg-attribute and catalog-pg-statistic-ext

A few references were missed in 0002.

+ <row>
+ <entry role="catalog_table_entry"><para role="column_definition">
+ <structfield>expr_attnum</structfield> <type>int2</type>
+ </para>
+ <para>
+ Synthetic attnum used to reference this expression in
+ <link linkend="catalog-pg-class"><structname>pg_statistic_ext</structname></link>.<structfield>stxdndistinct</structfield>
+ and
+ <link linkend="catalog-pg-class"><structname>pg_statistic_ext</structname></link>.<structfield>stxddependencies</structfield>
+ </para></entry>
+ </row>

Also fixed in v7

--
Sami Imseih
Amazon Web Services (AWS)

Attachment Content-Type Size
v7-0001-Add-test-view-pg_stats_check.patch application/octet-stream 14.0 KB
v7-0002-Add-tableid-statid-attnum-expr_attnum-columns-to-.patch application/octet-stream 77.9 KB
v7-0003-pg_dump-Use-tableid-in-getAttributeStats.patch application/octet-stream 8.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2026-03-13 15:53:00 Re: some more include removal from headers
Previous Message Corey Huinker 2026-03-13 15:36:31 Re: Import Statistics in postgres_fdw before resorting to sampling.