#5298 closed defect (fixed)
CopyTopology: ERROR: TopoGeometry 14678 does not exist in the child layer 1
Reported by: | strk | Owned by: | strk |
---|---|---|---|
Priority: | high | Milestone: | PostGIS 3.3.3 |
Component: | topology | Version: | 3.3.x |
Keywords: | Cc: |
Description (last modified by )
When trying to copy a topology I get this error:
CopyTopology: ERROR: TopoGeometry 14678 does not exist in the child layer 1
Context:
PL/pgSQL relationtrigger() riga 59 a RAISE istruzione SQL " INSERT INTO topo_italia_20221207.relation SELECT * FROM topo_italia.relation " funzione PL/pgSQL copytopology(character varying,character varying) riga 83 a EXECUTE
PostGIS version is 3.3.1
Change History (8)
comment:1 by , 2 years ago
Cc: | removed |
---|---|
Description: | modified (diff) |
comment:2 by , 2 years ago
comment:3 by , 2 years ago
Interesting enough, the topogeometry DOES exist in the relation table for layer_id=1:
=# Select * from topo_italia.relation where topogeo_id = 14678; topogeo_id | layer_id | element_id | element_type ------------+----------+------------+-------------- 14678 | 1 | 1769 | 3
comment:4 by , 2 years ago
I could reproduce the problem locally by running an UPDATE of relation records associated with primitive layers, so that they would be processed LAST in the INSERT query shown as context:
=# update topo_italia.relation set layer_id = 1 where layer_id = 1; UPDATE 8756 toto=# select copytopology('topo_italia', 'topo_italia20221207'); ERROR: TopoGeometry 7590 does not exist in the child layer 1 CONTEXT: PL/pgSQL function relationtrigger() line 59 at RAISE SQL statement " INSERT INTO topo_italia20221207.relation SELECT * FROM topo_italia.relation " PL/pgSQL function copytopology(character varying,character varying) line 83 at EXECUTE
Basically the relationtrigger
seems to be running for each row instead of for each statement and it does not allow insertint a record of a hierarchical topogeometry BEFORE the underlying topogeometry.
One solution should be to disable the trigger during the copy and re-enable it afterwards.
comment:5 by , 2 years ago
Testcase pushed in https://git.osgeo.org/gitea/postgis/postgis/pulls/117 —- fix yet to be implemented
comment:8 by , 2 years ago
Although 3.2 and earlier are also affected the patch doesn't apply cleanly and I don't think it's worth spending the time on backporting further anyway, given the many topology improvements in 3.3
It would be useful for the message (at the bare minimum) to report the ID of the topogeometry