@staticmethod
def _traverse_cte(root, vpath_tuple):
    """ Version of the traverse method, that uses a CTE instead of the
        Node.path attribute.  Unfortunately this is **much** slower and works
        only on PostgreSQL.

        It **does** work, but is not used ATM.  Could be very useful to replace
        :func:`kotti.events._set_path_for_new_parent` and
        :func:`kotti.events._set_path_for_new_name` event handlers to handle
        everything on the database with a single call, instead of the expensive
        recursion maassacre we have right now.
        """
    raise NotImplementedError('Use the traverse method instead.')
    """
        # needed until we find out how to pass an empty array of type String
        # (i.e. 'VARCHAR[]') to the initial cte.

        vpath = ('', ) + vpath_tuple

        cte = DBSession.query(
                Node.id,
                # array([concat('', Node.name)]).label('path'))                 concat('', Node.name).label('path'))             .enable_eagerloads(False)             .filter(Node.parent_id == None)             .cte(name="n1", recursive=True)
        parent = aliased(cte, name='parent')
        child = aliased(Node, name='child')
        inner = DBSession.query(
                child.id,
                # (parent.c.path + array([concat('', child.name)])).label('path'))                 concat(parent.c.path, '/', child.name).label('path'))             .enable_eagerloads(False)             .filter(child.parent_id == parent.c.id)
        cte = cte.union_all(inner)
        conditions = [
            # (cte.c.path == array(vpath[:idx + 1]))
            (cte.c.path == '/'.join(vpath[:idx + 1]))
            for idx, item in enumerate(vpath)]
        ids = DBSession.query(Node.id.label('node_id'))             .select_entity_from(cte)             .filter(or_(*conditions))
        nodes = DBSession.query(Node).filter(Node.id.in_(ids)).order_by(Node.path).offset(1).all()
        for i, node in enumerate(nodes):
            if i == 0:
                setattr(node, 'parent', root)
            else:
                setattr(node, 'parent', nodes[i-1])
        return nodes
        """
