[pgrouting-users] Error in "dijkstra_sp_delta_directed" line 83
Mathias Villeger
mathias.villeger at gmail.com
Thu Jun 21 02:25:35 PDT 2012
Hi Daniel,
I added type casts to request parameters but the error persists :
SELECT gid, the_geom FROM dijkstra_sp_delta( CAST( 'routes' AS varchar ),
CAST( :source AS int4 ), CAST( :target AS int4 ), CAST( :delta AS float8 )
);
I solved it changing this bloc of function dijkstra_sp_delta_directed :
*FOR rec IN EXECUTE 'SELECT CASE WHEN '||source_x||'<'||target_x||
' THEN '||source_x||' ELSE '||target_x||
' END as ll_x, CASE WHEN '||source_x||'>'||target_x||
' THEN '||source_x||' ELSE '||target_x||' END as ur_x'
LOOP
END LOOP;
ll_x := rec.ll_x;
ur_x := rec.ur_x;
FOR rec IN EXECUTE 'SELECT CASE WHEN '||source_y||'<'||
target_y||' THEN '||source_y||' ELSE '||
target_y||' END as ll_y, CASE WHEN '||
source_y||'>'||target_y||' THEN '||
source_y||' ELSE '||target_y||' END as ur_y'
LOOP
END LOOP;*
with bloc :
* # Cast in Float to prevent plan error in PostgreSQL
FOR rec IN EXECUTE 'SELECT CASE WHEN CAST('||source_x||' as float8)<
CAST('||target_x||
' as float8) THEN CAST('||source_x||' as float8) ELSE
CAST('||target_x||
' as float8) END as ll_x, CASE WHEN CAST('||source_x||' as
float8)>CAST('||target_x||
' as float8) THEN CAST('||source_x||' as float8) ELSE
CAST('||target_x||' as float8) END as ur_x'
LOOP
END LOOP;
ll_x := rec.ll_x;
ur_x := rec.ur_x;
# Cast in Float to prevent plan error in PostgreSQL
FOR rec IN EXECUTE 'SELECT CASE WHEN CAST('||source_y||' as
float8)<CAST('||
target_y||' as float8) THEN CAST('||source_y||' as float8) ELSE
CAST('||
target_y||' as float8) END as ll_y, CASE WHEN CAST('||
source_y||' as float8)>CAST('||target_y||' as float8) THEN
CAST('||
source_y||' as float8) ELSE CAST('||target_y||' as float8) END
as ur_y'
LOOP
END LOOP;*
The error occured when source_x has not any decimal.
Should I create an issue on issue tracker?
Mathias.
2012/6/21 Daniel Kastl <daniel at georepublic.de>
> Hi Mathias,
>
> Could you post the query?
> The pgRouting function you're using is this one:
>
> https://github.com/pgRouting/pgrouting/blob/master/core/sql/routing_core_wrappers.sql#L594
>
> Can you check if the expected parameters have the right data types?
> If the data type is not correct it sometimes is enough to type cast.
>
> Daniel
>
>
> On Thu, Jun 21, 2012 at 9:57 AM, Mathias Villeger <
> mathias.villeger at gmail.com> wrote:
>
>> Hello,
>>
>> I get the following error using the dijkstra_sp_delta function :
>>
>> type of parameter 33 (integer) does not match that when preparing the
>> plan (numeric)
>> Où : PL/pgSQL function "dijkstra_sp_delta_directed" line 83 at
>> assignment
>> PL/pgSQL function "dijkstra_sp_delta" line 19 at FOR over EXECUTE
>> statement
>>
>> I didn't find anything about that.
>> I'm using postgis with a java application. Calls are done with
>> Hibernate's named queries, but I don't think that the use of Hibernate is
>> the cause of this error.
>> The error occurs randomly : A failing request can work at its next call.
>>
>> Versions :
>> Postgres 9.1
>> Postgis 1.5
>> Pgrouting 1.0.5
>>
>> Any idea about this?
>>
>> Regards,
>>
>> Mathias.
>> _______________________________________________
>> Pgrouting-users mailing list
>> Pgrouting-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/pgrouting-users
>>
>>
>
>
> --
> Georepublic UG & Georepublic Japan
> eMail: daniel.kastl at georepublic.de
> Web: http://georepublic.de
>
> _______________________________________________
> Pgrouting-users mailing list
> Pgrouting-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/pgrouting-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/pgrouting-users/attachments/20120621/ccb655ef/attachment.html>
More information about the Pgrouting-users
mailing list