Fix division by zero in the new range type histogram creation.

Report and analysis by Matthias.
This commit is contained in:
Heikki Linnakangas 2012-08-30 20:27:19 +03:00
parent a66fca3f0c
commit 3e6eb0dd0a
1 changed files with 4 additions and 1 deletions

View File

@ -158,7 +158,10 @@ compute_range_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
/* Must copy the target values into anl_context */
old_cxt = MemoryContextSwitchTo(stats->anl_context);
if (non_empty_cnt > 0)
/*
* Generate a histogram slot entry if there are at least two values.
*/
if (non_empty_cnt >= 2)
{
/* Sort bound values */
qsort_arg(lowers, non_empty_cnt, sizeof(RangeBound),