[pgrouting-users] Function shortest_path does not exist

Hey everybody,

Sorry for disturbing you but I’m a little bit lost in one simple and probably easy to solve issue but I can’t see it anymore. What is wrong with this request? Why is the inner-query treated as unknown instead of text? Thank you!

postgres=# SELECT * FROM shortest_path(‘SELECT gid as id, source::integer, target::integer, length::double precision as cost FROM ways’,10, 20, false, false);

ERROR: function shortest_path(unknown, integer, integer, boolean, boolean) does not exist

LINE 1: SELECT * FROM shortest_path('SELECT gid as id, source::integ…

HINT: No function matches the given name and argument types. You might need to add explicit type casts.

The function does exist because I executed:

CREATE OR REPLACE FUNCTION shortest_path(sql text, source_id integer, target_id integer, directed boolean, has_reverse_cost boolean)
RETURNS SETOF path_result AS
‘/usr/lib/postgresql/8.4/lib/librouting’, ‘shortest_path’
LANGUAGE ‘c’ IMMUTABLE STRICT
COST 1
ROWS 1000;
ALTER FUNCTION shortest_path(text, integer, integer, boolean, boolean) OWNER TO postgres;

Regards

Frank

Hello Frank,

You need to login to your pgrouting db instead of postgres db.
Try this from terminal and then running the query:
psql -d <pgrouting_db> -U

Yasir

On 29 July 2010 12:32, Salet Frank <frank.salet@localyse.nl> wrote:

Hey everybody,

Sorry for disturbing you but I’m a little bit lost in one simple and probably easy to solve issue but I can’t see it anymore. What is wrong with this request? Why is the inner-query treated as unknown instead of text? Thank you!

postgres=# SELECT * FROM shortest_path(‘SELECT gid as id, source::integer, target::integer, length::double precision as cost FROM ways’,10, 20, false, false);

ERROR: function shortest_path(unknown, integer, integer, boolean, boolean) does not exist

LINE 1: SELECT * FROM shortest_path('SELECT gid as id, source::integ…

HINT: No function matches the given name and argument types. You might need to add explicit type casts.

The function does exist because I executed:

CREATE OR REPLACE FUNCTION shortest_path(sql text, source_id integer, target_id integer, directed boolean, has_reverse_cost boolean)
RETURNS SETOF path_result AS
‘/usr/lib/postgresql/8.4/lib/librouting’, ‘shortest_path’
LANGUAGE ‘c’ IMMUTABLE STRICT
COST 1
ROWS 1000;
ALTER FUNCTION shortest_path(text, integer, integer, boolean, boolean) OWNER TO postgres;

Regards

Frank


Pgrouting-users mailing list
Pgrouting-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-users