Content-Length: 261581 | pFad | http://github.com/postgrespro/postgres/commit/3e6eb0dd0a0982c61420a0d18d3e485bd2c2819c

F0 Fix division by zero in the new range type histogram creation. · postgrespro/postgres@3e6eb0d · GitHub
Skip to content

Commit 3e6eb0d

Browse files
committed
Fix division by zero in the new range type histogram creation.
Report and analysis by Matthias.
1 parent a66fca3 commit 3e6eb0d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/backend/utils/adt/rangetypes_typanalyze.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,10 @@ compute_range_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
158158
/* Must copy the target values into anl_context */
159159
old_cxt = MemoryContextSwitchTo(stats->anl_context);
160160

161-
if (non_empty_cnt > 0)
161+
/*
162+
* Generate a histogram slot entry if there are at least two values.
163+
*/
164+
if (non_empty_cnt >= 2)
162165
{
163166
/* Sort bound values */
164167
qsort_arg(lowers, non_empty_cnt, sizeof(RangeBound),

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/3e6eb0dd0a0982c61420a0d18d3e485bd2c2819c

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy