<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>I have created a test database with sample data from the pgrouting manual 2.0.<br>Scripts to create the tables:<br><br>CREATE TABLE edge_table (<br>    id serial,<br>    dir character varying,<br>    source integer,<br>    target integer,<br>    cost double precision,<br>    reverse_cost double precision,<br>    x1 double precision,<br>    y1 double precision,<br>    x2 double precision,<br>    y2 double precision,<br>    the_geom geometry<br>);<br><br>INSERT INTO edge_table (cost,reverse_cost,x1,y1,x2,y2) VALUES ( 1, 1,  2,0,   2,1);<br>INSERT INTO edge_table (cost,reverse_cost,x1,y1,x2,y2) VALUES (-1, 1,  2,1,   3,1);<br>INSERT INTO edge_table (cost,reverse_cost,x1,y1,x2,y2) VALUES (-1, 1,  3,1,   4,1);<br>INSERT INTO edge_table (cost,reverse_cost,x1,y1,x2,y2) VALUES ( 1, 1,  2,1,   2,2);<br>INSERT INTO edge_table (cost,reverse_cost,x1,y1,x2,y2) VALUES ( 1,-1,  3,1,   3,2);<br>INSERT INTO edge_table (cost,reverse_cost,x1,y1,x2,y2) VALUES ( 1, 1,  0,2,   1,2);<br>INSERT INTO edge_table (cost,reverse_cost,x1,y1,x2,y2) VALUES ( 1, 1,  1,2,   2,2);<br>INSERT INTO edge_table (cost,reverse_cost,x1,y1,x2,y2) VALUES ( 1, 1,  2,2,   3,2);<br>INSERT INTO edge_table (cost,reverse_cost,x1,y1,x2,y2) VALUES ( 1, 1,  3,2,   4,2);<br>INSERT INTO edge_table (cost,reverse_cost,x1,y1,x2,y2) VALUES ( 1, 1,  2,2,   2,3);<br>INSERT INTO edge_table (cost,reverse_cost,x1,y1,x2,y2) VALUES ( 1,-1,  3,2,   3,3);<br>INSERT INTO edge_table (cost,reverse_cost,x1,y1,x2,y2) VALUES ( 1,-1,  2,3,   3,3);<br>INSERT INTO edge_table (cost,reverse_cost,x1,y1,x2,y2) VALUES ( 1,-1,  3,3,   4,3);<br>INSERT INTO edge_table (cost,reverse_cost,x1,y1,x2,y2) VALUES ( 1, 1,  2,3,   2,4);<br>INSERT INTO edge_table (cost,reverse_cost,x1,y1,x2,y2) VALUES ( 1, 1,  4,2,   4,3);<br>INSERT INTO edge_table (cost,reverse_cost,x1,y1,x2,y2) VALUES ( 1, 1,  4,1,   4,2);<br>INSERT INTO edge_table (cost,reverse_cost,x1,y1,x2,y2) VALUES ( 1, 1,  0.5,3.5,  1.999999999999,3.5);<br>INSERT INTO edge_table (cost,reverse_cost,x1,y1,x2,y2) VALUES ( 1, 1,  3.5,2.3,  3.5,4);<br><br>UPDATE edge_table SET the_geom = st_makeline(st_point(x1,y1),st_point(x2,y2)),<br>                      dir = CASE WHEN (cost>0 and reverse_cost>0) THEN 'B'   -- both ways<br>                                 WHEN (cost>0 and reverse_cost<0) THEN 'FT'  -- direction of the LINESSTRING<br>                                 WHEN (cost<0 and reverse_cost>0) THEN 'TF'  -- reverse direction of the LINESTRING<br>                                 ELSE '' END;                                -- unknown<br><br>SELECT pgr_createTopology('edge_table',0.001);<br><br><br>After the tables are created, I ran the following SQL to calculate the shortest path from node 1 to node 11:<br><br>SELECT seq, id1 AS node, id2 AS edge, cost<br>FROM pgr_trsp(<br>  'SELECT id, source, target, cost FROM edge_table',<br>  1, 11, false, false<br>);<br><br>This was the result:<br>0;-1;0;0<br><br><br>But, when I used the other variant of pgr_trsp() to calculate the shortest path from edge 1 (position 0) to edge 11 (position 1):<br><br>SELECT seq, id1 AS node, id2 AS edge, cost<br>FROM pgr_trsp(<br>  'SELECT id, source, target, cost FROM edge_table',<br>  1, 0, 11, 1, false, false<br>);<br><br>I got the correct result:<br>0;1;1;1<br>1;2;4;1<br>2;5;8;1<br>3;6;11;1<br>4;11;-1;0<br><br><br>My system is running on Windows 7 Professional SP1 64-bit. My PostgreSQL info:<br><br>SELECT version();<br>PostgreSQL 9.3.5, compiled by Visual C++ build 1600, 64-bit<br><br>SELECT postgis_full_version();<br>POSTGIS="2.1.4 r12966" GEOS="3.4.2-CAPI-1.8.2 r3924" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.11.0, released 2014/04/16" LIBXML="2.7.8" LIBJSON="UNKNOWN" RASTER<br><br>SELECT pgr_version();<br>(2.0.0,pgrouting-2.0.0,0,d6ed2cb,master,1.53.0)<br><br><br>Dunno if this is a bug, so I posted it to the mailing list and hopefully someone can take a look at this.<br>Thank you.<br>                                          </div></body>
</html>