- Notifications
You must be signed in to change notification settings - Fork28
Commit620dddf
committed
> 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.Good point. Thank you Masaru for the suggested fix.Attached is a patch to fix the bug found by Masaru. His example nowproduces:regression=# SELECT * FROM connectby('connectby_tree', 'keyid','parent_keyid', '11', 0, '-') AS t(keyid int, parent_keyid int, levelint,branch text); keyid | parent_keyid | level | branch-------+--------------+-------+---------- 11 | | 0 | 11 10 | 11 | 1 | 11-10 111 | 11 | 1 | 11-111 1 | 111 | 2 | 11-111-1(4 rows)While making the patch I also realized that the "no show branch" form ofthe function was not going to work very well for recursion detection.Therefore there is now a default branch delimiter ('~') that is usedinternally, for that case, to enable recursion detection to work. Ifyou need a different delimiter for your specific data, you will have touse the "show branch" form of the function.Joe Conway1 parenta0bf250 commit620dddf
2 files changed
+29
-7
lines changedLines changed: 7 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
365 | 365 |
| |
366 | 366 |
| |
367 | 367 |
| |
368 |
| - | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
369 | 371 |
| |
370 | 372 |
| |
371 | 373 |
| |
| |||
388 | 390 |
| |
389 | 391 |
| |
390 | 392 |
| |
391 |
| - | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
392 | 397 |
| |
393 | 398 |
| |
394 | 399 |
| |
|
Lines changed: 22 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
652 | 652 |
| |
653 | 653 |
| |
654 | 654 |
| |
| 655 | + | |
| 656 | + | |
| 657 | + | |
655 | 658 |
| |
656 | 659 |
| |
657 | 660 |
| |
| |||
798 | 801 |
| |
799 | 802 |
| |
800 | 803 |
| |
| 804 | + | |
| 805 | + | |
801 | 806 |
| |
802 | 807 |
| |
803 | 808 |
| |
804 | 809 |
| |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
805 | 814 |
| |
806 | 815 |
| |
807 | 816 |
| |
| |||
854 | 863 |
| |
855 | 864 |
| |
856 | 865 |
| |
| 866 | + | |
857 | 867 |
| |
858 | 868 |
| |
859 | 869 |
| |
860 | 870 |
| |
861 | 871 |
| |
862 | 872 |
| |
| 873 | + | |
863 | 874 |
| |
864 | 875 |
| |
865 |
| - | |
866 |
| - | |
867 |
| - | |
868 |
| - | |
869 | 876 |
| |
870 | 877 |
| |
871 | 878 |
| |
872 |
| - | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
873 | 884 |
| |
874 | 885 |
| |
875 | 886 |
| |
| |||
913 | 924 |
| |
914 | 925 |
| |
915 | 926 |
| |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
916 | 933 |
| |
917 | 934 |
| |
918 | 935 |
| |
|
0 commit comments
Comments
(0)