Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am running this simple query

select id,gid from dijkstra_sp('roads',22,33)

This works perfectly fine and returns results in postgres query terminal. However running exactly the same query in java triggers the error:

Could anyone tell me how to solve this issue?

yours sincerely.

share|improve this question
For some reason the error was not posted. The error is: <org.postgresql.util.PSQLException: ERROR: type "geoms" does not exist Where: compilation of PL/pgSQL function "dijkstra_sp" near line 6> – mustafa al attar Jul 13 '12 at 10:02

I figure out what I was doing wrong. I needed to add the datatypes to the connection so that postgres jdbc driver understands the new datatypes. Simply I added

((org.postgresql.PGConnection)SQLConnectionOBJ ).addDataType("box3d",PGbox3d.class); ((org.postgresql.PGConnection)SQLConnectionOBJ ).addDataType("geoms",PGgeometry.class);

and it worked like charm. Thank you sanak for your answer.

share|improve this answer

I am not familiar with JDBC PostgreSQL driver, but it seems that JDBC driver compile PL/pgSQL function at runtime, and another type("geoms") compiling is fail.

If you want to get the same result, try the following plain query instead of above query.

SELECT ROW_NUMBER() OVER()::integer AS id, gid 
    FROM shortest_path(
        'SELECT gid AS id,
            length::double precision AS cost
            FROM roads',
         22, 33, false, false), roads
    WHERE edge_id = gid;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.