projects
/
postgresql.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a66fca3
)
Fix division by zero in the new range type histogram creation.
author
Heikki Linnakangas
Thu, 30 Aug 2012 17:27:19 +0000
(20:27 +0300)
committer
Heikki Linnakangas
Thu, 30 Aug 2012 17:29:11 +0000
(20:29 +0300)
Report and analysis by Matthias.
src/backend/utils/adt/rangetypes_typanalyze.c
patch
|
blob
|
blame
|
history
diff --git
a/src/backend/utils/adt/rangetypes_typanalyze.c
b/src/backend/utils/adt/rangetypes_typanalyze.c
index e276ad8e18125683c56ba0bd57ca88afd618fe57..5f346834e759c02713ba87675ff0203b6793e9f9 100644
(file)
--- a/
src/backend/utils/adt/rangetypes_typanalyze.c
+++ b/
src/backend/utils/adt/rangetypes_typanalyze.c
@@
-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),