Skip to content

Commit 92647fc

Browse files
committed
Avoid possible divide-by-zero in gincostestimate.
Per report from Jeff Janes.
1 parent a0e8df5 commit 92647fc

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/backend/utils/adt/selfuncs.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6458,6 +6458,10 @@ gincostestimate(PG_FUNCTION_ARGS)
64586458
numDataPages = Min(numDataPages, numPages - numEntryPages);
64596459
}
64606460

6461+
/* In an empty index, numEntries could be zero. Avoid divide-by-zero */
6462+
if (numEntries < 1)
6463+
numEntries = 1;
6464+
64616465
/*
64626466
* Include predicate in selectivityQuals (should match
64636467
* genericcostestimate)

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