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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy