https://bugs.documentfoundation.org/show_bug.cgi?id=144694
--- Comment #23 from flywire <[email protected]> --- Created attachment 198125 --> https://bugs.documentfoundation.org/attachment.cgi?id=198125&action=edit Base Direct SQL test code Testing with https://www.sqlite.org/lang_with.html#controlling_depth_first_versus_breadth_first_search_of_a_tree_using_order_by See But if we change the ORDER BY clause to add the "DESC" modifier, that will cause lower levels in the organization (with larger "level" values) to be processed first by the recursive-select, resulting in a depth-first search: WITH RECURSIVE under_alice(name,level) AS ( VALUES('Alice',0) UNION ALL SELECT org.name, under_alice.level+1 FROM org JOIN under_alice ON org.boss=under_alice.name ORDER BY 2 DESC ) SELECT substr('..........',1,level*3) || name FROM under_alice; The output of this revised query is: Alice ...Bob ......Dave ......Emma ...Cindy ......Fred ......Gail -- You are receiving this mail because: You are the assignee for the bug.
