Recursive Query with cycles #1798
-
Hi all! We are using a recursive query correctly but in certain occasions the structures can be generated with cycles (the client is the one that generates this data). Is there any way to avoid these cycles with Blaze Persistence? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi there. One way to avoid cycles is to check in the recursive part of your query whether the path already contains the current element i.e. |
Beta Was this translation helpful? Give feedback.
-
Hi @beikov! |
Beta Was this translation helpful? Give feedback.
Hi there. One way to avoid cycles is to check in the recursive part of your query whether the path already contains the current element i.e.
where path not like concat('%', label, '/%')
. I think it should also be possible to useunion
instead ofunion all
to avoid duplicates.