Skip to content
Vicky Vergara edited this page Mar 14, 2017 · 4 revisions

Migrating from 2.4 to 2.5

pgr_bdAstar

How to detect that it needs migration

  • when the output columns are (seq, id1, id2, cost)
  • when the pgr_bdAstar ends with two boolean values
  • when the inner query columns need casting

What to do

  • Adjust the returning to the new column names (seq, path_seq, node, edge, cost, agg_cost)
    • id1 is now node
    • id2 is now edge
  • Remove the inner query casting
  • Remove any contradiction
    • when the last boolean value has a value false: physically the column reverse_cost must not exist in the inner query
    • when the last boolean value has a value true: physically the column reverse_cost must exist in the inner query
  • Remove the last boolean value

Example

SELECT seq, id1, id2, cost FROM pgr_bdAStar(
    'SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost, x1, y1, x2, y2
     FROM edge_table',
    4, 10, false, false);

migrates to

SELECT seq, path_seq, node, edge, cost, agg_cost FROM pgr_bdAStar(
    'SELECT id, source, target, cost, x1, y1, x2, y2
     FROM edge_table',
    4, 10, false);

pgr_maxFlowBoykovKolmogorov, pgr_maxFlowEdmondsKarp, pgr_maxFlowPushRelabel

How to detect that it needs migration

  • The function has maxFlow on the name
  • when the output columns are (seq, edge_id, source, target, flow, residual_capacity)

What to do

  • Adjust the returning columns to the new column names (seq, edge, start_vid, end_vid, flow, residual_capacity)
    • source is now start_vid
    • target is now end_vid
  • Change the name acordingly:
    • pgr_maxFlowBoykovKolmogorov to pgr_boykovKolmogorov
    • pgr_maxFlowEdmondsKarp to pgr_edmondsKarp
    • pgr_maxFlowPushRelabel to pgr_pushRelabel

Example

SELECT seq, edge_id, source, target, flow, residual_capacity
FROM pgr_maxFlowBoykovKolmogorov(
    'SELECT id, source, target, capacity, reverse_capacity
    FROM edge_table',
    6, 11
);

migrates to

SELECT seq, edge, start_vid, end_vid, flow, residual_capacity
FROM pgr_boykovKolmogorov(
    'SELECT id, source, target, capacity, reverse_capacity
    FROM edge_table',
    6, 11
);

Others

pgr_pointToId

Availability: 2.0.x Deprecated: 2.1.0

what to do

given 'my_table' with the columns (gid, my_point_geom)

SELECT gid AS id
FROM  my_table
WHERE ST_Equals( my_point_geom, ST_SetSRID(ST_Point(-71.1043443253471, 42.3150676015829),4326))

Clone this wiki locally