pgsql: Fix pgstattuple_approx handling of iso-8859-1 tuple estimates

Поиск
Список
Период
Сортировка
Искать

pgsql: Fix pgstattuple_approx handling of iso-8859-1 tuple estimates

От:
Melanie Plageman <melanieplageman@gmail.com>
Дата:
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 
Author: Melanie Plageman 
Reviewed-by: Lukas Fittl 
Reviewed-by: Zsolt Parragi 
Discussion: https://postgr.es/m/CAN4CZFM0y8t%2BAQ8PWTeuBXnFtRDUNvkfVzzA_yo6uJ2bceK%3DxA%40mail.gmail.com
Backpatch-through: 15

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/7a733b9547c171e756d2934c77805568ba716ef7

Modified Files
--------------
contrib/pgstattuple/expected/pgstattuple.out | 12 ++++++++++++
contrib/pgstattuple/pgstatapprox.c           |  9 +++++----
contrib/pgstattuple/sql/pgstattuple.sql      | 10 ++++++++++
doc/src/sgml/pgstattuple.sgml                |  3 ++-
4 files changed, 29 insertions(+), 5 deletions(-)

FAQ