pgsql: Guard against zero vardata.rel->tuples in estimate_hash_bucketsi

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Guard against zero vardata.rel->tuples in estimate_hash_bucketsi
Date: 2016-03-27 22:21:09
Message-ID: E1akJ3V-0006bT-O3@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Guard against zero vardata.rel->tuples in estimate_hash_bucketsize().

If the referenced rel was proven empty, we'd compute 0/0 here, which
results in the function returning NaN. That's a bit more serious
than the other zero-divide case. Still, it only seems to be possible
in HEAD, so no back-patch.

Per report from Piotr Stefaniak. I looked through the rest of selfuncs.c
and found no other likely trouble spots.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/d65b665d524a67273b075f468bf3d60ce31f4040

Modified Files
--------------
src/backend/utils/adt/selfuncs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2016-03-27 23:27:02 pgsql: Release notes for 9.5.2, 9.4.7, 9.3.12, 9.2.16, 9.1.21.
Previous Message Tom Lane 2016-03-27 22:07:30 pgsql: Clamp adjusted ndistinct to positive integer in estimate_hash_bu