skip to Main Content

In the following code, it’s a simple query that fetches nodes that has the specified relation

test=# SELECT *
FROM cypher('first_graph', $$
MATCH (a:Person)-[]->(b:Person) RETURN a.name, b.name
$$) as (v agtype);

When I ran the query I get the following error

ERROR:  return row and column definition list do not match
LINE 2: FROM cypher('first_graph', $$..
             ^

2

Answers


  1. When you are returning more than 1 columns from cypher query, you need to specify exact number of columns outside the query.

    test=# SELECT *
    FROM cypher('first_graph', $$
    MATCH (a:Person)-[]->(b:Person) RETURN a.name, b.name
    $$) as (v agtype, w agtype);
    

    The above query will work fine.

    Login or Signup to reply.
  2. You always need to add the same number of agtypes at the RETURN clause to match the RETURN values inside your cypher query

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