Opened 2 years ago

Closed 2 years ago

#5017 closed defect (fixed)

topology.ValidateTopology error relation "shell_check" already exists

Reported by: Lars Aksel Opsahl Owned by: strk
Priority: medium Milestone: PostGIS 3.2.0
Component: topology Version: master
Keywords: Cc:

Description

When I run topology.ValidateTopology second time without starting a new session there is temp table not removed.

NOTICE:  Checking edge linking
ERROR:  relation "shell_check" already exists
CONTEXT:  SQL statement "CREATE TEMP TABLE shell_check (
    face_id int PRIMARY KEY,
    ring_geom geometry
  )"
PL/pgSQL function _validatetopologyrings(geometry) line 12 at SQL statement
PL/pgSQL function validatetopology(character varying,geometry) line 300 at FOR over SELECT rows

If I close the session and opens a new one it works ok.

Change History (7)

comment:1 by strk, 2 years ago

I cannot reproduce. What version of postgis ?

strk=# begin;
BEGIN
strk=# select * from validatetopology('city_data');
NOTICE:  Checking for coincident nodes
NOTICE:  Checking for edges crossing nodes
NOTICE:  Checking for invalid or not-simple edges
NOTICE:  Checking for crossing edges
NOTICE:  Checking for edges start_node mismatch
NOTICE:  Checking for edges end_node mismatch
NOTICE:  Checking for faces without edges
NOTICE:  Checking edge linking
NOTICE:  Building edge rings
NOTICE:  Found 315 rings, 310 valid shells, 5 valid holes
NOTICE:  Constructing geometry of all faces
NOTICE:  Checking faces
NOTICE:  Checked 310 faces
NOTICE:  Checking for holes coverage
NOTICE:  Finished checking for coverage of 5 holes
NOTICE:  Checking for node containing_face correctness
 error | id1 | id2 
-------+-----+-----
(0 rows)

strk=# select * from validatetopology('city_data');
NOTICE:  Checking for coincident nodes
NOTICE:  Checking for edges crossing nodes
NOTICE:  Checking for invalid or not-simple edges
NOTICE:  Checking for crossing edges
NOTICE:  Checking for edges start_node mismatch
NOTICE:  Checking for edges end_node mismatch
NOTICE:  Checking for faces without edges
NOTICE:  Checking edge linking
NOTICE:  Building edge rings
NOTICE:  Found 315 rings, 310 valid shells, 5 valid holes
NOTICE:  Constructing geometry of all faces
NOTICE:  Checking faces
NOTICE:  Checked 310 faces
NOTICE:  Checking for holes coverage
NOTICE:  Finished checking for coverage of 5 holes
NOTICE:  Checking for node containing_face correctness
 error | id1 | id2 
-------+-----+-----
(0 rows)

strk=# select postgis_full_version();
postgis_full_version
POSTGIS="3.2.0dev 3.2.0alpha1-53-g6c2131ddc" [EXTENSION] PGSQL="120" GEOS="3.10.0-CAPI-1.16.0" PROJ="7.1.0" GDAL="GDAL 3.2.2, released 2021/03/05" LIBXML="2.9.10" LIBJSON="0.15" LIBPROTOBUF="1.3.3" WAGYU="0.5.0 (Internal)" (core procs from "3.2.0dev 3.1.0rc1-392-g4f6e4bd36" need upgrade) TOPOLOGY (topology procs from "3.2.0dev 3.1.0rc1-392-g4f6e4bd36" need upgrade) RASTER (raster procs from "3.2.0dev 3.1.0rc1-392-g4f6e4bd36" need upgrade)
(1 row)

comment:2 by Lars Aksel Opsahl, 2 years ago

Maybe this was fixed after latest install ?

postgis_full_version


POSTGIS="3.2.0dev 3.1.0rc1-398-g9ee72d5cb" [EXTENSION] PGSQL="120" GEOS="3.9.0-CAPI-1.16.2" PROJ="7.2.1" LIBXML="2.9.10" LIBJSON="0.13.1" LIBPROTOBUF="1.3.3" WAGYU="0.5.0 (Internal)" TOPOLOGY

