Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE OR REPLACE PROCEDURE treeDown(INTEGER)
- LANGUAGE plpgsql
- AS $$
- DECLARE
- cur_childs CURSOR FOR select * from TreeRelation where von = $1 AND from < to;
- rec RECORD;
- BEGIN
- FOR rec IN cur_childs LOOP
- CALL treeDown(rec.to); -- seems to die here
- RAISE NOTICE '% is a child from %', rec.to, $1;
- end loop;
- END;
- $$;
- ...
- FOR rec IN (SELECT *
- FROM treerelation
- WHERE ...) LOOP
- ...
- -- 3 is our start node in this case
- WITH RECURSIVE test(s) AS (
- select to from TreeRelation where from = 3 AND from < to
- UNION
- select to from test, TreeRelation where from = test.s AND from < to
- ) select * from test;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement