| From: | Melanie Plageman <melanieplageman(at)gmail(dot)com> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Fix pgstattuple_approx handling of unknown tuple estimates |
| Date: | 2026-11-18 15:42:38 |
| Message-ID: | E1xThnx-00000000Fx3-41wp@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Fix pgstattuple_approx handling of unknown tuple estimates
vac_estimate_reltuples() can return -1 when there is not enough
information to estimate the number of live tuples. pgstattuple_approx()
assigned that value to an unsigned counter before attempting to clamp
it, making the clamp ineffective and exposing -1 through the bigint
result.
Clamp the signed estimate before assigning it to the unsigned counter.
Reported-by: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Author: Melanie Plageman <melanieplageman(at)gmail(dot)com>
Reviewed-by: Lukas Fittl <lukas(at)fittl(dot)com>
Reviewed-by: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Discussion: https://postgr.es/m/CAN4CZFM0y8t%2BAQ8PWTeuBXnFtRDUNvkfVzzA_yo6uJ2bceK%3DxA%40mail.gmail.com
Backpatch-through: 15
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/8c15c2cb5c49efcc6fa845f09d7619e0163e3259
Modified Files
--------------
contrib/pgstattuple/expected/pgstattuple.out | 12 ++++++++++++
contrib/pgstattuple/pgstatapprox.c | 11 ++++++-----
contrib/pgstattuple/sql/pgstattuple.sql | 10 ++++++++++
doc/src/sgml/pgstattuple.sgml | 3 ++-
4 files changed, 30 insertions(+), 6 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Melanie Plageman | 2026-11-18 15:46:12 | pgsql: Fix pgstattuple_approx handling of unknown tuple estimates |
| Previous Message | Heikki Linnakangas | 2026-11-18 15:14:36 | pgsql: Don't create a shell type for a function returning SETOF |