0

I'm trying to work with AgensGraph extension in PostgreSQL, but I'm having trouble getting it to work. When I run the following queries:

SELECT * FROM cypher('graph_name', $$
     MATCH (a:Person), (b:Person)
     WHERE a.name = 'Node A' AND b.name = 'Node B'
     CREATE (a)-[e:RELTYPE {name:a.name + '<->' + b.name}]->(b)
     RETURN e
$$) as (e agtype);

SELECT * FROM cypher('graph_name', $$
     RETURN to_char(to_timestamp(timestamp() / 1000), 'Month DD, YYYY, HH:MI:SS')
$$) as (t agtype);

I get the following errors respectively:

ERROR:  function ag_catalog.age_to_timestamp(agtype) does not exist
LINE 3: RETURN to_char(to_timestamp(timestamp() / 1000), 'Month DD, ...
ERROR:  function cypher(unknown, unknown) does not exist
LINE 2: FROM cypher('graph', $$

When I check if AgensGraph is installed by running SELECT * FROM pg_extension WHERE extname = 'agensgraph';, I get no rows.I also tried to load the extension by running LOAD 'agensgraph';, but I get the following error:

ERROR:  could not access file "agensgraph": No such file or directory
What am I missing here? How can I properly install and use AgensGraph in PostgreSQL?

I'm trying to use the timestamp() function in my PostgreSQL database, but I'm getting an error message when I try to access it.I'm not sure why this error is happening, since timestamp() is a built-in function in PostgreSQL. What could be causing this error and how can I fix it?

Also, I'm trying to use the AgensGraph extension in my database, but it doesn't seem to be installed. When I run SELECT * FROM pg_extension WHERE extname = 'agensgraph';, I get no rows returned. And when I try to load the extension with LOAD 'agensgraph';, I get an error saying that the file could not be found.

What could be causing these issues and how can I resolve them?

3 Answers3

1

The error in the timestamp() part as to_timestamp() is not a valid cypher Function. For more details regarding the timestamp() function, you can check this Stack Overflow Question.

For installation of AgensGraph you can follow Bitnine guide

1

Firstly, there is no to_timestamp function in AGE currently. Secondly, make sure the extension is installed properly. You can check the list of installed extensions by typing the following in psql:

postgres=# \dx
                 List of installed extensions
  Name   | Version |   Schema   |         Description          
---------+---------+------------+------------------------------
 age     | 1.1.0   | ag_catalog | AGE database extension
 plpgsql | 1.0     | pg_catalog | PL/pgSQL procedural language

Lastly, make sure your path is SET correctly. The cypher function is not found because it is not native to postgres and must be looked up inside the ag_catalog schema.

SET search_path = ag_catalog, "$user", public;
moeed865
  • 304
  • 1
  • 6
0

If the graph is stored in a table nodes with a column data that contains the node properties, the exact SQL statement generated from the AGE query will be:

SELECT data FROM nodes;

This will retrieve all rows from nodes table and return the properties from the data colum.

Tito
  • 289
  • 8