Commit 92647fc4 authored by Tom Lane's avatar Tom Lane

Avoid possible divide-by-zero in gincostestimate.

Per report from Jeff Janes.
parent a0e8df52
......@@ -6458,6 +6458,10 @@ gincostestimate(PG_FUNCTION_ARGS)
numDataPages = Min(numDataPages, numPages - numEntryPages);
}
/* In an empty index, numEntries could be zero. Avoid divide-by-zero */
if (numEntries < 1)
numEntries = 1;
/*
* Include predicate in selectivityQuals (should match
* genericcostestimate)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment