I am trying to add support for the following query for an AGE project that converts Cypher queries to SQL:
MATCH p=({name: 'agens-graph'})-[{lang: 'java'}]->(m) RETURN *;
This successfully converts into the following:
SELECT * FROM cypher('test', $$ MATCH p=({name: 'agens-graph'})-[{lang: 'java'}]->(m) RETURN * $$) AS (v agtype);
However, this produces an error:
ERROR: return row and column definition list do not match
Assuming I do not know the exact columns that will be produced with the RETURN *
, is there a way to replace the AS (v agtype)
to something else that will support the query (something like AS (* agtype)
)? Or is this not yet supported in AGE?
2
Answers
As per the documentation of RETURN clause, even if you are using
RETURN *
, you need to define the number of columns to be returned by the cypher query and so any alike of* agtype
is not yet supported. For example:Reference: RETURN clause
We have to define what we are getting back as return expects a column number but you can use a placeholder value to keep it dynamic. It is usually advised to know the exact number.