(1 row)

comment:3 by strk, 2 years ago

I don't see a specific commit mentioning a fix for that. Are you getting validity errors ?

comment:4 by Lars Aksel Opsahl, 2 years ago

Yes, below is the output.

But are they errors or is this only missing data ?

            error            |   id1   | id2 
-----------------------------+---------+-----
 mixed face labeling in ring | -809712 |    
 mixed face labeling in ring | -806016 |    
 mixed face labeling in ring | -803571 |    
 face has multiple shells    |  328890 |    
 mixed face labeling in ring | -668822 |    
 mixed face labeling in ring | -598223 |    
 mixed face labeling in ring | -597069 |    
 mixed face labeling in ring | -596880 |    
 face has multiple shells    |  251145 |    
 mixed face labeling in ring | -551197 |    
 mixed face labeling in ring | -551169 |    
 mixed face labeling in ring | -551167 |    
 mixed face labeling in ring | -550970 |    
 mixed face labeling in ring | -550836 |    
 mixed face labeling in ring | -550487 |    
 mixed face labeling in ring | -549836 |    
 mixed face labeling in ring | -467156 |    
 mixed face labeling in ring | -467153 |    
 mixed face labeling in ring | -467151 |    
 mixed face labeling in ring | -467149 |    
 mixed face labeling in ring | -467148 |    
 mixed face labeling in ring | -467144 |    
 mixed face labeling in ring | -467135 |    
 mixed face labeling in ring | -467134 |    
 mixed face labeling in ring | -467131 |    
 mixed face labeling in ring | -467129 |    
 mixed face labeling in ring | -467127 |    
 mixed face labeling in ring | -467122 |    
 mixed face labeling in ring | -467121 |    
 mixed face labeling in ring | -467118 |    
 mixed face labeling in ring | -467115 |    
 mixed face labeling in ring | -467103 |    
 mixed face labeling in ring | -467099 |    
 mixed face labeling in ring | -467097 |    
 mixed face labeling in ring | -467090 |    
 mixed face labeling in ring | -467089 |    
 mixed face labeling in ring | -467082 |    
 mixed face labeling in ring | -467081 |    
 mixed face labeling in ring | -467076 |    
 mixed face labeling in ring | -467074 |    
 mixed face labeling in ring | -467067 |    
 mixed face labeling in ring | -467066 |    
 mixed face labeling in ring | -467062 |    
 mixed face labeling in ring | -467061 |    
 mixed face labeling in ring | -467050 |    
 mixed face labeling in ring | -467042 |    
 mixed face labeling in ring | -467041 |    
 mixed face labeling in ring | -467033 |    
 mixed face labeling in ring | -467029 |    
 mixed face labeling in ring | -467028 |    
 mixed face labeling in ring | -467026 |    
 mixed face labeling in ring | -467020 |    
 mixed face labeling in ring | -467017 |    
 mixed face labeling in ring | -467013 |    
 mixed face labeling in ring | -467010 |    
 mixed face labeling in ring | -467000 |    
 mixed face labeling in ring | -466994 |    
 mixed face labeling in ring | -466987 |    
 mixed face labeling in ring | -466979 |    
 mixed face labeling in ring | -466978 |    
 mixed face labeling in ring | -466966 |    
 mixed face labeling in ring | -466953 |    
 mixed face labeling in ring | -466952 |    
 mixed face labeling in ring | -466940 |    
 mixed face labeling in ring | -466912 |    
 mixed face labeling in ring | -466911 |    
 mixed face labeling in ring | -466903 |    
 mixed face labeling in ring | -466889 |    
 mixed face labeling in ring | -466885 |    
 mixed face labeling in ring | -466880 |    
 mixed face labeling in ring | -466875 |    
 mixed face labeling in ring | -466872 |    
 mixed face labeling in ring | -466841 |    
 mixed face labeling in ring | -466817 |    
 mixed face labeling in ring | -466812 |    
 mixed face labeling in ring | -466802 |    
 mixed face labeling in ring | -466793 |    
 mixed face labeling in ring | -466786 |    
 mixed face labeling in ring | -466777 |    
 mixed face labeling in ring | -466775 |    
 mixed face labeling in ring | -466773 |    
 mixed face labeling in ring | -466769 |    
 mixed face labeling in ring | -466765 |    
 mixed face labeling in ring | -466715 |    
 mixed face labeling in ring | -466712 |    
 mixed face labeling in ring | -466710 |    
 mixed face labeling in ring | -466674 |    
 mixed face labeling in ring | -466653 |    
 mixed face labeling in ring | -466634 |    
 mixed face labeling in ring | -466631 |    
 mixed face labeling in ring | -466575 |    
 mixed face labeling in ring | -466522 |    
 mixed face labeling in ring | -466490 |    
 mixed face labeling in ring | -466468 |    
 mixed face labeling in ring | -466467 |    
 mixed face labeling in ring | -466461 |    
 mixed face labeling in ring | -466451 |    
 mixed face labeling in ring | -466310 |    
 mixed face labeling in ring | -466243 |    
 mixed face labeling in ring | -466176 |    
 mixed face labeling in ring | -466140 |    
 mixed face labeling in ring | -269463 |    
 mixed face labeling in ring | -268265 |    
 mixed face labeling in ring | -247391 |    
 mixed face labeling in ring | -246851 |    
 mixed face labeling in ring |  244153 |    
 mixed face labeling in ring |  244712 |    
 mixed face labeling in ring |  245199 |    
 mixed face labeling in ring |  246346 |    
 mixed face labeling in ring |  247223 |    
 mixed face labeling in ring |  247548 |    
 mixed face labeling in ring |  248154 |    
 mixed face labeling in ring |  248864 |    
 mixed face labeling in ring |  530767 |    
 mixed face labeling in ring |  531658 |    
