Avoid possible divide-by-zero in gincostestimate.

Per report from Jeff Janes.
This commit is contained in:
Tom Lane 2011-04-21 19:28:36 -04:00
parent a0e8df527e
commit 92647fc4b9

View File

@ -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)