Re: Add starelid, attnum to pg_stats and leverage this in pg_dump - Mailing list pgsql-hackers

From Corey Huinker
Subject Re: Add starelid, attnum to pg_stats and leverage this in pg_dump
Date
Msg-id CADkLM=cj2kQC3gvUM_CNDUVyShA=6RgDMBnrmEFVUO=YsnoVnQ@mail.gmail.com
Whole thread
In response to Re: Add starelid, attnum to pg_stats and leverage this in pg_dump  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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

pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: Row pattern recognition
Next
From: Michael Paquier
Date:
Subject: Re: Is the XLP_BKP_REMOVABLE flag itself removable/obsolete?