About connectby() again
От | Masaru Sugawara |
---|---|
Тема | About connectby() again |
Дата | |
Msg-id | 20020927020159.216C.RK73@sea.plala.or.jp обсуждение исходный текст |
Ответы |
Re: About connectby() again
|
Список | pgsql-hackers |
On Sat, 07 Sep 2002 10:21:21 -0700 Joe Conway <mail@joeconway.com> wrote: > I just sent in a patch using the ancestor check method. It turned out > that the performance hit was pretty small on a moderate sized tree. > > My test case was a 220000 record bill-of-material table. The tree built > was 9 levels deep with about 3800 nodes. The performance hit was only > about 1%. The previous patch fixed an infinite recursion bug in contrib/tablefunc/tablefunc.c:connectby. But, other unmanageable error seems to occur even if a table has commonplace tree data(see below). I would think the patch, ancestor check, should be if (strstr(branch_delim || branchstr->data || branch_delim, branch_delim || current_key || branch_delim)) This is my image, not a real code. However, if branchstr->data includes branch_delim, my image will not be perfect. -- test connectby with int based hierarchy DROP TABLE connectby_tree; CREATE TABLE connectby_tree(keyid int, parent_keyid int); INSERT INTO connectby_tree VALUES(11,NULL); INSERT INTO connectby_tree VALUES(10,11); INSERT INTO connectby_tree VALUES(111,11); INSERT INTO connectby_tree VALUES(1,111); SELECT * FROM connectby('connectby_tree', 'keyid', 'parent_keyid', '11', 0, '-') AS t(keyid int, parent_keyid int, levelint, branch text) ERROR: infinite recursion detected Regards, Masaru Sugawara
В списке pgsql-hackers по дате отправления: