0

This my trigger that will trigger if new value is inserted in origin.

I want to store the result of recursive to table(extract).

I get this error

ERROR: syntax error at or near "perform"
LINE 10: perform * from "test";
^
SQL state: 42601
Character: 221

BEGIN

WITH RECURSIVE "test" as

    (select "node_f", "node_2", "edge"
    from "con" where "node_f"= new."origin"
    union
    select O."node_f", O."node_2", O."edge"
    FROM "test" N
    JOIN "con" O on O."node_f" = N."node_2")
    
Select * from "test";

INSERT INTO "extract"
SELECT * FROM "test";

return new;
END;
3
  • Why are you using 4 obsolete versions? Commented Jul 17, 2022 at 13:56
  • The syntax error mentions perform. Where is that keyword in your code? Commented Jul 17, 2022 at 14:41
  • You have duplicated Select * from "test"; for some reason. Remove the first occurrence, the INSERT statement should be part of the WITH, not a separate statement (with a semicolon in between). Commented Jul 17, 2022 at 14:42

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.