pgsql: Fix confusion about data type of pg_class.relpages and relallvis

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix confusion about data type of pg_class.relpages and relallvis
Date: 2025-02-24 16:16:09
Message-ID: E1tmb7p-000Tcd-1e@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix confusion about data type of pg_class.relpages and relallvisible.

Although they're exposed as int4 in pg_class, relpages and
relallvisible are really of type BlockNumber, that is uint32.
Correct type puns in relation_statistics_update() and remove
inappropriate range-checks. The type puns are only cosmetic
issues, but the range checks would cause failures with huge
relations.

Reported-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Author: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/614341.1740269035@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9de2cc455eb9c60dda979c32985df967522a8ab2

Modified Files
--------------
src/backend/statistics/relation_stats.c | 53 ++++++++-------------------------
1 file changed, 13 insertions(+), 40 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2025-02-24 16:57:56 pgsql: libpq: Add PQfullProtocolVersion to exports.txt
Previous Message Jeff Davis 2025-02-24 16:07:54 Re: pgsql: Trial fix for old cross-version upgrades.