Paul Ramsey's original example was, I would guess, intended to be the shortest, simplest example of using recursive functions. Adding more complexity to the example will just make it harder to understand.   It was never intended to be the basis for a full solution and has a fundamentally flawed architecture for that purpose; it confound toplogy extraction with network walking.

I would suggest to the original poster that they switch over to pg_routing which already has robust solutions to the problems they are likely to encounter.  In particular, the network walking algorithms use the Boost Graph C++ library are likely to execute far faster than anything which can be written in PL/pgSQL or python.

Ruven Brooks



On 5/8/2022 3:09 PM, Shaozhong SHI wrote:
Hi, Imre,

There is a possibility that the Walk the Network (Network Walking in PostGIS · Paul Ramsey (cleverelephant.ca) <http://blog.cleverelephant.ca/2010/07/network-walking-in-postgis.html?m=1&msclkid=5cf8409ecf0a11ecbbe2896397a25c2b>)   encountered more than 2 answers/outputs.

It may get confused and cannot finish.

Can we build something in the script to report these and should there be an exception, allow it to complete the task?

Regards,

David

On Sun, 8 May 2022 at 00:59, Imre Samu <[email protected]> wrote:

    Hi David,
    > There is a loop of recursive query.  It runs at a point where it
    stops.
    >Can anyone provide pointers how to solve this problem or work around?

    Please share "this" recursive query;

    My guess:  Probably you have a "forever/endless loop" in your
    data; *so you have to LIMIT the recursive part ;*

    related links :
    1.)  with limiting "depth"  ( wheredepth <1000 )
    "Prevent infinite loop in recursive query in Postgresql"
    
https://stackoverflow.com/questions/51025607/prevent-infinite-loop-in-recursive-query-in-postgresql
    2.)  with LIMITING clause
    https://www.cybertec-postgresql.com/en/recursive-queries-postgresql/
    /"This example also demonstrates how an endless loop can be
    avoided with a LIMIT clause on the parent query."/

    Regards,
      Imre

    Shaozhong SHI <[email protected]> ezt írta (időpont: 2022.
    máj. 7., Szo, 15:23):

        There is a loop of recursive query.  It runs at a point where
        it stops.

        This error turned up.- ERROR:  invalid memory alloc request
        size 1073741824

        Can anyone provide pointers how to solve this problem or work
        around?

        Regards,

        David
        _______________________________________________
        postgis-users mailing list
        [email protected]
        https://lists.osgeo.org/mailman/listinfo/postgis-users

    _______________________________________________
    postgis-users mailing list
    [email protected]
    https://lists.osgeo.org/mailman/listinfo/postgis-users


_______________________________________________
postgis-users mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/postgis-users

Reply via email to