From: Paul Ramsey Date: Tue, 4 Feb 2014 22:44:33 +0000 (+0000) Subject: #2543, invalid join selectivity error from simple query X-Git-Tag: 2.2.0rc1~1258 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d32cdb4444da0f02d9cba3158b5e2e818531b0b4;p=postgis #2543, invalid join selectivity error from simple query git-svn-id: http://svn.osgeo.org/postgis/trunk@12222 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/NEWS b/NEWS index 98f617560..51e8fefa1 100644 --- a/NEWS +++ b/NEWS @@ -43,6 +43,7 @@ PostGIS 2.2.0 raster_columns and raster_overviews - #2532, Add missing raster/geometry commutator operators - #2540, Change GUC name for GDAL_DATA to postgis.gdal_datapath + - #2543, invalid join selectivity error from simple query - #2552, Fix handling of NULL raster in ST_AsTIFF, ST_AsPNG and ST_AsJPEG - #2555, Fix parsing issue of range arguments of ST_Reclass diff --git a/postgis/gserialized_estimate.c b/postgis/gserialized_estimate.c index 43101d928..1add23d42 100644 --- a/postgis/gserialized_estimate.c +++ b/postgis/gserialized_estimate.c @@ -1074,6 +1074,10 @@ estimate_join_selectivity(const ND_STATS *s1, const ND_STATS *s2) * number of rows that can be returned. */ selectivity = val / ntuples_max; + + /* Guard against over-estimates :) */ + if ( selectivity > 1.0 ) + selectivity = 1.0; return selectivity; }