BEGIN;
BEGIN
SET client_min_messages TO NOTICE;
SET
CREATE TABLE maptest as 
SELECT  671222::integer as id, 318255::integer as  source, 222698::integer as target, 14.02::float8 as cost, 14.02::float8 as reverse_cost UNION ALL
SELECT  671223, 222698, 36655, 197.16, 197.16 UNION ALL
SELECT  582877, 408918, 5556, 458.09, 458.09 UNION ALL
SELECT  582876, 318255, 408918, 3.89, 3.89 UNION ALL
SELECT  585280, 5556, 454424, 54.84, 54.84;
SELECT 5
q1
SELECT seq, id1 AS node, id2 AS edge, cost::numeric(11,4)
FROM pgr_trsp(
    'select * from maptest',
    582877,     
    0,          
    582877,     
    0.5,        
    true,        
    true,      
    null 
) PG ;
 seq | node | edge | cost 
-----+------+------+------
(0 rows)

q2
SELECT seq, id1 AS node, id2 AS edge, cost::numeric(11,4)
FROM pgr_trsp(
    'select * from maptest',
    582877,     
    0.0000000001,          
    582877,     
    0.5,        
    true,        
    true,      
    null 
) PG ;
 seq | node |  edge  |   cost   
-----+------+--------+----------
   0 |   -1 | 582877 | 229.0450
   1 |   -2 |     -1 |   0.0000
(2 rows)

q3
SELECT seq, id1 AS node, id2 AS edge, cost::numeric(11,4)
FROM pgr_trsp(
    'select * from maptest',
    582877,     
    0,         
    582877,     
    0.5,        
    true,        
    true,      
    $$SELECT 100::float AS to_cost, 25::INTEGER AS target_id, '32, 33'::TEXT AS via_path$$
) PG ;
 seq | node |  edge  |   cost   
-----+------+--------+----------
   0 |   -1 | 582877 | 229.0450
(1 row)

q4
SELECT seq, id1 AS node, id2 AS edge, cost::numeric(11,4)
FROM pgr_trsp(
    'select * from maptest',
    582877,     
    0.0000000001,          
    582877,     
    0.5,        
    true,        
    true,      
    $$SELECT 100::float AS to_cost, 25::INTEGER AS target_id, '32, 33'::TEXT AS via_path$$
) PG ;
 seq | node |  edge  |   cost   
-----+------+--------+----------
   0 |   -1 | 582877 | 229.0450
(1 row)

q5
ROLLBACK;
ROLLBACK
