WITH RECURSIVE traverse(parent_id, child_id, depth, PATH) AS
(SELECT first.parent_id,
first.child_id,
1 AS depth, ARRAY[first.parent_id] AS PATH
FROM flow_networks_networkedge AS FIRST
WHERE parent_id = 4269
UNION ALL SELECT first.parent_id,
first.child_id,
second.depth + 1 AS depth,
PATH || first.parent_id AS PATH
FROM flow_networks_networkedge AS FIRST,
traverse AS SECOND
WHERE first.parent_id = second.child_id
AND (first.parent_id <> ALL(second.path)) )
SELECT UNNEST(ARRAY[pkid]) AS pkid
FROM
(SELECT PATH || ARRAY[4215], depth
FROM traverse
WHERE child_id = 4215
AND depth <= 20
LIMIT 1) AS x(pkid);
ERROR: operator does not exist: bigint[] || integer[]
LINE 17: (SELECT PATH || ARRAY[4215], depth
^
HINT: No operator matches the given name and argument types. You might need to add explicit type casts.
SQL state: 42883
Character: 657