                 AND "locations_sqllocation"."domain" = domain_name
                 AND "locations_sqllocation"."parent_id" IS NULL
             )
-            ORDER BY "locations_sqllocation"."tree_id" ASC, "locations_sqllocation"."lft" ASC
         )
 
         UNION ALL

                            SELECT U0."id"
                            FROM "locations_sqllocation" U0
                            WHERE U0."id" = ANY(user_location_ids_array)
                            ORDER BY U0."tree_id" ASC, U0."lft" ASC
                        )
                    )
                    ORDER BY "locations_sqllocation"."tree_id" ASC, "locations_sqllocation"."lft" ASC
                )
            )


                    "locations_sqllocation"."is_archived" = False
                    AND "locations_sqllocation"."id" = ("cte"."parent_id")
                )
            )
        )

