| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | pgsql-committers(at)postgresql(dot)org |
| Subject: | pgsql: Clamp adjusted ndistinct to positive integer in estimate_hash_bu |
| Date: | 2016-03-27 22:07:30 |
| Message-ID: | E1akIqI-0006MJ-UG@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Clamp adjusted ndistinct to positive integer in estimate_hash_bucketsize().
This avoids a possible divide-by-zero in the following calculation,
and rounding the number to an integer seems like saner behavior anyway.
Assuming IEEE math, the division would yield +Infinity which would get
replaced by 1.0 at the bottom of the function, so nothing really
interesting would ensue; but avoiding divide-by-zero seems like a
good idea on general principles.
Per report from Piotr Stefaniak. No back-patch since this seems
mostly cosmetic.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/fa09f8935156533584b4e215bdf70ec1ff968dad
Modified Files
--------------
src/backend/utils/adt/selfuncs.c | 3 +++
1 file changed, 3 insertions(+)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2016-03-27 22:21:09 | pgsql: Guard against zero vardata.rel->tuples in estimate_hash_bucketsi |
| Previous Message | Andres Freund | 2016-03-27 21:51:27 | pgsql: pg_rewind: fsync target data directory. |