[postgis-devel] [PostGIS] #1998: Crash of topogeo_AddPolygon() with "ERROR: query string argument of EXECUTE is null"

PostGIS trac at osgeo.org
Fri Sep 14 03:03:22 PDT 2012


#1998: Crash of topogeo_AddPolygon() with "ERROR:  query string argument of
EXECUTE is null"
--------------------------------+-------------------------------------------
 Reporter:  wimned              |       Owner:  pramsey      
     Type:  defect              |      Status:  new          
 Priority:  medium              |   Milestone:  PostGIS 2.1.0
Component:  postgis             |     Version:  trunk        
 Keywords:  topogeo_AddPolygon  |  
--------------------------------+-------------------------------------------
 Complete message:

 ERROR:  query string argument of EXECUTE is null
 CONTEXT:  PL/pgSQL function "st_modedgesplit" line 106 at EXECUTE
 statement
 PL/pgSQL function "topogeo_addpoint" line 65 at assignment
 PL/pgSQL function "topogeo_addlinestring" line 92 at assignment
 SQL statement "SELECT array_cat(edges, array_agg(x)) FROM ( select
 topology.TopoGeo_addLinestring(atopology, rec.geom, tol) as x ) as foo"

 Version:
  POSTGIS="2.1.0SVN r10195" GEOS="3.3.4-CAPI-1.7.3" PROJ="Rel. 4.7.1, 23
 September 2009" LIBXML="2.7.8" TOPOLOGY

 After pol1 is added, node 2, the begin and end of the loop of pol1 is
 removed through ST_ModEdgeHeal().
 The code breaks when pol2 is added after this.
 Rearranging the geometry of pol1, so the common point of pol0 and pol1 is
 the begin/endpoint of the loop of pol1, prevents the crash.

 The code:

 {{{
 CREATE OR REPLACE FUNCTION testerror1()
  returns void as
 $$
     declare pol0 geometry;
     declare pol1 geometry;
     declare pol2 geometry;
     declare node_rec RECORD;
 begin
     raise notice 'version: %', postgis_full_version();

     perform CreateTopology('wimpy', 4326, 0.0000001);

     CREATE VIEW face_geom AS
         select i.face_id, ST_GetFaceGeometry('wimpy', i.face_id) as geom
             from wimpy.face as i
                 where face_id != 0;

     pol0 = ST_GeometryFromText(
         'POLYGON((76.5282669067383 9.43292331695557,76.5287322998047
 9.43261814117432,76.5285415649414 9.43255615234375,76.5282669067383
 9.43292331695557))', 4326);

     pol1 = ST_GeometryFromText(
         'POLYGON((76.5267181396484 9.4406852722168,76.5282669067383
 9.43292331695557, 76.5264434814453 9.43406867980957, 76.5267181396484
 9.4406852722168))',4326);

     pol2 = ST_GeometryFromText(
         'POLYGON((76.524 9.437,
                 76.5267181396484 9.4406852722168,76.5264434814453
 9.43406867980957,76.524 9.437))', 4326);


     perform topogeo_AddPolygon('wimpy', pol0);
     perform topogeo_AddPolygon('wimpy', pol1);
     perform cleanse_nodes();
     perform topogeo_AddPolygon('wimpy', pol2);
 END
 $$
 LANGUAGE plpgsql;

 CREATE OR REPLACE FUNCTION cleanse_nodes()
   returns void AS
 $$
   DECLARE node_rec RECORD;
 BEGIN
     for node_rec in select node_id from node
     loop
         perform cleanse_node(node_rec.node_id);
     end loop;
 END
 $$
 LANGUAGE plpgsql;

 CREATE OR REPLACE FUNCTION cleanse_node(passed_node_id integer)
   returns void AS
 $$
   DECLARE edge_ids integer[];
 BEGIN
     --raise notice 'check node %', passed_node_id;
     select array_agg(abs(t.edge)) into edge_ids
         from GetNodeEdges('wimpy', passed_node_id) as t(seq,edge);

     if array_length(edge_ids,1) = 2 and edge_ids[1] != edge_ids[2]
     then
         raise notice 'remove node %', passed_node_id;

         perform ST_ModEdgeHeal('wimpy', edge_ids[1], edge_ids[2]);
     end if;
 END
 $$
 LANGUAGE plpgsql;

 }}}

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/1998>
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-devel mailing list