[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 06:36:15 PDT 2012


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

Comment(by wimned):

 smaller testcase:

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

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

     pol0 = ST_GeometryFromText(
         'POLYGON((1 1,1 2,2 2,2 1,1 1))', 4326);

     pol1 = ST_GeometryFromText(
         'POLYGON((0 0,0 1,1 1,1 0,0 0))', 4326);

     perform topogeo_AddPolygon('wimpy', pol0);
     perform topogeo_AddPolygon('wimpy', pol1);
     perform cleanse_nodes();
 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 wimpy.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;

 }}}

 from validate_topology:

 {{{
                error                | id1 | id2
 ------------------------------------+-----+-----
  edge crosses edge                  |   1 |   2
  edge start node geometry mis-match |   2 |   1
  edge end node geometry mis-match   |   2 |   1
 (3 rows)

 }}}

 edges:

 {{{
  edge_id |            st_astext
 ---------+---------------------------------
        2 | LINESTRING(0 0,1 0,1 1,0 1,0 0)
        1 | LINESTRING(1 1,1 2,2 2,2 1,1 1)
 (2 rows)


 }}}

 nodes:


 {{{
  node_id | st_astext
 ---------+------------
        1 | POINT(1 1)
 (1 row)
 }}}

 looks a bit similar to ticket #1955

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