[postgis-tickets] [PostGIS] #5118: DropTopology: ERROR: update or delete on table "topology" violates foreign key constraint "layer_topology_id_fkey" on table "layer"

PostGIS trac at osgeo.org
Mon Mar 28 04:57:36 PDT 2022


#5118: DropTopology: ERROR:  update or delete on table "topology" violates foreign
key constraint "layer_topology_id_fkey" on table "layer"
----------------------+---------------------------
 Reporter:  strk      |      Owner:  strk
     Type:  defect    |     Status:  new
 Priority:  medium    |  Milestone:  PostGIS 3.3.0
Component:  topology  |    Version:  3.2.x
 Keywords:            |
----------------------+---------------------------
 {{{
 xxx=# select * from topology.layer;
  topology_id | layer_id | schema_name |  table_name   | feature_column |
 feature_type | level | child_id
 -------------+----------+-------------+---------------+----------------+--------------+-------+----------
           17 |        1 | features    | land_parcels  | feature        |
 3 |     0 |
           17 |        2 | features    | traffic_signs | feature        |
 1 |     0 |
           17 |        3 | features    | city_streets  | feature        |
 2 |     0 |
 (3 rows)

 xxx=# select * from topology.topology;
  id |   name    | srid | precision | hasz
 ----+-----------+------+-----------+------
   1 | tt        |    0 |         0 | f
  17 | city_data | 4326 |         0 | f
 (2 rows)
 xxx=# select droptopology('city_data');
 NOTICE:  Dropping all layers from topology 'city_data' (17)
 NOTICE:  sequence "topogeo_s_1" does not exist
 NOTICE:  A record in city_data.relation still references layer 1
 NOTICE:  sequence "topogeo_s_2" does not exist
 NOTICE:  A record in city_data.relation still references layer 2
 NOTICE:  sequence "topogeo_s_3" does not exist
 NOTICE:  A record in city_data.relation still references layer 3
 ERROR:  update or delete on table "topology" violates foreign key
 constraint "layer_topology_id_fkey" on table "layer"
 DETAIL:  Key (id)=(17) is still referenced from table "layer".
 CONTEXT:  SQL statement "DELETE FROM topology.topology WHERE id = $1"
 xxx=# select version();
                                                             version
 --------------------------------------------------------------------------------------------------------------------------------
  PostgreSQL 13.5 (Ubuntu 13.5-0ubuntu0.21.04.1) on x86_64-pc-linux-gnu,
 compiled by gcc (Ubuntu 10.3.0-1ubuntu1) 10.3.0, 64-bit
 (1 row)
 xxx=# select postgis_full_version();
 postgis_full_version
 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  POSTGIS="3.3.0dev 3.2.0-656-g1ba6bccae" [EXTENSION] PGSQL="130"
 GEOS="3.11.0dev-CAPI-1.16.0" PROJ="7.2.1" LIBXML="2.9.10" LIBJSON="0.15"
 LIBPROTOBUF="1.3.3" WAGYU="0.5.0 (Internal)" TOPOLOGY
 (1 row)
 }}}
 }}}

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5118>
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