[postgis-tickets] [PostGIS] #4286: Problem for generating statistics for 3D geometries

PostGIS trac at osgeo.org
Mon Jan 7 05:15:58 PST 2019


#4286: Problem for generating statistics for 3D geometries
----------------------+---------------------------
 Reporter:  ezimanyi  |      Owner:  pramsey
     Type:  defect    |     Status:  new
 Priority:  medium    |  Milestone:  PostGIS 2.5.2
Component:  postgis   |    Version:  2.4.x
 Keywords:            |
----------------------+---------------------------
 Statistics for 3D geometries are not collected. The problem can be
 reproduced with the following script.

 -------------------------------------------------------------------------------

 CREATE OR REPLACE FUNCTION random_float(low float, high float)
         RETURNS float AS $$
 BEGIN
         RETURN random()* (high-low + 1) + low;
 END;
 $$ LANGUAGE 'plpgsql' STRICT;

 CREATE OR REPLACE FUNCTION random_geompoint(lowx float, highx float,
         lowy float, highy float)
         RETURNS geometry AS $$
 BEGIN
         RETURN st_point(random_float(lowx, highx), random_float(lowy,
 highy));
 END;
 $$ LANGUAGE 'plpgsql' STRICT;


 CREATE OR REPLACE FUNCTION random_geompoint3D(lowx float, highx float,
         lowy float, highy float, lowz float, highz float)
         RETURNS geometry AS $$
 BEGIN
         RETURN st_makepoint(random_float(lowx, highx), random_float(lowy,
 highy), random_float(lowz, highz));
 END;
 $$ LANGUAGE 'plpgsql' STRICT;

 -------------------------------------------------------------------------------

 drop table if exists test_point;
 create table test_point (
 pt geometry(Point)
 );

 insert into test_point
 select random_geompoint(1, 1000, 1, 1000)
 from generate_series(1,100);

 vacuum analyze test_point;

 select stanumbers1, stanumbers2 from pg_statistic where starelid =
 (select relfilenode from pg_class where relname = 'test_point');

 --
 "{2,4,4,0,0,31.6331,0.643264,0,0,997.588,1005.19,0,0,100,100,100,100,16,100,3,8,4,9,5,7,6,7,6,4,8,2,8,7,12,4}";
 --
 "{2,4,4,0,0,31.6331,0.643264,0,0,997.588,1005.19,0,0,100,100,100,100,16,100,3,8,4,9,5,7,6,7,6,4,8,2,8,7,12,4}"
 -------------------------------------------------------------------------------

 drop table if exists test_point3D;
 create table test_point3D (
 pt geometry(PointZ)
 );

 insert into test_point3D
 select random_geompoint3D(1, 1000, 1, 1000, 1, 1000)
 from generate_series(1,100);

 select st_astext(pt) from test_point3D;

 vacuum analyze test_point3D;

 select stanumbers1, stanumbers2 from pg_statistic where starelid =
 (select relfilenode from pg_class where relname = 'test_point3D');

 -- EMPTY

 -------------------------------------------------------------------------------

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4286>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list