relpages value for partitioned tables

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: relpages value for partitioned tables
Date: 2026-08-25 06:37:04
Message-ID: 2f9030aa-e9f8-4d53-ba87-b739e19b1c7c@eisentraut.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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?

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2026-08-25 06:38:10 Re: Support EXCEPT for TABLES IN SCHEMA publications
Previous Message Andrey Borodin 2026-08-25 06:32:47 Re: Possible race condition in pg_basebackup