1

I am trying to execute a Cypher query on my Apache AGE graph database using the cypher function in PostgreSQL, but I am encountering an error.

Here is the query I am trying to run:

SELECT * FROM cypher('g1', $$ MATCH (n) return n $$);

And here is the error message that I am getting:

ERROR:  function cypher(unknown, unknown) does not exist
LINE 1: SELECT * FROM cypher('g1', $$ MATCH (n) return n $$);
                      ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

I have already checked that I have installed the Apache AGE extension and added it to my database, and I am using the correct graph name (g1) in the query.

I double-checked and confirmed that the AGE extension is installed by running this query.

SELECT * FROM pg_extension WHERE extname = 'age';

How can I resolve this error and successfully execute my Cypher query in Apache AGE?

0

2 Answers 2

3

Firstly there is an error in your query, the correct query is

SELECT * FROM cypher('<enter_graph_name_here>', $$ MATCH (n) return n $$)
AS (result agtype);

The above command will only execute correctly if you have set the search_path as

SET search_path to ag_catalog;

If you do not set the search_path as above and it is public be default, then modify the first query as

SELECT * FROM ag_catalog.cypher('<enter_graph_name_here>', $$ MATCH (n) return n $$)
AS (result agtype);

This is because cypher function is present in ag_catalog namespace and you need to either set the namespace to ag_catalog using search_path or prefix all the function names with ag_catalog. in all the queries.

Sign up to request clarification or add additional context in comments.

Comments

0

I found it need to run sql "LOAD 'age';" first in Rails.

Comments

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.