Re: About connectby() - Mailing list pgsql-hackers

From Masaru Sugawara
Subject Re: About connectby()
Date
Msg-id 20020908222757.DD7F.RK73@sea.plala.or.jp
Whole thread Raw
In response to Re: About connectby()  (Joe Conway <mail@joeconway.com>)
List pgsql-hackers
On Sat, 07 Sep 2002 10:26:36 -0700
Joe Conway <mail@joeconway.com> wrote:

> 
> OK -- patch submitted to fix this. Once the patch is applied, this case 
> gives:
> 
> test=# SELECT * FROM connectby('connectby_tree', 'keyid', 
> 'parent_keyid', '2', 0, '~') AS t(keyid int, parent_keyid int, level 
> int, branch text);
> ERROR:  infinite recursion detected

 Thank you for your patch.


> 
> If you specifically limit the depth to less than where the repeated key 
> is hit, everything works as before:

And I also think this approach is reasonable.


> 
> test=# SELECT * FROM connectby('connectby_tree', 'keyid', 
> 'parent_keyid', '2', 4, '~') AS t(keyid int, parent_keyid int, level 
> int, branch text);
>   keyid | parent_keyid | level |   branch
> -------+--------------+-------+-------------
>       2 |              |     0 | 2
>       4 |            2 |     1 | 2~4
>       6 |            4 |     2 | 2~4~6
>       8 |            6 |     3 | 2~4~6~8
>       5 |            2 |     1 | 2~5
>       9 |            5 |     2 | 2~5~9
>      10 |            9 |     3 | 2~5~9~10
>      11 |           10 |     4 | 2~5~9~10~11
> (8 rows)
> 
> Thanks for the feedback!
> 
> Joe
> 
> 

Regards,
Masaru Sugawara




pgsql-hackers by date:

Previous
From: Michael Meskes
Date:
Subject: 7.3beta and ecpg
Next
From: Hervé Piedvache
Date:
Subject: Importing data from 7.2.2 into 7.3b1 !?