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

Sami Imseih <samimseih@gmail.com>

From: Sami Imseih <samimseih@gmail.com>
To: Corey Huinker <corey.huinker@gmail.com>
Cc: nathandbossart@gmail.com, pgsql-hackers@lists.postgresql.org
Date: 2026-03-05T20:45:25Z
Lists: pgsql-hackers
>> I noticed that you changed the tests to selecting individual columns. I am
>> not clear as to why this is better?
>>
>> -SELECT *
>> +SELECT schemaname, tablename, attname, attnum, inherited, null_frac, avg_width,
>> +    n_distinct, most_common_vals, most_common_freqs, histogram_bounds,
>> +    correlation, most_common_elems, most_common_elem_freqs,
>> +    elem_count_histogram, range_length_histogram, range_empty_frac,
>> +    range_bounds_histogram

Makes sense.

BTW, I do not see a CF enty for this.

Thanks!

--
Sami Imseih
Amazon Web Services (AWS)



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.