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: 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-04 22:54:21
Message-ID: CAA5RZ0tSYjO4Frt-SkpV1kmXn4jYTdVP-1XEMtFF2yJ9B4scDg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>> I dislike the existing "pg_stats.tablename", since this can also be an
>> expression index.
>> "pg_stats.relation" with a description of "Name of table or index" is
>> more appropriate.
>> It is a change that we can possibly make in a major version. Looked
>> through the archives,
>> and did not see this being reported/discussed.
>
>
> I don't see it changing in any version, minor or major.

This could be a separate discussion as it's not the fault of this patch,
but clearly "tablename" is not correct here.

>> I noticed in other pg_fatal messages, we include OIDs
>>
>> pg_fatal("could not find function definition for function
>> with OID %u",
>> cast->castfunc);
>>
>> Should we do the same here?
>
>
> If I had the oid, I wouldn't have the error. :)

oops, you're right.

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

Otherwise v2 LGTM.

--
Sami Imseih
Amazon Web Services (AWS)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zsolt Parragi 2026-03-04 22:56:09 Re: meson: Make test output much more useful on failure (both in CI and locally)
Previous Message Michael Paquier 2026-03-04 22:51:26 Re: pgsql: Change default value of default_toast_compression to "lz4", when