On Fri, 13 Nov 2026, Melanie Plageman <[email protected]> wrote:
> So I did mean for a sentinel/unknown value to be returned here.
> However, it looks like the value should be 0 and not -1.

Sorry if that wasn't clear from my email, I didn't question the value
changing, only the part where the -1 is visible to users, as that
seems like a preexisting bug that now got one more case.

> So, to clamp it, we should save the return value of
> vac_estimate_reltuples() in a double and clamp it to 0 before
> assigning to stat->tuple_count.

Yes, either that or tuple_count should be signed, but the current way
doesn't seem to be good.

One more nit for the original v2-0001:

+        * value when at most one page was scanned.  When the relation size has
+        * changed, use the old density to account for the added or removed 
pages
+        * instead of preserving a stale tuple count.
         *
         * (Note: we might be returning -1 here.)
         */

That note is now stale, with the condition moved before it.


Reply via email to