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

PostGIS trac at osgeo.org
Fri Oct 17 08:53:28 PDT 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 francoisb):

 Replying to [comment:12 strk]:
 > I wouldn't know how we can tell which data was created BEFORE the
 catalog update and which data was created AFTER it, unless we can compare
 the transaction identifiers between the rows in the tables and the domain
 catalog row ?
 >

 The upgrade path from 3.6.0 is indeed challenging, because one needs to
 distinguish:
 - Topogeometry columns that need fixing, because created before the 3.6.0
 upgrade, not somehow manually fixed already, and still have bad values.
 - Topogeometry columns that do NOT need fixing, because created after the
 3.6.0 upgrade (and have correct values to begin with), or the user somehow
 managed to fix the bad values already.

 > Or we could use some fuzzy logic to check if any data value would be
 invalid, and bet on that being caused by the corruption.

 Exactly. A possible heuristic to answer this: All topogeometry columns
 have a built-in `CHECK` constraint to enforce a correct `type` subfield
 (from 1 to 4, depending on layer geometry type). Bad topogeometry values
 have garbage for this `type` (depending on memory contents, usually 0 at
 the beginning of a session), which is therefore violating the constraint.
 An actual value other than the one of the 4 valid ones defined in the
 `CHECK` constraint, and this in any row of a table, could be a criteria to
 trigger data recovery path for the entire table.
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5983#comment:18>
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