No stats means empty table or no run of analyze. Warn about that.
These Fixes bug #877. Includes regress test.
git-svn-id: http://svn.osgeo.org/postgis/trunk@8319
b70326c6-7e19-0410-871a-
916f4a2858ee
POSTGIS_DEBUGF(3, " %d stat rows", SPI_processed);
- elog(ERROR, "geometry_estimated_extent: couldn't locate table within current schema");
+ /*
+ * TODO: distinguish between empty and not analyzed ?
+ */
+ elog(WARNING, "No stats for \"%s\".\"%s\".\"%s\" "
+ "(empty or not analyzed)",
+ ( nsp ? nsp : "<current>" ), tbl, col);
PG_RETURN_NULL() ;
}
POSTGIS_DEBUG(3, " stats are NULL");
- elog(ERROR, "geometry_estimated_extent: couldn't locate statistics for table");
+ elog(ERROR, "geometry_estimated_extent: null statistics for table");
PG_RETURN_NULL();
}
WITH p AS ( SELECT 'MULTIPOINT((832694.188 816254.625))'::geometry as g )
SELECT '#1273.1', st_equals(p.g, postgis_dropbbox(p.g)) from p;
+-- #877
+create table t(g geometry);
+select '#877.1', st_estimated_extent('t','g');
+analyze t;
+select '#877.2', st_estimated_extent('public', 't','g');
+insert into t(g) values ('LINESTRING(-10 -50, 20 30)');
+select '#877.3', st_estimated_extent('t','g');
+analyze t;
+select '#877.4', st_estimated_extent('t','g');
+drop table t;
+
-- Clean up
DELETE FROM spatial_ref_sys;
#1060|FFFFFFFF2
#1273|t
#1273.1|t
+WARNING: No stats for "<current>"."t"."g" (empty or not analyzed)
+#877.1|
+WARNING: No stats for "public"."t"."g" (empty or not analyzed)
+#877.2|
+WARNING: No stats for "<current>"."t"."g" (empty or not analyzed)
+#877.3|
+#877.4|BOX(-10 -50,20 30)