Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
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

+4-1
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)