kysely
kysely copied to clipboard
Support for CYCLE
Hello,
I was wondering if it is possible to express the following query with Kysely:
WITH RECURSIVE blok_search AS (
-- Base case
SELECT *, 1 AS Depth
FROM bloks
WHERE id = 1
UNION ALL
-- Recursive case
SELECT i.*, c.Depth + 1
FROM bloks i
JOIN blok_search c ON
c.Depth < 3 AND
(
(c.type = 'headline' AND c."link" = i.id) OR
(c.type = 'headline' AND c."link2" = i.id) OR
(c.type = 'child' AND c.link = i.link)
)
) CYCLE id SET is_cycle USING path
SELECT * FROM blok_search WHERE is_cycle = FALSE;
This is what I got so far: Playground
I tried it with modifyEnd but could not place it at the right position:
WITH RECURSIVE
"blok_search" AS (...
) CYCLE id SET is_cycle USING path
Thank you
This is not currently supported.