skip to Main Content

I have done:

test=# SET search_path = ag_catalog, "$user", public;

But still I can not use create_graph function directly.

test=# create_graph('university');
ERROR:  syntax error at or near "create_graph"
LINE 1: create_graph('university');

Why I need to do this using ag_catalog:

test=# SELECT * FROM ag_catalog.create_graph('university');

4

Answers


  1. Your first query is incorrect because you are not using correct syntax.

    This will work

    new=# SELECT create_graph('university');
    NOTICE:  graph "university" has been created
     create_graph 
    --------------
     
    (1 row)
    

    but this will not

    new=# create_graph('university');
    ERROR:  syntax error at or near "create_graph"
    LINE 1: create_graph('university');
    
    Login or Signup to reply.
  2. You don’t to use the ag_catalog for every apacheAGE function that you use. You can just use :

    SELECT * FROM create_graph('graph');

    The reason you need SELECT * is to signify to the backend to give results to you, I believe all apacheAGE functions need that.

    Login or Signup to reply.
  3. You encountered a syntax error because you failed to use the SELECT statement, try modifying your query;

    SELECT create_graph('university');
    

    or

    SELECT * FROM create_graph('university');
    
    Login or Signup to reply.
  4. In the first query there is a syntax error it should be like that :

    SELECT * FROM ag_catalog.create_graph('graph_name');
    

    If you don’t want to write ag_catalog every time you execute a query than you should set search_path as follow:

    SET search_path to ag_catalog;
    

    This is because create_graph is present in ag_catalog namespace So, you need either to set namespace to ag_catalog using search_path or by adding ag_catalog. as a prefix of any function call in age.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search