The cypher() function returns a relational table, so a cypher call can be used alongside other tables in a query like so:
SELECT *
FROM table1, cypher('cypher_query1');
The query above works as expected. However, if I call the cypher function twice, like:
SELECT *
FROM cypher('cypher_query1'), cypher('cypher_query2');
I get the following error:
ERROR: table name "cypher" specified more than once
Is there a workaround to this?
So it seems only 1 table and 1 Cypher query will work at the moment. The order doesn't matter (table, cypher() or cypher(), table). I do not know whether this is an intended design choice or not.
As for practical usage, I don't understand how what you are seeking would be useful? If you are looking to access another graph within your query you can already do that using JOIN.
SELECT * FROM cypher('graph1', $$
CREATE (c: Customer { user: 'gomeZ', tags: 'dev' })
$$) as (v agtype);
SELECT * FROM cypher('graph2', $$
CREATE (s: Queries { user: 'gomeZ', keywords: ['java', 'c', 'python'] })
$$) as (v agtype);
SELECT graph1.u, graph1.t, graph2.k
FROM cypher('graph1', $$
MATCH (c:Customer)
RETURN c.user, c.tags
$$) as graph1(u agtype, t agtype)
JOIN cypher('graph2', $$
MATCH (s:Queries)
RETURN s.user, s.keywords
$$) as graph2(u agtype, k agtype)
ON graph1.u = graph2.u;