Closed pebbe closed 2 years ago
I cannot reproduce this issue. close it until responding. :(
-- github issue #507
CREATE (x:v1 {id: 'v1'})<-[r:rel]-();
MATCH (x:v1)
CREATE (x)-[r2:rel]->(x2);
CREATE FUNCTION udf_cypher_results() RETURNS RECORD AS $$
DECLARE
ret RECORD;
BEGIN
MATCH (x:v1 {id: 'v1'})<-[r:rel]-()
OPTIONAL MATCH (x)-[r2:rel]->(x2)
return x, r, x2, r2 INTO ret;
RETURN ret;
END;
$$ LANGUAGE plpgsql;
SELECT udf_cypher_results();
udf_cypher_results
------------------------------------------------------------------------------------------
("v1[6.1]{""id"": ""v1""}","rel[7.1][1.1,6.1]{}",ag_vertex[1.2]{},"rel[7.2][6.1,1.2]{}")
(1 row)
CREATE GRAPH udf_temp;
SET GRAPH_PATH to udf_temp;
SELECT udf_cypher_results();
ERROR: vertex label "v1" does not exist
CONTEXT: SQL statement "MATCH (x:v1 {id: 'v1'})<-[r:rel]-()
OPTIONAL MATCH (x)-[r2:rel]->(x2)
return x, r, x2, r2"
PL/pgSQL function udf_cypher_results() line 5 at SQL statement
DROP GRAPH udf_temp CASCADE;
NOTICE: drop cascades to 3 other objects
DETAIL: drop cascades to sequence udf_temp.ag_label_seq
drop cascades to vlabel ag_vertex
drop cascades to elabel ag_edge
In PostgreSQL I can write a function and in works on all datasets. Not so in AgensGraph, when you use match in the function.
So it looks like when you create a function, and use a match, then that match is linked to the current graph_path.
For illustration, here are the function and the query using the function, though you'd need the dataset, of course.