[PostGIS] #5983: Data corruption in topology.topoelement and topology.topogeometry after upgrade to 3.6.0

PostGIS trac at osgeo.org
Wed Nov 12 00:45:30 PST 2025


#5983: Data corruption in topology.topoelement and topology.topogeometry after
upgrade to 3.6.0
-----------------------+---------------------------
  Reporter:  packi     |      Owner:  robe
      Type:  defect    |     Status:  new
  Priority:  blocker   |  Milestone:  PostGIS 3.6.1
 Component:  topology  |    Version:  3.6.x
Resolution:            |   Keywords:
-----------------------+---------------------------
Comment (by robe):

 okay there is another issue which I ran into when trying to fix the
 topogeometry in the hook-after-upgrade-topology.sql.  The fix fails on
 this because of the index in place.  The index is:

 CREATE INDEX ON upgrade_test.feature ( id(tg) );

 So since it relies on id which is corrupt, the fixing of the corrupt fails
 with:


 {{{
 NOTICE:  schema "public" already exists, skipping
 psql:../../topology/test/regress/hooks/hook-after-upgrade-topology.sql:3:
 ERROR:  attribute 3 has wrong type
 DETAIL:  Table has type bigint, but query expects integer.
 CONTEXT:  SQL statement "UPDATE upgrade_test.feature
                 SET
            tg = (
              (tg).topology_id,
             (tg).layer_id,
              ((tg).id & 0xFFFFFFFF)::bigint,
              ((tg).id >> 32)::integer
            )::topology.topogeometry
          WHERE (  (tg).id & 0xFFFFFFFF )::bigint <> (tg).id OR  (  (tg).id
 >> 32 )::integer = (tg).type  "
 PL/pgSQL function fixcorrupttopogeometrycolumn(name,name,name) line 23 at
 EXECUTE

 }}}

 So I guess I should revise the script to drop indexes that have anything
 to do with the topogeometry column before attempting a fix and then readd
 the indexes.  Not sure how common this is for people to do.
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5983#comment:29>
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