| From: | Corey Huinker <corey(dot)huinker(at)gmail(dot)com> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| 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-02 05:18:36 |
| Message-ID: | CADkLM=cj2kQC3gvUM_CNDUVyShA=6RgDMBnrmEFVUO=YsnoVnQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
>
> I don't object to the idea, but I don't like exposing the name
> "starelid". That just screams implementation artifact, and it
> goes against the idea that pg_stats is trying to hide the physical
> representation of pg_statistic. I wish we could use "tableoid",
> but that's taken already as a system column. Maybe "tableid" or
> "tablerelid"?
>
I went with tableid, as it pairs with tablename, and at least they're
inaccurate in the same way.
>
> Also, the proposed column ordering seems excessively random:
>
> n.nspname AS schemaname,
> c.relname AS tablename,
> s.starelid AS starelid,
> a.attnum AS attnum,
> a.attname AS attname,
> stainherit AS inherited,
>
> I could see either of these as plausible:
>
> n.nspname AS schemaname,
> c.relname AS tablename,
> s.starelid AS tableid,
> a.attname AS attname,
> a.attnum AS attnum,
> stainherit AS inherited,
>
> n.nspname AS schemaname,
> c.relname AS tablename,
> a.attname AS attname,
> s.starelid AS tableid,
> a.attnum AS attnum,
> stainherit AS inherited,
>
> but I don't see the rationale behind your version.
>
The rationale went like this:
In order to get the grain of this table you need:
( (schemaname AND tablename) OR tableid )
AND
(attnum OR attname)
AND
inherited
As I stated earlier, I don't think there's a way to "win" with the column
ordering here, any ordering we choose will look awkward to at least one use
case. Your first suggestion seems fine to me, so I'm going with that one in
this round.
| Attachment | Content-Type | Size |
|---|---|---|
| v2-0001-Add-tableid-and-attnum-columns-to-pg_stats.patch | text/x-patch | 76.7 KB |
| v2-0002-pg_dump-Use-tableid-in-getAttributeStats.patch | text/x-patch | 8.0 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2026-03-02 05:20:13 | Re: Is the XLP_BKP_REMOVABLE flag itself removable/obsolete? |
| Previous Message | Tatsuo Ishii | 2026-03-02 05:18:23 | Re: Row pattern recognition |