I noticed in src/backend/commands/analyze.c, do_analyze_rel(), the value for relpages for partitioned tables is stored as -1:

    /*
     * Partitioned tables don't have storage, so we don't set any fields
     * in their pg_class entries except for reltuples and relhasindex.
     */
    vac_update_relstats(onerel, -1, totalrows,
                        0, 0, hasindex, InvalidTransactionId,
                        InvalidMultiXactId,
                        NULL, NULL,
                        in_outer_xact);

I don't see any documentation or explanation of this, and it doesn't seem to be made use of anywhere.

Other relation kinds without storage (views, partitioned indexes) store 0 in relpages.

If we wanted to keep this special value somehow, then it might at least make more sense to write InvalidBlockNumber, because the relevant argument type of vac_update_relstats() is actually BlockNumber (not int32 as in the catalog).

But we should probably be consistent across relkinds?

Thoughts?



Reply via email to