]> granicus.if.org Git - postgis/commitdiff
Fixed bug in join selectivity estimator returning invalid estimates (>1)
authorSandro Santilli <strk@keybit.net>
Fri, 22 Apr 2005 01:05:41 +0000 (01:05 +0000)
committerSandro Santilli <strk@keybit.net>
Fri, 22 Apr 2005 01:05:41 +0000 (01:05 +0000)
git-svn-id: http://svn.osgeo.org/postgis/branches/pgis_1_0@1668 b70326c6-7e19-0410-871a-916f4a2858ee

lwgeom/lwgeom_estimate.c

index 03849f963bb9baf59904477f4a4b0fec7c7e0f44..0fbeb03c174bdfa88f1848722b6a3b91ebae19f1 100644 (file)
@@ -984,6 +984,9 @@ Datum LWGEOM_gist_joinsel(PG_FUNCTION_ARGS)
                PG_RETURN_FLOAT8(DEFAULT_GEOMETRY_JOINSEL);
        }
 
+       if ( rows_returned > total_tuples )
+               PG_RETURN_FLOAT8(1.0);
+
        PG_RETURN_FLOAT8(rows_returned / total_tuples);
 }
 
@@ -2482,6 +2485,9 @@ Datum LWGEOM_estimated_extent(PG_FUNCTION_ARGS)
 
 /**********************************************************************
  * $Log$
+ * Revision 1.29.2.3  2005/04/22 01:05:41  strk
+ * Fixed bug in join selectivity estimator returning invalid estimates (>1)
+ *
  * Revision 1.29.2.2  2005/04/18 14:12:59  strk
  * Slightly changed standard deviation computation to be more corner-case-friendly.
  *