I use PostgreSQL 9.5.3, PostGIS 2.2 and pgRouting 2.3.2.

I have the same problem as Shortest Path Dijkstra because I use the same data with the same columns but when I put

 SELECT seq, id1 AS node, id2 AS edge, cost, b.the_geom, b.osm_name FROM pgr_dijkstra('

            SELECT id,
                     length::double precision AS cost
                    FROM at_2po_4pgr',
            30, 60, false, false) a LEFT JOIN at_2po_4pgr b ON (a.id2 = b.id);

into SQL window I got

ERROR: column link "cost" is ambiguous

How do I change cost atrribute?

I made it using this code:

SELECT seq, id1 AS node, id2 AS edge, di.cost, geom_way, osm_name  FROM pgr_dijkstra(
'SELECT id, source, target, st_length(geom_way) as cost FROM aa_2po_4pgr',
23941, 24159, false, false  ) as di  JOIN aa_2po_4pgr  ON di.id2 = aa_2po_4pgr.id

closed as off-topic by Ian Turton Feb 18 '17 at 14:48

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This problem cannot or can no longer be reproduced. Changes to the system or to the asker's circumstances may have rendered the question obsolete, or the question does not include a procedure to enable potential answerers to reproduce the same symptoms. Such questions are off-topic as they are unlikely to help future readers, but editing them to include more details can lead to re-opening." – Ian Turton
If this question can be reworded to fit the rules in the help center, please edit the question.

  • change define which cost you want - a.cost probably – Ian Turton Feb 17 '17 at 14:46
  • Yes. I know that, but which query do I have to use? I'm completly green here. I checked my data with pgrouting plugin on QGIS and every works fine. I'm sad that there is no small window in this plugin which shows queriers that was made in QGIS. – bass Feb 17 '17 at 16:32
  • Ok, I made it by myself. – bass Feb 18 '17 at 14:44
  • 1
    The problem is that you have cost in at_2po_4pgr a and b, so the optimiizer doesn't know which one you are referring to. If you put a.cost or b.cost in the select, the error will go away. – John Powell Feb 19 '17 at 12:00

Browse other questions tagged or ask your own question.