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

Corey Huinker <corey.huinker@gmail.com>

From: Corey Huinker <corey.huinker@gmail.com>
To: Sami Imseih <samimseih@gmail.com>
Cc: Nathan Bossart <nathandbossart@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2026-03-12T23:54:17Z
Lists: pgsql-hackers

Attachments

> 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.


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

Fixed catalog-pg-attribute and catalog-pg-statistic-ext

Commits

  1. pg_dump: Simplify query for retrieving attribute statistics.

  2. Add more columns to pg_stats, pg_stats_ext, and pg_stats_ext_exprs.

  3. Add convenience view to stats import test.