(115 rows)

comment:5 by strk, 2 years ago

I can reproduce. It occurs when topology errors are found:

NOTICE:  Checking for coincident nodes
NOTICE:  Checking for edges crossing nodes
NOTICE:  Checking for invalid or not-simple edges
NOTICE:  Checking for crossing edges
NOTICE:  Checking for edges start_node mismatch
NOTICE:  Checking for edges end_node mismatch
NOTICE:  Checking for faces without edges
NOTICE:  Checking edge linking
NOTICE:  Building edge rings
NOTICE:  Found 315 rings, 309 valid shells, 5 valid holes
            error            | id1  | id2 
-----------------------------+------+-----
 mixed face labeling in ring | -153 |    
(1 row)

strk=# select * from validateTopology('city_data');
NOTICE:  Checking for coincident nodes
NOTICE:  Checking for edges crossing nodes
NOTICE:  Checking for invalid or not-simple edges
NOTICE:  Checking for crossing edges
NOTICE:  Checking for edges start_node mismatch
NOTICE:  Checking for edges end_node mismatch
NOTICE:  Checking for faces without edges
NOTICE:  Checking edge linking
ERROR:  relation "shell_check" already exists
CONTEXT:  SQL statement "CREATE TEMP TABLE shell_check (
    face_id int PRIMARY KEY,
    ring_geom geometry
  )"
PL/pgSQL function _validatetopologyrings(geometry) line 12 at SQL statement
PL/pgSQL function validatetopology(character varying,geometry) line 300 at FOR over SELECT rows

Your errors are actual errors, not just missing data

comment:6 by Sandro Santilli <strk@…>, 2 years ago

In ad50a38/git:

Do not leave temporary tables around upon finding ring validity errors

References #5017 in master/main branch
Includes regression test

comment:7 by strk, 2 years ago

Component: postgistopology
Milestone: PostGIS 3.1.5PostGIS 3.2.0
Owner: changed from pramsey to strk
Resolution: fixed
Status: newclosed
Version: 2.5.xmaster

The bug is only in master branch, so closing this as fixed

Note: See TracTickets for help on using tickets.