-1

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');

6 Answers6

1

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');
0

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');
0

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.

0

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.

Omar Saad
  • 349
  • 3
  • 8
0

You don't have to use ag_catalog to use the create_graph() function if you already run SET search_path = ag_catalog, "$user", public;, you can simply run the following command without ag_catalog and it should work: SELECT * FROM create_graph('university');

ahmed_131313
  • 142
  • 6
0

You do not need to add the ag_catalog every time you make a query after setting the search_path. This is the correct syntax for creating a graph called university SELECT * FROM create_graph('university');