The stop_seq field is part of the primary key of table stop_times. As we remap stop_seq in an increasing order, remapping negative values can lead to unique constraint failure as we move indexes to larger values (for example -1 is remapped to 0 before 0 is remapped to 1).
To solve this, we need to analyze the graph of remapping and start with the non-conflicting indexes first, as processing in a decreasing order for negative values can also fail if we have non-consecutive indexes: for example the following sequence: { -2, -1, 0, 4, 6 } => { 0, 1, 2, 3, 4 } (Here the first remap 6 to 4 will fail).
The
stop_seq
field is part of the primary key of tablestop_times
. As we remapstop_seq
in an increasing order, remapping negative values can lead to unique constraint failure as we move indexes to larger values (for example -1 is remapped to 0 before 0 is remapped to 1).To solve this, we need to analyze the graph of remapping and start with the non-conflicting indexes first, as processing in a decreasing order for negative values can also fail if we have non-consecutive indexes: for example the following sequence: { -2, -1, 0, 4, 6 } => { 0, 1, 2, 3, 4 } (Here the first remap 6 to 4 will fail).