Guard against crazy selectivity numbers

git-svn-id: http://svn.osgeo.org/postgis/trunk@13600 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
Paul Ramsey 2015-06-01 16:15:29 +00:00
parent a3e647241f
commit 79cebf829c

View file

@ -1091,9 +1091,15 @@ estimate_join_selectivity(const ND_STATS *s1, const ND_STATS *s2)
*/
selectivity = val / ntuples_max;
/* Guard against over-estimates :) */
if ( selectivity > 1.0 )
selectivity = 1.0;
/* Guard against over-estimates and crazy numbers :) */
if ( isnan(selectivity) || ! isfinite(selectivity) || selectivity < 0.0 )
{
selectivity = DEFAULT_ND_JOINSEL;
}
else if ( selectivity > 1.0 )
{
selectivity = 1.0;
}
return selectivity;
}