parameter was given, the last output column is a serial number, and must
be of type <type>integer</type>.
</para>
<para>
The <quote>branch</quote> output column shows the path of keys taken to
reach the current row. The keys are separated by the specified
<parameter>branch_delim</parameter> string. If no branch display is
wanted, omit both the <parameter>branch_delim</parameter> parameter
and the branch column in the output column list.
</para>
<para>
If the ordering of siblings of the same parent is important,
include the <parameter>orderby_fld</parameter> parameter to
specify which field to order siblings by. This field can be of any
sortable data type. The output column list must include a final
integer serial-number column, if and only if
<parameter>orderby_fld</parameter> is specified.
</para>
<para>
The parameters representing table and field names are copied as-is
into the SQL queries that <function>connectby</function> generates internally.
Therefore, include double quotes if the names are mixed-case or contain
special characters. You may also need to schema-qualify the table name.
</para>
<para>
In large tables, performance will be poor unless there is an index on
the parent-key field.
</para>
<para>
It is important that the <parameter>branch_delim</parameter> string
not appear in any key values, else <function>connectby</function> may incorrectly
report an infinite-recursion error. Note that if
<parameter>branch_delim</parameter> is not provided, a default value
of <literal>~</literal> is used for recursion detection purposes.
<!-- That pretty well sucks. FIXME -->
</para>
<para>
Here is an example:
<programlisting>
CREATE TABLE connectby_tree(keyid text, parent_keyid text, pos int);
INSERT INTO connectby_tree VALUES('row1',NULL, 0);
INSERT INTO connectby_tree VALUES('row2','row1', 0);
INSERT INTO connectby_tree VALUES('row3','row1', 0);
INSERT INTO connectby_tree VALUES('row4','row2', 1);
INSERT INTO connectby_tree VALUES('row5','row2', 0);
INSERT INTO connectby_tree VALUES('row6','row4', 0);
INSERT INTO connectby_tree VALUES('row7','row3', 0);
INSERT INTO connectby_tree VALUES('row8','row6', 0);
INSERT INTO connectby_tree VALUES('row9','row5', 0);
-- with branch, without