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

From: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Sami Imseih <samimseih(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, michael(at)paquier(dot)xyz
Subject: Re: Add starelid, attnum to pg_stats and leverage this in pg_dump
Date: 2026-03-16 20:04:23
Message-ID: CADkLM=cuwGZU0i51vn+SUqptXB8QT8rhRRYshns+pX0KxczmAQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
>
> > CREATE VIEW pg_stats_ext_exprs WITH (security_barrier) AS
> > SELECT cn.nspname AS schemaname,
> > c.relname AS tablename,
> > + s.stxrelid AS tableid,
> > sn.nspname AS statistics_schemaname,
> > s.stxname AS statistics_name,
> > + s.oid AS statid,
> > pg_get_userbyid(s.stxowner) AS statistics_owner,
> > - stat.expr,
> > + expr.expr,
> > + 0 - expr.ordinality AS expr_attnum,
>
> I left the expr_attnum stuff out. It seems to make this patch quite large
> and complicated, we don't plan to use it for the pg_dump patch, and I'm not
> sure about showing users a "synthetic attnum" that seems to have no other
> point of reference. Would this information be useful in pg_dump somewhere?
> I'm curious to hear more about the intent.
>

expr_attnum was something that Michael Paquier had lamented that the view
didn't have. There is obviously no present need for it, as pg_dump isn't
being modified for extended stats at all.

> I didn't see much value in adding attnum here given the size of the changes
> to the expected output it produces.
>

Same reasons for putting that in - people had lamented that we couldn't
order the dump by attnum, and ordering by attname feels weird somehow.
Again, we don't presently need it.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Antonin Houska 2026-03-16 20:15:14 Re: Adding REPACK [concurrently]
Previous Message Jeff Davis 2026-03-16 20:01:27 Re: Expanding HOT updates for expression and partial indexes