*/
#define MIN_DIMENSION_WIDTH 0.000000001
+/**
+* Maximum width of a dimension that we'll bother trying to
+* compute statistics on.
+*/
+#define MAX_DIMENSION_WIDTH 1.0E+20
+
/**
* Default geometry selectivity factor
*/
smax = extent->max[d];
swidth = smax - smin;
- /* Don't try and calculate distribution of overly narrow dimensions */
- if ( swidth < MIN_DIMENSION_WIDTH )
+ /* Don't try and calculate distribution of overly narrow */
+ /* or overly wide dimensions. Here we're being pretty geographical, */
+ /* expecting "normal" planar or geographic coordinates. */
+ /* Otherwise we have to "handle" +/- Inf bounded features and */
+ /* the assumptions needed for that are as bad as this hack. */
+ if ( swidth < MIN_DIMENSION_WIDTH || swidth > MAX_DIMENSION_WIDTH )
{
distribution[d] = 0;
continue;
/* Initialize sum and stddev */
nd_box_init(&sum);
nd_box_init(&stddev);
+ nd_box_init(&avg);
+ nd_box_init(&histo_extent);
+ nd_box_init(&histo_extent_new);
/*
* This is where gserialized_analyze_nd
-- #4164
SELECT ST_AsText(ST_GeomFromGeoJSON('{"type": "Polygon", "coordinates": [[0,0],[0,5],[5, 5],[5,0],[0,0]]}'));
+-- #4144
+DROP TABLE IF EXISTS bug_4144_table;
+CREATE TABLE bug_4144_table (
+ geom geometry NOT NULL DEFAULT NULL
+);
+
+INSERT INTO bug_4144_table (geom)
+ VALUES ('GEOMETRYCOLLECTION(POINT(-3.385894e+38 0 0),POINT(0 0 0))');
+
+ANALYZE bug_4144_table;
+DROP TABLE IF EXISTS bug_4144_table;
+
-- Clean up
DELETE FROM spatial_ref_sys;
ERROR: lwgeom_pointonsurface: GEOS Error: TopologyException: Input geom 1 is invalid: Self-intersection
#4081|f|t
ERROR: The 'coordinates' in GeoJSON polygon are not sufficiently nested
+NOTICE: table "bug_4144_table" does not exist, skipping
#4176|t